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.
- package/lib/appdistribution/client.js +4 -2
- package/lib/apphosting/backend.js +65 -11
- package/lib/apphosting/config.js +130 -101
- package/lib/apphosting/rollout.js +3 -9
- package/lib/apphosting/secrets/dialogs.js +5 -2
- package/lib/apphosting/secrets/index.js +45 -3
- package/lib/apphosting/yaml.js +19 -8
- package/lib/commands/appdistribution-groups-create.js +1 -1
- package/lib/commands/appdistribution-groups-delete.js +1 -1
- package/lib/commands/appdistribution-groups-list.js +1 -1
- package/lib/commands/appdistribution-testers-add.js +1 -1
- package/lib/commands/appdistribution-testers-remove.js +1 -1
- package/lib/commands/apphosting-backends-create.js +1 -8
- package/lib/commands/apphosting-backends-delete.js +16 -26
- package/lib/commands/apphosting-backends-get.js +10 -16
- package/lib/commands/apphosting-backends-list.js +4 -10
- package/lib/commands/apphosting-rollouts-create.js +1 -8
- package/lib/commands/apphosting-secrets-access.js +1 -1
- package/lib/commands/apphosting-secrets-describe.js +1 -1
- package/lib/commands/apphosting-secrets-grantaccess.js +19 -9
- package/lib/commands/apphosting-secrets-set.js +31 -1
- package/lib/commands/apps-android-sha-create.js +1 -1
- package/lib/commands/apps-android-sha-delete.js +1 -1
- package/lib/commands/apps-android-sha-list.js +1 -1
- package/lib/commands/apps-create.js +1 -1
- package/lib/commands/apps-init.js +1 -1
- package/lib/commands/auth-export.js +1 -1
- package/lib/commands/auth-import.js +1 -1
- package/lib/commands/database-instances-create.js +1 -1
- package/lib/commands/database-profile.js +1 -2
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +1 -1
- package/lib/commands/dataconnect-sdk-generate.js +1 -1
- package/lib/commands/dataconnect-services-list.js +1 -1
- package/lib/commands/dataconnect-sql-diff.js +1 -1
- package/lib/commands/dataconnect-sql-grant.js +1 -1
- package/lib/commands/dataconnect-sql-migrate.js +2 -2
- package/lib/commands/dataconnect-sql-setup.js +1 -1
- package/lib/commands/dataconnect-sql-shell.js +1 -1
- package/lib/commands/deploy.js +3 -3
- package/lib/commands/emulators-exec.js +1 -1
- package/lib/commands/ext-dev-register.js +1 -1
- package/lib/commands/ext-dev-usage.js +2 -2
- package/lib/commands/ext-install.js +2 -3
- package/lib/commands/firestore-backups-delete.js +2 -2
- package/lib/commands/firestore-backups-get.js +1 -1
- package/lib/commands/firestore-backups-list.js +2 -2
- package/lib/commands/firestore-backups-schedules-create.js +4 -4
- package/lib/commands/firestore-backups-schedules-delete.js +2 -2
- package/lib/commands/firestore-backups-schedules-list.js +2 -2
- package/lib/commands/firestore-backups-schedules-update.js +1 -1
- package/lib/commands/firestore-databases-create.js +6 -6
- package/lib/commands/firestore-databases-delete.js +2 -2
- package/lib/commands/firestore-databases-get.js +1 -1
- package/lib/commands/firestore-databases-list.js +1 -1
- package/lib/commands/firestore-databases-restore.js +5 -5
- package/lib/commands/firestore-databases-update.js +4 -4
- package/lib/commands/firestore-delete.js +7 -8
- package/lib/commands/firestore-indexes-list.js +4 -4
- package/lib/commands/firestore-locations.js +1 -1
- package/lib/commands/functions-artifacts-setpolicy.js +11 -13
- package/lib/commands/functions-config-export.js +1 -1
- package/lib/commands/functions-deletegcfartifacts.js +1 -1
- package/lib/commands/functions-secrets-access.js +1 -1
- package/lib/commands/functions-secrets-describe.js +1 -1
- package/lib/commands/functions-secrets-destroy.js +2 -2
- package/lib/commands/functions-secrets-get.js +1 -1
- package/lib/commands/functions-secrets-prune.js +2 -2
- package/lib/commands/functions-secrets-set.js +3 -3
- package/lib/commands/index.js +0 -4
- package/lib/commands/init.js +3 -2
- package/lib/commands/internaltesting-frameworks-compose.js +1 -1
- package/lib/commands/remoteconfig-versions-list.js +1 -1
- package/lib/commands/setup-emulators-database.js +1 -1
- package/lib/commands/setup-emulators-dataconnect.js +1 -1
- package/lib/commands/setup-emulators-firestore.js +1 -1
- package/lib/commands/setup-emulators-pubsub.js +1 -1
- package/lib/commands/setup-emulators-storage.js +1 -1
- package/lib/commands/setup-emulators-ui.js +1 -1
- package/lib/config.js +16 -18
- package/lib/dataconnect/dataplaneClient.js +3 -1
- package/lib/deploy/functions/build.js +1 -0
- package/lib/deploy/functions/prompts.js +30 -1
- package/lib/deploy/functions/release/index.js +27 -9
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +4 -4
- package/lib/emulator/apphosting/config.js +15 -14
- package/lib/emulator/auth/operations.js +2 -1
- package/lib/emulator/constants.js +1 -1
- package/lib/emulator/dataconnect/pgliteServer.js +2 -1
- package/lib/emulator/dataconnectEmulator.js +2 -0
- package/lib/emulator/downloadableEmulators.js +9 -9
- package/lib/emulator/env.js +2 -1
- package/lib/emulator/initEmulators.js +29 -4
- package/lib/experiments.js +1 -13
- package/lib/functions/artifacts.js +89 -1
- package/lib/gcp/cloudfunctions.js +1 -1
- package/lib/gcp/cloudfunctionsv2.js +3 -3
- package/lib/gcp/cloudsql/permissions.js +2 -1
- package/lib/gcp/cloudsql/permissions_setup.js +8 -5
- package/lib/gcp/proto.js +4 -3
- package/lib/init/features/dataconnect/sdk.js +4 -5
- package/package.json +2 -2
- package/standalone/package.json +1 -1
- package/templates/init/dataconnect/dataconnect.yaml +1 -1
- package/lib/commands/apphosting-config-export.js +0 -29
- 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("
|
|
14
|
-
.option("-l, --location <locationId>", "
|
|
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("
|
|
17
|
-
.option("-d, --database <databaseId>", "
|
|
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>", "
|
|
20
|
-
.option("--day-of-week <dayOfWeek>", "
|
|
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("
|
|
15
|
-
.option("--force", "
|
|
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("
|
|
13
|
-
.option("-d, --database <databaseId>", "
|
|
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("
|
|
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("
|
|
16
|
-
.option("--location <locationId>", "
|
|
17
|
-
.option("--delete-protection <deleteProtectionState>", "
|
|
18
|
-
.option("--point-in-time-recovery <enablement>", "
|
|
19
|
-
.option("-k, --kms-key-name <kmsKeyName>", "
|
|
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("
|
|
16
|
-
.option("--force", "
|
|
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("
|
|
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("
|
|
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("
|
|
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>", "
|
|
18
|
-
.option("-e, --encryption-type <encryptionType>", `
|
|
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>", "
|
|
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("
|
|
16
|
-
.option("--json", "
|
|
17
|
-
.option("--delete-protection <deleteProtectionState>", "
|
|
18
|
-
.option("--point-in-time-recovery <enablement>", "
|
|
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("
|
|
51
|
-
.option("-r, --recursive", "
|
|
52
|
-
"specified level. May not be passed along with --shallow
|
|
53
|
-
.option("--shallow", "
|
|
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", "
|
|
57
|
-
|
|
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("
|
|
15
|
-
.option("--pretty", "
|
|
16
|
-
"JSON specification format
|
|
17
|
-
.option("--database <databaseId>", "
|
|
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("
|
|
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("
|
|
16
|
-
"
|
|
17
|
-
.option("--location <location>", "
|
|
18
|
-
"If omitted, uses the default functions location
|
|
19
|
-
.option("--days <days>",
|
|
20
|
-
.option("--none", "
|
|
21
|
-
.
|
|
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 ||
|
|
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("
|
|
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("
|
|
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("
|
|
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("
|
|
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("
|
|
14
|
-
.withForce("
|
|
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("
|
|
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("
|
|
17
|
-
.description("
|
|
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("
|
|
19
|
-
.withForce("
|
|
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>", '
|
|
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);
|
package/lib/commands/index.js
CHANGED
|
@@ -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");
|
package/lib/commands/init.js
CHANGED
|
@@ -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
|
|
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(
|
|
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>", "
|
|
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(`
|
|
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(`
|
|
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(`
|
|
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(`
|
|
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(`
|
|
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(`
|
|
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(
|
|
169
|
-
const writeTo = this.path(
|
|
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(
|
|
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
|
-
|
|
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;
|