firebase-tools 15.1.0 → 15.2.0

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 (523) hide show
  1. package/lib/accountExporter.js +3 -5
  2. package/lib/accountImporter.js +4 -5
  3. package/lib/api.js +3 -3
  4. package/lib/apiv2.js +9 -13
  5. package/lib/appUtils.js +19 -21
  6. package/lib/appdistribution/client.js +4 -8
  7. package/lib/appdistribution/distribution.js +4 -4
  8. package/lib/appdistribution/options-parser-util.js +8 -9
  9. package/lib/appdistribution/types.js +2 -2
  10. package/lib/appdistribution/yaml_helper.js +33 -17
  11. package/lib/apphosting/app.js +8 -13
  12. package/lib/apphosting/backend.js +34 -24
  13. package/lib/apphosting/config.js +14 -14
  14. package/lib/apphosting/githubConnections.js +38 -35
  15. package/lib/apphosting/localbuilds.js +4 -6
  16. package/lib/apphosting/repo.js +24 -20
  17. package/lib/apphosting/rollout.js +12 -5
  18. package/lib/apphosting/secrets/dialogs.js +9 -9
  19. package/lib/apphosting/secrets/index.js +9 -11
  20. package/lib/apphosting/utils.js +2 -3
  21. package/lib/apphosting/yaml.js +12 -11
  22. package/lib/apptesting/ensureProjectConfigured.js +1 -2
  23. package/lib/apptesting/invokeTests.js +2 -3
  24. package/lib/apptesting/parseTestFiles.js +5 -6
  25. package/lib/apptesting/types.js +2 -2
  26. package/lib/archiveDirectory.js +1 -2
  27. package/lib/auth.js +36 -40
  28. package/lib/bin/cli.js +2 -3
  29. package/lib/bin/mcp.js +1 -2
  30. package/lib/checkMinRequiredVersion.js +1 -2
  31. package/lib/checkValidTargetFilters.js +1 -2
  32. package/lib/command.js +6 -9
  33. package/lib/commands/appdistribution-testers-list.js +2 -3
  34. package/lib/commands/apphosting-backends-list.js +4 -6
  35. package/lib/commands/apphosting-builds-create.js +2 -3
  36. package/lib/commands/apphosting-builds-get.js +1 -2
  37. package/lib/commands/apphosting-rollouts-list.js +1 -2
  38. package/lib/commands/apps-init.js +1 -1
  39. package/lib/commands/{apptesting-execute.js → apptesting-wata.js} +3 -4
  40. package/lib/commands/crashlytics-symbols-upload.js +2 -2
  41. package/lib/commands/dataconnect-execute.js +4 -4
  42. package/lib/commands/dataconnect-sdk-generate.js +5 -6
  43. package/lib/commands/dataconnect-services-list.js +7 -8
  44. package/lib/commands/dataconnect-sql-diff.js +1 -2
  45. package/lib/commands/dataconnect-sql-migrate.js +4 -3
  46. package/lib/commands/dataconnect-sql-setup.js +2 -2
  47. package/lib/commands/dataconnect-sql-shell.js +5 -1
  48. package/lib/commands/emulators-start.js +1 -2
  49. package/lib/commands/ext-configure.js +6 -4
  50. package/lib/commands/ext-dev-list.js +2 -3
  51. package/lib/commands/ext-dev-upload.js +2 -2
  52. package/lib/commands/ext-export.js +1 -1
  53. package/lib/commands/ext-info.js +2 -3
  54. package/lib/commands/ext-install.js +5 -7
  55. package/lib/commands/firestore-backups-list.js +1 -2
  56. package/lib/commands/firestore-backups-schedules-list.js +1 -2
  57. package/lib/commands/firestore-indexes-list.js +1 -2
  58. package/lib/commands/firestore-utils.js +1 -2
  59. package/lib/commands/functions-artifacts-setpolicy.js +1 -2
  60. package/lib/commands/functions-config-export.js +2 -3
  61. package/lib/commands/hosting-channel-deploy.js +2 -2
  62. package/lib/commands/hosting-clone.js +2 -3
  63. package/lib/commands/hosting-sites-create.js +1 -1
  64. package/lib/commands/index.js +2 -3
  65. package/lib/commands/init.js +4 -5
  66. package/lib/commands/internaltesting-functions-discover.js +1 -1
  67. package/lib/commands/login.js +4 -5
  68. package/lib/commands/logout.js +3 -3
  69. package/lib/commands/projects-create.js +1 -1
  70. package/lib/commands/remoteconfig-experiments-list.js +2 -3
  71. package/lib/commands/remoteconfig-get.js +1 -1
  72. package/lib/commands/remoteconfig-rollback.js +1 -2
  73. package/lib/commands/remoteconfig-rollouts-list.js +2 -3
  74. package/lib/commands/remoteconfig-versions-list.js +3 -4
  75. package/lib/commands/use.js +3 -3
  76. package/lib/config.js +4 -5
  77. package/lib/crashlytics/buildToolsJarHelper.js +3 -5
  78. package/lib/crashlytics/events.js +4 -7
  79. package/lib/crashlytics/filters.js +10 -12
  80. package/lib/crashlytics/issues.js +2 -3
  81. package/lib/crashlytics/notes.js +3 -4
  82. package/lib/crashlytics/reports.js +21 -15
  83. package/lib/crashlytics/types.js +7 -7
  84. package/lib/crashlytics/utils.js +4 -4
  85. package/lib/database/api.js +2 -3
  86. package/lib/database/import.js +4 -4
  87. package/lib/database/metadata.js +5 -6
  88. package/lib/database/rulesConfig.js +2 -3
  89. package/lib/dataconnect/build.js +10 -13
  90. package/lib/dataconnect/checkIam.js +1 -2
  91. package/lib/dataconnect/client.js +15 -18
  92. package/lib/dataconnect/dataplaneClient.js +6 -6
  93. package/lib/dataconnect/ensureApis.js +2 -3
  94. package/lib/dataconnect/errors.js +8 -11
  95. package/lib/dataconnect/filters.js +2 -3
  96. package/lib/dataconnect/freeTrial.js +3 -4
  97. package/lib/dataconnect/graphqlError.js +5 -8
  98. package/lib/dataconnect/load.js +10 -11
  99. package/lib/dataconnect/names.js +14 -18
  100. package/lib/dataconnect/prompts.js +1 -2
  101. package/lib/dataconnect/provisionCloudSql.js +13 -17
  102. package/lib/dataconnect/schemaMigration.js +60 -27
  103. package/lib/dataconnect/types.js +10 -12
  104. package/lib/dataconnect/webhook.js +3 -3
  105. package/lib/defaultCredentials.js +3 -4
  106. package/lib/deploy/apphosting/deploy.js +2 -3
  107. package/lib/deploy/apphosting/prepare.js +3 -5
  108. package/lib/deploy/apphosting/release.js +1 -1
  109. package/lib/deploy/apphosting/util.js +1 -2
  110. package/lib/deploy/database/deploy.js +1 -2
  111. package/lib/deploy/database/prepare.js +1 -2
  112. package/lib/deploy/database/release.js +1 -2
  113. package/lib/deploy/dataconnect/context.js +15 -4
  114. package/lib/deploy/dataconnect/deploy.js +5 -6
  115. package/lib/deploy/dataconnect/prepare.js +7 -9
  116. package/lib/deploy/dataconnect/release.js +7 -10
  117. package/lib/deploy/extensions/deploy.js +7 -9
  118. package/lib/deploy/extensions/deploymentSummary.js +6 -7
  119. package/lib/deploy/extensions/planner.js +15 -18
  120. package/lib/deploy/extensions/prepare.js +9 -11
  121. package/lib/deploy/extensions/release.js +10 -12
  122. package/lib/deploy/extensions/secrets.js +8 -11
  123. package/lib/deploy/extensions/tasks.js +6 -8
  124. package/lib/deploy/extensions/v2FunctionHelper.js +2 -3
  125. package/lib/deploy/extensions/validate.js +1 -2
  126. package/lib/deploy/firestore/deploy.js +3 -5
  127. package/lib/deploy/firestore/prepare.js +2 -3
  128. package/lib/deploy/firestore/release.js +3 -4
  129. package/lib/deploy/functions/backend.js +52 -42
  130. package/lib/deploy/functions/build.js +41 -15
  131. package/lib/deploy/functions/cache/applyHash.js +3 -5
  132. package/lib/deploy/functions/cache/hash.js +4 -5
  133. package/lib/deploy/functions/cel.js +3 -3
  134. package/lib/deploy/functions/checkIam.js +8 -8
  135. package/lib/deploy/functions/containerCleaner.js +10 -6
  136. package/lib/deploy/functions/deploy.js +6 -8
  137. package/lib/deploy/functions/ensure.js +6 -9
  138. package/lib/deploy/functions/functionsDeployHelper.js +10 -11
  139. package/lib/deploy/functions/params.js +10 -10
  140. package/lib/deploy/functions/prepare.js +41 -36
  141. package/lib/deploy/functions/prepareFunctionsUpload.js +24 -10
  142. package/lib/deploy/functions/pricing.js +3 -3
  143. package/lib/deploy/functions/prompts.js +7 -10
  144. package/lib/deploy/functions/release/executor.js +5 -6
  145. package/lib/deploy/functions/release/fabricator.js +76 -29
  146. package/lib/deploy/functions/release/index.js +23 -14
  147. package/lib/deploy/functions/release/planner.js +15 -14
  148. package/lib/deploy/functions/release/reporter.js +20 -20
  149. package/lib/deploy/functions/release/sourceTokenScraper.js +4 -5
  150. package/lib/deploy/functions/remoteSource.js +3 -4
  151. package/lib/deploy/functions/runtimes/discovery/index.js +9 -12
  152. package/lib/deploy/functions/runtimes/discovery/parsing.js +2 -3
  153. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +29 -10
  154. package/lib/deploy/functions/runtimes/index.js +1 -2
  155. package/lib/deploy/functions/runtimes/node/index.js +18 -9
  156. package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +2 -2
  157. package/lib/deploy/functions/runtimes/node/validate.js +1 -2
  158. package/lib/deploy/functions/runtimes/node/versioning.js +6 -7
  159. package/lib/deploy/functions/runtimes/python/index.js +12 -12
  160. package/lib/deploy/functions/runtimes/supported/index.js +5 -6
  161. package/lib/deploy/functions/services/auth.js +49 -36
  162. package/lib/deploy/functions/services/database.js +1 -2
  163. package/lib/deploy/functions/services/dataconnect.js +16 -2
  164. package/lib/deploy/functions/services/firebaseAlerts.js +1 -2
  165. package/lib/deploy/functions/services/firestore.js +3 -5
  166. package/lib/deploy/functions/services/index.js +2 -2
  167. package/lib/deploy/functions/services/remoteConfig.js +1 -2
  168. package/lib/deploy/functions/services/storage.js +3 -5
  169. package/lib/deploy/functions/services/testLab.js +1 -2
  170. package/lib/deploy/functions/triggerRegionHelper.js +1 -2
  171. package/lib/deploy/functions/validate.js +12 -11
  172. package/lib/deploy/hosting/convertConfig.js +38 -22
  173. package/lib/deploy/hosting/deploy.js +4 -7
  174. package/lib/deploy/hosting/hashcache.js +2 -3
  175. package/lib/deploy/hosting/prepare.js +14 -14
  176. package/lib/deploy/hosting/release.js +1 -2
  177. package/lib/deploy/index.js +7 -8
  178. package/lib/deploy/lifecycleHooks.js +3 -5
  179. package/lib/deploy/remoteconfig/deploy.js +1 -1
  180. package/lib/deploy/remoteconfig/functions.js +5 -6
  181. package/lib/deploy/remoteconfig/prepare.js +2 -3
  182. package/lib/deploy/remoteconfig/release.js +2 -2
  183. package/lib/deploy/storage/deploy.js +1 -1
  184. package/lib/deploy/storage/prepare.js +1 -1
  185. package/lib/deploy/storage/release.js +1 -1
  186. package/lib/deploymentTool.js +5 -6
  187. package/lib/detectProjectRoot.js +1 -2
  188. package/lib/downloadUtils.js +2 -3
  189. package/lib/emulator/adminSdkConfig.js +2 -3
  190. package/lib/emulator/apphosting/config.js +1 -2
  191. package/lib/emulator/apphosting/developmentServer.js +3 -3
  192. package/lib/emulator/apphosting/serve.js +20 -14
  193. package/lib/emulator/auth/cloudFunctions.js +2 -3
  194. package/lib/emulator/auth/errors.js +2 -2
  195. package/lib/emulator/auth/handlers.js +3 -4
  196. package/lib/emulator/auth/index.js +6 -6
  197. package/lib/emulator/auth/operations.js +171 -129
  198. package/lib/emulator/auth/server.js +30 -22
  199. package/lib/emulator/auth/state.js +26 -36
  200. package/lib/emulator/auth/utils.js +12 -13
  201. package/lib/emulator/commandUtils.js +20 -20
  202. package/lib/emulator/controller.js +32 -29
  203. package/lib/emulator/databaseEmulator.js +1 -2
  204. package/lib/emulator/dataconnect/pgliteServer.js +48 -104
  205. package/lib/emulator/dataconnectEmulator.js +6 -9
  206. package/lib/emulator/download.js +2 -3
  207. package/lib/emulator/downloadableEmulatorInfo.json +7 -7
  208. package/lib/emulator/downloadableEmulators.js +49 -24
  209. package/lib/emulator/emulatorLogger.js +19 -4
  210. package/lib/emulator/env.js +6 -8
  211. package/lib/emulator/eventarcEmulator.js +2 -3
  212. package/lib/emulator/eventarcEmulatorUtils.js +3 -6
  213. package/lib/emulator/extensions/postinstall.js +1 -2
  214. package/lib/emulator/extensions/validation.js +4 -7
  215. package/lib/emulator/extensionsEmulator.js +6 -9
  216. package/lib/emulator/functionsEmulator.js +89 -46
  217. package/lib/emulator/functionsEmulatorRuntime.js +1 -1
  218. package/lib/emulator/functionsEmulatorShared.js +30 -30
  219. package/lib/emulator/functionsEmulatorShell.js +4 -6
  220. package/lib/emulator/functionsEmulatorUtils.js +8 -9
  221. package/lib/emulator/functionsRuntimeWorker.js +18 -9
  222. package/lib/emulator/hub.js +41 -34
  223. package/lib/emulator/hubClient.js +1 -1
  224. package/lib/emulator/initEmulators.js +2 -3
  225. package/lib/emulator/loggingEmulator.js +2 -2
  226. package/lib/emulator/portUtils.js +4 -5
  227. package/lib/emulator/registry.js +10 -4
  228. package/lib/emulator/shared/request.js +1 -2
  229. package/lib/emulator/storage/apis/firebase.js +16 -20
  230. package/lib/emulator/storage/apis/gcloud.js +6 -9
  231. package/lib/emulator/storage/apis/shared.js +1 -2
  232. package/lib/emulator/storage/crc.js +2 -3
  233. package/lib/emulator/storage/files.js +18 -41
  234. package/lib/emulator/storage/metadata.js +10 -4
  235. package/lib/emulator/storage/multipart.js +1 -2
  236. package/lib/emulator/storage/rfc.js +1 -2
  237. package/lib/emulator/storage/rules/config.js +1 -2
  238. package/lib/emulator/storage/rules/manager.js +3 -5
  239. package/lib/emulator/storage/rules/runtime.js +15 -13
  240. package/lib/emulator/storage/rules/types.js +2 -2
  241. package/lib/emulator/storage/rules/utils.js +5 -6
  242. package/lib/emulator/storage/server.js +1 -2
  243. package/lib/emulator/storage/upload.js +3 -4
  244. package/lib/emulator/taskQueue.js +11 -4
  245. package/lib/emulator/tasksEmulator.js +11 -12
  246. package/lib/emulator/types.js +6 -6
  247. package/lib/emulator/ui.js +6 -1
  248. package/lib/ensureApiEnabled.js +7 -9
  249. package/lib/env.js +2 -3
  250. package/lib/error.js +11 -13
  251. package/lib/errorOut.js +1 -2
  252. package/lib/experiments.js +15 -18
  253. package/lib/extensions/askUserForEventsConfig.js +12 -13
  254. package/lib/extensions/askUserForParam.js +11 -12
  255. package/lib/extensions/change-log.js +4 -5
  256. package/lib/extensions/checkProjectBilling.js +1 -2
  257. package/lib/extensions/diagnose.js +1 -2
  258. package/lib/extensions/displayExtensionInfo.js +25 -32
  259. package/lib/extensions/emulator/optionsHelper.js +6 -8
  260. package/lib/extensions/emulator/specHelper.js +15 -16
  261. package/lib/extensions/emulator/triggerHelper.js +3 -5
  262. package/lib/extensions/etags.js +2 -3
  263. package/lib/extensions/export.js +7 -9
  264. package/lib/extensions/extensionsApi.js +23 -29
  265. package/lib/extensions/extensionsHelper.js +52 -80
  266. package/lib/extensions/listExtensions.js +3 -5
  267. package/lib/extensions/localHelper.js +5 -5
  268. package/lib/extensions/manifest.js +15 -16
  269. package/lib/extensions/metricsUtils.js +3 -4
  270. package/lib/extensions/paramHelper.js +21 -18
  271. package/lib/extensions/provisioningHelper.js +17 -21
  272. package/lib/extensions/publishHelpers.js +1 -2
  273. package/lib/extensions/publisherApi.js +11 -13
  274. package/lib/extensions/refs.js +6 -7
  275. package/lib/extensions/runtimes/common.js +18 -19
  276. package/lib/extensions/runtimes/node.js +5 -6
  277. package/lib/extensions/secretsUtils.js +8 -8
  278. package/lib/extensions/tos.js +7 -8
  279. package/lib/extensions/types.js +3 -3
  280. package/lib/extensions/updateHelper.js +6 -7
  281. package/lib/extensions/utils.js +6 -8
  282. package/lib/extensions/versionHelper.js +1 -2
  283. package/lib/extensions/warnings.js +6 -8
  284. package/lib/fetchMOTD.js +1 -2
  285. package/lib/fetchWebSetup.js +3 -4
  286. package/lib/filterTargets.js +1 -2
  287. package/lib/firebaseConfigValidate.js +2 -3
  288. package/lib/firestore/api-sort.js +8 -9
  289. package/lib/firestore/api-types.js +15 -15
  290. package/lib/firestore/api.js +15 -13
  291. package/lib/firestore/backupUtils.js +3 -3
  292. package/lib/firestore/checkDatabaseType.js +1 -2
  293. package/lib/firestore/delete.js +1 -2
  294. package/lib/firestore/encodeFirestoreValue.js +1 -2
  295. package/lib/firestore/fsConfig.js +1 -2
  296. package/lib/firestore/options.js +1 -1
  297. package/lib/firestore/util.js +5 -6
  298. package/lib/firestore/validator.js +4 -5
  299. package/lib/frameworks/angular/index.js +14 -15
  300. package/lib/frameworks/angular/utils.js +21 -23
  301. package/lib/frameworks/astro/index.js +7 -7
  302. package/lib/frameworks/astro/utils.js +4 -6
  303. package/lib/frameworks/compose/discover/filesystem.js +3 -3
  304. package/lib/frameworks/compose/discover/frameworkMatcher.js +4 -5
  305. package/lib/frameworks/compose/discover/index.js +1 -2
  306. package/lib/frameworks/compose/discover/runtime/node.js +8 -11
  307. package/lib/frameworks/compose/driver/docker.js +3 -5
  308. package/lib/frameworks/compose/driver/hooks.js +2 -2
  309. package/lib/frameworks/compose/driver/index.js +2 -2
  310. package/lib/frameworks/compose/driver/local.js +2 -3
  311. package/lib/frameworks/compose/index.js +5 -7
  312. package/lib/frameworks/constants.js +3 -3
  313. package/lib/frameworks/express/index.js +7 -8
  314. package/lib/frameworks/flutter/index.js +6 -7
  315. package/lib/frameworks/flutter/utils.js +4 -5
  316. package/lib/frameworks/index.js +21 -22
  317. package/lib/frameworks/next/constants.js +5 -2
  318. package/lib/frameworks/next/index.js +34 -32
  319. package/lib/frameworks/next/utils.js +40 -39
  320. package/lib/frameworks/nuxt/index.js +9 -9
  321. package/lib/frameworks/nuxt/utils.js +4 -6
  322. package/lib/frameworks/nuxt2/index.js +7 -7
  323. package/lib/frameworks/sveltekit/index.js +6 -8
  324. package/lib/frameworks/utils.js +26 -24
  325. package/lib/frameworks/vite/index.js +8 -9
  326. package/lib/fsAsync.js +1 -2
  327. package/lib/fsutils.js +5 -6
  328. package/lib/functional.js +11 -11
  329. package/lib/functions/artifacts.js +25 -22
  330. package/lib/functions/ensureTargeted.js +1 -2
  331. package/lib/functions/env.js +13 -14
  332. package/lib/functions/functionslog.js +2 -3
  333. package/lib/functions/projectConfig.js +29 -33
  334. package/lib/functions/python.js +10 -4
  335. package/lib/functions/secrets.js +32 -18
  336. package/lib/functionsConfig.js +14 -14
  337. package/lib/functionsConfigClone.js +1 -2
  338. package/lib/functionsShellCommandAction.js +2 -3
  339. package/lib/gcp/apphosting.js +43 -28
  340. package/lib/gcp/apptesting.js +2 -2
  341. package/lib/gcp/artifactregistry.js +5 -5
  342. package/lib/gcp/auth.js +11 -13
  343. package/lib/gcp/cloudbilling.js +4 -5
  344. package/lib/gcp/cloudbuild.js +10 -11
  345. package/lib/gcp/cloudfunctions.js +61 -45
  346. package/lib/gcp/cloudfunctionsv2.js +81 -43
  347. package/lib/gcp/cloudlogging.js +2 -4
  348. package/lib/gcp/cloudmonitoring.js +7 -7
  349. package/lib/gcp/cloudscheduler.js +12 -14
  350. package/lib/gcp/cloudsql/cloudsqladmin.js +18 -20
  351. package/lib/gcp/cloudsql/connect.js +14 -9
  352. package/lib/gcp/cloudsql/fbToolsAuthClient.js +5 -3
  353. package/lib/gcp/cloudsql/interactive.js +2 -3
  354. package/lib/gcp/cloudsql/permissions.js +8 -8
  355. package/lib/gcp/cloudsql/permissionsSetup.js +9 -9
  356. package/lib/gcp/cloudtasks.js +19 -18
  357. package/lib/gcp/computeEngine.js +1 -2
  358. package/lib/gcp/devConnect.js +32 -29
  359. package/lib/gcp/docker.js +2 -4
  360. package/lib/gcp/eventarc.js +5 -5
  361. package/lib/gcp/firedata.js +4 -4
  362. package/lib/gcp/firestore.js +16 -16
  363. package/lib/gcp/iam.js +11 -12
  364. package/lib/gcp/identityPlatform.js +4 -5
  365. package/lib/gcp/k8s.js +1 -2
  366. package/lib/gcp/location.js +2 -2
  367. package/lib/gcp/proto.js +10 -11
  368. package/lib/gcp/pubsub.js +4 -5
  369. package/lib/gcp/resourceManager.js +5 -5
  370. package/lib/gcp/rules.js +13 -14
  371. package/lib/gcp/run.js +24 -31
  372. package/lib/gcp/runv2.js +39 -27
  373. package/lib/gcp/secretManager.js +60 -39
  374. package/lib/gcp/serviceusage.js +8 -4
  375. package/lib/gcp/storage.js +22 -20
  376. package/lib/gemini/fdcExperience.js +5 -5
  377. package/lib/getDefaultDatabaseInstance.js +2 -4
  378. package/lib/getDefaultHostingSite.js +3 -4
  379. package/lib/getProjectNumber.js +1 -2
  380. package/lib/hosting/api.js +32 -36
  381. package/lib/hosting/cloudRunProxy.js +2 -3
  382. package/lib/hosting/config.js +17 -17
  383. package/lib/hosting/expireUtils.js +3 -3
  384. package/lib/hosting/functionsProxy.js +1 -2
  385. package/lib/hosting/implicitInit.js +1 -2
  386. package/lib/hosting/initMiddleware.js +1 -2
  387. package/lib/hosting/interactive.js +1 -2
  388. package/lib/hosting/proxy.js +3 -5
  389. package/lib/hosting/runTags.js +8 -11
  390. package/lib/init/features/account.js +1 -2
  391. package/lib/init/features/ailogic/index.js +3 -5
  392. package/lib/init/features/ailogic/utils.js +6 -8
  393. package/lib/init/features/aitools/claude.js +1 -2
  394. package/lib/init/features/aitools/cursor.js +1 -2
  395. package/lib/init/features/aitools/gemini.js +1 -1
  396. package/lib/init/features/aitools/promptUpdater.js +10 -12
  397. package/lib/init/features/aitools.js +1 -2
  398. package/lib/init/features/apphosting.js +3 -4
  399. package/lib/init/features/apptesting/index.js +9 -9
  400. package/lib/init/features/database.js +4 -5
  401. package/lib/init/features/dataconnect/create_app.js +3 -4
  402. package/lib/init/features/dataconnect/index.js +25 -22
  403. package/lib/init/features/dataconnect/resolver.js +6 -10
  404. package/lib/init/features/dataconnect/sdk.js +31 -24
  405. package/lib/init/features/emulators.js +7 -6
  406. package/lib/init/features/extensions/index.js +3 -5
  407. package/lib/init/features/firestore/index.js +7 -9
  408. package/lib/init/features/firestore/indexes.js +2 -2
  409. package/lib/init/features/firestore/rules.js +3 -3
  410. package/lib/init/features/functions/index.js +3 -5
  411. package/lib/init/features/functions/javascript.js +1 -2
  412. package/lib/init/features/functions/npm-dependencies.js +1 -2
  413. package/lib/init/features/functions/python.js +1 -2
  414. package/lib/init/features/functions/typescript.js +1 -2
  415. package/lib/init/features/genkit/index.js +44 -18
  416. package/lib/init/features/hosting/github.js +6 -8
  417. package/lib/init/features/hosting/index.js +10 -13
  418. package/lib/init/features/project.js +4 -7
  419. package/lib/init/features/remoteconfig.js +1 -2
  420. package/lib/init/features/storage.js +3 -5
  421. package/lib/init/index.js +4 -7
  422. package/lib/init/spawn.js +7 -9
  423. package/lib/listFiles.js +1 -2
  424. package/lib/loadCJSON.js +1 -2
  425. package/lib/localFunction.js +14 -15
  426. package/lib/logError.js +1 -2
  427. package/lib/logger.js +7 -7
  428. package/lib/management/apps.js +22 -22
  429. package/lib/management/database.js +11 -12
  430. package/lib/management/projects.js +57 -56
  431. package/lib/management/provisioning/errorHandler.js +3 -5
  432. package/lib/management/provisioning/provision.js +15 -9
  433. package/lib/management/studio.js +2 -3
  434. package/lib/mcp/errors.js +4 -4
  435. package/lib/mcp/index.js +16 -23
  436. package/lib/mcp/prompt.js +1 -2
  437. package/lib/mcp/prompts/core/consult.js +2 -3
  438. package/lib/mcp/prompts/crashlytics/connect.js +15 -122
  439. package/lib/mcp/prompts/dataconnect/schema.js +3 -3
  440. package/lib/mcp/prompts/index.js +8 -10
  441. package/lib/mcp/resource.js +3 -15
  442. package/lib/mcp/resources/guides/app_id.js +39 -0
  443. package/lib/mcp/resources/guides/crashlytics_connect.js +51 -0
  444. package/lib/mcp/resources/guides/crashlytics_investigations.js +51 -0
  445. package/lib/mcp/resources/guides/crashlytics_issues.js +42 -0
  446. package/lib/mcp/resources/guides/crashlytics_reports.js +112 -0
  447. package/lib/mcp/resources/index.js +11 -3
  448. package/lib/mcp/tool.js +3 -15
  449. package/lib/mcp/tools/apphosting/fetch_logs.js +3 -4
  450. package/lib/mcp/tools/apphosting/list_backends.js +1 -1
  451. package/lib/mcp/tools/auth/get_users.js +5 -16
  452. package/lib/mcp/tools/core/create_android_sha.js +4 -1
  453. package/lib/mcp/tools/core/get_environment.js +3 -3
  454. package/lib/mcp/tools/core/get_sdk_config.js +4 -5
  455. package/lib/mcp/tools/core/get_security_rules.js +1 -2
  456. package/lib/mcp/tools/core/init.js +2 -2
  457. package/lib/mcp/tools/core/logout.js +1 -1
  458. package/lib/mcp/tools/core/read_resources.js +2 -2
  459. package/lib/mcp/tools/core/validate_security_rules.js +1 -2
  460. package/lib/mcp/tools/crashlytics/events.js +43 -19
  461. package/lib/mcp/tools/crashlytics/index.js +1 -6
  462. package/lib/mcp/tools/crashlytics/issues.js +33 -12
  463. package/lib/mcp/tools/crashlytics/reports.js +66 -117
  464. package/lib/mcp/tools/dataconnect/list_services.js +2 -3
  465. package/lib/mcp/tools/firestore/converter.js +3 -5
  466. package/lib/mcp/tools/firestore/delete_document.js +1 -1
  467. package/lib/mcp/tools/functions/get_logs.js +14 -12
  468. package/lib/mcp/tools/functions/list_functions.js +1 -1
  469. package/lib/mcp/tools/index.js +17 -9
  470. package/lib/mcp/util/apptesting/availability.js +1 -2
  471. package/lib/mcp/util/availability.js +1 -2
  472. package/lib/mcp/util/crashlytics/availability.js +1 -2
  473. package/lib/mcp/util/dataconnect/compile.js +7 -6
  474. package/lib/mcp/util/dataconnect/converter.js +7 -10
  475. package/lib/mcp/util/dataconnect/emulator.js +1 -2
  476. package/lib/mcp/util.js +9 -11
  477. package/lib/messaging/sendMessage.js +1 -2
  478. package/lib/metaprogramming.js +1 -2
  479. package/lib/operation-poller.js +2 -2
  480. package/lib/profileReport.js +6 -6
  481. package/lib/profiler.js +1 -2
  482. package/lib/projectPath.js +1 -2
  483. package/lib/projectUtils.js +5 -6
  484. package/lib/prompt.js +22 -13
  485. package/lib/rc.js +5 -7
  486. package/lib/remoteconfig/deleteExperiment.js +1 -2
  487. package/lib/remoteconfig/deleteRollout.js +1 -2
  488. package/lib/remoteconfig/get.js +2 -3
  489. package/lib/remoteconfig/getExperiment.js +2 -2
  490. package/lib/remoteconfig/getRollout.js +2 -2
  491. package/lib/remoteconfig/interfaces.js +1 -1
  492. package/lib/remoteconfig/listExperiments.js +2 -2
  493. package/lib/remoteconfig/listRollouts.js +2 -2
  494. package/lib/remoteconfig/publish.js +1 -2
  495. package/lib/remoteconfig/rollback.js +1 -2
  496. package/lib/remoteconfig/versionslist.js +1 -2
  497. package/lib/requireAuth.js +4 -6
  498. package/lib/requireConfig.js +5 -8
  499. package/lib/requireDatabaseInstance.js +2 -2
  500. package/lib/requireHostingSite.js +1 -2
  501. package/lib/requireInteractive.js +1 -1
  502. package/lib/requirePermissions.js +1 -2
  503. package/lib/requireTosAcceptance.js +1 -2
  504. package/lib/responseToError.js +1 -2
  505. package/lib/rtdb.js +2 -3
  506. package/lib/rulesDeploy.js +3 -4
  507. package/lib/serve/functions.js +9 -1
  508. package/lib/serve/hosting.js +4 -5
  509. package/lib/serve/index.js +1 -2
  510. package/lib/shortenUrl.js +1 -2
  511. package/lib/templates.js +3 -4
  512. package/lib/throttler/throttler.js +3 -3
  513. package/lib/timeout.js +2 -3
  514. package/lib/track.js +23 -14
  515. package/lib/tsconfig.publish.tsbuildinfo +1 -0
  516. package/lib/unzip.js +2 -3
  517. package/lib/utils.js +62 -63
  518. package/lib/vsCodeUtils.js +2 -3
  519. package/package.json +6 -6
  520. package/templates/extensions/typescript/index.ts +1 -1
  521. package/templates/extensions/typescript/package.lint.json +1 -1
  522. package/templates/extensions/typescript/package.nolint.json +1 -1
  523. package/templates/extensions/typescript/tsconfig.json +2 -1
package/lib/env.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isFirebaseMcp = exports.isFirebaseStudio = void 0;
3
+ exports.isFirebaseStudio = isFirebaseStudio;
4
+ exports.isFirebaseMcp = isFirebaseMcp;
4
5
  const fsutils_1 = require("./fsutils");
5
6
  let googleIdxFolderExists;
6
7
  function isFirebaseStudio() {
@@ -11,8 +12,6 @@ function isFirebaseStudio() {
11
12
  googleIdxFolderExists = (0, fsutils_1.dirExistsSync)("/google/idx");
12
13
  return googleIdxFolderExists;
13
14
  }
14
- exports.isFirebaseStudio = isFirebaseStudio;
15
15
  function isFirebaseMcp() {
16
16
  return !!process.env.IS_FIREBASE_MCP;
17
17
  }
18
- exports.isFirebaseMcp = isFirebaseMcp;
package/lib/error.js CHANGED
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasMessage = exports.isBillingError = exports.getError = exports.getErrStatus = exports.isObject = exports.getErrStack = exports.getErrMsg = exports.FirebaseError = void 0;
3
+ exports.hasMessage = exports.FirebaseError = void 0;
4
+ exports.getErrMsg = getErrMsg;
5
+ exports.getErrStack = getErrStack;
6
+ exports.isObject = isObject;
7
+ exports.getErrStatus = getErrStatus;
8
+ exports.getError = getError;
9
+ exports.isBillingError = isBillingError;
4
10
  const lodash_1 = require("lodash");
5
11
  const DEFAULT_CHILDREN = [];
6
12
  const DEFAULT_EXIT = 1;
@@ -30,40 +36,32 @@ function getErrMsg(err, defaultMsg) {
30
36
  }
31
37
  return JSON.stringify(err);
32
38
  }
33
- exports.getErrMsg = getErrMsg;
34
39
  function getErrStack(err) {
35
40
  if (err instanceof Error) {
36
41
  return err.stack || err.message;
37
42
  }
38
43
  return getErrMsg(err);
39
44
  }
40
- exports.getErrStack = getErrStack;
41
45
  function isObject(value) {
42
46
  return typeof value === "object" && value !== null;
43
47
  }
44
- exports.isObject = isObject;
45
48
  function getErrStatus(err, defaultStatus) {
46
49
  if (isObject(err) && err.status && typeof err.status === "number") {
47
50
  return err.status;
48
51
  }
49
52
  return defaultStatus || DEFAULT_STATUS;
50
53
  }
51
- exports.getErrStatus = getErrStatus;
52
54
  function getError(err) {
53
55
  if (err instanceof Error) {
54
56
  return err;
55
57
  }
56
58
  return Error(getErrMsg(err));
57
59
  }
58
- exports.getError = getError;
59
60
  function isBillingError(e) {
60
- var _a, _b, _c, _d;
61
- return !!((_d = (_c = (_b = (_a = e.context) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.details) === null || _d === void 0 ? void 0 : _d.find((d) => {
62
- var _a;
63
- return (((_a = d.violations) === null || _a === void 0 ? void 0 : _a.find((v) => v.type === "serviceusage/billing-enabled")) ||
61
+ return !!e.context?.body?.error?.details?.find((d) => {
62
+ return (d.violations?.find((v) => v.type === "serviceusage/billing-enabled") ||
64
63
  d.reason === "UREQ_PROJECT_BILLING_NOT_FOUND");
65
- }));
64
+ });
66
65
  }
67
- exports.isBillingError = isBillingError;
68
- const hasMessage = (e) => !!(e === null || e === void 0 ? void 0 : e.message);
66
+ const hasMessage = (e) => !!e?.message;
69
67
  exports.hasMessage = hasMessage;
package/lib/errorOut.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.errorOut = void 0;
3
+ exports.errorOut = errorOut;
4
4
  const logError_1 = require("./logError");
5
5
  const error_1 = require("./error");
6
6
  function errorOut(error) {
@@ -20,4 +20,3 @@ function errorOut(error) {
20
20
  process.exit();
21
21
  }, 250);
22
22
  }
23
- exports.errorOut = errorOut;
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.flushToDisk = exports.assertEnabled = exports.enableExperimentsFromCliEnvVariable = exports.setEnabled = exports.isEnabled = exports.experimentNameAutocorrect = exports.isValidExperiment = exports.ALL_EXPERIMENTS = void 0;
3
+ exports.ALL_EXPERIMENTS = void 0;
4
+ exports.isValidExperiment = isValidExperiment;
5
+ exports.experimentNameAutocorrect = experimentNameAutocorrect;
6
+ exports.isEnabled = isEnabled;
7
+ exports.setEnabled = setEnabled;
8
+ exports.enableExperimentsFromCliEnvVariable = enableExperimentsFromCliEnvVariable;
9
+ exports.assertEnabled = assertEnabled;
10
+ exports.flushToDisk = flushToDisk;
4
11
  const colorette_1 = require("colorette");
5
12
  const leven = require("leven");
6
13
  const path_1 = require("path");
@@ -22,11 +29,10 @@ exports.ALL_EXPERIMENTS = experiments({
22
29
  },
23
30
  functionsv2deployoptimizations: {
24
31
  shortDescription: "Optimize deployments of v2 firebase functions",
25
- fullDescription: "Reuse build images across funtions to increase performance and reliaibility " +
26
- "of deploys. This has been made an experiment due to backend bugs that are " +
27
- "temporarily causing failures in some regions with this optimization enabled",
32
+ fullDescription: "Reuse build images across functions to increase performance and reliability " +
33
+ "of deploys.",
28
34
  public: true,
29
- default: false,
35
+ default: true,
30
36
  },
31
37
  deletegcfartifacts: {
32
38
  shortDescription: `Add the ${(0, colorette_1.bold)("functions:deletegcfartifacts")} command to purge docker build images`,
@@ -39,13 +45,13 @@ exports.ALL_EXPERIMENTS = experiments({
39
45
  `Registry. The ${(0, colorette_1.bold)("functions:deletegcfartifacts")} command ` +
40
46
  "will delete all Docker images created by Google Cloud Functions irrespective " +
41
47
  "of how that image was created.",
42
- public: false,
48
+ public: true,
43
49
  },
44
50
  legacyRuntimeConfigCommands: {
45
51
  shortDescription: "Expose legacy functions.config() CLI commands",
46
52
  fullDescription: "The Cloud Runtime Config API is deprecated. Enable this experiment to continue using the " +
47
53
  "`functions:config:*` commands while you migrate to the Firebase Functions params APIs.",
48
- default: true,
54
+ default: false,
49
55
  public: true,
50
56
  },
51
57
  runfunctions: {
@@ -143,14 +149,12 @@ exports.ALL_EXPERIMENTS = experiments({
143
149
  function isValidExperiment(name) {
144
150
  return Object.keys(exports.ALL_EXPERIMENTS).includes(name);
145
151
  }
146
- exports.isValidExperiment = isValidExperiment;
147
152
  function experimentNameAutocorrect(malformed) {
148
153
  if (isValidExperiment(malformed)) {
149
154
  throw new error_1.FirebaseError("Assertion failed: experimentNameAutocorrect given actual experiment name", { exit: 2 });
150
155
  }
151
156
  return Object.keys(exports.ALL_EXPERIMENTS).filter((name) => leven(name, malformed) < malformed.length * 0.4);
152
157
  }
153
- exports.experimentNameAutocorrect = experimentNameAutocorrect;
154
158
  let localPreferencesCache = undefined;
155
159
  function localPreferences() {
156
160
  if (!localPreferencesCache) {
@@ -164,10 +168,8 @@ function localPreferences() {
164
168
  return localPreferencesCache;
165
169
  }
166
170
  function isEnabled(name) {
167
- var _a, _b, _c;
168
- return (_c = (_a = localPreferences()[name]) !== null && _a !== void 0 ? _a : (_b = exports.ALL_EXPERIMENTS[name]) === null || _b === void 0 ? void 0 : _b.default) !== null && _c !== void 0 ? _c : false;
171
+ return localPreferences()[name] ?? exports.ALL_EXPERIMENTS[name]?.default ?? false;
169
172
  }
170
- exports.isEnabled = isEnabled;
171
173
  function setEnabled(name, to) {
172
174
  if (to === null) {
173
175
  delete localPreferences()[name];
@@ -176,7 +178,6 @@ function setEnabled(name, to) {
176
178
  localPreferences()[name] = to;
177
179
  }
178
180
  }
179
- exports.setEnabled = setEnabled;
180
181
  function enableExperimentsFromCliEnvVariable() {
181
182
  const experiments = process.env.FIREBASE_CLI_EXPERIMENTS || "";
182
183
  for (const experiment of experiments.split(",")) {
@@ -185,13 +186,11 @@ function enableExperimentsFromCliEnvVariable() {
185
186
  }
186
187
  }
187
188
  }
188
- exports.enableExperimentsFromCliEnvVariable = enableExperimentsFromCliEnvVariable;
189
189
  function assertEnabled(name, task) {
190
- var _a;
191
190
  if (!isEnabled(name)) {
192
191
  const prefix = `Cannot ${task} because the experiment ${(0, colorette_1.bold)(name)} is not enabled.`;
193
192
  if ((0, utils_1.isRunningInGithubAction)()) {
194
- const path = (_a = process.env.GITHUB_WORKFLOW_REF) === null || _a === void 0 ? void 0 : _a.split("@")[0];
193
+ const path = process.env.GITHUB_WORKFLOW_REF?.split("@")[0];
195
194
  const filename = path ? `.github/workflows/${(0, path_1.basename)(path)}` : "your action's yml";
196
195
  const newValue = [process.env.FIREBASE_CLI_EXPERIMENTS, name].filter((it) => !!it).join(",");
197
196
  throw new error_1.FirebaseError(`${prefix} To enable add a ${(0, colorette_1.bold)("FIREBASE_CLI_EXPERIMENTS")} environment variable to ${filename}, like so: ${(0, colorette_1.italic)(`
@@ -208,8 +207,6 @@ function assertEnabled(name, task) {
208
207
  }
209
208
  }
210
209
  }
211
- exports.assertEnabled = assertEnabled;
212
210
  function flushToDisk() {
213
211
  configstore_1.configstore.set("previews", localPreferences());
214
212
  }
215
- exports.flushToDisk = flushToDisk;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.askForEventArcLocation = exports.EXTENSIONS_DEFAULT_EVENT_ARC_REGION = exports.ALLOWED_EVENT_ARC_REGIONS = exports.askShouldCollectEventsConfig = exports.askForAllowedEventTypes = exports.getEventArcChannel = exports.askForEventsConfig = exports.checkAllowedEventTypesResponse = void 0;
3
+ exports.EXTENSIONS_DEFAULT_EVENT_ARC_REGION = exports.ALLOWED_EVENT_ARC_REGIONS = void 0;
4
+ exports.checkAllowedEventTypesResponse = checkAllowedEventTypesResponse;
5
+ exports.askForEventsConfig = askForEventsConfig;
6
+ exports.getEventArcChannel = getEventArcChannel;
7
+ exports.askForAllowedEventTypes = askForAllowedEventTypes;
8
+ exports.askShouldCollectEventsConfig = askShouldCollectEventsConfig;
9
+ exports.askForEventArcLocation = askForEventArcLocation;
4
10
  const extensionsApi = require("../extensions/extensionsApi");
5
11
  const utils = require("../utils");
6
12
  const clc = require("colorette");
@@ -20,9 +26,7 @@ function checkAllowedEventTypesResponse(response, validEvents) {
20
26
  }
21
27
  return true;
22
28
  }
23
- exports.checkAllowedEventTypesResponse = checkAllowedEventTypesResponse;
24
29
  async function askForEventsConfig(events, projectId, instanceId) {
25
- var _a, _b;
26
30
  logger_1.logger.info(`\n${clc.bold("Enable Events")}: ${await (0, marked_1.marked)("If you enable events, you can write custom event handlers ([https://firebase.google.com/docs/extensions/install-extensions#eventarc](https://firebase.google.com/docs/extensions/install-extensions#eventarc)) that respond to these events.\n\nYou can always enable or disable events later. Events will be emitted via Eventarc. Fees apply ([https://cloud.google.com/eventarc/pricing](https://cloud.google.com/eventarc/pricing)).")}`);
27
31
  if (!(await askShouldCollectEventsConfig())) {
28
32
  return undefined;
@@ -33,20 +37,18 @@ async function askForEventsConfig(events, projectId, instanceId) {
33
37
  ? await extensionsApi.getInstance(projectId, instanceId)
34
38
  : undefined;
35
39
  }
36
- catch (_c) {
40
+ catch {
37
41
  }
38
- const preselectedTypes = (_a = existingInstance === null || existingInstance === void 0 ? void 0 : existingInstance.config.allowedEventTypes) !== null && _a !== void 0 ? _a : [];
39
- const oldLocation = (_b = existingInstance === null || existingInstance === void 0 ? void 0 : existingInstance.config.eventarcChannel) === null || _b === void 0 ? void 0 : _b.split("/")[3];
42
+ const preselectedTypes = existingInstance?.config.allowedEventTypes ?? [];
43
+ const oldLocation = existingInstance?.config.eventarcChannel?.split("/")[3];
40
44
  const location = await askForEventArcLocation(oldLocation);
41
45
  const channel = getEventArcChannel(projectId, location);
42
46
  const allowedEventTypes = await askForAllowedEventTypes(events, preselectedTypes);
43
47
  return { channel, allowedEventTypes };
44
48
  }
45
- exports.askForEventsConfig = askForEventsConfig;
46
49
  function getEventArcChannel(projectId, location) {
47
50
  return `projects/${projectId}/locations/${location}/channels/firebase`;
48
51
  }
49
- exports.getEventArcChannel = getEventArcChannel;
50
52
  async function askForAllowedEventTypes(eventDescriptors, preselectedTypes) {
51
53
  let valid = false;
52
54
  let response = [];
@@ -57,7 +59,7 @@ async function askForAllowedEventTypes(eventDescriptors, preselectedTypes) {
57
59
  }));
58
60
  while (!valid) {
59
61
  response = await (0, prompt_1.checkbox)({
60
- default: preselectedTypes !== null && preselectedTypes !== void 0 ? preselectedTypes : [],
62
+ default: preselectedTypes ?? [],
61
63
  message: `Please select the events [${eventTypes.length} types total] that this extension is permitted to emit. ` +
62
64
  "You can implement your own handlers that trigger when these events are emitted to customize the extension's behavior. ",
63
65
  choices: eventTypes,
@@ -67,11 +69,9 @@ async function askForAllowedEventTypes(eventDescriptors, preselectedTypes) {
67
69
  }
68
70
  return response.filter((e) => e !== "");
69
71
  }
70
- exports.askForAllowedEventTypes = askForAllowedEventTypes;
71
72
  function askShouldCollectEventsConfig() {
72
73
  return (0, prompt_1.confirm)("Would you like to enable events?");
73
74
  }
74
- exports.askShouldCollectEventsConfig = askShouldCollectEventsConfig;
75
75
  exports.ALLOWED_EVENT_ARC_REGIONS = [
76
76
  "us-central1",
77
77
  "us-west1",
@@ -84,7 +84,7 @@ async function askForEventArcLocation(preselectedLocation) {
84
84
  let location = "";
85
85
  while (!valid) {
86
86
  location = await (0, prompt_1.select)({
87
- default: preselectedLocation !== null && preselectedLocation !== void 0 ? preselectedLocation : exports.EXTENSIONS_DEFAULT_EVENT_ARC_REGION,
87
+ default: preselectedLocation ?? exports.EXTENSIONS_DEFAULT_EVENT_ARC_REGION,
88
88
  message: "Which location would you like the Eventarc channel to live in? We recommend using the default option. A channel location that differs from the extension's Cloud Functions location can incur egress cost.",
89
89
  choices: exports.ALLOWED_EVENT_ARC_REGIONS,
90
90
  });
@@ -95,4 +95,3 @@ async function askForEventArcLocation(preselectedLocation) {
95
95
  }
96
96
  return location;
97
97
  }
98
- exports.askForEventArcLocation = askForEventArcLocation;
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getInquirerDefault = exports.promptCreateSecret = exports.askForParam = exports.ask = exports.checkResponse = exports.SecretLocation = void 0;
3
+ exports.SecretLocation = void 0;
4
+ exports.checkResponse = checkResponse;
5
+ exports.ask = ask;
6
+ exports.askForParam = askForParam;
7
+ exports.promptCreateSecret = promptCreateSecret;
8
+ exports.getInquirerDefault = getInquirerDefault;
4
9
  const _ = require("lodash");
5
10
  const clc = require("colorette");
6
11
  const marked_1 = require("marked");
@@ -18,14 +23,13 @@ var SecretLocation;
18
23
  (function (SecretLocation) {
19
24
  SecretLocation[SecretLocation["CLOUD"] = 1] = "CLOUD";
20
25
  SecretLocation[SecretLocation["LOCAL"] = 2] = "LOCAL";
21
- })(SecretLocation = exports.SecretLocation || (exports.SecretLocation = {}));
26
+ })(SecretLocation || (exports.SecretLocation = SecretLocation = {}));
22
27
  var SecretUpdateAction;
23
28
  (function (SecretUpdateAction) {
24
29
  SecretUpdateAction[SecretUpdateAction["LEAVE"] = 1] = "LEAVE";
25
30
  SecretUpdateAction[SecretUpdateAction["SET_NEW"] = 2] = "SET_NEW";
26
31
  })(SecretUpdateAction || (SecretUpdateAction = {}));
27
32
  function checkResponse(response, spec) {
28
- var _a;
29
33
  let valid = true;
30
34
  let responses;
31
35
  if (spec.required && (response === "" || response === undefined)) {
@@ -51,7 +55,7 @@ function checkResponse(response, spec) {
51
55
  }
52
56
  if (spec.type && (spec.type === types_1.ParamType.MULTISELECT || spec.type === types_1.ParamType.SELECT)) {
53
57
  for (const r of responses) {
54
- const validChoice = (_a = spec.options) === null || _a === void 0 ? void 0 : _a.some((option) => r === option.value);
58
+ const validChoice = spec.options?.some((option) => r === option.value);
55
59
  if (r && !validChoice) {
56
60
  utils.logWarning(`${r} is not a valid option for ${spec.param}.`);
57
61
  valid = false;
@@ -60,7 +64,6 @@ function checkResponse(response, spec) {
60
64
  }
61
65
  return valid;
62
66
  }
63
- exports.checkResponse = checkResponse;
64
67
  async function ask(args) {
65
68
  if (_.isEmpty(args.paramSpecs)) {
66
69
  logger_1.logger.debug("No params were specified for this extension.");
@@ -68,7 +71,7 @@ async function ask(args) {
68
71
  }
69
72
  utils.logLabeledBullet(extensionsHelper_1.logPrefix, "answer the questions below to configure your extension:");
70
73
  const substituted = (0, extensionsHelper_1.substituteParams)(args.paramSpecs, args.firebaseProjectParams);
71
- const [advancedParams, standardParams] = (0, functional_1.partition)(substituted, (p) => { var _a; return (_a = p.advanced) !== null && _a !== void 0 ? _a : false; });
74
+ const [advancedParams, standardParams] = (0, functional_1.partition)(substituted, (p) => p.advanced ?? false);
72
75
  const result = {};
73
76
  const promises = standardParams.map((paramSpec) => {
74
77
  return async () => {
@@ -109,7 +112,6 @@ async function ask(args) {
109
112
  logger_1.logger.info();
110
113
  return result;
111
114
  }
112
- exports.ask = ask;
113
115
  async function askForParam(args) {
114
116
  const paramSpec = args.paramSpec;
115
117
  let valid = false;
@@ -169,9 +171,8 @@ async function askForParam(args) {
169
171
  valid = checkResponse(response, paramSpec);
170
172
  }
171
173
  }
172
- return Object.assign({ baseValue: response }, (responseForLocal ? { local: responseForLocal } : {}));
174
+ return { baseValue: response, ...(responseForLocal ? { local: responseForLocal } : {}) };
173
175
  }
174
- exports.askForParam = askForParam;
175
176
  function isValidSecretLocations(secretLocations, paramSpec) {
176
177
  if (paramSpec.required) {
177
178
  return !!secretLocations.length;
@@ -267,7 +268,7 @@ async function promptReconfigureSecret(projectId, instanceId, paramSpec) {
267
268
  }
268
269
  }
269
270
  async function promptCreateSecret(projectId, instanceId, paramSpec, secretName) {
270
- const name = secretName !== null && secretName !== void 0 ? secretName : (await generateSecretName(projectId, instanceId, paramSpec.param));
271
+ const name = secretName ?? (await generateSecretName(projectId, instanceId, paramSpec.param));
271
272
  const secretValue = (await (0, prompt_1.password)({
272
273
  message: `This secret will be stored in Cloud Secret Manager (https://cloud.google.com/secret-manager/pricing) as ${name} and managed by Firebase Extensions (Firebase Extensions Service Agent will be granted Secret Admin role on this secret).\nEnter a value for ${paramSpec.label.trim()}:`,
273
274
  })) ||
@@ -290,7 +291,6 @@ async function promptCreateSecret(projectId, instanceId, paramSpec, secretName)
290
291
  return "";
291
292
  }
292
293
  }
293
- exports.promptCreateSecret = promptCreateSecret;
294
294
  async function generateSecretName(projectId, instanceId, paramName) {
295
295
  let secretName = `ext-${instanceId}-${paramName}`;
296
296
  while (await secretManagerApi.secretExists(projectId, secretName)) {
@@ -307,4 +307,3 @@ function getInquirerDefault(options, def) {
307
307
  const defaultOption = options.find((o) => o.value === def);
308
308
  return defaultOption ? defaultOption.label || defaultOption.value : "";
309
309
  }
310
- exports.getInquirerDefault = getInquirerDefault;
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseChangelog = exports.getLocalChangelog = exports.breakingChangesInUpdate = exports.getReleaseNotesForUpdate = void 0;
3
+ exports.getReleaseNotesForUpdate = getReleaseNotesForUpdate;
4
+ exports.breakingChangesInUpdate = breakingChangesInUpdate;
5
+ exports.getLocalChangelog = getLocalChangelog;
6
+ exports.parseChangelog = parseChangelog;
4
7
  const marked_1 = require("marked");
5
8
  const path = require("path");
6
9
  const semver = require("semver");
@@ -26,7 +29,6 @@ async function getReleaseNotesForUpdate(args) {
26
29
  }
27
30
  return releaseNotes;
28
31
  }
29
- exports.getReleaseNotesForUpdate = getReleaseNotesForUpdate;
30
32
  function breakingChangesInUpdate(versionsInUpdate) {
31
33
  const breakingVersions = [];
32
34
  const semvers = versionsInUpdate.map((v) => semver.parse(v)).sort(semver.compare);
@@ -41,12 +43,10 @@ function breakingChangesInUpdate(versionsInUpdate) {
41
43
  }
42
44
  return breakingVersions;
43
45
  }
44
- exports.breakingChangesInUpdate = breakingChangesInUpdate;
45
46
  function getLocalChangelog(directory) {
46
47
  const rawChangelog = (0, localHelper_1.readFile)(path.resolve(directory, EXTENSIONS_CHANGELOG));
47
48
  return parseChangelog(rawChangelog);
48
49
  }
49
- exports.getLocalChangelog = getLocalChangelog;
50
50
  function parseChangelog(rawChangelog) {
51
51
  const changelog = {};
52
52
  let currentVersion = "";
@@ -66,4 +66,3 @@ function parseChangelog(rawChangelog) {
66
66
  }
67
67
  return changelog;
68
68
  }
69
- exports.parseChangelog = parseChangelog;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.enableBilling = void 0;
3
+ exports.enableBilling = enableBilling;
4
4
  const clc = require("colorette");
5
5
  const opn = require("open");
6
6
  const cloudbilling = require("../gcp/cloudbilling");
@@ -73,4 +73,3 @@ async function enableBilling(projectId) {
73
73
  : setUpBillingAccount(projectId);
74
74
  }
75
75
  }
76
- exports.enableBilling = enableBilling;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.diagnose = void 0;
3
+ exports.diagnose = diagnose;
4
4
  const extensionsHelper_1 = require("./extensionsHelper");
5
5
  const getProjectNumber_1 = require("../getProjectNumber");
6
6
  const utils = require("../utils");
@@ -50,4 +50,3 @@ async function diagnose(projectId) {
50
50
  return false;
51
51
  }
52
52
  }
53
- exports.diagnose = diagnose;
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.retrieveRoleInfo = exports.displayResources = exports.displayEvents = exports.displayExternalServices = exports.displayExtensionVersionInfo = void 0;
3
+ exports.displayExtensionVersionInfo = displayExtensionVersionInfo;
4
+ exports.displayExternalServices = displayExternalServices;
5
+ exports.displayEvents = displayEvents;
6
+ exports.displayResources = displayResources;
7
+ exports.retrieveRoleInfo = retrieveRoleInfo;
4
8
  const clc = require("colorette");
5
9
  const semver = require("semver");
6
10
  const path = require("path");
@@ -12,13 +16,12 @@ const secretsUtils_1 = require("./secretsUtils");
12
16
  const TASKS_ROLE = "cloudtasks.enqueuer";
13
17
  const TASKS_API = "cloudtasks.googleapis.com";
14
18
  async function displayExtensionVersionInfo(args) {
15
- var _a, _b, _c, _d, _e, _f, _g;
16
19
  const { spec, extensionVersion, latestApprovedVersion, latestVersion } = args;
17
20
  const lines = [];
18
21
  const extensionRef = extensionVersion
19
- ? refs.toExtensionRef(refs.parse(extensionVersion === null || extensionVersion === void 0 ? void 0 : extensionVersion.ref))
22
+ ? refs.toExtensionRef(refs.parse(extensionVersion?.ref))
20
23
  : "";
21
- lines.push(`${clc.bold("Extension:")} ${(_a = spec.displayName) !== null && _a !== void 0 ? _a : "Unnamed extension"} ${extensionRef ? `(${extensionRef})` : ""}`);
24
+ lines.push(`${clc.bold("Extension:")} ${spec.displayName ?? "Unnamed extension"} ${extensionRef ? `(${extensionRef})` : ""}`);
22
25
  if (spec.description) {
23
26
  lines.push(`${clc.bold("Description:")} ${spec.description}`);
24
27
  }
@@ -27,13 +30,13 @@ async function displayExtensionVersionInfo(args) {
27
30
  if (latestRelevantVersion && semver.eq(spec.version, latestRelevantVersion)) {
28
31
  versionNote = `- ${clc.green("Latest")}`;
29
32
  }
30
- if ((extensionVersion === null || extensionVersion === void 0 ? void 0 : extensionVersion.state) === "DEPRECATED") {
33
+ if (extensionVersion?.state === "DEPRECATED") {
31
34
  versionNote = `- ${clc.red("Deprecated")}`;
32
35
  }
33
36
  lines.push(`${clc.bold("Version:")} ${spec.version} ${versionNote}`);
34
37
  if (extensionVersion) {
35
38
  let reviewStatus;
36
- switch ((_b = extensionVersion.listing) === null || _b === void 0 ? void 0 : _b.state) {
39
+ switch (extensionVersion.listing?.state) {
37
40
  case "APPROVED":
38
41
  reviewStatus = clc.bold(clc.green("Accepted"));
39
42
  break;
@@ -49,19 +52,19 @@ async function displayExtensionVersionInfo(args) {
49
52
  }
50
53
  if (extensionVersion.buildSourceUri) {
51
54
  const buildSourceUri = new URL(extensionVersion.buildSourceUri);
52
- buildSourceUri.pathname = path.join(buildSourceUri.pathname, (_c = extensionVersion.extensionRoot) !== null && _c !== void 0 ? _c : "");
55
+ buildSourceUri.pathname = path.join(buildSourceUri.pathname, extensionVersion.extensionRoot ?? "");
53
56
  lines.push(`${clc.bold("Source in GitHub:")} ${buildSourceUri.toString()}`);
54
57
  }
55
58
  else {
56
- lines.push(`${clc.bold("Source download URI:")} ${(_d = extensionVersion.sourceDownloadUri) !== null && _d !== void 0 ? _d : "-"}`);
59
+ lines.push(`${clc.bold("Source download URI:")} ${extensionVersion.sourceDownloadUri ?? "-"}`);
57
60
  }
58
61
  }
59
- lines.push(`${clc.bold("License:")} ${(_e = spec.license) !== null && _e !== void 0 ? _e : "-"}`);
62
+ lines.push(`${clc.bold("License:")} ${spec.license ?? "-"}`);
60
63
  lines.push(displayResources(spec));
61
- if ((_f = spec.events) === null || _f === void 0 ? void 0 : _f.length) {
64
+ if (spec.events?.length) {
62
65
  lines.push(displayEvents(spec));
63
66
  }
64
- if ((_g = spec.externalServices) === null || _g === void 0 ? void 0 : _g.length) {
67
+ if (spec.externalServices?.length) {
65
68
  lines.push(displayExternalServices(spec));
66
69
  }
67
70
  const apis = impliedApis(spec);
@@ -75,25 +78,19 @@ async function displayExtensionVersionInfo(args) {
75
78
  logger_1.logger.info(`\n${lines.join("\n")}`);
76
79
  return lines;
77
80
  }
78
- exports.displayExtensionVersionInfo = displayExtensionVersionInfo;
79
81
  function displayExternalServices(spec) {
80
- var _a, _b;
81
- const lines = (_b = (_a = spec.externalServices) === null || _a === void 0 ? void 0 : _a.map((service) => {
82
+ const lines = spec.externalServices?.map((service) => {
82
83
  return ` - ${clc.cyan(`${service.name} (${service.pricingUri})`)}`;
83
- })) !== null && _b !== void 0 ? _b : [];
84
+ }) ?? [];
84
85
  return clc.bold("External services used:\n") + lines.join("\n");
85
86
  }
86
- exports.displayExternalServices = displayExternalServices;
87
87
  function displayEvents(spec) {
88
- var _a, _b;
89
- const lines = (_b = (_a = spec.events) === null || _a === void 0 ? void 0 : _a.map((event) => {
88
+ const lines = spec.events?.map((event) => {
90
89
  return ` - ${clc.magenta(event.type)}${event.description ? `: ${event.description}` : ""}`;
91
- })) !== null && _b !== void 0 ? _b : [];
90
+ }) ?? [];
92
91
  return clc.bold("Events emitted:\n") + lines.join("\n");
93
92
  }
94
- exports.displayEvents = displayEvents;
95
93
  function displayResources(spec) {
96
- var _a;
97
94
  const lines = spec.resources.map((resource) => {
98
95
  let type = resource.type;
99
96
  switch (resource.type) {
@@ -107,7 +104,7 @@ function displayResources(spec) {
107
104
  }
108
105
  return ` - ${clc.blueBright(`${resource.name} (${type})`)}${resource.description ? `: ${resource.description}` : ""}`;
109
106
  });
110
- lines.push(...new Set((_a = spec.lifecycleEvents) === null || _a === void 0 ? void 0 : _a.map((event) => {
107
+ lines.push(...new Set(spec.lifecycleEvents?.map((event) => {
111
108
  return ` - ${clc.blueBright(`${event.taskQueueTriggerFunction} (Cloud Task queue)`)}`;
112
109
  })));
113
110
  lines.push(...spec.params
@@ -119,12 +116,10 @@ function displayResources(spec) {
119
116
  }));
120
117
  return clc.bold("Resources created:\n") + (lines.length ? lines.join("\n") : " - None");
121
118
  }
122
- exports.displayResources = displayResources;
123
119
  async function retrieveRoleInfo(role) {
124
120
  const res = await iam.getRole(role);
125
121
  return ` - ${clc.yellow(res.title || res.name)}${res.description ? `: ${res.description}` : ""}`;
126
122
  }
127
- exports.retrieveRoleInfo = retrieveRoleInfo;
128
123
  async function displayRoles(roles) {
129
124
  const lines = await Promise.all(roles.map((role) => {
130
125
  return retrieveRoleInfo(role.role);
@@ -138,33 +133,31 @@ function displayApis(apis) {
138
133
  return clc.bold("APIs used:\n") + lines.join("\n");
139
134
  }
140
135
  function usesTasks(spec) {
141
- return spec.resources.some((r) => { var _a; return r.type === types_1.FUNCTIONS_RESOURCE_TYPE && ((_a = r.properties) === null || _a === void 0 ? void 0 : _a.taskQueueTrigger) !== undefined; });
136
+ return spec.resources.some((r) => r.type === types_1.FUNCTIONS_RESOURCE_TYPE && r.properties?.taskQueueTrigger !== undefined);
142
137
  }
143
138
  function impliedRoles(spec) {
144
- var _a, _b, _c;
145
139
  const roles = [];
146
- if ((0, secretsUtils_1.usesSecrets)(spec) && !((_a = spec.roles) === null || _a === void 0 ? void 0 : _a.some((r) => r.role === secretsUtils_1.SECRET_ROLE))) {
140
+ if ((0, secretsUtils_1.usesSecrets)(spec) && !spec.roles?.some((r) => r.role === secretsUtils_1.SECRET_ROLE)) {
147
141
  roles.push({
148
142
  role: secretsUtils_1.SECRET_ROLE,
149
143
  reason: "Allows the extension to read secret values from Cloud Secret Manager.",
150
144
  });
151
145
  }
152
- if (usesTasks(spec) && !((_b = spec.roles) === null || _b === void 0 ? void 0 : _b.some((r) => r.role === TASKS_ROLE))) {
146
+ if (usesTasks(spec) && !spec.roles?.some((r) => r.role === TASKS_ROLE)) {
153
147
  roles.push({
154
148
  role: TASKS_ROLE,
155
149
  reason: "Allows the extension to enqueue Cloud Tasks.",
156
150
  });
157
151
  }
158
- return roles.concat((_c = spec.roles) !== null && _c !== void 0 ? _c : []);
152
+ return roles.concat(spec.roles ?? []);
159
153
  }
160
154
  function impliedApis(spec) {
161
- var _a, _b;
162
155
  const apis = [];
163
- if (usesTasks(spec) && !((_a = spec.apis) === null || _a === void 0 ? void 0 : _a.some((a) => a.apiName === TASKS_API))) {
156
+ if (usesTasks(spec) && !spec.apis?.some((a) => a.apiName === TASKS_API)) {
164
157
  apis.push({
165
158
  apiName: TASKS_API,
166
159
  reason: "Allows the extension to enqueue Cloud Tasks.",
167
160
  });
168
161
  }
169
- return apis.concat((_b = spec.apis) !== null && _b !== void 0 ? _b : []);
162
+ return apis.concat(spec.apis ?? []);
170
163
  }
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getParams = exports.getSecretEnvVars = exports.getNonSecretEnv = exports.getExtensionFunctionInfo = void 0;
3
+ exports.getExtensionFunctionInfo = getExtensionFunctionInfo;
4
+ exports.getNonSecretEnv = getNonSecretEnv;
5
+ exports.getSecretEnvVars = getSecretEnvVars;
6
+ exports.getParams = getParams;
4
7
  const paramHelper = require("../paramHelper");
5
8
  const specHelper = require("./specHelper");
6
9
  const triggerHelper = require("./triggerHelper");
@@ -9,7 +12,6 @@ const extensionsHelper = require("../extensionsHelper");
9
12
  const planner = require("../../deploy/extensions/planner");
10
13
  const projectUtils_1 = require("../../projectUtils");
11
14
  async function getExtensionFunctionInfo(instance, paramValues) {
12
- var _a, _b;
13
15
  const spec = await planner.getExtensionSpec(instance);
14
16
  const functionResources = specHelper.getFunctionResourcesWithParamSubstitution(spec, paramValues);
15
17
  const extensionTriggers = functionResources
@@ -19,8 +21,8 @@ async function getExtensionFunctionInfo(instance, paramValues) {
19
21
  return trigger;
20
22
  });
21
23
  const runtime = specHelper.getRuntime(functionResources);
22
- const nonSecretEnv = getNonSecretEnv((_a = spec.params) !== null && _a !== void 0 ? _a : [], paramValues);
23
- const secretEnvVariables = getSecretEnvVars((_b = spec.params) !== null && _b !== void 0 ? _b : [], paramValues);
24
+ const nonSecretEnv = getNonSecretEnv(spec.params ?? [], paramValues);
25
+ const secretEnvVariables = getSecretEnvVars(spec.params ?? [], paramValues);
24
26
  return {
25
27
  extensionTriggers,
26
28
  runtime,
@@ -28,7 +30,6 @@ async function getExtensionFunctionInfo(instance, paramValues) {
28
30
  secretEnvVariables,
29
31
  };
30
32
  }
31
- exports.getExtensionFunctionInfo = getExtensionFunctionInfo;
32
33
  const isSecretParam = (p) => p.type === extensionsHelper.SpecParamType.SECRET || p.type === types_1.ParamType.SECRET;
33
34
  function getNonSecretEnv(params, paramValues) {
34
35
  const getNonSecretEnv = Object.assign({}, paramValues);
@@ -38,7 +39,6 @@ function getNonSecretEnv(params, paramValues) {
38
39
  }
39
40
  return getNonSecretEnv;
40
41
  }
41
- exports.getNonSecretEnv = getNonSecretEnv;
42
42
  function getSecretEnvVars(params, paramValues) {
43
43
  const secretEnvVar = [];
44
44
  const secretParams = params.filter(isSecretParam);
@@ -55,7 +55,6 @@ function getSecretEnvVars(params, paramValues) {
55
55
  }
56
56
  return secretEnvVar;
57
57
  }
58
- exports.getSecretEnvVars = getSecretEnvVars;
59
58
  function getParams(options, extensionSpec) {
60
59
  const projectId = (0, projectUtils_1.needProjectId)(options);
61
60
  const userParams = paramHelper.readEnvFile(options.testParams);
@@ -70,4 +69,3 @@ function getParams(options, extensionSpec) {
70
69
  const unsubbedParams = extensionsHelper.populateDefaultParams(unsubbedParamsWithoutDefaults, extensionSpec.params);
71
70
  return extensionsHelper.substituteParams(unsubbedParams, unsubbedParams);
72
71
  }
73
- exports.getParams = getParams;