Skip to content

Commit fa1436c

Browse files
authored
fix: Update dependencies (#865)
* Update Babel * Update ESLint and config * Update Jest * Update Semantic Release * Other non-major updates * Fix lint * Update axios (0.21.1 -> 0.27.2) There are some breaking changes but none that affect us here. See https://github.com/axios/axios/blob/main/CHANGELOG.md#0270-april-25-2022 * Fix semver ranges for aws-sdk * Update GitHub Actions to use Node 14
1 parent 6ff4f78 commit fa1436c

17 files changed

Lines changed: 4812 additions & 6315 deletions

.eslintrc.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
root: true
22

33
extends:
4-
- '@comicrelief/eslint-config/mixins/base'
5-
- '@comicrelief/eslint-config/mixins/flowtype'
4+
- '@comicrelief/eslint-config'
65
- '@comicrelief/eslint-config/mixins/jsdoc'
7-
- '@comicrelief/eslint-config/mixins/sonarjs'
8-
- '@comicrelief/eslint-config/mixins/unicorn'
6+
7+
parser: '@babel/eslint-parser'
98

109
ignorePatterns:
1110
- node_modules
1211
- dist
1312
- coverage
13+
- babel.config.js
14+
15+
rules:
16+
unicorn/prefer-node-protocol: off

.github/workflows/main.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v2
1212

13-
- name: Use Node.js 12.x
14-
uses: actions/setup-node@v1
13+
- uses: actions/setup-node@v1
1514
with:
16-
node-version: 12.x
15+
node-version: 14
1716

1817
- name: Restore cache
1918
uses: actions/cache@v2
@@ -34,10 +33,9 @@ jobs:
3433
steps:
3534
- uses: actions/checkout@v2
3635

37-
- name: Use Node.js 12.x
38-
uses: actions/setup-node@v1
36+
- uses: actions/setup-node@v1
3937
with:
40-
node-version: 12.x
38+
node-version: 14
4139

4240
- name: Restore cache
4341
uses: actions/cache@v2

package.json

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,49 @@
44
"description": "Lambda wrapper for all Comic Relief Serverless Projects",
55
"main": "dist/index.js",
66
"scripts": {
7-
"lint": "yarn eslint .",
7+
"lint": "eslint src tests",
88
"test": "jest --coverage",
99
"build": "babel src --out-dir dist --copy-files",
1010
"prepublish": "yarn build"
1111
},
1212
"author": "Adam Clark",
1313
"license": "ISC",
1414
"devDependencies": {
15-
"@babel/cli": "^7.12.10",
16-
"@babel/core": "^7.12.10",
17-
"@babel/node": "^7.12.10",
18-
"@babel/plugin-syntax-flow": "^7.12.1",
19-
"@babel/plugin-transform-flow-strip-types": "^7.12.10",
20-
"@babel/preset-env": "^7.12.11",
21-
"@comicrelief/eslint-config": "^1.3.3",
22-
"@types/jest": "^26.0.20",
23-
"aws-sdk": ">=2.831.0",
24-
"babel-eslint": "^10.1.0",
25-
"babel-jest": "^26.3.3",
26-
"eslint": "^7.18.0",
27-
"jest": "^26.6.3",
15+
"@babel/cli": "^7.18.10",
16+
"@babel/core": "^7.18.10",
17+
"@babel/eslint-parser": "^7.18.9",
18+
"@babel/node": "^7.18.10",
19+
"@babel/plugin-syntax-flow": "^7.18.6",
20+
"@babel/plugin-transform-flow-strip-types": "^7.18.9",
21+
"@babel/plugin-transform-react-jsx": "^7.18.10",
22+
"@babel/preset-env": "^7.18.10",
23+
"@comicrelief/eslint-config": "^2.0.3",
24+
"@types/jest": "^28.1.6",
25+
"aws-sdk": "^2.1194.0",
26+
"babel-jest": "^28.1.3",
27+
"eslint": "^8.22.0",
28+
"eslint-plugin-flowtype": "^8.0.3",
29+
"eslint-plugin-import": "^2.25.2",
30+
"eslint-plugin-jsdoc": "^39.3.2",
31+
"eslint-plugin-sonarjs": "^0.13.0",
32+
"eslint-plugin-unicorn": "^42.0.0",
33+
"jest": "^28.1.3",
2834
"nyc": "^15.1.0",
29-
"semantic-release": "^17.3.7"
35+
"semantic-release": "^19.0.3"
3036
},
3137
"peerDependencies": {
32-
"aws-sdk": ">=2.831.0"
38+
"aws-sdk": "^2.831.0"
3339
},
3440
"dependencies": {
3541
"@sentry/node": "^6.0.1",
3642
"alai": "1.0.3",
37-
"async": "^3.2.0",
38-
"axios": "^0.21.1",
39-
"epsagon": "^1.104.2",
43+
"async": "^3.2.4",
44+
"axios": "^0.27.2",
45+
"epsagon": "^1.123.2",
4046
"useragent": "2.3.0",
41-
"uuid": "^8.2.0",
47+
"uuid": "^8.3.2",
4248
"validate.js": "0.13.1",
43-
"winston": "^3.3.3",
49+
"winston": "^3.8.1",
4450
"xml2js": "^0.4.23"
4551
}
4652
}

src/DependencyInjection/DependencyInjection.class.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,7 @@ export default class DependencyInjection {
9999
return true;
100100
}
101101

102-
if (process.env.USE_SERVERLESS_OFFLINE) {
103-
return true;
104-
}
105-
106-
return false;
102+
return !!process.env.USE_SERVERLESS_OFFLINE;
107103
}
108104

109105
/**

src/Model/SQS/MarketingPreference.model.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,14 @@ export default class MarketingPreference extends Model {
546546
const validation = validate(this.getEntityMappings(), requestConstraintsClone);
547547

548548
if (typeof validation === 'undefined') {
549-
return resolve();
549+
resolve();
550+
return;
550551
}
551552

552553
const validationErrorResponse = ERROR_TYPES.VALIDATION_ERROR;
553554
validationErrorResponse.setBodyVariable('validation_errors', validation);
554555

555-
return reject(validationErrorResponse);
556+
reject(validationErrorResponse);
556557
});
557558
}
558559
}

src/Service/Request.service.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export default class RequestService extends DependencyAwareClass {
7878
* @param {string} name The name of the header.
7979
* @param {string} [whenMissing] Value to return if the header is missing.
8080
* (default: empty string)
81-
*
8281
* @returns {string}
8382
*/
8483
getHeader(name: string, whenMissing: string = '') {

src/Service/SQS.service.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,11 @@ export default class SQSService extends DependencyAwareClass {
321321
await this.sqs.sendMessage(messageParameters).promise();
322322
}
323323
} catch (error) {
324-
switch (failureMode) {
325-
case SQS_PUBLISH_FAILURE_MODES.CATCH:
324+
if (failureMode === SQS_PUBLISH_FAILURE_MODES.CATCH) {
326325
container.get(DEFINITIONS.LOGGER).error(error);
327-
328326
return null;
329-
330-
case SQS_PUBLISH_FAILURE_MODES.THROW:
331-
default:
332-
throw error;
333327
}
328+
throw error;
334329
}
335330

336331
return queue;

src/Service/Timer.service.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default class TimerService extends DependencyAwareClass {
2222
* @param identifier
2323
*/
2424
start(identifier: string) {
25-
this.timers[identifier] = new Date().getTime();
25+
this.timers[identifier] = Date.now();
2626
}
2727

2828
/**
@@ -32,7 +32,7 @@ export default class TimerService extends DependencyAwareClass {
3232
*/
3333
stop(identifier: string) {
3434
if (typeof this.timers[identifier] !== 'undefined') {
35-
const duration = new Date().getTime() - this.timers[identifier];
35+
const duration = Date.now() - this.timers[identifier];
3636

3737
this.getContainer().get(DEFINITIONS.LOGGER).info(`Timing - ${identifier} took ${duration}ms to complete`);
3838
}

src/Wrapper/LambdaWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default (configuration, handler, throwError = false) => {
124124
// and not an error object directly
125125
// and will treat resolved errors as successful
126126
// as it will cast the error to JSON, i.e. `{}`
127-
return Promise.reject(handled);
127+
throw handled;
128128
}
129129

130130
return handled;

src/Wrapper/PromisifiedDelay.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const HIGH_LATENCY_DELAYS = {
1010
3500: 15,
1111
4000: 9,
1212
5000: 5,
13-
10000: 5,
14-
20000: 1,
13+
10_000: 5,
14+
20_000: 1,
1515
};
1616

1717
/**

0 commit comments

Comments
 (0)