firebase-tools 9.23.3 → 10.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api.js +1 -1
- package/lib/apiv2.js +2 -2
- package/lib/appdistribution/client.js +1 -1
- package/lib/appdistribution/options-parser-util.js +1 -1
- package/lib/auth.js +2 -2
- package/lib/command.js +26 -26
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/appdistribution-testers-add.js +2 -2
- package/lib/commands/appdistribution-testers-remove.js +2 -2
- package/lib/commands/apps-android-sha-create.js +2 -2
- package/lib/commands/apps-android-sha-delete.js +2 -2
- package/lib/commands/apps-android-sha-list.js +2 -2
- package/lib/commands/apps-create.js +9 -9
- package/lib/commands/apps-list.js +3 -3
- package/lib/commands/apps-sdkconfig.js +8 -8
- package/lib/commands/database-get.js +1 -1
- package/lib/commands/database-instances-create.js +4 -4
- package/lib/commands/database-instances-list.js +4 -4
- package/lib/commands/database-profile.js +1 -1
- package/lib/commands/database-push.js +1 -1
- package/lib/commands/database-remove.js +4 -4
- package/lib/commands/database-set.js +4 -4
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +4 -4
- package/lib/commands/ext-configure.js +2 -2
- package/lib/commands/ext-dev-deprecate.js +4 -4
- package/lib/commands/ext-dev-extension-delete.js +3 -3
- package/lib/commands/ext-dev-init.js +3 -3
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +3 -3
- package/lib/commands/ext-dev-register.js +5 -5
- package/lib/commands/ext-dev-undeprecate.js +4 -4
- package/lib/commands/ext-dev-unpublish.js +3 -3
- package/lib/commands/ext-dev-usage.js +145 -0
- package/lib/commands/ext-export.js +8 -8
- package/lib/commands/ext-info.js +4 -4
- package/lib/commands/ext-install.js +26 -22
- package/lib/commands/ext-list.js +2 -2
- package/lib/commands/ext-sources-create.js +2 -2
- package/lib/commands/ext-uninstall.js +3 -3
- package/lib/commands/ext-update.js +17 -17
- package/lib/commands/ext.js +3 -3
- package/lib/commands/firestore-delete.js +3 -3
- package/lib/commands/functions-config-export.js +11 -11
- package/lib/commands/functions-delete.js +3 -3
- package/lib/commands/functions-deletegcfartifacts.js +4 -4
- package/lib/commands/functions-list.js +1 -1
- package/lib/commands/functions-log.js +1 -1
- package/lib/commands/hosting-channel-create.js +12 -12
- package/lib/commands/hosting-channel-delete.js +9 -9
- package/lib/commands/hosting-channel-deploy.js +17 -17
- package/lib/commands/hosting-channel-list.js +5 -5
- package/lib/commands/hosting-channel-open.js +9 -9
- package/lib/commands/hosting-clone.js +15 -15
- package/lib/commands/hosting-disable.js +4 -4
- package/lib/commands/hosting-sites-create.js +7 -7
- package/lib/commands/hosting-sites-delete.js +7 -7
- package/lib/commands/hosting-sites-get.js +2 -2
- package/lib/commands/hosting-sites-list.js +3 -3
- package/lib/commands/index.js +1 -0
- package/lib/commands/login.js +2 -2
- package/lib/commands/logout.js +1 -1
- package/lib/commands/open.js +1 -1
- package/lib/commands/projects-addfirebase.js +2 -2
- package/lib/commands/projects-create.js +2 -2
- package/lib/commands/projects-list.js +1 -1
- package/lib/commands/remoteconfig-get.js +3 -3
- package/lib/commands/remoteconfig-rollback.js +3 -3
- package/lib/commands/remoteconfig-versions-list.js +1 -1
- package/lib/commands/setup-emulators-storage.js +1 -1
- package/lib/config.js +6 -6
- package/lib/database/api.js +2 -2
- package/lib/deploy/extensions/deploy.js +4 -4
- package/lib/deploy/extensions/deploymentSummary.js +5 -4
- package/lib/deploy/extensions/index.js +1 -0
- package/lib/deploy/extensions/params.js +1 -1
- package/lib/deploy/extensions/planner.js +3 -3
- package/lib/deploy/extensions/prepare.js +9 -9
- package/lib/deploy/extensions/release.js +1 -1
- package/lib/deploy/extensions/secrets.js +7 -7
- package/lib/deploy/extensions/validate.js +2 -2
- package/lib/deploy/functions/backend.js +6 -4
- package/lib/deploy/functions/checkIam.js +7 -7
- package/lib/deploy/functions/containerCleaner.js +3 -3
- package/lib/deploy/functions/deploy.js +10 -11
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
- package/lib/deploy/functions/index.js +1 -0
- package/lib/deploy/functions/prepare.js +27 -21
- package/lib/deploy/functions/prompts.js +5 -5
- package/lib/deploy/functions/release/executor.js +4 -1
- package/lib/deploy/functions/release/fabricator.js +5 -5
- package/lib/deploy/functions/release/index.js +3 -3
- package/lib/deploy/functions/release/planner.js +6 -6
- package/lib/deploy/functions/release/reporter.js +8 -4
- package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
- package/lib/deploy/functions/runtimes/golang/index.js +9 -13
- package/lib/deploy/functions/runtimes/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/runtimes/node/validate.js +2 -1
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- package/lib/deploy/functions/validate.js +4 -3
- package/lib/deploy/hosting/deploy.js +7 -7
- package/lib/deploy/hosting/uploader.js +1 -1
- package/lib/deploy/hosting/validate.js +3 -3
- package/lib/deploy/remoteconfig/prepare.js +3 -3
- package/lib/deploy/remoteconfig/release.js +3 -3
- package/lib/deploy/storage/deploy.js +1 -1
- package/lib/deploy/storage/release.js +2 -2
- package/lib/detectProjectRoot.js +5 -5
- package/lib/emulator/auth/apiSpec.js +13 -7
- package/lib/emulator/auth/handlers.js +3 -3
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +256 -248
- package/lib/emulator/auth/server.js +11 -8
- package/lib/emulator/auth/state.js +12 -12
- package/lib/emulator/commandUtils.js +5 -5
- package/lib/emulator/controller.js +16 -11
- package/lib/emulator/downloadableEmulators.js +2 -2
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +101 -74
- package/lib/emulator/functionsEmulatorRuntime.js +33 -18
- package/lib/emulator/functionsEmulatorShell.js +3 -2
- package/lib/emulator/functionsRuntimeWorker.js +1 -1
- package/lib/emulator/hubExport.js +2 -2
- package/lib/emulator/storage/apis/firebase.js +2 -2
- package/lib/emulator/storage/apis/gcloud.js +2 -2
- package/lib/emulator/storage/cloudFunctions.js +1 -1
- package/lib/emulator/storage/files.js +14 -14
- package/lib/emulator/storage/index.js +2 -2
- package/lib/emulator/storage/metadata.js +7 -6
- package/lib/emulator/storage/rules/runtime.js +5 -5
- package/lib/emulator/storage/server.js +2 -2
- package/lib/ensureApiEnabled.js +7 -7
- package/lib/error.js +3 -3
- package/lib/extensions/askUserForConsent.js +2 -3
- package/lib/extensions/askUserForParam.js +10 -10
- package/lib/extensions/billingMigrationHelper.js +1 -1
- package/lib/extensions/changelog.js +3 -3
- package/lib/extensions/displayExtensionInfo.js +5 -5
- package/lib/extensions/emulator/optionsHelper.js +1 -1
- package/lib/extensions/emulator/specHelper.js +1 -1
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/export.js +6 -6
- package/lib/extensions/extensionsApi.js +14 -1
- package/lib/extensions/extensionsHelper.js +38 -29
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/localHelper.js +1 -1
- package/lib/extensions/metricsTypeDef.js +2 -0
- package/lib/extensions/metricsUtils.js +98 -0
- package/lib/extensions/paramHelper.js +6 -6
- package/lib/extensions/provisioningHelper.js +6 -4
- package/lib/extensions/resolveSource.js +1 -1
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/updateHelper.js +9 -9
- package/lib/extensions/utils.js +1 -1
- package/lib/extensions/warnings.js +10 -9
- package/lib/fetchWebSetup.js +2 -2
- package/lib/filterTargets.js +2 -2
- package/lib/firestore/indexes.js +2 -2
- package/lib/fsAsync.js +3 -3
- package/lib/fsutils.js +2 -2
- package/lib/functional.js +2 -1
- package/lib/functions/env.js +1 -1
- package/lib/functions/runtimeConfigExport.js +4 -4
- package/lib/functionsConfig.js +3 -3
- package/lib/functionsShellCommandAction.js +4 -3
- package/lib/gcp/cloudmonitoring.js +74 -0
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/iam.js +2 -2
- package/lib/gcp/resourceManager.js +2 -2
- package/lib/gcp/secretManager.js +3 -2
- package/lib/getDefaultDatabaseInstance.js +1 -1
- package/lib/getDefaultHostingSite.js +1 -1
- package/lib/getProjectNumber.js +2 -2
- package/lib/handlePreviewToggles.js +5 -5
- package/lib/hosting/api.js +6 -6
- package/lib/hosting/cloudRunProxy.js +6 -6
- package/lib/hosting/functionsProxy.js +3 -3
- package/lib/hosting/implicitInit.js +2 -2
- package/lib/hosting/normalizedHostingConfigs.js +3 -3
- package/lib/hosting/proxy.js +2 -2
- package/lib/init/features/account.js +7 -7
- package/lib/init/features/database.js +9 -9
- package/lib/init/features/emulators.js +8 -8
- package/lib/init/features/firestore/index.js +3 -3
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +2 -2
- package/lib/init/features/functions/golang.js +4 -4
- package/lib/init/features/functions/index.js +4 -4
- package/lib/init/features/hosting/github.js +31 -31
- package/lib/init/features/project.js +8 -8
- package/lib/init/features/remoteconfig.js +2 -2
- package/lib/init/features/storage.js +2 -2
- package/lib/listFiles.js +1 -1
- package/lib/management/apps.js +3 -3
- package/lib/management/projects.js +6 -6
- package/lib/previews.js +2 -2
- package/lib/profiler.js +1 -1
- package/lib/projectPath.js +1 -1
- package/lib/projectUtils.js +1 -1
- package/lib/prompt.js +0 -1
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +2 -2
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requireHostingSite.js +1 -1
- package/lib/requirePermissions.js +4 -4
- package/lib/rulesDeploy.js +2 -2
- package/lib/serve/functions.js +14 -7
- package/lib/serve/hosting.js +7 -7
- package/lib/utils.js +3 -2
- package/npm-shrinkwrap.json +24889 -0
- package/package.json +24 -24
- package/templates/init/functions/javascript/package.lint.json +1 -1
- package/templates/init/functions/javascript/package.nolint.json +1 -1
- package/templates/init/functions/typescript/package.lint.json +1 -1
- package/templates/init/functions/typescript/package.nolint.json +1 -1
- package/templates/init/hosting/index.html +1 -1
- package/CHANGELOG.md +0 -1
|
@@ -88,7 +88,7 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
|
|
|
88
88
|
res.json(specWithEmulatorServer(req.protocol, req.headers.host));
|
|
89
89
|
});
|
|
90
90
|
registerLegacyRoutes(app);
|
|
91
|
-
handlers_1.registerHandlers(app, (apiKey, tenantId) => getProjectStateById(getProjectIdByApiKey(apiKey), tenantId));
|
|
91
|
+
(0, handlers_1.registerHandlers)(app, (apiKey, tenantId) => getProjectStateById(getProjectIdByApiKey(apiKey), tenantId));
|
|
92
92
|
const apiKeyAuthenticator = (ctx, info) => {
|
|
93
93
|
if (info.in !== "query") {
|
|
94
94
|
throw new Error('apiKey must be defined as in: "query" in API spec.');
|
|
@@ -164,7 +164,7 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
|
|
|
164
164
|
defaultMaxBodySize: 1024 * 1024 * 1024,
|
|
165
165
|
validateDefaultResponses: true,
|
|
166
166
|
onResponseValidationError({ errors }) {
|
|
167
|
-
utils_1.logError(new Error(`An internal error occured when generating response. Details:\n${JSON.stringify(errors)}`));
|
|
167
|
+
(0, utils_1.logError)(new Error(`An internal error occured when generating response. Details:\n${JSON.stringify(errors)}`));
|
|
168
168
|
throw new errors_2.InternalError("An internal error occured when generating response.", "emulator-response-validation");
|
|
169
169
|
},
|
|
170
170
|
customFormats: {
|
|
@@ -183,6 +183,9 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
|
|
|
183
183
|
uint32() {
|
|
184
184
|
return true;
|
|
185
185
|
},
|
|
186
|
+
byte() {
|
|
187
|
+
return true;
|
|
188
|
+
},
|
|
186
189
|
},
|
|
187
190
|
plugins: [
|
|
188
191
|
{
|
|
@@ -233,7 +236,7 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
|
|
|
233
236
|
return res.status(err.status).json(err);
|
|
234
237
|
}
|
|
235
238
|
if (apiError.code === 500) {
|
|
236
|
-
utils_1.logError(err);
|
|
239
|
+
(0, utils_1.logError)(err);
|
|
237
240
|
}
|
|
238
241
|
return res.status(apiError.code).json({ error: apiError });
|
|
239
242
|
}));
|
|
@@ -343,7 +346,7 @@ function toExegesisController(ops, getProjectStateById) {
|
|
|
343
346
|
let targetProjectId = ctx.params.path.targetProjectId || ((_a = ctx.requestBody) === null || _a === void 0 ? void 0 : _a.targetProjectId);
|
|
344
347
|
if (targetProjectId) {
|
|
345
348
|
if ((_b = ctx.api.operationObject.security) === null || _b === void 0 ? void 0 : _b.some((sec) => sec.Oauth2)) {
|
|
346
|
-
errors_2.assert((_c = ctx.security) === null || _c === void 0 ? void 0 : _c.Oauth2, "INSUFFICIENT_PERMISSION : Only authenticated requests can specify target_project_id.");
|
|
349
|
+
(0, errors_2.assert)((_c = ctx.security) === null || _c === void 0 ? void 0 : _c.Oauth2, "INSUFFICIENT_PERMISSION : Only authenticated requests can specify target_project_id.");
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
else {
|
|
@@ -351,14 +354,14 @@ function toExegesisController(ops, getProjectStateById) {
|
|
|
351
354
|
}
|
|
352
355
|
let targetTenantId = undefined;
|
|
353
356
|
if (ctx.params.path.tenantId && ((_d = ctx.requestBody) === null || _d === void 0 ? void 0 : _d.tenantId)) {
|
|
354
|
-
errors_2.assert(ctx.params.path.tenantId === ctx.requestBody.tenantId, "TENANT_ID_MISMATCH");
|
|
357
|
+
(0, errors_2.assert)(ctx.params.path.tenantId === ctx.requestBody.tenantId, "TENANT_ID_MISMATCH");
|
|
355
358
|
}
|
|
356
359
|
targetTenantId = ctx.params.path.tenantId || ((_e = ctx.requestBody) === null || _e === void 0 ? void 0 : _e.tenantId);
|
|
357
360
|
if ((_f = ctx.requestBody) === null || _f === void 0 ? void 0 : _f.idToken) {
|
|
358
361
|
const idToken = (_g = ctx.requestBody) === null || _g === void 0 ? void 0 : _g.idToken;
|
|
359
|
-
const decoded = jsonwebtoken_1.decode(idToken, { complete: true });
|
|
362
|
+
const decoded = (0, jsonwebtoken_1.decode)(idToken, { complete: true });
|
|
360
363
|
if ((decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant) && targetTenantId) {
|
|
361
|
-
errors_2.assert((decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant) === targetTenantId, "TENANT_ID_MISMATCH");
|
|
364
|
+
(0, errors_2.assert)((decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant) === targetTenantId, "TENANT_ID_MISMATCH");
|
|
362
365
|
}
|
|
363
366
|
targetTenantId = targetTenantId || (decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant);
|
|
364
367
|
}
|
|
@@ -421,7 +424,7 @@ function convertKeysToCamelCase(body) {
|
|
|
421
424
|
}
|
|
422
425
|
const result = Object.create(null);
|
|
423
426
|
for (const key of Object.keys(body)) {
|
|
424
|
-
result[lodash_1.camelCase(key)] = convertKeysToCamelCase(body[key]);
|
|
427
|
+
result[(0, lodash_1.camelCase)(key)] = convertKeysToCamelCase(body[key]);
|
|
425
428
|
}
|
|
426
429
|
return result;
|
|
427
430
|
}
|
|
@@ -30,7 +30,7 @@ class ProjectState {
|
|
|
30
30
|
}
|
|
31
31
|
createUser(props) {
|
|
32
32
|
for (let i = 0; i < 10; i++) {
|
|
33
|
-
const localId = utils_1.randomId(28);
|
|
33
|
+
const localId = (0, utils_1.randomId)(28);
|
|
34
34
|
const user = this.createUserWithLocalId(localId, props);
|
|
35
35
|
if (user) {
|
|
36
36
|
return user;
|
|
@@ -93,7 +93,7 @@ class ProjectState {
|
|
|
93
93
|
const oldEmail = user.email;
|
|
94
94
|
const oldPhoneNumber = user.phoneNumber;
|
|
95
95
|
for (const field of Object.keys(fields)) {
|
|
96
|
-
utils_1.mirrorFieldTo(user, field, fields);
|
|
96
|
+
(0, utils_1.mirrorFieldTo)(user, field, fields);
|
|
97
97
|
}
|
|
98
98
|
if (oldEmail && oldEmail !== user.email) {
|
|
99
99
|
this.localIdForEmail.delete(oldEmail);
|
|
@@ -140,10 +140,10 @@ class ProjectState {
|
|
|
140
140
|
const phoneNumbers = new Set();
|
|
141
141
|
const enrollmentIds = new Set();
|
|
142
142
|
for (const enrollment of enrollments) {
|
|
143
|
-
errors_1.assert(enrollment.phoneInfo && utils_1.isValidPhoneNumber(enrollment.phoneInfo), "INVALID_MFA_PHONE_NUMBER : Invalid format.");
|
|
144
|
-
errors_1.assert(enrollment.mfaEnrollmentId, "INVALID_MFA_ENROLLMENT_ID : mfaEnrollmentId must be defined.");
|
|
145
|
-
errors_1.assert(!enrollmentIds.has(enrollment.mfaEnrollmentId), "DUPLICATE_MFA_ENROLLMENT_ID");
|
|
146
|
-
errors_1.assert(!phoneNumbers.has(enrollment.phoneInfo), "INTERNAL_ERROR : MFA Enrollment Phone Numbers must be unique.");
|
|
143
|
+
(0, errors_1.assert)(enrollment.phoneInfo && (0, utils_1.isValidPhoneNumber)(enrollment.phoneInfo), "INVALID_MFA_PHONE_NUMBER : Invalid format.");
|
|
144
|
+
(0, errors_1.assert)(enrollment.mfaEnrollmentId, "INVALID_MFA_ENROLLMENT_ID : mfaEnrollmentId must be defined.");
|
|
145
|
+
(0, errors_1.assert)(!enrollmentIds.has(enrollment.mfaEnrollmentId), "DUPLICATE_MFA_ENROLLMENT_ID");
|
|
146
|
+
(0, errors_1.assert)(!phoneNumbers.has(enrollment.phoneInfo), "INTERNAL_ERROR : MFA Enrollment Phone Numbers must be unique.");
|
|
147
147
|
phoneNumbers.add(enrollment.phoneInfo);
|
|
148
148
|
enrollmentIds.add(enrollment.mfaEnrollmentId);
|
|
149
149
|
}
|
|
@@ -282,7 +282,7 @@ class ProjectState {
|
|
|
282
282
|
}
|
|
283
283
|
createRefreshTokenFor(userInfo, provider, { extraClaims = {}, secondFactor, } = {}) {
|
|
284
284
|
const localId = userInfo.localId;
|
|
285
|
-
const refreshToken = utils_1.randomBase64UrlStr(204);
|
|
285
|
+
const refreshToken = (0, utils_1.randomBase64UrlStr)(204);
|
|
286
286
|
this.refreshTokens.set(refreshToken, {
|
|
287
287
|
localId,
|
|
288
288
|
provider,
|
|
@@ -311,7 +311,7 @@ class ProjectState {
|
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
createOob(email, requestType, generateLink) {
|
|
314
|
-
const oobCode = utils_1.randomBase64UrlStr(54);
|
|
314
|
+
const oobCode = (0, utils_1.randomBase64UrlStr)(54);
|
|
315
315
|
const oobLink = generateLink(oobCode);
|
|
316
316
|
const oob = {
|
|
317
317
|
email,
|
|
@@ -332,9 +332,9 @@ class ProjectState {
|
|
|
332
332
|
return this.oobs.values();
|
|
333
333
|
}
|
|
334
334
|
createVerificationCode(phoneNumber) {
|
|
335
|
-
const sessionInfo = utils_1.randomBase64UrlStr(226);
|
|
335
|
+
const sessionInfo = (0, utils_1.randomBase64UrlStr)(226);
|
|
336
336
|
const verification = {
|
|
337
|
-
code: utils_1.randomDigits(6),
|
|
337
|
+
code: (0, utils_1.randomDigits)(6),
|
|
338
338
|
phoneNumber,
|
|
339
339
|
sessionInfo,
|
|
340
340
|
};
|
|
@@ -386,7 +386,7 @@ class ProjectState {
|
|
|
386
386
|
createTemporaryProof(phoneNumber) {
|
|
387
387
|
const record = {
|
|
388
388
|
phoneNumber,
|
|
389
|
-
temporaryProof: utils_1.randomBase64UrlStr(119),
|
|
389
|
+
temporaryProof: (0, utils_1.randomBase64UrlStr)(119),
|
|
390
390
|
temporaryProofExpiresIn: "3600",
|
|
391
391
|
};
|
|
392
392
|
this.temporaryProofs.set(record.temporaryProof, record);
|
|
@@ -493,7 +493,7 @@ class AgentProjectState extends ProjectState {
|
|
|
493
493
|
}
|
|
494
494
|
createTenant(tenant) {
|
|
495
495
|
for (let i = 0; i < 10; i++) {
|
|
496
|
-
const tenantId = utils_1.randomId(28);
|
|
496
|
+
const tenantId = (0, utils_1.randomId)(28);
|
|
497
497
|
const createdTenant = this.createTenantWithTenantId(tenantId, tenant);
|
|
498
498
|
if (createdTenant) {
|
|
499
499
|
return createdTenant;
|
|
@@ -71,7 +71,7 @@ function warnEmulatorNotSupported(options, emulator) {
|
|
|
71
71
|
const opts = {
|
|
72
72
|
confirm: undefined,
|
|
73
73
|
};
|
|
74
|
-
return prompt_1.promptOnce({
|
|
74
|
+
return (0, prompt_1.promptOnce)({
|
|
75
75
|
type: "confirm",
|
|
76
76
|
default: false,
|
|
77
77
|
message: "Do you want to continue?",
|
|
@@ -90,7 +90,7 @@ async function beforeEmulatorCommand(options) {
|
|
|
90
90
|
!controller.shouldStart(optionsWithConfig, types_1.Emulators.FUNCTIONS) &&
|
|
91
91
|
!controller.shouldStart(optionsWithConfig, types_1.Emulators.HOSTING);
|
|
92
92
|
try {
|
|
93
|
-
await requireAuth_1.requireAuth(options);
|
|
93
|
+
await (0, requireAuth_1.requireAuth)(options);
|
|
94
94
|
}
|
|
95
95
|
catch (e) {
|
|
96
96
|
logger_1.logger.debug(e);
|
|
@@ -154,7 +154,7 @@ function processKillSignal(signal, res, rej, options) {
|
|
|
154
154
|
if (signalCount === 1) {
|
|
155
155
|
utils.logLabeledBullet("emulators", `Received ${signalDisplay} for the first time. Starting a clean shutdown.`);
|
|
156
156
|
utils.logLabeledBullet("emulators", `Please wait for a clean shutdown or send the ${signalDisplay} signal again to stop right now.`);
|
|
157
|
-
await controller_1.onExit(options);
|
|
157
|
+
await (0, controller_1.onExit)(options);
|
|
158
158
|
await controller.cleanShutdown();
|
|
159
159
|
}
|
|
160
160
|
else {
|
|
@@ -277,7 +277,7 @@ async function runScript(script, extraEnv) {
|
|
|
277
277
|
}
|
|
278
278
|
async function emulatorExec(script, options) {
|
|
279
279
|
shutdownWhenKilled(options);
|
|
280
|
-
const projectId = projectUtils_1.getProjectId(options);
|
|
280
|
+
const projectId = (0, projectUtils_1.getProjectId)(options);
|
|
281
281
|
const extraEnv = {};
|
|
282
282
|
if (projectId) {
|
|
283
283
|
extraEnv.GCLOUD_PROJECT = projectId;
|
|
@@ -287,7 +287,7 @@ async function emulatorExec(script, options) {
|
|
|
287
287
|
const showUI = !!options.ui;
|
|
288
288
|
await controller.startAll(options, showUI);
|
|
289
289
|
exitCode = await runScript(script, extraEnv);
|
|
290
|
-
await controller_1.onExit(options);
|
|
290
|
+
await (0, controller_1.onExit)(options);
|
|
291
291
|
}
|
|
292
292
|
finally {
|
|
293
293
|
await controller.cleanShutdown();
|
|
@@ -161,7 +161,7 @@ function findExportMetadata(importPath) {
|
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
const importFilePath = path.join(importPath, hubExport_1.HubExport.METADATA_FILE_NAME);
|
|
164
|
-
if (fsutils_1.fileExistsSync(importFilePath)) {
|
|
164
|
+
if ((0, fsutils_1.fileExistsSync)(importFilePath)) {
|
|
165
165
|
return JSON.parse(fs.readFileSync(importFilePath, "utf8").toString());
|
|
166
166
|
}
|
|
167
167
|
const fileList = fs.readdirSync(importPath);
|
|
@@ -200,7 +200,7 @@ async function startAll(options, showUI = true) {
|
|
|
200
200
|
}
|
|
201
201
|
const hubLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.HUB);
|
|
202
202
|
hubLogger.logLabeled("BULLET", "emulators", `Starting emulators: ${targets.join(", ")}`);
|
|
203
|
-
const projectId = projectUtils_1.getProjectId(options) || "";
|
|
203
|
+
const projectId = (0, projectUtils_1.getProjectId)(options) || "";
|
|
204
204
|
if (constants_1.Constants.isDemoProject(projectId)) {
|
|
205
205
|
hubLogger.logLabeled("BULLET", "emulators", `Detected demo project ID "${projectId}", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.`);
|
|
206
206
|
}
|
|
@@ -211,7 +211,7 @@ async function startAll(options, showUI = true) {
|
|
|
211
211
|
});
|
|
212
212
|
const ignored = _.difference(requested, targets);
|
|
213
213
|
for (const name of ignored) {
|
|
214
|
-
if (types_1.isEmulator(name)) {
|
|
214
|
+
if ((0, types_1.isEmulator)(name)) {
|
|
215
215
|
emulatorLogger_1.EmulatorLogger.forEmulator(name).logLabeled("WARN", name, `Not starting the ${clc.bold(name)} emulator, make sure you have run ${clc.bold("firebase init")}.`);
|
|
216
216
|
}
|
|
217
217
|
else {
|
|
@@ -242,7 +242,7 @@ async function startAll(options, showUI = true) {
|
|
|
242
242
|
if (shouldStart(options, types_1.Emulators.FUNCTIONS)) {
|
|
243
243
|
const functionsLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.FUNCTIONS);
|
|
244
244
|
const functionsAddr = await getAndCheckAddress(types_1.Emulators.FUNCTIONS, options);
|
|
245
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
245
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
246
246
|
utils.assertDefined(options.config.src.functions);
|
|
247
247
|
utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
|
|
248
248
|
utils.assertIsStringOrUndefined(options.extensionDir);
|
|
@@ -258,17 +258,22 @@ async function startAll(options, showUI = true) {
|
|
|
258
258
|
if (emulatorsNotRunning.length > 0 && !constants_1.Constants.isDemoProject(projectId)) {
|
|
259
259
|
functionsLogger.logLabeled("WARN", "functions", `The following emulators are not running, calls to these services from the Functions emulator will affect production: ${clc.bold(emulatorsNotRunning.join(", "))}`);
|
|
260
260
|
}
|
|
261
|
-
const account = auth_2.getProjectDefaultAccount(options.projectRoot);
|
|
261
|
+
const account = (0, auth_2.getProjectDefaultAccount)(options.projectRoot);
|
|
262
|
+
const emulatableBackends = [
|
|
263
|
+
{
|
|
264
|
+
functionsDir,
|
|
265
|
+
env: Object.assign({}, options.extensionEnv),
|
|
266
|
+
predefinedTriggers: options.extensionTriggers,
|
|
267
|
+
nodeMajorVersion: (0, functionsEmulatorUtils_1.parseRuntimeVersion)(options.extensionNodeVersion || options.config.get("functions.runtime")),
|
|
268
|
+
},
|
|
269
|
+
];
|
|
262
270
|
const functionsEmulator = new functionsEmulator_1.FunctionsEmulator({
|
|
263
271
|
projectId,
|
|
264
|
-
|
|
272
|
+
emulatableBackends,
|
|
265
273
|
account,
|
|
266
274
|
host: functionsAddr.host,
|
|
267
275
|
port: functionsAddr.port,
|
|
268
276
|
debugPort: inspectFunctions,
|
|
269
|
-
env: Object.assign({}, options.extensionEnv),
|
|
270
|
-
predefinedTriggers: options.extensionTriggers,
|
|
271
|
-
nodeMajorVersion: functionsEmulatorUtils_1.parseRuntimeVersion(options.extensionNodeVersion || options.config.get("functions.runtime")),
|
|
272
277
|
});
|
|
273
278
|
await startEmulator(functionsEmulator);
|
|
274
279
|
}
|
|
@@ -321,7 +326,7 @@ async function startAll(options, showUI = true) {
|
|
|
321
326
|
};
|
|
322
327
|
try {
|
|
323
328
|
if (!options.instance) {
|
|
324
|
-
options.instance = await getDefaultDatabaseInstance_1.getDefaultDatabaseInstance(options);
|
|
329
|
+
options.instance = await (0, getDefaultDatabaseInstance_1.getDefaultDatabaseInstance)(options);
|
|
325
330
|
}
|
|
326
331
|
}
|
|
327
332
|
catch (e) {
|
|
@@ -465,7 +470,7 @@ async function exportEmulatorData(exportPath, options) {
|
|
|
465
470
|
if (options.noninteractive) {
|
|
466
471
|
throw new error_1.FirebaseError("Export already exists in the target directory, re-run with --force to overwrite.", { exit: 1 });
|
|
467
472
|
}
|
|
468
|
-
const prompt = await prompt_1.promptOnce({
|
|
473
|
+
const prompt = await (0, prompt_1.promptOnce)({
|
|
469
474
|
type: "confirm",
|
|
470
475
|
message: `The directory ${exportAbsPath} already contains export data. Exporting again to the same directory will overwrite all data. Do you want to continue?`,
|
|
471
476
|
default: false,
|
|
@@ -308,7 +308,7 @@ async function downloadIfNecessary(targetName) {
|
|
|
308
308
|
if (hasEmulator) {
|
|
309
309
|
return;
|
|
310
310
|
}
|
|
311
|
-
await download_1.downloadEmulator(targetName);
|
|
311
|
+
await (0, download_1.downloadEmulator)(targetName);
|
|
312
312
|
}
|
|
313
313
|
exports.downloadIfNecessary = downloadIfNecessary;
|
|
314
314
|
async function start(targetName, args, extraEnv = {}) {
|
|
@@ -321,7 +321,7 @@ async function start(targetName, args, extraEnv = {}) {
|
|
|
321
321
|
if (process.env.CI) {
|
|
322
322
|
utils.logWarning(`It appears you are running in a CI environment. You can avoid downloading the ${constants_1.Constants.description(targetName)} repeatedly by caching the ${downloadDetails.opts.cacheDir} directory.`);
|
|
323
323
|
}
|
|
324
|
-
await download_1.downloadEmulator(targetName);
|
|
324
|
+
await (0, download_1.downloadEmulator)(targetName);
|
|
325
325
|
}
|
|
326
326
|
else {
|
|
327
327
|
utils.logWarning("Setup required, please run: firebase setup:emulators:" + targetName);
|
|
@@ -90,7 +90,7 @@ class EmulatorLogger {
|
|
|
90
90
|
this.handleSystemLog(log);
|
|
91
91
|
break;
|
|
92
92
|
case "USER":
|
|
93
|
-
this.log("USER", `${clc.blackBright("> ")} ${log.text}`, Object.assign({ user: utils_1.tryParse(log.text) }, this.data));
|
|
93
|
+
this.log("USER", `${clc.blackBright("> ")} ${log.text}`, Object.assign({ user: (0, utils_1.tryParse)(log.text) }, this.data));
|
|
94
94
|
break;
|
|
95
95
|
case "DEBUG":
|
|
96
96
|
if (log.data && Object.keys(log.data).length > 0) {
|