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
|
@@ -25,6 +25,7 @@ const run = require("../../../gcp/run");
|
|
|
25
25
|
const scheduler = require("../../../gcp/cloudscheduler");
|
|
26
26
|
const utils = require("../../../utils");
|
|
27
27
|
const services = require("../services");
|
|
28
|
+
const dataconnect_1 = require("../services/dataconnect");
|
|
28
29
|
const v1_1 = require("../../../functions/events/v1");
|
|
29
30
|
const gce = require("../../../gcp/computeEngine");
|
|
30
31
|
const functionsDeployHelper_1 = require("../functionsDeployHelper");
|
|
@@ -129,7 +130,7 @@ class Fabricator {
|
|
|
129
130
|
return deployResults;
|
|
130
131
|
}
|
|
131
132
|
async createEndpoint(endpoint, scraperV1, scraperV2) {
|
|
132
|
-
endpoint.labels =
|
|
133
|
+
endpoint.labels = { ...endpoint.labels, ...deploymentTool.labels() };
|
|
133
134
|
if (endpoint.platform === "gcfv1") {
|
|
134
135
|
await this.createV1Function(endpoint, scraperV1);
|
|
135
136
|
}
|
|
@@ -147,7 +148,7 @@ class Fabricator {
|
|
|
147
148
|
await this.setTrigger(endpoint);
|
|
148
149
|
}
|
|
149
150
|
async updateEndpoint(update, scraperV1, scraperV2) {
|
|
150
|
-
update.endpoint.labels =
|
|
151
|
+
update.endpoint.labels = { ...update.endpoint.labels, ...deploymentTool.labels() };
|
|
151
152
|
if (update.deleteAndRecreate) {
|
|
152
153
|
await this.deleteEndpoint(update.deleteAndRecreate);
|
|
153
154
|
await this.createEndpoint(update.endpoint, scraperV1, scraperV2);
|
|
@@ -181,8 +182,7 @@ class Fabricator {
|
|
|
181
182
|
(0, functional_1.assertExhaustive)(endpoint.platform);
|
|
182
183
|
}
|
|
183
184
|
async createV1Function(endpoint, scraper) {
|
|
184
|
-
|
|
185
|
-
const sourceUrl = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.sourceUrl;
|
|
185
|
+
const sourceUrl = this.sources[endpoint.codebase]?.sourceUrl;
|
|
186
186
|
if (!sourceUrl) {
|
|
187
187
|
logger_1.logger.debug("Precondition failed. Cannot create a GCF function without sourceUrl");
|
|
188
188
|
throw new Error("Precondition failed");
|
|
@@ -195,10 +195,15 @@ class Fabricator {
|
|
|
195
195
|
.run(async () => {
|
|
196
196
|
apiFunction.sourceToken = await scraper.getToken();
|
|
197
197
|
const op = await gcf.createFunction(apiFunction);
|
|
198
|
-
return poller.pollOperation(
|
|
198
|
+
return poller.pollOperation({
|
|
199
|
+
...gcfV1PollerOptions,
|
|
200
|
+
pollerName: `create-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`,
|
|
201
|
+
operationResourceName: op.name,
|
|
202
|
+
onPoll: scraper.poller,
|
|
203
|
+
});
|
|
199
204
|
})
|
|
200
205
|
.catch(rethrowAs(endpoint, "create"));
|
|
201
|
-
endpoint.uri =
|
|
206
|
+
endpoint.uri = resultFunction?.httpsTrigger?.url;
|
|
202
207
|
if (backend.isHttpsTriggered(endpoint)) {
|
|
203
208
|
const invoker = endpoint.httpsTrigger.invoker || ["public"];
|
|
204
209
|
if (!invoker.includes("private")) {
|
|
@@ -236,14 +241,13 @@ class Fabricator {
|
|
|
236
241
|
}
|
|
237
242
|
}
|
|
238
243
|
async createV2Function(endpoint, scraper) {
|
|
239
|
-
|
|
240
|
-
const storageSource = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.storage;
|
|
244
|
+
const storageSource = this.sources[endpoint.codebase]?.storage;
|
|
241
245
|
if (!storageSource) {
|
|
242
246
|
logger_1.logger.debug("Precondition failed. Cannot create a GCFv2 function without storage");
|
|
243
247
|
throw new Error("Precondition failed");
|
|
244
248
|
}
|
|
245
|
-
const apiFunction = gcfV2.functionFromEndpoint(
|
|
246
|
-
const topic =
|
|
249
|
+
const apiFunction = gcfV2.functionFromEndpoint({ ...endpoint, source: { storageSource } });
|
|
250
|
+
const topic = apiFunction.eventTrigger?.pubsubTopic;
|
|
247
251
|
if (topic) {
|
|
248
252
|
await this.executor
|
|
249
253
|
.run(async () => {
|
|
@@ -262,7 +266,7 @@ class Fabricator {
|
|
|
262
266
|
})
|
|
263
267
|
.catch(rethrowAs(endpoint, "create topic"));
|
|
264
268
|
}
|
|
265
|
-
const channel =
|
|
269
|
+
const channel = apiFunction.eventTrigger?.channel;
|
|
266
270
|
if (channel) {
|
|
267
271
|
await this.executor
|
|
268
272
|
.run(async () => {
|
|
@@ -271,7 +275,11 @@ class Fabricator {
|
|
|
271
275
|
return;
|
|
272
276
|
}
|
|
273
277
|
const op = await eventarc.createChannel({ name: channel });
|
|
274
|
-
return await poller.pollOperation(
|
|
278
|
+
return await poller.pollOperation({
|
|
279
|
+
...eventarcPollerOptions,
|
|
280
|
+
pollerName: `create-${channel}-${endpoint.region}-${endpoint.id}`,
|
|
281
|
+
operationResourceName: op.name,
|
|
282
|
+
});
|
|
275
283
|
}
|
|
276
284
|
catch (err) {
|
|
277
285
|
if (err.status === 409) {
|
|
@@ -293,7 +301,12 @@ class Fabricator {
|
|
|
293
301
|
apiFunction.buildConfig.sourceToken = await scraper.getToken();
|
|
294
302
|
}
|
|
295
303
|
const op = await gcfV2.createFunction(apiFunction);
|
|
296
|
-
return await poller.pollOperation(
|
|
304
|
+
return await poller.pollOperation({
|
|
305
|
+
...gcfV2PollerOptions,
|
|
306
|
+
pollerName: `create-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`,
|
|
307
|
+
operationResourceName: op.name,
|
|
308
|
+
onPoll: scraper.poller,
|
|
309
|
+
});
|
|
297
310
|
})
|
|
298
311
|
.catch(async (err) => {
|
|
299
312
|
scraper.abort();
|
|
@@ -308,8 +321,8 @@ class Fabricator {
|
|
|
308
321
|
});
|
|
309
322
|
}
|
|
310
323
|
endpoint.uri = resultFunction.url;
|
|
311
|
-
const serviceName =
|
|
312
|
-
endpoint.runServiceId = utils.last(serviceName
|
|
324
|
+
const serviceName = resultFunction.serviceConfig?.service;
|
|
325
|
+
endpoint.runServiceId = utils.last(serviceName?.split("/"));
|
|
313
326
|
if (!serviceName) {
|
|
314
327
|
logger_1.logger.debug("Result function unexpectedly didn't have a service name.");
|
|
315
328
|
utils.logLabeledWarning("functions", "Updated function is not associated with a service. This deployment is in an unexpected state - please re-deploy your functions.");
|
|
@@ -323,6 +336,15 @@ class Fabricator {
|
|
|
323
336
|
.catch(rethrowAs(endpoint, "set invoker"));
|
|
324
337
|
}
|
|
325
338
|
}
|
|
339
|
+
else if (backend.isDataConnectGraphqlTriggered(endpoint)) {
|
|
340
|
+
const invoker = endpoint.dataConnectGraphqlTrigger.invoker ?? [];
|
|
341
|
+
invoker.push((0, dataconnect_1.getDataConnectP4SA)(this.projectNumber));
|
|
342
|
+
if (!invoker.includes("private")) {
|
|
343
|
+
await this.executor
|
|
344
|
+
.run(() => run.setInvokerCreate(endpoint.project, serviceName, invoker))
|
|
345
|
+
.catch(rethrowAs(endpoint, "set invoker"));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
326
348
|
else if (backend.isCallableTriggered(endpoint)) {
|
|
327
349
|
await this.executor
|
|
328
350
|
.run(() => run.setInvokerCreate(endpoint.project, serviceName, ["public"]))
|
|
@@ -354,8 +376,7 @@ class Fabricator {
|
|
|
354
376
|
}
|
|
355
377
|
}
|
|
356
378
|
async updateV1Function(endpoint, scraper) {
|
|
357
|
-
|
|
358
|
-
const sourceUrl = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.sourceUrl;
|
|
379
|
+
const sourceUrl = this.sources[endpoint.codebase]?.sourceUrl;
|
|
359
380
|
if (!sourceUrl) {
|
|
360
381
|
logger_1.logger.debug("Precondition failed. Cannot update a GCF function without sourceUrl");
|
|
361
382
|
throw new Error("Precondition failed");
|
|
@@ -365,10 +386,15 @@ class Fabricator {
|
|
|
365
386
|
.run(async () => {
|
|
366
387
|
apiFunction.sourceToken = await scraper.getToken();
|
|
367
388
|
const op = await gcf.updateFunction(apiFunction);
|
|
368
|
-
return await poller.pollOperation(
|
|
389
|
+
return await poller.pollOperation({
|
|
390
|
+
...gcfV1PollerOptions,
|
|
391
|
+
pollerName: `update-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`,
|
|
392
|
+
operationResourceName: op.name,
|
|
393
|
+
onPoll: scraper.poller,
|
|
394
|
+
});
|
|
369
395
|
})
|
|
370
396
|
.catch(rethrowAs(endpoint, "update"));
|
|
371
|
-
endpoint.uri =
|
|
397
|
+
endpoint.uri = resultFunction?.httpsTrigger?.url;
|
|
372
398
|
let invoker;
|
|
373
399
|
if (backend.isHttpsTriggered(endpoint)) {
|
|
374
400
|
invoker = endpoint.httpsTrigger.invoker === null ? ["public"] : endpoint.httpsTrigger.invoker;
|
|
@@ -387,14 +413,13 @@ class Fabricator {
|
|
|
387
413
|
}
|
|
388
414
|
}
|
|
389
415
|
async updateV2Function(endpoint, scraper) {
|
|
390
|
-
|
|
391
|
-
const storageSource = (_a = this.sources[endpoint.codebase]) === null || _a === void 0 ? void 0 : _a.storage;
|
|
416
|
+
const storageSource = this.sources[endpoint.codebase]?.storage;
|
|
392
417
|
if (!storageSource) {
|
|
393
418
|
logger_1.logger.debug("Precondition failed. Cannot update a GCFv2 function without storage");
|
|
394
419
|
throw new Error("Precondition failed");
|
|
395
420
|
}
|
|
396
|
-
const apiFunction = gcfV2.functionFromEndpoint(
|
|
397
|
-
if (
|
|
421
|
+
const apiFunction = gcfV2.functionFromEndpoint({ ...endpoint, source: { storageSource } });
|
|
422
|
+
if (apiFunction.eventTrigger?.pubsubTopic) {
|
|
398
423
|
delete apiFunction.eventTrigger.pubsubTopic;
|
|
399
424
|
}
|
|
400
425
|
const resultFunction = await this.functionExecutor
|
|
@@ -403,16 +428,21 @@ class Fabricator {
|
|
|
403
428
|
apiFunction.buildConfig.sourceToken = await scraper.getToken();
|
|
404
429
|
}
|
|
405
430
|
const op = await gcfV2.updateFunction(apiFunction);
|
|
406
|
-
return await poller.pollOperation(
|
|
431
|
+
return await poller.pollOperation({
|
|
432
|
+
...gcfV2PollerOptions,
|
|
433
|
+
pollerName: `update-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`,
|
|
434
|
+
operationResourceName: op.name,
|
|
435
|
+
onPoll: scraper.poller,
|
|
436
|
+
});
|
|
407
437
|
}, { retryCodes: [...executor_1.DEFAULT_RETRY_CODES, CLOUD_RUN_RESOURCE_EXHAUSTED_CODE] })
|
|
408
438
|
.catch((err) => {
|
|
409
439
|
scraper.abort();
|
|
410
440
|
logger_1.logger.error(err.message);
|
|
411
441
|
throw new reporter.DeploymentError(endpoint, "update", err);
|
|
412
442
|
});
|
|
413
|
-
endpoint.uri =
|
|
414
|
-
const serviceName =
|
|
415
|
-
endpoint.runServiceId = utils.last(serviceName
|
|
443
|
+
endpoint.uri = resultFunction.serviceConfig?.uri;
|
|
444
|
+
const serviceName = resultFunction.serviceConfig?.service;
|
|
445
|
+
endpoint.runServiceId = utils.last(serviceName?.split("/"));
|
|
416
446
|
if (!serviceName) {
|
|
417
447
|
logger_1.logger.debug("Result function unexpectedly didn't have a service name.");
|
|
418
448
|
utils.logLabeledWarning("functions", "Updated function is not associated with a service. This deployment is in an unexpected state - please re-deploy your functions.");
|
|
@@ -422,6 +452,15 @@ class Fabricator {
|
|
|
422
452
|
if (backend.isHttpsTriggered(endpoint)) {
|
|
423
453
|
invoker = endpoint.httpsTrigger.invoker === null ? ["public"] : endpoint.httpsTrigger.invoker;
|
|
424
454
|
}
|
|
455
|
+
else if (backend.isDataConnectGraphqlTriggered(endpoint)) {
|
|
456
|
+
invoker =
|
|
457
|
+
endpoint.dataConnectGraphqlTrigger.invoker === null
|
|
458
|
+
? []
|
|
459
|
+
: endpoint.dataConnectGraphqlTrigger.invoker;
|
|
460
|
+
if (invoker) {
|
|
461
|
+
invoker.push((0, dataconnect_1.getDataConnectP4SA)(this.projectNumber));
|
|
462
|
+
}
|
|
463
|
+
}
|
|
425
464
|
else if (backend.isTaskQueueTriggered(endpoint)) {
|
|
426
465
|
invoker = endpoint.taskQueueTrigger.invoker === null ? [] : endpoint.taskQueueTrigger.invoker;
|
|
427
466
|
}
|
|
@@ -445,7 +484,11 @@ class Fabricator {
|
|
|
445
484
|
await this.functionExecutor
|
|
446
485
|
.run(async () => {
|
|
447
486
|
const op = await gcf.deleteFunction(fnName);
|
|
448
|
-
const pollerOptions =
|
|
487
|
+
const pollerOptions = {
|
|
488
|
+
...gcfV1PollerOptions,
|
|
489
|
+
pollerName: `delete-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`,
|
|
490
|
+
operationResourceName: op.name,
|
|
491
|
+
};
|
|
449
492
|
await poller.pollOperation(pollerOptions);
|
|
450
493
|
})
|
|
451
494
|
.catch(rethrowAs(endpoint, "delete"));
|
|
@@ -455,7 +498,11 @@ class Fabricator {
|
|
|
455
498
|
await this.functionExecutor
|
|
456
499
|
.run(async () => {
|
|
457
500
|
const op = await gcfV2.deleteFunction(fnName);
|
|
458
|
-
const pollerOptions =
|
|
501
|
+
const pollerOptions = {
|
|
502
|
+
...gcfV2PollerOptions,
|
|
503
|
+
pollerName: `delete-${endpoint.codebase}-${endpoint.region}-${endpoint.id}`,
|
|
504
|
+
operationResourceName: op.name,
|
|
505
|
+
};
|
|
459
506
|
await poller.pollOperation(pollerOptions);
|
|
460
507
|
}, { retryCodes: [...executor_1.DEFAULT_RETRY_CODES, CLOUD_RUN_RESOURCE_EXHAUSTED_CODE] })
|
|
461
508
|
.catch(rethrowAs(endpoint, "delete"));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.release = release;
|
|
4
|
+
exports.printTriggerUrls = printTriggerUrls;
|
|
4
5
|
const clc = require("colorette");
|
|
5
6
|
const logger_1 = require("../../../logger");
|
|
6
7
|
const functional_1 = require("../../../functional");
|
|
@@ -32,12 +33,15 @@ async function release(context, options, payload) {
|
|
|
32
33
|
}
|
|
33
34
|
let plan = {};
|
|
34
35
|
for (const [codebase, { wantBackend, haveBackend }] of Object.entries(payload.functions)) {
|
|
35
|
-
plan =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
plan = {
|
|
37
|
+
...plan,
|
|
38
|
+
...planner.createDeploymentPlan({
|
|
39
|
+
codebase,
|
|
40
|
+
wantBackend,
|
|
41
|
+
haveBackend,
|
|
42
|
+
filters: context.filters,
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
41
45
|
}
|
|
42
46
|
const fnsToDelete = Object.values(plan)
|
|
43
47
|
.map((regionalChanges) => regionalChanges.endpointsToDelete)
|
|
@@ -66,18 +70,19 @@ async function release(context, options, payload) {
|
|
|
66
70
|
concurrency: 40,
|
|
67
71
|
maxBackoff: 100000,
|
|
68
72
|
};
|
|
73
|
+
const projectNumber = options.projectNumber || (await (0, getProjectNumber_1.getProjectNumber)(context.projectId));
|
|
69
74
|
const fab = new fabricator.Fabricator({
|
|
70
75
|
functionExecutor: new executor.QueueExecutor(throttlerOptions),
|
|
71
76
|
executor: new executor.QueueExecutor(throttlerOptions),
|
|
72
77
|
sources: context.sources,
|
|
73
78
|
appEngineLocation: (0, functionsConfig_1.getAppEngineLocation)(context.firebaseConfig),
|
|
74
|
-
projectNumber:
|
|
79
|
+
projectNumber: projectNumber,
|
|
75
80
|
});
|
|
76
81
|
const summary = await fab.applyPlan(plan);
|
|
77
82
|
await reporter.logAndTrackDeployStats(summary, context);
|
|
78
83
|
reporter.printErrors(summary);
|
|
79
84
|
const wantBackend = backend.merge(...Object.values(payload.functions).map((p) => p.wantBackend));
|
|
80
|
-
printTriggerUrls(wantBackend);
|
|
85
|
+
printTriggerUrls(wantBackend, projectNumber);
|
|
81
86
|
await setupArtifactCleanupPolicies(options, options.projectId, Object.keys(wantBackend.endpoints));
|
|
82
87
|
const allErrors = summary.results.filter((r) => r.error).map((r) => r.error);
|
|
83
88
|
if (allErrors.length) {
|
|
@@ -86,12 +91,13 @@ async function release(context, options, payload) {
|
|
|
86
91
|
for (const error of allErrors) {
|
|
87
92
|
logger_1.logger.debug(JSON.stringify(error, null, 2));
|
|
88
93
|
}
|
|
89
|
-
throw new error_1.FirebaseError("There was an error deploying functions",
|
|
94
|
+
throw new error_1.FirebaseError("There was an error deploying functions", { ...opts, exit: 2 });
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
function printTriggerUrls(results, projectNumber) {
|
|
98
|
+
const httpsFunctions = backend
|
|
99
|
+
.allEndpoints(results)
|
|
100
|
+
.filter((b) => backend.isHttpsTriggered(b) || backend.isDataConnectGraphqlTriggered(b));
|
|
95
101
|
if (httpsFunctions.length === 0) {
|
|
96
102
|
return;
|
|
97
103
|
}
|
|
@@ -100,10 +106,13 @@ function printTriggerUrls(results) {
|
|
|
100
106
|
logger_1.logger.debug("Not printing URL for HTTPS function. Typically this means it didn't match a filter or we failed deployment");
|
|
101
107
|
continue;
|
|
102
108
|
}
|
|
109
|
+
if (backend.isDataConnectGraphqlTriggered(httpsFunc)) {
|
|
110
|
+
logger_1.logger.info(clc.bold("Function URL"), `(${(0, functionsDeployHelper_1.getFunctionLabel)(httpsFunc)}):`, `https://${httpsFunc.id.toLowerCase()}-${projectNumber}.${httpsFunc.region}.run.app`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
103
113
|
logger_1.logger.info(clc.bold("Function URL"), `(${(0, functionsDeployHelper_1.getFunctionLabel)(httpsFunc)}):`, httpsFunc.uri);
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
|
-
exports.printTriggerUrls = printTriggerUrls;
|
|
107
116
|
async function setupArtifactCleanupPolicies(options, projectId, locations) {
|
|
108
117
|
if (locations.length === 0) {
|
|
109
118
|
return;
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.calculateChangesets = calculateChangesets;
|
|
4
|
+
exports.calculateUpdate = calculateUpdate;
|
|
5
|
+
exports.createDeploymentPlan = createDeploymentPlan;
|
|
6
|
+
exports.upgradedToGCFv2WithoutSettingConcurrency = upgradedToGCFv2WithoutSettingConcurrency;
|
|
7
|
+
exports.changedTriggerRegion = changedTriggerRegion;
|
|
8
|
+
exports.changedV2PubSubTopic = changedV2PubSubTopic;
|
|
9
|
+
exports.upgradedScheduleFromV1ToV2 = upgradedScheduleFromV1ToV2;
|
|
10
|
+
exports.checkForUnsafeUpdate = checkForUnsafeUpdate;
|
|
11
|
+
exports.checkForIllegalUpdate = checkForIllegalUpdate;
|
|
12
|
+
exports.checkForV2Upgrade = checkForV2Upgrade;
|
|
4
13
|
const functionsDeployHelper_1 = require("../functionsDeployHelper");
|
|
5
14
|
const deploymentTool_1 = require("../../../deploymentTool");
|
|
6
15
|
const error_1 = require("../../../error");
|
|
@@ -52,7 +61,6 @@ function calculateChangesets(want, have, keyFn, deleteAll) {
|
|
|
52
61
|
}
|
|
53
62
|
return result;
|
|
54
63
|
}
|
|
55
|
-
exports.calculateChangesets = calculateChangesets;
|
|
56
64
|
function calculateUpdate(want, have) {
|
|
57
65
|
checkForIllegalUpdate(want, have);
|
|
58
66
|
const update = {
|
|
@@ -67,7 +75,6 @@ function calculateUpdate(want, have) {
|
|
|
67
75
|
}
|
|
68
76
|
return update;
|
|
69
77
|
}
|
|
70
|
-
exports.calculateUpdate = calculateUpdate;
|
|
71
78
|
function createDeploymentPlan(args) {
|
|
72
79
|
let { wantBackend, haveBackend, codebase, filters, deleteAll } = args;
|
|
73
80
|
let deployment = {};
|
|
@@ -84,7 +91,7 @@ function createDeploymentPlan(args) {
|
|
|
84
91
|
]);
|
|
85
92
|
for (const region of regions) {
|
|
86
93
|
const changesets = calculateChangesets(wantBackend.endpoints[region] || {}, haveBackend.endpoints[region] || {}, (e) => `${codebase}-${e.region}-${e.availableMemoryMb || "default"}`, deleteAll);
|
|
87
|
-
deployment =
|
|
94
|
+
deployment = { ...deployment, ...changesets };
|
|
88
95
|
}
|
|
89
96
|
if (upgradedToGCFv2WithoutSettingConcurrency(wantBackend, haveBackend)) {
|
|
90
97
|
utils.logLabeledBullet("functions", "You are updating one or more functions to Google Cloud Functions v2, " +
|
|
@@ -94,11 +101,9 @@ function createDeploymentPlan(args) {
|
|
|
94
101
|
}
|
|
95
102
|
return deployment;
|
|
96
103
|
}
|
|
97
|
-
exports.createDeploymentPlan = createDeploymentPlan;
|
|
98
104
|
function upgradedToGCFv2WithoutSettingConcurrency(want, have) {
|
|
99
105
|
return backend.someEndpoint(want, (endpoint) => {
|
|
100
|
-
|
|
101
|
-
if (((_b = (_a = have.endpoints[endpoint.region]) === null || _a === void 0 ? void 0 : _a[endpoint.id]) === null || _b === void 0 ? void 0 : _b.platform) !== "gcfv1") {
|
|
106
|
+
if (have.endpoints[endpoint.region]?.[endpoint.id]?.platform !== "gcfv1") {
|
|
102
107
|
return false;
|
|
103
108
|
}
|
|
104
109
|
if (endpoint.platform !== "gcfv2") {
|
|
@@ -110,7 +115,6 @@ function upgradedToGCFv2WithoutSettingConcurrency(want, have) {
|
|
|
110
115
|
return true;
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
|
-
exports.upgradedToGCFv2WithoutSettingConcurrency = upgradedToGCFv2WithoutSettingConcurrency;
|
|
114
118
|
function changedTriggerRegion(want, have) {
|
|
115
119
|
if (want.platform !== "gcfv2") {
|
|
116
120
|
return false;
|
|
@@ -126,7 +130,6 @@ function changedTriggerRegion(want, have) {
|
|
|
126
130
|
}
|
|
127
131
|
return want.eventTrigger.region !== have.eventTrigger.region;
|
|
128
132
|
}
|
|
129
|
-
exports.changedTriggerRegion = changedTriggerRegion;
|
|
130
133
|
function changedV2PubSubTopic(want, have) {
|
|
131
134
|
if (want.platform !== "gcfv2") {
|
|
132
135
|
return false;
|
|
@@ -148,7 +151,6 @@ function changedV2PubSubTopic(want, have) {
|
|
|
148
151
|
}
|
|
149
152
|
return have.eventTrigger.eventFilters.topic !== want.eventTrigger.eventFilters.topic;
|
|
150
153
|
}
|
|
151
|
-
exports.changedV2PubSubTopic = changedV2PubSubTopic;
|
|
152
154
|
function upgradedScheduleFromV1ToV2(want, have) {
|
|
153
155
|
if (have.platform !== "gcfv1") {
|
|
154
156
|
return false;
|
|
@@ -164,19 +166,20 @@ function upgradedScheduleFromV1ToV2(want, have) {
|
|
|
164
166
|
}
|
|
165
167
|
return true;
|
|
166
168
|
}
|
|
167
|
-
exports.upgradedScheduleFromV1ToV2 = upgradedScheduleFromV1ToV2;
|
|
168
169
|
function checkForUnsafeUpdate(want, have) {
|
|
169
170
|
return (backend.isEventTriggered(want) &&
|
|
170
171
|
backend.isEventTriggered(have) &&
|
|
171
172
|
want.eventTrigger.eventType ===
|
|
172
173
|
v2events.CONVERTABLE_EVENTS[have.eventTrigger.eventType]);
|
|
173
174
|
}
|
|
174
|
-
exports.checkForUnsafeUpdate = checkForUnsafeUpdate;
|
|
175
175
|
function checkForIllegalUpdate(want, have) {
|
|
176
176
|
const triggerType = (e) => {
|
|
177
177
|
if (backend.isHttpsTriggered(e)) {
|
|
178
178
|
return "an HTTPS";
|
|
179
179
|
}
|
|
180
|
+
else if (backend.isDataConnectGraphqlTriggered(e)) {
|
|
181
|
+
return "a Data Connect HTTPS";
|
|
182
|
+
}
|
|
180
183
|
else if (backend.isCallableTriggered(e)) {
|
|
181
184
|
return "a callable";
|
|
182
185
|
}
|
|
@@ -205,11 +208,9 @@ function checkForIllegalUpdate(want, have) {
|
|
|
205
208
|
}
|
|
206
209
|
exports.checkForV2Upgrade(want, have);
|
|
207
210
|
}
|
|
208
|
-
exports.checkForIllegalUpdate = checkForIllegalUpdate;
|
|
209
211
|
function checkForV2Upgrade(want, have) {
|
|
210
212
|
if (want.platform === "gcfv2" && have.platform === "gcfv1") {
|
|
211
213
|
throw new error_1.FirebaseError(`[${(0, functionsDeployHelper_1.getFunctionLabel)(have)}] Upgrading from 1st Gen to 2nd Gen is not yet supported. ` +
|
|
212
214
|
"See https://firebase.google.com/docs/functions/2nd-gen-upgrade before migrating to 2nd Gen.");
|
|
213
215
|
}
|
|
214
216
|
}
|
|
215
|
-
exports.checkForV2Upgrade = checkForV2Upgrade;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AbortedDeploymentError = exports.DeploymentError = void 0;
|
|
4
|
+
exports.logAndTrackDeployStats = logAndTrackDeployStats;
|
|
5
|
+
exports.printErrors = printErrors;
|
|
6
|
+
exports.printAbortedErrors = printAbortedErrors;
|
|
7
|
+
exports.triggerTag = triggerTag;
|
|
4
8
|
const backend = require("../backend");
|
|
5
9
|
const clc = require("colorette");
|
|
6
10
|
const logger_1 = require("../../../logger");
|
|
@@ -24,7 +28,6 @@ class AbortedDeploymentError extends DeploymentError {
|
|
|
24
28
|
}
|
|
25
29
|
exports.AbortedDeploymentError = AbortedDeploymentError;
|
|
26
30
|
async function logAndTrackDeployStats(summary, context) {
|
|
27
|
-
var _a, _b, _c;
|
|
28
31
|
let totalTime = 0;
|
|
29
32
|
let totalErrors = 0;
|
|
30
33
|
let totalSuccesses = 0;
|
|
@@ -51,29 +54,29 @@ async function logAndTrackDeployStats(summary, context) {
|
|
|
51
54
|
totalTime += result.durationMs;
|
|
52
55
|
if (!result.error) {
|
|
53
56
|
totalSuccesses++;
|
|
54
|
-
if (
|
|
57
|
+
if (context?.codebaseDeployEvents?.[result.endpoint.codebase || "default"] !== undefined) {
|
|
55
58
|
context.codebaseDeployEvents[result.endpoint.codebase || "default"]
|
|
56
59
|
.fn_deploy_num_successes++;
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
62
|
else if (result.error instanceof AbortedDeploymentError) {
|
|
60
63
|
totalAborts++;
|
|
61
|
-
if (
|
|
64
|
+
if (context?.codebaseDeployEvents?.[result.endpoint.codebase || "default"] !== undefined) {
|
|
62
65
|
context.codebaseDeployEvents[result.endpoint.codebase || "default"]
|
|
63
66
|
.fn_deploy_num_canceled++;
|
|
64
67
|
}
|
|
65
68
|
}
|
|
66
69
|
else {
|
|
67
70
|
totalErrors++;
|
|
68
|
-
if (
|
|
71
|
+
if (context?.codebaseDeployEvents?.[result.endpoint.codebase || "default"] !== undefined) {
|
|
69
72
|
context.codebaseDeployEvents[result.endpoint.codebase || "default"]
|
|
70
73
|
.fn_deploy_num_failures++;
|
|
71
74
|
}
|
|
72
75
|
}
|
|
73
76
|
}
|
|
74
77
|
for (const codebase of codebases) {
|
|
75
|
-
if (context
|
|
76
|
-
reports.push((0, track_1.trackGA4)("codebase_deploy",
|
|
78
|
+
if (context?.codebaseDeployEvents) {
|
|
79
|
+
reports.push((0, track_1.trackGA4)("codebase_deploy", { ...context.codebaseDeployEvents[codebase] }));
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
82
|
const fnDeployGroupEvent = {
|
|
@@ -81,7 +84,7 @@ async function logAndTrackDeployStats(summary, context) {
|
|
|
81
84
|
fn_deploy_num_successes: totalSuccesses,
|
|
82
85
|
fn_deploy_num_canceled: totalAborts,
|
|
83
86
|
fn_deploy_num_failures: totalErrors,
|
|
84
|
-
has_runtime_config: String(!!
|
|
87
|
+
has_runtime_config: String(!!context?.hasRuntimeConfig),
|
|
85
88
|
};
|
|
86
89
|
reports.push((0, track_1.trackGA4)("function_deploy_group", fnDeployGroupEvent));
|
|
87
90
|
const avgTime = totalTime / (totalSuccesses + totalErrors);
|
|
@@ -92,7 +95,6 @@ async function logAndTrackDeployStats(summary, context) {
|
|
|
92
95
|
logger_1.logger.debug(`Average Function Deployment time: ${avgTime}`);
|
|
93
96
|
await utils.allSettled(reports);
|
|
94
97
|
}
|
|
95
|
-
exports.logAndTrackDeployStats = logAndTrackDeployStats;
|
|
96
98
|
function printErrors(summary) {
|
|
97
99
|
const errored = summary.results.filter((r) => r.error);
|
|
98
100
|
if (errored.length === 0) {
|
|
@@ -109,7 +111,6 @@ function printErrors(summary) {
|
|
|
109
111
|
printQuotaErrors(errored);
|
|
110
112
|
printAbortedErrors(errored);
|
|
111
113
|
}
|
|
112
|
-
exports.printErrors = printErrors;
|
|
113
114
|
function printIamErrors(results) {
|
|
114
115
|
const iamFailures = results.filter((r) => r.error instanceof DeploymentError && r.error.op === "set invoker");
|
|
115
116
|
if (!iamFailures.length) {
|
|
@@ -137,16 +138,15 @@ function printIamErrors(results) {
|
|
|
137
138
|
}
|
|
138
139
|
function printQuotaErrors(results) {
|
|
139
140
|
const hadQuotaError = results.find((r) => {
|
|
140
|
-
var _a, _b, _c, _d, _e, _f;
|
|
141
141
|
if (!(r.error instanceof DeploymentError)) {
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
144
|
const original = r.error.original;
|
|
145
|
-
const code =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
const code = original?.status ||
|
|
146
|
+
original?.code ||
|
|
147
|
+
original?.context?.response?.statusCode ||
|
|
148
|
+
original?.original?.code ||
|
|
149
|
+
original?.original?.context?.response?.statusCode;
|
|
150
150
|
return code === 429 || code === 409;
|
|
151
151
|
});
|
|
152
152
|
if (!hadQuotaError) {
|
|
@@ -170,9 +170,7 @@ function printAbortedErrors(results) {
|
|
|
170
170
|
aborted.map((result) => `\n\t${(0, functionsDeployHelper_1.getFunctionLabel)(result.endpoint)}`).join(""));
|
|
171
171
|
logger_1.logger.info(`To delete these, use ${clc.bold("firebase functions:delete")}`);
|
|
172
172
|
}
|
|
173
|
-
exports.printAbortedErrors = printAbortedErrors;
|
|
174
173
|
function triggerTag(endpoint) {
|
|
175
|
-
var _a;
|
|
176
174
|
const prefix = endpoint.platform === "gcfv1" ? "v1" : "v2";
|
|
177
175
|
if (backend.isScheduleTriggered(endpoint)) {
|
|
178
176
|
return `${prefix}.scheduled`;
|
|
@@ -184,14 +182,16 @@ function triggerTag(endpoint) {
|
|
|
184
182
|
return `${prefix}.callable`;
|
|
185
183
|
}
|
|
186
184
|
if (backend.isHttpsTriggered(endpoint)) {
|
|
187
|
-
if (
|
|
185
|
+
if (endpoint.labels?.["deployment-callable"]) {
|
|
188
186
|
return `${prefix}.callable`;
|
|
189
187
|
}
|
|
190
188
|
return `${prefix}.https`;
|
|
191
189
|
}
|
|
190
|
+
if (backend.isDataConnectGraphqlTriggered(endpoint)) {
|
|
191
|
+
return `${prefix}.dataConnectGraphql`;
|
|
192
|
+
}
|
|
192
193
|
if (backend.isBlockingTriggered(endpoint)) {
|
|
193
194
|
return `${prefix}.blocking`;
|
|
194
195
|
}
|
|
195
196
|
return endpoint.eventTrigger.eventType;
|
|
196
197
|
}
|
|
197
|
-
exports.triggerTag = triggerTag;
|
|
@@ -50,12 +50,11 @@ class SourceTokenScraper {
|
|
|
50
50
|
}
|
|
51
51
|
get poller() {
|
|
52
52
|
return (op) => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
logger_1.logger.debug(`Got source token ${(_d = op.metadata) === null || _d === void 0 ? void 0 : _d.sourceToken} for region ${region}`);
|
|
53
|
+
if (op.metadata?.sourceToken || op.done) {
|
|
54
|
+
const [, , , region] = op.metadata?.target?.split("/") || [];
|
|
55
|
+
logger_1.logger.debug(`Got source token ${op.metadata?.sourceToken} for region ${region}`);
|
|
57
56
|
this.resolve({
|
|
58
|
-
token:
|
|
57
|
+
token: op.metadata?.sourceToken,
|
|
59
58
|
aborted: false,
|
|
60
59
|
});
|
|
61
60
|
this.fetchState = "VALID";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getRemoteSource = getRemoteSource;
|
|
4
|
+
exports.requireFunctionsYaml = requireFunctionsYaml;
|
|
4
5
|
const fs = require("fs");
|
|
5
6
|
const path = require("path");
|
|
6
7
|
const url_1 = require("url");
|
|
@@ -45,7 +46,6 @@ async function getRemoteSource(repository, ref, destDir, subDir) {
|
|
|
45
46
|
(0, utils_1.logLabeledBullet)("functions", `downloaded remote source (${origin})`);
|
|
46
47
|
return sourceDir;
|
|
47
48
|
}
|
|
48
|
-
exports.getRemoteSource = getRemoteSource;
|
|
49
49
|
function parseGitHubUrl(url) {
|
|
50
50
|
const shorthandMatch = /^[a-zA-Z0-9-]+\/[a-zA-Z0-9-_.]+$/.exec(url);
|
|
51
51
|
if (shorthandMatch) {
|
|
@@ -68,7 +68,7 @@ function parseGitHubUrl(url) {
|
|
|
68
68
|
}
|
|
69
69
|
return { owner, repo };
|
|
70
70
|
}
|
|
71
|
-
catch
|
|
71
|
+
catch {
|
|
72
72
|
return undefined;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -81,4 +81,3 @@ function requireFunctionsYaml(codeDir) {
|
|
|
81
81
|
`If you trust this repository and want to use it anyway, clone the repository locally, inspect the code for safety, and deploy it as a local source.`);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
exports.requireFunctionsYaml = requireFunctionsYaml;
|