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
@@ -88,7 +88,7 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
88
88
  res.json(specWithEmulatorServer(req.protocol, req.headers.host));
89
89
  });
90
90
  registerLegacyRoutes(app);
91
- handlers_1.registerHandlers(app, (apiKey, tenantId) => getProjectStateById(getProjectIdByApiKey(apiKey), tenantId));
91
+ (0, handlers_1.registerHandlers)(app, (apiKey, tenantId) => getProjectStateById(getProjectIdByApiKey(apiKey), tenantId));
92
92
  const apiKeyAuthenticator = (ctx, info) => {
93
93
  if (info.in !== "query") {
94
94
  throw new Error('apiKey must be defined as in: "query" in API spec.');
@@ -164,7 +164,7 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
164
164
  defaultMaxBodySize: 1024 * 1024 * 1024,
165
165
  validateDefaultResponses: true,
166
166
  onResponseValidationError({ errors }) {
167
- utils_1.logError(new Error(`An internal error occured when generating response. Details:\n${JSON.stringify(errors)}`));
167
+ (0, utils_1.logError)(new Error(`An internal error occured when generating response. Details:\n${JSON.stringify(errors)}`));
168
168
  throw new errors_2.InternalError("An internal error occured when generating response.", "emulator-response-validation");
169
169
  },
170
170
  customFormats: {
@@ -183,6 +183,9 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
183
183
  uint32() {
184
184
  return true;
185
185
  },
186
+ byte() {
187
+ return true;
188
+ },
186
189
  },
187
190
  plugins: [
188
191
  {
@@ -233,7 +236,7 @@ async function createApp(defaultProjectId, projectStateForId = new Map()) {
233
236
  return res.status(err.status).json(err);
234
237
  }
235
238
  if (apiError.code === 500) {
236
- utils_1.logError(err);
239
+ (0, utils_1.logError)(err);
237
240
  }
238
241
  return res.status(apiError.code).json({ error: apiError });
239
242
  }));
@@ -343,7 +346,7 @@ function toExegesisController(ops, getProjectStateById) {
343
346
  let targetProjectId = ctx.params.path.targetProjectId || ((_a = ctx.requestBody) === null || _a === void 0 ? void 0 : _a.targetProjectId);
344
347
  if (targetProjectId) {
345
348
  if ((_b = ctx.api.operationObject.security) === null || _b === void 0 ? void 0 : _b.some((sec) => sec.Oauth2)) {
346
- errors_2.assert((_c = ctx.security) === null || _c === void 0 ? void 0 : _c.Oauth2, "INSUFFICIENT_PERMISSION : Only authenticated requests can specify target_project_id.");
349
+ (0, errors_2.assert)((_c = ctx.security) === null || _c === void 0 ? void 0 : _c.Oauth2, "INSUFFICIENT_PERMISSION : Only authenticated requests can specify target_project_id.");
347
350
  }
348
351
  }
349
352
  else {
@@ -351,14 +354,14 @@ function toExegesisController(ops, getProjectStateById) {
351
354
  }
352
355
  let targetTenantId = undefined;
353
356
  if (ctx.params.path.tenantId && ((_d = ctx.requestBody) === null || _d === void 0 ? void 0 : _d.tenantId)) {
354
- errors_2.assert(ctx.params.path.tenantId === ctx.requestBody.tenantId, "TENANT_ID_MISMATCH");
357
+ (0, errors_2.assert)(ctx.params.path.tenantId === ctx.requestBody.tenantId, "TENANT_ID_MISMATCH");
355
358
  }
356
359
  targetTenantId = ctx.params.path.tenantId || ((_e = ctx.requestBody) === null || _e === void 0 ? void 0 : _e.tenantId);
357
360
  if ((_f = ctx.requestBody) === null || _f === void 0 ? void 0 : _f.idToken) {
358
361
  const idToken = (_g = ctx.requestBody) === null || _g === void 0 ? void 0 : _g.idToken;
359
- const decoded = jsonwebtoken_1.decode(idToken, { complete: true });
362
+ const decoded = (0, jsonwebtoken_1.decode)(idToken, { complete: true });
360
363
  if ((decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant) && targetTenantId) {
361
- errors_2.assert((decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant) === targetTenantId, "TENANT_ID_MISMATCH");
364
+ (0, errors_2.assert)((decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant) === targetTenantId, "TENANT_ID_MISMATCH");
362
365
  }
363
366
  targetTenantId = targetTenantId || (decoded === null || decoded === void 0 ? void 0 : decoded.payload.firebase.tenant);
364
367
  }
@@ -421,7 +424,7 @@ function convertKeysToCamelCase(body) {
421
424
  }
422
425
  const result = Object.create(null);
423
426
  for (const key of Object.keys(body)) {
424
- result[lodash_1.camelCase(key)] = convertKeysToCamelCase(body[key]);
427
+ result[(0, lodash_1.camelCase)(key)] = convertKeysToCamelCase(body[key]);
425
428
  }
426
429
  return result;
427
430
  }
@@ -30,7 +30,7 @@ class ProjectState {
30
30
  }
31
31
  createUser(props) {
32
32
  for (let i = 0; i < 10; i++) {
33
- const localId = utils_1.randomId(28);
33
+ const localId = (0, utils_1.randomId)(28);
34
34
  const user = this.createUserWithLocalId(localId, props);
35
35
  if (user) {
36
36
  return user;
@@ -93,7 +93,7 @@ class ProjectState {
93
93
  const oldEmail = user.email;
94
94
  const oldPhoneNumber = user.phoneNumber;
95
95
  for (const field of Object.keys(fields)) {
96
- utils_1.mirrorFieldTo(user, field, fields);
96
+ (0, utils_1.mirrorFieldTo)(user, field, fields);
97
97
  }
98
98
  if (oldEmail && oldEmail !== user.email) {
99
99
  this.localIdForEmail.delete(oldEmail);
@@ -140,10 +140,10 @@ class ProjectState {
140
140
  const phoneNumbers = new Set();
141
141
  const enrollmentIds = new Set();
142
142
  for (const enrollment of enrollments) {
143
- errors_1.assert(enrollment.phoneInfo && utils_1.isValidPhoneNumber(enrollment.phoneInfo), "INVALID_MFA_PHONE_NUMBER : Invalid format.");
144
- errors_1.assert(enrollment.mfaEnrollmentId, "INVALID_MFA_ENROLLMENT_ID : mfaEnrollmentId must be defined.");
145
- errors_1.assert(!enrollmentIds.has(enrollment.mfaEnrollmentId), "DUPLICATE_MFA_ENROLLMENT_ID");
146
- errors_1.assert(!phoneNumbers.has(enrollment.phoneInfo), "INTERNAL_ERROR : MFA Enrollment Phone Numbers must be unique.");
143
+ (0, errors_1.assert)(enrollment.phoneInfo && (0, utils_1.isValidPhoneNumber)(enrollment.phoneInfo), "INVALID_MFA_PHONE_NUMBER : Invalid format.");
144
+ (0, errors_1.assert)(enrollment.mfaEnrollmentId, "INVALID_MFA_ENROLLMENT_ID : mfaEnrollmentId must be defined.");
145
+ (0, errors_1.assert)(!enrollmentIds.has(enrollment.mfaEnrollmentId), "DUPLICATE_MFA_ENROLLMENT_ID");
146
+ (0, errors_1.assert)(!phoneNumbers.has(enrollment.phoneInfo), "INTERNAL_ERROR : MFA Enrollment Phone Numbers must be unique.");
147
147
  phoneNumbers.add(enrollment.phoneInfo);
148
148
  enrollmentIds.add(enrollment.mfaEnrollmentId);
149
149
  }
@@ -282,7 +282,7 @@ class ProjectState {
282
282
  }
283
283
  createRefreshTokenFor(userInfo, provider, { extraClaims = {}, secondFactor, } = {}) {
284
284
  const localId = userInfo.localId;
285
- const refreshToken = utils_1.randomBase64UrlStr(204);
285
+ const refreshToken = (0, utils_1.randomBase64UrlStr)(204);
286
286
  this.refreshTokens.set(refreshToken, {
287
287
  localId,
288
288
  provider,
@@ -311,7 +311,7 @@ class ProjectState {
311
311
  };
312
312
  }
313
313
  createOob(email, requestType, generateLink) {
314
- const oobCode = utils_1.randomBase64UrlStr(54);
314
+ const oobCode = (0, utils_1.randomBase64UrlStr)(54);
315
315
  const oobLink = generateLink(oobCode);
316
316
  const oob = {
317
317
  email,
@@ -332,9 +332,9 @@ class ProjectState {
332
332
  return this.oobs.values();
333
333
  }
334
334
  createVerificationCode(phoneNumber) {
335
- const sessionInfo = utils_1.randomBase64UrlStr(226);
335
+ const sessionInfo = (0, utils_1.randomBase64UrlStr)(226);
336
336
  const verification = {
337
- code: utils_1.randomDigits(6),
337
+ code: (0, utils_1.randomDigits)(6),
338
338
  phoneNumber,
339
339
  sessionInfo,
340
340
  };
@@ -386,7 +386,7 @@ class ProjectState {
386
386
  createTemporaryProof(phoneNumber) {
387
387
  const record = {
388
388
  phoneNumber,
389
- temporaryProof: utils_1.randomBase64UrlStr(119),
389
+ temporaryProof: (0, utils_1.randomBase64UrlStr)(119),
390
390
  temporaryProofExpiresIn: "3600",
391
391
  };
392
392
  this.temporaryProofs.set(record.temporaryProof, record);
@@ -493,7 +493,7 @@ class AgentProjectState extends ProjectState {
493
493
  }
494
494
  createTenant(tenant) {
495
495
  for (let i = 0; i < 10; i++) {
496
- const tenantId = utils_1.randomId(28);
496
+ const tenantId = (0, utils_1.randomId)(28);
497
497
  const createdTenant = this.createTenantWithTenantId(tenantId, tenant);
498
498
  if (createdTenant) {
499
499
  return createdTenant;
@@ -71,7 +71,7 @@ function warnEmulatorNotSupported(options, emulator) {
71
71
  const opts = {
72
72
  confirm: undefined,
73
73
  };
74
- return prompt_1.promptOnce({
74
+ return (0, prompt_1.promptOnce)({
75
75
  type: "confirm",
76
76
  default: false,
77
77
  message: "Do you want to continue?",
@@ -90,7 +90,7 @@ async function beforeEmulatorCommand(options) {
90
90
  !controller.shouldStart(optionsWithConfig, types_1.Emulators.FUNCTIONS) &&
91
91
  !controller.shouldStart(optionsWithConfig, types_1.Emulators.HOSTING);
92
92
  try {
93
- await requireAuth_1.requireAuth(options);
93
+ await (0, requireAuth_1.requireAuth)(options);
94
94
  }
95
95
  catch (e) {
96
96
  logger_1.logger.debug(e);
@@ -154,7 +154,7 @@ function processKillSignal(signal, res, rej, options) {
154
154
  if (signalCount === 1) {
155
155
  utils.logLabeledBullet("emulators", `Received ${signalDisplay} for the first time. Starting a clean shutdown.`);
156
156
  utils.logLabeledBullet("emulators", `Please wait for a clean shutdown or send the ${signalDisplay} signal again to stop right now.`);
157
- await controller_1.onExit(options);
157
+ await (0, controller_1.onExit)(options);
158
158
  await controller.cleanShutdown();
159
159
  }
160
160
  else {
@@ -277,7 +277,7 @@ async function runScript(script, extraEnv) {
277
277
  }
278
278
  async function emulatorExec(script, options) {
279
279
  shutdownWhenKilled(options);
280
- const projectId = projectUtils_1.getProjectId(options);
280
+ const projectId = (0, projectUtils_1.getProjectId)(options);
281
281
  const extraEnv = {};
282
282
  if (projectId) {
283
283
  extraEnv.GCLOUD_PROJECT = projectId;
@@ -287,7 +287,7 @@ async function emulatorExec(script, options) {
287
287
  const showUI = !!options.ui;
288
288
  await controller.startAll(options, showUI);
289
289
  exitCode = await runScript(script, extraEnv);
290
- await controller_1.onExit(options);
290
+ await (0, controller_1.onExit)(options);
291
291
  }
292
292
  finally {
293
293
  await controller.cleanShutdown();
@@ -161,7 +161,7 @@ function findExportMetadata(importPath) {
161
161
  return;
162
162
  }
163
163
  const importFilePath = path.join(importPath, hubExport_1.HubExport.METADATA_FILE_NAME);
164
- if (fsutils_1.fileExistsSync(importFilePath)) {
164
+ if ((0, fsutils_1.fileExistsSync)(importFilePath)) {
165
165
  return JSON.parse(fs.readFileSync(importFilePath, "utf8").toString());
166
166
  }
167
167
  const fileList = fs.readdirSync(importPath);
@@ -200,7 +200,7 @@ async function startAll(options, showUI = true) {
200
200
  }
201
201
  const hubLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.HUB);
202
202
  hubLogger.logLabeled("BULLET", "emulators", `Starting emulators: ${targets.join(", ")}`);
203
- const projectId = projectUtils_1.getProjectId(options) || "";
203
+ const projectId = (0, projectUtils_1.getProjectId)(options) || "";
204
204
  if (constants_1.Constants.isDemoProject(projectId)) {
205
205
  hubLogger.logLabeled("BULLET", "emulators", `Detected demo project ID "${projectId}", emulated services will use a demo configuration and attempts to access non-emulated services for this project will fail.`);
206
206
  }
@@ -211,7 +211,7 @@ async function startAll(options, showUI = true) {
211
211
  });
212
212
  const ignored = _.difference(requested, targets);
213
213
  for (const name of ignored) {
214
- if (types_1.isEmulator(name)) {
214
+ if ((0, types_1.isEmulator)(name)) {
215
215
  emulatorLogger_1.EmulatorLogger.forEmulator(name).logLabeled("WARN", name, `Not starting the ${clc.bold(name)} emulator, make sure you have run ${clc.bold("firebase init")}.`);
216
216
  }
217
217
  else {
@@ -242,7 +242,7 @@ async function startAll(options, showUI = true) {
242
242
  if (shouldStart(options, types_1.Emulators.FUNCTIONS)) {
243
243
  const functionsLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.FUNCTIONS);
244
244
  const functionsAddr = await getAndCheckAddress(types_1.Emulators.FUNCTIONS, options);
245
- const projectId = projectUtils_1.needProjectId(options);
245
+ const projectId = (0, projectUtils_1.needProjectId)(options);
246
246
  utils.assertDefined(options.config.src.functions);
247
247
  utils.assertDefined(options.config.src.functions.source, "Error: 'functions.source' is not defined");
248
248
  utils.assertIsStringOrUndefined(options.extensionDir);
@@ -258,17 +258,22 @@ async function startAll(options, showUI = true) {
258
258
  if (emulatorsNotRunning.length > 0 && !constants_1.Constants.isDemoProject(projectId)) {
259
259
  functionsLogger.logLabeled("WARN", "functions", `The following emulators are not running, calls to these services from the Functions emulator will affect production: ${clc.bold(emulatorsNotRunning.join(", "))}`);
260
260
  }
261
- const account = auth_2.getProjectDefaultAccount(options.projectRoot);
261
+ const account = (0, auth_2.getProjectDefaultAccount)(options.projectRoot);
262
+ const emulatableBackends = [
263
+ {
264
+ functionsDir,
265
+ env: Object.assign({}, options.extensionEnv),
266
+ predefinedTriggers: options.extensionTriggers,
267
+ nodeMajorVersion: (0, functionsEmulatorUtils_1.parseRuntimeVersion)(options.extensionNodeVersion || options.config.get("functions.runtime")),
268
+ },
269
+ ];
262
270
  const functionsEmulator = new functionsEmulator_1.FunctionsEmulator({
263
271
  projectId,
264
- functionsDir,
272
+ emulatableBackends,
265
273
  account,
266
274
  host: functionsAddr.host,
267
275
  port: functionsAddr.port,
268
276
  debugPort: inspectFunctions,
269
- env: Object.assign({}, options.extensionEnv),
270
- predefinedTriggers: options.extensionTriggers,
271
- nodeMajorVersion: functionsEmulatorUtils_1.parseRuntimeVersion(options.extensionNodeVersion || options.config.get("functions.runtime")),
272
277
  });
273
278
  await startEmulator(functionsEmulator);
274
279
  }
@@ -321,7 +326,7 @@ async function startAll(options, showUI = true) {
321
326
  };
322
327
  try {
323
328
  if (!options.instance) {
324
- options.instance = await getDefaultDatabaseInstance_1.getDefaultDatabaseInstance(options);
329
+ options.instance = await (0, getDefaultDatabaseInstance_1.getDefaultDatabaseInstance)(options);
325
330
  }
326
331
  }
327
332
  catch (e) {
@@ -465,7 +470,7 @@ async function exportEmulatorData(exportPath, options) {
465
470
  if (options.noninteractive) {
466
471
  throw new error_1.FirebaseError("Export already exists in the target directory, re-run with --force to overwrite.", { exit: 1 });
467
472
  }
468
- const prompt = await prompt_1.promptOnce({
473
+ const prompt = await (0, prompt_1.promptOnce)({
469
474
  type: "confirm",
470
475
  message: `The directory ${exportAbsPath} already contains export data. Exporting again to the same directory will overwrite all data. Do you want to continue?`,
471
476
  default: false,
@@ -221,6 +221,7 @@ async function handleEmulatorProcessError(emulator, err) {
221
221
  exports.handleEmulatorProcessError = handleEmulatorProcessError;
222
222
  async function _runBinary(emulator, command, extraEnv) {
223
223
  return new Promise((resolve) => {
224
+ var _a, _b;
224
225
  const logger = emulatorLogger_1.EmulatorLogger.forEmulator(emulator.name);
225
226
  emulator.stdout = fs.createWriteStream(getLogFileName(emulator.name));
226
227
  try {
@@ -242,11 +243,11 @@ async function _runBinary(emulator, command, extraEnv) {
242
243
  return;
243
244
  }
244
245
  logger.logLabeled("BULLET", emulator.name, `${description} logging to ${clc.bold(getLogFileName(emulator.name))}`);
245
- emulator.instance.stdout.on("data", (data) => {
246
+ (_a = emulator.instance.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
246
247
  logger.log("DEBUG", data.toString());
247
248
  emulator.stdout.write(data);
248
249
  });
249
- emulator.instance.stderr.on("data", (data) => {
250
+ (_b = emulator.instance.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
250
251
  logger.log("DEBUG", data.toString());
251
252
  emulator.stdout.write(data);
252
253
  if (data.toString().includes("java.lang.UnsupportedClassVersionError")) {
@@ -308,7 +309,7 @@ async function downloadIfNecessary(targetName) {
308
309
  if (hasEmulator) {
309
310
  return;
310
311
  }
311
- await download_1.downloadEmulator(targetName);
312
+ await (0, download_1.downloadEmulator)(targetName);
312
313
  }
313
314
  exports.downloadIfNecessary = downloadIfNecessary;
314
315
  async function start(targetName, args, extraEnv = {}) {
@@ -321,7 +322,7 @@ async function start(targetName, args, extraEnv = {}) {
321
322
  if (process.env.CI) {
322
323
  utils.logWarning(`It appears you are running in a CI environment. You can avoid downloading the ${constants_1.Constants.description(targetName)} repeatedly by caching the ${downloadDetails.opts.cacheDir} directory.`);
323
324
  }
324
- await download_1.downloadEmulator(targetName);
325
+ await (0, download_1.downloadEmulator)(targetName);
325
326
  }
326
327
  else {
327
328
  utils.logWarning("Setup required, please run: firebase setup:emulators:" + targetName);
@@ -90,7 +90,7 @@ class EmulatorLogger {
90
90
  this.handleSystemLog(log);
91
91
  break;
92
92
  case "USER":
93
- this.log("USER", `${clc.blackBright("> ")} ${log.text}`, Object.assign({ user: utils_1.tryParse(log.text) }, this.data));
93
+ this.log("USER", `${clc.blackBright("> ")} ${log.text}`, Object.assign({ user: (0, utils_1.tryParse)(log.text) }, this.data));
94
94
  break;
95
95
  case "DEBUG":
96
96
  if (log.data && Object.keys(log.data).length > 0) {