firebase-tools-with-isolate 13.29.1 → 14.10.1-1

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 (396) hide show
  1. package/README.md +53 -4
  2. package/lib/api.js +10 -2
  3. package/lib/appdistribution/client.js +2 -2
  4. package/lib/apphosting/backend.js +157 -55
  5. package/lib/apphosting/config.js +121 -101
  6. package/lib/apphosting/githubConnections.js +65 -100
  7. package/lib/apphosting/repo.js +22 -36
  8. package/lib/apphosting/rollout.js +5 -11
  9. package/lib/apphosting/secrets/dialogs.js +13 -11
  10. package/lib/apphosting/secrets/index.js +47 -5
  11. package/lib/apphosting/utils.js +1 -3
  12. package/lib/apphosting/yaml.js +35 -49
  13. package/lib/auth.js +23 -6
  14. package/lib/bin/cli.js +99 -0
  15. package/lib/bin/firebase.js +7 -123
  16. package/lib/bin/mcp.js +49 -0
  17. package/lib/checkValidTargetFilters.js +1 -0
  18. package/lib/command.js +3 -2
  19. package/lib/commands/appdistribution-distribute.js +1 -1
  20. package/lib/commands/appdistribution-groups-create.js +1 -1
  21. package/lib/commands/appdistribution-groups-delete.js +1 -1
  22. package/lib/commands/appdistribution-groups-list.js +2 -2
  23. package/lib/commands/appdistribution-testers-add.js +1 -1
  24. package/lib/commands/appdistribution-testers-list.js +3 -3
  25. package/lib/commands/appdistribution-testers-remove.js +1 -1
  26. package/lib/commands/apphosting-backends-create.js +3 -3
  27. package/lib/commands/apphosting-backends-delete.js +23 -27
  28. package/lib/commands/apphosting-backends-get.js +12 -12
  29. package/lib/commands/apphosting-backends-list.js +5 -5
  30. package/lib/commands/apphosting-builds-create.js +8 -2
  31. package/lib/commands/apphosting-builds-get.js +8 -1
  32. package/lib/commands/apphosting-rollouts-create.js +3 -3
  33. package/lib/commands/apphosting-rollouts-list.js +8 -2
  34. package/lib/commands/apphosting-secrets-access.js +1 -1
  35. package/lib/commands/apphosting-secrets-describe.js +2 -2
  36. package/lib/commands/apphosting-secrets-grantaccess.js +20 -10
  37. package/lib/commands/apphosting-secrets-set.js +27 -1
  38. package/lib/commands/apps-android-sha-create.js +1 -1
  39. package/lib/commands/apps-android-sha-delete.js +1 -1
  40. package/lib/commands/apps-android-sha-list.js +2 -2
  41. package/lib/commands/apps-create.js +4 -108
  42. package/lib/commands/apps-init.js +94 -0
  43. package/lib/commands/apps-list.js +1 -1
  44. package/lib/commands/apps-sdkconfig.js +5 -10
  45. package/lib/commands/auth-export.js +1 -1
  46. package/lib/commands/auth-import.js +1 -1
  47. package/lib/commands/database-import.js +4 -6
  48. package/lib/commands/database-instances-create.js +1 -1
  49. package/lib/commands/database-instances-list.js +1 -1
  50. package/lib/commands/database-profile.js +1 -2
  51. package/lib/commands/database-remove.js +4 -6
  52. package/lib/commands/database-set.js +6 -6
  53. package/lib/commands/database-settings-set.js +1 -1
  54. package/lib/commands/database-update.js +6 -6
  55. package/lib/commands/dataconnect-sdk-generate.js +5 -2
  56. package/lib/commands/dataconnect-services-list.js +2 -2
  57. package/lib/commands/dataconnect-sql-diff.js +2 -2
  58. package/lib/commands/dataconnect-sql-grant.js +3 -3
  59. package/lib/commands/dataconnect-sql-migrate.js +2 -2
  60. package/lib/commands/dataconnect-sql-setup.js +39 -0
  61. package/lib/commands/dataconnect-sql-shell.js +5 -7
  62. package/lib/commands/deploy.js +4 -3
  63. package/lib/commands/emulators-exec.js +1 -1
  64. package/lib/commands/emulators-start.js +4 -3
  65. package/lib/commands/experiments-list.js +1 -1
  66. package/lib/commands/ext-dev-deprecate.js +1 -0
  67. package/lib/commands/ext-dev-init.js +3 -12
  68. package/lib/commands/ext-dev-list.js +1 -1
  69. package/lib/commands/ext-dev-register.js +3 -5
  70. package/lib/commands/ext-dev-undeprecate.js +1 -2
  71. package/lib/commands/ext-dev-usage.js +4 -6
  72. package/lib/commands/ext-export.js +1 -2
  73. package/lib/commands/ext-install.js +3 -3
  74. package/lib/commands/ext-sdk-install.js +1 -0
  75. package/lib/commands/ext-update.js +1 -0
  76. package/lib/commands/firestore-backups-delete.js +3 -4
  77. package/lib/commands/firestore-backups-get.js +1 -1
  78. package/lib/commands/firestore-backups-list.js +2 -2
  79. package/lib/commands/firestore-backups-schedules-create.js +4 -4
  80. package/lib/commands/firestore-backups-schedules-delete.js +3 -4
  81. package/lib/commands/firestore-backups-schedules-list.js +2 -2
  82. package/lib/commands/firestore-backups-schedules-update.js +1 -1
  83. package/lib/commands/firestore-databases-create.js +6 -6
  84. package/lib/commands/firestore-databases-delete.js +3 -7
  85. package/lib/commands/firestore-databases-get.js +1 -1
  86. package/lib/commands/firestore-databases-list.js +1 -1
  87. package/lib/commands/firestore-databases-restore.js +5 -5
  88. package/lib/commands/firestore-databases-update.js +4 -4
  89. package/lib/commands/firestore-delete.js +13 -14
  90. package/lib/commands/firestore-indexes-list.js +4 -4
  91. package/lib/commands/firestore-locations.js +1 -1
  92. package/lib/commands/functions-artifacts-setpolicy.js +132 -0
  93. package/lib/commands/functions-config-export.js +6 -10
  94. package/lib/commands/functions-delete.js +5 -7
  95. package/lib/commands/functions-deletegcfartifacts.js +5 -5
  96. package/lib/commands/functions-list.js +24 -33
  97. package/lib/commands/functions-secrets-access.js +1 -1
  98. package/lib/commands/functions-secrets-describe.js +1 -1
  99. package/lib/commands/functions-secrets-destroy.js +10 -12
  100. package/lib/commands/functions-secrets-get.js +1 -1
  101. package/lib/commands/functions-secrets-prune.js +14 -15
  102. package/lib/commands/functions-secrets-set.js +14 -18
  103. package/lib/commands/hosting-channel-create.js +1 -2
  104. package/lib/commands/hosting-channel-delete.js +4 -4
  105. package/lib/commands/hosting-channel-list.js +1 -1
  106. package/lib/commands/hosting-channel-open.js +2 -3
  107. package/lib/commands/hosting-disable.js +5 -5
  108. package/lib/commands/hosting-sites-delete.js +4 -4
  109. package/lib/commands/hosting-sites-get.js +1 -1
  110. package/lib/commands/hosting-sites-list.js +1 -1
  111. package/lib/commands/index.js +7 -4
  112. package/lib/commands/init.js +54 -60
  113. package/lib/commands/internaltesting-frameworks-compose.js +1 -1
  114. package/lib/commands/login-use.js +2 -11
  115. package/lib/commands/login.js +10 -8
  116. package/lib/commands/logout.js +2 -3
  117. package/lib/commands/mcp.js +11 -0
  118. package/lib/commands/open.js +4 -2
  119. package/lib/commands/projects-create.js +1 -2
  120. package/lib/commands/projects-list.js +1 -1
  121. package/lib/commands/remoteconfig-get.js +1 -1
  122. package/lib/commands/remoteconfig-rollback.js +5 -5
  123. package/lib/commands/remoteconfig-versions-list.js +2 -2
  124. package/lib/commands/setup-emulators-database.js +1 -1
  125. package/lib/commands/setup-emulators-dataconnect.js +1 -1
  126. package/lib/commands/setup-emulators-firestore.js +1 -1
  127. package/lib/commands/setup-emulators-pubsub.js +1 -1
  128. package/lib/commands/setup-emulators-storage.js +1 -1
  129. package/lib/commands/setup-emulators-ui.js +1 -1
  130. package/lib/commands/use.js +115 -111
  131. package/lib/config.js +49 -33
  132. package/lib/crashlytics/buildToolsJarHelper.js +1 -1
  133. package/lib/crashlytics/listTopIssues.js +45 -0
  134. package/lib/dataconnect/build.js +61 -4
  135. package/lib/dataconnect/client.js +26 -17
  136. package/lib/dataconnect/cloudAICompanionClient.js +72 -0
  137. package/lib/dataconnect/dataplaneClient.js +19 -2
  138. package/lib/dataconnect/ensureApis.js +6 -3
  139. package/lib/dataconnect/fileUtils.js +39 -6
  140. package/lib/dataconnect/freeTrial.js +21 -9
  141. package/lib/dataconnect/graphqlError.js +56 -2
  142. package/lib/dataconnect/provisionCloudSql.js +23 -12
  143. package/lib/dataconnect/schemaMigration.js +46 -26
  144. package/lib/dataconnect/types.js +5 -1
  145. package/lib/defaultCredentials.js +12 -1
  146. package/lib/deploy/apphosting/args.js +2 -0
  147. package/lib/deploy/apphosting/deploy.js +77 -0
  148. package/lib/deploy/apphosting/index.js +9 -0
  149. package/lib/deploy/apphosting/prepare.js +138 -0
  150. package/lib/deploy/apphosting/release.js +56 -0
  151. package/lib/deploy/apphosting/util.js +65 -0
  152. package/lib/deploy/dataconnect/deploy.js +14 -7
  153. package/lib/deploy/dataconnect/prepare.js +3 -5
  154. package/lib/deploy/extensions/v2FunctionHelper.js +2 -1
  155. package/lib/deploy/firestore/deploy.js +50 -4
  156. package/lib/deploy/functions/build.js +1 -0
  157. package/lib/deploy/functions/checkIam.js +41 -6
  158. package/lib/deploy/functions/containerCleaner.js +17 -2
  159. package/lib/deploy/functions/ensure.js +2 -1
  160. package/lib/deploy/functions/params.js +10 -17
  161. package/lib/deploy/functions/prepare.js +51 -18
  162. package/lib/deploy/functions/prepareFunctionsUpload.js +9 -5
  163. package/lib/deploy/functions/prompts.js +24 -17
  164. package/lib/deploy/functions/release/fabricator.js +4 -4
  165. package/lib/deploy/functions/release/index.js +27 -9
  166. package/lib/deploy/functions/release/planner.js +1 -0
  167. package/lib/deploy/functions/runtimes/discovery/index.js +13 -5
  168. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +4 -4
  169. package/lib/deploy/functions/runtimes/python/index.js +4 -1
  170. package/lib/deploy/functions/runtimes/supported/types.js +17 -11
  171. package/lib/deploy/functions/services/firestore.js +23 -4
  172. package/lib/deploy/index.js +29 -10
  173. package/lib/deploy/lifecycleHooks.js +6 -12
  174. package/lib/emulator/ExpressBasedEmulator.js +1 -1
  175. package/lib/emulator/apphosting/config.js +15 -14
  176. package/lib/emulator/apphosting/index.js +2 -0
  177. package/lib/emulator/apphosting/serve.js +147 -10
  178. package/lib/emulator/auth/cloudFunctions.js +13 -1
  179. package/lib/emulator/auth/operations.js +2 -1
  180. package/lib/emulator/auth/widget_ui.js +2 -1
  181. package/lib/emulator/commandUtils.js +14 -20
  182. package/lib/emulator/constants.js +2 -0
  183. package/lib/emulator/controller.js +24 -9
  184. package/lib/emulator/dataconnect/pgliteServer.js +136 -45
  185. package/lib/emulator/dataconnectEmulator.js +34 -6
  186. package/lib/emulator/dataconnectToolkitController.js +5 -0
  187. package/lib/emulator/downloadableEmulatorInfo.json +81 -0
  188. package/lib/emulator/downloadableEmulators.js +28 -80
  189. package/lib/emulator/env.js +47 -1
  190. package/lib/emulator/extensionsEmulator.js +5 -3
  191. package/lib/emulator/functionsEmulator.js +6 -26
  192. package/lib/emulator/hub.js +5 -4
  193. package/lib/emulator/hubClient.js +5 -0
  194. package/lib/emulator/initEmulators.js +29 -15
  195. package/lib/emulator/ui.js +4 -8
  196. package/lib/ensureApiEnabled.js +32 -1
  197. package/lib/experiments.js +11 -12
  198. package/lib/extensions/askUserForEventsConfig.js +6 -15
  199. package/lib/extensions/askUserForParam.js +23 -52
  200. package/lib/extensions/change-log.js +1 -25
  201. package/lib/extensions/checkProjectBilling.js +3 -9
  202. package/lib/extensions/diagnose.js +3 -6
  203. package/lib/extensions/emulator/triggerHelper.js +4 -0
  204. package/lib/extensions/extensionsHelper.js +25 -31
  205. package/lib/extensions/listExtensions.js +1 -1
  206. package/lib/extensions/manifest.js +3 -7
  207. package/lib/extensions/paramHelper.js +11 -2
  208. package/lib/extensions/provisioningHelper.js +1 -1
  209. package/lib/extensions/tos.js +4 -2
  210. package/lib/extensions/utils.js +1 -10
  211. package/lib/firebaseConfigValidate.js +7 -5
  212. package/lib/firestore/delete.js +5 -4
  213. package/lib/firestore/pretty-print.js +1 -1
  214. package/lib/frameworks/angular/index.js +11 -6
  215. package/lib/frameworks/angular/utils.js +76 -47
  216. package/lib/frameworks/constants.js +1 -1
  217. package/lib/frameworks/index.js +6 -4
  218. package/lib/frameworks/next/index.js +7 -4
  219. package/lib/frameworks/utils.js +11 -3
  220. package/lib/frameworks/vite/index.js +2 -3
  221. package/lib/fsAsync.js +9 -2
  222. package/lib/fsutils.js +16 -1
  223. package/lib/functions/artifacts.js +196 -0
  224. package/lib/functions/secrets.js +15 -16
  225. package/lib/gcp/apphosting.js +13 -1
  226. package/lib/gcp/artifactregistry.js +27 -2
  227. package/lib/gcp/auth.js +113 -1
  228. package/lib/gcp/cloudbilling.js +12 -1
  229. package/lib/gcp/cloudfunctions.js +32 -4
  230. package/lib/gcp/cloudfunctionsv2.js +15 -9
  231. package/lib/gcp/cloudscheduler.js +2 -2
  232. package/lib/gcp/cloudsql/cloudsqladmin.js +32 -11
  233. package/lib/gcp/cloudsql/connect.js +21 -14
  234. package/lib/gcp/cloudsql/interactive.js +1 -1
  235. package/lib/gcp/cloudsql/permissions.js +46 -99
  236. package/lib/gcp/cloudsql/permissionsSetup.js +224 -0
  237. package/lib/gcp/computeEngine.js +19 -2
  238. package/lib/gcp/devConnect.js +6 -1
  239. package/lib/gcp/firestore.js +55 -16
  240. package/lib/gcp/iam.js +1 -5
  241. package/lib/gcp/proto.js +4 -3
  242. package/lib/gcp/run.js +18 -1
  243. package/lib/gcp/serviceusage.js +2 -1
  244. package/lib/gcp/storage.js +47 -1
  245. package/lib/gemini/fdcExperience.js +56 -0
  246. package/lib/gemini/types.js +2 -0
  247. package/lib/hosting/api.js +4 -0
  248. package/lib/hosting/implicitInit.js +7 -3
  249. package/lib/hosting/interactive.js +2 -3
  250. package/lib/index.js +1 -2
  251. package/lib/init/features/account.js +2 -4
  252. package/lib/init/features/apphosting.js +75 -6
  253. package/lib/init/features/database.js +63 -62
  254. package/lib/init/features/dataconnect/index.js +131 -85
  255. package/lib/init/features/dataconnect/sdk.js +73 -18
  256. package/lib/init/features/emulators.js +29 -46
  257. package/lib/init/features/firestore/index.js +79 -43
  258. package/lib/init/features/firestore/indexes.js +30 -45
  259. package/lib/init/features/firestore/rules.js +36 -62
  260. package/lib/init/features/functions/index.js +11 -16
  261. package/lib/init/features/functions/javascript.js +17 -30
  262. package/lib/init/features/functions/npm-dependencies.js +4 -8
  263. package/lib/init/features/functions/python.js +1 -3
  264. package/lib/init/features/functions/typescript.js +25 -43
  265. package/lib/init/features/genkit/index.js +111 -106
  266. package/lib/init/features/hosting/github.js +22 -52
  267. package/lib/init/features/hosting/index.js +37 -57
  268. package/lib/init/features/index.js +10 -5
  269. package/lib/init/features/project.js +18 -21
  270. package/lib/init/features/remoteconfig.js +5 -10
  271. package/lib/init/features/storage.js +30 -10
  272. package/lib/init/index.js +79 -24
  273. package/lib/logger.js +76 -3
  274. package/lib/management/apps.js +292 -7
  275. package/lib/management/projects.js +100 -52
  276. package/lib/mcp/errors.js +20 -0
  277. package/lib/mcp/index.js +227 -0
  278. package/lib/mcp/tool.js +12 -0
  279. package/lib/mcp/tools/apphosting/fetch_logs.js +68 -0
  280. package/lib/mcp/tools/apphosting/index.js +6 -0
  281. package/lib/mcp/tools/apphosting/list_backends.js +51 -0
  282. package/lib/mcp/tools/auth/disable_user.js +30 -0
  283. package/lib/mcp/tools/auth/get_user.js +38 -0
  284. package/lib/mcp/tools/auth/index.js +15 -0
  285. package/lib/mcp/tools/auth/list_users.js +36 -0
  286. package/lib/mcp/tools/auth/set_claims.js +43 -0
  287. package/lib/mcp/tools/auth/set_sms_region_policy.js +36 -0
  288. package/lib/mcp/tools/core/consult_assistant.js +28 -0
  289. package/lib/mcp/tools/core/create_android_sha.js +43 -0
  290. package/lib/mcp/tools/core/create_app.js +90 -0
  291. package/lib/mcp/tools/core/create_project.js +68 -0
  292. package/lib/mcp/tools/core/get_admin_sdk_config.js +26 -0
  293. package/lib/mcp/tools/core/get_environment.js +51 -0
  294. package/lib/mcp/tools/core/get_project.js +22 -0
  295. package/lib/mcp/tools/core/get_sdk_config.js +40 -0
  296. package/lib/mcp/tools/core/index.js +29 -0
  297. package/lib/mcp/tools/core/init.js +153 -0
  298. package/lib/mcp/tools/core/list_apps.js +34 -0
  299. package/lib/mcp/tools/core/list_projects.js +45 -0
  300. package/lib/mcp/tools/core/update_environment.js +55 -0
  301. package/lib/mcp/tools/crashlytics/index.js +5 -0
  302. package/lib/mcp/tools/crashlytics/list_top_issues.js +39 -0
  303. package/lib/mcp/tools/dataconnect/converter.js +60 -0
  304. package/lib/mcp/tools/dataconnect/emulator.js +16 -0
  305. package/lib/mcp/tools/dataconnect/execute_graphql.js +48 -0
  306. package/lib/mcp/tools/dataconnect/execute_graphql_read.js +48 -0
  307. package/lib/mcp/tools/dataconnect/execute_mutation.js +62 -0
  308. package/lib/mcp/tools/dataconnect/execute_query.js +62 -0
  309. package/lib/mcp/tools/dataconnect/generate_operation.js +34 -0
  310. package/lib/mcp/tools/dataconnect/generate_schema.js +26 -0
  311. package/lib/mcp/tools/dataconnect/get_connector.js +31 -0
  312. package/lib/mcp/tools/dataconnect/get_schema.js +31 -0
  313. package/lib/mcp/tools/dataconnect/index.js +23 -0
  314. package/lib/mcp/tools/dataconnect/list_services.js +23 -0
  315. package/lib/mcp/tools/firestore/converter.js +102 -0
  316. package/lib/mcp/tools/firestore/delete_document.js +50 -0
  317. package/lib/mcp/tools/firestore/get_documents.js +58 -0
  318. package/lib/mcp/tools/firestore/index.js +17 -0
  319. package/lib/mcp/tools/firestore/list_collections.js +36 -0
  320. package/lib/mcp/tools/firestore/query_collection.js +132 -0
  321. package/lib/mcp/tools/index.js +62 -0
  322. package/lib/mcp/tools/messaging/index.js +5 -0
  323. package/lib/mcp/tools/messaging/send_message.js +42 -0
  324. package/lib/mcp/tools/remoteconfig/get_template.js +27 -0
  325. package/lib/mcp/tools/remoteconfig/index.js +7 -0
  326. package/lib/mcp/tools/remoteconfig/publish_template.js +34 -0
  327. package/lib/mcp/tools/remoteconfig/rollback_template.js +29 -0
  328. package/lib/mcp/tools/rules/get_rules.js +29 -0
  329. package/lib/mcp/tools/rules/validate_rules.js +97 -0
  330. package/lib/mcp/tools/storage/get_download_url.js +40 -0
  331. package/lib/mcp/tools/storage/get_rules.js +26 -0
  332. package/lib/mcp/tools/storage/index.js +11 -0
  333. package/lib/mcp/types.js +13 -0
  334. package/lib/mcp/util.js +214 -0
  335. package/lib/mcp/util.test.js +468 -0
  336. package/lib/messaging/interfaces.js +2 -0
  337. package/lib/messaging/sendMessage.js +48 -0
  338. package/lib/operation-poller.js +3 -1
  339. package/lib/profileReport.js +1 -1
  340. package/lib/prompt.js +86 -54
  341. package/lib/remoteconfig/publish.js +39 -0
  342. package/lib/requireAuth.js +2 -2
  343. package/lib/requireTosAcceptance.js +4 -0
  344. package/lib/rulesDeploy.js +10 -15
  345. package/lib/track.js +7 -37
  346. package/lib/utils.js +28 -41
  347. package/lib/vsCodeUtils.js +7 -3
  348. package/package.json +31 -15
  349. package/schema/connector-yaml.json +12 -0
  350. package/schema/dataconnect-yaml.json +5 -0
  351. package/schema/extension-yaml.json +17 -4
  352. package/schema/firebase-config.json +1117 -2121
  353. package/standalone/package-lock.json +1255 -992
  354. package/standalone/package.json +1 -1
  355. package/templates/dataconnect-prompts/operation-generation-cursor-windsurf-rule.txt +273 -0
  356. package/templates/dataconnect-prompts/schema-generation-cursor-windsurf-rule.txt +653 -0
  357. package/templates/genkit/firebase.0.9.0.template +1 -1
  358. package/templates/genkit/firebase.1.0.0.template +71 -0
  359. package/templates/init/dataconnect/connector.yaml +4 -1
  360. package/templates/init/dataconnect/dataconnect.yaml +1 -1
  361. package/templates/init/dataconnect/mutations.gql +9 -26
  362. package/templates/init/dataconnect/queries.gql +9 -14
  363. package/templates/init/dataconnect/schema.gql +28 -21
  364. package/templates/init/firestore/firestore.rules +2 -0
  365. package/templates/init/functions/javascript/index.js +14 -1
  366. package/templates/init/functions/javascript/package.lint.json +1 -1
  367. package/templates/init/functions/javascript/package.nolint.json +1 -1
  368. package/templates/init/functions/python/_gitignore +6 -1
  369. package/templates/init/functions/python/main.py +8 -0
  370. package/templates/init/functions/typescript/index.ts +14 -1
  371. package/templates/init/functions/typescript/package.lint.json +2 -2
  372. package/templates/init/functions/typescript/package.nolint.json +3 -3
  373. package/lib/commands/apphosting-config-export.js +0 -28
  374. package/lib/commands/experimental-functions-shell.js +0 -13
  375. package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +0 -11
  376. package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +0 -58
  377. package/lib/emulator/dataconnect/pg-gateway/auth/index.js +0 -22
  378. package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +0 -124
  379. package/lib/emulator/dataconnect/pg-gateway/auth/password.js +0 -54
  380. package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +0 -34
  381. package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +0 -270
  382. package/lib/emulator/dataconnect/pg-gateway/backend-error.js +0 -75
  383. package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +0 -54
  384. package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +0 -79
  385. package/lib/emulator/dataconnect/pg-gateway/connection.js +0 -315
  386. package/lib/emulator/dataconnect/pg-gateway/connection.types.js +0 -8
  387. package/lib/emulator/dataconnect/pg-gateway/crypto.js +0 -40
  388. package/lib/emulator/dataconnect/pg-gateway/duplex.js +0 -53
  389. package/lib/emulator/dataconnect/pg-gateway/index.js +0 -27
  390. package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +0 -82
  391. package/lib/emulator/dataconnect/pg-gateway/message-codes.js +0 -52
  392. package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +0 -16
  393. package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +0 -35
  394. package/lib/emulator/dataconnect/pg-gateway/utils.js +0 -40
  395. package/templates/setup/web.js +0 -5
  396. /package/lib/{emulator/dataconnect/pg-gateway/auth/trust.js → dataconnect/cloudAICompanionTypes.js} +0 -0
package/lib/bin/mcp.js ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.mcp = void 0;
5
+ const logger_1 = require("../logger");
6
+ const index_1 = require("../mcp/index");
7
+ const util_1 = require("util");
8
+ const types_1 = require("../mcp/types");
9
+ const index_js_1 = require("../mcp/tools/index.js");
10
+ const path_1 = require("path");
11
+ const STARTUP_MESSAGE = `
12
+ This is a running process of the Firebase MCP server. This command should only be executed by an MCP client. An example MCP client configuration might be:
13
+
14
+ {
15
+ "mcpServers": {
16
+ "firebase": {
17
+ "command": "firebase",
18
+ "args": ["experimental:mcp", "--dir", "/path/to/firebase/project"]
19
+ }
20
+ }
21
+ }
22
+ `;
23
+ async function mcp() {
24
+ const { values } = (0, util_1.parseArgs)({
25
+ options: {
26
+ only: { type: "string", default: "" },
27
+ dir: { type: "string" },
28
+ "generate-tool-list": { type: "boolean", default: false },
29
+ },
30
+ allowPositionals: true,
31
+ });
32
+ if (values["generate-tool-list"]) {
33
+ console.log((0, index_js_1.markdownDocsOfTools)());
34
+ return;
35
+ }
36
+ process.env.IS_FIREBASE_MCP = "true";
37
+ (0, logger_1.useFileLogger)();
38
+ const activeFeatures = (values.only || "")
39
+ .split(",")
40
+ .filter((f) => types_1.SERVER_FEATURES.includes(f));
41
+ const server = new index_1.FirebaseMcpServer({
42
+ activeFeatures,
43
+ projectRoot: values.dir ? (0, path_1.resolve)(values.dir) : undefined,
44
+ });
45
+ await server.start();
46
+ if (process.stdin.isTTY)
47
+ process.stderr.write(STARTUP_MESSAGE);
48
+ }
49
+ exports.mcp = mcp;
@@ -26,6 +26,7 @@ const FILTERABLE_TARGETS = new Set([
26
26
  "storage",
27
27
  "database",
28
28
  "dataconnect",
29
+ "apphosting",
29
30
  ]);
30
31
  async function checkValidTargetFilters(options) {
31
32
  const only = !options.only ? [] : options.only.split(",");
package/lib/command.js CHANGED
@@ -13,6 +13,7 @@ const track_1 = require("./track");
13
13
  const auth_1 = require("./auth");
14
14
  const projects_1 = require("./management/projects");
15
15
  const requireAuth_1 = require("./requireAuth");
16
+ const logger_1 = require("./logger");
16
17
  class Command {
17
18
  constructor(cmd) {
18
19
  this.cmd = cmd;
@@ -163,8 +164,8 @@ class Command {
163
164
  if ((0, utils_1.getInheritedOption)(options, "json")) {
164
165
  options.nonInteractive = true;
165
166
  }
166
- else {
167
- (0, utils_1.setupLoggers)();
167
+ else if (!options.isMCP) {
168
+ (0, logger_1.useConsoleLoggers)();
168
169
  }
169
170
  if ((0, utils_1.getInheritedOption)(options, "config")) {
170
171
  options.configPath = (0, utils_1.getInheritedOption)(options, "config");
@@ -51,7 +51,7 @@ exports.command = new command_1.Command("appdistribution:distribute <release-bin
51
51
  const testCases = (0, options_parser_util_1.parseIntoStringArray)(options.testCaseIds, options.testCaseIdsFile);
52
52
  const testDevices = (0, options_parser_util_1.parseTestDevices)(options.testDevices, options.testDevicesFile);
53
53
  if (testCases.length && (options.testUsernameResource || options.testPasswordResource)) {
54
- throw new error_1.FirebaseError("Password and username resource names are not supported for the AI testing agent.");
54
+ throw new error_1.FirebaseError("Password and username resource names are not supported for the testing agent.");
55
55
  }
56
56
  const loginCredential = (0, options_parser_util_1.getLoginCredential)({
57
57
  username: options.testUsername,
@@ -7,7 +7,7 @@ const requireAuth_1 = require("../requireAuth");
7
7
  const client_1 = require("../appdistribution/client");
8
8
  const options_parser_util_1 = require("../appdistribution/options-parser-util");
9
9
  exports.command = new command_1.Command("appdistribution:groups:create <displayName> [alias]")
10
- .description("create group in project")
10
+ .description("create an App Distribution group")
11
11
  .alias("appdistribution:group:create")
12
12
  .before(requireAuth_1.requireAuth)
13
13
  .action(async (displayName, alias, options) => {
@@ -8,7 +8,7 @@ const error_1 = require("../error");
8
8
  const client_1 = require("../appdistribution/client");
9
9
  const options_parser_util_1 = require("../appdistribution/options-parser-util");
10
10
  exports.command = new command_1.Command("appdistribution:groups:delete <alias>")
11
- .description("delete group from a project")
11
+ .description("delete an App Distribution group")
12
12
  .alias("appdistribution:group:delete")
13
13
  .before(requireAuth_1.requireAuth)
14
14
  .action(async (alias, options) => {
@@ -9,9 +9,9 @@ const error_1 = require("../error");
9
9
  const logger_1 = require("../logger");
10
10
  const requireAuth_1 = require("../requireAuth");
11
11
  const utils = require("../utils");
12
- const Table = require("cli-table");
12
+ const Table = require("cli-table3");
13
13
  exports.command = new command_1.Command("appdistribution:groups:list")
14
- .description("list groups in project")
14
+ .description("list App Distribution groups")
15
15
  .alias("appdistribution:group:list")
16
16
  .before(requireAuth_1.requireAuth)
17
17
  .action(async (options) => {
@@ -7,7 +7,7 @@ const requireAuth_1 = require("../requireAuth");
7
7
  const client_1 = require("../appdistribution/client");
8
8
  const options_parser_util_1 = require("../appdistribution/options-parser-util");
9
9
  exports.command = new command_1.Command("appdistribution:testers:add [emails...]")
10
- .description("add testers to project (and possibly group)")
10
+ .description("add testers to project (and App Distribution group, if specified via flag)")
11
11
  .option("--file <file>", "a path to a file containing a list of tester emails to be added")
12
12
  .option("--group-alias <group-alias>", "if specified, the testers are also added to the group identified by this alias")
13
13
  .before(requireAuth_1.requireAuth)
@@ -9,7 +9,7 @@ const error_1 = require("../error");
9
9
  const logger_1 = require("../logger");
10
10
  const requireAuth_1 = require("../requireAuth");
11
11
  const utils = require("../utils");
12
- const Table = require("cli-table");
12
+ const Table = require("cli-table3");
13
13
  exports.command = new command_1.Command("appdistribution:testers:list [group]")
14
14
  .description("list testers in project")
15
15
  .before(requireAuth_1.requireAuth)
@@ -42,11 +42,11 @@ function printTestersTable(testers) {
42
42
  });
43
43
  for (const tester of testers) {
44
44
  const name = tester.name.split("/").pop();
45
- const groups = tester.groups
45
+ const groups = (tester.groups ?? [])
46
46
  .map((grp) => grp.split("/").pop())
47
47
  .sort()
48
48
  .join(";");
49
- table.push([name, tester.displayName ?? "", tester.lastActivityTime, groups]);
49
+ table.push([name, tester.displayName ?? "", tester.lastActivityTime.toString(), groups]);
50
50
  }
51
51
  logger_1.logger.info(table.toString());
52
52
  }
@@ -9,7 +9,7 @@ const client_1 = require("../appdistribution/client");
9
9
  const options_parser_util_1 = require("../appdistribution/options-parser-util");
10
10
  const logger_1 = require("../logger");
11
11
  exports.command = new command_1.Command("appdistribution:testers:remove [emails...]")
12
- .description("remove testers from a project (or group)")
12
+ .description("remove testers from a project (or App Distribution group, if specified via flag)")
13
13
  .option("--file <file>", "a path to a file containing a list of tester emails to be removed")
14
14
  .option("--group-alias <group-alias>", "if specified, the testers are only removed from the group identified by this alias, but not the project")
15
15
  .before(requireAuth_1.requireAuth)
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const command_1 = require("../command");
5
5
  const projectUtils_1 = require("../projectUtils");
6
+ const requireAuth_1 = require("../requireAuth");
6
7
  const requireInteractive_1 = require("../requireInteractive");
7
8
  const backend_1 = require("../apphosting/backend");
8
9
  const apphosting_1 = require("../gcp/apphosting");
@@ -11,15 +12,14 @@ const requireTosAcceptance_1 = require("../requireTosAcceptance");
11
12
  exports.command = new command_1.Command("apphosting:backends:create")
12
13
  .description("create a Firebase App Hosting backend")
13
14
  .option("-a, --app <webAppId>", "specify an existing Firebase web app's ID to associate your App Hosting backend with")
14
- .option("-l, --location <location>", "specify the location of the backend", "")
15
15
  .option("-s, --service-account <serviceAccount>", "specify the service account used to run the server", "")
16
+ .before(requireAuth_1.requireAuth)
16
17
  .before(apphosting_1.ensureApiEnabled)
17
18
  .before(requireInteractive_1.default)
18
19
  .before((0, requireTosAcceptance_1.requireTosAcceptance)(firedata_1.APPHOSTING_TOS_ID))
19
20
  .action(async (options) => {
20
21
  const projectId = (0, projectUtils_1.needProjectId)(options);
21
22
  const webAppId = options.app;
22
- const location = options.location;
23
23
  const serviceAccount = options.serviceAccount;
24
- await (0, backend_1.doSetup)(projectId, webAppId, location, serviceAccount);
24
+ await (0, backend_1.doSetup)(projectId, webAppId, serviceAccount);
25
25
  });
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const command_1 = require("../command");
5
5
  const projectUtils_1 = require("../projectUtils");
6
+ const requireAuth_1 = require("../requireAuth");
6
7
  const error_1 = require("../error");
7
8
  const prompt_1 = require("../prompt");
8
9
  const utils = require("../utils");
@@ -12,40 +13,35 @@ const backend_1 = require("../apphosting/backend");
12
13
  const ora = require("ora");
13
14
  exports.command = new command_1.Command("apphosting:backends:delete <backend>")
14
15
  .description("delete a Firebase App Hosting backend")
15
- .option("-l, --location <location>", "specify the location of the backend", "-")
16
16
  .withForce()
17
+ .before(requireAuth_1.requireAuth)
17
18
  .before(apphosting.ensureApiEnabled)
18
19
  .action(async (backendId, options) => {
19
20
  const projectId = (0, projectUtils_1.needProjectId)(options);
20
- let location = options.location;
21
- let backend;
22
- if (location === "-" || location === "") {
23
- backend = await (0, backend_1.getBackendForAmbiguousLocation)(projectId, backendId, "Please select the location of the backend you'd like to delete:");
24
- location = apphosting.parseBackendName(backend.name).location;
25
- }
26
- else {
27
- backend = await (0, backend_1.getBackendForLocation)(projectId, location, backendId);
28
- }
29
- utils.logWarning("You are about to permanently delete this backend:");
30
- (0, apphosting_backends_list_1.printBackendsTable)([backend]);
31
- const confirmDeletion = await (0, prompt_1.promptOnce)({
32
- type: "confirm",
33
- name: "force",
34
- default: false,
21
+ const backends = await (0, backend_1.chooseBackends)(projectId, backendId, "Please select the backends you'd like to delete:", options.force);
22
+ utils.logWarning("You are about to permanently delete these backend(s):");
23
+ (0, apphosting_backends_list_1.printBackendsTable)(backends);
24
+ const confirmDeletion = await (0, prompt_1.confirm)({
35
25
  message: "Are you sure?",
36
- }, options);
26
+ default: false,
27
+ force: options.force,
28
+ nonInteractive: options.nonInteractive,
29
+ });
37
30
  if (!confirmDeletion) {
38
31
  return;
39
32
  }
40
- const spinner = ora("Deleting backend...").start();
41
- try {
42
- await (0, backend_1.deleteBackendAndPoll)(projectId, location, backendId);
43
- spinner.succeed(`Successfully deleted the backend: ${backendId}`);
44
- }
45
- catch (err) {
46
- spinner.stop();
47
- throw new error_1.FirebaseError(`Failed to delete backend: ${backendId}.`, {
48
- original: (0, error_1.getError)(err),
49
- });
33
+ for (const b of backends) {
34
+ const { location, id } = apphosting.parseBackendName(b.name);
35
+ const spinner = ora(`Deleting backend ${id}(${location})...`).start();
36
+ try {
37
+ await (0, backend_1.deleteBackendAndPoll)(projectId, location, id);
38
+ spinner.succeed(`Successfully deleted the backend: ${id}(${location})`);
39
+ }
40
+ catch (err) {
41
+ spinner.stop();
42
+ throw new error_1.FirebaseError(`Failed to delete backend: ${id}(${location}). Please retry.`, {
43
+ original: (0, error_1.getError)(err),
44
+ });
45
+ }
50
46
  }
51
47
  });
@@ -3,28 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
4
  const command_1 = require("../command");
5
5
  const projectUtils_1 = require("../projectUtils");
6
+ const requireAuth_1 = require("../requireAuth");
6
7
  const error_1 = require("../error");
7
8
  const utils_1 = require("../utils");
8
9
  const apphosting = require("../gcp/apphosting");
9
10
  const apphosting_backends_list_1 = require("./apphosting-backends-list");
10
11
  exports.command = new command_1.Command("apphosting:backends:get <backend>")
11
12
  .description("print info about a Firebase App Hosting backend")
12
- .option("-l, --location <location>", "backend location", "-")
13
+ .before(requireAuth_1.requireAuth)
13
14
  .before(apphosting.ensureApiEnabled)
14
15
  .action(async (backend, options) => {
15
16
  const projectId = (0, projectUtils_1.needProjectId)(options);
16
- const location = options.location;
17
17
  let backendsList = [];
18
18
  try {
19
- if (location !== "-") {
20
- const backendInRegion = await apphosting.getBackend(projectId, location, backend);
21
- backendsList.push(backendInRegion);
22
- }
23
- else {
24
- const resp = await apphosting.listBackends(projectId, "-");
25
- const allBackends = resp.backends || [];
26
- backendsList = allBackends.filter((bkd) => bkd.name.split("/").pop() === backend);
27
- }
19
+ const resp = await apphosting.listBackends(projectId, "-");
20
+ const allBackends = resp.backends || [];
21
+ backendsList = allBackends.filter((bkd) => bkd.name.split("/").pop() === backend);
28
22
  }
29
23
  catch (err) {
30
24
  throw new error_1.FirebaseError(`Failed to get backend: ${backend}. Please check the parameters you have provided.`, { original: (0, error_1.getError)(err) });
@@ -33,6 +27,12 @@ exports.command = new command_1.Command("apphosting:backends:get <backend>")
33
27
  (0, utils_1.logWarning)(`Backend "${backend}" not found`);
34
28
  return;
35
29
  }
36
- (0, apphosting_backends_list_1.printBackendsTable)(backendsList);
30
+ if (backendsList.length > 1) {
31
+ const regions = backendsList.map((b) => apphosting.parseBackendName(b.name).location);
32
+ (0, utils_1.logWarning)(`Detected multiple backends with the same ${backend} ID in regions: ${regions.join(", ")}}. This is not allowed until we can support more locations.\n` +
33
+ `Please delete and recreate any backends that share an ID with another backend. ` +
34
+ `Use apphosting:backends:list to see all backends.\n Returning the following backend:`);
35
+ }
36
+ (0, apphosting_backends_list_1.printBackendsTable)(backendsList.slice(0, 1));
37
37
  return backendsList[0];
38
38
  });
@@ -6,19 +6,19 @@ const utils_1 = require("../utils");
6
6
  const error_1 = require("../error");
7
7
  const logger_1 = require("../logger");
8
8
  const projectUtils_1 = require("../projectUtils");
9
+ const requireAuth_1 = require("../requireAuth");
9
10
  const apphosting = require("../gcp/apphosting");
10
- const Table = require("cli-table");
11
- const TABLE_HEAD = ["Backend", "Repository", "URL", "Location", "Updated Date"];
11
+ const Table = require("cli-table3");
12
+ const TABLE_HEAD = ["Backend", "Repository", "URL", "Primary Region", "Updated Date"];
12
13
  exports.command = new command_1.Command("apphosting:backends:list")
13
14
  .description("list Firebase App Hosting backends")
14
- .option("-l, --location <location>", "list backends in the specified location", "-")
15
+ .before(requireAuth_1.requireAuth)
15
16
  .before(apphosting.ensureApiEnabled)
16
17
  .action(async (options) => {
17
18
  const projectId = (0, projectUtils_1.needProjectId)(options);
18
- const location = options.location;
19
19
  let backendRes;
20
20
  try {
21
- backendRes = await apphosting.listBackends(projectId, location);
21
+ backendRes = await apphosting.listBackends(projectId, "-");
22
22
  }
23
23
  catch (err) {
24
24
  throw new error_1.FirebaseError(`Unable to list backends present for project: ${projectId}. Please check the parameters you have provided.`, { original: err });
@@ -5,15 +5,21 @@ const apphosting = require("../gcp/apphosting");
5
5
  const logger_1 = require("../logger");
6
6
  const command_1 = require("../command");
7
7
  const projectUtils_1 = require("../projectUtils");
8
+ const requireAuth_1 = require("../requireAuth");
9
+ const utils_1 = require("../utils");
8
10
  exports.command = new command_1.Command("apphosting:builds:create <backendId>")
9
11
  .description("create a build for an App Hosting backend")
10
- .option("-l, --location <location>", "specify the region of the backend", "us-central1")
12
+ .option("-l, --location <location>", "specify the region of the backend")
11
13
  .option("-i, --id <buildId>", "id of the build (defaults to autogenerating a random id)", "")
12
14
  .option("-b, --branch <branch>", "repository branch to deploy (defaults to 'main')", "main")
15
+ .before(requireAuth_1.requireAuth)
13
16
  .before(apphosting.ensureApiEnabled)
14
17
  .action(async (backendId, options) => {
15
18
  const projectId = (0, projectUtils_1.needProjectId)(options);
16
- const location = options.location;
19
+ if (options.location !== undefined) {
20
+ (0, utils_1.logWarning)("--location is being removed in the next major release.");
21
+ }
22
+ const location = options.location ?? "us-central1";
17
23
  const buildId = options.buildId ||
18
24
  (await apphosting.getNextRolloutId(projectId, location, backendId));
19
25
  const branch = options.branch ?? "main";
@@ -5,11 +5,18 @@ const apphosting = require("../gcp/apphosting");
5
5
  const logger_1 = require("../logger");
6
6
  const command_1 = require("../command");
7
7
  const projectUtils_1 = require("../projectUtils");
8
+ const requireAuth_1 = require("../requireAuth");
9
+ const utils_1 = require("../utils");
8
10
  exports.command = new command_1.Command("apphosting:builds:get <backendId> <buildId>")
9
11
  .description("get a build for an App Hosting backend")
10
- .option("-l, --location <location>", "specify the region of the backend", "us-central1")
12
+ .option("-l, --location <location>", "specify the region of the backend")
13
+ .before(requireAuth_1.requireAuth)
11
14
  .before(apphosting.ensureApiEnabled)
12
15
  .action(async (backendId, buildId, options) => {
16
+ if (options.location !== undefined) {
17
+ (0, utils_1.logWarning)("--location is being removed in the next major release.");
18
+ }
19
+ options.location = options.location ?? "us-central";
13
20
  const projectId = (0, projectUtils_1.needProjectId)(options);
14
21
  const location = options.location;
15
22
  const build = await apphosting.getBuild(projectId, location, backendId, buildId);
@@ -4,22 +4,22 @@ exports.command = void 0;
4
4
  const apphosting = require("../gcp/apphosting");
5
5
  const command_1 = require("../command");
6
6
  const projectUtils_1 = require("../projectUtils");
7
+ const requireAuth_1 = require("../requireAuth");
7
8
  const error_1 = require("../error");
8
9
  const rollout_1 = require("../apphosting/rollout");
9
10
  exports.command = new command_1.Command("apphosting:rollouts:create <backendId>")
10
11
  .description("create a rollout using a build for an App Hosting backend")
11
- .option("-l, --location <location>", "specify the region of the backend", "-")
12
12
  .option("-b, --git-branch <gitBranch>", "repository branch to deploy (mutually exclusive with -g)")
13
13
  .option("-g, --git-commit <gitCommit>", "git commit to deploy (mutually exclusive with -b)")
14
14
  .withForce("Skip confirmation before creating rollout")
15
+ .before(requireAuth_1.requireAuth)
15
16
  .before(apphosting.ensureApiEnabled)
16
17
  .action(async (backendId, options) => {
17
18
  const projectId = (0, projectUtils_1.needProjectId)(options);
18
- const location = options.location;
19
19
  const branch = options.gitBranch;
20
20
  const commit = options.gitCommit;
21
21
  if (branch && commit) {
22
22
  throw new error_1.FirebaseError("Cannot specify both a branch and commit to deploy. Please specify either --git-branch or --git-commit.");
23
23
  }
24
- await (0, rollout_1.createRollout)(backendId, projectId, location, branch, commit, options.force);
24
+ await (0, rollout_1.createRollout)(backendId, projectId, branch, commit, options.force);
25
25
  });
@@ -5,13 +5,19 @@ const apphosting = require("../gcp/apphosting");
5
5
  const logger_1 = require("../logger");
6
6
  const command_1 = require("../command");
7
7
  const projectUtils_1 = require("../projectUtils");
8
+ const requireAuth_1 = require("../requireAuth");
9
+ const utils_1 = require("../utils");
8
10
  exports.command = new command_1.Command("apphosting:rollouts:list <backendId>")
9
11
  .description("list rollouts of an App Hosting backend")
10
- .option("-l, --location <location>", "region of the rollouts (defaults to listing rollouts from all regions)", "-")
12
+ .option("-l, --location <location>", "region of the rollouts (defaults to listing rollouts from all regions)")
13
+ .before(requireAuth_1.requireAuth)
11
14
  .before(apphosting.ensureApiEnabled)
12
15
  .action(async (backendId, options) => {
16
+ if (options.location !== undefined) {
17
+ (0, utils_1.logWarning)("--location is being removed in the next major release.");
18
+ }
13
19
  const projectId = (0, projectUtils_1.needProjectId)(options);
14
- const location = options.location;
20
+ const location = options.location ?? "-";
15
21
  const rollouts = await apphosting.listRollouts(projectId, location, backendId);
16
22
  if (rollouts.unreachable) {
17
23
  logger_1.logger.error(`WARNING: the following locations were unreachable: ${rollouts.unreachable.join(", ")}`);
@@ -9,7 +9,7 @@ const requireAuth_1 = require("../requireAuth");
9
9
  const secretManager = require("../gcp/secretManager");
10
10
  const requirePermissions_1 = require("../requirePermissions");
11
11
  exports.command = new command_1.Command("apphosting:secrets:access <secretName[@version]>")
12
- .description("Access secret value given secret and its version. Defaults to accessing the latest version.")
12
+ .description("access secret value given secret and its version. Defaults to accessing the latest version")
13
13
  .before(requireAuth_1.requireAuth)
14
14
  .before(secretManager.ensureApi)
15
15
  .before(requirePermissions_1.requirePermissions, ["secretmanager.versions.access"])
@@ -8,9 +8,9 @@ const requireAuth_1 = require("../requireAuth");
8
8
  const secretManager_1 = require("../gcp/secretManager");
9
9
  const secretManager = require("../gcp/secretManager");
10
10
  const requirePermissions_1 = require("../requirePermissions");
11
- const Table = require("cli-table");
11
+ const Table = require("cli-table3");
12
12
  exports.command = new command_1.Command("apphosting:secrets:describe <secretName>")
13
- .description("Get metadata for secret and its versions.")
13
+ .description("get metadata for secret and its versions")
14
14
  .before(requireAuth_1.requireAuth)
15
15
  .before(secretManager.ensureApi)
16
16
  .before(requirePermissions_1.requirePermissions, ["secretmanager.secrets.get"])
@@ -10,10 +10,11 @@ const requirePermissions_1 = require("../requirePermissions");
10
10
  const apphosting = require("../gcp/apphosting");
11
11
  const secrets = require("../apphosting/secrets");
12
12
  const backend_1 = require("../apphosting/backend");
13
- exports.command = new command_1.Command("apphosting:secrets:grantaccess <secretName>")
14
- .description("grant service accounts permissions to the provided secret")
13
+ exports.command = new command_1.Command("apphosting:secrets:grantaccess <secretNames>")
14
+ .description("Grant service accounts, users, or groups permissions to the provided secret(s). Can pass one or more secrets, separated by a comma")
15
15
  .option("-l, --location <location>", "backend location", "-")
16
16
  .option("-b, --backend <backend>", "backend name")
17
+ .option("-e, --emails <emails>", "comma delimited list of user or group emails")
17
18
  .before(requireAuth_1.requireAuth)
18
19
  .before(secretManager.ensureApi)
19
20
  .before(apphosting.ensureApiEnabled)
@@ -25,15 +26,24 @@ exports.command = new command_1.Command("apphosting:secrets:grantaccess <secretN
25
26
  "secretmanager.secrets.getIamPolicy",
26
27
  "secretmanager.secrets.setIamPolicy",
27
28
  ])
28
- .action(async (secretName, options) => {
29
+ .action(async (secretNames, options) => {
29
30
  const projectId = (0, projectUtils_1.needProjectId)(options);
30
31
  const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
31
- if (!options.backend) {
32
- throw new error_1.FirebaseError("Missing required flag --backend. See firebase apphosting:secrets:grantaccess --help for more info");
32
+ if (!options.backend && !options.emails) {
33
+ throw new error_1.FirebaseError("Missing required flag --backend or --emails. See firebase apphosting:secrets:grantaccess --help for more info");
33
34
  }
34
- const exists = await secretManager.secretExists(projectId, secretName);
35
- if (!exists) {
36
- throw new error_1.FirebaseError(`Cannot find secret ${secretName}`);
35
+ if (options.backend && options.emails) {
36
+ throw new error_1.FirebaseError("Cannot specify both --backend and --emails. See firebase apphosting:secrets:grantaccess --help for more info");
37
+ }
38
+ const secretList = secretNames.split(",");
39
+ for (const secretName of secretList) {
40
+ const exists = await secretManager.secretExists(projectId, secretName);
41
+ if (!exists) {
42
+ throw new error_1.FirebaseError(`Cannot find secret ${secretName}`);
43
+ }
44
+ }
45
+ if (options.emails) {
46
+ return await secrets.grantEmailsSecretAccess(projectId, secretList, String(options.emails).split(","));
37
47
  }
38
48
  const backendId = options.backend;
39
49
  const location = options.location;
@@ -44,6 +54,6 @@ exports.command = new command_1.Command("apphosting:secrets:grantaccess <secretN
44
54
  else {
45
55
  backend = await apphosting.getBackend(projectId, location, backendId);
46
56
  }
47
- const accounts = secrets.toMulti(secrets.serviceAccountsForBackend(projectNumber, backend));
48
- await secrets.grantSecretAccess(projectId, projectNumber, secretName, accounts);
57
+ const accounts = secrets.toMulti(await secrets.serviceAccountsForBackend(projectNumber, backend));
58
+ await Promise.allSettled(secretList.map((secretName) => secrets.grantSecretAccess(projectId, projectNumber, secretName, accounts)));
49
59
  });
@@ -12,6 +12,7 @@ const secrets = require("../apphosting/secrets");
12
12
  const dialogs = require("../apphosting/secrets/dialogs");
13
13
  const config = require("../apphosting/config");
14
14
  const utils = require("../utils");
15
+ const prompt = require("../prompt");
15
16
  exports.command = new command_1.Command("apphosting:secrets:set <secretName>")
16
17
  .description("create or update a secret for use in Firebase App Hosting")
17
18
  .option("-l, --location <location>", "optional location to retrict secret replication")
@@ -45,6 +46,27 @@ exports.command = new command_1.Command("apphosting:secrets:set <secretName>")
45
46
  if (!created) {
46
47
  return;
47
48
  }
49
+ const type = await prompt.select({
50
+ message: "Is this secret for production or only local testing?",
51
+ choices: [
52
+ { name: "Production", value: "production" },
53
+ { name: "Local testing only", value: "local" },
54
+ ],
55
+ });
56
+ if (type === "local") {
57
+ const emailList = await prompt.input({
58
+ message: "Please enter a comma separated list of user or groups who should have access to this secret:",
59
+ });
60
+ if (emailList.length) {
61
+ await secrets.grantEmailsSecretAccess(projectId, [secretName], emailList.split(","));
62
+ }
63
+ else {
64
+ utils.logBullet("To grant access in the future run " +
65
+ clc.bold(`firebase apphosting:secrets:grantaccess ${secretName} --emails [email list]`));
66
+ }
67
+ await config.maybeAddSecretToYaml(secretName, config.APPHOSTING_EMULATORS_YAML_FILE);
68
+ return;
69
+ }
48
70
  const accounts = await dialogs.selectBackendServiceAccounts(projectNumber, projectId, options);
49
71
  if (!accounts.buildServiceAccounts.length && !accounts.runServiceAccounts.length) {
50
72
  utils.logWarning(`To use this secret in your backend, you must grant access. You can do so in the future with ${clc.bold("firebase apphosting:secrets:grantaccess")}`);
@@ -52,5 +74,9 @@ exports.command = new command_1.Command("apphosting:secrets:set <secretName>")
52
74
  else {
53
75
  await secrets.grantSecretAccess(projectId, projectNumber, secretName, accounts);
54
76
  }
55
- await config.maybeAddSecretToYaml(secretName);
77
+ await config.maybeAddSecretToYaml(secretName, config.APPHOSTING_BASE_YAML_FILE);
78
+ utils.logBullet("To grant additional users access to this secret run " +
79
+ clc.bold(`firebase apphosting:secrets:grantaccess ${secretName} --email [email list]`) +
80
+ ".\nTo grant additional backends access to this secret run " +
81
+ clc.bold(`firebase apphosting:secrets:grantaccess ${secretName} --backend [backend ID]`));
56
82
  });
@@ -17,7 +17,7 @@ function getCertHashType(shaHash) {
17
17
  return apps_1.ShaCertificateType.SHA_CERTIFICATE_TYPE_UNSPECIFIED.toString();
18
18
  }
19
19
  exports.command = new command_1.Command("apps:android:sha:create <appId> <shaHash>")
20
- .description("add a SHA certificate hash for a given app id.")
20
+ .description("add a SHA certificate hash for a given app id")
21
21
  .before(requireAuth_1.requireAuth)
22
22
  .action(async (appId = "", shaHash = "", options) => {
23
23
  const projectId = (0, projectUtils_1.needProjectId)(options);
@@ -8,7 +8,7 @@ const apps_1 = require("../management/apps");
8
8
  const requireAuth_1 = require("../requireAuth");
9
9
  const utils_1 = require("../utils");
10
10
  exports.command = new command_1.Command("apps:android:sha:delete <appId> <shaId>")
11
- .description("delete a SHA certificate hash for a given app id.")
11
+ .description("delete a SHA certificate hash for a given app id")
12
12
  .before(requireAuth_1.requireAuth)
13
13
  .action(async (appId = "", shaId = "", options) => {
14
14
  const projectId = (0, projectUtils_1.needProjectId)(options);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.command = void 0;
4
- const Table = require("cli-table");
4
+ const Table = require("cli-table3");
5
5
  const command_1 = require("../command");
6
6
  const projectUtils_1 = require("../projectUtils");
7
7
  const apps_1 = require("../management/apps");
@@ -31,7 +31,7 @@ function logCertificatesCount(count = 0) {
31
31
  logger_1.logger.info(`${count} SHA hash(es) total.`);
32
32
  }
33
33
  exports.command = new command_1.Command("apps:android:sha:list <appId>")
34
- .description("list the SHA certificate hashes for a given app id. ")
34
+ .description("list the SHA certificate hashes for a given app id")
35
35
  .before(requireAuth_1.requireAuth)
36
36
  .action(async (appId = "", options) => {
37
37
  const projectId = (0, projectUtils_1.needProjectId)(options);