firebase-tools 13.35.0 → 14.0.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 (106) hide show
  1. package/lib/appdistribution/client.js +4 -2
  2. package/lib/apphosting/backend.js +65 -11
  3. package/lib/apphosting/config.js +130 -101
  4. package/lib/apphosting/rollout.js +3 -9
  5. package/lib/apphosting/secrets/dialogs.js +5 -2
  6. package/lib/apphosting/secrets/index.js +45 -3
  7. package/lib/apphosting/yaml.js +19 -8
  8. package/lib/commands/appdistribution-groups-create.js +1 -1
  9. package/lib/commands/appdistribution-groups-delete.js +1 -1
  10. package/lib/commands/appdistribution-groups-list.js +1 -1
  11. package/lib/commands/appdistribution-testers-add.js +1 -1
  12. package/lib/commands/appdistribution-testers-remove.js +1 -1
  13. package/lib/commands/apphosting-backends-create.js +1 -8
  14. package/lib/commands/apphosting-backends-delete.js +16 -26
  15. package/lib/commands/apphosting-backends-get.js +10 -16
  16. package/lib/commands/apphosting-backends-list.js +4 -10
  17. package/lib/commands/apphosting-rollouts-create.js +1 -8
  18. package/lib/commands/apphosting-secrets-access.js +1 -1
  19. package/lib/commands/apphosting-secrets-describe.js +1 -1
  20. package/lib/commands/apphosting-secrets-grantaccess.js +19 -9
  21. package/lib/commands/apphosting-secrets-set.js +31 -1
  22. package/lib/commands/apps-android-sha-create.js +1 -1
  23. package/lib/commands/apps-android-sha-delete.js +1 -1
  24. package/lib/commands/apps-android-sha-list.js +1 -1
  25. package/lib/commands/apps-create.js +1 -1
  26. package/lib/commands/apps-init.js +1 -1
  27. package/lib/commands/auth-export.js +1 -1
  28. package/lib/commands/auth-import.js +1 -1
  29. package/lib/commands/database-instances-create.js +1 -1
  30. package/lib/commands/database-profile.js +1 -2
  31. package/lib/commands/database-settings-set.js +1 -1
  32. package/lib/commands/database-update.js +1 -1
  33. package/lib/commands/dataconnect-sdk-generate.js +1 -1
  34. package/lib/commands/dataconnect-services-list.js +1 -1
  35. package/lib/commands/dataconnect-sql-diff.js +1 -1
  36. package/lib/commands/dataconnect-sql-grant.js +1 -1
  37. package/lib/commands/dataconnect-sql-migrate.js +2 -2
  38. package/lib/commands/dataconnect-sql-setup.js +1 -1
  39. package/lib/commands/dataconnect-sql-shell.js +1 -1
  40. package/lib/commands/deploy.js +3 -3
  41. package/lib/commands/emulators-exec.js +1 -1
  42. package/lib/commands/ext-dev-register.js +1 -1
  43. package/lib/commands/ext-dev-usage.js +2 -2
  44. package/lib/commands/ext-install.js +2 -3
  45. package/lib/commands/firestore-backups-delete.js +2 -2
  46. package/lib/commands/firestore-backups-get.js +1 -1
  47. package/lib/commands/firestore-backups-list.js +2 -2
  48. package/lib/commands/firestore-backups-schedules-create.js +4 -4
  49. package/lib/commands/firestore-backups-schedules-delete.js +2 -2
  50. package/lib/commands/firestore-backups-schedules-list.js +2 -2
  51. package/lib/commands/firestore-backups-schedules-update.js +1 -1
  52. package/lib/commands/firestore-databases-create.js +6 -6
  53. package/lib/commands/firestore-databases-delete.js +2 -2
  54. package/lib/commands/firestore-databases-get.js +1 -1
  55. package/lib/commands/firestore-databases-list.js +1 -1
  56. package/lib/commands/firestore-databases-restore.js +5 -5
  57. package/lib/commands/firestore-databases-update.js +4 -4
  58. package/lib/commands/firestore-delete.js +7 -8
  59. package/lib/commands/firestore-indexes-list.js +4 -4
  60. package/lib/commands/firestore-locations.js +1 -1
  61. package/lib/commands/functions-artifacts-setpolicy.js +11 -13
  62. package/lib/commands/functions-config-export.js +1 -1
  63. package/lib/commands/functions-deletegcfartifacts.js +1 -1
  64. package/lib/commands/functions-secrets-access.js +1 -1
  65. package/lib/commands/functions-secrets-describe.js +1 -1
  66. package/lib/commands/functions-secrets-destroy.js +2 -2
  67. package/lib/commands/functions-secrets-get.js +1 -1
  68. package/lib/commands/functions-secrets-prune.js +2 -2
  69. package/lib/commands/functions-secrets-set.js +3 -3
  70. package/lib/commands/index.js +0 -4
  71. package/lib/commands/init.js +3 -2
  72. package/lib/commands/internaltesting-frameworks-compose.js +1 -1
  73. package/lib/commands/remoteconfig-versions-list.js +1 -1
  74. package/lib/commands/setup-emulators-database.js +1 -1
  75. package/lib/commands/setup-emulators-dataconnect.js +1 -1
  76. package/lib/commands/setup-emulators-firestore.js +1 -1
  77. package/lib/commands/setup-emulators-pubsub.js +1 -1
  78. package/lib/commands/setup-emulators-storage.js +1 -1
  79. package/lib/commands/setup-emulators-ui.js +1 -1
  80. package/lib/config.js +16 -18
  81. package/lib/dataconnect/dataplaneClient.js +3 -1
  82. package/lib/deploy/functions/build.js +1 -0
  83. package/lib/deploy/functions/prompts.js +30 -1
  84. package/lib/deploy/functions/release/index.js +27 -9
  85. package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +4 -4
  86. package/lib/emulator/apphosting/config.js +15 -14
  87. package/lib/emulator/auth/operations.js +2 -1
  88. package/lib/emulator/constants.js +1 -1
  89. package/lib/emulator/dataconnect/pgliteServer.js +2 -1
  90. package/lib/emulator/dataconnectEmulator.js +2 -0
  91. package/lib/emulator/downloadableEmulators.js +9 -9
  92. package/lib/emulator/env.js +2 -1
  93. package/lib/emulator/initEmulators.js +29 -4
  94. package/lib/experiments.js +1 -13
  95. package/lib/functions/artifacts.js +89 -1
  96. package/lib/gcp/cloudfunctions.js +1 -1
  97. package/lib/gcp/cloudfunctionsv2.js +3 -3
  98. package/lib/gcp/cloudsql/permissions.js +2 -1
  99. package/lib/gcp/cloudsql/permissions_setup.js +8 -5
  100. package/lib/gcp/proto.js +4 -3
  101. package/lib/init/features/dataconnect/sdk.js +4 -5
  102. package/package.json +2 -2
  103. package/standalone/package.json +1 -1
  104. package/templates/init/dataconnect/dataconnect.yaml +1 -1
  105. package/lib/commands/apphosting-config-export.js +0 -29
  106. package/lib/commands/experimental-functions-shell.js +0 -13
@@ -10,8 +10,8 @@ const firestore_1 = require("../gcp/firestore");
10
10
  const utils_1 = require("../utils");
11
11
  const pretty_print_1 = require("../firestore/pretty-print");
12
12
  exports.command = new command_1.Command("firestore:backups:list")
13
- .description("List all Cloud Firestore backups in a given location")
14
- .option("-l, --location <locationId>", "Location to search for backups, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations. Defaults to all locations.")
13
+ .description("list all Cloud Firestore backups in a given location")
14
+ .option("-l, --location <locationId>", "location to search for backups, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations. Defaults to all locations")
15
15
  .before(requirePermissions_1.requirePermissions, ["datastore.backups.list"])
16
16
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
17
17
  .action(async (options) => {
@@ -13,11 +13,11 @@ const commandUtils_1 = require("../emulator/commandUtils");
13
13
  const pretty_print_1 = require("../firestore/pretty-print");
14
14
  const error_1 = require("../error");
15
15
  exports.command = new command_1.Command("firestore:backups:schedules:create")
16
- .description("Create a backup schedule under your Cloud Firestore database.")
17
- .option("-d, --database <databaseId>", "Database under which you want to create a schedule. Defaults to the (default) database")
16
+ .description("create a backup schedule under your Cloud Firestore database")
17
+ .option("-d, --database <databaseId>", "database under which you want to create a schedule. Defaults to the (default) database")
18
18
  .option("--retention <duration>", "duration string (e.g. 12h or 30d) for backup retention")
19
- .option("--recurrence <recurrence>", "Recurrence settings; either DAILY or WEEKLY")
20
- .option("--day-of-week <dayOfWeek>", "On which day of the week to perform backups; one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, or SUNDAY")
19
+ .option("--recurrence <recurrence>", "recurrence settings; either DAILY or WEEKLY")
20
+ .option("--day-of-week <dayOfWeek>", "on which day of the week to perform backups; one of MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, or SUNDAY")
21
21
  .before(requirePermissions_1.requirePermissions, ["datastore.backupSchedules.create"])
22
22
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
23
23
  .action(async (options) => {
@@ -11,8 +11,8 @@ const types_1 = require("../emulator/types");
11
11
  const commandUtils_1 = require("../emulator/commandUtils");
12
12
  const error_1 = require("../error");
13
13
  exports.command = new command_1.Command("firestore:backups:schedules:delete <backupSchedule>")
14
- .description("Delete a backup schedule under your Cloud Firestore database.")
15
- .option("--force", "Attempt to delete backup schedule without prompting for confirmation.")
14
+ .description("delete a backup schedule under your Cloud Firestore database")
15
+ .option("--force", "attempt to delete backup schedule without prompting for confirmation")
16
16
  .before(requirePermissions_1.requirePermissions, ["datastore.backupSchedules.delete"])
17
17
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
18
18
  .action(async (backupScheduleName, options) => {
@@ -9,8 +9,8 @@ const commandUtils_1 = require("../emulator/commandUtils");
9
9
  const firestore_1 = require("../gcp/firestore");
10
10
  const pretty_print_1 = require("../firestore/pretty-print");
11
11
  exports.command = new command_1.Command("firestore:backups:schedules:list")
12
- .description("List backup schedules under your Cloud Firestore database.")
13
- .option("-d, --database <databaseId>", "Database whose schedules you wish to list. Defaults to the (default) database.")
12
+ .description("list backup schedules under your Cloud Firestore database")
13
+ .option("-d, --database <databaseId>", "database whose schedules you wish to list. Defaults to the (default) database")
14
14
  .before(requirePermissions_1.requirePermissions, ["datastore.backupSchedules.list"])
15
15
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
16
16
  .action(async (options) => {
@@ -12,7 +12,7 @@ const commandUtils_1 = require("../emulator/commandUtils");
12
12
  const pretty_print_1 = require("../firestore/pretty-print");
13
13
  const error_1 = require("../error");
14
14
  exports.command = new command_1.Command("firestore:backups:schedules:update <backupSchedule>")
15
- .description("Update a backup schedule under your Cloud Firestore database.")
15
+ .description("update a backup schedule under your Cloud Firestore database")
16
16
  .option("--retention <duration>", "duration string (e.g. 12h or 30d) for backup retention")
17
17
  .before(requirePermissions_1.requirePermissions, ["datastore.backupSchedules.update"])
18
18
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
@@ -12,13 +12,13 @@ const commandUtils_1 = require("../emulator/commandUtils");
12
12
  const pretty_print_1 = require("../firestore/pretty-print");
13
13
  const error_1 = require("../error");
14
14
  exports.command = new command_1.Command("firestore:databases:create <database>")
15
- .description("Create a database in your Firebase project.")
16
- .option("--location <locationId>", "Region to create database, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations. (required)")
17
- .option("--delete-protection <deleteProtectionState>", "Whether or not to prevent deletion of database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
18
- .option("--point-in-time-recovery <enablement>", "Whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
19
- .option("-k, --kms-key-name <kmsKeyName>", "The resource ID of a Cloud KMS key. If set, the database created will be a " +
15
+ .description("create a database in your Firebase project")
16
+ .option("--location <locationId>", "region to create database, for example 'nam5'. Run 'firebase firestore:locations' to get a list of eligible locations (required)")
17
+ .option("--delete-protection <deleteProtectionState>", "whether or not to prevent deletion of database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
18
+ .option("--point-in-time-recovery <enablement>", "whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
19
+ .option("-k, --kms-key-name <kmsKeyName>", "the resource ID of a Cloud KMS key. If set, the database created will be a " +
20
20
  "Customer-managed Encryption Key (CMEK) database encrypted with this key. " +
21
- "This feature is allowlist only in initial launch.")
21
+ "This feature is allowlist only in initial launch")
22
22
  .before(requirePermissions_1.requirePermissions, ["datastore.databases.create"])
23
23
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
24
24
  .action(async (database, options) => {
@@ -12,8 +12,8 @@ const commandUtils_1 = require("../emulator/commandUtils");
12
12
  const error_1 = require("../error");
13
13
  const pretty_print_1 = require("../firestore/pretty-print");
14
14
  exports.command = new command_1.Command("firestore:databases:delete <database>")
15
- .description("Delete a database in your Cloud Firestore project. Database delete protection state must be disabled. To do so, use the update command: firebase firestore:databases:update <database> --delete-protection DISABLED")
16
- .option("--force", "Attempt to delete database without prompting for confirmation.")
15
+ .description("delete a database in your Cloud Firestore project")
16
+ .option("--force", "attempt to delete database without prompting for confirmation")
17
17
  .before(requirePermissions_1.requirePermissions, ["datastore.databases.delete"])
18
18
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
19
19
  .action(async (database, options) => {
@@ -9,7 +9,7 @@ const types_1 = require("../emulator/types");
9
9
  const commandUtils_1 = require("../emulator/commandUtils");
10
10
  const pretty_print_1 = require("../firestore/pretty-print");
11
11
  exports.command = new command_1.Command("firestore:databases:get [database]")
12
- .description("Get database in your Cloud Firestore project.")
12
+ .description("get information about a Cloud Firestore database")
13
13
  .before(requirePermissions_1.requirePermissions, ["datastore.databases.get"])
14
14
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
15
15
  .action(async (database, options) => {
@@ -9,7 +9,7 @@ const types_1 = require("../emulator/types");
9
9
  const commandUtils_1 = require("../emulator/commandUtils");
10
10
  const pretty_print_1 = require("../firestore/pretty-print");
11
11
  exports.command = new command_1.Command("firestore:databases:list")
12
- .description("List databases in your Cloud Firestore project.")
12
+ .description("list the Cloud Firestore databases on your project")
13
13
  .before(requirePermissions_1.requirePermissions, ["datastore.databases.list"])
14
14
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
15
15
  .action(async (options) => {
@@ -12,13 +12,13 @@ const options_1 = require("../firestore/options");
12
12
  const pretty_print_1 = require("../firestore/pretty-print");
13
13
  const error_1 = require("../error");
14
14
  exports.command = new command_1.Command("firestore:databases:restore")
15
- .description("Restore a Firestore database in your Firebase project.")
15
+ .description("restore a Firestore database from a backup")
16
16
  .option("-d, --database <databaseID>", "ID of the database to restore into")
17
- .option("-b, --backup <backup>", "Backup from which to restore")
18
- .option("-e, --encryption-type <encryptionType>", `Encryption method of the restored database; one of ${options_1.EncryptionType.USE_SOURCE_ENCRYPTION} (default), ` +
17
+ .option("-b, --backup <backup>", "backup from which to restore")
18
+ .option("-e, --encryption-type <encryptionType>", `encryption method of the restored database; one of ${options_1.EncryptionType.USE_SOURCE_ENCRYPTION} (default), ` +
19
19
  `${options_1.EncryptionType.CUSTOMER_MANAGED_ENCRYPTION}, ${options_1.EncryptionType.GOOGLE_DEFAULT_ENCRYPTION}`)
20
- .option("-k, --kms-key-name <kmsKeyName>", "Resource ID of the Cloud KMS key to encrypt the restored database. This " +
21
- "feature is allowlist only in initial launch.")
20
+ .option("-k, --kms-key-name <kmsKeyName>", "resource ID of the Cloud KMS key to encrypt the restored database. This " +
21
+ "feature is allowlist only in initial launch")
22
22
  .before(requirePermissions_1.requirePermissions, ["datastore.backups.restoreDatabase"])
23
23
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
24
24
  .action(async (options) => {
@@ -12,10 +12,10 @@ const commandUtils_1 = require("../emulator/commandUtils");
12
12
  const pretty_print_1 = require("../firestore/pretty-print");
13
13
  const error_1 = require("../error");
14
14
  exports.command = new command_1.Command("firestore:databases:update <database>")
15
- .description("Update a database in your Firebase project. Must specify at least one property to update.")
16
- .option("--json", "Prints raw json response of the create API call if specified")
17
- .option("--delete-protection <deleteProtectionState>", "Whether or not to prevent deletion of database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
18
- .option("--point-in-time-recovery <enablement>", "Whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
15
+ .description("update a database in your Firebase project. Must specify at least one property to update")
16
+ .option("--json", "prints raw json response of the create API call if specified")
17
+ .option("--delete-protection <deleteProtectionState>", "whether or not to prevent deletion of database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
18
+ .option("--point-in-time-recovery <enablement>", "whether to enable the PITR feature on this database, for example 'ENABLED' or 'DISABLED'. Default is 'DISABLED'")
19
19
  .before(requirePermissions_1.requirePermissions, ["datastore.databases.update"])
20
20
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
21
21
  .action(async (database, options) => {
@@ -47,15 +47,14 @@ function confirmationMessage(deleteOp, options) {
47
47
  ". Are you sure?");
48
48
  }
49
49
  exports.command = new command_1.Command("firestore:delete [path]")
50
- .description("Delete data from Cloud Firestore.")
51
- .option("-r, --recursive", "Recursive. Delete all documents and subcollections at and under the " +
52
- "specified level. May not be passed along with --shallow.")
53
- .option("--shallow", "Shallow. Delete only documents at the specified level and ignore documents in " +
50
+ .description("delete data from a Cloud Firestore database")
51
+ .option("-r, --recursive", "if set, recursively delete all documents and subcollections at and under the " +
52
+ "specified level. May not be passed along with --shallow")
53
+ .option("--shallow", "delete only documents at the specified level and ignore documents in " +
54
54
  "subcollections. This action can potentially orphan documents nested in " +
55
- "subcollections. May not be passed along with -r.")
56
- .option("--all-collections", "Delete all. Deletes the entire Firestore database, " +
57
- "including all collections and documents. Any other flags or arguments will be ignored.")
58
- .option("-f, --force", "No confirmation. Otherwise, a confirmation prompt will appear.")
55
+ "subcollections. May not be passed along with -r")
56
+ .option("--all-collections", "deletes all collections and documents in the Firestore database")
57
+ .withForce()
59
58
  .option("--database <databaseId>", 'Database ID for database to delete from. "(default)" if none is provided.')
60
59
  .before(commandUtils_1.printNoticeIfEmulated, types_1.Emulators.FIRESTORE)
61
60
  .before(requirePermissions_1.requirePermissions, ["datastore.entities.list", "datastore.entities.delete"])
@@ -11,10 +11,10 @@ const commandUtils_1 = require("../emulator/commandUtils");
11
11
  const pretty_print_1 = require("../firestore/pretty-print");
12
12
  const projectUtils_1 = require("../projectUtils");
13
13
  exports.command = new command_1.Command("firestore:indexes")
14
- .description("List indexes in your project's Cloud Firestore database.")
15
- .option("--pretty", "Pretty print. When not specified the indexes are printed in the " +
16
- "JSON specification format.")
17
- .option("--database <databaseId>", "Database ID of the firestore database from which to list indexes. (default) if none provided.")
14
+ .description("list indexes in a Cloud Firestore database")
15
+ .option("--pretty", "pretty print the indexes. When not specified the indexes are printed in the " +
16
+ "JSON specification format")
17
+ .option("--database <databaseId>", "database ID of the firestore database from which to list indexes. (default) if none provided")
18
18
  .before(requirePermissions_1.requirePermissions, ["datastore.indexes.list"])
19
19
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
20
20
  .action(async (options) => {
@@ -9,7 +9,7 @@ const types_1 = require("../emulator/types");
9
9
  const commandUtils_1 = require("../emulator/commandUtils");
10
10
  const pretty_print_1 = require("../firestore/pretty-print");
11
11
  exports.command = new command_1.Command("firestore:locations")
12
- .description("List possible locations for your Cloud Firestore project.")
12
+ .description("list possible locations for your Cloud Firestore database")
13
13
  .before(requirePermissions_1.requirePermissions, ["datastore.locations.list"])
14
14
  .before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.FIRESTORE)
15
15
  .action(async (options) => {
@@ -12,18 +12,13 @@ const utils_1 = require("../utils");
12
12
  const artifactregistry = require("../gcp/artifactregistry");
13
13
  const artifacts = require("../functions/artifacts");
14
14
  exports.command = new command_1.Command("functions:artifacts:setpolicy")
15
- .description("Set up a cleanup policy for Cloud Run functions container images in Artifact Registry. " +
16
- "This policy will automatically delete old container images created during functions deployment.")
17
- .option("--location <location>", "Specify location to set up the cleanup policy. " +
18
- "If omitted, uses the default functions location.", "us-central1")
19
- .option("--days <days>", "Number of days to keep container images before deletion. Default is 3 days.", "3")
20
- .option("--none", "Opt-out from cleanup policy. This will prevent suggestions to set up a cleanup policy during initialization and deployment.")
21
- .before((options) => {
22
- if (options.days && options.none) {
23
- throw new error_1.FirebaseError("Cannot specify both --days and --none options.");
24
- }
25
- })
26
- .withForce("Automatically create or modify cleanup policy")
15
+ .description("set up a cleanup policy for Cloud Run functions container images in Artifact Registry " +
16
+ "to automatically delete old function images")
17
+ .option("--location <location>", "specify location to set up the cleanup policy. " +
18
+ "If omitted, uses the default functions location", "us-central1")
19
+ .option("--days <days>", `number of days to keep container images before deletion. Default is ${artifacts.DEFAULT_CLEANUP_DAYS} day`)
20
+ .option("--none", "opt-out from cleanup policy. This will prevent suggestions to set up a cleanup policy during initialization and deployment")
21
+ .withForce("automatically create or modify cleanup policy")
27
22
  .before(requireAuth_1.requireAuth)
28
23
  .before(async (options) => {
29
24
  const projectId = (0, projectUtils_1.needProjectId)(options);
@@ -35,9 +30,12 @@ exports.command = new command_1.Command("functions:artifacts:setpolicy")
35
30
  ])
36
31
  .action(async (options) => {
37
32
  var _a;
33
+ if (options.days && options.none) {
34
+ throw new error_1.FirebaseError("Cannot specify both --days and --none options.");
35
+ }
38
36
  const projectId = (0, projectUtils_1.needProjectId)(options);
39
37
  const location = options.location || "us-central1";
40
- let daysToKeep = parseInt(options.days || "3", 10);
38
+ let daysToKeep = parseInt(options.days || artifacts.DEFAULT_CLEANUP_DAYS, 10);
41
39
  const repoPath = artifacts.makeRepoPath(projectId, location);
42
40
  let repository;
43
41
  try {
@@ -71,7 +71,7 @@ function fromEntries(itr) {
71
71
  return obj;
72
72
  }
73
73
  exports.command = new command_1.Command("functions:config:export")
74
- .description("Export environment config as environment variables in dotenv format")
74
+ .description("export environment config as environment variables in dotenv format")
75
75
  .before(requirePermissions_1.requirePermissions, [
76
76
  "runtimeconfig.configs.list",
77
77
  "runtimeconfig.configs.get",
@@ -16,7 +16,7 @@ function getConfirmationMessage(paths) {
16
16
  return message;
17
17
  }
18
18
  exports.command = new command_1.Command("functions:deletegcfartifacts")
19
- .description("Deletes all artifacts created by Google Cloud Functions on Google Container Registry.")
19
+ .description("deletes all artifacts created by Google Cloud Functions on Google Container Registry")
20
20
  .option("--regions <regions>", "Specify regions of artifacts to be deleted. " +
21
21
  "If omitted, artifacts from all regions will be deleted. " +
22
22
  "<regions> is a Google defined region list, e.g. us-central1,us-east1,europe-west2.")
@@ -9,7 +9,7 @@ const requireAuth_1 = require("../requireAuth");
9
9
  const secretManager = require("../gcp/secretManager");
10
10
  const secrets_1 = require("../apphosting/secrets");
11
11
  exports.command = new command_1.Command("functions:secrets:access <KEY>[@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
  .action(async (key, options) => {
@@ -7,7 +7,7 @@ const requirePermissions_1 = require("../requirePermissions");
7
7
  const secretManager = require("../gcp/secretManager");
8
8
  const secrets = require("../functions/secrets");
9
9
  exports.command = new command_1.Command("functions:secrets:describe <KEY>")
10
- .description("Get metadata for secret and its versions. Alias for functions:secrets:get to align with gcloud")
10
+ .description("get metadata for secret and its versions. Alias for functions:secrets:get to align with gcloud")
11
11
  .before(requireAuth_1.requireAuth)
12
12
  .before(secretManager.ensureApi)
13
13
  .before(requirePermissions_1.requirePermissions, ["secretmanager.secrets.get"])
@@ -10,8 +10,8 @@ const requireAuth_1 = require("../requireAuth");
10
10
  const secrets = require("../functions/secrets");
11
11
  const backend = require("../deploy/functions/backend");
12
12
  exports.command = new command_1.Command("functions:secrets:destroy <KEY>[@version]")
13
- .description("Destroy a secret. Defaults to destroying the latest version.")
14
- .withForce("Destroys a secret without confirmation.")
13
+ .description("destroy a secret. Defaults to destroying the latest version")
14
+ .withForce("destroy a secret without confirmation")
15
15
  .before(requireAuth_1.requireAuth)
16
16
  .before(secretManager_1.ensureApi)
17
17
  .action(async (key, options) => {
@@ -7,7 +7,7 @@ const requirePermissions_1 = require("../requirePermissions");
7
7
  const secretManager = require("../gcp/secretManager");
8
8
  const secrets = require("../functions/secrets");
9
9
  exports.command = new command_1.Command("functions:secrets:get <KEY>")
10
- .description("Get metadata for secret and its versions")
10
+ .description("get metadata for secret and its versions")
11
11
  .before(requireAuth_1.requireAuth)
12
12
  .before(secretManager.ensureApi)
13
13
  .before(requirePermissions_1.requirePermissions, ["secretmanager.secrets.get"])
@@ -13,8 +13,8 @@ const prompt_1 = require("../prompt");
13
13
  const secretManager_1 = require("../gcp/secretManager");
14
14
  const requireAuth_1 = require("../requireAuth");
15
15
  exports.command = new command_1.Command("functions:secrets:prune")
16
- .withForce("Destroys unused secrets without prompt")
17
- .description("Destroys unused secrets")
16
+ .withForce("destroy unused secrets without prompt")
17
+ .description("destroy unused secrets")
18
18
  .before(requireAuth_1.requireAuth)
19
19
  .before(secretManager.ensureApi)
20
20
  .before(requirePermissions_1.requirePermissions, [
@@ -15,8 +15,8 @@ const requireAuth_1 = require("../requireAuth");
15
15
  const secrets = require("../functions/secrets");
16
16
  const backend = require("../deploy/functions/backend");
17
17
  exports.command = new command_1.Command("functions:secrets:set <KEY>")
18
- .description("Create or update a secret for use in Cloud Functions for Firebase.")
19
- .withForce("Automatically updates functions to use the new secret.")
18
+ .description("create or update a secret for use in Cloud Functions for Firebase")
19
+ .withForce("automatically updates functions to use the new secret")
20
20
  .before(requireAuth_1.requireAuth)
21
21
  .before(secretManager_1.ensureApi)
22
22
  .before(requirePermissions_1.requirePermissions, [
@@ -25,7 +25,7 @@ exports.command = new command_1.Command("functions:secrets:set <KEY>")
25
25
  "secretmanager.secrets.update",
26
26
  "secretmanager.versions.add",
27
27
  ])
28
- .option("--data-file <dataFile>", 'File path from which to read secret data. Set to "-" to read the secret data from stdin.')
28
+ .option("--data-file <dataFile>", 'file path from which to read secret data. Set to "-" to read the secret data from stdin')
29
29
  .action(async (unvalidatedKey, options) => {
30
30
  const projectId = (0, projectUtils_1.needProjectId)(options);
31
31
  const projectNumber = await (0, projectUtils_1.needProjectNumber)(options);
@@ -71,9 +71,6 @@ function load(client) {
71
71
  client.emulators.exec = loadCommand("emulators-exec");
72
72
  client.emulators.export = loadCommand("emulators-export");
73
73
  client.emulators.start = loadCommand("emulators-start");
74
- client.experimental = {};
75
- client.experimental.functions = {};
76
- client.experimental.functions.shell = loadCommand("experimental-functions-shell");
77
74
  client.experiments = {};
78
75
  client.experiments.list = loadCommand("experiments-list");
79
76
  client.experiments.describe = loadCommand("experiments-describe");
@@ -178,7 +175,6 @@ function load(client) {
178
175
  client.apphosting.rollouts = {};
179
176
  client.apphosting.rollouts.create = loadCommand("apphosting-rollouts-create");
180
177
  client.apphosting.config = {};
181
- client.apphosting.config.export = loadCommand("apphosting-config-export");
182
178
  if (experiments.isEnabled("internaltesting")) {
183
179
  client.apphosting.builds = {};
184
180
  client.apphosting.builds.get = loadCommand("apphosting-builds-get");
@@ -98,7 +98,7 @@ if ((0, experiments_1.isEnabled)("genkit")) {
98
98
  ];
99
99
  }
100
100
  const featureNames = choices.map((choice) => choice.value);
101
- const DESCRIPTION = `Interactively configure the current directory as a Firebase project or initialize new features in an already configured Firebase project directory.
101
+ const HELP = `Interactively configure the current directory as a Firebase project or initialize new features in an already configured Firebase project directory.
102
102
 
103
103
  This command will create or update 'firebase.json' and '.firebaserc' configuration files in the current directory.
104
104
 
@@ -108,7 +108,8 @@ ${[...featureNames]
108
108
  .map((n) => `\n - ${n}`)
109
109
  .join("")}`;
110
110
  exports.command = new command_1.Command("init [feature]")
111
- .description(DESCRIPTION)
111
+ .description("interactively configure the current directory as a Firebase project directory")
112
+ .help(HELP)
112
113
  .before(requireAuth_1.requireAuth)
113
114
  .action(initAction);
114
115
  function initAction(feature, options) {
@@ -9,7 +9,7 @@ const error_1 = require("../error");
9
9
  const filesystem_1 = require("../frameworks/compose/discover/filesystem");
10
10
  const frameworkSpec_1 = require("../frameworks/compose/discover/frameworkSpec");
11
11
  exports.command = new command_1.Command("internaltesting:frameworks:compose")
12
- .option("-m, --mode <mode>", "Composer mode (local or docker)", "local")
12
+ .option("-m, --mode <mode>", "composer mode (local or docker)", "local")
13
13
  .description("compose framework in current directory")
14
14
  .action(async (options) => {
15
15
  const mode = options.mode;
@@ -20,7 +20,7 @@ function pushTableContents(table, version) {
20
20
  }
21
21
  exports.command = new command_1.Command("remoteconfig:versions:list")
22
22
  .description("get a list of Remote Config template versions that have been published for a Firebase project")
23
- .option("--limit <maxResults>", "limit the number of versions being returned. Pass '0' to fetch all versions.")
23
+ .option("--limit <maxResults>", "limit the number of versions being returned. Pass '0' to fetch all versions")
24
24
  .before(requireAuth_1.requireAuth)
25
25
  .before(requirePermissions_1.requirePermissions, ["cloudconfig.configs.get"])
26
26
  .action(async (options) => {
@@ -6,7 +6,7 @@ const download_1 = require("../emulator/download");
6
6
  const types_1 = require("../emulator/types");
7
7
  const NAME = types_1.Emulators.DATABASE;
8
8
  exports.command = new command_1.Command(`setup:emulators:${NAME}`)
9
- .description(`downloads the ${NAME} emulator`)
9
+ .description(`download the ${NAME} emulator`)
10
10
  .action(() => {
11
11
  return (0, download_1.downloadEmulator)(NAME);
12
12
  });
@@ -7,7 +7,7 @@ const logger_1 = require("../logger");
7
7
  const downloadableEmulators_1 = require("../emulator/downloadableEmulators");
8
8
  const NAME = types_1.Emulators.DATACONNECT;
9
9
  exports.command = new command_1.Command(`setup:emulators:${NAME}`)
10
- .description(`downloads the ${NAME} emulator`)
10
+ .description(`download the ${NAME} emulator`)
11
11
  .action(async (options) => {
12
12
  await (0, downloadableEmulators_1.downloadIfNecessary)(NAME);
13
13
  if (!options.config) {
@@ -6,7 +6,7 @@ const download_1 = require("../emulator/download");
6
6
  const types_1 = require("../emulator/types");
7
7
  const NAME = types_1.Emulators.FIRESTORE;
8
8
  exports.command = new command_1.Command(`setup:emulators:${NAME}`)
9
- .description(`downloads the ${NAME} emulator`)
9
+ .description(`download the ${NAME} emulator`)
10
10
  .action(() => {
11
11
  return (0, download_1.downloadEmulator)(NAME);
12
12
  });
@@ -6,7 +6,7 @@ const download_1 = require("../emulator/download");
6
6
  const types_1 = require("../emulator/types");
7
7
  const EMULATOR_NAME = types_1.Emulators.PUBSUB;
8
8
  exports.command = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
9
- .description(`downloads the ${EMULATOR_NAME} emulator`)
9
+ .description(`download the ${EMULATOR_NAME} emulator`)
10
10
  .action(() => {
11
11
  return (0, download_1.downloadEmulator)(EMULATOR_NAME);
12
12
  });
@@ -6,7 +6,7 @@ const download_1 = require("../emulator/download");
6
6
  const types_1 = require("../emulator/types");
7
7
  const EMULATOR_NAME = types_1.Emulators.STORAGE;
8
8
  exports.command = new command_1.Command(`setup:emulators:${EMULATOR_NAME}`)
9
- .description(`downloads the ${EMULATOR_NAME} emulator`)
9
+ .description(`download the ${EMULATOR_NAME} emulator`)
10
10
  .action(() => {
11
11
  return (0, download_1.downloadEmulator)(EMULATOR_NAME);
12
12
  });
@@ -6,7 +6,7 @@ const download_1 = require("../emulator/download");
6
6
  const types_1 = require("../emulator/types");
7
7
  const NAME = types_1.Emulators.UI;
8
8
  exports.command = new command_1.Command(`setup:emulators:${NAME}`)
9
- .description(`downloads the ${NAME} emulator`)
9
+ .description(`download the ${NAME} emulator`)
10
10
  .action(() => {
11
11
  return (0, download_1.downloadEmulator)(NAME);
12
12
  });
package/lib/config.js CHANGED
@@ -127,6 +127,9 @@ class Config {
127
127
  return _.has(this.data, key);
128
128
  }
129
129
  path(pathName) {
130
+ if (path.isAbsolute(pathName)) {
131
+ return pathName;
132
+ }
130
133
  const outPath = path.normalize(path.join(this.projectDir, pathName));
131
134
  if (path.relative(this.projectDir, outPath).includes("..")) {
132
135
  throw new error_1.FirebaseError(clc.bold(pathName) + " is outside of project directory", { exit: 1 });
@@ -165,9 +168,9 @@ class Config {
165
168
  deleteProjectFile(p) {
166
169
  fs.removeSync(this.path(p));
167
170
  }
168
- askWriteProjectFile(p, content, force, confirmByDefault) {
169
- const writeTo = this.path(p);
170
- let next;
171
+ async askWriteProjectFile(path, content, force, confirmByDefault) {
172
+ const writeTo = this.path(path);
173
+ let next = true;
171
174
  if (typeof content !== "string") {
172
175
  content = JSON.stringify(content, null, 2) + "\n";
173
176
  }
@@ -176,27 +179,22 @@ class Config {
176
179
  existingContent = fsutils.readFile(writeTo);
177
180
  }
178
181
  if (existingContent && existingContent !== content && !force) {
179
- next = (0, prompt_1.promptOnce)({
182
+ next = await (0, prompt_1.promptOnce)({
180
183
  type: "confirm",
181
- message: "File " + clc.underline(p) + " already exists. Overwrite?",
184
+ message: "File " + clc.underline(path) + " already exists. Overwrite?",
182
185
  default: !!confirmByDefault,
183
186
  });
184
187
  }
188
+ if (existingContent === content) {
189
+ utils.logBullet(clc.bold(path) + " is unchanged");
190
+ }
191
+ else if (next) {
192
+ this.writeProjectFile(path, content);
193
+ utils.logSuccess("Wrote " + clc.bold(path));
194
+ }
185
195
  else {
186
- next = Promise.resolve(true);
196
+ utils.logBullet("Skipping write of " + clc.bold(path));
187
197
  }
188
- return next.then((result) => {
189
- if (existingContent === content) {
190
- utils.logBullet(clc.bold(p) + " is unchanged");
191
- }
192
- else if (result) {
193
- this.writeProjectFile(p, content);
194
- utils.logSuccess("Wrote " + clc.bold(p));
195
- }
196
- else {
197
- utils.logBullet("Skipping write of " + clc.bold(p));
198
- }
199
- });
200
198
  }
201
199
  static load(options, allowMissing) {
202
200
  const pd = (0, detectProjectRoot_1.detectProjectRoot)(options);
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.executeGraphQL = exports.dataconnectDataplaneClient = exports.DATACONNECT_API_VERSION = void 0;
3
+ exports.executeGraphQL = exports.dataconnectDataplaneClient = exports.DATACONNECT_API_VERSION = exports.dataconnectOrigin = void 0;
4
4
  const api_1 = require("../api");
5
+ var api_2 = require("../api");
6
+ Object.defineProperty(exports, "dataconnectOrigin", { enumerable: true, get: function () { return api_2.dataconnectOrigin; } });
5
7
  const apiv2_1 = require("../apiv2");
6
8
  exports.DATACONNECT_API_VERSION = "v1";
7
9
  function dataconnectDataplaneClient() {
@@ -205,6 +205,7 @@ function toBackend(build, paramValues) {
205
205
  }
206
206
  const bkEndpoint = Object.assign({ id: endpointId, project: bdEndpoint.project, region: region, entryPoint: bdEndpoint.entryPoint, platform: bdEndpoint.platform, runtime: bdEndpoint.runtime }, trigger);
207
207
  proto.copyIfPresent(bkEndpoint, bdEndpoint, "environmentVariables", "labels", "secretEnvironmentVariables");
208
+ r.resolveStrings(bkEndpoint, bdEndpoint, "serviceAccount");
208
209
  proto.convertIfPresent(bkEndpoint, bdEndpoint, "ingressSettings", (from) => {
209
210
  if (from !== null && !backend.AllIngressSettings.includes(from)) {
210
211
  throw new error_1.FirebaseError(`Cannot set ingress settings to invalid value ${from}`);
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.promptForMinInstances = exports.promptForUnsafeMigration = exports.promptForFunctionDeletion = exports.promptForFailurePolicies = void 0;
3
+ exports.promptForCleanupPolicyDays = exports.promptForMinInstances = exports.promptForUnsafeMigration = exports.promptForFunctionDeletion = exports.promptForFailurePolicies = void 0;
4
4
  const clc = require("colorette");
5
5
  const functionsDeployHelper_1 = require("./functionsDeployHelper");
6
6
  const error_1 = require("../../error");
@@ -9,6 +9,7 @@ const logger_1 = require("../../logger");
9
9
  const backend = require("./backend");
10
10
  const pricing = require("./pricing");
11
11
  const utils = require("../../utils");
12
+ const artifacts = require("../../functions/artifacts");
12
13
  async function promptForFailurePolicies(options, want, have) {
13
14
  const retryEndpoints = backend.allEndpoints(want).filter((e) => {
14
15
  return backend.isEventTriggered(e) && e.eventTrigger.retry;
@@ -187,3 +188,31 @@ async function promptForMinInstances(options, want, have) {
187
188
  }
188
189
  }
189
190
  exports.promptForMinInstances = promptForMinInstances;
191
+ async function promptForCleanupPolicyDays(options, locations) {
192
+ utils.logLabeledWarning("functions", `No cleanup policy detected for repositories in ${locations.join(", ")}. ` +
193
+ "This may result in a small monthly bill as container images accumulate over time.");
194
+ if (options.force) {
195
+ return artifacts.DEFAULT_CLEANUP_DAYS;
196
+ }
197
+ if (options.nonInteractive) {
198
+ throw new error_1.FirebaseError(`Functions successfully deployed but could not set up cleanup policy in ` +
199
+ `${locations.length > 1 ? "locations" : "location"} ${locations.join(", ")}. ` +
200
+ `Pass the --force option to automatically set up a cleanup policy or ` +
201
+ "run 'firebase functions:artifacts:setpolicy' to manually set up a cleanup policy.");
202
+ }
203
+ const result = await (0, prompt_1.promptOnce)({
204
+ type: "input",
205
+ name: "days",
206
+ default: artifacts.DEFAULT_CLEANUP_DAYS.toString(),
207
+ message: "How many days do you want to keep container images before they're deleted?",
208
+ validate: (input) => {
209
+ const days = parseInt(input);
210
+ if (isNaN(days) || days < 0) {
211
+ return "Please enter a non-negative number";
212
+ }
213
+ return true;
214
+ },
215
+ });
216
+ return parseInt(result);
217
+ }
218
+ exports.promptForCleanupPolicyDays = promptForCleanupPolicyDays;