firebase-tools 15.1.0 → 15.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/accountExporter.js +3 -5
- package/lib/accountImporter.js +4 -5
- package/lib/api.js +3 -3
- package/lib/apiv2.js +9 -13
- package/lib/appUtils.js +19 -21
- package/lib/appdistribution/client.js +4 -8
- package/lib/appdistribution/distribution.js +4 -4
- package/lib/appdistribution/options-parser-util.js +8 -9
- package/lib/appdistribution/types.js +2 -2
- package/lib/appdistribution/yaml_helper.js +33 -17
- package/lib/apphosting/app.js +8 -13
- package/lib/apphosting/backend.js +34 -24
- package/lib/apphosting/config.js +14 -14
- package/lib/apphosting/githubConnections.js +38 -35
- package/lib/apphosting/localbuilds.js +4 -6
- package/lib/apphosting/repo.js +24 -20
- package/lib/apphosting/rollout.js +12 -5
- package/lib/apphosting/secrets/dialogs.js +9 -9
- package/lib/apphosting/secrets/index.js +9 -11
- package/lib/apphosting/utils.js +2 -3
- package/lib/apphosting/yaml.js +12 -11
- package/lib/apptesting/ensureProjectConfigured.js +1 -2
- package/lib/apptesting/invokeTests.js +2 -3
- package/lib/apptesting/parseTestFiles.js +5 -6
- package/lib/apptesting/types.js +2 -2
- package/lib/archiveDirectory.js +1 -2
- package/lib/auth.js +36 -40
- package/lib/bin/cli.js +2 -3
- package/lib/bin/mcp.js +1 -2
- package/lib/checkMinRequiredVersion.js +1 -2
- package/lib/checkValidTargetFilters.js +1 -2
- package/lib/command.js +6 -9
- package/lib/commands/appdistribution-testers-list.js +2 -3
- package/lib/commands/apphosting-backends-list.js +4 -6
- package/lib/commands/apphosting-builds-create.js +2 -3
- package/lib/commands/apphosting-builds-get.js +1 -2
- package/lib/commands/apphosting-rollouts-list.js +1 -2
- package/lib/commands/apps-init.js +1 -1
- package/lib/commands/{apptesting-execute.js → apptesting-wata.js} +3 -4
- package/lib/commands/crashlytics-symbols-upload.js +2 -2
- package/lib/commands/dataconnect-execute.js +4 -4
- package/lib/commands/dataconnect-sdk-generate.js +5 -6
- package/lib/commands/dataconnect-services-list.js +7 -8
- package/lib/commands/dataconnect-sql-diff.js +1 -2
- package/lib/commands/dataconnect-sql-migrate.js +4 -3
- package/lib/commands/dataconnect-sql-setup.js +2 -2
- package/lib/commands/dataconnect-sql-shell.js +5 -1
- package/lib/commands/emulators-start.js +1 -2
- package/lib/commands/ext-configure.js +6 -4
- package/lib/commands/ext-dev-list.js +2 -3
- package/lib/commands/ext-dev-upload.js +2 -2
- package/lib/commands/ext-export.js +1 -1
- package/lib/commands/ext-info.js +2 -3
- package/lib/commands/ext-install.js +5 -7
- package/lib/commands/firestore-backups-list.js +1 -2
- package/lib/commands/firestore-backups-schedules-list.js +1 -2
- package/lib/commands/firestore-indexes-list.js +1 -2
- package/lib/commands/firestore-utils.js +1 -2
- package/lib/commands/functions-artifacts-setpolicy.js +1 -2
- package/lib/commands/functions-config-export.js +2 -3
- package/lib/commands/hosting-channel-deploy.js +2 -2
- package/lib/commands/hosting-clone.js +2 -3
- package/lib/commands/hosting-sites-create.js +1 -1
- package/lib/commands/index.js +2 -3
- package/lib/commands/init.js +4 -5
- package/lib/commands/internaltesting-functions-discover.js +1 -1
- package/lib/commands/login.js +4 -5
- package/lib/commands/logout.js +3 -3
- package/lib/commands/projects-create.js +1 -1
- package/lib/commands/remoteconfig-experiments-list.js +2 -3
- package/lib/commands/remoteconfig-get.js +1 -1
- package/lib/commands/remoteconfig-rollback.js +1 -2
- package/lib/commands/remoteconfig-rollouts-list.js +2 -3
- package/lib/commands/remoteconfig-versions-list.js +3 -4
- package/lib/commands/use.js +3 -3
- package/lib/config.js +4 -5
- package/lib/crashlytics/buildToolsJarHelper.js +3 -5
- package/lib/crashlytics/events.js +4 -7
- package/lib/crashlytics/filters.js +10 -12
- package/lib/crashlytics/issues.js +2 -3
- package/lib/crashlytics/notes.js +3 -4
- package/lib/crashlytics/reports.js +21 -15
- package/lib/crashlytics/types.js +7 -7
- package/lib/crashlytics/utils.js +4 -4
- package/lib/database/api.js +2 -3
- package/lib/database/import.js +4 -4
- package/lib/database/metadata.js +5 -6
- package/lib/database/rulesConfig.js +2 -3
- package/lib/dataconnect/build.js +10 -13
- package/lib/dataconnect/checkIam.js +1 -2
- package/lib/dataconnect/client.js +15 -18
- package/lib/dataconnect/dataplaneClient.js +6 -6
- package/lib/dataconnect/ensureApis.js +2 -3
- package/lib/dataconnect/errors.js +8 -11
- package/lib/dataconnect/filters.js +2 -3
- package/lib/dataconnect/freeTrial.js +3 -4
- package/lib/dataconnect/graphqlError.js +5 -8
- package/lib/dataconnect/load.js +10 -11
- package/lib/dataconnect/names.js +14 -18
- package/lib/dataconnect/prompts.js +1 -2
- package/lib/dataconnect/provisionCloudSql.js +13 -17
- package/lib/dataconnect/schemaMigration.js +60 -27
- package/lib/dataconnect/types.js +10 -12
- package/lib/dataconnect/webhook.js +3 -3
- package/lib/defaultCredentials.js +3 -4
- package/lib/deploy/apphosting/deploy.js +2 -3
- package/lib/deploy/apphosting/prepare.js +3 -5
- package/lib/deploy/apphosting/release.js +1 -1
- package/lib/deploy/apphosting/util.js +1 -2
- package/lib/deploy/database/deploy.js +1 -2
- package/lib/deploy/database/prepare.js +1 -2
- package/lib/deploy/database/release.js +1 -2
- package/lib/deploy/dataconnect/context.js +15 -4
- package/lib/deploy/dataconnect/deploy.js +5 -6
- package/lib/deploy/dataconnect/prepare.js +7 -9
- package/lib/deploy/dataconnect/release.js +7 -10
- package/lib/deploy/extensions/deploy.js +7 -9
- package/lib/deploy/extensions/deploymentSummary.js +6 -7
- package/lib/deploy/extensions/planner.js +15 -18
- package/lib/deploy/extensions/prepare.js +9 -11
- package/lib/deploy/extensions/release.js +10 -12
- package/lib/deploy/extensions/secrets.js +8 -11
- package/lib/deploy/extensions/tasks.js +6 -8
- package/lib/deploy/extensions/v2FunctionHelper.js +2 -3
- package/lib/deploy/extensions/validate.js +1 -2
- package/lib/deploy/firestore/deploy.js +3 -5
- package/lib/deploy/firestore/prepare.js +2 -3
- package/lib/deploy/firestore/release.js +3 -4
- package/lib/deploy/functions/backend.js +52 -42
- package/lib/deploy/functions/build.js +41 -15
- package/lib/deploy/functions/cache/applyHash.js +3 -5
- package/lib/deploy/functions/cache/hash.js +4 -5
- package/lib/deploy/functions/cel.js +3 -3
- package/lib/deploy/functions/checkIam.js +8 -8
- package/lib/deploy/functions/containerCleaner.js +10 -6
- package/lib/deploy/functions/deploy.js +6 -8
- package/lib/deploy/functions/ensure.js +6 -9
- package/lib/deploy/functions/functionsDeployHelper.js +10 -11
- package/lib/deploy/functions/params.js +10 -10
- package/lib/deploy/functions/prepare.js +41 -36
- package/lib/deploy/functions/prepareFunctionsUpload.js +24 -10
- package/lib/deploy/functions/pricing.js +3 -3
- package/lib/deploy/functions/prompts.js +7 -10
- package/lib/deploy/functions/release/executor.js +5 -6
- package/lib/deploy/functions/release/fabricator.js +76 -29
- package/lib/deploy/functions/release/index.js +23 -14
- package/lib/deploy/functions/release/planner.js +15 -14
- package/lib/deploy/functions/release/reporter.js +20 -20
- package/lib/deploy/functions/release/sourceTokenScraper.js +4 -5
- package/lib/deploy/functions/remoteSource.js +3 -4
- package/lib/deploy/functions/runtimes/discovery/index.js +9 -12
- package/lib/deploy/functions/runtimes/discovery/parsing.js +2 -3
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +29 -10
- package/lib/deploy/functions/runtimes/index.js +1 -2
- package/lib/deploy/functions/runtimes/node/index.js +18 -9
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +2 -2
- package/lib/deploy/functions/runtimes/node/validate.js +1 -2
- package/lib/deploy/functions/runtimes/node/versioning.js +6 -7
- package/lib/deploy/functions/runtimes/python/index.js +12 -12
- package/lib/deploy/functions/runtimes/supported/index.js +5 -6
- package/lib/deploy/functions/services/auth.js +49 -36
- package/lib/deploy/functions/services/database.js +1 -2
- package/lib/deploy/functions/services/dataconnect.js +16 -2
- package/lib/deploy/functions/services/firebaseAlerts.js +1 -2
- package/lib/deploy/functions/services/firestore.js +3 -5
- package/lib/deploy/functions/services/index.js +2 -2
- package/lib/deploy/functions/services/remoteConfig.js +1 -2
- package/lib/deploy/functions/services/storage.js +3 -5
- package/lib/deploy/functions/services/testLab.js +1 -2
- package/lib/deploy/functions/triggerRegionHelper.js +1 -2
- package/lib/deploy/functions/validate.js +12 -11
- package/lib/deploy/hosting/convertConfig.js +38 -22
- package/lib/deploy/hosting/deploy.js +4 -7
- package/lib/deploy/hosting/hashcache.js +2 -3
- package/lib/deploy/hosting/prepare.js +14 -14
- package/lib/deploy/hosting/release.js +1 -2
- package/lib/deploy/index.js +7 -8
- package/lib/deploy/lifecycleHooks.js +3 -5
- package/lib/deploy/remoteconfig/deploy.js +1 -1
- package/lib/deploy/remoteconfig/functions.js +5 -6
- package/lib/deploy/remoteconfig/prepare.js +2 -3
- package/lib/deploy/remoteconfig/release.js +2 -2
- package/lib/deploy/storage/deploy.js +1 -1
- package/lib/deploy/storage/prepare.js +1 -1
- package/lib/deploy/storage/release.js +1 -1
- package/lib/deploymentTool.js +5 -6
- package/lib/detectProjectRoot.js +1 -2
- package/lib/downloadUtils.js +2 -3
- package/lib/emulator/adminSdkConfig.js +2 -3
- package/lib/emulator/apphosting/config.js +1 -2
- package/lib/emulator/apphosting/developmentServer.js +3 -3
- package/lib/emulator/apphosting/serve.js +20 -14
- package/lib/emulator/auth/cloudFunctions.js +2 -3
- package/lib/emulator/auth/errors.js +2 -2
- package/lib/emulator/auth/handlers.js +3 -4
- package/lib/emulator/auth/index.js +6 -6
- package/lib/emulator/auth/operations.js +171 -129
- package/lib/emulator/auth/server.js +30 -22
- package/lib/emulator/auth/state.js +26 -36
- package/lib/emulator/auth/utils.js +12 -13
- package/lib/emulator/commandUtils.js +20 -20
- package/lib/emulator/controller.js +32 -29
- package/lib/emulator/databaseEmulator.js +1 -2
- package/lib/emulator/dataconnect/pgliteServer.js +48 -104
- package/lib/emulator/dataconnectEmulator.js +6 -9
- package/lib/emulator/download.js +2 -3
- package/lib/emulator/downloadableEmulatorInfo.json +7 -7
- package/lib/emulator/downloadableEmulators.js +49 -24
- package/lib/emulator/emulatorLogger.js +19 -4
- package/lib/emulator/env.js +6 -8
- package/lib/emulator/eventarcEmulator.js +2 -3
- package/lib/emulator/eventarcEmulatorUtils.js +3 -6
- package/lib/emulator/extensions/postinstall.js +1 -2
- package/lib/emulator/extensions/validation.js +4 -7
- package/lib/emulator/extensionsEmulator.js +6 -9
- package/lib/emulator/functionsEmulator.js +89 -46
- package/lib/emulator/functionsEmulatorRuntime.js +1 -1
- package/lib/emulator/functionsEmulatorShared.js +30 -30
- package/lib/emulator/functionsEmulatorShell.js +4 -6
- package/lib/emulator/functionsEmulatorUtils.js +8 -9
- package/lib/emulator/functionsRuntimeWorker.js +18 -9
- package/lib/emulator/hub.js +41 -34
- package/lib/emulator/hubClient.js +1 -1
- package/lib/emulator/initEmulators.js +2 -3
- package/lib/emulator/loggingEmulator.js +2 -2
- package/lib/emulator/portUtils.js +4 -5
- package/lib/emulator/registry.js +10 -4
- package/lib/emulator/shared/request.js +1 -2
- package/lib/emulator/storage/apis/firebase.js +16 -20
- package/lib/emulator/storage/apis/gcloud.js +6 -9
- package/lib/emulator/storage/apis/shared.js +1 -2
- package/lib/emulator/storage/crc.js +2 -3
- package/lib/emulator/storage/files.js +18 -41
- package/lib/emulator/storage/metadata.js +10 -4
- package/lib/emulator/storage/multipart.js +1 -2
- package/lib/emulator/storage/rfc.js +1 -2
- package/lib/emulator/storage/rules/config.js +1 -2
- package/lib/emulator/storage/rules/manager.js +3 -5
- package/lib/emulator/storage/rules/runtime.js +15 -13
- package/lib/emulator/storage/rules/types.js +2 -2
- package/lib/emulator/storage/rules/utils.js +5 -6
- package/lib/emulator/storage/server.js +1 -2
- package/lib/emulator/storage/upload.js +3 -4
- package/lib/emulator/taskQueue.js +11 -4
- package/lib/emulator/tasksEmulator.js +11 -12
- package/lib/emulator/types.js +6 -6
- package/lib/emulator/ui.js +6 -1
- package/lib/ensureApiEnabled.js +7 -9
- package/lib/env.js +2 -3
- package/lib/error.js +11 -13
- package/lib/errorOut.js +1 -2
- package/lib/experiments.js +15 -18
- package/lib/extensions/askUserForEventsConfig.js +12 -13
- package/lib/extensions/askUserForParam.js +11 -12
- package/lib/extensions/change-log.js +4 -5
- package/lib/extensions/checkProjectBilling.js +1 -2
- package/lib/extensions/diagnose.js +1 -2
- package/lib/extensions/displayExtensionInfo.js +25 -32
- package/lib/extensions/emulator/optionsHelper.js +6 -8
- package/lib/extensions/emulator/specHelper.js +15 -16
- package/lib/extensions/emulator/triggerHelper.js +3 -5
- package/lib/extensions/etags.js +2 -3
- package/lib/extensions/export.js +7 -9
- package/lib/extensions/extensionsApi.js +23 -29
- package/lib/extensions/extensionsHelper.js +52 -80
- package/lib/extensions/listExtensions.js +3 -5
- package/lib/extensions/localHelper.js +5 -5
- package/lib/extensions/manifest.js +15 -16
- package/lib/extensions/metricsUtils.js +3 -4
- package/lib/extensions/paramHelper.js +21 -18
- package/lib/extensions/provisioningHelper.js +17 -21
- package/lib/extensions/publishHelpers.js +1 -2
- package/lib/extensions/publisherApi.js +11 -13
- package/lib/extensions/refs.js +6 -7
- package/lib/extensions/runtimes/common.js +18 -19
- package/lib/extensions/runtimes/node.js +5 -6
- package/lib/extensions/secretsUtils.js +8 -8
- package/lib/extensions/tos.js +7 -8
- package/lib/extensions/types.js +3 -3
- package/lib/extensions/updateHelper.js +6 -7
- package/lib/extensions/utils.js +6 -8
- package/lib/extensions/versionHelper.js +1 -2
- package/lib/extensions/warnings.js +6 -8
- package/lib/fetchMOTD.js +1 -2
- package/lib/fetchWebSetup.js +3 -4
- package/lib/filterTargets.js +1 -2
- package/lib/firebaseConfigValidate.js +2 -3
- package/lib/firestore/api-sort.js +8 -9
- package/lib/firestore/api-types.js +15 -15
- package/lib/firestore/api.js +15 -13
- package/lib/firestore/backupUtils.js +3 -3
- package/lib/firestore/checkDatabaseType.js +1 -2
- package/lib/firestore/delete.js +1 -2
- package/lib/firestore/encodeFirestoreValue.js +1 -2
- package/lib/firestore/fsConfig.js +1 -2
- package/lib/firestore/options.js +1 -1
- package/lib/firestore/util.js +5 -6
- package/lib/firestore/validator.js +4 -5
- package/lib/frameworks/angular/index.js +14 -15
- package/lib/frameworks/angular/utils.js +21 -23
- package/lib/frameworks/astro/index.js +7 -7
- package/lib/frameworks/astro/utils.js +4 -6
- package/lib/frameworks/compose/discover/filesystem.js +3 -3
- package/lib/frameworks/compose/discover/frameworkMatcher.js +4 -5
- package/lib/frameworks/compose/discover/index.js +1 -2
- package/lib/frameworks/compose/discover/runtime/node.js +8 -11
- package/lib/frameworks/compose/driver/docker.js +3 -5
- package/lib/frameworks/compose/driver/hooks.js +2 -2
- package/lib/frameworks/compose/driver/index.js +2 -2
- package/lib/frameworks/compose/driver/local.js +2 -3
- package/lib/frameworks/compose/index.js +5 -7
- package/lib/frameworks/constants.js +3 -3
- package/lib/frameworks/express/index.js +7 -8
- package/lib/frameworks/flutter/index.js +6 -7
- package/lib/frameworks/flutter/utils.js +4 -5
- package/lib/frameworks/index.js +21 -22
- package/lib/frameworks/next/constants.js +5 -2
- package/lib/frameworks/next/index.js +34 -32
- package/lib/frameworks/next/utils.js +40 -39
- package/lib/frameworks/nuxt/index.js +9 -9
- package/lib/frameworks/nuxt/utils.js +4 -6
- package/lib/frameworks/nuxt2/index.js +7 -7
- package/lib/frameworks/sveltekit/index.js +6 -8
- package/lib/frameworks/utils.js +26 -24
- package/lib/frameworks/vite/index.js +8 -9
- package/lib/fsAsync.js +1 -2
- package/lib/fsutils.js +5 -6
- package/lib/functional.js +11 -11
- package/lib/functions/artifacts.js +25 -22
- package/lib/functions/ensureTargeted.js +1 -2
- package/lib/functions/env.js +13 -14
- package/lib/functions/functionslog.js +2 -3
- package/lib/functions/projectConfig.js +29 -33
- package/lib/functions/python.js +10 -4
- package/lib/functions/secrets.js +32 -18
- package/lib/functionsConfig.js +14 -14
- package/lib/functionsConfigClone.js +1 -2
- package/lib/functionsShellCommandAction.js +2 -3
- package/lib/gcp/apphosting.js +43 -28
- package/lib/gcp/apptesting.js +2 -2
- package/lib/gcp/artifactregistry.js +5 -5
- package/lib/gcp/auth.js +11 -13
- package/lib/gcp/cloudbilling.js +4 -5
- package/lib/gcp/cloudbuild.js +10 -11
- package/lib/gcp/cloudfunctions.js +61 -45
- package/lib/gcp/cloudfunctionsv2.js +81 -43
- package/lib/gcp/cloudlogging.js +2 -4
- package/lib/gcp/cloudmonitoring.js +7 -7
- package/lib/gcp/cloudscheduler.js +12 -14
- package/lib/gcp/cloudsql/cloudsqladmin.js +18 -20
- package/lib/gcp/cloudsql/connect.js +14 -9
- package/lib/gcp/cloudsql/fbToolsAuthClient.js +5 -3
- package/lib/gcp/cloudsql/interactive.js +2 -3
- package/lib/gcp/cloudsql/permissions.js +8 -8
- package/lib/gcp/cloudsql/permissionsSetup.js +9 -9
- package/lib/gcp/cloudtasks.js +19 -18
- package/lib/gcp/computeEngine.js +1 -2
- package/lib/gcp/devConnect.js +32 -29
- package/lib/gcp/docker.js +2 -4
- package/lib/gcp/eventarc.js +5 -5
- package/lib/gcp/firedata.js +4 -4
- package/lib/gcp/firestore.js +16 -16
- package/lib/gcp/iam.js +11 -12
- package/lib/gcp/identityPlatform.js +4 -5
- package/lib/gcp/k8s.js +1 -2
- package/lib/gcp/location.js +2 -2
- package/lib/gcp/proto.js +10 -11
- package/lib/gcp/pubsub.js +4 -5
- package/lib/gcp/resourceManager.js +5 -5
- package/lib/gcp/rules.js +13 -14
- package/lib/gcp/run.js +24 -31
- package/lib/gcp/runv2.js +39 -27
- package/lib/gcp/secretManager.js +60 -39
- package/lib/gcp/serviceusage.js +8 -4
- package/lib/gcp/storage.js +22 -20
- package/lib/gemini/fdcExperience.js +5 -5
- package/lib/getDefaultDatabaseInstance.js +2 -4
- package/lib/getDefaultHostingSite.js +3 -4
- package/lib/getProjectNumber.js +1 -2
- package/lib/hosting/api.js +32 -36
- package/lib/hosting/cloudRunProxy.js +2 -3
- package/lib/hosting/config.js +17 -17
- package/lib/hosting/expireUtils.js +3 -3
- package/lib/hosting/functionsProxy.js +1 -2
- package/lib/hosting/implicitInit.js +1 -2
- package/lib/hosting/initMiddleware.js +1 -2
- package/lib/hosting/interactive.js +1 -2
- package/lib/hosting/proxy.js +3 -5
- package/lib/hosting/runTags.js +8 -11
- package/lib/init/features/account.js +1 -2
- package/lib/init/features/ailogic/index.js +3 -5
- package/lib/init/features/ailogic/utils.js +6 -8
- package/lib/init/features/aitools/claude.js +1 -2
- package/lib/init/features/aitools/cursor.js +1 -2
- package/lib/init/features/aitools/gemini.js +1 -1
- package/lib/init/features/aitools/promptUpdater.js +10 -12
- package/lib/init/features/aitools.js +1 -2
- package/lib/init/features/apphosting.js +3 -4
- package/lib/init/features/apptesting/index.js +9 -9
- package/lib/init/features/database.js +4 -5
- package/lib/init/features/dataconnect/create_app.js +3 -4
- package/lib/init/features/dataconnect/index.js +25 -22
- package/lib/init/features/dataconnect/resolver.js +6 -10
- package/lib/init/features/dataconnect/sdk.js +31 -24
- package/lib/init/features/emulators.js +7 -6
- package/lib/init/features/extensions/index.js +3 -5
- package/lib/init/features/firestore/index.js +7 -9
- package/lib/init/features/firestore/indexes.js +2 -2
- package/lib/init/features/firestore/rules.js +3 -3
- package/lib/init/features/functions/index.js +3 -5
- package/lib/init/features/functions/javascript.js +1 -2
- package/lib/init/features/functions/npm-dependencies.js +1 -2
- package/lib/init/features/functions/python.js +1 -2
- package/lib/init/features/functions/typescript.js +1 -2
- package/lib/init/features/genkit/index.js +44 -18
- package/lib/init/features/hosting/github.js +6 -8
- package/lib/init/features/hosting/index.js +10 -13
- package/lib/init/features/project.js +4 -7
- package/lib/init/features/remoteconfig.js +1 -2
- package/lib/init/features/storage.js +3 -5
- package/lib/init/index.js +4 -7
- package/lib/init/spawn.js +7 -9
- package/lib/listFiles.js +1 -2
- package/lib/loadCJSON.js +1 -2
- package/lib/localFunction.js +14 -15
- package/lib/logError.js +1 -2
- package/lib/logger.js +7 -7
- package/lib/management/apps.js +22 -22
- package/lib/management/database.js +11 -12
- package/lib/management/projects.js +57 -56
- package/lib/management/provisioning/errorHandler.js +3 -5
- package/lib/management/provisioning/provision.js +15 -9
- package/lib/management/studio.js +2 -3
- package/lib/mcp/errors.js +4 -4
- package/lib/mcp/index.js +16 -23
- package/lib/mcp/prompt.js +1 -2
- package/lib/mcp/prompts/core/consult.js +2 -3
- package/lib/mcp/prompts/crashlytics/connect.js +15 -122
- package/lib/mcp/prompts/dataconnect/schema.js +3 -3
- package/lib/mcp/prompts/index.js +8 -10
- package/lib/mcp/resource.js +3 -15
- package/lib/mcp/resources/guides/app_id.js +39 -0
- package/lib/mcp/resources/guides/crashlytics_connect.js +51 -0
- package/lib/mcp/resources/guides/crashlytics_investigations.js +51 -0
- package/lib/mcp/resources/guides/crashlytics_issues.js +42 -0
- package/lib/mcp/resources/guides/crashlytics_reports.js +112 -0
- package/lib/mcp/resources/index.js +11 -3
- package/lib/mcp/tool.js +3 -15
- package/lib/mcp/tools/apphosting/fetch_logs.js +3 -4
- package/lib/mcp/tools/apphosting/list_backends.js +1 -1
- package/lib/mcp/tools/auth/get_users.js +5 -16
- package/lib/mcp/tools/core/create_android_sha.js +4 -1
- package/lib/mcp/tools/core/get_environment.js +3 -3
- package/lib/mcp/tools/core/get_sdk_config.js +4 -5
- package/lib/mcp/tools/core/get_security_rules.js +1 -2
- package/lib/mcp/tools/core/init.js +2 -2
- package/lib/mcp/tools/core/logout.js +1 -1
- package/lib/mcp/tools/core/read_resources.js +2 -2
- package/lib/mcp/tools/core/validate_security_rules.js +1 -2
- package/lib/mcp/tools/crashlytics/events.js +43 -19
- package/lib/mcp/tools/crashlytics/index.js +1 -6
- package/lib/mcp/tools/crashlytics/issues.js +33 -12
- package/lib/mcp/tools/crashlytics/reports.js +66 -117
- package/lib/mcp/tools/dataconnect/list_services.js +2 -3
- package/lib/mcp/tools/firestore/converter.js +3 -5
- package/lib/mcp/tools/firestore/delete_document.js +1 -1
- package/lib/mcp/tools/functions/get_logs.js +14 -12
- package/lib/mcp/tools/functions/list_functions.js +1 -1
- package/lib/mcp/tools/index.js +17 -9
- package/lib/mcp/util/apptesting/availability.js +1 -2
- package/lib/mcp/util/availability.js +1 -2
- package/lib/mcp/util/crashlytics/availability.js +1 -2
- package/lib/mcp/util/dataconnect/compile.js +7 -6
- package/lib/mcp/util/dataconnect/converter.js +7 -10
- package/lib/mcp/util/dataconnect/emulator.js +1 -2
- package/lib/mcp/util.js +9 -11
- package/lib/messaging/sendMessage.js +1 -2
- package/lib/metaprogramming.js +1 -2
- package/lib/operation-poller.js +2 -2
- package/lib/profileReport.js +6 -6
- package/lib/profiler.js +1 -2
- package/lib/projectPath.js +1 -2
- package/lib/projectUtils.js +5 -6
- package/lib/prompt.js +22 -13
- package/lib/rc.js +5 -7
- package/lib/remoteconfig/deleteExperiment.js +1 -2
- package/lib/remoteconfig/deleteRollout.js +1 -2
- package/lib/remoteconfig/get.js +2 -3
- package/lib/remoteconfig/getExperiment.js +2 -2
- package/lib/remoteconfig/getRollout.js +2 -2
- package/lib/remoteconfig/interfaces.js +1 -1
- package/lib/remoteconfig/listExperiments.js +2 -2
- package/lib/remoteconfig/listRollouts.js +2 -2
- package/lib/remoteconfig/publish.js +1 -2
- package/lib/remoteconfig/rollback.js +1 -2
- package/lib/remoteconfig/versionslist.js +1 -2
- package/lib/requireAuth.js +4 -6
- package/lib/requireConfig.js +5 -8
- package/lib/requireDatabaseInstance.js +2 -2
- package/lib/requireHostingSite.js +1 -2
- package/lib/requireInteractive.js +1 -1
- package/lib/requirePermissions.js +1 -2
- package/lib/requireTosAcceptance.js +1 -2
- package/lib/responseToError.js +1 -2
- package/lib/rtdb.js +2 -3
- package/lib/rulesDeploy.js +3 -4
- package/lib/serve/functions.js +9 -1
- package/lib/serve/hosting.js +4 -5
- package/lib/serve/index.js +1 -2
- package/lib/shortenUrl.js +1 -2
- package/lib/templates.js +3 -4
- package/lib/throttler/throttler.js +3 -3
- package/lib/timeout.js +2 -3
- package/lib/track.js +23 -14
- package/lib/tsconfig.publish.tsbuildinfo +1 -0
- package/lib/unzip.js +2 -3
- package/lib/utils.js +62 -63
- package/lib/vsCodeUtils.js +2 -3
- package/package.json +6 -6
- package/templates/extensions/typescript/index.ts +1 -1
- package/templates/extensions/typescript/package.lint.json +1 -1
- package/templates/extensions/typescript/package.nolint.json +1 -1
- package/templates/extensions/typescript/tsconfig.json +2 -1
package/lib/gcp/storage.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ContentType = void 0;
|
|
4
|
+
exports.getDefaultBucket = getDefaultBucket;
|
|
5
|
+
exports.upload = upload;
|
|
6
|
+
exports.uploadObject = uploadObject;
|
|
7
|
+
exports.getObject = getObject;
|
|
8
|
+
exports.deleteObject = deleteObject;
|
|
9
|
+
exports.getBucket = getBucket;
|
|
10
|
+
exports.createBucket = createBucket;
|
|
11
|
+
exports.patchBucket = patchBucket;
|
|
12
|
+
exports.randomString = randomString;
|
|
13
|
+
exports.upsertBucket = upsertBucket;
|
|
14
|
+
exports.listBuckets = listBuckets;
|
|
15
|
+
exports.getServiceAccount = getServiceAccount;
|
|
16
|
+
exports.getDownloadUrl = getDownloadUrl;
|
|
4
17
|
const path = require("path");
|
|
5
18
|
const clc = require("colorette");
|
|
6
19
|
const crypto_1 = require("crypto");
|
|
@@ -15,9 +28,8 @@ var ContentType;
|
|
|
15
28
|
(function (ContentType) {
|
|
16
29
|
ContentType["ZIP"] = "ZIP";
|
|
17
30
|
ContentType["TAR"] = "TAR";
|
|
18
|
-
})(ContentType
|
|
31
|
+
})(ContentType || (exports.ContentType = ContentType = {}));
|
|
19
32
|
async function getDefaultBucket(projectId) {
|
|
20
|
-
var _a;
|
|
21
33
|
await (0, ensureApiEnabled_1.ensure)(projectId, (0, api_1.firebaseStorageOrigin)(), "storage", false);
|
|
22
34
|
try {
|
|
23
35
|
const localAPIClient = new apiv2_1.Client({
|
|
@@ -25,21 +37,20 @@ async function getDefaultBucket(projectId) {
|
|
|
25
37
|
apiVersion: "v1alpha",
|
|
26
38
|
});
|
|
27
39
|
const response = await localAPIClient.get(`/projects/${projectId}/defaultBucket`);
|
|
28
|
-
if (!
|
|
40
|
+
if (!response.body?.bucket.name) {
|
|
29
41
|
logger_1.logger.debug("Default storage bucket is undefined.");
|
|
30
42
|
throw new error_1.FirebaseError("Your project is being set up. Please wait a minute before deploying again.");
|
|
31
43
|
}
|
|
32
44
|
return response.body.bucket.name.split("/").pop();
|
|
33
45
|
}
|
|
34
46
|
catch (err) {
|
|
35
|
-
if (
|
|
47
|
+
if (err?.status === 404) {
|
|
36
48
|
throw new error_1.FirebaseError(`Firebase Storage has not been set up on project '${clc.bold(projectId)}'. Go to https://console.firebase.google.com/project/${projectId}/storage and click 'Get Started' to set up Firebase Storage.`);
|
|
37
49
|
}
|
|
38
50
|
logger_1.logger.info("\n\nUnexpected error when fetching default storage bucket.");
|
|
39
51
|
throw err;
|
|
40
52
|
}
|
|
41
53
|
}
|
|
42
|
-
exports.getDefaultBucket = getDefaultBucket;
|
|
43
54
|
async function upload(source, uploadUrl, extraHeaders, ignoreQuotaProject) {
|
|
44
55
|
const url = new URL(uploadUrl, (0, api_1.storageOrigin)());
|
|
45
56
|
const isSignedUrl = url.searchParams.has("GoogleAccessId");
|
|
@@ -49,7 +60,10 @@ async function upload(source, uploadUrl, extraHeaders, ignoreQuotaProject) {
|
|
|
49
60
|
path: url.pathname,
|
|
50
61
|
queryParams: url.searchParams,
|
|
51
62
|
responseType: "xml",
|
|
52
|
-
headers:
|
|
63
|
+
headers: {
|
|
64
|
+
"content-type": "application/zip",
|
|
65
|
+
...extraHeaders,
|
|
66
|
+
},
|
|
53
67
|
body: source.stream,
|
|
54
68
|
skipLog: { resBody: true },
|
|
55
69
|
ignoreQuotaProject,
|
|
@@ -58,7 +72,6 @@ async function upload(source, uploadUrl, extraHeaders, ignoreQuotaProject) {
|
|
|
58
72
|
generation: res.response.headers.get("x-goog-generation"),
|
|
59
73
|
};
|
|
60
74
|
}
|
|
61
|
-
exports.upload = upload;
|
|
62
75
|
async function uploadObject(source, bucketName, contentType) {
|
|
63
76
|
switch (contentType) {
|
|
64
77
|
case ContentType.TAR:
|
|
@@ -88,18 +101,15 @@ async function uploadObject(source, bucketName, contentType) {
|
|
|
88
101
|
generation: res.response.headers.get("x-goog-generation"),
|
|
89
102
|
};
|
|
90
103
|
}
|
|
91
|
-
exports.uploadObject = uploadObject;
|
|
92
104
|
async function getObject(bucketName, objectName) {
|
|
93
105
|
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
94
106
|
const res = await client.get(`/storage/v1/b/${bucketName}/o/${objectName}`);
|
|
95
107
|
return res.body;
|
|
96
108
|
}
|
|
97
|
-
exports.getObject = getObject;
|
|
98
109
|
function deleteObject(location) {
|
|
99
110
|
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
100
111
|
return localAPIClient.delete(location);
|
|
101
112
|
}
|
|
102
|
-
exports.deleteObject = deleteObject;
|
|
103
113
|
async function getBucket(bucketName) {
|
|
104
114
|
try {
|
|
105
115
|
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
@@ -113,7 +123,6 @@ async function getBucket(bucketName) {
|
|
|
113
123
|
});
|
|
114
124
|
}
|
|
115
125
|
}
|
|
116
|
-
exports.getBucket = getBucket;
|
|
117
126
|
async function createBucket(projectId, req, projectPrivate) {
|
|
118
127
|
const queryParams = {
|
|
119
128
|
project: projectId,
|
|
@@ -134,7 +143,6 @@ async function createBucket(projectId, req, projectPrivate) {
|
|
|
134
143
|
});
|
|
135
144
|
}
|
|
136
145
|
}
|
|
137
|
-
exports.createBucket = createBucket;
|
|
138
146
|
async function patchBucket(bucketName, metadata) {
|
|
139
147
|
try {
|
|
140
148
|
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
@@ -149,7 +157,6 @@ async function patchBucket(bucketName, metadata) {
|
|
|
149
157
|
});
|
|
150
158
|
}
|
|
151
159
|
}
|
|
152
|
-
exports.patchBucket = patchBucket;
|
|
153
160
|
function randomString(length) {
|
|
154
161
|
const chars = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
155
162
|
let result = "";
|
|
@@ -158,7 +165,6 @@ function randomString(length) {
|
|
|
158
165
|
}
|
|
159
166
|
return result;
|
|
160
167
|
}
|
|
161
|
-
exports.randomString = randomString;
|
|
162
168
|
const dynamicDispatch = exports;
|
|
163
169
|
async function upsertBucket(opts) {
|
|
164
170
|
const existingBuckets = await dynamicDispatch.listBuckets(opts.projectId);
|
|
@@ -169,7 +175,7 @@ async function upsertBucket(opts) {
|
|
|
169
175
|
const existingUnmanaged = existingBuckets.find((b) => b.name === opts.req.baseName);
|
|
170
176
|
if (existingUnmanaged) {
|
|
171
177
|
logger_1.logger.debug(`Found existing bucket ${existingUnmanaged.name} without purpose label. Because it is known not to be squatted, we can use it.`);
|
|
172
|
-
const labels =
|
|
178
|
+
const labels = { ...existingUnmanaged.labels, [opts.req.purposeLabel]: "true" };
|
|
173
179
|
await dynamicDispatch.patchBucket(existingUnmanaged.name, { labels });
|
|
174
180
|
return existingUnmanaged.name;
|
|
175
181
|
}
|
|
@@ -205,7 +211,6 @@ async function upsertBucket(opts) {
|
|
|
205
211
|
}
|
|
206
212
|
throw new error_1.FirebaseError("Failed to create a unique Cloud Storage bucket name after 5 attempts.");
|
|
207
213
|
}
|
|
208
|
-
exports.upsertBucket = upsertBucket;
|
|
209
214
|
async function listBuckets(projectId) {
|
|
210
215
|
try {
|
|
211
216
|
let buckets = [];
|
|
@@ -225,7 +230,6 @@ async function listBuckets(projectId) {
|
|
|
225
230
|
});
|
|
226
231
|
}
|
|
227
232
|
}
|
|
228
|
-
exports.listBuckets = listBuckets;
|
|
229
233
|
async function getServiceAccount(projectId) {
|
|
230
234
|
try {
|
|
231
235
|
const localAPIClient = new apiv2_1.Client({ urlPrefix: (0, api_1.storageOrigin)() });
|
|
@@ -239,7 +243,6 @@ async function getServiceAccount(projectId) {
|
|
|
239
243
|
});
|
|
240
244
|
}
|
|
241
245
|
}
|
|
242
|
-
exports.getServiceAccount = getServiceAccount;
|
|
243
246
|
async function getDownloadUrl(bucketName, objectPath, emulatorUrl) {
|
|
244
247
|
try {
|
|
245
248
|
const origin = emulatorUrl || (0, api_1.firebaseStorageOrigin)();
|
|
@@ -261,4 +264,3 @@ async function getDownloadUrl(bucketName, objectPath, emulatorUrl) {
|
|
|
261
264
|
});
|
|
262
265
|
}
|
|
263
266
|
}
|
|
264
|
-
exports.getDownloadUrl = getDownloadUrl;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PROMPT_GENERATE_SEED_DATA = exports.PROMPT_GENERATE_CONNECTOR = void 0;
|
|
4
|
+
exports.generateSchema = generateSchema;
|
|
5
|
+
exports.chatWithFirebase = chatWithFirebase;
|
|
6
|
+
exports.generateOperation = generateOperation;
|
|
7
|
+
exports.extractCodeBlock = extractCodeBlock;
|
|
4
8
|
const apiv2_1 = require("../apiv2");
|
|
5
9
|
const api_1 = require("../api");
|
|
6
10
|
const error_1 = require("../error");
|
|
@@ -20,7 +24,6 @@ async function generateSchema(prompt, project, chatHistory = []) {
|
|
|
20
24
|
});
|
|
21
25
|
return extractCodeBlock(res.body.output.messages[0].content);
|
|
22
26
|
}
|
|
23
|
-
exports.generateSchema = generateSchema;
|
|
24
27
|
async function chatWithFirebase(prompt, project, chatHistory = []) {
|
|
25
28
|
const res = await apiClient.post(`/v1beta/projects/${project}/locations/global/instances/default:completeTask`, {
|
|
26
29
|
input: { messages: [...chatHistory, { content: prompt, author: "USER" }] },
|
|
@@ -30,7 +33,6 @@ async function chatWithFirebase(prompt, project, chatHistory = []) {
|
|
|
30
33
|
});
|
|
31
34
|
return res.body;
|
|
32
35
|
}
|
|
33
|
-
exports.chatWithFirebase = chatWithFirebase;
|
|
34
36
|
async function generateOperation(prompt, service, project, chatHistory = []) {
|
|
35
37
|
const res = await apiClient.post(`/v1beta/projects/${project}/locations/global/instances/default:completeTask`, {
|
|
36
38
|
input: { messages: [...chatHistory, { content: prompt, author: "USER" }] },
|
|
@@ -46,7 +48,6 @@ async function generateOperation(prompt, service, project, chatHistory = []) {
|
|
|
46
48
|
});
|
|
47
49
|
return extractCodeBlock(res.body.output.messages[0].content);
|
|
48
50
|
}
|
|
49
|
-
exports.generateOperation = generateOperation;
|
|
50
51
|
function extractCodeBlock(text) {
|
|
51
52
|
const regex = /```(?:[a-z]+\n)?([\s\S]*?)```/m;
|
|
52
53
|
const match = text.match(regex);
|
|
@@ -55,4 +56,3 @@ function extractCodeBlock(text) {
|
|
|
55
56
|
}
|
|
56
57
|
throw new error_1.FirebaseError(`No code block found in the generated response: ${text}`);
|
|
57
58
|
}
|
|
58
|
-
exports.extractCodeBlock = extractCodeBlock;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDefaultDatabaseInstance =
|
|
3
|
+
exports.getDefaultDatabaseInstance = getDefaultDatabaseInstance;
|
|
4
4
|
const projects_1 = require("./management/projects");
|
|
5
5
|
async function getDefaultDatabaseInstance(project) {
|
|
6
|
-
var _a;
|
|
7
6
|
const projectDetails = await (0, projects_1.getFirebaseProject)(project);
|
|
8
|
-
return
|
|
7
|
+
return projectDetails.resources?.realtimeDatabaseInstance || "";
|
|
9
8
|
}
|
|
10
|
-
exports.getDefaultDatabaseInstance = getDefaultDatabaseInstance;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.errNoDefaultSite = void 0;
|
|
4
|
+
exports.getDefaultHostingSite = getDefaultHostingSite;
|
|
4
5
|
const error_1 = require("./error");
|
|
5
6
|
const api_1 = require("./hosting/api");
|
|
6
7
|
const logger_1 = require("./logger");
|
|
@@ -9,10 +10,9 @@ const projectUtils_1 = require("./projectUtils");
|
|
|
9
10
|
const utils_1 = require("./utils");
|
|
10
11
|
exports.errNoDefaultSite = new error_1.FirebaseError("Could not determine the default site for the project.");
|
|
11
12
|
async function getDefaultHostingSite(options) {
|
|
12
|
-
var _a;
|
|
13
13
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
14
14
|
const project = await (0, projects_1.getFirebaseProject)(projectId);
|
|
15
|
-
let site =
|
|
15
|
+
let site = project.resources?.hostingSite;
|
|
16
16
|
if (!site) {
|
|
17
17
|
logger_1.logger.debug(`the default site does not exist on the Firebase project; asking Hosting.`);
|
|
18
18
|
const sites = await (0, api_1.listSites)(projectId);
|
|
@@ -29,4 +29,3 @@ async function getDefaultHostingSite(options) {
|
|
|
29
29
|
}
|
|
30
30
|
return site;
|
|
31
31
|
}
|
|
32
|
-
exports.getDefaultHostingSite = getDefaultHostingSite;
|
package/lib/getProjectNumber.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getProjectNumber =
|
|
3
|
+
exports.getProjectNumber = getProjectNumber;
|
|
4
4
|
const projects_1 = require("./management/projects");
|
|
5
5
|
const projectUtils_1 = require("./projectUtils");
|
|
6
6
|
async function getProjectNumber(options) {
|
|
@@ -12,4 +12,3 @@ async function getProjectNumber(options) {
|
|
|
12
12
|
options.projectNumber = metadata.projectNumber;
|
|
13
13
|
return options.projectNumber;
|
|
14
14
|
}
|
|
15
|
-
exports.getProjectNumber = getProjectNumber;
|
package/lib/hosting/api.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SiteType = void 0;
|
|
4
|
+
exports.normalizeName = normalizeName;
|
|
5
|
+
exports.getChannel = getChannel;
|
|
6
|
+
exports.listChannels = listChannels;
|
|
7
|
+
exports.createChannel = createChannel;
|
|
8
|
+
exports.updateChannelTtl = updateChannelTtl;
|
|
9
|
+
exports.deleteChannel = deleteChannel;
|
|
10
|
+
exports.createVersion = createVersion;
|
|
11
|
+
exports.updateVersion = updateVersion;
|
|
12
|
+
exports.listVersions = listVersions;
|
|
13
|
+
exports.cloneVersion = cloneVersion;
|
|
14
|
+
exports.createRelease = createRelease;
|
|
15
|
+
exports.listSites = listSites;
|
|
16
|
+
exports.listDemoSites = listDemoSites;
|
|
17
|
+
exports.getSite = getSite;
|
|
18
|
+
exports.createSite = createSite;
|
|
19
|
+
exports.updateSite = updateSite;
|
|
20
|
+
exports.deleteSite = deleteSite;
|
|
21
|
+
exports.addAuthDomains = addAuthDomains;
|
|
22
|
+
exports.removeAuthDomain = removeAuthDomain;
|
|
23
|
+
exports.getCleanDomains = getCleanDomains;
|
|
24
|
+
exports.cleanAuthState = cleanAuthState;
|
|
25
|
+
exports.getSiteDomains = getSiteDomains;
|
|
26
|
+
exports.getAllSiteDomains = getAllSiteDomains;
|
|
27
|
+
exports.getDeploymentDomain = getDeploymentDomain;
|
|
4
28
|
const error_1 = require("../error");
|
|
5
29
|
const api_1 = require("../api");
|
|
6
30
|
const apiv2_1 = require("../apiv2");
|
|
@@ -23,11 +47,10 @@ var SiteType;
|
|
|
23
47
|
SiteType["TYPE_UNSPECIFIED"] = "TYPE_UNSPECIFIED";
|
|
24
48
|
SiteType["DEFAULT_SITE"] = "DEFAULT_SITE";
|
|
25
49
|
SiteType["USER_SITE"] = "USER_SITE";
|
|
26
|
-
})(SiteType
|
|
50
|
+
})(SiteType || (exports.SiteType = SiteType = {}));
|
|
27
51
|
function normalizeName(s) {
|
|
28
52
|
return s.replace(/[/:_#]/g, "-");
|
|
29
53
|
}
|
|
30
|
-
exports.normalizeName = normalizeName;
|
|
31
54
|
const apiClient = new apiv2_1.Client({
|
|
32
55
|
urlPrefix: (0, api_1.hostingApiOrigin)(),
|
|
33
56
|
apiVersion: "v1beta1",
|
|
@@ -45,15 +68,13 @@ async function getChannel(project = "-", site, channelId) {
|
|
|
45
68
|
throw e;
|
|
46
69
|
}
|
|
47
70
|
}
|
|
48
|
-
exports.getChannel = getChannel;
|
|
49
71
|
async function listChannels(project = "-", site) {
|
|
50
|
-
var _a;
|
|
51
72
|
const channels = [];
|
|
52
73
|
let nextPageToken = "";
|
|
53
74
|
for (;;) {
|
|
54
75
|
try {
|
|
55
76
|
const res = await apiClient.get(`/projects/${project}/sites/${site}/channels`, { queryParams: { pageToken: nextPageToken, pageSize: 10 } });
|
|
56
|
-
channels.push(...(
|
|
77
|
+
channels.push(...(res.body.channels ?? []));
|
|
57
78
|
nextPageToken = res.body.nextPageToken || "";
|
|
58
79
|
if (!nextPageToken) {
|
|
59
80
|
return channels;
|
|
@@ -69,26 +90,21 @@ async function listChannels(project = "-", site) {
|
|
|
69
90
|
}
|
|
70
91
|
}
|
|
71
92
|
}
|
|
72
|
-
exports.listChannels = listChannels;
|
|
73
93
|
async function createChannel(project = "-", site, channelId, ttlMillis = expireUtils_1.DEFAULT_DURATION) {
|
|
74
94
|
const res = await apiClient.post(`/projects/${project}/sites/${site}/channels?channelId=${channelId}`, { ttl: `${ttlMillis / 1000}s` });
|
|
75
95
|
return res.body;
|
|
76
96
|
}
|
|
77
|
-
exports.createChannel = createChannel;
|
|
78
97
|
async function updateChannelTtl(project = "-", site, channelId, ttlMillis = ONE_WEEK_MS) {
|
|
79
98
|
const res = await apiClient.patch(`/projects/${project}/sites/${site}/channels/${channelId}`, { ttl: `${ttlMillis / 1000}s` }, { queryParams: { updateMask: "ttl" } });
|
|
80
99
|
return res.body;
|
|
81
100
|
}
|
|
82
|
-
exports.updateChannelTtl = updateChannelTtl;
|
|
83
101
|
async function deleteChannel(project = "-", site, channelId) {
|
|
84
102
|
await apiClient.delete(`/projects/${project}/sites/${site}/channels/${channelId}`);
|
|
85
103
|
}
|
|
86
|
-
exports.deleteChannel = deleteChannel;
|
|
87
104
|
async function createVersion(siteId, version) {
|
|
88
105
|
const res = await apiClient.post(`projects/-/sites/${siteId}/versions`, version);
|
|
89
106
|
return res.body.name;
|
|
90
107
|
}
|
|
91
|
-
exports.createVersion = createVersion;
|
|
92
108
|
async function updateVersion(site, versionId, version) {
|
|
93
109
|
const res = await apiClient.patch(`projects/-/sites/${site}/versions/${versionId}`, version, {
|
|
94
110
|
queryParams: {
|
|
@@ -97,9 +113,7 @@ async function updateVersion(site, versionId, version) {
|
|
|
97
113
|
});
|
|
98
114
|
return res.body;
|
|
99
115
|
}
|
|
100
|
-
exports.updateVersion = updateVersion;
|
|
101
116
|
async function listVersions(site) {
|
|
102
|
-
var _a;
|
|
103
117
|
let pageToken = undefined;
|
|
104
118
|
const versions = [];
|
|
105
119
|
do {
|
|
@@ -110,12 +124,11 @@ async function listVersions(site) {
|
|
|
110
124
|
const res = await apiClient.get(`projects/-/sites/${site}/versions`, {
|
|
111
125
|
queryParams,
|
|
112
126
|
});
|
|
113
|
-
versions.push(...(
|
|
127
|
+
versions.push(...(res.body.versions ?? []));
|
|
114
128
|
pageToken = res.body.nextPageToken;
|
|
115
129
|
} while (pageToken);
|
|
116
130
|
return versions;
|
|
117
131
|
}
|
|
118
|
-
exports.listVersions = listVersions;
|
|
119
132
|
async function cloneVersion(site, versionName, finalize = false) {
|
|
120
133
|
const res = await apiClient.post(`/projects/-/sites/${site}/versions:clone`, {
|
|
121
134
|
sourceVersion: versionName,
|
|
@@ -130,20 +143,17 @@ async function cloneVersion(site, versionName, finalize = false) {
|
|
|
130
143
|
});
|
|
131
144
|
return pollRes;
|
|
132
145
|
}
|
|
133
|
-
exports.cloneVersion = cloneVersion;
|
|
134
146
|
async function createRelease(site, channel, version, partialRelease) {
|
|
135
147
|
const res = await apiClient.post(`/projects/-/sites/${site}/channels/${channel}/releases`, partialRelease, { queryParams: { versionName: version } });
|
|
136
148
|
return res.body;
|
|
137
149
|
}
|
|
138
|
-
exports.createRelease = createRelease;
|
|
139
150
|
async function listSites(project) {
|
|
140
|
-
var _a;
|
|
141
151
|
const sites = [];
|
|
142
152
|
let nextPageToken = "";
|
|
143
153
|
for (;;) {
|
|
144
154
|
try {
|
|
145
155
|
const res = await apiClient.get(`/projects/${project}/sites`, { queryParams: { pageToken: nextPageToken, pageSize: 10 } });
|
|
146
|
-
sites.push(...(
|
|
156
|
+
sites.push(...(res.body.sites ?? []));
|
|
147
157
|
nextPageToken = res.body.nextPageToken || "";
|
|
148
158
|
if (!nextPageToken) {
|
|
149
159
|
return sites;
|
|
@@ -159,7 +169,6 @@ async function listSites(project) {
|
|
|
159
169
|
}
|
|
160
170
|
}
|
|
161
171
|
}
|
|
162
|
-
exports.listSites = listSites;
|
|
163
172
|
function listDemoSites(projectId) {
|
|
164
173
|
return [
|
|
165
174
|
{
|
|
@@ -170,7 +179,6 @@ function listDemoSites(projectId) {
|
|
|
170
179
|
},
|
|
171
180
|
];
|
|
172
181
|
}
|
|
173
|
-
exports.listDemoSites = listDemoSites;
|
|
174
182
|
async function getSite(project, site) {
|
|
175
183
|
try {
|
|
176
184
|
const res = await apiClient.get(`/projects/${project}/sites/${site}`);
|
|
@@ -186,7 +194,6 @@ async function getSite(project, site) {
|
|
|
186
194
|
throw e;
|
|
187
195
|
}
|
|
188
196
|
}
|
|
189
|
-
exports.getSite = getSite;
|
|
190
197
|
async function createSite(project, site, appId = "", validateOnly = false) {
|
|
191
198
|
const queryParams = { siteId: site };
|
|
192
199
|
if (validateOnly) {
|
|
@@ -195,18 +202,15 @@ async function createSite(project, site, appId = "", validateOnly = false) {
|
|
|
195
202
|
const res = await apiClient.post(`/projects/${project}/sites`, { appId: appId }, { queryParams });
|
|
196
203
|
return res.body;
|
|
197
204
|
}
|
|
198
|
-
exports.createSite = createSite;
|
|
199
205
|
async function updateSite(project, site, fields) {
|
|
200
206
|
const res = await apiClient.patch(`/projects/${project}/sites/${site.name}`, site, {
|
|
201
207
|
queryParams: { updateMask: fields.join(",") },
|
|
202
208
|
});
|
|
203
209
|
return res.body;
|
|
204
210
|
}
|
|
205
|
-
exports.updateSite = updateSite;
|
|
206
211
|
async function deleteSite(project, site) {
|
|
207
212
|
await apiClient.delete(`/projects/${project}/sites/${site}`);
|
|
208
213
|
}
|
|
209
|
-
exports.deleteSite = deleteSite;
|
|
210
214
|
async function addAuthDomains(project, urls) {
|
|
211
215
|
const domains = await (0, auth_1.getAuthDomains)(project);
|
|
212
216
|
const authDomains = domains || [];
|
|
@@ -219,7 +223,6 @@ async function addAuthDomains(project, urls) {
|
|
|
219
223
|
}
|
|
220
224
|
return await (0, auth_1.updateAuthDomains)(project, authDomains);
|
|
221
225
|
}
|
|
222
|
-
exports.addAuthDomains = addAuthDomains;
|
|
223
226
|
async function removeAuthDomain(project, url) {
|
|
224
227
|
const domains = await (0, auth_1.getAuthDomains)(project);
|
|
225
228
|
if (!domains.length) {
|
|
@@ -229,7 +232,6 @@ async function removeAuthDomain(project, url) {
|
|
|
229
232
|
const authDomains = domains.filter((domain) => domain !== targetDomain);
|
|
230
233
|
return (0, auth_1.updateAuthDomains)(project, authDomains);
|
|
231
234
|
}
|
|
232
|
-
exports.removeAuthDomain = removeAuthDomain;
|
|
233
235
|
async function getCleanDomains(project, site) {
|
|
234
236
|
const channels = await listChannels(project, site);
|
|
235
237
|
const channelMap = channels
|
|
@@ -256,7 +258,6 @@ async function getCleanDomains(project, site) {
|
|
|
256
258
|
});
|
|
257
259
|
return authDomains;
|
|
258
260
|
}
|
|
259
|
-
exports.getCleanDomains = getCleanDomains;
|
|
260
261
|
async function cleanAuthState(project, sites) {
|
|
261
262
|
const siteDomainMap = new Map();
|
|
262
263
|
for (const site of sites) {
|
|
@@ -266,12 +267,10 @@ async function cleanAuthState(project, sites) {
|
|
|
266
267
|
}
|
|
267
268
|
return siteDomainMap;
|
|
268
269
|
}
|
|
269
|
-
exports.cleanAuthState = cleanAuthState;
|
|
270
270
|
async function getSiteDomains(project, site) {
|
|
271
|
-
var _a;
|
|
272
271
|
try {
|
|
273
272
|
const res = await apiClient.get(`/projects/${project}/sites/${site}/domains`);
|
|
274
|
-
return
|
|
273
|
+
return res.body.domains ?? [];
|
|
275
274
|
}
|
|
276
275
|
catch (e) {
|
|
277
276
|
if (e instanceof error_1.FirebaseError && e.status === 404) {
|
|
@@ -282,7 +281,6 @@ async function getSiteDomains(project, site) {
|
|
|
282
281
|
throw e;
|
|
283
282
|
}
|
|
284
283
|
}
|
|
285
|
-
exports.getSiteDomains = getSiteDomains;
|
|
286
284
|
async function getAllSiteDomains(projectId, siteId) {
|
|
287
285
|
const [hostingDomains, defaultDomain] = await Promise.all([
|
|
288
286
|
getSiteDomains(projectId, siteId),
|
|
@@ -297,14 +295,13 @@ async function getAllSiteDomains(projectId, siteId) {
|
|
|
297
295
|
]);
|
|
298
296
|
return Array.from(allSiteDomains);
|
|
299
297
|
}
|
|
300
|
-
exports.getAllSiteDomains = getAllSiteDomains;
|
|
301
298
|
async function getDeploymentDomain(projectId, siteId, hostingChannel) {
|
|
302
299
|
if (constants_1.Constants.isDemoProject(projectId)) {
|
|
303
300
|
return null;
|
|
304
301
|
}
|
|
305
302
|
if (hostingChannel) {
|
|
306
303
|
const channel = await getChannel(projectId, siteId, hostingChannel);
|
|
307
|
-
return channel && (0, utils_1.getHostnameFromUrl)(channel
|
|
304
|
+
return channel && (0, utils_1.getHostnameFromUrl)(channel?.url);
|
|
308
305
|
}
|
|
309
306
|
const site = await getSite(projectId, siteId).catch((e) => {
|
|
310
307
|
if (e instanceof error_1.FirebaseError &&
|
|
@@ -314,6 +311,5 @@ async function getDeploymentDomain(projectId, siteId, hostingChannel) {
|
|
|
314
311
|
}
|
|
315
312
|
throw e;
|
|
316
313
|
});
|
|
317
|
-
return site && (0, utils_1.getHostnameFromUrl)(site
|
|
314
|
+
return site && (0, utils_1.getHostnameFromUrl)(site?.defaultUrl);
|
|
318
315
|
}
|
|
319
|
-
exports.getDeploymentDomain = getDeploymentDomain;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
3
4
|
const apiv2_1 = require("../apiv2");
|
|
4
5
|
const api_1 = require("../api");
|
|
5
6
|
const proxy_1 = require("./proxy");
|
|
@@ -9,7 +10,6 @@ const projectUtils_1 = require("../projectUtils");
|
|
|
9
10
|
const cloudRunCache = {};
|
|
10
11
|
const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudRunApiOrigin)(), apiVersion: "v1" });
|
|
11
12
|
async function getCloudRunUrl(rewrite, projectId) {
|
|
12
|
-
var _a;
|
|
13
13
|
const alreadyFetched = cloudRunCache[`${rewrite.run.region}/${rewrite.run.serviceId}`];
|
|
14
14
|
if (alreadyFetched) {
|
|
15
15
|
return Promise.resolve(alreadyFetched);
|
|
@@ -18,7 +18,7 @@ async function getCloudRunUrl(rewrite, projectId) {
|
|
|
18
18
|
try {
|
|
19
19
|
logger_1.logger.info(`[hosting] Looking up Cloud Run service "${path}" for its URL`);
|
|
20
20
|
const res = await apiClient.get(path);
|
|
21
|
-
const url =
|
|
21
|
+
const url = res.body.status?.url;
|
|
22
22
|
if (!url) {
|
|
23
23
|
throw new error_1.FirebaseError("Cloud Run URL doesn't exist in response.");
|
|
24
24
|
}
|
|
@@ -49,4 +49,3 @@ function default_1(options) {
|
|
|
49
49
|
.catch(proxy_1.errorRequestHandler);
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
exports.default = default_1;
|
package/lib/hosting/config.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.filterOnly = filterOnly;
|
|
4
|
+
exports.filterExcept = filterExcept;
|
|
5
|
+
exports.extract = extract;
|
|
6
|
+
exports.validate = validate;
|
|
7
|
+
exports.resolveTargets = resolveTargets;
|
|
8
|
+
exports.normalize = normalize;
|
|
9
|
+
exports.hostingConfig = hostingConfig;
|
|
4
10
|
const colorette_1 = require("colorette");
|
|
5
11
|
const utils_1 = require("../utils");
|
|
6
12
|
const error_1 = require("../error");
|
|
@@ -40,7 +46,6 @@ function filterOnly(configs, onlyString) {
|
|
|
40
46
|
.map((target) => target.replace("hosting:", ""));
|
|
41
47
|
return matchingConfigs(configs, onlyTargets, true);
|
|
42
48
|
}
|
|
43
|
-
exports.filterOnly = filterOnly;
|
|
44
49
|
function filterExcept(configs, exceptOption) {
|
|
45
50
|
if (!exceptOption) {
|
|
46
51
|
return configs;
|
|
@@ -55,7 +60,6 @@ function filterExcept(configs, exceptOption) {
|
|
|
55
60
|
const toReject = matchingConfigs(configs, exceptValues, false);
|
|
56
61
|
return configs.filter((c) => !toReject.find((r) => c.site === r.site && c.target === r.target));
|
|
57
62
|
}
|
|
58
|
-
exports.filterExcept = filterExcept;
|
|
59
63
|
function extract(options) {
|
|
60
64
|
const config = options.config.src;
|
|
61
65
|
if (!config.hosting) {
|
|
@@ -79,18 +83,15 @@ function extract(options) {
|
|
|
79
83
|
return (0, utils_1.cloneDeep)(config.hosting);
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
|
-
exports.extract = extract;
|
|
83
86
|
function validate(configs, options) {
|
|
84
87
|
for (const config of configs) {
|
|
85
88
|
validateOne(config, options);
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
|
-
exports.validate = validate;
|
|
89
91
|
function validateOne(config, options) {
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
const
|
|
93
|
-
const hasAnyRedirects = !!((_c = config.redirects) === null || _c === void 0 ? void 0 : _c.length);
|
|
92
|
+
const hasAnyStaticRewrites = !!config.rewrites?.find((rw) => "destination" in rw);
|
|
93
|
+
const hasAnyDynamicRewrites = !!config.rewrites?.find((rw) => !("destination" in rw));
|
|
94
|
+
const hasAnyRedirects = !!config.redirects?.length;
|
|
94
95
|
if (config.source && config.public) {
|
|
95
96
|
throw new error_1.FirebaseError('Can only specify "source" or "public" in a Hosting config, not both');
|
|
96
97
|
}
|
|
@@ -105,7 +106,7 @@ function validateOne(config, options) {
|
|
|
105
106
|
logger_1.logger.debug(`Specified "${config.source ? "source" : "public"}" directory "${root}" does not exist; Deploy to Hosting site "${config.site || config.target || ""}" may fail or be empty.`);
|
|
106
107
|
}
|
|
107
108
|
const regionWithoutFunction = (rewrite) => typeof rewrite.region === "string" && typeof rewrite.function !== "string";
|
|
108
|
-
const violation =
|
|
109
|
+
const violation = config.rewrites?.find(regionWithoutFunction);
|
|
109
110
|
if (violation) {
|
|
110
111
|
throw new error_1.FirebaseError("Rewrites only support 'region' as a top-level field when 'function' is set as a string");
|
|
111
112
|
}
|
|
@@ -145,21 +146,22 @@ function resolveTargets(configs, options) {
|
|
|
145
146
|
return newConfig;
|
|
146
147
|
});
|
|
147
148
|
}
|
|
148
|
-
exports.resolveTargets = resolveTargets;
|
|
149
149
|
function isLegacyFunctionsRewrite(rewrite) {
|
|
150
150
|
return "function" in rewrite && typeof rewrite.function === "string";
|
|
151
151
|
}
|
|
152
152
|
function normalize(configs) {
|
|
153
|
-
var _a;
|
|
154
153
|
for (const config of configs) {
|
|
155
|
-
config.rewrites =
|
|
154
|
+
config.rewrites = config.rewrites?.map((rewrite) => {
|
|
156
155
|
if (!("function" in rewrite)) {
|
|
157
156
|
return rewrite;
|
|
158
157
|
}
|
|
159
158
|
if (isLegacyFunctionsRewrite(rewrite)) {
|
|
160
|
-
const modern =
|
|
159
|
+
const modern = {
|
|
160
|
+
...rewrite,
|
|
161
|
+
function: {
|
|
161
162
|
functionId: rewrite.function,
|
|
162
|
-
}
|
|
163
|
+
},
|
|
164
|
+
};
|
|
163
165
|
delete modern.region;
|
|
164
166
|
if ("region" in rewrite && typeof rewrite.region === "string") {
|
|
165
167
|
modern.function.region = rewrite.region;
|
|
@@ -173,7 +175,6 @@ function normalize(configs) {
|
|
|
173
175
|
});
|
|
174
176
|
}
|
|
175
177
|
}
|
|
176
|
-
exports.normalize = normalize;
|
|
177
178
|
function hostingConfig(options) {
|
|
178
179
|
if (!options.normalizedHostingConfig) {
|
|
179
180
|
let configs = extract(options);
|
|
@@ -186,4 +187,3 @@ function hostingConfig(options) {
|
|
|
186
187
|
}
|
|
187
188
|
return options.normalizedHostingConfig;
|
|
188
189
|
}
|
|
189
|
-
exports.hostingConfig = hostingConfig;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_DURATION = exports.MAX_DURATION = exports.Duration = exports.DURATION_REGEX = void 0;
|
|
4
|
+
exports.calculateChannelExpireTTL = calculateChannelExpireTTL;
|
|
4
5
|
const error_1 = require("../error");
|
|
5
6
|
exports.DURATION_REGEX = /^(\d+)([hdm])$/;
|
|
6
7
|
var Duration;
|
|
@@ -8,7 +9,7 @@ var Duration;
|
|
|
8
9
|
Duration[Duration["MINUTE"] = 60000] = "MINUTE";
|
|
9
10
|
Duration[Duration["HOUR"] = 3600000] = "HOUR";
|
|
10
11
|
Duration[Duration["DAY"] = 86400000] = "DAY";
|
|
11
|
-
})(Duration
|
|
12
|
+
})(Duration || (exports.Duration = Duration = {}));
|
|
12
13
|
const DURATIONS = {
|
|
13
14
|
m: Duration.MINUTE,
|
|
14
15
|
h: Duration.HOUR,
|
|
@@ -30,4 +31,3 @@ function calculateChannelExpireTTL(flag) {
|
|
|
30
31
|
}
|
|
31
32
|
return d;
|
|
32
33
|
}
|
|
33
|
-
exports.calculateChannelExpireTTL = calculateChannelExpireTTL;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.functionsProxy =
|
|
3
|
+
exports.functionsProxy = functionsProxy;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
const proxy_1 = require("./proxy");
|
|
6
6
|
const projectUtils_1 = require("../projectUtils");
|
|
@@ -39,4 +39,3 @@ function functionsProxy(options) {
|
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
exports.functionsProxy = functionsProxy;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.implicitInit =
|
|
3
|
+
exports.implicitInit = implicitInit;
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const clc = require("colorette");
|
|
6
6
|
const fetchWebSetup_1 = require("../fetchWebSetup");
|
|
@@ -59,4 +59,3 @@ async function implicitInit(options) {
|
|
|
59
59
|
json: configJson,
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
exports.implicitInit = implicitInit;
|