Merge pull request #15121 from mozilla/fxa-5948-esbuild

chore(deps): upgrade esbuild to 0.17.15
This commit is contained in:
Barry Chen 2023-04-07 07:13:03 -07:00 коммит произвёл GitHub
Родитель 2f3431da1b b41e7756e8
Коммит bf0c4faeb0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
138 изменённых файлов: 497 добавлений и 431 удалений

Просмотреть файл

@ -76,7 +76,7 @@
"@types/yargs": "^17.0.0",
"audit-filter": "^0.5.0",
"chance": "^1.1.8",
"esbuild": "^0.14.2",
"esbuild": "^0.17.15",
"esbuild-register": "^3.2.0",
"eslint": "^8.18.0",
"jest": "29.3.1",

Просмотреть файл

@ -38,7 +38,7 @@
"@types/node-fetch": "^2.5.7",
"@types/prettier": "^2",
"asmcrypto.js": "^0.22.0",
"esbuild": "^0.14.2",
"esbuild": "^0.17.15",
"esbuild-register": "^3.2.0",
"fast-text-encoding": "^1.0.4",
"mocha": "^10.0.0",

Просмотреть файл

@ -4,7 +4,7 @@
'use strict';
const config = require('../config');
const { config } = require('../config');
// Must be required and initialized right away
const TracingProvider = require('fxa-shared/tracing/node-tracing');
@ -155,7 +155,9 @@ async function run(config) {
const Password = require('../lib/crypto/password')(log, config);
const Customs = require('../lib/customs')(log, error, statsd);
const customs = new Customs(config.customsUrl);
const zendeskClient = require('../lib/zendesk-client')(config);
const zendeskClient = require('../lib/zendesk-client').createZendeskClient(
config
);
const routes = require('../lib/routes')(
log,
serverPublicKeys,

Просмотреть файл

@ -2106,4 +2106,5 @@ if (convictConf.get('isProduction')) {
export type conf = typeof convictConf;
export type ConfigType = ReturnType<conf['getProperties']>;
module.exports = convictConf;
export { convictConf as config };
export default convictConf;

Просмотреть файл

@ -6,7 +6,7 @@
const Joi = require('joi');
const createBackendServiceAPI = require('./backendService');
const config = require('../config');
const { config } = require('../config');
const localizeTimestamp = require('fxa-shared').l10n.localizeTimestamp({
supportedLanguages: config.get('i18n').supportedLanguages,
defaultLanguage: config.get('i18n').defaultLanguage,

Просмотреть файл

@ -12,7 +12,9 @@ const error = require('./error');
const oauthDB = require('./oauth/db');
const { DISPLAY_SAFE_UNICODE_WITH_NON_BMP, HEX_STRING, URL_SAFE_BASE_64 } =
validators;
const PUSH_SERVER_REGEX = require('../config').get('push.allowedServerRegex');
const PUSH_SERVER_REGEX = require('../config').default.get(
'push.allowedServerRegex'
);
const { synthesizeClientName } = require('fxa-shared/connected-services');
const SCHEMA = {

Просмотреть файл

@ -6,7 +6,7 @@
const ROOT_DIR = '../../..';
const config = require(`${ROOT_DIR}/config`);
const { config } = require(`${ROOT_DIR}/config`);
const emailDomains = require(`${ROOT_DIR}/config/popular-email-domains`);
const { default: Container } = require('typedi');
const { AccountEventsManager } = require('../../account-events');

Просмотреть файл

@ -4,7 +4,7 @@
'use strict';
const config = require('../config').get('geodb');
const config = require('../config').default.get('geodb');
const geodb = require('fxa-geodb')(config);
const ACCURACY_MAX_KM = 200;
const ACCURACY_MIN_KM = 25;

Просмотреть файл

@ -7,7 +7,7 @@
const EventEmitter = require('events').EventEmitter;
const util = require('util');
const mozlog = require('mozlog');
const config = require('../config');
const { config } = require('../config');
const logConfig = config.get('log');
const amplitudeConfig = config.get('amplitude');
const validateAmplitudeEvent = require('fxa-shared').metrics.amplitude.validate;

Просмотреть файл

@ -9,7 +9,7 @@
* to send notifications to Amazon SNS/SQS.
*/
const AWS = require('aws-sdk');
const config = require('../config');
const { config } = require('../config');
const notifierSnsTopicArn = config.get('snsTopicArn');
const notifierSnsTopicEndpoint = config.get('snsTopicEndpoint');

Просмотреть файл

@ -25,7 +25,7 @@ const Joi = require('joi');
const validators = require('./validators');
const OauthError = require('./error');
const config = require('../../config');
const { config } = require('../../config');
const { verifyJWT } = require('../../lib/serverJWT');
const HEX_STRING = /^[0-9a-f]+$/;

Просмотреть файл

@ -9,7 +9,7 @@ const token = require('./token');
const validators = require('./validators');
const WHITELIST = require('../../config')
.get('oauthServer.admin.whitelist')
.default.get('oauthServer.admin.whitelist')
.map(function (re) {
return new RegExp(re);
});

Просмотреть файл

@ -4,7 +4,7 @@
const unique = require('../unique');
const encrypt = require('fxa-shared/auth/encrypt');
const config = require('../../../config');
const { config } = require('../../../config');
const MAX_TTL = config.get('oauthServer.expiration.accessToken');
const { AccessToken } = require('fxa-shared/db/models/auth/access-token');

Просмотреть файл

@ -4,7 +4,7 @@
const hex = require('buf').to.hex;
const config = require('../../../config');
const { config } = require('../../../config');
const encrypt = require('fxa-shared/auth/encrypt');
const mysql = require('./mysql');
const redis = require('./redis');

Просмотреть файл

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const config = require('../../../config');
const { config } = require('../../../config');
const redis = require('../../redis');
const { ConnectedServicesCache } = require('fxa-shared/connected-services');
const { AuthLogger } = require('../../types');

Просмотреть файл

@ -7,7 +7,7 @@ const hex = require('buf').to.hex;
const { Container } = require('typedi');
const { CapabilityService } = require('../payments/capability');
const config = require('../../config');
const { config } = require('../../config');
const OauthError = require('./error');
const db = require('./db');
const util = require('./util');

Просмотреть файл

@ -5,7 +5,7 @@
const jsonwebtoken = require('jsonwebtoken');
const { publicPEM, SIGNING_PEM, SIGNING_KID, SIGNING_ALG } = require('./keys');
const config = require('../../config');
const { config } = require('../../config');
const ISSUER = config.get('oauthServer.openid.issuer');
const jwtverify = require('util').promisify(jsonwebtoken.verify);

Просмотреть файл

@ -7,7 +7,7 @@ const OauthError = require('./error');
const jwt = require('./jwt');
const sub = require('./jwt_sub');
const { OAUTH_SCOPE_OLD_SYNC } = require('fxa-shared/oauth/constants');
const config = require('../../config');
const { config } = require('../../config');
const TOKEN_SERVER_URL = config.get('syncTokenserverUrl');
const HEADER_TYP = 'at+JWT';

Просмотреть файл

@ -4,7 +4,7 @@
const hex = require('buf').to.hex;
const hkdf = require('../../lib/crypto/hkdf');
const config = require('../../config');
const { config } = require('../../config');
const validators = require('./validators');
const PPID_ENABLED = config.get('oauthServer.ppid.enabled');

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const assert = require('assert');
const config = require('../../config');
const { config } = require('../../config');
const { jwk2pem, pem2jwk } = require('pem-jwk');
const crypto = require('crypto');
const Joi = require('joi');

Просмотреть файл

@ -5,7 +5,7 @@
const ScopeSet = require('fxa-shared').oauth.scopes;
const OauthError = require('./error');
const config = require('../../config');
const { config } = require('../../config');
const db = require('./db');
const encrypt = require('fxa-shared/auth/encrypt');
const JWTAccessToken = require('./jwt_access_token');

Просмотреть файл

@ -4,7 +4,7 @@
const crypto = require('crypto');
const config = require('../../config');
const { config } = require('../../config');
function unique(length) {
return crypto.randomBytes(length); // eslint-disable-line fxa/async-crypto-random

Просмотреть файл

@ -7,7 +7,7 @@ const Joi = require('joi');
const ScopeSet = require('fxa-shared').oauth.scopes;
const authServerValidators = require('../routes/validators');
const config = require('../../config');
const { config } = require('../../config');
exports.HEX_STRING = /^(?:[0-9a-f]{2})+$/;
exports.B64URL_STRING = /^[A-Za-z0-9-_]+$/;

Просмотреть файл

@ -11,7 +11,8 @@ import { configureSentry } from '../sentry';
import { AppConfig, AuthFirestore, AuthLogger, ProfileClient } from '../types';
import { StripeHelper } from './stripe';
const config = require('../../config').getProperties();
import convictConf from '../../config';
const config = convictConf.getProperties();
export async function setupProcessingTaskObjects(processName: string) {
configureSentry(undefined, config, processName);

Просмотреть файл

@ -2074,8 +2074,3 @@ export const accountRoutes = (
return routes;
};
module.exports = {
accountRoutes,
AccountHandler,
};

Просмотреть файл

@ -161,7 +161,7 @@ module.exports = function (
customs,
mailer
);
const subscriptions = require('./subscriptions')(
const subscriptions = require('./subscriptions').default(
log,
db,
config,

Просмотреть файл

@ -347,7 +347,7 @@ export const linkedAccountRoutes = (
];
};
module.exports = {
export default {
linkedAccountRoutes,
LinkedAccountHandler,
};

Просмотреть файл

@ -33,7 +33,7 @@ function isLocalHost(url) {
module.exports = ({ log, oauthDB, config }) => {
if (!config) {
config = require('../../../config').getProperties();
config = require('../../../config').default.getProperties();
}
const MAX_TTL_S = config.oauthServer.expiration.accessToken / 1000;

Просмотреть файл

@ -5,7 +5,7 @@
const Joi = require('joi');
const OauthError = require('../../oauth/error');
const AuthError = require('../../error');
const config = require('../../../config').getProperties();
const config = require('../../../config').default.getProperties();
const validators = require('../../oauth/validators');
const verifyAssertion = require('../../oauth/assertion');
const { validateRequestedGrant } = require('../../oauth/grant');

Просмотреть файл

@ -36,7 +36,7 @@ const {
OAUTH_SCOPE_OLD_SYNC,
OAUTH_SCOPE_SESSION_TOKEN,
} = require('fxa-shared/oauth/constants');
const config = require('../../../config');
const { config } = require('../../../config');
const encrypt = require('fxa-shared/auth/encrypt');
const util = require('../../oauth/util');
const oauthRouteUtils = require('../utils/oauth');

Просмотреть файл

@ -18,7 +18,7 @@ import { stripeWebhookRoutes } from './stripe-webhook';
import { supportRoutes } from './support';
import { handleAuth } from './utils';
const createRoutes = (
export const createRoutes = (
log: AuthLogger,
db: any,
config: ConfigType,
@ -104,7 +104,5 @@ const createRoutes = (
return routes;
};
module.exports = createRoutes;
module.exports.DirectStripeRoutes = StripeHandler;
module.exports.handleAuth = handleAuth;
module.exports.sanitizePlans = sanitizePlans;
export default createRoutes;
export { handleAuth, sanitizePlans, StripeHandler as DirectStripeRoutes };

Просмотреть файл

@ -57,7 +57,3 @@ export const deleteAccountIfUnverified = async (
}
}
};
module.exports = {
deleteAccountIfUnverified,
};

Просмотреть файл

@ -4,7 +4,7 @@
'use strict';
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const Hoek = require('@hapi/hoek');
const Sentry = require('@sentry/node');
const { ExtraErrorData } = require('@sentry/integrations');

Просмотреть файл

@ -32,5 +32,3 @@ export const createZendeskClient = (config: Record<string, any>) => {
return zendeskClient;
};
module.exports = createZendeskClient;

Просмотреть файл

@ -176,7 +176,7 @@
"binary-split": "1.0.5",
"chai": "^4.3.6",
"chai-as-promised": "^7.1.1",
"esbuild": "^0.14.2",
"esbuild": "^0.17.15",
"esbuild-register": "^3.2.0",
"eslint": "^7.32.0",
"fxa-shared": "workspace:*",

Просмотреть файл

@ -19,7 +19,7 @@
const fs = require('fs');
const assert = require('assert');
const keys = require('../lib/oauth/keys');
const config = require('../config');
const { config } = require('../config');
function main(cb) {
cb = cb || (() => {});

Просмотреть файл

@ -5,7 +5,7 @@
'use strict';
const chunk = require('lodash.chunk');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const readUserRecords = require('./read-user-records');
const sendEmailBatches = require('./send-email-batches');
const Senders = require('../../lib/senders');

Просмотреть файл

@ -62,7 +62,7 @@ async function init() {
// Use local firestore
process.env.AUTH_FIRESTORE_EMULATOR_HOST = 'localhost:9090';
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const log = require('../lib/log')(config.log.level);
Container.set(AppConfig, config);

Просмотреть файл

@ -29,7 +29,7 @@ const {
ProfileClient,
} = require('../lib/types');
const readline = require('readline');
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const log = require('../lib/log')(config.log.level);
const Token = require('../lib/tokens')(log, config);
const mailer = null;

Просмотреть файл

@ -7,7 +7,7 @@
const pick = require('lodash.pick');
module.exports = function dumpUsers(keys, dbFunc, usePretty) {
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const log = {
error: (msg) => {},
info: (msg) => {},

Просмотреть файл

@ -7,7 +7,7 @@
const ROOT_DIR = '..';
const LIB_DIR = `${ROOT_DIR}/lib`;
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const log = require(`${ROOT_DIR}/test/mocks`).mockLog();
const redis = require(`${LIB_DIR}/redis`)(
{ ...config.redis, ...config.redis.email },

Просмотреть файл

@ -6,7 +6,7 @@
const program = require('commander');
const pckg = require('../package.json');
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const StatsD = require('hot-shots');
const { Container } = require('typedi');
const { AppConfig, AuthLogger } = require('../lib/types');

Просмотреть файл

@ -32,7 +32,7 @@ if (!process.env.NODE_ENV) {
process.env.NODE_ENV = 'dev';
}
const config = require('../config');
const { config } = require('../config');
const pubKeyFile = config.get('publicKeyFile');
const secretKeyFile = config.get('secretKeyFile');

Просмотреть файл

@ -28,7 +28,7 @@ if (!process.env.NODE_ENV) {
process.env.NODE_ENV = 'dev';
}
const config = require('../config');
const { config } = require('../config');
const vapidKeysFile = config.get('vapidKeysFile');
const fileExists = fs.existsSync(vapidKeysFile);

Просмотреть файл

@ -6,7 +6,7 @@
module.exports = async function main(items, dbFunction) {
const butil = require('../../lib/crypto/butil');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const crypto = require('crypto');
const log = require('../../lib/log')({});
const Token = require('../../lib/tokens')(log, config);

Просмотреть файл

@ -32,7 +32,7 @@ process.env.FXA_OPENID_UNSAFELY_ALLOW_MISSING_ACTIVE_KEY = true;
const fs = require('fs');
const path = require('path');
const keys = require('../lib/oauth/keys');
const config = require('../config');
const { config } = require('../config');
function writeJSONFile(filePath, data) {
try {

Просмотреть файл

@ -14,7 +14,7 @@ import { PaypalProcessor } from '../lib/payments/paypal/processor';
import { setupProcessingTaskObjects } from '../lib/payments/processing-tasks-setup';
const pckg = require('../package.json');
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const PAYPAL_PROCESSOR_LOCK = 'fxa-paypal-processor-lock';
const DEFAULT_LOCK_DURATION_MS = 300000;

Просмотреть файл

@ -13,7 +13,7 @@ import { PayPalHelper } from '../lib/payments/paypal/helper';
import { STRIPE_INVOICE_METADATA, StripeHelper } from '../lib/payments/stripe';
import { configureSentry } from '../lib/sentry';
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
class PayPalFixer {
private stripe: stripe;

Просмотреть файл

@ -10,7 +10,7 @@ import { FirestorePopulator } from './populate-firestore-customers/firestore-pop
const pckg = require('../package.json');
export async function init() {
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
program
.version(pckg.version)

Просмотреть файл

@ -18,7 +18,7 @@
const fs = require('fs');
const assert = require('assert');
const keys = require('../lib/oauth/keys');
const config = require('../config');
const { config } = require('../config');
function main(cb) {
cb = cb || (() => {});

Просмотреть файл

@ -10,7 +10,7 @@ const DEFAULT_TTL_MS = 900000;
export async function init() {
// Setup utilities
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const statsd = new StatsD({ ...config.statsd, maxBufferSize: 0 });
const log = require('../lib/log')(
config.log.level,

Просмотреть файл

@ -23,7 +23,7 @@ function parseDuration(duration: string | number) {
return moment.duration(...duration.split(/\s|-/)).asMilliseconds();
}
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const statsd = new StatsD(config.statsd);
const log = require('../lib/log')(config.log.level, 'prune-tokens', statsd);

Просмотреть файл

@ -12,7 +12,7 @@
//import { setupProcessingTaskObjects } from '../lib/payments/processing-tasks-setup';
//import { StripeHelper } from '../lib/payments/stripe';
//import { reportSentryError } from '../lib/sentry';
//const config = require('../config').getProperties();
//const config = require('../config').default.getProperties();
// export async function retreiveUnverifiedAccounts(
// database: any

Просмотреть файл

@ -16,7 +16,7 @@
//eslint-disable no-console
const fs = require('fs');
const config = require('../config');
const { config } = require('../config');
// We don't use this, but we load it to check key config.
require('../lib/oauth/keys');

Просмотреть файл

@ -10,7 +10,7 @@ import { setupProcessingTaskObjects } from '../lib/payments/processing-tasks-set
import { SubscriptionReminders } from '../lib/payments/subscription-reminders';
const pckg = require('../package.json');
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const DEFAULT_PLAN_LENGTH = 180;
const DEFAULT_REMINDER_LENGTH = 14;

Просмотреть файл

@ -8,7 +8,7 @@
const path = require('path');
const spawn = require('child_process').spawn;
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const TestServer = require('../test/test_server');
TestServer.start(config, false).then((server) => {

Просмотреть файл

@ -18,7 +18,7 @@
const ROOT_DIR = '..';
const LIB_DIR = `${ROOT_DIR}/lib`;
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const error = require(`${LIB_DIR}/error`);
const log = require(`${LIB_DIR}/log`)(config.log);

Просмотреть файл

@ -86,7 +86,7 @@ module.exports = (config) => {
if (!ignoreCors && allowedOrigin) {
// Requiring config outside this condition causes the local tests to fail
// because tokenLifetimes.passwordChangeToken is -1
const config = require('../../config');
const { config } = require('../../config');
const corsOrigin = config.get('corsOrigin');
if (corsOrigin.indexOf(allowedOrigin) < 0) {
return reject(

Просмотреть файл

@ -5,7 +5,7 @@
'use strict';
const { assert } = require('chai');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const { mockDB, mockLog } = require('../mocks');
const { PushManager } = require('../push_helper');

Просмотреть файл

@ -5,7 +5,7 @@ const { default: Container } = require('typedi');
const sinon = require('sinon');
process.env.CONFIG_FILES = require.resolve('./oauth-test.json');
const config = require('../../config');
const { config } = require('../../config');
const version = config.get('oauthServer.api.version');
config.set('log.level', 'critical');
const testConfig = config.getProperties();

Просмотреть файл

@ -7,7 +7,7 @@
const ROOT_DIR = '../..';
const assert = require('assert');
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const createBounces = require(`${ROOT_DIR}/lib/bounces`);
const error = require(`${ROOT_DIR}/lib/error`);
const sinon = require('sinon');

Просмотреть файл

@ -12,7 +12,7 @@ const EXPECTED_CREATE_DELETE_RESULT = REMINDERS.reduce((expected, reminder) => {
}, {});
const { assert } = require('chai');
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const mocks = require('../mocks');
describe('lib/cad-reminders', () => {

Просмотреть файл

@ -10,7 +10,7 @@ const { assert } = require('chai');
const mocks = require('../mocks');
const proxyquire = require('proxyquire');
const sinon = require('sinon');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const models = {
Device: {

Просмотреть файл

@ -14,13 +14,15 @@ describe('geodb', () => {
it('returns location data when enabled', () => {
const moduleMocks = {
'../config': {
get: function (item) {
if (item === 'geodb') {
return {
enabled: true,
locationOverride: {},
};
}
default: {
get: function (item) {
if (item === 'geodb') {
return {
enabled: true,
locationOverride: {},
};
}
},
},
},
};
@ -45,12 +47,14 @@ describe('geodb', () => {
it('returns empty object data when disabled', () => {
const moduleMocks = {
'../config': {
get: function (item) {
if (item === 'geodb') {
return {
enabled: false,
};
}
default: {
get: function (item) {
if (item === 'geodb') {
return {
enabled: false,
};
}
},
},
},
};

Просмотреть файл

@ -59,23 +59,25 @@ describe('log', () => {
mockAmplitudeConfig.schemaValidation = true;
mocks = {
'../config': {
get(name) {
switch (name) {
case 'log':
return {
fmt: 'mozlog',
};
case 'amplitude':
return mockAmplitudeConfig;
case 'domain':
return 'example.com';
case 'oauth.clientIds':
return {
clientid: 'human readable name',
};
default:
throw new Error(`unexpected config get: ${name}`);
}
config: {
get(name) {
switch (name) {
case 'log':
return {
fmt: 'mozlog',
};
case 'amplitude':
return mockAmplitudeConfig;
case 'domain':
return 'example.com';
case 'oauth.clientIds':
return {
clientid: 'human readable name',
};
default:
throw new Error(`unexpected config get: ${name}`);
}
},
},
},
// These need to be `function` functions, not arrow functions,

Просмотреть файл

@ -26,10 +26,12 @@ describe('notifier', () => {
beforeEach(() => {
config = {
get: (key) => {
if (key === 'snsTopicArn') {
return 'arn:aws:sns:us-west-2:927034868275:foo';
}
config: {
get: (key) => {
if (key === 'snsTopicArn') {
return 'arn:aws:sns:us-west-2:927034868275:foo';
}
},
},
};
@ -146,10 +148,12 @@ describe('notifier', () => {
it('works with disabled configuration', () => {
const config = {
get: (key) => {
if (key === 'snsTopicArn') {
return 'disabled';
}
config: {
get: (key) => {
if (key === 'snsTopicArn') {
return 'disabled';
}
},
},
};
const notifier = proxyquire(`${ROOT_DIR}/lib/notifier`, {

Просмотреть файл

@ -38,7 +38,7 @@ async function deleteQueryBatch(db, query, resolve) {
});
}
export async function deleteCollection(db, collectionRef, batchSize) {
async function deleteCollection(db, collectionRef, batchSize) {
const query = collectionRef.orderBy('__name__').limit(batchSize);
return new Promise((resolve, reject) => {
@ -46,4 +46,4 @@ export async function deleteCollection(db, collectionRef, batchSize) {
});
}
module.exports.deepCopy = deepCopy;
module.exports = { deepCopy, deleteCollection };

Просмотреть файл

@ -7,7 +7,7 @@
const { assert } = require('chai');
const AccessToken = require('../../lib/oauth/db/accessToken');
const RefreshTokenMetadata = require('../../lib/oauth/db/refreshTokenMetadata');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const mocks = require('../mocks');
const recordLimit = 20;

Просмотреть файл

@ -216,7 +216,9 @@ describe('update zendesk primary email', () => {
productNameFieldId: '192837465',
},
};
zendeskClient = require('../../../lib/zendesk-client')(config);
zendeskClient = require('../../../lib/zendesk-client').createZendeskClient(
config
);
searchSpy = sinon.spy(zendeskClient.search, 'queryAll');
listSpy = sinon.spy(zendeskClient.useridentities, 'list');
updateSpy = sinon.spy(zendeskClient, 'updateIdentity');

Просмотреть файл

@ -4,6 +4,7 @@
'use strict';
const proxyquire = require('proxyquire');
const sinon = require('sinon');
const { Container } = require('typedi');
const assert = { ...sinon.assert, ...require('chai').assert };
@ -22,7 +23,14 @@ const openInvoice = require('../../payments/fixtures/stripe/invoice_open.json');
const { filterSubscription } = require('fxa-shared/subscriptions/stripe');
const { CurrencyHelper } = require('../../../../lib/payments/currencies');
const { AuthLogger, AppConfig } = require('../../../../lib/types');
const buildRoutes = require('../../../../lib/routes/subscriptions');
const deleteAccountIfUnverifiedStub = sinon.stub();
const buildRoutes = proxyquire('../../../../lib/routes/subscriptions', {
'./paypal': proxyquire('../../../../lib/routes/subscriptions/paypal', {
'../utils/account': {
deleteAccountIfUnverified: deleteAccountIfUnverifiedStub,
},
}),
}).default;
const ACCOUNT_LOCALE = 'en-US';
const { OAUTH_SCOPE_SUBSCRIPTIONS } = require('fxa-shared/oauth/constants');
@ -37,7 +45,6 @@ const { PlayBilling } = require('../../../../lib/payments/iap/google-play');
const TEST_EMAIL = 'test@email.com';
const UID = uuid.v4({}, Buffer.alloc(16)).toString('hex');
const MOCK_SCOPES = ['profile:email', OAUTH_SCOPE_SUBSCRIPTIONS];
const accountUtils = require('../../../../lib/routes/utils/account.ts');
const {
SubscriptionEligibilityResult,
} = require('fxa-shared/subscriptions/types');
@ -282,9 +289,8 @@ describe('subscriptions payPalRoutes', () => {
stripeHelper.fetchCustomer = sinon.fake.throws(
error.backendServiceFailure()
);
const deleteAccountIfUnverifiedStub = sandbox
.stub(accountUtils, 'deleteAccountIfUnverified')
.returns(null);
deleteAccountIfUnverifiedStub.reset();
deleteAccountIfUnverifiedStub.returns(null);
try {
await runTest('/oauth/subscriptions/active/new-paypal', {
@ -306,9 +312,8 @@ describe('subscriptions payPalRoutes', () => {
stripeHelper.fetchCustomer = sinon.fake.throws(
error.backendServiceFailure()
);
const deleteAccountIfUnverifiedStub = sandbox
.stub(accountUtils, 'deleteAccountIfUnverified')
.throws(error.accountExists(null));
deleteAccountIfUnverifiedStub.reset();
deleteAccountIfUnverifiedStub.throws(error.accountExists(null));
try {
await runTest('/oauth/subscriptions/active/new-paypal', {
@ -330,9 +335,10 @@ describe('subscriptions payPalRoutes', () => {
stripeHelper.fetchCustomer = sinon.fake.throws(
error.backendServiceFailure()
);
const deleteAccountIfUnverifiedStub = sandbox
.stub(accountUtils, 'deleteAccountIfUnverified')
.throws(error.verifiedSecondaryEmailAlreadyExists());
deleteAccountIfUnverifiedStub.reset();
deleteAccountIfUnverifiedStub.throws(
error.verifiedSecondaryEmailAlreadyExists()
);
try {
await runTest('/oauth/subscriptions/active/new-paypal', {
@ -343,6 +349,7 @@ describe('subscriptions payPalRoutes', () => {
'Create subscription with wrong planCurrency should fail.'
);
} catch (err) {
console.log('>>>>>>>>>>>', err);
assert.equal(err.errno, error.ERRNO.BACKEND_SERVICE_FAILURE);
assert.equal(deleteAccountIfUnverifiedStub.calledOnce, true);
}

Просмотреть файл

@ -25,10 +25,14 @@ const {
handleAuth,
} = require('../../../../lib/routes/subscriptions');
const deleteAccountIfUnverifiedStub = sinon.stub();
const { StripeHandler: DirectStripeRoutes } = proxyquire(
'../../../../lib/routes/subscriptions/stripe',
{
'fxa-shared/db/models/auth': dbStub,
'../utils/account': {
deleteAccountIfUnverified: deleteAccountIfUnverifiedStub,
},
}
);
@ -1315,9 +1319,8 @@ describe('DirectStripeRoutes', () => {
idempotencyKey: uuidv4(),
};
const deleteAccountIfUnverifiedStub = sandbox
.stub(accountUtils, 'deleteAccountIfUnverified')
.returns(null);
deleteAccountIfUnverifiedStub.reset();
deleteAccountIfUnverifiedStub.returns(null);
try {
await directStripeRoutesInstance.createSubscriptionWithPMI(
@ -1342,9 +1345,8 @@ describe('DirectStripeRoutes', () => {
idempotencyKey: uuidv4(),
};
const deleteAccountIfUnverifiedStub = sandbox
.stub(accountUtils, 'deleteAccountIfUnverified')
.throws(error.accountExists(null));
deleteAccountIfUnverifiedStub.reset();
deleteAccountIfUnverifiedStub.throws(error.accountExists(null));
try {
await directStripeRoutesInstance.createSubscriptionWithPMI(
@ -1369,9 +1371,10 @@ describe('DirectStripeRoutes', () => {
idempotencyKey: uuidv4(),
};
const deleteAccountIfUnverifiedStub = sandbox
.stub(accountUtils, 'deleteAccountIfUnverified')
.throws(error.verifiedSecondaryEmailAlreadyExists());
deleteAccountIfUnverifiedStub.reset();
deleteAccountIfUnverifiedStub.throws(
error.verifiedSecondaryEmailAlreadyExists()
);
try {
await directStripeRoutesInstance.createSubscriptionWithPMI(

Просмотреть файл

@ -155,7 +155,9 @@ describe('support', () => {
email: TEST_EMAIL,
});
zendeskClient = require('../../../lib/zendesk-client')(config);
zendeskClient = require('../../../lib/zendesk-client').createZendeskClient(
config
);
});
requestOptions = {

Просмотреть файл

@ -25,7 +25,7 @@ import {
} from '../../../lib/senders/emails/partials/userDevice/mocks';
const moment = require('moment-timezone');
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const { assert } = chai;
if (!config.smtp.prependVerificationSubdomain.enabled) {
config.smtp.prependVerificationSubdomain.enabled = true;

Просмотреть файл

@ -7,7 +7,7 @@
const ROOT_DIR = '../../..';
const { assert } = require('chai');
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const crypto = require('crypto');
const mocks = require(`${ROOT_DIR}/test/mocks`);
const senders = require(`${ROOT_DIR}/lib/senders`);

Просмотреть файл

@ -12,7 +12,7 @@ const Hapi = require('@hapi/hapi');
const Sentry = require('@sentry/node');
const error = require('../../lib/error');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const {
configureSentry,
formatMetadataValidationErrorMessage,

Просмотреть файл

@ -12,7 +12,7 @@ const EXPECTED_CREATE_DELETE_RESULT = REMINDERS.reduce((expected, reminder) => {
}, {});
const { assert } = require('chai');
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const mocks = require('../mocks');
describe('#integration - lib/subscription-account-reminders', () => {

Просмотреть файл

@ -5,7 +5,7 @@
'use strict';
const { assert } = require('chai');
const config = require('../../../config').getProperties();
const config = require('../../../config').default.getProperties();
const mocks = require('../../mocks');
const log = mocks.mockLog();
const modulePath = '../../../lib/tokens/token';

Просмотреть файл

@ -12,7 +12,7 @@ const EXPECTED_CREATE_DELETE_RESULT = REMINDERS.reduce((expected, reminder) => {
}, {});
const { assert } = require('chai');
const config = require(`${ROOT_DIR}/config`).getProperties();
const config = require(`${ROOT_DIR}/config`).default.getProperties();
const mocks = require('../mocks');
describe('#integration - lib/verification-reminders', () => {

Просмотреть файл

@ -8,7 +8,7 @@
const MailParser = require('mailparser').MailParser;
const simplesmtp = require('simplesmtp');
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const TEMPLATES_WITH_NO_CODE = new Set(['passwordResetEmail']);

Просмотреть файл

@ -9,7 +9,7 @@
'use strict';
const assert = require('assert');
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const crypto = require('crypto');
const error = require('../lib/error');
const knownIpLocation = require('./known-ip-location');
@ -230,7 +230,7 @@ module.exports = {
mockPlaySubscriptions,
mockAppStoreSubscriptions,
mockAccountEventsManager,
unMockAccountEventsManager
unMockAccountEventsManager,
};
function mockCustoms(errors) {
@ -877,12 +877,12 @@ function mockAppStoreSubscriptions(methods) {
function mockAccountEventsManager() {
const mgr = {
recordSecurityEvent: sinon.stub(),
recordEmailEvent: sinon.stub()
recordEmailEvent: sinon.stub(),
};
Container.set(AccountEventsManager, mgr)
Container.set(AccountEventsManager, mgr);
return mgr;
}
function unMockAccountEventsManager() {
Container.remove(AccountEventsManager)
Container.remove(AccountEventsManager);
}

Просмотреть файл

@ -11,7 +11,7 @@ const util = require('util');
const jwt = require('jsonwebtoken');
const jwtSign = util.promisify(jwt.sign);
const config = require('../../config');
const { config } = require('../../config');
const unique = require('../../lib/oauth/unique');
const verifyAssertion = require('../../lib/oauth/assertion');

Просмотреть файл

@ -12,7 +12,7 @@ const ScopeSet = require('fxa-shared').oauth.scopes;
const encrypt = require('fxa-shared/auth/encrypt');
const db = require('../../../lib/oauth/db');
const config = require('../../../config');
const { config } = require('../../../config');
function randomString(len) {
return crypto.randomBytes(Math.ceil(len)).toString('hex');

Просмотреть файл

@ -7,7 +7,7 @@ const sinon = require('sinon');
const proxyquire = require('proxyquire');
const { default: Container } = require('typedi');
const config = require('../../config');
const { config } = require('../../config');
const ScopeSet = require('fxa-shared').oauth.scopes;
const AppError = require('../../lib/oauth/error');
const { decodeJWT } = require('../lib/util');
@ -274,18 +274,20 @@ describe('generateTokens', () => {
mockCapabilityService = {};
mockConfig = {
get(key) {
switch (key) {
case 'oauthServer.jwtAccessTokens.enabled': {
return true;
config: {
get(key) {
switch (key) {
case 'oauthServer.jwtAccessTokens.enabled': {
return true;
}
case 'oauthServer.jwtAccessTokens.enabledClientIds': {
return ['9876543210'];
}
default: {
return config.get(key);
}
}
case 'oauthServer.jwtAccessTokens.enabledClientIds': {
return ['9876543210'];
}
default: {
return config.get(key);
}
}
},
},
};

Просмотреть файл

@ -8,7 +8,8 @@ const proxyquire = require('proxyquire');
const AppError = require('../../lib/oauth/error');
const ScopeSet = require('fxa-shared').oauth.scopes;
const { OAUTH_SCOPE_OLD_SYNC } = require('fxa-shared/oauth/constants');
const TOKEN_SERVER_URL = require('../../config').get('syncTokenserverUrl');
const TOKEN_SERVER_URL =
require('../../config').default.get('syncTokenserverUrl');
describe('lib/jwt_access_token', () => {
let JWTAccessToken;

Просмотреть файл

@ -6,7 +6,7 @@ const { assert } = require('chai');
const jsonwebtoken = require('jsonwebtoken');
const AppError = require('../../lib/oauth/error');
const config = require('../../config');
const { config } = require('../../config');
const JWTIdToken = require('../../lib/oauth/jwt_id_token');
const {
SIGNING_PEM,

Просмотреть файл

@ -4,7 +4,7 @@
const { assert } = require('chai');
const proxyquire = require('proxyquire');
const config = require('../../config');
const { config } = require('../../config');
describe('lib/jwt_sub', () => {
let mockConfig;
@ -24,21 +24,23 @@ describe('lib/jwt_sub', () => {
function initialize(isEnabled) {
mockConfig = {
get(key) {
switch (key) {
case 'oauthServer.ppid.salt':
return 'salt';
case 'oauthServer.ppid.enabled':
return isEnabled;
case 'oauthServer.ppid.enabledClientIds':
return [ENABLED_CLIENT_ID_HEX, ROTATING_CLIENT_ID_HEX];
case 'oauthServer.ppid.rotatingClientIds':
return [ROTATING_CLIENT_ID_HEX];
case 'oauthServer.ppid.rotationPeriodMS':
return 1;
default:
return config.get(key);
}
config: {
get(key) {
switch (key) {
case 'oauthServer.ppid.salt':
return 'salt';
case 'oauthServer.ppid.enabled':
return isEnabled;
case 'oauthServer.ppid.enabledClientIds':
return [ENABLED_CLIENT_ID_HEX, ROTATING_CLIENT_ID_HEX];
case 'oauthServer.ppid.rotatingClientIds':
return [ROTATING_CLIENT_ID_HEX];
case 'oauthServer.ppid.rotationPeriodMS':
return 1;
default:
return config.get(key);
}
},
},
};

Просмотреть файл

@ -3,35 +3,27 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { assert } = require('chai');
const config = require('../../config');
const { config } = require('../../config');
const proxyquire = require('proxyquire');
const keys = require('../../lib/oauth/keys');
const MOCK_PRIVATE_KEY = {
kty: 'RSA',
n:
'gtZICzk-mbbsIf8LTrTDaog3lYzyDNGWwZvklM0euIWnkXfXDoracZAe5E3XV-PYNyT8OOwvf3LxX7zlzVjZ6Ew1PucUafXbjweHFPQy307qEWhJjJl-KYmcD7VXS1IYQ-BVzSKYBAWtCHiRb9f37mkAbITwes-dwm0nM8W0c2BtND-KKCFE5mhZTkBtbOcti-QHglRvEftoLo_7nqYu2tU3VqKDbRuv7lRzCgSPlpLbQMNoE_I190JxMOHOVUrj9GSfXNcuoR_3DqpfAEG8I0OR1RaAWq_-ZbIZJw380DZDN007r5w5oiiff_fG-DLFB9jY67eh7Mv1vpuZ7Q6tFQ',
n: 'gtZICzk-mbbsIf8LTrTDaog3lYzyDNGWwZvklM0euIWnkXfXDoracZAe5E3XV-PYNyT8OOwvf3LxX7zlzVjZ6Ew1PucUafXbjweHFPQy307qEWhJjJl-KYmcD7VXS1IYQ-BVzSKYBAWtCHiRb9f37mkAbITwes-dwm0nM8W0c2BtND-KKCFE5mhZTkBtbOcti-QHglRvEftoLo_7nqYu2tU3VqKDbRuv7lRzCgSPlpLbQMNoE_I190JxMOHOVUrj9GSfXNcuoR_3DqpfAEG8I0OR1RaAWq_-ZbIZJw380DZDN007r5w5oiiff_fG-DLFB9jY67eh7Mv1vpuZ7Q6tFQ',
e: 'AQAB',
d:
'ahFhsoej8mXTJPRorFPrIJBxz3HGQRIgz7CcLO3le94OrOWkmQuEcBBQmvFoJL536Ky5NUR0dTQv7ldrTYA8mBBAElCvwf8pEdkeb6RRIawOIjKTfcJp_y6qMCnpLQzO0ygpJvZmmswnLPjhnvRM8SB60X8sncN2t8pZv6UF14opwOOh6HRUCZIwk_qsVj3FFF2Kbof6zMGZeja2SNw2syRho8JunvLGj7i1EfNY_hCtfuKJQFgqnNGc6UkvvQow7biv8hoXmjAfuSfsll-YUMI0tizg8Qe6EhH34m0YcnW-iZjA6-VNDXcQpQG8Wey2r-t0Xf5IUZ0EaF2RTvJqeQ',
p:
'vqtEjuvKMtqATKajIFUmU0u2Ak0qgseTVSzLXA1DhyV4JBVguGXDOKCqEkomwB-WwudH2KWY0A22FP73KS7tFiEvPDjPPBnBrK2fNPYqBIMEoSW1Q5IKTwvuWyqbAMFEilGm4Or83Mzz7VGnokcsiKAqsKNFVnVvky0iflKfk4M',
q:
'r6rJ_nauB7J3fdjaJ9emM1nyBx2KyPzblraP4QhH9C3Ytfh4aYvh772vwFyu3_woDOc4PMNKTWa88yth5RQzlenAL9S4chk9sJvtAKEAzDy7_6saZHL0P30EAAjRaSrtq4ZCV4vXffhK6vXSFpW_TAXqNk6e2AwqPD70K6pMIYc',
dp:
'Kn2meKdJV03kW7CjF9iCAvwTYq3ptF1fkxK5exklnF-YR4pQFKfw-pSrcgn-WsBva535H-m_hVYY5tLvJ8liYpUgnq4WWNFwnNfQbBATyw-bn4H0xEsuavFAvCZhhqiLarvJkcQsd9Rg49lXn013OjdfbB_mmt7u74CWeEpXb5s',
dq:
'XKpAMZ5TQTYweE9LDRdh0dbRqFU6H7na8A7PqQpgQntoxN0UT8D9ZyTtsBB0Iy11xxC1hsAR0vCuHaw10MyuRZdvzQtuXKnZ8-7cv6cur44eMckFfBVzqIX-9TGxncOKah_BoULgYs_2XSldMJK_vY-lNA6XFiqcoPkoflwwGsM',
qi:
'Qgpo8CVYFvjpjni53XjVwrSTtD-zbT_COS3-1bs4h1zKinpruX7asvrwaAk1gpxG5Sz79zuaOyoKUzj7z3p3j9TYW7bILlP0WhIGmI5W_z0ZjdnYUCZa2j0JMcSY1iySuzGkp44Bllt8b19WYUnW5IrooGaJALaVL5YQmSKF5kc',
d: 'ahFhsoej8mXTJPRorFPrIJBxz3HGQRIgz7CcLO3le94OrOWkmQuEcBBQmvFoJL536Ky5NUR0dTQv7ldrTYA8mBBAElCvwf8pEdkeb6RRIawOIjKTfcJp_y6qMCnpLQzO0ygpJvZmmswnLPjhnvRM8SB60X8sncN2t8pZv6UF14opwOOh6HRUCZIwk_qsVj3FFF2Kbof6zMGZeja2SNw2syRho8JunvLGj7i1EfNY_hCtfuKJQFgqnNGc6UkvvQow7biv8hoXmjAfuSfsll-YUMI0tizg8Qe6EhH34m0YcnW-iZjA6-VNDXcQpQG8Wey2r-t0Xf5IUZ0EaF2RTvJqeQ',
p: 'vqtEjuvKMtqATKajIFUmU0u2Ak0qgseTVSzLXA1DhyV4JBVguGXDOKCqEkomwB-WwudH2KWY0A22FP73KS7tFiEvPDjPPBnBrK2fNPYqBIMEoSW1Q5IKTwvuWyqbAMFEilGm4Or83Mzz7VGnokcsiKAqsKNFVnVvky0iflKfk4M',
q: 'r6rJ_nauB7J3fdjaJ9emM1nyBx2KyPzblraP4QhH9C3Ytfh4aYvh772vwFyu3_woDOc4PMNKTWa88yth5RQzlenAL9S4chk9sJvtAKEAzDy7_6saZHL0P30EAAjRaSrtq4ZCV4vXffhK6vXSFpW_TAXqNk6e2AwqPD70K6pMIYc',
dp: 'Kn2meKdJV03kW7CjF9iCAvwTYq3ptF1fkxK5exklnF-YR4pQFKfw-pSrcgn-WsBva535H-m_hVYY5tLvJ8liYpUgnq4WWNFwnNfQbBATyw-bn4H0xEsuavFAvCZhhqiLarvJkcQsd9Rg49lXn013OjdfbB_mmt7u74CWeEpXb5s',
dq: 'XKpAMZ5TQTYweE9LDRdh0dbRqFU6H7na8A7PqQpgQntoxN0UT8D9ZyTtsBB0Iy11xxC1hsAR0vCuHaw10MyuRZdvzQtuXKnZ8-7cv6cur44eMckFfBVzqIX-9TGxncOKah_BoULgYs_2XSldMJK_vY-lNA6XFiqcoPkoflwwGsM',
qi: 'Qgpo8CVYFvjpjni53XjVwrSTtD-zbT_COS3-1bs4h1zKinpruX7asvrwaAk1gpxG5Sz79zuaOyoKUzj7z3p3j9TYW7bILlP0WhIGmI5W_z0ZjdnYUCZa2j0JMcSY1iySuzGkp44Bllt8b19WYUnW5IrooGaJALaVL5YQmSKF5kc',
kid: '20190403-4c56c912',
'fxa-createdAt': 1554278400,
};
const MOCK_PUBLIC_KEY = {
kty: 'RSA',
n:
'm9Iych6X-w5_vc1G0Ds_c1sD0KCwM1yGcyGbEn1XnJoNLMY0UqVbG0n6QQRSK841y9mVK88iaLgBjAfhHa4D3Ahvq5vzkoKbu1Ui0-_W0EilbqAMciUX9wi3spvlENzgwWtXqlPgDTlKwoTfx0blqUh-8RVJCkP147vQnDzQzYbl30oMIB_swzRFRkz87t02AE3iOHlBLDJqn4hS9Jgw1l9xcGTD17ZhPVpRqrbw63l9phUTHaIqUX2B1s-q9qJSi_16I-BV1C4r7TCtW6bAD9KH86upBUczOPakSmzydsWoj1fQllfBkl-d5E5s0llWGOr_geXtMZWa-DxzoTgllw',
n: 'm9Iych6X-w5_vc1G0Ds_c1sD0KCwM1yGcyGbEn1XnJoNLMY0UqVbG0n6QQRSK841y9mVK88iaLgBjAfhHa4D3Ahvq5vzkoKbu1Ui0-_W0EilbqAMciUX9wi3spvlENzgwWtXqlPgDTlKwoTfx0blqUh-8RVJCkP147vQnDzQzYbl30oMIB_swzRFRkz87t02AE3iOHlBLDJqn4hS9Jgw1l9xcGTD17ZhPVpRqrbw63l9phUTHaIqUX2B1s-q9qJSi_16I-BV1C4r7TCtW6bAD9KH86upBUczOPakSmzydsWoj1fQllfBkl-d5E5s0llWGOr_geXtMZWa-DxzoTgllw',
e: 'AQAB',
kid: '20190402-33e2bd19',
'fxa-createdAt': 1554278401,
@ -48,24 +40,26 @@ describe('lib/keys', () => {
oldKey = MOCK_PUBLIC_KEY;
unsafelyAllowMissingActiveKey = false;
mockConfig = {
get(key) {
switch (key) {
case 'oauthServer.openid.key': {
return currentKey;
config: {
get(key) {
switch (key) {
case 'oauthServer.openid.key': {
return currentKey;
}
case 'oauthServer.openid.newKey': {
return newKey;
}
case 'oauthServer.openid.oldKey': {
return oldKey;
}
case 'oauthServer.unsafelyAllowMissingActiveKey': {
return unsafelyAllowMissingActiveKey;
}
default: {
return config.get(key);
}
}
case 'oauthServer.openid.newKey': {
return newKey;
}
case 'oauthServer.openid.oldKey': {
return oldKey;
}
case 'oauthServer.unsafelyAllowMissingActiveKey': {
return unsafelyAllowMissingActiveKey;
}
default: {
return config.get(key);
}
}
},
},
};
loadMockedModule = () =>

Просмотреть файл

@ -4,7 +4,7 @@
'use strict';
const config = require('../config').getProperties();
const config = require('../config').default.getProperties();
const hapi = require('@hapi/hapi');
const url = require('url');

Просмотреть файл

@ -8,7 +8,7 @@ const { assert } = require('chai');
const TestServer = require('../test_server');
const crypto = require('crypto');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const mocks = require('../mocks');
const { default: Container } = require('typedi');
const {

Просмотреть файл

@ -8,7 +8,7 @@
const assert = require('../assert');
const TestServer = require('../test_server');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const otplib = require('otplib');
describe('#integration - remote account create with sign-up code', function () {

Просмотреть файл

@ -8,7 +8,7 @@ const { assert } = require('chai');
const TestServer = require('../test_server');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
describe('#integration - remote account destroy', function () {
this.timeout(15000);

Просмотреть файл

@ -9,7 +9,7 @@ const TestServer = require('../test_server');
const Client = require('../client')();
const retry = require('async-retry');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
config.redis.sessionTokens.enabled = false;
const key = {
algorithm: 'RS',

Просмотреть файл

@ -9,7 +9,7 @@ const Client = require('../client')();
const crypto = require('crypto');
const TestServer = require('../test_server');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
describe('remote account login', () => {
let server;

Просмотреть файл

@ -7,7 +7,7 @@
const { assert } = require('chai');
const TestServer = require('../test_server');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const CLIENT_ID = config.oauthServer.clients.find(
(client) => client.trusted && client.canGrant && client.publicClient

Просмотреть файл

@ -10,7 +10,7 @@ const Client = require('../client')();
const TestServer = require('../test_server');
const jwtool = require('fxa-jwtool');
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
describe('#integration - remote account reset', function () {
this.timeout(15000);

Просмотреть файл

@ -7,7 +7,7 @@
const { assert } = require('chai');
const TestServer = require('../test_server');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
config.redis.sessionTokens.enabled = false;
const url = require('url');
const jwtool = require('fxa-jwtool');

Просмотреть файл

@ -8,7 +8,7 @@ const { assert } = require('chai');
const TestServer = require('../test_server');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
describe('#integration - remote account status', function () {
this.timeout(15000);

Просмотреть файл

@ -8,7 +8,7 @@ const { assert } = require('chai');
const TestServer = require('../test_server');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
describe('#integration - remote account unlock', function () {
this.timeout(15000);

Просмотреть файл

@ -7,7 +7,7 @@
const { assert } = require('chai');
const TestServer = require('../test_server');
const Client = require('../client')();
const config = require('../../config').getProperties();
const config = require('../../config').default.getProperties();
const tokens = require('../../lib/tokens')({ trace: () => {} }, config);
const testUtils = require('../lib/util');
const ScopeSet = require('fxa-shared').oauth.scopes;

Просмотреть файл

@ -13,7 +13,7 @@ describe('remote base path', function () {
this.timeout(15000);
let server, config;
before(() => {
config = require('../../config').getProperties();
config = require('../../config').default.getProperties();
config.publicUrl = 'http://localhost:9000/auth';
return TestServer.start(config).then((s) => {

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше