firebase-tools 11.0.1 → 11.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accountExporter.js +11 -4
- package/lib/accountImporter.js +93 -95
- package/lib/api.js +77 -218
- package/lib/apiv2.js +5 -4
- package/lib/appdistribution/client.js +7 -9
- package/lib/auth.js +72 -52
- package/lib/bin/firebase.js +42 -47
- package/lib/checkValidTargetFilters.js +36 -25
- package/lib/commands/appdistribution-distribute.js +2 -1
- package/lib/commands/appdistribution-testers-add.js +2 -1
- package/lib/commands/appdistribution-testers-remove.js +2 -1
- package/lib/commands/apps-android-sha-create.js +2 -1
- package/lib/commands/apps-android-sha-delete.js +2 -1
- package/lib/commands/apps-android-sha-list.js +2 -1
- package/lib/commands/apps-create.js +2 -1
- package/lib/commands/apps-list.js +2 -1
- package/lib/commands/apps-sdkconfig.js +2 -1
- package/lib/commands/auth-export.js +2 -1
- package/lib/commands/auth-import.js +7 -10
- package/lib/commands/crashlytics-symbols-upload.js +2 -1
- package/lib/commands/database-get.js +4 -3
- package/lib/commands/database-instances-create.js +2 -1
- package/lib/commands/database-instances-list.js +3 -3
- package/lib/commands/database-profile.js +4 -4
- package/lib/commands/database-push.js +4 -4
- package/lib/commands/database-remove.js +3 -3
- package/lib/commands/database-rules-canary.js +2 -1
- package/lib/commands/database-rules-get.js +2 -1
- package/lib/commands/database-rules-list.js +2 -1
- package/lib/commands/database-rules-release.js +2 -1
- package/lib/commands/database-rules-stage.js +2 -1
- package/lib/commands/database-set.js +3 -3
- package/lib/commands/database-settings-get.js +2 -1
- package/lib/commands/database-settings-set.js +2 -1
- package/lib/commands/database-update.js +2 -1
- package/lib/commands/deploy.js +26 -25
- package/lib/commands/emulators-exec.js +2 -1
- package/lib/commands/emulators-export.js +2 -1
- package/lib/commands/emulators-start.js +2 -1
- package/lib/commands/experimental-functions-shell.js +10 -8
- package/lib/commands/ext-configure.js +2 -1
- package/lib/commands/ext-dev-deprecate.js +2 -1
- package/lib/commands/ext-dev-emulators-exec.js +3 -2
- package/lib/commands/ext-dev-emulators-start.js +3 -2
- package/lib/commands/ext-dev-extension-delete.js +2 -1
- package/lib/commands/ext-dev-init.js +2 -1
- package/lib/commands/ext-dev-list.js +8 -8
- package/lib/commands/ext-dev-publish.js +2 -1
- package/lib/commands/ext-dev-register.js +2 -1
- package/lib/commands/ext-dev-undeprecate.js +2 -1
- package/lib/commands/ext-dev-unpublish.js +2 -1
- package/lib/commands/ext-dev-usage.js +2 -1
- package/lib/commands/ext-export.js +2 -1
- package/lib/commands/ext-info.js +14 -14
- package/lib/commands/ext-install.js +2 -1
- package/lib/commands/ext-list.js +2 -1
- package/lib/commands/ext-sources-create.js +2 -1
- package/lib/commands/ext-uninstall.js +2 -1
- package/lib/commands/ext-update.js +2 -1
- package/lib/commands/ext.js +4 -4
- package/lib/commands/firestore-delete.js +2 -1
- package/lib/commands/firestore-indexes-list.js +2 -1
- package/lib/commands/functions-config-clone.js +4 -3
- package/lib/commands/functions-config-export.js +2 -1
- package/lib/commands/functions-config-get.js +2 -1
- package/lib/commands/functions-config-set.js +2 -1
- package/lib/commands/functions-config-unset.js +2 -1
- package/lib/commands/functions-delete.js +3 -8
- package/lib/commands/functions-deletegcfartifacts.js +2 -1
- package/lib/commands/functions-list.js +2 -1
- package/lib/commands/functions-log.js +2 -1
- package/lib/commands/functions-secrets-access.js +2 -1
- package/lib/commands/functions-secrets-destroy.js +2 -1
- package/lib/commands/functions-secrets-get.js +2 -1
- package/lib/commands/functions-secrets-prune.js +2 -1
- package/lib/commands/functions-secrets-set.js +2 -1
- package/lib/commands/functions-shell.js +12 -10
- package/lib/commands/help.js +2 -1
- package/lib/commands/hosting-channel-create.js +2 -1
- package/lib/commands/hosting-channel-delete.js +2 -1
- package/lib/commands/hosting-channel-deploy.js +2 -1
- package/lib/commands/hosting-channel-list.js +2 -1
- package/lib/commands/hosting-channel-open.js +2 -1
- package/lib/commands/hosting-clone.js +2 -1
- package/lib/commands/hosting-disable.js +2 -1
- package/lib/commands/hosting-sites-create.js +2 -1
- package/lib/commands/hosting-sites-delete.js +2 -1
- package/lib/commands/hosting-sites-get.js +2 -1
- package/lib/commands/hosting-sites-list.js +2 -1
- package/lib/commands/index.js +23 -13
- package/lib/commands/init.js +47 -43
- package/lib/commands/login-add.js +2 -1
- package/lib/commands/login-ci.js +2 -1
- package/lib/commands/login-list.js +2 -1
- package/lib/commands/login-use.js +2 -1
- package/lib/commands/login.js +2 -1
- package/lib/commands/logout.js +2 -1
- package/lib/commands/open.js +7 -7
- package/lib/commands/projects-addfirebase.js +2 -1
- package/lib/commands/projects-create.js +2 -1
- package/lib/commands/projects-list.js +2 -1
- package/lib/commands/remoteconfig-get.js +2 -1
- package/lib/commands/remoteconfig-rollback.js +2 -1
- package/lib/commands/remoteconfig-versions-list.js +2 -1
- package/lib/commands/serve.js +30 -30
- package/lib/commands/setup-emulators-database.js +2 -1
- package/lib/commands/setup-emulators-firestore.js +2 -1
- package/lib/commands/setup-emulators-pubsub.js +2 -1
- package/lib/commands/setup-emulators-storage.js +2 -1
- package/lib/commands/setup-emulators-ui.js +2 -1
- package/lib/commands/target-apply.js +2 -1
- package/lib/commands/target-clear.js +2 -1
- package/lib/commands/target-remove.js +2 -1
- package/lib/commands/target.js +2 -1
- package/lib/commands/use.js +54 -53
- package/lib/config.js +7 -6
- package/lib/deploy/database/deploy.js +3 -2
- package/lib/deploy/database/index.js +8 -5
- package/lib/deploy/database/prepare.js +22 -20
- package/lib/deploy/database/release.js +12 -9
- package/lib/deploy/extensions/secrets.js +3 -3
- package/lib/deploy/firestore/prepare.js +2 -2
- package/lib/deploy/functions/build.js +33 -20
- package/lib/deploy/functions/ensure.js +1 -11
- package/lib/deploy/functions/prepare.js +3 -13
- package/lib/deploy/functions/prepareFunctionsUpload.js +2 -3
- package/lib/deploy/functions/release/fabricator.js +0 -1
- package/lib/deploy/functions/release/index.js +1 -5
- package/lib/deploy/functions/runtimes/discovery/index.js +18 -3
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +188 -54
- package/lib/deploy/functions/runtimes/golang/index.js +2 -22
- package/lib/deploy/functions/runtimes/node/index.js +3 -7
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +16 -4
- package/lib/deploy/functions/services/database.js +14 -0
- package/lib/deploy/functions/services/index.js +14 -0
- package/lib/deploy/index.js +3 -3
- package/lib/deploy/lifecycleHooks.js +27 -27
- package/lib/deploy/remoteconfig/prepare.js +2 -2
- package/lib/deploy/storage/prepare.js +1 -1
- package/lib/emulator/auth/apiSpec.js +14 -46
- package/lib/emulator/auth/index.js +1 -1
- package/lib/emulator/auth/operations.js +342 -93
- package/lib/emulator/auth/server.js +2 -2
- package/lib/emulator/auth/state.js +34 -32
- package/lib/emulator/commandUtils.js +1 -1
- package/lib/emulator/constants.js +1 -1
- package/lib/emulator/controller.js +7 -6
- package/lib/emulator/databaseEmulator.js +4 -4
- package/lib/emulator/download.js +1 -1
- package/lib/emulator/downloadableEmulators.js +5 -5
- package/lib/emulator/events/types.js +2 -3
- package/lib/emulator/firestoreEmulator.js +2 -2
- package/lib/emulator/functionsEmulator.js +31 -45
- package/lib/emulator/functionsEmulatorRuntime.js +12 -16
- package/lib/emulator/functionsEmulatorShared.js +7 -5
- package/lib/emulator/functionsRuntimeWorker.js +0 -6
- package/lib/emulator/hostingEmulator.js +1 -1
- package/lib/emulator/hub.js +1 -1
- package/lib/emulator/loggingEmulator.js +1 -1
- package/lib/emulator/pubsubEmulator.js +1 -1
- package/lib/emulator/storage/crc.js +4 -4
- package/lib/emulator/storage/index.js +1 -1
- package/lib/emulator/types.js +1 -1
- package/lib/errorOut.js +2 -2
- package/lib/extensions/askUserForConsent.js +1 -2
- package/lib/extensions/askUserForParam.js +15 -18
- package/lib/extensions/emulator/optionsHelper.js +4 -4
- package/lib/extensions/extensionsApi.js +1 -22
- package/lib/extensions/extensionsHelper.js +6 -6
- package/lib/extensions/listExtensions.js +9 -10
- package/lib/extensions/manifest.js +2 -2
- package/lib/extensions/resolveSource.js +11 -7
- package/lib/extensions/secretsUtils.js +3 -3
- package/lib/extensions/types.js +24 -0
- package/lib/extensions/updateHelper.js +1 -1
- package/lib/extensions/utils.js +1 -2
- package/lib/extensions/warnings.js +3 -3
- package/lib/firestore/encodeFirestoreValue.js +11 -8
- package/lib/fsAsync.js +3 -3
- package/lib/functions/events/v2.js +7 -1
- package/lib/functionsConfig.js +17 -14
- package/lib/functionsConfigClone.js +46 -46
- package/lib/gcp/cloudfunctions.js +2 -15
- package/lib/gcp/cloudfunctionsv2.js +17 -2
- package/lib/gcp/iam.js +1 -1
- package/lib/gcp/index.js +10 -10
- package/lib/gcp/rules.js +1 -1
- package/lib/gcp/runtimeconfig.js +45 -47
- package/lib/hosting/proxy.js +1 -1
- package/lib/index.js +29 -28
- package/lib/init/features/database.js +10 -2
- package/lib/init/features/functions/index.js +1 -1
- package/lib/init/features/functions/javascript.js +23 -20
- package/lib/init/features/functions/npm-dependencies.js +17 -14
- package/lib/init/features/functions/typescript.js +27 -24
- package/lib/init/features/hosting/github.js +6 -5
- package/lib/init/features/hosting/index.js +2 -2
- package/lib/loadCJSON.js +9 -6
- package/lib/localFunction.js +4 -4
- package/lib/logError.js +15 -12
- package/lib/parseBoltRules.js +15 -14
- package/lib/previews.js +1 -1
- package/lib/profileReport.js +504 -512
- package/lib/profiler.js +4 -4
- package/lib/prompt.js +1 -2
- package/lib/rc.js +1 -1
- package/lib/requireAuth.js +0 -1
- package/lib/responseToError.js +8 -5
- package/lib/rulesDeploy.js +2 -2
- package/lib/scopes.js +9 -9
- package/lib/serve/index.js +4 -5
- package/lib/utils.js +30 -6
- package/npm-shrinkwrap.json +537 -193
- package/package.json +17 -14
|
@@ -45,7 +45,7 @@ function parseTriggers(projectId, sourceDir, configValues, envs) {
|
|
|
45
45
|
});
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function useStrategy(
|
|
48
|
+
function useStrategy() {
|
|
49
49
|
return Promise.resolve(true);
|
|
50
50
|
}
|
|
51
51
|
exports.useStrategy = useStrategy;
|
|
@@ -139,10 +139,22 @@ function addResourcesToBuild(projectId, runtime, annotation, want) {
|
|
|
139
139
|
triggered = {
|
|
140
140
|
scheduleTrigger: {
|
|
141
141
|
schedule: annotation.schedule.schedule,
|
|
142
|
-
timeZone: annotation.schedule.timeZone || "
|
|
143
|
-
retryConfig:
|
|
142
|
+
timeZone: annotation.schedule.timeZone || "America/Los_Angeles",
|
|
143
|
+
retryConfig: {},
|
|
144
144
|
},
|
|
145
145
|
};
|
|
146
|
+
if (annotation.schedule.retryConfig) {
|
|
147
|
+
if (annotation.schedule.retryConfig.maxBackoffDuration) {
|
|
148
|
+
triggered.scheduleTrigger.retryConfig.maxBackoffSeconds = proto.secondsFromDuration(annotation.schedule.retryConfig.maxBackoffDuration);
|
|
149
|
+
}
|
|
150
|
+
if (annotation.schedule.retryConfig.minBackoffDuration) {
|
|
151
|
+
triggered.scheduleTrigger.retryConfig.minBackoffSeconds = proto.secondsFromDuration(annotation.schedule.retryConfig.minBackoffDuration);
|
|
152
|
+
}
|
|
153
|
+
if (annotation.schedule.retryConfig.maxRetryDuration) {
|
|
154
|
+
triggered.scheduleTrigger.retryConfig.maxRetrySeconds = proto.secondsFromDuration(annotation.schedule.retryConfig.maxRetryDuration);
|
|
155
|
+
}
|
|
156
|
+
proto.copyIfPresent(triggered.scheduleTrigger.retryConfig, annotation.schedule.retryConfig, "maxDoublings", "retryCount");
|
|
157
|
+
}
|
|
146
158
|
}
|
|
147
159
|
else if (annotation.blockingTrigger) {
|
|
148
160
|
if (events.v1.AUTH_BLOCKING_EVENTS.includes(annotation.blockingTrigger.eventType)) {
|
|
@@ -167,7 +179,7 @@ function addResourcesToBuild(projectId, runtime, annotation, want) {
|
|
|
167
179
|
};
|
|
168
180
|
}
|
|
169
181
|
const endpointId = annotation.name;
|
|
170
|
-
const endpoint = Object.assign({ platform: annotation.platform || "gcfv1", region: regions, project: projectId, entryPoint: annotation.entryPoint, runtime: runtime, serviceAccount: annotation.serviceAccountEmail ||
|
|
182
|
+
const endpoint = Object.assign({ platform: annotation.platform || "gcfv1", region: regions, project: projectId, entryPoint: annotation.entryPoint, runtime: runtime, serviceAccount: annotation.serviceAccountEmail || null }, triggered);
|
|
171
183
|
if (annotation.vpcConnector != null) {
|
|
172
184
|
let maybeId = annotation.vpcConnector;
|
|
173
185
|
if (maybeId && !maybeId.includes("/")) {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ensureDatabaseTriggerRegion = void 0;
|
|
4
|
+
const error_1 = require("../../../error");
|
|
5
|
+
function ensureDatabaseTriggerRegion(endpoint) {
|
|
6
|
+
if (!endpoint.eventTrigger.region) {
|
|
7
|
+
endpoint.eventTrigger.region = endpoint.region;
|
|
8
|
+
}
|
|
9
|
+
if (endpoint.eventTrigger.region !== endpoint.region) {
|
|
10
|
+
throw new error_1.FirebaseError("A database trigger location must match the function region.");
|
|
11
|
+
}
|
|
12
|
+
return Promise.resolve();
|
|
13
|
+
}
|
|
14
|
+
exports.ensureDatabaseTriggerRegion = ensureDatabaseTriggerRegion;
|
|
@@ -5,6 +5,7 @@ const backend = require("../backend");
|
|
|
5
5
|
const auth_1 = require("./auth");
|
|
6
6
|
const storage_1 = require("./storage");
|
|
7
7
|
const firebaseAlerts_1 = require("./firebaseAlerts");
|
|
8
|
+
const database_1 = require("./database");
|
|
8
9
|
const noop = () => Promise.resolve();
|
|
9
10
|
exports.noop = noop;
|
|
10
11
|
const noopProjectBindings = () => Promise.resolve([]);
|
|
@@ -45,6 +46,15 @@ const firebaseAlertsService = {
|
|
|
45
46
|
unregisterTrigger: exports.noop,
|
|
46
47
|
};
|
|
47
48
|
const authBlockingService = new auth_1.AuthBlockingService();
|
|
49
|
+
const databaseService = {
|
|
50
|
+
name: "database",
|
|
51
|
+
api: "firebasedatabase.googleapis.com",
|
|
52
|
+
requiredProjectBindings: exports.noopProjectBindings,
|
|
53
|
+
ensureTriggerRegion: database_1.ensureDatabaseTriggerRegion,
|
|
54
|
+
validateTrigger: exports.noop,
|
|
55
|
+
registerTrigger: exports.noop,
|
|
56
|
+
unregisterTrigger: exports.noop,
|
|
57
|
+
};
|
|
48
58
|
const EVENT_SERVICE_MAPPING = {
|
|
49
59
|
"google.cloud.pubsub.topic.v1.messagePublished": pubSubService,
|
|
50
60
|
"google.cloud.storage.object.v1.finalized": storageService,
|
|
@@ -54,6 +64,10 @@ const EVENT_SERVICE_MAPPING = {
|
|
|
54
64
|
"google.firebase.firebasealerts.alerts.v1.published": firebaseAlertsService,
|
|
55
65
|
"providers/cloud.auth/eventTypes/user.beforeCreate": authBlockingService,
|
|
56
66
|
"providers/cloud.auth/eventTypes/user.beforeSignIn": authBlockingService,
|
|
67
|
+
"google.firebase.database.ref.v1.written": databaseService,
|
|
68
|
+
"google.firebase.database.ref.v1.created": databaseService,
|
|
69
|
+
"google.firebase.database.ref.v1.updated": databaseService,
|
|
70
|
+
"google.firebase.database.ref.v1.deleted": databaseService,
|
|
57
71
|
};
|
|
58
72
|
function serviceForEndpoint(endpoint) {
|
|
59
73
|
if (backend.isEventTriggered(endpoint)) {
|
package/lib/deploy/index.js
CHANGED
|
@@ -9,7 +9,7 @@ const projectUtils_1 = require("../projectUtils");
|
|
|
9
9
|
const utils_1 = require("../utils");
|
|
10
10
|
const error_1 = require("../error");
|
|
11
11
|
const track_1 = require("../track");
|
|
12
|
-
const
|
|
12
|
+
const lifecycleHooks_1 = require("./lifecycleHooks");
|
|
13
13
|
const previews_1 = require("../previews");
|
|
14
14
|
const HostingTarget = require("./hosting");
|
|
15
15
|
const DatabaseTarget = require("./database");
|
|
@@ -54,11 +54,11 @@ const deploy = async function (targetNames, options, customContext = {}) {
|
|
|
54
54
|
if (!target) {
|
|
55
55
|
return Promise.reject(new error_1.FirebaseError((0, cli_color_1.bold)(targetName) + " is not a valid deploy target", { exit: 1 }));
|
|
56
56
|
}
|
|
57
|
-
predeploys.push(lifecycleHooks(targetName, "predeploy"));
|
|
57
|
+
predeploys.push((0, lifecycleHooks_1.lifecycleHooks)(targetName, "predeploy"));
|
|
58
58
|
prepares.push(target.prepare);
|
|
59
59
|
deploys.push(target.deploy);
|
|
60
60
|
releases.push(target.release);
|
|
61
|
-
postdeploys.push(lifecycleHooks(targetName, "postdeploy"));
|
|
61
|
+
postdeploys.push((0, lifecycleHooks_1.lifecycleHooks)(targetName, "postdeploy"));
|
|
62
62
|
}
|
|
63
63
|
logger_1.logger.info();
|
|
64
64
|
logger_1.logger.info((0, cli_color_1.bold)((0, cli_color_1.white)("===") + " Deploying to '" + projectId + "'..."));
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lifecycleHooks = void 0;
|
|
3
4
|
const utils = require("../utils");
|
|
4
5
|
const clc = require("cli-color");
|
|
5
6
|
const childProcess = require("child_process");
|
|
6
|
-
const
|
|
7
|
+
const error_1 = require("../error");
|
|
7
8
|
const needProjectId = require("../projectUtils").needProjectId;
|
|
8
|
-
const
|
|
9
|
+
const logger_1 = require("../logger");
|
|
9
10
|
const path = require("path");
|
|
10
11
|
function runCommand(command, childOptions) {
|
|
11
12
|
const escapedCommand = command.replace(/\"/g, '\\"');
|
|
@@ -16,16 +17,16 @@ function runCommand(command, childOptions) {
|
|
|
16
17
|
'" "' +
|
|
17
18
|
escapedCommand +
|
|
18
19
|
'"';
|
|
19
|
-
return new Promise(
|
|
20
|
-
logger.info("Running command: " + command);
|
|
20
|
+
return new Promise((resolve, reject) => {
|
|
21
|
+
logger_1.logger.info("Running command: " + command);
|
|
21
22
|
if (translatedCommand === "") {
|
|
22
|
-
resolve();
|
|
23
|
+
return resolve();
|
|
23
24
|
}
|
|
24
25
|
const child = childProcess.spawn(translatedCommand, [], childOptions);
|
|
25
|
-
child.on("error",
|
|
26
|
+
child.on("error", (err) => {
|
|
26
27
|
reject(err);
|
|
27
28
|
});
|
|
28
|
-
child.on("exit",
|
|
29
|
+
child.on("exit", (code, signal) => {
|
|
29
30
|
if (signal) {
|
|
30
31
|
reject(new Error("Command terminated with signal " + signal));
|
|
31
32
|
}
|
|
@@ -52,7 +53,7 @@ function getChildEnvironment(target, overallOptions, config) {
|
|
|
52
53
|
default:
|
|
53
54
|
resourceDir = overallOptions.config.path(overallOptions.config.projectDir);
|
|
54
55
|
}
|
|
55
|
-
return
|
|
56
|
+
return Object.assign({}, process.env, {
|
|
56
57
|
GCLOUD_PROJECT: projectId,
|
|
57
58
|
PROJECT_DIR: projectDir,
|
|
58
59
|
RESOURCE_DIR: resourceDir,
|
|
@@ -72,21 +73,19 @@ function runTargetCommands(target, hook, overallOptions, config) {
|
|
|
72
73
|
shell: true,
|
|
73
74
|
stdio: [0, 1, 2],
|
|
74
75
|
};
|
|
75
|
-
const runAllCommands =
|
|
76
|
-
return soFar.then(
|
|
77
|
-
return runCommand(command, childOptions);
|
|
78
|
-
});
|
|
76
|
+
const runAllCommands = commands.reduce((soFar, command) => {
|
|
77
|
+
return soFar.then(() => runCommand(command, childOptions));
|
|
79
78
|
}, Promise.resolve());
|
|
80
79
|
let logIdentifier = target;
|
|
81
80
|
if (config.target) {
|
|
82
81
|
logIdentifier += `[${config.target}]`;
|
|
83
82
|
}
|
|
84
83
|
return runAllCommands
|
|
85
|
-
.then(
|
|
84
|
+
.then(() => {
|
|
86
85
|
utils.logSuccess(clc.green.bold(logIdentifier + ":") + " Finished running " + clc.bold(hook) + " script.");
|
|
87
86
|
})
|
|
88
|
-
.catch(
|
|
89
|
-
throw new FirebaseError(logIdentifier + " " + hook + " error: " + err.message);
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
throw new error_1.FirebaseError(logIdentifier + " " + hook + " error: " + err.message);
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
function getReleventConfigs(target, options) {
|
|
@@ -94,33 +93,34 @@ function getReleventConfigs(target, options) {
|
|
|
94
93
|
if (!targetConfigs) {
|
|
95
94
|
return [];
|
|
96
95
|
}
|
|
97
|
-
if (!
|
|
96
|
+
if (!Array.isArray(targetConfigs)) {
|
|
98
97
|
targetConfigs = [targetConfigs];
|
|
99
98
|
}
|
|
100
99
|
if (!options.only) {
|
|
101
100
|
return targetConfigs;
|
|
102
101
|
}
|
|
103
|
-
|
|
104
|
-
if (
|
|
102
|
+
let onlyTargets = options.only.split(",");
|
|
103
|
+
if (onlyTargets.includes(target)) {
|
|
105
104
|
return targetConfigs;
|
|
106
105
|
}
|
|
107
106
|
onlyTargets = onlyTargets
|
|
108
|
-
.filter(
|
|
107
|
+
.filter((individualOnly) => {
|
|
109
108
|
return individualOnly.indexOf(`${target}:`) === 0;
|
|
110
109
|
})
|
|
111
|
-
.map(
|
|
110
|
+
.map((individualOnly) => {
|
|
112
111
|
return individualOnly.replace(`${target}:`, "");
|
|
113
112
|
});
|
|
114
|
-
return targetConfigs.filter(
|
|
115
|
-
return !config.target ||
|
|
113
|
+
return targetConfigs.filter((config) => {
|
|
114
|
+
return !config.target || onlyTargets.includes(config.target);
|
|
116
115
|
});
|
|
117
116
|
}
|
|
118
|
-
|
|
117
|
+
function lifecycleHooks(target, hook) {
|
|
119
118
|
return function (context, options) {
|
|
120
|
-
return
|
|
121
|
-
return previousCommands.then(
|
|
119
|
+
return getReleventConfigs(target, options).reduce((previousCommands, individualConfig) => {
|
|
120
|
+
return previousCommands.then(() => {
|
|
122
121
|
return runTargetCommands(target, hook, options, individualConfig);
|
|
123
122
|
});
|
|
124
123
|
}, Promise.resolve());
|
|
125
124
|
};
|
|
126
|
-
}
|
|
125
|
+
}
|
|
126
|
+
exports.lifecycleHooks = lifecycleHooks;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const projectUtils_1 = require("../../projectUtils");
|
|
4
|
-
const
|
|
4
|
+
const loadCJSON_1 = require("../../loadCJSON");
|
|
5
5
|
const functions_1 = require("./functions");
|
|
6
6
|
const functions_2 = require("./functions");
|
|
7
7
|
async function default_1(context, options) {
|
|
@@ -13,7 +13,7 @@ async function default_1(context, options) {
|
|
|
13
13
|
if (!filePath) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
const template = loadCJSON(filePath);
|
|
16
|
+
const template = (0, loadCJSON_1.loadCJSON)(filePath);
|
|
17
17
|
const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
|
|
18
18
|
template.etag = await (0, functions_1.getEtag)(projectNumber);
|
|
19
19
|
(0, functions_2.validateInputRemoteConfigTemplate)(template);
|
|
@@ -13,7 +13,7 @@ async function default_1(context, options) {
|
|
|
13
13
|
_.set(context, "storage.rulesDeploy", rulesDeploy);
|
|
14
14
|
if (_.isPlainObject(rulesConfig)) {
|
|
15
15
|
const defaultBucket = await gcp.storage.getDefaultBucket(options.project);
|
|
16
|
-
rulesConfig = [
|
|
16
|
+
rulesConfig = [Object.assign(rulesConfig, { bucket: defaultBucket })];
|
|
17
17
|
_.set(context, "storage.rules", rulesConfig);
|
|
18
18
|
}
|
|
19
19
|
rulesConfig.forEach((ruleConfig) => {
|
|
@@ -4799,8 +4799,8 @@ exports.default = {
|
|
|
4799
4799
|
GoogleCloudIdentitytoolkitV1SetAccountInfoResponse: {
|
|
4800
4800
|
description: "Response message for SetAccountInfo",
|
|
4801
4801
|
properties: {
|
|
4802
|
-
displayName: { type: "string" },
|
|
4803
|
-
email: { type: "string" },
|
|
4802
|
+
displayName: { description: "The account's display name.", type: "string" },
|
|
4803
|
+
email: { description: "The account's email address.", type: "string" },
|
|
4804
4804
|
emailVerified: {
|
|
4805
4805
|
description: "Whether the account's email has been verified.",
|
|
4806
4806
|
type: "boolean",
|
|
@@ -4820,8 +4820,14 @@ exports.default = {
|
|
|
4820
4820
|
description: "The new email that has been set on the user's account attributes.",
|
|
4821
4821
|
type: "string",
|
|
4822
4822
|
},
|
|
4823
|
-
passwordHash: {
|
|
4824
|
-
|
|
4823
|
+
passwordHash: {
|
|
4824
|
+
description: "Deprecated. No actual password hash is currently returned.",
|
|
4825
|
+
type: "string",
|
|
4826
|
+
},
|
|
4827
|
+
photoUrl: {
|
|
4828
|
+
description: "The user's photo URL for the account's profile photo.",
|
|
4829
|
+
type: "string",
|
|
4830
|
+
},
|
|
4825
4831
|
providerUserInfo: {
|
|
4826
4832
|
description: "The linked Identity Providers on the account.",
|
|
4827
4833
|
items: { $ref: "#/components/schemas/GoogleCloudIdentitytoolkitV1ProviderUserInfo" },
|
|
@@ -5705,28 +5711,6 @@ exports.default = {
|
|
|
5705
5711
|
},
|
|
5706
5712
|
type: "object",
|
|
5707
5713
|
},
|
|
5708
|
-
GoogleCloudIdentitytoolkitAdminV2AllowByDefault: {
|
|
5709
|
-
description: "Defines a policy of allowing every region by default and adding disallowed regions to a disallow list.",
|
|
5710
|
-
properties: {
|
|
5711
|
-
disallowedRegions: {
|
|
5712
|
-
description: "Two letter unicode region codes to disallow as defined by https://cldr.unicode.org/ The full list of these region codes is here: https://github.com/unicode-cldr/cldr-localenames-full/blob/master/main/en/territories.json",
|
|
5713
|
-
items: { type: "string" },
|
|
5714
|
-
type: "array",
|
|
5715
|
-
},
|
|
5716
|
-
},
|
|
5717
|
-
type: "object",
|
|
5718
|
-
},
|
|
5719
|
-
GoogleCloudIdentitytoolkitAdminV2AllowlistOnly: {
|
|
5720
|
-
description: "Defines a policy of only allowing regions by explicitly adding them to an allowlist.",
|
|
5721
|
-
properties: {
|
|
5722
|
-
allowedRegions: {
|
|
5723
|
-
description: "Two letter unicode region codes to allow as defined by https://cldr.unicode.org/ The full list of these region codes is here: https://github.com/unicode-cldr/cldr-localenames-full/blob/master/main/en/territories.json",
|
|
5724
|
-
items: { type: "string" },
|
|
5725
|
-
type: "array",
|
|
5726
|
-
},
|
|
5727
|
-
},
|
|
5728
|
-
type: "object",
|
|
5729
|
-
},
|
|
5730
5714
|
GoogleCloudIdentitytoolkitAdminV2Anonymous: {
|
|
5731
5715
|
description: "Configuration options related to authenticating an anonymous user.",
|
|
5732
5716
|
properties: {
|
|
@@ -6337,18 +6321,6 @@ exports.default = {
|
|
|
6337
6321
|
},
|
|
6338
6322
|
type: "object",
|
|
6339
6323
|
},
|
|
6340
|
-
GoogleCloudIdentitytoolkitAdminV2SmsRegionConfig: {
|
|
6341
|
-
description: "Configures the regions where users are allowed to send verification SMS for the project or tenant. This is based on the calling code of the destination phone number.",
|
|
6342
|
-
properties: {
|
|
6343
|
-
allowByDefault: {
|
|
6344
|
-
$ref: "#/components/schemas/GoogleCloudIdentitytoolkitAdminV2AllowByDefault",
|
|
6345
|
-
},
|
|
6346
|
-
allowlistOnly: {
|
|
6347
|
-
$ref: "#/components/schemas/GoogleCloudIdentitytoolkitAdminV2AllowlistOnly",
|
|
6348
|
-
},
|
|
6349
|
-
},
|
|
6350
|
-
type: "object",
|
|
6351
|
-
},
|
|
6352
6324
|
GoogleCloudIdentitytoolkitAdminV2SmsTemplate: {
|
|
6353
6325
|
description: "The template to use when sending an SMS.",
|
|
6354
6326
|
properties: {
|
|
@@ -6458,9 +6430,6 @@ exports.default = {
|
|
|
6458
6430
|
readOnly: true,
|
|
6459
6431
|
type: "string",
|
|
6460
6432
|
},
|
|
6461
|
-
smsRegionConfig: {
|
|
6462
|
-
$ref: "#/components/schemas/GoogleCloudIdentitytoolkitAdminV2SmsRegionConfig",
|
|
6463
|
-
},
|
|
6464
6433
|
testPhoneNumbers: {
|
|
6465
6434
|
additionalProperties: { type: "string" },
|
|
6466
6435
|
description: "A map of pairs that can be used for MFA. The phone number should be in E.164 format (https://www.itu.int/rec/T-REC-E.164/) and a maximum of 10 pairs can be added (error will be thrown once exceeded).",
|
|
@@ -6708,7 +6677,7 @@ exports.default = {
|
|
|
6708
6677
|
type: "object",
|
|
6709
6678
|
},
|
|
6710
6679
|
GoogleIamV1AuditConfig: {
|
|
6711
|
-
description: 'Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts jose@example.com from DATA_READ logging, and aliya@example.com from DATA_WRITE logging.',
|
|
6680
|
+
description: 'Specifies the audit configuration for a service. The configuration determines which permission types are logged, and what identities, if any, are exempted from logging. An AuditConfig must have one or more AuditLogConfigs. If there are AuditConfigs for both `allServices` and a specific service, the union of the two AuditConfigs is used for that service: the log_types specified in each AuditConfig are enabled, and the exempted_members in each AuditLogConfig are exempted. Example Policy with multiple AuditConfigs: { "audit_configs": [ { "service": "allServices", "audit_log_configs": [ { "log_type": "DATA_READ", "exempted_members": [ "user:jose@example.com" ] }, { "log_type": "DATA_WRITE" }, { "log_type": "ADMIN_READ" } ] }, { "service": "sampleservice.googleapis.com", "audit_log_configs": [ { "log_type": "DATA_READ" }, { "log_type": "DATA_WRITE", "exempted_members": [ "user:aliya@example.com" ] } ] } ] } For sampleservice, this policy enables DATA_READ, DATA_WRITE and ADMIN_READ logging. It also exempts `jose@example.com` from DATA_READ logging, and `aliya@example.com` from DATA_WRITE logging.',
|
|
6712
6681
|
properties: {
|
|
6713
6682
|
auditLogConfigs: {
|
|
6714
6683
|
description: "The configuration for logging of each type of permission.",
|
|
@@ -6743,7 +6712,7 @@ exports.default = {
|
|
|
6743
6712
|
properties: {
|
|
6744
6713
|
condition: { $ref: "#/components/schemas/GoogleTypeExpr" },
|
|
6745
6714
|
members: {
|
|
6746
|
-
description: "Specifies the principals requesting access for a Cloud
|
|
6715
|
+
description: "Specifies the principals requesting access for a Google Cloud resource. `members` can have the following values: * `allUsers`: A special identifier that represents anyone who is on the internet; with or without a Google account. * `allAuthenticatedUsers`: A special identifier that represents anyone who is authenticated with a Google account or a service account. * `user:{emailid}`: An email address that represents a specific Google account. For example, `alice@example.com` . * `serviceAccount:{emailid}`: An email address that represents a service account. For example, `my-other-app@appspot.gserviceaccount.com`. * `group:{emailid}`: An email address that represents a Google group. For example, `admins@example.com`. * `deleted:user:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a user that has been recently deleted. For example, `alice@example.com?uid=123456789012345678901`. If the user is recovered, this value reverts to `user:{emailid}` and the recovered user retains the role in the binding. * `deleted:serviceAccount:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a service account that has been recently deleted. For example, `my-other-app@appspot.gserviceaccount.com?uid=123456789012345678901`. If the service account is undeleted, this value reverts to `serviceAccount:{emailid}` and the undeleted service account retains the role in the binding. * `deleted:group:{emailid}?uid={uniqueid}`: An email address (plus unique identifier) representing a Google group that has been recently deleted. For example, `admins@example.com?uid=123456789012345678901`. If the group is recovered, this value reverts to `group:{emailid}` and the recovered group retains the role in the binding. * `domain:{domain}`: The G Suite domain (primary) that represents all the users of that domain. For example, `google.com` or `example.com`. ",
|
|
6747
6716
|
items: { type: "string" },
|
|
6748
6717
|
type: "array",
|
|
6749
6718
|
},
|
|
@@ -6812,7 +6781,7 @@ exports.default = {
|
|
|
6812
6781
|
description: "Request message for `TestIamPermissions` method.",
|
|
6813
6782
|
properties: {
|
|
6814
6783
|
permissions: {
|
|
6815
|
-
description: "The set of permissions to check for the `resource`. Permissions with wildcards (such as
|
|
6784
|
+
description: "The set of permissions to check for the `resource`. Permissions with wildcards (such as `*` or `storage.*`) are not allowed. For more information see [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).",
|
|
6816
6785
|
items: { type: "string" },
|
|
6817
6786
|
type: "array",
|
|
6818
6787
|
},
|
|
@@ -6831,7 +6800,7 @@ exports.default = {
|
|
|
6831
6800
|
type: "object",
|
|
6832
6801
|
},
|
|
6833
6802
|
GoogleProtobufEmpty: {
|
|
6834
|
-
description: "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
|
|
6803
|
+
description: "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }",
|
|
6835
6804
|
properties: {},
|
|
6836
6805
|
type: "object",
|
|
6837
6806
|
},
|
|
@@ -6905,7 +6874,6 @@ exports.default = {
|
|
|
6905
6874
|
description: "Emulator-specific configuration.",
|
|
6906
6875
|
properties: {
|
|
6907
6876
|
signIn: { properties: { allowDuplicateEmails: { type: "boolean" } }, type: "object" },
|
|
6908
|
-
usageMode: { enum: ["USAGE_MODE_UNSPECIFIED", "DEFAULT", "PASSTHROUGH"], type: "string" },
|
|
6909
6877
|
},
|
|
6910
6878
|
},
|
|
6911
6879
|
EmulatorV1ProjectsOobCodes: {
|
|
@@ -26,7 +26,7 @@ class AuthEmulator {
|
|
|
26
26
|
return this.destroyServer ? this.destroyServer() : Promise.resolve();
|
|
27
27
|
}
|
|
28
28
|
getInfo() {
|
|
29
|
-
const host = this.args.host || constants_1.Constants.getDefaultHost(
|
|
29
|
+
const host = this.args.host || constants_1.Constants.getDefaultHost();
|
|
30
30
|
const port = this.args.port || constants_1.Constants.getDefaultPort(types_1.Emulators.AUTH);
|
|
31
31
|
return {
|
|
32
32
|
name: this.getName(),
|