firebase-tools 9.23.3 → 10.1.1

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 (223) hide show
  1. package/lib/api.js +1 -1
  2. package/lib/apiv2.js +2 -2
  3. package/lib/appdistribution/client.js +1 -1
  4. package/lib/appdistribution/options-parser-util.js +1 -1
  5. package/lib/auth.js +2 -2
  6. package/lib/command.js +26 -26
  7. package/lib/commands/appdistribution-distribute.js +4 -4
  8. package/lib/commands/appdistribution-testers-add.js +2 -2
  9. package/lib/commands/appdistribution-testers-remove.js +2 -2
  10. package/lib/commands/apps-android-sha-create.js +2 -2
  11. package/lib/commands/apps-android-sha-delete.js +2 -2
  12. package/lib/commands/apps-android-sha-list.js +2 -2
  13. package/lib/commands/apps-create.js +9 -9
  14. package/lib/commands/apps-list.js +3 -3
  15. package/lib/commands/apps-sdkconfig.js +8 -8
  16. package/lib/commands/database-get.js +1 -1
  17. package/lib/commands/database-instances-create.js +4 -4
  18. package/lib/commands/database-instances-list.js +4 -4
  19. package/lib/commands/database-profile.js +1 -1
  20. package/lib/commands/database-push.js +1 -1
  21. package/lib/commands/database-remove.js +4 -4
  22. package/lib/commands/database-set.js +4 -4
  23. package/lib/commands/database-settings-get.js +1 -1
  24. package/lib/commands/database-settings-set.js +1 -1
  25. package/lib/commands/database-update.js +4 -4
  26. package/lib/commands/ext-configure.js +2 -2
  27. package/lib/commands/ext-dev-deprecate.js +4 -4
  28. package/lib/commands/ext-dev-extension-delete.js +3 -3
  29. package/lib/commands/ext-dev-init.js +3 -3
  30. package/lib/commands/ext-dev-list.js +1 -1
  31. package/lib/commands/ext-dev-publish.js +3 -3
  32. package/lib/commands/ext-dev-register.js +5 -5
  33. package/lib/commands/ext-dev-undeprecate.js +4 -4
  34. package/lib/commands/ext-dev-unpublish.js +3 -3
  35. package/lib/commands/ext-dev-usage.js +145 -0
  36. package/lib/commands/ext-export.js +8 -8
  37. package/lib/commands/ext-info.js +4 -4
  38. package/lib/commands/ext-install.js +26 -22
  39. package/lib/commands/ext-list.js +2 -2
  40. package/lib/commands/ext-sources-create.js +2 -2
  41. package/lib/commands/ext-uninstall.js +3 -3
  42. package/lib/commands/ext-update.js +17 -17
  43. package/lib/commands/ext.js +3 -3
  44. package/lib/commands/firestore-delete.js +3 -3
  45. package/lib/commands/functions-config-export.js +11 -11
  46. package/lib/commands/functions-delete.js +3 -3
  47. package/lib/commands/functions-deletegcfartifacts.js +4 -4
  48. package/lib/commands/functions-list.js +1 -1
  49. package/lib/commands/functions-log.js +1 -1
  50. package/lib/commands/hosting-channel-create.js +12 -12
  51. package/lib/commands/hosting-channel-delete.js +9 -9
  52. package/lib/commands/hosting-channel-deploy.js +17 -17
  53. package/lib/commands/hosting-channel-list.js +5 -5
  54. package/lib/commands/hosting-channel-open.js +9 -9
  55. package/lib/commands/hosting-clone.js +15 -15
  56. package/lib/commands/hosting-disable.js +4 -4
  57. package/lib/commands/hosting-sites-create.js +7 -7
  58. package/lib/commands/hosting-sites-delete.js +7 -7
  59. package/lib/commands/hosting-sites-get.js +2 -2
  60. package/lib/commands/hosting-sites-list.js +3 -3
  61. package/lib/commands/index.js +1 -0
  62. package/lib/commands/login.js +2 -2
  63. package/lib/commands/logout.js +1 -1
  64. package/lib/commands/open.js +1 -1
  65. package/lib/commands/projects-addfirebase.js +2 -2
  66. package/lib/commands/projects-create.js +2 -2
  67. package/lib/commands/projects-list.js +1 -1
  68. package/lib/commands/remoteconfig-get.js +3 -3
  69. package/lib/commands/remoteconfig-rollback.js +3 -3
  70. package/lib/commands/remoteconfig-versions-list.js +1 -1
  71. package/lib/commands/setup-emulators-storage.js +1 -1
  72. package/lib/config.js +6 -6
  73. package/lib/database/api.js +2 -2
  74. package/lib/deploy/extensions/deploy.js +4 -4
  75. package/lib/deploy/extensions/deploymentSummary.js +5 -4
  76. package/lib/deploy/extensions/index.js +1 -0
  77. package/lib/deploy/extensions/params.js +1 -1
  78. package/lib/deploy/extensions/planner.js +3 -3
  79. package/lib/deploy/extensions/prepare.js +9 -9
  80. package/lib/deploy/extensions/release.js +1 -1
  81. package/lib/deploy/extensions/secrets.js +7 -7
  82. package/lib/deploy/extensions/validate.js +2 -2
  83. package/lib/deploy/functions/backend.js +6 -4
  84. package/lib/deploy/functions/checkIam.js +7 -7
  85. package/lib/deploy/functions/containerCleaner.js +3 -3
  86. package/lib/deploy/functions/deploy.js +10 -11
  87. package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
  88. package/lib/deploy/functions/index.js +1 -0
  89. package/lib/deploy/functions/prepare.js +27 -21
  90. package/lib/deploy/functions/prompts.js +5 -5
  91. package/lib/deploy/functions/release/executor.js +4 -1
  92. package/lib/deploy/functions/release/fabricator.js +5 -5
  93. package/lib/deploy/functions/release/index.js +3 -3
  94. package/lib/deploy/functions/release/planner.js +6 -6
  95. package/lib/deploy/functions/release/reporter.js +8 -4
  96. package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
  97. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
  98. package/lib/deploy/functions/runtimes/golang/index.js +9 -13
  99. package/lib/deploy/functions/runtimes/index.js +6 -10
  100. package/lib/deploy/functions/runtimes/node/index.js +6 -10
  101. package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +1 -1
  102. package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
  103. package/lib/deploy/functions/runtimes/node/validate.js +2 -1
  104. package/lib/deploy/functions/services/storage.js +1 -1
  105. package/lib/deploy/functions/triggerRegionHelper.js +1 -1
  106. package/lib/deploy/functions/validate.js +4 -3
  107. package/lib/deploy/hosting/deploy.js +7 -7
  108. package/lib/deploy/hosting/uploader.js +1 -1
  109. package/lib/deploy/hosting/validate.js +3 -3
  110. package/lib/deploy/remoteconfig/prepare.js +3 -3
  111. package/lib/deploy/remoteconfig/release.js +3 -3
  112. package/lib/deploy/storage/deploy.js +1 -1
  113. package/lib/deploy/storage/release.js +2 -2
  114. package/lib/detectProjectRoot.js +5 -5
  115. package/lib/emulator/auth/apiSpec.js +13 -7
  116. package/lib/emulator/auth/handlers.js +3 -3
  117. package/lib/emulator/auth/index.js +1 -1
  118. package/lib/emulator/auth/operations.js +256 -248
  119. package/lib/emulator/auth/server.js +11 -8
  120. package/lib/emulator/auth/state.js +12 -12
  121. package/lib/emulator/commandUtils.js +5 -5
  122. package/lib/emulator/controller.js +16 -11
  123. package/lib/emulator/downloadableEmulators.js +2 -2
  124. package/lib/emulator/emulatorLogger.js +1 -1
  125. package/lib/emulator/functionsEmulator.js +101 -74
  126. package/lib/emulator/functionsEmulatorRuntime.js +33 -18
  127. package/lib/emulator/functionsEmulatorShell.js +3 -2
  128. package/lib/emulator/functionsRuntimeWorker.js +1 -1
  129. package/lib/emulator/hubExport.js +2 -2
  130. package/lib/emulator/storage/apis/firebase.js +2 -2
  131. package/lib/emulator/storage/apis/gcloud.js +2 -2
  132. package/lib/emulator/storage/cloudFunctions.js +1 -1
  133. package/lib/emulator/storage/files.js +14 -14
  134. package/lib/emulator/storage/index.js +2 -2
  135. package/lib/emulator/storage/metadata.js +7 -6
  136. package/lib/emulator/storage/rules/runtime.js +5 -5
  137. package/lib/emulator/storage/server.js +2 -2
  138. package/lib/ensureApiEnabled.js +7 -7
  139. package/lib/error.js +3 -3
  140. package/lib/extensions/askUserForConsent.js +2 -3
  141. package/lib/extensions/askUserForParam.js +10 -10
  142. package/lib/extensions/billingMigrationHelper.js +1 -1
  143. package/lib/extensions/changelog.js +3 -3
  144. package/lib/extensions/displayExtensionInfo.js +5 -5
  145. package/lib/extensions/emulator/optionsHelper.js +1 -1
  146. package/lib/extensions/emulator/specHelper.js +1 -1
  147. package/lib/extensions/emulator/triggerHelper.js +1 -1
  148. package/lib/extensions/export.js +6 -6
  149. package/lib/extensions/extensionsApi.js +14 -1
  150. package/lib/extensions/extensionsHelper.js +38 -29
  151. package/lib/extensions/listExtensions.js +1 -1
  152. package/lib/extensions/localHelper.js +1 -1
  153. package/lib/extensions/metricsTypeDef.js +2 -0
  154. package/lib/extensions/metricsUtils.js +98 -0
  155. package/lib/extensions/paramHelper.js +6 -6
  156. package/lib/extensions/provisioningHelper.js +6 -4
  157. package/lib/extensions/resolveSource.js +1 -1
  158. package/lib/extensions/secretsUtils.js +3 -3
  159. package/lib/extensions/updateHelper.js +9 -9
  160. package/lib/extensions/utils.js +1 -1
  161. package/lib/extensions/warnings.js +10 -9
  162. package/lib/fetchWebSetup.js +2 -2
  163. package/lib/filterTargets.js +2 -2
  164. package/lib/firestore/indexes.js +2 -2
  165. package/lib/fsAsync.js +3 -3
  166. package/lib/fsutils.js +2 -2
  167. package/lib/functional.js +2 -1
  168. package/lib/functions/env.js +1 -1
  169. package/lib/functions/runtimeConfigExport.js +4 -4
  170. package/lib/functionsConfig.js +3 -3
  171. package/lib/functionsShellCommandAction.js +4 -3
  172. package/lib/gcp/cloudmonitoring.js +74 -0
  173. package/lib/gcp/cloudscheduler.js +1 -1
  174. package/lib/gcp/iam.js +2 -2
  175. package/lib/gcp/resourceManager.js +2 -2
  176. package/lib/gcp/secretManager.js +3 -2
  177. package/lib/getDefaultDatabaseInstance.js +1 -1
  178. package/lib/getDefaultHostingSite.js +1 -1
  179. package/lib/getProjectNumber.js +2 -2
  180. package/lib/handlePreviewToggles.js +5 -5
  181. package/lib/hosting/api.js +6 -6
  182. package/lib/hosting/cloudRunProxy.js +6 -6
  183. package/lib/hosting/functionsProxy.js +3 -3
  184. package/lib/hosting/implicitInit.js +2 -2
  185. package/lib/hosting/normalizedHostingConfigs.js +3 -3
  186. package/lib/hosting/proxy.js +2 -2
  187. package/lib/init/features/account.js +7 -7
  188. package/lib/init/features/database.js +9 -9
  189. package/lib/init/features/emulators.js +8 -8
  190. package/lib/init/features/firestore/index.js +3 -3
  191. package/lib/init/features/firestore/indexes.js +2 -2
  192. package/lib/init/features/firestore/rules.js +2 -2
  193. package/lib/init/features/functions/golang.js +4 -4
  194. package/lib/init/features/functions/index.js +4 -4
  195. package/lib/init/features/hosting/github.js +31 -31
  196. package/lib/init/features/project.js +8 -8
  197. package/lib/init/features/remoteconfig.js +2 -2
  198. package/lib/init/features/storage.js +2 -2
  199. package/lib/listFiles.js +1 -1
  200. package/lib/management/apps.js +3 -3
  201. package/lib/management/projects.js +6 -6
  202. package/lib/previews.js +2 -2
  203. package/lib/profiler.js +1 -1
  204. package/lib/projectPath.js +1 -1
  205. package/lib/projectUtils.js +1 -1
  206. package/lib/prompt.js +0 -1
  207. package/lib/rc.js +1 -1
  208. package/lib/requireAuth.js +2 -2
  209. package/lib/requireDatabaseInstance.js +1 -1
  210. package/lib/requireHostingSite.js +1 -1
  211. package/lib/requirePermissions.js +4 -4
  212. package/lib/rulesDeploy.js +2 -2
  213. package/lib/serve/functions.js +14 -7
  214. package/lib/serve/hosting.js +7 -7
  215. package/lib/utils.js +3 -2
  216. package/npm-shrinkwrap.json +24889 -0
  217. package/package.json +24 -24
  218. package/templates/init/functions/javascript/package.lint.json +1 -1
  219. package/templates/init/functions/javascript/package.nolint.json +1 -1
  220. package/templates/init/functions/typescript/package.lint.json +1 -1
  221. package/templates/init/functions/typescript/package.nolint.json +1 -1
  222. package/templates/init/hosting/index.html +1 -1
  223. package/CHANGELOG.md +0 -1
@@ -14,14 +14,14 @@ async function handleSecretParams(payload, have, nonInteractive) {
14
14
  var _a, _b, _c;
15
15
  for (const i of (_a = payload.instancesToCreate) !== null && _a !== void 0 ? _a : []) {
16
16
  if (await checkSpecForSecrets(i)) {
17
- utils_1.logLabeledBullet("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
17
+ (0, utils_1.logLabeledBullet)("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
18
18
  await handleSecretsCreateInstance(i, nonInteractive);
19
19
  }
20
20
  }
21
21
  const updates = [...((_b = payload.instancesToUpdate) !== null && _b !== void 0 ? _b : []), ...((_c = payload.instancesToConfigure) !== null && _c !== void 0 ? _c : [])];
22
22
  for (const i of updates) {
23
23
  if (await checkSpecForSecrets(i)) {
24
- utils_1.logLabeledBullet("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
24
+ (0, utils_1.logLabeledBullet)("extensions", `Verifying secret params for ${clc.bold(i.instanceId)}`);
25
25
  const previousSpec = have.find((h) => h.instanceId === i.instanceId);
26
26
  await handleSecretsUpdateInstance(i, previousSpec, nonInteractive);
27
27
  }
@@ -29,7 +29,7 @@ async function handleSecretParams(payload, have, nonInteractive) {
29
29
  }
30
30
  exports.handleSecretParams = handleSecretParams;
31
31
  async function checkSpecForSecrets(i) {
32
- const extensionVersion = await planner_1.getExtensionVersion(i);
32
+ const extensionVersion = await (0, planner_1.getExtensionVersion)(i);
33
33
  return secretUtils.usesSecrets(extensionVersion.spec);
34
34
  }
35
35
  exports.checkSpecForSecrets = checkSpecForSecrets;
@@ -37,15 +37,15 @@ const secretsInSpec = (spec) => {
37
37
  return spec.params.filter((p) => p.type === extensionsApi_1.ParamType.SECRET);
38
38
  };
39
39
  async function handleSecretsCreateInstance(i, nonInteractive) {
40
- const extensionVersion = await planner_1.getExtensionVersion(i);
40
+ const extensionVersion = await (0, planner_1.getExtensionVersion)(i);
41
41
  const secretParams = secretsInSpec(extensionVersion.spec);
42
42
  for (const s of secretParams) {
43
43
  await handleSecretParamForCreate(s, i, nonInteractive);
44
44
  }
45
45
  }
46
46
  async function handleSecretsUpdateInstance(i, prevSpec, nonInteractive) {
47
- const extensionVersion = await planner_1.getExtensionVersion(i);
48
- const prevExtensionVersion = await planner_1.getExtensionVersion(prevSpec);
47
+ const extensionVersion = await (0, planner_1.getExtensionVersion)(i);
48
+ const prevExtensionVersion = await (0, planner_1.getExtensionVersion)(prevSpec);
49
49
  const secretParams = secretsInSpec(extensionVersion.spec);
50
50
  for (const s of secretParams) {
51
51
  const prevParam = prevExtensionVersion.spec.params.find((p) => p.param === s.param);
@@ -146,5 +146,5 @@ async function promptForCreateSecret(args) {
146
146
  if (args.nonInteractive) {
147
147
  throw new error_1.FirebaseError(`To create this secret, run this command in interactive mode, or go to ${secretManager.secretManagerConsoleUri(args.projectId)}`);
148
148
  }
149
- return askUserForParam_1.promptCreateSecret(args.projectId, args.instanceId, args.secretParam, args.secretName);
149
+ return (0, askUserForParam_1.promptCreateSecret)(args.projectId, args.instanceId, args.secretParam, args.secretName);
150
150
  }
@@ -5,13 +5,13 @@ const cloudbilling_1 = require("../../gcp/cloudbilling");
5
5
  const checkProjectBilling_1 = require("../../extensions/checkProjectBilling");
6
6
  const error_1 = require("../../error");
7
7
  async function checkBilling(projectId, nonInteractive) {
8
- const enabled = await cloudbilling_1.checkBillingEnabled(projectId);
8
+ const enabled = await (0, cloudbilling_1.checkBillingEnabled)(projectId);
9
9
  if (!enabled && nonInteractive) {
10
10
  throw new error_1.FirebaseError(`Extensions require the Blaze plan, but project ${projectId} is not on the Blaze plan. ` +
11
11
  `Please visit https://console.cloud.google.com/billing/linkedaccount?project=${projectId} to upgrade your project.`);
12
12
  }
13
13
  else if (!enabled) {
14
- await checkProjectBilling_1.enableBilling(projectId);
14
+ await (0, checkProjectBilling_1.enableBilling)(projectId);
15
15
  }
16
16
  }
17
17
  exports.checkBilling = checkBilling;
@@ -200,12 +200,14 @@ function regionalEndpoints(backend, region) {
200
200
  return backend.endpoints[region] ? Object.values(backend.endpoints[region]) : [];
201
201
  }
202
202
  exports.regionalEndpoints = regionalEndpoints;
203
- exports.hasEndpoint = (backend) => (endpoint) => {
204
- return !!backend.endpoints[endpoint.region] && !!backend.endpoints[endpoint.region][endpoint.id];
203
+ const hasEndpoint = (backend) => (endpoint) => {
204
+ return (!!backend.endpoints[endpoint.region] && !!backend.endpoints[endpoint.region][endpoint.id]);
205
205
  };
206
- exports.missingEndpoint = (backend) => (endpoint) => {
207
- return !exports.hasEndpoint(backend)(endpoint);
206
+ exports.hasEndpoint = hasEndpoint;
207
+ const missingEndpoint = (backend) => (endpoint) => {
208
+ return !(0, exports.hasEndpoint)(backend)(endpoint);
208
209
  };
210
+ exports.missingEndpoint = missingEndpoint;
209
211
  function compareFunctions(left, right) {
210
212
  if (left.platform != right.platform) {
211
213
  return right.platform < left.platform ? -1 : 1;
@@ -24,18 +24,18 @@ async function checkServiceAccountIam(projectId) {
24
24
  return;
25
25
  }
26
26
  if (!passed) {
27
- throw new error_1.FirebaseError(`Missing permissions required for functions deploy. You must have permission ${cli_color_1.bold("iam.serviceAccounts.ActAs")} on service account ${cli_color_1.bold(saEmail)}.\n\n` +
27
+ throw new error_1.FirebaseError(`Missing permissions required for functions deploy. You must have permission ${(0, cli_color_1.bold)("iam.serviceAccounts.ActAs")} on service account ${(0, cli_color_1.bold)(saEmail)}.\n\n` +
28
28
  `To address this error, ask a project Owner to assign your account the "Service Account User" role from this URL:\n\n` +
29
29
  `https://console.cloud.google.com/iam-admin/iam?project=${projectId}`);
30
30
  }
31
31
  }
32
32
  exports.checkServiceAccountIam = checkServiceAccountIam;
33
33
  async function checkHttpIam(context, options, payload) {
34
- const filterGroups = context.filters || functionsDeployHelper_1.getFilterGroups(options);
34
+ const filterGroups = context.filters || (0, functionsDeployHelper_1.getFilterGroups)(options);
35
35
  const httpEndpoints = backend
36
36
  .allEndpoints(payload.functions.backend)
37
37
  .filter(backend.isHttpsTriggered)
38
- .filter((f) => functionsDeployHelper_1.functionMatchesAnyGroup(f, filterGroups));
38
+ .filter((f) => (0, functionsDeployHelper_1.functionMatchesAnyGroup)(f, filterGroups));
39
39
  const existing = await backend.existingBackend(context);
40
40
  const newHttpsEndpoints = httpEndpoints.filter(backend.missingEndpoint(existing));
41
41
  if (newHttpsEndpoints.length === 0) {
@@ -53,7 +53,7 @@ async function checkHttpIam(context, options, payload) {
53
53
  }
54
54
  if (!passed) {
55
55
  track("Error (User)", "deploy:functions:http_create_missing_iam");
56
- throw new error_1.FirebaseError(`Missing required permission on project ${cli_color_1.bold(context.projectId)} to deploy new HTTPS functions. The permission ${cli_color_1.bold(PERMISSION)} is required to deploy the following functions:\n\n- ` +
56
+ throw new error_1.FirebaseError(`Missing required permission on project ${(0, cli_color_1.bold)(context.projectId)} to deploy new HTTPS functions. The permission ${(0, cli_color_1.bold)(PERMISSION)} is required to deploy the following functions:\n\n- ` +
57
57
  newHttpsEndpoints.map((func) => func.id).join("\n- ") +
58
58
  `\n\nTo address this error, please ask a project Owner to assign your account the "Cloud Functions Admin" role at the following URL:\n\nhttps://console.cloud.google.com/iam-admin/iam?project=${context.projectId}`);
59
59
  }
@@ -61,7 +61,7 @@ async function checkHttpIam(context, options, payload) {
61
61
  }
62
62
  exports.checkHttpIam = checkHttpIam;
63
63
  function reduceEventsToServices(services, endpoint) {
64
- const service = services_1.serviceForEndpoint(endpoint);
64
+ const service = (0, services_1.serviceForEndpoint)(endpoint);
65
65
  if (service.requiredProjectBindings && !services.find((s) => s.name === service.name)) {
66
66
  services.push(service);
67
67
  }
@@ -96,7 +96,7 @@ async function ensureServiceAgentRoles(projectId, want, have) {
96
96
  }
97
97
  let policy;
98
98
  try {
99
- policy = await resourceManager_1.getIamPolicy(projectId);
99
+ policy = await (0, resourceManager_1.getIamPolicy)(projectId);
100
100
  }
101
101
  catch (err) {
102
102
  utils.logLabeledBullet("functions", "Could not verify the necessary IAM configuration for the following newly-integrated services: " +
@@ -109,7 +109,7 @@ async function ensureServiceAgentRoles(projectId, want, have) {
109
109
  const allRequiredBindings = await Promise.all(findRequiredBindings);
110
110
  mergeBindings(policy, allRequiredBindings);
111
111
  try {
112
- await resourceManager_1.setIamPolicy(projectId, policy, "bindings");
112
+ await (0, resourceManager_1.setIamPolicy)(projectId, policy, "bindings");
113
113
  }
114
114
  catch (err) {
115
115
  throw new error_1.FirebaseError("We failed to modify the IAM policy for the project. The functions " +
@@ -23,11 +23,11 @@ async function retry(func) {
23
23
  });
24
24
  return await Promise.race([func(), timeout]);
25
25
  }
26
- catch (error) {
27
- logger_1.logger.debug("Failed docker command with error ", error);
26
+ catch (err) {
27
+ logger_1.logger.debug("Failed docker command with error ", err);
28
28
  retry += 1;
29
29
  if (retry >= MAX_RETRIES) {
30
- throw new error_1.FirebaseError("Failed to clean up artifacts", { original: error });
30
+ throw new error_1.FirebaseError("Failed to clean up artifacts", { original: err });
31
31
  }
32
32
  await sleep(Math.pow(INITIAL_BACKOFF, retry - 1));
33
33
  }
@@ -5,18 +5,16 @@ const tmp_1 = require("tmp");
5
5
  const clc = require("cli-color");
6
6
  const fs = require("fs");
7
7
  const checkIam_1 = require("./checkIam");
8
- const api_1 = require("../../api");
9
8
  const utils_1 = require("../../utils");
10
9
  const gcs = require("../../gcp/storage");
11
10
  const gcf = require("../../gcp/cloudfunctions");
12
11
  const gcfv2 = require("../../gcp/cloudfunctionsv2");
13
12
  const utils = require("../../utils");
14
13
  const backend = require("./backend");
15
- const GCP_REGION = api_1.functionsUploadRegion;
16
- tmp_1.setGracefulCleanup();
17
- async function uploadSourceV1(context) {
18
- const uploadUrl = await gcf.generateUploadUrl(context.projectId, GCP_REGION);
19
- context.uploadUrl = uploadUrl;
14
+ (0, tmp_1.setGracefulCleanup)();
15
+ async function uploadSourceV1(context, region) {
16
+ const uploadUrl = await gcf.generateUploadUrl(context.projectId, region);
17
+ context.sourceUrl = uploadUrl;
20
18
  const uploadOpts = {
21
19
  file: context.functionsSourceV1,
22
20
  stream: fs.createReadStream(context.functionsSourceV1),
@@ -41,12 +39,13 @@ async function deploy(context, options, payload) {
41
39
  if (!context.functionsSourceV1 && !context.functionsSourceV2) {
42
40
  return;
43
41
  }
44
- await checkIam_1.checkHttpIam(context, options, payload);
42
+ await (0, checkIam_1.checkHttpIam)(context, options, payload);
45
43
  try {
46
44
  const want = payload.functions.backend;
47
45
  const uploads = [];
48
- if (backend.allEndpoints(want).some((endpoint) => endpoint.platform === "gcfv1")) {
49
- uploads.push(uploadSourceV1(context));
46
+ const v1Endpoints = backend.allEndpoints(want).filter((e) => e.platform === "gcfv1");
47
+ if (v1Endpoints.length > 0) {
48
+ uploads.push(uploadSourceV1(context, v1Endpoints[0].region));
50
49
  }
51
50
  for (const region of Object.keys(want.endpoints)) {
52
51
  if (backend.regionalEndpoints(want, region).some((e) => e.platform === "gcfv2")) {
@@ -56,14 +55,14 @@ async function deploy(context, options, payload) {
56
55
  await Promise.all(uploads);
57
56
  utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
58
57
  if (uploads.length) {
59
- utils_1.logSuccess(clc.green.bold("functions:") +
58
+ (0, utils_1.logSuccess)(clc.green.bold("functions:") +
60
59
  " " +
61
60
  clc.bold(options.config.src.functions.source) +
62
61
  " folder uploaded successfully");
63
62
  }
64
63
  }
65
64
  catch (err) {
66
- utils_1.logWarning(clc.yellow("functions:") + " Upload Error: " + err.message);
65
+ (0, utils_1.logWarning)(clc.yellow("functions:") + " Upload Error: " + err.message);
67
66
  throw err;
68
67
  }
69
68
  }
@@ -19,7 +19,7 @@ ${FAQ_URL}`, { exit: 1 });
19
19
  }
20
20
  function nodePermissionError(projectId) {
21
21
  track("functions_runtime_notices", "nodejs10_permission_error");
22
- return new error_1.FirebaseError(`Cloud Functions deployment requires the Cloud Build API to be enabled. The current credentials do not have permission to enable APIs for project ${cli_color_1.bold(projectId)}.
22
+ return new error_1.FirebaseError(`Cloud Functions deployment requires the Cloud Build API to be enabled. The current credentials do not have permission to enable APIs for project ${(0, cli_color_1.bold)(projectId)}.
23
23
 
24
24
  Please ask a project owner to visit the following URL to enable Cloud Build:
25
25
 
@@ -35,10 +35,10 @@ function isPermissionError(e) {
35
35
  }
36
36
  async function ensureCloudBuildEnabled(projectId) {
37
37
  try {
38
- await ensureApiEnabled_1.ensure(projectId, CLOUD_BUILD_API, "functions");
38
+ await (0, ensureApiEnabled_1.ensure)(projectId, CLOUD_BUILD_API, "functions");
39
39
  }
40
40
  catch (e) {
41
- if (error_1.isBillingError(e)) {
41
+ if ((0, error_1.isBillingError)(e)) {
42
42
  throw nodeBillingError(projectId);
43
43
  }
44
44
  else if (isPermissionError(e)) {
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.release = exports.deploy = exports.prepare = void 0;
3
4
  var prepare_1 = require("./prepare");
4
5
  Object.defineProperty(exports, "prepare", { enumerable: true, get: function () { return prepare_1.prepare; } });
5
6
  var deploy_1 = require("./deploy");
@@ -16,10 +16,10 @@ const projectUtils_1 = require("../../projectUtils");
16
16
  const track_1 = require("../../track");
17
17
  const runtimes = require("./runtimes");
18
18
  const validate = require("./validate");
19
- const utils = require("../../utils");
20
19
  const logger_1 = require("../../logger");
21
20
  const triggerRegionHelper_1 = require("./triggerRegionHelper");
22
21
  const checkIam_1 = require("./checkIam");
22
+ const error_1 = require("../../error");
23
23
  function hasUserConfig(config) {
24
24
  return Object.keys(config).length > 1;
25
25
  }
@@ -34,31 +34,37 @@ async function maybeEnableAR(projectId) {
34
34
  return true;
35
35
  }
36
36
  async function prepare(context, options, payload) {
37
- if (!options.config.src.functions) {
38
- return;
37
+ const projectId = (0, projectUtils_1.needProjectId)(options);
38
+ const sourceDirName = options.config.get("functions.source");
39
+ if (!sourceDirName) {
40
+ throw new error_1.FirebaseError(`No functions code detected at default location (./functions), and no functions.source defined in firebase.json`);
39
41
  }
40
- const runtimeDelegate = await runtimes.getRuntimeDelegate(context, options);
42
+ const sourceDir = options.config.path(sourceDirName);
43
+ const delegateContext = {
44
+ projectId,
45
+ sourceDir,
46
+ projectDir: options.config.projectDir,
47
+ runtime: options.config.get("functions.runtime") || "",
48
+ };
49
+ const runtimeDelegate = await runtimes.getRuntimeDelegate(delegateContext);
41
50
  logger_1.logger.debug(`Validating ${runtimeDelegate.name} source`);
42
51
  await runtimeDelegate.validate();
43
52
  logger_1.logger.debug(`Building ${runtimeDelegate.name} source`);
44
53
  await runtimeDelegate.build();
45
- const projectId = projectUtils_1.needProjectId(options);
46
54
  const checkAPIsEnabled = await Promise.all([
47
55
  ensureApiEnabled.ensure(projectId, "cloudfunctions.googleapis.com", "functions"),
48
56
  ensureApiEnabled.check(projectId, "runtimeconfig.googleapis.com", "runtimeconfig", true),
49
- ensureCloudBuildEnabled_1.ensureCloudBuildEnabled(projectId),
57
+ (0, ensureCloudBuildEnabled_1.ensureCloudBuildEnabled)(projectId),
50
58
  maybeEnableAR(projectId),
51
59
  ]);
52
60
  context.runtimeConfigEnabled = checkAPIsEnabled[1];
53
61
  context.artifactRegistryEnabled = checkAPIsEnabled[3];
54
62
  const firebaseConfig = await functionsConfig.getFirebaseConfig(options);
55
63
  context.firebaseConfig = firebaseConfig;
56
- const runtimeConfig = await prepareFunctionsUpload_1.getFunctionsConfig(context);
57
- utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
58
- const source = options.config.src.functions.source;
64
+ const runtimeConfig = await (0, prepareFunctionsUpload_1.getFunctionsConfig)(context);
59
65
  const firebaseEnvs = functionsEnv.loadFirebaseEnvs(firebaseConfig, projectId);
60
66
  const userEnvOpt = {
61
- functionsSource: options.config.path(source),
67
+ functionsSource: sourceDir,
62
68
  projectId: projectId,
63
69
  projectAlias: options.projectAlias,
64
70
  };
@@ -71,7 +77,7 @@ async function prepare(context, options, payload) {
71
77
  : usedDotenv
72
78
  ? "dotenv"
73
79
  : "none";
74
- await track_1.track("functions_codebase_deploy_env_method", tag);
80
+ await (0, track_1.track)("functions_codebase_deploy_env_method", tag);
75
81
  logger_1.logger.debug(`Analyzing ${runtimeDelegate.name} backend spec`);
76
82
  const wantBackend = await runtimeDelegate.discoverSpec(runtimeConfig, firebaseEnvs);
77
83
  wantBackend.environmentVariables = Object.assign(Object.assign({}, userEnvs), firebaseEnvs);
@@ -90,16 +96,16 @@ async function prepare(context, options, payload) {
90
96
  await Promise.all(enablements);
91
97
  }
92
98
  if (backend.someEndpoint(wantBackend, () => true)) {
93
- utils_1.logBullet(clc.cyan.bold("functions:") +
99
+ (0, utils_1.logBullet)(clc.cyan.bold("functions:") +
94
100
  " preparing " +
95
- clc.bold(options.config.src.functions.source) +
101
+ clc.bold(sourceDirName) +
96
102
  " directory for uploading...");
97
103
  }
98
104
  if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv1")) {
99
- context.functionsSourceV1 = await prepareFunctionsUpload_1.prepareFunctionsUpload(runtimeConfig, options);
105
+ context.functionsSourceV1 = await (0, prepareFunctionsUpload_1.prepareFunctionsUpload)(runtimeConfig, options);
100
106
  }
101
107
  if (backend.someEndpoint(wantBackend, (e) => e.platform === "gcfv2")) {
102
- context.functionsSourceV2 = await prepareFunctionsUpload_1.prepareFunctionsUpload(undefined, options);
108
+ context.functionsSourceV2 = await (0, prepareFunctionsUpload_1.prepareFunctionsUpload)(undefined, options);
103
109
  }
104
110
  for (const endpoint of backend.allEndpoints(wantBackend)) {
105
111
  endpoint.environmentVariables = wantBackend.environmentVariables;
@@ -108,16 +114,16 @@ async function prepare(context, options, payload) {
108
114
  return ensureApiEnabled.ensure(projectId, api, "functions", false);
109
115
  }));
110
116
  validate.functionIdsAreValid(backend.allEndpoints(wantBackend));
111
- context.filters = functionsDeployHelper_1.getFilterGroups(options);
117
+ context.filters = (0, functionsDeployHelper_1.getFilterGroups)(options);
112
118
  const matchingBackend = backend.matchingBackend(wantBackend, (endpoint) => {
113
- return functionsDeployHelper_1.functionMatchesAnyGroup(endpoint, context.filters);
119
+ return (0, functionsDeployHelper_1.functionMatchesAnyGroup)(endpoint, context.filters);
114
120
  });
115
121
  const haveBackend = await backend.existingBackend(context);
116
- await checkIam_1.ensureServiceAgentRoles(projectId, wantBackend, haveBackend);
122
+ await (0, checkIam_1.ensureServiceAgentRoles)(projectId, wantBackend, haveBackend);
117
123
  inferDetailsFromExisting(wantBackend, haveBackend, usedDotenv);
118
- await triggerRegionHelper_1.ensureTriggerRegions(wantBackend);
119
- await prompts_1.promptForFailurePolicies(options, matchingBackend, haveBackend);
120
- await prompts_1.promptForMinInstances(options, matchingBackend, haveBackend);
124
+ await (0, triggerRegionHelper_1.ensureTriggerRegions)(wantBackend);
125
+ await (0, prompts_1.promptForFailurePolicies)(options, matchingBackend, haveBackend);
126
+ await (0, prompts_1.promptForMinInstances)(options, matchingBackend, haveBackend);
121
127
  await backend.checkAvailability(context, wantBackend);
122
128
  }
123
129
  exports.prepare = prepare;
@@ -38,7 +38,7 @@ async function promptForFailurePolicies(options, want, have) {
38
38
  exit: 1,
39
39
  });
40
40
  }
41
- const proceed = await prompt_1.promptOnce({
41
+ const proceed = await (0, prompt_1.promptOnce)({
42
42
  type: "confirm",
43
43
  name: "confirm",
44
44
  default: false,
@@ -56,7 +56,7 @@ async function promptForFunctionDeletion(functionsToDelete, force, nonInteractiv
56
56
  }
57
57
  const deleteList = functionsToDelete
58
58
  .sort(backend.compareFunctions)
59
- .map((fn) => "\t" + functionsDeployHelper_1.getFunctionLabel(fn))
59
+ .map((fn) => "\t" + (0, functionsDeployHelper_1.getFunctionLabel)(fn))
60
60
  .join("\n");
61
61
  if (nonInteractive) {
62
62
  const deleteCommands = functionsToDelete
@@ -75,7 +75,7 @@ async function promptForFunctionDeletion(functionsToDelete, force, nonInteractiv
75
75
  "\n\nIf you are renaming a function or changing its region, it is recommended that you create the new " +
76
76
  "function first before deleting the old one to prevent event loss. For more info, visit " +
77
77
  clc.underline("https://firebase.google.com/docs/functions/manage-functions#modify" + "\n"));
78
- shouldDeleteFns = await prompt_1.promptOnce({
78
+ shouldDeleteFns = await (0, prompt_1.promptOnce)({
79
79
  type: "confirm",
80
80
  name: "confirm",
81
81
  default: false,
@@ -121,7 +121,7 @@ async function promptForMinInstances(options, want, have) {
121
121
  .filter((fn) => fn.minInstances)
122
122
  .sort(backend.compareFunctions)
123
123
  .map((fn) => {
124
- return (`\t${functionsDeployHelper_1.getFunctionLabel(fn)}: ${fn.minInstances} instances, ` +
124
+ return (`\t${(0, functionsDeployHelper_1.getFunctionLabel)(fn)}: ${fn.minInstances} instances, ` +
125
125
  backend.memoryOptionDisplayName(fn.availableMemoryMb || 256) +
126
126
  " of memory each");
127
127
  })
@@ -150,7 +150,7 @@ async function promptForMinInstances(options, want, have) {
150
150
  costLine +
151
151
  cudAnnotation;
152
152
  utils.logLabeledWarning("functions", warnMessage);
153
- const proceed = await prompt_1.promptOnce({
153
+ const proceed = await (0, prompt_1.promptOnce)({
154
154
  type: "confirm",
155
155
  name: "confirm",
156
156
  default: false,
@@ -9,7 +9,10 @@ async function handler(op) {
9
9
  }
10
10
  catch (err) {
11
11
  const code = err.status ||
12
- err.code || ((_b = (_a = err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) || ((_c = err.original) === null || _c === void 0 ? void 0 : _c.code) || ((_f = (_e = (_d = err.original) === null || _d === void 0 ? void 0 : _d.context) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.statusCode);
12
+ err.code ||
13
+ ((_b = (_a = err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) ||
14
+ ((_c = err.original) === null || _c === void 0 ? void 0 : _c.code) ||
15
+ ((_f = (_e = (_d = err.original) === null || _d === void 0 ? void 0 : _d.context) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.statusCode);
13
16
  if (code === 429 || code === 409) {
14
17
  throw err;
15
18
  }
@@ -119,7 +119,7 @@ class Fabricator {
119
119
  await this.createV2Function(endpoint);
120
120
  }
121
121
  else {
122
- functional_1.assertExhaustive(endpoint.platform);
122
+ (0, functional_1.assertExhaustive)(endpoint.platform);
123
123
  }
124
124
  await this.setTrigger(endpoint);
125
125
  }
@@ -139,7 +139,7 @@ class Fabricator {
139
139
  await this.updateV2Function(update.endpoint);
140
140
  }
141
141
  else {
142
- functional_1.assertExhaustive(update.endpoint.platform);
142
+ (0, functional_1.assertExhaustive)(update.endpoint.platform);
143
143
  }
144
144
  await this.setTrigger(update.endpoint);
145
145
  }
@@ -351,7 +351,7 @@ class Fabricator {
351
351
  await this.upsertScheduleV2(endpoint);
352
352
  return;
353
353
  }
354
- functional_1.assertExhaustive(endpoint.platform);
354
+ (0, functional_1.assertExhaustive)(endpoint.platform);
355
355
  }
356
356
  else if (backend.isTaskQueueTriggered(endpoint)) {
357
357
  await this.upsertTaskQueue(endpoint);
@@ -367,7 +367,7 @@ class Fabricator {
367
367
  await this.deleteScheduleV2(endpoint);
368
368
  return;
369
369
  }
370
- functional_1.assertExhaustive(endpoint.platform);
370
+ (0, functional_1.assertExhaustive)(endpoint.platform);
371
371
  }
372
372
  else if (backend.isTaskQueueTriggered(endpoint)) {
373
373
  await this.disableTaskQueue(endpoint);
@@ -415,7 +415,7 @@ class Fabricator {
415
415
  .catch(rethrowAs(endpoint, "disable task queue"));
416
416
  }
417
417
  logOpStart(op, endpoint) {
418
- const runtime = runtimes_1.getHumanFriendlyRuntimeName(endpoint.runtime);
418
+ const runtime = (0, runtimes_1.getHumanFriendlyRuntimeName)(endpoint.runtime);
419
419
  const label = helper.getFunctionLabel(endpoint);
420
420
  utils.logBullet(`${clc.bold.cyan("functions:")} ${op} ${runtime} function ${clc.bold(label)}...`);
421
421
  }
@@ -37,9 +37,9 @@ async function release(context, options, payload) {
37
37
  const fab = new fabricator.Fabricator({
38
38
  functionExecutor,
39
39
  executor: new executor.QueueExecutor({}),
40
- sourceUrl: context.uploadUrl,
40
+ sourceUrl: context.sourceUrl,
41
41
  storage: context.storage,
42
- appEngineLocation: functionsConfig_1.getAppEngineLocation(context.firebaseConfig),
42
+ appEngineLocation: (0, functionsConfig_1.getAppEngineLocation)(context.firebaseConfig),
43
43
  });
44
44
  const summary = await fab.applyPlan(plan);
45
45
  await reporter.logAndTrackDeployStats(summary);
@@ -71,7 +71,7 @@ function printTriggerUrls(results) {
71
71
  logger_1.logger.debug("Missing URI for HTTPS function in printTriggerUrls. This shouldn't happen");
72
72
  continue;
73
73
  }
74
- logger_1.logger.info(clc.bold("Function URL"), `(${functionsDeployHelper_1.getFunctionLabel(httpsFunc)}):`, httpsFunc.uri);
74
+ logger_1.logger.info(clc.bold("Function URL"), `(${(0, functionsDeployHelper_1.getFunctionLabel)(httpsFunc)}):`, httpsFunc.uri);
75
75
  }
76
76
  }
77
77
  exports.printTriggerUrls = printTriggerUrls;
@@ -14,7 +14,7 @@ function calculateRegionalChanges(want, have, options) {
14
14
  .map((id) => want[id]);
15
15
  const endpointsToDelete = Object.keys(have)
16
16
  .filter((id) => !want[id])
17
- .filter((id) => options.deleteAll || deploymentTool_1.isFirebaseManaged(have[id].labels || {}))
17
+ .filter((id) => options.deleteAll || (0, deploymentTool_1.isFirebaseManaged)(have[id].labels || {}))
18
18
  .map((id) => have[id]);
19
19
  const endpointsToUpdate = Object.keys(want)
20
20
  .filter((id) => have[id])
@@ -39,10 +39,10 @@ exports.calculateUpdate = calculateUpdate;
39
39
  function createDeploymentPlan(want, have, options = {}) {
40
40
  const deployment = {};
41
41
  want = backend.matchingBackend(want, (endpoint) => {
42
- return functionsDeployHelper_1.functionMatchesAnyGroup(endpoint, options.filters || []);
42
+ return (0, functionsDeployHelper_1.functionMatchesAnyGroup)(endpoint, options.filters || []);
43
43
  });
44
44
  have = backend.matchingBackend(have, (endpoint) => {
45
- return functionsDeployHelper_1.functionMatchesAnyGroup(endpoint, options.filters || []);
45
+ return (0, functionsDeployHelper_1.functionMatchesAnyGroup)(endpoint, options.filters || []);
46
46
  });
47
47
  const regions = new Set([...Object.keys(want.endpoints), ...Object.keys(have.endpoints)]);
48
48
  for (const region of regions) {
@@ -146,17 +146,17 @@ function checkForIllegalUpdate(want, have) {
146
146
  const wantType = triggerType(want);
147
147
  const haveType = triggerType(have);
148
148
  if (wantType != haveType) {
149
- throw new error_1.FirebaseError(`[${functionsDeployHelper_2.getFunctionLabel(want)}] Changing from ${haveType} function to ${wantType} function is not allowed. Please delete your function and create a new one instead.`);
149
+ throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_2.getFunctionLabel)(want)}] Changing from ${haveType} function to ${wantType} function is not allowed. Please delete your function and create a new one instead.`);
150
150
  }
151
151
  if (want.platform == "gcfv1" && have.platform == "gcfv2") {
152
- throw new error_1.FirebaseError(`[${functionsDeployHelper_2.getFunctionLabel(want)}] Functions cannot be downgraded from GCFv2 to GCFv1`);
152
+ throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_2.getFunctionLabel)(want)}] Functions cannot be downgraded from GCFv2 to GCFv1`);
153
153
  }
154
154
  exports.checkForV2Upgrade(want, have);
155
155
  }
156
156
  exports.checkForIllegalUpdate = checkForIllegalUpdate;
157
157
  function checkForV2Upgrade(want, have) {
158
158
  if (want.platform == "gcfv2" && have.platform == "gcfv1") {
159
- throw new error_1.FirebaseError(`[${functionsDeployHelper_2.getFunctionLabel(have)}] Upgrading from GCFv1 to GCFv2 is not yet supported. Please delete your old function or wait for this feature to be ready.`);
159
+ throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_2.getFunctionLabel)(have)}] Upgrading from GCFv1 to GCFv2 is not yet supported. Please delete your old function or wait for this feature to be ready.`);
160
160
  }
161
161
  }
162
162
  exports.checkForV2Upgrade = checkForV2Upgrade;
@@ -85,7 +85,7 @@ function printErrors(summary) {
85
85
  logger_1.logger.info("Functions deploy had errors with the following functions:" +
86
86
  errored
87
87
  .filter((r) => !(r.error instanceof AbortedDeploymentError))
88
- .map((result) => `\n\t${functionsDeployHelper_1.getFunctionLabel(result.endpoint)}`)
88
+ .map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`)
89
89
  .join(""));
90
90
  printIamErrors(errored);
91
91
  printQuotaErrors(errored);
@@ -99,7 +99,7 @@ function printIamErrors(results) {
99
99
  }
100
100
  logger_1.logger.info("");
101
101
  logger_1.logger.info("Unable to set the invoker for the IAM policy on the following functions:" +
102
- iamFailures.map((result) => `\n\t${functionsDeployHelper_1.getFunctionLabel(result.endpoint)}`).join(""));
102
+ iamFailures.map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`).join(""));
103
103
  logger_1.logger.info("");
104
104
  logger_1.logger.info("Some common causes of this:");
105
105
  logger_1.logger.info("");
@@ -124,7 +124,11 @@ function printQuotaErrors(results) {
124
124
  return false;
125
125
  }
126
126
  const original = r.error.original;
127
- const code = (original === null || original === void 0 ? void 0 : original.status) || (original === null || original === void 0 ? void 0 : original.code) || ((_b = (_a = original === null || original === void 0 ? void 0 : original.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) || ((_c = original === null || original === void 0 ? void 0 : original.original) === null || _c === void 0 ? void 0 : _c.code) || ((_f = (_e = (_d = original === null || original === void 0 ? void 0 : original.original) === null || _d === void 0 ? void 0 : _d.context) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.statusCode);
127
+ const code = (original === null || original === void 0 ? void 0 : original.status) ||
128
+ (original === null || original === void 0 ? void 0 : original.code) ||
129
+ ((_b = (_a = original === null || original === void 0 ? void 0 : original.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) ||
130
+ ((_c = original === null || original === void 0 ? void 0 : original.original) === null || _c === void 0 ? void 0 : _c.code) ||
131
+ ((_f = (_e = (_d = original === null || original === void 0 ? void 0 : original.original) === null || _d === void 0 ? void 0 : _d.context) === null || _e === void 0 ? void 0 : _e.response) === null || _f === void 0 ? void 0 : _f.statusCode);
128
132
  return code === 429 || code === 409;
129
133
  });
130
134
  if (!hadQuotaError) {
@@ -145,7 +149,7 @@ function printAbortedErrors(results) {
145
149
  logger_1.logger.info("");
146
150
  logger_1.logger.info("Because there were errors creating or updating functions, the following " +
147
151
  "functions were not deleted" +
148
- aborted.map((result) => `\n\t${functionsDeployHelper_1.getFunctionLabel(result.endpoint)}`).join(""));
152
+ aborted.map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`).join(""));
149
153
  logger_1.logger.info(`To delete these, use ${clc.bold("firebase functions:delete")}`);
150
154
  }
151
155
  exports.printAbortedErrors = printAbortedErrors;
@@ -10,7 +10,7 @@ const logger_1 = require("../../../../logger");
10
10
  const api = require("../../.../../../../api");
11
11
  const v1alpha1 = require("./v1alpha1");
12
12
  const error_1 = require("../../../../error");
13
- exports.readFileAsync = util_1.promisify(fs.readFile);
13
+ exports.readFileAsync = (0, util_1.promisify)(fs.readFile);
14
14
  function yamlToBackend(yaml, project, region, runtime) {
15
15
  try {
16
16
  if (!yaml.specVersion) {
@@ -54,7 +54,7 @@ async function detectFromPort(port, project, runtime, timeout = 30000) {
54
54
  });
55
55
  while (true) {
56
56
  try {
57
- res = await Promise.race([node_fetch_1.default(`http://localhost:${port}/backend.yaml`), timedOut]);
57
+ res = await Promise.race([(0, node_fetch_1.default)(`http://localhost:${port}/backend.yaml`), timedOut]);
58
58
  break;
59
59
  }
60
60
  catch (err) {