firebase-tools 11.4.2 → 11.7.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/crashlytics-mappingfile-generateid.js +26 -0
- package/lib/commands/crashlytics-mappingfile-upload.js +46 -0
- package/lib/commands/crashlytics-symbols-upload.js +18 -87
- 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 +3 -1
- package/lib/commands/functions-secrets-get.js +2 -0
- 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/index.js +3 -0
- 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/crashlytics/buildToolsJarHelper.js +51 -0
- 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 +4 -4
- package/lib/deploy/functions/build.js +78 -8
- package/lib/deploy/functions/checkIam.js +9 -8
- package/lib/deploy/functions/containerCleaner.js +2 -2
- package/lib/deploy/functions/deploy.js +2 -2
- package/lib/deploy/functions/ensure.js +1 -1
- package/lib/deploy/functions/params.js +15 -15
- package/lib/deploy/functions/prepare.js +1 -1
- package/lib/deploy/functions/prepareFunctionsUpload.js +2 -2
- package/lib/deploy/functions/prompts.js +1 -1
- package/lib/deploy/functions/release/fabricator.js +24 -7
- package/lib/deploy/functions/release/index.js +3 -1
- package/lib/deploy/functions/release/reporter.js +1 -1
- package/lib/deploy/functions/runtimes/discovery/index.js +1 -16
- package/lib/deploy/functions/runtimes/discovery/parsing.js +16 -0
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +59 -131
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +2 -6
- package/lib/deploy/functions/runtimes/node/versioning.js +4 -4
- package/lib/deploy/functions/validate.js +1 -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 +50 -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/functionsEmulatorRuntime.js +12 -23
- package/lib/emulator/functionsEmulatorShared.js +6 -1
- 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 +26 -12
- package/lib/emulator/storage/apis/gcloud.js +15 -8
- package/lib/emulator/storage/files.js +21 -4
- package/lib/emulator/storage/multipart.js +6 -5
- 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 +1 -1
- 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 +2 -2
- 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/functions/env.js +11 -11
- 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 +3 -3
- package/lib/gcp/cloudfunctionsv2.js +5 -5
- package/lib/gcp/cloudscheduler.js +63 -22
- package/lib/gcp/cloudtasks.js +17 -1
- 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/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 +11 -12
- package/lib/serve/hosting.js +2 -1
- package/lib/serve/index.js +15 -0
- package/lib/track.js +122 -3
- package/lib/utils.js +24 -11
- package/npm-shrinkwrap.json +523 -294
- package/package.json +6 -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
|
-
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
|
|
3
|
+
exports.ensureServiceAgentRoles = exports.mergeBindings = exports.obtainDefaultComputeServiceAgentBindings = exports.obtainPubSubServiceAgentBindings = exports.getDefaultComputeServiceAgent = exports.checkHttpIam = exports.checkServiceAccountIam = exports.EVENTARC_EVENT_RECEIVER_ROLE = exports.RUN_INVOKER_ROLE = exports.SERVICE_ACCOUNT_TOKEN_CREATOR_ROLE = void 0;
|
|
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
|
}
|
|
@@ -68,11 +68,12 @@ async function checkHttpIam(context, options, payload) {
|
|
|
68
68
|
}
|
|
69
69
|
exports.checkHttpIam = checkHttpIam;
|
|
70
70
|
function getPubsubServiceAgent(projectNumber) {
|
|
71
|
-
return `
|
|
71
|
+
return `service-${projectNumber}@gcp-sa-pubsub.iam.gserviceaccount.com`;
|
|
72
72
|
}
|
|
73
73
|
function getDefaultComputeServiceAgent(projectNumber) {
|
|
74
|
-
return
|
|
74
|
+
return `${projectNumber}-compute@developer.gserviceaccount.com`;
|
|
75
75
|
}
|
|
76
|
+
exports.getDefaultComputeServiceAgent = getDefaultComputeServiceAgent;
|
|
76
77
|
function reduceEventsToServices(services, endpoint) {
|
|
77
78
|
const service = (0, services_1.serviceForEndpoint)(endpoint);
|
|
78
79
|
if (service.requiredProjectBindings && !services.find((s) => s.name === service.name)) {
|
|
@@ -83,13 +84,13 @@ function reduceEventsToServices(services, endpoint) {
|
|
|
83
84
|
function obtainPubSubServiceAgentBindings(projectNumber) {
|
|
84
85
|
const serviceAccountTokenCreatorBinding = {
|
|
85
86
|
role: exports.SERVICE_ACCOUNT_TOKEN_CREATOR_ROLE,
|
|
86
|
-
members: [getPubsubServiceAgent(projectNumber)],
|
|
87
|
+
members: [`serviceAccount:${getPubsubServiceAgent(projectNumber)}`],
|
|
87
88
|
};
|
|
88
89
|
return [serviceAccountTokenCreatorBinding];
|
|
89
90
|
}
|
|
90
91
|
exports.obtainPubSubServiceAgentBindings = obtainPubSubServiceAgentBindings;
|
|
91
92
|
function obtainDefaultComputeServiceAgentBindings(projectNumber) {
|
|
92
|
-
const defaultComputeServiceAgent = getDefaultComputeServiceAgent(projectNumber)
|
|
93
|
+
const defaultComputeServiceAgent = `serviceAccount:${getDefaultComputeServiceAgent(projectNumber)}`;
|
|
93
94
|
const runInvokerBinding = {
|
|
94
95
|
role: exports.RUN_INVOKER_ROLE,
|
|
95
96
|
members: [defaultComputeServiceAgent],
|
|
@@ -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");
|
|
@@ -21,7 +21,7 @@ function resolveInt(from, paramValues) {
|
|
|
21
21
|
if (typeof from === "number") {
|
|
22
22
|
return from;
|
|
23
23
|
}
|
|
24
|
-
const match =
|
|
24
|
+
const match = /{{ params\.(\w+) }}/.exec(from);
|
|
25
25
|
if (!match) {
|
|
26
26
|
throw new error_1.FirebaseError("CEL evaluation of expression '" + from + "' not yet supported");
|
|
27
27
|
}
|
|
@@ -105,17 +105,17 @@ function canSatisfyParam(param, value) {
|
|
|
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.
|
|
108
|
+
return {}.hasOwnProperty.call(userEnvs, param.name);
|
|
109
109
|
});
|
|
110
110
|
for (const param of provided) {
|
|
111
|
-
if (!canSatisfyParam(param, userEnvs[param.
|
|
111
|
+
if (!canSatisfyParam(param, userEnvs[param.name])) {
|
|
112
112
|
throw new error_1.FirebaseError("Parameter " +
|
|
113
|
-
param.
|
|
113
|
+
param.name +
|
|
114
114
|
" resolved to value from dotenv files " +
|
|
115
|
-
userEnvs[param.
|
|
115
|
+
userEnvs[param.name] +
|
|
116
116
|
" of wrong type");
|
|
117
117
|
}
|
|
118
|
-
paramValues[param.
|
|
118
|
+
paramValues[param.name] = userEnvs[param.name];
|
|
119
119
|
}
|
|
120
120
|
for (const param of outstanding) {
|
|
121
121
|
let paramDefault = param.default;
|
|
@@ -123,9 +123,9 @@ async function resolveParams(params, projectId, userEnvs) {
|
|
|
123
123
|
paramDefault = resolveDefaultCEL(param.type, paramDefault, paramValues);
|
|
124
124
|
}
|
|
125
125
|
if (paramDefault && !canSatisfyParam(param, paramDefault)) {
|
|
126
|
-
throw new error_1.FirebaseError("Parameter " + param.
|
|
126
|
+
throw new error_1.FirebaseError("Parameter " + param.name + " has default value " + paramDefault + " of wrong type");
|
|
127
127
|
}
|
|
128
|
-
paramValues[param.
|
|
128
|
+
paramValues[param.name] = await promptParam(param, paramDefault);
|
|
129
129
|
}
|
|
130
130
|
return paramValues;
|
|
131
131
|
}
|
|
@@ -146,15 +146,15 @@ async function promptStringParam(param, resolvedDefault) {
|
|
|
146
146
|
}
|
|
147
147
|
switch (param.input.type) {
|
|
148
148
|
case "select":
|
|
149
|
-
throw new error_1.FirebaseError("Build specified string parameter " + param.
|
|
149
|
+
throw new error_1.FirebaseError("Build specified string parameter " + param.name + " with unsupported input type 'select'");
|
|
150
150
|
case "text":
|
|
151
151
|
default:
|
|
152
|
-
let prompt = `Enter a value for ${param.label || param.
|
|
152
|
+
let prompt = `Enter a value for ${param.label || param.name}:`;
|
|
153
153
|
if (param.description) {
|
|
154
154
|
prompt += ` \n(${param.description})`;
|
|
155
155
|
}
|
|
156
156
|
return await (0, prompt_1.promptOnce)({
|
|
157
|
-
name: param.
|
|
157
|
+
name: param.name,
|
|
158
158
|
type: "input",
|
|
159
159
|
default: resolvedDefault,
|
|
160
160
|
message: prompt,
|
|
@@ -168,17 +168,17 @@ async function promptIntParam(param, resolvedDefault) {
|
|
|
168
168
|
}
|
|
169
169
|
switch (param.input.type) {
|
|
170
170
|
case "select":
|
|
171
|
-
throw new error_1.FirebaseError("Build specified int parameter " + param.
|
|
171
|
+
throw new error_1.FirebaseError("Build specified int parameter " + param.name + " with unsupported input type 'select'");
|
|
172
172
|
case "text":
|
|
173
173
|
default:
|
|
174
|
-
let prompt = `Enter a value for ${param.label || param.
|
|
174
|
+
let prompt = `Enter a value for ${param.label || param.name}:`;
|
|
175
175
|
if (param.description) {
|
|
176
176
|
prompt += ` \n(${param.description})`;
|
|
177
177
|
}
|
|
178
178
|
let res;
|
|
179
179
|
while (true) {
|
|
180
180
|
res = await (0, prompt_1.promptOnce)({
|
|
181
|
-
name: param.
|
|
181
|
+
name: param.name,
|
|
182
182
|
type: "number",
|
|
183
183
|
default: resolvedDefault,
|
|
184
184
|
message: prompt,
|
|
@@ -186,7 +186,7 @@ async function promptIntParam(param, resolvedDefault) {
|
|
|
186
186
|
if (Number.isInteger(res)) {
|
|
187
187
|
return res;
|
|
188
188
|
}
|
|
189
|
-
logger_1.logger.error(`${param.label || param.
|
|
189
|
+
logger_1.logger.error(`${param.label || param.name} must be an integer; retrying...`);
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -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");
|
|
@@ -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,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");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serviceIsResolved = exports.Fabricator = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const error_1 = require("../../../error");
|
|
6
6
|
const sourceTokenScraper_1 = require("./sourceTokenScraper");
|
|
7
7
|
const timer_1 = require("./timer");
|
|
@@ -24,6 +24,7 @@ const utils = require("../../../utils");
|
|
|
24
24
|
const services = require("../services");
|
|
25
25
|
const v1_1 = require("../../../functions/events/v1");
|
|
26
26
|
const throttler_1 = require("../../../throttler/throttler");
|
|
27
|
+
const checkIam_1 = require("../checkIam");
|
|
27
28
|
const gcfV1PollerOptions = {
|
|
28
29
|
apiOrigin: api_1.functionsOrigin,
|
|
29
30
|
apiVersion: gcf.API_VERSION,
|
|
@@ -46,6 +47,7 @@ class Fabricator {
|
|
|
46
47
|
this.functionExecutor = args.functionExecutor;
|
|
47
48
|
this.sources = args.sources;
|
|
48
49
|
this.appEngineLocation = args.appEngineLocation;
|
|
50
|
+
this.projectNumber = args.projectNumber;
|
|
49
51
|
}
|
|
50
52
|
async applyPlan(plan) {
|
|
51
53
|
const timer = new timer_1.Timer();
|
|
@@ -270,6 +272,12 @@ class Fabricator {
|
|
|
270
272
|
.run(() => run.setInvokerCreate(endpoint.project, serviceName, ["public"]))
|
|
271
273
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
272
274
|
}
|
|
275
|
+
else if (backend.isScheduleTriggered(endpoint)) {
|
|
276
|
+
const invoker = [(0, checkIam_1.getDefaultComputeServiceAgent)(this.projectNumber)];
|
|
277
|
+
await this.executor
|
|
278
|
+
.run(() => run.setInvokerCreate(endpoint.project, serviceName, invoker))
|
|
279
|
+
.catch(rethrowAs(endpoint, "set invoker"));
|
|
280
|
+
}
|
|
273
281
|
const mem = endpoint.availableMemoryMb || backend.DEFAULT_MEMORY;
|
|
274
282
|
const hasCustomCPU = endpoint.cpu !== backend.memoryToGen1Cpu(mem);
|
|
275
283
|
if (!endpoint.concurrency) {
|
|
@@ -346,6 +354,9 @@ class Fabricator {
|
|
|
346
354
|
v1_1.AUTH_BLOCKING_EVENTS.includes(endpoint.blockingTrigger.eventType)) {
|
|
347
355
|
invoker = ["public"];
|
|
348
356
|
}
|
|
357
|
+
else if (backend.isScheduleTriggered(endpoint)) {
|
|
358
|
+
invoker = [(0, checkIam_1.getDefaultComputeServiceAgent)(this.projectNumber)];
|
|
359
|
+
}
|
|
349
360
|
if (invoker) {
|
|
350
361
|
await this.executor
|
|
351
362
|
.run(() => run.setInvokerUpdate(endpoint.project, serviceName, invoker))
|
|
@@ -452,13 +463,16 @@ class Fabricator {
|
|
|
452
463
|
}
|
|
453
464
|
}
|
|
454
465
|
async upsertScheduleV1(endpoint) {
|
|
455
|
-
const job = scheduler.jobFromEndpoint(endpoint, this.appEngineLocation);
|
|
466
|
+
const job = scheduler.jobFromEndpoint(endpoint, this.appEngineLocation, this.projectNumber);
|
|
456
467
|
await this.executor
|
|
457
468
|
.run(() => scheduler.createOrReplaceJob(job))
|
|
458
469
|
.catch(rethrowAs(endpoint, "upsert schedule"));
|
|
459
470
|
}
|
|
460
|
-
upsertScheduleV2(endpoint) {
|
|
461
|
-
|
|
471
|
+
async upsertScheduleV2(endpoint) {
|
|
472
|
+
const job = scheduler.jobFromEndpoint(endpoint, endpoint.region, this.projectNumber);
|
|
473
|
+
await this.executor
|
|
474
|
+
.run(() => scheduler.createOrReplaceJob(job))
|
|
475
|
+
.catch(rethrowAs(endpoint, "upsert schedule"));
|
|
462
476
|
}
|
|
463
477
|
async upsertTaskQueue(endpoint) {
|
|
464
478
|
const queue = cloudtasks.queueFromEndpoint(endpoint);
|
|
@@ -486,8 +500,11 @@ class Fabricator {
|
|
|
486
500
|
.run(() => pubsub.deleteTopic(topicName))
|
|
487
501
|
.catch(rethrowAs(endpoint, "delete topic"));
|
|
488
502
|
}
|
|
489
|
-
deleteScheduleV2(endpoint) {
|
|
490
|
-
|
|
503
|
+
async deleteScheduleV2(endpoint) {
|
|
504
|
+
const jobName = scheduler.jobNameForEndpoint(endpoint, endpoint.region);
|
|
505
|
+
await this.executor
|
|
506
|
+
.run(() => scheduler.deleteJob(jobName))
|
|
507
|
+
.catch(rethrowAs(endpoint, "delete schedule"));
|
|
491
508
|
}
|
|
492
509
|
async disableTaskQueue(endpoint) {
|
|
493
510
|
const update = {
|
|
@@ -510,7 +527,7 @@ class Fabricator {
|
|
|
510
527
|
}
|
|
511
528
|
logOpSuccess(op, endpoint) {
|
|
512
529
|
const label = helper.getFunctionLabel(endpoint);
|
|
513
|
-
utils.logSuccess(`${clc.bold.green(`functions[${label}]`)} Successful ${op} operation.`);
|
|
530
|
+
utils.logSuccess(`${clc.bold(clc.green(`functions[${label}]`))} Successful ${op} operation.`);
|
|
514
531
|
}
|
|
515
532
|
}
|
|
516
533
|
exports.Fabricator = Fabricator;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.printTriggerUrls = exports.release = void 0;
|
|
4
|
-
const clc = require("
|
|
4
|
+
const clc = require("colorette");
|
|
5
5
|
const logger_1 = require("../../../logger");
|
|
6
6
|
const functional_1 = require("../../../functional");
|
|
7
7
|
const backend = require("../backend");
|
|
@@ -14,6 +14,7 @@ const prompts = require("../prompts");
|
|
|
14
14
|
const functionsConfig_1 = require("../../../functionsConfig");
|
|
15
15
|
const functionsDeployHelper_1 = require("../functionsDeployHelper");
|
|
16
16
|
const error_1 = require("../../../error");
|
|
17
|
+
const getProjectNumber_1 = require("../../../getProjectNumber");
|
|
17
18
|
async function release(context, options, payload) {
|
|
18
19
|
if (!context.config) {
|
|
19
20
|
return;
|
|
@@ -53,6 +54,7 @@ async function release(context, options, payload) {
|
|
|
53
54
|
executor: new executor.QueueExecutor({}),
|
|
54
55
|
sources: context.sources,
|
|
55
56
|
appEngineLocation: (0, functionsConfig_1.getAppEngineLocation)(context.firebaseConfig),
|
|
57
|
+
projectNumber: options.projectNumber || (await (0, getProjectNumber_1.getProjectNumber)(context.projectId)),
|
|
56
58
|
});
|
|
57
59
|
const summary = await fab.applyPlan(plan);
|
|
58
60
|
await reporter.logAndTrackDeployStats(summary);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.triggerTag = exports.printAbortedErrors = exports.printErrors = exports.logAndTrackDeployStats = exports.AbortedDeploymentError = exports.DeploymentError = void 0;
|
|
4
4
|
const backend = require("../backend");
|
|
5
|
-
const clc = require("
|
|
5
|
+
const clc = require("colorette");
|
|
6
6
|
const logger_1 = require("../../../logger");
|
|
7
7
|
const track_1 = require("../../../track");
|
|
8
8
|
const utils = require("../../../utils");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.detectFromPort = exports.detectFromYaml = exports.yamlToBuild = exports.
|
|
3
|
+
exports.detectFromPort = exports.detectFromYaml = exports.yamlToBuild = exports.readFileAsync = void 0;
|
|
4
4
|
const node_fetch_1 = require("node-fetch");
|
|
5
5
|
const fs = require("fs");
|
|
6
6
|
const path = require("path");
|
|
@@ -11,21 +11,6 @@ const api = require("../../.../../../../api");
|
|
|
11
11
|
const v1alpha1 = require("./v1alpha1");
|
|
12
12
|
const error_1 = require("../../../../error");
|
|
13
13
|
exports.readFileAsync = (0, util_1.promisify)(fs.readFile);
|
|
14
|
-
function yamlToBackend(yaml, project, region, runtime) {
|
|
15
|
-
try {
|
|
16
|
-
if (!yaml.specVersion) {
|
|
17
|
-
throw new error_1.FirebaseError("Expect backend yaml to specify a version number");
|
|
18
|
-
}
|
|
19
|
-
if (yaml.specVersion === "v1alpha1") {
|
|
20
|
-
return v1alpha1.backendFromV1Alpha1(yaml, project, region, runtime);
|
|
21
|
-
}
|
|
22
|
-
throw new error_1.FirebaseError("It seems you are using a newer SDK than this version of the CLI can handle. Please update your CLI with `npm install -g firebase-tools`");
|
|
23
|
-
}
|
|
24
|
-
catch (err) {
|
|
25
|
-
throw new error_1.FirebaseError("Failed to parse backend specification", { children: [err] });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.yamlToBackend = yamlToBackend;
|
|
29
14
|
function yamlToBuild(yaml, project, region, runtime) {
|
|
30
15
|
try {
|
|
31
16
|
if (!yaml.specVersion) {
|
|
@@ -31,6 +31,22 @@ function assertKeyTypes(prefix, yaml, schema) {
|
|
|
31
31
|
}
|
|
32
32
|
continue;
|
|
33
33
|
}
|
|
34
|
+
if (value === null) {
|
|
35
|
+
if (schemaType.endsWith("?")) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
throw new error_1.FirebaseError(`Expected ${fullKey} to be type ${schemaType}; was null`);
|
|
39
|
+
}
|
|
40
|
+
if (schemaType.endsWith("?")) {
|
|
41
|
+
schemaType = schemaType.slice(0, schemaType.length - 1);
|
|
42
|
+
}
|
|
43
|
+
if (schemaType.includes("Field")) {
|
|
44
|
+
const match = /^Field<(\w+)>$/.exec(schemaType);
|
|
45
|
+
if (match && typeof value !== "string" && typeof value !== match[1]) {
|
|
46
|
+
throw new error_1.FirebaseError(`Expected ${fullKey} to be Field<${match[1]}>; was ${typeof value}`);
|
|
47
|
+
}
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
34
50
|
if (value === null) {
|
|
35
51
|
if (schemaType.endsWith("?")) {
|
|
36
52
|
continue;
|