firebase-tools 10.0.0 → 10.1.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 +9 -8
- package/lib/accountImporter.js +10 -8
- package/lib/api.js +1 -0
- 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/bin/firebase.js +1 -1
- 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/auth-export.js +26 -25
- package/lib/commands/auth-import.js +88 -78
- 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 +2 -2
- package/lib/commands/database-set.js +2 -2
- package/lib/commands/database-settings-get.js +1 -1
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +2 -2
- package/lib/commands/ext-configure.js +3 -3
- 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 +4 -4
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-publish.js +4 -4
- package/lib/commands/ext-dev-register.js +6 -6
- 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 +5 -5
- package/lib/commands/ext-install.js +27 -23
- package/lib/commands/ext-list.js +2 -2
- package/lib/commands/ext-sources-create.js +2 -2
- package/lib/commands/ext-uninstall.js +4 -4
- package/lib/commands/ext-update.js +18 -18
- package/lib/commands/ext.js +3 -3
- package/lib/commands/firestore-delete.js +1 -1
- package/lib/commands/functions-config-clone.js +22 -23
- package/lib/commands/functions-config-export.js +11 -11
- package/lib/commands/functions-config-get.js +22 -22
- package/lib/commands/functions-config-set.js +24 -22
- package/lib/commands/functions-config-unset.js +20 -22
- 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/help.js +12 -12
- package/lib/commands/hosting-channel-create.js +13 -13
- package/lib/commands/hosting-channel-delete.js +10 -10
- package/lib/commands/hosting-channel-deploy.js +18 -18
- package/lib/commands/hosting-channel-list.js +5 -5
- package/lib/commands/hosting-channel-open.js +9 -9
- package/lib/commands/hosting-clone.js +16 -16
- package/lib/commands/hosting-disable.js +1 -1
- 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-ci.js +10 -10
- 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 +7 -2
- package/lib/commands/setup-emulators-database.js +8 -7
- package/lib/commands/setup-emulators-firestore.js +8 -7
- package/lib/commands/setup-emulators-pubsub.js +5 -4
- package/lib/commands/setup-emulators-storage.js +4 -3
- package/lib/commands/setup-emulators-ui.js +8 -7
- package/lib/commands/target-apply.js +17 -16
- package/lib/commands/target-clear.js +11 -10
- package/lib/commands/target-remove.js +10 -9
- package/lib/commands/target.js +20 -20
- package/lib/config.js +6 -6
- package/lib/database/api.js +2 -2
- package/lib/defaultCredentials.js +3 -3
- 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 +4 -4
- 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 +2 -2
- 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 +11 -14
- 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/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 +10 -9
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +107 -74
- package/lib/emulator/functionsEmulatorRuntime.js +36 -21
- 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 +10 -9
- 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 +3 -4
- package/lib/extensions/askUserForParam.js +11 -11
- package/lib/extensions/billingMigrationHelper.js +2 -2
- package/lib/extensions/changelog.js +4 -4
- package/lib/extensions/displayExtensionInfo.js +6 -6
- 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 +69 -110
- package/lib/extensions/extensionsHelper.js +56 -43
- 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 +13 -14
- package/lib/extensions/resolveSource.js +6 -6
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/updateHelper.js +10 -10
- package/lib/extensions/utils.js +1 -1
- package/lib/extensions/warnings.js +11 -10
- 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 +7 -8
- 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/rules.js +18 -41
- 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 +2 -2
- package/lib/prompt.js +0 -1
- package/lib/rc.js +1 -1
- package/lib/remoteconfig/get.js +14 -8
- package/lib/remoteconfig/rollback.js +13 -6
- package/lib/remoteconfig/versionslist.js +13 -7
- 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 +24095 -0
- package/package.json +33 -30
- package/templates/init/hosting/index.html +1 -1
- package/CHANGELOG.md +0 -5
- package/lib/commands/functions-config-legacy.js +0 -45
- package/lib/prepareFirebaseRules.js +0 -58
|
@@ -24,7 +24,7 @@ const MAX_ATTEMPTS = 3;
|
|
|
24
24
|
function checkReservedAliases(pInfos) {
|
|
25
25
|
for (const pInfo of pInfos) {
|
|
26
26
|
if (pInfo.alias && RESERVED_PROJECT_ALIAS.includes(pInfo.alias)) {
|
|
27
|
-
utils_1.logWarning(`Project alias (${clc.bold(pInfo.alias)}) is reserved for internal use. ` +
|
|
27
|
+
(0, utils_1.logWarning)(`Project alias (${clc.bold(pInfo.alias)}) is reserved for internal use. ` +
|
|
28
28
|
`Saving exported config in .env.${pInfo.projectId} instead.`);
|
|
29
29
|
delete pInfo.alias;
|
|
30
30
|
}
|
|
@@ -32,15 +32,15 @@ function checkReservedAliases(pInfos) {
|
|
|
32
32
|
}
|
|
33
33
|
async function checkRequiredPermission(pInfos) {
|
|
34
34
|
pInfos = pInfos.filter((pInfo) => !pInfo.config);
|
|
35
|
-
const testPermissions = pInfos.map((pInfo) => iam_1.testIamPermissions(pInfo.projectId, REQUIRED_PERMISSIONS));
|
|
35
|
+
const testPermissions = pInfos.map((pInfo) => (0, iam_1.testIamPermissions)(pInfo.projectId, REQUIRED_PERMISSIONS));
|
|
36
36
|
const results = await Promise.all(testPermissions);
|
|
37
|
-
for (const [pInfo, result] of functional_1.zip(pInfos, results)) {
|
|
37
|
+
for (const [pInfo, result] of (0, functional_1.zip)(pInfos, results)) {
|
|
38
38
|
if (result.passed) {
|
|
39
39
|
throw new error_1.FirebaseError(`Unexpectedly failed to fetch runtime config for project ${pInfo.projectId}`);
|
|
40
40
|
}
|
|
41
|
-
utils_1.logWarning("You are missing the following permissions to read functions config on project " +
|
|
41
|
+
(0, utils_1.logWarning)("You are missing the following permissions to read functions config on project " +
|
|
42
42
|
`${clc.bold(pInfo.projectId)}:\n\t${result.missing.join("\n\t")}`);
|
|
43
|
-
const confirm = await prompt_1.promptOnce({
|
|
43
|
+
const confirm = await (0, prompt_1.promptOnce)({
|
|
44
44
|
type: "confirm",
|
|
45
45
|
name: "skip",
|
|
46
46
|
default: true,
|
|
@@ -52,9 +52,9 @@ async function checkRequiredPermission(pInfos) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
async function promptForPrefix(errMsg) {
|
|
55
|
-
utils_1.logWarning("The following configs keys could not be exported as environment variables:\n");
|
|
56
|
-
utils_1.logWarning(errMsg);
|
|
57
|
-
return await prompt_1.promptOnce({
|
|
55
|
+
(0, utils_1.logWarning)("The following configs keys could not be exported as environment variables:\n");
|
|
56
|
+
(0, utils_1.logWarning)(errMsg);
|
|
57
|
+
return await (0, prompt_1.promptOnce)({
|
|
58
58
|
type: "input",
|
|
59
59
|
name: "prefix",
|
|
60
60
|
default: "CONFIG_",
|
|
@@ -81,14 +81,14 @@ exports.default = new command_1.Command("functions:config:export")
|
|
|
81
81
|
.action(async (options) => {
|
|
82
82
|
let pInfos = configExport.getProjectInfos(options);
|
|
83
83
|
checkReservedAliases(pInfos);
|
|
84
|
-
utils_1.logBullet("Importing functions configs from projects [" +
|
|
84
|
+
(0, utils_1.logBullet)("Importing functions configs from projects [" +
|
|
85
85
|
pInfos.map(({ projectId }) => `${clc.bold(projectId)}`).join(", ") +
|
|
86
86
|
"]");
|
|
87
87
|
await configExport.hydrateConfigs(pInfos);
|
|
88
88
|
await checkRequiredPermission(pInfos);
|
|
89
89
|
pInfos = pInfos.filter((pInfo) => pInfo.config);
|
|
90
90
|
logger_1.logger.debug(`Loaded function configs: ${JSON.stringify(pInfos)}`);
|
|
91
|
-
utils_1.logBullet(`Importing configs from projects: [${pInfos.map((p) => p.projectId).join(", ")}]`);
|
|
91
|
+
(0, utils_1.logBullet)(`Importing configs from projects: [${pInfos.map((p) => p.projectId).join(", ")}]`);
|
|
92
92
|
let attempts = 0;
|
|
93
93
|
let prefix = "";
|
|
94
94
|
while (true) {
|
|
@@ -105,7 +105,7 @@ exports.default = new command_1.Command("functions:config:export")
|
|
|
105
105
|
const header = `# Exported firebase functions:config:export command on ${new Date().toLocaleDateString()}`;
|
|
106
106
|
const dotEnvs = pInfos.map((pInfo) => configExport.toDotenvFormat(pInfo.envs, header));
|
|
107
107
|
const filenames = pInfos.map(configExport.generateDotenvFilename);
|
|
108
|
-
const filesToWrite = fromEntries(functional_1.zip(filenames, dotEnvs));
|
|
108
|
+
const filesToWrite = fromEntries((0, functional_1.zip)(filenames, dotEnvs));
|
|
109
109
|
filesToWrite[".env.local"] = `${header}\n# .env.local file contains environment variables for the Functions Emulator.\n`;
|
|
110
110
|
filesToWrite[".env"] = `${header}# .env file contains environment variables that applies to all projects.\n`;
|
|
111
111
|
const functionsDir = options.config.get("functions.source", ".");
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const functionsConfig = require("../functionsConfig");
|
|
10
|
+
async function materialize(projectId, path) {
|
|
11
|
+
if (path === undefined) {
|
|
10
12
|
return functionsConfig.materializeAll(projectId);
|
|
11
13
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
});
|
|
14
|
+
const parts = path.split(".");
|
|
15
|
+
const configId = parts[0];
|
|
16
|
+
const configName = (0, path_1.join)("projects", projectId, "configs", configId);
|
|
17
|
+
const result = await functionsConfig.materializeConfig(configName, {});
|
|
18
|
+
const query = parts.join(".");
|
|
19
|
+
return query ? (0, lodash_1.get)(result, query) : result;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
+
exports.default = new command_1.Command("functions:config:get [path]")
|
|
21
22
|
.description("fetch environment config stored at the given path")
|
|
22
|
-
.before(requirePermissions, [
|
|
23
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
23
24
|
"runtimeconfig.configs.list",
|
|
24
25
|
"runtimeconfig.configs.get",
|
|
25
26
|
"runtimeconfig.variables.list",
|
|
26
27
|
"runtimeconfig.variables.get",
|
|
27
28
|
])
|
|
28
29
|
.before(functionsConfig.ensureApi)
|
|
29
|
-
.action(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
30
|
+
.action(async (path, options) => {
|
|
31
|
+
const result = await materialize((0, projectUtils_1.needProjectId)(options), path);
|
|
32
|
+
logger_1.logger.info(JSON.stringify(result, null, 2));
|
|
33
|
+
return result;
|
|
34
34
|
});
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
const logger_1 = require("../logger");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
9
|
+
const functionsConfig = require("../functionsConfig");
|
|
10
|
+
const utils = require("../utils");
|
|
11
|
+
exports.default = new command_1.Command("functions:config:set [values...]")
|
|
10
12
|
.description("set environment config with key=value syntax")
|
|
11
|
-
.before(requirePermissions, [
|
|
13
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
12
14
|
"runtimeconfig.configs.list",
|
|
13
15
|
"runtimeconfig.configs.create",
|
|
14
16
|
"runtimeconfig.configs.get",
|
|
@@ -21,20 +23,20 @@ module.exports = new Command("functions:config:set [values...]")
|
|
|
21
23
|
"runtimeconfig.variables.delete",
|
|
22
24
|
])
|
|
23
25
|
.before(functionsConfig.ensureApi)
|
|
24
|
-
.action(
|
|
26
|
+
.action(async (args, options) => {
|
|
25
27
|
if (!args.length) {
|
|
26
|
-
|
|
28
|
+
throw new error_1.FirebaseError(`Must supply at least one key/value pair, e.g. ${clc.bold('app.name="My App"')}`);
|
|
27
29
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
31
|
+
const parsed = functionsConfig.parseSetArgs(args);
|
|
32
|
+
const promises = [];
|
|
33
|
+
for (const item of parsed) {
|
|
34
|
+
if (item.val === undefined) {
|
|
35
|
+
throw new error_1.FirebaseError(`Unexpected undefined value for varId "${item.varId}`, { exit: 2 });
|
|
36
|
+
}
|
|
32
37
|
promises.push(functionsConfig.setVariablesRecursive(projectId, item.configId, item.varId, item.val));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
clc.bold("firebase deploy --only functions") +
|
|
38
|
-
"\n");
|
|
39
|
-
});
|
|
38
|
+
}
|
|
39
|
+
await Promise.all(promises);
|
|
40
|
+
utils.logSuccess("Functions config updated.");
|
|
41
|
+
logger_1.logger.info(`\nPlease deploy your functions for the change to take effect by running ${clc.bold("firebase deploy --only functions")}\n`);
|
|
40
42
|
});
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const functionsConfig = require("../functionsConfig");
|
|
9
|
+
const runtimeconfig = require("../gcp/runtimeconfig");
|
|
10
|
+
const utils = require("../utils");
|
|
11
|
+
const error_1 = require("../error");
|
|
12
|
+
exports.default = new command_1.Command("functions:config:unset [keys...]")
|
|
12
13
|
.description("unset environment config at the specified path(s)")
|
|
13
|
-
.before(requirePermissions, [
|
|
14
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
14
15
|
"runtimeconfig.configs.list",
|
|
15
16
|
"runtimeconfig.configs.create",
|
|
16
17
|
"runtimeconfig.configs.get",
|
|
@@ -23,21 +24,18 @@ module.exports = new Command("functions:config:unset [keys...]")
|
|
|
23
24
|
"runtimeconfig.variables.delete",
|
|
24
25
|
])
|
|
25
26
|
.before(functionsConfig.ensureApi)
|
|
26
|
-
.action(
|
|
27
|
+
.action(async (args, options) => {
|
|
27
28
|
if (!args.length) {
|
|
28
|
-
|
|
29
|
+
throw new error_1.FirebaseError("Must supply at least one key");
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
32
|
+
const parsed = functionsConfig.parseUnsetArgs(args);
|
|
33
|
+
await Promise.all(parsed.map((item) => {
|
|
33
34
|
if (item.varId === "") {
|
|
34
35
|
return runtimeconfig.configs.delete(projectId, item.configId);
|
|
35
36
|
}
|
|
36
37
|
return runtimeconfig.variables.delete(projectId, item.configId, item.varId);
|
|
37
|
-
}))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
clc.bold("firebase deploy --only functions") +
|
|
41
|
-
"\n");
|
|
42
|
-
});
|
|
38
|
+
}));
|
|
39
|
+
utils.logSuccess("Environment updated.");
|
|
40
|
+
logger_1.logger.info(`\nPlease deploy your functions for the change to take effect by running ${clc.bold("firebase deploy --only functions")}\n`);
|
|
43
41
|
});
|
|
@@ -28,7 +28,7 @@ exports.default = new command_1.Command("functions:delete [filters...]")
|
|
|
28
28
|
return utils.reject("Must supply at least function or group name.");
|
|
29
29
|
}
|
|
30
30
|
const context = {
|
|
31
|
-
projectId: projectUtils_1.needProjectId(options),
|
|
31
|
+
projectId: (0, projectUtils_1.needProjectId)(options),
|
|
32
32
|
filters: filters.map((f) => f.split(".")),
|
|
33
33
|
};
|
|
34
34
|
const [config, existingBackend] = await Promise.all([
|
|
@@ -52,7 +52,7 @@ exports.default = new command_1.Command("functions:delete [filters...]")
|
|
|
52
52
|
throw new error_1.FirebaseError(`The specified filters do not match any existing functions in project ${clc.bold(context.projectId)}.`);
|
|
53
53
|
}
|
|
54
54
|
const deleteList = allEpToDelete.map((func) => `\t${helper.getFunctionLabel(func)}`).join("\n");
|
|
55
|
-
const confirmDeletion = await prompt_1.promptOnce({
|
|
55
|
+
const confirmDeletion = await (0, prompt_1.promptOnce)({
|
|
56
56
|
type: "confirm",
|
|
57
57
|
name: "force",
|
|
58
58
|
default: false,
|
|
@@ -86,7 +86,7 @@ exports.default = new command_1.Command("functions:delete [filters...]")
|
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
const opts = {};
|
|
89
|
-
const arEnabled = await ensure.check(projectUtils_1.needProjectId(options), "artifactregistry.googleapis.com", "functions", true);
|
|
89
|
+
const arEnabled = await ensure.check((0, projectUtils_1.needProjectId)(options), "artifactregistry.googleapis.com", "functions", true);
|
|
90
90
|
if (!arEnabled) {
|
|
91
91
|
opts.ar = new containerCleaner.NoopArtifactRegistryCleaner();
|
|
92
92
|
}
|
|
@@ -21,12 +21,12 @@ exports.default = new command_1.Command("functions:deletegcfartifacts")
|
|
|
21
21
|
"<regions> is a Google defined region list, e.g. us-central1,us-east1,europe-west2.")
|
|
22
22
|
.before(requirePermissions_1.requirePermissions, ["storage.objects.delete"])
|
|
23
23
|
.action(async (options) => {
|
|
24
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
24
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
25
|
const regions = options.regions ? options.regions.split(",") : undefined;
|
|
26
26
|
const dockerHelper = {};
|
|
27
27
|
try {
|
|
28
|
-
const gcfPaths = await containerCleaner_1.listGcfPaths(projectId, regions, dockerHelper);
|
|
29
|
-
const confirmDeletion = await prompt_1.promptOnce({
|
|
28
|
+
const gcfPaths = await (0, containerCleaner_1.listGcfPaths)(projectId, regions, dockerHelper);
|
|
29
|
+
const confirmDeletion = await (0, prompt_1.promptOnce)({
|
|
30
30
|
type: "confirm",
|
|
31
31
|
name: "force",
|
|
32
32
|
default: false,
|
|
@@ -35,7 +35,7 @@ exports.default = new command_1.Command("functions:deletegcfartifacts")
|
|
|
35
35
|
if (!confirmDeletion) {
|
|
36
36
|
throw new error_1.FirebaseError("Command aborted.", { exit: 1 });
|
|
37
37
|
}
|
|
38
|
-
await containerCleaner_1.deleteGcfArtifacts(projectId, regions, dockerHelper);
|
|
38
|
+
await (0, containerCleaner_1.deleteGcfArtifacts)(projectId, regions, dockerHelper);
|
|
39
39
|
}
|
|
40
40
|
catch (err) {
|
|
41
41
|
throw new error_1.FirebaseError("Command failed.", { original: err });
|
|
@@ -14,7 +14,7 @@ exports.default = new command_1.Command("functions:list")
|
|
|
14
14
|
.action(async (options) => {
|
|
15
15
|
try {
|
|
16
16
|
const context = {
|
|
17
|
-
projectId: projectUtils_1.needProjectId(options),
|
|
17
|
+
projectId: (0, projectUtils_1.needProjectId)(options),
|
|
18
18
|
};
|
|
19
19
|
const existing = await backend.existingBackend(context);
|
|
20
20
|
const endpointsList = backend.allEndpoints(existing).sort(backend.compareFunctions);
|
|
@@ -16,7 +16,7 @@ module.exports = new command_1.Command("functions:log")
|
|
|
16
16
|
.before(requirePermissions_1.requirePermissions, ["logging.logEntries.list", "logging.logs.list"])
|
|
17
17
|
.action(async (options) => {
|
|
18
18
|
try {
|
|
19
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
19
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
20
20
|
const apiFilter = functionsLog.getApiFilter(options.only);
|
|
21
21
|
if (options.open) {
|
|
22
22
|
const url = `https://console.developers.google.com/logs/viewer?advancedFilter=${qs.escape(apiFilter)}&project=${projectId}`;
|
package/lib/commands/help.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const clc = require("cli-color");
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const logger_1 = require("../logger");
|
|
6
|
+
const utils = require("../utils");
|
|
7
|
+
exports.default = new command_1.Command("help [command]")
|
|
7
8
|
.description("display help information")
|
|
8
9
|
.action(function (commandName) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const client = this.client;
|
|
11
|
+
const cmd = client.getCommand(commandName);
|
|
11
12
|
if (cmd) {
|
|
12
13
|
cmd.outputHelp();
|
|
13
14
|
}
|
|
14
15
|
else if (commandName) {
|
|
15
|
-
logger.warn();
|
|
16
|
+
logger_1.logger.warn();
|
|
16
17
|
utils.logWarning(clc.bold(commandName) + " is not a valid command. See below for valid commands");
|
|
17
18
|
client.cli.outputHelp();
|
|
18
19
|
}
|
|
19
20
|
else {
|
|
20
21
|
client.cli.outputHelp();
|
|
21
|
-
logger.info();
|
|
22
|
-
logger.info(" To get help with a specific command, type", clc.bold("firebase help [command_name]"));
|
|
23
|
-
logger.info();
|
|
22
|
+
logger_1.logger.info();
|
|
23
|
+
logger_1.logger.info(" To get help with a specific command, type", clc.bold("firebase help [command_name]"));
|
|
24
|
+
logger_1.logger.info();
|
|
24
25
|
}
|
|
25
|
-
return Promise.resolve();
|
|
26
26
|
});
|
|
@@ -11,7 +11,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
11
11
|
const projectUtils_1 = require("../projectUtils");
|
|
12
12
|
const logger_1 = require("../logger");
|
|
13
13
|
const requireConfig = require("../requireConfig");
|
|
14
|
-
const marked = require("marked");
|
|
14
|
+
const { marked } = require("marked");
|
|
15
15
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
16
16
|
const LOG_TAG = "hosting:channel";
|
|
17
17
|
exports.default = new command_1.Command("hosting:channel:create [channelId]")
|
|
@@ -22,45 +22,45 @@ exports.default = new command_1.Command("hosting:channel:create [channelId]")
|
|
|
22
22
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
23
23
|
.before(requireHostingSite_1.requireHostingSite)
|
|
24
24
|
.action(async (channelId, options) => {
|
|
25
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
25
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
26
26
|
const site = options.site;
|
|
27
27
|
let expireTTL = expireUtils_1.DEFAULT_DURATION;
|
|
28
28
|
if (options.expires) {
|
|
29
|
-
expireTTL = expireUtils_1.calculateChannelExpireTTL(options.expires);
|
|
29
|
+
expireTTL = (0, expireUtils_1.calculateChannelExpireTTL)(options.expires);
|
|
30
30
|
}
|
|
31
31
|
if (channelId) {
|
|
32
32
|
options.channelId = channelId;
|
|
33
33
|
}
|
|
34
34
|
channelId =
|
|
35
35
|
channelId ||
|
|
36
|
-
(await prompt_1.promptOnce({
|
|
36
|
+
(await (0, prompt_1.promptOnce)({
|
|
37
37
|
type: "input",
|
|
38
38
|
message: "Please provide a URL-friendly name for the channel:",
|
|
39
39
|
validate: (s) => s.length > 0,
|
|
40
40
|
}));
|
|
41
|
-
channelId = api_1.normalizeName(channelId);
|
|
41
|
+
channelId = (0, api_1.normalizeName)(channelId);
|
|
42
42
|
let channel;
|
|
43
43
|
try {
|
|
44
|
-
channel = await api_1.createChannel(projectId, site, channelId, expireTTL);
|
|
44
|
+
channel = await (0, api_1.createChannel)(projectId, site, channelId, expireTTL);
|
|
45
45
|
}
|
|
46
46
|
catch (e) {
|
|
47
47
|
if (e.status === 409) {
|
|
48
|
-
throw new error_1.FirebaseError(`Channel ${cli_color_1.bold(channelId)} already exists on site ${cli_color_1.bold(site)}. Deploy to ${cli_color_1.bold(channelId)} with: ${cli_color_1.yellow(`firebase hosting:channel:deploy ${channelId}`)}`, { original: e });
|
|
48
|
+
throw new error_1.FirebaseError(`Channel ${(0, cli_color_1.bold)(channelId)} already exists on site ${(0, cli_color_1.bold)(site)}. Deploy to ${(0, cli_color_1.bold)(channelId)} with: ${(0, cli_color_1.yellow)(`firebase hosting:channel:deploy ${channelId}`)}`, { original: e });
|
|
49
49
|
}
|
|
50
50
|
throw e;
|
|
51
51
|
}
|
|
52
52
|
try {
|
|
53
|
-
await api_1.addAuthDomains(projectId, [channel.url]);
|
|
53
|
+
await (0, api_1.addAuthDomains)(projectId, [channel.url]);
|
|
54
54
|
}
|
|
55
55
|
catch (e) {
|
|
56
|
-
utils_1.logLabeledWarning(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils_1.consoleUrl(projectId, "/authentication/providers")}`));
|
|
56
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
57
57
|
logger_1.logger.debug("[hosting] unable to add auth domain", e);
|
|
58
58
|
}
|
|
59
59
|
logger_1.logger.info();
|
|
60
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel ${cli_color_1.bold(channelId)} has been created on site ${cli_color_1.bold(site)}.`);
|
|
61
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel ${cli_color_1.bold(channelId)} will expire at ${cli_color_1.bold(utils_1.datetimeString(new Date(channel.expireTime)))}.`);
|
|
62
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel URL: ${channel.url}`);
|
|
60
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel ${(0, cli_color_1.bold)(channelId)} has been created on site ${(0, cli_color_1.bold)(site)}.`);
|
|
61
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel ${(0, cli_color_1.bold)(channelId)} will expire at ${(0, cli_color_1.bold)((0, utils_1.datetimeString)(new Date(channel.expireTime)))}.`);
|
|
62
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel URL: ${channel.url}`);
|
|
63
63
|
logger_1.logger.info();
|
|
64
|
-
logger_1.logger.info(`To deploy to this channel, use ${cli_color_1.yellow(`firebase hosting:channel:deploy ${channelId}`)}.`);
|
|
64
|
+
logger_1.logger.info(`To deploy to this channel, use ${(0, cli_color_1.yellow)(`firebase hosting:channel:deploy ${channelId}`)}.`);
|
|
65
65
|
return channel;
|
|
66
66
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const cli_color_1 = require("cli-color");
|
|
4
|
-
const
|
|
4
|
+
const { marked } = require("marked");
|
|
5
5
|
const command_1 = require("../command");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
7
|
const api_1 = require("../hosting/api");
|
|
@@ -19,28 +19,28 @@ exports.default = new command_1.Command("hosting:channel:delete <channelId>")
|
|
|
19
19
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
20
20
|
.before(requireHostingSite_1.requireHostingSite)
|
|
21
21
|
.action(async (channelId, options) => {
|
|
22
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
22
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
23
23
|
const siteId = options.site;
|
|
24
|
-
channelId = api_1.normalizeName(channelId);
|
|
25
|
-
const channel = await api_1.getChannel(projectId, siteId, channelId);
|
|
26
|
-
const confirmed = await prompt_1.promptOnce({
|
|
24
|
+
channelId = (0, api_1.normalizeName)(channelId);
|
|
25
|
+
const channel = await (0, api_1.getChannel)(projectId, siteId, channelId);
|
|
26
|
+
const confirmed = await (0, prompt_1.promptOnce)({
|
|
27
27
|
name: "force",
|
|
28
28
|
type: "confirm",
|
|
29
|
-
message: `Are you sure you want to delete the Hosting Channel ${cli_color_1.underline(channelId)} for site ${cli_color_1.underline(siteId)}?`,
|
|
29
|
+
message: `Are you sure you want to delete the Hosting Channel ${(0, cli_color_1.underline)(channelId)} for site ${(0, cli_color_1.underline)(siteId)}?`,
|
|
30
30
|
default: false,
|
|
31
31
|
}, options);
|
|
32
32
|
if (!confirmed) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
await api_1.deleteChannel(projectId, siteId, channelId);
|
|
35
|
+
await (0, api_1.deleteChannel)(projectId, siteId, channelId);
|
|
36
36
|
if (channel) {
|
|
37
37
|
try {
|
|
38
|
-
await api_1.removeAuthDomain(projectId, channel.url);
|
|
38
|
+
await (0, api_1.removeAuthDomain)(projectId, channel.url);
|
|
39
39
|
}
|
|
40
40
|
catch (e) {
|
|
41
|
-
utils_1.logLabeledWarning("hosting:channel",
|
|
41
|
+
(0, utils_1.logLabeledWarning)("hosting:channel", marked(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
42
42
|
logger_1.logger.debug("[hosting] unable to remove auth domain", e);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
utils_1.logLabeledSuccess("hosting:channels", `Successfully deleted channel ${cli_color_1.bold(channelId)} for site ${cli_color_1.bold(siteId)}.`);
|
|
45
|
+
(0, utils_1.logLabeledSuccess)("hosting:channels", `Successfully deleted channel ${(0, cli_color_1.bold)(channelId)} for site ${(0, cli_color_1.bold)(siteId)}.`);
|
|
46
46
|
});
|
|
@@ -12,7 +12,7 @@ const logger_1 = require("../logger");
|
|
|
12
12
|
const requireConfig = require("../requireConfig");
|
|
13
13
|
const expireUtils_1 = require("../hosting/expireUtils");
|
|
14
14
|
const utils_1 = require("../utils");
|
|
15
|
-
const marked = require("marked");
|
|
15
|
+
const { marked } = require("marked");
|
|
16
16
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
17
17
|
const LOG_TAG = "hosting:channel";
|
|
18
18
|
exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
@@ -25,21 +25,21 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
25
25
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
26
26
|
.before(requireHostingSite_1.requireHostingSite)
|
|
27
27
|
.action(async (channelId, options) => {
|
|
28
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
28
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
29
29
|
if (options.open) {
|
|
30
30
|
throw new error_1.FirebaseError("open is not yet implemented");
|
|
31
31
|
}
|
|
32
32
|
let expireTTL = expireUtils_1.DEFAULT_DURATION;
|
|
33
33
|
if (options.expires) {
|
|
34
|
-
expireTTL = expireUtils_1.calculateChannelExpireTTL(options.expires);
|
|
34
|
+
expireTTL = (0, expireUtils_1.calculateChannelExpireTTL)(options.expires);
|
|
35
35
|
logger_1.logger.debug(`Expires TTL: ${expireTTL}`);
|
|
36
36
|
}
|
|
37
37
|
if (!channelId) {
|
|
38
38
|
throw new error_1.FirebaseError("channelID is currently required");
|
|
39
39
|
}
|
|
40
|
-
channelId = api_1.normalizeName(channelId);
|
|
40
|
+
channelId = (0, api_1.normalizeName)(channelId);
|
|
41
41
|
if (channelId.toLowerCase().trim() === "live") {
|
|
42
|
-
throw new error_1.FirebaseError(`Cannot deploy to the ${cli_color_1.bold("live")} channel using this command. Please use ${cli_color_1.bold(cli_color_1.yellow("firebase deploy"))} instead.`);
|
|
42
|
+
throw new error_1.FirebaseError(`Cannot deploy to the ${(0, cli_color_1.bold)("live")} channel using this command. Please use ${(0, cli_color_1.bold)((0, cli_color_1.yellow)("firebase deploy"))} instead.`);
|
|
43
43
|
}
|
|
44
44
|
if (options.only) {
|
|
45
45
|
options.only = options.only
|
|
@@ -47,7 +47,7 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
47
47
|
.map((o) => `hosting:${o}`)
|
|
48
48
|
.join(",");
|
|
49
49
|
}
|
|
50
|
-
const sites = normalizedHostingConfigs_1.normalizedHostingConfigs(options, {
|
|
50
|
+
const sites = (0, normalizedHostingConfigs_1.normalizedHostingConfigs)(options, {
|
|
51
51
|
resolveTargets: true,
|
|
52
52
|
}).map((cfg) => ({
|
|
53
53
|
site: cfg.site,
|
|
@@ -58,25 +58,25 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
58
58
|
}));
|
|
59
59
|
await Promise.all(sites.map(async (siteInfo) => {
|
|
60
60
|
const site = siteInfo.site;
|
|
61
|
-
let chan = await api_1.getChannel(projectId, site, channelId);
|
|
61
|
+
let chan = await (0, api_1.getChannel)(projectId, site, channelId);
|
|
62
62
|
if (chan) {
|
|
63
63
|
logger_1.logger.debug("[hosting] found existing channel for site", site, chan);
|
|
64
64
|
const channelExpires = Boolean(chan.expireTime);
|
|
65
65
|
if (!channelExpires && options.expires) {
|
|
66
|
-
chan = await api_1.updateChannelTtl(projectId, site, channelId, expireTTL);
|
|
66
|
+
chan = await (0, api_1.updateChannelTtl)(projectId, site, channelId, expireTTL);
|
|
67
67
|
}
|
|
68
68
|
else if (channelExpires) {
|
|
69
69
|
const channelTimeRemaining = new Date(chan.expireTime).getTime() - Date.now();
|
|
70
70
|
if (options.expires || channelTimeRemaining < expireTTL) {
|
|
71
|
-
chan = await api_1.updateChannelTtl(projectId, site, channelId, expireTTL);
|
|
71
|
+
chan = await (0, api_1.updateChannelTtl)(projectId, site, channelId, expireTTL);
|
|
72
72
|
logger_1.logger.debug("[hosting] updated TTL for existing channel for site", site, chan);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
else {
|
|
77
|
-
chan = await api_1.createChannel(projectId, site, channelId, expireTTL);
|
|
77
|
+
chan = await (0, api_1.createChannel)(projectId, site, channelId, expireTTL);
|
|
78
78
|
logger_1.logger.debug("[hosting] created new channnel for site", site, chan);
|
|
79
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel ${cli_color_1.bold(channelId)} has been created on site ${cli_color_1.bold(site)}.`);
|
|
79
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel ${(0, cli_color_1.bold)(channelId)} has been created on site ${(0, cli_color_1.bold)(site)}.`);
|
|
80
80
|
}
|
|
81
81
|
siteInfo.url = chan.url;
|
|
82
82
|
siteInfo.expireTime = chan.expireTime;
|
|
@@ -104,7 +104,7 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
104
104
|
deploys[d.target || d.site] = d;
|
|
105
105
|
let expires = "";
|
|
106
106
|
if (d.expireTime) {
|
|
107
|
-
expires = `[expires ${cli_color_1.bold(utils_1.datetimeString(new Date(d.expireTime)))}]`;
|
|
107
|
+
expires = `[expires ${(0, cli_color_1.bold)((0, utils_1.datetimeString)(new Date(d.expireTime)))}]`;
|
|
108
108
|
}
|
|
109
109
|
const versionPrefix = `sites/${d.site}/versions/`;
|
|
110
110
|
const versionName = versionNames.find((v) => {
|
|
@@ -113,9 +113,9 @@ exports.default = new command_1.Command("hosting:channel:deploy [channelId]")
|
|
|
113
113
|
let version = "";
|
|
114
114
|
if (versionName) {
|
|
115
115
|
d.version = versionName.replace(versionPrefix, "");
|
|
116
|
-
version = ` [version ${cli_color_1.bold(d.version)}]`;
|
|
116
|
+
version = ` [version ${(0, cli_color_1.bold)(d.version)}]`;
|
|
117
117
|
}
|
|
118
|
-
utils_1.logLabeledSuccess(LOG_TAG, `Channel URL (${cli_color_1.bold(d.site || d.target)}): ${d.url} ${expires}${version}`);
|
|
118
|
+
(0, utils_1.logLabeledSuccess)(LOG_TAG, `Channel URL (${(0, cli_color_1.bold)(d.site || d.target)}): ${d.url} ${expires}${version}`);
|
|
119
119
|
});
|
|
120
120
|
return deploys;
|
|
121
121
|
});
|
|
@@ -123,18 +123,18 @@ async function syncAuthState(projectId, sites) {
|
|
|
123
123
|
const siteNames = sites.map((d) => d.site);
|
|
124
124
|
const urlNames = sites.map((d) => d.url);
|
|
125
125
|
try {
|
|
126
|
-
await api_1.addAuthDomains(projectId, urlNames);
|
|
126
|
+
await (0, api_1.addAuthDomains)(projectId, urlNames);
|
|
127
127
|
logger_1.logger.debug("[hosting] added auth domain for urls", urlNames);
|
|
128
128
|
}
|
|
129
129
|
catch (e) {
|
|
130
|
-
utils_1.logLabeledWarning(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${utils_1.consoleUrl(projectId, "/authentication/providers")}`));
|
|
130
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, marked(`Unable to add channel domain to Firebase Auth. Visit the Firebase Console at ${(0, utils_1.consoleUrl)(projectId, "/authentication/providers")}`));
|
|
131
131
|
logger_1.logger.debug("[hosting] unable to add auth domain", e);
|
|
132
132
|
}
|
|
133
133
|
try {
|
|
134
|
-
await api_1.cleanAuthState(projectId, siteNames);
|
|
134
|
+
await (0, api_1.cleanAuthState)(projectId, siteNames);
|
|
135
135
|
}
|
|
136
136
|
catch (e) {
|
|
137
|
-
utils_1.logLabeledWarning(LOG_TAG, "Unable to sync Firebase Auth state.");
|
|
137
|
+
(0, utils_1.logLabeledWarning)(LOG_TAG, "Unable to sync Firebase Auth state.");
|
|
138
138
|
logger_1.logger.debug("[hosting] unable to sync auth domain", e);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
@@ -18,21 +18,21 @@ exports.default = new command_1.Command("hosting:channel:list")
|
|
|
18
18
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.update"])
|
|
19
19
|
.before(requireHostingSite_1.requireHostingSite)
|
|
20
20
|
.action(async (options) => {
|
|
21
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
21
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
22
22
|
const siteId = options.site;
|
|
23
|
-
const channels = await api_1.listChannels(projectId, siteId);
|
|
23
|
+
const channels = await (0, api_1.listChannels)(projectId, siteId);
|
|
24
24
|
const table = new Table({ head: TABLE_HEAD, style: { head: ["green"] } });
|
|
25
25
|
for (const channel of channels) {
|
|
26
26
|
const channelId = channel.name.split("/").pop();
|
|
27
27
|
table.push([
|
|
28
28
|
channelId,
|
|
29
|
-
utils_1.datetimeString(new Date(channel.updateTime)),
|
|
29
|
+
(0, utils_1.datetimeString)(new Date(channel.updateTime)),
|
|
30
30
|
channel.url,
|
|
31
|
-
channel.expireTime ? utils_1.datetimeString(new Date(channel.expireTime)) : "never",
|
|
31
|
+
channel.expireTime ? (0, utils_1.datetimeString)(new Date(channel.expireTime)) : "never",
|
|
32
32
|
]);
|
|
33
33
|
}
|
|
34
34
|
logger_1.logger.info();
|
|
35
|
-
logger_1.logger.info(`Channels for site ${cli_color_1.bold(siteId)}`);
|
|
35
|
+
logger_1.logger.info(`Channels for site ${(0, cli_color_1.bold)(siteId)}`);
|
|
36
36
|
logger_1.logger.info();
|
|
37
37
|
logger_1.logger.info(table.toString());
|
|
38
38
|
return { channels };
|