firebase-tools 11.1.0 → 11.2.2
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/accountExporter.js +11 -4
- package/lib/accountImporter.js +5 -6
- package/lib/appdistribution/client.js +7 -9
- package/lib/auth.js +3 -5
- package/lib/checkValidTargetFilters.js +28 -18
- package/lib/commands/database-profile.js +2 -3
- package/lib/commands/database-push.js +2 -3
- package/lib/commands/database-remove.js +1 -2
- package/lib/commands/database-set.js +1 -2
- package/lib/commands/deploy.js +5 -6
- package/lib/commands/ext-dev-emulators-exec.js +1 -1
- package/lib/commands/ext-dev-emulators-start.js +1 -1
- package/lib/commands/ext-dev-list.js +6 -7
- package/lib/commands/ext-export.js +2 -0
- package/lib/commands/ext-info.js +12 -13
- package/lib/commands/ext.js +2 -3
- package/lib/commands/functions-delete.js +1 -7
- package/lib/commands/open.js +5 -6
- package/lib/commands/serve.js +3 -5
- package/lib/commands/use.js +2 -3
- package/lib/config.js +4 -3
- package/lib/deploy/database/prepare.js +2 -3
- package/lib/deploy/extensions/planner.js +1 -0
- package/lib/deploy/extensions/prepare.js +18 -1
- package/lib/deploy/extensions/release.js +4 -0
- package/lib/deploy/extensions/secrets.js +3 -3
- package/lib/deploy/functions/build.js +35 -53
- package/lib/deploy/functions/ensure.js +1 -11
- package/lib/deploy/functions/params.js +189 -0
- package/lib/deploy/functions/prepare.js +3 -13
- package/lib/deploy/functions/prepareFunctionsUpload.js +2 -3
- package/lib/deploy/functions/release/fabricator.js +0 -1
- package/lib/deploy/functions/release/index.js +1 -5
- package/lib/deploy/functions/runtimes/discovery/index.js +18 -3
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +3 -2
- package/lib/deploy/functions/runtimes/golang/index.js +2 -22
- package/lib/deploy/functions/runtimes/node/index.js +3 -7
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +2 -2
- package/lib/deploy/lifecycleHooks.js +8 -11
- package/lib/deploy/storage/prepare.js +2 -2
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +336 -64
- package/lib/emulator/auth/server.js +2 -2
- package/lib/emulator/auth/state.js +32 -7
- package/lib/emulator/commandUtils.js +1 -1
- package/lib/emulator/constants.js +1 -1
- package/lib/emulator/controller.js +6 -5
- package/lib/emulator/databaseEmulator.js +2 -2
- package/lib/emulator/download.js +1 -1
- package/lib/emulator/downloadableEmulators.js +6 -6
- package/lib/emulator/events/types.js +2 -3
- package/lib/emulator/firestoreEmulator.js +2 -2
- package/lib/emulator/functionsEmulator.js +36 -45
- package/lib/emulator/functionsEmulatorRuntime.js +12 -16
- package/lib/emulator/functionsEmulatorShared.js +7 -5
- package/lib/emulator/functionsRuntimeWorker.js +0 -6
- package/lib/emulator/hostingEmulator.js +1 -1
- package/lib/emulator/hub.js +1 -1
- package/lib/emulator/loggingEmulator.js +1 -1
- package/lib/emulator/pubsubEmulator.js +1 -1
- package/lib/emulator/storage/crc.js +4 -4
- package/lib/emulator/storage/index.js +1 -1
- package/lib/emulator/types.js +1 -1
- package/lib/extensions/askUserForConsent.js +1 -2
- package/lib/extensions/askUserForParam.js +15 -18
- package/lib/extensions/emulator/optionsHelper.js +4 -4
- package/lib/extensions/etags.js +28 -0
- package/lib/extensions/extensionsApi.js +1 -22
- package/lib/extensions/extensionsHelper.js +6 -6
- package/lib/extensions/listExtensions.js +9 -10
- package/lib/extensions/manifest.js +2 -2
- package/lib/extensions/resolveSource.js +11 -7
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/types.js +24 -0
- package/lib/extensions/updateHelper.js +1 -1
- package/lib/extensions/utils.js +1 -2
- package/lib/extensions/warnings.js +10 -4
- package/lib/firestore/encodeFirestoreValue.js +11 -8
- package/lib/fsAsync.js +3 -3
- package/lib/functions/env.js +5 -1
- package/lib/functionsConfig.js +18 -15
- package/lib/functionsConfigClone.js +10 -12
- package/lib/gcp/cloudfunctions.js +2 -15
- package/lib/gcp/rules.js +3 -4
- package/lib/gcp/runtimeconfig.js +2 -2
- package/lib/hosting/api.js +9 -11
- package/lib/hosting/expireUtils.js +2 -2
- package/lib/hosting/proxy.js +1 -1
- package/lib/init/features/hosting/github.js +1 -1
- package/lib/init/features/hosting/index.js +2 -2
- package/lib/localFunction.js +4 -4
- package/lib/management/projects.js +6 -7
- package/lib/previews.js +1 -1
- package/lib/profileReport.js +24 -22
- package/lib/prompt.js +1 -2
- package/lib/rc.js +12 -2
- package/lib/rulesDeploy.js +2 -2
- package/lib/serve/index.js +4 -5
- package/lib/utils.js +30 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +10 -9
|
@@ -200,7 +200,8 @@ function assertManifestEndpoint(ep, id) {
|
|
|
200
200
|
function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
201
201
|
let triggered;
|
|
202
202
|
if (backend.isEventTriggered(ep)) {
|
|
203
|
-
const
|
|
203
|
+
const newTrigger = __rest(ep.eventTrigger, []);
|
|
204
|
+
delete newTrigger.serviceAccountEmail;
|
|
204
205
|
triggered = { eventTrigger: newTrigger };
|
|
205
206
|
triggered.eventTrigger.serviceAccount = ep.eventTrigger.serviceAccountEmail;
|
|
206
207
|
(0, proto_1.renameIfPresent)(triggered.eventTrigger, ep.eventTrigger, "channel", "channel", (c) => resolveChannelName(project, c, defaultRegion));
|
|
@@ -264,7 +265,7 @@ function parseEndpointForBuild(id, ep, project, defaultRegion, runtime) {
|
|
|
264
265
|
"firebase-tools with npm install -g firebase-tools@latest");
|
|
265
266
|
}
|
|
266
267
|
const parsed = Object.assign({ platform: ep.platform || "gcfv2", region: ep.region || [defaultRegion], project,
|
|
267
|
-
runtime, entryPoint: ep.entryPoint, serviceAccount: ep.serviceAccountEmail ||
|
|
268
|
+
runtime, entryPoint: ep.entryPoint, serviceAccount: ep.serviceAccountEmail || null }, triggered);
|
|
268
269
|
(0, proto_1.copyIfPresent)(parsed, ep, "availableMemoryMb", "maxInstances", "minInstances", "concurrency", "timeoutSeconds", "vpc", "labels", "ingressSettings", "environmentVariables");
|
|
269
270
|
(0, proto_1.renameIfPresent)(parsed, ep, "secretEnvironmentVariables", "secretEnvironmentVariables", (senvs) => {
|
|
270
271
|
const secretEnvironmentVariables = [];
|
|
@@ -5,11 +5,9 @@ const util_1 = require("util");
|
|
|
5
5
|
const node_fetch_1 = require("node-fetch");
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const path = require("path");
|
|
8
|
-
const portfinder = require("portfinder");
|
|
9
8
|
const spawn = require("cross-spawn");
|
|
10
9
|
const error_1 = require("../../../../error");
|
|
11
10
|
const logger_1 = require("../../../../logger");
|
|
12
|
-
const discovery = require("../discovery");
|
|
13
11
|
const gomod = require("./gomod");
|
|
14
12
|
const VERSION_TO_RUNTIME = {
|
|
15
13
|
"1.13": "go113",
|
|
@@ -105,26 +103,8 @@ class Delegate {
|
|
|
105
103
|
return p;
|
|
106
104
|
});
|
|
107
105
|
}
|
|
108
|
-
async discoverBuild(
|
|
109
|
-
return { requiredAPIs: [], endpoints: {}, params: [] };
|
|
110
|
-
}
|
|
111
|
-
async discoverSpec(configValues, envs) {
|
|
112
|
-
let discovered = await discovery.detectFromYaml(this.sourceDir, this.projectId, this.runtime);
|
|
113
|
-
if (!discovered) {
|
|
114
|
-
const getPort = (0, util_1.promisify)(portfinder.getPort);
|
|
115
|
-
const port = await getPort();
|
|
116
|
-
portfinder.basePort = port + 1;
|
|
117
|
-
const adminPort = await getPort();
|
|
118
|
-
const kill = await this.serve(port, adminPort, envs);
|
|
119
|
-
try {
|
|
120
|
-
discovered = await discovery.detectFromPort(adminPort, this.projectId, this.runtime);
|
|
121
|
-
}
|
|
122
|
-
finally {
|
|
123
|
-
await kill();
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
discovered.environmentVariables = envs;
|
|
127
|
-
return discovered;
|
|
106
|
+
async discoverBuild() {
|
|
107
|
+
return Promise.resolve({ requiredAPIs: [], endpoints: {}, params: [] });
|
|
128
108
|
}
|
|
129
109
|
}
|
|
130
110
|
exports.Delegate = Delegate;
|
|
@@ -85,15 +85,15 @@ class Delegate {
|
|
|
85
85
|
return p;
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
|
-
async
|
|
88
|
+
async discoverBuild(config, env) {
|
|
89
89
|
if (!semver.valid(this.sdkVersion)) {
|
|
90
90
|
logger_1.logger.debug(`Could not parse firebase-functions version '${this.sdkVersion}' into semver. Falling back to parseTriggers.`);
|
|
91
|
-
return parseTriggers.
|
|
91
|
+
return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env);
|
|
92
92
|
}
|
|
93
93
|
if (semver.lt(this.sdkVersion, MIN_FUNCTIONS_SDK_VERSION)) {
|
|
94
94
|
(0, utils_1.logLabeledWarning)("functions", `You are using an old version of firebase-functions SDK (${this.sdkVersion}). ` +
|
|
95
95
|
`Please update firebase-functions SDK to >=${MIN_FUNCTIONS_SDK_VERSION}`);
|
|
96
|
-
return parseTriggers.
|
|
96
|
+
return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env);
|
|
97
97
|
}
|
|
98
98
|
let discovered = await discovery.detectFromYaml(this.sourceDir, this.projectId, this.runtime);
|
|
99
99
|
if (!discovered) {
|
|
@@ -107,11 +107,7 @@ class Delegate {
|
|
|
107
107
|
await kill();
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
discovered.environmentVariables = env;
|
|
111
110
|
return discovered;
|
|
112
111
|
}
|
|
113
|
-
async discoverBuild(config, env) {
|
|
114
|
-
return parseTriggers.discoverBuild(this.projectId, this.sourceDir, this.runtime, config, env);
|
|
115
|
-
}
|
|
116
112
|
}
|
|
117
113
|
exports.Delegate = Delegate;
|
|
@@ -45,7 +45,7 @@ function parseTriggers(projectId, sourceDir, configValues, envs) {
|
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function useStrategy(
|
|
48
|
+
function useStrategy() {
|
|
49
49
|
return Promise.resolve(true);
|
|
50
50
|
}
|
|
51
51
|
exports.useStrategy = useStrategy;
|
|
@@ -179,7 +179,7 @@ function addResourcesToBuild(projectId, runtime, annotation, want) {
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
const endpointId = annotation.name;
|
|
182
|
-
const endpoint = Object.assign({ platform: annotation.platform || "gcfv1", region: regions, project: projectId, entryPoint: annotation.entryPoint, runtime: runtime, serviceAccount: annotation.serviceAccountEmail ||
|
|
182
|
+
const endpoint = Object.assign({ platform: annotation.platform || "gcfv1", region: regions, project: projectId, entryPoint: annotation.entryPoint, runtime: runtime, serviceAccount: annotation.serviceAccountEmail || null }, triggered);
|
|
183
183
|
if (annotation.vpcConnector != null) {
|
|
184
184
|
let maybeId = annotation.vpcConnector;
|
|
185
185
|
if (maybeId && !maybeId.includes("/")) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.lifecycleHooks = void 0;
|
|
4
|
-
const _ = require("lodash");
|
|
5
4
|
const utils = require("../utils");
|
|
6
5
|
const clc = require("cli-color");
|
|
7
6
|
const childProcess = require("child_process");
|
|
@@ -32,7 +31,7 @@ function runCommand(command, childOptions) {
|
|
|
32
31
|
reject(new Error("Command terminated with signal " + signal));
|
|
33
32
|
}
|
|
34
33
|
else if (code !== 0) {
|
|
35
|
-
reject(new Error("Command terminated with non-zero exit code" + code));
|
|
34
|
+
reject(new Error("Command terminated with non-zero exit code " + code));
|
|
36
35
|
}
|
|
37
36
|
else {
|
|
38
37
|
resolve();
|
|
@@ -54,7 +53,7 @@ function getChildEnvironment(target, overallOptions, config) {
|
|
|
54
53
|
default:
|
|
55
54
|
resourceDir = overallOptions.config.path(overallOptions.config.projectDir);
|
|
56
55
|
}
|
|
57
|
-
return
|
|
56
|
+
return Object.assign({}, process.env, {
|
|
58
57
|
GCLOUD_PROJECT: projectId,
|
|
59
58
|
PROJECT_DIR: projectDir,
|
|
60
59
|
RESOURCE_DIR: resourceDir,
|
|
@@ -74,10 +73,8 @@ function runTargetCommands(target, hook, overallOptions, config) {
|
|
|
74
73
|
shell: true,
|
|
75
74
|
stdio: [0, 1, 2],
|
|
76
75
|
};
|
|
77
|
-
const runAllCommands =
|
|
78
|
-
return soFar.then(() =>
|
|
79
|
-
return runCommand(command, childOptions);
|
|
80
|
-
});
|
|
76
|
+
const runAllCommands = commands.reduce((soFar, command) => {
|
|
77
|
+
return soFar.then(() => runCommand(command, childOptions));
|
|
81
78
|
}, Promise.resolve());
|
|
82
79
|
let logIdentifier = target;
|
|
83
80
|
if (config.target) {
|
|
@@ -96,14 +93,14 @@ function getReleventConfigs(target, options) {
|
|
|
96
93
|
if (!targetConfigs) {
|
|
97
94
|
return [];
|
|
98
95
|
}
|
|
99
|
-
if (!
|
|
96
|
+
if (!Array.isArray(targetConfigs)) {
|
|
100
97
|
targetConfigs = [targetConfigs];
|
|
101
98
|
}
|
|
102
99
|
if (!options.only) {
|
|
103
100
|
return targetConfigs;
|
|
104
101
|
}
|
|
105
102
|
let onlyTargets = options.only.split(",");
|
|
106
|
-
if (
|
|
103
|
+
if (onlyTargets.includes(target)) {
|
|
107
104
|
return targetConfigs;
|
|
108
105
|
}
|
|
109
106
|
onlyTargets = onlyTargets
|
|
@@ -114,12 +111,12 @@ function getReleventConfigs(target, options) {
|
|
|
114
111
|
return individualOnly.replace(`${target}:`, "");
|
|
115
112
|
});
|
|
116
113
|
return targetConfigs.filter((config) => {
|
|
117
|
-
return !config.target ||
|
|
114
|
+
return !config.target || onlyTargets.includes(config.target);
|
|
118
115
|
});
|
|
119
116
|
}
|
|
120
117
|
function lifecycleHooks(target, hook) {
|
|
121
118
|
return function (context, options) {
|
|
122
|
-
return
|
|
119
|
+
return getReleventConfigs(target, options).reduce((previousCommands, individualConfig) => {
|
|
123
120
|
return previousCommands.then(() => {
|
|
124
121
|
return runTargetCommands(target, hook, options, individualConfig);
|
|
125
122
|
});
|
|
@@ -11,9 +11,9 @@ async function default_1(context, options) {
|
|
|
11
11
|
_.set(context, "storage.rules", rulesConfig);
|
|
12
12
|
const rulesDeploy = new rulesDeploy_1.RulesDeploy(options, rulesDeploy_1.RulesetServiceType.FIREBASE_STORAGE);
|
|
13
13
|
_.set(context, "storage.rulesDeploy", rulesDeploy);
|
|
14
|
-
if (
|
|
14
|
+
if (typeof rulesConfig === "object" && rulesConfig !== null) {
|
|
15
15
|
const defaultBucket = await gcp.storage.getDefaultBucket(options.project);
|
|
16
|
-
rulesConfig = [
|
|
16
|
+
rulesConfig = [Object.assign(rulesConfig, { bucket: defaultBucket })];
|
|
17
17
|
_.set(context, "storage.rules", rulesConfig);
|
|
18
18
|
}
|
|
19
19
|
rulesConfig.forEach((ruleConfig) => {
|
|
@@ -26,7 +26,7 @@ class AuthEmulator {
|
|
|
26
26
|
return this.destroyServer ? this.destroyServer() : Promise.resolve();
|
|
27
27
|
}
|
|
28
28
|
getInfo() {
|
|
29
|
-
const host = this.args.host || constants_1.Constants.getDefaultHost(
|
|
29
|
+
const host = this.args.host || constants_1.Constants.getDefaultHost();
|
|
30
30
|
const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.AUTH);
|
|
31
31
|
return {
|
|
32
32
|
name: this.getName(),
|