firebase-tools-with-isolate 13.6.3 → 13.7.3
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/README.md +4 -6
- package/lib/api.js +1 -1
- package/lib/apphosting/app.js +88 -0
- package/lib/apphosting/config.js +97 -0
- package/lib/apphosting/githubConnections.js +265 -0
- package/lib/{init/features/apphosting → apphosting}/index.js +52 -26
- package/lib/{init/features/apphosting → apphosting}/repo.js +10 -10
- package/lib/apphosting/secrets/dialogs.js +170 -0
- package/lib/apphosting/secrets/index.js +97 -0
- package/lib/commands/apphosting-backends-create.js +7 -3
- package/lib/commands/apphosting-backends-delete.js +5 -4
- package/lib/commands/apphosting-backends-get.js +8 -8
- package/lib/commands/apphosting-backends-list.js +2 -2
- package/lib/commands/apphosting-secrets-access.js +24 -0
- package/lib/commands/apphosting-secrets-describe.js +29 -0
- package/lib/commands/apphosting-secrets-grantaccess.js +45 -0
- package/lib/commands/apphosting-secrets-set.js +56 -0
- package/lib/commands/firestore-databases-create.js +1 -0
- package/lib/commands/firestore-databases-restore.js +1 -0
- package/lib/commands/functions-secrets-access.js +2 -2
- package/lib/commands/functions-secrets-describe.js +14 -0
- package/lib/commands/functions-secrets-destroy.js +2 -2
- package/lib/commands/functions-secrets-get.js +3 -17
- package/lib/commands/functions-secrets-prune.js +2 -1
- package/lib/commands/functions-secrets-set.js +3 -19
- package/lib/commands/index.js +14 -6
- package/lib/deploy/firestore/prepare.js +4 -2
- package/lib/deploy/functions/checkIam.js +3 -6
- package/lib/deploy/functions/containerCleaner.js +1 -15
- package/lib/deploy/functions/deploy.js +2 -2
- package/lib/deploy/functions/params.js +2 -2
- package/lib/deploy/functions/prepare.js +13 -3
- package/lib/deploy/functions/pricing.js +2 -2
- package/lib/deploy/functions/prompts.js +39 -7
- package/lib/deploy/functions/release/fabricator.js +5 -5
- package/lib/deploy/functions/release/index.js +17 -2
- package/lib/deploy/functions/release/planner.js +11 -3
- package/lib/deploy/functions/runtimes/discovery/index.js +3 -3
- package/lib/deploy/functions/runtimes/index.js +6 -43
- package/lib/deploy/functions/runtimes/node/index.js +3 -2
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +15 -34
- package/lib/deploy/functions/runtimes/python/index.js +10 -7
- package/lib/deploy/functions/runtimes/supported/index.js +80 -0
- package/lib/deploy/functions/runtimes/supported/types.js +74 -0
- package/lib/deploy/functions/services/index.js +4 -0
- package/lib/downloadUtils.js +1 -0
- package/lib/emulator/controller.js +5 -1
- package/lib/emulator/functionsEmulator.js +2 -2
- package/lib/emulator/hub.js +5 -0
- package/lib/experiments.js +12 -0
- package/lib/extensions/emulator/specHelper.js +7 -6
- package/lib/extensions/extensionsApi.js +2 -2
- package/lib/extensions/localHelper.js +3 -3
- package/lib/firestore/pretty-print.js +5 -0
- package/lib/frameworks/astro/index.js +1 -1
- package/lib/frameworks/flutter/index.js +2 -2
- package/lib/frameworks/next/constants.js +2 -1
- package/lib/frameworks/next/index.js +22 -12
- package/lib/frameworks/next/utils.js +32 -3
- package/lib/functional.js +2 -2
- package/lib/functions/events/v2.js +7 -1
- package/lib/functions/secrets.js +40 -22
- package/lib/gcp/apphosting.js +14 -2
- package/lib/gcp/cloudbuild.js +7 -3
- package/lib/gcp/cloudfunctions.js +5 -5
- package/lib/gcp/cloudfunctionsv2.js +3 -3
- package/lib/gcp/cloudscheduler.js +2 -2
- package/lib/gcp/computeEngine.js +7 -0
- package/lib/gcp/devConnect.js +24 -11
- package/lib/gcp/iam.js +9 -1
- package/lib/gcp/secretManager.js +54 -6
- package/lib/gcp/serviceusage.js +24 -5
- package/lib/init/features/functions/python.js +4 -3
- package/lib/init/features/hosting/github.js +4 -5
- package/lib/init/features/index.js +1 -1
- package/lib/utils.js +23 -6
- package/package.json +4 -4
- package/schema/firebase-config.json +12 -2
- package/templates/init/functions/typescript/_eslintrc +1 -0
- /package/lib/{init/features/apphosting → apphosting}/constants.js +0 -0
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRoutesWithServerAction = exports.hasStaticAppNotFoundComponent = exports.getNextVersion = exports.getBuildId = exports.getHeadersFromMetaFiles = exports.getNonStaticServerComponents = exports.getNonStaticRoutes = exports.getMiddlewareMatcherRegexes = exports.allDependencyNames = exports.isUsingAppDirectory = exports.isUsingNextImageInAppDirectory = exports.isUsingImageOptimization = exports.isUsingMiddleware = exports.hasUnoptimizedImage = exports.usesNextImage = exports.usesAppDirRouter = exports.getNextjsRewritesToUse = exports.isHeaderSupportedByHosting = exports.isRedirectSupportedByHosting = exports.isRewriteSupportedByHosting = exports.cleanI18n = exports.cleanCustomRouteI18n = exports.cleanEscapedChars = exports.I18N_SOURCE = void 0;
|
|
3
|
+
exports.whichNextConfigFile = exports.getProductionDistDirFiles = exports.getRoutesWithServerAction = exports.hasStaticAppNotFoundComponent = exports.getNextVersion = exports.getBuildId = exports.getHeadersFromMetaFiles = exports.getNonStaticServerComponents = exports.getNonStaticRoutes = exports.getMiddlewareMatcherRegexes = exports.allDependencyNames = exports.isUsingAppDirectory = exports.isUsingNextImageInAppDirectory = exports.isUsingImageOptimization = exports.isUsingMiddleware = exports.hasUnoptimizedImage = exports.usesNextImage = exports.usesAppDirRouter = exports.getNextjsRewritesToUse = exports.isHeaderSupportedByHosting = exports.isRedirectSupportedByHosting = exports.isRewriteSupportedByHosting = exports.cleanI18n = exports.cleanCustomRouteI18n = exports.cleanEscapedChars = exports.I18N_SOURCE = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const fs_extra_1 = require("fs-extra");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const promises_1 = require("fs/promises");
|
|
8
8
|
const glob_1 = require("glob");
|
|
9
|
+
const glob = require("glob");
|
|
9
10
|
const semver_1 = require("semver");
|
|
10
11
|
const utils_1 = require("../utils");
|
|
11
12
|
const constants_1 = require("./constants");
|
|
12
13
|
const fsutils_1 = require("../../fsutils");
|
|
14
|
+
const utils_2 = require("../../utils");
|
|
13
15
|
exports.I18N_SOURCE = /\/:nextInternalLocale(\([^\)]+\))?/;
|
|
14
16
|
function cleanEscapedChars(path) {
|
|
15
17
|
return path.replace(/\\([(){}:+?*])/g, (a, b) => b);
|
|
@@ -104,10 +106,15 @@ async function isUsingImageOptimization(projectDir, distDir) {
|
|
|
104
106
|
}
|
|
105
107
|
exports.isUsingImageOptimization = isUsingImageOptimization;
|
|
106
108
|
async function isUsingNextImageInAppDirectory(projectDir, nextDir) {
|
|
109
|
+
const nextImagePath = ["node_modules", "next", "dist", "client", "image"];
|
|
110
|
+
const nextImageString = utils_2.IS_WINDOWS
|
|
111
|
+
?
|
|
112
|
+
nextImagePath.join(path_1.sep + path_1.sep)
|
|
113
|
+
: (0, path_1.join)(...nextImagePath);
|
|
107
114
|
const files = (0, glob_1.sync)((0, path_1.join)(projectDir, nextDir, "server", "**", "*client-reference-manifest.js"));
|
|
108
115
|
for (const filepath of files) {
|
|
109
|
-
const fileContents = await (0, promises_1.readFile)(filepath);
|
|
110
|
-
if (fileContents.includes(
|
|
116
|
+
const fileContents = await (0, promises_1.readFile)(filepath, "utf-8");
|
|
117
|
+
if (fileContents.includes(nextImageString)) {
|
|
111
118
|
return true;
|
|
112
119
|
}
|
|
113
120
|
}
|
|
@@ -221,3 +228,25 @@ function getRoutesWithServerAction(serverReferenceManifest, appPathRoutesManifes
|
|
|
221
228
|
return Array.from(routesWithServerAction);
|
|
222
229
|
}
|
|
223
230
|
exports.getRoutesWithServerAction = getRoutesWithServerAction;
|
|
231
|
+
async function getProductionDistDirFiles(sourceDir, distDir) {
|
|
232
|
+
const productionDistDirFiles = await new Promise((resolve, reject) => glob("**", {
|
|
233
|
+
ignore: [(0, path_1.join)("cache", "webpack", "*-development", "**"), (0, path_1.join)("cache", "eslint", "**")],
|
|
234
|
+
cwd: (0, path_1.join)(sourceDir, distDir),
|
|
235
|
+
nodir: true,
|
|
236
|
+
absolute: true,
|
|
237
|
+
}, (err, matches) => {
|
|
238
|
+
if (err)
|
|
239
|
+
reject(err);
|
|
240
|
+
resolve(matches);
|
|
241
|
+
}));
|
|
242
|
+
return productionDistDirFiles;
|
|
243
|
+
}
|
|
244
|
+
exports.getProductionDistDirFiles = getProductionDistDirFiles;
|
|
245
|
+
async function whichNextConfigFile(dir) {
|
|
246
|
+
for (const file of constants_1.CONFIG_FILES) {
|
|
247
|
+
if (await (0, fs_extra_1.pathExists)((0, path_1.join)(dir, file)))
|
|
248
|
+
return file;
|
|
249
|
+
}
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
exports.whichNextConfigFile = whichNextConfigFile;
|
package/lib/functional.js
CHANGED
|
@@ -52,8 +52,8 @@ const zipIn = (other) => (elem, ndx) => {
|
|
|
52
52
|
return [elem, other[ndx]];
|
|
53
53
|
};
|
|
54
54
|
exports.zipIn = zipIn;
|
|
55
|
-
function assertExhaustive(val) {
|
|
56
|
-
throw new Error(`Never has a value (${val}).`);
|
|
55
|
+
function assertExhaustive(val, message) {
|
|
56
|
+
throw new Error(message || `Never has a value (${val}).`);
|
|
57
57
|
}
|
|
58
58
|
exports.assertExhaustive = assertExhaustive;
|
|
59
59
|
function partition(arr, predicate) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FIRESTORE_EVENTS = exports.TEST_LAB_EVENT = exports.REMOTE_CONFIG_EVENT = exports.DATABASE_EVENTS = exports.FIREBASE_ALERTS_PUBLISH_EVENT = exports.STORAGE_EVENTS = exports.PUBSUB_PUBLISH_EVENT = void 0;
|
|
3
|
+
exports.FIRESTORE_EVENT_WITH_AUTH_CONTEXT_REGEX = exports.FIRESTORE_EVENT_REGEX = exports.FIRESTORE_EVENTS = exports.TEST_LAB_EVENT = exports.REMOTE_CONFIG_EVENT = 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",
|
|
@@ -22,4 +22,10 @@ exports.FIRESTORE_EVENTS = [
|
|
|
22
22
|
"google.cloud.firestore.document.v1.created",
|
|
23
23
|
"google.cloud.firestore.document.v1.updated",
|
|
24
24
|
"google.cloud.firestore.document.v1.deleted",
|
|
25
|
+
"google.cloud.firestore.document.v1.written.withAuthContext",
|
|
26
|
+
"google.cloud.firestore.document.v1.created.withAuthContext",
|
|
27
|
+
"google.cloud.firestore.document.v1.updated.withAuthContext",
|
|
28
|
+
"google.cloud.firestore.document.v1.deleted.withAuthContext",
|
|
25
29
|
];
|
|
30
|
+
exports.FIRESTORE_EVENT_REGEX = /^google\.cloud\.firestore\.document\.v1\.[^\.]*$/;
|
|
31
|
+
exports.FIRESTORE_EVENT_WITH_AUTH_CONTEXT_REGEX = /^google\.cloud\.firestore\.document\.v1\..*\.withAuthContext$/;
|
package/lib/functions/secrets.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateEndpointSecret = exports.pruneAndDestroySecrets = exports.pruneSecrets = exports.versionInUse = exports.inUse = exports.getSecretVersions = exports.of = exports.ensureSecret = exports.ensureValidKey =
|
|
3
|
+
exports.describeSecret = exports.updateEndpointSecret = exports.pruneAndDestroySecrets = exports.pruneSecrets = exports.versionInUse = exports.inUse = exports.getSecretVersions = exports.of = exports.ensureSecret = exports.ensureValidKey = void 0;
|
|
4
4
|
const utils = require("../utils");
|
|
5
5
|
const poller = require("../operation-poller");
|
|
6
6
|
const gcfV1 = require("../gcp/cloudfunctions");
|
|
7
7
|
const gcfV2 = require("../gcp/cloudfunctionsv2");
|
|
8
|
-
const ensureApiEnabled = require("../ensureApiEnabled");
|
|
9
8
|
const api_1 = require("../api");
|
|
10
9
|
const secretManager_1 = require("../gcp/secretManager");
|
|
11
10
|
const error_1 = require("../error");
|
|
@@ -14,8 +13,10 @@ const prompt_1 = require("../prompt");
|
|
|
14
13
|
const env_1 = require("./env");
|
|
15
14
|
const logger_1 = require("../logger");
|
|
16
15
|
const functional_1 = require("../functional");
|
|
16
|
+
const secretManager_2 = require("../gcp/secretManager");
|
|
17
|
+
const secretManager_3 = require("../gcp/secretManager");
|
|
17
18
|
const projectUtils_1 = require("../projectUtils");
|
|
18
|
-
const
|
|
19
|
+
const Table = require("cli-table");
|
|
19
20
|
const gcfV1PollerOptions = {
|
|
20
21
|
apiOrigin: (0, api_1.functionsOrigin)(),
|
|
21
22
|
apiVersion: "v1",
|
|
@@ -28,25 +29,12 @@ const gcfV2PollerOptions = {
|
|
|
28
29
|
masterTimeout: 25 * 60 * 1000,
|
|
29
30
|
maxBackoff: 10000,
|
|
30
31
|
};
|
|
31
|
-
function isFirebaseManaged(secret) {
|
|
32
|
-
return Object.keys(secret.labels || []).includes(FIREBASE_MANAGED);
|
|
33
|
-
}
|
|
34
|
-
exports.isFirebaseManaged = isFirebaseManaged;
|
|
35
|
-
function labels() {
|
|
36
|
-
return { [FIREBASE_MANAGED]: "true" };
|
|
37
|
-
}
|
|
38
|
-
exports.labels = labels;
|
|
39
32
|
function toUpperSnakeCase(key) {
|
|
40
33
|
return key
|
|
41
34
|
.replace(/[.-]/g, "_")
|
|
42
35
|
.replace(/([a-z])([A-Z])/g, "$1_$2")
|
|
43
36
|
.toUpperCase();
|
|
44
37
|
}
|
|
45
|
-
function ensureApi(options) {
|
|
46
|
-
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
47
|
-
return ensureApiEnabled.ensure(projectId, (0, api_1.secretManagerOrigin)(), "secretmanager", true);
|
|
48
|
-
}
|
|
49
|
-
exports.ensureApi = ensureApi;
|
|
50
38
|
async function ensureValidKey(key, options) {
|
|
51
39
|
const transformedKey = toUpperSnakeCase(key);
|
|
52
40
|
if (transformedKey !== key) {
|
|
@@ -76,20 +64,36 @@ exports.ensureValidKey = ensureValidKey;
|
|
|
76
64
|
async function ensureSecret(projectId, name, options) {
|
|
77
65
|
try {
|
|
78
66
|
const secret = await (0, secretManager_1.getSecret)(projectId, name);
|
|
79
|
-
if (
|
|
67
|
+
if ((0, secretManager_1.isAppHostingManaged)(secret)) {
|
|
68
|
+
(0, utils_1.logWarning)("Your secret is managed by Firebase App Hosting. Continuing will disable automatic deletion of old versions.");
|
|
69
|
+
const stopTracking = await (0, prompt_1.promptOnce)({
|
|
70
|
+
name: "doNotTrack",
|
|
71
|
+
type: "confirm",
|
|
72
|
+
default: false,
|
|
73
|
+
message: "Do you wish to continue?",
|
|
74
|
+
}, options);
|
|
75
|
+
if (stopTracking) {
|
|
76
|
+
delete secret.labels[secretManager_2.FIREBASE_MANAGED];
|
|
77
|
+
await (0, secretManager_1.patchSecret)(secret.projectId, secret.name, secret.labels);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
throw new Error("A secret cannot be managed by both Firebase App Hosting and Cloud Functions for Firebase");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
else if (!(0, secretManager_2.isFunctionsManaged)(secret)) {
|
|
80
84
|
if (!options.force) {
|
|
81
|
-
(0, utils_1.logWarning)("Your secret is not managed by Firebase. " +
|
|
85
|
+
(0, utils_1.logWarning)("Your secret is not managed by Cloud Functions for Firebase. " +
|
|
82
86
|
"Firebase managed secrets are automatically pruned to reduce your monthly cost for using Secret Manager. ");
|
|
83
87
|
const confirm = await (0, prompt_1.promptOnce)({
|
|
84
88
|
name: "updateLabels",
|
|
85
89
|
type: "confirm",
|
|
86
90
|
default: true,
|
|
87
|
-
message: `Would you like to have your secret ${secret.name} managed by Firebase?`,
|
|
91
|
+
message: `Would you like to have your secret ${secret.name} managed by Cloud Functions for Firebase?`,
|
|
88
92
|
}, options);
|
|
89
93
|
if (confirm) {
|
|
90
94
|
return (0, secretManager_1.patchSecret)(projectId, secret.name, {
|
|
91
95
|
...secret.labels,
|
|
92
|
-
...labels(),
|
|
96
|
+
...(0, secretManager_3.labels)(),
|
|
93
97
|
});
|
|
94
98
|
}
|
|
95
99
|
}
|
|
@@ -101,7 +105,7 @@ async function ensureSecret(projectId, name, options) {
|
|
|
101
105
|
throw err;
|
|
102
106
|
}
|
|
103
107
|
}
|
|
104
|
-
return await (0, secretManager_1.createSecret)(projectId, name, labels());
|
|
108
|
+
return await (0, secretManager_1.createSecret)(projectId, name, (0, secretManager_3.labels)());
|
|
105
109
|
}
|
|
106
110
|
exports.ensureSecret = ensureSecret;
|
|
107
111
|
function of(endpoints) {
|
|
@@ -142,7 +146,7 @@ async function pruneSecrets(projectInfo, endpoints) {
|
|
|
142
146
|
const { projectId, projectNumber } = projectInfo;
|
|
143
147
|
const pruneKey = (name, version) => `${name}@${version}`;
|
|
144
148
|
const prunedSecrets = new Set();
|
|
145
|
-
const haveSecrets = await (0, secretManager_1.listSecrets)(projectId, `labels.${FIREBASE_MANAGED}=true`);
|
|
149
|
+
const haveSecrets = await (0, secretManager_1.listSecrets)(projectId, `labels.${secretManager_2.FIREBASE_MANAGED}=true`);
|
|
146
150
|
for (const secret of haveSecrets) {
|
|
147
151
|
const versions = await (0, secretManager_1.listSecretVersions)(projectId, secret.name, `NOT state: DESTROYED`);
|
|
148
152
|
for (const version of versions) {
|
|
@@ -252,3 +256,17 @@ async function updateEndpointSecret(projectInfo, secretVersion, endpoint) {
|
|
|
252
256
|
}
|
|
253
257
|
}
|
|
254
258
|
exports.updateEndpointSecret = updateEndpointSecret;
|
|
259
|
+
async function describeSecret(key, options) {
|
|
260
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
261
|
+
const versions = await (0, secretManager_1.listSecretVersions)(projectId, key);
|
|
262
|
+
const table = new Table({
|
|
263
|
+
head: ["Version", "State"],
|
|
264
|
+
style: { head: ["yellow"] },
|
|
265
|
+
});
|
|
266
|
+
for (const version of versions) {
|
|
267
|
+
table.push([version.versionId, version.state]);
|
|
268
|
+
}
|
|
269
|
+
logger_1.logger.info(table.toString());
|
|
270
|
+
return { secrets: versions };
|
|
271
|
+
}
|
|
272
|
+
exports.describeSecret = describeSecret;
|
package/lib/gcp/apphosting.js
CHANGED
|
@@ -38,8 +38,20 @@ async function getBackend(projectId, location, backendId) {
|
|
|
38
38
|
exports.getBackend = getBackend;
|
|
39
39
|
async function listBackends(projectId, location) {
|
|
40
40
|
const name = `projects/${projectId}/locations/${location}/backends`;
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
let pageToken;
|
|
42
|
+
const res = {
|
|
43
|
+
backends: [],
|
|
44
|
+
unreachable: [],
|
|
45
|
+
};
|
|
46
|
+
do {
|
|
47
|
+
const queryParams = pageToken ? { pageToken } : {};
|
|
48
|
+
const int = await exports.client.get(name, { queryParams });
|
|
49
|
+
res.backends.push(...(int.body.backends || []));
|
|
50
|
+
res.unreachable?.push(...(int.body.unreachable || []));
|
|
51
|
+
pageToken = int.body.nextPageToken;
|
|
52
|
+
} while (pageToken);
|
|
53
|
+
res.unreachable = [...new Set(res.unreachable)];
|
|
54
|
+
return res;
|
|
43
55
|
}
|
|
44
56
|
exports.listBackends = listBackends;
|
|
45
57
|
async function deleteBackend(projectId, location, backendId) {
|
package/lib/gcp/cloudbuild.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDefaultServiceAgent = exports.getDefaultServiceAccount = exports.deleteRepository = exports.getRepository = exports.createRepository = exports.fetchLinkableRepositories = exports.deleteConnection = exports.listConnections = exports.getConnection = exports.createConnection = void 0;
|
|
4
4
|
const apiv2_1 = require("../apiv2");
|
|
5
5
|
const api_1 = require("../api");
|
|
6
6
|
const PAGE_SIZE_MAX = 100;
|
|
@@ -74,7 +74,11 @@ async function deleteRepository(projectId, location, connectionId, repositoryId)
|
|
|
74
74
|
return res.body;
|
|
75
75
|
}
|
|
76
76
|
exports.deleteRepository = deleteRepository;
|
|
77
|
-
function
|
|
77
|
+
function getDefaultServiceAccount(projectNumber) {
|
|
78
|
+
return `${projectNumber}@cloudbuild.gserviceaccount.com`;
|
|
79
|
+
}
|
|
80
|
+
exports.getDefaultServiceAccount = getDefaultServiceAccount;
|
|
81
|
+
function getDefaultServiceAgent(projectNumber) {
|
|
78
82
|
return `service-${projectNumber}@gcp-sa-cloudbuild.iam.gserviceaccount.com`;
|
|
79
83
|
}
|
|
80
|
-
exports.
|
|
84
|
+
exports.getDefaultServiceAgent = getDefaultServiceAgent;
|
|
@@ -7,7 +7,7 @@ const logger_1 = require("../logger");
|
|
|
7
7
|
const backend = require("../deploy/functions/backend");
|
|
8
8
|
const utils = require("../utils");
|
|
9
9
|
const proto = require("./proto");
|
|
10
|
-
const
|
|
10
|
+
const supported = require("../deploy/functions/runtimes/supported");
|
|
11
11
|
const projectConfig = require("../functions/projectConfig");
|
|
12
12
|
const apiv2_1 = require("../apiv2");
|
|
13
13
|
const api_1 = require("../api");
|
|
@@ -243,8 +243,8 @@ function endpointFromFunction(gcfFunction) {
|
|
|
243
243
|
uri = gcfFunction.httpsTrigger.url;
|
|
244
244
|
securityLevel = gcfFunction.httpsTrigger.securityLevel;
|
|
245
245
|
}
|
|
246
|
-
if (!
|
|
247
|
-
logger_1.logger.debug("
|
|
246
|
+
if (!supported.isRuntime(gcfFunction.runtime)) {
|
|
247
|
+
logger_1.logger.debug("GCF 1st gen function has unsupported runtime:", JSON.stringify(gcfFunction, null, 2));
|
|
248
248
|
}
|
|
249
249
|
const endpoint = {
|
|
250
250
|
platform: "gcfv1",
|
|
@@ -280,9 +280,9 @@ function functionFromEndpoint(endpoint, sourceUploadUrl) {
|
|
|
280
280
|
if (endpoint.platform !== "gcfv1") {
|
|
281
281
|
throw new error_1.FirebaseError("Trying to create a v1 CloudFunction with v2 API. This should never happen");
|
|
282
282
|
}
|
|
283
|
-
if (!
|
|
283
|
+
if (!supported.isRuntime(endpoint.runtime)) {
|
|
284
284
|
throw new error_1.FirebaseError("Failed internal assertion. Trying to deploy a new function with a deprecated runtime." +
|
|
285
|
-
" This should never happen");
|
|
285
|
+
" This should never happen", { exit: 1 });
|
|
286
286
|
}
|
|
287
287
|
const gcfFunction = {
|
|
288
288
|
name: backend.functionName(endpoint),
|
|
@@ -7,7 +7,7 @@ const api_1 = require("../api");
|
|
|
7
7
|
const logger_1 = require("../logger");
|
|
8
8
|
const v2_1 = require("../functions/events/v2");
|
|
9
9
|
const backend = require("../deploy/functions/backend");
|
|
10
|
-
const
|
|
10
|
+
const supported = require("../deploy/functions/runtimes/supported");
|
|
11
11
|
const proto = require("./proto");
|
|
12
12
|
const utils = require("../utils");
|
|
13
13
|
const projectConfig = require("../functions/projectConfig");
|
|
@@ -185,7 +185,7 @@ function functionFromEndpoint(endpoint) {
|
|
|
185
185
|
if (endpoint.platform !== "gcfv2") {
|
|
186
186
|
throw new error_1.FirebaseError("Trying to create a v2 CloudFunction with v1 API. This should never happen");
|
|
187
187
|
}
|
|
188
|
-
if (!
|
|
188
|
+
if (!supported.isRuntime(endpoint.runtime)) {
|
|
189
189
|
throw new error_1.FirebaseError("Failed internal assertion. Trying to deploy a new function with a deprecated runtime." +
|
|
190
190
|
" This should never happen");
|
|
191
191
|
}
|
|
@@ -358,7 +358,7 @@ function endpointFromFunction(gcfFunction) {
|
|
|
358
358
|
else {
|
|
359
359
|
trigger = { httpsTrigger: {} };
|
|
360
360
|
}
|
|
361
|
-
if (!
|
|
361
|
+
if (!supported.isRuntime(gcfFunction.buildConfig.runtime)) {
|
|
362
362
|
logger_1.logger.debug("GCFv2 function has a deprecated runtime:", JSON.stringify(gcfFunction, null, 2));
|
|
363
363
|
}
|
|
364
364
|
const endpoint = {
|
|
@@ -8,7 +8,7 @@ const api_1 = require("../api");
|
|
|
8
8
|
const apiv2_1 = require("../apiv2");
|
|
9
9
|
const backend = require("../deploy/functions/backend");
|
|
10
10
|
const proto = require("./proto");
|
|
11
|
-
const
|
|
11
|
+
const gce = require("../gcp/computeEngine");
|
|
12
12
|
const functional_1 = require("../functional");
|
|
13
13
|
const VERSION = "v1";
|
|
14
14
|
const DEFAULT_TIME_ZONE_V1 = "America/Los_Angeles";
|
|
@@ -129,7 +129,7 @@ function jobFromEndpoint(endpoint, location, projectNumber) {
|
|
|
129
129
|
uri: endpoint.uri,
|
|
130
130
|
httpMethod: "POST",
|
|
131
131
|
oidcToken: {
|
|
132
|
-
serviceAccountEmail: endpoint.serviceAccount ??
|
|
132
|
+
serviceAccountEmail: endpoint.serviceAccount ?? gce.getDefaultServiceAccount(projectNumber),
|
|
133
133
|
},
|
|
134
134
|
};
|
|
135
135
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultServiceAccount = void 0;
|
|
4
|
+
function getDefaultServiceAccount(projectNumber) {
|
|
5
|
+
return `${projectNumber}-compute@developer.gserviceaccount.com`;
|
|
6
|
+
}
|
|
7
|
+
exports.getDefaultServiceAccount = getDefaultServiceAccount;
|
package/lib/gcp/devConnect.js
CHANGED
|
@@ -1,27 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.serviceAgentEmail = exports.getGitRepositoryLink = exports.createGitRepositoryLink = exports.listAllLinkableGitRepositories = exports.listAllConnections = exports.getConnection = exports.createConnection = exports.client = void 0;
|
|
3
|
+
exports.generateP4SA = exports.serviceAgentEmail = exports.getGitRepositoryLink = exports.createGitRepositoryLink = exports.listAllLinkableGitRepositories = exports.listAllConnections = exports.getConnection = exports.deleteConnection = exports.createConnection = exports.client = void 0;
|
|
4
4
|
const apiv2_1 = require("../apiv2");
|
|
5
5
|
const api_1 = require("../api");
|
|
6
|
+
const serviceusage_1 = require("./serviceusage");
|
|
6
7
|
const PAGE_SIZE_MAX = 1000;
|
|
8
|
+
const LOCATION_OVERRIDE = process.env.FIREBASE_DEVELOPERCONNECT_LOCATION_OVERRIDE;
|
|
7
9
|
exports.client = new apiv2_1.Client({
|
|
8
10
|
urlPrefix: (0, api_1.developerConnectOrigin)(),
|
|
9
11
|
auth: true,
|
|
10
12
|
apiVersion: "v1",
|
|
11
13
|
});
|
|
12
|
-
async function createConnection(projectId, location, connectionId, githubConfig) {
|
|
14
|
+
async function createConnection(projectId, location, connectionId, githubConfig = {}) {
|
|
13
15
|
const config = {
|
|
14
16
|
...githubConfig,
|
|
15
17
|
githubApp: "FIREBASE",
|
|
16
18
|
};
|
|
17
|
-
const res = await exports.client.post(`projects/${projectId}/locations/${location}/connections`, {
|
|
19
|
+
const res = await exports.client.post(`projects/${projectId}/locations/${LOCATION_OVERRIDE ?? location}/connections`, {
|
|
18
20
|
githubConfig: config,
|
|
19
21
|
}, { queryParams: { connectionId } });
|
|
20
22
|
return res.body;
|
|
21
23
|
}
|
|
22
24
|
exports.createConnection = createConnection;
|
|
25
|
+
async function deleteConnection(projectId, location, connectionId) {
|
|
26
|
+
const name = `projects/${projectId}/locations/${LOCATION_OVERRIDE ?? location}/connections/${connectionId}`;
|
|
27
|
+
const res = await exports.client.delete(name, { queryParams: { force: "true" } });
|
|
28
|
+
return res.body;
|
|
29
|
+
}
|
|
30
|
+
exports.deleteConnection = deleteConnection;
|
|
23
31
|
async function getConnection(projectId, location, connectionId) {
|
|
24
|
-
const name = `projects/${projectId}/locations/${location}/connections/${connectionId}`;
|
|
32
|
+
const name = `projects/${projectId}/locations/${LOCATION_OVERRIDE ?? location}/connections/${connectionId}`;
|
|
25
33
|
const res = await exports.client.get(name);
|
|
26
34
|
return res.body;
|
|
27
35
|
}
|
|
@@ -29,7 +37,7 @@ exports.getConnection = getConnection;
|
|
|
29
37
|
async function listAllConnections(projectId, location) {
|
|
30
38
|
const conns = [];
|
|
31
39
|
const getNextPage = async (pageToken = "") => {
|
|
32
|
-
const res = await exports.client.get(`/projects/${projectId}/locations/${location}/connections`, {
|
|
40
|
+
const res = await exports.client.get(`/projects/${projectId}/locations/${LOCATION_OVERRIDE ?? location}/connections`, {
|
|
33
41
|
queryParams: {
|
|
34
42
|
pageSize: PAGE_SIZE_MAX,
|
|
35
43
|
pageToken,
|
|
@@ -47,17 +55,17 @@ async function listAllConnections(projectId, location) {
|
|
|
47
55
|
}
|
|
48
56
|
exports.listAllConnections = listAllConnections;
|
|
49
57
|
async function listAllLinkableGitRepositories(projectId, location, connectionId) {
|
|
50
|
-
const name = `projects/${projectId}/locations/${location}/connections/${connectionId}:
|
|
58
|
+
const name = `projects/${projectId}/locations/${LOCATION_OVERRIDE ?? location}/connections/${connectionId}:fetchLinkableGitRepositories`;
|
|
51
59
|
const repos = [];
|
|
52
60
|
const getNextPage = async (pageToken = "") => {
|
|
53
61
|
const res = await exports.client.get(name, {
|
|
54
62
|
queryParams: {
|
|
55
|
-
PAGE_SIZE_MAX,
|
|
63
|
+
pageSize: PAGE_SIZE_MAX,
|
|
56
64
|
pageToken,
|
|
57
65
|
},
|
|
58
66
|
});
|
|
59
|
-
if (Array.isArray(res.body.
|
|
60
|
-
repos.push(...res.body.
|
|
67
|
+
if (Array.isArray(res.body.linkableGitRepositories)) {
|
|
68
|
+
repos.push(...res.body.linkableGitRepositories);
|
|
61
69
|
}
|
|
62
70
|
if (res.body.nextPageToken) {
|
|
63
71
|
await getNextPage(res.body.nextPageToken);
|
|
@@ -68,12 +76,12 @@ async function listAllLinkableGitRepositories(projectId, location, connectionId)
|
|
|
68
76
|
}
|
|
69
77
|
exports.listAllLinkableGitRepositories = listAllLinkableGitRepositories;
|
|
70
78
|
async function createGitRepositoryLink(projectId, location, connectionId, gitRepositoryLinkId, cloneUri) {
|
|
71
|
-
const res = await exports.client.post(`projects/${projectId}/locations/${location}/connections/${connectionId}/gitRepositoryLinks`, { cloneUri }, { queryParams: { gitRepositoryLinkId } });
|
|
79
|
+
const res = await exports.client.post(`projects/${projectId}/locations/${LOCATION_OVERRIDE ?? location}/connections/${connectionId}/gitRepositoryLinks`, { cloneUri }, { queryParams: { gitRepositoryLinkId } });
|
|
72
80
|
return res.body;
|
|
73
81
|
}
|
|
74
82
|
exports.createGitRepositoryLink = createGitRepositoryLink;
|
|
75
83
|
async function getGitRepositoryLink(projectId, location, connectionId, gitRepositoryLinkId) {
|
|
76
|
-
const name = `projects/${projectId}/locations/${location}/connections/${connectionId}/gitRepositoryLinks/${gitRepositoryLinkId}`;
|
|
84
|
+
const name = `projects/${projectId}/locations/${LOCATION_OVERRIDE ?? location}/connections/${connectionId}/gitRepositoryLinks/${gitRepositoryLinkId}`;
|
|
77
85
|
const res = await exports.client.get(name);
|
|
78
86
|
return res.body;
|
|
79
87
|
}
|
|
@@ -82,3 +90,8 @@ function serviceAgentEmail(projectNumber) {
|
|
|
82
90
|
return `service-${projectNumber}@${(0, api_1.developerConnectP4SAOrigin)()}`;
|
|
83
91
|
}
|
|
84
92
|
exports.serviceAgentEmail = serviceAgentEmail;
|
|
93
|
+
async function generateP4SA(projectNumber) {
|
|
94
|
+
const devConnectOrigin = (0, api_1.developerConnectOrigin)();
|
|
95
|
+
await (0, serviceusage_1.generateServiceIdentityAndPoll)(projectNumber, new URL(devConnectOrigin).hostname, "apphosting");
|
|
96
|
+
}
|
|
97
|
+
exports.generateP4SA = generateP4SA;
|
package/lib/gcp/iam.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testIamPermissions = exports.testResourceIamPermissions = exports.getRole = exports.listServiceAccountKeys = exports.deleteServiceAccount = exports.createServiceAccountKey = exports.getServiceAccount = exports.createServiceAccount = void 0;
|
|
3
|
+
exports.testIamPermissions = exports.testResourceIamPermissions = exports.getRole = exports.listServiceAccountKeys = exports.deleteServiceAccount = exports.createServiceAccountKey = exports.getServiceAccount = exports.createServiceAccount = exports.getDefaultComputeEngineServiceAgent = exports.getDefaultCloudBuildServiceAgent = void 0;
|
|
4
4
|
const api_1 = require("../api");
|
|
5
5
|
const logger_1 = require("../logger");
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
7
7
|
const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.iamOrigin)(), apiVersion: "v1" });
|
|
8
|
+
function getDefaultCloudBuildServiceAgent(projectNumber) {
|
|
9
|
+
return `${projectNumber}@cloudbuild.gserviceaccount.com`;
|
|
10
|
+
}
|
|
11
|
+
exports.getDefaultCloudBuildServiceAgent = getDefaultCloudBuildServiceAgent;
|
|
12
|
+
function getDefaultComputeEngineServiceAgent(projectNumber) {
|
|
13
|
+
return `${projectNumber}-compute@developer.gserviceaccount.com`;
|
|
14
|
+
}
|
|
15
|
+
exports.getDefaultComputeEngineServiceAgent = getDefaultComputeEngineServiceAgent;
|
|
8
16
|
async function createServiceAccount(projectId, accountId, description, displayName) {
|
|
9
17
|
const response = await apiClient.post(`/projects/${projectId}/serviceAccounts`, {
|
|
10
18
|
accountId,
|
package/lib/gcp/secretManager.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureServiceAgentRole = exports.setIamPolicy = exports.getIamPolicy = exports.addVersion = exports.deleteSecret = exports.patchSecret = exports.createSecret = exports.toSecretVersionResourceName = exports.parseSecretVersionResourceName = exports.parseSecretResourceName = exports.secretExists = exports.destroySecretVersion = exports.accessSecretVersion = exports.getSecretVersion = exports.listSecretVersions = exports.getSecretMetadata = exports.listSecrets = exports.getSecret = exports.secretManagerConsoleUri = void 0;
|
|
3
|
+
exports.labels = exports.ensureApi = exports.isAppHostingManaged = exports.isFunctionsManaged = exports.FIREBASE_MANAGED = exports.ensureServiceAgentRole = exports.setIamPolicy = exports.getIamPolicy = exports.addVersion = exports.deleteSecret = exports.patchSecret = exports.createSecret = exports.toSecretVersionResourceName = exports.parseSecretVersionResourceName = exports.parseSecretResourceName = exports.secretExists = exports.destroySecretVersion = exports.accessSecretVersion = exports.getSecretVersion = exports.listSecretVersions = exports.getSecretMetadata = exports.listSecrets = exports.getSecret = exports.secretManagerConsoleUri = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const error_1 = require("../error");
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
7
7
|
const api_1 = require("../api");
|
|
8
|
+
const ensureApiEnabled = require("../ensureApiEnabled");
|
|
9
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
10
|
const SECRET_NAME_REGEX = new RegExp("projects\\/" +
|
|
9
11
|
"(?<project>(?:\\d+)|(?:[A-Za-z]+[A-Za-z\\d-]*[A-Za-z\\d]?))\\/" +
|
|
10
12
|
"secrets\\/" +
|
|
@@ -18,6 +20,7 @@ async function getSecret(projectId, name) {
|
|
|
18
20
|
const getRes = await client.get(`projects/${projectId}/secrets/${name}`);
|
|
19
21
|
const secret = parseSecretResourceName(getRes.body.name);
|
|
20
22
|
secret.labels = getRes.body.labels ?? {};
|
|
23
|
+
secret.replication = getRes.body.replication ?? {};
|
|
21
24
|
return secret;
|
|
22
25
|
}
|
|
23
26
|
exports.getSecret = getSecret;
|
|
@@ -35,6 +38,7 @@ async function listSecrets(projectId, filter) {
|
|
|
35
38
|
secrets.push({
|
|
36
39
|
...parseSecretResourceName(s.name),
|
|
37
40
|
labels: s.labels ?? {},
|
|
41
|
+
replication: s.replication ?? {},
|
|
38
42
|
});
|
|
39
43
|
}
|
|
40
44
|
if (!res.body.nextPageToken) {
|
|
@@ -73,6 +77,7 @@ async function listSecretVersions(projectId, name, filter) {
|
|
|
73
77
|
secrets.push({
|
|
74
78
|
...parseSecretVersionResourceName(s.name),
|
|
75
79
|
state: s.state,
|
|
80
|
+
createTime: s.createTime,
|
|
76
81
|
});
|
|
77
82
|
}
|
|
78
83
|
if (!res.body.nextPageToken) {
|
|
@@ -88,6 +93,7 @@ async function getSecretVersion(projectId, name, version) {
|
|
|
88
93
|
return {
|
|
89
94
|
...parseSecretVersionResourceName(getRes.body.name),
|
|
90
95
|
state: getRes.body.state,
|
|
96
|
+
createTime: getRes.body.createTime,
|
|
91
97
|
};
|
|
92
98
|
}
|
|
93
99
|
exports.getSecretVersion = getSecretVersion;
|
|
@@ -125,6 +131,8 @@ function parseSecretResourceName(resourceName) {
|
|
|
125
131
|
return {
|
|
126
132
|
projectId: match.groups.project,
|
|
127
133
|
name: match.groups.secret,
|
|
134
|
+
labels: {},
|
|
135
|
+
replication: {},
|
|
128
136
|
};
|
|
129
137
|
}
|
|
130
138
|
exports.parseSecretResourceName = parseSecretResourceName;
|
|
@@ -137,8 +145,11 @@ function parseSecretVersionResourceName(resourceName) {
|
|
|
137
145
|
secret: {
|
|
138
146
|
projectId: match.groups.project,
|
|
139
147
|
name: match.groups.secret,
|
|
148
|
+
labels: {},
|
|
149
|
+
replication: {},
|
|
140
150
|
},
|
|
141
151
|
versionId: match.groups.version,
|
|
152
|
+
createTime: "",
|
|
142
153
|
};
|
|
143
154
|
}
|
|
144
155
|
exports.parseSecretVersionResourceName = parseSecretVersionResourceName;
|
|
@@ -146,24 +157,42 @@ function toSecretVersionResourceName(secretVersion) {
|
|
|
146
157
|
return `projects/${secretVersion.secret.projectId}/secrets/${secretVersion.secret.name}/versions/${secretVersion.versionId}`;
|
|
147
158
|
}
|
|
148
159
|
exports.toSecretVersionResourceName = toSecretVersionResourceName;
|
|
149
|
-
async function createSecret(projectId, name, labels) {
|
|
160
|
+
async function createSecret(projectId, name, labels, location) {
|
|
161
|
+
let replication;
|
|
162
|
+
if (location) {
|
|
163
|
+
replication = {
|
|
164
|
+
userManaged: {
|
|
165
|
+
replicas: [
|
|
166
|
+
{
|
|
167
|
+
location,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
replication = { automatic: {} };
|
|
175
|
+
}
|
|
150
176
|
const createRes = await client.post(`projects/${projectId}/secrets`, {
|
|
151
177
|
name,
|
|
152
|
-
replication
|
|
153
|
-
automatic: {},
|
|
154
|
-
},
|
|
178
|
+
replication,
|
|
155
179
|
labels,
|
|
156
180
|
}, { queryParams: { secretId: name } });
|
|
157
181
|
return {
|
|
158
182
|
...parseSecretResourceName(createRes.body.name),
|
|
159
183
|
labels,
|
|
184
|
+
replication,
|
|
160
185
|
};
|
|
161
186
|
}
|
|
162
187
|
exports.createSecret = createSecret;
|
|
163
188
|
async function patchSecret(projectId, name, labels) {
|
|
164
189
|
const fullName = `projects/${projectId}/secrets/${name}`;
|
|
165
190
|
const res = await client.patch(fullName, { name: fullName, labels }, { queryParams: { updateMask: "labels" } });
|
|
166
|
-
return
|
|
191
|
+
return {
|
|
192
|
+
...parseSecretResourceName(res.body.name),
|
|
193
|
+
labels: res.body.labels,
|
|
194
|
+
replication: res.body.replication,
|
|
195
|
+
};
|
|
167
196
|
}
|
|
168
197
|
exports.patchSecret = patchSecret;
|
|
169
198
|
async function deleteSecret(projectId, name) {
|
|
@@ -180,6 +209,7 @@ async function addVersion(projectId, name, payloadData) {
|
|
|
180
209
|
return {
|
|
181
210
|
...parseSecretVersionResourceName(res.body.name),
|
|
182
211
|
state: res.body.state,
|
|
212
|
+
createTime: "",
|
|
183
213
|
};
|
|
184
214
|
}
|
|
185
215
|
exports.addVersion = addVersion;
|
|
@@ -218,3 +248,21 @@ async function ensureServiceAgentRole(secret, serviceAccountEmails, role) {
|
|
|
218
248
|
(0, utils_1.logLabeledSuccess)("secretmanager", `Granted ${role} on projects/${secret.projectId}/secrets/${secret.name} to ${serviceAccountEmails.join(", ")}`);
|
|
219
249
|
}
|
|
220
250
|
exports.ensureServiceAgentRole = ensureServiceAgentRole;
|
|
251
|
+
exports.FIREBASE_MANAGED = "firebase-managed";
|
|
252
|
+
function isFunctionsManaged(secret) {
|
|
253
|
+
return (secret.labels[exports.FIREBASE_MANAGED] === "true" || secret.labels[exports.FIREBASE_MANAGED] === "functions");
|
|
254
|
+
}
|
|
255
|
+
exports.isFunctionsManaged = isFunctionsManaged;
|
|
256
|
+
function isAppHostingManaged(secret) {
|
|
257
|
+
return secret.labels[exports.FIREBASE_MANAGED] === "apphosting";
|
|
258
|
+
}
|
|
259
|
+
exports.isAppHostingManaged = isAppHostingManaged;
|
|
260
|
+
function ensureApi(options) {
|
|
261
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
262
|
+
return ensureApiEnabled.ensure(projectId, (0, api_1.secretManagerOrigin)(), "secretmanager", true);
|
|
263
|
+
}
|
|
264
|
+
exports.ensureApi = ensureApi;
|
|
265
|
+
function labels(product = "functions") {
|
|
266
|
+
return { [exports.FIREBASE_MANAGED]: product };
|
|
267
|
+
}
|
|
268
|
+
exports.labels = labels;
|