firebase-tools-with-isolate 12.9.1-3 → 12.9.1-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/lib/accountExporter.js +1 -2
  2. package/lib/apiv2.js +5 -9
  3. package/lib/appdistribution/client.js +2 -3
  4. package/lib/auth.js +12 -15
  5. package/lib/command.js +1 -2
  6. package/lib/commands/crashlytics-symbols-upload.js +2 -2
  7. package/lib/commands/emulators-start.js +1 -2
  8. package/lib/commands/ext-configure.js +6 -4
  9. package/lib/commands/ext-dev-list.js +2 -3
  10. package/lib/commands/ext-export.js +1 -1
  11. package/lib/commands/ext-info.js +2 -3
  12. package/lib/commands/ext-install.js +5 -7
  13. package/lib/commands/firestore-indexes-list.js +1 -2
  14. package/lib/commands/frameworks-backends-delete.js +1 -2
  15. package/lib/commands/frameworks-backends-get.js +1 -2
  16. package/lib/commands/frameworks-backends-list.js +1 -2
  17. package/lib/commands/hosting-clone.js +2 -3
  18. package/lib/commands/init.js +1 -2
  19. package/lib/commands/logout.js +1 -1
  20. package/lib/commands/remoteconfig-get.js +1 -1
  21. package/lib/commands/remoteconfig-rollback.js +1 -2
  22. package/lib/commands/remoteconfig-versions-list.js +1 -2
  23. package/lib/config.js +2 -3
  24. package/lib/crashlytics/buildToolsJarHelper.js +1 -2
  25. package/lib/database/import.js +4 -4
  26. package/lib/deploy/extensions/deploy.js +6 -7
  27. package/lib/deploy/extensions/deploymentSummary.js +1 -2
  28. package/lib/deploy/extensions/planner.js +4 -5
  29. package/lib/deploy/extensions/prepare.js +6 -7
  30. package/lib/deploy/extensions/release.js +9 -10
  31. package/lib/deploy/extensions/secrets.js +6 -8
  32. package/lib/deploy/extensions/tasks.js +1 -2
  33. package/lib/deploy/firestore/deploy.js +2 -4
  34. package/lib/deploy/firestore/release.js +2 -3
  35. package/lib/deploy/functions/backend.js +17 -15
  36. package/lib/deploy/functions/build.js +9 -1
  37. package/lib/deploy/functions/cache/applyHash.js +2 -3
  38. package/lib/deploy/functions/containerCleaner.js +11 -3
  39. package/lib/deploy/functions/deploy.js +1 -2
  40. package/lib/deploy/functions/ensure.js +3 -5
  41. package/lib/deploy/functions/prepare.js +21 -18
  42. package/lib/deploy/functions/prepareFunctionsUpload.js +13 -7
  43. package/lib/deploy/functions/prompts.js +2 -4
  44. package/lib/deploy/functions/release/executor.js +5 -6
  45. package/lib/deploy/functions/release/fabricator.js +58 -30
  46. package/lib/deploy/functions/release/index.js +10 -7
  47. package/lib/deploy/functions/release/planner.js +2 -3
  48. package/lib/deploy/functions/release/reporter.js +11 -14
  49. package/lib/deploy/functions/release/sourceTokenScraper.js +4 -5
  50. package/lib/deploy/functions/runtimes/discovery/index.js +1 -1
  51. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +13 -8
  52. package/lib/deploy/functions/runtimes/node/index.js +11 -4
  53. package/lib/deploy/functions/runtimes/node/parseTriggers.js +23 -10
  54. package/lib/deploy/functions/runtimes/node/versioning.js +1 -2
  55. package/lib/deploy/functions/runtimes/python/index.js +8 -7
  56. package/lib/deploy/functions/services/auth.js +29 -22
  57. package/lib/deploy/functions/services/firestore.js +1 -2
  58. package/lib/deploy/functions/services/storage.js +1 -2
  59. package/lib/deploy/functions/validate.js +1 -2
  60. package/lib/deploy/hosting/convertConfig.js +36 -19
  61. package/lib/deploy/hosting/deploy.js +3 -5
  62. package/lib/deploy/hosting/prepare.js +10 -9
  63. package/lib/deploy/lifecycleHooks.js +2 -3
  64. package/lib/deploy/remoteconfig/functions.js +1 -1
  65. package/lib/deploy/remoteconfig/prepare.js +1 -2
  66. package/lib/deploy/remoteconfig/release.js +1 -1
  67. package/lib/deploymentTool.js +1 -2
  68. package/lib/emulator/auth/cloudFunctions.js +1 -1
  69. package/lib/emulator/auth/handlers.js +2 -2
  70. package/lib/emulator/auth/index.js +5 -5
  71. package/lib/emulator/auth/operations.js +165 -124
  72. package/lib/emulator/auth/server.js +29 -20
  73. package/lib/emulator/auth/state.js +21 -31
  74. package/lib/emulator/auth/utils.js +1 -1
  75. package/lib/emulator/commandUtils.js +9 -9
  76. package/lib/emulator/controller.js +16 -13
  77. package/lib/emulator/databaseEmulator.js +1 -2
  78. package/lib/emulator/downloadableEmulators.js +3 -4
  79. package/lib/emulator/emulatorLogger.js +18 -3
  80. package/lib/emulator/eventarcEmulator.js +2 -3
  81. package/lib/emulator/eventarcEmulatorUtils.js +2 -4
  82. package/lib/emulator/extensions/validation.js +2 -4
  83. package/lib/emulator/extensionsEmulator.js +6 -9
  84. package/lib/emulator/functionsEmulator.js +69 -37
  85. package/lib/emulator/functionsEmulatorRuntime.js +1 -1
  86. package/lib/emulator/functionsEmulatorShared.js +5 -7
  87. package/lib/emulator/functionsEmulatorShell.js +4 -6
  88. package/lib/emulator/functionsRuntimeWorker.js +17 -8
  89. package/lib/emulator/hub.js +9 -2
  90. package/lib/emulator/hubClient.js +1 -1
  91. package/lib/emulator/loggingEmulator.js +2 -2
  92. package/lib/emulator/registry.js +10 -4
  93. package/lib/emulator/storage/apis/firebase.js +15 -18
  94. package/lib/emulator/storage/apis/gcloud.js +5 -7
  95. package/lib/emulator/storage/files.js +18 -41
  96. package/lib/emulator/storage/metadata.js +8 -2
  97. package/lib/emulator/storage/rules/manager.js +2 -3
  98. package/lib/emulator/storage/rules/runtime.js +15 -13
  99. package/lib/emulator/storage/rules/utils.js +1 -1
  100. package/lib/emulator/storage/upload.js +1 -2
  101. package/lib/ensureApiEnabled.js +1 -2
  102. package/lib/error.js +3 -5
  103. package/lib/experiments.js +2 -4
  104. package/lib/extensions/askUserForEventsConfig.js +5 -6
  105. package/lib/extensions/askUserForParam.js +4 -5
  106. package/lib/extensions/displayExtensionInfo.js +20 -26
  107. package/lib/extensions/emulator/optionsHelper.js +2 -3
  108. package/lib/extensions/emulator/specHelper.js +9 -10
  109. package/lib/extensions/export.js +4 -5
  110. package/lib/extensions/extensionsApi.js +8 -13
  111. package/lib/extensions/extensionsHelper.js +15 -18
  112. package/lib/extensions/listExtensions.js +2 -3
  113. package/lib/extensions/manifest.js +2 -3
  114. package/lib/extensions/paramHelper.js +10 -5
  115. package/lib/extensions/provisioningHelper.js +12 -16
  116. package/lib/extensions/publisherApi.js +1 -2
  117. package/lib/extensions/resolveSource.js +1 -2
  118. package/lib/extensions/tos.js +8 -2
  119. package/lib/extensions/utils.js +2 -3
  120. package/lib/extensions/warnings.js +4 -5
  121. package/lib/frameworks/angular/index.js +5 -6
  122. package/lib/frameworks/angular/utils.js +10 -12
  123. package/lib/frameworks/astro/index.js +1 -1
  124. package/lib/frameworks/astro/utils.js +1 -2
  125. package/lib/frameworks/compose/discover/filesystem.js +1 -1
  126. package/lib/frameworks/compose/discover/runtime/node.js +8 -11
  127. package/lib/frameworks/compose/driver/docker.js +3 -5
  128. package/lib/frameworks/compose/driver/local.js +2 -3
  129. package/lib/frameworks/compose/index.js +4 -5
  130. package/lib/frameworks/express/index.js +2 -3
  131. package/lib/frameworks/flutter/index.js +1 -2
  132. package/lib/frameworks/index.js +16 -17
  133. package/lib/frameworks/next/index.js +21 -18
  134. package/lib/frameworks/next/utils.js +6 -3
  135. package/lib/frameworks/nuxt/index.js +1 -1
  136. package/lib/frameworks/nuxt/utils.js +2 -3
  137. package/lib/frameworks/nuxt2/index.js +1 -1
  138. package/lib/frameworks/sveltekit/index.js +2 -4
  139. package/lib/frameworks/utils.js +10 -7
  140. package/lib/functions/env.js +3 -4
  141. package/lib/functions/projectConfig.js +1 -1
  142. package/lib/functions/python.js +7 -1
  143. package/lib/functions/runtimeConfigExport.js +1 -2
  144. package/lib/functions/secrets.js +21 -6
  145. package/lib/functionsShellCommandAction.js +2 -3
  146. package/lib/gcp/cloudfunctions.js +47 -31
  147. package/lib/gcp/cloudfunctionsv2.js +59 -31
  148. package/lib/gcp/cloudscheduler.js +5 -5
  149. package/lib/gcp/cloudtasks.js +6 -5
  150. package/lib/gcp/docker.js +2 -4
  151. package/lib/gcp/run.js +12 -18
  152. package/lib/gcp/secretManager.js +25 -12
  153. package/lib/gcp/storage.js +5 -3
  154. package/lib/getDefaultDatabaseInstance.js +1 -2
  155. package/lib/getDefaultHostingSite.js +1 -2
  156. package/lib/hosting/api.js +1 -2
  157. package/lib/hosting/cloudRunProxy.js +1 -2
  158. package/lib/hosting/config.js +10 -9
  159. package/lib/hosting/proxy.js +1 -2
  160. package/lib/hosting/runTags.js +3 -6
  161. package/lib/init/features/extensions/index.js +2 -3
  162. package/lib/init/features/firestore/index.js +1 -1
  163. package/lib/init/features/frameworks/index.js +5 -1
  164. package/lib/init/features/frameworks/repo.js +11 -4
  165. package/lib/init/features/functions/index.js +2 -3
  166. package/lib/init/features/hosting/index.js +1 -2
  167. package/lib/init/index.js +1 -2
  168. package/lib/localFunction.js +13 -14
  169. package/lib/management/apps.js +1 -1
  170. package/lib/management/database.js +1 -2
  171. package/lib/projectUtils.js +1 -1
  172. package/lib/prompt.js +2 -4
  173. package/lib/rc.js +3 -5
  174. package/lib/requireConfig.js +4 -6
  175. package/lib/rulesDeploy.js +2 -3
  176. package/lib/serve/functions.js +8 -1
  177. package/lib/serve/hosting.js +1 -1
  178. package/lib/track.js +15 -6
  179. package/lib/unzip.js +2 -3
  180. package/lib/utils.js +2 -2
  181. package/package.json +3 -3
@@ -158,7 +158,6 @@ function createWriteUsersToFile() {
158
158
  };
159
159
  }
160
160
  async function serialExportUsers(projectId, options) {
161
- var _a;
162
161
  if (!options.writeUsersToFile) {
163
162
  options.writeUsersToFile = createWriteUsersToFile();
164
163
  }
@@ -189,7 +188,7 @@ async function serialExportUsers(projectId, options) {
189
188
  }
190
189
  }
191
190
  catch (err) {
192
- if (((_a = err.original) === null || _a === void 0 ? void 0 : _a.code) === "ETIMEDOUT") {
191
+ if (err.original?.code === "ETIMEDOUT") {
193
192
  options.timeoutRetryCount++;
194
193
  if (options.timeoutRetryCount > 5) {
195
194
  return err;
package/lib/apiv2.js CHANGED
@@ -154,7 +154,6 @@ class Client {
154
154
  return `${this.opts.urlPrefix}${versionPath}${options.path}`;
155
155
  }
156
156
  async doRequest(options) {
157
- var _a;
158
157
  if (!options.path.startsWith("/")) {
159
158
  options.path = "/" + options.path;
160
159
  }
@@ -200,7 +199,7 @@ class Client {
200
199
  fetchOptions.body = JSON.stringify(options.body);
201
200
  }
202
201
  const operationOptions = {
203
- retries: ((_a = options.retryCodes) === null || _a === void 0 ? void 0 : _a.length) ? 1 : 2,
202
+ retries: options.retryCodes?.length ? 1 : 2,
204
203
  minTimeout: 1 * 1000,
205
204
  maxTimeout: 5 * 1000,
206
205
  };
@@ -216,7 +215,6 @@ class Client {
216
215
  const operation = retry.operation(operationOptions);
217
216
  return await new Promise((resolve, reject) => {
218
217
  operation.attempt(async (currentAttempt) => {
219
- var _a;
220
218
  let res;
221
219
  let body;
222
220
  try {
@@ -275,7 +273,7 @@ class Client {
275
273
  }
276
274
  this.logResponse(res, body, options);
277
275
  if (res.status >= 400) {
278
- if ((_a = options.retryCodes) === null || _a === void 0 ? void 0 : _a.includes(res.status)) {
276
+ if (options.retryCodes?.includes(res.status)) {
279
277
  const err = (0, responseToError_1.responseToError)({ statusCode: res.status }, body) || undefined;
280
278
  if (operation.retry(err)) {
281
279
  return;
@@ -294,11 +292,10 @@ class Client {
294
292
  });
295
293
  }
296
294
  logRequest(options) {
297
- var _a, _b;
298
295
  let queryParamsLog = "[none]";
299
296
  if (options.queryParams) {
300
297
  queryParamsLog = "[omitted]";
301
- if (!((_a = options.skipLog) === null || _a === void 0 ? void 0 : _a.queryParams)) {
298
+ if (!options.skipLog?.queryParams) {
302
299
  queryParamsLog =
303
300
  options.queryParams instanceof url_1.URLSearchParams
304
301
  ? options.queryParams.toString()
@@ -313,18 +310,17 @@ class Client {
313
310
  }
314
311
  if (options.body !== undefined) {
315
312
  let logBody = "[omitted]";
316
- if (!((_b = options.skipLog) === null || _b === void 0 ? void 0 : _b.body)) {
313
+ if (!options.skipLog?.body) {
317
314
  logBody = bodyToString(options.body);
318
315
  }
319
316
  logger_1.logger.debug(`>>> [apiv2][body] ${options.method} ${logURL} ${logBody}`);
320
317
  }
321
318
  }
322
319
  logResponse(res, body, options) {
323
- var _a;
324
320
  const logURL = this.requestURL(options);
325
321
  logger_1.logger.debug(`<<< [apiv2][status] ${options.method} ${logURL} ${res.status}`);
326
322
  let logBody = "[omitted]";
327
- if (!((_a = options.skipLog) === null || _a === void 0 ? void 0 : _a.resBody)) {
323
+ if (!options.skipLog?.resBody) {
328
324
  logBody = bodyToString(body);
329
325
  }
330
326
  logger_1.logger.debug(`<<< [apiv2][body] ${options.method} ${logURL} ${logBody}`);
@@ -77,12 +77,11 @@ class AppDistributionClient {
77
77
  await this.appDistroV2Client.patch(`/${releaseName}`, data, { queryParams });
78
78
  }
79
79
  catch (err) {
80
- throw new error_1.FirebaseError(`failed to update release notes with ${err === null || err === void 0 ? void 0 : err.message}`);
80
+ throw new error_1.FirebaseError(`failed to update release notes with ${err?.message}`);
81
81
  }
82
82
  utils.logSuccess("added release notes successfully");
83
83
  }
84
84
  async distribute(releaseName, testerEmails = [], groupAliases = []) {
85
- var _a, _b, _c;
86
85
  if (testerEmails.length === 0 && groupAliases.length === 0) {
87
86
  utils.logWarning("no testers or groups specified, skipping");
88
87
  return;
@@ -97,7 +96,7 @@ class AppDistributionClient {
97
96
  }
98
97
  catch (err) {
99
98
  let errorMessage = err.message;
100
- const errorStatus = (_c = (_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.status;
99
+ const errorStatus = err?.context?.body?.error?.status;
101
100
  if (errorStatus === "FAILED_PRECONDITION") {
102
101
  errorMessage = "invalid testers";
103
102
  }
package/lib/auth.js CHANGED
@@ -276,7 +276,6 @@ function urlsafeBase64(base64string) {
276
276
  return base64string.replace(/\+/g, "-").replace(/=+$/, "").replace(/\//g, "_");
277
277
  }
278
278
  async function loginRemotely() {
279
- var _a;
280
279
  const authProxyClient = new apiv2.Client({
281
280
  urlPrefix: api_1.authProxyOrigin,
282
281
  auth: false,
@@ -284,9 +283,9 @@ async function loginRemotely() {
284
283
  const sessionId = (0, uuid_1.v4)();
285
284
  const codeVerifier = (0, crypto_1.randomBytes)(32).toString("hex");
286
285
  const codeChallenge = urlsafeBase64((0, crypto_1.createHash)("sha256").update(codeVerifier).digest("base64"));
287
- const attestToken = (_a = (await authProxyClient.post("/attest", {
286
+ const attestToken = (await authProxyClient.post("/attest", {
288
287
  session_id: sessionId,
289
- })).body) === null || _a === void 0 ? void 0 : _a.token;
288
+ })).body?.token;
290
289
  const loginUrl = `${api_1.authProxyOrigin}/login?code_challenge=${codeChallenge}&session=${sessionId}&attest=${attestToken}`;
291
290
  logger_1.logger.info();
292
291
  logger_1.logger.info("To sign in to the Firebase CLI:");
@@ -381,7 +380,7 @@ async function loginGoogle(localhost, userHint) {
381
380
  const port = await getPort();
382
381
  return await loginWithLocalhostGoogle(port, userHint);
383
382
  }
384
- catch (_a) {
383
+ catch {
385
384
  return await loginRemotely();
386
385
  }
387
386
  }
@@ -398,23 +397,22 @@ function findAccountByEmail(email) {
398
397
  }
399
398
  exports.findAccountByEmail = findAccountByEmail;
400
399
  function haveValidTokens(refreshToken, authScopes) {
401
- var _a;
402
- if (!(lastAccessToken === null || lastAccessToken === void 0 ? void 0 : lastAccessToken.access_token)) {
400
+ if (!lastAccessToken?.access_token) {
403
401
  const tokens = configstore_1.configstore.get("tokens");
404
- if (refreshToken === (tokens === null || tokens === void 0 ? void 0 : tokens.refresh_token)) {
402
+ if (refreshToken === tokens?.refresh_token) {
405
403
  lastAccessToken = tokens;
406
404
  }
407
405
  }
408
- const hasTokens = !!(lastAccessToken === null || lastAccessToken === void 0 ? void 0 : lastAccessToken.access_token);
409
- const oldScopesJSON = JSON.stringify(((_a = lastAccessToken === null || lastAccessToken === void 0 ? void 0 : lastAccessToken.scopes) === null || _a === void 0 ? void 0 : _a.sort()) || []);
406
+ const hasTokens = !!lastAccessToken?.access_token;
407
+ const oldScopesJSON = JSON.stringify(lastAccessToken?.scopes?.sort() || []);
410
408
  const newScopesJSON = JSON.stringify(authScopes.sort());
411
409
  const hasSameScopes = oldScopesJSON === newScopesJSON;
412
- const isExpired = ((lastAccessToken === null || lastAccessToken === void 0 ? void 0 : lastAccessToken.expires_at) || 0) < Date.now() + FIFTEEN_MINUTES_IN_MS;
410
+ const isExpired = (lastAccessToken?.expires_at || 0) < Date.now() + FIFTEEN_MINUTES_IN_MS;
413
411
  return hasTokens && hasSameScopes && !isExpired;
414
412
  }
415
413
  function deleteAccount(account) {
416
414
  const defaultAccount = getGlobalDefaultAccount();
417
- if (account.user.email === (defaultAccount === null || defaultAccount === void 0 ? void 0 : defaultAccount.user.email)) {
415
+ if (account.user.email === defaultAccount?.user.email) {
418
416
  configstore_1.configstore.delete("user");
419
417
  configstore_1.configstore.delete("tokens");
420
418
  configstore_1.configstore.delete("usage");
@@ -433,7 +431,7 @@ function deleteAccount(account) {
433
431
  }
434
432
  function updateAccount(account) {
435
433
  const defaultAccount = getGlobalDefaultAccount();
436
- if (account.user.email === (defaultAccount === null || defaultAccount === void 0 ? void 0 : defaultAccount.user.email)) {
434
+ if (account.user.email === defaultAccount?.user.email) {
437
435
  configstore_1.configstore.set("user", account.user);
438
436
  configstore_1.configstore.set("tokens", account.tokens);
439
437
  }
@@ -456,7 +454,6 @@ function logoutCurrentSession(refreshToken) {
456
454
  deleteAccount(account);
457
455
  }
458
456
  async function refreshTokens(refreshToken, authScopes) {
459
- var _a, _b;
460
457
  logger_1.logger.debug("> refreshing access token with scopes:", JSON.stringify(authScopes));
461
458
  try {
462
459
  const client = new apiv2.Client({ urlPrefix: api_1.googleOrigin, auth: false });
@@ -498,7 +495,7 @@ async function refreshTokens(refreshToken, authScopes) {
498
495
  return lastAccessToken;
499
496
  }
500
497
  catch (err) {
501
- if (((_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.error) === "invalid_scope") {
498
+ if (err?.context?.body?.error === "invalid_scope") {
502
499
  throw new error_1.FirebaseError("This command requires new authorization scopes not granted to your current session. Please run " +
503
500
  clc.bold("firebase login --reauth") +
504
501
  "\n\n" +
@@ -516,7 +513,7 @@ async function getAccessToken(refreshToken, authScopes) {
516
513
  }
517
514
  exports.getAccessToken = getAccessToken;
518
515
  async function logout(refreshToken) {
519
- if ((lastAccessToken === null || lastAccessToken === void 0 ? void 0 : lastAccessToken.refresh_token) === refreshToken) {
516
+ if (lastAccessToken?.refresh_token === refreshToken) {
520
517
  lastAccessToken = undefined;
521
518
  }
522
519
  logoutCurrentSession(refreshToken);
package/lib/command.js CHANGED
@@ -201,8 +201,7 @@ class Command {
201
201
  }
202
202
  }
203
203
  async resolveProjectIdentifiers(options) {
204
- var _a;
205
- if ((_a = options.project) === null || _a === void 0 ? void 0 : _a.match(/^\d+$/)) {
204
+ if (options.project?.match(/^\d+$/)) {
206
205
  await (0, requireAuth_1.requireAuth)(options);
207
206
  const { projectId, projectNumber } = await (0, projects_1.getFirebaseProject)(options.project);
208
207
  options.projectId = projectId;
@@ -34,7 +34,7 @@ exports.command = new command_1.Command("crashlytics:symbols:upload <symbolFiles
34
34
  };
35
35
  for (const symbolFile of symbolFiles) {
36
36
  utils.logBullet(`Generating symbols for ${symbolFile}`);
37
- const generateArgs = buildArgs(Object.assign(Object.assign({}, jarOptions), { symbolFile }));
37
+ const generateArgs = buildArgs({ ...jarOptions, symbolFile });
38
38
  (0, buildToolsJarHelper_1.runBuildtoolsCommand)(jarFile, generateArgs, debug);
39
39
  utils.logBullet(`Generated symbols for ${symbolFile}`);
40
40
  utils.logBullet(`Output Path: ${jarOptions.cachePath}`);
@@ -44,7 +44,7 @@ exports.command = new command_1.Command("crashlytics:symbols:upload <symbolFiles
44
44
  return;
45
45
  }
46
46
  utils.logBullet(`Uploading all generated symbols...`);
47
- const uploadArgs = buildArgs(Object.assign(Object.assign({}, jarOptions), { generate: false }));
47
+ const uploadArgs = buildArgs({ ...jarOptions, generate: false });
48
48
  (0, buildToolsJarHelper_1.runBuildtoolsCommand)(jarFile, uploadArgs, debug);
49
49
  utils.logBullet("Successfully uploaded all symbols");
50
50
  });
@@ -52,8 +52,7 @@ function printEmulatorOverview(options) {
52
52
  reservedPorts.push(info.port);
53
53
  }
54
54
  controller.filterEmulatorTargets(options).forEach((emulator) => {
55
- var _a;
56
- reservedPorts.push(...(((_a = registry_1.EmulatorRegistry.getInfo(emulator)) === null || _a === void 0 ? void 0 : _a.reservedPorts) || []));
55
+ reservedPorts.push(...(registry_1.EmulatorRegistry.getInfo(emulator)?.reservedPorts || []));
57
56
  });
58
57
  }
59
58
  const reservedPortsString = reservedPorts.length > 0 ? reservedPorts.join(", ") : "None";
@@ -33,7 +33,6 @@ exports.command = new command_1.Command("ext:configure <extensionInstanceId>")
33
33
  .before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
34
34
  .before(extensionsHelper_1.diagnoseAndFixProject)
35
35
  .action(async (instanceId, options) => {
36
- var _a, _b;
37
36
  const projectId = (0, projectUtils_1.getProjectId)(options);
38
37
  if (options.nonInteractive) {
39
38
  throw new error_1.FirebaseError(`Command not supported in non-interactive mode, edit ./extensions/${instanceId}.env directly instead. ` +
@@ -58,8 +57,8 @@ exports.command = new command_1.Command("ext:configure <extensionInstanceId>")
58
57
  instanceId,
59
58
  projectDir: config.projectDir,
60
59
  });
61
- const params = ((_a = spec.params) !== null && _a !== void 0 ? _a : []).concat((_b = spec.systemParams) !== null && _b !== void 0 ? _b : []);
62
- const [immutableParams, tbdParams] = (0, functional_1.partition)(params, (param) => { var _a; return (_a = (param.immutable && !!oldParamValues[param.param])) !== null && _a !== void 0 ? _a : false; });
60
+ const params = (spec.params ?? []).concat(spec.systemParams ?? []);
61
+ const [immutableParams, tbdParams] = (0, functional_1.partition)(params, (param) => (param.immutable && !!oldParamValues[param.param]) ?? false);
63
62
  infoImmutableParams(immutableParams, oldParamValues);
64
63
  paramHelper.setNewDefaults(tbdParams, oldParamValues);
65
64
  const mutableParamsBindingOptions = await paramHelper.getParams({
@@ -78,7 +77,10 @@ exports.command = new command_1.Command("ext:configure <extensionInstanceId>")
78
77
  baseValue: eventsConfig.allowedEventTypes.join(","),
79
78
  };
80
79
  }
81
- const newParamOptions = Object.assign(Object.assign({}, (0, paramHelper_1.buildBindingOptionsWithBaseValue)(oldParamValues)), mutableParamsBindingOptions);
80
+ const newParamOptions = {
81
+ ...(0, paramHelper_1.buildBindingOptionsWithBaseValue)(oldParamValues),
82
+ ...mutableParamsBindingOptions,
83
+ };
82
84
  await manifest.writeToManifest([
83
85
  {
84
86
  instanceId,
@@ -33,12 +33,11 @@ exports.command = new command_1.Command("ext:dev:list <publisherId>")
33
33
  });
34
34
  const sorted = extensions.sort((a, b) => a.ref.localeCompare(b.ref));
35
35
  sorted.forEach((extension) => {
36
- var _a, _b;
37
36
  table.push([
38
37
  (0, utils_1.last)(extension.ref.split("/")),
39
38
  (0, extensionsHelper_1.unpackExtensionState)(extension),
40
- (_a = extension.latestVersion) !== null && _a !== void 0 ? _a : "-",
41
- (_b = extension.latestApprovedVersion) !== null && _b !== void 0 ? _b : "-",
39
+ extension.latestVersion ?? "-",
40
+ extension.latestApprovedVersion ?? "-",
42
41
  ]);
43
42
  });
44
43
  (0, utils_1.logLabeledBullet)(extensionsHelper_1.logPrefix, `list of uploaded extensions for publisher ${clc.bold(publisherId)}:`);
@@ -46,7 +46,7 @@ exports.command = new command_1.Command("ext:export")
46
46
  return;
47
47
  }
48
48
  const manifestSpecs = withRefSubbed.map((spec) => {
49
- const paramCopy = Object.assign({}, spec.params);
49
+ const paramCopy = { ...spec.params };
50
50
  if (spec.eventarcChannel) {
51
51
  paramCopy.EVENTARC_CHANNEL = spec.eventarcChannel;
52
52
  }
@@ -18,7 +18,6 @@ exports.command = new command_1.Command("ext:info <extensionName>")
18
18
  .option("--markdown", "output info in Markdown suitable for constructing a README file")
19
19
  .before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
20
20
  .action(async (extensionName, options) => {
21
- var _a, _b;
22
21
  let spec;
23
22
  if ((0, localHelper_1.isLocalExtension)(extensionName)) {
24
23
  if (!options.markdown) {
@@ -53,8 +52,8 @@ exports.command = new command_1.Command("ext:info <extensionName>")
53
52
  else {
54
53
  lines.push(`**Name**: ${spec.displayName}`);
55
54
  }
56
- const authorName = (_a = spec.author) === null || _a === void 0 ? void 0 : _a.authorName;
57
- const url = (_b = spec.author) === null || _b === void 0 ? void 0 : _b.url;
55
+ const authorName = spec.author?.authorName;
56
+ const url = spec.author?.url;
58
57
  const urlMarkdown = url ? `(**[${url}](${url})**)` : "";
59
58
  lines.push(`**Author**: ${authorName} ${urlMarkdown}`);
60
59
  if (spec.description) {
@@ -38,7 +38,6 @@ exports.command = new command_1.Command("ext:install [extensionRef]")
38
38
  .before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
39
39
  .before(extensionsHelper_1.diagnoseAndFixProject)
40
40
  .action(async (extensionRef, options) => {
41
- var _a, _b;
42
41
  if (options.local) {
43
42
  utils.logLabeledWarning(extensionsHelper_1.logPrefix, "As of firebase-tools@11.0.0, the `--local` flag is no longer required, as it is the default behavior.");
44
43
  }
@@ -87,7 +86,7 @@ exports.command = new command_1.Command("ext:install [extensionRef]")
87
86
  }))) {
88
87
  return;
89
88
  }
90
- const spec = (_a = source === null || source === void 0 ? void 0 : source.spec) !== null && _a !== void 0 ? _a : extensionVersion === null || extensionVersion === void 0 ? void 0 : extensionVersion.spec;
89
+ const spec = source?.spec ?? extensionVersion?.spec;
91
90
  if (!spec) {
92
91
  throw new error_1.FirebaseError(`Could not find the extension.yaml for extension '${clc.bold(extensionRef)}'. Please make sure this is a valid extension and try again.`);
93
92
  }
@@ -99,7 +98,7 @@ exports.command = new command_1.Command("ext:install [extensionRef]")
99
98
  }
100
99
  else if (extensionVersion) {
101
100
  void (0, track_1.trackGA4)("extension_added_to_manifest", {
102
- published: ((_b = extensionVersion.listing) === null || _b === void 0 ? void 0 : _b.state) === "APPROVED" ? "published" : "uploaded",
101
+ published: extensionVersion.listing?.state === "APPROVED" ? "published" : "uploaded",
103
102
  interactive: options.nonInteractive ? "false" : "true",
104
103
  });
105
104
  }
@@ -123,10 +122,9 @@ exports.command = new command_1.Command("ext:install [extensionRef]")
123
122
  }
124
123
  });
125
124
  async function installToManifest(options) {
126
- var _a, _b, _c;
127
125
  const { projectId, extensionRef, extVersion, source, nonInteractive, force } = options;
128
126
  const isLocalSource = (0, extensionsHelper_1.isLocalPath)(extensionRef);
129
- const spec = (_a = extVersion === null || extVersion === void 0 ? void 0 : extVersion.spec) !== null && _a !== void 0 ? _a : source === null || source === void 0 ? void 0 : source.spec;
127
+ const spec = extVersion?.spec ?? source?.spec;
130
128
  if (!spec) {
131
129
  throw new error_1.FirebaseError(`Could not find the extension.yaml for ${extensionRef}. Please make sure this is a valid extension and try again.`);
132
130
  }
@@ -140,7 +138,7 @@ async function installToManifest(options) {
140
138
  }
141
139
  const paramBindingOptions = await paramHelper.getParams({
142
140
  projectId,
143
- paramSpecs: ((_b = spec.params) !== null && _b !== void 0 ? _b : []).concat((_c = spec.systemParams) !== null && _c !== void 0 ? _c : []),
141
+ paramSpecs: (spec.params ?? []).concat(spec.systemParams ?? []),
144
142
  nonInteractive,
145
143
  instanceId,
146
144
  });
@@ -162,6 +160,6 @@ async function installToManifest(options) {
162
160
  params: paramBindingOptions,
163
161
  extensionSpec: spec,
164
162
  },
165
- ], config, { nonInteractive, force: force !== null && force !== void 0 ? force : false });
163
+ ], config, { nonInteractive, force: force ?? false });
166
164
  (0, tos_1.displayDeveloperTOSWarning)();
167
165
  }
@@ -16,9 +16,8 @@ exports.command = new command_1.Command("firestore:indexes")
16
16
  .before(requirePermissions_1.requirePermissions, ["datastore.indexes.list"])
17
17
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
18
18
  .action(async (options) => {
19
- var _a;
20
19
  const indexApi = new fsi.FirestoreApi();
21
- const databaseId = (_a = options.database) !== null && _a !== void 0 ? _a : "(default)";
20
+ const databaseId = options.database ?? "(default)";
22
21
  const indexes = await indexApi.listIndexes(options.project, databaseId);
23
22
  const fieldOverrides = await indexApi.listFieldOverrides(options.project, databaseId);
24
23
  const indexSpec = indexApi.makeIndexSpec(indexes, fieldOverrides);
@@ -76,11 +76,10 @@ exports.command = new command_1.Command("backends:delete")
76
76
  return backend;
77
77
  });
78
78
  function populateTable(backend, table) {
79
- var _a;
80
79
  const [location, , backendId] = backend.name.split("/").slice(3, 6);
81
80
  const entry = [
82
81
  backendId,
83
- (_a = backend.codebase.repository) === null || _a === void 0 ? void 0 : _a.split("/").pop(),
82
+ backend.codebase.repository?.split("/").pop(),
84
83
  location,
85
84
  backend.uri,
86
85
  backend.createTime,
@@ -58,11 +58,10 @@ exports.command = new command_1.Command("backends:get")
58
58
  return backendsList;
59
59
  });
60
60
  function populateTable(backend, table) {
61
- var _a;
62
61
  const [location, , backendId] = backend.name.split("/").slice(3, 6);
63
62
  const entry = [
64
63
  backendId,
65
- (_a = backend.codebase.repository) === null || _a === void 0 ? void 0 : _a.split("/").pop(),
64
+ backend.codebase.repository?.split("/").pop(),
66
65
  location,
67
66
  backend.uri,
68
67
  backend.createTime,
@@ -44,12 +44,11 @@ exports.command = new command_1.Command("backends:list")
44
44
  return backendsList;
45
45
  });
46
46
  function populateTable(backendsLists, location, table) {
47
- var _a;
48
47
  for (const backend of backendsLists.backends) {
49
48
  const [location, , backendId] = backend.name.split("/").slice(3, 6);
50
49
  const entry = [
51
50
  backendId,
52
- (_a = backend.codebase.repository) === null || _a === void 0 ? void 0 : _a.split("/").pop(),
51
+ backend.codebase.repository?.split("/").pop(),
53
52
  location,
54
53
  backend.uri,
55
54
  backend.createTime,
@@ -19,7 +19,6 @@ For example, to copy the content for a site \`my-site\` from a preview channel \
19
19
  firebase hosting:clone my-site:foo my-site:live`)
20
20
  .before(requireAuth_1.requireAuth)
21
21
  .action(async (source = "", targetChannel = "") => {
22
- var _a, _b, _c, _d;
23
22
  let sourceVersionName;
24
23
  let sourceVersion;
25
24
  let [sourceSiteId, sourceChannelId] = source.split(":");
@@ -48,7 +47,7 @@ For example, to copy the content for a site \`my-site\` from a preview channel \
48
47
  if (!sChannel) {
49
48
  throw new error_1.FirebaseError(`Could not find the channel ${(0, colorette_1.bold)(sourceChannelId)} for site ${(0, colorette_1.bold)(sourceSiteId)}.`);
50
49
  }
51
- sourceVersionName = (_b = (_a = sChannel.release) === null || _a === void 0 ? void 0 : _a.version) === null || _b === void 0 ? void 0 : _b.name;
50
+ sourceVersionName = sChannel.release?.version?.name;
52
51
  if (!sourceVersionName) {
53
52
  throw new error_1.FirebaseError(`Could not find a version on the channel ${(0, colorette_1.bold)(sourceChannelId)} for site ${(0, colorette_1.bold)(sourceSiteId)}.`);
54
53
  }
@@ -72,7 +71,7 @@ For example, to copy the content for a site \`my-site\` from a preview channel \
72
71
  logger_1.logger.debug("[hosting] unable to add auth domain", e);
73
72
  }
74
73
  }
75
- const currentTargetVersionName = (_d = (_c = tChannel.release) === null || _c === void 0 ? void 0 : _c.version) === null || _d === void 0 ? void 0 : _d.name;
74
+ const currentTargetVersionName = tChannel.release?.version?.name;
76
75
  if (equalSiteIds && sourceVersionName === currentTargetVersionName) {
77
76
  utils.logSuccess(`Channels ${(0, colorette_1.bold)(sourceChannelId)} and ${(0, colorette_1.bold)(targetChannel)} are serving identical versions. No need to clone.`);
78
77
  return;
@@ -161,8 +161,7 @@ function initAction(feature, options) {
161
161
  ]);
162
162
  })
163
163
  .then(() => {
164
- var _a;
165
- if (!setup.features || ((_a = setup.features) === null || _a === void 0 ? void 0 : _a.length) === 0) {
164
+ if (!setup.features || setup.features?.length === 0) {
166
165
  return utils.reject("Must select at least one feature. Use " +
167
166
  clc.bold(clc.underline("SPACEBAR")) +
168
167
  " to select features, or specify a feature by running " +
@@ -25,7 +25,7 @@ async function logoutAction(email, options) {
25
25
  utils.logWarning(`No account matches ${email}, can't log out.`);
26
26
  return;
27
27
  }
28
- const logoutDefault = email === (defaultAccount === null || defaultAccount === void 0 ? void 0 : defaultAccount.user.email);
28
+ const logoutDefault = email === defaultAccount?.user.email;
29
29
  let newDefaultAccount = undefined;
30
30
  if (logoutDefault && additionalAccounts.length > 0) {
31
31
  if (additionalAccounts.length === 1) {
@@ -57,7 +57,7 @@ exports.command = new command_1.Command("remoteconfig:get")
57
57
  utils.assertIsString(options.output);
58
58
  filename = options.output;
59
59
  }
60
- const outTemplate = Object.assign({}, template);
60
+ const outTemplate = { ...template };
61
61
  delete outTemplate.version;
62
62
  fs.writeFileSync(filename, JSON.stringify(outTemplate, null, 2));
63
63
  }
@@ -16,14 +16,13 @@ exports.command = new command_1.Command("remoteconfig:rollback")
16
16
  .option("-v, --version-number <versionNumber>", "rollback to the specified version of the template")
17
17
  .withForce()
18
18
  .action(async (options) => {
19
- var _a;
20
19
  const templateVersion = await (0, versionslist_1.getVersions)((0, projectUtils_1.needProjectId)(options), 1);
21
20
  let targetVersion = 0;
22
21
  if (options.versionNumber) {
23
22
  targetVersion = options.versionNumber;
24
23
  }
25
24
  else {
26
- if ((_a = templateVersion === null || templateVersion === void 0 ? void 0 : templateVersion.versions[0]) === null || _a === void 0 ? void 0 : _a.versionNumber) {
25
+ if (templateVersion?.versions[0]?.versionNumber) {
27
26
  const latestVersion = templateVersion.versions[0].versionNumber.toString();
28
27
  const previousVersion = parseInt(latestVersion) - 1;
29
28
  targetVersion = previousVersion;
@@ -11,9 +11,8 @@ const utils_1 = require("../utils");
11
11
  const Table = require("cli-table");
12
12
  const tableHead = ["Update User", "Version Number", "Update Time"];
13
13
  function pushTableContents(table, version) {
14
- var _a;
15
14
  return table.push([
16
- (_a = version.updateUser) === null || _a === void 0 ? void 0 : _a.email,
15
+ version.updateUser?.email,
17
16
  version.versionNumber,
18
17
  version.updateTime ? (0, utils_1.datetimeString)(new Date(version.updateTime)) : "",
19
18
  ]);
package/lib/config.js CHANGED
@@ -18,7 +18,6 @@ const loadCJSON_1 = require("./loadCJSON");
18
18
  const parseBoltRules = require("./parseBoltRules");
19
19
  class Config {
20
20
  constructor(src, options = {}) {
21
- var _a;
22
21
  this.data = {};
23
22
  this.defaults = {};
24
23
  this.notes = {};
@@ -32,8 +31,8 @@ class Config {
32
31
  clc.bold("firebase use --add") +
33
32
  " instead");
34
33
  }
35
- if ((_a = this._src) === null || _a === void 0 ? void 0 : _a.rules) {
36
- this._src.database = Object.assign(Object.assign({}, this._src.database), { rules: this._src.rules });
34
+ if (this._src?.rules) {
35
+ this._src.database = { ...this._src.database, rules: this._src.rules };
37
36
  }
38
37
  Config.MATERIALIZE_TARGETS.forEach((target) => {
39
38
  if (_.get(this._src, target)) {
@@ -36,14 +36,13 @@ async function fetchBuildtoolsJar() {
36
36
  }
37
37
  exports.fetchBuildtoolsJar = fetchBuildtoolsJar;
38
38
  function runBuildtoolsCommand(jarFile, args, debug) {
39
- var _a;
40
39
  const fullArgs = ["-jar", jarFile, ...args, "-clientName", "firebase-cli;crashlytics-buildtools"];
41
40
  const outputs = spawn.sync("java", fullArgs, {
42
41
  stdio: debug ? "inherit" : "pipe",
43
42
  });
44
43
  if (outputs.status !== 0) {
45
44
  if (!debug) {
46
- utils.logWarning(((_a = outputs.stdout) === null || _a === void 0 ? void 0 : _a.toString()) || "An unknown error occurred");
45
+ utils.logWarning(outputs.stdout?.toString() || "An unknown error occurred");
47
46
  }
48
47
  throw new error_1.FirebaseError(`java command failed with args: ${fullArgs}`);
49
48
  }
@@ -11,7 +11,7 @@ const error_1 = require("../error");
11
11
  const pLimit = require("p-limit");
12
12
  class BatchChunks extends stream.Transform {
13
13
  constructor(maxSize, opts) {
14
- super(Object.assign(Object.assign({}, opts), { objectMode: true }));
14
+ super({ ...opts, objectMode: true });
15
15
  this.maxSize = maxSize;
16
16
  this.batch = [];
17
17
  this.size = 0;
@@ -51,7 +51,7 @@ class BatchChunks extends stream.Transform {
51
51
  return { json: { [lastToken]: json }, pathname: tokens.join("/"), size };
52
52
  }
53
53
  if (Array.isArray(json)) {
54
- return { json: Object.assign({}, json), pathname, size };
54
+ return { json: { ...json }, pathname, size };
55
55
  }
56
56
  return { json, pathname, size };
57
57
  }
@@ -119,7 +119,7 @@ class DatabaseImporter {
119
119
  readChunks._transform = function (chunk, _, done) {
120
120
  const data = { json: chunk.value, pathname: getJoinedPath(dbUrl.pathname, chunk.key) };
121
121
  const chunkedData = chunkData(data);
122
- const chunks = chunkedData.chunks || [Object.assign(Object.assign({}, data), { size: JSON.stringify(data.json).length })];
122
+ const chunks = chunkedData.chunks || [{ ...data, size: JSON.stringify(data.json).length }];
123
123
  for (const chunk of chunks) {
124
124
  this.push(chunk);
125
125
  }
@@ -197,7 +197,7 @@ class DatabaseImporter {
197
197
  chunks.push(...childChunks.chunks);
198
198
  }
199
199
  else {
200
- chunks.push(Object.assign(Object.assign({}, child), { size: childChunks.size }));
200
+ chunks.push({ ...child, size: childChunks.size });
201
201
  }
202
202
  }
203
203
  if (hasChunkedChild || size >= this.payloadSize) {
@@ -10,13 +10,12 @@ const provisioningHelper_1 = require("../../extensions/provisioningHelper");
10
10
  const secrets_1 = require("./secrets");
11
11
  const validate_1 = require("./validate");
12
12
  async function deploy(context, options, payload) {
13
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
14
13
  const projectId = (0, projectUtils_1.needProjectId)(options);
15
14
  await (0, validate_1.checkBilling)(projectId, options.nonInteractive);
16
15
  await (0, provisioningHelper_1.bulkCheckProductsProvisioned)(projectId, [
17
- ...((_a = payload.instancesToCreate) !== null && _a !== void 0 ? _a : []),
18
- ...((_b = payload.instancesToUpdate) !== null && _b !== void 0 ? _b : []),
19
- ...((_c = payload.instancesToConfigure) !== null && _c !== void 0 ? _c : []),
16
+ ...(payload.instancesToCreate ?? []),
17
+ ...(payload.instancesToUpdate ?? []),
18
+ ...(payload.instancesToConfigure ?? []),
20
19
  ]);
21
20
  await (0, secrets_1.handleSecretParams)(payload, context.have, options.nonInteractive);
22
21
  const errorHandler = new errors_1.ErrorHandler();
@@ -25,15 +24,15 @@ async function deploy(context, options, payload) {
25
24
  concurrency: 5,
26
25
  handler: tasks.extensionsDeploymentHandler(errorHandler),
27
26
  });
28
- for (const create of (_e = (_d = payload.instancesToCreate) === null || _d === void 0 ? void 0 : _d.filter((i) => !!i.ref)) !== null && _e !== void 0 ? _e : []) {
27
+ for (const create of payload.instancesToCreate?.filter((i) => !!i.ref) ?? []) {
29
28
  const task = tasks.createExtensionInstanceTask(projectId, create, true);
30
29
  void validationQueue.run(task);
31
30
  }
32
- for (const update of (_g = (_f = payload.instancesToUpdate) === null || _f === void 0 ? void 0 : _f.filter((i) => !!i.ref)) !== null && _g !== void 0 ? _g : []) {
31
+ for (const update of payload.instancesToUpdate?.filter((i) => !!i.ref) ?? []) {
33
32
  const task = tasks.updateExtensionInstanceTask(projectId, update, true);
34
33
  void validationQueue.run(task);
35
34
  }
36
- for (const configure of (_j = (_h = payload.instancesToConfigure) === null || _h === void 0 ? void 0 : _h.filter((i) => !!i.ref)) !== null && _j !== void 0 ? _j : []) {
35
+ for (const configure of payload.instancesToConfigure?.filter((i) => !!i.ref) ?? []) {
37
36
  const task = tasks.configureExtensionInstanceTask(projectId, configure, true);
38
37
  void validationQueue.run(task);
39
38
  }