зеркало из https://github.com/mozilla/fxa.git
refactor(event-broker): update deps, TS 3.7
Because: * Multiple dependencies were out of date. * TS 3.7 has some handy optional chaining. This commit: * Updates the out of date dependencies. * Uses TS 3.7 optional chaining were applicable.
This commit is contained in:
Родитель
e022740d01
Коммит
73f955d00a
|
@ -19,9 +19,9 @@ export class PubSubScheme {
|
|||
throw new Error('Invalid options for pubsub auth scheme');
|
||||
}
|
||||
const opts = options as PubSubOptions;
|
||||
this.audience = opts.audience || '';
|
||||
this.verificationToken = opts.verificationToken || '';
|
||||
this.verifyAuth = opts.authenticate || false;
|
||||
this.audience = opts.audience ?? '';
|
||||
this.verificationToken = opts.verificationToken ?? '';
|
||||
this.verifyAuth = opts.authenticate ?? false;
|
||||
}
|
||||
|
||||
public async authenticate(
|
||||
|
|
|
@ -39,7 +39,7 @@ export default function(
|
|||
auth: 'pubsub',
|
||||
handler: proxyController.proxyDelivery,
|
||||
validate: {
|
||||
payload: proxyPayloadValidator as hapiJoi.ObjectSchema
|
||||
payload: (proxyPayloadValidator as unknown) as hapiJoi.ObjectSchema
|
||||
}
|
||||
},
|
||||
path: '/v1/proxy/{clientId}'
|
||||
|
|
|
@ -43,7 +43,7 @@ class FirestoreDatastore implements Datastore {
|
|||
const doc = await document.get();
|
||||
if (doc.exists) {
|
||||
const data = doc.data();
|
||||
if (data && data.oauth_clients && data.oauth_clients[clientId]) {
|
||||
if (data?.oauth_clients?.[clientId]) {
|
||||
// Record is already in the database
|
||||
return;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ class FirestoreDatastore implements Datastore {
|
|||
const doc = await document.get();
|
||||
if (doc.exists) {
|
||||
const data = doc.data();
|
||||
if (data && data.oauth_clients) {
|
||||
if (data?.oauth_clients) {
|
||||
return Object.keys(data.oauth_clients);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ function getValue(name: string, command: string): string {
|
|||
readJson(path.resolve(__dirname, '..', 'version.json')) ||
|
||||
readJson(path.resolve(__dirname, '..', '..', 'version.json'));
|
||||
|
||||
if (value && value.version) {
|
||||
if (value?.version?.[name]) {
|
||||
return value.version[name];
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ function getValue(name: string, command: string): string {
|
|||
/* ignore */
|
||||
}
|
||||
|
||||
return stdout && stdout.toString().trim();
|
||||
return stdout?.toString().trim();
|
||||
}
|
||||
|
||||
interface Version {
|
||||
|
@ -66,7 +66,7 @@ function getVersionInfo(): Version {
|
|||
return {
|
||||
commit,
|
||||
source,
|
||||
version: packageInfo && packageInfo.version
|
||||
version: packageInfo?.version
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -31,49 +31,48 @@
|
|||
"@google-cloud/firestore": "^2.6.0",
|
||||
"@google-cloud/pubsub": "^1.1.5",
|
||||
"@hapi/hapi": "^18.4.0",
|
||||
"@hapi/joi": "^15.0.3",
|
||||
"@sentry/node": "^5.7.1",
|
||||
"aws-sdk": "^2.459.0",
|
||||
"convict": "^5.0.0",
|
||||
"@hapi/joi": "^16.1.7",
|
||||
"@sentry/node": "^5.8.0",
|
||||
"aws-sdk": "^2.569.0",
|
||||
"convict": "^5.2.0",
|
||||
"fxa-jwtool": "^0.7.2",
|
||||
"google-auth-library": "^5.5.1",
|
||||
"hot-shots": "^6.4.1",
|
||||
"hot-shots": "^6.8.1",
|
||||
"mozlog": "^2.2.0",
|
||||
"request": "^2.88.0",
|
||||
"request-promise-native": "^1.0.7",
|
||||
"sqs-consumer": "^5.2.0",
|
||||
"request-promise-native": "^1.0.8",
|
||||
"sqs-consumer": "^5.4.0",
|
||||
"typesafe-joi": "^2.0.6",
|
||||
"typesafe-node-firestore": "^1.0.0"
|
||||
"typesafe-node-firestore": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/chance": "^1.0.4",
|
||||
"@types/chai": "^4.2.4",
|
||||
"@types/chance": "^1.0.7",
|
||||
"@types/convict": "^4.2.1",
|
||||
"@types/hapi__hapi": "^18.2.3",
|
||||
"@types/mocha": "^5.2.6",
|
||||
"@types/nock": "^10.0.3",
|
||||
"@types/node": "^12.0.2",
|
||||
"@types/request-promise-native": "^1.0.16",
|
||||
"@types/sinon": "^7.0.11",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"@types/hapi__hapi": "^18.2.6",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^12.12.7",
|
||||
"@types/request-promise-native": "^1.0.17",
|
||||
"@types/sinon": "^7.5.0",
|
||||
"@types/uuid": "^3.4.6",
|
||||
"audit-filter": "^0.5.0",
|
||||
"chai": "^4.2.0",
|
||||
"chance": "^1.0.18",
|
||||
"chance": "^1.1.3",
|
||||
"eslint-plugin-fxa": "git+https://github.com/mozilla/eslint-plugin-fxa.git#master",
|
||||
"factory-bot-ts": "^0.1.5",
|
||||
"mocha": "^6.1.4",
|
||||
"nock": "^10.0.6",
|
||||
"nodemon": "^1.19.3",
|
||||
"mocha": "^6.2.2",
|
||||
"nock": "^11.7.0",
|
||||
"nodemon": "^1.19.4",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"p-event": "^4.1.0",
|
||||
"prettier": "^1.17.1",
|
||||
"sinon": "^7.3.2",
|
||||
"ts-node": "^8.1.0",
|
||||
"ts-sinon": "^1.0.17",
|
||||
"tslint": "^5.16.0",
|
||||
"prettier": "^1.19.1",
|
||||
"sinon": "^7.5.0",
|
||||
"ts-node": "^8.5.0",
|
||||
"ts-sinon": "^1.0.24",
|
||||
"tslint": "^5.20.1",
|
||||
"tslint-config-prettier": "^1.18.0",
|
||||
"tslint-plugin-prettier": "^2.0.1",
|
||||
"typescript": "^3.5.1",
|
||||
"uuid": "^3.3.2"
|
||||
"typescript": "^3.7.2",
|
||||
"uuid": "^3.3.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ describe('Proxy Controller', () => {
|
|||
.post('/webhook')
|
||||
.reply(200, '', {
|
||||
'X-AUTH': (req, res, body) => {
|
||||
return req.headers.authorization;
|
||||
const auth = req.getHeader('authorization');
|
||||
return typeof auth === 'string' ? auth : 'unknown';
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче