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.
- package/README.md +53 -4
- package/lib/api.js +10 -2
- package/lib/appdistribution/client.js +2 -2
- package/lib/apphosting/backend.js +157 -55
- package/lib/apphosting/config.js +121 -101
- package/lib/apphosting/githubConnections.js +65 -100
- package/lib/apphosting/repo.js +22 -36
- package/lib/apphosting/rollout.js +5 -11
- package/lib/apphosting/secrets/dialogs.js +13 -11
- package/lib/apphosting/secrets/index.js +47 -5
- package/lib/apphosting/utils.js +1 -3
- package/lib/apphosting/yaml.js +35 -49
- package/lib/auth.js +23 -6
- package/lib/bin/cli.js +99 -0
- package/lib/bin/firebase.js +7 -123
- package/lib/bin/mcp.js +49 -0
- package/lib/checkValidTargetFilters.js +1 -0
- package/lib/command.js +3 -2
- package/lib/commands/appdistribution-distribute.js +1 -1
- 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 +2 -2
- package/lib/commands/appdistribution-testers-add.js +1 -1
- package/lib/commands/appdistribution-testers-list.js +3 -3
- package/lib/commands/appdistribution-testers-remove.js +1 -1
- package/lib/commands/apphosting-backends-create.js +3 -3
- package/lib/commands/apphosting-backends-delete.js +23 -27
- package/lib/commands/apphosting-backends-get.js +12 -12
- package/lib/commands/apphosting-backends-list.js +5 -5
- package/lib/commands/apphosting-builds-create.js +8 -2
- package/lib/commands/apphosting-builds-get.js +8 -1
- package/lib/commands/apphosting-rollouts-create.js +3 -3
- package/lib/commands/apphosting-rollouts-list.js +8 -2
- package/lib/commands/apphosting-secrets-access.js +1 -1
- package/lib/commands/apphosting-secrets-describe.js +2 -2
- package/lib/commands/apphosting-secrets-grantaccess.js +20 -10
- package/lib/commands/apphosting-secrets-set.js +27 -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 +2 -2
- package/lib/commands/apps-create.js +4 -108
- package/lib/commands/apps-init.js +94 -0
- package/lib/commands/apps-list.js +1 -1
- package/lib/commands/apps-sdkconfig.js +5 -10
- package/lib/commands/auth-export.js +1 -1
- package/lib/commands/auth-import.js +1 -1
- package/lib/commands/database-import.js +4 -6
- package/lib/commands/database-instances-create.js +1 -1
- package/lib/commands/database-instances-list.js +1 -1
- package/lib/commands/database-profile.js +1 -2
- package/lib/commands/database-remove.js +4 -6
- package/lib/commands/database-set.js +6 -6
- package/lib/commands/database-settings-set.js +1 -1
- package/lib/commands/database-update.js +6 -6
- package/lib/commands/dataconnect-sdk-generate.js +5 -2
- package/lib/commands/dataconnect-services-list.js +2 -2
- package/lib/commands/dataconnect-sql-diff.js +2 -2
- package/lib/commands/dataconnect-sql-grant.js +3 -3
- package/lib/commands/dataconnect-sql-migrate.js +2 -2
- package/lib/commands/dataconnect-sql-setup.js +39 -0
- package/lib/commands/dataconnect-sql-shell.js +5 -7
- package/lib/commands/deploy.js +4 -3
- package/lib/commands/emulators-exec.js +1 -1
- package/lib/commands/emulators-start.js +4 -3
- package/lib/commands/experiments-list.js +1 -1
- package/lib/commands/ext-dev-deprecate.js +1 -0
- package/lib/commands/ext-dev-init.js +3 -12
- package/lib/commands/ext-dev-list.js +1 -1
- package/lib/commands/ext-dev-register.js +3 -5
- package/lib/commands/ext-dev-undeprecate.js +1 -2
- package/lib/commands/ext-dev-usage.js +4 -6
- package/lib/commands/ext-export.js +1 -2
- package/lib/commands/ext-install.js +3 -3
- package/lib/commands/ext-sdk-install.js +1 -0
- package/lib/commands/ext-update.js +1 -0
- package/lib/commands/firestore-backups-delete.js +3 -4
- 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 +3 -4
- 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 +3 -7
- 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 +13 -14
- package/lib/commands/firestore-indexes-list.js +4 -4
- package/lib/commands/firestore-locations.js +1 -1
- package/lib/commands/functions-artifacts-setpolicy.js +132 -0
- package/lib/commands/functions-config-export.js +6 -10
- package/lib/commands/functions-delete.js +5 -7
- package/lib/commands/functions-deletegcfartifacts.js +5 -5
- package/lib/commands/functions-list.js +24 -33
- 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 +10 -12
- package/lib/commands/functions-secrets-get.js +1 -1
- package/lib/commands/functions-secrets-prune.js +14 -15
- package/lib/commands/functions-secrets-set.js +14 -18
- package/lib/commands/hosting-channel-create.js +1 -2
- package/lib/commands/hosting-channel-delete.js +4 -4
- package/lib/commands/hosting-channel-list.js +1 -1
- package/lib/commands/hosting-channel-open.js +2 -3
- package/lib/commands/hosting-disable.js +5 -5
- package/lib/commands/hosting-sites-delete.js +4 -4
- package/lib/commands/hosting-sites-get.js +1 -1
- package/lib/commands/hosting-sites-list.js +1 -1
- package/lib/commands/index.js +7 -4
- package/lib/commands/init.js +54 -60
- package/lib/commands/internaltesting-frameworks-compose.js +1 -1
- package/lib/commands/login-use.js +2 -11
- package/lib/commands/login.js +10 -8
- package/lib/commands/logout.js +2 -3
- package/lib/commands/mcp.js +11 -0
- package/lib/commands/open.js +4 -2
- package/lib/commands/projects-create.js +1 -2
- package/lib/commands/projects-list.js +1 -1
- package/lib/commands/remoteconfig-get.js +1 -1
- package/lib/commands/remoteconfig-rollback.js +5 -5
- package/lib/commands/remoteconfig-versions-list.js +2 -2
- 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/commands/use.js +115 -111
- package/lib/config.js +49 -33
- package/lib/crashlytics/buildToolsJarHelper.js +1 -1
- package/lib/crashlytics/listTopIssues.js +45 -0
- package/lib/dataconnect/build.js +61 -4
- package/lib/dataconnect/client.js +26 -17
- package/lib/dataconnect/cloudAICompanionClient.js +72 -0
- package/lib/dataconnect/dataplaneClient.js +19 -2
- package/lib/dataconnect/ensureApis.js +6 -3
- package/lib/dataconnect/fileUtils.js +39 -6
- package/lib/dataconnect/freeTrial.js +21 -9
- package/lib/dataconnect/graphqlError.js +56 -2
- package/lib/dataconnect/provisionCloudSql.js +23 -12
- package/lib/dataconnect/schemaMigration.js +46 -26
- package/lib/dataconnect/types.js +5 -1
- package/lib/defaultCredentials.js +12 -1
- package/lib/deploy/apphosting/args.js +2 -0
- package/lib/deploy/apphosting/deploy.js +77 -0
- package/lib/deploy/apphosting/index.js +9 -0
- package/lib/deploy/apphosting/prepare.js +138 -0
- package/lib/deploy/apphosting/release.js +56 -0
- package/lib/deploy/apphosting/util.js +65 -0
- package/lib/deploy/dataconnect/deploy.js +14 -7
- package/lib/deploy/dataconnect/prepare.js +3 -5
- package/lib/deploy/extensions/v2FunctionHelper.js +2 -1
- package/lib/deploy/firestore/deploy.js +50 -4
- package/lib/deploy/functions/build.js +1 -0
- package/lib/deploy/functions/checkIam.js +41 -6
- package/lib/deploy/functions/containerCleaner.js +17 -2
- package/lib/deploy/functions/ensure.js +2 -1
- package/lib/deploy/functions/params.js +10 -17
- package/lib/deploy/functions/prepare.js +51 -18
- package/lib/deploy/functions/prepareFunctionsUpload.js +9 -5
- package/lib/deploy/functions/prompts.js +24 -17
- package/lib/deploy/functions/release/fabricator.js +4 -4
- package/lib/deploy/functions/release/index.js +27 -9
- package/lib/deploy/functions/release/planner.js +1 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +13 -5
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +4 -4
- package/lib/deploy/functions/runtimes/python/index.js +4 -1
- package/lib/deploy/functions/runtimes/supported/types.js +17 -11
- package/lib/deploy/functions/services/firestore.js +23 -4
- package/lib/deploy/index.js +29 -10
- package/lib/deploy/lifecycleHooks.js +6 -12
- package/lib/emulator/ExpressBasedEmulator.js +1 -1
- package/lib/emulator/apphosting/config.js +15 -14
- package/lib/emulator/apphosting/index.js +2 -0
- package/lib/emulator/apphosting/serve.js +147 -10
- package/lib/emulator/auth/cloudFunctions.js +13 -1
- package/lib/emulator/auth/operations.js +2 -1
- package/lib/emulator/auth/widget_ui.js +2 -1
- package/lib/emulator/commandUtils.js +14 -20
- package/lib/emulator/constants.js +2 -0
- package/lib/emulator/controller.js +24 -9
- package/lib/emulator/dataconnect/pgliteServer.js +136 -45
- package/lib/emulator/dataconnectEmulator.js +34 -6
- package/lib/emulator/dataconnectToolkitController.js +5 -0
- package/lib/emulator/downloadableEmulatorInfo.json +81 -0
- package/lib/emulator/downloadableEmulators.js +28 -80
- package/lib/emulator/env.js +47 -1
- package/lib/emulator/extensionsEmulator.js +5 -3
- package/lib/emulator/functionsEmulator.js +6 -26
- package/lib/emulator/hub.js +5 -4
- package/lib/emulator/hubClient.js +5 -0
- package/lib/emulator/initEmulators.js +29 -15
- package/lib/emulator/ui.js +4 -8
- package/lib/ensureApiEnabled.js +32 -1
- package/lib/experiments.js +11 -12
- package/lib/extensions/askUserForEventsConfig.js +6 -15
- package/lib/extensions/askUserForParam.js +23 -52
- package/lib/extensions/change-log.js +1 -25
- package/lib/extensions/checkProjectBilling.js +3 -9
- package/lib/extensions/diagnose.js +3 -6
- package/lib/extensions/emulator/triggerHelper.js +4 -0
- package/lib/extensions/extensionsHelper.js +25 -31
- package/lib/extensions/listExtensions.js +1 -1
- package/lib/extensions/manifest.js +3 -7
- package/lib/extensions/paramHelper.js +11 -2
- package/lib/extensions/provisioningHelper.js +1 -1
- package/lib/extensions/tos.js +4 -2
- package/lib/extensions/utils.js +1 -10
- package/lib/firebaseConfigValidate.js +7 -5
- package/lib/firestore/delete.js +5 -4
- package/lib/firestore/pretty-print.js +1 -1
- package/lib/frameworks/angular/index.js +11 -6
- package/lib/frameworks/angular/utils.js +76 -47
- package/lib/frameworks/constants.js +1 -1
- package/lib/frameworks/index.js +6 -4
- package/lib/frameworks/next/index.js +7 -4
- package/lib/frameworks/utils.js +11 -3
- package/lib/frameworks/vite/index.js +2 -3
- package/lib/fsAsync.js +9 -2
- package/lib/fsutils.js +16 -1
- package/lib/functions/artifacts.js +196 -0
- package/lib/functions/secrets.js +15 -16
- package/lib/gcp/apphosting.js +13 -1
- package/lib/gcp/artifactregistry.js +27 -2
- package/lib/gcp/auth.js +113 -1
- package/lib/gcp/cloudbilling.js +12 -1
- package/lib/gcp/cloudfunctions.js +32 -4
- package/lib/gcp/cloudfunctionsv2.js +15 -9
- package/lib/gcp/cloudscheduler.js +2 -2
- package/lib/gcp/cloudsql/cloudsqladmin.js +32 -11
- package/lib/gcp/cloudsql/connect.js +21 -14
- package/lib/gcp/cloudsql/interactive.js +1 -1
- package/lib/gcp/cloudsql/permissions.js +46 -99
- package/lib/gcp/cloudsql/permissionsSetup.js +224 -0
- package/lib/gcp/computeEngine.js +19 -2
- package/lib/gcp/devConnect.js +6 -1
- package/lib/gcp/firestore.js +55 -16
- package/lib/gcp/iam.js +1 -5
- package/lib/gcp/proto.js +4 -3
- package/lib/gcp/run.js +18 -1
- package/lib/gcp/serviceusage.js +2 -1
- package/lib/gcp/storage.js +47 -1
- package/lib/gemini/fdcExperience.js +56 -0
- package/lib/gemini/types.js +2 -0
- package/lib/hosting/api.js +4 -0
- package/lib/hosting/implicitInit.js +7 -3
- package/lib/hosting/interactive.js +2 -3
- package/lib/index.js +1 -2
- package/lib/init/features/account.js +2 -4
- package/lib/init/features/apphosting.js +75 -6
- package/lib/init/features/database.js +63 -62
- package/lib/init/features/dataconnect/index.js +131 -85
- package/lib/init/features/dataconnect/sdk.js +73 -18
- package/lib/init/features/emulators.js +29 -46
- package/lib/init/features/firestore/index.js +79 -43
- package/lib/init/features/firestore/indexes.js +30 -45
- package/lib/init/features/firestore/rules.js +36 -62
- package/lib/init/features/functions/index.js +11 -16
- package/lib/init/features/functions/javascript.js +17 -30
- package/lib/init/features/functions/npm-dependencies.js +4 -8
- package/lib/init/features/functions/python.js +1 -3
- package/lib/init/features/functions/typescript.js +25 -43
- package/lib/init/features/genkit/index.js +111 -106
- package/lib/init/features/hosting/github.js +22 -52
- package/lib/init/features/hosting/index.js +37 -57
- package/lib/init/features/index.js +10 -5
- package/lib/init/features/project.js +18 -21
- package/lib/init/features/remoteconfig.js +5 -10
- package/lib/init/features/storage.js +30 -10
- package/lib/init/index.js +79 -24
- package/lib/logger.js +76 -3
- package/lib/management/apps.js +292 -7
- package/lib/management/projects.js +100 -52
- package/lib/mcp/errors.js +20 -0
- package/lib/mcp/index.js +227 -0
- package/lib/mcp/tool.js +12 -0
- package/lib/mcp/tools/apphosting/fetch_logs.js +68 -0
- package/lib/mcp/tools/apphosting/index.js +6 -0
- package/lib/mcp/tools/apphosting/list_backends.js +51 -0
- package/lib/mcp/tools/auth/disable_user.js +30 -0
- package/lib/mcp/tools/auth/get_user.js +38 -0
- package/lib/mcp/tools/auth/index.js +15 -0
- package/lib/mcp/tools/auth/list_users.js +36 -0
- package/lib/mcp/tools/auth/set_claims.js +43 -0
- package/lib/mcp/tools/auth/set_sms_region_policy.js +36 -0
- package/lib/mcp/tools/core/consult_assistant.js +28 -0
- package/lib/mcp/tools/core/create_android_sha.js +43 -0
- package/lib/mcp/tools/core/create_app.js +90 -0
- package/lib/mcp/tools/core/create_project.js +68 -0
- package/lib/mcp/tools/core/get_admin_sdk_config.js +26 -0
- package/lib/mcp/tools/core/get_environment.js +51 -0
- package/lib/mcp/tools/core/get_project.js +22 -0
- package/lib/mcp/tools/core/get_sdk_config.js +40 -0
- package/lib/mcp/tools/core/index.js +29 -0
- package/lib/mcp/tools/core/init.js +153 -0
- package/lib/mcp/tools/core/list_apps.js +34 -0
- package/lib/mcp/tools/core/list_projects.js +45 -0
- package/lib/mcp/tools/core/update_environment.js +55 -0
- package/lib/mcp/tools/crashlytics/index.js +5 -0
- package/lib/mcp/tools/crashlytics/list_top_issues.js +39 -0
- package/lib/mcp/tools/dataconnect/converter.js +60 -0
- package/lib/mcp/tools/dataconnect/emulator.js +16 -0
- package/lib/mcp/tools/dataconnect/execute_graphql.js +48 -0
- package/lib/mcp/tools/dataconnect/execute_graphql_read.js +48 -0
- package/lib/mcp/tools/dataconnect/execute_mutation.js +62 -0
- package/lib/mcp/tools/dataconnect/execute_query.js +62 -0
- package/lib/mcp/tools/dataconnect/generate_operation.js +34 -0
- package/lib/mcp/tools/dataconnect/generate_schema.js +26 -0
- package/lib/mcp/tools/dataconnect/get_connector.js +31 -0
- package/lib/mcp/tools/dataconnect/get_schema.js +31 -0
- package/lib/mcp/tools/dataconnect/index.js +23 -0
- package/lib/mcp/tools/dataconnect/list_services.js +23 -0
- package/lib/mcp/tools/firestore/converter.js +102 -0
- package/lib/mcp/tools/firestore/delete_document.js +50 -0
- package/lib/mcp/tools/firestore/get_documents.js +58 -0
- package/lib/mcp/tools/firestore/index.js +17 -0
- package/lib/mcp/tools/firestore/list_collections.js +36 -0
- package/lib/mcp/tools/firestore/query_collection.js +132 -0
- package/lib/mcp/tools/index.js +62 -0
- package/lib/mcp/tools/messaging/index.js +5 -0
- package/lib/mcp/tools/messaging/send_message.js +42 -0
- package/lib/mcp/tools/remoteconfig/get_template.js +27 -0
- package/lib/mcp/tools/remoteconfig/index.js +7 -0
- package/lib/mcp/tools/remoteconfig/publish_template.js +34 -0
- package/lib/mcp/tools/remoteconfig/rollback_template.js +29 -0
- package/lib/mcp/tools/rules/get_rules.js +29 -0
- package/lib/mcp/tools/rules/validate_rules.js +97 -0
- package/lib/mcp/tools/storage/get_download_url.js +40 -0
- package/lib/mcp/tools/storage/get_rules.js +26 -0
- package/lib/mcp/tools/storage/index.js +11 -0
- package/lib/mcp/types.js +13 -0
- package/lib/mcp/util.js +214 -0
- package/lib/mcp/util.test.js +468 -0
- package/lib/messaging/interfaces.js +2 -0
- package/lib/messaging/sendMessage.js +48 -0
- package/lib/operation-poller.js +3 -1
- package/lib/profileReport.js +1 -1
- package/lib/prompt.js +86 -54
- package/lib/remoteconfig/publish.js +39 -0
- package/lib/requireAuth.js +2 -2
- package/lib/requireTosAcceptance.js +4 -0
- package/lib/rulesDeploy.js +10 -15
- package/lib/track.js +7 -37
- package/lib/utils.js +28 -41
- package/lib/vsCodeUtils.js +7 -3
- package/package.json +31 -15
- package/schema/connector-yaml.json +12 -0
- package/schema/dataconnect-yaml.json +5 -0
- package/schema/extension-yaml.json +17 -4
- package/schema/firebase-config.json +1117 -2121
- package/standalone/package-lock.json +1255 -992
- package/standalone/package.json +1 -1
- package/templates/dataconnect-prompts/operation-generation-cursor-windsurf-rule.txt +273 -0
- package/templates/dataconnect-prompts/schema-generation-cursor-windsurf-rule.txt +653 -0
- package/templates/genkit/firebase.0.9.0.template +1 -1
- package/templates/genkit/firebase.1.0.0.template +71 -0
- package/templates/init/dataconnect/connector.yaml +4 -1
- package/templates/init/dataconnect/dataconnect.yaml +1 -1
- package/templates/init/dataconnect/mutations.gql +9 -26
- package/templates/init/dataconnect/queries.gql +9 -14
- package/templates/init/dataconnect/schema.gql +28 -21
- package/templates/init/firestore/firestore.rules +2 -0
- package/templates/init/functions/javascript/index.js +14 -1
- package/templates/init/functions/javascript/package.lint.json +1 -1
- package/templates/init/functions/javascript/package.nolint.json +1 -1
- package/templates/init/functions/python/_gitignore +6 -1
- package/templates/init/functions/python/main.py +8 -0
- package/templates/init/functions/typescript/index.ts +14 -1
- package/templates/init/functions/typescript/package.lint.json +2 -2
- package/templates/init/functions/typescript/package.nolint.json +3 -3
- package/lib/commands/apphosting-config-export.js +0 -28
- package/lib/commands/experimental-functions-shell.js +0 -13
- package/lib/emulator/dataconnect/pg-gateway/auth/base-auth-flow.js +0 -11
- package/lib/emulator/dataconnect/pg-gateway/auth/cert.js +0 -58
- package/lib/emulator/dataconnect/pg-gateway/auth/index.js +0 -22
- package/lib/emulator/dataconnect/pg-gateway/auth/md5.js +0 -124
- package/lib/emulator/dataconnect/pg-gateway/auth/password.js +0 -54
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/sasl-mechanism.js +0 -34
- package/lib/emulator/dataconnect/pg-gateway/auth/sasl/scram-sha-256.js +0 -270
- package/lib/emulator/dataconnect/pg-gateway/backend-error.js +0 -75
- package/lib/emulator/dataconnect/pg-gateway/buffer-reader.js +0 -54
- package/lib/emulator/dataconnect/pg-gateway/buffer-writer.js +0 -79
- package/lib/emulator/dataconnect/pg-gateway/connection.js +0 -315
- package/lib/emulator/dataconnect/pg-gateway/connection.types.js +0 -8
- package/lib/emulator/dataconnect/pg-gateway/crypto.js +0 -40
- package/lib/emulator/dataconnect/pg-gateway/duplex.js +0 -53
- package/lib/emulator/dataconnect/pg-gateway/index.js +0 -27
- package/lib/emulator/dataconnect/pg-gateway/message-buffer.js +0 -82
- package/lib/emulator/dataconnect/pg-gateway/message-codes.js +0 -52
- package/lib/emulator/dataconnect/pg-gateway/platforms/node/index.js +0 -16
- package/lib/emulator/dataconnect/pg-gateway/polyfills/readable-stream-async-iterator.js +0 -35
- package/lib/emulator/dataconnect/pg-gateway/utils.js +0 -40
- package/templates/setup/web.js +0 -5
- /package/lib/{emulator/dataconnect/pg-gateway/auth/trust.js → dataconnect/cloudAICompanionTypes.js} +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const error_1 = require("../error");
|
|
7
|
+
const projectUtils_1 = require("../projectUtils");
|
|
8
|
+
const prompt_1 = require("../prompt");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
const requireAuth_1 = require("../requireAuth");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
const artifactregistry = require("../gcp/artifactregistry");
|
|
13
|
+
const artifacts = require("../functions/artifacts");
|
|
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
|
+
"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")
|
|
22
|
+
.before(requireAuth_1.requireAuth)
|
|
23
|
+
.before(async (options) => {
|
|
24
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
|
+
await artifactregistry.ensureApiEnabled(projectId);
|
|
26
|
+
})
|
|
27
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
28
|
+
"artifactregistry.repositories.update",
|
|
29
|
+
"artifactregistry.versions.delete",
|
|
30
|
+
])
|
|
31
|
+
.action(async (options) => {
|
|
32
|
+
if (options.days && options.none) {
|
|
33
|
+
throw new error_1.FirebaseError("Cannot specify both --days and --none options.");
|
|
34
|
+
}
|
|
35
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
36
|
+
const location = options.location || "us-central1";
|
|
37
|
+
let daysToKeep = parseInt(options.days || artifacts.DEFAULT_CLEANUP_DAYS, 10);
|
|
38
|
+
const repoPath = artifacts.makeRepoPath(projectId, location);
|
|
39
|
+
let repository;
|
|
40
|
+
try {
|
|
41
|
+
repository = await artifactregistry.getRepository(repoPath);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
if (err.status === 404) {
|
|
45
|
+
(0, utils_1.logBullet)(`Repository '${repoPath}' does not exist in Artifact Registry.`);
|
|
46
|
+
(0, utils_1.logBullet)(`Please deploy your functions first using: ` +
|
|
47
|
+
`${clc.bold(`firebase deploy --only functions`)}`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
if (options.none) {
|
|
53
|
+
const existingPolicy = artifacts.findExistingPolicy(repository);
|
|
54
|
+
if (artifacts.hasCleanupOptOut(repository) && !existingPolicy) {
|
|
55
|
+
(0, utils_1.logBullet)(`Repository '${repoPath}' is already opted out from cleanup policies.`);
|
|
56
|
+
(0, utils_1.logBullet)(`No changes needed.`);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
(0, utils_1.logBullet)(`You are about to opt-out from cleanup policy for repository '${repoPath}'.`);
|
|
60
|
+
(0, utils_1.logBullet)(`This will prevent suggestions to set up cleanup policy during initialization and deployment.`);
|
|
61
|
+
if (existingPolicy) {
|
|
62
|
+
(0, utils_1.logBullet)(`Note: This will remove the existing cleanup policy from the repository.`);
|
|
63
|
+
}
|
|
64
|
+
const confirmOptOut = await (0, prompt_1.confirm)({
|
|
65
|
+
message: "Do you want to continue?",
|
|
66
|
+
default: true,
|
|
67
|
+
force: options.force,
|
|
68
|
+
nonInteractive: options.nonInteractive,
|
|
69
|
+
});
|
|
70
|
+
if (!confirmOptOut) {
|
|
71
|
+
throw new error_1.FirebaseError("Command aborted.", { exit: 1 });
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
await artifacts.optOutRepository(repository);
|
|
75
|
+
(0, utils_1.logSuccess)(`Successfully opted out from cleanup policy for ${clc.bold(repoPath)}`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
throw new error_1.FirebaseError("Failed to opt-out from artifact registry cleanup policy", {
|
|
80
|
+
original: err,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (isNaN(daysToKeep) || daysToKeep < 0) {
|
|
85
|
+
throw new error_1.FirebaseError("Days must be a non-negative number");
|
|
86
|
+
}
|
|
87
|
+
if (daysToKeep === 0) {
|
|
88
|
+
daysToKeep = 0.003472;
|
|
89
|
+
}
|
|
90
|
+
if (artifacts.hasSameCleanupPolicy(repository, daysToKeep)) {
|
|
91
|
+
(0, utils_1.logBullet)(`A cleanup policy already exists that deletes images older than ${clc.bold(daysToKeep)} days.`);
|
|
92
|
+
(0, utils_1.logBullet)(`No changes needed.`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
(0, utils_1.logBullet)(`You are about to set up a cleanup policy for Cloud Run functions container images in location ${clc.bold(location)}`);
|
|
96
|
+
(0, utils_1.logBullet)(`This policy will automatically delete container images that are older than ${clc.bold(daysToKeep)} days`);
|
|
97
|
+
(0, utils_1.logBullet)("This helps reduce storage costs by removing old container images that are no longer needed");
|
|
98
|
+
const existingPolicy = artifacts.findExistingPolicy(repository);
|
|
99
|
+
let isUpdate = false;
|
|
100
|
+
if (existingPolicy && existingPolicy.condition?.olderThan) {
|
|
101
|
+
const existingDays = artifacts.parseDaysFromPolicy(existingPolicy.condition.olderThan);
|
|
102
|
+
if (existingDays) {
|
|
103
|
+
isUpdate = true;
|
|
104
|
+
(0, utils_1.logBullet)(`Note: This will update an existing policy that currently deletes images older than ${clc.bold(existingDays)} days`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (artifacts.hasCleanupOptOut(repository)) {
|
|
108
|
+
(0, utils_1.logBullet)(`Note: This repository was previously opted out from cleanup policy. This action will remove the opt-out status.`);
|
|
109
|
+
}
|
|
110
|
+
const confirmSetup = await (0, prompt_1.confirm)({
|
|
111
|
+
message: "Do you want to continue?",
|
|
112
|
+
default: true,
|
|
113
|
+
force: options.force,
|
|
114
|
+
nonInteractive: options.nonInteractive,
|
|
115
|
+
});
|
|
116
|
+
if (!confirmSetup) {
|
|
117
|
+
throw new error_1.FirebaseError("Command aborted.", { exit: 1 });
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
await artifacts.setCleanupPolicy(repository, daysToKeep);
|
|
121
|
+
const successMessage = isUpdate
|
|
122
|
+
? `Successfully updated cleanup policy to delete images older than ${clc.bold(daysToKeep)} days`
|
|
123
|
+
: `Successfully set up cleanup policy that deletes images older than ${clc.bold(daysToKeep)} days`;
|
|
124
|
+
(0, utils_1.logSuccess)(successMessage);
|
|
125
|
+
(0, utils_1.logBullet)(`Cleanup policy has been set for ${clc.bold(repoPath)}`);
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
throw new error_1.FirebaseError("Failed to set up artifact registry cleanup policy", {
|
|
129
|
+
original: err,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
});
|
|
@@ -42,13 +42,11 @@ async function checkRequiredPermission(pInfos) {
|
|
|
42
42
|
}
|
|
43
43
|
(0, utils_1.logWarning)("You are missing the following permissions to read functions config on project " +
|
|
44
44
|
`${clc.bold(pInfo.projectId)}:\n\t${result.missing.join("\n\t")}`);
|
|
45
|
-
const
|
|
46
|
-
type: "confirm",
|
|
47
|
-
name: "skip",
|
|
48
|
-
default: true,
|
|
45
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
49
46
|
message: `Continue without importing configs from project ${pInfo.projectId}?`,
|
|
47
|
+
default: true,
|
|
50
48
|
});
|
|
51
|
-
if (!
|
|
49
|
+
if (!confirmed) {
|
|
52
50
|
throw new error_1.FirebaseError("Command aborted!");
|
|
53
51
|
}
|
|
54
52
|
}
|
|
@@ -56,12 +54,10 @@ async function checkRequiredPermission(pInfos) {
|
|
|
56
54
|
async function promptForPrefix(errMsg) {
|
|
57
55
|
(0, utils_1.logWarning)("The following configs keys could not be exported as environment variables:\n");
|
|
58
56
|
(0, utils_1.logWarning)(errMsg);
|
|
59
|
-
return await (0, prompt_1.
|
|
60
|
-
type: "input",
|
|
61
|
-
name: "prefix",
|
|
57
|
+
return await (0, prompt_1.input)({
|
|
62
58
|
default: "CONFIG_",
|
|
63
59
|
message: "Enter a PREFIX to rename invalid environment variable keys:",
|
|
64
|
-
}
|
|
60
|
+
});
|
|
65
61
|
}
|
|
66
62
|
function fromEntries(itr) {
|
|
67
63
|
const obj = {};
|
|
@@ -71,7 +67,7 @@ function fromEntries(itr) {
|
|
|
71
67
|
return obj;
|
|
72
68
|
}
|
|
73
69
|
exports.command = new command_1.Command("functions:config:export")
|
|
74
|
-
.description("
|
|
70
|
+
.description("export environment config as environment variables in dotenv format")
|
|
75
71
|
.before(requirePermissions_1.requirePermissions, [
|
|
76
72
|
"runtimeconfig.configs.list",
|
|
77
73
|
"runtimeconfig.configs.get",
|
|
@@ -16,7 +16,6 @@ const planner = require("../deploy/functions/release/planner");
|
|
|
16
16
|
const fabricator = require("../deploy/functions/release/fabricator");
|
|
17
17
|
const executor = require("../deploy/functions/release/executor");
|
|
18
18
|
const reporter = require("../deploy/functions/release/reporter");
|
|
19
|
-
const containerCleaner = require("../deploy/functions/containerCleaner");
|
|
20
19
|
const getProjectNumber_1 = require("../getProjectNumber");
|
|
21
20
|
exports.command = new command_1.Command("functions:delete [filters...]")
|
|
22
21
|
.description("delete one or more Cloud Functions by name or group name.")
|
|
@@ -56,14 +55,14 @@ exports.command = new command_1.Command("functions:delete [filters...]")
|
|
|
56
55
|
throw new error_1.FirebaseError(`The specified filters do not match any existing functions in project ${clc.bold(context.projectId)}.`);
|
|
57
56
|
}
|
|
58
57
|
const deleteList = allEpToDelete.map((func) => `\t${helper.getFunctionLabel(func)}`).join("\n");
|
|
59
|
-
const confirmDeletion = await (0, prompt_1.
|
|
60
|
-
type: "confirm",
|
|
61
|
-
name: "force",
|
|
62
|
-
default: false,
|
|
58
|
+
const confirmDeletion = await (0, prompt_1.confirm)({
|
|
63
59
|
message: "You are about to delete the following Cloud Functions:\n" +
|
|
64
60
|
deleteList +
|
|
65
61
|
"\n Are you sure?",
|
|
66
|
-
|
|
62
|
+
default: false,
|
|
63
|
+
force: options.force,
|
|
64
|
+
nonInteractive: options.nonInteractive,
|
|
65
|
+
});
|
|
67
66
|
if (!confirmDeletion) {
|
|
68
67
|
throw new error_1.FirebaseError("Command aborted.");
|
|
69
68
|
}
|
|
@@ -91,5 +90,4 @@ exports.command = new command_1.Command("functions:delete [filters...]")
|
|
|
91
90
|
exit: 1,
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
|
-
await containerCleaner.cleanupBuildImages([], allEpToDelete);
|
|
95
93
|
});
|
|
@@ -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.")
|
|
@@ -27,12 +27,12 @@ exports.command = new command_1.Command("functions:deletegcfartifacts")
|
|
|
27
27
|
const dockerHelper = {};
|
|
28
28
|
try {
|
|
29
29
|
const gcfPaths = await (0, containerCleaner_1.listGcfPaths)(projectId, regions, dockerHelper);
|
|
30
|
-
const confirmDeletion = await (0, prompt_1.
|
|
31
|
-
type: "confirm",
|
|
32
|
-
name: "force",
|
|
30
|
+
const confirmDeletion = await (0, prompt_1.confirm)({
|
|
33
31
|
default: false,
|
|
34
32
|
message: getConfirmationMessage(gcfPaths),
|
|
35
|
-
|
|
33
|
+
force: options.force,
|
|
34
|
+
nonInteractive: options.nonInteractive,
|
|
35
|
+
});
|
|
36
36
|
if (!confirmDeletion) {
|
|
37
37
|
throw new error_1.FirebaseError("Command aborted.", { exit: 1 });
|
|
38
38
|
}
|
|
@@ -2,46 +2,37 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const command_1 = require("../command");
|
|
5
|
-
const error_1 = require("../error");
|
|
6
5
|
const projectUtils_1 = require("../projectUtils");
|
|
7
6
|
const requirePermissions_1 = require("../requirePermissions");
|
|
8
7
|
const backend = require("../deploy/functions/backend");
|
|
9
8
|
const logger_1 = require("../logger");
|
|
10
|
-
const Table = require("cli-
|
|
9
|
+
const Table = require("cli-table3");
|
|
11
10
|
exports.command = new command_1.Command("functions:list")
|
|
12
11
|
.description("list all deployed functions in your Firebase project")
|
|
13
12
|
.before(requirePermissions_1.requirePermissions, ["cloudfunctions.functions.list"])
|
|
14
13
|
.action(async (options) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
table.push(entry);
|
|
37
|
-
}
|
|
38
|
-
logger_1.logger.info(table.toString());
|
|
39
|
-
return endpointsList;
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
throw new error_1.FirebaseError("Failed to list functions", {
|
|
43
|
-
exit: 1,
|
|
44
|
-
original: err,
|
|
45
|
-
});
|
|
14
|
+
const context = {
|
|
15
|
+
projectId: (0, projectUtils_1.needProjectId)(options),
|
|
16
|
+
};
|
|
17
|
+
const existing = await backend.existingBackend(context);
|
|
18
|
+
const endpointsList = backend.allEndpoints(existing).sort(backend.compareFunctions);
|
|
19
|
+
const table = new Table({
|
|
20
|
+
head: ["Function", "Version", "Trigger", "Location", "Memory", "Runtime"],
|
|
21
|
+
style: { head: ["yellow"] },
|
|
22
|
+
});
|
|
23
|
+
for (const endpoint of endpointsList) {
|
|
24
|
+
const trigger = backend.endpointTriggerType(endpoint);
|
|
25
|
+
const availableMemoryMb = endpoint.availableMemoryMb || "---";
|
|
26
|
+
const entry = [
|
|
27
|
+
endpoint.id,
|
|
28
|
+
endpoint.platform === "gcfv2" ? "v2" : "v1",
|
|
29
|
+
trigger,
|
|
30
|
+
endpoint.region,
|
|
31
|
+
availableMemoryMb,
|
|
32
|
+
endpoint.runtime,
|
|
33
|
+
];
|
|
34
|
+
table.push(entry);
|
|
46
35
|
}
|
|
36
|
+
logger_1.logger.info(table.toString());
|
|
37
|
+
return endpointsList;
|
|
47
38
|
});
|
|
@@ -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) => {
|
|
@@ -40,16 +40,14 @@ exports.command = new command_1.Command("functions:secrets:destroy <KEY>[@versio
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
43
|
+
const areYouSure = await (0, prompt_1.confirm)({
|
|
44
|
+
message: `Are you sure you want to destroy ${sv.secret.name}@${sv.versionId}`,
|
|
45
|
+
default: true,
|
|
46
|
+
nonInteractive: options.nonInteractive,
|
|
47
|
+
force: options.force,
|
|
48
|
+
});
|
|
49
|
+
if (!areYouSure) {
|
|
50
|
+
return;
|
|
53
51
|
}
|
|
54
52
|
await (0, secretManager_1.destroySecretVersion)(projectId, name, version);
|
|
55
53
|
(0, utils_1.logBullet)(`Destroyed secret version ${name}@${sv.versionId}`);
|
|
@@ -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, [
|
|
@@ -38,20 +38,19 @@ exports.command = new command_1.Command("functions:secrets:prune")
|
|
|
38
38
|
}
|
|
39
39
|
(0, utils_1.logBullet)(`Found ${pruned.length} unused active secret versions:\n\t` +
|
|
40
40
|
pruned.map((sv) => `${sv.secret}@${sv.version}`).join("\n\t"));
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
name: "destroy",
|
|
44
|
-
type: "confirm",
|
|
45
|
-
default: true,
|
|
41
|
+
const confirmed = options.destroy ||
|
|
42
|
+
(await (0, prompt_1.confirm)({
|
|
46
43
|
message: `Do you want to destroy unused secret versions?`,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
default: true,
|
|
45
|
+
force: options.force,
|
|
46
|
+
nonInteractive: options.nonInteractive,
|
|
47
|
+
}));
|
|
48
|
+
if (!confirmed) {
|
|
49
|
+
(0, utils_1.logBullet)("Run the following commands to destroy each unused secret version:\n\t" +
|
|
50
|
+
pruned
|
|
51
|
+
.map((sv) => `firebase functions:secrets:destroy ${sv.secret}@${sv.version}`)
|
|
52
|
+
.join("\n\t"));
|
|
53
|
+
return;
|
|
55
54
|
}
|
|
56
55
|
await Promise.all(pruned.map((sv) => (0, secretManager_1.destroySecretVersion)(projectId, sv.secret, sv.version)));
|
|
57
56
|
(0, utils_1.logSuccess)("Destroyed all unused secrets!");
|
|
@@ -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);
|
|
@@ -53,21 +53,17 @@ exports.command = new command_1.Command("functions:secrets:set <KEY>")
|
|
|
53
53
|
}
|
|
54
54
|
(0, utils_1.logBullet)(`${endpointsToUpdate.length} functions are using stale version of secret ${secret.name}:\n\t` +
|
|
55
55
|
endpointsToUpdate.map((e) => `${e.id}(${e.region})`).join("\n\t"));
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(0, utils_1.logBullet)("Please deploy your functions for the change to take effect by running:\n\t" +
|
|
68
|
-
clc.bold("firebase deploy --only functions"));
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
56
|
+
const redeploy = options.nonInteractive
|
|
57
|
+
? false
|
|
58
|
+
: await (0, prompt_1.confirm)({
|
|
59
|
+
message: `Do you want to re-deploy the functions and destroy the stale version of secret ${secret.name}?`,
|
|
60
|
+
default: true,
|
|
61
|
+
force: options.force,
|
|
62
|
+
});
|
|
63
|
+
if (!redeploy) {
|
|
64
|
+
(0, utils_1.logBullet)("Please deploy your functions for the change to take effect by running:\n\t" +
|
|
65
|
+
clc.bold("firebase deploy --only functions"));
|
|
66
|
+
return;
|
|
71
67
|
}
|
|
72
68
|
const updateOps = endpointsToUpdate.map(async (e) => {
|
|
73
69
|
(0, utils_1.logBullet)(`Updating function ${e.id}(${e.region})...`);
|
|
@@ -45,8 +45,7 @@ exports.command = new command_1.Command("hosting:channel:create [channelId]")
|
|
|
45
45
|
}
|
|
46
46
|
channelId =
|
|
47
47
|
channelId ||
|
|
48
|
-
(await (0, prompt_1.
|
|
49
|
-
type: "input",
|
|
48
|
+
(await (0, prompt_1.input)({
|
|
50
49
|
message: "Please provide a URL-friendly name for the channel:",
|
|
51
50
|
validate: (s) => s.length > 0,
|
|
52
51
|
}));
|
|
@@ -24,12 +24,12 @@ exports.command = new command_1.Command("hosting:channel:delete <channelId>")
|
|
|
24
24
|
const siteId = options.site;
|
|
25
25
|
channelId = (0, api_1.normalizeName)(channelId);
|
|
26
26
|
const channel = await (0, api_1.getChannel)(projectId, siteId, channelId);
|
|
27
|
-
const confirmed = await (0, prompt_1.
|
|
28
|
-
name: "force",
|
|
29
|
-
type: "confirm",
|
|
27
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
30
28
|
message: `Are you sure you want to delete the Hosting Channel ${(0, colorette_1.underline)(channelId)} for site ${(0, colorette_1.underline)(siteId)}?`,
|
|
31
29
|
default: false,
|
|
32
|
-
|
|
30
|
+
force: options.force,
|
|
31
|
+
nonInteractive: options.nonInteractive,
|
|
32
|
+
});
|
|
33
33
|
if (!confirmed) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const colorette_1 = require("colorette");
|
|
5
|
-
const Table = require("cli-
|
|
5
|
+
const Table = require("cli-table3");
|
|
6
6
|
const api_1 = require("../hosting/api");
|
|
7
7
|
const command_1 = require("../command");
|
|
8
8
|
const requirePermissions_1 = require("../requirePermissions");
|
|
@@ -11,8 +11,8 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
11
11
|
const projectUtils_1 = require("../projectUtils");
|
|
12
12
|
const requireConfig_1 = require("../requireConfig");
|
|
13
13
|
const utils_1 = require("../utils");
|
|
14
|
-
const prompt_1 = require("../prompt");
|
|
15
14
|
const requireHostingSite_1 = require("../requireHostingSite");
|
|
15
|
+
const prompt_1 = require("../prompt");
|
|
16
16
|
exports.command = new command_1.Command("hosting:channel:open [channelId]")
|
|
17
17
|
.description("opens the URL for a Firebase Hosting channel")
|
|
18
18
|
.help("if unable to open the URL in a browser, it will be displayed in the output")
|
|
@@ -29,8 +29,7 @@ exports.command = new command_1.Command("hosting:channel:open [channelId]")
|
|
|
29
29
|
}
|
|
30
30
|
const channels = await (0, api_1.listChannels)(projectId, siteId);
|
|
31
31
|
(0, lodash_1.sortBy)(channels, ["name"]);
|
|
32
|
-
channelId = await (0, prompt_1.
|
|
33
|
-
type: "list",
|
|
32
|
+
channelId = await (0, prompt_1.select)({
|
|
34
33
|
message: "Which channel would you like to open?",
|
|
35
34
|
choices: channels.map((c) => (0, lodash_1.last)(c.name.split("/")) || c.name),
|
|
36
35
|
});
|
|
@@ -17,12 +17,12 @@ exports.command = new command_1.Command("hosting:disable")
|
|
|
17
17
|
.before(requireHostingSite_1.requireHostingSite)
|
|
18
18
|
.action(async (options) => {
|
|
19
19
|
const siteToDisable = options.site;
|
|
20
|
-
const
|
|
21
|
-
type: "confirm",
|
|
22
|
-
name: "force",
|
|
20
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
23
21
|
message: `Are you sure you want to disable Firebase Hosting for the site ${clc.underline(siteToDisable)}\n${clc.underline("This will immediately make your site inaccessible!")}`,
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
force: options.force,
|
|
23
|
+
nonInteractive: options.nonInteractive,
|
|
24
|
+
});
|
|
25
|
+
if (!confirmed) {
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const c = new apiv2_1.Client({ urlPrefix: (0, api_1.hostingApiOrigin)(), apiVersion: "v1beta1", auth: true });
|
|
@@ -24,12 +24,12 @@ exports.command = new command_1.Command("hosting:sites:delete <siteId>")
|
|
|
24
24
|
}
|
|
25
25
|
logger_1.logger.info(`Deleting a site is a permanent action. If you delete a site, Firebase doesn't maintain records of deployed files or deployment history, and the site ${(0, colorette_1.underline)(siteId)} cannot be reactivated by you or anyone else.`);
|
|
26
26
|
logger_1.logger.info();
|
|
27
|
-
const confirmed = await (0, prompt_1.
|
|
28
|
-
name: "force",
|
|
29
|
-
type: "confirm",
|
|
27
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
30
28
|
message: `Are you sure you want to delete the Hosting site ${(0, colorette_1.underline)(siteId)} for project ${(0, colorette_1.underline)(projectId)}? `,
|
|
31
29
|
default: false,
|
|
32
|
-
|
|
30
|
+
force: options.force,
|
|
31
|
+
nonInteractive: options.nonInteractive,
|
|
32
|
+
});
|
|
33
33
|
if (!confirmed) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
@@ -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-
|
|
4
|
+
const Table = require("cli-table3");
|
|
5
5
|
const command_1 = require("../command");
|
|
6
6
|
const api_1 = require("../hosting/api");
|
|
7
7
|
const requirePermissions_1 = require("../requirePermissions");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const colorette_1 = require("colorette");
|
|
5
|
-
const Table = require("cli-
|
|
5
|
+
const Table = require("cli-table3");
|
|
6
6
|
const command_1 = require("../command");
|
|
7
7
|
const api_1 = require("../hosting/api");
|
|
8
8
|
const requirePermissions_1 = require("../requirePermissions");
|
package/lib/commands/index.js
CHANGED
|
@@ -28,6 +28,7 @@ function load(client) {
|
|
|
28
28
|
client.apps = {};
|
|
29
29
|
client.apps.create = loadCommand("apps-create");
|
|
30
30
|
client.apps.list = loadCommand("apps-list");
|
|
31
|
+
client.apps.init = loadCommand("apps-init");
|
|
31
32
|
client.apps.sdkconfig = loadCommand("apps-sdkconfig");
|
|
32
33
|
client.apps.android = {};
|
|
33
34
|
client.apps.android.sha = {};
|
|
@@ -70,9 +71,6 @@ function load(client) {
|
|
|
70
71
|
client.emulators.exec = loadCommand("emulators-exec");
|
|
71
72
|
client.emulators.export = loadCommand("emulators-export");
|
|
72
73
|
client.emulators.start = loadCommand("emulators-start");
|
|
73
|
-
client.experimental = {};
|
|
74
|
-
client.experimental.functions = {};
|
|
75
|
-
client.experimental.functions.shell = loadCommand("experimental-functions-shell");
|
|
76
74
|
client.experiments = {};
|
|
77
75
|
client.experiments.list = loadCommand("experiments-list");
|
|
78
76
|
client.experiments.describe = loadCommand("experiments-describe");
|
|
@@ -137,6 +135,8 @@ function load(client) {
|
|
|
137
135
|
client.functions.secrets.describe = loadCommand("functions-secrets-describe");
|
|
138
136
|
client.functions.secrets.prune = loadCommand("functions-secrets-prune");
|
|
139
137
|
client.functions.secrets.set = loadCommand("functions-secrets-set");
|
|
138
|
+
client.functions.artifacts = {};
|
|
139
|
+
client.functions.artifacts.setpolicy = loadCommand("functions-artifacts-setpolicy");
|
|
140
140
|
client.help = loadCommand("help");
|
|
141
141
|
client.hosting = {};
|
|
142
142
|
client.hosting.channel = {};
|
|
@@ -175,7 +175,6 @@ function load(client) {
|
|
|
175
175
|
client.apphosting.rollouts = {};
|
|
176
176
|
client.apphosting.rollouts.create = loadCommand("apphosting-rollouts-create");
|
|
177
177
|
client.apphosting.config = {};
|
|
178
|
-
client.apphosting.config.export = loadCommand("apphosting-config-export");
|
|
179
178
|
if (experiments.isEnabled("internaltesting")) {
|
|
180
179
|
client.apphosting.builds = {};
|
|
181
180
|
client.apphosting.builds.get = loadCommand("apphosting-builds-get");
|
|
@@ -191,6 +190,9 @@ function load(client) {
|
|
|
191
190
|
client.login.list = loadCommand("login-list");
|
|
192
191
|
client.login.use = loadCommand("login-use");
|
|
193
192
|
client.logout = loadCommand("logout");
|
|
193
|
+
if (experiments.isEnabled("mcp")) {
|
|
194
|
+
client.mcp = loadCommand("mcp");
|
|
195
|
+
}
|
|
194
196
|
client.open = loadCommand("open");
|
|
195
197
|
client.projects = {};
|
|
196
198
|
client.projects.addfirebase = loadCommand("projects-addfirebase");
|
|
@@ -215,6 +217,7 @@ function load(client) {
|
|
|
215
217
|
client.dataconnect.services.list = loadCommand("dataconnect-services-list");
|
|
216
218
|
client.dataconnect.sql = {};
|
|
217
219
|
client.dataconnect.sql.diff = loadCommand("dataconnect-sql-diff");
|
|
220
|
+
client.dataconnect.sql.setup = loadCommand("dataconnect-sql-setup");
|
|
218
221
|
client.dataconnect.sql.migrate = loadCommand("dataconnect-sql-migrate");
|
|
219
222
|
client.dataconnect.sql.grant = loadCommand("dataconnect-sql-grant");
|
|
220
223
|
client.dataconnect.sql.shell = loadCommand("dataconnect-sql-shell");
|