firebase-tools 10.0.1 → 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 -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/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 +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 +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 +1 -1
- 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 +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.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 +4 -4
- 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 +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 +6 -6
- package/lib/deploy/functions/runtimes/node/index.js +3 -3
- 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 +2 -2
- package/lib/emulator/emulatorLogger.js +1 -1
- package/lib/emulator/functionsEmulator.js +101 -74
- package/lib/emulator/functionsEmulatorRuntime.js +32 -17
- 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 +23 -23
- package/standalone/firepit.js +4 -4
- package/templates/init/hosting/index.html +1 -1
package/lib/functional.js
CHANGED
|
@@ -48,9 +48,10 @@ function* zip(left, right) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
exports.zip = zip;
|
|
51
|
-
|
|
51
|
+
const zipIn = (other) => (elem, ndx) => {
|
|
52
52
|
return [elem, other[ndx]];
|
|
53
53
|
};
|
|
54
|
+
exports.zipIn = zipIn;
|
|
54
55
|
function assertExhaustive(val) {
|
|
55
56
|
throw new Error(`Never has a value (${val}). This should be impossible`);
|
|
56
57
|
}
|
package/lib/functions/env.js
CHANGED
|
@@ -165,7 +165,7 @@ function loadUserEnvs({ functionsSource, projectId, projectAlias, isEmulator, })
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
utils_1.logBullet(clc.cyan.bold("functions: ") + `Loaded environment variables from ${envFiles.join(", ")}.`);
|
|
168
|
+
(0, utils_1.logBullet)(clc.cyan.bold("functions: ") + `Loaded environment variables from ${envFiles.join(", ")}.`);
|
|
169
169
|
return envs;
|
|
170
170
|
}
|
|
171
171
|
exports.loadUserEnvs = loadUserEnvs;
|
|
@@ -12,18 +12,18 @@ const utils_1 = require("../utils");
|
|
|
12
12
|
const functional_1 = require("../functional");
|
|
13
13
|
function getProjectInfos(options) {
|
|
14
14
|
const result = {};
|
|
15
|
-
const rc = rc_1.loadRC(options);
|
|
15
|
+
const rc = (0, rc_1.loadRC)(options);
|
|
16
16
|
if (rc.projects) {
|
|
17
17
|
for (const [alias, projectId] of Object.entries(rc.projects)) {
|
|
18
18
|
if (Object.keys(result).includes(projectId)) {
|
|
19
|
-
utils_1.logWarning(`Multiple aliases found for ${clc.bold(projectId)}. ` +
|
|
19
|
+
(0, utils_1.logWarning)(`Multiple aliases found for ${clc.bold(projectId)}. ` +
|
|
20
20
|
`Preferring alias (${clc.bold(result[projectId])}) over (${clc.bold(alias)}).`);
|
|
21
21
|
continue;
|
|
22
22
|
}
|
|
23
23
|
result[projectId] = alias;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
const projectId = projectUtils_1.getProjectId(options);
|
|
26
|
+
const projectId = (0, projectUtils_1.getProjectId)(options);
|
|
27
27
|
if (projectId && !Object.keys(result).includes(projectId)) {
|
|
28
28
|
result[projectId] = projectId;
|
|
29
29
|
}
|
|
@@ -72,7 +72,7 @@ exports.convertKey = convertKey;
|
|
|
72
72
|
function configToEnv(configs, prefix) {
|
|
73
73
|
const success = [];
|
|
74
74
|
const errors = [];
|
|
75
|
-
for (const [configKey, value] of functional_1.flatten(configs)) {
|
|
75
|
+
for (const [configKey, value] of (0, functional_1.flatten)(configs)) {
|
|
76
76
|
try {
|
|
77
77
|
const envKey = convertKey(configKey, prefix);
|
|
78
78
|
success.push({ origKey: configKey, newKey: envKey, value: value });
|
package/lib/functionsConfig.js
CHANGED
|
@@ -30,8 +30,8 @@ function isReservedNamespace(id) {
|
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
async function ensureApi(options) {
|
|
33
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
34
|
-
return ensureApiEnabled_1.ensure(projectId, "runtimeconfig.googleapis.com", "runtimeconfig", true);
|
|
33
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
34
|
+
return (0, ensureApiEnabled_1.ensure)(projectId, "runtimeconfig.googleapis.com", "runtimeconfig", true);
|
|
35
35
|
}
|
|
36
36
|
exports.ensureApi = ensureApi;
|
|
37
37
|
function varNameToIds(varName) {
|
|
@@ -54,7 +54,7 @@ function getAppEngineLocation(config) {
|
|
|
54
54
|
}
|
|
55
55
|
exports.getAppEngineLocation = getAppEngineLocation;
|
|
56
56
|
async function getFirebaseConfig(options) {
|
|
57
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
57
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
58
58
|
const response = await api.request("GET", "/v1beta1/projects/" + projectId + "/adminSdkConfig", {
|
|
59
59
|
auth: true,
|
|
60
60
|
origin: api.firebaseApiOrigin,
|
|
@@ -16,7 +16,7 @@ const types_1 = require("./emulator/types");
|
|
|
16
16
|
const hubClient_1 = require("./emulator/hubClient");
|
|
17
17
|
const portUtils_1 = require("./emulator/portUtils");
|
|
18
18
|
const serveFunctions = new functions_1.FunctionsServer();
|
|
19
|
-
|
|
19
|
+
const actionFunction = async (options) => {
|
|
20
20
|
var _a, _b;
|
|
21
21
|
if (typeof options.port === "string") {
|
|
22
22
|
options.port = parseInt(options.port, 10);
|
|
@@ -42,7 +42,7 @@ exports.actionFunction = async (options) => {
|
|
|
42
42
|
options.port = (_b = (_a = options.config.src.emulators) === null || _a === void 0 ? void 0 : _a.functions) === null || _b === void 0 ? void 0 : _b.port;
|
|
43
43
|
}
|
|
44
44
|
if (!options.port) {
|
|
45
|
-
options.port = await portUtils_1.findAvailablePort("localhost", 5000);
|
|
45
|
+
options.port = await (0, portUtils_1.findAvailablePort)("localhost", 5000);
|
|
46
46
|
}
|
|
47
47
|
return serveFunctions
|
|
48
48
|
.start(options, {
|
|
@@ -55,7 +55,7 @@ exports.actionFunction = async (options) => {
|
|
|
55
55
|
})
|
|
56
56
|
.then(() => {
|
|
57
57
|
const instance = serveFunctions.get();
|
|
58
|
-
const emulator = new shell.FunctionsEmulatorShell(instance);
|
|
58
|
+
const emulator = new shell.FunctionsEmulatorShell(instance, serveFunctions.getBackend());
|
|
59
59
|
if (emulator.emulatedFunctions && emulator.emulatedFunctions.length === 0) {
|
|
60
60
|
logger_1.logger.info("No functions emulated.");
|
|
61
61
|
process.exit();
|
|
@@ -98,3 +98,4 @@ exports.actionFunction = async (options) => {
|
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
};
|
|
101
|
+
exports.actionFunction = actionFunction;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.queryTimeSeries = exports.ValueType = exports.Reducer = exports.MetricKind = exports.Aligner = exports.TimeSeriesView = exports.CLOUD_MONITORING_VERSION = void 0;
|
|
4
|
+
const api = require("../api");
|
|
5
|
+
const error_1 = require("../error");
|
|
6
|
+
exports.CLOUD_MONITORING_VERSION = "v3";
|
|
7
|
+
var TimeSeriesView;
|
|
8
|
+
(function (TimeSeriesView) {
|
|
9
|
+
TimeSeriesView["FULL"] = "FULL";
|
|
10
|
+
TimeSeriesView["HEADERS"] = "HEADERS";
|
|
11
|
+
})(TimeSeriesView = exports.TimeSeriesView || (exports.TimeSeriesView = {}));
|
|
12
|
+
var Aligner;
|
|
13
|
+
(function (Aligner) {
|
|
14
|
+
Aligner["ALIGN_NONE"] = "ALIGN_NONE";
|
|
15
|
+
Aligner["ALIGN_DELTA"] = "ALIGN_DELTA";
|
|
16
|
+
Aligner["ALIGN_RATE"] = "ALIGN_RATE";
|
|
17
|
+
Aligner["ALIGN_INTERPOLATE"] = "ALIGN_INTERPOLATE";
|
|
18
|
+
Aligner["ALIGN_NEXT_OLDER"] = "ALIGN_NEXT_OLDER";
|
|
19
|
+
Aligner["ALIGN_MIN"] = "ALIGN_MIN";
|
|
20
|
+
Aligner["ALIGN_MAX"] = "ALIGN_MAX";
|
|
21
|
+
Aligner["ALIGN_MEAN"] = "ALIGN_MEAN";
|
|
22
|
+
Aligner["ALIGN_COUNT"] = "ALIGN_COUNT";
|
|
23
|
+
Aligner["ALIGN_SUM"] = "ALIGN_SUM";
|
|
24
|
+
Aligner["ALIGN_STDDEV"] = "ALIGN_STDDEV";
|
|
25
|
+
Aligner["ALIGN_COUNT_TRUE"] = "ALIGN_COUNT_TRUE";
|
|
26
|
+
Aligner["ALIGN_FRACTION_TRUE"] = "ALIGN_FRACTION_TRUE";
|
|
27
|
+
})(Aligner = exports.Aligner || (exports.Aligner = {}));
|
|
28
|
+
var MetricKind;
|
|
29
|
+
(function (MetricKind) {
|
|
30
|
+
MetricKind["METRIC_KIND_UNSPECIFIED"] = "METRIC_KIND_UNSPECIFIED";
|
|
31
|
+
MetricKind["GAUGE"] = "GAUGE";
|
|
32
|
+
MetricKind["DELTA"] = "DELTA";
|
|
33
|
+
MetricKind["CUMULATIVE"] = "CUMULATIVE";
|
|
34
|
+
})(MetricKind = exports.MetricKind || (exports.MetricKind = {}));
|
|
35
|
+
var Reducer;
|
|
36
|
+
(function (Reducer) {
|
|
37
|
+
Reducer["REDUCE_NONE"] = "REDUCE_NONE";
|
|
38
|
+
Reducer["REDUCE_MEAN"] = "REDUCE_MEAN";
|
|
39
|
+
Reducer["REDUCE_MIN"] = "REDUCE_MIN";
|
|
40
|
+
Reducer["REDUCE_MAX"] = "REDUCE_MAX";
|
|
41
|
+
Reducer["REDUCE_SUM"] = "REDUCE_SUM";
|
|
42
|
+
Reducer["REDUCE_STDDEV"] = "REDUCE_STDDEV";
|
|
43
|
+
Reducer["REDUCE_COUNT"] = "REDUCE_COUNT";
|
|
44
|
+
Reducer["REDUCE_COUNT_TRUE"] = "REDUCE_COUNT_TRUE";
|
|
45
|
+
Reducer["REDUCE_FRACTION_TRUE"] = "REDUCE_FRACTION_TRUE";
|
|
46
|
+
Reducer["REDUCE_PERCENTILE_99"] = "REDUCE_PERCENTILE_99";
|
|
47
|
+
Reducer["REDUCE_PERCENTILE_95"] = "REDUCE_PERCENTILE_95";
|
|
48
|
+
Reducer["REDUCE_PERCENTILE_50"] = "REDUCE_PERCENTILE_50";
|
|
49
|
+
Reducer["REDUCE_PERCENTILE_05"] = "REDUCE_PERCENTILE_05";
|
|
50
|
+
})(Reducer = exports.Reducer || (exports.Reducer = {}));
|
|
51
|
+
var ValueType;
|
|
52
|
+
(function (ValueType) {
|
|
53
|
+
ValueType["VALUE_TYPE_UNSPECIFIED"] = "VALUE_TYPE_UNSPECIFIED";
|
|
54
|
+
ValueType["BOOL"] = "BOOL";
|
|
55
|
+
ValueType["INT64"] = "INT64";
|
|
56
|
+
ValueType["DOUBLE"] = "DOUBLE";
|
|
57
|
+
ValueType["STRING"] = "STRING";
|
|
58
|
+
})(ValueType = exports.ValueType || (exports.ValueType = {}));
|
|
59
|
+
async function queryTimeSeries(query, projectNumber) {
|
|
60
|
+
try {
|
|
61
|
+
const res = await api.request("GET", `/${exports.CLOUD_MONITORING_VERSION}/projects/${projectNumber}/timeSeries/`, {
|
|
62
|
+
auth: true,
|
|
63
|
+
origin: api.cloudMonitoringOrigin,
|
|
64
|
+
data: query,
|
|
65
|
+
});
|
|
66
|
+
return res.body.timeSeries;
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
throw new error_1.FirebaseError(`Failed to get extension usage: ${err}`, {
|
|
70
|
+
status: err.status,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.queryTimeSeries = queryTimeSeries;
|
|
@@ -104,7 +104,7 @@ function jobFromEndpoint(endpoint, appEngineLocation) {
|
|
|
104
104
|
throw new error_1.FirebaseError("Do not know how to create a scheduled GCFv2 function");
|
|
105
105
|
}
|
|
106
106
|
else {
|
|
107
|
-
functional_1.assertExhaustive(endpoint.platform);
|
|
107
|
+
(0, functional_1.assertExhaustive)(endpoint.platform);
|
|
108
108
|
}
|
|
109
109
|
proto.copyIfPresent(job, endpoint.scheduleTrigger, "schedule", "retryConfig", "timeZone");
|
|
110
110
|
return job;
|
package/lib/gcp/iam.js
CHANGED
|
@@ -50,7 +50,7 @@ function deleteServiceAccount(projectId, accountEmail) {
|
|
|
50
50
|
}
|
|
51
51
|
exports.deleteServiceAccount = deleteServiceAccount;
|
|
52
52
|
async function getRole(role) {
|
|
53
|
-
const response = await api.request("GET", utils_1.endpoint([API_VERSION, "roles", role]), {
|
|
53
|
+
const response = await api.request("GET", (0, utils_1.endpoint)([API_VERSION, "roles", role]), {
|
|
54
54
|
auth: true,
|
|
55
55
|
origin: api.iamOrigin,
|
|
56
56
|
retryCodes: [500, 503],
|
|
@@ -69,7 +69,7 @@ async function testResourceIamPermissions(origin, apiVersion, resourceName, perm
|
|
|
69
69
|
origin,
|
|
70
70
|
});
|
|
71
71
|
const allowed = (response.body.permissions || []).sort();
|
|
72
|
-
const missing = lodash_1.difference(permissions, allowed);
|
|
72
|
+
const missing = (0, lodash_1.difference)(permissions, allowed);
|
|
73
73
|
return {
|
|
74
74
|
allowed,
|
|
75
75
|
missing,
|
|
@@ -33,12 +33,12 @@ async function setIamPolicy(projectId, newPolicy, updateMask) {
|
|
|
33
33
|
exports.setIamPolicy = setIamPolicy;
|
|
34
34
|
async function addServiceAccountToRoles(projectId, serviceAccountName, roles) {
|
|
35
35
|
const [{ name: fullServiceAccountName }, projectPolicy] = await Promise.all([
|
|
36
|
-
iam_1.getServiceAccount(projectId, serviceAccountName),
|
|
36
|
+
(0, iam_1.getServiceAccount)(projectId, serviceAccountName),
|
|
37
37
|
getIamPolicy(projectId),
|
|
38
38
|
]);
|
|
39
39
|
const newMemberName = `serviceAccount:${fullServiceAccountName.split("/").pop()}`;
|
|
40
40
|
roles.forEach((roleName) => {
|
|
41
|
-
let bindingIndex = lodash_1.findIndex(projectPolicy.bindings, (binding) => binding.role === roleName);
|
|
41
|
+
let bindingIndex = (0, lodash_1.findIndex)(projectPolicy.bindings, (binding) => binding.role === roleName);
|
|
42
42
|
if (bindingIndex === -1) {
|
|
43
43
|
bindingIndex =
|
|
44
44
|
projectPolicy.bindings.push({
|
package/lib/gcp/secretManager.js
CHANGED
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.grantServiceAgentRole = exports.addVersion = exports.createSecret = exports.toSecretVersionResourceName = exports.parseSecretVersionResourceName = exports.parseSecretResourceName = exports.secretExists = exports.getSecretVersion = exports.getSecret = exports.listSecrets = exports.secretManagerConsoleUri = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const api = require("../api");
|
|
6
|
-
|
|
6
|
+
const secretManagerConsoleUri = (projectId) => `https://console.cloud.google.com/security/secret-manager?project=${projectId}`;
|
|
7
|
+
exports.secretManagerConsoleUri = secretManagerConsoleUri;
|
|
7
8
|
async function listSecrets(projectId) {
|
|
8
9
|
const listRes = await api.request("GET", `/v1beta1/projects/${projectId}/secrets`, {
|
|
9
10
|
auth: true,
|
|
@@ -127,6 +128,6 @@ async function grantServiceAgentRole(secret, serviceAccountEmail, role) {
|
|
|
127
128
|
},
|
|
128
129
|
},
|
|
129
130
|
});
|
|
130
|
-
utils_1.logLabeledSuccess("SecretManager", `Granted ${role} on projects/${secret.projectId}/secrets/${secret.name} to ${serviceAccountEmail}`);
|
|
131
|
+
(0, utils_1.logLabeledSuccess)("SecretManager", `Granted ${role} on projects/${secret.projectId}/secrets/${secret.name} to ${serviceAccountEmail}`);
|
|
131
132
|
}
|
|
132
133
|
exports.grantServiceAgentRole = grantServiceAgentRole;
|
|
@@ -4,7 +4,7 @@ exports.getDefaultDatabaseInstance = void 0;
|
|
|
4
4
|
const projects_1 = require("./management/projects");
|
|
5
5
|
async function getDefaultDatabaseInstance(options) {
|
|
6
6
|
var _a;
|
|
7
|
-
const projectDetails = await projects_1.getFirebaseProject(options.project);
|
|
7
|
+
const projectDetails = await (0, projects_1.getFirebaseProject)(options.project);
|
|
8
8
|
return ((_a = projectDetails.resources) === null || _a === void 0 ? void 0 : _a.realtimeDatabaseInstance) || "";
|
|
9
9
|
}
|
|
10
10
|
exports.getDefaultDatabaseInstance = getDefaultDatabaseInstance;
|
|
@@ -5,7 +5,7 @@ const logger_1 = require("./logger");
|
|
|
5
5
|
const projects_1 = require("./management/projects");
|
|
6
6
|
async function getDefaultHostingSite(options) {
|
|
7
7
|
var _a;
|
|
8
|
-
const project = await projects_1.getFirebaseProject(options.project);
|
|
8
|
+
const project = await (0, projects_1.getFirebaseProject)(options.project);
|
|
9
9
|
const site = (_a = project.resources) === null || _a === void 0 ? void 0 : _a.hostingSite;
|
|
10
10
|
if (!site) {
|
|
11
11
|
logger_1.logger.debug(`No default hosting site found for project: ${options.project}. Using projectId as hosting site name.`);
|
package/lib/getProjectNumber.js
CHANGED
|
@@ -7,8 +7,8 @@ async function getProjectNumber(options) {
|
|
|
7
7
|
if (options.projectNumber) {
|
|
8
8
|
return options.projectNumber;
|
|
9
9
|
}
|
|
10
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
11
|
-
const metadata = await projects_1.getFirebaseProject(projectId);
|
|
10
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
11
|
+
const metadata = await (0, projects_1.getFirebaseProject)(projectId);
|
|
12
12
|
options.projectNumber = metadata.projectNumber;
|
|
13
13
|
return options.projectNumber;
|
|
14
14
|
}
|
|
@@ -6,14 +6,14 @@ const cli_color_1 = require("cli-color");
|
|
|
6
6
|
const configstore_1 = require("./configstore");
|
|
7
7
|
const previews_1 = require("./previews");
|
|
8
8
|
function _errorOut(name) {
|
|
9
|
-
console.log(cli_color_1.bold.red("Error:"), "Did not recognize preview feature", cli_color_1.bold(name));
|
|
9
|
+
console.log(cli_color_1.bold.red("Error:"), "Did not recognize preview feature", (0, cli_color_1.bold)(name));
|
|
10
10
|
process.exit(1);
|
|
11
11
|
}
|
|
12
12
|
function handlePreviewToggles(args) {
|
|
13
|
-
const isValidPreview = lodash_1.has(previews_1.previews, args[1]);
|
|
13
|
+
const isValidPreview = (0, lodash_1.has)(previews_1.previews, args[1]);
|
|
14
14
|
if (args[0] === "--open-sesame") {
|
|
15
15
|
if (isValidPreview) {
|
|
16
|
-
console.log("Enabling preview feature", cli_color_1.bold(args[1]) + "...");
|
|
16
|
+
console.log("Enabling preview feature", (0, cli_color_1.bold)(args[1]) + "...");
|
|
17
17
|
previews_1.previews[args[1]] = true;
|
|
18
18
|
configstore_1.configstore.set("previews", previews_1.previews);
|
|
19
19
|
console.log("Preview feature enabled!");
|
|
@@ -23,8 +23,8 @@ function handlePreviewToggles(args) {
|
|
|
23
23
|
}
|
|
24
24
|
else if (args[0] === "--close-sesame") {
|
|
25
25
|
if (isValidPreview) {
|
|
26
|
-
console.log("Disabling preview feature", cli_color_1.bold(args[1]));
|
|
27
|
-
lodash_1.unset(previews_1.previews, args[1]);
|
|
26
|
+
console.log("Disabling preview feature", (0, cli_color_1.bold)(args[1]));
|
|
27
|
+
(0, lodash_1.unset)(previews_1.previews, args[1]);
|
|
28
28
|
configstore_1.configstore.set("previews", previews_1.previews);
|
|
29
29
|
return process.exit(0);
|
|
30
30
|
}
|
package/lib/hosting/api.js
CHANGED
|
@@ -174,7 +174,7 @@ async function deleteSite(project, site) {
|
|
|
174
174
|
}
|
|
175
175
|
exports.deleteSite = deleteSite;
|
|
176
176
|
async function addAuthDomains(project, urls) {
|
|
177
|
-
const domains = await auth_1.getAuthDomains(project);
|
|
177
|
+
const domains = await (0, auth_1.getAuthDomains)(project);
|
|
178
178
|
const authDomains = domains || [];
|
|
179
179
|
for (const url of urls) {
|
|
180
180
|
const domain = url.replace("https://", "");
|
|
@@ -183,17 +183,17 @@ async function addAuthDomains(project, urls) {
|
|
|
183
183
|
}
|
|
184
184
|
authDomains.push(domain);
|
|
185
185
|
}
|
|
186
|
-
return await auth_1.updateAuthDomains(project, authDomains);
|
|
186
|
+
return await (0, auth_1.updateAuthDomains)(project, authDomains);
|
|
187
187
|
}
|
|
188
188
|
exports.addAuthDomains = addAuthDomains;
|
|
189
189
|
async function removeAuthDomain(project, url) {
|
|
190
|
-
const domains = await auth_1.getAuthDomains(project);
|
|
190
|
+
const domains = await (0, auth_1.getAuthDomains)(project);
|
|
191
191
|
if (!domains.length) {
|
|
192
192
|
return domains;
|
|
193
193
|
}
|
|
194
194
|
const targetDomain = url.replace("https://", "");
|
|
195
195
|
const authDomains = domains.filter((domain) => domain != targetDomain);
|
|
196
|
-
return auth_1.updateAuthDomains(project, authDomains);
|
|
196
|
+
return (0, auth_1.updateAuthDomains)(project, authDomains);
|
|
197
197
|
}
|
|
198
198
|
exports.removeAuthDomain = removeAuthDomain;
|
|
199
199
|
async function getCleanDomains(project, site) {
|
|
@@ -206,7 +206,7 @@ async function getCleanDomains(project, site) {
|
|
|
206
206
|
}, {});
|
|
207
207
|
const siteMatch = new RegExp(`${site}--`, "i");
|
|
208
208
|
const firebaseAppMatch = new RegExp(/firebaseapp.com$/);
|
|
209
|
-
const domains = await auth_1.getAuthDomains(project);
|
|
209
|
+
const domains = await (0, auth_1.getAuthDomains)(project);
|
|
210
210
|
const authDomains = [];
|
|
211
211
|
domains.forEach((domain) => {
|
|
212
212
|
const endsWithFirebaseApp = firebaseAppMatch.test(domain);
|
|
@@ -227,7 +227,7 @@ async function cleanAuthState(project, sites) {
|
|
|
227
227
|
const siteDomainMap = new Map();
|
|
228
228
|
for (const site of sites) {
|
|
229
229
|
const authDomains = await getCleanDomains(project, site);
|
|
230
|
-
const updatedDomains = await auth_1.updateAuthDomains(project, authDomains);
|
|
230
|
+
const updatedDomains = await (0, auth_1.updateAuthDomains)(project, authDomains);
|
|
231
231
|
siteDomainMap.set(site, updatedDomains);
|
|
232
232
|
}
|
|
233
233
|
return siteDomainMap;
|
|
@@ -13,9 +13,9 @@ function getCloudRunUrl(rewrite, projectId) {
|
|
|
13
13
|
}
|
|
14
14
|
const path = `/v1/projects/${projectId}/locations/${rewrite.run.region || "us-central1"}/services/${rewrite.run.serviceId}`;
|
|
15
15
|
logger_1.logger.info(`[hosting] Looking up Cloud Run service "${path}" for its URL`);
|
|
16
|
-
return api_1.request("GET", path, { origin: api_1.cloudRunApiOrigin, auth: true })
|
|
16
|
+
return (0, api_1.request)("GET", path, { origin: api_1.cloudRunApiOrigin, auth: true })
|
|
17
17
|
.then((res) => {
|
|
18
|
-
const url = lodash_1.get(res, "body.status.url");
|
|
18
|
+
const url = (0, lodash_1.get)(res, "body.status.url");
|
|
19
19
|
if (!url) {
|
|
20
20
|
return Promise.reject("Cloud Run URL doesn't exist in response.");
|
|
21
21
|
}
|
|
@@ -30,18 +30,18 @@ function getCloudRunUrl(rewrite, projectId) {
|
|
|
30
30
|
function default_1(options) {
|
|
31
31
|
return async (rewrite) => {
|
|
32
32
|
if (!rewrite.run) {
|
|
33
|
-
return proxy_1.errorRequestHandler('Cloud Run rewrites must have a valid "run" field.');
|
|
33
|
+
return (0, proxy_1.errorRequestHandler)('Cloud Run rewrites must have a valid "run" field.');
|
|
34
34
|
}
|
|
35
35
|
if (!rewrite.run.serviceId) {
|
|
36
|
-
return proxy_1.errorRequestHandler("Cloud Run rewrites must supply a service ID.");
|
|
36
|
+
return (0, proxy_1.errorRequestHandler)("Cloud Run rewrites must supply a service ID.");
|
|
37
37
|
}
|
|
38
38
|
if (!rewrite.run.region) {
|
|
39
39
|
rewrite.run.region = "us-central1";
|
|
40
40
|
}
|
|
41
41
|
logger_1.logger.info(`[hosting] Cloud Run rewrite ${JSON.stringify(rewrite)} triggered`);
|
|
42
42
|
const textIdentifier = `Cloud Run service "${rewrite.run.serviceId}" for region "${rewrite.run.region}"`;
|
|
43
|
-
return getCloudRunUrl(rewrite, projectUtils_1.needProjectId(options))
|
|
44
|
-
.then((url) => proxy_1.proxyRequestHandler(url, textIdentifier))
|
|
43
|
+
return getCloudRunUrl(rewrite, (0, projectUtils_1.needProjectId)(options))
|
|
44
|
+
.then((url) => (0, proxy_1.proxyRequestHandler)(url, textIdentifier))
|
|
45
45
|
.catch(proxy_1.errorRequestHandler);
|
|
46
46
|
};
|
|
47
47
|
}
|
|
@@ -9,17 +9,17 @@ const functionsEmulator_1 = require("../emulator/functionsEmulator");
|
|
|
9
9
|
function default_1(options) {
|
|
10
10
|
return (rewrite) => {
|
|
11
11
|
return new Promise((resolve) => {
|
|
12
|
-
const projectId = projectUtils_1.needProjectId(options);
|
|
12
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
13
13
|
let url = `https://us-central1-${projectId}.cloudfunctions.net/${rewrite.function}`;
|
|
14
14
|
let destLabel = "live";
|
|
15
|
-
if (lodash_1.includes(options.targets, "functions")) {
|
|
15
|
+
if ((0, lodash_1.includes)(options.targets, "functions")) {
|
|
16
16
|
destLabel = "local";
|
|
17
17
|
const functionsEmu = registry_1.EmulatorRegistry.get(types_1.Emulators.FUNCTIONS);
|
|
18
18
|
if (functionsEmu) {
|
|
19
19
|
url = functionsEmulator_1.FunctionsEmulator.getHttpFunctionUrl(functionsEmu.getInfo().host, functionsEmu.getInfo().port, projectId, rewrite.function, "us-central1");
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
resolve(proxy_1.proxyRequestHandler(url, `${destLabel} Function ${rewrite.function}`));
|
|
22
|
+
resolve((0, proxy_1.proxyRequestHandler)(url, `${destLabel} Function ${rewrite.function}`));
|
|
23
23
|
});
|
|
24
24
|
};
|
|
25
25
|
}
|
|
@@ -13,7 +13,7 @@ const INIT_TEMPLATE = fs.readFileSync(__dirname + "/../../templates/hosting/init
|
|
|
13
13
|
async function implicitInit(options) {
|
|
14
14
|
let config;
|
|
15
15
|
try {
|
|
16
|
-
config = await fetchWebSetup_1.fetchWebSetup(options);
|
|
16
|
+
config = await (0, fetchWebSetup_1.fetchWebSetup)(options);
|
|
17
17
|
}
|
|
18
18
|
catch (e) {
|
|
19
19
|
logger_1.logger.debug("fetchWebSetup error: " + e);
|
|
@@ -23,7 +23,7 @@ async function implicitInit(options) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
if (!config) {
|
|
26
|
-
config = fetchWebSetup_1.getCachedWebSetup(options);
|
|
26
|
+
config = (0, fetchWebSetup_1.getCachedWebSetup)(options);
|
|
27
27
|
if (config) {
|
|
28
28
|
utils.logLabeledWarning("hosting", "Using web app configuration from cache.");
|
|
29
29
|
}
|
|
@@ -34,7 +34,7 @@ function filterOnly(configs, onlyString) {
|
|
|
34
34
|
filteredConfigs.push(configsByTarget.get(onlyTarget));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
throw new error_1.FirebaseError(`Hosting site or target ${cli_color_1.bold(onlyTarget)} not detected in firebase.json`);
|
|
37
|
+
throw new error_1.FirebaseError(`Hosting site or target ${(0, cli_color_1.bold)(onlyTarget)} not detected in firebase.json`);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
return filteredConfigs;
|
|
@@ -57,7 +57,7 @@ function filterExcept(configs, exceptOption) {
|
|
|
57
57
|
return filteredConfigs;
|
|
58
58
|
}
|
|
59
59
|
function normalizedHostingConfigs(cmdOptions, options = {}) {
|
|
60
|
-
let configs = lodash_1.cloneDeep(cmdOptions.config.get("hosting"));
|
|
60
|
+
let configs = (0, lodash_1.cloneDeep)(cmdOptions.config.get("hosting"));
|
|
61
61
|
if (!configs) {
|
|
62
62
|
return [];
|
|
63
63
|
}
|
|
@@ -79,7 +79,7 @@ function normalizedHostingConfigs(cmdOptions, options = {}) {
|
|
|
79
79
|
if (cfg.target) {
|
|
80
80
|
const matchingTargets = cmdOptions.rc.requireTarget(cmdOptions.project, "hosting", cfg.target);
|
|
81
81
|
if (matchingTargets.length > 1) {
|
|
82
|
-
throw new error_1.FirebaseError(`Hosting target ${cli_color_1.bold(cfg.target)} is linked to multiple sites, ` +
|
|
82
|
+
throw new error_1.FirebaseError(`Hosting target ${(0, cli_color_1.bold)(cfg.target)} is linked to multiple sites, ` +
|
|
83
83
|
`but only one is permitted. ` +
|
|
84
84
|
`To clear, run:\n\n firebase target:clear hosting ${cfg.target}`);
|
|
85
85
|
}
|
package/lib/hosting/proxy.js
CHANGED
|
@@ -16,11 +16,11 @@ function makeVary(vary = "") {
|
|
|
16
16
|
const varies = vary.split(/, ?/).map((v) => {
|
|
17
17
|
return v
|
|
18
18
|
.split("-")
|
|
19
|
-
.map((part) => lodash_1.capitalize(part))
|
|
19
|
+
.map((part) => (0, lodash_1.capitalize)(part))
|
|
20
20
|
.join("-");
|
|
21
21
|
});
|
|
22
22
|
REQUIRED_VARY_VALUES.forEach((requiredVary) => {
|
|
23
|
-
if (!lodash_1.includes(varies, requiredVary)) {
|
|
23
|
+
if (!(0, lodash_1.includes)(varies, requiredVary)) {
|
|
24
24
|
varies.push(requiredVary);
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -10,7 +10,7 @@ async function promptForAccount() {
|
|
|
10
10
|
logger_1.logger.info();
|
|
11
11
|
logger_1.logger.info(`Which account do you want to use for this project? Choose an account or add a new one now`);
|
|
12
12
|
logger_1.logger.info();
|
|
13
|
-
const allAccounts = auth_1.getAllAccounts();
|
|
13
|
+
const allAccounts = (0, auth_1.getAllAccounts)();
|
|
14
14
|
const choices = allAccounts.map((a) => {
|
|
15
15
|
return {
|
|
16
16
|
name: a.user.email,
|
|
@@ -21,27 +21,27 @@ async function promptForAccount() {
|
|
|
21
21
|
name: "(add a new account)",
|
|
22
22
|
value: "__add__",
|
|
23
23
|
});
|
|
24
|
-
const emailChoice = await prompt_1.promptOnce({
|
|
24
|
+
const emailChoice = await (0, prompt_1.promptOnce)({
|
|
25
25
|
type: "list",
|
|
26
26
|
name: "email",
|
|
27
27
|
message: "Please select an option:",
|
|
28
28
|
choices,
|
|
29
29
|
});
|
|
30
30
|
if (emailChoice == "__add__") {
|
|
31
|
-
const newAccount = await auth_1.loginAdditionalAccount(true);
|
|
31
|
+
const newAccount = await (0, auth_1.loginAdditionalAccount)(true);
|
|
32
32
|
if (!newAccount) {
|
|
33
33
|
throw new error_1.FirebaseError("Failed to add new account", { exit: 1 });
|
|
34
34
|
}
|
|
35
35
|
return newAccount;
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
return auth_1.findAccountByEmail(emailChoice);
|
|
38
|
+
return (0, auth_1.findAccountByEmail)(emailChoice);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
async function doSetup(setup, config, options) {
|
|
42
42
|
let account;
|
|
43
43
|
if (options.account) {
|
|
44
|
-
account = auth_1.findAccountByEmail(options.account);
|
|
44
|
+
account = (0, auth_1.findAccountByEmail)(options.account);
|
|
45
45
|
if (!account) {
|
|
46
46
|
throw new error_1.FirebaseError(`Invalid account ${options.account}`, { exit: 1 });
|
|
47
47
|
}
|
|
@@ -52,9 +52,9 @@ async function doSetup(setup, config, options) {
|
|
|
52
52
|
if (!account) {
|
|
53
53
|
throw new error_1.FirebaseError(`No account selected, have you run "firebase login"?`, { exit: 1 });
|
|
54
54
|
}
|
|
55
|
-
auth_1.setActiveAccount(options, account);
|
|
55
|
+
(0, auth_1.setActiveAccount)(options, account);
|
|
56
56
|
if (config.projectDir) {
|
|
57
|
-
auth_1.setProjectAccount(config.projectDir, account.user.email);
|
|
57
|
+
(0, auth_1.setProjectAccount)(config.projectDir, account.user.email);
|
|
58
58
|
}
|
|
59
59
|
logger_1.logger.info();
|
|
60
60
|
utils.logSuccess(`Using account: ${account.user.email}`);
|
|
@@ -30,7 +30,7 @@ function writeDBRules(rules, logMessagePrefix, filename, config) {
|
|
|
30
30
|
logger_1.logger.info(clc.bold("firebase deploy") + ".");
|
|
31
31
|
}
|
|
32
32
|
async function createDefaultDatabaseInstance(project) {
|
|
33
|
-
const selectedLocation = await prompt_1.promptOnce({
|
|
33
|
+
const selectedLocation = await (0, prompt_1.promptOnce)({
|
|
34
34
|
type: "list",
|
|
35
35
|
message: "Please choose the location for your default Realtime Database instance:",
|
|
36
36
|
choices: [
|
|
@@ -40,7 +40,7 @@ async function createDefaultDatabaseInstance(project) {
|
|
|
40
40
|
],
|
|
41
41
|
});
|
|
42
42
|
let instanceName = `${project}-default-rtdb`;
|
|
43
|
-
const checkOutput = await database_1.checkInstanceNameAvailable(project, instanceName, database_1.DatabaseInstanceType.DEFAULT_DATABASE, selectedLocation);
|
|
43
|
+
const checkOutput = await (0, database_1.checkInstanceNameAvailable)(project, instanceName, database_1.DatabaseInstanceType.DEFAULT_DATABASE, selectedLocation);
|
|
44
44
|
if (!checkOutput.available) {
|
|
45
45
|
if (!checkOutput.suggestedIds || checkOutput.suggestedIds.length === 0) {
|
|
46
46
|
logger_1.logger.debug(`No instance names were suggested instead of conventional instance name: ${instanceName}`);
|
|
@@ -51,7 +51,7 @@ async function createDefaultDatabaseInstance(project) {
|
|
|
51
51
|
}
|
|
52
52
|
const spinner = ora(`Creating your default Realtime Database instance: ${instanceName}`).start();
|
|
53
53
|
try {
|
|
54
|
-
const createdInstance = await database_1.createInstance(project, instanceName, selectedLocation, database_1.DatabaseInstanceType.DEFAULT_DATABASE);
|
|
54
|
+
const createdInstance = await (0, database_1.createInstance)(project, instanceName, selectedLocation, database_1.DatabaseInstanceType.DEFAULT_DATABASE);
|
|
55
55
|
spinner.succeed();
|
|
56
56
|
return createdInstance;
|
|
57
57
|
}
|
|
@@ -64,15 +64,15 @@ async function doSetup(setup, config) {
|
|
|
64
64
|
setup.config = setup.config || {};
|
|
65
65
|
let instanceDetails;
|
|
66
66
|
if (setup.projectId) {
|
|
67
|
-
await ensureApiEnabled_1.ensure(setup.projectId, "firebasedatabase.googleapis.com", "database", false);
|
|
67
|
+
await (0, ensureApiEnabled_1.ensure)(setup.projectId, "firebasedatabase.googleapis.com", "database", false);
|
|
68
68
|
logger_1.logger.info();
|
|
69
69
|
setup.instance =
|
|
70
|
-
setup.instance || (await getDefaultDatabaseInstance_1.getDefaultDatabaseInstance({ project: setup.projectId }));
|
|
70
|
+
setup.instance || (await (0, getDefaultDatabaseInstance_1.getDefaultDatabaseInstance)({ project: setup.projectId }));
|
|
71
71
|
if (setup.instance !== "") {
|
|
72
|
-
instanceDetails = await database_1.getDatabaseInstanceDetails(setup.projectId, setup.instance);
|
|
72
|
+
instanceDetails = await (0, database_1.getDatabaseInstanceDetails)(setup.projectId, setup.instance);
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
const confirm = await prompt_1.promptOnce({
|
|
75
|
+
const confirm = await (0, prompt_1.promptOnce)({
|
|
76
76
|
type: "confirm",
|
|
77
77
|
name: "confirm",
|
|
78
78
|
default: true,
|
|
@@ -88,7 +88,7 @@ async function doSetup(setup, config) {
|
|
|
88
88
|
logger_1.logger.info("Firebase Realtime Database Security Rules allow you to define how your data should be");
|
|
89
89
|
logger_1.logger.info("structured and when your data can be read from and written to.");
|
|
90
90
|
logger_1.logger.info();
|
|
91
|
-
await prompt_1.prompt(setup.config.database, [
|
|
91
|
+
await (0, prompt_1.prompt)(setup.config.database, [
|
|
92
92
|
{
|
|
93
93
|
type: "input",
|
|
94
94
|
name: "rules",
|
|
@@ -106,7 +106,7 @@ async function doSetup(setup, config) {
|
|
|
106
106
|
? `the Realtime Database Security Rules for ${clc.bold(instanceDetails.name)} from the Firebase console`
|
|
107
107
|
: "default rules";
|
|
108
108
|
const msg = `File ${clc.bold(filename)} already exists. Do you want to overwrite it with ${rulesDescription}?`;
|
|
109
|
-
writeRules = await prompt_1.promptOnce({
|
|
109
|
+
writeRules = await (0, prompt_1.promptOnce)({
|
|
110
110
|
type: "confirm",
|
|
111
111
|
message: msg,
|
|
112
112
|
default: false,
|