firebase-tools 9.23.2 → 10.1.0
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 +13 -13
- 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 +6 -6
- package/lib/deploy/functions/runtimes/node/index.js +3 -3
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
- package/lib/deploy/functions/services/storage.js +1 -1
- package/lib/deploy/functions/triggerRegionHelper.js +1 -1
- 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/auth/widget_ui.js +1 -1
- package/lib/emulator/commandUtils.js +5 -5
- package/lib/emulator/controller.js +16 -11
- package/lib/emulator/downloadableEmulators.js +7 -7
- 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 +24926 -0
- package/package.json +24 -24
- package/standalone/firepit.js +4 -4
- 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 -7
|
@@ -47,9 +47,9 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
47
47
|
.withForce()
|
|
48
48
|
.option("--params <paramsFile>", "name of params variables file with .env format.")
|
|
49
49
|
.action(async (instanceId, updateSource, options) => {
|
|
50
|
-
const spinner = ora
|
|
50
|
+
const spinner = ora(`Updating ${clc.bold(instanceId)}. This usually takes 3 to 5 minutes...`);
|
|
51
51
|
try {
|
|
52
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
52
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
53
53
|
let existingInstance;
|
|
54
54
|
try {
|
|
55
55
|
existingInstance = await extensionsApi.getInstance(projectId, instanceId);
|
|
@@ -67,11 +67,11 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
67
67
|
const existingParams = existingInstance.config.params;
|
|
68
68
|
const existingSource = existingInstance.config.source.name;
|
|
69
69
|
if (existingInstance.config.extensionRef) {
|
|
70
|
-
updateSource = updateHelper_1.inferUpdateSource(updateSource, existingInstance.config.extensionRef);
|
|
70
|
+
updateSource = (0, updateHelper_1.inferUpdateSource)(updateSource, existingInstance.config.extensionRef);
|
|
71
71
|
}
|
|
72
72
|
let newSourceName;
|
|
73
|
-
const existingSourceOrigin = await updateHelper_1.getExistingSourceOrigin(projectId, instanceId, existingSpec.name, existingSource);
|
|
74
|
-
const newSourceOrigin = extensionsHelper_1.getSourceOrigin(updateSource);
|
|
73
|
+
const existingSourceOrigin = await (0, updateHelper_1.getExistingSourceOrigin)(projectId, instanceId, existingSpec.name, existingSource);
|
|
74
|
+
const newSourceOrigin = (0, extensionsHelper_1.getSourceOrigin)(updateSource);
|
|
75
75
|
const validUpdate = isValidUpdate(existingSourceOrigin, newSourceOrigin);
|
|
76
76
|
if (!validUpdate) {
|
|
77
77
|
throw new error_1.FirebaseError(`Cannot update from a(n) ${existingSourceOrigin} to a(n) ${newSourceOrigin}. Please provide a new source that is a(n) ${existingSourceOrigin} and try again.`);
|
|
@@ -79,24 +79,24 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
79
79
|
switch (newSourceOrigin) {
|
|
80
80
|
case extensionsHelper_1.SourceOrigin.LOCAL:
|
|
81
81
|
if (previews_1.previews.extdev) {
|
|
82
|
-
newSourceName = await updateHelper_1.updateFromLocalSource(projectId, instanceId, updateSource, existingSpec);
|
|
82
|
+
newSourceName = await (0, updateHelper_1.updateFromLocalSource)(projectId, instanceId, updateSource, existingSpec);
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
case extensionsHelper_1.SourceOrigin.URL:
|
|
86
86
|
if (previews_1.previews.extdev) {
|
|
87
|
-
newSourceName = await updateHelper_1.updateFromUrlSource(projectId, instanceId, updateSource, existingSpec);
|
|
87
|
+
newSourceName = await (0, updateHelper_1.updateFromUrlSource)(projectId, instanceId, updateSource, existingSpec);
|
|
88
88
|
break;
|
|
89
89
|
}
|
|
90
90
|
case extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION_VERSION:
|
|
91
|
-
newSourceName = await updateHelper_1.updateToVersionFromPublisherSource(projectId, instanceId, updateSource, existingSpec);
|
|
91
|
+
newSourceName = await (0, updateHelper_1.updateToVersionFromPublisherSource)(projectId, instanceId, updateSource, existingSpec);
|
|
92
92
|
break;
|
|
93
93
|
case extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION:
|
|
94
|
-
newSourceName = await updateHelper_1.updateFromPublisherSource(projectId, instanceId, updateSource, existingSpec);
|
|
94
|
+
newSourceName = await (0, updateHelper_1.updateFromPublisherSource)(projectId, instanceId, updateSource, existingSpec);
|
|
95
95
|
break;
|
|
96
96
|
default:
|
|
97
97
|
throw new error_1.FirebaseError(`Unknown source '${clc.bold(updateSource)}.'`);
|
|
98
98
|
}
|
|
99
|
-
if (!(await extensionsHelper_1.confirm({
|
|
99
|
+
if (!(await (0, extensionsHelper_1.confirm)({
|
|
100
100
|
nonInteractive: options.nonInteractive,
|
|
101
101
|
force: options.force,
|
|
102
102
|
default: true,
|
|
@@ -108,7 +108,7 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
108
108
|
if (![extensionsHelper_1.SourceOrigin.LOCAL, extensionsHelper_1.SourceOrigin.URL].includes(newSourceOrigin) &&
|
|
109
109
|
existingSpec.version === newSpec.version) {
|
|
110
110
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `${clc.bold(instanceId)} is already up to date. Its version is ${clc.bold(existingSpec.version)}.`);
|
|
111
|
-
const retry = await extensionsHelper_1.confirm({
|
|
111
|
+
const retry = await (0, extensionsHelper_1.confirm)({
|
|
112
112
|
nonInteractive: options.nonInteractive,
|
|
113
113
|
force: options.force,
|
|
114
114
|
default: false,
|
|
@@ -118,7 +118,7 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
await updateHelper_1.displayChanges({
|
|
121
|
+
await (0, updateHelper_1.displayChanges)({
|
|
122
122
|
spec: existingSpec,
|
|
123
123
|
newSpec: newSpec,
|
|
124
124
|
nonInteractive: options.nonInteractive,
|
|
@@ -127,9 +127,9 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
127
127
|
await provisioningHelper.checkProductsProvisioned(projectId, newSpec);
|
|
128
128
|
const usesSecrets = secretsUtils.usesSecrets(newSpec);
|
|
129
129
|
if (newSpec.billingRequired || usesSecrets) {
|
|
130
|
-
const enabled = await cloudbilling_1.checkBillingEnabled(projectId);
|
|
131
|
-
billingMigrationHelper_1.displayNode10UpdateBillingNotice(existingSpec, newSpec);
|
|
132
|
-
if (!(await extensionsHelper_1.confirm({
|
|
130
|
+
const enabled = await (0, cloudbilling_1.checkBillingEnabled)(projectId);
|
|
131
|
+
(0, billingMigrationHelper_1.displayNode10UpdateBillingNotice)(existingSpec, newSpec);
|
|
132
|
+
if (!(await (0, extensionsHelper_1.confirm)({
|
|
133
133
|
nonInteractive: options.nonInteractive,
|
|
134
134
|
force: options.force,
|
|
135
135
|
default: true,
|
|
@@ -138,7 +138,7 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
138
138
|
}
|
|
139
139
|
if (!enabled) {
|
|
140
140
|
if (!options.nonInteractive) {
|
|
141
|
-
await checkProjectBilling_1.enableBilling(projectId);
|
|
141
|
+
await (0, checkProjectBilling_1.enableBilling)(projectId);
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
144
|
throw new error_1.FirebaseError("The extension requires your project to be upgraded to the Blaze plan. " +
|
|
@@ -174,7 +174,7 @@ exports.default = new command_1.Command("ext:update <extensionInstanceId> [updat
|
|
|
174
174
|
if (!_.isEqual(newParams, oldParamValues)) {
|
|
175
175
|
updateOptions.params = newParams;
|
|
176
176
|
}
|
|
177
|
-
await updateHelper_1.update(updateOptions);
|
|
177
|
+
await (0, updateHelper_1.update)(updateOptions);
|
|
178
178
|
spinner.stop();
|
|
179
179
|
utils.logLabeledSuccess(extensionsHelper_1.logPrefix, `successfully updated ${clc.bold(instanceId)}.`);
|
|
180
180
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`You can view your updated instance in the Firebase console: ${utils.consoleUrl(projectId, `/extensions/instances/${instanceId}?tab=usage`)}`));
|
package/lib/commands/ext.js
CHANGED
|
@@ -31,9 +31,9 @@ module.exports = new command_1.Command("ext")
|
|
|
31
31
|
});
|
|
32
32
|
logger_1.logger.info();
|
|
33
33
|
try {
|
|
34
|
-
await requirePermissions_1.requirePermissions(options, ["firebaseextensions.instances.list"]);
|
|
35
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
36
|
-
return listExtensions_1.listExtensions(projectId);
|
|
34
|
+
await (0, requirePermissions_1.requirePermissions)(options, ["firebaseextensions.instances.list"]);
|
|
35
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
36
|
+
return (0, listExtensions_1.listExtensions)(projectId);
|
|
37
37
|
}
|
|
38
38
|
catch (err) {
|
|
39
39
|
return;
|
|
@@ -54,7 +54,7 @@ module.exports = new command_1.Command("firestore:delete [path]")
|
|
|
54
54
|
"subcollections. May not be passed along with -r.")
|
|
55
55
|
.option("--all-collections", "Delete all. Deletes the entire Firestore database, " +
|
|
56
56
|
"including all collections and documents. Any other flags or arguments will be ignored.")
|
|
57
|
-
.option("-
|
|
57
|
+
.option("-f, --force", "No confirmation. Otherwise, a confirmation prompt will appear.")
|
|
58
58
|
.before(commandUtils_1.printNoticeIfEmulated, types_1.Emulators.FIRESTORE)
|
|
59
59
|
.before(requirePermissions_1.requirePermissions, ["datastore.entities.list", "datastore.entities.delete"])
|
|
60
60
|
.action(async (path, options) => {
|
|
@@ -66,9 +66,9 @@ module.exports = new command_1.Command("firestore:delete [path]")
|
|
|
66
66
|
shallow: options.shallow,
|
|
67
67
|
allCollections: options.allCollections,
|
|
68
68
|
});
|
|
69
|
-
const confirm = await prompt_1.promptOnce({
|
|
69
|
+
const confirm = await (0, prompt_1.promptOnce)({
|
|
70
70
|
type: "confirm",
|
|
71
|
-
name: "
|
|
71
|
+
name: "force",
|
|
72
72
|
default: false,
|
|
73
73
|
message: getConfirmationMessage(deleteOp, options),
|
|
74
74
|
}, options);
|
|
@@ -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", ".");
|
|
@@ -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}`;
|
|
@@ -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
|
});
|
|
@@ -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", marked_1.default(`Unable to remove channel domain from Firebase Auth. Visit the Firebase Console at ${utils_1.consoleUrl(projectId, "/authentication/providers")}`));
|
|
41
|
+
(0, utils_1.logLabeledWarning)("hosting:channel", (0, marked_1.default)(`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
|
});
|
|
@@ -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 };
|
|
@@ -20,26 +20,26 @@ exports.default = new command_1.Command("hosting:channel:open [channelId]")
|
|
|
20
20
|
.before(requirePermissions_1.requirePermissions, ["firebasehosting.sites.get"])
|
|
21
21
|
.before(requireHostingSite_1.requireHostingSite)
|
|
22
22
|
.action(async (channelId, options) => {
|
|
23
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
23
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
24
24
|
const siteId = options.site;
|
|
25
25
|
if (!channelId) {
|
|
26
26
|
if (options.nonInteractive) {
|
|
27
27
|
throw new error_1.FirebaseError(`Please provide a channelId.`);
|
|
28
28
|
}
|
|
29
|
-
const channels = await api_1.listChannels(projectId, siteId);
|
|
30
|
-
lodash_1.sortBy(channels, ["name"]);
|
|
31
|
-
channelId = await prompt_1.promptOnce({
|
|
29
|
+
const channels = await (0, api_1.listChannels)(projectId, siteId);
|
|
30
|
+
(0, lodash_1.sortBy)(channels, ["name"]);
|
|
31
|
+
channelId = await (0, prompt_1.promptOnce)({
|
|
32
32
|
type: "list",
|
|
33
33
|
message: "Which channel would you like to open?",
|
|
34
|
-
choices: channels.map((c) => lodash_1.last(c.name.split("/")) || c.name),
|
|
34
|
+
choices: channels.map((c) => (0, lodash_1.last)(c.name.split("/")) || c.name),
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
channelId = api_1.normalizeName(channelId);
|
|
38
|
-
const channel = await api_1.getChannel(projectId, siteId, channelId);
|
|
37
|
+
channelId = (0, api_1.normalizeName)(channelId);
|
|
38
|
+
const channel = await (0, api_1.getChannel)(projectId, siteId, channelId);
|
|
39
39
|
if (!channel) {
|
|
40
|
-
throw new error_1.FirebaseError(`Could not find the channel ${cli_color_1.bold(channelId)} for site ${cli_color_1.bold(siteId)}.`);
|
|
40
|
+
throw new error_1.FirebaseError(`Could not find the channel ${(0, cli_color_1.bold)(channelId)} for site ${(0, cli_color_1.bold)(siteId)}.`);
|
|
41
41
|
}
|
|
42
|
-
utils_1.logLabeledBullet("hosting:channel", channel.url);
|
|
42
|
+
(0, utils_1.logLabeledBullet)("hosting:channel", channel.url);
|
|
43
43
|
if (!options.nonInteractive) {
|
|
44
44
|
open(channel.url);
|
|
45
45
|
}
|