firebase-tools 10.5.0 → 10.7.1
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/command.js +4 -4
- package/lib/commands/deploy.js +1 -1
- package/lib/commands/emulators-start.js +7 -2
- package/lib/commands/ext-configure.js +15 -5
- package/lib/commands/ext-export.js +6 -5
- package/lib/commands/ext-install.js +28 -44
- package/lib/commands/ext-update.js +9 -1
- package/lib/commands/functions-delete.js +7 -3
- package/lib/commands/functions-secrets-destroy.js +23 -3
- package/lib/commands/functions-secrets-prune.js +15 -12
- package/lib/commands/functions-secrets-set.js +51 -4
- package/lib/commands/hosting-channel-deploy.js +2 -2
- package/lib/deploy/database/deploy.js +4 -0
- package/lib/deploy/database/index.js +1 -0
- package/lib/deploy/extensions/deploy.js +4 -4
- package/lib/deploy/extensions/deploymentSummary.js +8 -5
- package/lib/deploy/extensions/planner.js +36 -9
- package/lib/deploy/extensions/prepare.js +1 -1
- package/lib/deploy/extensions/secrets.js +2 -2
- package/lib/deploy/extensions/tasks.js +60 -21
- package/lib/deploy/functions/backend.js +37 -6
- package/lib/deploy/functions/build.js +162 -0
- package/lib/deploy/functions/checkIam.js +10 -6
- package/lib/deploy/functions/deploy.js +49 -28
- package/lib/deploy/functions/ensure.js +4 -4
- package/lib/deploy/functions/functionsDeployHelper.js +99 -24
- package/lib/deploy/functions/prepare.js +130 -62
- package/lib/deploy/functions/prepareFunctionsUpload.js +16 -21
- package/lib/deploy/functions/pricing.js +6 -3
- package/lib/deploy/functions/prompts.js +1 -7
- package/lib/deploy/functions/release/fabricator.js +70 -28
- package/lib/deploy/functions/release/index.js +41 -6
- package/lib/deploy/functions/release/planner.js +19 -12
- package/lib/deploy/functions/release/reporter.js +14 -11
- package/lib/deploy/functions/runtimes/discovery/parsing.js +12 -6
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +61 -13
- package/lib/deploy/functions/runtimes/node/index.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +3 -3
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +29 -24
- package/lib/deploy/functions/runtimes/node/versioning.js +2 -2
- package/lib/deploy/functions/services/auth.js +95 -0
- package/lib/deploy/functions/services/index.js +41 -21
- package/lib/deploy/functions/services/storage.js +1 -6
- package/lib/deploy/functions/validate.js +32 -6
- package/lib/deploy/hosting/args.js +2 -0
- package/lib/deploy/hosting/convertConfig.js +39 -8
- package/lib/deploy/hosting/deploy.js +3 -3
- package/lib/deploy/hosting/prepare.js +2 -2
- package/lib/deploy/hosting/release.js +6 -2
- package/lib/deploy/index.js +82 -93
- package/lib/deploy/remoteconfig/deploy.js +4 -0
- package/lib/deploy/remoteconfig/index.js +3 -1
- package/lib/emulator/auth/operations.js +5 -0
- package/lib/emulator/auth/utils.js +3 -25
- package/lib/emulator/controller.js +17 -14
- package/lib/emulator/downloadableEmulators.js +39 -23
- package/lib/emulator/extensions/postinstall.js +41 -0
- package/lib/emulator/extensions/validation.js +2 -2
- package/lib/emulator/extensionsEmulator.js +85 -21
- package/lib/emulator/functionsEmulator.js +88 -10
- package/lib/emulator/functionsEmulatorShared.js +37 -21
- package/lib/emulator/functionsEmulatorShell.js +2 -3
- package/lib/emulator/pubsubEmulator.js +13 -9
- package/lib/emulator/registry.js +34 -12
- package/lib/emulator/storage/apis/firebase.js +13 -8
- package/lib/emulator/storage/apis/gcloud.js +15 -9
- package/lib/emulator/storage/files.js +14 -3
- package/lib/emulator/storage/index.js +9 -1
- package/lib/emulator/storage/metadata.js +18 -8
- package/lib/emulator/storage/rules/manager.js +7 -17
- package/lib/emulator/storage/server.js +38 -12
- package/lib/ensureApiEnabled.js +8 -4
- package/lib/extensions/askUserForParam.js +14 -11
- package/lib/extensions/changelog.js +1 -1
- package/lib/extensions/emulator/optionsHelper.js +9 -10
- package/lib/extensions/emulator/specHelper.js +7 -1
- package/lib/extensions/emulator/triggerHelper.js +11 -14
- package/lib/extensions/extensionsApi.js +2 -1
- package/lib/extensions/extensionsHelper.js +30 -24
- package/lib/extensions/manifest.js +28 -8
- package/lib/extensions/paramHelper.js +19 -13
- package/lib/extensions/provisioningHelper.js +2 -2
- package/lib/extensions/warnings.js +3 -3
- package/lib/functions/env.js +10 -2
- package/lib/functions/events/index.js +7 -0
- package/lib/functions/events/v1.js +6 -0
- package/lib/functions/projectConfig.js +32 -6
- package/lib/functions/runtimeConfigExport.js +10 -6
- package/lib/functions/secrets.js +99 -6
- package/lib/functionsShellCommandAction.js +1 -1
- package/lib/gcp/cloudfunctions.js +44 -18
- package/lib/gcp/cloudfunctionsv2.js +48 -25
- package/lib/gcp/cloudtasks.js +5 -3
- package/lib/gcp/identityPlatform.js +44 -0
- package/lib/gcp/secretManager.js +2 -2
- package/lib/metaprogramming.js +2 -0
- package/lib/previews.js +1 -1
- package/lib/serve/functions.js +16 -19
- package/lib/serve/hosting.js +25 -12
- package/lib/serve/index.js +6 -0
- package/lib/track.js +15 -21
- package/lib/utils.js +30 -1
- package/npm-shrinkwrap.json +44 -2
- package/package.json +4 -1
- package/schema/firebase-config.json +6 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertConfig = void 0;
|
|
4
4
|
const error_1 = require("../../error");
|
|
5
|
+
const backend_1 = require("../functions/backend");
|
|
5
6
|
function has(obj, k) {
|
|
6
7
|
return obj[k] !== undefined;
|
|
7
8
|
}
|
|
@@ -28,7 +29,7 @@ function extractPattern(type, spec) {
|
|
|
28
29
|
}
|
|
29
30
|
throw new error_1.FirebaseError(`Cannot specify a ${type} with no pattern (either a glob or regex required).`);
|
|
30
31
|
}
|
|
31
|
-
function convertConfig(config) {
|
|
32
|
+
async function convertConfig(context, payload, config, finalize) {
|
|
32
33
|
if (Array.isArray(config)) {
|
|
33
34
|
throw new error_1.FirebaseError(`convertConfig should be given a single configuration, not an array.`, {
|
|
34
35
|
exit: 2,
|
|
@@ -38,29 +39,59 @@ function convertConfig(config) {
|
|
|
38
39
|
if (!config) {
|
|
39
40
|
return out;
|
|
40
41
|
}
|
|
42
|
+
const endpointBeingDeployed = (serviceId, region = "us-central1") => {
|
|
43
|
+
var _a;
|
|
44
|
+
for (const { wantBackend } of Object.values(payload.functions || {})) {
|
|
45
|
+
const endpoint = (_a = wantBackend === null || wantBackend === void 0 ? void 0 : wantBackend.endpoints[region]) === null || _a === void 0 ? void 0 : _a[serviceId];
|
|
46
|
+
if (endpoint && (0, backend_1.isHttpsTriggered)(endpoint) && endpoint.platform === "gcfv2")
|
|
47
|
+
return endpoint;
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
};
|
|
51
|
+
const matchingEndpoint = async (serviceId, region = "us-central1") => {
|
|
52
|
+
const pendingEndpoint = endpointBeingDeployed(serviceId, region);
|
|
53
|
+
if (pendingEndpoint)
|
|
54
|
+
return pendingEndpoint;
|
|
55
|
+
const backend = await (0, backend_1.existingBackend)(context);
|
|
56
|
+
return (0, backend_1.allEndpoints)(backend).find((it) => (0, backend_1.isHttpsTriggered)(it) &&
|
|
57
|
+
it.platform === "gcfv2" &&
|
|
58
|
+
it.id === serviceId &&
|
|
59
|
+
it.region === region);
|
|
60
|
+
};
|
|
41
61
|
if (Array.isArray(config.rewrites)) {
|
|
42
|
-
out.rewrites =
|
|
62
|
+
out.rewrites = [];
|
|
63
|
+
for (const rewrite of config.rewrites) {
|
|
43
64
|
const vRewrite = extractPattern("rewrite", rewrite);
|
|
44
65
|
if ("destination" in rewrite) {
|
|
45
66
|
vRewrite.path = rewrite.destination;
|
|
46
67
|
}
|
|
47
68
|
else if ("function" in rewrite) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
69
|
+
if (!finalize && endpointBeingDeployed(rewrite.function, rewrite.region))
|
|
70
|
+
continue;
|
|
71
|
+
const endpoint = await matchingEndpoint(rewrite.function, rewrite.region);
|
|
72
|
+
if (endpoint) {
|
|
73
|
+
vRewrite.run = { serviceId: endpoint.id, region: endpoint.region };
|
|
51
74
|
}
|
|
52
75
|
else {
|
|
53
|
-
vRewrite.
|
|
76
|
+
vRewrite.function = rewrite.function;
|
|
77
|
+
if (rewrite.region) {
|
|
78
|
+
vRewrite.functionRegion = rewrite.region;
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
vRewrite.functionRegion = "us-central1";
|
|
82
|
+
}
|
|
54
83
|
}
|
|
55
84
|
}
|
|
56
85
|
else if ("dynamicLinks" in rewrite) {
|
|
57
86
|
vRewrite.dynamicLinks = rewrite.dynamicLinks;
|
|
58
87
|
}
|
|
59
88
|
else if ("run" in rewrite) {
|
|
89
|
+
if (!finalize && endpointBeingDeployed(rewrite.run.serviceId, rewrite.run.region))
|
|
90
|
+
continue;
|
|
60
91
|
vRewrite.run = Object.assign({ region: "us-central1" }, rewrite.run);
|
|
61
92
|
}
|
|
62
|
-
|
|
63
|
-
}
|
|
93
|
+
out.rewrites.push(vRewrite);
|
|
94
|
+
}
|
|
64
95
|
}
|
|
65
96
|
if (Array.isArray(config.redirects)) {
|
|
66
97
|
out.redirects = config.redirects.map((redirect) => {
|
|
@@ -5,7 +5,7 @@ const uploader_1 = require("./uploader");
|
|
|
5
5
|
const detectProjectRoot_1 = require("../../detectProjectRoot");
|
|
6
6
|
const listFiles_1 = require("../../listFiles");
|
|
7
7
|
const logger_1 = require("../../logger");
|
|
8
|
-
const
|
|
8
|
+
const track_1 = require("../../track");
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const clc = require("cli-color");
|
|
11
11
|
const SPINNER = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
@@ -63,7 +63,7 @@ async function deploy(context, options) {
|
|
|
63
63
|
await uploader.start();
|
|
64
64
|
}
|
|
65
65
|
catch (err) {
|
|
66
|
-
void track("Hosting Deploy", "failure");
|
|
66
|
+
void (0, track_1.track)("Hosting Deploy", "failure");
|
|
67
67
|
throw err;
|
|
68
68
|
}
|
|
69
69
|
finally {
|
|
@@ -75,7 +75,7 @@ async function deploy(context, options) {
|
|
|
75
75
|
(0, utils_1.logLabeledSuccess)("hosting[" + deploy.site + "]", "file upload complete");
|
|
76
76
|
const dt = Date.now() - t0;
|
|
77
77
|
logger_1.logger.debug("[hosting] deploy completed after " + dt + "ms");
|
|
78
|
-
void track("Hosting Deploy", "success", dt);
|
|
78
|
+
void (0, track_1.track)("Hosting Deploy", "success", dt);
|
|
79
79
|
return runDeploys(deploys, debugging);
|
|
80
80
|
}
|
|
81
81
|
const debugging = !!(options.debug || options.nonInteractive);
|
|
@@ -8,7 +8,7 @@ const normalizedHostingConfigs_1 = require("../../hosting/normalizedHostingConfi
|
|
|
8
8
|
const validate_1 = require("./validate");
|
|
9
9
|
const convertConfig_1 = require("./convertConfig");
|
|
10
10
|
const deploymentTool = require("../../deploymentTool");
|
|
11
|
-
async function prepare(context, options) {
|
|
11
|
+
async function prepare(context, options, payload) {
|
|
12
12
|
if (options.public) {
|
|
13
13
|
if (Array.isArray(options.config.get("hosting"))) {
|
|
14
14
|
throw new error_1.FirebaseError("Cannot specify --public option with multi-site configuration.");
|
|
@@ -30,7 +30,7 @@ async function prepare(context, options) {
|
|
|
30
30
|
const cfg = deploy.config;
|
|
31
31
|
(0, validate_1.validateDeploy)(deploy, options);
|
|
32
32
|
const data = {
|
|
33
|
-
config: (0, convertConfig_1.convertConfig)(cfg),
|
|
33
|
+
config: await (0, convertConfig_1.convertConfig)(context, payload, cfg, false),
|
|
34
34
|
labels: deploymentTool.labels(),
|
|
35
35
|
};
|
|
36
36
|
versionCreates.push(client_1.client
|
|
@@ -5,7 +5,8 @@ const client_1 = require("./client");
|
|
|
5
5
|
const logger_1 = require("../../logger");
|
|
6
6
|
const projectUtils_1 = require("../../projectUtils");
|
|
7
7
|
const utils = require("../../utils");
|
|
8
|
-
|
|
8
|
+
const convertConfig_1 = require("./convertConfig");
|
|
9
|
+
async function release(context, options, payload) {
|
|
9
10
|
if (!context.hosting || !context.hosting.deploys) {
|
|
10
11
|
return;
|
|
11
12
|
}
|
|
@@ -13,7 +14,10 @@ async function release(context, options) {
|
|
|
13
14
|
logger_1.logger.debug(JSON.stringify(context.hosting.deploys, null, 2));
|
|
14
15
|
await Promise.all(context.hosting.deploys.map(async (deploy) => {
|
|
15
16
|
utils.logLabeledBullet(`hosting[${deploy.site}]`, "finalizing version...");
|
|
16
|
-
const
|
|
17
|
+
const config = await (0, convertConfig_1.convertConfig)(context, payload, deploy.config, true);
|
|
18
|
+
const data = { status: "FINALIZED", config };
|
|
19
|
+
const queryParams = { updateMask: "status,config" };
|
|
20
|
+
const finalizeResult = await client_1.client.patch(`/${deploy.version}`, data, { queryParams });
|
|
17
21
|
logger_1.logger.debug(`[hosting] finalized version for ${deploy.site}:${finalizeResult.body}`);
|
|
18
22
|
utils.logLabeledSuccess(`hosting[${deploy.site}]`, "version finalized");
|
|
19
23
|
utils.logLabeledBullet(`hosting[${deploy.site}]`, "releasing new version...");
|
package/lib/deploy/index.js
CHANGED
|
@@ -1,103 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deploy = void 0;
|
|
4
|
+
const logger_1 = require("../logger");
|
|
5
|
+
const api_1 = require("../api");
|
|
6
|
+
const cli_color_1 = require("cli-color");
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
8
|
+
const projectUtils_1 = require("../projectUtils");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const error_1 = require("../error");
|
|
11
|
+
const track_1 = require("../track");
|
|
12
|
+
const lifecycleHooks = require("./lifecycleHooks");
|
|
13
|
+
const previews_1 = require("../previews");
|
|
14
|
+
const HostingTarget = require("./hosting");
|
|
15
|
+
const DatabaseTarget = require("./database");
|
|
16
|
+
const FirestoreTarget = require("./firestore");
|
|
17
|
+
const FunctionsTarget = require("./functions");
|
|
18
|
+
const StorageTarget = require("./storage");
|
|
19
|
+
const RemoteConfigTarget = require("./remoteconfig");
|
|
20
|
+
const ExtensionsTarget = require("./extensions");
|
|
21
|
+
const TARGETS = {
|
|
22
|
+
hosting: HostingTarget,
|
|
23
|
+
database: DatabaseTarget,
|
|
24
|
+
firestore: FirestoreTarget,
|
|
25
|
+
functions: FunctionsTarget,
|
|
26
|
+
storage: StorageTarget,
|
|
27
|
+
remoteconfig: RemoteConfigTarget,
|
|
28
|
+
extensions: ExtensionsTarget,
|
|
19
29
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _chain = function (fns, context, options, payload) {
|
|
24
|
-
var latest = (fns.shift() || _noop)(context, options, payload);
|
|
25
|
-
if (fns.length) {
|
|
26
|
-
return latest.then(function () {
|
|
27
|
-
return _chain(fns, context, options, payload);
|
|
28
|
-
});
|
|
30
|
+
const chain = async function (fns, context, options, payload) {
|
|
31
|
+
for (const latest of fns) {
|
|
32
|
+
await latest(context, options, payload);
|
|
29
33
|
}
|
|
30
|
-
return latest;
|
|
31
34
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
const deploy = async function (targetNames, options, customContext = {}) {
|
|
36
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
37
|
+
const payload = {};
|
|
38
|
+
const context = Object.assign({ projectId }, customContext);
|
|
39
|
+
const predeploys = [];
|
|
40
|
+
const prepares = [];
|
|
41
|
+
const deploys = [];
|
|
42
|
+
const releases = [];
|
|
43
|
+
const postdeploys = [];
|
|
44
|
+
const startTime = Date.now();
|
|
45
|
+
if (previews_1.previews.frameworkawareness && targetNames.includes("hosting")) {
|
|
46
|
+
const config = options.config.get("hosting");
|
|
47
|
+
if (Array.isArray(config) ? config.some((it) => it.source) : config.source) {
|
|
48
|
+
await require("firebase-frameworks").prepare(targetNames, context, options);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
for (const targetName of targetNames) {
|
|
52
|
+
const target = TARGETS[targetName];
|
|
45
53
|
if (!target) {
|
|
46
|
-
return Promise.reject(new FirebaseError(
|
|
54
|
+
return Promise.reject(new error_1.FirebaseError((0, cli_color_1.bold)(targetName) + " is not a valid deploy target", { exit: 1 }));
|
|
47
55
|
}
|
|
48
56
|
predeploys.push(lifecycleHooks(targetName, "predeploy"));
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (target.deploy) {
|
|
53
|
-
deploys.push(target.deploy);
|
|
54
|
-
}
|
|
55
|
-
if (target.release) {
|
|
56
|
-
releases.push(target.release);
|
|
57
|
-
}
|
|
57
|
+
prepares.push(target.prepare);
|
|
58
|
+
deploys.push(target.deploy);
|
|
59
|
+
releases.push(target.release);
|
|
58
60
|
postdeploys.push(lifecycleHooks(targetName, "postdeploy"));
|
|
59
61
|
}
|
|
60
|
-
logger.info();
|
|
61
|
-
logger.info(
|
|
62
|
-
logger.info();
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
utils.logSuccess(clc.underline.bold("Deploy complete!"));
|
|
90
|
-
logger.info();
|
|
91
|
-
var deployedHosting = _.includes(targetNames, "hosting");
|
|
92
|
-
logger.info(clc.bold("Project Console:"), utils.consoleUrl(options.project, "/overview"));
|
|
93
|
-
if (deployedHosting) {
|
|
94
|
-
_.each(context.hosting.deploys, function (deploy) {
|
|
95
|
-
logger.info(clc.bold("Hosting URL:"), utils.addSubdomain(api.hostingOrigin, deploy.site));
|
|
96
|
-
});
|
|
97
|
-
const versionNames = context.hosting.deploys.map((deploy) => deploy.version);
|
|
98
|
-
return { hosting: versionNames.length === 1 ? versionNames[0] : versionNames };
|
|
99
|
-
}
|
|
100
|
-
});
|
|
62
|
+
logger_1.logger.info();
|
|
63
|
+
logger_1.logger.info((0, cli_color_1.bold)((0, cli_color_1.white)("===") + " Deploying to '" + projectId + "'..."));
|
|
64
|
+
logger_1.logger.info();
|
|
65
|
+
(0, utils_1.logBullet)("deploying " + (0, cli_color_1.bold)(targetNames.join(", ")));
|
|
66
|
+
await chain(predeploys, context, options, payload);
|
|
67
|
+
await chain(prepares, context, options, payload);
|
|
68
|
+
await chain(deploys, context, options, payload);
|
|
69
|
+
await chain(releases, context, options, payload);
|
|
70
|
+
await chain(postdeploys, context, options, payload);
|
|
71
|
+
if ((0, lodash_1.has)(options, "config.notes.databaseRules")) {
|
|
72
|
+
await (0, track_1.track)("Rules Deploy", options.config.notes.databaseRules);
|
|
73
|
+
}
|
|
74
|
+
const duration = Date.now() - startTime;
|
|
75
|
+
await (0, track_1.track)("Product Deploy", [...targetNames].sort().join(","), duration);
|
|
76
|
+
logger_1.logger.info();
|
|
77
|
+
(0, utils_1.logSuccess)(cli_color_1.bold.underline("Deploy complete!"));
|
|
78
|
+
logger_1.logger.info();
|
|
79
|
+
const deployedHosting = (0, lodash_1.includes)(targetNames, "hosting");
|
|
80
|
+
logger_1.logger.info((0, cli_color_1.bold)("Project Console:"), (0, utils_1.consoleUrl)(options.project, "/overview"));
|
|
81
|
+
if (deployedHosting) {
|
|
82
|
+
(0, lodash_1.each)(context.hosting.deploys, (deploy) => {
|
|
83
|
+
logger_1.logger.info((0, cli_color_1.bold)("Hosting URL:"), (0, utils_1.addSubdomain)(api_1.hostingOrigin, deploy.site));
|
|
84
|
+
});
|
|
85
|
+
const versionNames = context.hosting.deploys.map((deploy) => deploy.version);
|
|
86
|
+
return { hosting: versionNames.length === 1 ? versionNames[0] : versionNames };
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
return { hosting: undefined };
|
|
90
|
+
}
|
|
101
91
|
};
|
|
102
|
-
deploy
|
|
103
|
-
module.exports = deploy;
|
|
92
|
+
exports.deploy = deploy;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.release = exports.prepare = void 0;
|
|
3
|
+
exports.deploy = exports.release = exports.prepare = void 0;
|
|
4
4
|
const prepare_1 = require("./prepare");
|
|
5
5
|
exports.prepare = prepare_1.default;
|
|
6
6
|
const release_1 = require("./release");
|
|
7
7
|
exports.release = release_1.default;
|
|
8
|
+
const deploy_1 = require("./deploy");
|
|
9
|
+
exports.deploy = deploy_1.default;
|
|
@@ -39,6 +39,7 @@ exports.authOperations = {
|
|
|
39
39
|
projects: {
|
|
40
40
|
createSessionCookie,
|
|
41
41
|
queryAccounts,
|
|
42
|
+
getConfig,
|
|
42
43
|
updateConfig,
|
|
43
44
|
accounts: {
|
|
44
45
|
_: signUp,
|
|
@@ -1380,6 +1381,10 @@ function mfaSignInFinalize(state, reqBody) {
|
|
|
1380
1381
|
refreshToken,
|
|
1381
1382
|
};
|
|
1382
1383
|
}
|
|
1384
|
+
function getConfig(state, reqBody, ctx) {
|
|
1385
|
+
(0, errors_1.assert)(state instanceof state_1.AgentProjectState, "((Can only get top-level configurations on agent projects.))");
|
|
1386
|
+
return state.config;
|
|
1387
|
+
}
|
|
1383
1388
|
function updateConfig(state, reqBody, ctx) {
|
|
1384
1389
|
var _a;
|
|
1385
1390
|
(0, errors_1.assert)(state instanceof state_1.AgentProjectState, "((Can only update top-level configurations on agent projects.))");
|
|
@@ -64,34 +64,12 @@ function logError(err) {
|
|
|
64
64
|
}
|
|
65
65
|
exports.logError = logError;
|
|
66
66
|
function authEmulatorUrl(req) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (info) {
|
|
70
|
-
if (info.host === "0.0.0.0") {
|
|
71
|
-
url.hostname = "127.0.0.1";
|
|
72
|
-
}
|
|
73
|
-
else if (info.host === "::") {
|
|
74
|
-
url.hostname = "[::1]";
|
|
75
|
-
}
|
|
76
|
-
else if (info.host.includes(":")) {
|
|
77
|
-
url.hostname = `[${info.host}]`;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
url.hostname = info.host;
|
|
81
|
-
}
|
|
82
|
-
url.port = info.port.toString();
|
|
67
|
+
if (registry_1.EmulatorRegistry.getInfo(types_1.Emulators.AUTH)) {
|
|
68
|
+
return registry_1.EmulatorRegistry.url(types_1.Emulators.AUTH);
|
|
83
69
|
}
|
|
84
70
|
else {
|
|
85
|
-
|
|
86
|
-
url.protocol = req.protocol;
|
|
87
|
-
if (host) {
|
|
88
|
-
url.host = host;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
console.warn("Cannot determine host and port of auth emulator server.");
|
|
92
|
-
}
|
|
71
|
+
return registry_1.EmulatorRegistry.url(types_1.Emulators.AUTH, req);
|
|
93
72
|
}
|
|
94
|
-
return url;
|
|
95
73
|
}
|
|
96
74
|
exports.authEmulatorUrl = authEmulatorUrl;
|
|
97
75
|
function mirrorFieldTo(dest, field, source) {
|
|
@@ -6,7 +6,7 @@ const clc = require("cli-color");
|
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const path = require("path");
|
|
8
8
|
const logger_1 = require("../logger");
|
|
9
|
-
const
|
|
9
|
+
const track_1 = require("../track");
|
|
10
10
|
const utils = require("../utils");
|
|
11
11
|
const registry_1 = require("./registry");
|
|
12
12
|
const types_1 = require("./types");
|
|
@@ -95,7 +95,7 @@ async function getAndCheckAddress(emulator, options) {
|
|
|
95
95
|
}
|
|
96
96
|
async function startEmulator(instance) {
|
|
97
97
|
const name = instance.getName();
|
|
98
|
-
void track("Emulator Run", name);
|
|
98
|
+
void (0, track_1.track)("Emulator Run", name);
|
|
99
99
|
await registry_1.EmulatorRegistry.start(instance);
|
|
100
100
|
}
|
|
101
101
|
exports.startEmulator = startEmulator;
|
|
@@ -248,7 +248,7 @@ async function startAll(options, showUI = true) {
|
|
|
248
248
|
if (shouldStart(options, types_1.Emulators.HUB)) {
|
|
249
249
|
const hubAddr = await getAndCheckAddress(types_1.Emulators.HUB, options);
|
|
250
250
|
const hub = new hub_1.EmulatorHub(Object.assign({ projectId }, hubAddr));
|
|
251
|
-
void track("emulators:start", "hub");
|
|
251
|
+
void (0, track_1.track)("emulators:start", "hub");
|
|
252
252
|
await startEmulator(hub);
|
|
253
253
|
}
|
|
254
254
|
let exportMetadata = {
|
|
@@ -268,16 +268,19 @@ async function startAll(options, showUI = true) {
|
|
|
268
268
|
const emulatableBackends = [];
|
|
269
269
|
const projectDir = (options.extDevDir || options.config.projectDir);
|
|
270
270
|
if (shouldStart(options, types_1.Emulators.FUNCTIONS)) {
|
|
271
|
-
const functionsCfg = (0, projectConfig_1.normalizeAndValidate)(options.config.src.functions)
|
|
271
|
+
const functionsCfg = (0, projectConfig_1.normalizeAndValidate)(options.config.src.functions);
|
|
272
272
|
utils.assertIsStringOrUndefined(options.extDevDir);
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
273
|
+
for (const cfg of functionsCfg) {
|
|
274
|
+
const functionsDir = path.join(projectDir, cfg.source);
|
|
275
|
+
emulatableBackends.push({
|
|
276
|
+
functionsDir,
|
|
277
|
+
codebase: cfg.codebase,
|
|
278
|
+
env: Object.assign({}, options.extDevEnv),
|
|
279
|
+
secretEnv: [],
|
|
280
|
+
predefinedTriggers: options.extDevTriggers,
|
|
281
|
+
nodeMajorVersion: (0, functionsEmulatorUtils_1.parseRuntimeVersion)(options.extDevNodeVersion || cfg.runtime),
|
|
282
|
+
});
|
|
283
|
+
}
|
|
281
284
|
}
|
|
282
285
|
if (shouldStart(options, types_1.Emulators.EXTENSIONS) && previews_1.previews.extensionsemulator) {
|
|
283
286
|
const projectNumber = constants_1.Constants.isDemoProject(projectId)
|
|
@@ -294,8 +297,8 @@ async function startAll(options, showUI = true) {
|
|
|
294
297
|
const extensionsBackends = await extensionEmulator.getExtensionBackends();
|
|
295
298
|
const filteredExtensionsBackends = extensionEmulator.filterUnemulatedTriggers(options, extensionsBackends);
|
|
296
299
|
emulatableBackends.push(...filteredExtensionsBackends);
|
|
297
|
-
void track("Emulator Run", types_1.Emulators.EXTENSIONS);
|
|
298
|
-
|
|
300
|
+
void (0, track_1.track)("Emulator Run", types_1.Emulators.EXTENSIONS);
|
|
301
|
+
await startEmulator(extensionEmulator);
|
|
299
302
|
}
|
|
300
303
|
if (emulatableBackends.length) {
|
|
301
304
|
const functionsLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.FUNCTIONS);
|
|
@@ -29,13 +29,13 @@ exports.DownloadDetails = {
|
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
firestore: {
|
|
32
|
-
downloadPath: path.join(CACHE_DIR, "cloud-firestore-emulator-v1.14.
|
|
33
|
-
version: "1.14.
|
|
32
|
+
downloadPath: path.join(CACHE_DIR, "cloud-firestore-emulator-v1.14.3.jar"),
|
|
33
|
+
version: "1.14.3",
|
|
34
34
|
opts: {
|
|
35
35
|
cacheDir: CACHE_DIR,
|
|
36
|
-
remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.14.
|
|
37
|
-
expectedSize:
|
|
38
|
-
expectedChecksum: "
|
|
36
|
+
remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/cloud-firestore-emulator-v1.14.3.jar",
|
|
37
|
+
expectedSize: 60442855,
|
|
38
|
+
expectedChecksum: "63517534875818689639ee5dee57dd52",
|
|
39
39
|
namePrefix: "cloud-firestore-emulator",
|
|
40
40
|
},
|
|
41
41
|
},
|
|
@@ -50,15 +50,15 @@ exports.DownloadDetails = {
|
|
|
50
50
|
namePrefix: "cloud-storage-rules-emulator",
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
|
-
ui: previews_1.previews.
|
|
53
|
+
ui: previews_1.previews.extensionsemulator
|
|
54
54
|
? {
|
|
55
|
-
version: "
|
|
56
|
-
downloadPath: path.join(CACHE_DIR, "ui-
|
|
57
|
-
unzipDir: path.join(CACHE_DIR, "ui-
|
|
58
|
-
binaryPath: path.join(CACHE_DIR, "ui-
|
|
55
|
+
version: "EXTENSIONS",
|
|
56
|
+
downloadPath: path.join(CACHE_DIR, "ui-vEXTENSIONS.zip"),
|
|
57
|
+
unzipDir: path.join(CACHE_DIR, "ui-vEXTENSIONS"),
|
|
58
|
+
binaryPath: path.join(CACHE_DIR, "ui-vEXTENSIONS", "server.bundle.js"),
|
|
59
59
|
opts: {
|
|
60
60
|
cacheDir: CACHE_DIR,
|
|
61
|
-
remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/ui-
|
|
61
|
+
remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/ui-vEXTENSIONS.zip",
|
|
62
62
|
expectedSize: -1,
|
|
63
63
|
expectedChecksum: "",
|
|
64
64
|
skipCache: true,
|
|
@@ -66,19 +66,35 @@ exports.DownloadDetails = {
|
|
|
66
66
|
namePrefix: "ui",
|
|
67
67
|
},
|
|
68
68
|
}
|
|
69
|
-
:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
: previews_1.previews.emulatoruisnapshot
|
|
70
|
+
? {
|
|
71
|
+
version: "SNAPSHOT",
|
|
72
|
+
downloadPath: path.join(CACHE_DIR, "ui-vSNAPSHOT.zip"),
|
|
73
|
+
unzipDir: path.join(CACHE_DIR, "ui-vSNAPSHOT"),
|
|
74
|
+
binaryPath: path.join(CACHE_DIR, "ui-vSNAPSHOT", "server.bundle.js"),
|
|
75
|
+
opts: {
|
|
76
|
+
cacheDir: CACHE_DIR,
|
|
77
|
+
remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/ui-vSNAPSHOT.zip",
|
|
78
|
+
expectedSize: -1,
|
|
79
|
+
expectedChecksum: "",
|
|
80
|
+
skipCache: true,
|
|
81
|
+
skipChecksumAndSize: true,
|
|
82
|
+
namePrefix: "ui",
|
|
83
|
+
},
|
|
84
|
+
}
|
|
85
|
+
: {
|
|
86
|
+
version: "1.6.5",
|
|
87
|
+
downloadPath: path.join(CACHE_DIR, "ui-v1.6.5.zip"),
|
|
88
|
+
unzipDir: path.join(CACHE_DIR, "ui-v1.6.5"),
|
|
89
|
+
binaryPath: path.join(CACHE_DIR, "ui-v1.6.5", "server.bundle.js"),
|
|
90
|
+
opts: {
|
|
91
|
+
cacheDir: CACHE_DIR,
|
|
92
|
+
remoteUrl: "https://storage.googleapis.com/firebase-preview-drop/emulator/ui-v1.6.5.zip",
|
|
93
|
+
expectedSize: 3816994,
|
|
94
|
+
expectedChecksum: "92dfff4b2ef8ab616e8a60cc93e0a00b",
|
|
95
|
+
namePrefix: "ui",
|
|
96
|
+
},
|
|
80
97
|
},
|
|
81
|
-
},
|
|
82
98
|
pubsub: {
|
|
83
99
|
downloadPath: path.join(CACHE_DIR, "pubsub-emulator-0.1.0.zip"),
|
|
84
100
|
version: "0.1.0",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.replaceConsoleLinks = void 0;
|
|
4
|
+
const registry_1 = require("../registry");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
function replaceConsoleLinks(postinstall) {
|
|
7
|
+
const uiInfo = registry_1.EmulatorRegistry.getInfo(types_1.Emulators.UI);
|
|
8
|
+
const uiUrl = uiInfo ? `http://${registry_1.EmulatorRegistry.getInfoHostString(uiInfo)}` : "unknown";
|
|
9
|
+
let subbedPostinstall = postinstall;
|
|
10
|
+
const linkReplacements = new Map([
|
|
11
|
+
[
|
|
12
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/storage[A-Za-z0-9\/-]*(?=[\)\]\s])/,
|
|
13
|
+
`${uiUrl}/${types_1.Emulators.STORAGE}`,
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/firestore[A-Za-z0-9\/-]*(?=[\)\]\s])/,
|
|
17
|
+
`${uiUrl}/${types_1.Emulators.FIRESTORE}`,
|
|
18
|
+
],
|
|
19
|
+
[
|
|
20
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/database[A-Za-z0-9\/-]*(?=[\)\]\s])/,
|
|
21
|
+
`${uiUrl}/${types_1.Emulators.DATABASE}`,
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/authentication[A-Za-z0-9\/-]*(?=[\)\]\s])/,
|
|
25
|
+
`${uiUrl}/${types_1.Emulators.AUTH}`,
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/functions[A-Za-z0-9\/-]*(?=[\)\]\s])/,
|
|
29
|
+
`${uiUrl}/logs`,
|
|
30
|
+
],
|
|
31
|
+
[
|
|
32
|
+
/(http[s]?:\/\/)?console\.firebase\.google\.com\/(u\/[0-9]\/)?project\/[A-Za-z0-9-]+\/extensions[A-Za-z0-9\/-]*(?=[\)\]\s])/,
|
|
33
|
+
`${uiUrl}/${types_1.Emulators.EXTENSIONS}`,
|
|
34
|
+
],
|
|
35
|
+
]);
|
|
36
|
+
for (const [consoleLinkRegex, replacement] of linkReplacements) {
|
|
37
|
+
subbedPostinstall = subbedPostinstall.replace(consoleLinkRegex, replacement);
|
|
38
|
+
}
|
|
39
|
+
return subbedPostinstall;
|
|
40
|
+
}
|
|
41
|
+
exports.replaceConsoleLinks = replaceConsoleLinks;
|
|
@@ -17,8 +17,8 @@ async function getUnemulatedAPIs(projectId, instances) {
|
|
|
17
17
|
var _a;
|
|
18
18
|
const unemulatedAPIs = {};
|
|
19
19
|
for (const i of instances) {
|
|
20
|
-
const
|
|
21
|
-
for (const api of (_a =
|
|
20
|
+
const extensionSpec = await planner.getExtensionSpec(i);
|
|
21
|
+
for (const api of (_a = extensionSpec.apis) !== null && _a !== void 0 ? _a : []) {
|
|
22
22
|
if (!EMULATED_APIS.includes(api.apiName)) {
|
|
23
23
|
if (unemulatedAPIs[api.apiName]) {
|
|
24
24
|
unemulatedAPIs[api.apiName].instanceIds.push(i.instanceId);
|