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,11 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
|
-
var m = o[Symbol.asyncIterator], i;
|
|
5
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
6
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
7
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
8
|
-
};
|
|
9
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
3
|
exports.StorageLayer = exports.StoredFile = void 0;
|
|
11
4
|
const fs_1 = require("fs");
|
|
@@ -58,12 +51,11 @@ class StorageLayer {
|
|
|
58
51
|
return [...this._buckets.values()];
|
|
59
52
|
}
|
|
60
53
|
async getObject(request) {
|
|
61
|
-
var _a;
|
|
62
54
|
const metadata = this.getMetadata(request.bucketId, request.decodedObjectId);
|
|
63
|
-
const hasValidDownloadToken = (
|
|
55
|
+
const hasValidDownloadToken = (metadata?.downloadTokens || []).includes(request.downloadToken ?? "");
|
|
64
56
|
let authorized = hasValidDownloadToken;
|
|
65
57
|
if (!authorized) {
|
|
66
|
-
authorized = await this._rulesValidator.validate(["b", request.bucketId, "o", request.decodedObjectId].join("/"), request.bucketId, types_1.RulesetOperationMethod.GET, { before: metadata
|
|
58
|
+
authorized = await this._rulesValidator.validate(["b", request.bucketId, "o", request.decodedObjectId].join("/"), request.bucketId, types_1.RulesetOperationMethod.GET, { before: metadata?.asRulesResource() }, this._projectId, request.authorization);
|
|
67
59
|
}
|
|
68
60
|
if (!authorized) {
|
|
69
61
|
throw new errors_1.ForbiddenError("Failed auth");
|
|
@@ -92,7 +84,7 @@ class StorageLayer {
|
|
|
92
84
|
}
|
|
93
85
|
async deleteObject(request) {
|
|
94
86
|
const storedMetadata = this.getMetadata(request.bucketId, request.decodedObjectId);
|
|
95
|
-
const authorized = await this._rulesValidator.validate(["b", request.bucketId, "o", request.decodedObjectId].join("/"), request.bucketId, types_1.RulesetOperationMethod.DELETE, { before: storedMetadata
|
|
87
|
+
const authorized = await this._rulesValidator.validate(["b", request.bucketId, "o", request.decodedObjectId].join("/"), request.bucketId, types_1.RulesetOperationMethod.DELETE, { before: storedMetadata?.asRulesResource() }, this._projectId, request.authorization);
|
|
96
88
|
if (!authorized) {
|
|
97
89
|
throw new errors_1.ForbiddenError();
|
|
98
90
|
}
|
|
@@ -124,8 +116,8 @@ class StorageLayer {
|
|
|
124
116
|
async updateObjectMetadata(request) {
|
|
125
117
|
const storedMetadata = this.getMetadata(request.bucketId, request.decodedObjectId);
|
|
126
118
|
const authorized = await this._rulesValidator.validate(["b", request.bucketId, "o", request.decodedObjectId].join("/"), request.bucketId, types_1.RulesetOperationMethod.UPDATE, {
|
|
127
|
-
before: storedMetadata
|
|
128
|
-
after: storedMetadata
|
|
119
|
+
before: storedMetadata?.asRulesResource(),
|
|
120
|
+
after: storedMetadata?.asRulesResource(request.metadata),
|
|
129
121
|
}, this._projectId, request.authorization);
|
|
130
122
|
if (!authorized) {
|
|
131
123
|
throw new errors_1.ForbiddenError();
|
|
@@ -160,7 +152,7 @@ class StorageLayer {
|
|
|
160
152
|
customMetadata: getIncomingMetadata("metadata"),
|
|
161
153
|
}, this._cloudFunctions, this._persistence.readBytes(upload.path, upload.size));
|
|
162
154
|
const authorized = await this._rulesValidator.validate(["b", upload.bucketId, "o", upload.objectId].join("/"), upload.bucketId, types_1.RulesetOperationMethod.CREATE, {
|
|
163
|
-
before: storedMetadata
|
|
155
|
+
before: storedMetadata?.asRulesResource(),
|
|
164
156
|
after: metadata.asRulesResource(),
|
|
165
157
|
}, this._projectId, upload.authorization);
|
|
166
158
|
if (!authorized) {
|
|
@@ -185,9 +177,13 @@ class StorageLayer {
|
|
|
185
177
|
const destinationFilePath = this.path(destinationBucket, destinationObject);
|
|
186
178
|
this._persistence.deleteFile(destinationFilePath, true);
|
|
187
179
|
this._persistence.appendBytes(destinationFilePath, sourceBytes);
|
|
188
|
-
const newMetadata =
|
|
180
|
+
const newMetadata = {
|
|
181
|
+
...sourceMetadata,
|
|
182
|
+
metadata: sourceMetadata.customMetadata,
|
|
183
|
+
...incomingMetadata,
|
|
184
|
+
};
|
|
189
185
|
if (sourceMetadata.downloadTokens.length &&
|
|
190
|
-
!(
|
|
186
|
+
!(incomingMetadata?.metadata && Object.keys(incomingMetadata?.metadata).length)) {
|
|
191
187
|
if (!newMetadata.metadata)
|
|
192
188
|
newMetadata.metadata = {};
|
|
193
189
|
newMetadata.metadata.firebaseStorageDownloadTokens = sourceMetadata.downloadTokens.join(",");
|
|
@@ -218,7 +214,6 @@ class StorageLayer {
|
|
|
218
214
|
return file.metadata;
|
|
219
215
|
}
|
|
220
216
|
async listObjects(request) {
|
|
221
|
-
var _a;
|
|
222
217
|
const { bucketId, prefix, delimiter, pageToken, authorization } = request;
|
|
223
218
|
const authorized = await this._rulesValidator.validate(["b", bucketId, "o", prefix.replace(TRAILING_SLASHES_PATTERN, "")].join("/"), bucketId, types_1.RulesetOperationMethod.LIST, {}, this._projectId, authorization, delimiter);
|
|
224
219
|
if (!authorized) {
|
|
@@ -264,7 +259,7 @@ class StorageLayer {
|
|
|
264
259
|
items = items.slice(idx);
|
|
265
260
|
}
|
|
266
261
|
}
|
|
267
|
-
const maxResults =
|
|
262
|
+
const maxResults = request.maxResults ?? 1000;
|
|
268
263
|
let nextPageToken = undefined;
|
|
269
264
|
if (items.length > maxResults) {
|
|
270
265
|
nextPageToken = items[maxResults].name;
|
|
@@ -305,7 +300,6 @@ class StorageLayer {
|
|
|
305
300
|
return this._persistence.dirPath;
|
|
306
301
|
}
|
|
307
302
|
async export(storageExportPath, options) {
|
|
308
|
-
var _a, e_1, _b, _c;
|
|
309
303
|
const bucketsList = {
|
|
310
304
|
buckets: [],
|
|
311
305
|
};
|
|
@@ -323,28 +317,11 @@ class StorageLayer {
|
|
|
323
317
|
await fse.ensureDir(blobsDirPath);
|
|
324
318
|
const metadataDirPath = path.join(storageExportPath, "metadata");
|
|
325
319
|
await fse.ensureDir(metadataDirPath);
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
const [, file] = _c;
|
|
332
|
-
const diskFileName = this._persistence.getDiskFileName(this.path(file.metadata.bucket, file.metadata.name));
|
|
333
|
-
await fse.copy(path.join(this.dirPath, diskFileName), path.join(blobsDirPath, diskFileName));
|
|
334
|
-
const metadataExportPath = path.join(metadataDirPath, encodeURIComponent(diskFileName)) + ".json";
|
|
335
|
-
await fse.writeFile(metadataExportPath, metadata_1.StoredFileMetadata.toJSON(file.metadata));
|
|
336
|
-
}
|
|
337
|
-
finally {
|
|
338
|
-
_d = true;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
343
|
-
finally {
|
|
344
|
-
try {
|
|
345
|
-
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
346
|
-
}
|
|
347
|
-
finally { if (e_1) throw e_1.error; }
|
|
320
|
+
for await (const [, file] of this._files.entries()) {
|
|
321
|
+
const diskFileName = this._persistence.getDiskFileName(this.path(file.metadata.bucket, file.metadata.name));
|
|
322
|
+
await fse.copy(path.join(this.dirPath, diskFileName), path.join(blobsDirPath, diskFileName));
|
|
323
|
+
const metadataExportPath = path.join(metadataDirPath, encodeURIComponent(diskFileName)) + ".json";
|
|
324
|
+
await fse.writeFile(metadataExportPath, metadata_1.StoredFileMetadata.toJSON(file.metadata));
|
|
348
325
|
}
|
|
349
326
|
}
|
|
350
327
|
import(storageExportPath, options) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CloudStorageObjectMetadata = exports.CloudStorageObjectAccessControlMetadata = exports.CloudStorageBucketMetadata = exports.OutgoingFirebaseMetadata = exports.StoredFileMetadata = void 0;
|
|
4
|
+
exports.toSerializedDate = toSerializedDate;
|
|
4
5
|
const uuid = require("uuid");
|
|
5
6
|
const crypto = require("crypto");
|
|
6
7
|
const registry_1 = require("../registry");
|
|
@@ -285,10 +286,16 @@ class CloudStorageObjectMetadata {
|
|
|
285
286
|
this.etag = metadata.etag;
|
|
286
287
|
this.metadata = {};
|
|
287
288
|
if (Object.keys(metadata.customMetadata || {})) {
|
|
288
|
-
this.metadata =
|
|
289
|
+
this.metadata = {
|
|
290
|
+
...this.metadata,
|
|
291
|
+
...metadata.customMetadata,
|
|
292
|
+
};
|
|
289
293
|
}
|
|
290
294
|
if (metadata.downloadTokens.length) {
|
|
291
|
-
this.metadata =
|
|
295
|
+
this.metadata = {
|
|
296
|
+
...this.metadata,
|
|
297
|
+
firebaseStorageDownloadTokens: metadata.downloadTokens.join(","),
|
|
298
|
+
};
|
|
292
299
|
}
|
|
293
300
|
if (!Object.keys(this.metadata).length) {
|
|
294
301
|
delete this.metadata;
|
|
@@ -336,7 +343,6 @@ function toSerializedDate(d) {
|
|
|
336
343
|
.padStart(3, "0")}`;
|
|
337
344
|
return `${day}T${time}Z`;
|
|
338
345
|
}
|
|
339
|
-
exports.toSerializedDate = toSerializedDate;
|
|
340
346
|
function generateMd5Hash(bytes) {
|
|
341
347
|
const hash = crypto.createHash("md5");
|
|
342
348
|
hash.update(bytes);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseObjectUploadMultipartRequest =
|
|
3
|
+
exports.parseObjectUploadMultipartRequest = parseObjectUploadMultipartRequest;
|
|
4
4
|
const LINE_SEPARATOR = `\r\n`;
|
|
5
5
|
function splitBufferByDelimiter(buffer, delimiter, maxResults = -1) {
|
|
6
6
|
let offset = 0;
|
|
@@ -60,4 +60,3 @@ function parseObjectUploadMultipartRequest(contentTypeHeader, body) {
|
|
|
60
60
|
dataRaw: Buffer.from(parsedBody[1].dataRaw),
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
exports.parseObjectUploadMultipartRequest = parseObjectUploadMultipartRequest;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeRFC5987 =
|
|
3
|
+
exports.encodeRFC5987 = encodeRFC5987;
|
|
4
4
|
function encodeRFC5987(str) {
|
|
5
5
|
return encodeURIComponent(str)
|
|
6
6
|
.replace(/['()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`)
|
|
7
7
|
.replace(/%(7C|60|5E)/g, (str, hex) => String.fromCharCode(parseInt(hex, 16)));
|
|
8
8
|
}
|
|
9
|
-
exports.encodeRFC5987 = encodeRFC5987;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getStorageRulesConfig =
|
|
3
|
+
exports.getStorageRulesConfig = getStorageRulesConfig;
|
|
4
4
|
const error_1 = require("../../../error");
|
|
5
5
|
const fsutils_1 = require("../../../fsutils");
|
|
6
6
|
const constants_1 = require("../../constants");
|
|
@@ -47,7 +47,6 @@ function getStorageRulesConfig(projectId, options) {
|
|
|
47
47
|
}
|
|
48
48
|
return results;
|
|
49
49
|
}
|
|
50
|
-
exports.getStorageRulesConfig = getStorageRulesConfig;
|
|
51
50
|
function defaultStorageRules() {
|
|
52
51
|
const defaultRulesPath = "emulators/default_storage.rules";
|
|
53
52
|
const name = (0, templates_1.absoluteTemplateFilePath)(defaultRulesPath);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createStorageRulesManager =
|
|
3
|
+
exports.createStorageRulesManager = createStorageRulesManager;
|
|
4
4
|
const chokidar = require("chokidar");
|
|
5
5
|
const emulatorLogger_1 = require("../../emulatorLogger");
|
|
6
6
|
const types_1 = require("../../types");
|
|
@@ -11,7 +11,6 @@ function createStorageRulesManager(rules, runtime) {
|
|
|
11
11
|
? new ResourceBasedStorageRulesManager(rules, runtime)
|
|
12
12
|
: new DefaultStorageRulesManager(rules, runtime);
|
|
13
13
|
}
|
|
14
|
-
exports.createStorageRulesManager = createStorageRulesManager;
|
|
15
14
|
class DefaultStorageRulesManager {
|
|
16
15
|
constructor(_rules, _runtime) {
|
|
17
16
|
this._runtime = _runtime;
|
|
@@ -51,7 +50,7 @@ class DefaultStorageRulesManager {
|
|
|
51
50
|
const parsedIssue = JSON.parse(issue);
|
|
52
51
|
this._logger.log("WARN", `${parsedIssue.description_.replace(/\.$/, "")} in ${parsedIssue.sourcePosition_.fileName_}:${parsedIssue.sourcePosition_.line_}`);
|
|
53
52
|
}
|
|
54
|
-
catch
|
|
53
|
+
catch {
|
|
55
54
|
this._logger.logLabeled("WARN", "storage", issue);
|
|
56
55
|
}
|
|
57
56
|
});
|
|
@@ -74,8 +73,7 @@ class ResourceBasedStorageRulesManager {
|
|
|
74
73
|
return allIssues;
|
|
75
74
|
}
|
|
76
75
|
getRuleset(resource) {
|
|
77
|
-
|
|
78
|
-
return (_a = this._rulesManagers.get(resource)) === null || _a === void 0 ? void 0 : _a.getRuleset();
|
|
76
|
+
return this._rulesManagers.get(resource)?.getRuleset();
|
|
79
77
|
}
|
|
80
78
|
async stop() {
|
|
81
79
|
await Promise.all(Array.from(this._rulesManagers.values(), async (rulesManager) => await rulesManager.stop()));
|
|
@@ -70,7 +70,6 @@ class StorageRulesRuntime {
|
|
|
70
70
|
return this._alive;
|
|
71
71
|
}
|
|
72
72
|
async start(autoDownload = true) {
|
|
73
|
-
var _a, _b;
|
|
74
73
|
if (this.alive) {
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
@@ -94,9 +93,8 @@ class StorageRulesRuntime {
|
|
|
94
93
|
stdio: ["pipe", "pipe", "pipe"],
|
|
95
94
|
});
|
|
96
95
|
this._childprocess.on("exit", () => {
|
|
97
|
-
var _a;
|
|
98
96
|
this._alive = false;
|
|
99
|
-
|
|
97
|
+
this._childprocess?.removeAllListeners();
|
|
100
98
|
this._childprocess = undefined;
|
|
101
99
|
});
|
|
102
100
|
const startPromise = new Promise((resolve) => {
|
|
@@ -111,7 +109,7 @@ class StorageRulesRuntime {
|
|
|
111
109
|
this._childprocess.on("error", (err) => {
|
|
112
110
|
void (0, downloadableEmulators_1.handleEmulatorProcessError)(types_2.Emulators.STORAGE, err);
|
|
113
111
|
});
|
|
114
|
-
|
|
112
|
+
this._childprocess.stderr?.on("data", (buf) => {
|
|
115
113
|
const error = buf.toString();
|
|
116
114
|
if (error.includes("jarfile")) {
|
|
117
115
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_2.Emulators.STORAGE).log("ERROR", error);
|
|
@@ -121,8 +119,7 @@ class StorageRulesRuntime {
|
|
|
121
119
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_2.Emulators.STORAGE).log("WARN", `Unexpected rules runtime error: ${buf.toString()}`);
|
|
122
120
|
}
|
|
123
121
|
});
|
|
124
|
-
|
|
125
|
-
var _a;
|
|
122
|
+
this._childprocess.stdout?.on("data", (buf) => {
|
|
126
123
|
const serializedRuntimeActionResponse = buf.toString("utf-8").trim();
|
|
127
124
|
if (serializedRuntimeActionResponse !== "") {
|
|
128
125
|
let rap;
|
|
@@ -133,7 +130,7 @@ class StorageRulesRuntime {
|
|
|
133
130
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_2.Emulators.STORAGE).log("INFO", serializedRuntimeActionResponse);
|
|
134
131
|
return;
|
|
135
132
|
}
|
|
136
|
-
const id =
|
|
133
|
+
const id = rap.id ?? rap.server_request_id;
|
|
137
134
|
if (id === undefined) {
|
|
138
135
|
console.log(`Received no ID from server response ${serializedRuntimeActionResponse}`);
|
|
139
136
|
return;
|
|
@@ -157,12 +154,11 @@ class StorageRulesRuntime {
|
|
|
157
154
|
stop() {
|
|
158
155
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_2.Emulators.STORAGE).log("DEBUG", "Stopping rules runtime.");
|
|
159
156
|
return new Promise((resolve) => {
|
|
160
|
-
var _a;
|
|
161
157
|
if (this.alive) {
|
|
162
158
|
this._childprocess.on("exit", () => {
|
|
163
159
|
resolve();
|
|
164
160
|
});
|
|
165
|
-
|
|
161
|
+
this._childprocess?.kill("SIGINT");
|
|
166
162
|
}
|
|
167
163
|
else {
|
|
168
164
|
resolve();
|
|
@@ -173,7 +169,10 @@ class StorageRulesRuntime {
|
|
|
173
169
|
if (!this._childprocess) {
|
|
174
170
|
throw new error_1.FirebaseError("Failed to send Cloud Storage rules request due to rules runtime not available.");
|
|
175
171
|
}
|
|
176
|
-
const runtimeActionRequest =
|
|
172
|
+
const runtimeActionRequest = {
|
|
173
|
+
...rab,
|
|
174
|
+
id: overrideId ?? this._requestCount++,
|
|
175
|
+
};
|
|
177
176
|
if (overrideId !== undefined) {
|
|
178
177
|
delete this._requests[overrideId];
|
|
179
178
|
}
|
|
@@ -187,8 +186,7 @@ class StorageRulesRuntime {
|
|
|
187
186
|
};
|
|
188
187
|
const serializedRequest = JSON.stringify(runtimeActionRequest);
|
|
189
188
|
lock.acquire(synchonizationKey, (done) => {
|
|
190
|
-
|
|
191
|
-
(_b = (_a = this._childprocess) === null || _a === void 0 ? void 0 : _a.stdin) === null || _b === void 0 ? void 0 : _b.write(serializedRequest + "\n");
|
|
189
|
+
this._childprocess?.stdin?.write(serializedRequest + "\n");
|
|
192
190
|
setTimeout(() => {
|
|
193
191
|
done();
|
|
194
192
|
}, 15);
|
|
@@ -223,7 +221,11 @@ class StorageRulesRuntime {
|
|
|
223
221
|
if (opts.path.endsWith("/")) {
|
|
224
222
|
opts.path = opts.path.slice(0, -1);
|
|
225
223
|
}
|
|
226
|
-
const runtimeVariables =
|
|
224
|
+
const runtimeVariables = {
|
|
225
|
+
resource: toExpressionValue(opts.file.before || null),
|
|
226
|
+
request: createRequestExpressionValue(opts),
|
|
227
|
+
...runtimeVariableOverrides,
|
|
228
|
+
};
|
|
227
229
|
const runtimeActionRequest = {
|
|
228
230
|
action: "verify",
|
|
229
231
|
context: {
|
|
@@ -10,10 +10,10 @@ var RulesetOperationMethod;
|
|
|
10
10
|
RulesetOperationMethod["CREATE"] = "create";
|
|
11
11
|
RulesetOperationMethod["UPDATE"] = "update";
|
|
12
12
|
RulesetOperationMethod["DELETE"] = "delete";
|
|
13
|
-
})(RulesetOperationMethod
|
|
13
|
+
})(RulesetOperationMethod || (exports.RulesetOperationMethod = RulesetOperationMethod = {}));
|
|
14
14
|
var DataLoadStatus;
|
|
15
15
|
(function (DataLoadStatus) {
|
|
16
16
|
DataLoadStatus["OK"] = "ok";
|
|
17
17
|
DataLoadStatus["NOT_FOUND"] = "not_found";
|
|
18
18
|
DataLoadStatus["INVALID_STATE"] = "invalid_state";
|
|
19
|
-
})(DataLoadStatus
|
|
19
|
+
})(DataLoadStatus || (exports.DataLoadStatus = DataLoadStatus = {}));
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getFirebaseRulesValidator = getFirebaseRulesValidator;
|
|
4
|
+
exports.getAdminOnlyFirebaseRulesValidator = getAdminOnlyFirebaseRulesValidator;
|
|
5
|
+
exports.getAdminCredentialValidator = getAdminCredentialValidator;
|
|
6
|
+
exports.isPermitted = isPermitted;
|
|
4
7
|
const emulatorLogger_1 = require("../../emulatorLogger");
|
|
5
8
|
const types_1 = require("../../types");
|
|
6
9
|
function getFirebaseRulesValidator(rulesetProvider) {
|
|
@@ -18,7 +21,6 @@ function getFirebaseRulesValidator(rulesetProvider) {
|
|
|
18
21
|
},
|
|
19
22
|
};
|
|
20
23
|
}
|
|
21
|
-
exports.getFirebaseRulesValidator = getFirebaseRulesValidator;
|
|
22
24
|
function getAdminOnlyFirebaseRulesValidator() {
|
|
23
25
|
return {
|
|
24
26
|
validate: (_path, _bucketId, _method, _variableOverrides, _authorization, delimiter) => {
|
|
@@ -26,11 +28,9 @@ function getAdminOnlyFirebaseRulesValidator() {
|
|
|
26
28
|
},
|
|
27
29
|
};
|
|
28
30
|
}
|
|
29
|
-
exports.getAdminOnlyFirebaseRulesValidator = getAdminOnlyFirebaseRulesValidator;
|
|
30
31
|
function getAdminCredentialValidator() {
|
|
31
32
|
return { validate: isValidAdminCredentials };
|
|
32
33
|
}
|
|
33
|
-
exports.getAdminCredentialValidator = getAdminCredentialValidator;
|
|
34
34
|
async function isPermitted(opts) {
|
|
35
35
|
if (!opts.ruleset) {
|
|
36
36
|
emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.STORAGE).log("WARN", `Can not process SDK request with no loaded ruleset`);
|
|
@@ -54,7 +54,6 @@ async function isPermitted(opts) {
|
|
|
54
54
|
}
|
|
55
55
|
return !!permitted;
|
|
56
56
|
}
|
|
57
|
-
exports.isPermitted = isPermitted;
|
|
58
57
|
function isValidAdminCredentials(authorization) {
|
|
59
|
-
return ["Bearer owner", "Firebase owner"].includes(authorization
|
|
58
|
+
return ["Bearer owner", "Firebase owner"].includes(authorization ?? "");
|
|
60
59
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createApp =
|
|
3
|
+
exports.createApp = createApp;
|
|
4
4
|
const cors = require("cors");
|
|
5
5
|
const express = require("express");
|
|
6
6
|
const emulatorLogger_1 = require("../emulatorLogger");
|
|
@@ -107,7 +107,6 @@ function createApp(defaultProjectId, emulator) {
|
|
|
107
107
|
app.use("/", (0, gcloud_1.createCloudEndpoints)(emulator));
|
|
108
108
|
return Promise.resolve(app);
|
|
109
109
|
}
|
|
110
|
-
exports.createApp = createApp;
|
|
111
110
|
function isRulesFile(file) {
|
|
112
111
|
return (typeof file.name === "string" && typeof file.content === "string");
|
|
113
112
|
}
|
|
@@ -8,13 +8,13 @@ var UploadType;
|
|
|
8
8
|
UploadType[UploadType["MEDIA"] = 0] = "MEDIA";
|
|
9
9
|
UploadType[UploadType["MULTIPART"] = 1] = "MULTIPART";
|
|
10
10
|
UploadType[UploadType["RESUMABLE"] = 2] = "RESUMABLE";
|
|
11
|
-
})(UploadType
|
|
11
|
+
})(UploadType || (exports.UploadType = UploadType = {}));
|
|
12
12
|
var UploadStatus;
|
|
13
13
|
(function (UploadStatus) {
|
|
14
14
|
UploadStatus["ACTIVE"] = "active";
|
|
15
15
|
UploadStatus["CANCELLED"] = "cancelled";
|
|
16
16
|
UploadStatus["FINISHED"] = "final";
|
|
17
|
-
})(UploadStatus
|
|
17
|
+
})(UploadStatus || (exports.UploadStatus = UploadStatus = {}));
|
|
18
18
|
class UploadNotActiveError extends Error {
|
|
19
19
|
}
|
|
20
20
|
exports.UploadNotActiveError = UploadNotActiveError;
|
|
@@ -133,8 +133,7 @@ class UploadService {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
getPreviousResponseCode(uploadId) {
|
|
136
|
-
|
|
137
|
-
return ((_a = this._uploads.get(uploadId)) === null || _a === void 0 ? void 0 : _a.prevResponseCode) || 200;
|
|
136
|
+
return this._uploads.get(uploadId)?.prevResponseCode || 200;
|
|
138
137
|
}
|
|
139
138
|
getStagingFileName(uploadId, bucketId, objectId) {
|
|
140
139
|
return encodeURIComponent(`${uploadId}_b_${bucketId}_o_${objectId}`);
|
|
@@ -112,7 +112,7 @@ var TaskStatus;
|
|
|
112
112
|
TaskStatus[TaskStatus["RETRY"] = 2] = "RETRY";
|
|
113
113
|
TaskStatus[TaskStatus["FAILED"] = 3] = "FAILED";
|
|
114
114
|
TaskStatus[TaskStatus["FINISHED"] = 4] = "FINISHED";
|
|
115
|
-
})(TaskStatus
|
|
115
|
+
})(TaskStatus || (exports.TaskStatus = TaskStatus = {}));
|
|
116
116
|
class TaskQueue {
|
|
117
117
|
constructor(key, config) {
|
|
118
118
|
this.key = key;
|
|
@@ -157,10 +157,9 @@ class TaskQueue {
|
|
|
157
157
|
return this.dispatches;
|
|
158
158
|
}
|
|
159
159
|
processDispatch() {
|
|
160
|
-
var _a;
|
|
161
160
|
for (let i = 0; i < this.dispatches.length; i++) {
|
|
162
161
|
if (this.dispatches[i] !== null) {
|
|
163
|
-
switch (
|
|
162
|
+
switch (this.dispatches[i]?.metadata.status) {
|
|
164
163
|
case TaskStatus.FAILED:
|
|
165
164
|
this.dispatches[i] = null;
|
|
166
165
|
this.openDispatches.push(i);
|
|
@@ -193,7 +192,15 @@ class TaskQueue {
|
|
|
193
192
|
}
|
|
194
193
|
emulatedTask.metadata.status = TaskStatus.RUNNING;
|
|
195
194
|
try {
|
|
196
|
-
const headers =
|
|
195
|
+
const headers = {
|
|
196
|
+
"Content-Type": "application/json",
|
|
197
|
+
"X-CloudTasks-QueueName": this.key,
|
|
198
|
+
"X-CloudTasks-TaskName": emulatedTask.task.name.split("/").pop(),
|
|
199
|
+
"X-CloudTasks-TaskRetryCount": `${emulatedTask.metadata.currentAttempt - 1}`,
|
|
200
|
+
"X-CloudTasks-TaskExecutionCount": `${emulatedTask.metadata.executionCount}`,
|
|
201
|
+
"X-CloudTasks-TaskETA": `${emulatedTask.task.scheduleTime || Date.now()}`,
|
|
202
|
+
...emulatedTask.task.httpRequest.headers,
|
|
203
|
+
};
|
|
197
204
|
if (emulatedTask.metadata.previousResponse) {
|
|
198
205
|
headers["X-CloudTasks-TaskPreviousResponse"] = `${emulatedTask.metadata.previousResponse}`;
|
|
199
206
|
}
|
|
@@ -111,7 +111,6 @@ class TasksEmulator {
|
|
|
111
111
|
const hub = express();
|
|
112
112
|
const createTaskQueueRoute = `/projects/:project_id/locations/:location_id/queues/:queue_name`;
|
|
113
113
|
const createTaskQueueHandler = (req, res) => {
|
|
114
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
115
114
|
const projectId = req.params.project_id;
|
|
116
115
|
const locationId = req.params.location_id;
|
|
117
116
|
const queueName = req.params.queue_name;
|
|
@@ -127,18 +126,18 @@ class TasksEmulator {
|
|
|
127
126
|
const body = req.body;
|
|
128
127
|
const taskQueueConfig = {
|
|
129
128
|
retryConfig: {
|
|
130
|
-
maxAttempts:
|
|
131
|
-
maxRetrySeconds:
|
|
132
|
-
maxBackoffSeconds:
|
|
133
|
-
maxDoublings:
|
|
134
|
-
minBackoffSeconds:
|
|
129
|
+
maxAttempts: body.retryConfig?.maxAttempts ?? RETRY_CONFIG_DEFAULTS.maxAttempts,
|
|
130
|
+
maxRetrySeconds: body.retryConfig?.maxRetrySeconds ?? RETRY_CONFIG_DEFAULTS.maxRetrySeconds,
|
|
131
|
+
maxBackoffSeconds: body.retryConfig?.maxBackoffSeconds ?? RETRY_CONFIG_DEFAULTS.maxBackoffSeconds,
|
|
132
|
+
maxDoublings: body.retryConfig?.maxDoublings ?? RETRY_CONFIG_DEFAULTS.maxDoublings,
|
|
133
|
+
minBackoffSeconds: body.retryConfig?.minBackoffSeconds ?? RETRY_CONFIG_DEFAULTS.minBackoffSeconds,
|
|
135
134
|
},
|
|
136
135
|
rateLimits: {
|
|
137
|
-
maxConcurrentDispatches:
|
|
138
|
-
maxDispatchesPerSecond:
|
|
136
|
+
maxConcurrentDispatches: body.rateLimits?.maxConcurrentDispatches ?? RATE_LIMITS_DEFAULT.maxConcurrentDispatches,
|
|
137
|
+
maxDispatchesPerSecond: body.rateLimits?.maxDispatchesPerSecond ?? RATE_LIMITS_DEFAULT.maxDispatchesPerSecond,
|
|
139
138
|
},
|
|
140
|
-
timeoutSeconds:
|
|
141
|
-
retry:
|
|
139
|
+
timeoutSeconds: body.timeoutSeconds ?? 10,
|
|
140
|
+
retry: body.retry ?? false,
|
|
142
141
|
defaultUri: body.defaultUri,
|
|
143
142
|
};
|
|
144
143
|
if (taskQueueConfig.rateLimits.maxConcurrentDispatches > 5000) {
|
|
@@ -151,7 +150,6 @@ class TasksEmulator {
|
|
|
151
150
|
};
|
|
152
151
|
const enqueueTasksRoute = `/projects/:project_id/locations/:location_id/queues/:queue_name/tasks`;
|
|
153
152
|
const enqueueTasksHandler = (req, res) => {
|
|
154
|
-
var _a;
|
|
155
153
|
if (!this.controller.isRunning()) {
|
|
156
154
|
this.controller.start();
|
|
157
155
|
}
|
|
@@ -165,7 +163,8 @@ class TasksEmulator {
|
|
|
165
163
|
return;
|
|
166
164
|
}
|
|
167
165
|
req.body.task.name =
|
|
168
|
-
|
|
166
|
+
req.body.task.name ??
|
|
167
|
+
`/projects/${projectId}/locations/${locationId}/queues/${queueName}/tasks/${Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)}`;
|
|
169
168
|
req.body.task.httpRequest.body = JSON.parse(Buffer.from(req.body.task.httpRequest.body, "base64").toString("utf-8"));
|
|
170
169
|
const task = req.body.task;
|
|
171
170
|
try {
|
package/lib/emulator/types.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Severity = exports.EmulatorLog = exports.FunctionsExecutionMode = exports.
|
|
3
|
+
exports.Severity = exports.EmulatorLog = exports.FunctionsExecutionMode = exports.ALL_EMULATORS = exports.EMULATORS_SUPPORTED_BY_USE_EMULATOR = exports.EMULATORS_SUPPORTED_BY_UI = exports.EMULATORS_SUPPORTED_BY_FUNCTIONS = exports.ALL_SERVICE_EMULATORS = exports.IMPORT_EXPORT_EMULATORS = exports.DOWNLOADABLE_EMULATORS = exports.Emulators = void 0;
|
|
4
|
+
exports.isDownloadableEmulator = isDownloadableEmulator;
|
|
5
|
+
exports.isEmulator = isEmulator;
|
|
4
6
|
var Emulators;
|
|
5
7
|
(function (Emulators) {
|
|
6
8
|
Emulators["AUTH"] = "auth";
|
|
@@ -18,7 +20,7 @@ var Emulators;
|
|
|
18
20
|
Emulators["EVENTARC"] = "eventarc";
|
|
19
21
|
Emulators["DATACONNECT"] = "dataconnect";
|
|
20
22
|
Emulators["TASKS"] = "tasks";
|
|
21
|
-
})(Emulators
|
|
23
|
+
})(Emulators || (exports.Emulators = Emulators = {}));
|
|
22
24
|
exports.DOWNLOADABLE_EMULATORS = [
|
|
23
25
|
Emulators.FIRESTORE,
|
|
24
26
|
Emulators.DATABASE,
|
|
@@ -80,16 +82,14 @@ exports.ALL_EMULATORS = [
|
|
|
80
82
|
function isDownloadableEmulator(value) {
|
|
81
83
|
return isEmulator(value) && exports.DOWNLOADABLE_EMULATORS.includes(value);
|
|
82
84
|
}
|
|
83
|
-
exports.isDownloadableEmulator = isDownloadableEmulator;
|
|
84
85
|
function isEmulator(value) {
|
|
85
86
|
return Object.values(Emulators).includes(value);
|
|
86
87
|
}
|
|
87
|
-
exports.isEmulator = isEmulator;
|
|
88
88
|
var FunctionsExecutionMode;
|
|
89
89
|
(function (FunctionsExecutionMode) {
|
|
90
90
|
FunctionsExecutionMode["AUTO"] = "auto";
|
|
91
91
|
FunctionsExecutionMode["SEQUENTIAL"] = "sequential";
|
|
92
|
-
})(FunctionsExecutionMode
|
|
92
|
+
})(FunctionsExecutionMode || (exports.FunctionsExecutionMode = FunctionsExecutionMode = {}));
|
|
93
93
|
class EmulatorLog {
|
|
94
94
|
get date() {
|
|
95
95
|
if (!this.timestamp) {
|
|
@@ -206,4 +206,4 @@ var Severity;
|
|
|
206
206
|
Severity[Severity["DEPRECATION"] = 1] = "DEPRECATION";
|
|
207
207
|
Severity[Severity["WARNING"] = 2] = "WARNING";
|
|
208
208
|
Severity[Severity["ERROR"] = 3] = "ERROR";
|
|
209
|
-
})(Severity
|
|
209
|
+
})(Severity || (exports.Severity = Severity = {}));
|
package/lib/emulator/ui.js
CHANGED
|
@@ -38,7 +38,12 @@ class EmulatorUI extends ExpressBasedEmulator_1.ExpressBasedEmulator {
|
|
|
38
38
|
const webDir = path.join(downloadDetails.unzipDir, "client");
|
|
39
39
|
app.get("/api/config", this.jsonHandler(() => {
|
|
40
40
|
const emulatorInfos = (0, functional_1.mapObject)(hub.getRunningEmulatorsMapping(), env_1.maybeUsePortForwarding);
|
|
41
|
-
const json =
|
|
41
|
+
const json = {
|
|
42
|
+
projectId,
|
|
43
|
+
experiments: enabledExperiments ?? [],
|
|
44
|
+
analytics: emulatorGaSession,
|
|
45
|
+
...emulatorInfos,
|
|
46
|
+
};
|
|
42
47
|
return Promise.resolve(json);
|
|
43
48
|
}));
|
|
44
49
|
app.use(express.static(webDir));
|
package/lib/ensureApiEnabled.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.POLL_SETTINGS = void 0;
|
|
4
|
+
exports.check = check;
|
|
5
|
+
exports.ensure = ensure;
|
|
6
|
+
exports.bestEffortEnsure = bestEffortEnsure;
|
|
7
|
+
exports.enableApiURI = enableApiURI;
|
|
4
8
|
const colorette_1 = require("colorette");
|
|
5
9
|
const track_1 = require("./track");
|
|
6
10
|
const api_1 = require("./api");
|
|
@@ -35,10 +39,8 @@ async function check(projectId, apiUri, prefix, silent = false) {
|
|
|
35
39
|
}
|
|
36
40
|
return isEnabled;
|
|
37
41
|
}
|
|
38
|
-
exports.check = check;
|
|
39
42
|
function isPermissionError(e) {
|
|
40
|
-
|
|
41
|
-
return ((_c = (_b = (_a = e.context) === null || _a === void 0 ? void 0 : _a.body) === null || _b === void 0 ? void 0 : _b.error) === null || _c === void 0 ? void 0 : _c.status) === "PERMISSION_DENIED";
|
|
43
|
+
return e.context?.body?.error?.status === "PERMISSION_DENIED";
|
|
42
44
|
}
|
|
43
45
|
async function enable(projectId, apiName) {
|
|
44
46
|
try {
|
|
@@ -114,7 +116,6 @@ async function ensure(projectId, apiUri, prefix, silent = false) {
|
|
|
114
116
|
}
|
|
115
117
|
return enableApiWithRetries(projectId, hostname, prefix, silent);
|
|
116
118
|
}
|
|
117
|
-
exports.ensure = ensure;
|
|
118
119
|
async function bestEffortEnsure(projectId, apiUri, prefix, silent = false) {
|
|
119
120
|
try {
|
|
120
121
|
await ensure(projectId, apiUri, prefix, silent);
|
|
@@ -123,16 +124,13 @@ async function bestEffortEnsure(projectId, apiUri, prefix, silent = false) {
|
|
|
123
124
|
logger_1.logger.debug(`Unable to check that ${apiUri} is enabled on ${projectId}. Calls to it will fail if it is not enabled`);
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
|
-
exports.bestEffortEnsure = bestEffortEnsure;
|
|
127
127
|
function enableApiURI(projectId, apiName) {
|
|
128
128
|
return `https://console.cloud.google.com/apis/library/${apiName}?project=${projectId}`;
|
|
129
129
|
}
|
|
130
|
-
exports.enableApiURI = enableApiURI;
|
|
131
130
|
const API_ENABLEMENT_CACHE_KEY = "apiEnablementCache";
|
|
132
131
|
function checkAPIEnablementCache(projectId, apiName) {
|
|
133
|
-
var _a;
|
|
134
132
|
const cache = configstore_1.configstore.get(API_ENABLEMENT_CACHE_KEY);
|
|
135
|
-
return !!
|
|
133
|
+
return !!cache?.[projectId]?.[apiName];
|
|
136
134
|
}
|
|
137
135
|
function cacheEnabledAPI(projectId, apiName) {
|
|
138
136
|
const cache = (configstore_1.configstore.get(API_ENABLEMENT_CACHE_KEY) || {});
|