firebase-tools-with-isolate 13.3.1 → 13.6.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 +1 -1
- package/lib/accountImporter.js +1 -1
- package/lib/api.js +112 -55
- package/lib/apiv2.js +10 -3
- package/lib/appdistribution/client.js +4 -4
- package/lib/auth.js +17 -17
- package/lib/commands/apphosting-backends-delete.js +3 -38
- package/lib/commands/apphosting-backends-get.js +2 -32
- package/lib/commands/apphosting-backends-list.js +12 -5
- package/lib/commands/hosting-disable.js +1 -1
- package/lib/commands/open.js +1 -1
- package/lib/database/metadata.js +3 -3
- package/lib/defaultCredentials.js +2 -2
- package/lib/deploy/extensions/v2FunctionHelper.js +2 -1
- package/lib/deploy/functions/backend.js +5 -1
- package/lib/deploy/functions/build.js +10 -7
- package/lib/deploy/functions/containerCleaner.js +4 -4
- package/lib/deploy/functions/deploy.js +8 -2
- package/lib/deploy/functions/ensure.js +2 -2
- package/lib/deploy/functions/prepare.js +6 -9
- package/lib/deploy/functions/release/fabricator.js +9 -5
- package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +2 -1
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +2 -2
- package/lib/deploy/hosting/uploader.js +1 -1
- package/lib/deploy/index.js +1 -1
- package/lib/deploy/remoteconfig/functions.js +1 -1
- package/lib/emulator/adminSdkConfig.js +1 -1
- package/lib/emulator/commandUtils.js +7 -4
- package/lib/emulator/controller.js +3 -4
- package/lib/emulator/downloadableEmulators.js +10 -10
- package/lib/emulator/functionsEmulator.js +21 -1
- package/lib/ensureApiEnabled.js +9 -7
- package/lib/extensions/extensionsApi.js +5 -5
- package/lib/extensions/extensionsHelper.js +4 -4
- package/lib/extensions/provisioningHelper.js +2 -2
- package/lib/extensions/publishHelpers.js +1 -1
- package/lib/extensions/publisherApi.js +3 -3
- package/lib/extensions/resolveSource.js +1 -1
- package/lib/extensions/secretsUtils.js +2 -1
- package/lib/extensions/tos.js +1 -1
- package/lib/fetchMOTD.js +1 -1
- package/lib/fetchWebSetup.js +4 -3
- package/lib/firestore/api-sort.js +17 -0
- package/lib/firestore/api.js +9 -2
- package/lib/firestore/checkDatabaseType.js +1 -1
- package/lib/firestore/delete.js +1 -1
- package/lib/firestore/pretty-print.js +11 -2
- package/lib/frameworks/index.js +6 -2
- package/lib/frameworks/next/constants.js +38 -1
- package/lib/frameworks/next/index.js +25 -3
- package/lib/frameworks/next/utils.js +20 -1
- package/lib/functions/secrets.js +3 -3
- package/lib/functionsConfig.js +1 -1
- package/lib/gcp/apphosting.js +22 -17
- package/lib/gcp/artifactregistry.js +1 -1
- package/lib/gcp/auth.js +6 -3
- package/lib/gcp/cloudbilling.js +1 -1
- package/lib/gcp/cloudbuild.js +1 -1
- package/lib/gcp/cloudfunctions.js +1 -1
- package/lib/gcp/cloudfunctionsv2.js +4 -1
- package/lib/gcp/cloudlogging.js +1 -1
- package/lib/gcp/cloudmonitoring.js +1 -1
- package/lib/gcp/cloudscheduler.js +2 -2
- package/lib/gcp/cloudtasks.js +1 -1
- package/lib/gcp/devConnect.js +84 -0
- package/lib/gcp/eventarc.js +1 -1
- package/lib/gcp/firestore.js +2 -2
- package/lib/gcp/iam.js +2 -2
- package/lib/gcp/identityPlatform.js +1 -1
- package/lib/gcp/pubsub.js +1 -1
- package/lib/gcp/resourceManager.js +2 -1
- package/lib/gcp/rules.js +1 -1
- package/lib/gcp/run.js +1 -1
- package/lib/gcp/runtimeconfig.js +1 -1
- package/lib/gcp/secretManager.js +1 -1
- package/lib/gcp/serviceusage.js +1 -1
- package/lib/gcp/storage.js +12 -8
- package/lib/hosting/api.js +14 -3
- package/lib/hosting/cloudRunProxy.js +1 -1
- package/lib/init/features/apphosting/index.js +5 -5
- package/lib/init/features/apphosting/repo.js +84 -99
- package/lib/init/features/database.js +2 -1
- package/lib/init/features/extensions/index.js +2 -1
- package/lib/init/features/functions/index.js +3 -2
- package/lib/init/features/hosting/github.js +4 -3
- package/lib/management/apps.js +4 -4
- package/lib/management/database.js +1 -1
- package/lib/management/projects.js +4 -4
- package/lib/remoteconfig/get.js +1 -1
- package/lib/remoteconfig/rollback.js +1 -1
- package/lib/remoteconfig/versionslist.js +1 -1
- package/lib/serve/functions.js +2 -0
- package/lib/shortenUrl.js +2 -2
- package/lib/utils.js +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
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;
|
|
4
|
+
const apiv2_1 = require("../apiv2");
|
|
5
|
+
const api_1 = require("../api");
|
|
6
|
+
const PAGE_SIZE_MAX = 1000;
|
|
7
|
+
exports.client = new apiv2_1.Client({
|
|
8
|
+
urlPrefix: (0, api_1.developerConnectOrigin)(),
|
|
9
|
+
auth: true,
|
|
10
|
+
apiVersion: "v1",
|
|
11
|
+
});
|
|
12
|
+
async function createConnection(projectId, location, connectionId, githubConfig) {
|
|
13
|
+
const config = {
|
|
14
|
+
...githubConfig,
|
|
15
|
+
githubApp: "FIREBASE",
|
|
16
|
+
};
|
|
17
|
+
const res = await exports.client.post(`projects/${projectId}/locations/${location}/connections`, {
|
|
18
|
+
githubConfig: config,
|
|
19
|
+
}, { queryParams: { connectionId } });
|
|
20
|
+
return res.body;
|
|
21
|
+
}
|
|
22
|
+
exports.createConnection = createConnection;
|
|
23
|
+
async function getConnection(projectId, location, connectionId) {
|
|
24
|
+
const name = `projects/${projectId}/locations/${location}/connections/${connectionId}`;
|
|
25
|
+
const res = await exports.client.get(name);
|
|
26
|
+
return res.body;
|
|
27
|
+
}
|
|
28
|
+
exports.getConnection = getConnection;
|
|
29
|
+
async function listAllConnections(projectId, location) {
|
|
30
|
+
const conns = [];
|
|
31
|
+
const getNextPage = async (pageToken = "") => {
|
|
32
|
+
const res = await exports.client.get(`/projects/${projectId}/locations/${location}/connections`, {
|
|
33
|
+
queryParams: {
|
|
34
|
+
pageSize: PAGE_SIZE_MAX,
|
|
35
|
+
pageToken,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
if (Array.isArray(res.body.connections)) {
|
|
39
|
+
conns.push(...res.body.connections);
|
|
40
|
+
}
|
|
41
|
+
if (res.body.nextPageToken) {
|
|
42
|
+
await getNextPage(res.body.nextPageToken);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
await getNextPage();
|
|
46
|
+
return conns;
|
|
47
|
+
}
|
|
48
|
+
exports.listAllConnections = listAllConnections;
|
|
49
|
+
async function listAllLinkableGitRepositories(projectId, location, connectionId) {
|
|
50
|
+
const name = `projects/${projectId}/locations/${location}/connections/${connectionId}:fetchLinkableRepositories`;
|
|
51
|
+
const repos = [];
|
|
52
|
+
const getNextPage = async (pageToken = "") => {
|
|
53
|
+
const res = await exports.client.get(name, {
|
|
54
|
+
queryParams: {
|
|
55
|
+
PAGE_SIZE_MAX,
|
|
56
|
+
pageToken,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
if (Array.isArray(res.body.repositories)) {
|
|
60
|
+
repos.push(...res.body.repositories);
|
|
61
|
+
}
|
|
62
|
+
if (res.body.nextPageToken) {
|
|
63
|
+
await getNextPage(res.body.nextPageToken);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
await getNextPage();
|
|
67
|
+
return repos;
|
|
68
|
+
}
|
|
69
|
+
exports.listAllLinkableGitRepositories = listAllLinkableGitRepositories;
|
|
70
|
+
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 } });
|
|
72
|
+
return res.body;
|
|
73
|
+
}
|
|
74
|
+
exports.createGitRepositoryLink = createGitRepositoryLink;
|
|
75
|
+
async function getGitRepositoryLink(projectId, location, connectionId, gitRepositoryLinkId) {
|
|
76
|
+
const name = `projects/${projectId}/locations/${location}/connections/${connectionId}/gitRepositoryLinks/${gitRepositoryLinkId}`;
|
|
77
|
+
const res = await exports.client.get(name);
|
|
78
|
+
return res.body;
|
|
79
|
+
}
|
|
80
|
+
exports.getGitRepositoryLink = getGitRepositoryLink;
|
|
81
|
+
function serviceAgentEmail(projectNumber) {
|
|
82
|
+
return `service-${projectNumber}@${(0, api_1.developerConnectP4SAOrigin)()}`;
|
|
83
|
+
}
|
|
84
|
+
exports.serviceAgentEmail = serviceAgentEmail;
|
package/lib/gcp/eventarc.js
CHANGED
|
@@ -7,7 +7,7 @@ const lodash_1 = require("lodash");
|
|
|
7
7
|
const proto_1 = require("./proto");
|
|
8
8
|
exports.API_VERSION = "v1";
|
|
9
9
|
const client = new apiv2_1.Client({
|
|
10
|
-
urlPrefix: api_1.eventarcOrigin,
|
|
10
|
+
urlPrefix: (0, api_1.eventarcOrigin)(),
|
|
11
11
|
auth: true,
|
|
12
12
|
apiVersion: exports.API_VERSION,
|
|
13
13
|
});
|
package/lib/gcp/firestore.js
CHANGED
|
@@ -9,12 +9,12 @@ const error_1 = require("../error");
|
|
|
9
9
|
const prodOnlyClient = new apiv2_1.Client({
|
|
10
10
|
auth: true,
|
|
11
11
|
apiVersion: "v1",
|
|
12
|
-
urlPrefix: api_1.firestoreOrigin,
|
|
12
|
+
urlPrefix: (0, api_1.firestoreOrigin)(),
|
|
13
13
|
});
|
|
14
14
|
const emuOrProdClient = new apiv2_1.Client({
|
|
15
15
|
auth: true,
|
|
16
16
|
apiVersion: "v1",
|
|
17
|
-
urlPrefix: api_1.firestoreOriginOrEmulator,
|
|
17
|
+
urlPrefix: (0, api_1.firestoreOriginOrEmulator)(),
|
|
18
18
|
});
|
|
19
19
|
var DayOfWeek;
|
|
20
20
|
(function (DayOfWeek) {
|
package/lib/gcp/iam.js
CHANGED
|
@@ -4,7 +4,7 @@ exports.testIamPermissions = exports.testResourceIamPermissions = exports.getRol
|
|
|
4
4
|
const api_1 = require("../api");
|
|
5
5
|
const logger_1 = require("../logger");
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
7
|
-
const apiClient = new apiv2_1.Client({ urlPrefix: api_1.iamOrigin, apiVersion: "v1" });
|
|
7
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.iamOrigin)(), apiVersion: "v1" });
|
|
8
8
|
async function createServiceAccount(projectId, accountId, description, displayName) {
|
|
9
9
|
const response = await apiClient.post(`/projects/${projectId}/serviceAccounts`, {
|
|
10
10
|
accountId,
|
|
@@ -71,6 +71,6 @@ async function testResourceIamPermissions(origin, apiVersion, resourceName, perm
|
|
|
71
71
|
}
|
|
72
72
|
exports.testResourceIamPermissions = testResourceIamPermissions;
|
|
73
73
|
async function testIamPermissions(projectId, permissions) {
|
|
74
|
-
return testResourceIamPermissions(api_1.resourceManagerOrigin, "v1", `projects/${projectId}`, permissions, `projects/${projectId}`);
|
|
74
|
+
return testResourceIamPermissions((0, api_1.resourceManagerOrigin)(), "v1", `projects/${projectId}`, permissions, `projects/${projectId}`);
|
|
75
75
|
}
|
|
76
76
|
exports.testIamPermissions = testIamPermissions;
|
|
@@ -6,7 +6,7 @@ const api_1 = require("../api");
|
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
7
7
|
const API_VERSION = "v2";
|
|
8
8
|
const adminApiClient = new apiv2_1.Client({
|
|
9
|
-
urlPrefix: api_1.identityOrigin + "/admin",
|
|
9
|
+
urlPrefix: (0, api_1.identityOrigin)() + "/admin",
|
|
10
10
|
apiVersion: API_VERSION,
|
|
11
11
|
});
|
|
12
12
|
async function getBlockingFunctionsConfig(project) {
|
package/lib/gcp/pubsub.js
CHANGED
|
@@ -6,13 +6,14 @@ const api_1 = require("../api");
|
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
7
7
|
const iam_1 = require("./iam");
|
|
8
8
|
const API_VERSION = "v1";
|
|
9
|
-
const apiClient = new apiv2_1.Client({ urlPrefix: api_1.resourceManagerOrigin, apiVersion: API_VERSION });
|
|
9
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.resourceManagerOrigin)(), apiVersion: API_VERSION });
|
|
10
10
|
exports.firebaseRoles = {
|
|
11
11
|
apiKeysViewer: "roles/serviceusage.apiKeysViewer",
|
|
12
12
|
authAdmin: "roles/firebaseauth.admin",
|
|
13
13
|
functionsDeveloper: "roles/cloudfunctions.developer",
|
|
14
14
|
hostingAdmin: "roles/firebasehosting.admin",
|
|
15
15
|
runViewer: "roles/run.viewer",
|
|
16
|
+
serviceUsageConsumer: "roles/serviceusage.serviceUsageConsumer",
|
|
16
17
|
};
|
|
17
18
|
async function getIamPolicy(projectIdOrNumber) {
|
|
18
19
|
const response = await apiClient.post(`/projects/${projectIdOrNumber}:getIamPolicy`);
|
package/lib/gcp/rules.js
CHANGED
|
@@ -6,7 +6,7 @@ const apiv2_1 = require("../apiv2");
|
|
|
6
6
|
const logger_1 = require("../logger");
|
|
7
7
|
const utils = require("../utils");
|
|
8
8
|
const API_VERSION = "v1";
|
|
9
|
-
const apiClient = new apiv2_1.Client({ urlPrefix: api_1.rulesOrigin, apiVersion: API_VERSION });
|
|
9
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.rulesOrigin)(), apiVersion: API_VERSION });
|
|
10
10
|
function _handleErrorResponse(response) {
|
|
11
11
|
if (response.body && response.body.error) {
|
|
12
12
|
return utils.reject(response.body.error, { code: 2 });
|
package/lib/gcp/run.js
CHANGED
|
@@ -9,7 +9,7 @@ const throttler_1 = require("../throttler/throttler");
|
|
|
9
9
|
const logger_1 = require("../logger");
|
|
10
10
|
const API_VERSION = "v1";
|
|
11
11
|
const client = new apiv2_1.Client({
|
|
12
|
-
urlPrefix: api_1.runOrigin,
|
|
12
|
+
urlPrefix: (0, api_1.runOrigin)(),
|
|
13
13
|
auth: true,
|
|
14
14
|
apiVersion: API_VERSION,
|
|
15
15
|
});
|
package/lib/gcp/runtimeconfig.js
CHANGED
|
@@ -6,7 +6,7 @@ const api_1 = require("../api");
|
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
7
7
|
const logger_1 = require("../logger");
|
|
8
8
|
const API_VERSION = "v1beta1";
|
|
9
|
-
const apiClient = new apiv2_1.Client({ urlPrefix: api_1.runtimeconfigOrigin, apiVersion: API_VERSION });
|
|
9
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.runtimeconfigOrigin)(), apiVersion: API_VERSION });
|
|
10
10
|
function listConfigs(projectId) {
|
|
11
11
|
return apiClient
|
|
12
12
|
.get(`/projects/${projectId}/configs`, {
|
package/lib/gcp/secretManager.js
CHANGED
|
@@ -13,7 +13,7 @@ const SECRET_VERSION_NAME_REGEX = new RegExp(SECRET_NAME_REGEX.source + "\\/vers
|
|
|
13
13
|
const secretManagerConsoleUri = (projectId) => `https://console.cloud.google.com/security/secret-manager?project=${projectId}`;
|
|
14
14
|
exports.secretManagerConsoleUri = secretManagerConsoleUri;
|
|
15
15
|
const API_VERSION = "v1";
|
|
16
|
-
const client = new apiv2_1.Client({ urlPrefix: api_1.secretManagerOrigin, apiVersion: API_VERSION });
|
|
16
|
+
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.secretManagerOrigin)(), apiVersion: API_VERSION });
|
|
17
17
|
async function getSecret(projectId, name) {
|
|
18
18
|
const getRes = await client.get(`projects/${projectId}/secrets/${name}`);
|
|
19
19
|
const secret = parseSecretResourceName(getRes.body.name);
|
package/lib/gcp/serviceusage.js
CHANGED
|
@@ -7,7 +7,7 @@ const apiv2_1 = require("../apiv2");
|
|
|
7
7
|
const error_1 = require("../error");
|
|
8
8
|
const utils = require("../utils");
|
|
9
9
|
const apiClient = new apiv2_1.Client({
|
|
10
|
-
urlPrefix: api_1.serviceUsageOrigin,
|
|
10
|
+
urlPrefix: (0, api_1.serviceUsageOrigin)(),
|
|
11
11
|
apiVersion: "v1beta1",
|
|
12
12
|
});
|
|
13
13
|
async function generateServiceIdentity(projectNumber, service, prefix) {
|
package/lib/gcp/storage.js
CHANGED
|
@@ -9,9 +9,12 @@ const error_1 = require("../error");
|
|
|
9
9
|
const logger_1 = require("../logger");
|
|
10
10
|
const ensureApiEnabled_1 = require("../ensureApiEnabled");
|
|
11
11
|
async function getDefaultBucket(projectId) {
|
|
12
|
-
await (0, ensureApiEnabled_1.ensure)(projectId,
|
|
12
|
+
await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.firebaseStorageOrigin)(), "storage", false);
|
|
13
13
|
try {
|
|
14
|
-
const localAPIClient = new apiv2_1.Client({
|
|
14
|
+
const localAPIClient = new apiv2_1.Client({
|
|
15
|
+
urlPrefix: (0, api_1.firebaseStorageOrigin)(),
|
|
16
|
+
apiVersion: "v1alpha",
|
|
17
|
+
});
|
|
15
18
|
const response = await localAPIClient.get(`/projects/${projectId}/defaultBucket`);
|
|
16
19
|
if (!response.body?.bucket.name) {
|
|
17
20
|
logger_1.logger.debug("Default storage bucket is undefined.");
|
|
@@ -28,7 +31,7 @@ async function getDefaultBucket(projectId) {
|
|
|
28
31
|
}
|
|
29
32
|
}
|
|
30
33
|
exports.getDefaultBucket = getDefaultBucket;
|
|
31
|
-
async function upload(source, uploadUrl, extraHeaders) {
|
|
34
|
+
async function upload(source, uploadUrl, extraHeaders, ignoreQuotaProject) {
|
|
32
35
|
const url = new URL(uploadUrl);
|
|
33
36
|
const localAPIClient = new apiv2_1.Client({ urlPrefix: url.origin, auth: false });
|
|
34
37
|
const res = await localAPIClient.request({
|
|
@@ -42,6 +45,7 @@ async function upload(source, uploadUrl, extraHeaders) {
|
|
|
42
45
|
},
|
|
43
46
|
body: source.stream,
|
|
44
47
|
skipLog: { resBody: true },
|
|
48
|
+
ignoreQuotaProject,
|
|
45
49
|
});
|
|
46
50
|
return {
|
|
47
51
|
generation: res.response.headers.get("x-goog-generation"),
|
|
@@ -52,7 +56,7 @@ async function uploadObject(source, bucketName) {
|
|
|
52
56
|
if (path.extname(source.file) !== ".zip") {
|
|
53
57
|
throw new error_1.FirebaseError(`Expected a file name ending in .zip, got ${source.file}`);
|
|
54
58
|
}
|
|
55
|
-
const localAPIClient = new apiv2_1.Client({ urlPrefix: api_1.storageOrigin });
|
|
59
|
+
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
56
60
|
const location = `/${bucketName}/${path.basename(source.file)}`;
|
|
57
61
|
const res = await localAPIClient.request({
|
|
58
62
|
method: "PUT",
|
|
@@ -71,13 +75,13 @@ async function uploadObject(source, bucketName) {
|
|
|
71
75
|
}
|
|
72
76
|
exports.uploadObject = uploadObject;
|
|
73
77
|
function deleteObject(location) {
|
|
74
|
-
const localAPIClient = new apiv2_1.Client({ urlPrefix: api_1.storageOrigin });
|
|
78
|
+
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
75
79
|
return localAPIClient.delete(location);
|
|
76
80
|
}
|
|
77
81
|
exports.deleteObject = deleteObject;
|
|
78
82
|
async function getBucket(bucketName) {
|
|
79
83
|
try {
|
|
80
|
-
const localAPIClient = new apiv2_1.Client({ urlPrefix: api_1.storageOrigin });
|
|
84
|
+
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
81
85
|
const result = await localAPIClient.get(`/storage/v1/b/${bucketName}`);
|
|
82
86
|
return result.body;
|
|
83
87
|
}
|
|
@@ -91,7 +95,7 @@ async function getBucket(bucketName) {
|
|
|
91
95
|
exports.getBucket = getBucket;
|
|
92
96
|
async function listBuckets(projectId) {
|
|
93
97
|
try {
|
|
94
|
-
const localAPIClient = new apiv2_1.Client({ urlPrefix: api_1.storageOrigin });
|
|
98
|
+
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
95
99
|
const result = await localAPIClient.get(`/storage/v1/b?project=${projectId}`);
|
|
96
100
|
return result.body.items.map((bucket) => bucket.name);
|
|
97
101
|
}
|
|
@@ -105,7 +109,7 @@ async function listBuckets(projectId) {
|
|
|
105
109
|
exports.listBuckets = listBuckets;
|
|
106
110
|
async function getServiceAccount(projectId) {
|
|
107
111
|
try {
|
|
108
|
-
const localAPIClient = new apiv2_1.Client({ urlPrefix: api_1.storageOrigin });
|
|
112
|
+
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
109
113
|
const response = await localAPIClient.get(`/storage/v1/projects/${projectId}/serviceAccount`);
|
|
110
114
|
return response.body;
|
|
111
115
|
}
|
package/lib/hosting/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDeploymentDomain = exports.getAllSiteDomains = exports.getSiteDomains = exports.cleanAuthState = exports.getCleanDomains = exports.removeAuthDomain = exports.addAuthDomains = exports.deleteSite = exports.updateSite = exports.createSite = exports.getSite = exports.listSites = exports.createRelease = exports.cloneVersion = exports.listVersions = exports.updateVersion = exports.createVersion = exports.deleteChannel = exports.updateChannelTtl = exports.createChannel = exports.listChannels = exports.getChannel = exports.normalizeName = exports.SiteType = void 0;
|
|
3
|
+
exports.getDeploymentDomain = exports.getAllSiteDomains = exports.getSiteDomains = exports.cleanAuthState = exports.getCleanDomains = exports.removeAuthDomain = exports.addAuthDomains = exports.deleteSite = exports.updateSite = exports.createSite = exports.getSite = exports.listDemoSites = exports.listSites = exports.createRelease = exports.cloneVersion = exports.listVersions = exports.updateVersion = exports.createVersion = exports.deleteChannel = exports.updateChannelTtl = exports.createChannel = exports.listChannels = exports.getChannel = exports.normalizeName = exports.SiteType = void 0;
|
|
4
4
|
const error_1 = require("../error");
|
|
5
5
|
const api_1 = require("../api");
|
|
6
6
|
const apiv2_1 = require("../apiv2");
|
|
@@ -28,7 +28,7 @@ function normalizeName(s) {
|
|
|
28
28
|
}
|
|
29
29
|
exports.normalizeName = normalizeName;
|
|
30
30
|
const apiClient = new apiv2_1.Client({
|
|
31
|
-
urlPrefix: api_1.hostingApiOrigin,
|
|
31
|
+
urlPrefix: (0, api_1.hostingApiOrigin)(),
|
|
32
32
|
apiVersion: "v1beta1",
|
|
33
33
|
auth: true,
|
|
34
34
|
});
|
|
@@ -120,7 +120,7 @@ async function cloneVersion(site, versionName, finalize = false) {
|
|
|
120
120
|
});
|
|
121
121
|
const { name: operationName } = res.body;
|
|
122
122
|
const pollRes = await operationPoller.pollOperation({
|
|
123
|
-
apiOrigin: api_1.hostingApiOrigin,
|
|
123
|
+
apiOrigin: (0, api_1.hostingApiOrigin)(),
|
|
124
124
|
apiVersion: "v1beta1",
|
|
125
125
|
operationResourceName: operationName,
|
|
126
126
|
masterTimeout: 600000,
|
|
@@ -156,6 +156,17 @@ async function listSites(project) {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
exports.listSites = listSites;
|
|
159
|
+
function listDemoSites(projectId) {
|
|
160
|
+
return [
|
|
161
|
+
{
|
|
162
|
+
name: `projects/${projectId}/sites/${projectId}`,
|
|
163
|
+
defaultUrl: `https://${projectId}.firebaseapp.com`,
|
|
164
|
+
appId: "fake-app-id",
|
|
165
|
+
labels: {},
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
exports.listDemoSites = listDemoSites;
|
|
159
170
|
async function getSite(project, site) {
|
|
160
171
|
try {
|
|
161
172
|
const res = await apiClient.get(`/projects/${project}/sites/${site}`);
|
|
@@ -7,7 +7,7 @@ const error_1 = require("../error");
|
|
|
7
7
|
const logger_1 = require("../logger");
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const cloudRunCache = {};
|
|
10
|
-
const apiClient = new apiv2_1.Client({ urlPrefix: api_1.cloudRunApiOrigin, apiVersion: "v1" });
|
|
10
|
+
const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudRunApiOrigin)(), apiVersion: "v1" });
|
|
11
11
|
async function getCloudRunUrl(rewrite, projectId) {
|
|
12
12
|
const alreadyFetched = cloudRunCache[`${rewrite.run.region}/${rewrite.run.serviceId}`];
|
|
13
13
|
if (alreadyFetched) {
|
|
@@ -17,17 +17,17 @@ const ensureApiEnabled_1 = require("../../../ensureApiEnabled");
|
|
|
17
17
|
const deploymentTool = require("../../../deploymentTool");
|
|
18
18
|
const DEFAULT_COMPUTE_SERVICE_ACCOUNT_NAME = "firebase-app-hosting-compute";
|
|
19
19
|
const apphostingPollerOptions = {
|
|
20
|
-
apiOrigin: api_1.apphostingOrigin,
|
|
20
|
+
apiOrigin: (0, api_1.apphostingOrigin)(),
|
|
21
21
|
apiVersion: apphosting_1.API_VERSION,
|
|
22
22
|
masterTimeout: 25 * 60 * 1000,
|
|
23
23
|
maxBackoff: 10000,
|
|
24
24
|
};
|
|
25
25
|
async function doSetup(projectId, location, serviceAccount) {
|
|
26
26
|
await Promise.all([
|
|
27
|
-
(0, ensureApiEnabled_1.ensure)(projectId,
|
|
28
|
-
(0, ensureApiEnabled_1.ensure)(projectId,
|
|
29
|
-
(0, ensureApiEnabled_1.ensure)(projectId,
|
|
30
|
-
(0, ensureApiEnabled_1.ensure)(projectId,
|
|
27
|
+
(0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.cloudbuildOrigin)(), "apphosting", true),
|
|
28
|
+
(0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.secretManagerOrigin)(), "apphosting", true),
|
|
29
|
+
(0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.cloudRunApiOrigin)(), "apphosting", true),
|
|
30
|
+
(0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.artifactRegistryDomain)(), "apphosting", true),
|
|
31
31
|
]);
|
|
32
32
|
const allowedLocations = (await apphosting.listLocations(projectId)).map((loc) => loc.locationId);
|
|
33
33
|
if (location) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchAllRepositories = exports.listAppHostingConnections = exports.getOrCreateRepository = exports.getOrCreateConnection = exports.createConnection = exports.linkGitHubRepository = exports.parseConnectionName = void 0;
|
|
3
|
+
exports.fetchAllRepositories = exports.listAppHostingConnections = exports.getOrCreateRepository = exports.getOrCreateConnection = exports.createConnection = exports.getOrCreateOauthConnection = exports.linkGitHubRepository = exports.parseConnectionName = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
5
|
const gcb = require("../../../gcp/cloudbuild");
|
|
6
6
|
const rm = require("../../../gcp/resourceManager");
|
|
@@ -29,7 +29,7 @@ function parseConnectionName(name) {
|
|
|
29
29
|
}
|
|
30
30
|
exports.parseConnectionName = parseConnectionName;
|
|
31
31
|
const gcbPollerOptions = {
|
|
32
|
-
apiOrigin: api_1.cloudbuildOrigin,
|
|
32
|
+
apiOrigin: (0, api_1.cloudbuildOrigin)(),
|
|
33
33
|
apiVersion: "v2",
|
|
34
34
|
masterTimeout: 25 * 60 * 1000,
|
|
35
35
|
maxBackoff: 10000,
|
|
@@ -48,106 +48,117 @@ function generateConnectionId() {
|
|
|
48
48
|
const randomHash = Math.random().toString(36).slice(6);
|
|
49
49
|
return `apphosting-github-conn-${randomHash}`;
|
|
50
50
|
}
|
|
51
|
-
const ADD_REPO_CHOICE = "@ADD_REPO";
|
|
52
51
|
const ADD_CONN_CHOICE = "@ADD_CONN";
|
|
53
|
-
const CONFIGURE_REMOTE_URI_CHOICES = [ADD_REPO_CHOICE, ADD_CONN_CHOICE];
|
|
54
52
|
async function linkGitHubRepository(projectId, location) {
|
|
55
53
|
utils.logBullet(clc.bold(`${clc.yellow("===")} Set up a GitHub connection`));
|
|
56
|
-
|
|
57
|
-
while (oauthConn.installationState.stage === "PENDING_USER_OAUTH") {
|
|
58
|
-
oauthConn = await promptConnectionAuth(oauthConn);
|
|
59
|
-
}
|
|
54
|
+
const oauthConn = await getOrCreateOauthConnection(projectId, location);
|
|
60
55
|
const existingConns = await listAppHostingConnections(projectId);
|
|
61
|
-
if (existingConns.length
|
|
62
|
-
|
|
63
|
-
if (!grantSuccess) {
|
|
64
|
-
throw new error_1.FirebaseError("Insufficient IAM permissions to create a new connection to GitHub");
|
|
65
|
-
}
|
|
66
|
-
const connectionId = generateConnectionId();
|
|
67
|
-
const conn = await createConnection(projectId, location, connectionId, {
|
|
68
|
-
authorizerCredential: oauthConn.githubConfig?.authorizerCredential,
|
|
69
|
-
});
|
|
70
|
-
let refreshedConn = conn;
|
|
71
|
-
while (refreshedConn.installationState.stage !== "COMPLETE") {
|
|
72
|
-
refreshedConn = await promptAppInstall(conn);
|
|
73
|
-
}
|
|
74
|
-
existingConns.push(refreshedConn);
|
|
56
|
+
if (existingConns.length === 0) {
|
|
57
|
+
existingConns.push(await createFullyInstalledConnection(projectId, location, generateConnectionId(), oauthConn));
|
|
75
58
|
}
|
|
76
|
-
let
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
await (
|
|
81
|
-
type: "input",
|
|
82
|
-
message: "Press ENTER once you have provided the GitHub app installation with access to your desired repository.",
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
else if (remoteUri === ADD_CONN_CHOICE) {
|
|
86
|
-
const connectionId = generateConnectionId();
|
|
87
|
-
const conn = await createConnection(projectId, location, connectionId, {
|
|
88
|
-
authorizerCredential: oauthConn.githubConfig?.authorizerCredential,
|
|
89
|
-
});
|
|
90
|
-
let refreshedConn = conn;
|
|
91
|
-
while (refreshedConn.installationState.stage !== "COMPLETE") {
|
|
92
|
-
refreshedConn = await promptAppInstall(conn);
|
|
93
|
-
}
|
|
94
|
-
existingConns.push(refreshedConn);
|
|
59
|
+
let repoRemoteUri;
|
|
60
|
+
let connection;
|
|
61
|
+
do {
|
|
62
|
+
if (repoRemoteUri === ADD_CONN_CHOICE) {
|
|
63
|
+
existingConns.push(await createFullyInstalledConnection(projectId, location, generateConnectionId(), oauthConn));
|
|
95
64
|
}
|
|
96
65
|
const selection = await promptRepositoryUri(projectId, existingConns);
|
|
97
|
-
|
|
66
|
+
repoRemoteUri = selection.remoteUri;
|
|
98
67
|
connection = selection.connection;
|
|
99
|
-
}
|
|
68
|
+
} while (repoRemoteUri === ADD_CONN_CHOICE);
|
|
100
69
|
const { id: connectionId } = parseConnectionName(connection.name);
|
|
101
70
|
await getOrCreateConnection(projectId, location, connectionId, {
|
|
102
71
|
authorizerCredential: connection.githubConfig?.authorizerCredential,
|
|
103
72
|
appInstallationId: connection.githubConfig?.appInstallationId,
|
|
104
73
|
});
|
|
105
|
-
const repo = await getOrCreateRepository(projectId, location, connectionId,
|
|
74
|
+
const repo = await getOrCreateRepository(projectId, location, connectionId, repoRemoteUri);
|
|
106
75
|
utils.logSuccess(`Successfully linked GitHub repository at remote URI`);
|
|
107
|
-
utils.logSuccess(`\t${
|
|
76
|
+
utils.logSuccess(`\t${repoRemoteUri}`);
|
|
108
77
|
return repo;
|
|
109
78
|
}
|
|
110
79
|
exports.linkGitHubRepository = linkGitHubRepository;
|
|
80
|
+
async function createFullyInstalledConnection(projectId, location, connectionId, oauthConn) {
|
|
81
|
+
let conn = await createConnection(projectId, location, connectionId, {
|
|
82
|
+
authorizerCredential: oauthConn.githubConfig?.authorizerCredential,
|
|
83
|
+
});
|
|
84
|
+
while (conn.installationState.stage !== "COMPLETE") {
|
|
85
|
+
utils.logBullet("Install the Cloud Build GitHub app to enable access to GitHub repositories");
|
|
86
|
+
const targetUri = conn.installationState.actionUri.replace("install_v2", "direct_install_v2");
|
|
87
|
+
utils.logBullet(targetUri);
|
|
88
|
+
await utils.openInBrowser(targetUri);
|
|
89
|
+
await (0, prompt_1.promptOnce)({
|
|
90
|
+
type: "input",
|
|
91
|
+
message: "Press Enter once you have installed or configured the Cloud Build GitHub app to access your GitHub repo.",
|
|
92
|
+
});
|
|
93
|
+
conn = await gcb.getConnection(projectId, location, connectionId);
|
|
94
|
+
}
|
|
95
|
+
return conn;
|
|
96
|
+
}
|
|
97
|
+
async function getOrCreateOauthConnection(projectId, location) {
|
|
98
|
+
let conn;
|
|
99
|
+
try {
|
|
100
|
+
conn = await gcb.getConnection(projectId, location, APPHOSTING_OAUTH_CONN_NAME);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
if (err.status === 404) {
|
|
104
|
+
await ensureSecretManagerAdminGrant(projectId);
|
|
105
|
+
conn = await createConnection(projectId, location, APPHOSTING_OAUTH_CONN_NAME);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
throw err;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
while (conn.installationState.stage === "PENDING_USER_OAUTH") {
|
|
112
|
+
utils.logBullet("You must authorize the Cloud Build GitHub app.");
|
|
113
|
+
utils.logBullet("Sign in to GitHub and authorize Cloud Build GitHub app:");
|
|
114
|
+
const { url, cleanup } = await utils.openInBrowserPopup(conn.installationState.actionUri, "Authorize the GitHub app");
|
|
115
|
+
utils.logBullet(`\t${url}`);
|
|
116
|
+
await (0, prompt_1.promptOnce)({
|
|
117
|
+
type: "input",
|
|
118
|
+
message: "Press Enter once you have authorized the app",
|
|
119
|
+
});
|
|
120
|
+
cleanup();
|
|
121
|
+
const { projectId, location, id } = parseConnectionName(conn.name);
|
|
122
|
+
conn = await gcb.getConnection(projectId, location, id);
|
|
123
|
+
}
|
|
124
|
+
return conn;
|
|
125
|
+
}
|
|
126
|
+
exports.getOrCreateOauthConnection = getOrCreateOauthConnection;
|
|
111
127
|
async function promptRepositoryUri(projectId, connections) {
|
|
112
128
|
const { repos, remoteUriToConnection } = await fetchAllRepositories(projectId, connections);
|
|
113
|
-
const searchRepos = (repos) => async (_, input = "") => {
|
|
114
|
-
return [
|
|
115
|
-
new inquirer.Separator(),
|
|
116
|
-
{
|
|
117
|
-
name: "Missing a repo? Select this option to configure your installation's access settings",
|
|
118
|
-
value: ADD_REPO_CHOICE,
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
name: "Missing an account or org? Select this option to create a new connection",
|
|
122
|
-
value: ADD_CONN_CHOICE,
|
|
123
|
-
},
|
|
124
|
-
new inquirer.Separator(),
|
|
125
|
-
...fuzzy
|
|
126
|
-
.filter(input, repos, {
|
|
127
|
-
extract: (repo) => extractRepoSlugFromUri(repo.remoteUri) || "",
|
|
128
|
-
})
|
|
129
|
-
.map((result) => {
|
|
130
|
-
return {
|
|
131
|
-
name: extractRepoSlugFromUri(result.original.remoteUri) || "",
|
|
132
|
-
value: result.original.remoteUri,
|
|
133
|
-
};
|
|
134
|
-
}),
|
|
135
|
-
];
|
|
136
|
-
};
|
|
137
129
|
const remoteUri = await (0, prompt_1.promptOnce)({
|
|
138
130
|
type: "autocomplete",
|
|
139
131
|
name: "remoteUri",
|
|
140
132
|
message: "Which of the following repositories would you like to deploy?",
|
|
141
|
-
source:
|
|
133
|
+
source: (_, input = "") => {
|
|
134
|
+
return new Promise((resolve) => resolve([
|
|
135
|
+
new inquirer.Separator(),
|
|
136
|
+
{
|
|
137
|
+
name: "Missing a repo? Select this option to configure your GitHub connection settings",
|
|
138
|
+
value: ADD_CONN_CHOICE,
|
|
139
|
+
},
|
|
140
|
+
new inquirer.Separator(),
|
|
141
|
+
...fuzzy
|
|
142
|
+
.filter(input, repos, {
|
|
143
|
+
extract: (repo) => extractRepoSlugFromUri(repo.remoteUri) || "",
|
|
144
|
+
})
|
|
145
|
+
.map((result) => {
|
|
146
|
+
return {
|
|
147
|
+
name: extractRepoSlugFromUri(result.original.remoteUri) || "",
|
|
148
|
+
value: result.original.remoteUri,
|
|
149
|
+
};
|
|
150
|
+
}),
|
|
151
|
+
]));
|
|
152
|
+
},
|
|
142
153
|
});
|
|
143
154
|
return { remoteUri, connection: remoteUriToConnection[remoteUri] };
|
|
144
155
|
}
|
|
145
|
-
async function
|
|
156
|
+
async function ensureSecretManagerAdminGrant(projectId) {
|
|
146
157
|
const projectNumber = await (0, getProjectNumber_1.getProjectNumber)({ projectId });
|
|
147
158
|
const cbsaEmail = gcb.serviceAgentEmail(projectNumber);
|
|
148
159
|
const alreadyGranted = await rm.serviceAccountHasRoles(projectId, cbsaEmail, ["roles/secretmanager.admin"], true);
|
|
149
160
|
if (alreadyGranted) {
|
|
150
|
-
return
|
|
161
|
+
return;
|
|
151
162
|
}
|
|
152
163
|
utils.logBullet("To create a new GitHub connection, Secret Manager Admin role (roles/secretmanager.admin) is required on the Cloud Build Service Agent.");
|
|
153
164
|
const grant = await (0, prompt_1.promptOnce)({
|
|
@@ -160,36 +171,10 @@ async function promptSecretManagerAdminGrant(projectId) {
|
|
|
160
171
|
`\tgcloud projects add-iam-policy-binding ${projectId} \\\n` +
|
|
161
172
|
`\t --member="serviceAccount:${cbsaEmail} \\\n` +
|
|
162
173
|
`\t --role="roles/secretmanager.admin\n`);
|
|
163
|
-
|
|
174
|
+
throw new error_1.FirebaseError("Insufficient IAM permissions to create a new connection to GitHub");
|
|
164
175
|
}
|
|
165
176
|
await rm.addServiceAccountToRoles(projectId, cbsaEmail, ["roles/secretmanager.admin"], true);
|
|
166
177
|
utils.logSuccess("Successfully granted the required role to the Cloud Build Service Agent!");
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
async function promptConnectionAuth(conn) {
|
|
170
|
-
utils.logBullet("You must authorize the Cloud Build GitHub app.");
|
|
171
|
-
utils.logBullet("Sign in to GitHub and authorize Cloud Build GitHub app:");
|
|
172
|
-
const { url, cleanup } = await utils.openInBrowserPopup(conn.installationState.actionUri, "Authorize the GitHub app");
|
|
173
|
-
utils.logBullet(`\t${url}`);
|
|
174
|
-
await (0, prompt_1.promptOnce)({
|
|
175
|
-
type: "input",
|
|
176
|
-
message: "Press Enter once you have authorized the app",
|
|
177
|
-
});
|
|
178
|
-
cleanup();
|
|
179
|
-
const { projectId, location, id } = parseConnectionName(conn.name);
|
|
180
|
-
return await gcb.getConnection(projectId, location, id);
|
|
181
|
-
}
|
|
182
|
-
async function promptAppInstall(conn) {
|
|
183
|
-
utils.logBullet("Install the Cloud Build GitHub app to enable access to GitHub repositories");
|
|
184
|
-
const targetUri = conn.installationState.actionUri.replace("install_v2", "direct_install_v2");
|
|
185
|
-
utils.logBullet(targetUri);
|
|
186
|
-
await utils.openInBrowser(targetUri);
|
|
187
|
-
await (0, prompt_1.promptOnce)({
|
|
188
|
-
type: "input",
|
|
189
|
-
message: "Press Enter once you have installed or configured the Cloud Build GitHub app to access your GitHub repo.",
|
|
190
|
-
});
|
|
191
|
-
const { projectId, location, id } = parseConnectionName(conn.name);
|
|
192
|
-
return await gcb.getConnection(projectId, location, id);
|
|
193
178
|
}
|
|
194
179
|
async function createConnection(projectId, location, connectionId, githubConfig) {
|
|
195
180
|
const op = await gcb.createConnection(projectId, location, connectionId, githubConfig);
|
|
@@ -12,6 +12,7 @@ const ensureApiEnabled_1 = require("../../ensureApiEnabled");
|
|
|
12
12
|
const getDefaultDatabaseInstance_1 = require("../../getDefaultDatabaseInstance");
|
|
13
13
|
const error_1 = require("../../error");
|
|
14
14
|
const apiv2_1 = require("../../apiv2");
|
|
15
|
+
const api_1 = require("../../api");
|
|
15
16
|
const DEFAULT_RULES = JSON.stringify({ rules: { ".read": "auth != null", ".write": "auth != null" } }, null, 2);
|
|
16
17
|
async function getDBRules(instanceDetails) {
|
|
17
18
|
if (!instanceDetails || !instanceDetails.name) {
|
|
@@ -70,7 +71,7 @@ async function doSetup(setup, config) {
|
|
|
70
71
|
setup.config = setup.config || {};
|
|
71
72
|
let instanceDetails;
|
|
72
73
|
if (setup.projectId) {
|
|
73
|
-
await (0, ensureApiEnabled_1.ensure)(setup.projectId,
|
|
74
|
+
await (0, ensureApiEnabled_1.ensure)(setup.projectId, (0, api_1.rtdbManagementOrigin)(), "database", false);
|
|
74
75
|
logger_1.logger.info();
|
|
75
76
|
setup.instance =
|
|
76
77
|
setup.instance || (await (0, getDefaultDatabaseInstance_1.getDefaultDatabaseInstance)({ project: setup.projectId }));
|
|
@@ -4,11 +4,12 @@ exports.doSetup = void 0;
|
|
|
4
4
|
const requirePermissions_1 = require("../../../requirePermissions");
|
|
5
5
|
const ensureApiEnabled_1 = require("../../../ensureApiEnabled");
|
|
6
6
|
const manifest = require("../../../extensions/manifest");
|
|
7
|
+
const api_1 = require("../../../api");
|
|
7
8
|
async function doSetup(setup, config, options) {
|
|
8
9
|
const projectId = setup?.rcfile?.projects?.default;
|
|
9
10
|
if (projectId) {
|
|
10
11
|
await (0, requirePermissions_1.requirePermissions)({ ...options, project: projectId });
|
|
11
|
-
await Promise.all([(0, ensureApiEnabled_1.ensure)(projectId,
|
|
12
|
+
await Promise.all([(0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.extensionsOrigin)(), "unused", true)]);
|
|
12
13
|
}
|
|
13
14
|
return manifest.writeEmptyManifest(config, options);
|
|
14
15
|
}
|