firebase-tools-with-isolate 13.29.1 → 14.10.1-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/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
|
@@ -2,20 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
|
-
const ora = require("ora");
|
|
6
5
|
const command_1 = require("../command");
|
|
7
6
|
const projectUtils_1 = require("../projectUtils");
|
|
8
7
|
const error_1 = require("../error");
|
|
9
8
|
const apps_1 = require("../management/apps");
|
|
10
|
-
const prompt_1 = require("../prompt");
|
|
11
9
|
const requireAuth_1 = require("../requireAuth");
|
|
12
10
|
const logger_1 = require("../logger");
|
|
13
|
-
const
|
|
14
|
-
type: "input",
|
|
15
|
-
name: "displayName",
|
|
16
|
-
default: "",
|
|
17
|
-
message: "What would you like to call your app?",
|
|
18
|
-
};
|
|
11
|
+
const prompt_1 = require("../prompt");
|
|
19
12
|
function logPostAppCreationInformation(appMetadata, appPlatform) {
|
|
20
13
|
logger_1.logger.info("");
|
|
21
14
|
logger_1.logger.info(`🎉🎉🎉 Your Firebase ${appPlatform} App is ready! 🎉🎉🎉`);
|
|
@@ -39,91 +32,8 @@ function logPostAppCreationInformation(appMetadata, appPlatform) {
|
|
|
39
32
|
logger_1.logger.info("You can run this command to print out your new app's Google Services config:");
|
|
40
33
|
logger_1.logger.info(` firebase apps:sdkconfig ${appPlatform} ${appMetadata.appId}`);
|
|
41
34
|
}
|
|
42
|
-
async function initiateIosAppCreation(options) {
|
|
43
|
-
if (!options.nonInteractive) {
|
|
44
|
-
await (0, prompt_1.prompt)(options, [
|
|
45
|
-
DISPLAY_NAME_QUESTION,
|
|
46
|
-
{
|
|
47
|
-
type: "input",
|
|
48
|
-
default: "",
|
|
49
|
-
name: "bundleId",
|
|
50
|
-
message: "Please specify your iOS app bundle ID:",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
type: "input",
|
|
54
|
-
default: "",
|
|
55
|
-
name: "appStoreId",
|
|
56
|
-
message: "Please specify your iOS app App Store ID:",
|
|
57
|
-
},
|
|
58
|
-
]);
|
|
59
|
-
}
|
|
60
|
-
if (!options.bundleId) {
|
|
61
|
-
throw new error_1.FirebaseError("Bundle ID for iOS app cannot be empty");
|
|
62
|
-
}
|
|
63
|
-
const spinner = ora("Creating your iOS app").start();
|
|
64
|
-
try {
|
|
65
|
-
const appData = await (0, apps_1.createIosApp)(options.project, {
|
|
66
|
-
displayName: options.displayName,
|
|
67
|
-
bundleId: options.bundleId,
|
|
68
|
-
appStoreId: options.appStoreId,
|
|
69
|
-
});
|
|
70
|
-
spinner.succeed();
|
|
71
|
-
return appData;
|
|
72
|
-
}
|
|
73
|
-
catch (err) {
|
|
74
|
-
spinner.fail();
|
|
75
|
-
throw err;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
async function initiateAndroidAppCreation(options) {
|
|
79
|
-
if (!options.nonInteractive) {
|
|
80
|
-
await (0, prompt_1.prompt)(options, [
|
|
81
|
-
DISPLAY_NAME_QUESTION,
|
|
82
|
-
{
|
|
83
|
-
type: "input",
|
|
84
|
-
default: "",
|
|
85
|
-
name: "packageName",
|
|
86
|
-
message: "Please specify your Android app package name:",
|
|
87
|
-
},
|
|
88
|
-
]);
|
|
89
|
-
}
|
|
90
|
-
if (!options.packageName) {
|
|
91
|
-
throw new error_1.FirebaseError("Package name for Android app cannot be empty");
|
|
92
|
-
}
|
|
93
|
-
const spinner = ora("Creating your Android app").start();
|
|
94
|
-
try {
|
|
95
|
-
const appData = await (0, apps_1.createAndroidApp)(options.project, {
|
|
96
|
-
displayName: options.displayName,
|
|
97
|
-
packageName: options.packageName,
|
|
98
|
-
});
|
|
99
|
-
spinner.succeed();
|
|
100
|
-
return appData;
|
|
101
|
-
}
|
|
102
|
-
catch (err) {
|
|
103
|
-
spinner.fail();
|
|
104
|
-
throw err;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
async function initiateWebAppCreation(options) {
|
|
108
|
-
if (!options.nonInteractive) {
|
|
109
|
-
await (0, prompt_1.prompt)(options, [DISPLAY_NAME_QUESTION]);
|
|
110
|
-
}
|
|
111
|
-
if (!options.displayName) {
|
|
112
|
-
throw new error_1.FirebaseError("Display name for Web app cannot be empty");
|
|
113
|
-
}
|
|
114
|
-
const spinner = ora("Creating your Web app").start();
|
|
115
|
-
try {
|
|
116
|
-
const appData = await (0, apps_1.createWebApp)(options.project, { displayName: options.displayName });
|
|
117
|
-
spinner.succeed();
|
|
118
|
-
return appData;
|
|
119
|
-
}
|
|
120
|
-
catch (err) {
|
|
121
|
-
spinner.fail();
|
|
122
|
-
throw err;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
35
|
exports.command = new command_1.Command("apps:create [platform] [displayName]")
|
|
126
|
-
.description("create a new Firebase app. [platform] can be IOS, ANDROID or WEB (case insensitive)
|
|
36
|
+
.description("create a new Firebase app. [platform] can be IOS, ANDROID or WEB (case insensitive)")
|
|
127
37
|
.option("-a, --package-name <packageName>", "required package name for the Android app")
|
|
128
38
|
.option("-b, --bundle-id <bundleId>", "required bundle id for the iOS app")
|
|
129
39
|
.option("-s, --app-store-id <appStoreId>", "(optional) app store id for the iOS app")
|
|
@@ -131,8 +41,7 @@ exports.command = new command_1.Command("apps:create [platform] [displayName]")
|
|
|
131
41
|
.action(async (platform = "", displayName, options) => {
|
|
132
42
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
133
43
|
if (!options.nonInteractive && !platform) {
|
|
134
|
-
platform = await (0, prompt_1.
|
|
135
|
-
type: "list",
|
|
44
|
+
platform = await (0, prompt_1.select)({
|
|
136
45
|
message: "Please choose the platform of the app:",
|
|
137
46
|
choices: [
|
|
138
47
|
{ name: "iOS", value: apps_1.AppPlatform.IOS },
|
|
@@ -147,20 +56,7 @@ exports.command = new command_1.Command("apps:create [platform] [displayName]")
|
|
|
147
56
|
}
|
|
148
57
|
logger_1.logger.info(`Create your ${appPlatform} app in project ${clc.bold(projectId)}:`);
|
|
149
58
|
options.displayName = displayName;
|
|
150
|
-
|
|
151
|
-
switch (appPlatform) {
|
|
152
|
-
case apps_1.AppPlatform.IOS:
|
|
153
|
-
appData = await initiateIosAppCreation(options);
|
|
154
|
-
break;
|
|
155
|
-
case apps_1.AppPlatform.ANDROID:
|
|
156
|
-
appData = await initiateAndroidAppCreation(options);
|
|
157
|
-
break;
|
|
158
|
-
case apps_1.AppPlatform.WEB:
|
|
159
|
-
appData = await initiateWebAppCreation(options);
|
|
160
|
-
break;
|
|
161
|
-
default:
|
|
162
|
-
throw new error_1.FirebaseError("Unexpected error. This should not happen");
|
|
163
|
-
}
|
|
59
|
+
const appData = await (0, apps_1.sdkInit)(appPlatform, options);
|
|
164
60
|
logPostAppCreationInformation(appData, appPlatform);
|
|
165
61
|
return appData;
|
|
166
62
|
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const fs = require("fs-extra");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
const command_1 = require("../command");
|
|
7
|
+
const apps_1 = require("../management/apps");
|
|
8
|
+
const requireAuth_1 = require("../requireAuth");
|
|
9
|
+
const logger_1 = require("../logger");
|
|
10
|
+
const projectUtils_1 = require("../projectUtils");
|
|
11
|
+
const types_1 = require("../dataconnect/types");
|
|
12
|
+
const experiments_1 = require("../experiments");
|
|
13
|
+
function logUse(platform, filePath) {
|
|
14
|
+
switch (platform) {
|
|
15
|
+
case apps_1.AppPlatform.WEB:
|
|
16
|
+
logger_1.logger.info(`
|
|
17
|
+
How to use your JS SDK Config:
|
|
18
|
+
ES Module:
|
|
19
|
+
import { initializeApp } from 'firebase/app';
|
|
20
|
+
import json from './${filePath || "firebase-sdk-config.json"}';
|
|
21
|
+
initializeApp(json); // or copy and paste the config directly from the json file here
|
|
22
|
+
// CommonJS Module:
|
|
23
|
+
const { initializeApp } = require('firebase/app');
|
|
24
|
+
const json = require('./firebase-js-config.json');
|
|
25
|
+
initializeApp(json); // or copy and paste the config directly from the json file here`);
|
|
26
|
+
break;
|
|
27
|
+
case apps_1.AppPlatform.ANDROID:
|
|
28
|
+
logger_1.logger.info(`Visit https://firebase.google.com/docs/android/setup#add-config-file
|
|
29
|
+
for information on editing your gradle file and adding Firebase SDKs to your app.
|
|
30
|
+
|
|
31
|
+
If you're using Unity or C++, visit https://firebase.google.com/docs/cpp/setup?platform=android#add-config-file
|
|
32
|
+
for information about adding your config file to your project.`);
|
|
33
|
+
break;
|
|
34
|
+
case apps_1.AppPlatform.IOS:
|
|
35
|
+
logger_1.logger.info(`Visit https://firebase.google.com/docs/ios/setup#add-config-file
|
|
36
|
+
for information on adding the config file to your targets and adding Firebase SDKs to your app.
|
|
37
|
+
|
|
38
|
+
If you're using Unity or C++, visit https://firebase.google.com/docs/cpp/setup?platform=ios#add-config-file
|
|
39
|
+
for information about adding your config file to your project.`);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function toAppPlatform(str) {
|
|
44
|
+
switch (str.toUpperCase()) {
|
|
45
|
+
case types_1.Platform.ANDROID:
|
|
46
|
+
return types_1.Platform.ANDROID;
|
|
47
|
+
case types_1.Platform.IOS:
|
|
48
|
+
return types_1.Platform.IOS;
|
|
49
|
+
case types_1.Platform.WEB:
|
|
50
|
+
return types_1.Platform.WEB;
|
|
51
|
+
}
|
|
52
|
+
throw new Error(`Platform ${str} is not compatible with apps:configure`);
|
|
53
|
+
}
|
|
54
|
+
exports.command = new command_1.Command("apps:init [platform] [appId]")
|
|
55
|
+
.description("automatically download and create config of a Firebase app")
|
|
56
|
+
.before(requireAuth_1.requireAuth)
|
|
57
|
+
.option("-o, --out [file]", "(optional) write config output to a file")
|
|
58
|
+
.action(async (platform = "", appId = "", options) => {
|
|
59
|
+
(0, experiments_1.assertEnabled)("appsinit", "autoconfigure an app");
|
|
60
|
+
if (typeof options.out === "boolean") {
|
|
61
|
+
throw new Error("Please specify a file path to output to.");
|
|
62
|
+
}
|
|
63
|
+
const config = options.config;
|
|
64
|
+
const appDir = process.cwd();
|
|
65
|
+
const detectedPlatform = platform ? toAppPlatform(platform) : await (0, apps_1.getPlatform)(appDir, config);
|
|
66
|
+
let sdkConfig;
|
|
67
|
+
while (sdkConfig === undefined) {
|
|
68
|
+
try {
|
|
69
|
+
sdkConfig = await (0, apps_1.getSdkConfig)(options, (0, apps_1.getAppPlatform)(detectedPlatform), appId);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
if (e.message.includes("associated with this Firebase project")) {
|
|
73
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
74
|
+
await (0, apps_1.sdkInit)(detectedPlatform, { ...options, project: projectId });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw e;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
let outputPath = options.out;
|
|
82
|
+
const fileInfo = (0, apps_1.getAppConfigFile)(sdkConfig, detectedPlatform);
|
|
83
|
+
let relativePath = "";
|
|
84
|
+
outputPath = outputPath || (await (0, apps_1.getSdkOutputPath)(appDir, detectedPlatform, options));
|
|
85
|
+
const outputDir = path.dirname(outputPath);
|
|
86
|
+
fs.mkdirpSync(outputDir);
|
|
87
|
+
relativePath = path.relative(appDir, outputPath);
|
|
88
|
+
const written = await (0, apps_1.writeConfigToFile)(outputPath, options.nonInteractive, fileInfo.fileContents);
|
|
89
|
+
if (written) {
|
|
90
|
+
logger_1.logger.info(`App configuration is written in ${relativePath}`);
|
|
91
|
+
}
|
|
92
|
+
logUse(detectedPlatform, relativePath);
|
|
93
|
+
return sdkConfig;
|
|
94
|
+
});
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.command = void 0;
|
|
4
4
|
const clc = require("colorette");
|
|
5
5
|
const ora = require("ora");
|
|
6
|
-
const Table = require("cli-
|
|
6
|
+
const Table = require("cli-table3");
|
|
7
7
|
const command_1 = require("../command");
|
|
8
8
|
const projectUtils_1 = require("../projectUtils");
|
|
9
9
|
const apps_1 = require("../management/apps");
|
|
@@ -26,8 +26,7 @@ async function selectAppInteractively(apps, appPlatform) {
|
|
|
26
26
|
value: app,
|
|
27
27
|
};
|
|
28
28
|
});
|
|
29
|
-
return await (0, prompt_1.
|
|
30
|
-
type: "list",
|
|
29
|
+
return await (0, prompt_1.select)({
|
|
31
30
|
message: `Select the ${appPlatform === apps_1.AppPlatform.ANY ? "" : appPlatform + " "}` +
|
|
32
31
|
"app to get the configuration data:",
|
|
33
32
|
choices,
|
|
@@ -83,21 +82,17 @@ exports.command = new command_1.Command("apps:sdkconfig [platform] [appId]")
|
|
|
83
82
|
return fileInfo;
|
|
84
83
|
}
|
|
85
84
|
const shouldUseDefaultFilename = options.out === true || options.out === "";
|
|
86
|
-
const filename = shouldUseDefaultFilename ?
|
|
85
|
+
const filename = shouldUseDefaultFilename ? fileInfo.fileName : options.out;
|
|
87
86
|
if (fs.existsSync(filename)) {
|
|
88
87
|
if (options.nonInteractive) {
|
|
89
88
|
throw new error_1.FirebaseError(`${filename} already exists`);
|
|
90
89
|
}
|
|
91
|
-
const overwrite = await (0, prompt_1.
|
|
92
|
-
type: "confirm",
|
|
93
|
-
default: false,
|
|
94
|
-
message: `${filename} already exists. Do you want to overwrite?`,
|
|
95
|
-
});
|
|
90
|
+
const overwrite = await (0, prompt_1.confirm)(`${filename} already exists. Do you want to overwrite?`);
|
|
96
91
|
if (!overwrite) {
|
|
97
|
-
return
|
|
92
|
+
return fileInfo;
|
|
98
93
|
}
|
|
99
94
|
}
|
|
100
95
|
fs.writeFileSync(filename, fileInfo.fileContents);
|
|
101
96
|
logger_1.logger.info(`App configuration is written in ${filename}`);
|
|
102
|
-
return
|
|
97
|
+
return fileInfo;
|
|
103
98
|
});
|
|
@@ -11,7 +11,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
11
11
|
const accountExporter_1 = require("../accountExporter");
|
|
12
12
|
const MAX_BATCH_SIZE = 1000;
|
|
13
13
|
exports.command = new command_1.Command("auth:export [dataFile]")
|
|
14
|
-
.description("
|
|
14
|
+
.description("export accounts from your Firebase project into a data file")
|
|
15
15
|
.option("--format <format>", "Format of exported data (csv, json). Ignored if <dataFile> has format extension.")
|
|
16
16
|
.before(requirePermissions_1.requirePermissions, ["firebaseauth.users.get"])
|
|
17
17
|
.action((dataFile, options) => {
|
|
@@ -15,7 +15,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
15
15
|
const accountImporter_1 = require("../accountImporter");
|
|
16
16
|
const MAX_BATCH_SIZE = 1000;
|
|
17
17
|
exports.command = new command_1.Command("auth:import [dataFile]")
|
|
18
|
-
.description("import users into your Firebase project from a data file(.csv or .json)")
|
|
18
|
+
.description("import users into your Firebase project from a data file (.csv or .json)")
|
|
19
19
|
.option("--hash-algo <hashAlgo>", "specify the hash algorithm used in password for these accounts")
|
|
20
20
|
.option("--hash-key <hashKey>", "specify the key used in hash algorithm")
|
|
21
21
|
.option("--salt-separator <saltSeparator>", "specify the salt separator which will be appended to salt when verifying password. only used by SCRYPT now.")
|
|
@@ -49,13 +49,11 @@ exports.command = new command_1.Command("database:import <path> [infile]")
|
|
|
49
49
|
if (options.disableTriggers) {
|
|
50
50
|
dbUrl.searchParams.set("disableTriggers", "true");
|
|
51
51
|
}
|
|
52
|
-
const
|
|
53
|
-
type: "confirm",
|
|
54
|
-
name: "force",
|
|
55
|
-
default: false,
|
|
52
|
+
const areYouSure = await (0, prompt_1.confirm)({
|
|
56
53
|
message: "You are about to import data to " + clc.cyan(dbPath) + ". Are you sure?",
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
force: options.force,
|
|
55
|
+
});
|
|
56
|
+
if (!areYouSure) {
|
|
59
57
|
throw new error_1.FirebaseError("Command aborted.");
|
|
60
58
|
}
|
|
61
59
|
const inStream = fs.createReadStream(infile);
|
|
@@ -12,7 +12,7 @@ const getDefaultDatabaseInstance_1 = require("../getDefaultDatabaseInstance");
|
|
|
12
12
|
const error_1 = require("../error");
|
|
13
13
|
const requireDatabaseInstance_1 = require("../requireDatabaseInstance");
|
|
14
14
|
exports.command = new command_1.Command("database:instances:create <instanceName>")
|
|
15
|
-
.description("create a
|
|
15
|
+
.description("create a Realtime Database instance")
|
|
16
16
|
.option("-l, --location <location>", "(optional) location for the database instance, defaults to us-central1")
|
|
17
17
|
.before(requirePermissions_1.requirePermissions, ["firebasedatabase.instances.create"])
|
|
18
18
|
.before(commandUtils_1.warnEmulatorNotSupported, types_1.Emulators.DATABASE)
|
|
@@ -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 clc = require("colorette");
|
|
7
7
|
const ora = require("ora");
|
|
@@ -9,9 +9,8 @@ const utils = require("../utils");
|
|
|
9
9
|
const profiler_1 = require("../profiler");
|
|
10
10
|
const types_1 = require("../emulator/types");
|
|
11
11
|
const commandUtils_1 = require("../emulator/commandUtils");
|
|
12
|
-
const description = "profile the Realtime Database and generate a usage report";
|
|
13
12
|
exports.command = new command_1.Command("database:profile")
|
|
14
|
-
.description(
|
|
13
|
+
.description("profile the Realtime Database and generate a usage report")
|
|
15
14
|
.option("-o, --output <filename>", "save the output to the specified file")
|
|
16
15
|
.option("-d, --duration <seconds>", "collect database usage information for the specified number of seconds")
|
|
17
16
|
.option("--raw", "output the raw stats collected as newline delimited json")
|
|
@@ -27,13 +27,11 @@ exports.command = new command_1.Command("database:remove <path>")
|
|
|
27
27
|
}
|
|
28
28
|
const origin = (0, api_1.realtimeOriginOrEmulatorOrCustomUrl)(options.instanceDetails.databaseUrl);
|
|
29
29
|
const databaseUrl = utils.getDatabaseUrl(origin, options.instance, path);
|
|
30
|
-
const
|
|
31
|
-
type: "confirm",
|
|
32
|
-
name: "force",
|
|
33
|
-
default: false,
|
|
30
|
+
const areYouSure = await (0, prompt_1.confirm)({
|
|
34
31
|
message: "You are about to remove all data at " + clc.cyan(databaseUrl) + ". Are you sure?",
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
force: options.force,
|
|
33
|
+
});
|
|
34
|
+
if (!areYouSure) {
|
|
37
35
|
return utils.reject("Command aborted.", { exit: 1 });
|
|
38
36
|
}
|
|
39
37
|
const removeOps = new remove_1.default(options.instance, path, origin, !!options.disableTriggers);
|
|
@@ -36,13 +36,13 @@ exports.command = new command_1.Command("database:set <path> [infile]")
|
|
|
36
36
|
if (options.disableTriggers) {
|
|
37
37
|
dbJsonURL.searchParams.set("disableTriggers", "true");
|
|
38
38
|
}
|
|
39
|
-
const
|
|
40
|
-
type: "confirm",
|
|
41
|
-
name: "force",
|
|
42
|
-
default: false,
|
|
39
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
43
40
|
message: "You are about to overwrite all data at " + clc.cyan(dbPath) + ". Are you sure?",
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
default: false,
|
|
42
|
+
force: options.force,
|
|
43
|
+
nonInteractive: options.nonInteractive,
|
|
44
|
+
});
|
|
45
|
+
if (!confirmed) {
|
|
46
46
|
throw new error_1.FirebaseError("Command aborted.");
|
|
47
47
|
}
|
|
48
48
|
const inStream = utils.stringToStream(options.data) || (infile ? fs.createReadStream(infile) : process.stdin);
|
|
@@ -14,7 +14,7 @@ const commandUtils_1 = require("../emulator/commandUtils");
|
|
|
14
14
|
const requireDatabaseInstance_1 = require("../requireDatabaseInstance");
|
|
15
15
|
const utils = require("../utils");
|
|
16
16
|
exports.command = new command_1.Command("database:settings:set <path> <value>")
|
|
17
|
-
.description("set the
|
|
17
|
+
.description("set the Realtime Database setting at path")
|
|
18
18
|
.option("--instance <instance>", "use the database <instance>.firebaseio.com (if omitted, use default database instance)")
|
|
19
19
|
.help(settings_1.HELP_TEXT)
|
|
20
20
|
.before(requirePermissions_1.requirePermissions, ["firebasedatabase.instances.update"])
|
|
@@ -17,7 +17,7 @@ const logger_1 = require("../logger");
|
|
|
17
17
|
const requireDatabaseInstance_1 = require("../requireDatabaseInstance");
|
|
18
18
|
const utils = require("../utils");
|
|
19
19
|
exports.command = new command_1.Command("database:update <path> [infile]")
|
|
20
|
-
.description("update some of the keys for the defined path in your
|
|
20
|
+
.description("update some of the keys for the defined path in your Realtime Database")
|
|
21
21
|
.option("-d, --data <data>", "specify escaped JSON directly")
|
|
22
22
|
.option("-f, --force", "pass this option to bypass confirmation prompt")
|
|
23
23
|
.option("--instance <instance>", "use the database <instance>.firebaseio.com (if omitted, use default database instance)")
|
|
@@ -32,12 +32,12 @@ exports.command = new command_1.Command("database:update <path> [infile]")
|
|
|
32
32
|
}
|
|
33
33
|
const origin = (0, api_1.realtimeOriginOrEmulatorOrCustomUrl)(options.instanceDetails.databaseUrl);
|
|
34
34
|
const url = utils.getDatabaseUrl(origin, options.instance, path);
|
|
35
|
-
const confirmed = await (0, prompt_1.
|
|
36
|
-
type: "confirm",
|
|
37
|
-
name: "force",
|
|
38
|
-
default: false,
|
|
35
|
+
const confirmed = await (0, prompt_1.confirm)({
|
|
39
36
|
message: `You are about to modify data at ${clc.cyan(url)}. Are you sure?`,
|
|
40
|
-
|
|
37
|
+
default: false,
|
|
38
|
+
force: options.force,
|
|
39
|
+
nonInteractive: options.nonInteractive,
|
|
40
|
+
});
|
|
41
41
|
if (!confirmed) {
|
|
42
42
|
throw new error_1.FirebaseError("Command aborted.");
|
|
43
43
|
}
|
|
@@ -8,8 +8,9 @@ const projectUtils_1 = require("../projectUtils");
|
|
|
8
8
|
const load_1 = require("../dataconnect/load");
|
|
9
9
|
const fileUtils_1 = require("../dataconnect/fileUtils");
|
|
10
10
|
const logger_1 = require("../logger");
|
|
11
|
+
const auth_1 = require("../auth");
|
|
11
12
|
exports.command = new command_1.Command("dataconnect:sdk:generate")
|
|
12
|
-
.description("
|
|
13
|
+
.description("generate typed SDKs for your Data Connect connectors")
|
|
13
14
|
.option("--watch", "watch for changes to your connector GQL files and regenerate your SDKs when updates occur")
|
|
14
15
|
.action(async (options) => {
|
|
15
16
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
@@ -26,14 +27,16 @@ exports.command = new command_1.Command("dataconnect:sdk:generate")
|
|
|
26
27
|
if (!hasGeneratables) {
|
|
27
28
|
logger_1.logger.warn("No generated SDKs have been declared in connector.yaml files.");
|
|
28
29
|
logger_1.logger.warn(`Run ${clc.bold("firebase init dataconnect:sdk")} to configure a generated SDK.`);
|
|
29
|
-
logger_1.logger.warn(`See https://firebase.google.com/docs/data-connect/
|
|
30
|
+
logger_1.logger.warn(`See https://firebase.google.com/docs/data-connect/web-sdk for more details of how to configure generated SDKs.`);
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
33
|
for (const conn of serviceInfo.connectorInfo) {
|
|
34
|
+
const account = (0, auth_1.getProjectDefaultAccount)(options.projectRoot);
|
|
33
35
|
const output = await dataconnectEmulator_1.DataConnectEmulator.generate({
|
|
34
36
|
configDir,
|
|
35
37
|
connectorId: conn.connectorYaml.connectorId,
|
|
36
38
|
watch: options.watch,
|
|
39
|
+
account,
|
|
37
40
|
});
|
|
38
41
|
logger_1.logger.info(output);
|
|
39
42
|
logger_1.logger.info(`Generated SDKs for ${conn.connectorYaml.connectorId}`);
|
|
@@ -8,9 +8,9 @@ const client = require("../dataconnect/client");
|
|
|
8
8
|
const logger_1 = require("../logger");
|
|
9
9
|
const requirePermissions_1 = require("../requirePermissions");
|
|
10
10
|
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
11
|
-
const Table = require("cli-
|
|
11
|
+
const Table = require("cli-table3");
|
|
12
12
|
exports.command = new command_1.Command("dataconnect:services:list")
|
|
13
|
-
.description("list all deployed
|
|
13
|
+
.description("list all deployed Data Connect services")
|
|
14
14
|
.before(requirePermissions_1.requirePermissions, [
|
|
15
15
|
"dataconnect.services.list",
|
|
16
16
|
"dataconnect.schemas.list",
|
|
@@ -9,7 +9,7 @@ const fileUtils_1 = require("../dataconnect/fileUtils");
|
|
|
9
9
|
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
10
10
|
const requireAuth_1 = require("../requireAuth");
|
|
11
11
|
exports.command = new command_1.Command("dataconnect:sql:diff [serviceId]")
|
|
12
|
-
.description("
|
|
12
|
+
.description("display the differences between a local Data Connect schema and your CloudSQL database's current schema")
|
|
13
13
|
.before(requirePermissions_1.requirePermissions, [
|
|
14
14
|
"firebasedataconnect.services.list",
|
|
15
15
|
"firebasedataconnect.schemas.list",
|
|
@@ -20,6 +20,6 @@ exports.command = new command_1.Command("dataconnect:sql:diff [serviceId]")
|
|
|
20
20
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
21
21
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
22
22
|
const serviceInfo = await (0, fileUtils_1.pickService)(projectId, options.config, serviceId);
|
|
23
|
-
const diffs = await (0, schemaMigration_1.diffSchema)(serviceInfo.schema, serviceInfo.dataConnectYaml.schema.datasource.postgresql?.schemaValidation);
|
|
23
|
+
const diffs = await (0, schemaMigration_1.diffSchema)(options, serviceInfo.schema, serviceInfo.dataConnectYaml.schema.datasource.postgresql?.schemaValidation);
|
|
24
24
|
return { projectId, serviceId, diffs };
|
|
25
25
|
});
|
|
@@ -9,10 +9,10 @@ const fileUtils_1 = require("../dataconnect/fileUtils");
|
|
|
9
9
|
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
10
10
|
const requireAuth_1 = require("../requireAuth");
|
|
11
11
|
const error_1 = require("../error");
|
|
12
|
-
const
|
|
13
|
-
const allowedRoles = Object.keys(
|
|
12
|
+
const permissionsSetup_1 = require("../gcp/cloudsql/permissionsSetup");
|
|
13
|
+
const allowedRoles = Object.keys(permissionsSetup_1.fdcSqlRoleMap);
|
|
14
14
|
exports.command = new command_1.Command("dataconnect:sql:grant [serviceId]")
|
|
15
|
-
.description("
|
|
15
|
+
.description("grants the SQL role <role> to the provided user or service account <email>")
|
|
16
16
|
.option("-R, --role <role>", "The SQL role to grant. One of: owner, writer, or reader.")
|
|
17
17
|
.option("-E, --email <email>", "The email of the user or service account we would like to grant the role to.")
|
|
18
18
|
.before(requirePermissions_1.requirePermissions, ["firebasedataconnect.services.list"])
|
|
@@ -11,7 +11,7 @@ const requirePermissions_1 = require("../requirePermissions");
|
|
|
11
11
|
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
12
12
|
const utils_1 = require("../utils");
|
|
13
13
|
exports.command = new command_1.Command("dataconnect:sql:migrate [serviceId]")
|
|
14
|
-
.description("
|
|
14
|
+
.description("migrate your CloudSQL database's schema to match your local Data Connect schema")
|
|
15
15
|
.before(requirePermissions_1.requirePermissions, [
|
|
16
16
|
"firebasedataconnect.services.list",
|
|
17
17
|
"firebasedataconnect.schemas.list",
|
|
@@ -19,7 +19,7 @@ exports.command = new command_1.Command("dataconnect:sql:migrate [serviceId]")
|
|
|
19
19
|
"cloudsql.instances.connect",
|
|
20
20
|
])
|
|
21
21
|
.before(requireAuth_1.requireAuth)
|
|
22
|
-
.withForce("
|
|
22
|
+
.withForce("execute any required database changes without prompting")
|
|
23
23
|
.action(async (serviceId, options) => {
|
|
24
24
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
25
25
|
await (0, ensureApis_1.ensureApis)(projectId);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const command_1 = require("../command");
|
|
5
|
+
const projectUtils_1 = require("../projectUtils");
|
|
6
|
+
const fileUtils_1 = require("../dataconnect/fileUtils");
|
|
7
|
+
const error_1 = require("../error");
|
|
8
|
+
const requireAuth_1 = require("../requireAuth");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
const ensureApis_1 = require("../dataconnect/ensureApis");
|
|
11
|
+
const permissionsSetup_1 = require("../gcp/cloudsql/permissionsSetup");
|
|
12
|
+
const permissions_1 = require("../gcp/cloudsql/permissions");
|
|
13
|
+
const schemaMigration_1 = require("../dataconnect/schemaMigration");
|
|
14
|
+
const connect_1 = require("../gcp/cloudsql/connect");
|
|
15
|
+
const cloudSqlAdminClient = require("../gcp/cloudsql/cloudsqladmin");
|
|
16
|
+
exports.command = new command_1.Command("dataconnect:sql:setup [serviceId]")
|
|
17
|
+
.description("set up your CloudSQL database")
|
|
18
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
19
|
+
"firebasedataconnect.services.list",
|
|
20
|
+
"firebasedataconnect.schemas.list",
|
|
21
|
+
"firebasedataconnect.schemas.update",
|
|
22
|
+
"cloudsql.instances.connect",
|
|
23
|
+
])
|
|
24
|
+
.before(requireAuth_1.requireAuth)
|
|
25
|
+
.action(async (serviceId, options) => {
|
|
26
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
27
|
+
await (0, ensureApis_1.ensureApis)(projectId);
|
|
28
|
+
const serviceInfo = await (0, fileUtils_1.pickService)(projectId, options.config, serviceId);
|
|
29
|
+
const instanceId = serviceInfo.dataConnectYaml.schema.datasource.postgresql?.cloudSql.instanceId;
|
|
30
|
+
if (!instanceId) {
|
|
31
|
+
throw new error_1.FirebaseError("dataconnect.yaml is missing field schema.datasource.postgresql.cloudsql.instanceId");
|
|
32
|
+
}
|
|
33
|
+
const { serviceName, instanceName, databaseId } = (0, schemaMigration_1.getIdentifiers)(serviceInfo.schema);
|
|
34
|
+
await (0, schemaMigration_1.ensureServiceIsConnectedToCloudSql)(serviceName, instanceName, databaseId, true);
|
|
35
|
+
const { user, mode } = await (0, connect_1.getIAMUser)(options);
|
|
36
|
+
await cloudSqlAdminClient.createUser(projectId, instanceId, mode, user);
|
|
37
|
+
const schemaInfo = await (0, permissionsSetup_1.getSchemaMetadata)(instanceId, databaseId, permissions_1.DEFAULT_SCHEMA, options);
|
|
38
|
+
await (0, permissionsSetup_1.setupSQLPermissions)(instanceId, databaseId, schemaInfo, options);
|
|
39
|
+
});
|
|
@@ -35,11 +35,9 @@ const sqlKeywords = [
|
|
|
35
35
|
];
|
|
36
36
|
async function promptForQuery() {
|
|
37
37
|
let query = "";
|
|
38
|
-
|
|
38
|
+
const line = "";
|
|
39
39
|
do {
|
|
40
|
-
|
|
41
|
-
type: "input",
|
|
42
|
-
name: "line",
|
|
40
|
+
let line = await (0, prompt_1.input)({
|
|
43
41
|
message: query ? "> " : "Enter your SQL query (or '.exit'):",
|
|
44
42
|
transformer: (input) => {
|
|
45
43
|
return input
|
|
@@ -47,8 +45,8 @@ async function promptForQuery() {
|
|
|
47
45
|
.map((word) => (sqlKeywords.includes(word.toUpperCase()) ? clc.cyan(word) : word))
|
|
48
46
|
.join(" ");
|
|
49
47
|
},
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
nonInteractive: false,
|
|
49
|
+
});
|
|
52
50
|
line = line.trimEnd();
|
|
53
51
|
if (line.toLowerCase() === ".exit") {
|
|
54
52
|
return ".exit";
|
|
@@ -75,7 +73,7 @@ async function mainShellLoop(conn) {
|
|
|
75
73
|
}
|
|
76
74
|
}
|
|
77
75
|
exports.command = new command_1.Command("dataconnect:sql:shell [serviceId]")
|
|
78
|
-
.description("
|
|
76
|
+
.description("start a shell connected directly to your Data Connect service's linked CloudSQL instance")
|
|
79
77
|
.before(requirePermissions_1.requirePermissions, ["firebasedataconnect.services.list", "cloudsql.instances.connect"])
|
|
80
78
|
.before(requireAuth_1.requireAuth)
|
|
81
79
|
.action(async (serviceId, options) => {
|
package/lib/commands/deploy.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.VALID_DEPLOY_TARGETS = [
|
|
|
24
24
|
"remoteconfig",
|
|
25
25
|
"extensions",
|
|
26
26
|
"dataconnect",
|
|
27
|
+
"apphosting",
|
|
27
28
|
];
|
|
28
29
|
exports.TARGET_PERMISSIONS = {
|
|
29
30
|
database: ["firebasedatabase.instances.update"],
|
|
@@ -84,10 +85,10 @@ exports.command = new command_1.Command("deploy")
|
|
|
84
85
|
"When filtering based on codebases, use colons to specify codebase names " +
|
|
85
86
|
'(e.g. "--only functions:codebase1:func1,functions:codebase2:group1.subgroup1"). ' +
|
|
86
87
|
"For data connect, can specify filters with colons to deploy only a service, connector, or schema" +
|
|
87
|
-
'(e.g. "--only dataconnect:serviceId,dataconnect:serviceId:connectorId,dataconnect:serviceId:schema")
|
|
88
|
+
'(e.g. "--only dataconnect:serviceId,dataconnect:serviceId:connectorId,dataconnect:serviceId:schema")')
|
|
88
89
|
.option("--except <targets>", 'deploy to all targets except specified (e.g. "database")')
|
|
89
|
-
.option("--dry-run", "
|
|
90
|
-
"In order to provide better validation, this may still enable APIs on the target project
|
|
90
|
+
.option("--dry-run", "perform a dry run of your deployment. Validates your changes and builds your code without deploying any changes to your project. " +
|
|
91
|
+
"In order to provide better validation, this may still enable APIs on the target project")
|
|
91
92
|
.before(requireConfig_1.requireConfig)
|
|
92
93
|
.before((options) => {
|
|
93
94
|
options.filteredTargets = (0, filterTargets_1.filterTargets)(options, exports.VALID_DEPLOY_TARGETS);
|
|
@@ -7,7 +7,7 @@ const commandUtils_1 = require("../emulator/commandUtils");
|
|
|
7
7
|
exports.command = new command_1.Command("emulators:exec <script>")
|
|
8
8
|
.before(commandUtils.setExportOnExitOptions)
|
|
9
9
|
.before(commandUtils.beforeEmulatorCommand)
|
|
10
|
-
.description("start the local Firebase emulators,
|
|
10
|
+
.description("start the local Firebase emulators, run a test script, then shut down the emulators")
|
|
11
11
|
.option(commandUtils.FLAG_ONLY, commandUtils.DESC_ONLY)
|
|
12
12
|
.option(commandUtils.FLAG_INSPECT_FUNCTIONS, commandUtils.DESC_INSPECT_FUNCTIONS)
|
|
13
13
|
.option(commandUtils.FLAG_IMPORT, commandUtils.DESC_IMPORT)
|