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
@@ -1,6 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.endpointFromFunction = exports.functionFromEndpoint = exports.deleteFunction = exports.updateFunction = exports.listAllFunctions = exports.getFunction = exports.createFunction = exports.generateUploadUrl = exports.API_VERSION = void 0;
3
+ exports.API_VERSION = void 0;
4
+ exports.generateUploadUrl = generateUploadUrl;
5
+ exports.createFunction = createFunction;
6
+ exports.getFunction = getFunction;
7
+ exports.listAllFunctions = listAllFunctions;
8
+ exports.updateFunction = updateFunction;
9
+ exports.deleteFunction = deleteFunction;
10
+ exports.functionFromEndpoint = functionFromEndpoint;
11
+ exports.endpointFromFunction = endpointFromFunction;
4
12
  const apiv2_1 = require("../apiv2");
5
13
  const error_1 = require("../error");
6
14
  const api_1 = require("../api");
@@ -22,34 +30,33 @@ const client = new apiv2_1.Client({
22
30
  apiVersion: exports.API_VERSION,
23
31
  });
24
32
  function functionsOpLogReject(func, type, err) {
25
- var _a, _b, _c, _d, _e, _f, _g, _h;
26
- if ((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes("Runtime validation errors")) {
33
+ if (err?.message?.includes("Runtime validation errors")) {
27
34
  const capturedMessage = (0, cloudfunctions_1.captureRuntimeValidationError)(err.message);
28
35
  utils.logLabeledWarning("functions", capturedMessage + " for function " + func.name);
29
36
  }
30
- if ((_b = err === null || err === void 0 ? void 0 : err.message) === null || _b === void 0 ? void 0 : _b.includes("maxScale may not exceed")) {
37
+ if (err?.message?.includes("maxScale may not exceed")) {
31
38
  const maxInstances = func.serviceConfig.maxInstanceCount || DEFAULT_MAX_INSTANCE_COUNT;
32
39
  utils.logLabeledWarning("functions", `Your current project quotas don't allow for the current max instances setting of ${maxInstances}. ` +
33
40
  "Either reduce this function's maximum instances, or request a quota increase on the underlying Cloud Run service " +
34
41
  "at https://cloud.google.com/run/quotas.");
35
- const suggestedFix = ((_c = func.buildConfig.runtime) === null || _c === void 0 ? void 0 : _c.startsWith("python"))
42
+ const suggestedFix = func.buildConfig.runtime?.startsWith("python")
36
43
  ? "firebase_functions.options.set_global_options(max_instances=10)"
37
44
  : "setGlobalOptions({maxInstances: 10})";
38
45
  utils.logLabeledWarning("functions", `You can adjust the max instances value in your function's runtime options:\n\t${suggestedFix}`);
39
46
  }
40
47
  else {
41
- utils.logLabeledWarning("functions", `${err === null || err === void 0 ? void 0 : err.message}`);
42
- if (((_e = (_d = err === null || err === void 0 ? void 0 : err.context) === null || _d === void 0 ? void 0 : _d.response) === null || _e === void 0 ? void 0 : _e.statusCode) === 429) {
48
+ utils.logLabeledWarning("functions", `${err?.message}`);
49
+ if (err?.context?.response?.statusCode === 429) {
43
50
  utils.logLabeledWarning("functions", `Got "Quota Exceeded" error while trying to ${type} ${func.name}. Waiting to retry...`);
44
51
  }
45
- else if ((_f = err === null || err === void 0 ? void 0 : err.message) === null || _f === void 0 ? void 0 : _f.includes("If you recently started to use Eventarc, it may take a few minutes before all necessary permissions are propagated to the Service Agent")) {
52
+ else if (err?.message?.includes("If you recently started to use Eventarc, it may take a few minutes before all necessary permissions are propagated to the Service Agent")) {
46
53
  utils.logLabeledWarning("functions", `Since this is your first time using 2nd gen functions, we need a little bit longer to finish setting everything up. Retry the deployment in a few minutes.`);
47
54
  }
48
55
  utils.logLabeledWarning("functions", ` failed to ${type} function ${func.name}`);
49
56
  }
50
57
  throw new error_1.FirebaseError(`Failed to ${type} function ${func.name}`, {
51
58
  original: err,
52
- status: (_h = (_g = err === null || err === void 0 ? void 0 : err.context) === null || _g === void 0 ? void 0 : _g.response) === null || _h === void 0 ? void 0 : _h.statusCode,
59
+ status: err?.context?.response?.statusCode,
53
60
  context: { function: func.name },
54
61
  });
55
62
  }
@@ -63,12 +70,18 @@ async function generateUploadUrl(projectId, location) {
63
70
  throw err;
64
71
  }
65
72
  }
66
- exports.generateUploadUrl = generateUploadUrl;
67
73
  async function createFunction(cloudFunction) {
68
74
  const components = cloudFunction.name.split("/");
69
75
  const functionId = components.splice(-1, 1)[0];
70
- cloudFunction.buildConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.buildConfig.environmentVariables), { GOOGLE_NODE_RUN_SCRIPTS: "" });
71
- cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."), LOG_EXECUTION_ID: "true" });
76
+ cloudFunction.buildConfig.environmentVariables = {
77
+ ...cloudFunction.buildConfig.environmentVariables,
78
+ GOOGLE_NODE_RUN_SCRIPTS: "",
79
+ };
80
+ cloudFunction.serviceConfig.environmentVariables = {
81
+ ...cloudFunction.serviceConfig.environmentVariables,
82
+ FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."),
83
+ LOG_EXECUTION_ID: "true",
84
+ };
72
85
  try {
73
86
  const res = await client.post(components.join("/"), cloudFunction, { queryParams: { functionId } });
74
87
  return res.body;
@@ -77,17 +90,14 @@ async function createFunction(cloudFunction) {
77
90
  throw functionsOpLogReject(cloudFunction, "create", err);
78
91
  }
79
92
  }
80
- exports.createFunction = createFunction;
81
93
  async function getFunction(projectId, location, functionId) {
82
94
  const name = `projects/${projectId}/locations/${location}/functions/${functionId}`;
83
95
  const res = await client.get(name);
84
96
  return res.body;
85
97
  }
86
- exports.getFunction = getFunction;
87
98
  async function listAllFunctions(projectId) {
88
99
  return await listFunctionsInternal(projectId, "-");
89
100
  }
90
- exports.listAllFunctions = listAllFunctions;
91
101
  async function listFunctionsInternal(projectId, region) {
92
102
  const functions = [];
93
103
  const unreacahble = new Set();
@@ -96,7 +106,7 @@ async function listFunctionsInternal(projectId, region) {
96
106
  const url = `projects/${projectId}/locations/${region}/functions`;
97
107
  const opts = { queryParams: { filter: `environment="GEN_2"` } };
98
108
  if (pageToken !== "") {
99
- opts.queryParams = Object.assign(Object.assign({}, opts.queryParams), { pageToken });
109
+ opts.queryParams = { ...opts.queryParams, pageToken };
100
110
  }
101
111
  const res = await client.get(url, opts);
102
112
  functions.push(...(res.body.functions || []));
@@ -113,8 +123,15 @@ async function listFunctionsInternal(projectId, region) {
113
123
  }
114
124
  }
115
125
  async function updateFunction(cloudFunction) {
116
- cloudFunction.buildConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.buildConfig.environmentVariables), { GOOGLE_NODE_RUN_SCRIPTS: "" });
117
- cloudFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, cloudFunction.serviceConfig.environmentVariables), { FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."), LOG_EXECUTION_ID: "true" });
126
+ cloudFunction.buildConfig.environmentVariables = {
127
+ ...cloudFunction.buildConfig.environmentVariables,
128
+ GOOGLE_NODE_RUN_SCRIPTS: "",
129
+ };
130
+ cloudFunction.serviceConfig.environmentVariables = {
131
+ ...cloudFunction.serviceConfig.environmentVariables,
132
+ FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."),
133
+ LOG_EXECUTION_ID: "true",
134
+ };
118
135
  const fieldMasks = proto.fieldMasks(cloudFunction, "labels", "serviceConfig.environmentVariables", "serviceConfig.secretEnvironmentVariables", "buildConfig.environmentVariables");
119
136
  try {
120
137
  const queryParams = {
@@ -127,7 +144,6 @@ async function updateFunction(cloudFunction) {
127
144
  throw functionsOpLogReject(cloudFunction, "update", err);
128
145
  }
129
146
  }
130
- exports.updateFunction = updateFunction;
131
147
  async function deleteFunction(cloudFunction) {
132
148
  try {
133
149
  const res = await client.delete(cloudFunction);
@@ -137,9 +153,7 @@ async function deleteFunction(cloudFunction) {
137
153
  throw functionsOpLogReject({ name: cloudFunction }, "update", err);
138
154
  }
139
155
  }
140
- exports.deleteFunction = deleteFunction;
141
156
  function functionFromEndpoint(endpoint) {
142
- var _a, _b, _c;
143
157
  if (endpoint.platform !== "gcfv2") {
144
158
  throw new error_1.FirebaseError("Trying to create a v2 CloudFunction with v1 API. This should never happen");
145
159
  }
@@ -153,7 +167,7 @@ function functionFromEndpoint(endpoint) {
153
167
  runtime: endpoint.runtime || undefined,
154
168
  entryPoint: endpoint.entryPoint,
155
169
  source: {
156
- storageSource: (_a = endpoint.source) === null || _a === void 0 ? void 0 : _a.storageSource,
170
+ storageSource: endpoint.source?.storageSource,
157
171
  },
158
172
  environmentVariables: {},
159
173
  },
@@ -189,7 +203,7 @@ function functionFromEndpoint(endpoint) {
189
203
  gcfFunction.eventTrigger.serviceAccountEmail = gcfFunction.serviceConfig.serviceAccountEmail;
190
204
  }
191
205
  if (gcfFunction.eventTrigger.eventType === v2_1.PUBSUB_PUBLISH_EVENT) {
192
- if (!((_b = endpoint.eventTrigger.eventFilters) === null || _b === void 0 ? void 0 : _b.topic)) {
206
+ if (!endpoint.eventTrigger.eventFilters?.topic) {
193
207
  throw new error_1.FirebaseError("Error: Pub/Sub event trigger is missing topic: " +
194
208
  JSON.stringify(endpoint.eventTrigger, null, 2));
195
209
  }
@@ -219,56 +233,74 @@ function functionFromEndpoint(endpoint) {
219
233
  endpoint.eventTrigger.retry
220
234
  ? (gcfFunction.eventTrigger.retryPolicy = "RETRY_POLICY_RETRY")
221
235
  : (gcfFunction.eventTrigger.retryPolicy = "RETRY_POLICY_DO_NOT_RETRY");
222
- gcfFunction.serviceConfig.environmentVariables = Object.assign(Object.assign({}, gcfFunction.serviceConfig.environmentVariables), { FUNCTION_SIGNATURE_TYPE: "cloudevent" });
236
+ gcfFunction.serviceConfig.environmentVariables = {
237
+ ...gcfFunction.serviceConfig.environmentVariables,
238
+ FUNCTION_SIGNATURE_TYPE: "cloudevent",
239
+ };
223
240
  }
224
241
  else if (backend.isScheduleTriggered(endpoint)) {
225
- gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { "deployment-scheduled": "true" });
242
+ gcfFunction.labels = { ...gcfFunction.labels, "deployment-scheduled": "true" };
226
243
  }
227
244
  else if (backend.isTaskQueueTriggered(endpoint)) {
228
- gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { "deployment-taskqueue": "true" });
245
+ gcfFunction.labels = { ...gcfFunction.labels, "deployment-taskqueue": "true" };
229
246
  }
230
247
  else if (backend.isCallableTriggered(endpoint)) {
231
- gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { "deployment-callable": "true" });
248
+ gcfFunction.labels = { ...gcfFunction.labels, "deployment-callable": "true" };
232
249
  if (endpoint.callableTrigger.genkitAction) {
233
250
  gcfFunction.labels["genkit-action"] = "true";
234
251
  }
235
252
  }
253
+ else if (backend.isDataConnectGraphqlTriggered(endpoint)) {
254
+ gcfFunction.labels = { ...gcfFunction.labels, "deployment-fdcgraphql": "true" };
255
+ }
236
256
  else if (backend.isBlockingTriggered(endpoint)) {
237
- gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { [constants_1.BLOCKING_LABEL]: constants_1.BLOCKING_EVENT_TO_LABEL_KEY[endpoint.blockingTrigger.eventType] });
257
+ gcfFunction.labels = {
258
+ ...gcfFunction.labels,
259
+ [constants_1.BLOCKING_LABEL]: constants_1.BLOCKING_EVENT_TO_LABEL_KEY[endpoint.blockingTrigger.eventType],
260
+ };
238
261
  }
239
262
  const codebase = endpoint.codebase || projectConfig.DEFAULT_CODEBASE;
240
263
  if (codebase !== projectConfig.DEFAULT_CODEBASE) {
241
- gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { [constants_1.CODEBASE_LABEL]: codebase });
264
+ gcfFunction.labels = {
265
+ ...gcfFunction.labels,
266
+ [constants_1.CODEBASE_LABEL]: codebase,
267
+ };
242
268
  }
243
269
  else {
244
- (_c = gcfFunction.labels) === null || _c === void 0 ? true : delete _c[constants_1.CODEBASE_LABEL];
270
+ delete gcfFunction.labels?.[constants_1.CODEBASE_LABEL];
245
271
  }
246
272
  if (endpoint.hash) {
247
- gcfFunction.labels = Object.assign(Object.assign({}, gcfFunction.labels), { [constants_1.HASH_LABEL]: endpoint.hash });
273
+ gcfFunction.labels = {
274
+ ...gcfFunction.labels,
275
+ [constants_1.HASH_LABEL]: endpoint.hash,
276
+ };
248
277
  }
249
278
  return gcfFunction;
250
279
  }
251
- exports.functionFromEndpoint = functionFromEndpoint;
252
280
  function endpointFromFunction(gcfFunction) {
253
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
254
281
  const [, project, , region, , id] = gcfFunction.name.split("/");
255
282
  let trigger;
256
- if (((_a = gcfFunction.labels) === null || _a === void 0 ? void 0 : _a["deployment-scheduled"]) === "true") {
283
+ if (gcfFunction.labels?.["deployment-scheduled"] === "true") {
257
284
  trigger = {
258
285
  scheduleTrigger: {},
259
286
  };
260
287
  }
261
- else if (((_b = gcfFunction.labels) === null || _b === void 0 ? void 0 : _b["deployment-taskqueue"]) === "true") {
288
+ else if (gcfFunction.labels?.["deployment-taskqueue"] === "true") {
262
289
  trigger = {
263
290
  taskQueueTrigger: {},
264
291
  };
265
292
  }
266
- else if (((_c = gcfFunction.labels) === null || _c === void 0 ? void 0 : _c["deployment-callable"]) === "true") {
293
+ else if (gcfFunction.labels?.["deployment-callable"] === "true") {
267
294
  trigger = {
268
295
  callableTrigger: {},
269
296
  };
270
297
  }
271
- else if ((_d = gcfFunction.labels) === null || _d === void 0 ? void 0 : _d[constants_1.BLOCKING_LABEL]) {
298
+ else if (gcfFunction.labels?.["deployment-fdcgraphql"] === "true") {
299
+ trigger = {
300
+ dataConnectGraphqlTrigger: {},
301
+ };
302
+ }
303
+ else if (gcfFunction.labels?.[constants_1.BLOCKING_LABEL]) {
272
304
  trigger = {
273
305
  blockingTrigger: {
274
306
  eventType: constants_1.BLOCKING_LABEL_KEY_TO_EVENT[gcfFunction.labels[constants_1.BLOCKING_LABEL]],
@@ -310,12 +342,19 @@ function endpointFromFunction(gcfFunction) {
310
342
  else {
311
343
  trigger = { httpsTrigger: {} };
312
344
  }
313
- if (((_e = gcfFunction.buildConfig) === null || _e === void 0 ? void 0 : _e.runtime) && !supported.isRuntime(gcfFunction.buildConfig.runtime)) {
345
+ if (gcfFunction.buildConfig?.runtime && !supported.isRuntime(gcfFunction.buildConfig.runtime)) {
314
346
  logger_1.logger.debug("GCFv2 function has a deprecated runtime:", JSON.stringify(gcfFunction, null, 2));
315
347
  }
316
- const endpoint = Object.assign(Object.assign({ platform: "gcfv2", id,
348
+ const endpoint = {
349
+ platform: "gcfv2",
350
+ id,
317
351
  project,
318
- region }, trigger), { entryPoint: ((_f = gcfFunction.buildConfig) === null || _f === void 0 ? void 0 : _f.entryPoint) || "", runtime: ((_g = gcfFunction.buildConfig) === null || _g === void 0 ? void 0 : _g.runtime) || undefined, source: (_h = gcfFunction.buildConfig) === null || _h === void 0 ? void 0 : _h.source });
352
+ region,
353
+ ...trigger,
354
+ entryPoint: gcfFunction.buildConfig?.entryPoint || "",
355
+ runtime: gcfFunction.buildConfig?.runtime || undefined,
356
+ source: gcfFunction.buildConfig?.source,
357
+ };
319
358
  if (gcfFunction.serviceConfig) {
320
359
  proto.copyIfPresent(endpoint, gcfFunction.serviceConfig, "ingressSettings", "environmentVariables", "secretEnvironmentVariables", "timeoutSeconds", "uri");
321
360
  proto.renameIfPresent(endpoint, gcfFunction.serviceConfig, "serviceAccount", "serviceAccountEmail");
@@ -355,11 +394,10 @@ function endpointFromFunction(gcfFunction) {
355
394
  }
356
395
  }
357
396
  proto.renameIfPresent(endpoint, gcfFunction, "uri", "url");
358
- endpoint.codebase = ((_j = gcfFunction.labels) === null || _j === void 0 ? void 0 : _j[constants_1.CODEBASE_LABEL]) || projectConfig.DEFAULT_CODEBASE;
359
- if ((_k = gcfFunction.labels) === null || _k === void 0 ? void 0 : _k[constants_1.HASH_LABEL]) {
397
+ endpoint.codebase = gcfFunction.labels?.[constants_1.CODEBASE_LABEL] || projectConfig.DEFAULT_CODEBASE;
398
+ if (gcfFunction.labels?.[constants_1.HASH_LABEL]) {
360
399
  endpoint.hash = gcfFunction.labels[constants_1.HASH_LABEL];
361
400
  }
362
401
  proto.copyIfPresent(endpoint, gcfFunction, "state");
363
402
  return endpoint;
364
403
  }
365
- exports.endpointFromFunction = endpointFromFunction;
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listEntries = void 0;
3
+ exports.listEntries = listEntries;
4
4
  const api_1 = require("../api");
5
5
  const apiv2_1 = require("../apiv2");
6
6
  const error_1 = require("../error");
7
7
  const API_VERSION = "v2";
8
8
  async function listEntries(projectId, filter, pageSize, order, pageToken) {
9
- var _a;
10
9
  const client = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudloggingOrigin)(), apiVersion: API_VERSION });
11
10
  const body = {
12
11
  resourceNames: [`projects/${projectId}`],
@@ -20,7 +19,7 @@ async function listEntries(projectId, filter, pageSize, order, pageToken) {
20
19
  try {
21
20
  const result = await client.post("/entries:list", body);
22
21
  return {
23
- entries: (_a = result.body.entries) !== null && _a !== void 0 ? _a : [],
22
+ entries: result.body.entries ?? [],
24
23
  nextPageToken: result.body.nextPageToken,
25
24
  };
26
25
  }
@@ -30,4 +29,3 @@ async function listEntries(projectId, filter, pageSize, order, pageToken) {
30
29
  });
31
30
  }
32
31
  }
33
- exports.listEntries = listEntries;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.queryTimeSeries = exports.ValueType = exports.Reducer = exports.MetricKind = exports.Aligner = exports.TimeSeriesView = exports.CLOUD_MONITORING_VERSION = void 0;
3
+ exports.ValueType = exports.Reducer = exports.MetricKind = exports.Aligner = exports.TimeSeriesView = exports.CLOUD_MONITORING_VERSION = void 0;
4
+ exports.queryTimeSeries = queryTimeSeries;
4
5
  const api_1 = require("../api");
5
6
  const apiv2_1 = require("../apiv2");
6
7
  const error_1 = require("../error");
@@ -9,7 +10,7 @@ var TimeSeriesView;
9
10
  (function (TimeSeriesView) {
10
11
  TimeSeriesView["FULL"] = "FULL";
11
12
  TimeSeriesView["HEADERS"] = "HEADERS";
12
- })(TimeSeriesView = exports.TimeSeriesView || (exports.TimeSeriesView = {}));
13
+ })(TimeSeriesView || (exports.TimeSeriesView = TimeSeriesView = {}));
13
14
  var Aligner;
14
15
  (function (Aligner) {
15
16
  Aligner["ALIGN_NONE"] = "ALIGN_NONE";
@@ -25,14 +26,14 @@ var Aligner;
25
26
  Aligner["ALIGN_STDDEV"] = "ALIGN_STDDEV";
26
27
  Aligner["ALIGN_COUNT_TRUE"] = "ALIGN_COUNT_TRUE";
27
28
  Aligner["ALIGN_FRACTION_TRUE"] = "ALIGN_FRACTION_TRUE";
28
- })(Aligner = exports.Aligner || (exports.Aligner = {}));
29
+ })(Aligner || (exports.Aligner = Aligner = {}));
29
30
  var MetricKind;
30
31
  (function (MetricKind) {
31
32
  MetricKind["METRIC_KIND_UNSPECIFIED"] = "METRIC_KIND_UNSPECIFIED";
32
33
  MetricKind["GAUGE"] = "GAUGE";
33
34
  MetricKind["DELTA"] = "DELTA";
34
35
  MetricKind["CUMULATIVE"] = "CUMULATIVE";
35
- })(MetricKind = exports.MetricKind || (exports.MetricKind = {}));
36
+ })(MetricKind || (exports.MetricKind = MetricKind = {}));
36
37
  var Reducer;
37
38
  (function (Reducer) {
38
39
  Reducer["REDUCE_NONE"] = "REDUCE_NONE";
@@ -48,7 +49,7 @@ var Reducer;
48
49
  Reducer["REDUCE_PERCENTILE_95"] = "REDUCE_PERCENTILE_95";
49
50
  Reducer["REDUCE_PERCENTILE_50"] = "REDUCE_PERCENTILE_50";
50
51
  Reducer["REDUCE_PERCENTILE_05"] = "REDUCE_PERCENTILE_05";
51
- })(Reducer = exports.Reducer || (exports.Reducer = {}));
52
+ })(Reducer || (exports.Reducer = Reducer = {}));
52
53
  var ValueType;
53
54
  (function (ValueType) {
54
55
  ValueType["VALUE_TYPE_UNSPECIFIED"] = "VALUE_TYPE_UNSPECIFIED";
@@ -56,7 +57,7 @@ var ValueType;
56
57
  ValueType["INT64"] = "INT64";
57
58
  ValueType["DOUBLE"] = "DOUBLE";
58
59
  ValueType["STRING"] = "STRING";
59
- })(ValueType = exports.ValueType || (exports.ValueType = {}));
60
+ })(ValueType || (exports.ValueType = ValueType = {}));
60
61
  async function queryTimeSeries(query, project) {
61
62
  const client = new apiv2_1.Client({
62
63
  urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
@@ -74,4 +75,3 @@ async function queryTimeSeries(query, project) {
74
75
  });
75
76
  }
76
77
  }
77
- exports.queryTimeSeries = queryTimeSeries;
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jobFromEndpoint = exports.topicNameForEndpoint = exports.jobNameForEndpoint = exports.createOrReplaceJob = exports.getJob = exports.deleteJob = void 0;
3
+ exports.deleteJob = deleteJob;
4
+ exports.getJob = getJob;
5
+ exports.createOrReplaceJob = createOrReplaceJob;
6
+ exports.jobNameForEndpoint = jobNameForEndpoint;
7
+ exports.topicNameForEndpoint = topicNameForEndpoint;
8
+ exports.jobFromEndpoint = jobFromEndpoint;
4
9
  const _ = require("lodash");
5
10
  const error_1 = require("../error");
6
11
  const logger_1 = require("../logger");
@@ -18,29 +23,28 @@ const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudschedulerOrigin
18
23
  function createJob(job) {
19
24
  const strippedName = job.name.substring(0, job.name.lastIndexOf("/"));
20
25
  const json = job.pubsubTarget
21
- ? Object.assign({ timeZone: DEFAULT_TIME_ZONE_V1 }, job) : Object.assign({ timeZone: DEFAULT_TIME_ZONE_V2 }, job);
26
+ ? { timeZone: DEFAULT_TIME_ZONE_V1, ...job }
27
+ : { timeZone: DEFAULT_TIME_ZONE_V2, ...job };
22
28
  return apiClient.post(`/${strippedName}`, json);
23
29
  }
24
30
  function deleteJob(name) {
25
31
  return apiClient.delete(`/${name}`);
26
32
  }
27
- exports.deleteJob = deleteJob;
28
33
  function getJob(name) {
29
34
  return apiClient.get(`/${name}`, {
30
35
  resolveOnHTTPError: true,
31
36
  });
32
37
  }
33
- exports.getJob = getJob;
34
38
  function updateJob(job) {
35
39
  let fieldMasks;
36
40
  let json;
37
41
  if (job.pubsubTarget) {
38
42
  fieldMasks = proto.fieldMasks(job, "pubsubTarget");
39
- json = Object.assign({ timeZone: DEFAULT_TIME_ZONE_V1 }, job);
43
+ json = { timeZone: DEFAULT_TIME_ZONE_V1, ...job };
40
44
  }
41
45
  else {
42
46
  fieldMasks = proto.fieldMasks(job, "httpTarget");
43
- json = Object.assign({ timeZone: DEFAULT_TIME_ZONE_V2 }, job);
47
+ json = { timeZone: DEFAULT_TIME_ZONE_V2, ...job };
44
48
  }
45
49
  return apiClient.patch(`/${job.name}`, json, {
46
50
  queryParams: {
@@ -49,7 +53,6 @@ function updateJob(job) {
49
53
  });
50
54
  }
51
55
  async function createOrReplaceJob(job) {
52
- var _a, _b;
53
56
  const jobName = job.name.split("/").pop();
54
57
  const existingJob = await getJob(job.name);
55
58
  if (existingJob.status === 404) {
@@ -58,7 +61,7 @@ async function createOrReplaceJob(job) {
58
61
  newJob = await createJob(job);
59
62
  }
60
63
  catch (err) {
61
- if (((_b = (_a = err === null || err === void 0 ? void 0 : err.context) === null || _a === void 0 ? void 0 : _a.response) === null || _b === void 0 ? void 0 : _b.statusCode) === 404) {
64
+ if (err?.context?.response?.statusCode === 404) {
62
65
  throw new error_1.FirebaseError(`Cloud resource location is not set for this project but scheduled functions require it. ` +
63
66
  `Please see this documentation for more details: https://firebase.google.com/docs/projects/locations.`);
64
67
  }
@@ -78,7 +81,6 @@ async function createOrReplaceJob(job) {
78
81
  logger_1.logger.debug(`updated scheduler job ${jobName}`);
79
82
  return updatedJob;
80
83
  }
81
- exports.createOrReplaceJob = createOrReplaceJob;
82
84
  function needUpdate(existingJob, newJob) {
83
85
  if (!existingJob) {
84
86
  return true;
@@ -109,14 +111,11 @@ function jobNameForEndpoint(endpoint, location) {
109
111
  const id = backend.scheduleIdForFunction(endpoint);
110
112
  return `projects/${endpoint.project}/locations/${location}/jobs/${id}`;
111
113
  }
112
- exports.jobNameForEndpoint = jobNameForEndpoint;
113
114
  function topicNameForEndpoint(endpoint) {
114
115
  const id = backend.scheduleIdForFunction(endpoint);
115
116
  return `projects/${endpoint.project}/topics/${id}`;
116
117
  }
117
- exports.topicNameForEndpoint = topicNameForEndpoint;
118
118
  async function jobFromEndpoint(endpoint, location, projectNumber) {
119
- var _a;
120
119
  const job = {};
121
120
  job.name = jobNameForEndpoint(endpoint, location);
122
121
  if (endpoint.platform === "gcfv1") {
@@ -134,7 +133,7 @@ async function jobFromEndpoint(endpoint, location, projectNumber) {
134
133
  uri: endpoint.uri,
135
134
  httpMethod: "POST",
136
135
  oidcToken: {
137
- serviceAccountEmail: (_a = endpoint.serviceAccount) !== null && _a !== void 0 ? _a : (await gce.getDefaultServiceAccount(projectNumber)),
136
+ serviceAccountEmail: endpoint.serviceAccount ?? (await gce.getDefaultServiceAccount(projectNumber)),
138
137
  },
139
138
  };
140
139
  }
@@ -166,4 +165,3 @@ async function jobFromEndpoint(endpoint, location, projectNumber) {
166
165
  }
167
166
  return job;
168
167
  }
169
- exports.jobFromEndpoint = jobFromEndpoint;
@@ -1,6 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listUsers = exports.deleteUser = exports.getUser = exports.createUser = exports.deleteDatabase = exports.createDatabase = exports.getDatabase = exports.listDatabases = exports.updateInstanceForDataConnect = exports.createInstance = exports.DEFAULT_DATABASE_VERSION = exports.instanceConsoleLink = exports.getInstance = exports.listInstances = exports.iamUserIsCSQLAdmin = void 0;
3
+ exports.DEFAULT_DATABASE_VERSION = void 0;
4
+ exports.iamUserIsCSQLAdmin = iamUserIsCSQLAdmin;
5
+ exports.listInstances = listInstances;
6
+ exports.getInstance = getInstance;
7
+ exports.instanceConsoleLink = instanceConsoleLink;
8
+ exports.createInstance = createInstance;
9
+ exports.updateInstanceForDataConnect = updateInstanceForDataConnect;
10
+ exports.listDatabases = listDatabases;
11
+ exports.getDatabase = getDatabase;
12
+ exports.createDatabase = createDatabase;
13
+ exports.deleteDatabase = deleteDatabase;
14
+ exports.createUser = createUser;
15
+ exports.getUser = getUser;
16
+ exports.deleteUser = deleteUser;
17
+ exports.listUsers = listUsers;
4
18
  const apiv2_1 = require("../../apiv2");
5
19
  const api_1 = require("../../api");
6
20
  const clc = require("colorette");
@@ -32,13 +46,10 @@ async function iamUserIsCSQLAdmin(options) {
32
46
  return false;
33
47
  }
34
48
  }
35
- exports.iamUserIsCSQLAdmin = iamUserIsCSQLAdmin;
36
49
  async function listInstances(projectId) {
37
- var _a;
38
50
  const res = await client.get(`projects/${projectId}/instances`);
39
- return (_a = res.body.items) !== null && _a !== void 0 ? _a : [];
51
+ return res.body.items ?? [];
40
52
  }
41
- exports.listInstances = listInstances;
42
53
  async function getInstance(projectId, instanceId) {
43
54
  const res = await client.get(`projects/${projectId}/instances/${instanceId}`);
44
55
  if (res.body.state === "FAILED") {
@@ -46,11 +57,9 @@ async function getInstance(projectId, instanceId) {
46
57
  }
47
58
  return res.body;
48
59
  }
49
- exports.getInstance = getInstance;
50
60
  function instanceConsoleLink(projectId, instanceId) {
51
61
  return `https://console.cloud.google.com/sql/instances/${instanceId}/overview?project=${projectId}`;
52
62
  }
53
- exports.instanceConsoleLink = instanceConsoleLink;
54
63
  exports.DEFAULT_DATABASE_VERSION = "POSTGRES_17";
55
64
  async function createInstance(args) {
56
65
  const databaseFlags = [{ name: "cloudsql.iam_authentication", value: "on" }];
@@ -86,9 +95,7 @@ async function createInstance(args) {
86
95
  throw err;
87
96
  }
88
97
  }
89
- exports.createInstance = createInstance;
90
98
  async function updateInstanceForDataConnect(instance, enableGoogleMlIntegration) {
91
- var _a, _b;
92
99
  let dbFlags = setDatabaseFlag({ name: "cloudsql.iam_authentication", value: "on" }, instance.settings.databaseFlags);
93
100
  if (enableGoogleMlIntegration) {
94
101
  dbFlags = setDatabaseFlag({ name: "cloudsql.enable_google_ml_integration", value: "on" }, dbFlags);
@@ -96,7 +103,7 @@ async function updateInstanceForDataConnect(instance, enableGoogleMlIntegration)
96
103
  const op = await client.patch(`projects/${instance.project}/instances/${instance.name}`, {
97
104
  settings: {
98
105
  ipConfiguration: {
99
- enablePrivatePathForGoogleCloudServices: !!((_b = (_a = instance === null || instance === void 0 ? void 0 : instance.settings) === null || _a === void 0 ? void 0 : _a.ipConfiguration) === null || _b === void 0 ? void 0 : _b.privateNetwork),
106
+ enablePrivatePathForGoogleCloudServices: !!instance?.settings?.ipConfiguration?.privateNetwork,
100
107
  },
101
108
  databaseFlags: dbFlags,
102
109
  enableGoogleMlIntegration,
@@ -112,7 +119,6 @@ async function updateInstanceForDataConnect(instance, enableGoogleMlIntegration)
112
119
  });
113
120
  return pollRes;
114
121
  }
115
- exports.updateInstanceForDataConnect = updateInstanceForDataConnect;
116
122
  function handleAllowlistError(err, region) {
117
123
  if (err.message.includes("Not allowed to set system label: firebase-data-connect")) {
118
124
  throw new error_1.FirebaseError(`Cloud SQL free trial instances are not yet available in ${region}. Please check https://firebase.google.com/docs/data-connect/ for a full list of available regions.`);
@@ -127,12 +133,10 @@ async function listDatabases(projectId, instanceId) {
127
133
  const res = await client.get(`projects/${projectId}/instances/${instanceId}/databases`);
128
134
  return res.body.items;
129
135
  }
130
- exports.listDatabases = listDatabases;
131
136
  async function getDatabase(projectId, instanceId, databaseId) {
132
137
  const res = await client.get(`projects/${projectId}/instances/${instanceId}/databases/${databaseId}`);
133
138
  return res.body;
134
139
  }
135
- exports.getDatabase = getDatabase;
136
140
  async function createDatabase(projectId, instanceId, databaseId) {
137
141
  const op = await client.post(`projects/${projectId}/instances/${instanceId}/databases`, {
138
142
  project: projectId,
@@ -148,12 +152,10 @@ async function createDatabase(projectId, instanceId, databaseId) {
148
152
  });
149
153
  return pollRes;
150
154
  }
151
- exports.createDatabase = createDatabase;
152
155
  async function deleteDatabase(projectId, instanceId, databaseId) {
153
156
  const res = await client.delete(`projects/${projectId}/instances/${instanceId}/databases/${databaseId}`);
154
157
  return res.body;
155
158
  }
156
- exports.deleteDatabase = deleteDatabase;
157
159
  async function createUser(projectId, instanceId, type, username, password, retryTimeout) {
158
160
  const maxRetries = 3;
159
161
  let retries = 0;
@@ -183,7 +185,7 @@ async function createUser(projectId, instanceId, type, username, password, retry
183
185
  if (builtinRoleNotReady(err.message) && retries < maxRetries) {
184
186
  retries++;
185
187
  await new Promise((resolve) => {
186
- setTimeout(resolve, retryTimeout !== null && retryTimeout !== void 0 ? retryTimeout : 1000 * retries);
188
+ setTimeout(resolve, retryTimeout ?? 1000 * retries);
187
189
  });
188
190
  }
189
191
  else {
@@ -192,7 +194,6 @@ async function createUser(projectId, instanceId, type, username, password, retry
192
194
  }
193
195
  }
194
196
  }
195
- exports.createUser = createUser;
196
197
  function builtinRoleNotReady(message) {
197
198
  return message.includes("cloudsqliamuser");
198
199
  }
@@ -200,7 +201,6 @@ async function getUser(projectId, instanceId, username) {
200
201
  const res = await client.get(`projects/${projectId}/instances/${instanceId}/users/${username}`);
201
202
  return res.body;
202
203
  }
203
- exports.getUser = getUser;
204
204
  async function deleteUser(projectId, instanceId, username) {
205
205
  const res = await client.delete(`projects/${projectId}/instances/${instanceId}/users`, {
206
206
  queryParams: {
@@ -209,9 +209,7 @@ async function deleteUser(projectId, instanceId, username) {
209
209
  });
210
210
  return res.body;
211
211
  }
212
- exports.deleteUser = deleteUser;
213
212
  async function listUsers(projectId, instanceId) {
214
213
  const res = await client.get(`projects/${projectId}/instances/${instanceId}/users`);
215
214
  return res.body.items;
216
215
  }
217
- exports.listUsers = listUsers;