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
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.API_VERSION = void 0;
|
|
4
|
+
exports.generateUploadUrl = generateUploadUrl;
|
|
5
|
+
exports.createFunction = createFunction;
|
|
6
|
+
exports.getFunction = getFunction;
|
|
7
|
+
exports.listAllFunctions = listAllFunctions;
|
|
8
|
+
exports.updateFunction = updateFunction;
|
|
9
|
+
exports.deleteFunction = deleteFunction;
|
|
10
|
+
exports.functionFromEndpoint = functionFromEndpoint;
|
|
11
|
+
exports.endpointFromFunction = endpointFromFunction;
|
|
4
12
|
const apiv2_1 = require("../apiv2");
|
|
5
13
|
const error_1 = require("../error");
|
|
6
14
|
const api_1 = require("../api");
|
|
@@ -22,34 +30,33 @@ const client = new apiv2_1.Client({
|
|
|
22
30
|
apiVersion: exports.API_VERSION,
|
|
23
31
|
});
|
|
24
32
|
function functionsOpLogReject(func, type, err) {
|
|
25
|
-
|
|
26
|
-
if ((_a = err === null || err === void 0 ? void 0 : err.message) === null || _a === void 0 ? void 0 : _a.includes("Runtime validation errors")) {
|
|
33
|
+
if (err?.message?.includes("Runtime validation errors")) {
|
|
27
34
|
const capturedMessage = (0, cloudfunctions_1.captureRuntimeValidationError)(err.message);
|
|
28
35
|
utils.logLabeledWarning("functions", capturedMessage + " for function " + func.name);
|
|
29
36
|
}
|
|
30
|
-
if (
|
|
37
|
+
if (err?.message?.includes("maxScale may not exceed")) {
|
|
31
38
|
const maxInstances = func.serviceConfig.maxInstanceCount || DEFAULT_MAX_INSTANCE_COUNT;
|
|
32
39
|
utils.logLabeledWarning("functions", `Your current project quotas don't allow for the current max instances setting of ${maxInstances}. ` +
|
|
33
40
|
"Either reduce this function's maximum instances, or request a quota increase on the underlying Cloud Run service " +
|
|
34
41
|
"at https://cloud.google.com/run/quotas.");
|
|
35
|
-
const suggestedFix =
|
|
42
|
+
const suggestedFix = func.buildConfig.runtime?.startsWith("python")
|
|
36
43
|
? "firebase_functions.options.set_global_options(max_instances=10)"
|
|
37
44
|
: "setGlobalOptions({maxInstances: 10})";
|
|
38
45
|
utils.logLabeledWarning("functions", `You can adjust the max instances value in your function's runtime options:\n\t${suggestedFix}`);
|
|
39
46
|
}
|
|
40
47
|
else {
|
|
41
|
-
utils.logLabeledWarning("functions", `${err
|
|
42
|
-
if (
|
|
48
|
+
utils.logLabeledWarning("functions", `${err?.message}`);
|
|
49
|
+
if (err?.context?.response?.statusCode === 429) {
|
|
43
50
|
utils.logLabeledWarning("functions", `Got "Quota Exceeded" error while trying to ${type} ${func.name}. Waiting to retry...`);
|
|
44
51
|
}
|
|
45
|
-
else if (
|
|
52
|
+
else if (err?.message?.includes("If you recently started to use Eventarc, it may take a few minutes before all necessary permissions are propagated to the Service Agent")) {
|
|
46
53
|
utils.logLabeledWarning("functions", `Since this is your first time using 2nd gen functions, we need a little bit longer to finish setting everything up. Retry the deployment in a few minutes.`);
|
|
47
54
|
}
|
|
48
55
|
utils.logLabeledWarning("functions", ` failed to ${type} function ${func.name}`);
|
|
49
56
|
}
|
|
50
57
|
throw new error_1.FirebaseError(`Failed to ${type} function ${func.name}`, {
|
|
51
58
|
original: err,
|
|
52
|
-
status:
|
|
59
|
+
status: err?.context?.response?.statusCode,
|
|
53
60
|
context: { function: func.name },
|
|
54
61
|
});
|
|
55
62
|
}
|
|
@@ -63,12 +70,18 @@ async function generateUploadUrl(projectId, location) {
|
|
|
63
70
|
throw err;
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
|
-
exports.generateUploadUrl = generateUploadUrl;
|
|
67
73
|
async function createFunction(cloudFunction) {
|
|
68
74
|
const components = cloudFunction.name.split("/");
|
|
69
75
|
const functionId = components.splice(-1, 1)[0];
|
|
70
|
-
cloudFunction.buildConfig.environmentVariables =
|
|
71
|
-
|
|
76
|
+
cloudFunction.buildConfig.environmentVariables = {
|
|
77
|
+
...cloudFunction.buildConfig.environmentVariables,
|
|
78
|
+
GOOGLE_NODE_RUN_SCRIPTS: "",
|
|
79
|
+
};
|
|
80
|
+
cloudFunction.serviceConfig.environmentVariables = {
|
|
81
|
+
...cloudFunction.serviceConfig.environmentVariables,
|
|
82
|
+
FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."),
|
|
83
|
+
LOG_EXECUTION_ID: "true",
|
|
84
|
+
};
|
|
72
85
|
try {
|
|
73
86
|
const res = await client.post(components.join("/"), cloudFunction, { queryParams: { functionId } });
|
|
74
87
|
return res.body;
|
|
@@ -77,17 +90,14 @@ async function createFunction(cloudFunction) {
|
|
|
77
90
|
throw functionsOpLogReject(cloudFunction, "create", err);
|
|
78
91
|
}
|
|
79
92
|
}
|
|
80
|
-
exports.createFunction = createFunction;
|
|
81
93
|
async function getFunction(projectId, location, functionId) {
|
|
82
94
|
const name = `projects/${projectId}/locations/${location}/functions/${functionId}`;
|
|
83
95
|
const res = await client.get(name);
|
|
84
96
|
return res.body;
|
|
85
97
|
}
|
|
86
|
-
exports.getFunction = getFunction;
|
|
87
98
|
async function listAllFunctions(projectId) {
|
|
88
99
|
return await listFunctionsInternal(projectId, "-");
|
|
89
100
|
}
|
|
90
|
-
exports.listAllFunctions = listAllFunctions;
|
|
91
101
|
async function listFunctionsInternal(projectId, region) {
|
|
92
102
|
const functions = [];
|
|
93
103
|
const unreacahble = new Set();
|
|
@@ -96,7 +106,7 @@ async function listFunctionsInternal(projectId, region) {
|
|
|
96
106
|
const url = `projects/${projectId}/locations/${region}/functions`;
|
|
97
107
|
const opts = { queryParams: { filter: `environment="GEN_2"` } };
|
|
98
108
|
if (pageToken !== "") {
|
|
99
|
-
opts.queryParams =
|
|
109
|
+
opts.queryParams = { ...opts.queryParams, pageToken };
|
|
100
110
|
}
|
|
101
111
|
const res = await client.get(url, opts);
|
|
102
112
|
functions.push(...(res.body.functions || []));
|
|
@@ -113,8 +123,15 @@ async function listFunctionsInternal(projectId, region) {
|
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
async function updateFunction(cloudFunction) {
|
|
116
|
-
cloudFunction.buildConfig.environmentVariables =
|
|
117
|
-
|
|
126
|
+
cloudFunction.buildConfig.environmentVariables = {
|
|
127
|
+
...cloudFunction.buildConfig.environmentVariables,
|
|
128
|
+
GOOGLE_NODE_RUN_SCRIPTS: "",
|
|
129
|
+
};
|
|
130
|
+
cloudFunction.serviceConfig.environmentVariables = {
|
|
131
|
+
...cloudFunction.serviceConfig.environmentVariables,
|
|
132
|
+
FUNCTION_TARGET: cloudFunction.buildConfig.entryPoint.replaceAll("-", "."),
|
|
133
|
+
LOG_EXECUTION_ID: "true",
|
|
134
|
+
};
|
|
118
135
|
const fieldMasks = proto.fieldMasks(cloudFunction, "labels", "serviceConfig.environmentVariables", "serviceConfig.secretEnvironmentVariables", "buildConfig.environmentVariables");
|
|
119
136
|
try {
|
|
120
137
|
const queryParams = {
|
|
@@ -127,7 +144,6 @@ async function updateFunction(cloudFunction) {
|
|
|
127
144
|
throw functionsOpLogReject(cloudFunction, "update", err);
|
|
128
145
|
}
|
|
129
146
|
}
|
|
130
|
-
exports.updateFunction = updateFunction;
|
|
131
147
|
async function deleteFunction(cloudFunction) {
|
|
132
148
|
try {
|
|
133
149
|
const res = await client.delete(cloudFunction);
|
|
@@ -137,9 +153,7 @@ async function deleteFunction(cloudFunction) {
|
|
|
137
153
|
throw functionsOpLogReject({ name: cloudFunction }, "update", err);
|
|
138
154
|
}
|
|
139
155
|
}
|
|
140
|
-
exports.deleteFunction = deleteFunction;
|
|
141
156
|
function functionFromEndpoint(endpoint) {
|
|
142
|
-
var _a, _b, _c;
|
|
143
157
|
if (endpoint.platform !== "gcfv2") {
|
|
144
158
|
throw new error_1.FirebaseError("Trying to create a v2 CloudFunction with v1 API. This should never happen");
|
|
145
159
|
}
|
|
@@ -153,7 +167,7 @@ function functionFromEndpoint(endpoint) {
|
|
|
153
167
|
runtime: endpoint.runtime || undefined,
|
|
154
168
|
entryPoint: endpoint.entryPoint,
|
|
155
169
|
source: {
|
|
156
|
-
storageSource:
|
|
170
|
+
storageSource: endpoint.source?.storageSource,
|
|
157
171
|
},
|
|
158
172
|
environmentVariables: {},
|
|
159
173
|
},
|
|
@@ -189,7 +203,7 @@ function functionFromEndpoint(endpoint) {
|
|
|
189
203
|
gcfFunction.eventTrigger.serviceAccountEmail = gcfFunction.serviceConfig.serviceAccountEmail;
|
|
190
204
|
}
|
|
191
205
|
if (gcfFunction.eventTrigger.eventType === v2_1.PUBSUB_PUBLISH_EVENT) {
|
|
192
|
-
if (!
|
|
206
|
+
if (!endpoint.eventTrigger.eventFilters?.topic) {
|
|
193
207
|
throw new error_1.FirebaseError("Error: Pub/Sub event trigger is missing topic: " +
|
|
194
208
|
JSON.stringify(endpoint.eventTrigger, null, 2));
|
|
195
209
|
}
|
|
@@ -219,56 +233,74 @@ function functionFromEndpoint(endpoint) {
|
|
|
219
233
|
endpoint.eventTrigger.retry
|
|
220
234
|
? (gcfFunction.eventTrigger.retryPolicy = "RETRY_POLICY_RETRY")
|
|
221
235
|
: (gcfFunction.eventTrigger.retryPolicy = "RETRY_POLICY_DO_NOT_RETRY");
|
|
222
|
-
gcfFunction.serviceConfig.environmentVariables =
|
|
236
|
+
gcfFunction.serviceConfig.environmentVariables = {
|
|
237
|
+
...gcfFunction.serviceConfig.environmentVariables,
|
|
238
|
+
FUNCTION_SIGNATURE_TYPE: "cloudevent",
|
|
239
|
+
};
|
|
223
240
|
}
|
|
224
241
|
else if (backend.isScheduleTriggered(endpoint)) {
|
|
225
|
-
gcfFunction.labels =
|
|
242
|
+
gcfFunction.labels = { ...gcfFunction.labels, "deployment-scheduled": "true" };
|
|
226
243
|
}
|
|
227
244
|
else if (backend.isTaskQueueTriggered(endpoint)) {
|
|
228
|
-
gcfFunction.labels =
|
|
245
|
+
gcfFunction.labels = { ...gcfFunction.labels, "deployment-taskqueue": "true" };
|
|
229
246
|
}
|
|
230
247
|
else if (backend.isCallableTriggered(endpoint)) {
|
|
231
|
-
gcfFunction.labels =
|
|
248
|
+
gcfFunction.labels = { ...gcfFunction.labels, "deployment-callable": "true" };
|
|
232
249
|
if (endpoint.callableTrigger.genkitAction) {
|
|
233
250
|
gcfFunction.labels["genkit-action"] = "true";
|
|
234
251
|
}
|
|
235
252
|
}
|
|
253
|
+
else if (backend.isDataConnectGraphqlTriggered(endpoint)) {
|
|
254
|
+
gcfFunction.labels = { ...gcfFunction.labels, "deployment-fdcgraphql": "true" };
|
|
255
|
+
}
|
|
236
256
|
else if (backend.isBlockingTriggered(endpoint)) {
|
|
237
|
-
gcfFunction.labels =
|
|
257
|
+
gcfFunction.labels = {
|
|
258
|
+
...gcfFunction.labels,
|
|
259
|
+
[constants_1.BLOCKING_LABEL]: constants_1.BLOCKING_EVENT_TO_LABEL_KEY[endpoint.blockingTrigger.eventType],
|
|
260
|
+
};
|
|
238
261
|
}
|
|
239
262
|
const codebase = endpoint.codebase || projectConfig.DEFAULT_CODEBASE;
|
|
240
263
|
if (codebase !== projectConfig.DEFAULT_CODEBASE) {
|
|
241
|
-
gcfFunction.labels =
|
|
264
|
+
gcfFunction.labels = {
|
|
265
|
+
...gcfFunction.labels,
|
|
266
|
+
[constants_1.CODEBASE_LABEL]: codebase,
|
|
267
|
+
};
|
|
242
268
|
}
|
|
243
269
|
else {
|
|
244
|
-
|
|
270
|
+
delete gcfFunction.labels?.[constants_1.CODEBASE_LABEL];
|
|
245
271
|
}
|
|
246
272
|
if (endpoint.hash) {
|
|
247
|
-
gcfFunction.labels =
|
|
273
|
+
gcfFunction.labels = {
|
|
274
|
+
...gcfFunction.labels,
|
|
275
|
+
[constants_1.HASH_LABEL]: endpoint.hash,
|
|
276
|
+
};
|
|
248
277
|
}
|
|
249
278
|
return gcfFunction;
|
|
250
279
|
}
|
|
251
|
-
exports.functionFromEndpoint = functionFromEndpoint;
|
|
252
280
|
function endpointFromFunction(gcfFunction) {
|
|
253
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
254
281
|
const [, project, , region, , id] = gcfFunction.name.split("/");
|
|
255
282
|
let trigger;
|
|
256
|
-
if (
|
|
283
|
+
if (gcfFunction.labels?.["deployment-scheduled"] === "true") {
|
|
257
284
|
trigger = {
|
|
258
285
|
scheduleTrigger: {},
|
|
259
286
|
};
|
|
260
287
|
}
|
|
261
|
-
else if (
|
|
288
|
+
else if (gcfFunction.labels?.["deployment-taskqueue"] === "true") {
|
|
262
289
|
trigger = {
|
|
263
290
|
taskQueueTrigger: {},
|
|
264
291
|
};
|
|
265
292
|
}
|
|
266
|
-
else if (
|
|
293
|
+
else if (gcfFunction.labels?.["deployment-callable"] === "true") {
|
|
267
294
|
trigger = {
|
|
268
295
|
callableTrigger: {},
|
|
269
296
|
};
|
|
270
297
|
}
|
|
271
|
-
else if (
|
|
298
|
+
else if (gcfFunction.labels?.["deployment-fdcgraphql"] === "true") {
|
|
299
|
+
trigger = {
|
|
300
|
+
dataConnectGraphqlTrigger: {},
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
else if (gcfFunction.labels?.[constants_1.BLOCKING_LABEL]) {
|
|
272
304
|
trigger = {
|
|
273
305
|
blockingTrigger: {
|
|
274
306
|
eventType: constants_1.BLOCKING_LABEL_KEY_TO_EVENT[gcfFunction.labels[constants_1.BLOCKING_LABEL]],
|
|
@@ -310,12 +342,19 @@ function endpointFromFunction(gcfFunction) {
|
|
|
310
342
|
else {
|
|
311
343
|
trigger = { httpsTrigger: {} };
|
|
312
344
|
}
|
|
313
|
-
if (
|
|
345
|
+
if (gcfFunction.buildConfig?.runtime && !supported.isRuntime(gcfFunction.buildConfig.runtime)) {
|
|
314
346
|
logger_1.logger.debug("GCFv2 function has a deprecated runtime:", JSON.stringify(gcfFunction, null, 2));
|
|
315
347
|
}
|
|
316
|
-
const endpoint =
|
|
348
|
+
const endpoint = {
|
|
349
|
+
platform: "gcfv2",
|
|
350
|
+
id,
|
|
317
351
|
project,
|
|
318
|
-
region
|
|
352
|
+
region,
|
|
353
|
+
...trigger,
|
|
354
|
+
entryPoint: gcfFunction.buildConfig?.entryPoint || "",
|
|
355
|
+
runtime: gcfFunction.buildConfig?.runtime || undefined,
|
|
356
|
+
source: gcfFunction.buildConfig?.source,
|
|
357
|
+
};
|
|
319
358
|
if (gcfFunction.serviceConfig) {
|
|
320
359
|
proto.copyIfPresent(endpoint, gcfFunction.serviceConfig, "ingressSettings", "environmentVariables", "secretEnvironmentVariables", "timeoutSeconds", "uri");
|
|
321
360
|
proto.renameIfPresent(endpoint, gcfFunction.serviceConfig, "serviceAccount", "serviceAccountEmail");
|
|
@@ -355,11 +394,10 @@ function endpointFromFunction(gcfFunction) {
|
|
|
355
394
|
}
|
|
356
395
|
}
|
|
357
396
|
proto.renameIfPresent(endpoint, gcfFunction, "uri", "url");
|
|
358
|
-
endpoint.codebase =
|
|
359
|
-
if (
|
|
397
|
+
endpoint.codebase = gcfFunction.labels?.[constants_1.CODEBASE_LABEL] || projectConfig.DEFAULT_CODEBASE;
|
|
398
|
+
if (gcfFunction.labels?.[constants_1.HASH_LABEL]) {
|
|
360
399
|
endpoint.hash = gcfFunction.labels[constants_1.HASH_LABEL];
|
|
361
400
|
}
|
|
362
401
|
proto.copyIfPresent(endpoint, gcfFunction, "state");
|
|
363
402
|
return endpoint;
|
|
364
403
|
}
|
|
365
|
-
exports.endpointFromFunction = endpointFromFunction;
|
package/lib/gcp/cloudlogging.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listEntries =
|
|
3
|
+
exports.listEntries = listEntries;
|
|
4
4
|
const api_1 = require("../api");
|
|
5
5
|
const apiv2_1 = require("../apiv2");
|
|
6
6
|
const error_1 = require("../error");
|
|
7
7
|
const API_VERSION = "v2";
|
|
8
8
|
async function listEntries(projectId, filter, pageSize, order, pageToken) {
|
|
9
|
-
var _a;
|
|
10
9
|
const client = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudloggingOrigin)(), apiVersion: API_VERSION });
|
|
11
10
|
const body = {
|
|
12
11
|
resourceNames: [`projects/${projectId}`],
|
|
@@ -20,7 +19,7 @@ async function listEntries(projectId, filter, pageSize, order, pageToken) {
|
|
|
20
19
|
try {
|
|
21
20
|
const result = await client.post("/entries:list", body);
|
|
22
21
|
return {
|
|
23
|
-
entries:
|
|
22
|
+
entries: result.body.entries ?? [],
|
|
24
23
|
nextPageToken: result.body.nextPageToken,
|
|
25
24
|
};
|
|
26
25
|
}
|
|
@@ -30,4 +29,3 @@ async function listEntries(projectId, filter, pageSize, order, pageToken) {
|
|
|
30
29
|
});
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
exports.listEntries = listEntries;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ValueType = exports.Reducer = exports.MetricKind = exports.Aligner = exports.TimeSeriesView = exports.CLOUD_MONITORING_VERSION = void 0;
|
|
4
|
+
exports.queryTimeSeries = queryTimeSeries;
|
|
4
5
|
const api_1 = require("../api");
|
|
5
6
|
const apiv2_1 = require("../apiv2");
|
|
6
7
|
const error_1 = require("../error");
|
|
@@ -9,7 +10,7 @@ var TimeSeriesView;
|
|
|
9
10
|
(function (TimeSeriesView) {
|
|
10
11
|
TimeSeriesView["FULL"] = "FULL";
|
|
11
12
|
TimeSeriesView["HEADERS"] = "HEADERS";
|
|
12
|
-
})(TimeSeriesView
|
|
13
|
+
})(TimeSeriesView || (exports.TimeSeriesView = TimeSeriesView = {}));
|
|
13
14
|
var Aligner;
|
|
14
15
|
(function (Aligner) {
|
|
15
16
|
Aligner["ALIGN_NONE"] = "ALIGN_NONE";
|
|
@@ -25,14 +26,14 @@ var Aligner;
|
|
|
25
26
|
Aligner["ALIGN_STDDEV"] = "ALIGN_STDDEV";
|
|
26
27
|
Aligner["ALIGN_COUNT_TRUE"] = "ALIGN_COUNT_TRUE";
|
|
27
28
|
Aligner["ALIGN_FRACTION_TRUE"] = "ALIGN_FRACTION_TRUE";
|
|
28
|
-
})(Aligner
|
|
29
|
+
})(Aligner || (exports.Aligner = Aligner = {}));
|
|
29
30
|
var MetricKind;
|
|
30
31
|
(function (MetricKind) {
|
|
31
32
|
MetricKind["METRIC_KIND_UNSPECIFIED"] = "METRIC_KIND_UNSPECIFIED";
|
|
32
33
|
MetricKind["GAUGE"] = "GAUGE";
|
|
33
34
|
MetricKind["DELTA"] = "DELTA";
|
|
34
35
|
MetricKind["CUMULATIVE"] = "CUMULATIVE";
|
|
35
|
-
})(MetricKind
|
|
36
|
+
})(MetricKind || (exports.MetricKind = MetricKind = {}));
|
|
36
37
|
var Reducer;
|
|
37
38
|
(function (Reducer) {
|
|
38
39
|
Reducer["REDUCE_NONE"] = "REDUCE_NONE";
|
|
@@ -48,7 +49,7 @@ var Reducer;
|
|
|
48
49
|
Reducer["REDUCE_PERCENTILE_95"] = "REDUCE_PERCENTILE_95";
|
|
49
50
|
Reducer["REDUCE_PERCENTILE_50"] = "REDUCE_PERCENTILE_50";
|
|
50
51
|
Reducer["REDUCE_PERCENTILE_05"] = "REDUCE_PERCENTILE_05";
|
|
51
|
-
})(Reducer
|
|
52
|
+
})(Reducer || (exports.Reducer = Reducer = {}));
|
|
52
53
|
var ValueType;
|
|
53
54
|
(function (ValueType) {
|
|
54
55
|
ValueType["VALUE_TYPE_UNSPECIFIED"] = "VALUE_TYPE_UNSPECIFIED";
|
|
@@ -56,7 +57,7 @@ var ValueType;
|
|
|
56
57
|
ValueType["INT64"] = "INT64";
|
|
57
58
|
ValueType["DOUBLE"] = "DOUBLE";
|
|
58
59
|
ValueType["STRING"] = "STRING";
|
|
59
|
-
})(ValueType
|
|
60
|
+
})(ValueType || (exports.ValueType = ValueType = {}));
|
|
60
61
|
async function queryTimeSeries(query, project) {
|
|
61
62
|
const client = new apiv2_1.Client({
|
|
62
63
|
urlPrefix: (0, api_1.cloudMonitoringOrigin)(),
|
|
@@ -74,4 +75,3 @@ async function queryTimeSeries(query, project) {
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
|
-
exports.queryTimeSeries = queryTimeSeries;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.deleteJob = deleteJob;
|
|
4
|
+
exports.getJob = getJob;
|
|
5
|
+
exports.createOrReplaceJob = createOrReplaceJob;
|
|
6
|
+
exports.jobNameForEndpoint = jobNameForEndpoint;
|
|
7
|
+
exports.topicNameForEndpoint = topicNameForEndpoint;
|
|
8
|
+
exports.jobFromEndpoint = jobFromEndpoint;
|
|
4
9
|
const _ = require("lodash");
|
|
5
10
|
const error_1 = require("../error");
|
|
6
11
|
const logger_1 = require("../logger");
|
|
@@ -18,29 +23,28 @@ const apiClient = new apiv2_1.Client({ urlPrefix: (0, api_1.cloudschedulerOrigin
|
|
|
18
23
|
function createJob(job) {
|
|
19
24
|
const strippedName = job.name.substring(0, job.name.lastIndexOf("/"));
|
|
20
25
|
const json = job.pubsubTarget
|
|
21
|
-
?
|
|
26
|
+
? { timeZone: DEFAULT_TIME_ZONE_V1, ...job }
|
|
27
|
+
: { timeZone: DEFAULT_TIME_ZONE_V2, ...job };
|
|
22
28
|
return apiClient.post(`/${strippedName}`, json);
|
|
23
29
|
}
|
|
24
30
|
function deleteJob(name) {
|
|
25
31
|
return apiClient.delete(`/${name}`);
|
|
26
32
|
}
|
|
27
|
-
exports.deleteJob = deleteJob;
|
|
28
33
|
function getJob(name) {
|
|
29
34
|
return apiClient.get(`/${name}`, {
|
|
30
35
|
resolveOnHTTPError: true,
|
|
31
36
|
});
|
|
32
37
|
}
|
|
33
|
-
exports.getJob = getJob;
|
|
34
38
|
function updateJob(job) {
|
|
35
39
|
let fieldMasks;
|
|
36
40
|
let json;
|
|
37
41
|
if (job.pubsubTarget) {
|
|
38
42
|
fieldMasks = proto.fieldMasks(job, "pubsubTarget");
|
|
39
|
-
json =
|
|
43
|
+
json = { timeZone: DEFAULT_TIME_ZONE_V1, ...job };
|
|
40
44
|
}
|
|
41
45
|
else {
|
|
42
46
|
fieldMasks = proto.fieldMasks(job, "httpTarget");
|
|
43
|
-
json =
|
|
47
|
+
json = { timeZone: DEFAULT_TIME_ZONE_V2, ...job };
|
|
44
48
|
}
|
|
45
49
|
return apiClient.patch(`/${job.name}`, json, {
|
|
46
50
|
queryParams: {
|
|
@@ -49,7 +53,6 @@ function updateJob(job) {
|
|
|
49
53
|
});
|
|
50
54
|
}
|
|
51
55
|
async function createOrReplaceJob(job) {
|
|
52
|
-
var _a, _b;
|
|
53
56
|
const jobName = job.name.split("/").pop();
|
|
54
57
|
const existingJob = await getJob(job.name);
|
|
55
58
|
if (existingJob.status === 404) {
|
|
@@ -58,7 +61,7 @@ async function createOrReplaceJob(job) {
|
|
|
58
61
|
newJob = await createJob(job);
|
|
59
62
|
}
|
|
60
63
|
catch (err) {
|
|
61
|
-
if (
|
|
64
|
+
if (err?.context?.response?.statusCode === 404) {
|
|
62
65
|
throw new error_1.FirebaseError(`Cloud resource location is not set for this project but scheduled functions require it. ` +
|
|
63
66
|
`Please see this documentation for more details: https://firebase.google.com/docs/projects/locations.`);
|
|
64
67
|
}
|
|
@@ -78,7 +81,6 @@ async function createOrReplaceJob(job) {
|
|
|
78
81
|
logger_1.logger.debug(`updated scheduler job ${jobName}`);
|
|
79
82
|
return updatedJob;
|
|
80
83
|
}
|
|
81
|
-
exports.createOrReplaceJob = createOrReplaceJob;
|
|
82
84
|
function needUpdate(existingJob, newJob) {
|
|
83
85
|
if (!existingJob) {
|
|
84
86
|
return true;
|
|
@@ -109,14 +111,11 @@ function jobNameForEndpoint(endpoint, location) {
|
|
|
109
111
|
const id = backend.scheduleIdForFunction(endpoint);
|
|
110
112
|
return `projects/${endpoint.project}/locations/${location}/jobs/${id}`;
|
|
111
113
|
}
|
|
112
|
-
exports.jobNameForEndpoint = jobNameForEndpoint;
|
|
113
114
|
function topicNameForEndpoint(endpoint) {
|
|
114
115
|
const id = backend.scheduleIdForFunction(endpoint);
|
|
115
116
|
return `projects/${endpoint.project}/topics/${id}`;
|
|
116
117
|
}
|
|
117
|
-
exports.topicNameForEndpoint = topicNameForEndpoint;
|
|
118
118
|
async function jobFromEndpoint(endpoint, location, projectNumber) {
|
|
119
|
-
var _a;
|
|
120
119
|
const job = {};
|
|
121
120
|
job.name = jobNameForEndpoint(endpoint, location);
|
|
122
121
|
if (endpoint.platform === "gcfv1") {
|
|
@@ -134,7 +133,7 @@ async function jobFromEndpoint(endpoint, location, projectNumber) {
|
|
|
134
133
|
uri: endpoint.uri,
|
|
135
134
|
httpMethod: "POST",
|
|
136
135
|
oidcToken: {
|
|
137
|
-
serviceAccountEmail:
|
|
136
|
+
serviceAccountEmail: endpoint.serviceAccount ?? (await gce.getDefaultServiceAccount(projectNumber)),
|
|
138
137
|
},
|
|
139
138
|
};
|
|
140
139
|
}
|
|
@@ -166,4 +165,3 @@ async function jobFromEndpoint(endpoint, location, projectNumber) {
|
|
|
166
165
|
}
|
|
167
166
|
return job;
|
|
168
167
|
}
|
|
169
|
-
exports.jobFromEndpoint = jobFromEndpoint;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_DATABASE_VERSION = void 0;
|
|
4
|
+
exports.iamUserIsCSQLAdmin = iamUserIsCSQLAdmin;
|
|
5
|
+
exports.listInstances = listInstances;
|
|
6
|
+
exports.getInstance = getInstance;
|
|
7
|
+
exports.instanceConsoleLink = instanceConsoleLink;
|
|
8
|
+
exports.createInstance = createInstance;
|
|
9
|
+
exports.updateInstanceForDataConnect = updateInstanceForDataConnect;
|
|
10
|
+
exports.listDatabases = listDatabases;
|
|
11
|
+
exports.getDatabase = getDatabase;
|
|
12
|
+
exports.createDatabase = createDatabase;
|
|
13
|
+
exports.deleteDatabase = deleteDatabase;
|
|
14
|
+
exports.createUser = createUser;
|
|
15
|
+
exports.getUser = getUser;
|
|
16
|
+
exports.deleteUser = deleteUser;
|
|
17
|
+
exports.listUsers = listUsers;
|
|
4
18
|
const apiv2_1 = require("../../apiv2");
|
|
5
19
|
const api_1 = require("../../api");
|
|
6
20
|
const clc = require("colorette");
|
|
@@ -32,13 +46,10 @@ async function iamUserIsCSQLAdmin(options) {
|
|
|
32
46
|
return false;
|
|
33
47
|
}
|
|
34
48
|
}
|
|
35
|
-
exports.iamUserIsCSQLAdmin = iamUserIsCSQLAdmin;
|
|
36
49
|
async function listInstances(projectId) {
|
|
37
|
-
var _a;
|
|
38
50
|
const res = await client.get(`projects/${projectId}/instances`);
|
|
39
|
-
return
|
|
51
|
+
return res.body.items ?? [];
|
|
40
52
|
}
|
|
41
|
-
exports.listInstances = listInstances;
|
|
42
53
|
async function getInstance(projectId, instanceId) {
|
|
43
54
|
const res = await client.get(`projects/${projectId}/instances/${instanceId}`);
|
|
44
55
|
if (res.body.state === "FAILED") {
|
|
@@ -46,11 +57,9 @@ async function getInstance(projectId, instanceId) {
|
|
|
46
57
|
}
|
|
47
58
|
return res.body;
|
|
48
59
|
}
|
|
49
|
-
exports.getInstance = getInstance;
|
|
50
60
|
function instanceConsoleLink(projectId, instanceId) {
|
|
51
61
|
return `https://console.cloud.google.com/sql/instances/${instanceId}/overview?project=${projectId}`;
|
|
52
62
|
}
|
|
53
|
-
exports.instanceConsoleLink = instanceConsoleLink;
|
|
54
63
|
exports.DEFAULT_DATABASE_VERSION = "POSTGRES_17";
|
|
55
64
|
async function createInstance(args) {
|
|
56
65
|
const databaseFlags = [{ name: "cloudsql.iam_authentication", value: "on" }];
|
|
@@ -86,9 +95,7 @@ async function createInstance(args) {
|
|
|
86
95
|
throw err;
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
|
-
exports.createInstance = createInstance;
|
|
90
98
|
async function updateInstanceForDataConnect(instance, enableGoogleMlIntegration) {
|
|
91
|
-
var _a, _b;
|
|
92
99
|
let dbFlags = setDatabaseFlag({ name: "cloudsql.iam_authentication", value: "on" }, instance.settings.databaseFlags);
|
|
93
100
|
if (enableGoogleMlIntegration) {
|
|
94
101
|
dbFlags = setDatabaseFlag({ name: "cloudsql.enable_google_ml_integration", value: "on" }, dbFlags);
|
|
@@ -96,7 +103,7 @@ async function updateInstanceForDataConnect(instance, enableGoogleMlIntegration)
|
|
|
96
103
|
const op = await client.patch(`projects/${instance.project}/instances/${instance.name}`, {
|
|
97
104
|
settings: {
|
|
98
105
|
ipConfiguration: {
|
|
99
|
-
enablePrivatePathForGoogleCloudServices: !!
|
|
106
|
+
enablePrivatePathForGoogleCloudServices: !!instance?.settings?.ipConfiguration?.privateNetwork,
|
|
100
107
|
},
|
|
101
108
|
databaseFlags: dbFlags,
|
|
102
109
|
enableGoogleMlIntegration,
|
|
@@ -112,7 +119,6 @@ async function updateInstanceForDataConnect(instance, enableGoogleMlIntegration)
|
|
|
112
119
|
});
|
|
113
120
|
return pollRes;
|
|
114
121
|
}
|
|
115
|
-
exports.updateInstanceForDataConnect = updateInstanceForDataConnect;
|
|
116
122
|
function handleAllowlistError(err, region) {
|
|
117
123
|
if (err.message.includes("Not allowed to set system label: firebase-data-connect")) {
|
|
118
124
|
throw new error_1.FirebaseError(`Cloud SQL free trial instances are not yet available in ${region}. Please check https://firebase.google.com/docs/data-connect/ for a full list of available regions.`);
|
|
@@ -127,12 +133,10 @@ async function listDatabases(projectId, instanceId) {
|
|
|
127
133
|
const res = await client.get(`projects/${projectId}/instances/${instanceId}/databases`);
|
|
128
134
|
return res.body.items;
|
|
129
135
|
}
|
|
130
|
-
exports.listDatabases = listDatabases;
|
|
131
136
|
async function getDatabase(projectId, instanceId, databaseId) {
|
|
132
137
|
const res = await client.get(`projects/${projectId}/instances/${instanceId}/databases/${databaseId}`);
|
|
133
138
|
return res.body;
|
|
134
139
|
}
|
|
135
|
-
exports.getDatabase = getDatabase;
|
|
136
140
|
async function createDatabase(projectId, instanceId, databaseId) {
|
|
137
141
|
const op = await client.post(`projects/${projectId}/instances/${instanceId}/databases`, {
|
|
138
142
|
project: projectId,
|
|
@@ -148,12 +152,10 @@ async function createDatabase(projectId, instanceId, databaseId) {
|
|
|
148
152
|
});
|
|
149
153
|
return pollRes;
|
|
150
154
|
}
|
|
151
|
-
exports.createDatabase = createDatabase;
|
|
152
155
|
async function deleteDatabase(projectId, instanceId, databaseId) {
|
|
153
156
|
const res = await client.delete(`projects/${projectId}/instances/${instanceId}/databases/${databaseId}`);
|
|
154
157
|
return res.body;
|
|
155
158
|
}
|
|
156
|
-
exports.deleteDatabase = deleteDatabase;
|
|
157
159
|
async function createUser(projectId, instanceId, type, username, password, retryTimeout) {
|
|
158
160
|
const maxRetries = 3;
|
|
159
161
|
let retries = 0;
|
|
@@ -183,7 +185,7 @@ async function createUser(projectId, instanceId, type, username, password, retry
|
|
|
183
185
|
if (builtinRoleNotReady(err.message) && retries < maxRetries) {
|
|
184
186
|
retries++;
|
|
185
187
|
await new Promise((resolve) => {
|
|
186
|
-
setTimeout(resolve, retryTimeout
|
|
188
|
+
setTimeout(resolve, retryTimeout ?? 1000 * retries);
|
|
187
189
|
});
|
|
188
190
|
}
|
|
189
191
|
else {
|
|
@@ -192,7 +194,6 @@ async function createUser(projectId, instanceId, type, username, password, retry
|
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
|
-
exports.createUser = createUser;
|
|
196
197
|
function builtinRoleNotReady(message) {
|
|
197
198
|
return message.includes("cloudsqliamuser");
|
|
198
199
|
}
|
|
@@ -200,7 +201,6 @@ async function getUser(projectId, instanceId, username) {
|
|
|
200
201
|
const res = await client.get(`projects/${projectId}/instances/${instanceId}/users/${username}`);
|
|
201
202
|
return res.body;
|
|
202
203
|
}
|
|
203
|
-
exports.getUser = getUser;
|
|
204
204
|
async function deleteUser(projectId, instanceId, username) {
|
|
205
205
|
const res = await client.delete(`projects/${projectId}/instances/${instanceId}/users`, {
|
|
206
206
|
queryParams: {
|
|
@@ -209,9 +209,7 @@ async function deleteUser(projectId, instanceId, username) {
|
|
|
209
209
|
});
|
|
210
210
|
return res.body;
|
|
211
211
|
}
|
|
212
|
-
exports.deleteUser = deleteUser;
|
|
213
212
|
async function listUsers(projectId, instanceId) {
|
|
214
213
|
const res = await client.get(`projects/${projectId}/instances/${instanceId}/users`);
|
|
215
214
|
return res.body.items;
|
|
216
215
|
}
|
|
217
|
-
exports.listUsers = listUsers;
|