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
|
@@ -6,22 +6,23 @@ const config_1 = require("../../apphosting/config");
|
|
|
6
6
|
const yaml_1 = require("../../apphosting/yaml");
|
|
7
7
|
async function getLocalAppHostingConfiguration(backendDir) {
|
|
8
8
|
const appHostingConfigPaths = (0, config_1.listAppHostingFilesInPath)(backendDir);
|
|
9
|
-
const fileNameToPathMap =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const fileNameToPathMap = Object.fromEntries(appHostingConfigPaths.map((path) => [(0, path_1.basename)(path), path]));
|
|
10
|
+
const output = yaml_1.AppHostingYamlConfig.empty();
|
|
11
|
+
const baseFilePath = fileNameToPathMap[config_1.APPHOSTING_BASE_YAML_FILE];
|
|
12
|
+
const emulatorsFilePath = fileNameToPathMap[config_1.APPHOSTING_EMULATORS_YAML_FILE];
|
|
13
|
+
const localFilePath = fileNameToPathMap[config_1.APPHOSTING_LOCAL_YAML_FILE];
|
|
14
|
+
if (baseFilePath) {
|
|
15
|
+
const baseFile = await yaml_1.AppHostingYamlConfig.loadFromFile(baseFilePath);
|
|
16
|
+
output.merge(baseFile, false);
|
|
13
17
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return yaml_1.AppHostingYamlConfig.empty();
|
|
18
|
+
if (emulatorsFilePath) {
|
|
19
|
+
const emulatorsConfig = await yaml_1.AppHostingYamlConfig.loadFromFile(emulatorsFilePath);
|
|
20
|
+
output.merge(emulatorsConfig, false);
|
|
18
21
|
}
|
|
19
|
-
if (
|
|
20
|
-
|
|
22
|
+
if (localFilePath) {
|
|
23
|
+
const localYamlConfig = await yaml_1.AppHostingYamlConfig.loadFromFile(localFilePath);
|
|
24
|
+
output.merge(localYamlConfig, true);
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
const baseConfig = await yaml_1.AppHostingYamlConfig.loadFromFile(baseFilePath);
|
|
24
|
-
baseConfig.merge(localYamlConfig);
|
|
25
|
-
return baseConfig;
|
|
26
|
+
return output;
|
|
26
27
|
}
|
|
27
28
|
exports.getLocalAppHostingConfiguration = getLocalAppHostingConfiguration;
|
|
@@ -10,6 +10,8 @@ class AppHostingEmulator {
|
|
|
10
10
|
}
|
|
11
11
|
async start() {
|
|
12
12
|
const { hostname, port } = await (0, serve_1.start)({
|
|
13
|
+
projectId: this.args.projectId,
|
|
14
|
+
backendId: this.args.backendId,
|
|
13
15
|
port: this.args.port,
|
|
14
16
|
startCommand: this.args.startCommand,
|
|
15
17
|
rootDirectory: this.args.rootDirectory,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.start = void 0;
|
|
3
|
+
exports.getEmulatorEnvs = exports.start = void 0;
|
|
4
4
|
const net_1 = require("net");
|
|
5
|
+
const clc = require("colorette");
|
|
5
6
|
const portUtils_1 = require("../portUtils");
|
|
6
7
|
const developmentServer_1 = require("./developmentServer");
|
|
7
8
|
const constants_1 = require("../constants");
|
|
@@ -10,36 +11,113 @@ const developmentServer_2 = require("./developmentServer");
|
|
|
10
11
|
const types_1 = require("../types");
|
|
11
12
|
const config_1 = require("./config");
|
|
12
13
|
const projectPath_1 = require("../../projectPath");
|
|
14
|
+
const registry_1 = require("../registry");
|
|
15
|
+
const env_1 = require("../env");
|
|
16
|
+
const error_1 = require("../../error");
|
|
17
|
+
const secrets = require("../../gcp/secretManager");
|
|
18
|
+
const utils_1 = require("../../utils");
|
|
19
|
+
const apphosting = require("../../gcp/apphosting");
|
|
20
|
+
const constants_2 = require("../constants");
|
|
21
|
+
const fetchWebSetup_1 = require("../../fetchWebSetup");
|
|
22
|
+
const apps_1 = require("../../management/apps");
|
|
23
|
+
const child_process_1 = require("child_process");
|
|
24
|
+
const semver_1 = require("semver");
|
|
13
25
|
async function start(options) {
|
|
14
26
|
const hostname = constants_1.DEFAULT_HOST;
|
|
15
27
|
let port = options?.port ?? constants_1.DEFAULT_PORTS.apphosting;
|
|
16
28
|
while (!(await availablePort(hostname, port))) {
|
|
17
29
|
port += 1;
|
|
18
30
|
}
|
|
19
|
-
serve(port, options?.startCommand, options?.rootDirectory);
|
|
31
|
+
await serve(options?.projectId, options?.backendId, port, options?.startCommand, options?.rootDirectory);
|
|
20
32
|
return { hostname, port };
|
|
21
33
|
}
|
|
22
34
|
exports.start = start;
|
|
23
|
-
|
|
35
|
+
const secretResourceRegex = /^projects\/([^/]+)\/secrets\/([^/]+)(?:\/versions\/((?:latest)|\d+))?$/;
|
|
36
|
+
const secretShorthandRegex = /^([^/@]+)(?:@((?:latest)|\d+))?$/;
|
|
37
|
+
async function loadSecret(project, name) {
|
|
38
|
+
let projectId;
|
|
39
|
+
let secretId;
|
|
40
|
+
let version;
|
|
41
|
+
const match = secretResourceRegex.exec(name);
|
|
42
|
+
if (match) {
|
|
43
|
+
projectId = match[1];
|
|
44
|
+
secretId = match[2];
|
|
45
|
+
version = match[3] || "latest";
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const match = secretShorthandRegex.exec(name);
|
|
49
|
+
if (!match) {
|
|
50
|
+
throw new error_1.FirebaseError(`Invalid secret name: ${name}`);
|
|
51
|
+
}
|
|
52
|
+
if (!project) {
|
|
53
|
+
throw new error_1.FirebaseError(`Cannot load secret ${match[1]} without a project. ` +
|
|
54
|
+
`Please use ${clc.bold("firebase use")} or pass the --project flag.`);
|
|
55
|
+
}
|
|
56
|
+
projectId = project;
|
|
57
|
+
secretId = match[1];
|
|
58
|
+
version = match[2] || "latest";
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
return await secrets.accessSecretVersion(projectId, secretId, version);
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
if (err?.original?.code === 403 || err?.original?.context?.response?.statusCode === 403) {
|
|
65
|
+
(0, utils_1.logLabeledError)(types_1.Emulators.APPHOSTING, `Permission denied to access secret ${secretId}. Use ` +
|
|
66
|
+
`${clc.bold("firebase apphosting:secrets:grantaccess")} to get permissions.`);
|
|
67
|
+
}
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function serve(projectId, backendId, port, startCommand, backendRelativeDir) {
|
|
24
72
|
backendRelativeDir = backendRelativeDir ?? "./";
|
|
25
73
|
const backendRoot = (0, projectPath_1.resolveProjectPath)({}, backendRelativeDir);
|
|
26
74
|
const apphostingLocalConfig = await (0, config_1.getLocalAppHostingConfiguration)(backendRoot);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
75
|
+
const resolveEnv = Object.entries(apphostingLocalConfig.env).map(async ([key, value]) => [
|
|
76
|
+
key,
|
|
77
|
+
value.value ? value.value : await loadSecret(projectId, value.secret),
|
|
78
|
+
]);
|
|
31
79
|
const environmentVariablesToInject = {
|
|
32
|
-
|
|
80
|
+
NODE_ENV: process.env.NODE_ENV,
|
|
81
|
+
...getEmulatorEnvs(),
|
|
82
|
+
...Object.fromEntries(await Promise.all(resolveEnv)),
|
|
83
|
+
FIREBASE_APP_HOSTING: "1",
|
|
84
|
+
X_GOOGLE_TARGET_PLATFORM: "fah",
|
|
85
|
+
GCLOUD_PROJECT: projectId,
|
|
86
|
+
PROJECT_ID: projectId,
|
|
33
87
|
PORT: port.toString(),
|
|
34
88
|
};
|
|
89
|
+
const packageManager = await (0, developmentServer_1.detectPackageManager)(backendRoot).catch(() => undefined);
|
|
90
|
+
if (packageManager === "pnpm") {
|
|
91
|
+
(0, utils_1.logLabeledWarning)("apphosting", `Firebase JS SDK autoinit does not currently support PNPM.`);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
const webappConfig = await getBackendAppConfig(projectId, backendId);
|
|
95
|
+
if (webappConfig) {
|
|
96
|
+
environmentVariablesToInject["FIREBASE_WEBAPP_CONFIG"] || (environmentVariablesToInject["FIREBASE_WEBAPP_CONFIG"] = JSON.stringify(webappConfig));
|
|
97
|
+
environmentVariablesToInject["FIREBASE_CONFIG"] || (environmentVariablesToInject["FIREBASE_CONFIG"] = JSON.stringify({
|
|
98
|
+
databaseURL: webappConfig.databaseURL,
|
|
99
|
+
storageBucket: webappConfig.storageBucket,
|
|
100
|
+
projectId: webappConfig.projectId,
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
await tripFirebasePostinstall(backendRoot, environmentVariablesToInject);
|
|
104
|
+
}
|
|
35
105
|
if (startCommand) {
|
|
36
106
|
developmentServer_2.logger.logLabeled("BULLET", types_1.Emulators.APPHOSTING, `running custom start command: '${startCommand}'`);
|
|
37
|
-
|
|
107
|
+
(0, spawn_1.spawnWithCommandString)(startCommand, backendRoot, environmentVariablesToInject)
|
|
108
|
+
.catch((err) => {
|
|
109
|
+
developmentServer_2.logger.logLabeled("ERROR", types_1.Emulators.APPHOSTING, `failed to start Dev Server: ${err}`);
|
|
110
|
+
})
|
|
111
|
+
.then(() => developmentServer_2.logger.logLabeled("BULLET", types_1.Emulators.APPHOSTING, `Dev Server stopped`));
|
|
38
112
|
return;
|
|
39
113
|
}
|
|
40
114
|
const detectedStartCommand = await (0, developmentServer_1.detectStartCommand)(backendRoot);
|
|
41
115
|
developmentServer_2.logger.logLabeled("BULLET", types_1.Emulators.APPHOSTING, `starting app with: '${detectedStartCommand}'`);
|
|
42
|
-
|
|
116
|
+
(0, spawn_1.spawnWithCommandString)(detectedStartCommand, backendRoot, environmentVariablesToInject)
|
|
117
|
+
.catch((err) => {
|
|
118
|
+
developmentServer_2.logger.logLabeled("ERROR", types_1.Emulators.APPHOSTING, `failed to start Dev Server: ${err}`);
|
|
119
|
+
})
|
|
120
|
+
.then(() => developmentServer_2.logger.logLabeled("BULLET", types_1.Emulators.APPHOSTING, `Dev Server stopped`));
|
|
43
121
|
}
|
|
44
122
|
function availablePort(host, port) {
|
|
45
123
|
return (0, portUtils_1.checkListenable)({
|
|
@@ -48,3 +126,62 @@ function availablePort(host, port) {
|
|
|
48
126
|
family: (0, net_1.isIPv4)(host) ? "IPv4" : "IPv6",
|
|
49
127
|
});
|
|
50
128
|
}
|
|
129
|
+
function getEmulatorEnvs() {
|
|
130
|
+
const envs = {};
|
|
131
|
+
const emulatorInfos = registry_1.EmulatorRegistry.listRunningWithInfo().filter((emulator) => emulator.name !== types_1.Emulators.APPHOSTING);
|
|
132
|
+
(0, env_1.setEnvVarsForEmulators)(envs, emulatorInfos);
|
|
133
|
+
return envs;
|
|
134
|
+
}
|
|
135
|
+
exports.getEmulatorEnvs = getEmulatorEnvs;
|
|
136
|
+
async function tripFirebasePostinstall(rootDirectory, env) {
|
|
137
|
+
const npmLs = (0, child_process_1.spawnSync)("npm", ["ls", "@firebase/util", "--json", "--long"], {
|
|
138
|
+
cwd: rootDirectory,
|
|
139
|
+
shell: process.platform === "win32",
|
|
140
|
+
});
|
|
141
|
+
if (!npmLs.stdout) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const npmLsResults = JSON.parse(npmLs.stdout.toString().trim());
|
|
145
|
+
const dependenciesToSearch = Object.values(npmLsResults.dependencies || {});
|
|
146
|
+
const firebaseUtilPaths = [];
|
|
147
|
+
for (const dependency of dependenciesToSearch) {
|
|
148
|
+
if (dependency.name === "@firebase/util" &&
|
|
149
|
+
(0, semver_1.gte)(dependency.version, "1.11.0") &&
|
|
150
|
+
firebaseUtilPaths.indexOf(dependency.path) === -1) {
|
|
151
|
+
firebaseUtilPaths.push(dependency.path);
|
|
152
|
+
}
|
|
153
|
+
if (dependency.dependencies) {
|
|
154
|
+
dependenciesToSearch.push(...Object.values(dependency.dependencies));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
await Promise.all(firebaseUtilPaths.map((path) => new Promise((resolve) => {
|
|
158
|
+
(0, child_process_1.spawnSync)("npm", ["run", "postinstall"], {
|
|
159
|
+
cwd: path,
|
|
160
|
+
env,
|
|
161
|
+
stdio: "ignore",
|
|
162
|
+
shell: process.platform === "win32",
|
|
163
|
+
});
|
|
164
|
+
resolve();
|
|
165
|
+
})));
|
|
166
|
+
}
|
|
167
|
+
async function getBackendAppConfig(projectId, backendId) {
|
|
168
|
+
if (!projectId) {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
if (constants_2.Constants.isDemoProject(projectId)) {
|
|
172
|
+
return (0, fetchWebSetup_1.constructDefaultWebSetup)(projectId);
|
|
173
|
+
}
|
|
174
|
+
if (!backendId) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
const backendsList = await apphosting.listBackends(projectId, "-").catch(() => undefined);
|
|
178
|
+
const backend = backendsList?.backends.find((b) => apphosting.parseBackendName(b.name).id === backendId);
|
|
179
|
+
if (!backend) {
|
|
180
|
+
(0, utils_1.logLabeledWarning)("apphosting", `Unable to lookup details for backend ${backendId}. Firebase SDK autoinit will not be available.`);
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
if (!backend.appId) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
return (await (0, apps_1.getAppConfig)(backend.appId, apps_1.AppPlatform.WEB));
|
|
187
|
+
}
|
|
@@ -61,10 +61,22 @@ class AuthCloudFunction {
|
|
|
61
61
|
: undefined,
|
|
62
62
|
},
|
|
63
63
|
customClaims: JSON.parse(user.customAttributes || "{}"),
|
|
64
|
-
providerData: user.providerUserInfo,
|
|
64
|
+
providerData: user.providerUserInfo?.map((info) => this.createProviderUserInfoPayload(info)),
|
|
65
65
|
tenantId: user.tenantId,
|
|
66
66
|
mfaInfo: user.mfaInfo,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
createProviderUserInfoPayload(info) {
|
|
70
|
+
return {
|
|
71
|
+
rawId: info.rawId,
|
|
72
|
+
providerId: info.providerId,
|
|
73
|
+
displayName: info.displayName,
|
|
74
|
+
email: info.email,
|
|
75
|
+
federatedId: info.federatedId,
|
|
76
|
+
phoneNumber: info.phoneNumber,
|
|
77
|
+
photoURL: info.photoUrl,
|
|
78
|
+
screenName: info.screenName,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
69
81
|
}
|
|
70
82
|
exports.AuthCloudFunction = AuthCloudFunction;
|
|
@@ -220,7 +220,8 @@ function lookup(state, reqBody, ctx) {
|
|
|
220
220
|
tryAddUser(state.getUserByLocalId(localId));
|
|
221
221
|
}
|
|
222
222
|
for (const email of reqBody.email ?? []) {
|
|
223
|
-
|
|
223
|
+
const canonicalizedEmail = (0, utils_1.canonicalizeEmailAddress)(email);
|
|
224
|
+
tryAddUser(state.getUserByEmail(canonicalizedEmail));
|
|
224
225
|
}
|
|
225
226
|
for (const phoneNumber of reqBody.phoneNumber ?? []) {
|
|
226
227
|
tryAddUser(state.getUserByPhoneNumber(phoneNumber));
|
|
@@ -21,6 +21,7 @@ assert(!internalError, internalError);
|
|
|
21
21
|
|
|
22
22
|
var apiKey = query.get('apiKey');
|
|
23
23
|
var appName = query.get('appName');
|
|
24
|
+
var tenantId = query.get('tid');
|
|
24
25
|
var authType = query.get('authType');
|
|
25
26
|
var providerId = query.get('providerId');
|
|
26
27
|
var redirectUrl = query.get('redirectUrl');
|
|
@@ -192,7 +193,7 @@ function finishWithUser(urlEncodedIdToken, email) {
|
|
|
192
193
|
urlResponse: url,
|
|
193
194
|
sessionId: "ValueNotUsedByAuthEmulator",
|
|
194
195
|
postBody: "",
|
|
195
|
-
tenantId:
|
|
196
|
+
tenantId: tenantId,
|
|
196
197
|
error: null,
|
|
197
198
|
});
|
|
198
199
|
}
|
|
@@ -17,7 +17,7 @@ const registry_1 = require("./registry");
|
|
|
17
17
|
const projectUtils_1 = require("../projectUtils");
|
|
18
18
|
const prompt_1 = require("../prompt");
|
|
19
19
|
const fsutils = require("../fsutils");
|
|
20
|
-
const Table = require("cli-
|
|
20
|
+
const Table = require("cli-table3");
|
|
21
21
|
const track_1 = require("../track");
|
|
22
22
|
const env_1 = require("./env");
|
|
23
23
|
const webhook_1 = require("../dataconnect/webhook");
|
|
@@ -69,7 +69,7 @@ function printNoticeIfEmulated(options, emulator) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
exports.printNoticeIfEmulated = printNoticeIfEmulated;
|
|
72
|
-
function warnEmulatorNotSupported(options, emulator) {
|
|
72
|
+
async function warnEmulatorNotSupported(options, emulator) {
|
|
73
73
|
if (emulator !== types_1.Emulators.DATABASE && emulator !== types_1.Emulators.FIRESTORE) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
@@ -80,18 +80,9 @@ function warnEmulatorNotSupported(options, emulator) {
|
|
|
80
80
|
const envVal = process.env[envKey];
|
|
81
81
|
if (envVal) {
|
|
82
82
|
utils.logWarning(`You have set ${clc.bold(`${envKey}=${envVal}`)}, however this command does not support running against the ${emuName} so this action will affect production.`);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
return (0, prompt_1.promptOnce)({
|
|
87
|
-
type: "confirm",
|
|
88
|
-
default: false,
|
|
89
|
-
message: "Do you want to continue?",
|
|
90
|
-
}).then(() => {
|
|
91
|
-
if (!opts.confirm) {
|
|
92
|
-
return utils.reject("Command aborted.", { exit: 1 });
|
|
93
|
-
}
|
|
94
|
-
});
|
|
83
|
+
if (!(await (0, prompt_1.confirm)("Do you want to continue?"))) {
|
|
84
|
+
throw new error_1.FirebaseError("Command aborted.", { exit: 1 });
|
|
85
|
+
}
|
|
95
86
|
}
|
|
96
87
|
}
|
|
97
88
|
exports.warnEmulatorNotSupported = warnEmulatorNotSupported;
|
|
@@ -104,12 +95,15 @@ async function beforeEmulatorCommand(options) {
|
|
|
104
95
|
const canStartWithoutConfig = options.only &&
|
|
105
96
|
!controller.shouldStart(optionsWithConfig, types_1.Emulators.FUNCTIONS) &&
|
|
106
97
|
!controller.shouldStart(optionsWithConfig, types_1.Emulators.HOSTING);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
if (!constants_1.Constants.isDemoProject(options.project) ||
|
|
99
|
+
controller.shouldStart(optionsWithConfig, types_1.Emulators.EXTENSIONS)) {
|
|
100
|
+
try {
|
|
101
|
+
await (0, requireAuth_1.requireAuth)(options);
|
|
102
|
+
}
|
|
103
|
+
catch (e) {
|
|
104
|
+
logger_1.logger.debug(e);
|
|
105
|
+
utils.logLabeledWarning("emulators", `You are not currently authenticated so some features may not work correctly. Please run ${clc.bold("firebase login")} to authenticate the CLI.`);
|
|
106
|
+
}
|
|
113
107
|
}
|
|
114
108
|
if (canStartWithoutConfig && !options.config) {
|
|
115
109
|
utils.logWarning("Could not find config (firebase.json) so using defaults.");
|
|
@@ -103,6 +103,8 @@ Constants.FIREBASE_ENABLED_EXPERIMENTS = "FIREBASE_ENABLED_EXPERIMENTS";
|
|
|
103
103
|
Constants.FIRESTORE_EMULATOR_HOST = "FIRESTORE_EMULATOR_HOST";
|
|
104
104
|
Constants.FIRESTORE_EMULATOR_ENV_ALT = "FIREBASE_FIRESTORE_EMULATOR_ADDRESS";
|
|
105
105
|
Constants.FIREBASE_DATABASE_EMULATOR_HOST = "FIREBASE_DATABASE_EMULATOR_HOST";
|
|
106
|
+
Constants.FIREBASE_DATACONNECT_EMULATOR_HOST = "FIREBASE_DATA_CONNECT_EMULATOR_HOST";
|
|
107
|
+
Constants.FIREBASE_DATACONNECT_ENV_ALT = "DATA_CONNECT_EMULATOR_HOST";
|
|
106
108
|
Constants.FIREBASE_AUTH_EMULATOR_HOST = "FIREBASE_AUTH_EMULATOR_HOST";
|
|
107
109
|
Constants.FIREBASE_STORAGE_EMULATOR_HOST = "FIREBASE_STORAGE_EMULATOR_HOST";
|
|
108
110
|
Constants.CLOUD_STORAGE_EMULATOR_HOST = "STORAGE_EMULATOR_HOST";
|
|
@@ -48,6 +48,7 @@ const tasksEmulator_1 = require("./tasksEmulator");
|
|
|
48
48
|
const apphosting_1 = require("./apphosting");
|
|
49
49
|
const webhook_1 = require("../dataconnect/webhook");
|
|
50
50
|
const api_1 = require("../api");
|
|
51
|
+
const projectPath_1 = require("../projectPath");
|
|
51
52
|
const START_LOGGING_EMULATOR = utils.envOverride("START_LOGGING_EMULATOR", "false", (val) => val === "true");
|
|
52
53
|
async function exportOnExit(options) {
|
|
53
54
|
const exportOnExitDir = options.exportOnExit;
|
|
@@ -357,6 +358,7 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
357
358
|
if (extensionEmulator) {
|
|
358
359
|
await startEmulator(extensionEmulator);
|
|
359
360
|
}
|
|
361
|
+
const account = (0, auth_1.getProjectDefaultAccount)(options.projectRoot);
|
|
360
362
|
if (emulatableBackends.length) {
|
|
361
363
|
if (!listenForEmulator.functions || !listenForEmulator.eventarc || !listenForEmulator.tasks) {
|
|
362
364
|
listenForEmulator = await (0, portUtils_1.resolveHostAndAssignPorts)({
|
|
@@ -382,7 +384,6 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
382
384
|
if (emulatorsNotRunning.length > 0 && !constants_1.Constants.isDemoProject(projectId)) {
|
|
383
385
|
functionsLogger.logLabeled("WARN", "functions", `The following emulators are not running, calls to these services from the Functions emulator will affect production: ${clc.bold(emulatorsNotRunning.join(", "))}`);
|
|
384
386
|
}
|
|
385
|
-
const account = (0, auth_1.getProjectDefaultAccount)(options.projectRoot);
|
|
386
387
|
const functionsEmulator = new functionsEmulator_1.FunctionsEmulator({
|
|
387
388
|
projectId,
|
|
388
389
|
projectDir,
|
|
@@ -578,6 +579,7 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
578
579
|
enable_output_generated_sdk: true,
|
|
579
580
|
enable_output_schema_extensions: true,
|
|
580
581
|
debug: options.debug,
|
|
582
|
+
account,
|
|
581
583
|
};
|
|
582
584
|
if (exportMetadata.dataconnect) {
|
|
583
585
|
utils.assertIsString(options.import);
|
|
@@ -588,13 +590,12 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
588
590
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.DATACONNECT).logLabeled("WARN", "dataconnect", "'firebase.json#emulators.dataconnect.dataDir' is set and `--import` flag was passed. " +
|
|
589
591
|
"This will overwrite any data saved from previous runs.");
|
|
590
592
|
if (!options.nonInteractive &&
|
|
591
|
-
!(await (0, prompt_1.
|
|
592
|
-
type: "confirm",
|
|
593
|
+
!(await (0, prompt_1.confirm)({
|
|
593
594
|
message: `Do you wish to continue and overwrite data in ${dataDirectory}?`,
|
|
594
595
|
default: false,
|
|
595
596
|
}))) {
|
|
596
597
|
await cleanShutdown();
|
|
597
|
-
|
|
598
|
+
throw new error_1.FirebaseError("Command aborted");
|
|
598
599
|
}
|
|
599
600
|
}
|
|
600
601
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.DATACONNECT).logLabeled("BULLET", "dataconnect", `Importing data from ${exportMetadataFilePath}`);
|
|
@@ -632,18 +633,32 @@ async function startAll(options, showUI = true, runningTestScript = false) {
|
|
|
632
633
|
});
|
|
633
634
|
await startEmulator(hostingEmulator);
|
|
634
635
|
}
|
|
635
|
-
const
|
|
636
|
+
const apphostingEmulatorConfig = options.config.src.emulators?.[types_1.Emulators.APPHOSTING];
|
|
636
637
|
if (listenForEmulator.apphosting) {
|
|
638
|
+
const rootDirectory = apphostingEmulatorConfig?.rootDirectory;
|
|
639
|
+
const backendRoot = (0, projectPath_1.resolveProjectPath)({}, rootDirectory ?? "./");
|
|
640
|
+
let apphostingConfig;
|
|
641
|
+
if (Array.isArray(options.config.src.apphosting)) {
|
|
642
|
+
const matchingAppHostingConfig = options.config.src.apphosting.filter((config) => (0, projectPath_1.resolveProjectPath)({}, path.join(".", config.rootDir ?? "/")) === backendRoot);
|
|
643
|
+
if (matchingAppHostingConfig.length === 1) {
|
|
644
|
+
apphostingConfig = matchingAppHostingConfig[0];
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
else {
|
|
648
|
+
apphostingConfig = options.config.src.apphosting;
|
|
649
|
+
}
|
|
637
650
|
const apphostingAddr = legacyGetFirstAddr(types_1.Emulators.APPHOSTING);
|
|
638
|
-
if (
|
|
651
|
+
if (apphostingEmulatorConfig?.startCommandOverride) {
|
|
639
652
|
const apphostingLogger = emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.APPHOSTING);
|
|
640
653
|
apphostingLogger.logLabeled("WARN", types_1.Emulators.APPHOSTING, "The `firebase.json#emulators.apphosting.startCommandOverride` config is deprecated, please use `firebase.json#emulators.apphosting.startCommand` to set a custom start command instead");
|
|
641
654
|
}
|
|
642
655
|
const apphostingEmulator = new apphosting_1.AppHostingEmulator({
|
|
656
|
+
projectId: options.project,
|
|
657
|
+
backendId: apphostingConfig?.backendId,
|
|
643
658
|
host: apphostingAddr.host,
|
|
644
659
|
port: apphostingAddr.port,
|
|
645
|
-
startCommand:
|
|
646
|
-
rootDirectory
|
|
660
|
+
startCommand: apphostingEmulatorConfig?.startCommand || apphostingEmulatorConfig?.startCommandOverride,
|
|
661
|
+
rootDirectory,
|
|
647
662
|
options,
|
|
648
663
|
});
|
|
649
664
|
await startEmulator(apphostingEmulator);
|
|
@@ -730,7 +745,7 @@ async function exportEmulatorData(exportPath, options, initiatedBy) {
|
|
|
730
745
|
const exportAbsPath = path.resolve(exportPath);
|
|
731
746
|
if (!fs.existsSync(exportAbsPath)) {
|
|
732
747
|
utils.logBullet(`Creating export directory ${exportAbsPath}`);
|
|
733
|
-
fs.mkdirSync(exportAbsPath);
|
|
748
|
+
fs.mkdirSync(exportAbsPath, { recursive: true });
|
|
734
749
|
}
|
|
735
750
|
const existingMetadata = hubExport_1.HubExport.readMetadata(exportAbsPath);
|
|
736
751
|
const isExportDirEmpty = fs.readdirSync(exportAbsPath).length === 0;
|