firebase-tools 11.4.1 → 11.6.0
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/accountImporter.js +1 -1
- package/lib/auth.js +3 -4
- package/lib/bin/firebase.js +4 -4
- package/lib/command.js +35 -10
- package/lib/commands/apps-android-sha-create.js +1 -1
- package/lib/commands/apps-android-sha-delete.js +1 -1
- package/lib/commands/apps-create.js +1 -1
- package/lib/commands/apps-list.js +1 -1
- package/lib/commands/auth-export.js +1 -1
- package/lib/commands/auth-import.js +1 -1
- package/lib/commands/database-instances-list.js +1 -1
- package/lib/commands/database-push.js +1 -1
- package/lib/commands/database-remove.js +1 -1
- package/lib/commands/database-set.js +1 -1
- package/lib/commands/database-update.js +1 -1
- package/lib/commands/emulators-exec.js +4 -1
- package/lib/commands/emulators-export.js +5 -2
- package/lib/commands/emulators-start.js +24 -18
- package/lib/commands/ext-dev-deprecate.js +1 -1
- package/lib/commands/ext-dev-emulators-exec.js +1 -1
- package/lib/commands/ext-dev-emulators-start.js +1 -1
- package/lib/commands/ext-dev-extension-delete.js +1 -1
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +4 -1
- package/lib/commands/ext-dev-register.js +1 -1
- package/lib/commands/ext-dev-undeprecate.js +1 -1
- package/lib/commands/ext-dev-unpublish.js +1 -1
- package/lib/commands/ext-dev-usage.js +1 -1
- package/lib/commands/ext-info.js +1 -1
- package/lib/commands/ext-install.js +2 -2
- package/lib/commands/ext-update.js +1 -1
- package/lib/commands/ext.js +1 -1
- package/lib/commands/firestore-delete.js +2 -2
- package/lib/commands/firestore-indexes-list.js +3 -3
- package/lib/commands/functions-config-clone.js +1 -1
- package/lib/commands/functions-config-export.js +1 -1
- package/lib/commands/functions-config-set.js +1 -1
- package/lib/commands/functions-config-unset.js +1 -1
- package/lib/commands/functions-delete.js +1 -1
- package/lib/commands/functions-secrets-set.js +1 -1
- package/lib/commands/help.js +1 -1
- package/lib/commands/hosting-channel-create.js +5 -5
- package/lib/commands/hosting-channel-delete.js +3 -3
- package/lib/commands/hosting-channel-deploy.js +6 -6
- package/lib/commands/hosting-channel-list.js +2 -2
- package/lib/commands/hosting-channel-open.js +2 -2
- package/lib/commands/hosting-clone.js +8 -8
- package/lib/commands/hosting-disable.js +1 -1
- package/lib/commands/hosting-sites-create.js +4 -4
- package/lib/commands/hosting-sites-delete.js +4 -4
- package/lib/commands/hosting-sites-list.js +2 -2
- package/lib/commands/init.js +5 -5
- package/lib/commands/login-add.js +1 -1
- package/lib/commands/login-ci.js +2 -2
- package/lib/commands/login-list.js +1 -1
- package/lib/commands/login-use.js +1 -1
- package/lib/commands/login.js +3 -3
- package/lib/commands/logout.js +1 -1
- package/lib/commands/open.js +3 -3
- package/lib/commands/projects-list.js +2 -2
- package/lib/commands/serve.js +1 -1
- package/lib/commands/target-apply.js +1 -1
- package/lib/commands/target-clear.js +1 -1
- package/lib/commands/target-remove.js +1 -1
- package/lib/commands/target.js +1 -1
- package/lib/commands/use.js +7 -7
- package/lib/config.js +1 -1
- package/lib/deploy/database/prepare.js +3 -3
- package/lib/deploy/database/release.js +3 -3
- package/lib/deploy/extensions/deploymentSummary.js +1 -1
- package/lib/deploy/extensions/errors.js +1 -1
- package/lib/deploy/extensions/secrets.js +1 -1
- package/lib/deploy/extensions/tasks.js +2 -2
- package/lib/deploy/firestore/deploy.js +2 -2
- package/lib/deploy/firestore/prepare.js +2 -2
- package/lib/deploy/functions/backend.js +7 -5
- package/lib/deploy/functions/build.js +110 -95
- package/lib/deploy/functions/checkIam.js +3 -3
- package/lib/deploy/functions/containerCleaner.js +2 -2
- package/lib/deploy/functions/deploy.js +2 -2
- package/lib/deploy/functions/ensure.js +2 -2
- package/lib/deploy/functions/params.js +5 -2
- package/lib/deploy/functions/prepare.js +4 -4
- package/lib/deploy/functions/prepareFunctionsUpload.js +2 -2
- package/lib/deploy/functions/pricing.js +3 -2
- package/lib/deploy/functions/prompts.js +2 -2
- package/lib/deploy/functions/release/fabricator.js +10 -9
- package/lib/deploy/functions/release/index.js +1 -1
- package/lib/deploy/functions/release/reporter.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/parsing.js +19 -8
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +112 -107
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +54 -26
- package/lib/deploy/functions/runtimes/node/versioning.js +4 -4
- package/lib/deploy/functions/services/storage.js +6 -0
- package/lib/deploy/functions/validate.js +1 -1
- package/lib/deploy/hosting/convertConfig.js +8 -1
- package/lib/deploy/hosting/deploy.js +10 -9
- package/lib/deploy/hosting/uploader.js +2 -2
- package/lib/deploy/hosting/validate.js +2 -2
- package/lib/deploy/index.js +7 -7
- package/lib/deploy/lifecycleHooks.js +5 -2
- package/lib/deploy/storage/prepare.js +5 -3
- package/lib/deploy/storage/release.js +7 -6
- package/lib/emulator/auth/index.js +7 -2
- package/lib/emulator/auth/operations.js +10 -10
- package/lib/emulator/commandUtils.js +33 -16
- package/lib/emulator/constants.js +14 -6
- package/lib/emulator/controller.js +55 -18
- package/lib/emulator/databaseEmulator.js +1 -1
- package/lib/emulator/downloadableEmulators.js +8 -8
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/eventarcEmulator.js +148 -0
- package/lib/emulator/extensionsEmulator.js +5 -3
- package/lib/emulator/firestoreEmulator.js +1 -1
- package/lib/emulator/functionsEmulator.js +66 -14
- package/lib/emulator/functionsEmulatorShared.js +12 -12
- package/lib/emulator/hub.js +7 -3
- package/lib/emulator/hubClient.js +2 -2
- package/lib/emulator/hubExport.js +22 -2
- package/lib/emulator/loggingEmulator.js +2 -2
- package/lib/emulator/registry.js +1 -0
- package/lib/emulator/storage/apis/firebase.js +13 -1
- package/lib/emulator/storage/apis/gcloud.js +15 -8
- package/lib/emulator/storage/files.js +25 -4
- package/lib/emulator/storage/metadata.js +6 -6
- package/lib/emulator/storage/multipart.js +4 -3
- package/lib/emulator/storage/rules/runtime.js +3 -3
- package/lib/emulator/storage/rules/utils.js +4 -2
- package/lib/emulator/storage/server.js +2 -1
- package/lib/emulator/storage/upload.js +1 -0
- package/lib/emulator/types.js +4 -0
- package/lib/emulator/ui.js +7 -2
- package/lib/ensureApiEnabled.js +7 -7
- package/lib/extensions/askUserForConsent.js +1 -1
- package/lib/extensions/askUserForEventsConfig.js +1 -1
- package/lib/extensions/askUserForParam.js +1 -1
- package/lib/extensions/changelog.js +2 -2
- package/lib/extensions/checkProjectBilling.js +2 -2
- package/lib/extensions/displayExtensionInfo.js +2 -102
- package/lib/extensions/emulator/triggerHelper.js +2 -2
- package/lib/extensions/extensionsApi.js +3 -2
- package/lib/extensions/extensionsHelper.js +30 -2
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/manifest.js +1 -1
- package/lib/extensions/metricsUtils.js +1 -1
- package/lib/extensions/paramHelper.js +1 -1
- package/lib/extensions/updateHelper.js +3 -9
- package/lib/extensions/warnings.js +2 -2
- package/lib/fetchMOTD.js +1 -1
- package/lib/firestore/delete.js +1 -1
- package/lib/firestore/indexes.js +2 -2
- package/lib/firestore/validator.js +1 -1
- package/lib/functional.js +16 -1
- package/lib/functions/env.js +3 -3
- package/lib/functions/runtimeConfigExport.js +1 -1
- package/lib/functionsConfig.js +1 -1
- package/lib/functionsConfigClone.js +1 -1
- package/lib/functionsShellCommandAction.js +1 -1
- package/lib/gcp/cloudfunctions.js +24 -11
- package/lib/gcp/cloudfunctionsv2.js +48 -24
- package/lib/gcp/cloudscheduler.js +58 -22
- package/lib/gcp/cloudtasks.js +21 -4
- package/lib/gcp/proto.js +18 -6
- package/lib/gcp/resourceManager.js +25 -3
- package/lib/gcp/serviceusage.js +2 -2
- package/lib/handlePreviewToggles.js +4 -4
- package/lib/hosting/implicitInit.js +1 -1
- package/lib/hosting/normalizedHostingConfigs.js +3 -3
- package/lib/index.js +2 -2
- package/lib/init/features/database.js +1 -1
- package/lib/init/features/emulators.js +1 -1
- package/lib/init/features/firestore/index.js +2 -2
- package/lib/init/features/firestore/indexes.js +1 -1
- package/lib/init/features/firestore/rules.js +1 -1
- package/lib/init/features/functions/golang.js +1 -1
- package/lib/init/features/functions/index.js +8 -1
- package/lib/init/features/hosting/github.js +9 -9
- package/lib/init/features/hosting/index.js +1 -1
- package/lib/init/features/project.js +1 -1
- package/lib/init/features/remoteconfig.js +1 -1
- package/lib/init/features/storage.js +1 -1
- package/lib/init/index.js +1 -1
- package/lib/logError.js +3 -3
- package/lib/management/projects.js +1 -1
- package/lib/parseBoltRules.js +1 -1
- package/lib/previews.js +1 -1
- package/lib/profileReport.js +2 -2
- package/lib/projectUtils.js +1 -1
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +1 -1
- package/lib/requireDatabaseInstance.js +2 -2
- package/lib/requirePermissions.js +2 -2
- package/lib/rulesDeploy.js +49 -13
- package/lib/serve/hosting.js +2 -1
- package/lib/serve/index.js +15 -0
- package/lib/track.js +119 -3
- package/lib/utils.js +24 -11
- package/npm-shrinkwrap.json +14 -294
- package/package.json +5 -4
- package/schema/firebase-config.json +12 -0
- package/templates/extensions/CHANGELOG.md +1 -7
- package/templates/hosting/init.js +6 -2
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkFunctionsSDKVersion = exports.getLatestSDKVersion = exports.getFunctionsSDKVersion = exports.FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const semver = require("semver");
|
|
7
7
|
const spawn = require("cross-spawn");
|
|
8
8
|
const utils = require("../../../../utils");
|
|
9
9
|
const logger_1 = require("../../../../logger");
|
|
10
10
|
const track_1 = require("../../../../track");
|
|
11
11
|
const MIN_SDK_VERSION = "2.0.0";
|
|
12
|
-
exports.FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING = clc.bold.yellow("functions: ") +
|
|
12
|
+
exports.FUNCTIONS_SDK_VERSION_TOO_OLD_WARNING = clc.bold(clc.yellow("functions: ")) +
|
|
13
13
|
"You must have a " +
|
|
14
14
|
clc.bold("firebase-functions") +
|
|
15
15
|
" version that is at least 2.0.0. Please run " +
|
|
@@ -62,12 +62,12 @@ function checkFunctionsSDKVersion(currentVersion) {
|
|
|
62
62
|
if (semver.eq(currentVersion, latest)) {
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
utils.logWarning(clc.bold.yellow("functions: ") +
|
|
65
|
+
utils.logWarning(clc.bold(clc.yellow("functions: ")) +
|
|
66
66
|
"package.json indicates an outdated version of firebase-functions. Please upgrade using " +
|
|
67
67
|
clc.bold("npm install --save firebase-functions@latest") +
|
|
68
68
|
" in your functions directory.");
|
|
69
69
|
if (semver.major(currentVersion) < semver.major(latest)) {
|
|
70
|
-
utils.logWarning(clc.bold.yellow("functions: ") +
|
|
70
|
+
utils.logWarning(clc.bold(clc.yellow("functions: ")) +
|
|
71
71
|
"Please note that there will be breaking changes when you upgrade.");
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -17,8 +17,14 @@ async function obtainStorageBindings(projectNumber) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.obtainStorageBindings = obtainStorageBindings;
|
|
19
19
|
async function ensureStorageTriggerRegion(endpoint) {
|
|
20
|
+
var _a;
|
|
20
21
|
const { eventTrigger } = endpoint;
|
|
21
22
|
if (!eventTrigger.region) {
|
|
23
|
+
logger_1.logger.debug("Looking up bucket region for the storage event trigger");
|
|
24
|
+
if (!((_a = eventTrigger.eventFilters) === null || _a === void 0 ? void 0 : _a.bucket)) {
|
|
25
|
+
throw new error_1.FirebaseError("Error: storage event trigger is missing bucket filter: " +
|
|
26
|
+
JSON.stringify(eventTrigger, null, 2));
|
|
27
|
+
}
|
|
22
28
|
logger_1.logger.debug(`Looking up bucket region for the storage event trigger on bucket ${eventTrigger.eventFilters.bucket}`);
|
|
23
29
|
try {
|
|
24
30
|
const bucket = await storage.getBucket(eventTrigger.eventFilters.bucket);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.secretsAreValid = exports.functionIdsAreValid = exports.functionsDirectoryExists = exports.endpointsAreUnique = exports.cpuConfigIsValid = exports.endpointsAreValid = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const secretManager_1 = require("../../gcp/secretManager");
|
|
8
8
|
const logger_1 = require("../../logger");
|
|
@@ -50,11 +50,18 @@ async function convertConfig(context, payload, config, finalize) {
|
|
|
50
50
|
(!functionsEndpointInfo.platform || endpoint.platform === functionsEndpointInfo.platform));
|
|
51
51
|
});
|
|
52
52
|
if (matchingBackends.length > 1) {
|
|
53
|
+
for (const endpoint of matchingBackends) {
|
|
54
|
+
if (endpoint.region === "us-central1") {
|
|
55
|
+
(0, utils_1.logLabeledBullet)(`hosting[${config.site}]`, `Function \`${functionsEndpointInfo.serviceId}\` found in multiple regions, defaulting to \`us-central1\`. ` +
|
|
56
|
+
`To rewrite to a different region, specify a \`region\` for the rewrite in \`firebase.json\`.`);
|
|
57
|
+
return endpoint;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
53
60
|
throw new error_1.FirebaseError(`More than one backend found for function name: ${functionsEndpointInfo.serviceId}. If the function is deployed in multiple regions, you must specify a region.`);
|
|
54
61
|
}
|
|
55
62
|
if (matchingBackends.length === 1) {
|
|
56
63
|
const endpoint = matchingBackends[0];
|
|
57
|
-
if (endpoint && (0, backend_1.isHttpsTriggered)(endpoint)) {
|
|
64
|
+
if (endpoint && ((0, backend_1.isHttpsTriggered)(endpoint) || (0, backend_1.isCallableTriggered)(endpoint))) {
|
|
58
65
|
return endpoint;
|
|
59
66
|
}
|
|
60
67
|
}
|
|
@@ -7,24 +7,21 @@ const listFiles_1 = require("../../listFiles");
|
|
|
7
7
|
const logger_1 = require("../../logger");
|
|
8
8
|
const track_1 = require("../../track");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const _ERASE_LINE = "\x1b[2K";
|
|
10
|
+
const colorette_1 = require("colorette");
|
|
11
|
+
const ora = require("ora");
|
|
13
12
|
async function deploy(context, options) {
|
|
14
13
|
var _a, _b;
|
|
15
14
|
if (!((_a = context.hosting) === null || _a === void 0 ? void 0 : _a.deploys)) {
|
|
16
15
|
return;
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
const spinner = ora();
|
|
19
18
|
function updateSpinner(newMessage, debugging) {
|
|
20
19
|
if (debugging) {
|
|
21
20
|
(0, utils_1.logLabeledBullet)("hosting", newMessage);
|
|
22
21
|
}
|
|
23
22
|
else {
|
|
24
|
-
|
|
25
|
-
process.stdout.write(clc.bold.cyan(SPINNER[spins % SPINNER.length] + " hosting: ") + newMessage);
|
|
23
|
+
spinner.text = `${(0, colorette_1.bold)((0, colorette_1.cyan)(" hosting:"))} ${newMessage}`;
|
|
26
24
|
}
|
|
27
|
-
spins++;
|
|
28
25
|
}
|
|
29
26
|
async function runDeploys(deploys, debugging) {
|
|
30
27
|
var _a;
|
|
@@ -40,7 +37,7 @@ async function deploy(context, options) {
|
|
|
40
37
|
const t0 = Date.now();
|
|
41
38
|
const publicDir = options.config.path(deploy.config.public);
|
|
42
39
|
const files = (0, listFiles_1.listFiles)(publicDir, deploy.config.ignore);
|
|
43
|
-
(0, utils_1.logLabeledBullet)(`hosting[${deploy.site}]`, `found ${files.length} files in ${
|
|
40
|
+
(0, utils_1.logLabeledBullet)(`hosting[${deploy.site}]`, `found ${files.length} files in ${(0, colorette_1.bold)(deploy.config.public)}`);
|
|
44
41
|
let concurrency = 200;
|
|
45
42
|
const envConcurrency = (0, utils_1.envOverride)("FIREBASE_HOSTING_UPLOAD_CONCURRENCY", "");
|
|
46
43
|
if (envConcurrency) {
|
|
@@ -59,6 +56,9 @@ async function deploy(context, options) {
|
|
|
59
56
|
uploadConcurrency: concurrency,
|
|
60
57
|
});
|
|
61
58
|
const progressInterval = setInterval(() => updateSpinner(uploader.statusMessage(), debugging), debugging ? 2000 : 200);
|
|
59
|
+
if (!debugging) {
|
|
60
|
+
spinner.start();
|
|
61
|
+
}
|
|
62
62
|
try {
|
|
63
63
|
await uploader.start();
|
|
64
64
|
}
|
|
@@ -68,9 +68,10 @@ async function deploy(context, options) {
|
|
|
68
68
|
}
|
|
69
69
|
finally {
|
|
70
70
|
clearInterval(progressInterval);
|
|
71
|
+
updateSpinner(uploader.statusMessage(), debugging);
|
|
71
72
|
}
|
|
72
73
|
if (!debugging) {
|
|
73
|
-
|
|
74
|
+
spinner.stop();
|
|
74
75
|
}
|
|
75
76
|
(0, utils_1.logLabeledSuccess)("hosting[" + deploy.site + "]", "file upload complete");
|
|
76
77
|
const dt = Date.now() - t0;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Uploader = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const abort_controller_1 = require("abort-controller");
|
|
6
|
-
const clc = require("
|
|
6
|
+
const clc = require("colorette");
|
|
7
7
|
const crypto = require("crypto");
|
|
8
8
|
const fs = require("fs");
|
|
9
9
|
const path = require("path");
|
|
@@ -19,7 +19,7 @@ const MAX_UPLOAD_TIMEOUT = 7200000;
|
|
|
19
19
|
function progressMessage(message, current, total) {
|
|
20
20
|
current = Math.min(current, total);
|
|
21
21
|
const percent = Math.floor(((current * 1.0) / total) * 100).toString();
|
|
22
|
-
return `${message} [${current}/${total}] (${clc.bold.green(`${percent}%`)})`;
|
|
22
|
+
return `${message} [${current}/${total}] (${clc.bold(clc.green(`${percent}%`))})`;
|
|
23
23
|
}
|
|
24
24
|
class Uploader {
|
|
25
25
|
constructor(options) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateDeploy = void 0;
|
|
4
4
|
const path = require("path");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const projectPath_1 = require("../../projectPath");
|
|
8
8
|
const fsutils_1 = require("../../fsutils");
|
|
@@ -33,7 +33,7 @@ function validateDeploy(deploy, options) {
|
|
|
33
33
|
else {
|
|
34
34
|
const i18nPath = path.join(cfg.public, cfg.i18n.root);
|
|
35
35
|
if (!(0, fsutils_1.dirExistsSync)((0, projectPath_1.resolveProjectPath)(options, i18nPath))) {
|
|
36
|
-
(0, utils_1.logLabeledWarning)("hosting", `Couldn't find specified i18n root directory ${clc.bold(cfg.i18n.root)} in public directory ${clc.bold(cfg.public)}.`);
|
|
36
|
+
(0, utils_1.logLabeledWarning)("hosting", `Couldn't find specified i18n root directory ${clc.bold(cfg.i18n.root)} in public directory ${clc.bold(cfg.public || "")}.`);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
}
|
package/lib/deploy/index.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deploy = void 0;
|
|
4
4
|
const logger_1 = require("../logger");
|
|
5
5
|
const api_1 = require("../api");
|
|
6
|
-
const
|
|
6
|
+
const colorette_1 = require("colorette");
|
|
7
7
|
const lodash_1 = require("lodash");
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const utils_1 = require("../utils");
|
|
@@ -52,7 +52,7 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
52
52
|
for (const targetName of targetNames) {
|
|
53
53
|
const target = TARGETS[targetName];
|
|
54
54
|
if (!target) {
|
|
55
|
-
return Promise.reject(new error_1.FirebaseError(`${(0,
|
|
55
|
+
return Promise.reject(new error_1.FirebaseError(`${(0, colorette_1.bold)(targetName)} is not a valid deploy target`));
|
|
56
56
|
}
|
|
57
57
|
predeploys.push((0, lifecycleHooks_1.lifecycleHooks)(targetName, "predeploy"));
|
|
58
58
|
prepares.push(target.prepare);
|
|
@@ -61,9 +61,9 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
61
61
|
postdeploys.push((0, lifecycleHooks_1.lifecycleHooks)(targetName, "postdeploy"));
|
|
62
62
|
}
|
|
63
63
|
logger_1.logger.info();
|
|
64
|
-
logger_1.logger.info((0,
|
|
64
|
+
logger_1.logger.info((0, colorette_1.bold)((0, colorette_1.white)("===") + " Deploying to '" + projectId + "'..."));
|
|
65
65
|
logger_1.logger.info();
|
|
66
|
-
(0, utils_1.logBullet)("deploying " + (0,
|
|
66
|
+
(0, utils_1.logBullet)("deploying " + (0, colorette_1.bold)(targetNames.join(", ")));
|
|
67
67
|
await chain(predeploys, context, options, payload);
|
|
68
68
|
await chain(prepares, context, options, payload);
|
|
69
69
|
await chain(deploys, context, options, payload);
|
|
@@ -75,13 +75,13 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
75
75
|
const duration = Date.now() - startTime;
|
|
76
76
|
await (0, track_1.track)("Product Deploy", [...targetNames].sort().join(","), duration);
|
|
77
77
|
logger_1.logger.info();
|
|
78
|
-
(0, utils_1.logSuccess)(
|
|
78
|
+
(0, utils_1.logSuccess)((0, colorette_1.bold)((0, colorette_1.underline)("Deploy complete!")));
|
|
79
79
|
logger_1.logger.info();
|
|
80
80
|
const deployedHosting = (0, lodash_1.includes)(targetNames, "hosting");
|
|
81
|
-
logger_1.logger.info((0,
|
|
81
|
+
logger_1.logger.info((0, colorette_1.bold)("Project Console:"), (0, utils_1.consoleUrl)(options.project, "/overview"));
|
|
82
82
|
if (deployedHosting) {
|
|
83
83
|
(0, lodash_1.each)(context.hosting.deploys, (deploy) => {
|
|
84
|
-
logger_1.logger.info((0,
|
|
84
|
+
logger_1.logger.info((0, colorette_1.bold)("Hosting URL:"), (0, utils_1.addSubdomain)(api_1.hostingOrigin, deploy.site));
|
|
85
85
|
});
|
|
86
86
|
const versionNames = context.hosting.deploys.map((deploy) => deploy.version);
|
|
87
87
|
return { hosting: versionNames.length === 1 ? versionNames[0] : versionNames };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lifecycleHooks = void 0;
|
|
4
4
|
const utils = require("../utils");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const childProcess = require("child_process");
|
|
7
7
|
const error_1 = require("../error");
|
|
8
8
|
const needProjectId = require("../projectUtils").needProjectId;
|
|
@@ -82,7 +82,10 @@ function runTargetCommands(target, hook, overallOptions, config) {
|
|
|
82
82
|
}
|
|
83
83
|
return runAllCommands
|
|
84
84
|
.then(() => {
|
|
85
|
-
utils.logSuccess(clc.green.bold(logIdentifier + ":")
|
|
85
|
+
utils.logSuccess(clc.green(clc.bold(logIdentifier + ":")) +
|
|
86
|
+
" Finished running " +
|
|
87
|
+
clc.bold(hook) +
|
|
88
|
+
" script.");
|
|
86
89
|
})
|
|
87
90
|
.catch((err) => {
|
|
88
91
|
throw new error_1.FirebaseError(logIdentifier + " " + hook + " error: " + err.message);
|
|
@@ -24,13 +24,11 @@ async function default_1(context, options) {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
_.set(context, "storage.rules", rulesConfig);
|
|
28
27
|
const rulesDeploy = new rulesDeploy_1.RulesDeploy(options, rulesDeploy_1.RulesetServiceType.FIREBASE_STORAGE);
|
|
29
|
-
|
|
28
|
+
const rulesConfigsToDeploy = [];
|
|
30
29
|
if (!Array.isArray(rulesConfig)) {
|
|
31
30
|
const defaultBucket = await gcp.storage.getDefaultBucket(options.project);
|
|
32
31
|
rulesConfig = [Object.assign(rulesConfig, { bucket: defaultBucket })];
|
|
33
|
-
_.set(context, "storage.rules", rulesConfig);
|
|
34
32
|
}
|
|
35
33
|
for (const ruleConfig of rulesConfig) {
|
|
36
34
|
const target = ruleConfig.target;
|
|
@@ -39,12 +37,16 @@ async function default_1(context, options) {
|
|
|
39
37
|
}
|
|
40
38
|
if (allStorage || onlyTargets.has(target)) {
|
|
41
39
|
rulesDeploy.addFile(ruleConfig.rules);
|
|
40
|
+
rulesConfigsToDeploy.push(ruleConfig);
|
|
42
41
|
onlyTargets.delete(target);
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
if (!allStorage && onlyTargets.size !== 0) {
|
|
46
45
|
throw new error_1.FirebaseError(`Could not find rules for the following storage targets: ${[...onlyTargets].join(", ")}`);
|
|
47
46
|
}
|
|
47
|
+
_.set(context, "storage.rules", rulesConfig);
|
|
48
|
+
_.set(context, "storage.rulesConfigsToDeploy", rulesConfigsToDeploy);
|
|
49
|
+
_.set(context, "storage.rulesDeploy", rulesDeploy);
|
|
48
50
|
await rulesDeploy.compile();
|
|
49
51
|
}
|
|
50
52
|
exports.default = default_1;
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const lodash_1 = require("lodash");
|
|
4
4
|
const rulesDeploy_1 = require("../../rulesDeploy");
|
|
5
5
|
async function default_1(context, options) {
|
|
6
|
-
const
|
|
6
|
+
const rulesConfigsToDeploy = (0, lodash_1.get)(context, "storage.rulesConfigsToDeploy", []);
|
|
7
7
|
const rulesDeploy = (0, lodash_1.get)(context, "storage.rulesDeploy");
|
|
8
|
-
if (!
|
|
9
|
-
return;
|
|
8
|
+
if (!rulesConfigsToDeploy.length || !rulesDeploy) {
|
|
9
|
+
return [];
|
|
10
10
|
}
|
|
11
11
|
const toRelease = [];
|
|
12
|
-
for (const ruleConfig of
|
|
12
|
+
for (const ruleConfig of rulesConfigsToDeploy) {
|
|
13
13
|
if (ruleConfig.target) {
|
|
14
14
|
options.rc.target(options.project, "storage", ruleConfig.target).forEach((bucket) => {
|
|
15
15
|
toRelease.push({ bucket: bucket, rules: ruleConfig.rules });
|
|
@@ -19,8 +19,9 @@ async function default_1(context, options) {
|
|
|
19
19
|
toRelease.push({ bucket: ruleConfig.bucket, rules: ruleConfig.rules });
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
await Promise.all(toRelease.map((
|
|
23
|
-
return rulesDeploy.release(
|
|
22
|
+
await Promise.all(toRelease.map((r) => {
|
|
23
|
+
return rulesDeploy.release(r.rules, rulesDeploy_1.RulesetServiceType.FIREBASE_STORAGE, r.bucket);
|
|
24
24
|
}));
|
|
25
|
+
return toRelease.map((r) => r.bucket);
|
|
25
26
|
}
|
|
26
27
|
exports.default = default_1;
|
|
@@ -10,6 +10,7 @@ const emulatorLogger_1 = require("../emulatorLogger");
|
|
|
10
10
|
const types_1 = require("../types");
|
|
11
11
|
const server_1 = require("./server");
|
|
12
12
|
const error_1 = require("../../error");
|
|
13
|
+
const track_1 = require("../../track");
|
|
13
14
|
class AuthEmulator {
|
|
14
15
|
constructor(args) {
|
|
15
16
|
this.args = args;
|
|
@@ -37,8 +38,12 @@ class AuthEmulator {
|
|
|
37
38
|
getName() {
|
|
38
39
|
return types_1.Emulators.AUTH;
|
|
39
40
|
}
|
|
40
|
-
async importData(authExportDir, projectId) {
|
|
41
|
-
|
|
41
|
+
async importData(authExportDir, projectId, options) {
|
|
42
|
+
void (0, track_1.trackEmulator)("emulator_import", {
|
|
43
|
+
initiated_by: options.initiatedBy,
|
|
44
|
+
emulator_name: types_1.Emulators.AUTH,
|
|
45
|
+
});
|
|
46
|
+
const logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.AUTH);
|
|
42
47
|
const { host, port } = this.getInfo();
|
|
43
48
|
const configPath = path.join(authExportDir, "config.json");
|
|
44
49
|
const configStat = await stat(configPath);
|
|
@@ -340,7 +340,7 @@ function batchCreate(state, reqBody) {
|
|
|
340
340
|
}
|
|
341
341
|
fields.emailVerified = !!userInfo.emailVerified;
|
|
342
342
|
fields.disabled = !!userInfo.disabled;
|
|
343
|
-
if (userInfo.mfaInfo) {
|
|
343
|
+
if (userInfo.mfaInfo && userInfo.mfaInfo.length > 0) {
|
|
344
344
|
fields.mfaInfo = [];
|
|
345
345
|
(0, errors_1.assert)(fields.email, "Second factor account requires email to be presented.");
|
|
346
346
|
(0, errors_1.assert)(fields.emailVerified, "Second factor account requires email to be verified.");
|
|
@@ -1716,14 +1716,14 @@ function fakeFetchUserInfoFromIdp(providerId, claims, samlResponse) {
|
|
|
1716
1716
|
switch (providerId) {
|
|
1717
1717
|
case "google.com": {
|
|
1718
1718
|
federatedId = `https://accounts.google.com/${rawId}`;
|
|
1719
|
-
let
|
|
1719
|
+
let grantedScopes = "openid https://www.googleapis.com/auth/userinfo.profile";
|
|
1720
1720
|
if (email) {
|
|
1721
|
-
|
|
1721
|
+
grantedScopes += " https://www.googleapis.com/auth/userinfo.email";
|
|
1722
1722
|
}
|
|
1723
1723
|
response.firstName = claims.given_name;
|
|
1724
1724
|
response.lastName = claims.family_name;
|
|
1725
1725
|
response.rawUserInfo = JSON.stringify({
|
|
1726
|
-
granted_scopes,
|
|
1726
|
+
granted_scopes: grantedScopes,
|
|
1727
1727
|
id: rawId,
|
|
1728
1728
|
name: displayName,
|
|
1729
1729
|
given_name: claims.given_name,
|
|
@@ -2064,7 +2064,7 @@ function generateBlockingFunctionJwt(state, event, url, timeoutMs, user, options
|
|
|
2064
2064
|
jwt.tenant_id = state.tenantId;
|
|
2065
2065
|
jwt.user_record.tenant_id = state.tenantId;
|
|
2066
2066
|
}
|
|
2067
|
-
const
|
|
2067
|
+
const providerData = [];
|
|
2068
2068
|
if (user.providerUserInfo) {
|
|
2069
2069
|
for (const providerUserInfo of user.providerUserInfo) {
|
|
2070
2070
|
const provider = {
|
|
@@ -2075,12 +2075,12 @@ function generateBlockingFunctionJwt(state, event, url, timeoutMs, user, options
|
|
|
2075
2075
|
uid: providerUserInfo.rawId,
|
|
2076
2076
|
phone_number: providerUserInfo.phoneNumber,
|
|
2077
2077
|
};
|
|
2078
|
-
|
|
2078
|
+
providerData.push(provider);
|
|
2079
2079
|
}
|
|
2080
2080
|
}
|
|
2081
|
-
jwt.user_record.provider_data =
|
|
2081
|
+
jwt.user_record.provider_data = providerData;
|
|
2082
2082
|
if (user.mfaInfo) {
|
|
2083
|
-
const
|
|
2083
|
+
const enrolledFactors = [];
|
|
2084
2084
|
for (const mfaEnrollment of user.mfaInfo) {
|
|
2085
2085
|
if (!mfaEnrollment.mfaEnrollmentId) {
|
|
2086
2086
|
continue;
|
|
@@ -2092,10 +2092,10 @@ function generateBlockingFunctionJwt(state, event, url, timeoutMs, user, options
|
|
|
2092
2092
|
phone_number: mfaEnrollment.phoneInfo,
|
|
2093
2093
|
factor_id: state_1.PROVIDER_PHONE,
|
|
2094
2094
|
};
|
|
2095
|
-
|
|
2095
|
+
enrolledFactors.push(enrolledFactor);
|
|
2096
2096
|
}
|
|
2097
2097
|
jwt.user_record.multi_factor = {
|
|
2098
|
-
enrolled_factors,
|
|
2098
|
+
enrolled_factors: enrolledFactors,
|
|
2099
2099
|
};
|
|
2100
2100
|
}
|
|
2101
2101
|
if (user.lastLoginAt || user.createdAt) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JAVA_DEPRECATION_WARNING = exports.
|
|
4
|
-
const clc = require("
|
|
3
|
+
exports.JAVA_DEPRECATION_WARNING = exports.MIN_SUPPORTED_JAVA_MAJOR_VERSION = exports.checkJavaMajorVersion = exports.emulatorExec = exports.shutdownWhenKilled = exports.setExportOnExitOptions = exports.parseInspectionPort = exports.beforeEmulatorCommand = exports.warnEmulatorNotSupported = exports.printNoticeIfEmulated = exports.DESC_TEST_PARAMS = exports.FLAG_TEST_PARAMS = exports.DESC_TEST_CONFIG = exports.FLAG_TEST_CONFIG = exports.DESC_UI = exports.FLAG_UI = exports.EXPORT_ON_EXIT_CWD_DANGER = exports.EXPORT_ON_EXIT_USAGE_ERROR = exports.DESC_EXPORT_ON_EXIT = exports.FLAG_EXPORT_ON_EXIT = exports.FLAG_EXPORT_ON_EXIT_NAME = exports.DESC_IMPORT = exports.FLAG_IMPORT = exports.DESC_INSPECT_FUNCTIONS = exports.FLAG_INSPECT_FUNCTIONS = exports.DESC_ONLY = exports.FLAG_ONLY = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const childProcess = require("child_process");
|
|
6
6
|
const controller = require("../emulator/controller");
|
|
7
7
|
const config_1 = require("../config");
|
|
@@ -20,6 +20,7 @@ const prompt_1 = require("../prompt");
|
|
|
20
20
|
const controller_1 = require("./controller");
|
|
21
21
|
const fsutils = require("../fsutils");
|
|
22
22
|
const Table = require("cli-table");
|
|
23
|
+
const track_1 = require("../track");
|
|
23
24
|
exports.FLAG_ONLY = "--only <emulators>";
|
|
24
25
|
exports.DESC_ONLY = "only specific emulators. " +
|
|
25
26
|
"This is a comma separated list of emulator names. " +
|
|
@@ -43,7 +44,14 @@ exports.FLAG_TEST_CONFIG = "--test-config <firebase.json file>";
|
|
|
43
44
|
exports.DESC_TEST_CONFIG = "A firebase.json style file. Used to configure the Firestore and Realtime Database emulators.";
|
|
44
45
|
exports.FLAG_TEST_PARAMS = "--test-params <params.env file>";
|
|
45
46
|
exports.DESC_TEST_PARAMS = "A .env file containing test param values for your emulated extension.";
|
|
46
|
-
const DEFAULT_CONFIG = new config_1.Config({
|
|
47
|
+
const DEFAULT_CONFIG = new config_1.Config({
|
|
48
|
+
eventarc: {},
|
|
49
|
+
database: {},
|
|
50
|
+
firestore: {},
|
|
51
|
+
functions: {},
|
|
52
|
+
hosting: {},
|
|
53
|
+
emulators: { auth: {}, pubsub: {} },
|
|
54
|
+
}, {});
|
|
47
55
|
function printNoticeIfEmulated(options, emulator) {
|
|
48
56
|
if (emulator !== types_1.Emulators.DATABASE && emulator !== types_1.Emulators.FIRESTORE) {
|
|
49
57
|
return;
|
|
@@ -201,14 +209,10 @@ function shutdownWhenKilled(options) {
|
|
|
201
209
|
["SIGINT", "SIGTERM", "SIGHUP", "SIGQUIT"].forEach((signal) => {
|
|
202
210
|
process.on(signal, processKillSignal(signal, res, rej, options));
|
|
203
211
|
});
|
|
204
|
-
})
|
|
205
|
-
.then(() => {
|
|
206
|
-
process.exit(0);
|
|
207
|
-
})
|
|
208
|
-
.catch((e) => {
|
|
212
|
+
}).catch((e) => {
|
|
209
213
|
logger_1.logger.debug(e);
|
|
210
214
|
utils.logLabeledWarning("emulators", "emulators failed to shut down cleanly, see firebase-debug.log for details.");
|
|
211
|
-
|
|
215
|
+
throw e;
|
|
212
216
|
});
|
|
213
217
|
}
|
|
214
218
|
exports.shutdownWhenKilled = shutdownWhenKilled;
|
|
@@ -247,6 +251,12 @@ async function runScript(script, extraEnv) {
|
|
|
247
251
|
const address = registry_1.EmulatorRegistry.getInfoHostString(info);
|
|
248
252
|
env[constants_1.Constants.FIREBASE_EMULATOR_HUB] = address;
|
|
249
253
|
}
|
|
254
|
+
const eventarcInstance = registry_1.EmulatorRegistry.get(types_1.Emulators.EVENTARC);
|
|
255
|
+
if (eventarcInstance) {
|
|
256
|
+
const info = eventarcInstance.getInfo();
|
|
257
|
+
const address = registry_1.EmulatorRegistry.getInfoHostString(info);
|
|
258
|
+
env[constants_1.Constants.CLOUD_EVENTARC_EMULATOR_HOST] = address;
|
|
259
|
+
}
|
|
250
260
|
const proc = childProcess.spawn(script, {
|
|
251
261
|
stdio: ["inherit", "inherit", "inherit"],
|
|
252
262
|
shell: true,
|
|
@@ -280,12 +290,15 @@ async function runScript(script, extraEnv) {
|
|
|
280
290
|
});
|
|
281
291
|
}
|
|
282
292
|
async function emulatorExec(script, options) {
|
|
283
|
-
shutdownWhenKilled(options);
|
|
284
293
|
const projectId = (0, projectUtils_1.getProjectId)(options);
|
|
285
294
|
const extraEnv = {};
|
|
286
295
|
if (projectId) {
|
|
287
296
|
extraEnv.GCLOUD_PROJECT = projectId;
|
|
288
297
|
}
|
|
298
|
+
const session = (0, track_1.emulatorSession)();
|
|
299
|
+
if (session && session.debugMode) {
|
|
300
|
+
extraEnv[constants_1.Constants.FIREBASE_GA_SESSION] = JSON.stringify(session);
|
|
301
|
+
}
|
|
289
302
|
let exitCode = 0;
|
|
290
303
|
let deprecationNotices;
|
|
291
304
|
try {
|
|
@@ -308,9 +321,8 @@ async function emulatorExec(script, options) {
|
|
|
308
321
|
}
|
|
309
322
|
exports.emulatorExec = emulatorExec;
|
|
310
323
|
const JAVA_VERSION_REGEX = /version "([1-9][0-9]*)/;
|
|
311
|
-
const MIN_SUPPORTED_JAVA_MAJOR_VERSION = 11;
|
|
312
324
|
const JAVA_HINT = "Please make sure Java is installed and on your system PATH.";
|
|
313
|
-
async function
|
|
325
|
+
async function checkJavaMajorVersion() {
|
|
314
326
|
return new Promise((resolve, reject) => {
|
|
315
327
|
var _a, _b;
|
|
316
328
|
let child;
|
|
@@ -351,25 +363,30 @@ async function checkJavaSupported() {
|
|
|
351
363
|
}
|
|
352
364
|
});
|
|
353
365
|
}).then((output) => {
|
|
366
|
+
let versionInt = -1;
|
|
354
367
|
const match = output.match(JAVA_VERSION_REGEX);
|
|
355
368
|
if (match) {
|
|
356
369
|
const version = match[1];
|
|
357
|
-
|
|
370
|
+
versionInt = parseInt(version, 10);
|
|
358
371
|
if (!versionInt) {
|
|
359
372
|
utils.logLabeledWarning("emulators", `Failed to parse Java version. Got "${match[0]}".`, "warn");
|
|
360
373
|
}
|
|
361
374
|
else {
|
|
362
375
|
logger_1.logger.debug(`Parsed Java major version: ${versionInt}`);
|
|
363
|
-
return versionInt >= MIN_SUPPORTED_JAVA_MAJOR_VERSION;
|
|
364
376
|
}
|
|
365
377
|
}
|
|
366
378
|
else {
|
|
367
379
|
logger_1.logger.debug("java -version outputs:", output);
|
|
368
380
|
logger_1.logger.warn(`Failed to parse Java version.`);
|
|
369
381
|
}
|
|
370
|
-
|
|
382
|
+
const session = (0, track_1.emulatorSession)();
|
|
383
|
+
if (session) {
|
|
384
|
+
session.javaMajorVersion = versionInt;
|
|
385
|
+
}
|
|
386
|
+
return versionInt;
|
|
371
387
|
});
|
|
372
388
|
}
|
|
373
|
-
exports.
|
|
389
|
+
exports.checkJavaMajorVersion = checkJavaMajorVersion;
|
|
390
|
+
exports.MIN_SUPPORTED_JAVA_MAJOR_VERSION = 11;
|
|
374
391
|
exports.JAVA_DEPRECATION_WARNING = "firebase-tools no longer supports Java version before 11. " +
|
|
375
392
|
"Please upgrade to Java version 11 or above to continue using the emulators.";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Constants = exports.EMULATOR_DESCRIPTION = exports.FIND_AVAILBLE_PORT_BY_DEFAULT = void 0;
|
|
3
|
+
exports.Constants = exports.DEFAULT_HOST = exports.EMULATOR_DESCRIPTION = exports.FIND_AVAILBLE_PORT_BY_DEFAULT = exports.DEFAULT_PORTS = void 0;
|
|
4
4
|
const url = require("url");
|
|
5
|
-
|
|
5
|
+
exports.DEFAULT_PORTS = {
|
|
6
6
|
ui: 4000,
|
|
7
7
|
hub: 4400,
|
|
8
8
|
logging: 4500,
|
|
@@ -14,6 +14,7 @@ const DEFAULT_PORTS = {
|
|
|
14
14
|
database: 9000,
|
|
15
15
|
auth: 9099,
|
|
16
16
|
storage: 9199,
|
|
17
|
+
eventarc: 9299,
|
|
17
18
|
};
|
|
18
19
|
exports.FIND_AVAILBLE_PORT_BY_DEFAULT = {
|
|
19
20
|
ui: true,
|
|
@@ -27,6 +28,7 @@ exports.FIND_AVAILBLE_PORT_BY_DEFAULT = {
|
|
|
27
28
|
auth: false,
|
|
28
29
|
storage: false,
|
|
29
30
|
extensions: false,
|
|
31
|
+
eventarc: false,
|
|
30
32
|
};
|
|
31
33
|
exports.EMULATOR_DESCRIPTION = {
|
|
32
34
|
ui: "Emulator UI",
|
|
@@ -40,8 +42,9 @@ exports.EMULATOR_DESCRIPTION = {
|
|
|
40
42
|
auth: "Authentication Emulator",
|
|
41
43
|
storage: "Storage Emulator",
|
|
42
44
|
extensions: "Extensions Emulator",
|
|
45
|
+
eventarc: "Eventarc Emulator",
|
|
43
46
|
};
|
|
44
|
-
|
|
47
|
+
exports.DEFAULT_HOST = "localhost";
|
|
45
48
|
class Constants {
|
|
46
49
|
static getServiceName(service) {
|
|
47
50
|
switch (service) {
|
|
@@ -63,15 +66,17 @@ class Constants {
|
|
|
63
66
|
return "storage";
|
|
64
67
|
case this.SERVICE_TEST_LAB:
|
|
65
68
|
return "test lab";
|
|
69
|
+
case this.SERVICE_EVENTARC:
|
|
70
|
+
return "eventarc";
|
|
66
71
|
default:
|
|
67
72
|
return service;
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
static getDefaultHost() {
|
|
71
|
-
return DEFAULT_HOST;
|
|
76
|
+
return exports.DEFAULT_HOST;
|
|
72
77
|
}
|
|
73
78
|
static getDefaultPort(emulator) {
|
|
74
|
-
return DEFAULT_PORTS[emulator];
|
|
79
|
+
return exports.DEFAULT_PORTS[emulator];
|
|
75
80
|
}
|
|
76
81
|
static description(name) {
|
|
77
82
|
return exports.EMULATOR_DESCRIPTION[name];
|
|
@@ -82,7 +87,7 @@ class Constants {
|
|
|
82
87
|
normalized = `http://${normalized}`;
|
|
83
88
|
}
|
|
84
89
|
const u = url.parse(normalized);
|
|
85
|
-
return u.hostname || DEFAULT_HOST;
|
|
90
|
+
return u.hostname || exports.DEFAULT_HOST;
|
|
86
91
|
}
|
|
87
92
|
static isDemoProject(projectId) {
|
|
88
93
|
return !!projectId && projectId.startsWith(this.FAKE_PROJECT_ID_PREFIX);
|
|
@@ -97,10 +102,13 @@ Constants.FIREBASE_DATABASE_EMULATOR_HOST = "FIREBASE_DATABASE_EMULATOR_HOST";
|
|
|
97
102
|
Constants.FIREBASE_AUTH_EMULATOR_HOST = "FIREBASE_AUTH_EMULATOR_HOST";
|
|
98
103
|
Constants.FIREBASE_STORAGE_EMULATOR_HOST = "FIREBASE_STORAGE_EMULATOR_HOST";
|
|
99
104
|
Constants.CLOUD_STORAGE_EMULATOR_HOST = "STORAGE_EMULATOR_HOST";
|
|
105
|
+
Constants.CLOUD_EVENTARC_EMULATOR_HOST = "CLOUD_EVENTARC_EMULATOR_HOST";
|
|
100
106
|
Constants.FIREBASE_EMULATOR_HUB = "FIREBASE_EMULATOR_HUB";
|
|
107
|
+
Constants.FIREBASE_GA_SESSION = "FIREBASE_GA_SESSION";
|
|
101
108
|
Constants.SERVICE_FIRESTORE = "firestore.googleapis.com";
|
|
102
109
|
Constants.SERVICE_REALTIME_DATABASE = "firebaseio.com";
|
|
103
110
|
Constants.SERVICE_PUBSUB = "pubsub.googleapis.com";
|
|
111
|
+
Constants.SERVICE_EVENTARC = "eventarc.googleapis.com";
|
|
104
112
|
Constants.SERVICE_ANALYTICS = "app-measurement.com";
|
|
105
113
|
Constants.SERVICE_AUTH = "firebaseauth.googleapis.com";
|
|
106
114
|
Constants.SERVICE_CRASHLYTICS = "fabric.io";
|