firebase-tools-with-isolate 12.9.1-4 → 12.9.1-6

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.
Files changed (181) hide show
  1. package/lib/accountExporter.js +1 -2
  2. package/lib/apiv2.js +5 -9
  3. package/lib/appdistribution/client.js +2 -3
  4. package/lib/auth.js +12 -15
  5. package/lib/command.js +1 -2
  6. package/lib/commands/crashlytics-symbols-upload.js +2 -2
  7. package/lib/commands/emulators-start.js +1 -2
  8. package/lib/commands/ext-configure.js +6 -4
  9. package/lib/commands/ext-dev-list.js +2 -3
  10. package/lib/commands/ext-export.js +1 -1
  11. package/lib/commands/ext-info.js +2 -3
  12. package/lib/commands/ext-install.js +5 -7
  13. package/lib/commands/firestore-indexes-list.js +1 -2
  14. package/lib/commands/frameworks-backends-delete.js +1 -2
  15. package/lib/commands/frameworks-backends-get.js +1 -2
  16. package/lib/commands/frameworks-backends-list.js +1 -2
  17. package/lib/commands/hosting-clone.js +2 -3
  18. package/lib/commands/init.js +1 -2
  19. package/lib/commands/logout.js +1 -1
  20. package/lib/commands/remoteconfig-get.js +1 -1
  21. package/lib/commands/remoteconfig-rollback.js +1 -2
  22. package/lib/commands/remoteconfig-versions-list.js +1 -2
  23. package/lib/config.js +2 -3
  24. package/lib/crashlytics/buildToolsJarHelper.js +1 -2
  25. package/lib/database/import.js +4 -4
  26. package/lib/deploy/extensions/deploy.js +6 -7
  27. package/lib/deploy/extensions/deploymentSummary.js +1 -2
  28. package/lib/deploy/extensions/planner.js +4 -5
  29. package/lib/deploy/extensions/prepare.js +6 -7
  30. package/lib/deploy/extensions/release.js +9 -10
  31. package/lib/deploy/extensions/secrets.js +6 -8
  32. package/lib/deploy/extensions/tasks.js +1 -2
  33. package/lib/deploy/firestore/deploy.js +2 -4
  34. package/lib/deploy/firestore/release.js +2 -3
  35. package/lib/deploy/functions/backend.js +17 -15
  36. package/lib/deploy/functions/build.js +9 -1
  37. package/lib/deploy/functions/cache/applyHash.js +2 -3
  38. package/lib/deploy/functions/containerCleaner.js +11 -3
  39. package/lib/deploy/functions/deploy.js +1 -2
  40. package/lib/deploy/functions/ensure.js +3 -5
  41. package/lib/deploy/functions/prepare.js +21 -18
  42. package/lib/deploy/functions/prepareFunctionsUpload.js +14 -7
  43. package/lib/deploy/functions/prompts.js +2 -4
  44. package/lib/deploy/functions/release/executor.js +5 -6
  45. package/lib/deploy/functions/release/fabricator.js +58 -30
  46. package/lib/deploy/functions/release/index.js +10 -7
  47. package/lib/deploy/functions/release/planner.js +2 -3
  48. package/lib/deploy/functions/release/reporter.js +11 -14
  49. package/lib/deploy/functions/release/sourceTokenScraper.js +4 -5
  50. package/lib/deploy/functions/runtimes/discovery/index.js +1 -1
  51. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +13 -8
  52. package/lib/deploy/functions/runtimes/node/index.js +11 -4
  53. package/lib/deploy/functions/runtimes/node/parseTriggers.js +23 -10
  54. package/lib/deploy/functions/runtimes/node/versioning.js +1 -2
  55. package/lib/deploy/functions/runtimes/python/index.js +8 -7
  56. package/lib/deploy/functions/services/auth.js +29 -22
  57. package/lib/deploy/functions/services/firestore.js +1 -2
  58. package/lib/deploy/functions/services/storage.js +1 -2
  59. package/lib/deploy/functions/validate.js +1 -2
  60. package/lib/deploy/hosting/convertConfig.js +36 -19
  61. package/lib/deploy/hosting/deploy.js +3 -5
  62. package/lib/deploy/hosting/prepare.js +10 -9
  63. package/lib/deploy/lifecycleHooks.js +2 -3
  64. package/lib/deploy/remoteconfig/functions.js +1 -1
  65. package/lib/deploy/remoteconfig/prepare.js +1 -2
  66. package/lib/deploy/remoteconfig/release.js +1 -1
  67. package/lib/deploymentTool.js +1 -2
  68. package/lib/emulator/auth/cloudFunctions.js +1 -1
  69. package/lib/emulator/auth/handlers.js +2 -2
  70. package/lib/emulator/auth/index.js +5 -5
  71. package/lib/emulator/auth/operations.js +165 -124
  72. package/lib/emulator/auth/server.js +29 -20
  73. package/lib/emulator/auth/state.js +21 -31
  74. package/lib/emulator/auth/utils.js +1 -1
  75. package/lib/emulator/commandUtils.js +9 -9
  76. package/lib/emulator/controller.js +16 -13
  77. package/lib/emulator/databaseEmulator.js +1 -2
  78. package/lib/emulator/downloadableEmulators.js +3 -4
  79. package/lib/emulator/emulatorLogger.js +18 -3
  80. package/lib/emulator/eventarcEmulator.js +2 -3
  81. package/lib/emulator/eventarcEmulatorUtils.js +2 -4
  82. package/lib/emulator/extensions/validation.js +2 -4
  83. package/lib/emulator/extensionsEmulator.js +6 -9
  84. package/lib/emulator/functionsEmulator.js +69 -37
  85. package/lib/emulator/functionsEmulatorRuntime.js +1 -1
  86. package/lib/emulator/functionsEmulatorShared.js +5 -7
  87. package/lib/emulator/functionsEmulatorShell.js +4 -6
  88. package/lib/emulator/functionsRuntimeWorker.js +17 -8
  89. package/lib/emulator/hub.js +9 -2
  90. package/lib/emulator/hubClient.js +1 -1
  91. package/lib/emulator/loggingEmulator.js +2 -2
  92. package/lib/emulator/registry.js +10 -4
  93. package/lib/emulator/storage/apis/firebase.js +15 -18
  94. package/lib/emulator/storage/apis/gcloud.js +5 -7
  95. package/lib/emulator/storage/files.js +18 -41
  96. package/lib/emulator/storage/metadata.js +8 -2
  97. package/lib/emulator/storage/rules/manager.js +2 -3
  98. package/lib/emulator/storage/rules/runtime.js +15 -13
  99. package/lib/emulator/storage/rules/utils.js +1 -1
  100. package/lib/emulator/storage/upload.js +1 -2
  101. package/lib/ensureApiEnabled.js +1 -2
  102. package/lib/error.js +3 -5
  103. package/lib/experiments.js +2 -4
  104. package/lib/extensions/askUserForEventsConfig.js +5 -6
  105. package/lib/extensions/askUserForParam.js +4 -5
  106. package/lib/extensions/displayExtensionInfo.js +20 -26
  107. package/lib/extensions/emulator/optionsHelper.js +2 -3
  108. package/lib/extensions/emulator/specHelper.js +9 -10
  109. package/lib/extensions/export.js +4 -5
  110. package/lib/extensions/extensionsApi.js +8 -13
  111. package/lib/extensions/extensionsHelper.js +15 -18
  112. package/lib/extensions/listExtensions.js +2 -3
  113. package/lib/extensions/manifest.js +2 -3
  114. package/lib/extensions/paramHelper.js +10 -5
  115. package/lib/extensions/provisioningHelper.js +12 -16
  116. package/lib/extensions/publisherApi.js +1 -2
  117. package/lib/extensions/resolveSource.js +1 -2
  118. package/lib/extensions/tos.js +8 -2
  119. package/lib/extensions/utils.js +2 -3
  120. package/lib/extensions/warnings.js +4 -5
  121. package/lib/frameworks/angular/index.js +5 -6
  122. package/lib/frameworks/angular/utils.js +10 -12
  123. package/lib/frameworks/astro/index.js +1 -1
  124. package/lib/frameworks/astro/utils.js +1 -2
  125. package/lib/frameworks/compose/discover/filesystem.js +1 -1
  126. package/lib/frameworks/compose/discover/runtime/node.js +8 -11
  127. package/lib/frameworks/compose/driver/docker.js +3 -5
  128. package/lib/frameworks/compose/driver/local.js +2 -3
  129. package/lib/frameworks/compose/index.js +4 -5
  130. package/lib/frameworks/express/index.js +2 -3
  131. package/lib/frameworks/flutter/index.js +1 -2
  132. package/lib/frameworks/index.js +16 -17
  133. package/lib/frameworks/next/index.js +21 -18
  134. package/lib/frameworks/next/utils.js +6 -3
  135. package/lib/frameworks/nuxt/index.js +1 -1
  136. package/lib/frameworks/nuxt/utils.js +2 -3
  137. package/lib/frameworks/nuxt2/index.js +1 -1
  138. package/lib/frameworks/sveltekit/index.js +2 -4
  139. package/lib/frameworks/utils.js +10 -7
  140. package/lib/functions/env.js +3 -4
  141. package/lib/functions/projectConfig.js +1 -1
  142. package/lib/functions/python.js +7 -1
  143. package/lib/functions/runtimeConfigExport.js +1 -2
  144. package/lib/functions/secrets.js +21 -6
  145. package/lib/functionsShellCommandAction.js +2 -3
  146. package/lib/gcp/cloudfunctions.js +47 -31
  147. package/lib/gcp/cloudfunctionsv2.js +59 -31
  148. package/lib/gcp/cloudscheduler.js +5 -5
  149. package/lib/gcp/cloudtasks.js +6 -5
  150. package/lib/gcp/docker.js +2 -4
  151. package/lib/gcp/run.js +12 -18
  152. package/lib/gcp/secretManager.js +25 -12
  153. package/lib/gcp/storage.js +5 -3
  154. package/lib/getDefaultDatabaseInstance.js +1 -2
  155. package/lib/getDefaultHostingSite.js +1 -2
  156. package/lib/hosting/api.js +1 -2
  157. package/lib/hosting/cloudRunProxy.js +1 -2
  158. package/lib/hosting/config.js +10 -9
  159. package/lib/hosting/proxy.js +1 -2
  160. package/lib/hosting/runTags.js +3 -6
  161. package/lib/init/features/extensions/index.js +2 -3
  162. package/lib/init/features/firestore/index.js +1 -1
  163. package/lib/init/features/frameworks/index.js +5 -1
  164. package/lib/init/features/frameworks/repo.js +11 -4
  165. package/lib/init/features/functions/index.js +2 -3
  166. package/lib/init/features/hosting/index.js +1 -2
  167. package/lib/init/index.js +1 -2
  168. package/lib/localFunction.js +13 -14
  169. package/lib/management/apps.js +1 -1
  170. package/lib/management/database.js +1 -2
  171. package/lib/projectUtils.js +1 -1
  172. package/lib/prompt.js +2 -4
  173. package/lib/rc.js +3 -5
  174. package/lib/requireConfig.js +4 -6
  175. package/lib/rulesDeploy.js +2 -3
  176. package/lib/serve/functions.js +8 -1
  177. package/lib/serve/hosting.js +1 -1
  178. package/lib/track.js +15 -6
  179. package/lib/unzip.js +2 -3
  180. package/lib/utils.js +2 -2
  181. package/package.json +2 -2
@@ -6,12 +6,11 @@ const refs = require("../../extensions/refs");
6
6
  const humanReadable = (dep) => `${clc.bold(dep.instanceId)} (${dep.ref ? `${refs.toExtensionVersionRef(dep.ref)}` : `Installed from local source`})`;
7
7
  exports.humanReadable = humanReadable;
8
8
  const humanReadableUpdate = (from, to) => {
9
- var _a;
10
9
  if (from.ref &&
11
10
  to.ref &&
12
11
  from.ref.publisherId === to.ref.publisherId &&
13
12
  from.ref.extensionId === to.ref.extensionId) {
14
- return `\t${clc.bold(from.instanceId)} (${refs.toExtensionVersionRef(from.ref)} => ${(_a = to.ref) === null || _a === void 0 ? void 0 : _a.version})`;
13
+ return `\t${clc.bold(from.instanceId)} (${refs.toExtensionVersionRef(from.ref)} => ${to.ref?.version})`;
15
14
  }
16
15
  else {
17
16
  const fromRef = from.ref
@@ -51,11 +51,10 @@ exports.getExtensionSpec = getExtensionSpec;
51
51
  async function have(projectId) {
52
52
  const instances = await extensionsApi.listInstances(projectId);
53
53
  return instances.map((i) => {
54
- var _a;
55
54
  const dep = {
56
55
  instanceId: i.name.split("/").pop(),
57
56
  params: i.config.params,
58
- systemParams: (_a = i.config.systemParams) !== null && _a !== void 0 ? _a : {},
57
+ systemParams: i.config.systemParams ?? {},
59
58
  allowedEventTypes: i.config.allowedEventTypes,
60
59
  eventarcChannel: i.config.eventarcChannel,
61
60
  etag: i.etag,
@@ -129,17 +128,17 @@ async function want(args) {
129
128
  exports.want = want;
130
129
  async function resolveVersion(ref, extension) {
131
130
  const extensionRef = refs.toExtensionRef(ref);
132
- if (!ref.version && (extension === null || extension === void 0 ? void 0 : extension.latestApprovedVersion)) {
131
+ if (!ref.version && extension?.latestApprovedVersion) {
133
132
  return extension.latestApprovedVersion;
134
133
  }
135
134
  if (ref.version === "latest-approved") {
136
- if (!(extension === null || extension === void 0 ? void 0 : extension.latestApprovedVersion)) {
135
+ if (!extension?.latestApprovedVersion) {
137
136
  throw new error_1.FirebaseError(`${extensionRef} has not been published to Extensions Hub (https://extensions.dev). To install it, you must specify the version you want to install.`);
138
137
  }
139
138
  return extension.latestApprovedVersion;
140
139
  }
141
140
  if (!ref.version || ref.version === "latest") {
142
- if (!(extension === null || extension === void 0 ? void 0 : extension.latestVersion)) {
141
+ if (!extension?.latestVersion) {
143
142
  throw new error_1.FirebaseError(`${extensionRef} has no stable non-deprecated versions. If you wish to install a prerelease version, you must specify the version you want to install.`);
144
143
  }
145
144
  return extension.latestVersion;
@@ -17,7 +17,6 @@ const etags_1 = require("../../extensions/etags");
17
17
  const v2FunctionHelper_1 = require("./v2FunctionHelper");
18
18
  const tos_1 = require("../../extensions/tos");
19
19
  async function prepare(context, options, payload) {
20
- var _a, _b;
21
20
  context.extensionsStartTime = Date.now();
22
21
  const projectId = (0, projectUtils_1.needProjectId)(options);
23
22
  const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
@@ -44,18 +43,18 @@ async function prepare(context, options, payload) {
44
43
  throw new error_1.FirebaseError("Deployment cancelled");
45
44
  }
46
45
  }
47
- const usingSecrets = await Promise.all((_a = context.want) === null || _a === void 0 ? void 0 : _a.map(secrets_1.checkSpecForSecrets));
46
+ const usingSecrets = await Promise.all(context.want?.map(secrets_1.checkSpecForSecrets));
48
47
  if (usingSecrets.some((i) => i)) {
49
48
  await (0, secretsUtils_1.ensureSecretManagerApiEnabled)(options);
50
49
  }
51
- const usingV2Functions = await Promise.all((_b = context.want) === null || _b === void 0 ? void 0 : _b.map(v2FunctionHelper_1.checkSpecForV2Functions));
50
+ const usingV2Functions = await Promise.all(context.want?.map(v2FunctionHelper_1.checkSpecForV2Functions));
52
51
  if (usingV2Functions) {
53
52
  await (0, v2FunctionHelper_1.ensureNecessaryV2ApisAndRoles)(options);
54
53
  }
55
- payload.instancesToCreate = context.want.filter((i) => { var _a; return !((_a = context.have) === null || _a === void 0 ? void 0 : _a.some(matchesInstanceId(i))); });
56
- payload.instancesToConfigure = context.want.filter((i) => { var _a; return (_a = context.have) === null || _a === void 0 ? void 0 : _a.some(isConfigure(i)); });
57
- payload.instancesToUpdate = context.want.filter((i) => { var _a; return (_a = context.have) === null || _a === void 0 ? void 0 : _a.some(isUpdate(i)); });
58
- payload.instancesToDelete = context.have.filter((i) => { var _a; return !((_a = context.want) === null || _a === void 0 ? void 0 : _a.some(matchesInstanceId(i))); });
54
+ payload.instancesToCreate = context.want.filter((i) => !context.have?.some(matchesInstanceId(i)));
55
+ payload.instancesToConfigure = context.want.filter((i) => context.have?.some(isConfigure(i)));
56
+ payload.instancesToUpdate = context.want.filter((i) => context.have?.some(isUpdate(i)));
57
+ payload.instancesToDelete = context.have.filter((i) => !context.want?.some(matchesInstanceId(i)));
59
58
  if (await (0, warnings_1.displayWarningsForDeploy)(payload.instancesToCreate)) {
60
59
  if (!(await prompt.confirm({
61
60
  message: `Do you wish to continue deploying these extension instances?`,
@@ -10,7 +10,6 @@ const projectUtils_1 = require("../../projectUtils");
10
10
  const etags_1 = require("../../extensions/etags");
11
11
  const track_1 = require("../../track");
12
12
  async function release(context, options, payload) {
13
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
14
13
  const projectId = (0, projectUtils_1.needProjectId)(options);
15
14
  const errorHandler = new errors_1.ErrorHandler();
16
15
  const deploymentQueue = new queue_1.default({
@@ -18,19 +17,19 @@ async function release(context, options, payload) {
18
17
  concurrency: 5,
19
18
  handler: tasks.extensionsDeploymentHandler(errorHandler),
20
19
  });
21
- for (const creation of (_a = payload.instancesToCreate) !== null && _a !== void 0 ? _a : []) {
20
+ for (const creation of payload.instancesToCreate ?? []) {
22
21
  const task = tasks.createExtensionInstanceTask(projectId, creation);
23
22
  void deploymentQueue.run(task);
24
23
  }
25
- for (const update of (_b = payload.instancesToUpdate) !== null && _b !== void 0 ? _b : []) {
24
+ for (const update of payload.instancesToUpdate ?? []) {
26
25
  const task = tasks.updateExtensionInstanceTask(projectId, update);
27
26
  void deploymentQueue.run(task);
28
27
  }
29
- for (const update of (_c = payload.instancesToConfigure) !== null && _c !== void 0 ? _c : []) {
28
+ for (const update of payload.instancesToConfigure ?? []) {
30
29
  const task = tasks.configureExtensionInstanceTask(projectId, update);
31
30
  void deploymentQueue.run(task);
32
31
  }
33
- for (const deletion of (_d = payload.instancesToDelete) !== null && _d !== void 0 ? _d : []) {
32
+ for (const deletion of payload.instancesToDelete ?? []) {
34
33
  const task = tasks.deleteExtensionInstanceTask(projectId, deletion);
35
34
  void deploymentQueue.run(task);
36
35
  }
@@ -40,11 +39,11 @@ async function release(context, options, payload) {
40
39
  await deploymentPromise;
41
40
  const duration = context.extensionsStartTime ? Date.now() - context.extensionsStartTime : 1;
42
41
  await (0, track_1.trackGA4)("extensions_deploy", {
43
- extension_instance_created: (_f = (_e = payload.instancesToCreate) === null || _e === void 0 ? void 0 : _e.length) !== null && _f !== void 0 ? _f : 0,
44
- extension_instance_updated: (_h = (_g = payload.instancesToUpdate) === null || _g === void 0 ? void 0 : _g.length) !== null && _h !== void 0 ? _h : 0,
45
- extension_instance_configured: (_k = (_j = payload.instancesToConfigure) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0,
46
- extension_instance_deleted: (_m = (_l = payload.instancesToDelete) === null || _l === void 0 ? void 0 : _l.length) !== null && _m !== void 0 ? _m : 0,
47
- errors: (_o = errorHandler.errors.length) !== null && _o !== void 0 ? _o : 0,
42
+ extension_instance_created: payload.instancesToCreate?.length ?? 0,
43
+ extension_instance_updated: payload.instancesToUpdate?.length ?? 0,
44
+ extension_instance_configured: payload.instancesToConfigure?.length ?? 0,
45
+ extension_instance_deleted: payload.instancesToDelete?.length ?? 0,
46
+ errors: errorHandler.errors.length ?? 0,
48
47
  interactive: options.nonInteractive ? "false" : "true",
49
48
  }, duration);
50
49
  const newHave = await planner.have(projectId);
@@ -11,14 +11,13 @@ const error_1 = require("../../error");
11
11
  const logger_1 = require("../../logger");
12
12
  const utils_1 = require("../../utils");
13
13
  async function handleSecretParams(payload, have, nonInteractive) {
14
- var _a, _b, _c;
15
- for (const i of (_a = payload.instancesToCreate) !== null && _a !== void 0 ? _a : []) {
14
+ for (const i of payload.instancesToCreate ?? []) {
16
15
  if (await checkSpecForSecrets(i)) {
17
16
  (0, utils_1.logLabeledBullet)("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
18
17
  await handleSecretsCreateInstance(i, nonInteractive);
19
18
  }
20
19
  }
21
- const updates = [...((_b = payload.instancesToUpdate) !== null && _b !== void 0 ? _b : []), ...((_c = payload.instancesToConfigure) !== null && _c !== void 0 ? _c : [])];
20
+ const updates = [...(payload.instancesToUpdate ?? []), ...(payload.instancesToConfigure ?? [])];
22
21
  for (const i of updates) {
23
22
  if (await checkSpecForSecrets(i)) {
24
23
  (0, utils_1.logLabeledBullet)("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
@@ -49,8 +48,8 @@ async function handleSecretsUpdateInstance(i, prevSpec, nonInteractive) {
49
48
  const secretParams = secretsInSpec(extensionVersion.spec);
50
49
  for (const s of secretParams) {
51
50
  const prevParam = prevExtensionVersion.spec.params.find((p) => p.param === s.param);
52
- if ((prevParam === null || prevParam === void 0 ? void 0 : prevParam.type) === types_1.ParamType.SECRET && prevSpec.params[prevParam === null || prevParam === void 0 ? void 0 : prevParam.param]) {
53
- await handleSecretParamForUpdate(s, i, prevSpec.params[prevParam === null || prevParam === void 0 ? void 0 : prevParam.param], nonInteractive);
51
+ if (prevParam?.type === types_1.ParamType.SECRET && prevSpec.params[prevParam?.param]) {
52
+ await handleSecretParamForUpdate(s, i, prevSpec.params[prevParam?.param], nonInteractive);
54
53
  }
55
54
  else {
56
55
  await handleSecretParamForCreate(s, i, nonInteractive);
@@ -58,7 +57,6 @@ async function handleSecretsUpdateInstance(i, prevSpec, nonInteractive) {
58
57
  }
59
58
  }
60
59
  async function handleSecretParamForCreate(secretParam, i, nonInteractive) {
61
- var _a;
62
60
  const providedValue = i.params[secretParam.param];
63
61
  if (!providedValue) {
64
62
  return;
@@ -83,8 +81,8 @@ async function handleSecretParamForCreate(secretParam, i, nonInteractive) {
83
81
  `projects/${projectId}/secrets/${secretName} exists, but version ${version} does not. ` +
84
82
  `See more information about this secret at ${secretManager.secretManagerConsoleUri(projectId)}`);
85
83
  }
86
- if (!!((_a = secretInfo === null || secretInfo === void 0 ? void 0 : secretInfo.secret) === null || _a === void 0 ? void 0 : _a.labels) &&
87
- !!(secretInfo === null || secretInfo === void 0 ? void 0 : secretInfo.secret.labels[secretUtils.SECRET_LABEL]) &&
84
+ if (!!secretInfo?.secret?.labels &&
85
+ !!secretInfo?.secret.labels[secretUtils.SECRET_LABEL] &&
88
86
  secretInfo.secret.labels[secretUtils.SECRET_LABEL] !== i.instanceId) {
89
87
  throw new error_1.FirebaseError(`${clc.bold(i.instanceId)}: Found '${providedValue}' for secret param ${secretParam.param}. ` +
90
88
  `projects/${projectId}/secrets/${secretName} is managed by a different extension instance (${secretInfo.secret.labels[secretUtils.SECRET_LABEL]}), so reusing it here can lead to unexpected behavior. ` +
@@ -10,7 +10,6 @@ const utils = require("../../utils");
10
10
  const isRetryable = (err) => err.status === 429 || err.status === 409;
11
11
  function extensionsDeploymentHandler(errorHandler) {
12
12
  return async (task) => {
13
- var _a, _b, _c, _d;
14
13
  let result;
15
14
  try {
16
15
  result = await task.run();
@@ -19,7 +18,7 @@ function extensionsDeploymentHandler(errorHandler) {
19
18
  if (isRetryable(err)) {
20
19
  throw err;
21
20
  }
22
- errorHandler.record(task.spec.instanceId, task.type, (_d = (_c = (_b = (_a = err.context) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : err);
21
+ errorHandler.record(task.spec.instanceId, task.type, err.context?.body?.error?.message ?? err);
23
22
  }
24
23
  return result;
25
24
  };
@@ -6,19 +6,17 @@ const logger_1 = require("../../logger");
6
6
  const utils = require("../../utils");
7
7
  const rulesDeploy_1 = require("../../rulesDeploy");
8
8
  async function deployRules(context) {
9
- var _a;
10
- const rulesDeploy = (_a = context === null || context === void 0 ? void 0 : context.firestore) === null || _a === void 0 ? void 0 : _a.rulesDeploy;
9
+ const rulesDeploy = context?.firestore?.rulesDeploy;
11
10
  if (!context.firestoreRules || !rulesDeploy) {
12
11
  return;
13
12
  }
14
13
  await rulesDeploy.createRulesets(rulesDeploy_1.RulesetServiceType.CLOUD_FIRESTORE);
15
14
  }
16
15
  async function deployIndexes(context, options) {
17
- var _a;
18
16
  if (!context.firestoreIndexes) {
19
17
  return;
20
18
  }
21
- const indexesContext = (_a = context === null || context === void 0 ? void 0 : context.firestore) === null || _a === void 0 ? void 0 : _a.indexes;
19
+ const indexesContext = context?.firestore?.indexes;
22
20
  utils.logBullet(clc.bold(clc.cyan("firestore: ")) + "deploying indexes...");
23
21
  const firestoreIndexes = new api_1.FirestoreApi();
24
22
  await Promise.all(indexesContext.map(async (indexContext) => {
@@ -3,12 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const rulesDeploy_1 = require("../../rulesDeploy");
4
4
  const logger_1 = require("../../logger");
5
5
  async function default_1(context, options) {
6
- var _a, _b;
7
- const rulesDeploy = (_a = context === null || context === void 0 ? void 0 : context.firestore) === null || _a === void 0 ? void 0 : _a.rulesDeploy;
6
+ const rulesDeploy = context?.firestore?.rulesDeploy;
8
7
  if (!context.firestoreRules || !rulesDeploy) {
9
8
  return;
10
9
  }
11
- const rulesContext = (_b = context === null || context === void 0 ? void 0 : context.firestore) === null || _b === void 0 ? void 0 : _b.rules;
10
+ const rulesContext = context?.firestore?.rules;
12
11
  await Promise.all(rulesContext.map(async (ruleContext) => {
13
12
  const databaseId = ruleContext.databaseId;
14
13
  const rulesFile = ruleContext.rulesFile;
@@ -88,8 +88,7 @@ exports.DEFAULT_MEMORY = 256;
88
88
  exports.MIN_CPU_FOR_CONCURRENCY = 1;
89
89
  exports.SCHEDULED_FUNCTION_LABEL = Object.freeze({ deployment: "firebase-schedule" });
90
90
  function secretVersionName(s) {
91
- var _a;
92
- return `projects/${s.projectId}/secrets/${s.secret}/versions/${(_a = s.version) !== null && _a !== void 0 ? _a : "latest"}`;
91
+ return `projects/${s.projectId}/secrets/${s.secret}/versions/${s.version ?? "latest"}`;
93
92
  }
94
93
  exports.secretVersionName = secretVersionName;
95
94
  exports.AllFunctionsPlatforms = ["gcfv1", "gcfv2"];
@@ -126,7 +125,7 @@ function empty() {
126
125
  }
127
126
  exports.empty = empty;
128
127
  function of(...endpoints) {
129
- const bkend = Object.assign({}, empty());
128
+ const bkend = { ...empty() };
130
129
  for (const endpoint of endpoints) {
131
130
  bkend.endpoints[endpoint.region] = bkend.endpoints[endpoint.region] || {};
132
131
  if (bkend.endpoints[endpoint.region][endpoint.id]) {
@@ -148,7 +147,7 @@ function merge(...backends) {
148
147
  }
149
148
  apiToReasons[api] = reasons;
150
149
  }
151
- merged.environmentVariables = Object.assign(Object.assign({}, merged.environmentVariables), b.environmentVariables);
150
+ merged.environmentVariables = { ...merged.environmentVariables, ...b.environmentVariables };
152
151
  }
153
152
  for (const [api, reasons] of Object.entries(apiToReasons)) {
154
153
  merged.requiredAPIs.push({ api, reason: Array.from(reasons).join(" ") });
@@ -176,9 +175,10 @@ async function existingBackend(context, forceRefresh) {
176
175
  }
177
176
  exports.existingBackend = existingBackend;
178
177
  async function loadExistingBackend(ctx) {
179
- var _a;
180
178
  ctx.loadedExistingBackend = true;
181
- ctx.existingBackend = Object.assign({}, empty());
179
+ ctx.existingBackend = {
180
+ ...empty(),
181
+ };
182
182
  ctx.unreachableRegions = {
183
183
  gcfV1: [],
184
184
  gcfV2: [],
@@ -203,14 +203,13 @@ async function loadExistingBackend(ctx) {
203
203
  ctx.unreachableRegions.gcfV2 = gcfV2Results.unreachable;
204
204
  }
205
205
  catch (err) {
206
- if (err.status === 404 && ((_a = err.message) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes("method not found"))) {
206
+ if (err.status === 404 && err.message?.toLowerCase().includes("method not found")) {
207
207
  return;
208
208
  }
209
209
  throw err;
210
210
  }
211
211
  }
212
212
  async function checkAvailability(context, want) {
213
- var _a, _b, _c, _d;
214
213
  if (!context.loadedExistingBackend) {
215
214
  await loadExistingBackend(context);
216
215
  }
@@ -224,24 +223,24 @@ async function checkAvailability(context, want) {
224
223
  gcfV2Regions.add(ep.region);
225
224
  }
226
225
  }
227
- const neededUnreachableV1 = (_a = context.unreachableRegions) === null || _a === void 0 ? void 0 : _a.gcfV1.filter((region) => gcfV1Regions.has(region));
228
- const neededUnreachableV2 = (_b = context.unreachableRegions) === null || _b === void 0 ? void 0 : _b.gcfV2.filter((region) => gcfV2Regions.has(region));
229
- if (neededUnreachableV1 === null || neededUnreachableV1 === void 0 ? void 0 : neededUnreachableV1.length) {
226
+ const neededUnreachableV1 = context.unreachableRegions?.gcfV1.filter((region) => gcfV1Regions.has(region));
227
+ const neededUnreachableV2 = context.unreachableRegions?.gcfV2.filter((region) => gcfV2Regions.has(region));
228
+ if (neededUnreachableV1?.length) {
230
229
  throw new error_1.FirebaseError("The following Cloud Functions regions are currently unreachable:\n\t" +
231
230
  neededUnreachableV1.join("\n\t") +
232
231
  "\nThis deployment contains functions in those regions. Please try again in a few minutes, or exclude these regions from your deployment.");
233
232
  }
234
- if (neededUnreachableV2 === null || neededUnreachableV2 === void 0 ? void 0 : neededUnreachableV2.length) {
233
+ if (neededUnreachableV2?.length) {
235
234
  throw new error_1.FirebaseError("The following Cloud Functions V2 regions are currently unreachable:\n\t" +
236
235
  neededUnreachableV2.join("\n\t") +
237
236
  "\nThis deployment contains functions in those regions. Please try again in a few minutes, or exclude these regions from your deployment.");
238
237
  }
239
- if ((_c = context.unreachableRegions) === null || _c === void 0 ? void 0 : _c.gcfV1.length) {
238
+ if (context.unreachableRegions?.gcfV1.length) {
240
239
  utils.logLabeledWarning("functions", "The following Cloud Functions regions are currently unreachable:\n" +
241
240
  context.unreachableRegions.gcfV1.join("\n") +
242
241
  "\nCloud Functions in these regions won't be deleted.");
243
242
  }
244
- if ((_d = context.unreachableRegions) === null || _d === void 0 ? void 0 : _d.gcfV2.length) {
243
+ if (context.unreachableRegions?.gcfV2.length) {
245
244
  utils.logLabeledWarning("functions", "The following Cloud Functions V2 regions are currently unreachable:\n" +
246
245
  context.unreachableRegions.gcfV2.join("\n") +
247
246
  "\nCloud Functions in these regions won't be deleted.");
@@ -272,7 +271,10 @@ function findEndpoint(backend, predicate) {
272
271
  }
273
272
  exports.findEndpoint = findEndpoint;
274
273
  function matchingBackend(backend, predicate) {
275
- const filtered = Object.assign(Object.assign({}, backend), { endpoints: {} });
274
+ const filtered = {
275
+ ...backend,
276
+ endpoints: {},
277
+ };
276
278
  for (const endpoint of allEndpoints(backend)) {
277
279
  if (!predicate(endpoint)) {
278
280
  continue;
@@ -198,7 +198,15 @@ function toBackend(build, paramValues) {
198
198
  if (typeof bdEndpoint.platform === "undefined") {
199
199
  throw new error_1.FirebaseError("platform can't be undefined");
200
200
  }
201
- const bkEndpoint = Object.assign({ id: endpointId, project: bdEndpoint.project, region: region, entryPoint: bdEndpoint.entryPoint, platform: bdEndpoint.platform, runtime: bdEndpoint.runtime }, trigger);
201
+ const bkEndpoint = {
202
+ id: endpointId,
203
+ project: bdEndpoint.project,
204
+ region: region,
205
+ entryPoint: bdEndpoint.entryPoint,
206
+ platform: bdEndpoint.platform,
207
+ runtime: bdEndpoint.runtime,
208
+ ...trigger,
209
+ };
202
210
  proto.copyIfPresent(bkEndpoint, bdEndpoint, "environmentVariables", "labels", "secretEnvironmentVariables");
203
211
  proto.convertIfPresent(bkEndpoint, bdEndpoint, "ingressSettings", (from) => {
204
212
  if (from !== null && !backend.AllIngressSettings.includes(from)) {
@@ -4,11 +4,10 @@ exports.applyBackendHashToBackends = void 0;
4
4
  const backend_1 = require("../backend");
5
5
  const hash_1 = require("./hash");
6
6
  function applyBackendHashToBackends(wantBackends, context) {
7
- var _a;
8
7
  for (const [codebase, wantBackend] of Object.entries(wantBackends)) {
9
- const source = (_a = context === null || context === void 0 ? void 0 : context.sources) === null || _a === void 0 ? void 0 : _a[codebase];
8
+ const source = context?.sources?.[codebase];
10
9
  const envHash = (0, hash_1.getEnvironmentVariablesHash)(wantBackend);
11
- applyBackendHashToEndpoints(wantBackend, envHash, source === null || source === void 0 ? void 0 : source.functionsSourceV1Hash, source === null || source === void 0 ? void 0 : source.functionsSourceV2Hash);
10
+ applyBackendHashToEndpoints(wantBackend, envHash, source?.functionsSourceV1Hash, source?.functionsSourceV2Hash);
12
11
  }
13
12
  }
14
13
  exports.applyBackendHashToBackends = applyBackendHashToBackends;
@@ -104,14 +104,22 @@ class ArtifactRegistryCleaner {
104
104
  if (op.done) {
105
105
  return;
106
106
  }
107
- await poller.pollOperation(Object.assign(Object.assign({}, ArtifactRegistryCleaner.POLLER_OPTIONS), { pollerName: `cleanup-${func.region}-${func.id}`, operationResourceName: op.name }));
107
+ await poller.pollOperation({
108
+ ...ArtifactRegistryCleaner.POLLER_OPTIONS,
109
+ pollerName: `cleanup-${func.region}-${func.id}`,
110
+ operationResourceName: op.name,
111
+ });
108
112
  }
109
113
  async cleanupFunctionCache(func) {
110
114
  const op = await artifactregistry.deletePackage(`${ArtifactRegistryCleaner.packagePath(func)}%2Fcache`);
111
115
  if (op.done) {
112
116
  return;
113
117
  }
114
- await poller.pollOperation(Object.assign(Object.assign({}, ArtifactRegistryCleaner.POLLER_OPTIONS), { pollerName: `cleanup-cache-${func.region}-${func.id}`, operationResourceName: op.name }));
118
+ await poller.pollOperation({
119
+ ...ArtifactRegistryCleaner.POLLER_OPTIONS,
120
+ pollerName: `cleanup-cache-${func.region}-${func.id}`,
121
+ operationResourceName: op.name,
122
+ });
115
123
  }
116
124
  }
117
125
  exports.ArtifactRegistryCleaner = ArtifactRegistryCleaner;
@@ -156,7 +164,7 @@ class ContainerRegistryCleaner {
156
164
  await Promise.all(loadUuidTags);
157
165
  const extractFunction = /^(.*)_version-\d+$/;
158
166
  const entry = Object.entries(uuidTags).find(([, tags]) => {
159
- return tags.find((tag) => { var _a; return ((_a = extractFunction.exec(tag)) === null || _a === void 0 ? void 0 : _a[1]) === func.id; });
167
+ return tags.find((tag) => extractFunction.exec(tag)?.[1] === func.id);
160
168
  });
161
169
  if (!entry) {
162
170
  logger_1.logger.debug("Could not find image for function", backend.functionName(func));
@@ -44,8 +44,7 @@ async function uploadSourceV2(projectId, source, wantBackend) {
44
44
  return res.storageSource;
45
45
  }
46
46
  async function uploadCodebase(context, codebase, wantBackend) {
47
- var _a;
48
- const source = (_a = context.sources) === null || _a === void 0 ? void 0 : _a[codebase];
47
+ const source = context.sources?.[codebase];
49
48
  if (!source || (!source.functionsSourceV1 && !source.functionsSourceV2)) {
50
49
  return;
51
50
  }
@@ -49,8 +49,7 @@ ${FAQ_URL}
49
49
  `);
50
50
  }
51
51
  function isPermissionError(e) {
52
- var _a, _b, _c;
53
- return ((_c = (_b = (_a = e.context) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.status) === "PERMISSION_DENIED";
52
+ return e.context?.body?.error?.status === "PERMISSION_DENIED";
54
53
  }
55
54
  async function cloudBuildEnabled(projectId) {
56
55
  try {
@@ -80,7 +79,6 @@ async function secretsToServiceAccounts(b) {
80
79
  return secretsToSa;
81
80
  }
82
81
  async function secretAccess(projectId, wantBackend, haveBackend) {
83
- var _a, _b;
84
82
  const ensureAccess = async (secret, serviceAccounts) => {
85
83
  (0, utils_1.logLabeledBullet)("functions", `ensuring ${clc.bold(serviceAccounts.join(", "))} access to secret ${clc.bold(secret)}.`);
86
84
  await (0, secretManager_1.ensureServiceAgentRole)({ name: secret, projectId }, serviceAccounts, "roles/secretmanager.secretAccessor");
@@ -90,9 +88,9 @@ async function secretAccess(projectId, wantBackend, haveBackend) {
90
88
  const haveSecrets = await secretsToServiceAccounts(haveBackend);
91
89
  for (const [secret, serviceAccounts] of Object.entries(haveSecrets)) {
92
90
  for (const serviceAccount of serviceAccounts) {
93
- (_a = wantSecrets[secret]) === null || _a === void 0 ? void 0 : _a.delete(serviceAccount);
91
+ wantSecrets[secret]?.delete(serviceAccount);
94
92
  }
95
- if (((_b = wantSecrets[secret]) === null || _b === void 0 ? void 0 : _b.size) === 0) {
93
+ if (wantSecrets[secret]?.size === 0) {
96
94
  delete wantSecrets[secret];
97
95
  }
98
96
  }
@@ -27,7 +27,6 @@ const backend_1 = require("./backend");
27
27
  const functional_1 = require("../../functional");
28
28
  exports.EVENTARC_SOURCE_ENV = "EVENTARC_CLOUD_EVENT_SOURCE";
29
29
  async function prepare(context, options, payload) {
30
- var _a, _b;
31
30
  const projectId = (0, projectUtils_1.needProjectId)(options);
32
31
  const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
33
32
  context.config = (0, projectConfig_1.normalizeAndValidate)(options.config.src.functions);
@@ -49,7 +48,7 @@ async function prepare(context, options, payload) {
49
48
  context.firebaseConfig = firebaseConfig;
50
49
  let runtimeConfig = { firebase: firebaseConfig };
51
50
  if (checkAPIsEnabled[1]) {
52
- runtimeConfig = Object.assign(Object.assign({}, runtimeConfig), (await (0, prepareFunctionsUpload_1.getFunctionsConfig)(projectId)));
51
+ runtimeConfig = { ...runtimeConfig, ...(await (0, prepareFunctionsUpload_1.getFunctionsConfig)(projectId)) };
53
52
  }
54
53
  context.codebaseDeployEvents = {};
55
54
  const wantBuilds = await loadCodebases(context.config, options, firebaseConfig, runtimeConfig, context.filters);
@@ -64,13 +63,13 @@ async function prepare(context, options, payload) {
64
63
  projectAlias: options.projectAlias,
65
64
  };
66
65
  const userEnvs = functionsEnv.loadUserEnvs(userEnvOpt);
67
- const envs = Object.assign(Object.assign({}, userEnvs), firebaseEnvs);
66
+ const envs = { ...userEnvs, ...firebaseEnvs };
68
67
  const { backend: wantBackend, envs: resolvedEnvs } = await build.resolveBackend(wantBuild, firebaseConfig, userEnvOpt, userEnvs, options.nonInteractive);
69
68
  let hasEnvsFromParams = false;
70
69
  wantBackend.environmentVariables = envs;
71
70
  for (const envName of Object.keys(resolvedEnvs)) {
72
- const isList = (_a = resolvedEnvs[envName]) === null || _a === void 0 ? void 0 : _a.legalList;
73
- const envValue = (_b = resolvedEnvs[envName]) === null || _b === void 0 ? void 0 : _b.toSDK();
71
+ const isList = resolvedEnvs[envName]?.legalList;
72
+ const envValue = resolvedEnvs[envName]?.toSDK();
74
73
  if (envValue &&
75
74
  !resolvedEnvs[envName].internal &&
76
75
  (!Object.prototype.hasOwnProperty.call(wantBackend.environmentVariables, envName) || isList)) {
@@ -79,7 +78,7 @@ async function prepare(context, options, payload) {
79
78
  }
80
79
  }
81
80
  for (const endpoint of backend.allEndpoints(wantBackend)) {
82
- endpoint.environmentVariables = Object.assign({}, wantBackend.environmentVariables) || {};
81
+ endpoint.environmentVariables = { ...wantBackend.environmentVariables } || {};
83
82
  let resource;
84
83
  if (endpoint.platform === "gcfv1") {
85
84
  resource = `projects/${endpoint.project}/locations/${endpoint.region}/functions/${endpoint.id}`;
@@ -128,13 +127,13 @@ async function prepare(context, options, payload) {
128
127
  }
129
128
  if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv2")) {
130
129
  const packagedSource = await (0, prepareFunctionsUpload_1.prepareFunctionsUpload)(sourceDir, config);
131
- source.functionsSourceV2 = packagedSource === null || packagedSource === void 0 ? void 0 : packagedSource.pathToSource;
132
- source.functionsSourceV2Hash = packagedSource === null || packagedSource === void 0 ? void 0 : packagedSource.hash;
130
+ source.functionsSourceV2 = packagedSource?.pathToSource;
131
+ source.functionsSourceV2Hash = packagedSource?.hash;
133
132
  }
134
133
  if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv1")) {
135
134
  const packagedSource = await (0, prepareFunctionsUpload_1.prepareFunctionsUpload)(sourceDir, config, runtimeConfig);
136
- source.functionsSourceV1 = packagedSource === null || packagedSource === void 0 ? void 0 : packagedSource.pathToSource;
137
- source.functionsSourceV1Hash = packagedSource === null || packagedSource === void 0 ? void 0 : packagedSource.hash;
135
+ source.functionsSourceV1 = packagedSource?.pathToSource;
136
+ source.functionsSourceV1Hash = packagedSource?.hash;
138
137
  }
139
138
  context.sources[codebase] = source;
140
139
  }
@@ -187,14 +186,16 @@ async function prepare(context, options, payload) {
187
186
  }
188
187
  exports.prepare = prepare;
189
188
  function inferDetailsFromExisting(want, have, usedDotenv) {
190
- var _a;
191
189
  for (const wantE of backend.allEndpoints(want)) {
192
- const haveE = (_a = have.endpoints[wantE.region]) === null || _a === void 0 ? void 0 : _a[wantE.id];
190
+ const haveE = have.endpoints[wantE.region]?.[wantE.id];
193
191
  if (!haveE) {
194
192
  continue;
195
193
  }
196
194
  if (!usedDotenv) {
197
- wantE.environmentVariables = Object.assign(Object.assign({}, haveE.environmentVariables), wantE.environmentVariables);
195
+ wantE.environmentVariables = {
196
+ ...haveE.environmentVariables,
197
+ ...wantE.environmentVariables,
198
+ };
198
199
  }
199
200
  if (typeof wantE.availableMemoryMb === "undefined" && haveE.availableMemoryMb) {
200
201
  wantE.availableMemoryMb = haveE.availableMemoryMb;
@@ -229,7 +230,6 @@ function updateEndpointTargetedStatus(wantBackends, endpointFilters) {
229
230
  }
230
231
  exports.updateEndpointTargetedStatus = updateEndpointTargetedStatus;
231
232
  function inferBlockingDetails(want) {
232
- var _a, _b, _c;
233
233
  const authBlockingEndpoints = backend
234
234
  .allEndpoints(want)
235
235
  .filter((ep) => backend.isBlockingTriggered(ep) &&
@@ -241,9 +241,9 @@ function inferBlockingDetails(want) {
241
241
  let idToken = false;
242
242
  let refreshToken = false;
243
243
  for (const blockingEp of authBlockingEndpoints) {
244
- accessToken || (accessToken = !!((_a = blockingEp.blockingTrigger.options) === null || _a === void 0 ? void 0 : _a.accessToken));
245
- idToken || (idToken = !!((_b = blockingEp.blockingTrigger.options) === null || _b === void 0 ? void 0 : _b.idToken));
246
- refreshToken || (refreshToken = !!((_c = blockingEp.blockingTrigger.options) === null || _c === void 0 ? void 0 : _c.refreshToken));
244
+ accessToken || (accessToken = !!blockingEp.blockingTrigger.options?.accessToken);
245
+ idToken || (idToken = !!blockingEp.blockingTrigger.options?.idToken);
246
+ refreshToken || (refreshToken = !!blockingEp.blockingTrigger.options?.refreshToken);
247
247
  }
248
248
  for (const blockingEp of authBlockingEndpoints) {
249
249
  if (!blockingEp.blockingTrigger.options) {
@@ -296,7 +296,10 @@ async function loadCodebases(config, options, firebaseConfig, runtimeConfig, fil
296
296
  await runtimeDelegate.build();
297
297
  const firebaseEnvs = functionsEnv.loadFirebaseEnvs(firebaseConfig, projectId);
298
298
  (0, utils_1.logLabeledBullet)("functions", `Loading and analyzing source code for codebase ${codebase} to determine what to deploy`);
299
- wantBuilds[codebase] = await runtimeDelegate.discoverBuild(runtimeConfig, Object.assign(Object.assign({}, firebaseEnvs), { GOOGLE_CLOUD_QUOTA_PROJECT: projectId }));
299
+ wantBuilds[codebase] = await runtimeDelegate.discoverBuild(runtimeConfig, {
300
+ ...firebaseEnvs,
301
+ GOOGLE_CLOUD_QUOTA_PROJECT: projectId,
302
+ });
300
303
  wantBuilds[codebase].runtime = codebaseConfig.runtime;
301
304
  }
302
305
  return wantBuilds;
@@ -7,6 +7,7 @@ const filesize = require("filesize");
7
7
  const fs = require("fs");
8
8
  const path = require("path");
9
9
  const tmp = require("tmp");
10
+ const dynamicImport_1 = require("../../dynamicImport");
10
11
  const error_1 = require("../../error");
11
12
  const fsAsync = require("../../fsAsync");
12
13
  const functionsConfig = require("../../functionsConfig");
@@ -15,13 +16,12 @@ const utils = require("../../utils");
15
16
  const hash_1 = require("./cache/hash");
16
17
  const CONFIG_DEST_FILE = ".runtimeconfig.json";
17
18
  async function getFunctionsConfig(projectId) {
18
- var _a, _b;
19
19
  try {
20
20
  return await functionsConfig.materializeAll(projectId);
21
21
  }
22
22
  catch (err) {
23
23
  logger_1.logger.debug(err);
24
- let errorCode = (_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode;
24
+ let errorCode = err?.context?.response?.statusCode;
25
25
  if (!errorCode) {
26
26
  logger_1.logger.debug("Got unexpected error from Runtime Config; it has no status code:", err);
27
27
  errorCode = 500;
@@ -92,12 +92,19 @@ async function packageSource(sourceDir, config, runtimeConfig) {
92
92
  return { pathToSource: tmpFile, hash };
93
93
  }
94
94
  async function prepareFunctionsUpload(sourceDir, config, runtimeConfig) {
95
+ utils.logLabeledBullet("functions", `+++ Prepare functions for upload`);
95
96
  if (config.isolate === true) {
96
- const { isolate } = await Promise.resolve().then(() => require("isolate-package"));
97
- utils.logLabeledBullet("functions", `Start isolating the current directory...`);
98
- const isolateDir = await isolate();
99
- utils.logLabeledBullet("functions", `Finished isolating at ${clc.bold(isolateDir)}`);
100
- return packageSource(isolateDir, config, runtimeConfig);
97
+ utils.logLabeledBullet("functions", `+++ Start isolating the current directory...`);
98
+ try {
99
+ const { isolate } = await (0, dynamicImport_1.dynamicImport)("isolate-package");
100
+ const isolateDir = await isolate();
101
+ utils.logLabeledBullet("functions", `+++ Finished isolating at ${clc.bold(isolateDir)}`);
102
+ return packageSource(isolateDir, config, runtimeConfig);
103
+ }
104
+ catch (err) {
105
+ utils.logLabeledBullet("functions", `+++ Failed to isolate: ${err.message}`);
106
+ throw err;
107
+ }
101
108
  }
102
109
  else {
103
110
  return packageSource(sourceDir, config, runtimeConfig);
@@ -17,8 +17,7 @@ async function promptForFailurePolicies(options, want, have) {
17
17
  return;
18
18
  }
19
19
  const newRetryEndpoints = retryEndpoints.filter((endpoint) => {
20
- var _a;
21
- const existing = (_a = have.endpoints[endpoint.region]) === null || _a === void 0 ? void 0 : _a[endpoint.id];
20
+ const existing = have.endpoints[endpoint.region]?.[endpoint.id];
22
21
  return !(existing && backend.isEventTriggered(existing) && existing.eventTrigger.retry);
23
22
  });
24
23
  if (newRetryEndpoints.length === 0) {
@@ -90,12 +89,11 @@ async function promptForMinInstances(options, want, have) {
90
89
  return;
91
90
  }
92
91
  const increasesCost = backend.someEndpoint(want, (wantE) => {
93
- var _a;
94
92
  if (!pricing.canCalculateMinInstanceCost(wantE)) {
95
93
  return true;
96
94
  }
97
95
  const wantCost = pricing.monthlyMinInstanceCost([wantE]);
98
- const haveE = (_a = have.endpoints[wantE.region]) === null || _a === void 0 ? void 0 : _a[wantE.id];
96
+ const haveE = have.endpoints[wantE.region]?.[wantE.id];
99
97
  let haveCost;
100
98
  if (!haveE) {
101
99
  haveCost = 0;