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/env.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isFirebaseStudio = isFirebaseStudio;
|
|
4
|
+
exports.isFirebaseMcp = isFirebaseMcp;
|
|
4
5
|
const fsutils_1 = require("./fsutils");
|
|
5
6
|
let googleIdxFolderExists;
|
|
6
7
|
function isFirebaseStudio() {
|
|
@@ -11,8 +12,6 @@ function isFirebaseStudio() {
|
|
|
11
12
|
googleIdxFolderExists = (0, fsutils_1.dirExistsSync)("/google/idx");
|
|
12
13
|
return googleIdxFolderExists;
|
|
13
14
|
}
|
|
14
|
-
exports.isFirebaseStudio = isFirebaseStudio;
|
|
15
15
|
function isFirebaseMcp() {
|
|
16
16
|
return !!process.env.IS_FIREBASE_MCP;
|
|
17
17
|
}
|
|
18
|
-
exports.isFirebaseMcp = isFirebaseMcp;
|
package/lib/error.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasMessage = exports.
|
|
3
|
+
exports.hasMessage = exports.FirebaseError = void 0;
|
|
4
|
+
exports.getErrMsg = getErrMsg;
|
|
5
|
+
exports.getErrStack = getErrStack;
|
|
6
|
+
exports.isObject = isObject;
|
|
7
|
+
exports.getErrStatus = getErrStatus;
|
|
8
|
+
exports.getError = getError;
|
|
9
|
+
exports.isBillingError = isBillingError;
|
|
4
10
|
const lodash_1 = require("lodash");
|
|
5
11
|
const DEFAULT_CHILDREN = [];
|
|
6
12
|
const DEFAULT_EXIT = 1;
|
|
@@ -30,40 +36,32 @@ function getErrMsg(err, defaultMsg) {
|
|
|
30
36
|
}
|
|
31
37
|
return JSON.stringify(err);
|
|
32
38
|
}
|
|
33
|
-
exports.getErrMsg = getErrMsg;
|
|
34
39
|
function getErrStack(err) {
|
|
35
40
|
if (err instanceof Error) {
|
|
36
41
|
return err.stack || err.message;
|
|
37
42
|
}
|
|
38
43
|
return getErrMsg(err);
|
|
39
44
|
}
|
|
40
|
-
exports.getErrStack = getErrStack;
|
|
41
45
|
function isObject(value) {
|
|
42
46
|
return typeof value === "object" && value !== null;
|
|
43
47
|
}
|
|
44
|
-
exports.isObject = isObject;
|
|
45
48
|
function getErrStatus(err, defaultStatus) {
|
|
46
49
|
if (isObject(err) && err.status && typeof err.status === "number") {
|
|
47
50
|
return err.status;
|
|
48
51
|
}
|
|
49
52
|
return defaultStatus || DEFAULT_STATUS;
|
|
50
53
|
}
|
|
51
|
-
exports.getErrStatus = getErrStatus;
|
|
52
54
|
function getError(err) {
|
|
53
55
|
if (err instanceof Error) {
|
|
54
56
|
return err;
|
|
55
57
|
}
|
|
56
58
|
return Error(getErrMsg(err));
|
|
57
59
|
}
|
|
58
|
-
exports.getError = getError;
|
|
59
60
|
function isBillingError(e) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
var _a;
|
|
63
|
-
return (((_a = d.violations) === null || _a === void 0 ? void 0 : _a.find((v) => v.type === "serviceusage/billing-enabled")) ||
|
|
61
|
+
return !!e.context?.body?.error?.details?.find((d) => {
|
|
62
|
+
return (d.violations?.find((v) => v.type === "serviceusage/billing-enabled") ||
|
|
64
63
|
d.reason === "UREQ_PROJECT_BILLING_NOT_FOUND");
|
|
65
|
-
})
|
|
64
|
+
});
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
const hasMessage = (e) => !!(e === null || e === void 0 ? void 0 : e.message);
|
|
66
|
+
const hasMessage = (e) => !!e?.message;
|
|
69
67
|
exports.hasMessage = hasMessage;
|
package/lib/errorOut.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.errorOut =
|
|
3
|
+
exports.errorOut = errorOut;
|
|
4
4
|
const logError_1 = require("./logError");
|
|
5
5
|
const error_1 = require("./error");
|
|
6
6
|
function errorOut(error) {
|
|
@@ -20,4 +20,3 @@ function errorOut(error) {
|
|
|
20
20
|
process.exit();
|
|
21
21
|
}, 250);
|
|
22
22
|
}
|
|
23
|
-
exports.errorOut = errorOut;
|
package/lib/experiments.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ALL_EXPERIMENTS = void 0;
|
|
4
|
+
exports.isValidExperiment = isValidExperiment;
|
|
5
|
+
exports.experimentNameAutocorrect = experimentNameAutocorrect;
|
|
6
|
+
exports.isEnabled = isEnabled;
|
|
7
|
+
exports.setEnabled = setEnabled;
|
|
8
|
+
exports.enableExperimentsFromCliEnvVariable = enableExperimentsFromCliEnvVariable;
|
|
9
|
+
exports.assertEnabled = assertEnabled;
|
|
10
|
+
exports.flushToDisk = flushToDisk;
|
|
4
11
|
const colorette_1 = require("colorette");
|
|
5
12
|
const leven = require("leven");
|
|
6
13
|
const path_1 = require("path");
|
|
@@ -22,11 +29,10 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
22
29
|
},
|
|
23
30
|
functionsv2deployoptimizations: {
|
|
24
31
|
shortDescription: "Optimize deployments of v2 firebase functions",
|
|
25
|
-
fullDescription: "Reuse build images across
|
|
26
|
-
"of deploys.
|
|
27
|
-
"temporarily causing failures in some regions with this optimization enabled",
|
|
32
|
+
fullDescription: "Reuse build images across functions to increase performance and reliability " +
|
|
33
|
+
"of deploys.",
|
|
28
34
|
public: true,
|
|
29
|
-
default:
|
|
35
|
+
default: true,
|
|
30
36
|
},
|
|
31
37
|
deletegcfartifacts: {
|
|
32
38
|
shortDescription: `Add the ${(0, colorette_1.bold)("functions:deletegcfartifacts")} command to purge docker build images`,
|
|
@@ -39,13 +45,13 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
39
45
|
`Registry. The ${(0, colorette_1.bold)("functions:deletegcfartifacts")} command ` +
|
|
40
46
|
"will delete all Docker images created by Google Cloud Functions irrespective " +
|
|
41
47
|
"of how that image was created.",
|
|
42
|
-
public:
|
|
48
|
+
public: true,
|
|
43
49
|
},
|
|
44
50
|
legacyRuntimeConfigCommands: {
|
|
45
51
|
shortDescription: "Expose legacy functions.config() CLI commands",
|
|
46
52
|
fullDescription: "The Cloud Runtime Config API is deprecated. Enable this experiment to continue using the " +
|
|
47
53
|
"`functions:config:*` commands while you migrate to the Firebase Functions params APIs.",
|
|
48
|
-
default:
|
|
54
|
+
default: false,
|
|
49
55
|
public: true,
|
|
50
56
|
},
|
|
51
57
|
runfunctions: {
|
|
@@ -143,14 +149,12 @@ exports.ALL_EXPERIMENTS = experiments({
|
|
|
143
149
|
function isValidExperiment(name) {
|
|
144
150
|
return Object.keys(exports.ALL_EXPERIMENTS).includes(name);
|
|
145
151
|
}
|
|
146
|
-
exports.isValidExperiment = isValidExperiment;
|
|
147
152
|
function experimentNameAutocorrect(malformed) {
|
|
148
153
|
if (isValidExperiment(malformed)) {
|
|
149
154
|
throw new error_1.FirebaseError("Assertion failed: experimentNameAutocorrect given actual experiment name", { exit: 2 });
|
|
150
155
|
}
|
|
151
156
|
return Object.keys(exports.ALL_EXPERIMENTS).filter((name) => leven(name, malformed) < malformed.length * 0.4);
|
|
152
157
|
}
|
|
153
|
-
exports.experimentNameAutocorrect = experimentNameAutocorrect;
|
|
154
158
|
let localPreferencesCache = undefined;
|
|
155
159
|
function localPreferences() {
|
|
156
160
|
if (!localPreferencesCache) {
|
|
@@ -164,10 +168,8 @@ function localPreferences() {
|
|
|
164
168
|
return localPreferencesCache;
|
|
165
169
|
}
|
|
166
170
|
function isEnabled(name) {
|
|
167
|
-
|
|
168
|
-
return (_c = (_a = localPreferences()[name]) !== null && _a !== void 0 ? _a : (_b = exports.ALL_EXPERIMENTS[name]) === null || _b === void 0 ? void 0 : _b.default) !== null && _c !== void 0 ? _c : false;
|
|
171
|
+
return localPreferences()[name] ?? exports.ALL_EXPERIMENTS[name]?.default ?? false;
|
|
169
172
|
}
|
|
170
|
-
exports.isEnabled = isEnabled;
|
|
171
173
|
function setEnabled(name, to) {
|
|
172
174
|
if (to === null) {
|
|
173
175
|
delete localPreferences()[name];
|
|
@@ -176,7 +178,6 @@ function setEnabled(name, to) {
|
|
|
176
178
|
localPreferences()[name] = to;
|
|
177
179
|
}
|
|
178
180
|
}
|
|
179
|
-
exports.setEnabled = setEnabled;
|
|
180
181
|
function enableExperimentsFromCliEnvVariable() {
|
|
181
182
|
const experiments = process.env.FIREBASE_CLI_EXPERIMENTS || "";
|
|
182
183
|
for (const experiment of experiments.split(",")) {
|
|
@@ -185,13 +186,11 @@ function enableExperimentsFromCliEnvVariable() {
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
|
-
exports.enableExperimentsFromCliEnvVariable = enableExperimentsFromCliEnvVariable;
|
|
189
189
|
function assertEnabled(name, task) {
|
|
190
|
-
var _a;
|
|
191
190
|
if (!isEnabled(name)) {
|
|
192
191
|
const prefix = `Cannot ${task} because the experiment ${(0, colorette_1.bold)(name)} is not enabled.`;
|
|
193
192
|
if ((0, utils_1.isRunningInGithubAction)()) {
|
|
194
|
-
const path =
|
|
193
|
+
const path = process.env.GITHUB_WORKFLOW_REF?.split("@")[0];
|
|
195
194
|
const filename = path ? `.github/workflows/${(0, path_1.basename)(path)}` : "your action's yml";
|
|
196
195
|
const newValue = [process.env.FIREBASE_CLI_EXPERIMENTS, name].filter((it) => !!it).join(",");
|
|
197
196
|
throw new error_1.FirebaseError(`${prefix} To enable add a ${(0, colorette_1.bold)("FIREBASE_CLI_EXPERIMENTS")} environment variable to ${filename}, like so: ${(0, colorette_1.italic)(`
|
|
@@ -208,8 +207,6 @@ function assertEnabled(name, task) {
|
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
|
-
exports.assertEnabled = assertEnabled;
|
|
212
210
|
function flushToDisk() {
|
|
213
211
|
configstore_1.configstore.set("previews", localPreferences());
|
|
214
212
|
}
|
|
215
|
-
exports.flushToDisk = flushToDisk;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.EXTENSIONS_DEFAULT_EVENT_ARC_REGION = exports.ALLOWED_EVENT_ARC_REGIONS = void 0;
|
|
4
|
+
exports.checkAllowedEventTypesResponse = checkAllowedEventTypesResponse;
|
|
5
|
+
exports.askForEventsConfig = askForEventsConfig;
|
|
6
|
+
exports.getEventArcChannel = getEventArcChannel;
|
|
7
|
+
exports.askForAllowedEventTypes = askForAllowedEventTypes;
|
|
8
|
+
exports.askShouldCollectEventsConfig = askShouldCollectEventsConfig;
|
|
9
|
+
exports.askForEventArcLocation = askForEventArcLocation;
|
|
4
10
|
const extensionsApi = require("../extensions/extensionsApi");
|
|
5
11
|
const utils = require("../utils");
|
|
6
12
|
const clc = require("colorette");
|
|
@@ -20,9 +26,7 @@ function checkAllowedEventTypesResponse(response, validEvents) {
|
|
|
20
26
|
}
|
|
21
27
|
return true;
|
|
22
28
|
}
|
|
23
|
-
exports.checkAllowedEventTypesResponse = checkAllowedEventTypesResponse;
|
|
24
29
|
async function askForEventsConfig(events, projectId, instanceId) {
|
|
25
|
-
var _a, _b;
|
|
26
30
|
logger_1.logger.info(`\n${clc.bold("Enable Events")}: ${await (0, marked_1.marked)("If you enable events, you can write custom event handlers ([https://firebase.google.com/docs/extensions/install-extensions#eventarc](https://firebase.google.com/docs/extensions/install-extensions#eventarc)) that respond to these events.\n\nYou can always enable or disable events later. Events will be emitted via Eventarc. Fees apply ([https://cloud.google.com/eventarc/pricing](https://cloud.google.com/eventarc/pricing)).")}`);
|
|
27
31
|
if (!(await askShouldCollectEventsConfig())) {
|
|
28
32
|
return undefined;
|
|
@@ -33,20 +37,18 @@ async function askForEventsConfig(events, projectId, instanceId) {
|
|
|
33
37
|
? await extensionsApi.getInstance(projectId, instanceId)
|
|
34
38
|
: undefined;
|
|
35
39
|
}
|
|
36
|
-
catch
|
|
40
|
+
catch {
|
|
37
41
|
}
|
|
38
|
-
const preselectedTypes =
|
|
39
|
-
const oldLocation =
|
|
42
|
+
const preselectedTypes = existingInstance?.config.allowedEventTypes ?? [];
|
|
43
|
+
const oldLocation = existingInstance?.config.eventarcChannel?.split("/")[3];
|
|
40
44
|
const location = await askForEventArcLocation(oldLocation);
|
|
41
45
|
const channel = getEventArcChannel(projectId, location);
|
|
42
46
|
const allowedEventTypes = await askForAllowedEventTypes(events, preselectedTypes);
|
|
43
47
|
return { channel, allowedEventTypes };
|
|
44
48
|
}
|
|
45
|
-
exports.askForEventsConfig = askForEventsConfig;
|
|
46
49
|
function getEventArcChannel(projectId, location) {
|
|
47
50
|
return `projects/${projectId}/locations/${location}/channels/firebase`;
|
|
48
51
|
}
|
|
49
|
-
exports.getEventArcChannel = getEventArcChannel;
|
|
50
52
|
async function askForAllowedEventTypes(eventDescriptors, preselectedTypes) {
|
|
51
53
|
let valid = false;
|
|
52
54
|
let response = [];
|
|
@@ -57,7 +59,7 @@ async function askForAllowedEventTypes(eventDescriptors, preselectedTypes) {
|
|
|
57
59
|
}));
|
|
58
60
|
while (!valid) {
|
|
59
61
|
response = await (0, prompt_1.checkbox)({
|
|
60
|
-
default: preselectedTypes
|
|
62
|
+
default: preselectedTypes ?? [],
|
|
61
63
|
message: `Please select the events [${eventTypes.length} types total] that this extension is permitted to emit. ` +
|
|
62
64
|
"You can implement your own handlers that trigger when these events are emitted to customize the extension's behavior. ",
|
|
63
65
|
choices: eventTypes,
|
|
@@ -67,11 +69,9 @@ async function askForAllowedEventTypes(eventDescriptors, preselectedTypes) {
|
|
|
67
69
|
}
|
|
68
70
|
return response.filter((e) => e !== "");
|
|
69
71
|
}
|
|
70
|
-
exports.askForAllowedEventTypes = askForAllowedEventTypes;
|
|
71
72
|
function askShouldCollectEventsConfig() {
|
|
72
73
|
return (0, prompt_1.confirm)("Would you like to enable events?");
|
|
73
74
|
}
|
|
74
|
-
exports.askShouldCollectEventsConfig = askShouldCollectEventsConfig;
|
|
75
75
|
exports.ALLOWED_EVENT_ARC_REGIONS = [
|
|
76
76
|
"us-central1",
|
|
77
77
|
"us-west1",
|
|
@@ -84,7 +84,7 @@ async function askForEventArcLocation(preselectedLocation) {
|
|
|
84
84
|
let location = "";
|
|
85
85
|
while (!valid) {
|
|
86
86
|
location = await (0, prompt_1.select)({
|
|
87
|
-
default: preselectedLocation
|
|
87
|
+
default: preselectedLocation ?? exports.EXTENSIONS_DEFAULT_EVENT_ARC_REGION,
|
|
88
88
|
message: "Which location would you like the Eventarc channel to live in? We recommend using the default option. A channel location that differs from the extension's Cloud Functions location can incur egress cost.",
|
|
89
89
|
choices: exports.ALLOWED_EVENT_ARC_REGIONS,
|
|
90
90
|
});
|
|
@@ -95,4 +95,3 @@ async function askForEventArcLocation(preselectedLocation) {
|
|
|
95
95
|
}
|
|
96
96
|
return location;
|
|
97
97
|
}
|
|
98
|
-
exports.askForEventArcLocation = askForEventArcLocation;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.SecretLocation = void 0;
|
|
4
|
+
exports.checkResponse = checkResponse;
|
|
5
|
+
exports.ask = ask;
|
|
6
|
+
exports.askForParam = askForParam;
|
|
7
|
+
exports.promptCreateSecret = promptCreateSecret;
|
|
8
|
+
exports.getInquirerDefault = getInquirerDefault;
|
|
4
9
|
const _ = require("lodash");
|
|
5
10
|
const clc = require("colorette");
|
|
6
11
|
const marked_1 = require("marked");
|
|
@@ -18,14 +23,13 @@ var SecretLocation;
|
|
|
18
23
|
(function (SecretLocation) {
|
|
19
24
|
SecretLocation[SecretLocation["CLOUD"] = 1] = "CLOUD";
|
|
20
25
|
SecretLocation[SecretLocation["LOCAL"] = 2] = "LOCAL";
|
|
21
|
-
})(SecretLocation
|
|
26
|
+
})(SecretLocation || (exports.SecretLocation = SecretLocation = {}));
|
|
22
27
|
var SecretUpdateAction;
|
|
23
28
|
(function (SecretUpdateAction) {
|
|
24
29
|
SecretUpdateAction[SecretUpdateAction["LEAVE"] = 1] = "LEAVE";
|
|
25
30
|
SecretUpdateAction[SecretUpdateAction["SET_NEW"] = 2] = "SET_NEW";
|
|
26
31
|
})(SecretUpdateAction || (SecretUpdateAction = {}));
|
|
27
32
|
function checkResponse(response, spec) {
|
|
28
|
-
var _a;
|
|
29
33
|
let valid = true;
|
|
30
34
|
let responses;
|
|
31
35
|
if (spec.required && (response === "" || response === undefined)) {
|
|
@@ -51,7 +55,7 @@ function checkResponse(response, spec) {
|
|
|
51
55
|
}
|
|
52
56
|
if (spec.type && (spec.type === types_1.ParamType.MULTISELECT || spec.type === types_1.ParamType.SELECT)) {
|
|
53
57
|
for (const r of responses) {
|
|
54
|
-
const validChoice =
|
|
58
|
+
const validChoice = spec.options?.some((option) => r === option.value);
|
|
55
59
|
if (r && !validChoice) {
|
|
56
60
|
utils.logWarning(`${r} is not a valid option for ${spec.param}.`);
|
|
57
61
|
valid = false;
|
|
@@ -60,7 +64,6 @@ function checkResponse(response, spec) {
|
|
|
60
64
|
}
|
|
61
65
|
return valid;
|
|
62
66
|
}
|
|
63
|
-
exports.checkResponse = checkResponse;
|
|
64
67
|
async function ask(args) {
|
|
65
68
|
if (_.isEmpty(args.paramSpecs)) {
|
|
66
69
|
logger_1.logger.debug("No params were specified for this extension.");
|
|
@@ -68,7 +71,7 @@ async function ask(args) {
|
|
|
68
71
|
}
|
|
69
72
|
utils.logLabeledBullet(extensionsHelper_1.logPrefix, "answer the questions below to configure your extension:");
|
|
70
73
|
const substituted = (0, extensionsHelper_1.substituteParams)(args.paramSpecs, args.firebaseProjectParams);
|
|
71
|
-
const [advancedParams, standardParams] = (0, functional_1.partition)(substituted, (p) =>
|
|
74
|
+
const [advancedParams, standardParams] = (0, functional_1.partition)(substituted, (p) => p.advanced ?? false);
|
|
72
75
|
const result = {};
|
|
73
76
|
const promises = standardParams.map((paramSpec) => {
|
|
74
77
|
return async () => {
|
|
@@ -109,7 +112,6 @@ async function ask(args) {
|
|
|
109
112
|
logger_1.logger.info();
|
|
110
113
|
return result;
|
|
111
114
|
}
|
|
112
|
-
exports.ask = ask;
|
|
113
115
|
async function askForParam(args) {
|
|
114
116
|
const paramSpec = args.paramSpec;
|
|
115
117
|
let valid = false;
|
|
@@ -169,9 +171,8 @@ async function askForParam(args) {
|
|
|
169
171
|
valid = checkResponse(response, paramSpec);
|
|
170
172
|
}
|
|
171
173
|
}
|
|
172
|
-
return
|
|
174
|
+
return { baseValue: response, ...(responseForLocal ? { local: responseForLocal } : {}) };
|
|
173
175
|
}
|
|
174
|
-
exports.askForParam = askForParam;
|
|
175
176
|
function isValidSecretLocations(secretLocations, paramSpec) {
|
|
176
177
|
if (paramSpec.required) {
|
|
177
178
|
return !!secretLocations.length;
|
|
@@ -267,7 +268,7 @@ async function promptReconfigureSecret(projectId, instanceId, paramSpec) {
|
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
async function promptCreateSecret(projectId, instanceId, paramSpec, secretName) {
|
|
270
|
-
const name = secretName
|
|
271
|
+
const name = secretName ?? (await generateSecretName(projectId, instanceId, paramSpec.param));
|
|
271
272
|
const secretValue = (await (0, prompt_1.password)({
|
|
272
273
|
message: `This secret will be stored in Cloud Secret Manager (https://cloud.google.com/secret-manager/pricing) as ${name} and managed by Firebase Extensions (Firebase Extensions Service Agent will be granted Secret Admin role on this secret).\nEnter a value for ${paramSpec.label.trim()}:`,
|
|
273
274
|
})) ||
|
|
@@ -290,7 +291,6 @@ async function promptCreateSecret(projectId, instanceId, paramSpec, secretName)
|
|
|
290
291
|
return "";
|
|
291
292
|
}
|
|
292
293
|
}
|
|
293
|
-
exports.promptCreateSecret = promptCreateSecret;
|
|
294
294
|
async function generateSecretName(projectId, instanceId, paramName) {
|
|
295
295
|
let secretName = `ext-${instanceId}-${paramName}`;
|
|
296
296
|
while (await secretManagerApi.secretExists(projectId, secretName)) {
|
|
@@ -307,4 +307,3 @@ function getInquirerDefault(options, def) {
|
|
|
307
307
|
const defaultOption = options.find((o) => o.value === def);
|
|
308
308
|
return defaultOption ? defaultOption.label || defaultOption.value : "";
|
|
309
309
|
}
|
|
310
|
-
exports.getInquirerDefault = getInquirerDefault;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getReleaseNotesForUpdate = getReleaseNotesForUpdate;
|
|
4
|
+
exports.breakingChangesInUpdate = breakingChangesInUpdate;
|
|
5
|
+
exports.getLocalChangelog = getLocalChangelog;
|
|
6
|
+
exports.parseChangelog = parseChangelog;
|
|
4
7
|
const marked_1 = require("marked");
|
|
5
8
|
const path = require("path");
|
|
6
9
|
const semver = require("semver");
|
|
@@ -26,7 +29,6 @@ async function getReleaseNotesForUpdate(args) {
|
|
|
26
29
|
}
|
|
27
30
|
return releaseNotes;
|
|
28
31
|
}
|
|
29
|
-
exports.getReleaseNotesForUpdate = getReleaseNotesForUpdate;
|
|
30
32
|
function breakingChangesInUpdate(versionsInUpdate) {
|
|
31
33
|
const breakingVersions = [];
|
|
32
34
|
const semvers = versionsInUpdate.map((v) => semver.parse(v)).sort(semver.compare);
|
|
@@ -41,12 +43,10 @@ function breakingChangesInUpdate(versionsInUpdate) {
|
|
|
41
43
|
}
|
|
42
44
|
return breakingVersions;
|
|
43
45
|
}
|
|
44
|
-
exports.breakingChangesInUpdate = breakingChangesInUpdate;
|
|
45
46
|
function getLocalChangelog(directory) {
|
|
46
47
|
const rawChangelog = (0, localHelper_1.readFile)(path.resolve(directory, EXTENSIONS_CHANGELOG));
|
|
47
48
|
return parseChangelog(rawChangelog);
|
|
48
49
|
}
|
|
49
|
-
exports.getLocalChangelog = getLocalChangelog;
|
|
50
50
|
function parseChangelog(rawChangelog) {
|
|
51
51
|
const changelog = {};
|
|
52
52
|
let currentVersion = "";
|
|
@@ -66,4 +66,3 @@ function parseChangelog(rawChangelog) {
|
|
|
66
66
|
}
|
|
67
67
|
return changelog;
|
|
68
68
|
}
|
|
69
|
-
exports.parseChangelog = parseChangelog;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.enableBilling =
|
|
3
|
+
exports.enableBilling = enableBilling;
|
|
4
4
|
const clc = require("colorette");
|
|
5
5
|
const opn = require("open");
|
|
6
6
|
const cloudbilling = require("../gcp/cloudbilling");
|
|
@@ -73,4 +73,3 @@ async function enableBilling(projectId) {
|
|
|
73
73
|
: setUpBillingAccount(projectId);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
exports.enableBilling = enableBilling;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.diagnose =
|
|
3
|
+
exports.diagnose = diagnose;
|
|
4
4
|
const extensionsHelper_1 = require("./extensionsHelper");
|
|
5
5
|
const getProjectNumber_1 = require("../getProjectNumber");
|
|
6
6
|
const utils = require("../utils");
|
|
@@ -50,4 +50,3 @@ async function diagnose(projectId) {
|
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
exports.diagnose = diagnose;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.displayExtensionVersionInfo = displayExtensionVersionInfo;
|
|
4
|
+
exports.displayExternalServices = displayExternalServices;
|
|
5
|
+
exports.displayEvents = displayEvents;
|
|
6
|
+
exports.displayResources = displayResources;
|
|
7
|
+
exports.retrieveRoleInfo = retrieveRoleInfo;
|
|
4
8
|
const clc = require("colorette");
|
|
5
9
|
const semver = require("semver");
|
|
6
10
|
const path = require("path");
|
|
@@ -12,13 +16,12 @@ const secretsUtils_1 = require("./secretsUtils");
|
|
|
12
16
|
const TASKS_ROLE = "cloudtasks.enqueuer";
|
|
13
17
|
const TASKS_API = "cloudtasks.googleapis.com";
|
|
14
18
|
async function displayExtensionVersionInfo(args) {
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
16
19
|
const { spec, extensionVersion, latestApprovedVersion, latestVersion } = args;
|
|
17
20
|
const lines = [];
|
|
18
21
|
const extensionRef = extensionVersion
|
|
19
|
-
? refs.toExtensionRef(refs.parse(extensionVersion
|
|
22
|
+
? refs.toExtensionRef(refs.parse(extensionVersion?.ref))
|
|
20
23
|
: "";
|
|
21
|
-
lines.push(`${clc.bold("Extension:")} ${
|
|
24
|
+
lines.push(`${clc.bold("Extension:")} ${spec.displayName ?? "Unnamed extension"} ${extensionRef ? `(${extensionRef})` : ""}`);
|
|
22
25
|
if (spec.description) {
|
|
23
26
|
lines.push(`${clc.bold("Description:")} ${spec.description}`);
|
|
24
27
|
}
|
|
@@ -27,13 +30,13 @@ async function displayExtensionVersionInfo(args) {
|
|
|
27
30
|
if (latestRelevantVersion && semver.eq(spec.version, latestRelevantVersion)) {
|
|
28
31
|
versionNote = `- ${clc.green("Latest")}`;
|
|
29
32
|
}
|
|
30
|
-
if (
|
|
33
|
+
if (extensionVersion?.state === "DEPRECATED") {
|
|
31
34
|
versionNote = `- ${clc.red("Deprecated")}`;
|
|
32
35
|
}
|
|
33
36
|
lines.push(`${clc.bold("Version:")} ${spec.version} ${versionNote}`);
|
|
34
37
|
if (extensionVersion) {
|
|
35
38
|
let reviewStatus;
|
|
36
|
-
switch (
|
|
39
|
+
switch (extensionVersion.listing?.state) {
|
|
37
40
|
case "APPROVED":
|
|
38
41
|
reviewStatus = clc.bold(clc.green("Accepted"));
|
|
39
42
|
break;
|
|
@@ -49,19 +52,19 @@ async function displayExtensionVersionInfo(args) {
|
|
|
49
52
|
}
|
|
50
53
|
if (extensionVersion.buildSourceUri) {
|
|
51
54
|
const buildSourceUri = new URL(extensionVersion.buildSourceUri);
|
|
52
|
-
buildSourceUri.pathname = path.join(buildSourceUri.pathname,
|
|
55
|
+
buildSourceUri.pathname = path.join(buildSourceUri.pathname, extensionVersion.extensionRoot ?? "");
|
|
53
56
|
lines.push(`${clc.bold("Source in GitHub:")} ${buildSourceUri.toString()}`);
|
|
54
57
|
}
|
|
55
58
|
else {
|
|
56
|
-
lines.push(`${clc.bold("Source download URI:")} ${
|
|
59
|
+
lines.push(`${clc.bold("Source download URI:")} ${extensionVersion.sourceDownloadUri ?? "-"}`);
|
|
57
60
|
}
|
|
58
61
|
}
|
|
59
|
-
lines.push(`${clc.bold("License:")} ${
|
|
62
|
+
lines.push(`${clc.bold("License:")} ${spec.license ?? "-"}`);
|
|
60
63
|
lines.push(displayResources(spec));
|
|
61
|
-
if (
|
|
64
|
+
if (spec.events?.length) {
|
|
62
65
|
lines.push(displayEvents(spec));
|
|
63
66
|
}
|
|
64
|
-
if (
|
|
67
|
+
if (spec.externalServices?.length) {
|
|
65
68
|
lines.push(displayExternalServices(spec));
|
|
66
69
|
}
|
|
67
70
|
const apis = impliedApis(spec);
|
|
@@ -75,25 +78,19 @@ async function displayExtensionVersionInfo(args) {
|
|
|
75
78
|
logger_1.logger.info(`\n${lines.join("\n")}`);
|
|
76
79
|
return lines;
|
|
77
80
|
}
|
|
78
|
-
exports.displayExtensionVersionInfo = displayExtensionVersionInfo;
|
|
79
81
|
function displayExternalServices(spec) {
|
|
80
|
-
|
|
81
|
-
const lines = (_b = (_a = spec.externalServices) === null || _a === void 0 ? void 0 : _a.map((service) => {
|
|
82
|
+
const lines = spec.externalServices?.map((service) => {
|
|
82
83
|
return ` - ${clc.cyan(`${service.name} (${service.pricingUri})`)}`;
|
|
83
|
-
})
|
|
84
|
+
}) ?? [];
|
|
84
85
|
return clc.bold("External services used:\n") + lines.join("\n");
|
|
85
86
|
}
|
|
86
|
-
exports.displayExternalServices = displayExternalServices;
|
|
87
87
|
function displayEvents(spec) {
|
|
88
|
-
|
|
89
|
-
const lines = (_b = (_a = spec.events) === null || _a === void 0 ? void 0 : _a.map((event) => {
|
|
88
|
+
const lines = spec.events?.map((event) => {
|
|
90
89
|
return ` - ${clc.magenta(event.type)}${event.description ? `: ${event.description}` : ""}`;
|
|
91
|
-
})
|
|
90
|
+
}) ?? [];
|
|
92
91
|
return clc.bold("Events emitted:\n") + lines.join("\n");
|
|
93
92
|
}
|
|
94
|
-
exports.displayEvents = displayEvents;
|
|
95
93
|
function displayResources(spec) {
|
|
96
|
-
var _a;
|
|
97
94
|
const lines = spec.resources.map((resource) => {
|
|
98
95
|
let type = resource.type;
|
|
99
96
|
switch (resource.type) {
|
|
@@ -107,7 +104,7 @@ function displayResources(spec) {
|
|
|
107
104
|
}
|
|
108
105
|
return ` - ${clc.blueBright(`${resource.name} (${type})`)}${resource.description ? `: ${resource.description}` : ""}`;
|
|
109
106
|
});
|
|
110
|
-
lines.push(...new Set(
|
|
107
|
+
lines.push(...new Set(spec.lifecycleEvents?.map((event) => {
|
|
111
108
|
return ` - ${clc.blueBright(`${event.taskQueueTriggerFunction} (Cloud Task queue)`)}`;
|
|
112
109
|
})));
|
|
113
110
|
lines.push(...spec.params
|
|
@@ -119,12 +116,10 @@ function displayResources(spec) {
|
|
|
119
116
|
}));
|
|
120
117
|
return clc.bold("Resources created:\n") + (lines.length ? lines.join("\n") : " - None");
|
|
121
118
|
}
|
|
122
|
-
exports.displayResources = displayResources;
|
|
123
119
|
async function retrieveRoleInfo(role) {
|
|
124
120
|
const res = await iam.getRole(role);
|
|
125
121
|
return ` - ${clc.yellow(res.title || res.name)}${res.description ? `: ${res.description}` : ""}`;
|
|
126
122
|
}
|
|
127
|
-
exports.retrieveRoleInfo = retrieveRoleInfo;
|
|
128
123
|
async function displayRoles(roles) {
|
|
129
124
|
const lines = await Promise.all(roles.map((role) => {
|
|
130
125
|
return retrieveRoleInfo(role.role);
|
|
@@ -138,33 +133,31 @@ function displayApis(apis) {
|
|
|
138
133
|
return clc.bold("APIs used:\n") + lines.join("\n");
|
|
139
134
|
}
|
|
140
135
|
function usesTasks(spec) {
|
|
141
|
-
return spec.resources.some((r) =>
|
|
136
|
+
return spec.resources.some((r) => r.type === types_1.FUNCTIONS_RESOURCE_TYPE && r.properties?.taskQueueTrigger !== undefined);
|
|
142
137
|
}
|
|
143
138
|
function impliedRoles(spec) {
|
|
144
|
-
var _a, _b, _c;
|
|
145
139
|
const roles = [];
|
|
146
|
-
if ((0, secretsUtils_1.usesSecrets)(spec) && !
|
|
140
|
+
if ((0, secretsUtils_1.usesSecrets)(spec) && !spec.roles?.some((r) => r.role === secretsUtils_1.SECRET_ROLE)) {
|
|
147
141
|
roles.push({
|
|
148
142
|
role: secretsUtils_1.SECRET_ROLE,
|
|
149
143
|
reason: "Allows the extension to read secret values from Cloud Secret Manager.",
|
|
150
144
|
});
|
|
151
145
|
}
|
|
152
|
-
if (usesTasks(spec) && !
|
|
146
|
+
if (usesTasks(spec) && !spec.roles?.some((r) => r.role === TASKS_ROLE)) {
|
|
153
147
|
roles.push({
|
|
154
148
|
role: TASKS_ROLE,
|
|
155
149
|
reason: "Allows the extension to enqueue Cloud Tasks.",
|
|
156
150
|
});
|
|
157
151
|
}
|
|
158
|
-
return roles.concat(
|
|
152
|
+
return roles.concat(spec.roles ?? []);
|
|
159
153
|
}
|
|
160
154
|
function impliedApis(spec) {
|
|
161
|
-
var _a, _b;
|
|
162
155
|
const apis = [];
|
|
163
|
-
if (usesTasks(spec) && !
|
|
156
|
+
if (usesTasks(spec) && !spec.apis?.some((a) => a.apiName === TASKS_API)) {
|
|
164
157
|
apis.push({
|
|
165
158
|
apiName: TASKS_API,
|
|
166
159
|
reason: "Allows the extension to enqueue Cloud Tasks.",
|
|
167
160
|
});
|
|
168
161
|
}
|
|
169
|
-
return apis.concat(
|
|
162
|
+
return apis.concat(spec.apis ?? []);
|
|
170
163
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getExtensionFunctionInfo = getExtensionFunctionInfo;
|
|
4
|
+
exports.getNonSecretEnv = getNonSecretEnv;
|
|
5
|
+
exports.getSecretEnvVars = getSecretEnvVars;
|
|
6
|
+
exports.getParams = getParams;
|
|
4
7
|
const paramHelper = require("../paramHelper");
|
|
5
8
|
const specHelper = require("./specHelper");
|
|
6
9
|
const triggerHelper = require("./triggerHelper");
|
|
@@ -9,7 +12,6 @@ const extensionsHelper = require("../extensionsHelper");
|
|
|
9
12
|
const planner = require("../../deploy/extensions/planner");
|
|
10
13
|
const projectUtils_1 = require("../../projectUtils");
|
|
11
14
|
async function getExtensionFunctionInfo(instance, paramValues) {
|
|
12
|
-
var _a, _b;
|
|
13
15
|
const spec = await planner.getExtensionSpec(instance);
|
|
14
16
|
const functionResources = specHelper.getFunctionResourcesWithParamSubstitution(spec, paramValues);
|
|
15
17
|
const extensionTriggers = functionResources
|
|
@@ -19,8 +21,8 @@ async function getExtensionFunctionInfo(instance, paramValues) {
|
|
|
19
21
|
return trigger;
|
|
20
22
|
});
|
|
21
23
|
const runtime = specHelper.getRuntime(functionResources);
|
|
22
|
-
const nonSecretEnv = getNonSecretEnv(
|
|
23
|
-
const secretEnvVariables = getSecretEnvVars(
|
|
24
|
+
const nonSecretEnv = getNonSecretEnv(spec.params ?? [], paramValues);
|
|
25
|
+
const secretEnvVariables = getSecretEnvVars(spec.params ?? [], paramValues);
|
|
24
26
|
return {
|
|
25
27
|
extensionTriggers,
|
|
26
28
|
runtime,
|
|
@@ -28,7 +30,6 @@ async function getExtensionFunctionInfo(instance, paramValues) {
|
|
|
28
30
|
secretEnvVariables,
|
|
29
31
|
};
|
|
30
32
|
}
|
|
31
|
-
exports.getExtensionFunctionInfo = getExtensionFunctionInfo;
|
|
32
33
|
const isSecretParam = (p) => p.type === extensionsHelper.SpecParamType.SECRET || p.type === types_1.ParamType.SECRET;
|
|
33
34
|
function getNonSecretEnv(params, paramValues) {
|
|
34
35
|
const getNonSecretEnv = Object.assign({}, paramValues);
|
|
@@ -38,7 +39,6 @@ function getNonSecretEnv(params, paramValues) {
|
|
|
38
39
|
}
|
|
39
40
|
return getNonSecretEnv;
|
|
40
41
|
}
|
|
41
|
-
exports.getNonSecretEnv = getNonSecretEnv;
|
|
42
42
|
function getSecretEnvVars(params, paramValues) {
|
|
43
43
|
const secretEnvVar = [];
|
|
44
44
|
const secretParams = params.filter(isSecretParam);
|
|
@@ -55,7 +55,6 @@ function getSecretEnvVars(params, paramValues) {
|
|
|
55
55
|
}
|
|
56
56
|
return secretEnvVar;
|
|
57
57
|
}
|
|
58
|
-
exports.getSecretEnvVars = getSecretEnvVars;
|
|
59
58
|
function getParams(options, extensionSpec) {
|
|
60
59
|
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
61
60
|
const userParams = paramHelper.readEnvFile(options.testParams);
|
|
@@ -70,4 +69,3 @@ function getParams(options, extensionSpec) {
|
|
|
70
69
|
const unsubbedParams = extensionsHelper.populateDefaultParams(unsubbedParamsWithoutDefaults, extensionSpec.params);
|
|
71
70
|
return extensionsHelper.substituteParams(unsubbedParams, unsubbedParams);
|
|
72
71
|
}
|
|
73
|
-
exports.getParams = getParams;
|