firebase-tools 10.0.0 → 10.1.2
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/accountExporter.js +9 -8
- package/lib/accountImporter.js +10 -8
- package/lib/api.js +1 -0
- 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/bin/firebase.js +1 -1
- 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/auth-export.js +26 -25
- package/lib/commands/auth-import.js +88 -78
- 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 +2 -2
- package/lib/commands/database-set.js +2 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +2 -2
- package/lib/commands/ext-configure.js +3 -3
- 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 +4 -4
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +4 -4
- package/lib/commands/ext-dev-register.js +6 -6
- 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 +5 -5
- package/lib/commands/ext-install.js +27 -23
- package/lib/commands/ext-list.js +2 -2
- package/lib/commands/ext-sources-create.js +2 -2
- package/lib/commands/ext-uninstall.js +4 -4
- package/lib/commands/ext-update.js +18 -18
- package/lib/commands/ext.js +3 -3
- package/lib/commands/firestore-delete.js +1 -1
- package/lib/commands/functions-config-clone.js +22 -23
- package/lib/commands/functions-config-export.js +11 -11
- package/lib/commands/functions-config-get.js +22 -22
- package/lib/commands/functions-config-set.js +24 -22
- package/lib/commands/functions-config-unset.js +20 -22
- 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/help.js +12 -12
- package/lib/commands/hosting-channel-create.js +13 -13
- package/lib/commands/hosting-channel-delete.js +10 -10
- package/lib/commands/hosting-channel-deploy.js +18 -18
- package/lib/commands/hosting-channel-list.js +5 -5
- package/lib/commands/hosting-channel-open.js +9 -9
- package/lib/commands/hosting-clone.js +16 -16
- package/lib/commands/hosting-disable.js +1 -1
- 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-ci.js +10 -10
- 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 +7 -2
- package/lib/commands/setup-emulators-database.js +8 -7
- package/lib/commands/setup-emulators-firestore.js +8 -7
- package/lib/commands/setup-emulators-pubsub.js +5 -4
- package/lib/commands/setup-emulators-storage.js +4 -3
- package/lib/commands/setup-emulators-ui.js +8 -7
- package/lib/commands/target-apply.js +17 -16
- package/lib/commands/target-clear.js +11 -10
- package/lib/commands/target-remove.js +10 -9
- package/lib/commands/target.js +20 -20
- package/lib/config.js +6 -6
- package/lib/database/api.js +2 -2
- package/lib/defaultCredentials.js +3 -3
- 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 +4 -4
- 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 +2 -2
- 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 +11 -14
- 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/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 +10 -9
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +107 -74
- package/lib/emulator/functionsEmulatorRuntime.js +36 -21
- 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 +10 -9
- 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 +3 -4
- package/lib/extensions/askUserForParam.js +11 -11
- package/lib/extensions/billingMigrationHelper.js +2 -2
- package/lib/extensions/changelog.js +4 -4
- package/lib/extensions/displayExtensionInfo.js +6 -6
- 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 +69 -110
- package/lib/extensions/extensionsHelper.js +56 -43
- 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 +13 -14
- package/lib/extensions/resolveSource.js +6 -6
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/updateHelper.js +10 -10
- package/lib/extensions/utils.js +1 -1
- package/lib/extensions/warnings.js +11 -10
- 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 +7 -8
- 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/rules.js +18 -41
- 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 +2 -2
- package/lib/prompt.js +0 -1
- package/lib/rc.js +1 -1
- package/lib/remoteconfig/get.js +14 -8
- package/lib/remoteconfig/rollback.js +13 -6
- package/lib/remoteconfig/versionslist.js +13 -7
- 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 +24095 -0
- package/package.json +33 -30
- package/templates/init/hosting/index.html +1 -1
- package/CHANGELOG.md +0 -5
- package/lib/commands/functions-config-legacy.js +0 -45
- package/lib/prepareFirebaseRules.js +0 -58
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const requireConfig = require("../requireConfig");
|
|
6
|
+
const utils = require("../utils");
|
|
7
|
+
exports.default = new command_1.Command("target:remove <type> <resource>")
|
|
7
8
|
.description("remove a resource target")
|
|
8
9
|
.before(requireConfig)
|
|
9
|
-
.action(
|
|
10
|
-
|
|
10
|
+
.action((type, resource, options) => {
|
|
11
|
+
const name = options.rc.removeTarget(options.project, type, resource);
|
|
11
12
|
if (name) {
|
|
12
|
-
utils.logSuccess(
|
|
13
|
+
utils.logSuccess(`Removed ${type} target ${clc.bold(name)} from ${clc.bold(resource)}`);
|
|
13
14
|
}
|
|
14
15
|
else {
|
|
15
|
-
utils.logWarning(
|
|
16
|
+
utils.logWarning(`No action taken. No target found for ${type} resource ${clc.bold(resource)}`);
|
|
16
17
|
}
|
|
17
18
|
return Promise.resolve(name);
|
|
18
19
|
});
|
package/lib/commands/target.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
logger.info(clc.cyan("[ " + type + " ]"));
|
|
10
|
-
|
|
11
|
-
logger.info(name, "(" + (resources || []).join(",") + ")");
|
|
12
|
-
}
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const requireConfig = require("../requireConfig");
|
|
7
|
+
const utils = require("../utils");
|
|
8
|
+
function logTargets(type, targets) {
|
|
9
|
+
logger_1.logger.info(clc.cyan("[ " + type + " ]"));
|
|
10
|
+
for (const [name, resources] of Object.entries(targets)) {
|
|
11
|
+
logger_1.logger.info(name, "(" + (resources || []).join(",") + ")");
|
|
12
|
+
}
|
|
13
13
|
}
|
|
14
|
-
|
|
14
|
+
exports.default = new command_1.Command("target [type]")
|
|
15
15
|
.description("display configured deploy targets for the current project")
|
|
16
16
|
.before(requireConfig)
|
|
17
|
-
.action(
|
|
17
|
+
.action((type, options) => {
|
|
18
18
|
if (!options.project) {
|
|
19
19
|
return utils.reject("No active project, cannot list deploy targets.");
|
|
20
20
|
}
|
|
21
|
-
logger.info("Resource targets for", clc.bold(options.project) + ":");
|
|
22
|
-
logger.info();
|
|
21
|
+
logger_1.logger.info("Resource targets for", clc.bold(options.project) + ":");
|
|
22
|
+
logger_1.logger.info();
|
|
23
23
|
if (type) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
24
|
+
const targets = options.rc.targets(options.project, type);
|
|
25
|
+
logTargets(type, targets);
|
|
26
|
+
return targets;
|
|
27
27
|
}
|
|
28
28
|
const allTargets = options.rc.allTargets(options.project);
|
|
29
29
|
for (const [targetType, targetName] of Object.entries(allTargets)) {
|
|
30
|
-
|
|
30
|
+
logTargets(targetType, targetName);
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return allTargets;
|
|
33
33
|
});
|
package/lib/config.js
CHANGED
|
@@ -22,7 +22,7 @@ class Config {
|
|
|
22
22
|
this.defaults = {};
|
|
23
23
|
this.notes = {};
|
|
24
24
|
this.options = options || {};
|
|
25
|
-
this.projectDir = options.projectDir || detectProjectRoot_1.detectProjectRoot(options);
|
|
25
|
+
this.projectDir = options.projectDir || (0, detectProjectRoot_1.detectProjectRoot)(options);
|
|
26
26
|
this._src = src;
|
|
27
27
|
if (this._src.firebase) {
|
|
28
28
|
this.defaults.project = this._src.firebase;
|
|
@@ -64,7 +64,7 @@ class Config {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
parseFile(target, filePath) {
|
|
67
|
-
const fullPath = projectPath_1.resolveProjectPath(this.options, filePath);
|
|
67
|
+
const fullPath = (0, projectPath_1.resolveProjectPath)(this.options, filePath);
|
|
68
68
|
const ext = path.extname(filePath);
|
|
69
69
|
if (!fsutils.fileExistsSync(fullPath)) {
|
|
70
70
|
throw new error_1.FirebaseError("Parse Error: Imported file " + filePath + " does not exist", {
|
|
@@ -148,7 +148,7 @@ class Config {
|
|
|
148
148
|
const writeTo = this.path(p);
|
|
149
149
|
let next;
|
|
150
150
|
if (fsutils.fileExistsSync(writeTo) && !force) {
|
|
151
|
-
next = prompt_1.promptOnce({
|
|
151
|
+
next = (0, prompt_1.promptOnce)({
|
|
152
152
|
type: "confirm",
|
|
153
153
|
message: "File " + clc.underline(p) + " already exists. Overwrite?",
|
|
154
154
|
default: false,
|
|
@@ -168,17 +168,17 @@ class Config {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
static load(options, allowMissing) {
|
|
171
|
-
const pd = detectProjectRoot_1.detectProjectRoot(options);
|
|
171
|
+
const pd = (0, detectProjectRoot_1.detectProjectRoot)(options);
|
|
172
172
|
const filename = options.configPath || Config.FILENAME;
|
|
173
173
|
if (pd) {
|
|
174
174
|
try {
|
|
175
175
|
const filePath = path.resolve(pd, path.basename(filename));
|
|
176
176
|
const data = cjson.load(filePath);
|
|
177
|
-
const validator = firebaseConfigValidate_1.getValidator();
|
|
177
|
+
const validator = (0, firebaseConfigValidate_1.getValidator)();
|
|
178
178
|
const valid = validator(data);
|
|
179
179
|
if (!valid && validator.errors) {
|
|
180
180
|
for (const e of validator.errors) {
|
|
181
|
-
logger_1.logger.debug(firebaseConfigValidate_1.getErrorMessage(e));
|
|
181
|
+
logger_1.logger.debug((0, firebaseConfigValidate_1.getErrorMessage)(e));
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
return new Config(data, options);
|
package/lib/database/api.js
CHANGED
|
@@ -4,11 +4,11 @@ exports.realtimeOriginOrCustomUrl = exports.realtimeOriginOrEmulatorOrCustomUrl
|
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const constants_1 = require("../emulator/constants");
|
|
6
6
|
function realtimeOriginOrEmulatorOrCustomUrl(host) {
|
|
7
|
-
return utils_1.envOverride(constants_1.Constants.FIREBASE_DATABASE_EMULATOR_HOST, utils_1.envOverride("FIREBASE_REALTIME_URL", host), addHttpIfRequired);
|
|
7
|
+
return (0, utils_1.envOverride)(constants_1.Constants.FIREBASE_DATABASE_EMULATOR_HOST, (0, utils_1.envOverride)("FIREBASE_REALTIME_URL", host), addHttpIfRequired);
|
|
8
8
|
}
|
|
9
9
|
exports.realtimeOriginOrEmulatorOrCustomUrl = realtimeOriginOrEmulatorOrCustomUrl;
|
|
10
10
|
function realtimeOriginOrCustomUrl(host) {
|
|
11
|
-
return utils_1.envOverride("FIREBASE_REALTIME_URL", host);
|
|
11
|
+
return (0, utils_1.envOverride)("FIREBASE_REALTIME_URL", host);
|
|
12
12
|
}
|
|
13
13
|
exports.realtimeOriginOrCustomUrl = realtimeOriginOrCustomUrl;
|
|
14
14
|
function addHttpIfRequired(val) {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.clearCredentials = exports.getCredentialPathAsync = void 0;
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
|
-
const
|
|
6
|
+
const api_1 = require("./api");
|
|
7
7
|
const logger_1 = require("./logger");
|
|
8
8
|
async function getCredentialPathAsync(account) {
|
|
9
9
|
const filePath = credFilePath(account.user);
|
|
@@ -43,8 +43,8 @@ exports.clearCredentials = clearCredentials;
|
|
|
43
43
|
function getCredential(tokens) {
|
|
44
44
|
if (tokens.refresh_token) {
|
|
45
45
|
return {
|
|
46
|
-
client_id:
|
|
47
|
-
client_secret:
|
|
46
|
+
client_id: api_1.clientId,
|
|
47
|
+
client_secret: api_1.clientSecret,
|
|
48
48
|
refresh_token: tokens.refresh_token,
|
|
49
49
|
type: "authorized_user",
|
|
50
50
|
};
|
|
@@ -11,14 +11,14 @@ const secrets_1 = require("./secrets");
|
|
|
11
11
|
const validate_1 = require("./validate");
|
|
12
12
|
async function deploy(context, options, payload) {
|
|
13
13
|
var _a, _b, _c, _d, _e, _f;
|
|
14
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
15
|
-
await validate_1.checkBilling(projectId, options.nonInteractive);
|
|
16
|
-
await provisioningHelper_1.bulkCheckProductsProvisioned(projectId, [
|
|
14
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
15
|
+
await (0, validate_1.checkBilling)(projectId, options.nonInteractive);
|
|
16
|
+
await (0, provisioningHelper_1.bulkCheckProductsProvisioned)(projectId, [
|
|
17
17
|
...((_a = payload.instancesToCreate) !== null && _a !== void 0 ? _a : []),
|
|
18
18
|
...((_b = payload.instancesToUpdate) !== null && _b !== void 0 ? _b : []),
|
|
19
19
|
...((_c = payload.instancesToConfigure) !== null && _c !== void 0 ? _c : []),
|
|
20
20
|
]);
|
|
21
|
-
await secrets_1.handleSecretParams(payload, context.have, options.nonInteractive);
|
|
21
|
+
await (0, secrets_1.handleSecretParams)(payload, context.have, options.nonInteractive);
|
|
22
22
|
const errorHandler = new errors_1.ErrorHandler();
|
|
23
23
|
const validationQueue = new queue_1.default({
|
|
24
24
|
retries: 5,
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deletesSummary = exports.configuresSummary = exports.updatesSummary = exports.createsSummary = exports.humanReadable = void 0;
|
|
4
4
|
const clc = require("cli-color");
|
|
5
5
|
const refs = require("../../extensions/refs");
|
|
6
|
-
|
|
6
|
+
const humanReadable = (dep) => `${clc.bold(dep.instanceId)} (${dep.ref ? `${refs.toExtensionVersionRef(dep.ref)}` : `Installed from local source`})`;
|
|
7
|
+
exports.humanReadable = humanReadable;
|
|
7
8
|
const humanReadableUpdate = (from, to) => {
|
|
8
9
|
var _a, _b, _c, _d, _e;
|
|
9
10
|
if (((_a = from.ref) === null || _a === void 0 ? void 0 : _a.publisherId) == ((_b = to.ref) === null || _b === void 0 ? void 0 : _b.publisherId) &&
|
|
@@ -18,7 +19,7 @@ const humanReadableUpdate = (from, to) => {
|
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
function createsSummary(toCreate) {
|
|
21
|
-
const instancesToCreate = toCreate.map((s) => `\t${exports.humanReadable(s)}`).join("\n");
|
|
22
|
+
const instancesToCreate = toCreate.map((s) => `\t${(0, exports.humanReadable)(s)}`).join("\n");
|
|
22
23
|
return toCreate.length
|
|
23
24
|
? `The following extension instances will be created:\n${instancesToCreate}\n`
|
|
24
25
|
: "";
|
|
@@ -37,14 +38,14 @@ function updatesSummary(toUpdate, have) {
|
|
|
37
38
|
}
|
|
38
39
|
exports.updatesSummary = updatesSummary;
|
|
39
40
|
function configuresSummary(toConfigure) {
|
|
40
|
-
const instancesToConfigure = toConfigure.map((s) => `\t${exports.humanReadable(s)}`).join("\n");
|
|
41
|
+
const instancesToConfigure = toConfigure.map((s) => `\t${(0, exports.humanReadable)(s)}`).join("\n");
|
|
41
42
|
return toConfigure.length
|
|
42
43
|
? `The following extension instances will be configured:\n${instancesToConfigure}\n`
|
|
43
44
|
: "";
|
|
44
45
|
}
|
|
45
46
|
exports.configuresSummary = configuresSummary;
|
|
46
47
|
function deletesSummary(toDelete) {
|
|
47
|
-
const instancesToDelete = toDelete.map((s) => `\t${exports.humanReadable(s)}`).join("\n");
|
|
48
|
+
const instancesToDelete = toDelete.map((s) => `\t${(0, exports.humanReadable)(s)}`).join("\n");
|
|
48
49
|
return toDelete.length
|
|
49
50
|
? `The following extension instances are not listed in 'firebase.json':\n${instancesToDelete}\n`
|
|
50
51
|
: "";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.release = exports.deploy = exports.prepare = void 0;
|
|
3
4
|
var prepare_1 = require("./prepare");
|
|
4
5
|
Object.defineProperty(exports, "prepare", { enumerable: true, get: function () { return prepare_1.prepare; } });
|
|
5
6
|
var deploy_1 = require("./deploy");
|
|
@@ -34,6 +34,6 @@ function readParams(args) {
|
|
|
34
34
|
exports.readParams = readParams;
|
|
35
35
|
function readParamsFile(projectDir, fileName) {
|
|
36
36
|
const paramPath = path.join(projectDir, ENV_DIRECTORY, fileName);
|
|
37
|
-
const params = paramHelper_1.readEnvFile(paramPath);
|
|
37
|
+
const params = (0, paramHelper_1.readEnvFile)(paramPath);
|
|
38
38
|
return params;
|
|
39
39
|
}
|
|
@@ -52,15 +52,15 @@ async function want(args) {
|
|
|
52
52
|
const instanceId = e[0];
|
|
53
53
|
const ref = refs.parse(e[1]);
|
|
54
54
|
ref.version = await resolveVersion(ref);
|
|
55
|
-
const params = params_1.readParams({
|
|
55
|
+
const params = (0, params_1.readParams)({
|
|
56
56
|
projectDir: args.projectDir,
|
|
57
57
|
instanceId,
|
|
58
58
|
projectId: args.projectId,
|
|
59
59
|
projectNumber: args.projectNumber,
|
|
60
60
|
aliases: args.aliases,
|
|
61
61
|
});
|
|
62
|
-
const autoPopulatedParams = await extensionsHelper_1.getFirebaseProjectParams(args.projectId);
|
|
63
|
-
const subbedParams = extensionsHelper_1.substituteParams(params, autoPopulatedParams);
|
|
62
|
+
const autoPopulatedParams = await (0, extensionsHelper_1.getFirebaseProjectParams)(args.projectId);
|
|
63
|
+
const subbedParams = (0, extensionsHelper_1.substituteParams)(params, autoPopulatedParams);
|
|
64
64
|
instanceSpecs.push({
|
|
65
65
|
instanceId,
|
|
66
66
|
ref,
|
|
@@ -15,11 +15,11 @@ const secrets_1 = require("./secrets");
|
|
|
15
15
|
const warnings_1 = require("../../extensions/warnings");
|
|
16
16
|
async function prepare(context, options, payload) {
|
|
17
17
|
var _a;
|
|
18
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
19
|
-
const projectNumber = await projectUtils_1.needProjectNumber(options);
|
|
20
|
-
const aliases = projectUtils_1.getAliases(options, projectId);
|
|
21
|
-
await extensionsHelper_1.ensureExtensionsApiEnabled(options);
|
|
22
|
-
await requirePermissions_1.requirePermissions(options, ["firebaseextensions.instances.list"]);
|
|
18
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
19
|
+
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
20
|
+
const aliases = (0, projectUtils_1.getAliases)(options, projectId);
|
|
21
|
+
await (0, extensionsHelper_1.ensureExtensionsApiEnabled)(options);
|
|
22
|
+
await (0, requirePermissions_1.requirePermissions)(options, ["firebaseextensions.instances.list"]);
|
|
23
23
|
context.have = await planner.have(projectId);
|
|
24
24
|
context.want = await planner.want({
|
|
25
25
|
projectId,
|
|
@@ -30,13 +30,13 @@ async function prepare(context, options, payload) {
|
|
|
30
30
|
});
|
|
31
31
|
const usingSecrets = await Promise.all((_a = context.have) === null || _a === void 0 ? void 0 : _a.map(secrets_1.checkSpecForSecrets));
|
|
32
32
|
if (usingSecrets.some((i) => i)) {
|
|
33
|
-
await secretsUtils_1.ensureSecretManagerApiEnabled(options);
|
|
33
|
+
await (0, secretsUtils_1.ensureSecretManagerApiEnabled)(options);
|
|
34
34
|
}
|
|
35
35
|
payload.instancesToCreate = context.want.filter((i) => { var _a; return !((_a = context.have) === null || _a === void 0 ? void 0 : _a.some(matchesInstanceId(i))); });
|
|
36
36
|
payload.instancesToConfigure = context.want.filter((i) => { var _a; return (_a = context.have) === null || _a === void 0 ? void 0 : _a.some(isConfigure(i)); });
|
|
37
37
|
payload.instancesToUpdate = context.want.filter((i) => { var _a; return (_a = context.have) === null || _a === void 0 ? void 0 : _a.some(isUpdate(i)); });
|
|
38
38
|
payload.instancesToDelete = context.have.filter((i) => { var _a; return !((_a = context.want) === null || _a === void 0 ? void 0 : _a.some(matchesInstanceId(i))); });
|
|
39
|
-
if (await warnings_1.displayWarningsForDeploy(payload.instancesToCreate)) {
|
|
39
|
+
if (await (0, warnings_1.displayWarningsForDeploy)(payload.instancesToCreate)) {
|
|
40
40
|
if (!options.force && options.nonInteractive) {
|
|
41
41
|
throw new error_1.FirebaseError("Pass the --force flag to acknowledge these terms in non-interactive mode");
|
|
42
42
|
}
|
|
@@ -50,7 +50,7 @@ async function prepare(context, options, payload) {
|
|
|
50
50
|
throw new error_1.FirebaseError("Deployment cancelled");
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
if (await warnings_1.displayWarningsForDeploy(payload.instancesToCreate)) {
|
|
53
|
+
if (await (0, warnings_1.displayWarningsForDeploy)(payload.instancesToCreate)) {
|
|
54
54
|
if (!options.force && options.nonInteractive) {
|
|
55
55
|
throw new error_1.FirebaseError("Pass the --force flag to acknowledge these terms in non-interactive mode");
|
|
56
56
|
}
|
|
@@ -97,7 +97,7 @@ async function prepare(context, options, payload) {
|
|
|
97
97
|
permissionsNeeded.push("firebaseextensions.instances.delete");
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
await requirePermissions_1.requirePermissions(options, permissionsNeeded);
|
|
100
|
+
await (0, requirePermissions_1.requirePermissions)(options, permissionsNeeded);
|
|
101
101
|
}
|
|
102
102
|
exports.prepare = prepare;
|
|
103
103
|
const matchesInstanceId = (dep) => (test) => {
|
|
@@ -8,7 +8,7 @@ const errors_1 = require("./errors");
|
|
|
8
8
|
const projectUtils_1 = require("../../projectUtils");
|
|
9
9
|
async function release(context, options, payload) {
|
|
10
10
|
var _a, _b, _c, _d;
|
|
11
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
11
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
12
12
|
const errorHandler = new errors_1.ErrorHandler();
|
|
13
13
|
const deploymentQueue = new queue_1.default({
|
|
14
14
|
retries: 5,
|
|
@@ -14,14 +14,14 @@ async function handleSecretParams(payload, have, nonInteractive) {
|
|
|
14
14
|
var _a, _b, _c;
|
|
15
15
|
for (const i of (_a = payload.instancesToCreate) !== null && _a !== void 0 ? _a : []) {
|
|
16
16
|
if (await checkSpecForSecrets(i)) {
|
|
17
|
-
utils_1.logLabeledBullet("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
|
|
17
|
+
(0, utils_1.logLabeledBullet)("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
|
|
18
18
|
await handleSecretsCreateInstance(i, nonInteractive);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
const updates = [...((_b = payload.instancesToUpdate) !== null && _b !== void 0 ? _b : []), ...((_c = payload.instancesToConfigure) !== null && _c !== void 0 ? _c : [])];
|
|
22
22
|
for (const i of updates) {
|
|
23
23
|
if (await checkSpecForSecrets(i)) {
|
|
24
|
-
utils_1.logLabeledBullet("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
|
|
24
|
+
(0, utils_1.logLabeledBullet)("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
|
|
25
25
|
const previousSpec = have.find((h) => h.instanceId === i.instanceId);
|
|
26
26
|
await handleSecretsUpdateInstance(i, previousSpec, nonInteractive);
|
|
27
27
|
}
|
|
@@ -29,7 +29,7 @@ async function handleSecretParams(payload, have, nonInteractive) {
|
|
|
29
29
|
}
|
|
30
30
|
exports.handleSecretParams = handleSecretParams;
|
|
31
31
|
async function checkSpecForSecrets(i) {
|
|
32
|
-
const extensionVersion = await planner_1.getExtensionVersion(i);
|
|
32
|
+
const extensionVersion = await (0, planner_1.getExtensionVersion)(i);
|
|
33
33
|
return secretUtils.usesSecrets(extensionVersion.spec);
|
|
34
34
|
}
|
|
35
35
|
exports.checkSpecForSecrets = checkSpecForSecrets;
|
|
@@ -37,15 +37,15 @@ const secretsInSpec = (spec) => {
|
|
|
37
37
|
return spec.params.filter((p) => p.type === extensionsApi_1.ParamType.SECRET);
|
|
38
38
|
};
|
|
39
39
|
async function handleSecretsCreateInstance(i, nonInteractive) {
|
|
40
|
-
const extensionVersion = await planner_1.getExtensionVersion(i);
|
|
40
|
+
const extensionVersion = await (0, planner_1.getExtensionVersion)(i);
|
|
41
41
|
const secretParams = secretsInSpec(extensionVersion.spec);
|
|
42
42
|
for (const s of secretParams) {
|
|
43
43
|
await handleSecretParamForCreate(s, i, nonInteractive);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
async function handleSecretsUpdateInstance(i, prevSpec, nonInteractive) {
|
|
47
|
-
const extensionVersion = await planner_1.getExtensionVersion(i);
|
|
48
|
-
const prevExtensionVersion = await planner_1.getExtensionVersion(prevSpec);
|
|
47
|
+
const extensionVersion = await (0, planner_1.getExtensionVersion)(i);
|
|
48
|
+
const prevExtensionVersion = await (0, planner_1.getExtensionVersion)(prevSpec);
|
|
49
49
|
const secretParams = secretsInSpec(extensionVersion.spec);
|
|
50
50
|
for (const s of secretParams) {
|
|
51
51
|
const prevParam = prevExtensionVersion.spec.params.find((p) => p.param === s.param);
|
|
@@ -146,5 +146,5 @@ async function promptForCreateSecret(args) {
|
|
|
146
146
|
if (args.nonInteractive) {
|
|
147
147
|
throw new error_1.FirebaseError(`To create this secret, run this command in interactive mode, or go to ${secretManager.secretManagerConsoleUri(args.projectId)}`);
|
|
148
148
|
}
|
|
149
|
-
return askUserForParam_1.promptCreateSecret(args.projectId, args.instanceId, args.secretParam, args.secretName);
|
|
149
|
+
return (0, askUserForParam_1.promptCreateSecret)(args.projectId, args.instanceId, args.secretParam, args.secretName);
|
|
150
150
|
}
|
|
@@ -5,13 +5,13 @@ const cloudbilling_1 = require("../../gcp/cloudbilling");
|
|
|
5
5
|
const checkProjectBilling_1 = require("../../extensions/checkProjectBilling");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
async function checkBilling(projectId, nonInteractive) {
|
|
8
|
-
const enabled = await cloudbilling_1.checkBillingEnabled(projectId);
|
|
8
|
+
const enabled = await (0, cloudbilling_1.checkBillingEnabled)(projectId);
|
|
9
9
|
if (!enabled && nonInteractive) {
|
|
10
10
|
throw new error_1.FirebaseError(`Extensions require the Blaze plan, but project ${projectId} is not on the Blaze plan. ` +
|
|
11
11
|
`Please visit https://console.cloud.google.com/billing/linkedaccount?project=${projectId} to upgrade your project.`);
|
|
12
12
|
}
|
|
13
13
|
else if (!enabled) {
|
|
14
|
-
await checkProjectBilling_1.enableBilling(projectId);
|
|
14
|
+
await (0, checkProjectBilling_1.enableBilling)(projectId);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
exports.checkBilling = checkBilling;
|
|
@@ -200,12 +200,14 @@ function regionalEndpoints(backend, region) {
|
|
|
200
200
|
return backend.endpoints[region] ? Object.values(backend.endpoints[region]) : [];
|
|
201
201
|
}
|
|
202
202
|
exports.regionalEndpoints = regionalEndpoints;
|
|
203
|
-
|
|
204
|
-
return !!backend.endpoints[endpoint.region] && !!backend.endpoints[endpoint.region][endpoint.id];
|
|
203
|
+
const hasEndpoint = (backend) => (endpoint) => {
|
|
204
|
+
return (!!backend.endpoints[endpoint.region] && !!backend.endpoints[endpoint.region][endpoint.id]);
|
|
205
205
|
};
|
|
206
|
-
exports.
|
|
207
|
-
|
|
206
|
+
exports.hasEndpoint = hasEndpoint;
|
|
207
|
+
const missingEndpoint = (backend) => (endpoint) => {
|
|
208
|
+
return !(0, exports.hasEndpoint)(backend)(endpoint);
|
|
208
209
|
};
|
|
210
|
+
exports.missingEndpoint = missingEndpoint;
|
|
209
211
|
function compareFunctions(left, right) {
|
|
210
212
|
if (left.platform != right.platform) {
|
|
211
213
|
return right.platform < left.platform ? -1 : 1;
|
|
@@ -24,18 +24,18 @@ async function checkServiceAccountIam(projectId) {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
if (!passed) {
|
|
27
|
-
throw new error_1.FirebaseError(`Missing permissions required for functions deploy. You must have permission ${cli_color_1.bold("iam.serviceAccounts.ActAs")} on service account ${cli_color_1.bold(saEmail)}.\n\n` +
|
|
27
|
+
throw new error_1.FirebaseError(`Missing permissions required for functions deploy. You must have permission ${(0, cli_color_1.bold)("iam.serviceAccounts.ActAs")} on service account ${(0, cli_color_1.bold)(saEmail)}.\n\n` +
|
|
28
28
|
`To address this error, ask a project Owner to assign your account the "Service Account User" role from this URL:\n\n` +
|
|
29
29
|
`https://console.cloud.google.com/iam-admin/iam?project=${projectId}`);
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.checkServiceAccountIam = checkServiceAccountIam;
|
|
33
33
|
async function checkHttpIam(context, options, payload) {
|
|
34
|
-
const filterGroups = context.filters || functionsDeployHelper_1.getFilterGroups(options);
|
|
34
|
+
const filterGroups = context.filters || (0, functionsDeployHelper_1.getFilterGroups)(options);
|
|
35
35
|
const httpEndpoints = backend
|
|
36
36
|
.allEndpoints(payload.functions.backend)
|
|
37
37
|
.filter(backend.isHttpsTriggered)
|
|
38
|
-
.filter((f) => functionsDeployHelper_1.functionMatchesAnyGroup(f, filterGroups));
|
|
38
|
+
.filter((f) => (0, functionsDeployHelper_1.functionMatchesAnyGroup)(f, filterGroups));
|
|
39
39
|
const existing = await backend.existingBackend(context);
|
|
40
40
|
const newHttpsEndpoints = httpEndpoints.filter(backend.missingEndpoint(existing));
|
|
41
41
|
if (newHttpsEndpoints.length === 0) {
|
|
@@ -53,7 +53,7 @@ async function checkHttpIam(context, options, payload) {
|
|
|
53
53
|
}
|
|
54
54
|
if (!passed) {
|
|
55
55
|
track("Error (User)", "deploy:functions:http_create_missing_iam");
|
|
56
|
-
throw new error_1.FirebaseError(`Missing required permission on project ${cli_color_1.bold(context.projectId)} to deploy new HTTPS functions. The permission ${cli_color_1.bold(PERMISSION)} is required to deploy the following functions:\n\n- ` +
|
|
56
|
+
throw new error_1.FirebaseError(`Missing required permission on project ${(0, cli_color_1.bold)(context.projectId)} to deploy new HTTPS functions. The permission ${(0, cli_color_1.bold)(PERMISSION)} is required to deploy the following functions:\n\n- ` +
|
|
57
57
|
newHttpsEndpoints.map((func) => func.id).join("\n- ") +
|
|
58
58
|
`\n\nTo address this error, please ask a project Owner to assign your account the "Cloud Functions Admin" role at the following URL:\n\nhttps://console.cloud.google.com/iam-admin/iam?project=${context.projectId}`);
|
|
59
59
|
}
|
|
@@ -61,7 +61,7 @@ async function checkHttpIam(context, options, payload) {
|
|
|
61
61
|
}
|
|
62
62
|
exports.checkHttpIam = checkHttpIam;
|
|
63
63
|
function reduceEventsToServices(services, endpoint) {
|
|
64
|
-
const service = services_1.serviceForEndpoint(endpoint);
|
|
64
|
+
const service = (0, services_1.serviceForEndpoint)(endpoint);
|
|
65
65
|
if (service.requiredProjectBindings && !services.find((s) => s.name === service.name)) {
|
|
66
66
|
services.push(service);
|
|
67
67
|
}
|
|
@@ -96,7 +96,7 @@ async function ensureServiceAgentRoles(projectId, want, have) {
|
|
|
96
96
|
}
|
|
97
97
|
let policy;
|
|
98
98
|
try {
|
|
99
|
-
policy = await resourceManager_1.getIamPolicy(projectId);
|
|
99
|
+
policy = await (0, resourceManager_1.getIamPolicy)(projectId);
|
|
100
100
|
}
|
|
101
101
|
catch (err) {
|
|
102
102
|
utils.logLabeledBullet("functions", "Could not verify the necessary IAM configuration for the following newly-integrated services: " +
|
|
@@ -109,7 +109,7 @@ async function ensureServiceAgentRoles(projectId, want, have) {
|
|
|
109
109
|
const allRequiredBindings = await Promise.all(findRequiredBindings);
|
|
110
110
|
mergeBindings(policy, allRequiredBindings);
|
|
111
111
|
try {
|
|
112
|
-
await resourceManager_1.setIamPolicy(projectId, policy, "bindings");
|
|
112
|
+
await (0, resourceManager_1.setIamPolicy)(projectId, policy, "bindings");
|
|
113
113
|
}
|
|
114
114
|
catch (err) {
|
|
115
115
|
throw new error_1.FirebaseError("We failed to modify the IAM policy for the project. The functions " +
|
|
@@ -23,11 +23,11 @@ async function retry(func) {
|
|
|
23
23
|
});
|
|
24
24
|
return await Promise.race([func(), timeout]);
|
|
25
25
|
}
|
|
26
|
-
catch (
|
|
27
|
-
logger_1.logger.debug("Failed docker command with error ",
|
|
26
|
+
catch (err) {
|
|
27
|
+
logger_1.logger.debug("Failed docker command with error ", err);
|
|
28
28
|
retry += 1;
|
|
29
29
|
if (retry >= MAX_RETRIES) {
|
|
30
|
-
throw new error_1.FirebaseError("Failed to clean up artifacts", { original:
|
|
30
|
+
throw new error_1.FirebaseError("Failed to clean up artifacts", { original: err });
|
|
31
31
|
}
|
|
32
32
|
await sleep(Math.pow(INITIAL_BACKOFF, retry - 1));
|
|
33
33
|
}
|
|
@@ -11,7 +11,7 @@ const gcf = require("../../gcp/cloudfunctions");
|
|
|
11
11
|
const gcfv2 = require("../../gcp/cloudfunctionsv2");
|
|
12
12
|
const utils = require("../../utils");
|
|
13
13
|
const backend = require("./backend");
|
|
14
|
-
tmp_1.setGracefulCleanup();
|
|
14
|
+
(0, tmp_1.setGracefulCleanup)();
|
|
15
15
|
async function uploadSourceV1(context, region) {
|
|
16
16
|
const uploadUrl = await gcf.generateUploadUrl(context.projectId, region);
|
|
17
17
|
context.sourceUrl = uploadUrl;
|
|
@@ -39,7 +39,7 @@ async function deploy(context, options, payload) {
|
|
|
39
39
|
if (!context.functionsSourceV1 && !context.functionsSourceV2) {
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
await checkIam_1.checkHttpIam(context, options, payload);
|
|
42
|
+
await (0, checkIam_1.checkHttpIam)(context, options, payload);
|
|
43
43
|
try {
|
|
44
44
|
const want = payload.functions.backend;
|
|
45
45
|
const uploads = [];
|
|
@@ -55,14 +55,14 @@ async function deploy(context, options, payload) {
|
|
|
55
55
|
await Promise.all(uploads);
|
|
56
56
|
utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
|
|
57
57
|
if (uploads.length) {
|
|
58
|
-
utils_1.logSuccess(clc.green.bold("functions:") +
|
|
58
|
+
(0, utils_1.logSuccess)(clc.green.bold("functions:") +
|
|
59
59
|
" " +
|
|
60
60
|
clc.bold(options.config.src.functions.source) +
|
|
61
61
|
" folder uploaded successfully");
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
catch (err) {
|
|
65
|
-
utils_1.logWarning(clc.yellow("functions:") + " Upload Error: " + err.message);
|
|
65
|
+
(0, utils_1.logWarning)(clc.yellow("functions:") + " Upload Error: " + err.message);
|
|
66
66
|
throw err;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -19,7 +19,7 @@ ${FAQ_URL}`, { exit: 1 });
|
|
|
19
19
|
}
|
|
20
20
|
function nodePermissionError(projectId) {
|
|
21
21
|
track("functions_runtime_notices", "nodejs10_permission_error");
|
|
22
|
-
return new error_1.FirebaseError(`Cloud Functions deployment requires the Cloud Build API to be enabled. The current credentials do not have permission to enable APIs for project ${cli_color_1.bold(projectId)}.
|
|
22
|
+
return new error_1.FirebaseError(`Cloud Functions deployment requires the Cloud Build API to be enabled. The current credentials do not have permission to enable APIs for project ${(0, cli_color_1.bold)(projectId)}.
|
|
23
23
|
|
|
24
24
|
Please ask a project owner to visit the following URL to enable Cloud Build:
|
|
25
25
|
|
|
@@ -35,10 +35,10 @@ function isPermissionError(e) {
|
|
|
35
35
|
}
|
|
36
36
|
async function ensureCloudBuildEnabled(projectId) {
|
|
37
37
|
try {
|
|
38
|
-
await ensureApiEnabled_1.ensure(projectId, CLOUD_BUILD_API, "functions");
|
|
38
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, CLOUD_BUILD_API, "functions");
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
|
-
if (error_1.isBillingError(e)) {
|
|
41
|
+
if ((0, error_1.isBillingError)(e)) {
|
|
42
42
|
throw nodeBillingError(projectId);
|
|
43
43
|
}
|
|
44
44
|
else if (isPermissionError(e)) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.release = exports.deploy = exports.prepare = void 0;
|
|
3
4
|
var prepare_1 = require("./prepare");
|
|
4
5
|
Object.defineProperty(exports, "prepare", { enumerable: true, get: function () { return prepare_1.prepare; } });
|
|
5
6
|
var deploy_1 = require("./deploy");
|