firebase-tools 9.19.0 → 9.23.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/CHANGELOG.md +1 -3
- package/lib/api.js +3 -0
- package/lib/apiv2.js +7 -4
- package/lib/commands/crashlytics-symbols-upload.js +146 -0
- package/lib/commands/deploy.js +9 -1
- package/lib/commands/ext-configure.js +3 -1
- package/lib/commands/ext-dev-deprecate.js +63 -0
- package/lib/commands/ext-dev-undeprecate.js +56 -0
- package/lib/commands/ext-dev-unpublish.js +10 -3
- package/lib/commands/ext-export.js +44 -0
- package/lib/commands/ext-install.js +24 -3
- package/lib/commands/ext-uninstall.js +6 -0
- package/lib/commands/ext-update.js +10 -3
- package/lib/commands/functions-config-export.js +115 -0
- package/lib/commands/functions-delete.js +47 -25
- package/lib/commands/functions-list.js +12 -12
- package/lib/commands/index.js +9 -0
- package/lib/commands/init.js +3 -0
- package/lib/config.js +3 -2
- package/lib/deploy/extensions/args.js +2 -0
- package/lib/deploy/extensions/deploy.js +49 -0
- package/lib/deploy/extensions/deploymentSummary.js +52 -0
- package/lib/deploy/extensions/errors.js +31 -0
- package/lib/deploy/extensions/index.js +8 -0
- package/lib/deploy/extensions/params.js +39 -0
- package/lib/deploy/extensions/planner.js +94 -0
- package/lib/deploy/extensions/prepare.js +111 -0
- package/lib/deploy/extensions/release.js +43 -0
- package/lib/deploy/extensions/secrets.js +150 -0
- package/lib/deploy/extensions/tasks.js +98 -0
- package/lib/deploy/extensions/validate.js +17 -0
- package/lib/deploy/functions/backend.js +93 -115
- package/lib/deploy/functions/checkIam.js +8 -8
- package/lib/deploy/functions/containerCleaner.js +71 -14
- package/lib/deploy/functions/deploy.js +4 -10
- package/lib/deploy/functions/functionsDeployHelper.js +3 -68
- package/lib/deploy/functions/prepare.js +63 -27
- package/lib/deploy/functions/pricing.js +17 -17
- package/lib/deploy/functions/prompts.js +22 -21
- package/lib/deploy/functions/release/executor.js +39 -0
- package/lib/deploy/functions/release/fabricator.js +422 -0
- package/lib/deploy/functions/release/index.js +73 -0
- package/lib/deploy/functions/release/planner.js +162 -0
- package/lib/deploy/functions/release/reporter.js +165 -0
- package/lib/deploy/functions/release/sourceTokenScraper.js +28 -0
- package/lib/deploy/functions/release/timer.js +14 -0
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +129 -126
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +41 -45
- package/lib/deploy/functions/triggerRegionHelper.js +40 -0
- package/lib/deploy/functions/validate.js +1 -24
- package/lib/deploy/index.js +10 -1
- package/lib/downloadUtils.js +37 -0
- package/lib/emulator/auth/apiSpec.js +549 -6
- package/lib/emulator/auth/handlers.js +4 -3
- package/lib/emulator/auth/operations.js +154 -14
- package/lib/emulator/auth/server.js +26 -15
- package/lib/emulator/auth/state.js +151 -13
- package/lib/emulator/download.js +2 -31
- package/lib/emulator/downloadableEmulators.js +7 -7
- package/lib/emulator/functionsEmulator.js +18 -4
- package/lib/emulator/functionsEmulatorRuntime.js +29 -7
- package/lib/emulator/storage/cloudFunctions.js +37 -7
- package/lib/extensions/askUserForConsent.js +14 -1
- package/lib/extensions/askUserForParam.js +81 -4
- package/lib/extensions/checkProjectBilling.js +7 -7
- package/lib/extensions/export.js +107 -0
- package/lib/extensions/extensionsApi.js +104 -21
- package/lib/extensions/extensionsHelper.js +6 -2
- package/lib/extensions/listExtensions.js +16 -11
- package/lib/extensions/paramHelper.js +9 -6
- package/lib/extensions/provisioningHelper.js +16 -3
- package/lib/extensions/refs.js +9 -1
- package/lib/extensions/secretsUtils.js +59 -0
- package/lib/extensions/updateHelper.js +12 -2
- package/lib/extensions/versionHelper.js +14 -0
- package/lib/extensions/warnings.js +33 -1
- package/lib/functional.js +8 -1
- package/lib/functions/env.js +10 -4
- package/lib/functions/runtimeConfigExport.js +137 -0
- package/lib/gcp/artifactregistry.js +16 -0
- package/lib/gcp/cloudfunctions.js +20 -74
- package/lib/gcp/cloudfunctionsv2.js +12 -90
- package/lib/gcp/cloudscheduler.js +22 -16
- package/lib/gcp/cloudtasks.js +143 -0
- package/lib/gcp/docker.js +7 -1
- package/lib/gcp/proto.js +2 -2
- package/lib/gcp/pubsub.js +1 -9
- package/lib/gcp/secretManager.js +132 -0
- package/lib/gcp/storage.js +16 -0
- package/lib/projectUtils.js +10 -1
- package/lib/requireInteractive.js +12 -0
- package/lib/utils.js +30 -1
- package/package.json +5 -4
- package/schema/firebase-config.json +9 -0
- package/lib/deploy/functions/deploymentPlanner.js +0 -113
- package/lib/deploy/functions/deploymentTimer.js +0 -23
- package/lib/deploy/functions/errorHandler.js +0 -75
- package/lib/deploy/functions/release.js +0 -116
- package/lib/deploy/functions/tasks.js +0 -324
- package/lib/functions/listFunctions.js +0 -10
- package/lib/functionsDelete.js +0 -60
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.functionIdsAreValid = exports.functionsDirectoryExists = void 0;
|
|
4
4
|
const clc = require("cli-color");
|
|
5
5
|
const error_1 = require("../../error");
|
|
6
|
-
const functionsDeployHelper_1 = require("./functionsDeployHelper");
|
|
7
|
-
const backend = require("./backend");
|
|
8
6
|
const fsutils = require("../../fsutils");
|
|
9
7
|
const projectPath = require("../../projectPath");
|
|
10
8
|
function functionsDirectoryExists(options, sourceDirName) {
|
|
@@ -36,24 +34,3 @@ function functionIdsAreValid(functions) {
|
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
exports.functionIdsAreValid = functionIdsAreValid;
|
|
39
|
-
function checkForInvalidChangeOfTrigger(fn, exFn) {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
const wantEventTrigger = backend.isEventTrigger(fn.trigger);
|
|
42
|
-
const haveEventTrigger = backend.isEventTrigger(exFn.trigger);
|
|
43
|
-
if (!wantEventTrigger && haveEventTrigger) {
|
|
44
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_1.getFunctionLabel(fn)}] Changing from a background triggered function to an HTTPS function is not allowed. Please delete your function and create a new one instead.`);
|
|
45
|
-
}
|
|
46
|
-
if (wantEventTrigger && !haveEventTrigger) {
|
|
47
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_1.getFunctionLabel(fn)}] Changing from an HTTPS function to an background triggered function is not allowed. Please delete your function and create a new one instead.`);
|
|
48
|
-
}
|
|
49
|
-
if (fn.platform == "gcfv2" && exFn.platform == "gcfv1") {
|
|
50
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_1.getFunctionLabel(fn)}] Upgrading from GCFv1 to GCFv2 is not yet supported. Please delete your old function or wait for this feature to be ready.`);
|
|
51
|
-
}
|
|
52
|
-
if (fn.platform == "gcfv1" && exFn.platform == "gcfv2") {
|
|
53
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_1.getFunctionLabel(fn)}] Functions cannot be downgraded from GCFv2 to GCFv1`);
|
|
54
|
-
}
|
|
55
|
-
if (((_a = exFn.labels) === null || _a === void 0 ? void 0 : _a["deployment-scheduled"]) && !((_b = fn.labels) === null || _b === void 0 ? void 0 : _b["deployment-scheduled"])) {
|
|
56
|
-
throw new error_1.FirebaseError(`[${functionsDeployHelper_1.getFunctionLabel(fn)}] Scheduled functions cannot be changed to event handler or HTTP functions`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.checkForInvalidChangeOfTrigger = checkForInvalidChangeOfTrigger;
|
package/lib/deploy/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var TARGETS = {
|
|
|
15
15
|
functions: require("./functions"),
|
|
16
16
|
storage: require("./storage"),
|
|
17
17
|
remoteconfig: require("./remoteconfig"),
|
|
18
|
+
extensions: require("./extensions"),
|
|
18
19
|
};
|
|
19
20
|
var _noop = function () {
|
|
20
21
|
return Promise.resolve();
|
|
@@ -37,6 +38,7 @@ var deploy = function (targetNames, options, customContext = {}) {
|
|
|
37
38
|
var deploys = [];
|
|
38
39
|
var releases = [];
|
|
39
40
|
var postdeploys = [];
|
|
41
|
+
var startTime = Date.now();
|
|
40
42
|
for (var i = 0; i < targetNames.length; i++) {
|
|
41
43
|
var targetName = targetNames[i];
|
|
42
44
|
var target = TARGETS[targetName];
|
|
@@ -74,8 +76,15 @@ var deploy = function (targetNames, options, customContext = {}) {
|
|
|
74
76
|
})
|
|
75
77
|
.then(function () {
|
|
76
78
|
if (_.has(options, "config.notes.databaseRules")) {
|
|
77
|
-
track("Rules Deploy", options.config.notes.databaseRules);
|
|
79
|
+
return track("Rules Deploy", options.config.notes.databaseRules);
|
|
78
80
|
}
|
|
81
|
+
return;
|
|
82
|
+
})
|
|
83
|
+
.then(function () {
|
|
84
|
+
const duration = Date.now() - startTime;
|
|
85
|
+
return track("Product Deploy", [...targetNames].sort().join(","), duration);
|
|
86
|
+
})
|
|
87
|
+
.then(function () {
|
|
79
88
|
logger.info();
|
|
80
89
|
utils.logSuccess(clc.underline.bold("Deploy complete!"));
|
|
81
90
|
logger.info();
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.downloadToTmp = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
5
|
+
const fs = require("fs-extra");
|
|
6
|
+
const ProgressBar = require("progress");
|
|
7
|
+
const tmp = require("tmp");
|
|
8
|
+
const apiv2_1 = require("./apiv2");
|
|
9
|
+
const error_1 = require("./error");
|
|
10
|
+
async function downloadToTmp(remoteUrl) {
|
|
11
|
+
const u = new url_1.URL(remoteUrl);
|
|
12
|
+
const c = new apiv2_1.Client({ urlPrefix: u.origin, auth: false });
|
|
13
|
+
const tmpfile = tmp.fileSync();
|
|
14
|
+
const writeStream = fs.createWriteStream(tmpfile.name);
|
|
15
|
+
const res = await c.request({
|
|
16
|
+
method: "GET",
|
|
17
|
+
path: u.pathname,
|
|
18
|
+
queryParams: u.searchParams,
|
|
19
|
+
responseType: "stream",
|
|
20
|
+
resolveOnHTTPError: true,
|
|
21
|
+
});
|
|
22
|
+
if (res.status !== 200) {
|
|
23
|
+
throw new error_1.FirebaseError(`download failed, status ${res.status}`, { exit: 1 });
|
|
24
|
+
}
|
|
25
|
+
const total = parseInt(res.response.headers.get("content-length") || "0", 10);
|
|
26
|
+
const totalMb = Math.ceil(total / 1000000);
|
|
27
|
+
const bar = new ProgressBar(`Progress: :bar (:percent of ${totalMb}MB)`, { total, head: ">" });
|
|
28
|
+
res.body.on("data", (chunk) => {
|
|
29
|
+
bar.tick(chunk.length);
|
|
30
|
+
});
|
|
31
|
+
await new Promise((resolve) => {
|
|
32
|
+
writeStream.on("finish", resolve);
|
|
33
|
+
res.body.pipe(writeStream);
|
|
34
|
+
});
|
|
35
|
+
return tmpfile.name;
|
|
36
|
+
}
|
|
37
|
+
exports.downloadToTmp = downloadToTmp;
|