firebase-tools 9.23.3 → 10.1.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/api.js +1 -1
- 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 +4 -4
- package/lib/commands/database-set.js +4 -4
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +4 -4
- 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 +3 -3
- 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 +4 -4
- 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 +10 -11
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
- package/lib/deploy/functions/index.js +1 -0
- package/lib/deploy/functions/prepare.js +27 -21
- 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 +3 -3
- 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 +9 -13
- package/lib/deploy/functions/runtimes/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/index.js +6 -10
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/runtimes/node/validate.js +2 -1
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- package/lib/deploy/functions/validate.js +4 -3
- 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/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 +33 -18
- 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 +24889 -0
- package/package.json +24 -24
- package/templates/init/functions/javascript/package.lint.json +1 -1
- package/templates/init/functions/javascript/package.nolint.json +1 -1
- package/templates/init/functions/typescript/package.lint.json +1 -1
- package/templates/init/functions/typescript/package.nolint.json +1 -1
- package/templates/init/hosting/index.html +1 -1
- package/CHANGELOG.md +0 -1
|
@@ -11,7 +11,7 @@ async function requireDatabaseInstance(options) {
|
|
|
11
11
|
}
|
|
12
12
|
let instance;
|
|
13
13
|
try {
|
|
14
|
-
instance = await getDefaultDatabaseInstance_1.getDefaultDatabaseInstance(options);
|
|
14
|
+
instance = await (0, getDefaultDatabaseInstance_1.getDefaultDatabaseInstance)(options);
|
|
15
15
|
}
|
|
16
16
|
catch (err) {
|
|
17
17
|
throw new error_1.FirebaseError(`Failed to get details for project: ${options.project}.`, {
|
|
@@ -6,7 +6,7 @@ async function requireHostingSite(options) {
|
|
|
6
6
|
if (options.site) {
|
|
7
7
|
return Promise.resolve();
|
|
8
8
|
}
|
|
9
|
-
const site = await getDefaultHostingSite_1.getDefaultHostingSite(options);
|
|
9
|
+
const site = await (0, getDefaultHostingSite_1.getDefaultHostingSite)(options);
|
|
10
10
|
options.site = site;
|
|
11
11
|
}
|
|
12
12
|
exports.requireHostingSite = requireHostingSite;
|
|
@@ -9,14 +9,14 @@ const error_1 = require("./error");
|
|
|
9
9
|
const iam_1 = require("./gcp/iam");
|
|
10
10
|
const BASE_PERMISSIONS = ["firebase.projects.get"];
|
|
11
11
|
async function requirePermissions(options, permissions = []) {
|
|
12
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
12
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
13
13
|
const requiredPermissions = BASE_PERMISSIONS.concat(permissions).sort();
|
|
14
|
-
await requireAuth_1.requireAuth(options);
|
|
14
|
+
await (0, requireAuth_1.requireAuth)(options);
|
|
15
15
|
logger_1.logger.debug(`[iam] checking project ${projectId} for permissions ${JSON.stringify(requiredPermissions)}`);
|
|
16
16
|
try {
|
|
17
|
-
const iamResult = await iam_1.testIamPermissions(projectId, requiredPermissions);
|
|
17
|
+
const iamResult = await (0, iam_1.testIamPermissions)(projectId, requiredPermissions);
|
|
18
18
|
if (!iamResult.passed) {
|
|
19
|
-
throw new error_1.FirebaseError(`Authorization failed. This account is missing the following required permissions on project ${cli_color_1.bold(projectId)}:\n\n ${iamResult.missing.join("\n ")}`);
|
|
19
|
+
throw new error_1.FirebaseError(`Authorization failed. This account is missing the following required permissions on project ${(0, cli_color_1.bold)(projectId)}:\n\n ${iamResult.missing.join("\n ")}`);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
catch (err) {
|
package/lib/rulesDeploy.js
CHANGED
|
@@ -56,7 +56,7 @@ class RulesDeploy {
|
|
|
56
56
|
}
|
|
57
57
|
async createRulesets(service) {
|
|
58
58
|
const createdRulesetNames = [];
|
|
59
|
-
const { latestName: latestRulesetName, latestContent: latestRulesetContent
|
|
59
|
+
const { latestName: latestRulesetName, latestContent: latestRulesetContent } = await this.getCurrentRules(service);
|
|
60
60
|
const newRulesetsByFilename = new Map();
|
|
61
61
|
for (const filename of Object.keys(this.rulesFiles)) {
|
|
62
62
|
const files = this.rulesFiles[filename];
|
|
@@ -83,7 +83,7 @@ class RulesDeploy {
|
|
|
83
83
|
" quota exceeded error while uploading rules");
|
|
84
84
|
const history = await gcp.rules.listAllRulesets(this.options.project);
|
|
85
85
|
if (history.length > RULESET_COUNT_LIMIT) {
|
|
86
|
-
const confirm = await prompt_1.promptOnce({
|
|
86
|
+
const confirm = await (0, prompt_1.promptOnce)({
|
|
87
87
|
type: "confirm",
|
|
88
88
|
name: "force",
|
|
89
89
|
message: `You have ${history.length} rules, do you want to delete the oldest ${RULESETS_TO_GC} to free up space?`,
|
package/lib/serve/functions.js
CHANGED
|
@@ -11,23 +11,26 @@ const utils = require("../utils");
|
|
|
11
11
|
class FunctionsServer {
|
|
12
12
|
constructor() {
|
|
13
13
|
this.emulatorServer = undefined;
|
|
14
|
+
this.backend = undefined;
|
|
14
15
|
}
|
|
15
16
|
assertServer() {
|
|
16
|
-
if (!this.emulatorServer) {
|
|
17
|
+
if (!this.emulatorServer || !this.backend) {
|
|
17
18
|
throw new Error("Must call start() before calling any other operation!");
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
async start(options, partialArgs) {
|
|
21
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
22
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
22
23
|
utils.assertDefined(options.config.src.functions);
|
|
23
24
|
utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
|
|
24
25
|
const functionsDir = path.join(options.config.projectDir, options.config.src.functions.source);
|
|
25
|
-
const account = auth_1.getProjectDefaultAccount(options.config.projectDir);
|
|
26
|
-
const nodeMajorVersion = functionsEmulatorUtils_1.parseRuntimeVersion(options.config.get("functions.runtime"));
|
|
27
|
-
|
|
26
|
+
const account = (0, auth_1.getProjectDefaultAccount)(options.config.projectDir);
|
|
27
|
+
const nodeMajorVersion = (0, functionsEmulatorUtils_1.parseRuntimeVersion)(options.config.get("functions.runtime"));
|
|
28
|
+
this.backend = {
|
|
28
29
|
functionsDir,
|
|
29
|
-
|
|
30
|
-
nodeMajorVersion
|
|
30
|
+
env: {},
|
|
31
|
+
nodeMajorVersion,
|
|
32
|
+
};
|
|
33
|
+
const args = Object.assign({ projectId, emulatableBackends: [this.backend], account }, partialArgs);
|
|
31
34
|
if (options.host) {
|
|
32
35
|
utils.assertIsStringOrUndefined(options.host);
|
|
33
36
|
args.host = options.host;
|
|
@@ -55,6 +58,10 @@ class FunctionsServer {
|
|
|
55
58
|
this.assertServer();
|
|
56
59
|
await this.emulatorServer.stop();
|
|
57
60
|
}
|
|
61
|
+
getBackend() {
|
|
62
|
+
this.assertServer();
|
|
63
|
+
return this.backend;
|
|
64
|
+
}
|
|
58
65
|
get() {
|
|
59
66
|
this.assertServer();
|
|
60
67
|
return this.emulatorServer.get();
|
package/lib/serve/hosting.js
CHANGED
|
@@ -20,7 +20,7 @@ let attempts = 0;
|
|
|
20
20
|
let destroyServer = undefined;
|
|
21
21
|
const logger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.HOSTING);
|
|
22
22
|
function startServer(options, config, port, init) {
|
|
23
|
-
const firebaseMiddleware = initMiddleware_1.initMiddleware(init);
|
|
23
|
+
const firebaseMiddleware = (0, initMiddleware_1.initMiddleware)(init);
|
|
24
24
|
const morganStream = new stream_1.Writable();
|
|
25
25
|
morganStream._write = (chunk, encoding, callback) => {
|
|
26
26
|
if (chunk instanceof Buffer) {
|
|
@@ -36,7 +36,7 @@ function startServer(options, config, port, init) {
|
|
|
36
36
|
port: port,
|
|
37
37
|
host: options.host,
|
|
38
38
|
config: config,
|
|
39
|
-
cwd: detectProjectRoot_1.detectProjectRoot(options),
|
|
39
|
+
cwd: (0, detectProjectRoot_1.detectProjectRoot)(options),
|
|
40
40
|
stack: "strict",
|
|
41
41
|
before: {
|
|
42
42
|
files: (req, res, next) => {
|
|
@@ -46,8 +46,8 @@ function startServer(options, config, port, init) {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
rewriters: {
|
|
49
|
-
function: functionsProxy_1.default(options),
|
|
50
|
-
run: cloudRunProxy_1.default(options),
|
|
49
|
+
function: (0, functionsProxy_1.default)(options),
|
|
50
|
+
run: (0, cloudRunProxy_1.default)(options),
|
|
51
51
|
},
|
|
52
52
|
}).listen(() => {
|
|
53
53
|
const siteName = config.target || config.site;
|
|
@@ -57,7 +57,7 @@ function startServer(options, config, port, init) {
|
|
|
57
57
|
}
|
|
58
58
|
logger.logLabeled("SUCCESS", label, "Local server: " + clc.underline(clc.bold("http://" + options.host + ":" + port)));
|
|
59
59
|
});
|
|
60
|
-
destroyServer = utils_1.createDestroyer(server);
|
|
60
|
+
destroyServer = (0, utils_1.createDestroyer)(server);
|
|
61
61
|
server.on("error", (err) => {
|
|
62
62
|
if (err.code === "EADDRINUSE") {
|
|
63
63
|
const message = "Port " + options.port + " is not available.";
|
|
@@ -83,8 +83,8 @@ function stop() {
|
|
|
83
83
|
}
|
|
84
84
|
exports.stop = stop;
|
|
85
85
|
async function start(options) {
|
|
86
|
-
const init = await implicitInit_1.implicitInit(options);
|
|
87
|
-
const configs = normalizedHostingConfigs_1.normalizedHostingConfigs(options);
|
|
86
|
+
const init = await (0, implicitInit_1.implicitInit)(options);
|
|
87
|
+
const configs = (0, normalizedHostingConfigs_1.normalizedHostingConfigs)(options);
|
|
88
88
|
for (let i = 0; i < configs.length; i++) {
|
|
89
89
|
const port = i === 0 ? options.port : options.port + 4 + i;
|
|
90
90
|
startServer(options, configs[i], port, init);
|
package/lib/utils.js
CHANGED
|
@@ -333,9 +333,10 @@ function createDestroyer(server) {
|
|
|
333
333
|
}
|
|
334
334
|
exports.createDestroyer = createDestroyer;
|
|
335
335
|
function datetimeString(d) {
|
|
336
|
-
const day = `${d.getFullYear()}-${(d.getMonth() + 1)
|
|
336
|
+
const day = `${d.getFullYear()}-${(d.getMonth() + 1).toString().padStart(2, "0")}-${d
|
|
337
|
+
.getDate()
|
|
337
338
|
.toString()
|
|
338
|
-
.padStart(2, "0")}
|
|
339
|
+
.padStart(2, "0")}`;
|
|
339
340
|
const time = `${d.getHours().toString().padStart(2, "0")}:${d
|
|
340
341
|
.getMinutes()
|
|
341
342
|
.toString()
|