firebase-tools-with-isolate 13.3.1 → 13.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/api.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.githubApiOrigin = exports.githubOrigin = exports.apphostingOrigin = exports.serviceUsageOrigin = exports.cloudRunApiOrigin = exports.hostingApiOrigin = exports.firebaseStorageOrigin = exports.storageOrigin = exports.runtimeconfigOrigin = exports.rulesOrigin = exports.resourceManagerOrigin = exports.remoteConfigApiOrigin = exports.rtdbMetadataOrigin = exports.rtdbManagementOrigin = exports.realtimeOrigin = exports.extensionsTOSOrigin = exports.extensionsPublisherOrigin = exports.extensionsOrigin = exports.iamOrigin = exports.identityOrigin = exports.hostingOrigin = exports.googleOrigin = exports.pubsubOrigin = exports.cloudTasksOrigin = exports.cloudschedulerOrigin = exports.cloudbuildOrigin = exports.functionsDefaultRegion = exports.runOrigin = exports.functionsV2Origin = exports.functionsOrigin = exports.firestoreOrigin = exports.firestoreOriginOrEmulator = exports.firedataOrigin = exports.firebaseExtensionsRegistryOrigin = exports.firebaseApiOrigin = exports.eventarcOrigin = exports.dynamicLinksKey = exports.dynamicLinksOrigin = exports.deployOrigin = exports.consoleOrigin = exports.authOrigin = exports.appDistributionOrigin = exports.artifactRegistryDomain = exports.containerRegistryDomain = exports.cloudMonitoringOrigin = exports.cloudloggingOrigin = exports.cloudbillingOrigin = exports.clientSecret = exports.clientId = exports.authProxyOrigin = void 0;
4
- exports.setScopes = exports.getScopes = exports.githubClientSecret = exports.githubClientId = exports.secretManagerOrigin = void 0;
4
+ exports.setScopes = exports.getScopes = exports.githubClientSecret = exports.githubClientId = exports.computeOrigin = exports.secretManagerOrigin = void 0;
5
5
  const constants_1 = require("./emulator/constants");
6
6
  const logger_1 = require("./logger");
7
7
  const scopes = require("./scopes");
@@ -63,6 +63,7 @@ exports.apphostingOrigin = utils.envOverride("APPHOSTING_URL", "https://firebase
63
63
  exports.githubOrigin = utils.envOverride("GITHUB_URL", "https://github.com");
64
64
  exports.githubApiOrigin = utils.envOverride("GITHUB_API_URL", "https://api.github.com");
65
65
  exports.secretManagerOrigin = utils.envOverride("CLOUD_SECRET_MANAGER_URL", "https://secretmanager.googleapis.com");
66
+ exports.computeOrigin = utils.envOverride("COMPUTE_URL", "https://compute.googleapis.com");
66
67
  exports.githubClientId = utils.envOverride("GITHUB_CLIENT_ID", "89cf50f02ac6aaed3484");
67
68
  exports.githubClientSecret = utils.envOverride("GITHUB_CLIENT_SECRET", "3330d14abc895d9a74d5f17cd7a00711fa2c5bf0");
68
69
  function getScopes() {
@@ -5,20 +5,10 @@ const command_1 = require("../command");
5
5
  const projectUtils_1 = require("../projectUtils");
6
6
  const error_1 = require("../error");
7
7
  const prompt_1 = require("../prompt");
8
- const logger_1 = require("../logger");
9
8
  const constants_1 = require("../init/features/apphosting/constants");
10
9
  const utils = require("../utils");
11
10
  const apphosting = require("../gcp/apphosting");
12
- const Table = require("cli-table");
13
- const COLUMN_LENGTH = 20;
14
- const TABLE_HEAD = [
15
- "Backend Id",
16
- "Repository Name",
17
- "Location",
18
- "URL",
19
- "Created Date",
20
- "Updated Date",
21
- ];
11
+ const apphosting_backends_list_1 = require("./apphosting-backends-list");
22
12
  exports.command = new command_1.Command("apphosting:backends:delete <backend>")
23
13
  .description("delete a backend from a Firebase project")
24
14
  .option("-l, --location <location>", "App Backend location", "")
@@ -40,15 +30,9 @@ exports.command = new command_1.Command("apphosting:backends:delete <backend>")
40
30
  choices: allowedLocations,
41
31
  });
42
32
  }
43
- const table = new Table({
44
- head: TABLE_HEAD,
45
- style: { head: ["green"] },
46
- });
47
- table.colWidths = COLUMN_LENGTH;
48
33
  let backend;
49
34
  try {
50
35
  backend = await apphosting.getBackend(projectId, location, backendId);
51
- populateTable(backend, table);
52
36
  }
53
37
  catch (err) {
54
38
  throw new error_1.FirebaseError(`No backends found with given parameters. Command aborted.`, {
@@ -56,7 +40,8 @@ exports.command = new command_1.Command("apphosting:backends:delete <backend>")
56
40
  });
57
41
  }
58
42
  utils.logWarning("You are about to permanently delete the backend:");
59
- logger_1.logger.info(table.toString());
43
+ const backends = [backend];
44
+ (0, apphosting_backends_list_1.printBackendsTable)(backends);
60
45
  const confirmDeletion = await (0, prompt_1.promptOnce)({
61
46
  type: "confirm",
62
47
  name: "force",
@@ -75,23 +60,3 @@ exports.command = new command_1.Command("apphosting:backends:delete <backend>")
75
60
  }
76
61
  return backend;
77
62
  });
78
- function populateTable(backend, table) {
79
- const [location, , backendId] = backend.name.split("/").slice(3, 6);
80
- const entry = [
81
- backendId,
82
- backend.codebase.repository?.split("/").pop(),
83
- location,
84
- backend.uri,
85
- backend.createTime,
86
- backend.updateTime,
87
- ];
88
- const newRow = entry.map((name) => {
89
- const maxCellWidth = COLUMN_LENGTH - 2;
90
- const chunks = [];
91
- for (let i = 0; name && i < name.length; i += maxCellWidth) {
92
- chunks.push(name.substring(i, i + maxCellWidth));
93
- }
94
- return chunks.join("\n");
95
- });
96
- table.push(newRow);
97
- }
@@ -4,12 +4,9 @@ exports.command = void 0;
4
4
  const command_1 = require("../command");
5
5
  const projectUtils_1 = require("../projectUtils");
6
6
  const error_1 = require("../error");
7
- const logger_1 = require("../logger");
8
7
  const utils_1 = require("../utils");
9
8
  const apphosting = require("../gcp/apphosting");
10
- const Table = require("cli-table");
11
- const COLUMN_LENGTH = 20;
12
- const TABLE_HEAD = ["Backend Id", "Repository", "Location", "URL", "Created Date", "Updated Date"];
9
+ const apphosting_backends_list_1 = require("./apphosting-backends-list");
13
10
  exports.command = new command_1.Command("apphosting:backends:get <backendId>")
14
11
  .description("get backend details of a Firebase project")
15
12
  .option("-l, --location <location>", "app backend location", "-")
@@ -18,22 +15,15 @@ exports.command = new command_1.Command("apphosting:backends:get <backendId>")
18
15
  const projectId = (0, projectUtils_1.needProjectId)(options);
19
16
  const location = options.location;
20
17
  let backendsList = [];
21
- const table = new Table({
22
- head: TABLE_HEAD,
23
- style: { head: ["green"] },
24
- });
25
- table.colWidths = COLUMN_LENGTH;
26
18
  try {
27
19
  if (location !== "-") {
28
20
  const backendInRegion = await apphosting.getBackend(projectId, location, backendId);
29
21
  backendsList.push(backendInRegion);
30
- populateTable(backendInRegion, table);
31
22
  }
32
23
  else {
33
24
  const resp = await apphosting.listBackends(projectId, "-");
34
25
  const allBackends = resp.backends || [];
35
26
  backendsList = allBackends.filter((bkd) => bkd.name.split("/").pop() === backendId);
36
- backendsList.forEach((bkd) => populateTable(bkd, table));
37
27
  }
38
28
  }
39
29
  catch (err) {
@@ -43,26 +33,6 @@ exports.command = new command_1.Command("apphosting:backends:get <backendId>")
43
33
  (0, utils_1.logWarning)(`Found no backend with id: ${backendId}`);
44
34
  return;
45
35
  }
46
- logger_1.logger.info(table.toString());
36
+ (0, apphosting_backends_list_1.printBackendsTable)(backendsList);
47
37
  return backendsList[0];
48
38
  });
49
- function populateTable(backend, table) {
50
- const [location, , backendId] = backend.name.split("/").slice(3, 6);
51
- const entry = [
52
- backendId,
53
- backend.codebase.repository?.split("/").pop(),
54
- location,
55
- backend.uri,
56
- backend.createTime,
57
- backend.updateTime,
58
- ];
59
- const newRow = entry.map((name) => {
60
- const maxCellWidth = COLUMN_LENGTH - 2;
61
- const chunks = [];
62
- for (let i = 0; name && i < name.length; i += maxCellWidth) {
63
- chunks.push(name.substring(i, i + maxCellWidth));
64
- }
65
- return chunks.join("\n");
66
- });
67
- table.push(newRow);
68
- }
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.command = void 0;
4
- const Table = require("cli-table");
3
+ exports.printBackendsTable = exports.command = void 0;
5
4
  const command_1 = require("../command");
6
5
  const utils_1 = require("../utils");
7
6
  const error_1 = require("../error");
8
7
  const logger_1 = require("../logger");
9
8
  const projectUtils_1 = require("../projectUtils");
10
9
  const apphosting = require("../gcp/apphosting");
10
+ const Table = require("cli-table");
11
11
  const TABLE_HEAD = ["Backend ID", "Repository", "Location", "URL", "Created Date", "Updated Date"];
12
12
  exports.command = new command_1.Command("apphosting:backends:list")
13
13
  .description("list backends of a Firebase project")
@@ -16,7 +16,6 @@ exports.command = new command_1.Command("apphosting:backends:list")
16
16
  .action(async (options) => {
17
17
  const projectId = (0, projectUtils_1.needProjectId)(options);
18
18
  const location = options.location;
19
- const table = new Table({ head: TABLE_HEAD, style: { head: ["green"] } });
20
19
  let backendRes;
21
20
  try {
22
21
  backendRes = await apphosting.listBackends(projectId, location);
@@ -25,6 +24,14 @@ exports.command = new command_1.Command("apphosting:backends:list")
25
24
  throw new error_1.FirebaseError(`Unable to list backends present for project: ${projectId}. Please check the parameters you have provided.`, { original: err });
26
25
  }
27
26
  const backends = backendRes.backends ?? [];
27
+ printBackendsTable(backends);
28
+ return backends;
29
+ });
30
+ function printBackendsTable(backends) {
31
+ const table = new Table({
32
+ head: TABLE_HEAD,
33
+ style: { head: ["green"] },
34
+ });
28
35
  for (const backend of backends) {
29
36
  const [backendLocation, , backendId] = backend.name.split("/").slice(3, 6);
30
37
  table.push([
@@ -37,5 +44,5 @@ exports.command = new command_1.Command("apphosting:backends:list")
37
44
  ]);
38
45
  }
39
46
  logger_1.logger.info(table.toString());
40
- return backends;
41
- });
47
+ }
48
+ exports.printBackendsTable = printBackendsTable;
@@ -8,6 +8,7 @@ const error_1 = require("../../error");
8
8
  const ensureApiEnabled_1 = require("../../ensureApiEnabled");
9
9
  const planner = require("./planner");
10
10
  const projectUtils_1 = require("../../projectUtils");
11
+ const api_1 = require("../../api");
11
12
  const SERVICE_AGENT_ROLE = "roles/eventarc.eventReceiver";
12
13
  async function checkSpecForV2Functions(i) {
13
14
  const extensionSpec = await planner.getExtensionSpec(i);
@@ -16,7 +17,7 @@ async function checkSpecForV2Functions(i) {
16
17
  exports.checkSpecForV2Functions = checkSpecForV2Functions;
17
18
  async function ensureNecessaryV2ApisAndRoles(options) {
18
19
  const projectId = (0, projectUtils_1.needProjectId)(options);
19
- await (0, ensureApiEnabled_1.ensure)(projectId, "compute.googleapis.com", "extensions", options.markdown);
20
+ await (0, ensureApiEnabled_1.ensure)(projectId, api_1.computeOrigin, "extensions", options.markdown);
20
21
  await ensureComputeP4SARole(projectId);
21
22
  }
22
23
  exports.ensureNecessaryV2ApisAndRoles = ensureNecessaryV2ApisAndRoles;
@@ -8,9 +8,9 @@ const utils_1 = require("../../utils");
8
8
  const secretManager_1 = require("../../gcp/secretManager");
9
9
  const projects_1 = require("../../management/projects");
10
10
  const functional_1 = require("../../functional");
11
+ const api_1 = require("../../api");
11
12
  const backend = require("./backend");
12
13
  const FAQ_URL = "https://firebase.google.com/support/faq#functions-runtime";
13
- const CLOUD_BUILD_API = "cloudbuild.googleapis.com";
14
14
  const metadataCallCache = new Map();
15
15
  async function defaultServiceAccount(e) {
16
16
  let metadataCall = metadataCallCache.get(e.project);
@@ -53,7 +53,7 @@ function isPermissionError(e) {
53
53
  }
54
54
  async function cloudBuildEnabled(projectId) {
55
55
  try {
56
- await (0, ensureApiEnabled_1.ensure)(projectId, CLOUD_BUILD_API, "functions");
56
+ await (0, ensureApiEnabled_1.ensure)(projectId, api_1.cloudbuildOrigin, "functions");
57
57
  }
58
58
  catch (e) {
59
59
  if ((0, error_1.isBillingError)(e)) {
@@ -10,6 +10,7 @@ const functionsEnv = require("../../functions/env");
10
10
  const runtimes = require("./runtimes");
11
11
  const validate = require("./validate");
12
12
  const ensure = require("./ensure");
13
+ const api_1 = require("../../api");
13
14
  const functionsDeployHelper_1 = require("./functionsDeployHelper");
14
15
  const utils_1 = require("../../utils");
15
16
  const prepareFunctionsUpload_1 = require("./prepareFunctionsUpload");
@@ -39,10 +40,10 @@ async function prepare(context, options, payload) {
39
40
  (0, utils_1.logLabeledBullet)("functions", `preparing codebase ${clc.bold(codebase)} for deployment`);
40
41
  }
41
42
  const checkAPIsEnabled = await Promise.all([
42
- ensureApiEnabled.ensure(projectId, "cloudfunctions.googleapis.com", "functions"),
43
- ensureApiEnabled.check(projectId, "runtimeconfig.googleapis.com", "runtimeconfig", true),
43
+ ensureApiEnabled.ensure(projectId, api_1.functionsOrigin, "functions"),
44
+ ensureApiEnabled.check(projectId, api_1.runtimeconfigOrigin, "runtimeconfig", true),
44
45
  ensure.cloudBuildEnabled(projectId),
45
- ensureApiEnabled.ensure(projectId, "artifactregistry.googleapis.com", "artifactregistry"),
46
+ ensureApiEnabled.ensure(projectId, api_1.artifactRegistryDomain, "artifactregistry"),
46
47
  ]);
47
48
  const firebaseConfig = await functionsConfig.getFirebaseConfig(options);
48
49
  context.firebaseConfig = firebaseConfig;
@@ -156,12 +157,7 @@ async function prepare(context, options, payload) {
156
157
  return ensureApiEnabled.ensure(projectId, api, "functions", false);
157
158
  }));
158
159
  if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv2")) {
159
- const V2_APIS = [
160
- "run.googleapis.com",
161
- "eventarc.googleapis.com",
162
- "pubsub.googleapis.com",
163
- "storage.googleapis.com",
164
- ];
160
+ const V2_APIS = [api_1.cloudRunApiOrigin, api_1.eventarcOrigin, api_1.pubsubOrigin, api_1.storageOrigin];
165
161
  const enablements = V2_APIS.map((api) => {
166
162
  return ensureApiEnabled.ensure(context.projectId, api, "functions");
167
163
  });
@@ -15,7 +15,8 @@ const apiClient = new apiv2_1.Client({
15
15
  urlPrefix: api_1.serviceUsageOrigin,
16
16
  apiVersion: "v1",
17
17
  });
18
- async function check(projectId, apiName, prefix, silent = false) {
18
+ async function check(projectId, apiUri, prefix, silent = false) {
19
+ const apiName = apiUri.startsWith("http") ? new URL(apiUri).hostname : apiUri;
19
20
  const res = await apiClient.get(`/projects/${projectId}/services/${apiName}`, {
20
21
  headers: { "x-goog-quota-user": `projects/${projectId}` },
21
22
  skipLog: { resBody: true },
@@ -89,18 +90,19 @@ async function enableApiWithRetries(projectId, apiName, prefix, silent, enableme
89
90
  await enable(projectId, apiName);
90
91
  return pollCheckEnabled(projectId, apiName, prefix, silent, enablementRetries);
91
92
  }
92
- async function ensure(projectId, apiName, prefix, silent = false) {
93
+ async function ensure(projectId, apiUri, prefix, silent = false) {
94
+ const hostname = apiUri.startsWith("http") ? new URL(apiUri).hostname : apiUri;
93
95
  if (!silent) {
94
- utils.logLabeledBullet(prefix, `ensuring required API ${(0, colorette_1.bold)(apiName)} is enabled...`);
96
+ utils.logLabeledBullet(prefix, `ensuring required API ${(0, colorette_1.bold)(hostname)} is enabled...`);
95
97
  }
96
- const isEnabled = await check(projectId, apiName, prefix, silent);
98
+ const isEnabled = await check(projectId, hostname, prefix, silent);
97
99
  if (isEnabled) {
98
100
  return;
99
101
  }
100
102
  if (!silent) {
101
- utils.logLabeledWarning(prefix, `missing required API ${(0, colorette_1.bold)(apiName)}. Enabling now...`);
103
+ utils.logLabeledWarning(prefix, `missing required API ${(0, colorette_1.bold)(hostname)}. Enabling now...`);
102
104
  }
103
- return enableApiWithRetries(projectId, apiName, prefix, silent);
105
+ return enableApiWithRetries(projectId, hostname, prefix, silent);
104
106
  }
105
107
  exports.ensure = ensure;
106
108
  function enableApiURI(projectId, apiName) {
@@ -352,7 +352,7 @@ async function ensureExtensionsApiEnabled(options) {
352
352
  if (!projectId) {
353
353
  return;
354
354
  }
355
- return await (0, ensureApiEnabled_1.ensure)(projectId, "firebaseextensions.googleapis.com", "extensions", options.markdown);
355
+ return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.extensionsOrigin, "extensions", options.markdown);
356
356
  }
357
357
  exports.ensureExtensionsApiEnabled = ensureExtensionsApiEnabled;
358
358
  async function ensureExtensionsPublisherApiEnabled(options) {
@@ -360,7 +360,7 @@ async function ensureExtensionsPublisherApiEnabled(options) {
360
360
  if (!projectId) {
361
361
  return;
362
362
  }
363
- return await (0, ensureApiEnabled_1.ensure)(projectId, "firebaseextensionspublisher.googleapis.com", "extensions", options.markdown);
363
+ return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.extensionsPublisherOrigin, "extensions", options.markdown);
364
364
  }
365
365
  exports.ensureExtensionsPublisherApiEnabled = ensureExtensionsPublisherApiEnabled;
366
366
  async function archiveAndUploadSource(extPath, bucketName) {
@@ -8,11 +8,12 @@ const projectUtils_1 = require("../projectUtils");
8
8
  const types_1 = require("./types");
9
9
  const secretManagerApi = require("../gcp/secretManager");
10
10
  const logger_1 = require("../logger");
11
+ const api_1 = require("../api");
11
12
  exports.SECRET_LABEL = "firebase-extensions-managed";
12
13
  exports.SECRET_ROLE = "secretmanager.secretAccessor";
13
14
  async function ensureSecretManagerApiEnabled(options) {
14
15
  const projectId = (0, projectUtils_1.needProjectId)(options);
15
- return await (0, ensureApiEnabled_1.ensure)(projectId, "secretmanager.googleapis.com", "extensions", options.markdown);
16
+ return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.secretManagerOrigin, "extensions", options.markdown);
16
17
  }
17
18
  exports.ensureSecretManagerApiEnabled = ensureSecretManagerApiEnabled;
18
19
  function usesSecrets(spec) {
@@ -44,7 +44,7 @@ function toUpperSnakeCase(key) {
44
44
  }
45
45
  function ensureApi(options) {
46
46
  const projectId = (0, projectUtils_1.needProjectId)(options);
47
- return ensureApiEnabled.ensure(projectId, "secretmanager.googleapis.com", "secretmanager", true);
47
+ return ensureApiEnabled.ensure(projectId, api_1.secretManagerOrigin, "secretmanager", true);
48
48
  }
49
49
  exports.ensureApi = ensureApi;
50
50
  async function ensureValidKey(key, options) {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getNextRolloutId = exports.ensureApiEnabled = exports.listLocations = exports.updateTraffic = exports.listRollouts = exports.createRollout = exports.createBuild = exports.listBuilds = exports.getBuild = exports.deleteBackend = exports.listBackends = exports.getBackend = exports.createBackend = exports.client = exports.API_VERSION = exports.API_HOST = void 0;
3
+ exports.getNextRolloutId = exports.ensureApiEnabled = exports.listLocations = exports.updateTraffic = exports.listRollouts = exports.createRollout = exports.createBuild = exports.listBuilds = exports.getBuild = exports.deleteBackend = exports.listBackends = exports.getBackend = exports.createBackend = exports.client = exports.API_VERSION = void 0;
4
4
  const proto = require("../gcp/proto");
5
5
  const apiv2_1 = require("../apiv2");
6
6
  const projectUtils_1 = require("../projectUtils");
@@ -9,7 +9,6 @@ const ensureApiEnabled_1 = require("../ensureApiEnabled");
9
9
  const deploymentTool = require("../deploymentTool");
10
10
  const error_1 = require("../error");
11
11
  const metaprogramming_1 = require("../metaprogramming");
12
- exports.API_HOST = new URL(api_1.apphostingOrigin).host;
13
12
  exports.API_VERSION = "v1alpha";
14
13
  exports.client = new apiv2_1.Client({
15
14
  urlPrefix: api_1.apphostingOrigin,
@@ -143,7 +142,7 @@ async function listLocations(projectId) {
143
142
  exports.listLocations = listLocations;
144
143
  async function ensureApiEnabled(options) {
145
144
  const projectId = (0, projectUtils_1.needProjectId)(options);
146
- return await (0, ensureApiEnabled_1.ensure)(projectId, exports.API_HOST, "app hosting", true);
145
+ return await (0, ensureApiEnabled_1.ensure)(projectId, api_1.apphostingOrigin, "app hosting", true);
147
146
  }
148
147
  exports.ensureApiEnabled = ensureApiEnabled;
149
148
  async function getNextRolloutId(projectId, location, backendId, counter) {
package/lib/gcp/auth.js CHANGED
@@ -5,12 +5,15 @@ const apiv2_1 = require("../apiv2");
5
5
  const api_1 = require("../api");
6
6
  const apiClient = new apiv2_1.Client({ urlPrefix: api_1.identityOrigin, auth: true });
7
7
  async function getAuthDomains(project) {
8
- const res = await apiClient.get(`/admin/v2/projects/${project}/config`);
8
+ const res = await apiClient.get(`/admin/v2/projects/${project}/config`, { headers: { "x-goog-user-project": project } });
9
9
  return res.body.authorizedDomains;
10
10
  }
11
11
  exports.getAuthDomains = getAuthDomains;
12
12
  async function updateAuthDomains(project, authDomains) {
13
- const res = await apiClient.patch(`/admin/v2/projects/${project}/config`, { authorizedDomains: authDomains }, { queryParams: { update_mask: "authorizedDomains" } });
13
+ const res = await apiClient.patch(`/admin/v2/projects/${project}/config`, { authorizedDomains: authDomains }, {
14
+ queryParams: { update_mask: "authorizedDomains" },
15
+ headers: { "x-goog-user-project": project },
16
+ });
14
17
  return res.body.authorizedDomains;
15
18
  }
16
19
  exports.updateAuthDomains = updateAuthDomains;
@@ -9,7 +9,7 @@ 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, "firebasestorage.googleapis.com", "storage", false);
12
+ await (0, ensureApiEnabled_1.ensure)(projectId, api_1.firebaseStorageOrigin, "storage", false);
13
13
  try {
14
14
  const localAPIClient = new apiv2_1.Client({ urlPrefix: api_1.firebaseStorageOrigin, apiVersion: "v1alpha" });
15
15
  const response = await localAPIClient.get(`/projects/${projectId}/defaultBucket`);
@@ -24,10 +24,10 @@ const apphostingPollerOptions = {
24
24
  };
25
25
  async function doSetup(projectId, location, serviceAccount) {
26
26
  await Promise.all([
27
- (0, ensureApiEnabled_1.ensure)(projectId, "cloudbuild.googleapis.com", "apphosting", true),
28
- (0, ensureApiEnabled_1.ensure)(projectId, "secretmanager.googleapis.com", "apphosting", true),
29
- (0, ensureApiEnabled_1.ensure)(projectId, "run.googleapis.com", "apphosting", true),
30
- (0, ensureApiEnabled_1.ensure)(projectId, "artifactregistry.googleapis.com", "apphosting", true),
27
+ (0, ensureApiEnabled_1.ensure)(projectId, api_1.cloudbuildOrigin, "apphosting", true),
28
+ (0, ensureApiEnabled_1.ensure)(projectId, api_1.secretManagerOrigin, "apphosting", true),
29
+ (0, ensureApiEnabled_1.ensure)(projectId, api_1.cloudRunApiOrigin, "apphosting", true),
30
+ (0, ensureApiEnabled_1.ensure)(projectId, api_1.artifactRegistryDomain, "apphosting", true),
31
31
  ]);
32
32
  const allowedLocations = (await apphosting.listLocations(projectId)).map((loc) => loc.locationId);
33
33
  if (location) {
@@ -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, "firebasedatabase.googleapis.com", "database", false);
74
+ await (0, ensureApiEnabled_1.ensure)(setup.projectId, 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, "firebaseextensions.googleapis.com", "unused", true)]);
12
+ await Promise.all([(0, ensureApiEnabled_1.ensure)(projectId, api_1.extensionsOrigin, "unused", true)]);
12
13
  }
13
14
  return manifest.writeEmptyManifest(config, options);
14
15
  }
@@ -8,14 +8,15 @@ const requirePermissions_1 = require("../../../requirePermissions");
8
8
  const ensureApiEnabled_1 = require("../../../ensureApiEnabled");
9
9
  const projectConfig_1 = require("../../../functions/projectConfig");
10
10
  const error_1 = require("../../../error");
11
+ const api_1 = require("../../../api");
11
12
  const MAX_ATTEMPTS = 5;
12
13
  async function doSetup(setup, config, options) {
13
14
  const projectId = setup?.rcfile?.projects?.default;
14
15
  if (projectId) {
15
16
  await (0, requirePermissions_1.requirePermissions)({ ...options, project: projectId });
16
17
  await Promise.all([
17
- (0, ensureApiEnabled_1.ensure)(projectId, "cloudfunctions.googleapis.com", "unused", true),
18
- (0, ensureApiEnabled_1.ensure)(projectId, "runtimeconfig.googleapis.com", "unused", true),
18
+ (0, ensureApiEnabled_1.ensure)(projectId, api_1.functionsOrigin, "unused", true),
19
+ (0, ensureApiEnabled_1.ensure)(projectId, api_1.runtimeconfigOrigin, "unused", true),
19
20
  ]);
20
21
  }
21
22
  setup.functions = {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "firebase-tools-with-isolate",
3
+ "version": "13.4.0",
3
4
  "description": "Command-Line Interface for Firebase with monorepo support",
4
- "version": "13.3.1",
5
5
  "main": "./lib/index.js",
6
6
  "bin": {
7
7
  "firebase": "lib/bin/firebase.js"