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
package/lib/rc.js
CHANGED
|
@@ -25,7 +25,7 @@ exports.loadRC = loadRC;
|
|
|
25
25
|
class RC {
|
|
26
26
|
constructor(rcpath, data) {
|
|
27
27
|
this.path = rcpath;
|
|
28
|
-
this.data = Object.assign({ projects: {}, targets: {} }, data);
|
|
28
|
+
this.data = Object.assign({ projects: {}, targets: {}, etags: {} }, data);
|
|
29
29
|
}
|
|
30
30
|
static loadFile(rcpath) {
|
|
31
31
|
let data = {};
|
|
@@ -93,7 +93,7 @@ class RC {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
const existing = this.target(project, type, targetName);
|
|
96
|
-
const list =
|
|
96
|
+
const list = Array.from(new Set(existing.concat(resources))).sort();
|
|
97
97
|
this.set(["targets", project, type, targetName], list);
|
|
98
98
|
this.save();
|
|
99
99
|
return changed;
|
|
@@ -148,6 +148,16 @@ class RC {
|
|
|
148
148
|
}
|
|
149
149
|
return target;
|
|
150
150
|
}
|
|
151
|
+
getEtags(projectId) {
|
|
152
|
+
return this.data.etags[projectId] || { extensionInstances: {} };
|
|
153
|
+
}
|
|
154
|
+
setEtags(projectId, resourceType, etagData) {
|
|
155
|
+
if (!this.data.etags[projectId]) {
|
|
156
|
+
this.data.etags[projectId] = {};
|
|
157
|
+
}
|
|
158
|
+
this.data.etags[projectId][resourceType] = etagData;
|
|
159
|
+
this.save();
|
|
160
|
+
}
|
|
151
161
|
save() {
|
|
152
162
|
if (this.path) {
|
|
153
163
|
fs.writeFileSync(this.path, JSON.stringify(this.data, null, 2), {
|
package/lib/rulesDeploy.js
CHANGED
|
@@ -91,8 +91,8 @@ class RulesDeploy {
|
|
|
91
91
|
}, this.options);
|
|
92
92
|
if (confirm) {
|
|
93
93
|
const releases = await gcp.rules.listAllReleases(this.options.project);
|
|
94
|
-
const unreleased =
|
|
95
|
-
return
|
|
94
|
+
const unreleased = history.filter((ruleset) => {
|
|
95
|
+
return !releases.find((release) => release.rulesetName === ruleset.name);
|
|
96
96
|
});
|
|
97
97
|
const entriesToDelete = unreleased.reverse().slice(0, RULESETS_TO_GC);
|
|
98
98
|
for (const entry of entriesToDelete) {
|
package/lib/serve/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.serve = void 0;
|
|
4
|
-
const _ = require("lodash");
|
|
5
4
|
const logger_1 = require("../logger");
|
|
6
5
|
const frameworks_1 = require("../frameworks");
|
|
7
6
|
const previews_1 = require("../previews");
|
|
@@ -11,23 +10,23 @@ const TARGETS = {
|
|
|
11
10
|
functions: new FunctionsServer(),
|
|
12
11
|
};
|
|
13
12
|
async function serve(options) {
|
|
14
|
-
const targetNames = options.targets;
|
|
13
|
+
const targetNames = options.targets || [];
|
|
15
14
|
options.port = parseInt(options.port, 10);
|
|
16
15
|
if (previews_1.previews.frameworkawareness &&
|
|
17
16
|
targetNames.includes("hosting") &&
|
|
18
17
|
[].concat(options.config.get("hosting")).some((it) => it.source)) {
|
|
19
18
|
await (0, frameworks_1.prepareFrameworks)(targetNames, options, options);
|
|
20
19
|
}
|
|
21
|
-
await Promise.all(
|
|
20
|
+
await Promise.all(targetNames.map((targetName) => {
|
|
22
21
|
return TARGETS[targetName].start(options);
|
|
23
22
|
}));
|
|
24
|
-
await Promise.all(
|
|
23
|
+
await Promise.all(targetNames.map((targetName) => {
|
|
25
24
|
return TARGETS[targetName].connect();
|
|
26
25
|
}));
|
|
27
26
|
await new Promise((resolve) => {
|
|
28
27
|
process.on("SIGINT", () => {
|
|
29
28
|
logger_1.logger.info("Shutting down...");
|
|
30
|
-
|
|
29
|
+
Promise.all(targetNames.map((targetName) => {
|
|
31
30
|
return TARGETS[targetName].stop(options);
|
|
32
31
|
}))
|
|
33
32
|
.then(resolve)
|
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.assertDefined = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.isCloudEnvironment = exports.datetimeString = exports.createDestroyer = exports.promiseWithSpinner = exports.setupLoggers = exports.tryParse = exports.tryStringify = exports.promiseProps = exports.promiseWhile = exports.promiseAllSettled = exports.getFunctionsEventProvider = exports.endpoint = exports.makeActiveProject = exports.streamToString = exports.stringToStream = exports.explainStdin = exports.allSettled = exports.reject = exports.logLabeledError = exports.logLabeledWarning = exports.logWarning = exports.logLabeledBullet = exports.logBullet = exports.logLabeledSuccess = exports.logSuccess = exports.addSubdomain = exports.addDatabaseNamespace = exports.getDatabaseViewDataUrl = exports.getDatabaseUrl = exports.envOverride = exports.getInheritedOption = exports.consoleUrl = exports.envOverrides = void 0;
|
|
3
|
+
exports.randomInt = exports.debounce = exports.last = exports.cloneDeep = exports.groupBy = exports.assertIsStringOrUndefined = exports.assertIsNumber = exports.assertIsString = exports.assertDefined = exports.thirtyDaysFromNow = exports.isRunningInWSL = exports.isCloudEnvironment = exports.datetimeString = exports.createDestroyer = exports.promiseWithSpinner = exports.setupLoggers = exports.tryParse = exports.tryStringify = exports.promiseProps = exports.promiseWhile = exports.promiseAllSettled = exports.getFunctionsEventProvider = exports.endpoint = exports.makeActiveProject = exports.streamToString = exports.stringToStream = exports.explainStdin = exports.allSettled = exports.reject = exports.logLabeledError = exports.logLabeledWarning = exports.logWarning = exports.logLabeledBullet = exports.logBullet = exports.logLabeledSuccess = exports.logSuccess = exports.addSubdomain = exports.addDatabaseNamespace = exports.getDatabaseViewDataUrl = exports.getDatabaseUrl = exports.envOverride = exports.getInheritedOption = exports.consoleUrl = exports.envOverrides = void 0;
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const url = require("url");
|
|
6
6
|
const clc = require("cli-color");
|
|
@@ -28,7 +28,7 @@ exports.consoleUrl = consoleUrl;
|
|
|
28
28
|
function getInheritedOption(options, key) {
|
|
29
29
|
let target = options;
|
|
30
30
|
while (target) {
|
|
31
|
-
if (
|
|
31
|
+
if (target[key] !== undefined) {
|
|
32
32
|
return target[key];
|
|
33
33
|
}
|
|
34
34
|
target = target.parent;
|
|
@@ -184,13 +184,13 @@ function makeActiveProject(projectDir, newActive) {
|
|
|
184
184
|
}
|
|
185
185
|
exports.makeActiveProject = makeActiveProject;
|
|
186
186
|
function endpoint(parts) {
|
|
187
|
-
return `/${
|
|
187
|
+
return `/${parts.join("/")}`;
|
|
188
188
|
}
|
|
189
189
|
exports.endpoint = endpoint;
|
|
190
190
|
function getFunctionsEventProvider(eventType) {
|
|
191
191
|
const parts = eventType.split("/");
|
|
192
192
|
if (parts.length > 1) {
|
|
193
|
-
const provider =
|
|
193
|
+
const provider = last(parts[1].split("."));
|
|
194
194
|
return _.capitalize(provider);
|
|
195
195
|
}
|
|
196
196
|
if (eventType.match(/google.pubsub/)) {
|
|
@@ -218,7 +218,7 @@ function getFunctionsEventProvider(eventType) {
|
|
|
218
218
|
}
|
|
219
219
|
exports.getFunctionsEventProvider = getFunctionsEventProvider;
|
|
220
220
|
function promiseAllSettled(promises) {
|
|
221
|
-
const wrappedPromises =
|
|
221
|
+
const wrappedPromises = promises.map(async (p) => {
|
|
222
222
|
try {
|
|
223
223
|
const val = await Promise.resolve(p);
|
|
224
224
|
return { state: "fulfilled", value: val };
|
|
@@ -250,7 +250,7 @@ async function promiseWhile(action, check, interval = 2500) {
|
|
|
250
250
|
exports.promiseWhile = promiseWhile;
|
|
251
251
|
async function promiseProps(obj) {
|
|
252
252
|
const resultObj = {};
|
|
253
|
-
const promises =
|
|
253
|
+
const promises = Object.keys(obj).map(async (key) => {
|
|
254
254
|
const r = await Promise.resolve(obj[key]);
|
|
255
255
|
resultObj[key] = r;
|
|
256
256
|
});
|
|
@@ -435,3 +435,27 @@ function cloneDeep(obj) {
|
|
|
435
435
|
return cloneObject(obj);
|
|
436
436
|
}
|
|
437
437
|
exports.cloneDeep = cloneDeep;
|
|
438
|
+
function last(arr) {
|
|
439
|
+
if (!Array.isArray(arr)) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
return arr[arr.length - 1];
|
|
443
|
+
}
|
|
444
|
+
exports.last = last;
|
|
445
|
+
function debounce(fn, delay, { leading } = {}) {
|
|
446
|
+
let timer;
|
|
447
|
+
return (...args) => {
|
|
448
|
+
if (!timer && leading) {
|
|
449
|
+
fn(...args);
|
|
450
|
+
}
|
|
451
|
+
clearTimeout(timer);
|
|
452
|
+
timer = setTimeout(() => fn(...args), delay);
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
exports.debounce = debounce;
|
|
456
|
+
function randomInt(min, max) {
|
|
457
|
+
min = Math.floor(min);
|
|
458
|
+
max = Math.ceil(max) + 1;
|
|
459
|
+
return Math.floor(Math.random() * (max - min) + min);
|
|
460
|
+
}
|
|
461
|
+
exports.randomInt = randomInt;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.2",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "firebase-tools",
|
|
9
|
-
"version": "11.
|
|
9
|
+
"version": "11.2.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@google-cloud/pubsub": "^3.0.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "firebase-tools",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.2",
|
|
4
4
|
"description": "Command-Line Interface for Firebase",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -23,15 +23,16 @@
|
|
|
23
23
|
"mocha": "nyc mocha 'src/test/**/*.{ts,js}'",
|
|
24
24
|
"prepare": "npm run clean && npm run build -- --build tsconfig.publish.json",
|
|
25
25
|
"test": "npm run lint:quiet && npm run test:compile && npm run mocha",
|
|
26
|
-
"test:client-integration": "./scripts/client-integration-tests/run.sh",
|
|
26
|
+
"test:client-integration": "bash ./scripts/client-integration-tests/run.sh",
|
|
27
27
|
"test:compile": "tsc --project tsconfig.compile.json",
|
|
28
|
-
"test:emulator": "./scripts/emulator-tests/run.sh",
|
|
29
|
-
"test:
|
|
30
|
-
"test:extensions-
|
|
31
|
-
"test:
|
|
32
|
-
"test:
|
|
33
|
-
"test:
|
|
34
|
-
"test:storage-
|
|
28
|
+
"test:emulator": "bash ./scripts/emulator-tests/run.sh",
|
|
29
|
+
"test:import-export": "bash ./scripts/emulator-import-export-tests/run.sh",
|
|
30
|
+
"test:extensions-deploy": "bash ./scripts/extensions-deploy-tests/run.sh",
|
|
31
|
+
"test:extensions-emulator": "bash ./scripts/extensions-emulator-tests/run.sh",
|
|
32
|
+
"test:hosting": "bash ./scripts/hosting-tests/run.sh",
|
|
33
|
+
"test:triggers-end-to-end": "bash ./scripts/triggers-end-to-end-tests/run.sh",
|
|
34
|
+
"test:storage-deploy": "bash ./scripts/storage-deploy-tests/run.sh",
|
|
35
|
+
"test:storage-emulator-integration": "bash ./scripts/storage-emulator-integration/run.sh"
|
|
35
36
|
},
|
|
36
37
|
"files": [
|
|
37
38
|
"lib",
|