firebase-tools 11.0.0 → 11.2.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/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 +23 -34
- 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 +6 -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 +6 -1
- package/lib/commands/ext-list.js +2 -1
- package/lib/commands/ext-sources-create.js +2 -1
- package/lib/commands/ext-uninstall.js +7 -1
- package/lib/commands/ext-update.js +6 -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 +15 -3
- 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/functions.js +18 -14
- 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 +11 -9
- package/lib/emulator/download.js +1 -1
- package/lib/emulator/events/types.js +2 -3
- package/lib/emulator/firestoreEmulator.js +12 -14
- package/lib/emulator/functionsEmulator.js +65 -77
- package/lib/emulator/functionsEmulatorRuntime.js +7 -7
- package/lib/emulator/hostingEmulator.js +1 -1
- package/lib/emulator/hub.js +1 -1
- package/lib/emulator/hubClient.js +11 -22
- package/lib/emulator/hubExport.js +26 -16
- 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/checkDatabaseType.js +4 -5
- package/lib/firestore/encodeFirestoreValue.js +11 -8
- package/lib/firestore/indexes.js +17 -34
- 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/gcp/storage.js +2 -4
- package/lib/hosting/cloudRunProxy.js +19 -15
- package/lib/hosting/proxy.js +1 -1
- package/lib/index.js +29 -28
- package/lib/init/features/database.js +11 -5
- 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/management/apps.js +47 -43
- package/lib/management/database.js +33 -31
- package/lib/management/projects.js +13 -7
- 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/rtdb.js +31 -29
- 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 +877 -279
- package/package.json +19 -16
- package/standalone/package.json +1 -1
|
@@ -5,7 +5,7 @@ const getProjectNumber_1 = require("../getProjectNumber");
|
|
|
5
5
|
const utils = require("../utils");
|
|
6
6
|
const ensureApiEnabled_1 = require("../ensureApiEnabled");
|
|
7
7
|
const projectUtils_1 = require("../projectUtils");
|
|
8
|
-
const
|
|
8
|
+
const types_1 = require("./types");
|
|
9
9
|
const secretManagerApi = require("../gcp/secretManager");
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
11
|
exports.SECRET_LABEL = "firebase-extensions-managed";
|
|
@@ -15,7 +15,7 @@ async function ensureSecretManagerApiEnabled(options) {
|
|
|
15
15
|
}
|
|
16
16
|
exports.ensureSecretManagerApiEnabled = ensureSecretManagerApiEnabled;
|
|
17
17
|
function usesSecrets(spec) {
|
|
18
|
-
return spec.params && !!spec.params.find((p) => p.type ===
|
|
18
|
+
return spec.params && !!spec.params.find((p) => p.type === types_1.ParamType.SECRET);
|
|
19
19
|
}
|
|
20
20
|
exports.usesSecrets = usesSecrets;
|
|
21
21
|
async function grantFirexServiceAgentSecretAdminRole(secret) {
|
|
@@ -38,7 +38,7 @@ async function getManagedSecrets(instance) {
|
|
|
38
38
|
exports.getManagedSecrets = getManagedSecrets;
|
|
39
39
|
function getActiveSecrets(spec, params) {
|
|
40
40
|
return spec.params
|
|
41
|
-
.map((p) => (p.type ===
|
|
41
|
+
.map((p) => (p.type === types_1.ParamType.SECRET ? params[p.param] : ""))
|
|
42
42
|
.filter((pv) => !!pv);
|
|
43
43
|
}
|
|
44
44
|
exports.getActiveSecrets = getActiveSecrets;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ParamType = exports.FUNCTIONS_RESOURCE_TYPE = exports.Visibility = exports.RegistryLaunchStage = void 0;
|
|
4
|
+
var RegistryLaunchStage;
|
|
5
|
+
(function (RegistryLaunchStage) {
|
|
6
|
+
RegistryLaunchStage["EXPERIMENTAL"] = "EXPERIMENTAL";
|
|
7
|
+
RegistryLaunchStage["BETA"] = "BETA";
|
|
8
|
+
RegistryLaunchStage["GA"] = "GA";
|
|
9
|
+
RegistryLaunchStage["DEPRECATED"] = "DEPRECATED";
|
|
10
|
+
RegistryLaunchStage["REGISTRY_LAUNCH_STAGE_UNSPECIFIED"] = "REGISTRY_LAUNCH_STAGE_UNSPECIFIED";
|
|
11
|
+
})(RegistryLaunchStage = exports.RegistryLaunchStage || (exports.RegistryLaunchStage = {}));
|
|
12
|
+
var Visibility;
|
|
13
|
+
(function (Visibility) {
|
|
14
|
+
Visibility["UNLISTED"] = "unlisted";
|
|
15
|
+
Visibility["PUBLIC"] = "public";
|
|
16
|
+
})(Visibility = exports.Visibility || (exports.Visibility = {}));
|
|
17
|
+
exports.FUNCTIONS_RESOURCE_TYPE = "firebaseextensions.v1beta.function";
|
|
18
|
+
var ParamType;
|
|
19
|
+
(function (ParamType) {
|
|
20
|
+
ParamType["STRING"] = "STRING";
|
|
21
|
+
ParamType["SELECT"] = "SELECT";
|
|
22
|
+
ParamType["MULTISELECT"] = "MULTISELECT";
|
|
23
|
+
ParamType["SECRET"] = "SECRET";
|
|
24
|
+
})(ParamType = exports.ParamType || (exports.ParamType = {}));
|
|
@@ -17,7 +17,7 @@ function invalidSourceErrMsgTemplate(instanceId, source) {
|
|
|
17
17
|
- Run \`${clc.bold("firebase ext:update " + instanceId)}\` to update from the published source.\n
|
|
18
18
|
- Check your directory path or URL, then run \`${clc.bold("firebase ext:update " + instanceId + " <otherSource>")}\` to update from a local directory or URL source.`;
|
|
19
19
|
}
|
|
20
|
-
async function getExistingSourceOrigin(projectId, instanceId
|
|
20
|
+
async function getExistingSourceOrigin(projectId, instanceId) {
|
|
21
21
|
const instance = await extensionsApi.getInstance(projectId, instanceId);
|
|
22
22
|
return instance && instance.config.extensionRef
|
|
23
23
|
? extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION
|
package/lib/extensions/utils.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatTimestamp = exports.getRandomString = exports.convertOfficialExtensionsToList = exports.convertExtensionOptionToLabeledList = exports.onceWithJoin = void 0;
|
|
4
|
-
const _ = require("lodash");
|
|
5
4
|
const prompt_1 = require("../prompt");
|
|
6
5
|
async function onceWithJoin(question) {
|
|
7
6
|
const response = await (0, prompt_1.promptOnce)(question);
|
|
@@ -22,7 +21,7 @@ function convertExtensionOptionToLabeledList(options) {
|
|
|
22
21
|
}
|
|
23
22
|
exports.convertExtensionOptionToLabeledList = convertExtensionOptionToLabeledList;
|
|
24
23
|
function convertOfficialExtensionsToList(officialExts) {
|
|
25
|
-
const l =
|
|
24
|
+
const l = Object.entries(officialExts).map(([key, entry]) => {
|
|
26
25
|
return {
|
|
27
26
|
checked: false,
|
|
28
27
|
value: `${entry.publisher}/${key}`,
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.paramsFlagDeprecationWarning = exports.displayWarningsForDeploy = exports.displayWarningPrompts = void 0;
|
|
4
4
|
const { marked } = require("marked");
|
|
5
5
|
const clc = require("cli-color");
|
|
6
|
-
const
|
|
6
|
+
const types_1 = require("./types");
|
|
7
7
|
const displayExtensionInfo_1 = require("./displayExtensionInfo");
|
|
8
8
|
const extensionsHelper_1 = require("./extensionsHelper");
|
|
9
9
|
const resolveSource_1 = require("./resolveSource");
|
|
@@ -31,7 +31,7 @@ async function displayWarningPrompts(publisherId, launchStage, extensionVersion)
|
|
|
31
31
|
githubLink: extensionVersion.spec.sourceUrl,
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
else if (launchStage ===
|
|
34
|
+
else if (launchStage === types_1.RegistryLaunchStage.EXPERIMENTAL) {
|
|
35
35
|
displayExperimentalWarning();
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
@@ -55,7 +55,7 @@ async function displayWarningsForDeploy(instancesToCreate) {
|
|
|
55
55
|
await (0, planner_1.getExtension)(i);
|
|
56
56
|
}
|
|
57
57
|
const [eapExtensions, nonEapExtensions] = (0, functional_1.partition)(publishedExtensionInstances, (i) => { var _a, _b; return !trustedPublishers.includes((_b = (_a = i.ref) === null || _a === void 0 ? void 0 : _a.publisherId) !== null && _b !== void 0 ? _b : ""); });
|
|
58
|
-
const experimental = nonEapExtensions.filter((i) => i.extension.registryLaunchStage ===
|
|
58
|
+
const experimental = nonEapExtensions.filter((i) => i.extension.registryLaunchStage === types_1.RegistryLaunchStage.EXPERIMENTAL);
|
|
59
59
|
if (experimental.length) {
|
|
60
60
|
const humanReadableList = experimental.map((i) => `\t${(0, deploymentSummary_1.humanReadable)(i)}`).join("\n");
|
|
61
61
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, marked(`The following are instances of ${clc.bold("experimental")} extensions.They may not be production-ready. Their functionality may change in backward-incompatible ways before their official release, or they may be discontinued.\n${humanReadableList}\n`, { gfm: false }));
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkDatabaseType = void 0;
|
|
4
|
-
const
|
|
4
|
+
const api_1 = require("../api");
|
|
5
|
+
const apiv2_1 = require("../apiv2");
|
|
5
6
|
const logger_1 = require("../logger");
|
|
6
7
|
async function checkDatabaseType(projectId) {
|
|
7
8
|
try {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
origin: api.appengineOrigin,
|
|
11
|
-
});
|
|
9
|
+
const client = new apiv2_1.Client({ urlPrefix: api_1.appengineOrigin, apiVersion: "v1" });
|
|
10
|
+
const resp = await client.get(`/apps/${projectId}`);
|
|
12
11
|
return resp.body.databaseType;
|
|
13
12
|
}
|
|
14
13
|
catch (err) {
|
|
@@ -9,22 +9,22 @@ function isPlainObject(input) {
|
|
|
9
9
|
_.isEqual(Object.getPrototypeOf(input), Object.prototype));
|
|
10
10
|
}
|
|
11
11
|
function encodeHelper(val) {
|
|
12
|
-
if (
|
|
12
|
+
if (typeof val === "string") {
|
|
13
13
|
return { stringValue: val };
|
|
14
14
|
}
|
|
15
|
-
if (
|
|
15
|
+
if (val === !!val) {
|
|
16
16
|
return { booleanValue: val };
|
|
17
17
|
}
|
|
18
|
-
if (
|
|
18
|
+
if (Number.isInteger(val)) {
|
|
19
19
|
return { integerValue: val };
|
|
20
20
|
}
|
|
21
|
-
if (
|
|
21
|
+
if (typeof val === "number") {
|
|
22
22
|
return { doubleValue: val };
|
|
23
23
|
}
|
|
24
|
-
if (
|
|
24
|
+
if (val instanceof Date && !Number.isNaN(val)) {
|
|
25
25
|
return { timestampValue: val.toISOString() };
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
27
|
+
if (Array.isArray(val)) {
|
|
28
28
|
const encodedElements = [];
|
|
29
29
|
for (const v of val) {
|
|
30
30
|
const enc = encodeHelper(v);
|
|
@@ -36,7 +36,7 @@ function encodeHelper(val) {
|
|
|
36
36
|
arrayValue: { values: encodedElements },
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
if (
|
|
39
|
+
if (val === null) {
|
|
40
40
|
return { nullValue: "NULL_VALUE" };
|
|
41
41
|
}
|
|
42
42
|
if (val instanceof Buffer || val instanceof Uint8Array) {
|
|
@@ -51,6 +51,9 @@ function encodeHelper(val) {
|
|
|
51
51
|
"The emulator does not yet support Firestore document reference values or geo points.");
|
|
52
52
|
}
|
|
53
53
|
function encodeFirestoreValue(data) {
|
|
54
|
-
return
|
|
54
|
+
return Object.entries(data).reduce((acc, [key, val]) => {
|
|
55
|
+
acc[key] = encodeHelper(val);
|
|
56
|
+
return acc;
|
|
57
|
+
}, {});
|
|
55
58
|
}
|
|
56
59
|
exports.encodeFirestoreValue = encodeFirestoreValue;
|
package/lib/firestore/indexes.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FirestoreIndexes = void 0;
|
|
4
4
|
const clc = require("cli-color");
|
|
5
|
-
const api = require("../api");
|
|
6
5
|
const logger_1 = require("../logger");
|
|
7
6
|
const utils = require("../utils");
|
|
8
7
|
const validator = require("./validator");
|
|
@@ -10,7 +9,12 @@ const API = require("./indexes-api");
|
|
|
10
9
|
const sort = require("./indexes-sort");
|
|
11
10
|
const util = require("./util");
|
|
12
11
|
const prompt_1 = require("../prompt");
|
|
12
|
+
const api_1 = require("../api");
|
|
13
|
+
const apiv2_1 = require("../apiv2");
|
|
13
14
|
class FirestoreIndexes {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.apiClient = new apiv2_1.Client({ urlPrefix: api_1.firestoreOrigin, apiVersion: "v1" });
|
|
17
|
+
}
|
|
14
18
|
async deploy(options, indexes, fieldOverrides) {
|
|
15
19
|
const spec = this.upgradeOldSpec({
|
|
16
20
|
indexes,
|
|
@@ -112,11 +116,8 @@ class FirestoreIndexes {
|
|
|
112
116
|
}
|
|
113
117
|
}
|
|
114
118
|
async listIndexes(project) {
|
|
115
|
-
const url =
|
|
116
|
-
const res = await
|
|
117
|
-
auth: true,
|
|
118
|
-
origin: api.firestoreOrigin,
|
|
119
|
-
});
|
|
119
|
+
const url = `/projects/${project}/databases/(default)/collectionGroups/-/indexes`;
|
|
120
|
+
const res = await this.apiClient.get(url);
|
|
120
121
|
const indexes = res.body.indexes;
|
|
121
122
|
if (!indexes) {
|
|
122
123
|
return [];
|
|
@@ -135,11 +136,8 @@ class FirestoreIndexes {
|
|
|
135
136
|
}
|
|
136
137
|
async listFieldOverrides(project) {
|
|
137
138
|
const parent = `projects/${project}/databases/(default)/collectionGroups/-`;
|
|
138
|
-
const url =
|
|
139
|
-
const res = await
|
|
140
|
-
auth: true,
|
|
141
|
-
origin: api.firestoreOrigin,
|
|
142
|
-
});
|
|
139
|
+
const url = `/${parent}/fields?filter=indexConfig.usesAncestorConfig=false`;
|
|
140
|
+
const res = await this.apiClient.get(url);
|
|
143
141
|
const fields = res.body.fields;
|
|
144
142
|
if (!fields) {
|
|
145
143
|
return [];
|
|
@@ -248,7 +246,7 @@ class FirestoreIndexes {
|
|
|
248
246
|
});
|
|
249
247
|
}
|
|
250
248
|
async patchField(project, spec) {
|
|
251
|
-
const url =
|
|
249
|
+
const url = `/projects/${project}/databases/(default)/collectionGroups/${spec.collectionGroup}/fields/${spec.fieldPath}`;
|
|
252
250
|
const indexes = spec.indexes.map((index) => {
|
|
253
251
|
return {
|
|
254
252
|
queryScope: index.queryScope,
|
|
@@ -266,38 +264,23 @@ class FirestoreIndexes {
|
|
|
266
264
|
indexes,
|
|
267
265
|
},
|
|
268
266
|
};
|
|
269
|
-
await
|
|
270
|
-
auth: true,
|
|
271
|
-
origin: api.firestoreOrigin,
|
|
272
|
-
data,
|
|
273
|
-
});
|
|
267
|
+
await this.apiClient.patch(url, data);
|
|
274
268
|
}
|
|
275
269
|
deleteField(field) {
|
|
276
270
|
const url = field.name;
|
|
277
271
|
const data = {};
|
|
278
|
-
return
|
|
279
|
-
auth: true,
|
|
280
|
-
origin: api.firestoreOrigin,
|
|
281
|
-
data,
|
|
282
|
-
});
|
|
272
|
+
return this.apiClient.patch(`/${url}`, data, { queryParams: { updateMask: "indexConfig" } });
|
|
283
273
|
}
|
|
284
274
|
createIndex(project, index) {
|
|
285
|
-
const url =
|
|
286
|
-
return
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
fields: index.fields,
|
|
290
|
-
queryScope: index.queryScope,
|
|
291
|
-
},
|
|
292
|
-
origin: api.firestoreOrigin,
|
|
275
|
+
const url = `/projects/${project}/databases/(default)/collectionGroups/${index.collectionGroup}/indexes`;
|
|
276
|
+
return this.apiClient.post(url, {
|
|
277
|
+
fields: index.fields,
|
|
278
|
+
queryScope: index.queryScope,
|
|
293
279
|
});
|
|
294
280
|
}
|
|
295
281
|
deleteIndex(index) {
|
|
296
282
|
const url = index.name;
|
|
297
|
-
return
|
|
298
|
-
auth: true,
|
|
299
|
-
origin: api.firestoreOrigin,
|
|
300
|
-
});
|
|
283
|
+
return this.apiClient.delete(`/${url}`);
|
|
301
284
|
}
|
|
302
285
|
indexMatchesSpec(index, spec) {
|
|
303
286
|
const collection = util.parseIndexName(index.name).collectionGroupId;
|
package/lib/fsAsync.js
CHANGED
|
@@ -8,7 +8,7 @@ const minimatch = require("minimatch");
|
|
|
8
8
|
async function readdirRecursiveHelper(options) {
|
|
9
9
|
const dirContents = (0, fs_extra_1.readdirSync)(options.path);
|
|
10
10
|
const fullPaths = dirContents.map((n) => (0, path_1.join)(options.path, n));
|
|
11
|
-
const filteredPaths =
|
|
11
|
+
const filteredPaths = fullPaths.filter((p) => !options.filter(p));
|
|
12
12
|
const filePromises = [];
|
|
13
13
|
for (const p of filteredPaths) {
|
|
14
14
|
const fstat = (0, fs_extra_1.statSync)(p);
|
|
@@ -22,12 +22,12 @@ async function readdirRecursiveHelper(options) {
|
|
|
22
22
|
}
|
|
23
23
|
const files = await Promise.all(filePromises);
|
|
24
24
|
let flatFiles = _.flattenDeep(files);
|
|
25
|
-
flatFiles =
|
|
25
|
+
flatFiles = flatFiles.filter((f) => f !== null);
|
|
26
26
|
return flatFiles;
|
|
27
27
|
}
|
|
28
28
|
async function readdirRecursive(options) {
|
|
29
29
|
const mmopts = { matchBase: true, dot: true };
|
|
30
|
-
const rules =
|
|
30
|
+
const rules = (options.ignore || []).map((glob) => {
|
|
31
31
|
return (p) => minimatch(p, glob, mmopts);
|
|
32
32
|
});
|
|
33
33
|
const filter = (t) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FIREBASE_ALERTS_PUBLISH_EVENT = exports.STORAGE_EVENTS = exports.PUBSUB_PUBLISH_EVENT = void 0;
|
|
3
|
+
exports.DATABASE_EVENTS = exports.FIREBASE_ALERTS_PUBLISH_EVENT = exports.STORAGE_EVENTS = exports.PUBSUB_PUBLISH_EVENT = void 0;
|
|
4
4
|
exports.PUBSUB_PUBLISH_EVENT = "google.cloud.pubsub.topic.v1.messagePublished";
|
|
5
5
|
exports.STORAGE_EVENTS = [
|
|
6
6
|
"google.cloud.storage.object.v1.finalized",
|
|
@@ -9,3 +9,9 @@ exports.STORAGE_EVENTS = [
|
|
|
9
9
|
"google.cloud.storage.object.v1.metadataUpdated",
|
|
10
10
|
];
|
|
11
11
|
exports.FIREBASE_ALERTS_PUBLISH_EVENT = "google.firebase.firebasealerts.alerts.v1.published";
|
|
12
|
+
exports.DATABASE_EVENTS = [
|
|
13
|
+
"google.firebase.database.ref.v1.written",
|
|
14
|
+
"google.firebase.database.ref.v1.created",
|
|
15
|
+
"google.firebase.database.ref.v1.updated",
|
|
16
|
+
"google.firebase.database.ref.v1.deleted",
|
|
17
|
+
];
|
package/lib/functionsConfig.js
CHANGED
|
@@ -27,7 +27,7 @@ function setVariable(projectId, configId, varPath, val) {
|
|
|
27
27
|
return runtimeconfig.variables.set(projectId, configId, varPath, val);
|
|
28
28
|
}
|
|
29
29
|
function isReservedNamespace(id) {
|
|
30
|
-
return
|
|
30
|
+
return exports.RESERVED_NAMESPACES.some((reserved) => {
|
|
31
31
|
return id.config.toLowerCase().startsWith(reserved);
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -44,7 +44,7 @@ function varNameToIds(varName) {
|
|
|
44
44
|
}
|
|
45
45
|
exports.varNameToIds = varNameToIds;
|
|
46
46
|
function idsToVarName(projectId, configId, varId) {
|
|
47
|
-
return
|
|
47
|
+
return ["projects", projectId, "configs", configId, "variables", varId].join("/");
|
|
48
48
|
}
|
|
49
49
|
exports.idsToVarName = idsToVarName;
|
|
50
50
|
function getAppEngineLocation(config) {
|
|
@@ -63,7 +63,7 @@ async function getFirebaseConfig(options) {
|
|
|
63
63
|
exports.getFirebaseConfig = getFirebaseConfig;
|
|
64
64
|
async function setVariablesRecursive(projectId, configId, varPath, val) {
|
|
65
65
|
let parsed = val;
|
|
66
|
-
if (
|
|
66
|
+
if (typeof val === "string") {
|
|
67
67
|
try {
|
|
68
68
|
parsed = JSON.parse(val);
|
|
69
69
|
}
|
|
@@ -71,8 +71,8 @@ async function setVariablesRecursive(projectId, configId, varPath, val) {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
if (_.isPlainObject(parsed)) {
|
|
74
|
-
return Promise.all(
|
|
75
|
-
const newVarPath = varPath ?
|
|
74
|
+
return Promise.all(Object.entries(parsed).map(([key, item]) => {
|
|
75
|
+
const newVarPath = varPath ? [varPath, key].join("/") : key;
|
|
76
76
|
return setVariablesRecursive(projectId, configId, newVarPath, item);
|
|
77
77
|
}));
|
|
78
78
|
}
|
|
@@ -87,7 +87,7 @@ async function materializeConfig(configName, output) {
|
|
|
87
87
|
_.set(output, key, variable.text);
|
|
88
88
|
};
|
|
89
89
|
const traverseVariables = async function (variables) {
|
|
90
|
-
return Promise.all(
|
|
90
|
+
return Promise.all(variables.map((variable) => {
|
|
91
91
|
return materializeVariable(variable.name);
|
|
92
92
|
}));
|
|
93
93
|
};
|
|
@@ -99,7 +99,10 @@ exports.materializeConfig = materializeConfig;
|
|
|
99
99
|
async function materializeAll(projectId) {
|
|
100
100
|
const output = {};
|
|
101
101
|
const configs = await runtimeconfig.configs.list(projectId);
|
|
102
|
-
|
|
102
|
+
if (!Array.isArray(configs) || !configs.length) {
|
|
103
|
+
return output;
|
|
104
|
+
}
|
|
105
|
+
await Promise.all(configs.map((config) => {
|
|
103
106
|
if (config.name.match(new RegExp("configs/firebase"))) {
|
|
104
107
|
return;
|
|
105
108
|
}
|
|
@@ -110,7 +113,7 @@ async function materializeAll(projectId) {
|
|
|
110
113
|
exports.materializeAll = materializeAll;
|
|
111
114
|
function parseSetArgs(args) {
|
|
112
115
|
const parsed = [];
|
|
113
|
-
|
|
116
|
+
for (const arg of args) {
|
|
114
117
|
const parts = arg.split("=");
|
|
115
118
|
const key = parts[0];
|
|
116
119
|
if (parts.length < 2) {
|
|
@@ -129,17 +132,17 @@ function parseSetArgs(args) {
|
|
|
129
132
|
varId: id.variable,
|
|
130
133
|
val: val,
|
|
131
134
|
});
|
|
132
|
-
}
|
|
135
|
+
}
|
|
133
136
|
return parsed;
|
|
134
137
|
}
|
|
135
138
|
exports.parseSetArgs = parseSetArgs;
|
|
136
139
|
function parseUnsetArgs(args) {
|
|
137
140
|
const parsed = [];
|
|
138
141
|
let splitArgs = [];
|
|
139
|
-
|
|
140
|
-
splitArgs =
|
|
141
|
-
}
|
|
142
|
-
|
|
142
|
+
for (const arg of args) {
|
|
143
|
+
splitArgs = Array.from(new Set([...splitArgs, ...arg.split(",")]));
|
|
144
|
+
}
|
|
145
|
+
for (const key of splitArgs) {
|
|
143
146
|
const id = keyToIds(key);
|
|
144
147
|
if (isReservedNamespace(id)) {
|
|
145
148
|
throw new error_1.FirebaseError("Cannot unset reserved namespace " + clc.bold(id.config));
|
|
@@ -148,7 +151,7 @@ function parseUnsetArgs(args) {
|
|
|
148
151
|
configId: id.config,
|
|
149
152
|
varId: id.variable,
|
|
150
153
|
});
|
|
151
|
-
}
|
|
154
|
+
}
|
|
152
155
|
return parsed;
|
|
153
156
|
}
|
|
154
157
|
exports.parseUnsetArgs = parseUnsetArgs;
|
|
@@ -1,68 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.functionsConfigClone = void 0;
|
|
4
|
+
const _ = require("lodash");
|
|
5
|
+
const clc = require("cli-color");
|
|
6
|
+
const error_1 = require("./error");
|
|
7
|
+
const functionsConfig = require("./functionsConfig");
|
|
8
|
+
const runtimeconfig = require("./gcp/runtimeconfig");
|
|
9
|
+
function matchPrefix(short, long) {
|
|
8
10
|
if (short.length > long.length) {
|
|
9
11
|
return false;
|
|
10
12
|
}
|
|
11
|
-
return
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _applyExcept = function (json, except) {
|
|
16
|
-
_.forEach(except, function (key) {
|
|
13
|
+
return short.reduce((accum, x, i) => accum && x === long[i], true);
|
|
14
|
+
}
|
|
15
|
+
function applyExcept(json, except) {
|
|
16
|
+
for (const key of except) {
|
|
17
17
|
_.unset(json, key);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return runtimeconfig.variables.get(varName).then(
|
|
22
|
-
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function cloneVariable(varName, toProject) {
|
|
21
|
+
return runtimeconfig.variables.get(varName).then((variable) => {
|
|
22
|
+
const id = functionsConfig.varNameToIds(variable.name);
|
|
23
23
|
return runtimeconfig.variables.set(toProject, id.config, id.variable, variable.text);
|
|
24
24
|
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return runtimeconfig.variables.list(configName).then(
|
|
28
|
-
return Promise.all(
|
|
29
|
-
return
|
|
25
|
+
}
|
|
26
|
+
function cloneConfig(configName, toProject) {
|
|
27
|
+
return runtimeconfig.variables.list(configName).then((variables) => {
|
|
28
|
+
return Promise.all(variables.map((variable) => {
|
|
29
|
+
return cloneVariable(variable.name, toProject);
|
|
30
30
|
}));
|
|
31
31
|
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
throw new FirebaseError("Cannot clone reserved namespace " + clc.bold(parts[0]));
|
|
32
|
+
}
|
|
33
|
+
async function cloneConfigOrVariable(key, fromProject, toProject) {
|
|
34
|
+
const parts = key.split(".");
|
|
35
|
+
if (functionsConfig.RESERVED_NAMESPACES.includes(parts[0])) {
|
|
36
|
+
throw new error_1.FirebaseError("Cannot clone reserved namespace " + clc.bold(parts[0]));
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
const configName = ["projects", fromProject, "configs", parts[0]].join("/");
|
|
39
39
|
if (parts.length === 1) {
|
|
40
|
-
return
|
|
40
|
+
return cloneConfig(configName, toProject);
|
|
41
41
|
}
|
|
42
|
-
return runtimeconfig.variables.list(configName).then(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
promises.push(
|
|
42
|
+
return runtimeconfig.variables.list(configName).then((variables) => {
|
|
43
|
+
const promises = [];
|
|
44
|
+
for (const variable of variables) {
|
|
45
|
+
const varId = functionsConfig.varNameToIds(variable.name).variable;
|
|
46
|
+
const variablePrefixFilter = parts.slice(1);
|
|
47
|
+
if (matchPrefix(variablePrefixFilter, varId.split("/"))) {
|
|
48
|
+
promises.push(cloneVariable(variable.name, toProject));
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|
|
51
51
|
return Promise.all(promises);
|
|
52
52
|
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
except = except || [];
|
|
53
|
+
}
|
|
54
|
+
async function functionsConfigClone(fromProject, toProject, only, except = []) {
|
|
56
55
|
if (only) {
|
|
57
|
-
return Promise.all(
|
|
58
|
-
return
|
|
56
|
+
return Promise.all(only.map((key) => {
|
|
57
|
+
return cloneConfigOrVariable(key, fromProject, toProject);
|
|
59
58
|
}));
|
|
60
59
|
}
|
|
61
|
-
return functionsConfig.materializeAll(fromProject).then(
|
|
60
|
+
return functionsConfig.materializeAll(fromProject).then((toClone) => {
|
|
62
61
|
_.unset(toClone, "firebase");
|
|
63
|
-
|
|
64
|
-
return Promise.all(
|
|
62
|
+
applyExcept(toClone, except);
|
|
63
|
+
return Promise.all(Object.entries(toClone).map(([configId, val]) => {
|
|
65
64
|
return functionsConfig.setVariablesRecursive(toProject, configId, "", val);
|
|
66
65
|
}));
|
|
67
66
|
});
|
|
68
|
-
}
|
|
67
|
+
}
|
|
68
|
+
exports.functionsConfigClone = functionsConfigClone;
|
|
@@ -4,7 +4,6 @@ exports.functionFromEndpoint = exports.endpointFromFunction = exports.listAllFun
|
|
|
4
4
|
const clc = require("cli-color");
|
|
5
5
|
const error_1 = require("../error");
|
|
6
6
|
const logger_1 = require("../logger");
|
|
7
|
-
const previews_1 = require("../previews");
|
|
8
7
|
const backend = require("../deploy/functions/backend");
|
|
9
8
|
const utils = require("../utils");
|
|
10
9
|
const proto = require("./proto");
|
|
@@ -24,10 +23,6 @@ const BLOCKING_EVENT_TO_LABEL_KEY = {
|
|
|
24
23
|
"providers/cloud.auth/eventTypes/user.beforeCreate": "before-create",
|
|
25
24
|
"providers/cloud.auth/eventTypes/user.beforeSignIn": "before-sign-in",
|
|
26
25
|
};
|
|
27
|
-
function validateFunction(func) {
|
|
28
|
-
proto.assertOneOf("Cloud Function", func, "sourceCode", "sourceArchiveUrl", "sourceRepository", "sourceUploadUrl");
|
|
29
|
-
proto.assertOneOf("Cloud Function", func, "trigger", "httpsTrigger", "eventTrigger");
|
|
30
|
-
}
|
|
31
26
|
function functionsOpLogReject(funcName, type, err) {
|
|
32
27
|
var _a, _b;
|
|
33
28
|
if (((_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) === 429) {
|
|
@@ -58,11 +53,7 @@ async function createFunction(cloudFunction) {
|
|
|
58
53
|
const apiPath = cloudFunction.name.substring(0, cloudFunction.name.lastIndexOf("/"));
|
|
59
54
|
const endpoint = `/${apiPath}`;
|
|
60
55
|
try {
|
|
61
|
-
const
|
|
62
|
-
if (previews_1.previews.artifactregistry) {
|
|
63
|
-
headers["X-Firebase-Artifact-Registry"] = "optin";
|
|
64
|
-
}
|
|
65
|
-
const res = await client.post(endpoint, cloudFunction, { headers });
|
|
56
|
+
const res = await client.post(endpoint, cloudFunction);
|
|
66
57
|
return {
|
|
67
58
|
name: res.body.name,
|
|
68
59
|
type: "create",
|
|
@@ -147,12 +138,7 @@ async function updateFunction(cloudFunction) {
|
|
|
147
138
|
const endpoint = `/${cloudFunction.name}`;
|
|
148
139
|
const fieldMasks = proto.fieldMasks(cloudFunction, "labels", "environmentVariables", "secretEnvironmentVariables");
|
|
149
140
|
try {
|
|
150
|
-
const headers = {};
|
|
151
|
-
if (previews_1.previews.artifactregistry) {
|
|
152
|
-
headers["X-Firebase-Artifact-Registry"] = "optin";
|
|
153
|
-
}
|
|
154
141
|
const res = await client.patch(endpoint, cloudFunction, {
|
|
155
|
-
headers,
|
|
156
142
|
queryParams: {
|
|
157
143
|
updateMask: fieldMasks.join(","),
|
|
158
144
|
},
|
|
@@ -293,6 +279,7 @@ function functionFromEndpoint(endpoint, sourceUploadUrl) {
|
|
|
293
279
|
sourceUploadUrl: sourceUploadUrl,
|
|
294
280
|
entryPoint: endpoint.entryPoint,
|
|
295
281
|
runtime: endpoint.runtime,
|
|
282
|
+
dockerRegistry: "ARTIFACT_REGISTRY",
|
|
296
283
|
};
|
|
297
284
|
proto.copyIfPresent(gcfFunction, endpoint, "labels");
|
|
298
285
|
if (backend.isEventTriggered(endpoint)) {
|
|
@@ -209,6 +209,13 @@ function functionFromEndpoint(endpoint, source) {
|
|
|
209
209
|
for (const [attribute, value] of Object.entries(endpoint.eventTrigger.eventFilters)) {
|
|
210
210
|
gcfFunction.eventTrigger.eventFilters.push({ attribute, value });
|
|
211
211
|
}
|
|
212
|
+
for (const [attribute, value] of Object.entries(endpoint.eventTrigger.eventFilterPathPatterns || {})) {
|
|
213
|
+
gcfFunction.eventTrigger.eventFilters.push({
|
|
214
|
+
attribute,
|
|
215
|
+
value,
|
|
216
|
+
operator: "match-path-pattern",
|
|
217
|
+
});
|
|
218
|
+
}
|
|
212
219
|
}
|
|
213
220
|
proto.renameIfPresent(gcfFunction.eventTrigger, endpoint.eventTrigger, "triggerRegion", "region");
|
|
214
221
|
proto.copyIfPresent(gcfFunction.eventTrigger, endpoint.eventTrigger, "channel");
|
|
@@ -277,8 +284,16 @@ function endpointFromFunction(gcfFunction) {
|
|
|
277
284
|
trigger.eventTrigger.eventFilters.topic = gcfFunction.eventTrigger.pubsubTopic;
|
|
278
285
|
}
|
|
279
286
|
else {
|
|
280
|
-
for (const
|
|
281
|
-
|
|
287
|
+
for (const eventFilter of gcfFunction.eventTrigger.eventFilters || []) {
|
|
288
|
+
if (eventFilter.operator === "match-path-pattern") {
|
|
289
|
+
if (!trigger.eventTrigger.eventFilterPathPatterns) {
|
|
290
|
+
trigger.eventTrigger.eventFilterPathPatterns = {};
|
|
291
|
+
}
|
|
292
|
+
trigger.eventTrigger.eventFilterPathPatterns[eventFilter.attribute] = eventFilter.value;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
trigger.eventTrigger.eventFilters[eventFilter.attribute] = eventFilter.value;
|
|
296
|
+
}
|
|
282
297
|
}
|
|
283
298
|
}
|
|
284
299
|
proto.copyIfPresent(trigger.eventTrigger, gcfFunction.eventTrigger, "channel");
|
package/lib/gcp/iam.js
CHANGED