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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.release = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const rtdb = require("../../rtdb");
|
|
6
6
|
const utils = require("../../utils");
|
|
7
7
|
function release(context) {
|
|
@@ -13,14 +13,14 @@ function release(context) {
|
|
|
13
13
|
}
|
|
14
14
|
const deploys = context.database.deploys;
|
|
15
15
|
const ruleFiles = context.database.ruleFiles;
|
|
16
|
-
utils.logBullet(clc.bold.cyan("database: ") + "releasing rules...");
|
|
16
|
+
utils.logBullet(clc.bold(clc.cyan("database: ")) + "releasing rules...");
|
|
17
17
|
return Promise.all(deploys.map((deploy) => {
|
|
18
18
|
return rtdb
|
|
19
19
|
.updateRules(context.projectId, deploy.instance, ruleFiles[deploy.rules], {
|
|
20
20
|
dryRun: false,
|
|
21
21
|
})
|
|
22
22
|
.then(() => {
|
|
23
|
-
utils.logSuccess(clc.bold.green("database: ") +
|
|
23
|
+
utils.logSuccess(clc.bold(clc.green("database: ")) +
|
|
24
24
|
"rules for database " +
|
|
25
25
|
clc.bold(deploy.instance) +
|
|
26
26
|
" released successfully");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deletesSummary = exports.configuresSummary = exports.updatesSummary = exports.createsSummary = exports.humanReadable = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
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
7
|
exports.humanReadable = humanReadable;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ErrorHandler = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const logger_1 = require("../../logger");
|
|
6
6
|
class ErrorHandler {
|
|
7
7
|
constructor() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkSpecForSecrets = exports.handleSecretParams = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const secretUtils = require("../../extensions/secretsUtils");
|
|
6
6
|
const secretManager = require("../../gcp/secretManager");
|
|
7
7
|
const planner_1 = require("./planner");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteExtensionInstanceTask = exports.configureExtensionInstanceTask = exports.updateExtensionInstanceTask = exports.createExtensionInstanceTask = exports.extensionsDeploymentHandler = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const error_1 = require("../../error");
|
|
6
6
|
const extensionsApi = require("../../extensions/extensionsApi");
|
|
7
7
|
const extensionsHelper_1 = require("../../extensions/extensionsHelper");
|
|
@@ -146,5 +146,5 @@ function deleteExtensionInstanceTask(projectId, instanceSpec) {
|
|
|
146
146
|
exports.deleteExtensionInstanceTask = deleteExtensionInstanceTask;
|
|
147
147
|
function printSuccess(instanceId, type, validateOnly) {
|
|
148
148
|
const action = validateOnly ? `validated ${type} for` : `${type}d`;
|
|
149
|
-
utils.logSuccess(clc.bold.green("extensions") + ` Successfully ${action} ${instanceId}`);
|
|
149
|
+
utils.logSuccess(clc.bold(clc.green("extensions")) + ` Successfully ${action} ${instanceId}`);
|
|
150
150
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const _ = require("lodash");
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const error_1 = require("../../error");
|
|
6
6
|
const indexes_1 = require("../../firestore/indexes");
|
|
7
7
|
const logger_1 = require("../../logger");
|
|
@@ -30,7 +30,7 @@ async function deployIndexes(context, options) {
|
|
|
30
30
|
}
|
|
31
31
|
const fieldOverrides = indexesSrc.fieldOverrides || [];
|
|
32
32
|
await new indexes_1.FirestoreIndexes().deploy(options, indexes, fieldOverrides);
|
|
33
|
-
utils.logSuccess(`${clc.bold.green("firestore:")} deployed indexes in ${clc.bold(indexesFileName)} successfully`);
|
|
33
|
+
utils.logSuccess(`${clc.bold(clc.green("firestore:"))} deployed indexes in ${clc.bold(indexesFileName)} successfully`);
|
|
34
34
|
}
|
|
35
35
|
async function default_1(context, options) {
|
|
36
36
|
await Promise.all([deployRules(context), deployIndexes(context, options)]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const _ = require("lodash");
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const loadCJSON_1 = require("../../loadCJSON");
|
|
6
6
|
const rulesDeploy_1 = require("../../rulesDeploy");
|
|
7
7
|
const utils = require("../../utils");
|
|
@@ -23,7 +23,7 @@ function prepareIndexes(context, options) {
|
|
|
23
23
|
const indexesFileName = options.config.src.firestore.indexes;
|
|
24
24
|
const indexesPath = options.config.path(indexesFileName);
|
|
25
25
|
const parsedSrc = (0, loadCJSON_1.loadCJSON)(indexesPath);
|
|
26
|
-
utils.logBullet(`${clc.bold.cyan("firestore:")} reading indexes from ${clc.bold(indexesFileName)}...`);
|
|
26
|
+
utils.logBullet(`${clc.bold(clc.cyan("firestore:"))} reading indexes from ${clc.bold(indexesFileName)}...`);
|
|
27
27
|
context.firestore = context.firestore || {};
|
|
28
28
|
context.firestore.indexes = {
|
|
29
29
|
name: indexesFileName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compareFunctions = exports.missingEndpoint = exports.hasEndpoint = exports.regionalEndpoints = exports.matchingBackend = exports.findEndpoint = exports.someEndpoint = exports.allEndpoints = exports.checkAvailability = exports.existingBackend = exports.scheduleIdForFunction = exports.functionName = exports.isEmptyBackend = exports.merge = exports.of = exports.empty = exports.isBlockingTriggered = exports.isTaskQueueTriggered = exports.isScheduleTriggered = exports.isEventTriggered = exports.isCallableTriggered = exports.isHttpsTriggered = exports.AllFunctionsPlatforms = exports.secretVersionName = exports.SCHEDULED_FUNCTION_LABEL = exports.MIN_CPU_FOR_CONCURRENCY = exports.DEFAULT_MEMORY = exports.DEFAULT_CONCURRENCY = exports.memoryToGen2Cpu = exports.memoryToGen1Cpu = exports.memoryOptionDisplayName = exports.
|
|
3
|
+
exports.compareFunctions = exports.missingEndpoint = exports.hasEndpoint = exports.regionalEndpoints = exports.matchingBackend = exports.findEndpoint = exports.someEndpoint = exports.allEndpoints = exports.checkAvailability = exports.existingBackend = exports.scheduleIdForFunction = exports.functionName = exports.isEmptyBackend = exports.merge = exports.of = exports.empty = exports.isBlockingTriggered = exports.isTaskQueueTriggered = exports.isScheduleTriggered = exports.isEventTriggered = exports.isCallableTriggered = exports.isHttpsTriggered = exports.AllFunctionsPlatforms = exports.secretVersionName = exports.SCHEDULED_FUNCTION_LABEL = exports.MIN_CPU_FOR_CONCURRENCY = exports.DEFAULT_MEMORY = exports.DEFAULT_CONCURRENCY = exports.memoryToGen2Cpu = exports.memoryToGen1Cpu = exports.memoryOptionDisplayName = exports.isValidMemoryOption = exports.AllIngressSettings = exports.AllVpcEgressSettings = exports.endpointTriggerType = void 0;
|
|
4
4
|
const gcf = require("../../gcp/cloudfunctions");
|
|
5
5
|
const gcfV2 = require("../../gcp/cloudfunctionsv2");
|
|
6
6
|
const run = require("../../gcp/run");
|
|
@@ -37,9 +37,11 @@ exports.AllIngressSettings = [
|
|
|
37
37
|
"ALLOW_INTERNAL_ONLY",
|
|
38
38
|
"ALLOW_INTERNAL_AND_GCLB",
|
|
39
39
|
];
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
const allMemoryOptions = [128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768];
|
|
41
|
+
function isValidMemoryOption(mem) {
|
|
42
|
+
return allMemoryOptions.includes(mem);
|
|
43
|
+
}
|
|
44
|
+
exports.isValidMemoryOption = isValidMemoryOption;
|
|
43
45
|
function memoryOptionDisplayName(option) {
|
|
44
46
|
return {
|
|
45
47
|
128: "128MB",
|
|
@@ -77,7 +79,7 @@ function memoryToGen2Cpu(memory) {
|
|
|
77
79
|
2048: 1,
|
|
78
80
|
4096: 2,
|
|
79
81
|
8192: 2,
|
|
80
|
-
16384:
|
|
82
|
+
16384: 2,
|
|
81
83
|
32768: 4,
|
|
82
84
|
}[memory];
|
|
83
85
|
}
|
|
@@ -8,6 +8,7 @@ const params = require("./params");
|
|
|
8
8
|
const previews_1 = require("../../previews");
|
|
9
9
|
const error_1 = require("../../error");
|
|
10
10
|
const functional_1 = require("../../functional");
|
|
11
|
+
const logger_1 = require("../../logger");
|
|
11
12
|
function empty() {
|
|
12
13
|
return {
|
|
13
14
|
requiredAPIs: [],
|
|
@@ -22,9 +23,6 @@ function of(endpoints) {
|
|
|
22
23
|
return build;
|
|
23
24
|
}
|
|
24
25
|
exports.of = of;
|
|
25
|
-
function isMemoryOption(value) {
|
|
26
|
-
return value == null || [128, 256, 512, 1024, 2048, 4096, 8192].includes(value);
|
|
27
|
-
}
|
|
28
26
|
async function resolveBackend(build, userEnvOpt, userEnvs) {
|
|
29
27
|
const projectId = userEnvOpt.projectId;
|
|
30
28
|
let paramValues = {};
|
|
@@ -34,7 +32,49 @@ async function resolveBackend(build, userEnvOpt, userEnvs) {
|
|
|
34
32
|
return toBackend(build, paramValues);
|
|
35
33
|
}
|
|
36
34
|
exports.resolveBackend = resolveBackend;
|
|
35
|
+
class Resolver {
|
|
36
|
+
constructor(paramValues) {
|
|
37
|
+
this.paramValues = paramValues;
|
|
38
|
+
this.resolveInt = (i) => {
|
|
39
|
+
if (i === null) {
|
|
40
|
+
return i;
|
|
41
|
+
}
|
|
42
|
+
return params.resolveInt(i, this.paramValues);
|
|
43
|
+
};
|
|
44
|
+
this.resolveBoolean = (i) => {
|
|
45
|
+
if (i === null) {
|
|
46
|
+
return i;
|
|
47
|
+
}
|
|
48
|
+
return params.resolveBoolean(i, this.paramValues);
|
|
49
|
+
};
|
|
50
|
+
this.resolveString = (i) => {
|
|
51
|
+
if (i === null) {
|
|
52
|
+
return i;
|
|
53
|
+
}
|
|
54
|
+
return params.resolveString(i, this.paramValues);
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
resolveStrings(dest, src, ...keys) {
|
|
58
|
+
for (const key of keys) {
|
|
59
|
+
const orig = src[key];
|
|
60
|
+
if (typeof orig === "undefined") {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
dest[key] = orig === null ? null : params.resolveString(orig, this.paramValues);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
resolveInts(dest, src, ...keys) {
|
|
67
|
+
for (const key of keys) {
|
|
68
|
+
const orig = src[key];
|
|
69
|
+
if (typeof orig === "undefined") {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
dest[key] = orig === null ? null : params.resolveInt(orig, this.paramValues);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
37
76
|
function toBackend(build, paramValues) {
|
|
77
|
+
const r = new Resolver(paramValues);
|
|
38
78
|
const bkEndpoints = [];
|
|
39
79
|
for (const endpointId of Object.keys(build.endpoints)) {
|
|
40
80
|
const bdEndpoint = build.endpoints[endpointId];
|
|
@@ -43,39 +83,40 @@ function toBackend(build, paramValues) {
|
|
|
43
83
|
regions = [api.functionsDefaultRegion];
|
|
44
84
|
}
|
|
45
85
|
for (const region of regions) {
|
|
46
|
-
const trigger = discoverTrigger(bdEndpoint,
|
|
86
|
+
const trigger = discoverTrigger(bdEndpoint, region, r);
|
|
47
87
|
if (typeof bdEndpoint.platform === "undefined") {
|
|
48
88
|
throw new error_1.FirebaseError("platform can't be undefined");
|
|
49
89
|
}
|
|
50
|
-
if (
|
|
90
|
+
if (bdEndpoint.availableMemoryMb != null &&
|
|
91
|
+
!backend.isValidMemoryOption(bdEndpoint.availableMemoryMb)) {
|
|
51
92
|
throw new error_1.FirebaseError("available memory must be a supported value, if present");
|
|
52
93
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const bkEndpoint = Object.assign({ id: endpointId, project: bdEndpoint.project, region: region, entryPoint: bdEndpoint.entryPoint, platform: bdEndpoint.platform, runtime: bdEndpoint.runtime, timeoutSeconds: timeout }, trigger);
|
|
61
|
-
proto.renameIfPresent(bkEndpoint, bdEndpoint, "maxInstances", "maxInstances", (from) => {
|
|
62
|
-
return params.resolveInt(from, paramValues);
|
|
94
|
+
const bkEndpoint = Object.assign({ id: endpointId, project: bdEndpoint.project, region: region, entryPoint: bdEndpoint.entryPoint, platform: bdEndpoint.platform, runtime: bdEndpoint.runtime }, trigger);
|
|
95
|
+
proto.copyIfPresent(bkEndpoint, bdEndpoint, "environmentVariables", "labels", "secretEnvironmentVariables", "serviceAccount");
|
|
96
|
+
proto.convertIfPresent(bkEndpoint, bdEndpoint, "ingressSettings", (from) => {
|
|
97
|
+
if (from !== null && !backend.AllIngressSettings.includes(from)) {
|
|
98
|
+
throw new error_1.FirebaseError(`Cannot set ingress settings to invalid value ${from}`);
|
|
99
|
+
}
|
|
100
|
+
return from;
|
|
63
101
|
});
|
|
64
|
-
proto.
|
|
65
|
-
|
|
102
|
+
proto.convertIfPresent(bkEndpoint, bdEndpoint, "availableMemoryMb", (from) => {
|
|
103
|
+
const mem = r.resolveInt(from);
|
|
104
|
+
if (mem !== null && !backend.isValidMemoryOption(mem)) {
|
|
105
|
+
logger_1.logger.debug("Warning; setting memory to unexpected value", mem);
|
|
106
|
+
}
|
|
107
|
+
return mem;
|
|
66
108
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
70
|
-
proto.copyIfPresent(bkEndpoint, bdEndpoint, "ingressSettings", "availableMemoryMb", "environmentVariables", "labels");
|
|
71
|
-
proto.copyIfPresent(bkEndpoint, bdEndpoint, "secretEnvironmentVariables");
|
|
109
|
+
r.resolveInts(bkEndpoint, bdEndpoint, "timeoutSeconds", "maxInstances", "minInstances", "concurrency");
|
|
110
|
+
proto.convertIfPresent(bkEndpoint, bdEndpoint, "cpu", (0, functional_1.nullsafeVisitor)((cpu) => (cpu === "gcf_gen1" ? cpu : r.resolveInt(cpu))));
|
|
72
111
|
if (bdEndpoint.vpc) {
|
|
112
|
+
if (bdEndpoint.vpc.connector && !bdEndpoint.vpc.connector.includes("/")) {
|
|
113
|
+
bdEndpoint.vpc.connector = `projects/${bdEndpoint.project}/locations/${region}/connectors/${bdEndpoint.vpc.connector}`;
|
|
114
|
+
}
|
|
73
115
|
bkEndpoint.vpc = { connector: params.resolveString(bdEndpoint.vpc.connector, paramValues) };
|
|
74
116
|
proto.copyIfPresent(bkEndpoint.vpc, bdEndpoint.vpc, "egressSettings");
|
|
75
117
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
delete bkEndpoint.serviceAccountEmail;
|
|
118
|
+
else if (bdEndpoint.vpc === null) {
|
|
119
|
+
bkEndpoint.vpc = null;
|
|
79
120
|
}
|
|
80
121
|
bkEndpoints.push(bkEndpoint);
|
|
81
122
|
}
|
|
@@ -85,101 +126,75 @@ function toBackend(build, paramValues) {
|
|
|
85
126
|
return bkend;
|
|
86
127
|
}
|
|
87
128
|
exports.toBackend = toBackend;
|
|
88
|
-
function discoverTrigger(endpoint,
|
|
89
|
-
const resolveInt = (from) => params.resolveInt(from, paramValues);
|
|
90
|
-
const resolveString = (from) => params.resolveString(from, paramValues);
|
|
91
|
-
const resolveBoolean = (from) => params.resolveBoolean(from, paramValues);
|
|
92
|
-
let trigger;
|
|
129
|
+
function discoverTrigger(endpoint, region, r) {
|
|
93
130
|
if ("httpsTrigger" in endpoint) {
|
|
94
|
-
const
|
|
95
|
-
if (endpoint.httpsTrigger.invoker) {
|
|
96
|
-
|
|
131
|
+
const httpsTrigger = {};
|
|
132
|
+
if (endpoint.httpsTrigger.invoker === null) {
|
|
133
|
+
httpsTrigger.invoker = null;
|
|
134
|
+
}
|
|
135
|
+
else if (typeof endpoint.httpsTrigger.invoker !== "undefined") {
|
|
136
|
+
httpsTrigger.invoker = endpoint.httpsTrigger.invoker.map(r.resolveString);
|
|
97
137
|
}
|
|
98
|
-
|
|
138
|
+
return { httpsTrigger };
|
|
99
139
|
}
|
|
100
140
|
else if ("callableTrigger" in endpoint) {
|
|
101
|
-
|
|
141
|
+
return { callableTrigger: {} };
|
|
102
142
|
}
|
|
103
143
|
else if ("blockingTrigger" in endpoint) {
|
|
104
|
-
|
|
144
|
+
return { blockingTrigger: endpoint.blockingTrigger };
|
|
105
145
|
}
|
|
106
146
|
else if ("eventTrigger" in endpoint) {
|
|
107
|
-
const
|
|
108
|
-
for (const [key, value] of Object.entries(endpoint.eventTrigger.eventFilters)) {
|
|
109
|
-
bkEventFilters[key] = params.resolveString(value, paramValues);
|
|
110
|
-
}
|
|
111
|
-
const bkEvent = {
|
|
147
|
+
const eventTrigger = {
|
|
112
148
|
eventType: endpoint.eventTrigger.eventType,
|
|
113
|
-
|
|
114
|
-
retry: resolveBoolean(endpoint.eventTrigger.retry || false),
|
|
149
|
+
retry: r.resolveBoolean(endpoint.eventTrigger.retry) || false,
|
|
115
150
|
};
|
|
116
|
-
if (endpoint.eventTrigger.
|
|
117
|
-
|
|
118
|
-
for (const [key, value] of Object.entries(endpoint.eventTrigger.eventFilterPathPatterns)) {
|
|
119
|
-
bkEventFiltersPathPatterns[key] = params.resolveString(value, paramValues);
|
|
120
|
-
}
|
|
121
|
-
bkEvent.eventFilterPathPatterns = bkEventFiltersPathPatterns;
|
|
122
|
-
}
|
|
123
|
-
if (endpoint.eventTrigger.serviceAccount) {
|
|
124
|
-
bkEvent.serviceAccountEmail = endpoint.eventTrigger.serviceAccount;
|
|
151
|
+
if (endpoint.eventTrigger.eventFilters) {
|
|
152
|
+
eventTrigger.eventFilters = (0, functional_1.mapObject)(endpoint.eventTrigger.eventFilters, r.resolveString);
|
|
125
153
|
}
|
|
126
|
-
if (endpoint.eventTrigger.
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
if (endpoint.eventTrigger.channel) {
|
|
130
|
-
bkEvent.channel = endpoint.eventTrigger.channel;
|
|
154
|
+
if (endpoint.eventTrigger.eventFilterPathPatterns) {
|
|
155
|
+
eventTrigger.eventFilterPathPatterns = (0, functional_1.mapObject)(endpoint.eventTrigger.eventFilterPathPatterns, r.resolveString);
|
|
131
156
|
}
|
|
132
|
-
|
|
157
|
+
r.resolveStrings(eventTrigger, endpoint.eventTrigger, "serviceAccount", "region", "channel");
|
|
158
|
+
return { eventTrigger };
|
|
133
159
|
}
|
|
134
160
|
else if ("scheduleTrigger" in endpoint) {
|
|
135
161
|
const bkSchedule = {
|
|
136
|
-
schedule: resolveString(endpoint.scheduleTrigger.schedule),
|
|
137
|
-
timeZone: resolveString(endpoint.scheduleTrigger.timeZone),
|
|
162
|
+
schedule: r.resolveString(endpoint.scheduleTrigger.schedule),
|
|
163
|
+
timeZone: r.resolveString(endpoint.scheduleTrigger.timeZone),
|
|
138
164
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
bkRetry
|
|
165
|
+
if (endpoint.scheduleTrigger.retryConfig) {
|
|
166
|
+
const bkRetry = {};
|
|
167
|
+
r.resolveInts(bkRetry, endpoint.scheduleTrigger.retryConfig, "maxBackoffSeconds", "minBackoffSeconds", "maxRetrySeconds", "retryCount", "maxDoublings");
|
|
168
|
+
bkSchedule.retryConfig = bkRetry;
|
|
142
169
|
}
|
|
143
|
-
if (endpoint.scheduleTrigger.retryConfig
|
|
144
|
-
|
|
170
|
+
else if (endpoint.scheduleTrigger.retryConfig === null) {
|
|
171
|
+
bkSchedule.retryConfig = null;
|
|
145
172
|
}
|
|
146
|
-
|
|
147
|
-
bkRetry.maxRetryDuration = proto.durationFromSeconds(resolveInt(endpoint.scheduleTrigger.retryConfig.maxRetrySeconds));
|
|
148
|
-
}
|
|
149
|
-
proto.copyIfPresent(bkRetry, endpoint.scheduleTrigger.retryConfig, "retryCount", "maxDoublings");
|
|
150
|
-
bkSchedule.retryConfig = bkRetry;
|
|
151
|
-
trigger = { scheduleTrigger: bkSchedule };
|
|
173
|
+
return { scheduleTrigger: bkSchedule };
|
|
152
174
|
}
|
|
153
175
|
else if ("taskQueueTrigger" in endpoint) {
|
|
154
|
-
const
|
|
176
|
+
const taskQueueTrigger = {};
|
|
155
177
|
if (endpoint.taskQueueTrigger.rateLimits) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
178
|
+
taskQueueTrigger.rateLimits = {};
|
|
179
|
+
r.resolveInts(taskQueueTrigger.rateLimits, endpoint.taskQueueTrigger.rateLimits, "maxConcurrentDispatches", "maxDispatchesPerSecond");
|
|
180
|
+
}
|
|
181
|
+
else if (endpoint.taskQueueTrigger.rateLimits === null) {
|
|
182
|
+
taskQueueTrigger.rateLimits = null;
|
|
160
183
|
}
|
|
161
184
|
if (endpoint.taskQueueTrigger.retryConfig) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
proto.renameIfPresent(bkRetryConfig, endpoint.taskQueueTrigger.retryConfig, "minBackoffSeconds", "minBackoffSeconds", (from) => {
|
|
168
|
-
return proto.durationFromSeconds(resolveInt(from));
|
|
169
|
-
});
|
|
170
|
-
proto.renameIfPresent(bkRetryConfig, endpoint.taskQueueTrigger.retryConfig, "maxRetrySeconds", "maxRetryDurationSeconds", (from) => {
|
|
171
|
-
return proto.durationFromSeconds(resolveInt(from));
|
|
172
|
-
});
|
|
173
|
-
proto.renameIfPresent(bkRetryConfig, endpoint.taskQueueTrigger.retryConfig, "maxDoublings", "maxDoublings", resolveInt);
|
|
174
|
-
bkTaskQueue.retryConfig = bkRetryConfig;
|
|
185
|
+
taskQueueTrigger.retryConfig = {};
|
|
186
|
+
r.resolveInts(taskQueueTrigger.retryConfig, endpoint.taskQueueTrigger.retryConfig, "maxAttempts", "maxBackoffSeconds", "minBackoffSeconds", "maxRetrySeconds", "maxDoublings");
|
|
187
|
+
}
|
|
188
|
+
else if (endpoint.taskQueueTrigger.retryConfig === null) {
|
|
189
|
+
taskQueueTrigger.retryConfig = null;
|
|
175
190
|
}
|
|
176
191
|
if (endpoint.taskQueueTrigger.invoker) {
|
|
177
|
-
|
|
192
|
+
taskQueueTrigger.invoker = endpoint.taskQueueTrigger.invoker.map(r.resolveString);
|
|
178
193
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
194
|
+
else if (endpoint.taskQueueTrigger.invoker === null) {
|
|
195
|
+
taskQueueTrigger.invoker = null;
|
|
196
|
+
}
|
|
197
|
+
return { taskQueueTrigger };
|
|
183
198
|
}
|
|
184
|
-
|
|
199
|
+
(0, functional_1.assertExhaustive)(endpoint);
|
|
185
200
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ensureServiceAgentRoles = exports.mergeBindings = exports.obtainDefaultComputeServiceAgentBindings = exports.obtainPubSubServiceAgentBindings = exports.checkHttpIam = exports.checkServiceAccountIam = exports.EVENTARC_EVENT_RECEIVER_ROLE = exports.RUN_INVOKER_ROLE = exports.SERVICE_ACCOUNT_TOKEN_CREATOR_ROLE = void 0;
|
|
4
|
-
const
|
|
4
|
+
const colorette_1 = require("colorette");
|
|
5
5
|
const logger_1 = require("../../logger");
|
|
6
6
|
const functionsDeployHelper_1 = require("./functionsDeployHelper");
|
|
7
7
|
const error_1 = require("../../error");
|
|
@@ -28,7 +28,7 @@ async function checkServiceAccountIam(projectId) {
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
if (!passed) {
|
|
31
|
-
throw new error_1.FirebaseError(`Missing permissions required for functions deploy. You must have permission ${(0,
|
|
31
|
+
throw new error_1.FirebaseError(`Missing permissions required for functions deploy. You must have permission ${(0, colorette_1.bold)("iam.serviceAccounts.ActAs")} on service account ${(0, colorette_1.bold)(saEmail)}.\n\n` +
|
|
32
32
|
`To address this error, ask a project Owner to assign your account the "Service Account User" role from this URL:\n\n` +
|
|
33
33
|
`https://console.cloud.google.com/iam-admin/iam?project=${projectId}`);
|
|
34
34
|
}
|
|
@@ -60,7 +60,7 @@ async function checkHttpIam(context, options, payload) {
|
|
|
60
60
|
}
|
|
61
61
|
if (!passed) {
|
|
62
62
|
void (0, track_1.track)("Error (User)", "deploy:functions:http_create_missing_iam");
|
|
63
|
-
throw new error_1.FirebaseError(`Missing required permission on project ${(0,
|
|
63
|
+
throw new error_1.FirebaseError(`Missing required permission on project ${(0, colorette_1.bold)(context.projectId)} to deploy new HTTPS functions. The permission ${(0, colorette_1.bold)(PERMISSION)} is required to deploy the following functions:\n\n- ` +
|
|
64
64
|
newHttpsEndpoints.map((func) => func.id).join("\n- ") +
|
|
65
65
|
`\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}`);
|
|
66
66
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DockerHelper = exports.deleteGcfArtifacts = exports.listGcfPaths = exports.ContainerRegistryCleaner = exports.NoopArtifactRegistryCleaner = exports.ArtifactRegistryCleaner = exports.cleanupBuildImages = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const error_1 = require("../../error");
|
|
6
6
|
const api_1 = require("../../api");
|
|
7
7
|
const logger_1 = require("../../logger");
|
|
@@ -34,7 +34,7 @@ async function retry(func) {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
async function cleanupBuildImages(haveFunctions, deletedFunctions, cleaners = {}) {
|
|
37
|
-
utils.logBullet(clc.bold.cyan("functions: ") + "cleaning up build files...");
|
|
37
|
+
utils.logBullet(clc.bold(clc.cyan("functions: ")) + "cleaning up build files...");
|
|
38
38
|
const failedDomains = new Set();
|
|
39
39
|
const cleanup = [];
|
|
40
40
|
const arCleaner = cleaners.ar || new ArtifactRegistryCleaner();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deploy = void 0;
|
|
4
4
|
const tmp_1 = require("tmp");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const checkIam_1 = require("./checkIam");
|
|
8
8
|
const utils_1 = require("../../utils");
|
|
@@ -61,7 +61,7 @@ async function uploadCodebase(context, codebase, wantBackend) {
|
|
|
61
61
|
}
|
|
62
62
|
const sourceDir = (0, projectConfig_1.configForCodebase)(context.config, codebase).source;
|
|
63
63
|
if (uploads.length) {
|
|
64
|
-
(0, utils_1.logSuccess)(`${clc.green.bold("functions:")} ${clc.bold(sourceDir)} folder uploaded successfully`);
|
|
64
|
+
(0, utils_1.logSuccess)(`${clc.green(clc.bold("functions:"))} ${clc.bold(sourceDir)} folder uploaded successfully`);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
catch (err) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.secretAccess = exports.cloudBuildEnabled = exports.defaultServiceAccount = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const ensureApiEnabled_1 = require("../../ensureApiEnabled");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
@@ -67,7 +67,7 @@ exports.cloudBuildEnabled = cloudBuildEnabled;
|
|
|
67
67
|
async function secretsToServiceAccounts(b) {
|
|
68
68
|
const secretsToSa = {};
|
|
69
69
|
for (const e of backend.allEndpoints(b)) {
|
|
70
|
-
const sa = e.
|
|
70
|
+
const sa = e.serviceAccount || (await module.exports.defaultServiceAccount(e));
|
|
71
71
|
for (const s of e.secretEnvironmentVariables || []) {
|
|
72
72
|
const serviceAccounts = secretsToSa[s.secret] || new Set();
|
|
73
73
|
serviceAccounts.add(sa);
|
|
@@ -104,7 +104,10 @@ function canSatisfyParam(param, value) {
|
|
|
104
104
|
}
|
|
105
105
|
async function resolveParams(params, projectId, userEnvs) {
|
|
106
106
|
const paramValues = {};
|
|
107
|
-
|
|
107
|
+
const [provided, outstanding] = (0, functional_1.partition)(params, (param) => {
|
|
108
|
+
return {}.hasOwnProperty.call(userEnvs, param.param);
|
|
109
|
+
});
|
|
110
|
+
for (const param of provided) {
|
|
108
111
|
if (!canSatisfyParam(param, userEnvs[param.param])) {
|
|
109
112
|
throw new error_1.FirebaseError("Parameter " +
|
|
110
113
|
param.param +
|
|
@@ -114,7 +117,7 @@ async function resolveParams(params, projectId, userEnvs) {
|
|
|
114
117
|
}
|
|
115
118
|
paramValues[param.param] = userEnvs[param.param];
|
|
116
119
|
}
|
|
117
|
-
for (const param of
|
|
120
|
+
for (const param of outstanding) {
|
|
118
121
|
let paramDefault = param.default;
|
|
119
122
|
if (paramDefault && isCEL(paramDefault)) {
|
|
120
123
|
paramDefault = resolveDefaultCEL(param.type, paramDefault, paramValues);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveCpu = exports.inferBlockingDetails = exports.inferDetailsFromExisting = exports.prepare = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const backend = require("./backend");
|
|
6
6
|
const build = require("./build");
|
|
7
7
|
const ensureApiEnabled = require("../../ensureApiEnabled");
|
|
@@ -172,13 +172,13 @@ function inferDetailsFromExisting(want, have, usedDotenv) {
|
|
|
172
172
|
if (!usedDotenv) {
|
|
173
173
|
wantE.environmentVariables = Object.assign(Object.assign({}, haveE.environmentVariables), wantE.environmentVariables);
|
|
174
174
|
}
|
|
175
|
-
if (
|
|
175
|
+
if (typeof wantE.availableMemoryMb === "undefined" && haveE.availableMemoryMb) {
|
|
176
176
|
wantE.availableMemoryMb = haveE.availableMemoryMb;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
178
|
+
if (typeof wantE.concurrency === "undefined" && haveE.concurrency) {
|
|
179
179
|
wantE.concurrency = haveE.concurrency;
|
|
180
180
|
}
|
|
181
|
-
if (
|
|
181
|
+
if (typeof wantE.cpu === "undefined" && haveE.cpu) {
|
|
182
182
|
wantE.cpu = haveE.cpu;
|
|
183
183
|
}
|
|
184
184
|
wantE.securityLevel = haveE.securityLevel ? haveE.securityLevel : "SECURE_ALWAYS";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.prepareFunctionsUpload = exports.getFunctionsConfig = void 0;
|
|
4
4
|
const archiver = require("archiver");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const filesize = require("filesize");
|
|
7
7
|
const fs = require("fs");
|
|
8
8
|
const path = require("path");
|
|
@@ -74,7 +74,7 @@ async function packageSource(sourceDir, config, runtimeConfig) {
|
|
|
74
74
|
exit: 1,
|
|
75
75
|
});
|
|
76
76
|
}
|
|
77
|
-
utils.logBullet(clc.cyan.bold("functions:") +
|
|
77
|
+
utils.logBullet(clc.cyan(clc.bold("functions:")) +
|
|
78
78
|
" packaged " +
|
|
79
79
|
clc.bold(sourceDir) +
|
|
80
80
|
" (" +
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.monthlyMinInstanceCost = exports.canCalculateMinInstanceCost = exports.V2_FREE_TIER = exports.V1_FREE_TIER = exports.V2_RATES = exports.V1_RATES = void 0;
|
|
4
|
+
const backend = require("./backend");
|
|
4
5
|
const V1_REGION_TO_TIER = {
|
|
5
6
|
"us-central1": 1,
|
|
6
7
|
"us-east1": 1,
|
|
@@ -110,7 +111,7 @@ function canCalculateMinInstanceCost(endpoint) {
|
|
|
110
111
|
return true;
|
|
111
112
|
}
|
|
112
113
|
if (endpoint.platform === "gcfv1") {
|
|
113
|
-
if (!MB_TO_GHZ[endpoint.availableMemoryMb ||
|
|
114
|
+
if (!MB_TO_GHZ[endpoint.availableMemoryMb || backend.DEFAULT_MEMORY]) {
|
|
114
115
|
return false;
|
|
115
116
|
}
|
|
116
117
|
if (!V1_REGION_TO_TIER[endpoint.region]) {
|
|
@@ -134,7 +135,7 @@ function monthlyMinInstanceCost(endpoints) {
|
|
|
134
135
|
if (!endpoint.minInstances) {
|
|
135
136
|
continue;
|
|
136
137
|
}
|
|
137
|
-
const ramMb = endpoint.availableMemoryMb ||
|
|
138
|
+
const ramMb = endpoint.availableMemoryMb || backend.DEFAULT_MEMORY;
|
|
138
139
|
const ramGb = ramMb / 1024;
|
|
139
140
|
if (endpoint.platform === "gcfv1") {
|
|
140
141
|
const cpu = MB_TO_GHZ[ramMb];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.promptForMinInstances = exports.promptForFunctionDeletion = exports.promptForFailurePolicies = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const functionsDeployHelper_1 = require("./functionsDeployHelper");
|
|
6
6
|
const error_1 = require("../../error");
|
|
7
7
|
const prompt_1 = require("../../prompt");
|
|
@@ -122,7 +122,7 @@ async function promptForMinInstances(options, want, have) {
|
|
|
122
122
|
.sort(backend.compareFunctions)
|
|
123
123
|
.map((fn) => {
|
|
124
124
|
return (`\t${(0, functionsDeployHelper_1.getFunctionLabel)(fn)}: ${fn.minInstances} instances, ` +
|
|
125
|
-
backend.memoryOptionDisplayName(fn.availableMemoryMb ||
|
|
125
|
+
backend.memoryOptionDisplayName(fn.availableMemoryMb || backend.DEFAULT_MEMORY) +
|
|
126
126
|
" of memory each");
|
|
127
127
|
})
|
|
128
128
|
.join("\n");
|