firebase-tools 10.0.1 → 10.1.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/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/command.js +26 -26
- package/lib/commands/appdistribution-distribute.js +4 -4
- package/lib/commands/appdistribution-testers-add.js +2 -2
- package/lib/commands/appdistribution-testers-remove.js +2 -2
- package/lib/commands/apps-android-sha-create.js +2 -2
- package/lib/commands/apps-android-sha-delete.js +2 -2
- package/lib/commands/apps-android-sha-list.js +2 -2
- package/lib/commands/apps-create.js +9 -9
- package/lib/commands/apps-list.js +3 -3
- package/lib/commands/apps-sdkconfig.js +8 -8
- package/lib/commands/database-get.js +1 -1
- package/lib/commands/database-instances-create.js +4 -4
- package/lib/commands/database-instances-list.js +4 -4
- package/lib/commands/database-profile.js +1 -1
- package/lib/commands/database-push.js +1 -1
- package/lib/commands/database-remove.js +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 +2 -2
- package/lib/commands/ext-dev-deprecate.js +4 -4
- package/lib/commands/ext-dev-extension-delete.js +3 -3
- package/lib/commands/ext-dev-init.js +3 -3
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +3 -3
- package/lib/commands/ext-dev-register.js +5 -5
- package/lib/commands/ext-dev-undeprecate.js +4 -4
- package/lib/commands/ext-dev-unpublish.js +3 -3
- package/lib/commands/ext-dev-usage.js +145 -0
- package/lib/commands/ext-export.js +8 -8
- package/lib/commands/ext-info.js +4 -4
- package/lib/commands/ext-install.js +26 -22
- package/lib/commands/ext-list.js +2 -2
- package/lib/commands/ext-sources-create.js +2 -2
- package/lib/commands/ext-uninstall.js +3 -3
- package/lib/commands/ext-update.js +17 -17
- package/lib/commands/ext.js +3 -3
- package/lib/commands/firestore-delete.js +1 -1
- package/lib/commands/functions-config-export.js +11 -11
- package/lib/commands/functions-delete.js +3 -3
- package/lib/commands/functions-deletegcfartifacts.js +4 -4
- package/lib/commands/functions-list.js +1 -1
- package/lib/commands/functions-log.js +1 -1
- package/lib/commands/hosting-channel-create.js +12 -12
- package/lib/commands/hosting-channel-delete.js +9 -9
- package/lib/commands/hosting-channel-deploy.js +17 -17
- package/lib/commands/hosting-channel-list.js +5 -5
- package/lib/commands/hosting-channel-open.js +9 -9
- package/lib/commands/hosting-clone.js +15 -15
- package/lib/commands/hosting-disable.js +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.js +2 -2
- package/lib/commands/logout.js +1 -1
- package/lib/commands/open.js +1 -1
- package/lib/commands/projects-addfirebase.js +2 -2
- package/lib/commands/projects-create.js +2 -2
- package/lib/commands/projects-list.js +1 -1
- package/lib/commands/remoteconfig-get.js +3 -3
- package/lib/commands/remoteconfig-rollback.js +3 -3
- package/lib/commands/remoteconfig-versions-list.js +1 -1
- package/lib/commands/setup-emulators-storage.js +1 -1
- package/lib/config.js +6 -6
- package/lib/database/api.js +2 -2
- package/lib/deploy/extensions/deploy.js +4 -4
- package/lib/deploy/extensions/deploymentSummary.js +5 -4
- package/lib/deploy/extensions/index.js +1 -0
- package/lib/deploy/extensions/params.js +1 -1
- package/lib/deploy/extensions/planner.js +3 -3
- package/lib/deploy/extensions/prepare.js +9 -9
- package/lib/deploy/extensions/release.js +1 -1
- package/lib/deploy/extensions/secrets.js +7 -7
- package/lib/deploy/extensions/validate.js +2 -2
- package/lib/deploy/functions/backend.js +6 -4
- package/lib/deploy/functions/checkIam.js +7 -7
- package/lib/deploy/functions/containerCleaner.js +3 -3
- package/lib/deploy/functions/deploy.js +4 -4
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
- package/lib/deploy/functions/index.js +1 -0
- package/lib/deploy/functions/prepare.js +13 -13
- 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 +6 -6
- package/lib/deploy/functions/runtimes/node/index.js +3 -3
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- 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/auth/widget_ui.js +1 -1
- package/lib/emulator/commandUtils.js +5 -5
- package/lib/emulator/controller.js +16 -11
- package/lib/emulator/downloadableEmulators.js +2 -2
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +101 -74
- package/lib/emulator/functionsEmulatorRuntime.js +32 -17
- package/lib/emulator/functionsEmulatorShell.js +3 -2
- package/lib/emulator/functionsRuntimeWorker.js +1 -1
- package/lib/emulator/hubExport.js +2 -2
- package/lib/emulator/storage/apis/firebase.js +2 -2
- package/lib/emulator/storage/apis/gcloud.js +2 -2
- package/lib/emulator/storage/cloudFunctions.js +1 -1
- package/lib/emulator/storage/files.js +14 -14
- package/lib/emulator/storage/index.js +2 -2
- package/lib/emulator/storage/metadata.js +7 -6
- package/lib/emulator/storage/rules/runtime.js +5 -5
- package/lib/emulator/storage/server.js +2 -2
- package/lib/ensureApiEnabled.js +7 -7
- package/lib/error.js +3 -3
- package/lib/extensions/askUserForConsent.js +2 -3
- package/lib/extensions/askUserForParam.js +10 -10
- package/lib/extensions/billingMigrationHelper.js +1 -1
- package/lib/extensions/changelog.js +3 -3
- package/lib/extensions/displayExtensionInfo.js +5 -5
- package/lib/extensions/emulator/optionsHelper.js +1 -1
- package/lib/extensions/emulator/specHelper.js +1 -1
- package/lib/extensions/emulator/triggerHelper.js +1 -1
- package/lib/extensions/export.js +6 -6
- package/lib/extensions/extensionsApi.js +14 -1
- package/lib/extensions/extensionsHelper.js +38 -29
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/localHelper.js +1 -1
- package/lib/extensions/metricsTypeDef.js +2 -0
- package/lib/extensions/metricsUtils.js +98 -0
- package/lib/extensions/paramHelper.js +6 -6
- package/lib/extensions/provisioningHelper.js +6 -4
- package/lib/extensions/resolveSource.js +1 -1
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/updateHelper.js +9 -9
- package/lib/extensions/utils.js +1 -1
- package/lib/extensions/warnings.js +10 -9
- package/lib/fetchWebSetup.js +2 -2
- package/lib/filterTargets.js +2 -2
- package/lib/firestore/indexes.js +2 -2
- package/lib/fsAsync.js +3 -3
- package/lib/fsutils.js +2 -2
- package/lib/functional.js +2 -1
- package/lib/functions/env.js +1 -1
- package/lib/functions/runtimeConfigExport.js +4 -4
- package/lib/functionsConfig.js +3 -3
- package/lib/functionsShellCommandAction.js +4 -3
- package/lib/gcp/cloudmonitoring.js +74 -0
- package/lib/gcp/cloudscheduler.js +1 -1
- package/lib/gcp/iam.js +2 -2
- package/lib/gcp/resourceManager.js +2 -2
- package/lib/gcp/secretManager.js +3 -2
- package/lib/getDefaultDatabaseInstance.js +1 -1
- package/lib/getDefaultHostingSite.js +1 -1
- package/lib/getProjectNumber.js +2 -2
- package/lib/handlePreviewToggles.js +5 -5
- package/lib/hosting/api.js +6 -6
- package/lib/hosting/cloudRunProxy.js +6 -6
- package/lib/hosting/functionsProxy.js +3 -3
- package/lib/hosting/implicitInit.js +2 -2
- package/lib/hosting/normalizedHostingConfigs.js +3 -3
- package/lib/hosting/proxy.js +2 -2
- package/lib/init/features/account.js +7 -7
- package/lib/init/features/database.js +9 -9
- package/lib/init/features/emulators.js +8 -8
- package/lib/init/features/firestore/index.js +3 -3
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +2 -2
- package/lib/init/features/functions/golang.js +4 -4
- package/lib/init/features/functions/index.js +4 -4
- package/lib/init/features/hosting/github.js +31 -31
- package/lib/init/features/project.js +8 -8
- package/lib/init/features/remoteconfig.js +2 -2
- package/lib/init/features/storage.js +2 -2
- package/lib/listFiles.js +1 -1
- package/lib/management/apps.js +3 -3
- package/lib/management/projects.js +6 -6
- package/lib/previews.js +2 -2
- package/lib/profiler.js +1 -1
- package/lib/projectPath.js +1 -1
- package/lib/projectUtils.js +1 -1
- package/lib/prompt.js +0 -1
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +2 -2
- package/lib/requireDatabaseInstance.js +1 -1
- package/lib/requireHostingSite.js +1 -1
- package/lib/requirePermissions.js +4 -4
- package/lib/rulesDeploy.js +2 -2
- package/lib/serve/functions.js +14 -7
- package/lib/serve/hosting.js +7 -7
- package/lib/utils.js +3 -2
- package/npm-shrinkwrap.json +24926 -0
- package/package.json +23 -23
- package/standalone/firepit.js +4 -4
- package/templates/init/hosting/index.html +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");
|
|
@@ -42,18 +42,18 @@ async function prepare(context, options, payload) {
|
|
|
42
42
|
await runtimeDelegate.validate();
|
|
43
43
|
logger_1.logger.debug(`Building ${runtimeDelegate.name} source`);
|
|
44
44
|
await runtimeDelegate.build();
|
|
45
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
45
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
46
46
|
const checkAPIsEnabled = await Promise.all([
|
|
47
47
|
ensureApiEnabled.ensure(projectId, "cloudfunctions.googleapis.com", "functions"),
|
|
48
48
|
ensureApiEnabled.check(projectId, "runtimeconfig.googleapis.com", "runtimeconfig", true),
|
|
49
|
-
ensureCloudBuildEnabled_1.ensureCloudBuildEnabled(projectId),
|
|
49
|
+
(0, ensureCloudBuildEnabled_1.ensureCloudBuildEnabled)(projectId),
|
|
50
50
|
maybeEnableAR(projectId),
|
|
51
51
|
]);
|
|
52
52
|
context.runtimeConfigEnabled = checkAPIsEnabled[1];
|
|
53
53
|
context.artifactRegistryEnabled = checkAPIsEnabled[3];
|
|
54
54
|
const firebaseConfig = await functionsConfig.getFirebaseConfig(options);
|
|
55
55
|
context.firebaseConfig = firebaseConfig;
|
|
56
|
-
const runtimeConfig = await prepareFunctionsUpload_1.getFunctionsConfig(context);
|
|
56
|
+
const runtimeConfig = await (0, prepareFunctionsUpload_1.getFunctionsConfig)(context);
|
|
57
57
|
utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
|
|
58
58
|
const source = options.config.src.functions.source;
|
|
59
59
|
const firebaseEnvs = functionsEnv.loadFirebaseEnvs(firebaseConfig, projectId);
|
|
@@ -71,7 +71,7 @@ async function prepare(context, options, payload) {
|
|
|
71
71
|
: usedDotenv
|
|
72
72
|
? "dotenv"
|
|
73
73
|
: "none";
|
|
74
|
-
await track_1.track("functions_codebase_deploy_env_method", tag);
|
|
74
|
+
await (0, track_1.track)("functions_codebase_deploy_env_method", tag);
|
|
75
75
|
logger_1.logger.debug(`Analyzing ${runtimeDelegate.name} backend spec`);
|
|
76
76
|
const wantBackend = await runtimeDelegate.discoverSpec(runtimeConfig, firebaseEnvs);
|
|
77
77
|
wantBackend.environmentVariables = Object.assign(Object.assign({}, userEnvs), firebaseEnvs);
|
|
@@ -90,16 +90,16 @@ async function prepare(context, options, payload) {
|
|
|
90
90
|
await Promise.all(enablements);
|
|
91
91
|
}
|
|
92
92
|
if (backend.someEndpoint(wantBackend, () => true)) {
|
|
93
|
-
utils_1.logBullet(clc.cyan.bold("functions:") +
|
|
93
|
+
(0, utils_1.logBullet)(clc.cyan.bold("functions:") +
|
|
94
94
|
" preparing " +
|
|
95
95
|
clc.bold(options.config.src.functions.source) +
|
|
96
96
|
" directory for uploading...");
|
|
97
97
|
}
|
|
98
98
|
if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv1")) {
|
|
99
|
-
context.functionsSourceV1 = await prepareFunctionsUpload_1.prepareFunctionsUpload(runtimeConfig, options);
|
|
99
|
+
context.functionsSourceV1 = await (0, prepareFunctionsUpload_1.prepareFunctionsUpload)(runtimeConfig, options);
|
|
100
100
|
}
|
|
101
101
|
if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv2")) {
|
|
102
|
-
context.functionsSourceV2 = await prepareFunctionsUpload_1.prepareFunctionsUpload(undefined, options);
|
|
102
|
+
context.functionsSourceV2 = await (0, prepareFunctionsUpload_1.prepareFunctionsUpload)(undefined, options);
|
|
103
103
|
}
|
|
104
104
|
for (const endpoint of backend.allEndpoints(wantBackend)) {
|
|
105
105
|
endpoint.environmentVariables = wantBackend.environmentVariables;
|
|
@@ -108,16 +108,16 @@ async function prepare(context, options, payload) {
|
|
|
108
108
|
return ensureApiEnabled.ensure(projectId, api, "functions", false);
|
|
109
109
|
}));
|
|
110
110
|
validate.functionIdsAreValid(backend.allEndpoints(wantBackend));
|
|
111
|
-
context.filters = functionsDeployHelper_1.getFilterGroups(options);
|
|
111
|
+
context.filters = (0, functionsDeployHelper_1.getFilterGroups)(options);
|
|
112
112
|
const matchingBackend = backend.matchingBackend(wantBackend, (endpoint) => {
|
|
113
|
-
return functionsDeployHelper_1.functionMatchesAnyGroup(endpoint, context.filters);
|
|
113
|
+
return (0, functionsDeployHelper_1.functionMatchesAnyGroup)(endpoint, context.filters);
|
|
114
114
|
});
|
|
115
115
|
const haveBackend = await backend.existingBackend(context);
|
|
116
|
-
await checkIam_1.ensureServiceAgentRoles(projectId, wantBackend, haveBackend);
|
|
116
|
+
await (0, checkIam_1.ensureServiceAgentRoles)(projectId, wantBackend, haveBackend);
|
|
117
117
|
inferDetailsFromExisting(wantBackend, haveBackend, usedDotenv);
|
|
118
|
-
await triggerRegionHelper_1.ensureTriggerRegions(wantBackend);
|
|
119
|
-
await prompts_1.promptForFailurePolicies(options, matchingBackend, haveBackend);
|
|
120
|
-
await prompts_1.promptForMinInstances(options, matchingBackend, haveBackend);
|
|
118
|
+
await (0, triggerRegionHelper_1.ensureTriggerRegions)(wantBackend);
|
|
119
|
+
await (0, prompts_1.promptForFailurePolicies)(options, matchingBackend, haveBackend);
|
|
120
|
+
await (0, prompts_1.promptForMinInstances)(options, matchingBackend, haveBackend);
|
|
121
121
|
await backend.checkAvailability(context, wantBackend);
|
|
122
122
|
}
|
|
123
123
|
exports.prepare = prepare;
|
|
@@ -38,7 +38,7 @@ async function promptForFailurePolicies(options, want, have) {
|
|
|
38
38
|
exit: 1,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
const proceed = await prompt_1.promptOnce({
|
|
41
|
+
const proceed = await (0, prompt_1.promptOnce)({
|
|
42
42
|
type: "confirm",
|
|
43
43
|
name: "confirm",
|
|
44
44
|
default: false,
|
|
@@ -56,7 +56,7 @@ async function promptForFunctionDeletion(functionsToDelete, force, nonInteractiv
|
|
|
56
56
|
}
|
|
57
57
|
const deleteList = functionsToDelete
|
|
58
58
|
.sort(backend.compareFunctions)
|
|
59
|
-
.map((fn) => "\t" + functionsDeployHelper_1.getFunctionLabel(fn))
|
|
59
|
+
.map((fn) => "\t" + (0, functionsDeployHelper_1.getFunctionLabel)(fn))
|
|
60
60
|
.join("\n");
|
|
61
61
|
if (nonInteractive) {
|
|
62
62
|
const deleteCommands = functionsToDelete
|
|
@@ -75,7 +75,7 @@ async function promptForFunctionDeletion(functionsToDelete, force, nonInteractiv
|
|
|
75
75
|
"\n\nIf you are renaming a function or changing its region, it is recommended that you create the new " +
|
|
76
76
|
"function first before deleting the old one to prevent event loss. For more info, visit " +
|
|
77
77
|
clc.underline("https://firebase.google.com/docs/functions/manage-functions#modify" + "\n"));
|
|
78
|
-
shouldDeleteFns = await prompt_1.promptOnce({
|
|
78
|
+
shouldDeleteFns = await (0, prompt_1.promptOnce)({
|
|
79
79
|
type: "confirm",
|
|
80
80
|
name: "confirm",
|
|
81
81
|
default: false,
|
|
@@ -121,7 +121,7 @@ async function promptForMinInstances(options, want, have) {
|
|
|
121
121
|
.filter((fn) => fn.minInstances)
|
|
122
122
|
.sort(backend.compareFunctions)
|
|
123
123
|
.map((fn) => {
|
|
124
|
-
return (`\t${functionsDeployHelper_1.getFunctionLabel(fn)}: ${fn.minInstances} instances, ` +
|
|
124
|
+
return (`\t${(0, functionsDeployHelper_1.getFunctionLabel)(fn)}: ${fn.minInstances} instances, ` +
|
|
125
125
|
backend.memoryOptionDisplayName(fn.availableMemoryMb || 256) +
|
|
126
126
|
" of memory each");
|
|
127
127
|
})
|
|
@@ -150,7 +150,7 @@ async function promptForMinInstances(options, want, have) {
|
|
|
150
150
|
costLine +
|
|
151
151
|
cudAnnotation;
|
|
152
152
|
utils.logLabeledWarning("functions", warnMessage);
|
|
153
|
-
const proceed = await prompt_1.promptOnce({
|
|
153
|
+
const proceed = await (0, prompt_1.promptOnce)({
|
|
154
154
|
type: "confirm",
|
|
155
155
|
name: "confirm",
|
|
156
156
|
default: false,
|
|
@@ -9,7 +9,10 @@ async function handler(op) {
|
|
|
9
9
|
}
|
|
10
10
|
catch (err) {
|
|
11
11
|
const code = err.status ||
|
|
12
|
-
err.code ||
|
|
12
|
+
err.code ||
|
|
13
|
+
((_b = (_a = err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) ||
|
|
14
|
+
((_c = err.original) === null || _c === void 0 ? void 0 : _c.code) ||
|
|
15
|
+
((_f = (_e = (_d = err.original) === null || _d === void 0 ? void 0 : _d.context) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.statusCode);
|
|
13
16
|
if (code === 429 || code === 409) {
|
|
14
17
|
throw err;
|
|
15
18
|
}
|
|
@@ -119,7 +119,7 @@ class Fabricator {
|
|
|
119
119
|
await this.createV2Function(endpoint);
|
|
120
120
|
}
|
|
121
121
|
else {
|
|
122
|
-
functional_1.assertExhaustive(endpoint.platform);
|
|
122
|
+
(0, functional_1.assertExhaustive)(endpoint.platform);
|
|
123
123
|
}
|
|
124
124
|
await this.setTrigger(endpoint);
|
|
125
125
|
}
|
|
@@ -139,7 +139,7 @@ class Fabricator {
|
|
|
139
139
|
await this.updateV2Function(update.endpoint);
|
|
140
140
|
}
|
|
141
141
|
else {
|
|
142
|
-
functional_1.assertExhaustive(update.endpoint.platform);
|
|
142
|
+
(0, functional_1.assertExhaustive)(update.endpoint.platform);
|
|
143
143
|
}
|
|
144
144
|
await this.setTrigger(update.endpoint);
|
|
145
145
|
}
|
|
@@ -351,7 +351,7 @@ class Fabricator {
|
|
|
351
351
|
await this.upsertScheduleV2(endpoint);
|
|
352
352
|
return;
|
|
353
353
|
}
|
|
354
|
-
functional_1.assertExhaustive(endpoint.platform);
|
|
354
|
+
(0, functional_1.assertExhaustive)(endpoint.platform);
|
|
355
355
|
}
|
|
356
356
|
else if (backend.isTaskQueueTriggered(endpoint)) {
|
|
357
357
|
await this.upsertTaskQueue(endpoint);
|
|
@@ -367,7 +367,7 @@ class Fabricator {
|
|
|
367
367
|
await this.deleteScheduleV2(endpoint);
|
|
368
368
|
return;
|
|
369
369
|
}
|
|
370
|
-
functional_1.assertExhaustive(endpoint.platform);
|
|
370
|
+
(0, functional_1.assertExhaustive)(endpoint.platform);
|
|
371
371
|
}
|
|
372
372
|
else if (backend.isTaskQueueTriggered(endpoint)) {
|
|
373
373
|
await this.disableTaskQueue(endpoint);
|
|
@@ -415,7 +415,7 @@ class Fabricator {
|
|
|
415
415
|
.catch(rethrowAs(endpoint, "disable task queue"));
|
|
416
416
|
}
|
|
417
417
|
logOpStart(op, endpoint) {
|
|
418
|
-
const runtime = runtimes_1.getHumanFriendlyRuntimeName(endpoint.runtime);
|
|
418
|
+
const runtime = (0, runtimes_1.getHumanFriendlyRuntimeName)(endpoint.runtime);
|
|
419
419
|
const label = helper.getFunctionLabel(endpoint);
|
|
420
420
|
utils.logBullet(`${clc.bold.cyan("functions:")} ${op} ${runtime} function ${clc.bold(label)}...`);
|
|
421
421
|
}
|
|
@@ -39,7 +39,7 @@ async function release(context, options, payload) {
|
|
|
39
39
|
executor: new executor.QueueExecutor({}),
|
|
40
40
|
sourceUrl: context.sourceUrl,
|
|
41
41
|
storage: context.storage,
|
|
42
|
-
appEngineLocation: functionsConfig_1.getAppEngineLocation(context.firebaseConfig),
|
|
42
|
+
appEngineLocation: (0, functionsConfig_1.getAppEngineLocation)(context.firebaseConfig),
|
|
43
43
|
});
|
|
44
44
|
const summary = await fab.applyPlan(plan);
|
|
45
45
|
await reporter.logAndTrackDeployStats(summary);
|
|
@@ -71,7 +71,7 @@ function printTriggerUrls(results) {
|
|
|
71
71
|
logger_1.logger.debug("Missing URI for HTTPS function in printTriggerUrls. This shouldn't happen");
|
|
72
72
|
continue;
|
|
73
73
|
}
|
|
74
|
-
logger_1.logger.info(clc.bold("Function URL"), `(${functionsDeployHelper_1.getFunctionLabel(httpsFunc)}):`, httpsFunc.uri);
|
|
74
|
+
logger_1.logger.info(clc.bold("Function URL"), `(${(0, functionsDeployHelper_1.getFunctionLabel)(httpsFunc)}):`, httpsFunc.uri);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
exports.printTriggerUrls = printTriggerUrls;
|
|
@@ -14,7 +14,7 @@ function calculateRegionalChanges(want, have, options) {
|
|
|
14
14
|
.map((id) => want[id]);
|
|
15
15
|
const endpointsToDelete = Object.keys(have)
|
|
16
16
|
.filter((id) => !want[id])
|
|
17
|
-
.filter((id) => options.deleteAll || deploymentTool_1.isFirebaseManaged(have[id].labels || {}))
|
|
17
|
+
.filter((id) => options.deleteAll || (0, deploymentTool_1.isFirebaseManaged)(have[id].labels || {}))
|
|
18
18
|
.map((id) => have[id]);
|
|
19
19
|
const endpointsToUpdate = Object.keys(want)
|
|
20
20
|
.filter((id) => have[id])
|
|
@@ -39,10 +39,10 @@ exports.calculateUpdate = calculateUpdate;
|
|
|
39
39
|
function createDeploymentPlan(want, have, options = {}) {
|
|
40
40
|
const deployment = {};
|
|
41
41
|
want = backend.matchingBackend(want, (endpoint) => {
|
|
42
|
-
return functionsDeployHelper_1.functionMatchesAnyGroup(endpoint, options.filters || []);
|
|
42
|
+
return (0, functionsDeployHelper_1.functionMatchesAnyGroup)(endpoint, options.filters || []);
|
|
43
43
|
});
|
|
44
44
|
have = backend.matchingBackend(have, (endpoint) => {
|
|
45
|
-
return functionsDeployHelper_1.functionMatchesAnyGroup(endpoint, options.filters || []);
|
|
45
|
+
return (0, functionsDeployHelper_1.functionMatchesAnyGroup)(endpoint, options.filters || []);
|
|
46
46
|
});
|
|
47
47
|
const regions = new Set([...Object.keys(want.endpoints), ...Object.keys(have.endpoints)]);
|
|
48
48
|
for (const region of regions) {
|
|
@@ -146,17 +146,17 @@ function checkForIllegalUpdate(want, have) {
|
|
|
146
146
|
const wantType = triggerType(want);
|
|
147
147
|
const haveType = triggerType(have);
|
|
148
148
|
if (wantType != haveType) {
|
|
149
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_2.getFunctionLabel(want)}] Changing from ${haveType} function to ${wantType} function is not allowed. Please delete your function and create a new one instead.`);
|
|
149
|
+
throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_2.getFunctionLabel)(want)}] Changing from ${haveType} function to ${wantType} function is not allowed. Please delete your function and create a new one instead.`);
|
|
150
150
|
}
|
|
151
151
|
if (want.platform == "gcfv1" && have.platform == "gcfv2") {
|
|
152
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_2.getFunctionLabel(want)}] Functions cannot be downgraded from GCFv2 to GCFv1`);
|
|
152
|
+
throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_2.getFunctionLabel)(want)}] Functions cannot be downgraded from GCFv2 to GCFv1`);
|
|
153
153
|
}
|
|
154
154
|
exports.checkForV2Upgrade(want, have);
|
|
155
155
|
}
|
|
156
156
|
exports.checkForIllegalUpdate = checkForIllegalUpdate;
|
|
157
157
|
function checkForV2Upgrade(want, have) {
|
|
158
158
|
if (want.platform == "gcfv2" && have.platform == "gcfv1") {
|
|
159
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_2.getFunctionLabel(have)}] Upgrading from GCFv1 to GCFv2 is not yet supported. Please delete your old function or wait for this feature to be ready.`);
|
|
159
|
+
throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_2.getFunctionLabel)(have)}] Upgrading from GCFv1 to GCFv2 is not yet supported. Please delete your old function or wait for this feature to be ready.`);
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
exports.checkForV2Upgrade = checkForV2Upgrade;
|
|
@@ -85,7 +85,7 @@ function printErrors(summary) {
|
|
|
85
85
|
logger_1.logger.info("Functions deploy had errors with the following functions:" +
|
|
86
86
|
errored
|
|
87
87
|
.filter((r) => !(r.error instanceof AbortedDeploymentError))
|
|
88
|
-
.map((result) => `\n\t${functionsDeployHelper_1.getFunctionLabel(result.endpoint)}`)
|
|
88
|
+
.map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`)
|
|
89
89
|
.join(""));
|
|
90
90
|
printIamErrors(errored);
|
|
91
91
|
printQuotaErrors(errored);
|
|
@@ -99,7 +99,7 @@ function printIamErrors(results) {
|
|
|
99
99
|
}
|
|
100
100
|
logger_1.logger.info("");
|
|
101
101
|
logger_1.logger.info("Unable to set the invoker for the IAM policy on the following functions:" +
|
|
102
|
-
iamFailures.map((result) => `\n\t${functionsDeployHelper_1.getFunctionLabel(result.endpoint)}`).join(""));
|
|
102
|
+
iamFailures.map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`).join(""));
|
|
103
103
|
logger_1.logger.info("");
|
|
104
104
|
logger_1.logger.info("Some common causes of this:");
|
|
105
105
|
logger_1.logger.info("");
|
|
@@ -124,7 +124,11 @@ function printQuotaErrors(results) {
|
|
|
124
124
|
return false;
|
|
125
125
|
}
|
|
126
126
|
const original = r.error.original;
|
|
127
|
-
const code = (original === null || original === void 0 ? void 0 : original.status) ||
|
|
127
|
+
const code = (original === null || original === void 0 ? void 0 : original.status) ||
|
|
128
|
+
(original === null || original === void 0 ? void 0 : original.code) ||
|
|
129
|
+
((_b = (_a = original === null || original === void 0 ? void 0 : original.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) ||
|
|
130
|
+
((_c = original === null || original === void 0 ? void 0 : original.original) === null || _c === void 0 ? void 0 : _c.code) ||
|
|
131
|
+
((_f = (_e = (_d = original === null || original === void 0 ? void 0 : original.original) === null || _d === void 0 ? void 0 : _d.context) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.statusCode);
|
|
128
132
|
return code === 429 || code === 409;
|
|
129
133
|
});
|
|
130
134
|
if (!hadQuotaError) {
|
|
@@ -145,7 +149,7 @@ function printAbortedErrors(results) {
|
|
|
145
149
|
logger_1.logger.info("");
|
|
146
150
|
logger_1.logger.info("Because there were errors creating or updating functions, the following " +
|
|
147
151
|
"functions were not deleted" +
|
|
148
|
-
aborted.map((result) => `\n\t${functionsDeployHelper_1.getFunctionLabel(result.endpoint)}`).join(""));
|
|
152
|
+
aborted.map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`).join(""));
|
|
149
153
|
logger_1.logger.info(`To delete these, use ${clc.bold("firebase functions:delete")}`);
|
|
150
154
|
}
|
|
151
155
|
exports.printAbortedErrors = printAbortedErrors;
|
|
@@ -10,7 +10,7 @@ const logger_1 = require("../../../../logger");
|
|
|
10
10
|
const api = require("../../.../../../../api");
|
|
11
11
|
const v1alpha1 = require("./v1alpha1");
|
|
12
12
|
const error_1 = require("../../../../error");
|
|
13
|
-
exports.readFileAsync = util_1.promisify(fs.readFile);
|
|
13
|
+
exports.readFileAsync = (0, util_1.promisify)(fs.readFile);
|
|
14
14
|
function yamlToBackend(yaml, project, region, runtime) {
|
|
15
15
|
try {
|
|
16
16
|
if (!yaml.specVersion) {
|
|
@@ -54,7 +54,7 @@ async function detectFromPort(port, project, runtime, timeout = 30000) {
|
|
|
54
54
|
});
|
|
55
55
|
while (true) {
|
|
56
56
|
try {
|
|
57
|
-
res = await Promise.race([node_fetch_1.default(`http://localhost:${port}/backend.yaml`), timedOut]);
|
|
57
|
+
res = await Promise.race([(0, node_fetch_1.default)(`http://localhost:${port}/backend.yaml`), timedOut]);
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
catch (err) {
|
|
@@ -9,8 +9,8 @@ function backendFromV1Alpha1(yaml, project, region, runtime) {
|
|
|
9
9
|
const manifest = JSON.parse(JSON.stringify(yaml));
|
|
10
10
|
const bkend = backend.empty();
|
|
11
11
|
bkend.requiredAPIs = parseRequiredAPIs(manifest);
|
|
12
|
-
parsing_1.requireKeys("", manifest, "endpoints");
|
|
13
|
-
parsing_1.assertKeyTypes("", manifest, {
|
|
12
|
+
(0, parsing_1.requireKeys)("", manifest, "endpoints");
|
|
13
|
+
(0, parsing_1.assertKeyTypes)("", manifest, {
|
|
14
14
|
specVersion: "string",
|
|
15
15
|
requiredAPIs: "object",
|
|
16
16
|
endpoints: "object",
|
|
@@ -41,7 +41,7 @@ function parseEndpoints(manifest, id, project, defaultRegion, runtime) {
|
|
|
41
41
|
const allParsed = [];
|
|
42
42
|
const prefix = `endpoints[${id}]`;
|
|
43
43
|
const ep = manifest.endpoints[id];
|
|
44
|
-
parsing_1.assertKeyTypes(prefix, ep, {
|
|
44
|
+
(0, parsing_1.assertKeyTypes)(prefix, ep, {
|
|
45
45
|
region: "array",
|
|
46
46
|
platform: "string",
|
|
47
47
|
entryPoint: "string",
|
|
@@ -83,8 +83,8 @@ function parseEndpoints(manifest, id, project, defaultRegion, runtime) {
|
|
|
83
83
|
for (const region of ep.region || [defaultRegion]) {
|
|
84
84
|
let triggered;
|
|
85
85
|
if (backend.isEventTriggered(ep)) {
|
|
86
|
-
parsing_1.requireKeys(prefix + ".eventTrigger", ep.eventTrigger, "eventType", "eventFilters");
|
|
87
|
-
parsing_1.assertKeyTypes(prefix + ".eventTrigger", ep.eventTrigger, {
|
|
86
|
+
(0, parsing_1.requireKeys)(prefix + ".eventTrigger", ep.eventTrigger, "eventType", "eventFilters");
|
|
87
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".eventTrigger", ep.eventTrigger, {
|
|
88
88
|
eventFilters: "object",
|
|
89
89
|
eventType: "string",
|
|
90
90
|
retry: "boolean",
|
|
@@ -94,19 +94,19 @@ function parseEndpoints(manifest, id, project, defaultRegion, runtime) {
|
|
|
94
94
|
triggered = { eventTrigger: ep.eventTrigger };
|
|
95
95
|
}
|
|
96
96
|
else if (backend.isHttpsTriggered(ep)) {
|
|
97
|
-
parsing_1.assertKeyTypes(prefix + ".httpsTrigger", ep.httpsTrigger, {
|
|
97
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".httpsTrigger", ep.httpsTrigger, {
|
|
98
98
|
invoker: "array",
|
|
99
99
|
});
|
|
100
100
|
triggered = { httpsTrigger: {} };
|
|
101
|
-
proto_1.copyIfPresent(triggered.httpsTrigger, ep.httpsTrigger, "invoker");
|
|
101
|
+
(0, proto_1.copyIfPresent)(triggered.httpsTrigger, ep.httpsTrigger, "invoker");
|
|
102
102
|
}
|
|
103
103
|
else if (backend.isScheduleTriggered(ep)) {
|
|
104
|
-
parsing_1.assertKeyTypes(prefix + ".scheduleTrigger", ep.scheduleTrigger, {
|
|
104
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".scheduleTrigger", ep.scheduleTrigger, {
|
|
105
105
|
schedule: "string",
|
|
106
106
|
timeZone: "string",
|
|
107
107
|
retryConfig: "object",
|
|
108
108
|
});
|
|
109
|
-
parsing_1.assertKeyTypes(prefix + ".scheduleTrigger.retryConfig", ep.scheduleTrigger.retryConfig, {
|
|
109
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".scheduleTrigger.retryConfig", ep.scheduleTrigger.retryConfig, {
|
|
110
110
|
retryCount: "number",
|
|
111
111
|
maxDoublings: "number",
|
|
112
112
|
minBackoffDuration: "string",
|
|
@@ -116,20 +116,20 @@ function parseEndpoints(manifest, id, project, defaultRegion, runtime) {
|
|
|
116
116
|
triggered = { scheduleTrigger: ep.scheduleTrigger };
|
|
117
117
|
}
|
|
118
118
|
else if (backend.isTaskQueueTriggered(ep)) {
|
|
119
|
-
parsing_1.assertKeyTypes(prefix + ".taskQueueTrigger", ep.taskQueueTrigger, {
|
|
119
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".taskQueueTrigger", ep.taskQueueTrigger, {
|
|
120
120
|
rateLimits: "object",
|
|
121
121
|
retryConfig: "object",
|
|
122
122
|
invoker: "array",
|
|
123
123
|
});
|
|
124
124
|
if (ep.taskQueueTrigger.rateLimits) {
|
|
125
|
-
parsing_1.assertKeyTypes(prefix + ".taskQueueTrigger.rateLimits", ep.taskQueueTrigger.rateLimits, {
|
|
125
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".taskQueueTrigger.rateLimits", ep.taskQueueTrigger.rateLimits, {
|
|
126
126
|
maxBurstSize: "number",
|
|
127
127
|
maxConcurrentDispatches: "number",
|
|
128
128
|
maxDispatchesPerSecond: "number",
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
131
|
if (ep.taskQueueTrigger.retryConfig) {
|
|
132
|
-
parsing_1.assertKeyTypes(prefix + ".taskQueueTrigger.retryConfig", ep.taskQueueTrigger.retryConfig, {
|
|
132
|
+
(0, parsing_1.assertKeyTypes)(prefix + ".taskQueueTrigger.retryConfig", ep.taskQueueTrigger.retryConfig, {
|
|
133
133
|
maxAttempts: "number",
|
|
134
134
|
maxRetryDuration: "string",
|
|
135
135
|
minBackoff: "string",
|
|
@@ -143,12 +143,12 @@ function parseEndpoints(manifest, id, project, defaultRegion, runtime) {
|
|
|
143
143
|
throw new error_1.FirebaseError(`Do not recognize trigger type for endpoint ${id}. Try upgrading ` +
|
|
144
144
|
"firebase-tools with npm install -g firebase-tools@latest");
|
|
145
145
|
}
|
|
146
|
-
parsing_1.requireKeys(prefix, ep, "entryPoint");
|
|
146
|
+
(0, parsing_1.requireKeys)(prefix, ep, "entryPoint");
|
|
147
147
|
const parsed = Object.assign({ platform: ep.platform || "gcfv2", id,
|
|
148
148
|
region,
|
|
149
149
|
project,
|
|
150
150
|
runtime, entryPoint: ep.entryPoint }, triggered);
|
|
151
|
-
proto_1.copyIfPresent(parsed, ep, "availableMemoryMb", "maxInstances", "minInstances", "concurrency", "serviceAccountEmail", "timeout", "vpcConnector", "vpcConnectorEgressSettings", "labels", "ingressSettings", "environmentVariables");
|
|
151
|
+
(0, proto_1.copyIfPresent)(parsed, ep, "availableMemoryMb", "maxInstances", "minInstances", "concurrency", "serviceAccountEmail", "timeout", "vpcConnector", "vpcConnectorEgressSettings", "labels", "ingressSettings", "environmentVariables");
|
|
152
152
|
allParsed.push(parsed);
|
|
153
153
|
}
|
|
154
154
|
return allParsed;
|
|
@@ -23,10 +23,10 @@ async function tryCreateDelegate(context, options) {
|
|
|
23
23
|
const relativeSourceDir = options.config.get("functions.source");
|
|
24
24
|
const sourceDir = options.config.path(relativeSourceDir);
|
|
25
25
|
const goModPath = path.join(sourceDir, "go.mod");
|
|
26
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
26
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
27
27
|
let module;
|
|
28
28
|
try {
|
|
29
|
-
const modBuffer = await util_1.promisify(fs.readFile)(goModPath);
|
|
29
|
+
const modBuffer = await (0, util_1.promisify)(fs.readFile)(goModPath);
|
|
30
30
|
module = gomod.parseModule(modBuffer.toString("utf8"));
|
|
31
31
|
}
|
|
32
32
|
catch (err) {
|
|
@@ -59,7 +59,7 @@ class Delegate {
|
|
|
59
59
|
}
|
|
60
60
|
async build() {
|
|
61
61
|
try {
|
|
62
|
-
await util_1.promisify(fs.mkdir)(path.join(this.sourceDir, "autogen"));
|
|
62
|
+
await (0, util_1.promisify)(fs.mkdir)(path.join(this.sourceDir, "autogen"));
|
|
63
63
|
}
|
|
64
64
|
catch (err) {
|
|
65
65
|
if ((err === null || err === void 0 ? void 0 : err.code) !== "EEXIST") {
|
|
@@ -80,7 +80,7 @@ class Delegate {
|
|
|
80
80
|
children: [new Error(genBinary.stderr.toString())],
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
await util_1.promisify(fs.writeFile)(path.join(this.sourceDir, "autogen", "main.go"), genBinary.stdout);
|
|
83
|
+
await (0, util_1.promisify)(fs.writeFile)(path.join(this.sourceDir, "autogen", "main.go"), genBinary.stdout);
|
|
84
84
|
}
|
|
85
85
|
watch() {
|
|
86
86
|
return Promise.resolve(() => Promise.resolve());
|
|
@@ -99,7 +99,7 @@ class Delegate {
|
|
|
99
99
|
childProcess.once("exit", resolve);
|
|
100
100
|
childProcess.once("error", reject);
|
|
101
101
|
});
|
|
102
|
-
await node_fetch_1.default(`http://localhost:${adminPort}/quitquitquit`);
|
|
102
|
+
await (0, node_fetch_1.default)(`http://localhost:${adminPort}/quitquitquit`);
|
|
103
103
|
setTimeout(() => {
|
|
104
104
|
if (!childProcess.killed) {
|
|
105
105
|
childProcess.kill("SIGKILL");
|
|
@@ -111,7 +111,7 @@ class Delegate {
|
|
|
111
111
|
async discoverSpec(configValues, envs) {
|
|
112
112
|
let discovered = await discovery.detectFromYaml(this.sourceDir, this.projectId, this.runtime);
|
|
113
113
|
if (!discovered) {
|
|
114
|
-
const getPort = util_1.promisify(portfinder.getPort);
|
|
114
|
+
const getPort = (0, util_1.promisify)(portfinder.getPort);
|
|
115
115
|
const port = await getPort();
|
|
116
116
|
portfinder.basePort = port + 1;
|
|
117
117
|
const adminPort = await getPort();
|
|
@@ -15,17 +15,17 @@ async function tryCreateDelegate(context, options) {
|
|
|
15
15
|
const projectRelativeSourceDir = options.config.get("functions.source");
|
|
16
16
|
const sourceDir = options.config.path(projectRelativeSourceDir);
|
|
17
17
|
const packageJsonPath = path.join(sourceDir, "package.json");
|
|
18
|
-
if (!(await util_1.promisify(fs.exists)(packageJsonPath))) {
|
|
18
|
+
if (!(await (0, util_1.promisify)(fs.exists)(packageJsonPath))) {
|
|
19
19
|
logger_1.logger.debug("Customer code is not Node");
|
|
20
20
|
return undefined;
|
|
21
21
|
}
|
|
22
22
|
let runtime = options.config.get("functions.runtime") || "";
|
|
23
|
-
runtime = parseRuntimeAndValidateSDK_1.getRuntimeChoice(sourceDir, runtime);
|
|
23
|
+
runtime = (0, parseRuntimeAndValidateSDK_1.getRuntimeChoice)(sourceDir, runtime);
|
|
24
24
|
if (!runtime.startsWith("nodejs")) {
|
|
25
25
|
logger_1.logger.debug("Customer has a package.json but did not get a nodejs runtime. This should not happen");
|
|
26
26
|
throw new error_1.FirebaseError(`Unexpected runtime ${runtime}`);
|
|
27
27
|
}
|
|
28
|
-
return new Delegate(projectUtils_1.needProjectId(options), options.config.projectDir, sourceDir, runtime);
|
|
28
|
+
return new Delegate((0, projectUtils_1.needProjectId)(options), options.config.projectDir, sourceDir, runtime);
|
|
29
29
|
}
|
|
30
30
|
exports.tryCreateDelegate = tryCreateDelegate;
|
|
31
31
|
class Delegate {
|
|
@@ -25,7 +25,7 @@ function parseTriggers(projectId, sourceDir, configValues, envs) {
|
|
|
25
25
|
if (env.NODE_OPTIONS) {
|
|
26
26
|
env.NODE_OPTIONS = removeInspectOptions(env.NODE_OPTIONS.split(" ")).join(" ");
|
|
27
27
|
}
|
|
28
|
-
const parser = child_process_1.fork(TRIGGER_PARSER, [sourceDir], {
|
|
28
|
+
const parser = (0, child_process_1.fork)(TRIGGER_PARSER, [sourceDir], {
|
|
29
29
|
silent: true,
|
|
30
30
|
env: env,
|
|
31
31
|
execArgv: execArgv,
|
|
@@ -100,9 +100,9 @@ function addResourcesToBackend(projectId, runtime, annotation, want) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
const endpoint = Object.assign({ platform: annotation.platform || "gcfv1", id: annotation.name, region: region, project: projectId, entryPoint: annotation.entryPoint, runtime: runtime }, triggered);
|
|
103
|
-
if (annotation.vpcConnector) {
|
|
103
|
+
if (annotation.vpcConnector != null) {
|
|
104
104
|
let maybeId = annotation.vpcConnector;
|
|
105
|
-
if (!maybeId.includes("/")) {
|
|
105
|
+
if (maybeId && !maybeId.includes("/")) {
|
|
106
106
|
maybeId = `projects/${projectId}/locations/${region}/connectors/${maybeId}`;
|
|
107
107
|
}
|
|
108
108
|
endpoint.vpcConnector = maybeId;
|
|
@@ -36,7 +36,7 @@ async function ensureStorageTriggerRegion(endpoint, eventTrigger) {
|
|
|
36
36
|
}
|
|
37
37
|
if (endpoint.region !== eventTrigger.region &&
|
|
38
38
|
eventTrigger.region !== "us-central1" &&
|
|
39
|
-
!location_1.regionInLocation(endpoint.region, eventTrigger.region)) {
|
|
39
|
+
!(0, location_1.regionInLocation)(endpoint.region, eventTrigger.region)) {
|
|
40
40
|
throw new error_1.FirebaseError(`A function in region ${endpoint.region} cannot listen to a bucket in region ${eventTrigger.region}`);
|
|
41
41
|
}
|
|
42
42
|
}
|