firebase-tools 10.0.1 → 10.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/lib/accountExporter.js +9 -8
  2. package/lib/accountImporter.js +10 -8
  3. package/lib/api.js +1 -0
  4. package/lib/apiv2.js +91 -48
  5. package/lib/appdistribution/client.js +1 -1
  6. package/lib/appdistribution/options-parser-util.js +1 -1
  7. package/lib/archiveDirectory.js +63 -73
  8. package/lib/auth.js +2 -2
  9. package/lib/bin/firebase.js +1 -1
  10. package/lib/command.js +26 -26
  11. package/lib/commands/appdistribution-distribute.js +4 -4
  12. package/lib/commands/appdistribution-testers-add.js +2 -2
  13. package/lib/commands/appdistribution-testers-remove.js +2 -2
  14. package/lib/commands/apps-android-sha-create.js +2 -2
  15. package/lib/commands/apps-android-sha-delete.js +2 -2
  16. package/lib/commands/apps-android-sha-list.js +2 -2
  17. package/lib/commands/apps-create.js +9 -9
  18. package/lib/commands/apps-list.js +3 -3
  19. package/lib/commands/apps-sdkconfig.js +8 -8
  20. package/lib/commands/auth-export.js +26 -25
  21. package/lib/commands/auth-import.js +88 -78
  22. package/lib/commands/database-get.js +1 -1
  23. package/lib/commands/database-instances-create.js +4 -4
  24. package/lib/commands/database-instances-list.js +4 -4
  25. package/lib/commands/database-profile.js +1 -1
  26. package/lib/commands/database-push.js +1 -1
  27. package/lib/commands/database-remove.js +2 -2
  28. package/lib/commands/database-set.js +2 -2
  29. package/lib/commands/database-settings-get.js +1 -1
  30. package/lib/commands/database-settings-set.js +1 -1
  31. package/lib/commands/database-update.js +2 -2
  32. package/lib/commands/ext-configure.js +3 -3
  33. package/lib/commands/ext-dev-deprecate.js +4 -4
  34. package/lib/commands/ext-dev-extension-delete.js +3 -3
  35. package/lib/commands/ext-dev-init.js +4 -4
  36. package/lib/commands/ext-dev-list.js +1 -1
  37. package/lib/commands/ext-dev-publish.js +4 -4
  38. package/lib/commands/ext-dev-register.js +6 -6
  39. package/lib/commands/ext-dev-undeprecate.js +4 -4
  40. package/lib/commands/ext-dev-unpublish.js +3 -3
  41. package/lib/commands/ext-dev-usage.js +140 -0
  42. package/lib/commands/ext-export.js +8 -8
  43. package/lib/commands/ext-info.js +5 -5
  44. package/lib/commands/ext-install.js +27 -23
  45. package/lib/commands/ext-list.js +2 -2
  46. package/lib/commands/ext-sources-create.js +2 -2
  47. package/lib/commands/ext-uninstall.js +4 -4
  48. package/lib/commands/ext-update.js +18 -18
  49. package/lib/commands/ext.js +3 -3
  50. package/lib/commands/firestore-delete.js +1 -1
  51. package/lib/commands/functions-config-clone.js +22 -23
  52. package/lib/commands/functions-config-export.js +11 -11
  53. package/lib/commands/functions-config-get.js +22 -22
  54. package/lib/commands/functions-config-set.js +24 -22
  55. package/lib/commands/functions-config-unset.js +20 -22
  56. package/lib/commands/functions-delete.js +3 -3
  57. package/lib/commands/functions-deletegcfartifacts.js +4 -4
  58. package/lib/commands/functions-list.js +1 -1
  59. package/lib/commands/functions-log.js +1 -1
  60. package/lib/commands/help.js +12 -12
  61. package/lib/commands/hosting-channel-create.js +13 -13
  62. package/lib/commands/hosting-channel-delete.js +10 -10
  63. package/lib/commands/hosting-channel-deploy.js +18 -18
  64. package/lib/commands/hosting-channel-list.js +5 -5
  65. package/lib/commands/hosting-channel-open.js +9 -9
  66. package/lib/commands/hosting-clone.js +16 -16
  67. package/lib/commands/hosting-disable.js +1 -1
  68. package/lib/commands/hosting-sites-create.js +7 -7
  69. package/lib/commands/hosting-sites-delete.js +7 -7
  70. package/lib/commands/hosting-sites-get.js +2 -2
  71. package/lib/commands/hosting-sites-list.js +3 -3
  72. package/lib/commands/index.js +1 -0
  73. package/lib/commands/login-ci.js +10 -10
  74. package/lib/commands/login.js +2 -2
  75. package/lib/commands/logout.js +1 -1
  76. package/lib/commands/open.js +1 -1
  77. package/lib/commands/projects-addfirebase.js +2 -2
  78. package/lib/commands/projects-create.js +2 -2
  79. package/lib/commands/projects-list.js +1 -1
  80. package/lib/commands/remoteconfig-get.js +3 -3
  81. package/lib/commands/remoteconfig-rollback.js +3 -3
  82. package/lib/commands/remoteconfig-versions-list.js +7 -2
  83. package/lib/commands/setup-emulators-database.js +8 -7
  84. package/lib/commands/setup-emulators-firestore.js +8 -7
  85. package/lib/commands/setup-emulators-pubsub.js +5 -4
  86. package/lib/commands/setup-emulators-storage.js +4 -3
  87. package/lib/commands/setup-emulators-ui.js +8 -7
  88. package/lib/commands/target-apply.js +17 -16
  89. package/lib/commands/target-clear.js +11 -10
  90. package/lib/commands/target-remove.js +10 -9
  91. package/lib/commands/target.js +20 -20
  92. package/lib/config.js +6 -6
  93. package/lib/database/api.js +2 -2
  94. package/lib/database/metadata.js +16 -24
  95. package/lib/defaultCredentials.js +3 -3
  96. package/lib/deploy/extensions/deploy.js +4 -4
  97. package/lib/deploy/extensions/deploymentSummary.js +5 -4
  98. package/lib/deploy/extensions/index.js +1 -0
  99. package/lib/deploy/extensions/params.js +1 -1
  100. package/lib/deploy/extensions/planner.js +3 -3
  101. package/lib/deploy/extensions/prepare.js +9 -9
  102. package/lib/deploy/extensions/release.js +1 -1
  103. package/lib/deploy/extensions/secrets.js +7 -7
  104. package/lib/deploy/extensions/validate.js +2 -2
  105. package/lib/deploy/functions/backend.js +9 -5
  106. package/lib/deploy/functions/checkIam.js +7 -7
  107. package/lib/deploy/functions/containerCleaner.js +3 -3
  108. package/lib/deploy/functions/deploy.js +4 -4
  109. package/lib/deploy/functions/ensureCloudBuildEnabled.js +3 -3
  110. package/lib/deploy/functions/index.js +1 -0
  111. package/lib/deploy/functions/prepare.js +29 -23
  112. package/lib/deploy/functions/prompts.js +5 -5
  113. package/lib/deploy/functions/release/executor.js +4 -1
  114. package/lib/deploy/functions/release/fabricator.js +9 -6
  115. package/lib/deploy/functions/release/index.js +2 -2
  116. package/lib/deploy/functions/release/planner.js +6 -6
  117. package/lib/deploy/functions/release/reporter.js +8 -4
  118. package/lib/deploy/functions/runtimes/discovery/index.js +2 -2
  119. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +14 -14
  120. package/lib/deploy/functions/runtimes/golang/index.js +11 -14
  121. package/lib/deploy/functions/runtimes/index.js +6 -10
  122. package/lib/deploy/functions/runtimes/node/index.js +6 -10
  123. package/lib/deploy/functions/runtimes/node/parseTriggers.js +3 -3
  124. package/lib/deploy/functions/runtimes/node/validate.js +2 -1
  125. package/lib/deploy/functions/services/storage.js +1 -1
  126. package/lib/deploy/functions/triggerRegionHelper.js +1 -1
  127. package/lib/deploy/functions/validate.js +32 -4
  128. package/lib/deploy/hosting/convertConfig.js +45 -24
  129. package/lib/deploy/hosting/deploy.js +7 -7
  130. package/lib/deploy/hosting/prepare.js +1 -1
  131. package/lib/deploy/hosting/uploader.js +1 -1
  132. package/lib/deploy/hosting/validate.js +3 -3
  133. package/lib/deploy/remoteconfig/prepare.js +3 -3
  134. package/lib/deploy/remoteconfig/release.js +3 -3
  135. package/lib/deploy/storage/deploy.js +1 -1
  136. package/lib/deploy/storage/release.js +2 -2
  137. package/lib/detectProjectRoot.js +5 -5
  138. package/lib/emulator/auth/apiSpec.js +13 -7
  139. package/lib/emulator/auth/handlers.js +3 -3
  140. package/lib/emulator/auth/index.js +1 -1
  141. package/lib/emulator/auth/operations.js +256 -248
  142. package/lib/emulator/auth/server.js +11 -8
  143. package/lib/emulator/auth/state.js +12 -12
  144. package/lib/emulator/commandUtils.js +5 -5
  145. package/lib/emulator/controller.js +16 -11
  146. package/lib/emulator/downloadableEmulators.js +5 -4
  147. package/lib/emulator/emulatorLogger.js +1 -1
  148. package/lib/emulator/functionsEmulator.js +110 -75
  149. package/lib/emulator/functionsEmulatorRuntime.js +36 -21
  150. package/lib/emulator/functionsEmulatorShell.js +3 -2
  151. package/lib/emulator/functionsRuntimeWorker.js +1 -1
  152. package/lib/emulator/hubExport.js +2 -2
  153. package/lib/emulator/storage/apis/firebase.js +2 -2
  154. package/lib/emulator/storage/apis/gcloud.js +2 -2
  155. package/lib/emulator/storage/cloudFunctions.js +1 -1
  156. package/lib/emulator/storage/files.js +14 -14
  157. package/lib/emulator/storage/index.js +2 -2
  158. package/lib/emulator/storage/metadata.js +7 -6
  159. package/lib/emulator/storage/rules/runtime.js +10 -9
  160. package/lib/emulator/storage/server.js +2 -2
  161. package/lib/ensureApiEnabled.js +7 -7
  162. package/lib/error.js +3 -3
  163. package/lib/extensions/askUserForConsent.js +3 -4
  164. package/lib/extensions/askUserForParam.js +11 -11
  165. package/lib/extensions/billingMigrationHelper.js +2 -2
  166. package/lib/extensions/changelog.js +4 -4
  167. package/lib/extensions/displayExtensionInfo.js +6 -6
  168. package/lib/extensions/emulator/optionsHelper.js +1 -1
  169. package/lib/extensions/emulator/specHelper.js +1 -1
  170. package/lib/extensions/emulator/triggerHelper.js +1 -1
  171. package/lib/extensions/export.js +6 -6
  172. package/lib/extensions/extensionsApi.js +68 -110
  173. package/lib/extensions/extensionsHelper.js +56 -43
  174. package/lib/extensions/listExtensions.js +1 -1
  175. package/lib/extensions/localHelper.js +1 -1
  176. package/lib/extensions/metricsTypeDef.js +2 -0
  177. package/lib/extensions/metricsUtils.js +98 -0
  178. package/lib/extensions/paramHelper.js +6 -6
  179. package/lib/extensions/provisioningHelper.js +13 -14
  180. package/lib/extensions/resolveSource.js +6 -6
  181. package/lib/extensions/secretsUtils.js +3 -3
  182. package/lib/extensions/updateHelper.js +10 -10
  183. package/lib/extensions/utils.js +1 -1
  184. package/lib/extensions/warnings.js +11 -10
  185. package/lib/fetchWebSetup.js +2 -2
  186. package/lib/filterTargets.js +2 -2
  187. package/lib/firestore/indexes.js +2 -2
  188. package/lib/fsAsync.js +3 -3
  189. package/lib/fsutils.js +2 -2
  190. package/lib/functional.js +2 -1
  191. package/lib/functions/env.js +1 -1
  192. package/lib/functions/runtimeConfigExport.js +4 -4
  193. package/lib/functionsConfig.js +7 -8
  194. package/lib/functionsShellCommandAction.js +4 -3
  195. package/lib/gcp/cloudbilling.js +8 -19
  196. package/lib/gcp/cloudfunctions.js +22 -46
  197. package/lib/gcp/cloudlogging.js +8 -11
  198. package/lib/gcp/cloudmonitoring.js +77 -0
  199. package/lib/gcp/cloudscheduler.js +8 -19
  200. package/lib/gcp/firedata.js +5 -4
  201. package/lib/gcp/firestore.js +5 -5
  202. package/lib/gcp/iam.js +19 -34
  203. package/lib/gcp/resourceManager.js +10 -15
  204. package/lib/gcp/rules.js +18 -41
  205. package/lib/gcp/runtimeconfig.js +31 -53
  206. package/lib/gcp/secretManager.js +24 -45
  207. package/lib/gcp/storage.js +24 -29
  208. package/lib/getDefaultDatabaseInstance.js +1 -1
  209. package/lib/getDefaultHostingSite.js +1 -1
  210. package/lib/getProjectNumber.js +2 -2
  211. package/lib/handlePreviewToggles.js +5 -5
  212. package/lib/hosting/api.js +6 -6
  213. package/lib/hosting/cloudRunProxy.js +6 -6
  214. package/lib/hosting/functionsProxy.js +3 -3
  215. package/lib/hosting/implicitInit.js +2 -2
  216. package/lib/hosting/normalizedHostingConfigs.js +3 -3
  217. package/lib/hosting/proxy.js +2 -2
  218. package/lib/init/features/account.js +7 -7
  219. package/lib/init/features/database.js +9 -9
  220. package/lib/init/features/emulators.js +8 -8
  221. package/lib/init/features/firestore/index.js +3 -3
  222. package/lib/init/features/firestore/indexes.js +2 -2
  223. package/lib/init/features/firestore/rules.js +2 -2
  224. package/lib/init/features/functions/golang.js +4 -4
  225. package/lib/init/features/functions/index.js +4 -4
  226. package/lib/init/features/hosting/github.js +31 -31
  227. package/lib/init/features/project.js +8 -8
  228. package/lib/init/features/remoteconfig.js +2 -2
  229. package/lib/init/features/storage.js +2 -2
  230. package/lib/listFiles.js +1 -1
  231. package/lib/management/apps.js +3 -3
  232. package/lib/management/projects.js +6 -6
  233. package/lib/previews.js +2 -2
  234. package/lib/profiler.js +1 -1
  235. package/lib/projectPath.js +1 -1
  236. package/lib/projectUtils.js +2 -2
  237. package/lib/prompt.js +0 -1
  238. package/lib/rc.js +1 -1
  239. package/lib/remoteconfig/get.js +14 -8
  240. package/lib/remoteconfig/rollback.js +13 -6
  241. package/lib/remoteconfig/versionslist.js +13 -7
  242. package/lib/requireAuth.js +2 -2
  243. package/lib/requireDatabaseInstance.js +1 -1
  244. package/lib/requireHostingSite.js +1 -1
  245. package/lib/requirePermissions.js +4 -4
  246. package/lib/rulesDeploy.js +2 -2
  247. package/lib/serve/functions.js +14 -7
  248. package/lib/serve/hosting.js +7 -7
  249. package/lib/utils.js +3 -2
  250. package/npm-shrinkwrap.json +24090 -0
  251. package/package.json +36 -31
  252. package/schema/firebase-config.json +387 -12
  253. package/lib/commands/functions-config-legacy.js +0 -45
  254. package/lib/prepareFirebaseRules.js +0 -58
@@ -15,11 +15,11 @@ const secrets_1 = require("./secrets");
15
15
  const warnings_1 = require("../../extensions/warnings");
16
16
  async function prepare(context, options, payload) {
17
17
  var _a;
18
- const projectId = projectUtils_1.needProjectId(options);
19
- const projectNumber = await projectUtils_1.needProjectNumber(options);
20
- const aliases = projectUtils_1.getAliases(options, projectId);
21
- await extensionsHelper_1.ensureExtensionsApiEnabled(options);
22
- await requirePermissions_1.requirePermissions(options, ["firebaseextensions.instances.list"]);
18
+ const projectId = (0, projectUtils_1.needProjectId)(options);
19
+ const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
20
+ const aliases = (0, projectUtils_1.getAliases)(options, projectId);
21
+ await (0, extensionsHelper_1.ensureExtensionsApiEnabled)(options);
22
+ await (0, requirePermissions_1.requirePermissions)(options, ["firebaseextensions.instances.list"]);
23
23
  context.have = await planner.have(projectId);
24
24
  context.want = await planner.want({
25
25
  projectId,
@@ -30,13 +30,13 @@ async function prepare(context, options, payload) {
30
30
  });
31
31
  const usingSecrets = await Promise.all((_a = context.have) === null || _a === void 0 ? void 0 : _a.map(secrets_1.checkSpecForSecrets));
32
32
  if (usingSecrets.some((i) => i)) {
33
- await secretsUtils_1.ensureSecretManagerApiEnabled(options);
33
+ await (0, secretsUtils_1.ensureSecretManagerApiEnabled)(options);
34
34
  }
35
35
  payload.instancesToCreate = context.want.filter((i) => { var _a; return !((_a = context.have) === null || _a === void 0 ? void 0 : _a.some(matchesInstanceId(i))); });
36
36
  payload.instancesToConfigure = context.want.filter((i) => { var _a; return (_a = context.have) === null || _a === void 0 ? void 0 : _a.some(isConfigure(i)); });
37
37
  payload.instancesToUpdate = context.want.filter((i) => { var _a; return (_a = context.have) === null || _a === void 0 ? void 0 : _a.some(isUpdate(i)); });
38
38
  payload.instancesToDelete = context.have.filter((i) => { var _a; return !((_a = context.want) === null || _a === void 0 ? void 0 : _a.some(matchesInstanceId(i))); });
39
- if (await warnings_1.displayWarningsForDeploy(payload.instancesToCreate)) {
39
+ if (await (0, warnings_1.displayWarningsForDeploy)(payload.instancesToCreate)) {
40
40
  if (!options.force && options.nonInteractive) {
41
41
  throw new error_1.FirebaseError("Pass the --force flag to acknowledge these terms in non-interactive mode");
42
42
  }
@@ -50,7 +50,7 @@ async function prepare(context, options, payload) {
50
50
  throw new error_1.FirebaseError("Deployment cancelled");
51
51
  }
52
52
  }
53
- if (await warnings_1.displayWarningsForDeploy(payload.instancesToCreate)) {
53
+ if (await (0, warnings_1.displayWarningsForDeploy)(payload.instancesToCreate)) {
54
54
  if (!options.force && options.nonInteractive) {
55
55
  throw new error_1.FirebaseError("Pass the --force flag to acknowledge these terms in non-interactive mode");
56
56
  }
@@ -97,7 +97,7 @@ async function prepare(context, options, payload) {
97
97
  permissionsNeeded.push("firebaseextensions.instances.delete");
98
98
  }
99
99
  }
100
- await requirePermissions_1.requirePermissions(options, permissionsNeeded);
100
+ await (0, requirePermissions_1.requirePermissions)(options, permissionsNeeded);
101
101
  }
102
102
  exports.prepare = prepare;
103
103
  const matchesInstanceId = (dep) => (test) => {
@@ -8,7 +8,7 @@ const errors_1 = require("./errors");
8
8
  const projectUtils_1 = require("../../projectUtils");
9
9
  async function release(context, options, payload) {
10
10
  var _a, _b, _c, _d;
11
- const projectId = projectUtils_1.needProjectId(options);
11
+ const projectId = (0, projectUtils_1.needProjectId)(options);
12
12
  const errorHandler = new errors_1.ErrorHandler();
13
13
  const deploymentQueue = new queue_1.default({
14
14
  retries: 5,
@@ -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;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.compareFunctions = exports.missingEndpoint = exports.hasEndpoint = exports.regionalEndpoints = exports.matchingBackend = exports.someEndpoint = exports.allEndpoints = exports.checkAvailability = exports.existingBackend = exports.scheduleIdForFunction = exports.functionName = exports.isEmptyBackend = exports.of = exports.empty = exports.isTaskQueueTriggered = exports.isScheduleTriggered = exports.isEventTriggered = exports.isHttpsTriggered = exports.SCHEDULED_FUNCTION_LABEL = exports.memoryOptionDisplayName = exports.endpointTriggerType = void 0;
3
+ exports.compareFunctions = exports.missingEndpoint = exports.hasEndpoint = exports.regionalEndpoints = exports.matchingBackend = exports.someEndpoint = exports.allEndpoints = exports.checkAvailability = exports.existingBackend = exports.scheduleIdForFunction = exports.functionName = exports.isEmptyBackend = exports.of = exports.empty = exports.isTaskQueueTriggered = exports.isScheduleTriggered = exports.isEventTriggered = exports.isHttpsTriggered = exports.SCHEDULED_FUNCTION_LABEL = exports.MIN_MEMORY_FOR_CONCURRENCY = exports.DEFAULT_MEMORY = exports.memoryOptionDisplayName = exports.endpointTriggerType = void 0;
4
4
  const gcf = require("../../gcp/cloudfunctions");
5
5
  const gcfV2 = require("../../gcp/cloudfunctionsv2");
6
6
  const utils = require("../../utils");
@@ -36,6 +36,8 @@ function memoryOptionDisplayName(option) {
36
36
  }[option];
37
37
  }
38
38
  exports.memoryOptionDisplayName = memoryOptionDisplayName;
39
+ exports.DEFAULT_MEMORY = 256;
40
+ exports.MIN_MEMORY_FOR_CONCURRENCY = 2048;
39
41
  exports.SCHEDULED_FUNCTION_LABEL = Object.freeze({ deployment: "firebase-schedule" });
40
42
  function isHttpsTriggered(triggered) {
41
43
  return {}.hasOwnProperty.call(triggered, "httpsTrigger");
@@ -200,12 +202,14 @@ function regionalEndpoints(backend, region) {
200
202
  return backend.endpoints[region] ? Object.values(backend.endpoints[region]) : [];
201
203
  }
202
204
  exports.regionalEndpoints = regionalEndpoints;
203
- exports.hasEndpoint = (backend) => (endpoint) => {
204
- return !!backend.endpoints[endpoint.region] && !!backend.endpoints[endpoint.region][endpoint.id];
205
+ const hasEndpoint = (backend) => (endpoint) => {
206
+ return (!!backend.endpoints[endpoint.region] && !!backend.endpoints[endpoint.region][endpoint.id]);
205
207
  };
206
- exports.missingEndpoint = (backend) => (endpoint) => {
207
- return !exports.hasEndpoint(backend)(endpoint);
208
+ exports.hasEndpoint = hasEndpoint;
209
+ const missingEndpoint = (backend) => (endpoint) => {
210
+ return !(0, exports.hasEndpoint)(backend)(endpoint);
208
211
  };
212
+ exports.missingEndpoint = missingEndpoint;
209
213
  function compareFunctions(left, right) {
210
214
  if (left.platform != right.platform) {
211
215
  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
  }
@@ -11,7 +11,7 @@ const gcf = require("../../gcp/cloudfunctions");
11
11
  const gcfv2 = require("../../gcp/cloudfunctionsv2");
12
12
  const utils = require("../../utils");
13
13
  const backend = require("./backend");
14
- tmp_1.setGracefulCleanup();
14
+ (0, tmp_1.setGracefulCleanup)();
15
15
  async function uploadSourceV1(context, region) {
16
16
  const uploadUrl = await gcf.generateUploadUrl(context.projectId, region);
17
17
  context.sourceUrl = uploadUrl;
@@ -39,7 +39,7 @@ async function deploy(context, options, payload) {
39
39
  if (!context.functionsSourceV1 && !context.functionsSourceV2) {
40
40
  return;
41
41
  }
42
- await checkIam_1.checkHttpIam(context, options, payload);
42
+ await (0, checkIam_1.checkHttpIam)(context, options, payload);
43
43
  try {
44
44
  const want = payload.functions.backend;
45
45
  const uploads = [];
@@ -55,14 +55,14 @@ async function deploy(context, options, payload) {
55
55
  await Promise.all(uploads);
56
56
  utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
57
57
  if (uploads.length) {
58
- utils_1.logSuccess(clc.green.bold("functions:") +
58
+ (0, utils_1.logSuccess)(clc.green.bold("functions:") +
59
59
  " " +
60
60
  clc.bold(options.config.src.functions.source) +
61
61
  " folder uploaded successfully");
62
62
  }
63
63
  }
64
64
  catch (err) {
65
- utils_1.logWarning(clc.yellow("functions:") + " Upload Error: " + err.message);
65
+ (0, utils_1.logWarning)(clc.yellow("functions:") + " Upload Error: " + err.message);
66
66
  throw err;
67
67
  }
68
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
  }
@@ -27,38 +27,44 @@ function hasDotenv(opts) {
27
27
  return previews_1.previews.dotenv && functionsEnv.hasUserEnvs(opts);
28
28
  }
29
29
  async function maybeEnableAR(projectId) {
30
- if (previews_1.previews.artifactregistry) {
30
+ if (!previews_1.previews.artifactregistry) {
31
31
  return ensureApiEnabled.check(projectId, "artifactregistry.googleapis.com", "functions", true);
32
32
  }
33
33
  await ensureApiEnabled.ensure(projectId, "artifactregistry.googleapis.com", "functions");
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;
@@ -107,17 +113,17 @@ async function prepare(context, options, payload) {
107
113
  await Promise.all(Object.values(wantBackend.requiredAPIs).map((api) => {
108
114
  return ensureApiEnabled.ensure(projectId, api, "functions", false);
109
115
  }));
110
- validate.functionIdsAreValid(backend.allEndpoints(wantBackend));
111
- context.filters = functionsDeployHelper_1.getFilterGroups(options);
116
+ validate.endpointsAreValid(wantBackend);
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
  }
@@ -242,7 +242,10 @@ class Fabricator {
242
242
  .catch(rethrowAs(endpoint, "set invoker"));
243
243
  }
244
244
  }
245
- await this.setConcurrency(endpoint, serviceName, endpoint.concurrency || DEFAULT_GCFV2_CONCURRENCY);
245
+ const mem = endpoint.availableMemoryMb || backend.DEFAULT_MEMORY;
246
+ if (mem >= backend.MIN_MEMORY_FOR_CONCURRENCY && endpoint.concurrency != 1) {
247
+ await this.setConcurrency(endpoint, serviceName, endpoint.concurrency || DEFAULT_GCFV2_CONCURRENCY);
248
+ }
246
249
  }
247
250
  async updateV1Function(endpoint, scraper) {
248
251
  var _a;
@@ -351,7 +354,7 @@ class Fabricator {
351
354
  await this.upsertScheduleV2(endpoint);
352
355
  return;
353
356
  }
354
- functional_1.assertExhaustive(endpoint.platform);
357
+ (0, functional_1.assertExhaustive)(endpoint.platform);
355
358
  }
356
359
  else if (backend.isTaskQueueTriggered(endpoint)) {
357
360
  await this.upsertTaskQueue(endpoint);
@@ -367,7 +370,7 @@ class Fabricator {
367
370
  await this.deleteScheduleV2(endpoint);
368
371
  return;
369
372
  }
370
- functional_1.assertExhaustive(endpoint.platform);
373
+ (0, functional_1.assertExhaustive)(endpoint.platform);
371
374
  }
372
375
  else if (backend.isTaskQueueTriggered(endpoint)) {
373
376
  await this.disableTaskQueue(endpoint);
@@ -415,7 +418,7 @@ class Fabricator {
415
418
  .catch(rethrowAs(endpoint, "disable task queue"));
416
419
  }
417
420
  logOpStart(op, endpoint) {
418
- const runtime = runtimes_1.getHumanFriendlyRuntimeName(endpoint.runtime);
421
+ const runtime = (0, runtimes_1.getHumanFriendlyRuntimeName)(endpoint.runtime);
419
422
  const label = helper.getFunctionLabel(endpoint);
420
423
  utils.logBullet(`${clc.bold.cyan("functions:")} ${op} ${runtime} function ${clc.bold(label)}...`);
421
424
  }
@@ -39,7 +39,7 @@ async function release(context, options, payload) {
39
39
  executor: new executor.QueueExecutor({}),
40
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;