firebase-tools-with-isolate 12.9.1-1
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/LICENSE +21 -0
- package/README.md +48 -0
- package/lib/accountExporter.js +207 -0
- package/lib/accountImporter.js +305 -0
- package/lib/api.js +84 -0
- package/lib/apiv2.js +353 -0
- package/lib/appdistribution/client.js +193 -0
- package/lib/appdistribution/distribution.js +51 -0
- package/lib/appdistribution/options-parser-util.js +51 -0
- package/lib/archiveDirectory.js +120 -0
- package/lib/auth.js +535 -0
- package/lib/bin/firebase.js +132 -0
- package/lib/checkMinRequiredVersion.js +14 -0
- package/lib/checkValidTargetFilters.js +46 -0
- package/lib/command.js +250 -0
- package/lib/commands/appdistribution-distribute.js +121 -0
- package/lib/commands/appdistribution-group-create.js +19 -0
- package/lib/commands/appdistribution-group-delete.js +24 -0
- package/lib/commands/appdistribution-testers-add.js +24 -0
- package/lib/commands/appdistribution-testers-remove.js +40 -0
- package/lib/commands/apps-android-sha-create.js +29 -0
- package/lib/commands/apps-android-sha-delete.js +16 -0
- package/lib/commands/apps-android-sha-list.js +42 -0
- package/lib/commands/apps-create.js +166 -0
- package/lib/commands/apps-list.js +53 -0
- package/lib/commands/apps-sdkconfig.js +103 -0
- package/lib/commands/auth-export.js +44 -0
- package/lib/commands/auth-import.js +114 -0
- package/lib/commands/crashlytics-mappingfile-generateid.js +26 -0
- package/lib/commands/crashlytics-mappingfile-upload.js +46 -0
- package/lib/commands/crashlytics-symbols-upload.js +78 -0
- package/lib/commands/database-get.js +122 -0
- package/lib/commands/database-import.js +85 -0
- package/lib/commands/database-instances-create.js +29 -0
- package/lib/commands/database-instances-list.js +53 -0
- package/lib/commands/database-profile.js +46 -0
- package/lib/commands/database-push.js +63 -0
- package/lib/commands/database-remove.js +42 -0
- package/lib/commands/database-rules-canary.js +24 -0
- package/lib/commands/database-rules-get.js +22 -0
- package/lib/commands/database-rules-list.js +36 -0
- package/lib/commands/database-rules-release.js +24 -0
- package/lib/commands/database-rules-stage.js +26 -0
- package/lib/commands/database-set.js +68 -0
- package/lib/commands/database-settings-get.js +44 -0
- package/lib/commands/database-settings-set.js +46 -0
- package/lib/commands/database-update.js +69 -0
- package/lib/commands/deploy.js +101 -0
- package/lib/commands/emulators-exec.js +19 -0
- package/lib/commands/emulators-export.js +14 -0
- package/lib/commands/emulators-start.js +115 -0
- package/lib/commands/experimental-functions-shell.js +13 -0
- package/lib/commands/experiments-describe.js +31 -0
- package/lib/commands/experiments-disable.js +28 -0
- package/lib/commands/experiments-enable.js +28 -0
- package/lib/commands/experiments-list.js +29 -0
- package/lib/commands/ext-configure.js +110 -0
- package/lib/commands/ext-dev-deprecate.js +68 -0
- package/lib/commands/ext-dev-init.js +148 -0
- package/lib/commands/ext-dev-list.js +47 -0
- package/lib/commands/ext-dev-publish.js +32 -0
- package/lib/commands/ext-dev-register.js +50 -0
- package/lib/commands/ext-dev-undeprecate.js +57 -0
- package/lib/commands/ext-dev-upload.js +88 -0
- package/lib/commands/ext-dev-usage.js +141 -0
- package/lib/commands/ext-export.js +68 -0
- package/lib/commands/ext-info.js +118 -0
- package/lib/commands/ext-install.js +167 -0
- package/lib/commands/ext-list.js +18 -0
- package/lib/commands/ext-uninstall.js +29 -0
- package/lib/commands/ext-update.js +105 -0
- package/lib/commands/ext.js +41 -0
- package/lib/commands/firestore-databases-create.js +55 -0
- package/lib/commands/firestore-databases-delete.js +39 -0
- package/lib/commands/firestore-databases-get.js +25 -0
- package/lib/commands/firestore-databases-list.js +24 -0
- package/lib/commands/firestore-databases-update.js +59 -0
- package/lib/commands/firestore-delete.js +88 -0
- package/lib/commands/firestore-indexes-list.js +38 -0
- package/lib/commands/firestore-locations.js +24 -0
- package/lib/commands/frameworks-backends-create.js +14 -0
- package/lib/commands/frameworks-backends-delete.js +98 -0
- package/lib/commands/frameworks-backends-get.js +80 -0
- package/lib/commands/frameworks-backends-list.js +68 -0
- package/lib/commands/functions-config-clone.js +53 -0
- package/lib/commands/functions-config-export.js +118 -0
- package/lib/commands/functions-config-get.js +35 -0
- package/lib/commands/functions-config-set.js +43 -0
- package/lib/commands/functions-config-unset.js +42 -0
- package/lib/commands/functions-delete.js +95 -0
- package/lib/commands/functions-deletegcfartifacts.js +44 -0
- package/lib/commands/functions-list.js +47 -0
- package/lib/commands/functions-log.js +34 -0
- package/lib/commands/functions-secrets-access.js +22 -0
- package/lib/commands/functions-secrets-destroy.js +64 -0
- package/lib/commands/functions-secrets-get.js +28 -0
- package/lib/commands/functions-secrets-prune.js +57 -0
- package/lib/commands/functions-secrets-set.js +108 -0
- package/lib/commands/functions-shell.js +15 -0
- package/lib/commands/help.js +27 -0
- package/lib/commands/hosting-channel-create.js +78 -0
- package/lib/commands/hosting-channel-delete.js +47 -0
- package/lib/commands/hosting-channel-deploy.js +146 -0
- package/lib/commands/hosting-channel-list.js +40 -0
- package/lib/commands/hosting-channel-open.js +48 -0
- package/lib/commands/hosting-clone.js +103 -0
- package/lib/commands/hosting-disable.js +31 -0
- package/lib/commands/hosting-sites-create.js +34 -0
- package/lib/commands/hosting-sites-delete.js +39 -0
- package/lib/commands/hosting-sites-get.js +27 -0
- package/lib/commands/hosting-sites-list.js +28 -0
- package/lib/commands/index.js +191 -0
- package/lib/commands/init.js +195 -0
- package/lib/commands/internaltesting-frameworks-compose.js +22 -0
- package/lib/commands/internaltesting-functions-discover.js +25 -0
- package/lib/commands/login-add.js +32 -0
- package/lib/commands/login-ci.js +25 -0
- package/lib/commands/login-list.js +28 -0
- package/lib/commands/login-use.js +24 -0
- package/lib/commands/login.js +57 -0
- package/lib/commands/logout.js +76 -0
- package/lib/commands/open.js +100 -0
- package/lib/commands/projects-addfirebase.js +19 -0
- package/lib/commands/projects-create.js +37 -0
- package/lib/commands/projects-list.js +61 -0
- package/lib/commands/remoteconfig-get.js +68 -0
- package/lib/commands/remoteconfig-rollback.js +48 -0
- package/lib/commands/remoteconfig-versions-list.js +34 -0
- package/lib/commands/serve.js +60 -0
- package/lib/commands/setup-emulators-database.js +12 -0
- package/lib/commands/setup-emulators-firestore.js +12 -0
- package/lib/commands/setup-emulators-pubsub.js +12 -0
- package/lib/commands/setup-emulators-storage.js +12 -0
- package/lib/commands/setup-emulators-ui.js +12 -0
- package/lib/commands/target-apply.js +24 -0
- package/lib/commands/target-clear.js +20 -0
- package/lib/commands/target-remove.js +20 -0
- package/lib/commands/target.js +34 -0
- package/lib/commands/use.js +162 -0
- package/lib/config.js +227 -0
- package/lib/configstore.js +6 -0
- package/lib/crashlytics/buildToolsJarHelper.js +51 -0
- package/lib/database/api.js +19 -0
- package/lib/database/import.js +218 -0
- package/lib/database/listRemote.js +37 -0
- package/lib/database/metadata.js +67 -0
- package/lib/database/remove.js +88 -0
- package/lib/database/removeRemote.js +51 -0
- package/lib/database/rulesConfig.js +79 -0
- package/lib/database/settings.js +62 -0
- package/lib/defaultCredentials.js +80 -0
- package/lib/deploy/database/deploy.js +5 -0
- package/lib/deploy/database/index.js +9 -0
- package/lib/deploy/database/prepare.js +54 -0
- package/lib/deploy/database/release.js +30 -0
- package/lib/deploy/extensions/args.js +2 -0
- package/lib/deploy/extensions/deploy.js +49 -0
- package/lib/deploy/extensions/deploymentSummary.js +56 -0
- package/lib/deploy/extensions/errors.js +31 -0
- package/lib/deploy/extensions/index.js +9 -0
- package/lib/deploy/extensions/planner.js +157 -0
- package/lib/deploy/extensions/prepare.js +110 -0
- package/lib/deploy/extensions/release.js +57 -0
- package/lib/deploy/extensions/secrets.js +150 -0
- package/lib/deploy/extensions/tasks.js +156 -0
- package/lib/deploy/extensions/v2FunctionHelper.js +53 -0
- package/lib/deploy/extensions/validate.js +17 -0
- package/lib/deploy/firestore/deploy.js +44 -0
- package/lib/deploy/firestore/index.js +9 -0
- package/lib/deploy/firestore/prepare.js +59 -0
- package/lib/deploy/firestore/release.js +22 -0
- package/lib/deploy/functions/args.js +2 -0
- package/lib/deploy/functions/backend.js +316 -0
- package/lib/deploy/functions/build.js +311 -0
- package/lib/deploy/functions/cache/applyHash.js +22 -0
- package/lib/deploy/functions/cache/hash.js +30 -0
- package/lib/deploy/functions/cel.js +365 -0
- package/lib/deploy/functions/checkIam.js +183 -0
- package/lib/deploy/functions/containerCleaner.js +305 -0
- package/lib/deploy/functions/deploy.js +108 -0
- package/lib/deploy/functions/ensure.js +105 -0
- package/lib/deploy/functions/ensureCloudBuildEnabled.js +1 -0
- package/lib/deploy/functions/functionsDeployHelper.js +134 -0
- package/lib/deploy/functions/index.js +9 -0
- package/lib/deploy/functions/params.js +517 -0
- package/lib/deploy/functions/prepare.js +304 -0
- package/lib/deploy/functions/prepareFunctionsUpload.js +113 -0
- package/lib/deploy/functions/pricing.js +171 -0
- package/lib/deploy/functions/prompts.js +157 -0
- package/lib/deploy/functions/release/executor.js +51 -0
- package/lib/deploy/functions/release/fabricator.js +584 -0
- package/lib/deploy/functions/release/index.js +93 -0
- package/lib/deploy/functions/release/planner.js +205 -0
- package/lib/deploy/functions/release/reporter.js +196 -0
- package/lib/deploy/functions/release/sourceTokenScraper.js +67 -0
- package/lib/deploy/functions/release/timer.js +14 -0
- package/lib/deploy/functions/runtimes/discovery/index.js +85 -0
- package/lib/deploy/functions/runtimes/discovery/mockDiscoveryServer.js +14 -0
- package/lib/deploy/functions/runtimes/discovery/parsing.js +95 -0
- package/lib/deploy/functions/runtimes/discovery/v1alpha1.js +296 -0
- package/lib/deploy/functions/runtimes/index.js +59 -0
- package/lib/deploy/functions/runtimes/node/extractTriggers.js +23 -0
- package/lib/deploy/functions/runtimes/node/index.js +173 -0
- package/lib/deploy/functions/runtimes/node/parseRuntimeAndValidateSDK.js +57 -0
- package/lib/deploy/functions/runtimes/node/parseTriggers.js +332 -0
- package/lib/deploy/functions/runtimes/node/triggerParser.js +72 -0
- package/lib/deploy/functions/runtimes/node/validate.js +34 -0
- package/lib/deploy/functions/runtimes/node/versioning.js +95 -0
- package/lib/deploy/functions/runtimes/python/index.js +154 -0
- package/lib/deploy/functions/services/auth.js +95 -0
- package/lib/deploy/functions/services/database.js +14 -0
- package/lib/deploy/functions/services/firebaseAlerts.js +14 -0
- package/lib/deploy/functions/services/firestore.js +17 -0
- package/lib/deploy/functions/services/index.js +117 -0
- package/lib/deploy/functions/services/remoteConfig.js +14 -0
- package/lib/deploy/functions/services/storage.js +44 -0
- package/lib/deploy/functions/services/testLab.js +14 -0
- package/lib/deploy/functions/triggerRegionHelper.js +16 -0
- package/lib/deploy/functions/validate.js +198 -0
- package/lib/deploy/hosting/args.js +2 -0
- package/lib/deploy/hosting/context.js +2 -0
- package/lib/deploy/hosting/convertConfig.js +181 -0
- package/lib/deploy/hosting/deploy.js +85 -0
- package/lib/deploy/hosting/hashcache.js +48 -0
- package/lib/deploy/hosting/index.js +9 -0
- package/lib/deploy/hosting/prepare.js +162 -0
- package/lib/deploy/hosting/release.js +40 -0
- package/lib/deploy/hosting/uploader.js +207 -0
- package/lib/deploy/index.js +127 -0
- package/lib/deploy/lifecycleHooks.js +151 -0
- package/lib/deploy/remoteconfig/deploy.js +4 -0
- package/lib/deploy/remoteconfig/functions.js +69 -0
- package/lib/deploy/remoteconfig/index.js +9 -0
- package/lib/deploy/remoteconfig/prepare.js +23 -0
- package/lib/deploy/remoteconfig/release.js +14 -0
- package/lib/deploy/storage/deploy.js +12 -0
- package/lib/deploy/storage/index.js +9 -0
- package/lib/deploy/storage/prepare.js +52 -0
- package/lib/deploy/storage/release.js +27 -0
- package/lib/deploymentTool.js +22 -0
- package/lib/detectProjectRoot.js +28 -0
- package/lib/downloadUtils.js +37 -0
- package/lib/dynamicImport.js +22 -0
- package/lib/emulator/ExpressBasedEmulator.js +92 -0
- package/lib/emulator/adminSdkConfig.js +65 -0
- package/lib/emulator/auth/apiSpec.js +8138 -0
- package/lib/emulator/auth/cloudFunctions.js +70 -0
- package/lib/emulator/auth/errors.js +77 -0
- package/lib/emulator/auth/handlers.js +281 -0
- package/lib/emulator/auth/index.js +146 -0
- package/lib/emulator/auth/operations.js +2145 -0
- package/lib/emulator/auth/schema.js +2 -0
- package/lib/emulator/auth/server.js +474 -0
- package/lib/emulator/auth/state.js +668 -0
- package/lib/emulator/auth/types.js +2 -0
- package/lib/emulator/auth/utils.js +84 -0
- package/lib/emulator/auth/widget_ui.js +620 -0
- package/lib/emulator/commandUtils.js +380 -0
- package/lib/emulator/constants.js +111 -0
- package/lib/emulator/controller.js +654 -0
- package/lib/emulator/databaseEmulator.js +172 -0
- package/lib/emulator/dns.js +49 -0
- package/lib/emulator/download.js +88 -0
- package/lib/emulator/downloadableEmulators.js +384 -0
- package/lib/emulator/emulatorLogger.js +237 -0
- package/lib/emulator/env.js +37 -0
- package/lib/emulator/eventarcEmulator.js +143 -0
- package/lib/emulator/eventarcEmulatorUtils.js +62 -0
- package/lib/emulator/events/types.js +28 -0
- package/lib/emulator/extensions/postinstall.js +41 -0
- package/lib/emulator/extensions/validation.js +72 -0
- package/lib/emulator/extensionsEmulator.js +254 -0
- package/lib/emulator/firestoreEmulator.js +96 -0
- package/lib/emulator/functionsEmulator.js +1038 -0
- package/lib/emulator/functionsEmulatorRuntime.js +730 -0
- package/lib/emulator/functionsEmulatorShared.js +322 -0
- package/lib/emulator/functionsEmulatorShell.js +88 -0
- package/lib/emulator/functionsEmulatorUtils.js +91 -0
- package/lib/emulator/functionsRuntimeWorker.js +314 -0
- package/lib/emulator/hostingEmulator.js +40 -0
- package/lib/emulator/hub.js +162 -0
- package/lib/emulator/hubClient.js +53 -0
- package/lib/emulator/hubExport.js +208 -0
- package/lib/emulator/loggingEmulator.js +118 -0
- package/lib/emulator/portUtils.js +323 -0
- package/lib/emulator/pubsubEmulator.js +186 -0
- package/lib/emulator/registry.js +122 -0
- package/lib/emulator/shared/request.js +19 -0
- package/lib/emulator/storage/apis/firebase.js +500 -0
- package/lib/emulator/storage/apis/gcloud.js +405 -0
- package/lib/emulator/storage/apis/shared.js +44 -0
- package/lib/emulator/storage/cloudFunctions.js +88 -0
- package/lib/emulator/storage/crc.js +33 -0
- package/lib/emulator/storage/errors.js +9 -0
- package/lib/emulator/storage/files.js +410 -0
- package/lib/emulator/storage/index.js +98 -0
- package/lib/emulator/storage/metadata.js +349 -0
- package/lib/emulator/storage/multipart.js +63 -0
- package/lib/emulator/storage/persistence.js +92 -0
- package/lib/emulator/storage/rules/config.js +53 -0
- package/lib/emulator/storage/rules/expressionValue.js +2 -0
- package/lib/emulator/storage/rules/manager.js +88 -0
- package/lib/emulator/storage/rules/runtime.js +363 -0
- package/lib/emulator/storage/rules/types.js +19 -0
- package/lib/emulator/storage/rules/utils.js +60 -0
- package/lib/emulator/storage/server.js +113 -0
- package/lib/emulator/storage/upload.js +143 -0
- package/lib/emulator/types.js +200 -0
- package/lib/emulator/ui.js +52 -0
- package/lib/emulator/workQueue.js +114 -0
- package/lib/ensureApiEnabled.js +110 -0
- package/lib/ensureCloudResourceLocation.js +12 -0
- package/lib/error.js +29 -0
- package/lib/errorOut.js +23 -0
- package/lib/experiments.js +153 -0
- package/lib/extensions/askUserForEventsConfig.js +97 -0
- package/lib/extensions/askUserForParam.js +338 -0
- package/lib/extensions/billingMigrationHelper.js +61 -0
- package/lib/extensions/change-log.js +95 -0
- package/lib/extensions/checkProjectBilling.js +82 -0
- package/lib/extensions/diagnose.js +56 -0
- package/lib/extensions/displayExtensionInfo.js +175 -0
- package/lib/extensions/emulator/optionsHelper.js +73 -0
- package/lib/extensions/emulator/specHelper.js +102 -0
- package/lib/extensions/emulator/triggerHelper.js +105 -0
- package/lib/extensions/etags.js +28 -0
- package/lib/extensions/export.js +64 -0
- package/lib/extensions/extensionsApi.js +361 -0
- package/lib/extensions/extensionsHelper.js +862 -0
- package/lib/extensions/listExtensions.js +53 -0
- package/lib/extensions/localHelper.js +67 -0
- package/lib/extensions/manifest.js +205 -0
- package/lib/extensions/metricsTypeDef.js +2 -0
- package/lib/extensions/metricsUtils.js +98 -0
- package/lib/extensions/paramHelper.js +140 -0
- package/lib/extensions/provisioningHelper.js +109 -0
- package/lib/extensions/publishHelpers.js +8 -0
- package/lib/extensions/publisherApi.js +214 -0
- package/lib/extensions/refs.js +67 -0
- package/lib/extensions/resolveSource.js +24 -0
- package/lib/extensions/secretsUtils.js +60 -0
- package/lib/extensions/tos.js +90 -0
- package/lib/extensions/types.js +25 -0
- package/lib/extensions/updateHelper.js +127 -0
- package/lib/extensions/utils.js +63 -0
- package/lib/extensions/versionHelper.js +14 -0
- package/lib/extensions/warnings.js +44 -0
- package/lib/fetchMOTD.js +46 -0
- package/lib/fetchWebSetup.js +75 -0
- package/lib/filterTargets.js +34 -0
- package/lib/firebaseConfig.js +2 -0
- package/lib/firebaseConfigValidate.js +29 -0
- package/lib/firestore/api-sort.js +118 -0
- package/lib/firestore/api-spec.js +2 -0
- package/lib/firestore/api-types.js +60 -0
- package/lib/firestore/api.js +566 -0
- package/lib/firestore/checkDatabaseType.js +18 -0
- package/lib/firestore/delete.js +347 -0
- package/lib/firestore/encodeFirestoreValue.js +59 -0
- package/lib/firestore/fsConfig.js +74 -0
- package/lib/firestore/options.js +2 -0
- package/lib/firestore/util.js +39 -0
- package/lib/firestore/validator.js +38 -0
- package/lib/frameworks/angular/index.js +193 -0
- package/lib/frameworks/angular/interfaces.js +2 -0
- package/lib/frameworks/angular/utils.js +431 -0
- package/lib/frameworks/astro/index.js +73 -0
- package/lib/frameworks/astro/utils.js +40 -0
- package/lib/frameworks/compose/discover/filesystem.js +52 -0
- package/lib/frameworks/compose/discover/frameworkMatcher.js +76 -0
- package/lib/frameworks/compose/discover/frameworkSpec.js +39 -0
- package/lib/frameworks/compose/discover/index.js +32 -0
- package/lib/frameworks/compose/discover/runtime/node.js +149 -0
- package/lib/frameworks/compose/discover/types.js +2 -0
- package/lib/frameworks/compose/driver/docker.js +187 -0
- package/lib/frameworks/compose/driver/hooks.js +22 -0
- package/lib/frameworks/compose/driver/index.js +16 -0
- package/lib/frameworks/compose/driver/local.js +51 -0
- package/lib/frameworks/compose/index.js +31 -0
- package/lib/frameworks/compose/interfaces.js +21 -0
- package/lib/frameworks/constants.js +40 -0
- package/lib/frameworks/docs/index.js +2 -0
- package/lib/frameworks/express/index.js +102 -0
- package/lib/frameworks/flutter/constants.js +72 -0
- package/lib/frameworks/flutter/index.js +58 -0
- package/lib/frameworks/flutter/utils.js +11 -0
- package/lib/frameworks/frameworks.js +31 -0
- package/lib/frameworks/index.js +421 -0
- package/lib/frameworks/interfaces.js +2 -0
- package/lib/frameworks/lit/index.js +23 -0
- package/lib/frameworks/next/constants.js +12 -0
- package/lib/frameworks/next/index.js +403 -0
- package/lib/frameworks/next/interfaces.js +2 -0
- package/lib/frameworks/next/utils.js +197 -0
- package/lib/frameworks/nuxt/index.js +92 -0
- package/lib/frameworks/nuxt/interfaces.js +2 -0
- package/lib/frameworks/nuxt/utils.js +23 -0
- package/lib/frameworks/nuxt2/index.js +79 -0
- package/lib/frameworks/preact/index.js +23 -0
- package/lib/frameworks/react/index.js +23 -0
- package/lib/frameworks/svelte/index.js +23 -0
- package/lib/frameworks/sveltekit/index.js +54 -0
- package/lib/frameworks/sveltekit/interfaces.js +2 -0
- package/lib/frameworks/utils.js +260 -0
- package/lib/frameworks/vite/index.js +99 -0
- package/lib/fsAsync.js +43 -0
- package/lib/fsutils.js +35 -0
- package/lib/functional.js +87 -0
- package/lib/functions/constants.js +14 -0
- package/lib/functions/ensureTargeted.js +21 -0
- package/lib/functions/env.js +246 -0
- package/lib/functions/events/index.js +7 -0
- package/lib/functions/events/v1.js +6 -0
- package/lib/functions/events/v2.js +25 -0
- package/lib/functions/functionslog.js +35 -0
- package/lib/functions/projectConfig.js +68 -0
- package/lib/functions/python.js +23 -0
- package/lib/functions/runtimeConfigExport.js +141 -0
- package/lib/functions/secrets.js +239 -0
- package/lib/functionsConfig.js +157 -0
- package/lib/functionsConfigClone.js +68 -0
- package/lib/functionsShellCommandAction.js +112 -0
- package/lib/gcp/artifactregistry.js +16 -0
- package/lib/gcp/auth.js +16 -0
- package/lib/gcp/cloudbilling.js +25 -0
- package/lib/gcp/cloudbuild.js +50 -0
- package/lib/gcp/cloudfunctions.js +351 -0
- package/lib/gcp/cloudfunctionsv2.js +389 -0
- package/lib/gcp/cloudlogging.js +25 -0
- package/lib/gcp/cloudmonitoring.js +77 -0
- package/lib/gcp/cloudscheduler.js +155 -0
- package/lib/gcp/cloudtasks.js +162 -0
- package/lib/gcp/docker.js +80 -0
- package/lib/gcp/eventarc.js +42 -0
- package/lib/gcp/firestore.js +47 -0
- package/lib/gcp/frameworks.js +40 -0
- package/lib/gcp/iam.js +76 -0
- package/lib/gcp/identityPlatform.js +44 -0
- package/lib/gcp/index.js +11 -0
- package/lib/gcp/location.js +44 -0
- package/lib/gcp/proto.js +130 -0
- package/lib/gcp/pubsub.js +34 -0
- package/lib/gcp/resourceManager.js +74 -0
- package/lib/gcp/rules.js +156 -0
- package/lib/gcp/run.js +157 -0
- package/lib/gcp/runtimeconfig.js +127 -0
- package/lib/gcp/secretManager.js +207 -0
- package/lib/gcp/serviceusage.js +24 -0
- package/lib/gcp/storage.js +111 -0
- package/lib/getDefaultDatabaseInstance.js +10 -0
- package/lib/getDefaultHostingSite.js +32 -0
- package/lib/getProjectNumber.js +15 -0
- package/lib/handlePreviewToggles.js +38 -0
- package/lib/hosting/api.js +289 -0
- package/lib/hosting/cloudRunProxy.js +52 -0
- package/lib/hosting/config.js +189 -0
- package/lib/hosting/expireUtils.js +33 -0
- package/lib/hosting/functionsProxy.js +42 -0
- package/lib/hosting/implicitInit.js +58 -0
- package/lib/hosting/initMiddleware.js +63 -0
- package/lib/hosting/interactive.js +75 -0
- package/lib/hosting/options.js +3 -0
- package/lib/hosting/proxy.js +143 -0
- package/lib/hosting/runTags.js +114 -0
- package/lib/index.js +71 -0
- package/lib/init/features/account.js +62 -0
- package/lib/init/features/database.js +133 -0
- package/lib/init/features/emulators.js +102 -0
- package/lib/init/features/extensions/index.js +16 -0
- package/lib/init/features/firestore/index.js +36 -0
- package/lib/init/features/firestore/indexes.js +71 -0
- package/lib/init/features/firestore/rules.js +80 -0
- package/lib/init/features/frameworks/constants.js +7 -0
- package/lib/init/features/frameworks/index.js +116 -0
- package/lib/init/features/frameworks/repo.js +125 -0
- package/lib/init/features/functions/index.js +165 -0
- package/lib/init/features/functions/javascript.js +46 -0
- package/lib/init/features/functions/npm-dependencies.js +37 -0
- package/lib/init/features/functions/python.js +48 -0
- package/lib/init/features/functions/typescript.js +61 -0
- package/lib/init/features/hosting/github.js +397 -0
- package/lib/init/features/hosting/index.js +183 -0
- package/lib/init/features/index.js +27 -0
- package/lib/init/features/project.js +101 -0
- package/lib/init/features/remoteconfig.js +32 -0
- package/lib/init/features/storage.js +27 -0
- package/lib/init/index.js +45 -0
- package/lib/listFiles.js +15 -0
- package/lib/loadCJSON.js +17 -0
- package/lib/localFunction.js +222 -0
- package/lib/logError.js +29 -0
- package/lib/logger.js +31 -0
- package/lib/management/apps.js +280 -0
- package/lib/management/database.js +184 -0
- package/lib/management/projects.js +312 -0
- package/lib/metaprogramming.js +2 -0
- package/lib/monospace/index.js +82 -0
- package/lib/monospace/interfaces.js +2 -0
- package/lib/operation-poller.js +59 -0
- package/lib/options.js +2 -0
- package/lib/parseBoltRules.js +29 -0
- package/lib/profileReport.js +577 -0
- package/lib/profiler.js +99 -0
- package/lib/projectPath.js +16 -0
- package/lib/projectUtils.js +59 -0
- package/lib/prompt.js +50 -0
- package/lib/rc.js +165 -0
- package/lib/remoteconfig/get.js +49 -0
- package/lib/remoteconfig/interfaces.js +17 -0
- package/lib/remoteconfig/rollback.js +22 -0
- package/lib/remoteconfig/versionslist.js +33 -0
- package/lib/requireAuth.js +81 -0
- package/lib/requireConfig.js +13 -0
- package/lib/requireDatabaseInstance.js +26 -0
- package/lib/requireHostingSite.js +12 -0
- package/lib/requireInteractive.js +12 -0
- package/lib/requirePermissions.js +30 -0
- package/lib/responseToError.js +58 -0
- package/lib/rtdb.js +35 -0
- package/lib/rulesDeploy.js +180 -0
- package/lib/scopes.js +10 -0
- package/lib/serve/functions.js +64 -0
- package/lib/serve/hosting.js +115 -0
- package/lib/serve/index.js +53 -0
- package/lib/shortenUrl.js +29 -0
- package/lib/throttler/errors/retries-exhausted-error.js +11 -0
- package/lib/throttler/errors/task-error.js +9 -0
- package/lib/throttler/errors/timeout-error.js +9 -0
- package/lib/throttler/queue.js +23 -0
- package/lib/throttler/stack.js +28 -0
- package/lib/throttler/throttler.js +230 -0
- package/lib/track.js +196 -0
- package/lib/unzip.js +126 -0
- package/lib/utils.js +488 -0
- package/package.json +239 -0
- package/schema/extension-yaml.json +432 -0
- package/schema/firebase-config.json +2619 -0
- package/standalone/check.js +6 -0
- package/standalone/config.template.js +19 -0
- package/standalone/firepit.js +1074 -0
- package/standalone/package-lock.json +7019 -0
- package/standalone/package.json +36 -0
- package/standalone/runtime.js +122 -0
- package/standalone/welcome.js +178 -0
- package/templates/_gitignore +66 -0
- package/templates/banner.txt +6 -0
- package/templates/emulators/default_storage.rules +8 -0
- package/templates/extensions/CL-template.md +2 -0
- package/templates/extensions/POSTINSTALL.md +29 -0
- package/templates/extensions/PREINSTALL.md +22 -0
- package/templates/extensions/extension.yaml +61 -0
- package/templates/extensions/integration-test.env +2 -0
- package/templates/extensions/integration-test.json +14 -0
- package/templates/extensions/javascript/WELCOME.md +18 -0
- package/templates/extensions/javascript/_gitignore +1 -0
- package/templates/extensions/javascript/index.js +25 -0
- package/templates/extensions/javascript/integration-test.js +13 -0
- package/templates/extensions/javascript/package.lint.json +25 -0
- package/templates/extensions/javascript/package.nolint.json +19 -0
- package/templates/extensions/typescript/WELCOME.md +22 -0
- package/templates/extensions/typescript/_gitignore +8 -0
- package/templates/extensions/typescript/_mocharc +10 -0
- package/templates/extensions/typescript/index.ts +26 -0
- package/templates/extensions/typescript/integration-test.ts +13 -0
- package/templates/extensions/typescript/package.lint.json +31 -0
- package/templates/extensions/typescript/package.nolint.json +24 -0
- package/templates/extensions/typescript/tsconfig.dev.json +5 -0
- package/templates/extensions/typescript/tsconfig.json +15 -0
- package/templates/firebase.json +9 -0
- package/templates/hosting/init.js +36 -0
- package/templates/init/firestore/firestore.indexes.json +26 -0
- package/templates/init/firestore/firestore.rules +16 -0
- package/templates/init/functions/javascript/_eslintrc +28 -0
- package/templates/init/functions/javascript/_gitignore +1 -0
- package/templates/init/functions/javascript/index.js +19 -0
- package/templates/init/functions/javascript/package.lint.json +26 -0
- package/templates/init/functions/javascript/package.nolint.json +23 -0
- package/templates/init/functions/python/_gitignore +0 -0
- package/templates/init/functions/python/main.py +13 -0
- package/templates/init/functions/python/requirements.txt +1 -0
- package/templates/init/functions/typescript/_eslintrc +32 -0
- package/templates/init/functions/typescript/_gitignore +9 -0
- package/templates/init/functions/typescript/index.ts +19 -0
- package/templates/init/functions/typescript/package.lint.json +31 -0
- package/templates/init/functions/typescript/package.nolint.json +25 -0
- package/templates/init/functions/typescript/tsconfig.dev.json +5 -0
- package/templates/init/functions/typescript/tsconfig.json +15 -0
- package/templates/init/hosting/404.html +33 -0
- package/templates/init/hosting/index.html +89 -0
- package/templates/init/storage/storage.rules +12 -0
- package/templates/loginFailure.html +34 -0
- package/templates/loginSuccess.html +32 -0
- package/templates/loginSuccessGithub.html +32 -0
- package/templates/setup/web.js +5 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const Table = require("cli-table");
|
|
5
|
+
const clc = require("colorette");
|
|
6
|
+
const utils = require("../utils");
|
|
7
|
+
const command_1 = require("../command");
|
|
8
|
+
const cloudmonitoring_1 = require("../gcp/cloudmonitoring");
|
|
9
|
+
const requireAuth_1 = require("../requireAuth");
|
|
10
|
+
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
11
|
+
const metricsUtils_1 = require("../extensions/metricsUtils");
|
|
12
|
+
const publisherApi_1 = require("../extensions/publisherApi");
|
|
13
|
+
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
14
|
+
const error_1 = require("../error");
|
|
15
|
+
const logger_1 = require("../logger");
|
|
16
|
+
const prompt_1 = require("../prompt");
|
|
17
|
+
const shortenUrl_1 = require("../shortenUrl");
|
|
18
|
+
exports.command = new command_1.Command("ext:dev:usage <publisherId>")
|
|
19
|
+
.description("get usage for an extension")
|
|
20
|
+
.help("use this command to get the usage of extensions you published. " +
|
|
21
|
+
"Specify the publisher ID you used to publish your extensions, " +
|
|
22
|
+
"or the extension ref of your published extension.")
|
|
23
|
+
.before(requireAuth_1.requireAuth)
|
|
24
|
+
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extDevMinVersion")
|
|
25
|
+
.action(async (input) => {
|
|
26
|
+
const extensionRefRegex = /^[\w\d-]+\/[\w\d-]+$/;
|
|
27
|
+
let extensionName;
|
|
28
|
+
let publisherId;
|
|
29
|
+
if (extensionRefRegex.test(input)) {
|
|
30
|
+
[publisherId, extensionName] = input.split("/");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
publisherId = input;
|
|
34
|
+
let extensions;
|
|
35
|
+
try {
|
|
36
|
+
extensions = await (0, publisherApi_1.listExtensions)(publisherId);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
throw new error_1.FirebaseError(err);
|
|
40
|
+
}
|
|
41
|
+
if (extensions.length < 1) {
|
|
42
|
+
throw new error_1.FirebaseError(`There are no published extensions associated with publisher ID ${clc.bold(publisherId)}. This could happen for two reasons:\n` +
|
|
43
|
+
" - The publisher ID doesn't exist or could be misspelled\n" +
|
|
44
|
+
" - This publisher has not published any extensions\n\n" +
|
|
45
|
+
"If you are expecting some extensions to appear, please make sure you have the correct publisher ID and try again.");
|
|
46
|
+
}
|
|
47
|
+
extensionName = await (0, prompt_1.promptOnce)({
|
|
48
|
+
type: "list",
|
|
49
|
+
name: "extension",
|
|
50
|
+
message: "Which published extension do you want to view the stats for?",
|
|
51
|
+
choices: extensions.map((e) => {
|
|
52
|
+
const [_, name] = e.ref.split("/");
|
|
53
|
+
return {
|
|
54
|
+
name,
|
|
55
|
+
value: name,
|
|
56
|
+
};
|
|
57
|
+
}),
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const profile = await (0, publisherApi_1.getPublisherProfile)("-", publisherId);
|
|
61
|
+
const projectNumber = (0, extensionsHelper_1.getPublisherProjectFromName)(profile.name);
|
|
62
|
+
const past45d = new Date();
|
|
63
|
+
past45d.setDate(past45d.getDate() - 45);
|
|
64
|
+
const query = {
|
|
65
|
+
filter: `metric.type="firebaseextensions.googleapis.com/extension/version/active_instances" ` +
|
|
66
|
+
`resource.type="firebaseextensions.googleapis.com/ExtensionVersion" ` +
|
|
67
|
+
`resource.labels.extension="${extensionName}"`,
|
|
68
|
+
"interval.endTime": new Date().toJSON(),
|
|
69
|
+
"interval.startTime": past45d.toJSON(),
|
|
70
|
+
view: cloudmonitoring_1.TimeSeriesView.FULL,
|
|
71
|
+
"aggregation.alignmentPeriod": (60 * 60 * 24).toString() + "s",
|
|
72
|
+
"aggregation.perSeriesAligner": cloudmonitoring_1.Aligner.ALIGN_MAX,
|
|
73
|
+
};
|
|
74
|
+
let response;
|
|
75
|
+
try {
|
|
76
|
+
response = await (0, cloudmonitoring_1.queryTimeSeries)(query, projectNumber);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
throw new error_1.FirebaseError(`Error occurred when fetching usage data for extension ${extensionName}`, {
|
|
80
|
+
original: err,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (!response) {
|
|
84
|
+
throw new error_1.FirebaseError(`Couldn't find any usage data for extension ${extensionName}`);
|
|
85
|
+
}
|
|
86
|
+
const metrics = (0, metricsUtils_1.parseTimeseriesResponse)(response);
|
|
87
|
+
const table = new Table({
|
|
88
|
+
head: ["Version", "Active Instances", "Changes last 7 Days", "Changes last 28 Days"],
|
|
89
|
+
style: {
|
|
90
|
+
head: ["yellow"],
|
|
91
|
+
},
|
|
92
|
+
colAligns: ["left", "right", "right", "right"],
|
|
93
|
+
});
|
|
94
|
+
metrics.forEach((m) => {
|
|
95
|
+
table.push((0, metricsUtils_1.buildMetricsTableRow)(m));
|
|
96
|
+
});
|
|
97
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `showing usage stats for ${clc.bold(extensionName)}:`);
|
|
98
|
+
logger_1.logger.info(table.toString());
|
|
99
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `How to read this table:`);
|
|
100
|
+
logger_1.logger.info(`* Due to privacy considerations, numbers are reported as ranges.`);
|
|
101
|
+
logger_1.logger.info(`* In the absence of significant changes, we will render a '-' symbol.`);
|
|
102
|
+
logger_1.logger.info(`* You will need more than 10 installs over a period of more than 28 days to render sufficient data.`);
|
|
103
|
+
});
|
|
104
|
+
async function buildCloudMonitoringLink(args) {
|
|
105
|
+
const pageState = {
|
|
106
|
+
xyChart: {
|
|
107
|
+
dataSets: [
|
|
108
|
+
{
|
|
109
|
+
timeSeriesFilter: {
|
|
110
|
+
filter: `metric.type="firebaseextensions.googleapis.com/extension/version/active_instances"` +
|
|
111
|
+
` resource.type="firebaseextensions.googleapis.com/ExtensionVersion"` +
|
|
112
|
+
` resource.label.extension="${args.extensionName}"`,
|
|
113
|
+
minAlignmentPeriod: "86400s",
|
|
114
|
+
aggregations: [
|
|
115
|
+
{
|
|
116
|
+
perSeriesAligner: "ALIGN_MEAN",
|
|
117
|
+
crossSeriesReducer: "REDUCE_MAX",
|
|
118
|
+
alignmentPeriod: "86400s",
|
|
119
|
+
groupByFields: ['resource.label."extension"', 'resource.label."version"'],
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
crossSeriesReducer: "REDUCE_NONE",
|
|
123
|
+
alignmentPeriod: "60s",
|
|
124
|
+
groupByFields: [],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
isAutoRefresh: true,
|
|
132
|
+
timeSelection: {
|
|
133
|
+
timeRange: "4w",
|
|
134
|
+
},
|
|
135
|
+
};
|
|
136
|
+
let uri = `https://console.cloud.google.com/monitoring/metrics-explorer?project=${args.projectNumber}` +
|
|
137
|
+
`&pageState=${JSON.stringify(pageState)}`;
|
|
138
|
+
uri = encodeURI(uri);
|
|
139
|
+
uri = await (0, shortenUrl_1.shortenUrl)(uri);
|
|
140
|
+
return uri;
|
|
141
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const planner = require("../deploy/extensions/planner");
|
|
7
|
+
const etags_1 = require("../extensions/etags");
|
|
8
|
+
const export_1 = require("../extensions/export");
|
|
9
|
+
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
10
|
+
const manifest = require("../extensions/manifest");
|
|
11
|
+
const paramHelper_1 = require("../extensions/paramHelper");
|
|
12
|
+
const functional_1 = require("../functional");
|
|
13
|
+
const getProjectNumber_1 = require("../getProjectNumber");
|
|
14
|
+
const logger_1 = require("../logger");
|
|
15
|
+
const projectUtils_1 = require("../projectUtils");
|
|
16
|
+
const prompt_1 = require("../prompt");
|
|
17
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
18
|
+
exports.command = new command_1.Command("ext:export")
|
|
19
|
+
.description("export all Extension instances installed on a project to a local Firebase directory")
|
|
20
|
+
.before(requirePermissions_1.requirePermissions, ["firebaseextensions.instances.list"])
|
|
21
|
+
.before(extensionsHelper_1.ensureExtensionsApiEnabled)
|
|
22
|
+
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
|
|
23
|
+
.withForce()
|
|
24
|
+
.action(async (options) => {
|
|
25
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
26
|
+
const projectNumber = await (0, getProjectNumber_1.getProjectNumber)(options);
|
|
27
|
+
const have = await Promise.all(await planner.have(projectId));
|
|
28
|
+
if (have.length === 0) {
|
|
29
|
+
logger_1.logger.info(`No extension instances installed on ${projectId}, so there is nothing to export.`);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const [withRef, withoutRef] = (0, functional_1.partition)(have, (s) => !!s.ref);
|
|
33
|
+
const withRefSubbed = await Promise.all(withRef.map(async (i) => {
|
|
34
|
+
const subbed = await (0, export_1.setSecretParamsToLatest)(i);
|
|
35
|
+
return (0, export_1.parameterizeProject)(projectId, projectNumber, subbed);
|
|
36
|
+
}));
|
|
37
|
+
(0, export_1.displayExportInfo)(withRefSubbed, withoutRef);
|
|
38
|
+
if (!options.nonInteractive &&
|
|
39
|
+
!options.force &&
|
|
40
|
+
!(await (0, prompt_1.promptOnce)({
|
|
41
|
+
message: "Do you wish to add these Extension instances to firebase.json?",
|
|
42
|
+
type: "confirm",
|
|
43
|
+
default: true,
|
|
44
|
+
}))) {
|
|
45
|
+
logger_1.logger.info("Exiting. No changes made.");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const manifestSpecs = withRefSubbed.map((spec) => {
|
|
49
|
+
const paramCopy = Object.assign({}, spec.params);
|
|
50
|
+
if (spec.eventarcChannel) {
|
|
51
|
+
paramCopy.EVENTARC_CHANNEL = spec.eventarcChannel;
|
|
52
|
+
}
|
|
53
|
+
if (spec.allowedEventTypes) {
|
|
54
|
+
paramCopy.ALLOWED_EVENT_TYPES = spec.allowedEventTypes.join(",");
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
instanceId: spec.instanceId,
|
|
58
|
+
ref: spec.ref,
|
|
59
|
+
params: (0, paramHelper_1.buildBindingOptionsWithBaseValue)(paramCopy),
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
const existingConfig = manifest.loadConfig(options);
|
|
63
|
+
await manifest.writeToManifest(manifestSpecs, existingConfig, {
|
|
64
|
+
nonInteractive: options.nonInteractive,
|
|
65
|
+
force: options.force,
|
|
66
|
+
}, true);
|
|
67
|
+
(0, etags_1.saveEtags)(options.rc, projectId, have);
|
|
68
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
6
|
+
const command_1 = require("../command");
|
|
7
|
+
const extensionsApi = require("../extensions/extensionsApi");
|
|
8
|
+
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
9
|
+
const localHelper_1 = require("../extensions/localHelper");
|
|
10
|
+
const logger_1 = require("../logger");
|
|
11
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
12
|
+
const utils = require("../utils");
|
|
13
|
+
const marked_1 = require("marked");
|
|
14
|
+
const TerminalRenderer = require("marked-terminal");
|
|
15
|
+
const FUNCTION_TYPE_REGEX = /\..+\.function/;
|
|
16
|
+
exports.command = new command_1.Command("ext:info <extensionName>")
|
|
17
|
+
.description("display information about an extension by name (extensionName@x.y.z for a specific version)")
|
|
18
|
+
.option("--markdown", "output info in Markdown suitable for constructing a README file")
|
|
19
|
+
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
|
|
20
|
+
.action(async (extensionName, options) => {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
let spec;
|
|
23
|
+
if ((0, localHelper_1.isLocalExtension)(extensionName)) {
|
|
24
|
+
if (!options.markdown) {
|
|
25
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `reading extension from directory: ${extensionName}`);
|
|
26
|
+
}
|
|
27
|
+
spec = await (0, localHelper_1.getLocalExtensionSpec)(extensionName);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
await (0, requirePermissions_1.requirePermissions)(options, ["firebaseextensions.sources.get"]);
|
|
31
|
+
await (0, extensionsHelper_1.ensureExtensionsApiEnabled)(options);
|
|
32
|
+
const hasPublisherId = extensionName.split("/").length >= 2;
|
|
33
|
+
if (hasPublisherId) {
|
|
34
|
+
const nameAndVersion = extensionName.split("/")[1];
|
|
35
|
+
if (nameAndVersion.split("@").length < 2) {
|
|
36
|
+
extensionName = extensionName + "@latest";
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const [name, version] = extensionName.split("@");
|
|
41
|
+
extensionName = `firebase/${name}@${version || "latest"}`;
|
|
42
|
+
}
|
|
43
|
+
const version = await extensionsApi.getExtensionVersion(extensionName);
|
|
44
|
+
spec = version.spec;
|
|
45
|
+
}
|
|
46
|
+
if (!options.markdown) {
|
|
47
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `information about ${extensionName}:\n`);
|
|
48
|
+
}
|
|
49
|
+
const lines = [];
|
|
50
|
+
if (options.markdown) {
|
|
51
|
+
lines.push(`# ${spec.displayName}`);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
lines.push(`**Name**: ${spec.displayName}`);
|
|
55
|
+
}
|
|
56
|
+
const authorName = (_a = spec.author) === null || _a === void 0 ? void 0 : _a.authorName;
|
|
57
|
+
const url = (_b = spec.author) === null || _b === void 0 ? void 0 : _b.url;
|
|
58
|
+
const urlMarkdown = url ? `(**[${url}](${url})**)` : "";
|
|
59
|
+
lines.push(`**Author**: ${authorName} ${urlMarkdown}`);
|
|
60
|
+
if (spec.description) {
|
|
61
|
+
lines.push(`**Description**: ${spec.description}`);
|
|
62
|
+
}
|
|
63
|
+
if (spec.preinstallContent) {
|
|
64
|
+
lines.push("", `**Details**: ${spec.preinstallContent}`);
|
|
65
|
+
}
|
|
66
|
+
if (spec.params && Array.isArray(spec.params) && spec.params.length > 0) {
|
|
67
|
+
lines.push("", "**Configuration Parameters:**");
|
|
68
|
+
for (const param of spec.params) {
|
|
69
|
+
lines.push(`* ${param.label}` + (param.description ? `: ${param.description}` : ""));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const functions = [];
|
|
73
|
+
const otherResources = [];
|
|
74
|
+
for (const resource of spec.resources) {
|
|
75
|
+
if (FUNCTION_TYPE_REGEX.test(resource.type)) {
|
|
76
|
+
functions.push(resource);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
otherResources.push(resource);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (functions.length > 0) {
|
|
83
|
+
lines.push("", "**Cloud Functions:**");
|
|
84
|
+
for (const func of functions) {
|
|
85
|
+
lines.push(`* **${func.name}:** ${func.description}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (otherResources.length > 0) {
|
|
89
|
+
lines.push("", "**Other Resources**:");
|
|
90
|
+
for (const resource of otherResources) {
|
|
91
|
+
lines.push(`* ${resource.name} (${resource.type})`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (spec.apis) {
|
|
95
|
+
lines.push("", "**APIs Used**:");
|
|
96
|
+
for (const api of spec.apis) {
|
|
97
|
+
lines.push(`* ${api.apiName}` + (api.reason ? ` (Reason: ${api.reason})` : ""));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (spec.roles) {
|
|
101
|
+
lines.push("", "**Access Required**:");
|
|
102
|
+
lines.push("", "This extension will operate with the following project IAM roles:");
|
|
103
|
+
for (const role of spec.roles) {
|
|
104
|
+
lines.push(`* ${role.role}` + (role.reason ? ` (Reason: ${role.reason})` : ""));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
if (options.markdown) {
|
|
108
|
+
logger_1.logger.info(lines.join("\n\n"));
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
marked_1.marked.setOptions({
|
|
112
|
+
renderer: new TerminalRenderer(),
|
|
113
|
+
});
|
|
114
|
+
logger_1.logger.info((0, marked_1.marked)(lines.join("\n")));
|
|
115
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `to install this extension, type ` +
|
|
116
|
+
clc.bold(`firebase ext:install ${extensionName} --project=YOUR_PROJECT`));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const marked_1 = require("marked");
|
|
6
|
+
const semver = require("semver");
|
|
7
|
+
const TerminalRenderer = require("marked-terminal");
|
|
8
|
+
const displayExtensionInfo_1 = require("../extensions/displayExtensionInfo");
|
|
9
|
+
const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
|
|
10
|
+
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
11
|
+
const command_1 = require("../command");
|
|
12
|
+
const error_1 = require("../error");
|
|
13
|
+
const logger_1 = require("../logger");
|
|
14
|
+
const projectUtils_1 = require("../projectUtils");
|
|
15
|
+
const extensionsApi = require("../extensions/extensionsApi");
|
|
16
|
+
const refs = require("../extensions/refs");
|
|
17
|
+
const secretsUtils = require("../extensions/secretsUtils");
|
|
18
|
+
const paramHelper = require("../extensions/paramHelper");
|
|
19
|
+
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
20
|
+
const planner_1 = require("../deploy/extensions/planner");
|
|
21
|
+
const utils_1 = require("../extensions/utils");
|
|
22
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
23
|
+
const utils = require("../utils");
|
|
24
|
+
const track_1 = require("../track");
|
|
25
|
+
const prompt_1 = require("../prompt");
|
|
26
|
+
const manifest = require("../extensions/manifest");
|
|
27
|
+
const tos_1 = require("../extensions/tos");
|
|
28
|
+
marked_1.marked.setOptions({
|
|
29
|
+
renderer: new TerminalRenderer(),
|
|
30
|
+
});
|
|
31
|
+
exports.command = new command_1.Command("ext:install [extensionRef]")
|
|
32
|
+
.description("add an uploaded extension to firebase.json if [publisherId/extensionId] is provided;" +
|
|
33
|
+
"or, add a local extension if [localPath] is provided")
|
|
34
|
+
.option("--local", "deprecated")
|
|
35
|
+
.withForce()
|
|
36
|
+
.before(requirePermissions_1.requirePermissions, ["firebaseextensions.instances.create"])
|
|
37
|
+
.before(extensionsHelper_1.ensureExtensionsApiEnabled)
|
|
38
|
+
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
|
|
39
|
+
.before(extensionsHelper_1.diagnoseAndFixProject)
|
|
40
|
+
.action(async (extensionRef, options) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
if (options.local) {
|
|
43
|
+
utils.logLabeledWarning(extensionsHelper_1.logPrefix, "As of firebase-tools@11.0.0, the `--local` flag is no longer required, as it is the default behavior.");
|
|
44
|
+
}
|
|
45
|
+
if (!extensionRef) {
|
|
46
|
+
throw new error_1.FirebaseError("Extension ref is required to install. To see a full list of available extensions, go to Extensions Hub (https://extensions.dev/extensions).");
|
|
47
|
+
}
|
|
48
|
+
let source;
|
|
49
|
+
let extensionVersion;
|
|
50
|
+
const projectId = (0, projectUtils_1.getProjectId)(options);
|
|
51
|
+
if ((0, extensionsHelper_1.isLocalPath)(extensionRef)) {
|
|
52
|
+
source = await (0, extensionsHelper_1.createSourceFromLocation)((0, projectUtils_1.needProjectId)({ projectId }), extensionRef);
|
|
53
|
+
await (0, displayExtensionInfo_1.displayExtensionVersionInfo)({ spec: source.spec });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
const extension = await extensionsApi.getExtension(extensionRef);
|
|
57
|
+
const ref = refs.parse(extensionRef);
|
|
58
|
+
ref.version = await (0, planner_1.resolveVersion)(ref, extension);
|
|
59
|
+
const extensionVersionRef = refs.toExtensionVersionRef(ref);
|
|
60
|
+
extensionVersion = await extensionsApi.getExtensionVersion(extensionVersionRef);
|
|
61
|
+
await (0, displayExtensionInfo_1.displayExtensionVersionInfo)({
|
|
62
|
+
spec: extensionVersion.spec,
|
|
63
|
+
extensionVersion,
|
|
64
|
+
latestApprovedVersion: extension.latestApprovedVersion,
|
|
65
|
+
latestVersion: extension.latestVersion,
|
|
66
|
+
});
|
|
67
|
+
if (extensionVersion.state === "DEPRECATED") {
|
|
68
|
+
throw new error_1.FirebaseError(`Extension version ${clc.bold(extensionVersionRef)} is deprecated and cannot be installed. To install the latest non-deprecated version, omit the version in the extension ref.`);
|
|
69
|
+
}
|
|
70
|
+
logger_1.logger.info();
|
|
71
|
+
if ((extension.latestApprovedVersion &&
|
|
72
|
+
semver.gt(extension.latestApprovedVersion, extensionVersion.spec.version)) ||
|
|
73
|
+
(!extension.latestApprovedVersion &&
|
|
74
|
+
extension.latestVersion &&
|
|
75
|
+
semver.gt(extension.latestVersion, extensionVersion.spec.version))) {
|
|
76
|
+
const version = extension.latestApprovedVersion || extension.latestVersion;
|
|
77
|
+
logger_1.logger.info(`You are about to install extension version ${clc.bold(extensionVersion.spec.version)} which is older than the latest ${extension.latestApprovedVersion ? "accepted version" : "version"} ${clc.bold(version)}.`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (!source && !extensionVersion) {
|
|
81
|
+
throw new error_1.FirebaseError(`Failed to parse ${clc.bold(extensionRef)} as an extension version or a path to a local extension. Please specify a valid reference.`);
|
|
82
|
+
}
|
|
83
|
+
if (!(await (0, prompt_1.confirm)({
|
|
84
|
+
nonInteractive: options.nonInteractive,
|
|
85
|
+
force: options.force,
|
|
86
|
+
default: true,
|
|
87
|
+
}))) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const spec = (_a = source === null || source === void 0 ? void 0 : source.spec) !== null && _a !== void 0 ? _a : extensionVersion === null || extensionVersion === void 0 ? void 0 : extensionVersion.spec;
|
|
91
|
+
if (!spec) {
|
|
92
|
+
throw new error_1.FirebaseError(`Could not find the extension.yaml for extension '${clc.bold(extensionRef)}'. Please make sure this is a valid extension and try again.`);
|
|
93
|
+
}
|
|
94
|
+
if (source) {
|
|
95
|
+
void (0, track_1.trackGA4)("extension_added_to_manifest", {
|
|
96
|
+
published: "local",
|
|
97
|
+
interactive: options.nonInteractive ? "false" : "true",
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
else if (extensionVersion) {
|
|
101
|
+
void (0, track_1.trackGA4)("extension_added_to_manifest", {
|
|
102
|
+
published: ((_b = extensionVersion.listing) === null || _b === void 0 ? void 0 : _b.state) === "APPROVED" ? "published" : "uploaded",
|
|
103
|
+
interactive: options.nonInteractive ? "false" : "true",
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
return installToManifest({
|
|
108
|
+
projectId,
|
|
109
|
+
extensionRef,
|
|
110
|
+
source,
|
|
111
|
+
extVersion: extensionVersion,
|
|
112
|
+
nonInteractive: options.nonInteractive,
|
|
113
|
+
force: options.force,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
if (!(err instanceof error_1.FirebaseError)) {
|
|
118
|
+
throw new error_1.FirebaseError(`Error occurred saving the extension to manifest: ${err.message}`, {
|
|
119
|
+
original: err,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
throw err;
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
async function installToManifest(options) {
|
|
126
|
+
var _a, _b, _c;
|
|
127
|
+
const { projectId, extensionRef, extVersion, source, nonInteractive, force } = options;
|
|
128
|
+
const isLocalSource = (0, extensionsHelper_1.isLocalPath)(extensionRef);
|
|
129
|
+
const spec = (_a = extVersion === null || extVersion === void 0 ? void 0 : extVersion.spec) !== null && _a !== void 0 ? _a : source === null || source === void 0 ? void 0 : source.spec;
|
|
130
|
+
if (!spec) {
|
|
131
|
+
throw new error_1.FirebaseError(`Could not find the extension.yaml for ${extensionRef}. Please make sure this is a valid extension and try again.`);
|
|
132
|
+
}
|
|
133
|
+
if (secretsUtils.usesSecrets(spec)) {
|
|
134
|
+
await secretsUtils.ensureSecretManagerApiEnabled(options);
|
|
135
|
+
}
|
|
136
|
+
const config = manifest.loadConfig(options);
|
|
137
|
+
let instanceId = spec.name;
|
|
138
|
+
while (manifest.instanceExists(instanceId, config)) {
|
|
139
|
+
instanceId = await (0, extensionsHelper_1.promptForValidInstanceId)(`${spec.name}-${(0, utils_1.getRandomString)(4)}`);
|
|
140
|
+
}
|
|
141
|
+
const paramBindingOptions = await paramHelper.getParams({
|
|
142
|
+
projectId,
|
|
143
|
+
paramSpecs: ((_b = spec.params) !== null && _b !== void 0 ? _b : []).concat((_c = spec.systemParams) !== null && _c !== void 0 ? _c : []),
|
|
144
|
+
nonInteractive,
|
|
145
|
+
instanceId,
|
|
146
|
+
});
|
|
147
|
+
const eventsConfig = spec.events
|
|
148
|
+
? await askUserForEventsConfig.askForEventsConfig(spec.events, "${param:PROJECT_ID}", instanceId)
|
|
149
|
+
: undefined;
|
|
150
|
+
if (eventsConfig) {
|
|
151
|
+
paramBindingOptions.EVENTARC_CHANNEL = { baseValue: eventsConfig.channel };
|
|
152
|
+
paramBindingOptions.ALLOWED_EVENT_TYPES = {
|
|
153
|
+
baseValue: eventsConfig.allowedEventTypes.join(","),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const ref = extVersion ? refs.parse(extVersion.ref) : undefined;
|
|
157
|
+
await manifest.writeToManifest([
|
|
158
|
+
{
|
|
159
|
+
instanceId,
|
|
160
|
+
ref: !isLocalSource ? ref : undefined,
|
|
161
|
+
localPath: isLocalSource ? extensionRef : undefined,
|
|
162
|
+
params: paramBindingOptions,
|
|
163
|
+
extensionSpec: spec,
|
|
164
|
+
},
|
|
165
|
+
], config, { nonInteractive, force: force !== null && force !== void 0 ? force : false });
|
|
166
|
+
(0, tos_1.displayDeveloperTOSWarning)();
|
|
167
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
5
|
+
const command_1 = require("../command");
|
|
6
|
+
const projectUtils_1 = require("../projectUtils");
|
|
7
|
+
const listExtensions_1 = require("../extensions/listExtensions");
|
|
8
|
+
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
exports.command = new command_1.Command("ext:list")
|
|
11
|
+
.description("list all the extensions that are installed in your Firebase project")
|
|
12
|
+
.before(requirePermissions_1.requirePermissions, ["firebaseextensions.instances.list"])
|
|
13
|
+
.before(extensionsHelper_1.ensureExtensionsApiEnabled)
|
|
14
|
+
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
|
|
15
|
+
.action((options) => {
|
|
16
|
+
const projectId = (0, projectUtils_1.needProjectId)(options);
|
|
17
|
+
return (0, listExtensions_1.listExtensions)(projectId);
|
|
18
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const marked_1 = require("marked");
|
|
5
|
+
const TerminalRenderer = require("marked-terminal");
|
|
6
|
+
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
7
|
+
const command_1 = require("../command");
|
|
8
|
+
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
9
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const manifest = require("../extensions/manifest");
|
|
12
|
+
marked_1.marked.setOptions({
|
|
13
|
+
renderer: new TerminalRenderer(),
|
|
14
|
+
});
|
|
15
|
+
exports.command = new command_1.Command("ext:uninstall <extensionInstanceId>")
|
|
16
|
+
.description("uninstall an extension that is installed in your Firebase project by instance ID")
|
|
17
|
+
.option("--local", "deprecated")
|
|
18
|
+
.withForce()
|
|
19
|
+
.before(requirePermissions_1.requirePermissions, ["firebaseextensions.instances.delete"])
|
|
20
|
+
.before(extensionsHelper_1.ensureExtensionsApiEnabled)
|
|
21
|
+
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
|
|
22
|
+
.before(extensionsHelper_1.diagnoseAndFixProject)
|
|
23
|
+
.action((instanceId, options) => {
|
|
24
|
+
if (options.local) {
|
|
25
|
+
(0, utils_1.logLabeledWarning)(extensionsHelper_1.logPrefix, "As of firebase-tools@11.0.0, the `--local` flag is no longer required, as it is the default behavior.");
|
|
26
|
+
}
|
|
27
|
+
const config = manifest.loadConfig(options);
|
|
28
|
+
manifest.removeFromManifest(instanceId, config);
|
|
29
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.command = void 0;
|
|
4
|
+
const clc = require("colorette");
|
|
5
|
+
const marked_1 = require("marked");
|
|
6
|
+
const TerminalRenderer = require("marked-terminal");
|
|
7
|
+
const checkMinRequiredVersion_1 = require("../checkMinRequiredVersion");
|
|
8
|
+
const command_1 = require("../command");
|
|
9
|
+
const error_1 = require("../error");
|
|
10
|
+
const extensionsApi = require("../extensions/extensionsApi");
|
|
11
|
+
const extensionsHelper_1 = require("../extensions/extensionsHelper");
|
|
12
|
+
const paramHelper = require("../extensions/paramHelper");
|
|
13
|
+
const updateHelper_1 = require("../extensions/updateHelper");
|
|
14
|
+
const secretsUtils = require("../extensions/secretsUtils");
|
|
15
|
+
const refs = require("../extensions/refs");
|
|
16
|
+
const projectUtils_1 = require("../projectUtils");
|
|
17
|
+
const requirePermissions_1 = require("../requirePermissions");
|
|
18
|
+
const utils = require("../utils");
|
|
19
|
+
const prompt_1 = require("../prompt");
|
|
20
|
+
const manifest = require("../extensions/manifest");
|
|
21
|
+
const askUserForEventsConfig = require("../extensions/askUserForEventsConfig");
|
|
22
|
+
const tos_1 = require("../extensions/tos");
|
|
23
|
+
marked_1.marked.setOptions({
|
|
24
|
+
renderer: new TerminalRenderer(),
|
|
25
|
+
});
|
|
26
|
+
exports.command = new command_1.Command("ext:update <extensionInstanceId> [updateSource]")
|
|
27
|
+
.description("update an existing extension instance to the latest version, or to a specific version if provided")
|
|
28
|
+
.before(requirePermissions_1.requirePermissions, [
|
|
29
|
+
"firebaseextensions.instances.update",
|
|
30
|
+
"firebaseextensions.instances.get",
|
|
31
|
+
])
|
|
32
|
+
.before(extensionsHelper_1.ensureExtensionsApiEnabled)
|
|
33
|
+
.before(checkMinRequiredVersion_1.checkMinRequiredVersion, "extMinVersion")
|
|
34
|
+
.before(extensionsHelper_1.diagnoseAndFixProject)
|
|
35
|
+
.withForce()
|
|
36
|
+
.action(async (instanceId, updateSource, options) => {
|
|
37
|
+
const projectId = (0, projectUtils_1.getProjectId)(options);
|
|
38
|
+
const config = manifest.loadConfig(options);
|
|
39
|
+
const oldRefOrPath = manifest.getInstanceTarget(instanceId, config);
|
|
40
|
+
if ((0, extensionsHelper_1.isLocalPath)(oldRefOrPath)) {
|
|
41
|
+
throw new error_1.FirebaseError(`Updating an extension with local source is not neccessary. ` +
|
|
42
|
+
`Rerun "firebase deploy" or restart the emulator after making changes to your local extension source. ` +
|
|
43
|
+
`If you've edited the extension param spec, you can edit an extension instance's params ` +
|
|
44
|
+
`interactively by running "firebase ext:configure --local {instance-id}"`);
|
|
45
|
+
}
|
|
46
|
+
const oldRef = manifest.getInstanceRef(instanceId, config);
|
|
47
|
+
const oldExtensionVersion = await extensionsApi.getExtensionVersion(refs.toExtensionVersionRef(oldRef));
|
|
48
|
+
updateSource = (0, updateHelper_1.inferUpdateSource)(updateSource, refs.toExtensionRef(oldRef));
|
|
49
|
+
const newSourceOrigin = (0, extensionsHelper_1.getSourceOrigin)(updateSource);
|
|
50
|
+
if (![extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION, extensionsHelper_1.SourceOrigin.PUBLISHED_EXTENSION_VERSION].includes(newSourceOrigin)) {
|
|
51
|
+
throw new error_1.FirebaseError(`Only updating to a published extension version is allowed`);
|
|
52
|
+
}
|
|
53
|
+
const newExtensionVersion = await extensionsApi.getExtensionVersion(updateSource);
|
|
54
|
+
if (oldExtensionVersion.ref === newExtensionVersion.ref) {
|
|
55
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `${clc.bold(instanceId)} is already up to date. Its version is ${clc.bold(newExtensionVersion.ref)}.`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, `Updating ${clc.bold(instanceId)} from version ${clc.bold(oldExtensionVersion.ref)} to version ${clc.bold(newExtensionVersion.ref)}.`);
|
|
59
|
+
if (!(await (0, prompt_1.confirm)({
|
|
60
|
+
nonInteractive: options.nonInteractive,
|
|
61
|
+
force: options.force,
|
|
62
|
+
default: false,
|
|
63
|
+
}))) {
|
|
64
|
+
utils.logLabeledBullet(extensionsHelper_1.logPrefix, "Update aborted.");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (secretsUtils.usesSecrets(newExtensionVersion.spec)) {
|
|
68
|
+
await secretsUtils.ensureSecretManagerApiEnabled(options);
|
|
69
|
+
}
|
|
70
|
+
const oldParamValues = manifest.readInstanceParam({
|
|
71
|
+
instanceId,
|
|
72
|
+
projectDir: config.projectDir,
|
|
73
|
+
});
|
|
74
|
+
const newParamBindingOptions = await paramHelper.getParamsForUpdate({
|
|
75
|
+
spec: oldExtensionVersion.spec,
|
|
76
|
+
newSpec: newExtensionVersion.spec,
|
|
77
|
+
currentParams: oldParamValues,
|
|
78
|
+
projectId,
|
|
79
|
+
nonInteractive: options.nonInteractive,
|
|
80
|
+
instanceId,
|
|
81
|
+
});
|
|
82
|
+
const eventsConfig = newExtensionVersion.spec.events
|
|
83
|
+
? await askUserForEventsConfig.askForEventsConfig(newExtensionVersion.spec.events, "${param:PROJECT_ID}", instanceId)
|
|
84
|
+
: undefined;
|
|
85
|
+
if (eventsConfig) {
|
|
86
|
+
newParamBindingOptions.EVENTARC_CHANNEL = { baseValue: eventsConfig.channel };
|
|
87
|
+
newParamBindingOptions.ALLOWED_EVENT_TYPES = {
|
|
88
|
+
baseValue: eventsConfig.allowedEventTypes.join(","),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
await manifest.writeToManifest([
|
|
92
|
+
{
|
|
93
|
+
instanceId,
|
|
94
|
+
ref: refs.parse(newExtensionVersion.ref),
|
|
95
|
+
params: newParamBindingOptions,
|
|
96
|
+
extensionSpec: newExtensionVersion.spec,
|
|
97
|
+
extensionVersion: newExtensionVersion,
|
|
98
|
+
},
|
|
99
|
+
], config, {
|
|
100
|
+
nonInteractive: options.nonInteractive,
|
|
101
|
+
force: true,
|
|
102
|
+
});
|
|
103
|
+
(0, tos_1.displayDeveloperTOSWarning)();
|
|
104
|
+
return;
|
|
105
|
+
});
|