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,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mirrorFieldTo = exports.authEmulatorUrl = exports.logError = exports.toUnixTimestamp = exports.randomDigits = exports.randomBase64UrlStr = exports.randomId = exports.parseAbsoluteUri = exports.canonicalizeEmailAddress = exports.isValidPhoneNumber = exports.isValidEmailAddress = void 0;
|
|
4
|
+
const url_1 = require("url");
|
|
5
|
+
const registry_1 = require("../registry");
|
|
6
|
+
const types_1 = require("../types");
|
|
7
|
+
const emulatorLogger_1 = require("../emulatorLogger");
|
|
8
|
+
function isValidEmailAddress(email) {
|
|
9
|
+
return /^[^@]+@[^@]+$/.test(email);
|
|
10
|
+
}
|
|
11
|
+
exports.isValidEmailAddress = isValidEmailAddress;
|
|
12
|
+
function isValidPhoneNumber(phoneNumber) {
|
|
13
|
+
return /^\+/.test(phoneNumber);
|
|
14
|
+
}
|
|
15
|
+
exports.isValidPhoneNumber = isValidPhoneNumber;
|
|
16
|
+
function canonicalizeEmailAddress(email) {
|
|
17
|
+
return email.toLowerCase();
|
|
18
|
+
}
|
|
19
|
+
exports.canonicalizeEmailAddress = canonicalizeEmailAddress;
|
|
20
|
+
function parseAbsoluteUri(uri) {
|
|
21
|
+
try {
|
|
22
|
+
return new url_1.URL(uri);
|
|
23
|
+
}
|
|
24
|
+
catch (_a) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.parseAbsoluteUri = parseAbsoluteUri;
|
|
29
|
+
function randomId(len) {
|
|
30
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
31
|
+
let autoId = "";
|
|
32
|
+
for (let i = 0; i < len; i++) {
|
|
33
|
+
autoId += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
34
|
+
}
|
|
35
|
+
return autoId;
|
|
36
|
+
}
|
|
37
|
+
exports.randomId = randomId;
|
|
38
|
+
function randomBase64UrlStr(len) {
|
|
39
|
+
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-";
|
|
40
|
+
let autoId = "";
|
|
41
|
+
for (let i = 0; i < len; i++) {
|
|
42
|
+
autoId += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
43
|
+
}
|
|
44
|
+
return autoId;
|
|
45
|
+
}
|
|
46
|
+
exports.randomBase64UrlStr = randomBase64UrlStr;
|
|
47
|
+
function randomDigits(len) {
|
|
48
|
+
let digits = "";
|
|
49
|
+
for (let i = 0; i < len; i++) {
|
|
50
|
+
digits += Math.floor(Math.random() * 10);
|
|
51
|
+
}
|
|
52
|
+
return digits;
|
|
53
|
+
}
|
|
54
|
+
exports.randomDigits = randomDigits;
|
|
55
|
+
function toUnixTimestamp(date) {
|
|
56
|
+
return Math.floor(date.getTime() / 1000);
|
|
57
|
+
}
|
|
58
|
+
exports.toUnixTimestamp = toUnixTimestamp;
|
|
59
|
+
function logError(err) {
|
|
60
|
+
if (!registry_1.EmulatorRegistry.isRunning(types_1.Emulators.AUTH)) {
|
|
61
|
+
console.error(err);
|
|
62
|
+
}
|
|
63
|
+
emulatorLogger_1.EmulatorLogger.forEmulator(types_1.Emulators.AUTH).log("WARN", err.stack || err.message || err.constructor.name);
|
|
64
|
+
}
|
|
65
|
+
exports.logError = logError;
|
|
66
|
+
function authEmulatorUrl(req) {
|
|
67
|
+
if (registry_1.EmulatorRegistry.isRunning(types_1.Emulators.AUTH)) {
|
|
68
|
+
return registry_1.EmulatorRegistry.url(types_1.Emulators.AUTH);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return registry_1.EmulatorRegistry.url(types_1.Emulators.AUTH, req);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.authEmulatorUrl = authEmulatorUrl;
|
|
75
|
+
function mirrorFieldTo(dest, field, source) {
|
|
76
|
+
const value = source[field];
|
|
77
|
+
if (value === undefined) {
|
|
78
|
+
delete dest[field];
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
dest[field] = value;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.mirrorFieldTo = mirrorFieldTo;
|
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WIDGET_UI = exports.PROVIDERS_LIST_PLACEHOLDER = void 0;
|
|
4
|
+
const SCRIPT = `
|
|
5
|
+
function assert(condition, error) {
|
|
6
|
+
if (!condition) {
|
|
7
|
+
if (!(error instanceof Error)) {
|
|
8
|
+
error = new Error('Auth Emulator Internal Error: ' + error);
|
|
9
|
+
}
|
|
10
|
+
// Show error with great visibility AND stops further user interactions.
|
|
11
|
+
document.body.textContent = error.stack || error.message;
|
|
12
|
+
document.body.style = 'color:red;white-space:pre';
|
|
13
|
+
throw error; // Halts current script and prints error to console.
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// TODO: Support older browsers where URLSearchParams is not available.
|
|
18
|
+
var query = new URLSearchParams(location.search);
|
|
19
|
+
var internalError = query.get('error');
|
|
20
|
+
assert(!internalError, internalError);
|
|
21
|
+
|
|
22
|
+
var apiKey = query.get('apiKey');
|
|
23
|
+
var appName = query.get('appName');
|
|
24
|
+
var authType = query.get('authType');
|
|
25
|
+
var providerId = query.get('providerId');
|
|
26
|
+
var redirectUrl = query.get('redirectUrl');
|
|
27
|
+
var scopes = query.get('scopes');
|
|
28
|
+
var eventId = query.get('eventId');
|
|
29
|
+
var storageKey = apiKey + ':' + appName;
|
|
30
|
+
|
|
31
|
+
var clientId = query.get('clientId');
|
|
32
|
+
var firebaseAppId = query.get('appId');
|
|
33
|
+
var apn = query.get('apn');
|
|
34
|
+
var ibi = query.get('ibi');
|
|
35
|
+
var appIdentifier = apn || ibi;
|
|
36
|
+
var isSamlProvider = !!providerId.match(/^saml\./);
|
|
37
|
+
assert(
|
|
38
|
+
appName || clientId || firebaseAppId || appIdentifier,
|
|
39
|
+
'Missing one of appName / clientId / appId / apn / ibi query params.'
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Warn the developer of a few flows only available in Auth Emulator.
|
|
43
|
+
if ((providerId === 'facebook.com' && appIdentifier) || (providerId === 'apple.com' && ibi)) {
|
|
44
|
+
var providerName = (providerId === 'facebook.com') ? 'Facebook' : 'Apple';
|
|
45
|
+
var productionMethod = providerName + (apn ? ' Android SDK' : ' iOS SDK');
|
|
46
|
+
var warningEl = document.querySelector('.js-signin-warning');
|
|
47
|
+
warningEl.querySelector('.content').textContent =
|
|
48
|
+
'Sign-in with ' + providerName + ' via generic IDP is only supported in the Auth Emulator; ' +
|
|
49
|
+
'remember to switch to ' + productionMethod + ' for production Firebase projects.';
|
|
50
|
+
warningEl.style.display = 'flex';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function saveAuthEvent(authEvent) {
|
|
54
|
+
if (/popup/i.test(authType)) {
|
|
55
|
+
sendAuthEventViaIframeRelay(authEvent, function (err) {
|
|
56
|
+
assert(!err, err);
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
if (apn) {
|
|
60
|
+
redirectToAndroid(authEvent);
|
|
61
|
+
} else if (ibi) {
|
|
62
|
+
redirectToIos(authEvent);
|
|
63
|
+
} else if (redirectUrl) {
|
|
64
|
+
saveAuthEventToStorage(authEvent);
|
|
65
|
+
window.location = redirectUrl;
|
|
66
|
+
} else {
|
|
67
|
+
assert(false, 'This feature is not implemented in Auth Emulator yet. Please use signInWithCredential for now.');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function saveAuthEventToStorage(authEvent) {
|
|
73
|
+
sessionStorage['firebase:redirectEvent:' + storageKey] =
|
|
74
|
+
JSON.stringify(authEvent);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function sendAuthEventViaIframeRelay(authEvent, cb) {
|
|
78
|
+
var sent = false;
|
|
79
|
+
if (window.opener) {
|
|
80
|
+
for (var i = 0; i < window.opener.frames.length; i++) {
|
|
81
|
+
// Try/catch is necessary because without it, the code will crash the first time one of the frames does not have
|
|
82
|
+
// the same origin (from the iframeWin.location.search) and the loop will not reach the other frames.
|
|
83
|
+
try {
|
|
84
|
+
var iframeWin = window.opener.frames[i];
|
|
85
|
+
var query = new URLSearchParams(iframeWin.location.search);
|
|
86
|
+
if (query.get('apiKey') === apiKey && query.get('appName') === appName) {
|
|
87
|
+
iframeWin.postMessage({
|
|
88
|
+
data: {authEvent: authEvent, storageKey: storageKey},
|
|
89
|
+
eventId: Math.floor(Math.random() * Math.pow(10, 20)).toString(),
|
|
90
|
+
eventType: "sendAuthEvent",
|
|
91
|
+
}, '*');
|
|
92
|
+
sent = true;
|
|
93
|
+
}
|
|
94
|
+
} catch (e) {
|
|
95
|
+
// The frame does not have the same origin
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (!sent) {
|
|
100
|
+
return cb('No matching frame');
|
|
101
|
+
}
|
|
102
|
+
return cb();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function redirectToAndroid(authEvent) {
|
|
106
|
+
// This is shown when no app handles the link and displays an error.
|
|
107
|
+
var fallbackUrl = window.location.href + '&error=App+not+found+for+intent';
|
|
108
|
+
|
|
109
|
+
var link = 'intent://firebase.auth/#Intent;scheme=genericidp;' +
|
|
110
|
+
'package=' + apn + ';' +
|
|
111
|
+
'S.authType=' + authEvent.type + ';';
|
|
112
|
+
if (authEvent.eventId) {
|
|
113
|
+
link += 'S.eventId=' + authEvent.eventId + ';';
|
|
114
|
+
}
|
|
115
|
+
link += 'S.link=' + encodeURIComponent(authEvent.urlResponse) + ';';
|
|
116
|
+
link += 'B.encryptionEnabled=false;';
|
|
117
|
+
link += 'S.browser_fallback_url=' + encodeURIComponent(fallbackUrl) + ';';
|
|
118
|
+
|
|
119
|
+
link += 'end;';
|
|
120
|
+
|
|
121
|
+
window.location.replace(link);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function redirectToIos(authEvent) {
|
|
125
|
+
// This URL format is based on production widget and known to work with the
|
|
126
|
+
// iOS SDK. It does not matter that /__/auth/callback is not an actual page
|
|
127
|
+
// served by the Auth Emulator -- only the format and query params matter.
|
|
128
|
+
var url = window.location.protocol + '//' + window.location.host +
|
|
129
|
+
'/__/auth/callback?authType=' + encodeURIComponent(authEvent.type) +
|
|
130
|
+
'&link=' + encodeURIComponent(authEvent.urlResponse);
|
|
131
|
+
if (authEvent.eventId) {
|
|
132
|
+
url += '&eventId=' + authEvent.eventId;
|
|
133
|
+
}
|
|
134
|
+
var scheme;
|
|
135
|
+
if (clientId) {
|
|
136
|
+
scheme = clientId.split('.').reverse().join('.');
|
|
137
|
+
} else if (firebaseAppId) {
|
|
138
|
+
scheme = 'app-' + firebaseAppId.replace(/:/g, '-');
|
|
139
|
+
} else {
|
|
140
|
+
scheme = appIdentifier;
|
|
141
|
+
}
|
|
142
|
+
var deepLink = scheme + '://' +
|
|
143
|
+
(clientId || firebaseAppId ? 'firebaseauth' : 'google') + '/link';
|
|
144
|
+
deepLink += '?deep_link_id=' + encodeURIComponent(url);
|
|
145
|
+
|
|
146
|
+
window.location.replace(deepLink);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
// DOM logic
|
|
151
|
+
|
|
152
|
+
var formattedProviderId = providerId[0].toUpperCase() + providerId.substring(1);
|
|
153
|
+
document.querySelectorAll('.js-provider-id').forEach(function(e) {
|
|
154
|
+
e.textContent = formattedProviderId;
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
var reuseAccountEls = document.querySelectorAll('.js-reuse-account');
|
|
158
|
+
if (reuseAccountEls.length) {
|
|
159
|
+
[].forEach.call(reuseAccountEls, function (el) {
|
|
160
|
+
var urlEncodedIdToken = el.dataset.idToken;
|
|
161
|
+
const decoded = JSON.parse(decodeURIComponent(urlEncodedIdToken));
|
|
162
|
+
el.addEventListener('click', function (e) {
|
|
163
|
+
e.preventDefault();
|
|
164
|
+
finishWithUser(urlEncodedIdToken, decoded.email);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
} else {
|
|
168
|
+
document.querySelector('.js-accounts-help-text').textContent = "No " + formattedProviderId + " accounts exist in the Auth Emulator.";
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function finishWithUser(urlEncodedIdToken, email) {
|
|
172
|
+
// Use widget URL, but replace all query parameters (no apiKey etc.).
|
|
173
|
+
var url = window.location.href.split('?')[0];
|
|
174
|
+
// Avoid URLSearchParams for browser compatibility.
|
|
175
|
+
url += '?providerId=' + encodeURIComponent(providerId);
|
|
176
|
+
url += '&id_token=' + urlEncodedIdToken;
|
|
177
|
+
|
|
178
|
+
// Save reasonable defaults for SAML providers
|
|
179
|
+
if (isSamlProvider) {
|
|
180
|
+
url += '&SAMLResponse=' + encodeURIComponent(JSON.stringify({
|
|
181
|
+
assertion: {
|
|
182
|
+
subject: {
|
|
183
|
+
nameId: email,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
saveAuthEvent({
|
|
190
|
+
type: authType,
|
|
191
|
+
eventId: eventId,
|
|
192
|
+
urlResponse: url,
|
|
193
|
+
sessionId: "ValueNotUsedByAuthEmulator",
|
|
194
|
+
postBody: "",
|
|
195
|
+
tenantId: null,
|
|
196
|
+
error: null,
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
document.querySelector('.js-new-account').addEventListener('click', function (e) {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
toggleForm(true);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
var inputs = document.querySelectorAll('.mdc-text-field');
|
|
206
|
+
// Set up styling and reactivity for inputs
|
|
207
|
+
inputs.forEach(function (input) {
|
|
208
|
+
input.querySelector('input').addEventListener('input', function(e) {
|
|
209
|
+
var display = 'none';
|
|
210
|
+
if (!e.target.value) display = 'block';
|
|
211
|
+
input.querySelector('.custom-label').style.display = display;
|
|
212
|
+
validateForm();
|
|
213
|
+
});
|
|
214
|
+
window.mdc && mdc.textField.MDCTextField.attachTo(input);
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
document.getElementById('autogen-button').addEventListener('click', function() {
|
|
218
|
+
runAutogen();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// Handle form validation and submission
|
|
222
|
+
document.getElementById('main-form').addEventListener('submit', function(e) {
|
|
223
|
+
e.preventDefault();
|
|
224
|
+
var valid = validateForm();
|
|
225
|
+
if (valid) {
|
|
226
|
+
var email = document.getElementById('email-input').value;
|
|
227
|
+
var displayName = document.getElementById('display-name-input').value;
|
|
228
|
+
var screenName = document.getElementById('screen-name-input').value;
|
|
229
|
+
var photoUrl = document.getElementById('profile-photo-input').value;
|
|
230
|
+
var claims = {};
|
|
231
|
+
|
|
232
|
+
if (email) claims.email = email;
|
|
233
|
+
if (displayName) claims.displayName = displayName;
|
|
234
|
+
if (screenName) claims.screenName = screenName;
|
|
235
|
+
if (photoUrl) claims.photoUrl = photoUrl;
|
|
236
|
+
|
|
237
|
+
finishWithUser(createFakeClaims(claims), claims.email);
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
document.getElementById('back-button').addEventListener('click', function() {
|
|
242
|
+
toggleForm(false);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
function createFakeClaims(info) {
|
|
246
|
+
return encodeURIComponent(JSON.stringify({
|
|
247
|
+
sub: randomProviderRawId(),
|
|
248
|
+
iss: "",
|
|
249
|
+
aud: "",
|
|
250
|
+
exp: 0,
|
|
251
|
+
iat: 0,
|
|
252
|
+
name: info.displayName,
|
|
253
|
+
screen_name: info.screenName,
|
|
254
|
+
email: info.email,
|
|
255
|
+
email_verified: true, // TODO: Shall we allow changing this?
|
|
256
|
+
picture: info.photoUrl,
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function randomProviderRawId() {
|
|
261
|
+
var str = '';
|
|
262
|
+
for (var i = 0; i < 40; i++) {
|
|
263
|
+
str += Math.floor(Math.random() * 10).toString();
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
return str;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
// For now form validation only checks the email field.
|
|
271
|
+
function validateForm() {
|
|
272
|
+
var emailInput = document.getElementById('email-input');
|
|
273
|
+
var valid = true;
|
|
274
|
+
var value = emailInput.value;
|
|
275
|
+
|
|
276
|
+
if (!value) {
|
|
277
|
+
valid = false;
|
|
278
|
+
emailErrorMessage('Email required');
|
|
279
|
+
} else if (value.indexOf('@') < 0) {
|
|
280
|
+
valid = false;
|
|
281
|
+
emailErrorMessage('Missing "@"');
|
|
282
|
+
} else {
|
|
283
|
+
emailErrorMessage('');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
document.querySelector('#sign-in').disabled = !valid;
|
|
287
|
+
|
|
288
|
+
return valid;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Generates random info for user creation
|
|
292
|
+
function runAutogen() {
|
|
293
|
+
var emailInput = document.getElementById('email-input');
|
|
294
|
+
var displayInput = document.getElementById('display-name-input');
|
|
295
|
+
var screenInput = document.getElementById('screen-name-input');
|
|
296
|
+
|
|
297
|
+
var nameOptions = [
|
|
298
|
+
'raccoon',
|
|
299
|
+
'olive',
|
|
300
|
+
'orange',
|
|
301
|
+
'chicken',
|
|
302
|
+
'mountain',
|
|
303
|
+
'peach',
|
|
304
|
+
'panda',
|
|
305
|
+
'grass',
|
|
306
|
+
'algae',
|
|
307
|
+
'otter'
|
|
308
|
+
];
|
|
309
|
+
|
|
310
|
+
var randomNumber = Math.floor(Math.random() * 1000);
|
|
311
|
+
var givenName = nameOptions[Math.floor(Math.random() * nameOptions.length)];
|
|
312
|
+
var familyName = nameOptions[Math.floor(Math.random() * nameOptions.length)];
|
|
313
|
+
emailInput.value = givenName + '.' + familyName + '.' + randomNumber + '@example.com';
|
|
314
|
+
displayInput.value = capitalize(givenName) + ' ' + capitalize(familyName);
|
|
315
|
+
screenInput.value = familyName + '_' + givenName;
|
|
316
|
+
|
|
317
|
+
emailInput.dispatchEvent(new Event('input'));
|
|
318
|
+
displayInput.dispatchEvent(new Event('input'));
|
|
319
|
+
screenInput.dispatchEvent(new Event('input'));
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
function emailErrorMessage(value) {
|
|
323
|
+
document.getElementById('email-error').innerText = value;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function capitalize(a) {
|
|
327
|
+
return a.charAt(0).toUpperCase() + a.slice(1);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function toggleForm(showForm) {
|
|
331
|
+
document.getElementById('add-user').style.display =
|
|
332
|
+
showForm ? 'block' : 'none';
|
|
333
|
+
document.getElementById('accounts-list').style.display =
|
|
334
|
+
showForm ? 'none' : 'block';
|
|
335
|
+
}
|
|
336
|
+
`;
|
|
337
|
+
const STYLE = `
|
|
338
|
+
|
|
339
|
+
:root {
|
|
340
|
+
--mdc-theme-text-secondary-on-background: rgba(0,0,0,.56);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
body {
|
|
344
|
+
font-family: "Roboto", sans-serif;
|
|
345
|
+
margin: 0;
|
|
346
|
+
padding: 0;
|
|
347
|
+
width: 100%;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
p {
|
|
351
|
+
margin-block-end: 0em;
|
|
352
|
+
margin-block-start: 0em;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
li {
|
|
356
|
+
padding: 8px 16px;
|
|
357
|
+
list-style-type: none;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
ul {
|
|
361
|
+
padding-inline-start: 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
button {
|
|
365
|
+
text-transform: none !important;
|
|
366
|
+
letter-spacing: 0 !important;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
#title {
|
|
370
|
+
align-items: center;
|
|
371
|
+
display: flex;
|
|
372
|
+
flex-direction: row;
|
|
373
|
+
font-size: 24px;
|
|
374
|
+
font-weight: 500;
|
|
375
|
+
margin-bottom: 16px;
|
|
376
|
+
margin-top: 32px;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
#title > span {
|
|
380
|
+
flex: 1;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
#title > button {
|
|
384
|
+
color: #858585;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.subtitle {
|
|
388
|
+
color: var(--mdc-theme-text-secondary-on-background);
|
|
389
|
+
font-size: 14px;
|
|
390
|
+
line-height: 20px;
|
|
391
|
+
margin-block-end: 0em;
|
|
392
|
+
margin-block-start: 0em;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
#content {
|
|
396
|
+
box-sizing: border-box;
|
|
397
|
+
margin: 16px auto;
|
|
398
|
+
max-width: 515px;
|
|
399
|
+
min-width: 300px;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.content-wrapper, .mdc-list--avatar-list .mdc-list-item {
|
|
403
|
+
padding: 0 24px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.mdc-list .mdc-list-item__graphic {
|
|
407
|
+
align-items: center;
|
|
408
|
+
background-color: #c5c5c5;
|
|
409
|
+
background-size: contain;
|
|
410
|
+
border-radius: 50%;
|
|
411
|
+
color: #fff;
|
|
412
|
+
fill: currentColor;
|
|
413
|
+
flex-shrink: 0;
|
|
414
|
+
height: 36px;
|
|
415
|
+
justify-content: center;
|
|
416
|
+
margin-left: 0;
|
|
417
|
+
margin-right: 16px;
|
|
418
|
+
width: 36px;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
#add-account-button {
|
|
422
|
+
height: 56px !important;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.callout {
|
|
426
|
+
background: #e5eaf0;
|
|
427
|
+
color: #476282;
|
|
428
|
+
display: flex;
|
|
429
|
+
flex-direction: row;
|
|
430
|
+
padding: 12px 24px;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.callout-warning {
|
|
434
|
+
background: #fff3e0;
|
|
435
|
+
color: #bf360c;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.callout .content {
|
|
439
|
+
flex: 1;
|
|
440
|
+
align-self: center;
|
|
441
|
+
font-size: 14px;
|
|
442
|
+
font-weight: 500;
|
|
443
|
+
margin-left: 8px;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* Vertical Spaced */
|
|
447
|
+
.vs {
|
|
448
|
+
margin-bottom: 16px;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
.mdc-text-field {
|
|
452
|
+
height: 40px !important;
|
|
453
|
+
width: 100%;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
.form-label {
|
|
457
|
+
color: rgba(0,0,0,.54);
|
|
458
|
+
display: block;
|
|
459
|
+
font-size: 12px;
|
|
460
|
+
margin: 0 0 4px 1px;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.custom-label {
|
|
464
|
+
color: rgba(0,0,0,.38);
|
|
465
|
+
display: inline-block;
|
|
466
|
+
margin-left: 4px;
|
|
467
|
+
transform: translateY(50%);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.error-info {
|
|
471
|
+
color: #C62828;
|
|
472
|
+
display: block;
|
|
473
|
+
font-size: 12px;
|
|
474
|
+
padding-top: 4px;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
#main-action {
|
|
478
|
+
display: flex;
|
|
479
|
+
flex-direction: row;
|
|
480
|
+
justify-content: space-between;
|
|
481
|
+
margin-top: 15px;
|
|
482
|
+
width: 100%;
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
#back-button {
|
|
486
|
+
left: -8px;
|
|
487
|
+
position: relative;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
#add-user {
|
|
491
|
+
display: none;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.fallback-secondary-text {
|
|
495
|
+
color: var(--mdc-theme-text-secondary-on-background);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
`;
|
|
499
|
+
exports.PROVIDERS_LIST_PLACEHOLDER = "__PROVIDERS__";
|
|
500
|
+
exports.WIDGET_UI = `
|
|
501
|
+
<!DOCTYPE html>
|
|
502
|
+
<meta charset="utf-8">
|
|
503
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
504
|
+
<title>Auth Emulator IDP Login Widget</title>
|
|
505
|
+
<link href="https://unpkg.com/material-components-web@10/dist/material-components-web.min.css" rel="stylesheet">
|
|
506
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
|
507
|
+
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500&display=swap" rel="stylesheet">
|
|
508
|
+
<style>${STYLE}</style>
|
|
509
|
+
<div id="content">
|
|
510
|
+
<div class="content-wrapper">
|
|
511
|
+
<div id="title">
|
|
512
|
+
<span>Sign-in with <span class="js-provider-id provider-name">Provider</span></span>
|
|
513
|
+
</div>
|
|
514
|
+
</div>
|
|
515
|
+
<div id="accounts-list">
|
|
516
|
+
<div class="content-wrapper">
|
|
517
|
+
<div class="callout callout-warning vs js-signin-warning" style="display:none">
|
|
518
|
+
<i class="material-icons">error</i>
|
|
519
|
+
<div class="content"></div>
|
|
520
|
+
</div>
|
|
521
|
+
<p class="subtitle js-accounts-help-text">Please select an existing account in the Auth Emulator or add a new one:</p>
|
|
522
|
+
</div>
|
|
523
|
+
<ul class="mdc-list list mdc-list--two-line mdc-list--avatar-list">
|
|
524
|
+
${exports.PROVIDERS_LIST_PLACEHOLDER}
|
|
525
|
+
<li id="add-account-button" class="js-new-account mdc-list-item">
|
|
526
|
+
<button class="mdc-button mdc-button--outlined">
|
|
527
|
+
<div class="mdc-button__ripple"></div>
|
|
528
|
+
<i class="material-icons mdc-button__icon" aria-hidden="true">add</i>
|
|
529
|
+
<span class="mdc-button__label">Add new account</span>
|
|
530
|
+
</button>
|
|
531
|
+
</li>
|
|
532
|
+
</ul>
|
|
533
|
+
</div>
|
|
534
|
+
<div id="add-user">
|
|
535
|
+
<div class="content-wrapper" id="form-content">
|
|
536
|
+
<div class="callout vs">
|
|
537
|
+
<i class="material-icons">info</i>
|
|
538
|
+
<div class="content">
|
|
539
|
+
Custom claims can be added after an account is created
|
|
540
|
+
</div>
|
|
541
|
+
</div>
|
|
542
|
+
<button id="autogen-button" class="vs mdc-button mdc-button--outlined" type="button">
|
|
543
|
+
<div class="mdc-button__ripple"></div>
|
|
544
|
+
<span class="mdc-button__label">Auto-generate user information</span>
|
|
545
|
+
</button>
|
|
546
|
+
<form id="main-form">
|
|
547
|
+
<span class="form-label">Email</span>
|
|
548
|
+
<label class="mdc-text-field mdc-text-field--outlined">
|
|
549
|
+
<input id="email-input" type="text"
|
|
550
|
+
class="mdc-text-field__input test" aria-labelledby="my-label-id">
|
|
551
|
+
<span class="mdc-notched-outline">
|
|
552
|
+
<span class="mdc-notched-outline__leading"></span>
|
|
553
|
+
<span class="mdc-notched-outline__notch">
|
|
554
|
+
<span class="custom-label" id="email-label">Email</span>
|
|
555
|
+
</span>
|
|
556
|
+
<span class="mdc-notched-outline__trailing"></span>
|
|
557
|
+
</span>
|
|
558
|
+
</label>
|
|
559
|
+
<span class="error-info vs" id="email-error"></span>
|
|
560
|
+
|
|
561
|
+
<span class="form-label">Display name (optional)</span>
|
|
562
|
+
<label class="mdc-text-field mdc-text-field--outlined vs">
|
|
563
|
+
<input id="display-name-input" type="text"
|
|
564
|
+
class="mdc-text-field__input test" aria-labelledby="my-label-id">
|
|
565
|
+
<span class="mdc-notched-outline">
|
|
566
|
+
<span class="mdc-notched-outline__leading"></span>
|
|
567
|
+
<span class="mdc-notched-outline__notch">
|
|
568
|
+
<span class="custom-label" id="email-label">Display name</span>
|
|
569
|
+
</span>
|
|
570
|
+
<span class="mdc-notched-outline__trailing"></span>
|
|
571
|
+
</span>
|
|
572
|
+
</label>
|
|
573
|
+
|
|
574
|
+
<span class="form-label">Screen name (optional)</span>
|
|
575
|
+
<label class="mdc-text-field mdc-text-field--outlined vs">
|
|
576
|
+
<input id="screen-name-input" type="text"
|
|
577
|
+
class="mdc-text-field__input test" aria-labelledby="my-label-id">
|
|
578
|
+
<span class="mdc-notched-outline">
|
|
579
|
+
<span class="mdc-notched-outline__leading"></span>
|
|
580
|
+
<span class="mdc-notched-outline__notch">
|
|
581
|
+
<span class="custom-label" id="email-label">Screen name</span>
|
|
582
|
+
</span>
|
|
583
|
+
<span class="mdc-notched-outline__trailing"></span>
|
|
584
|
+
</span>
|
|
585
|
+
</label>
|
|
586
|
+
|
|
587
|
+
<span class="form-label">Profile photo URL (optional)</span>
|
|
588
|
+
<label class="mdc-text-field mdc-text-field--outlined vs">
|
|
589
|
+
<input id="profile-photo-input" type="text"
|
|
590
|
+
class="mdc-text-field__input test" aria-labelledby="my-label-id">
|
|
591
|
+
<span class="mdc-notched-outline">
|
|
592
|
+
<span class="mdc-notched-outline__leading"></span>
|
|
593
|
+
<span class="mdc-notched-outline__notch">
|
|
594
|
+
<span class="custom-label" id="email-label">Profile photo URL</span>
|
|
595
|
+
</span>
|
|
596
|
+
<span class="mdc-notched-outline__trailing"></span>
|
|
597
|
+
</span>
|
|
598
|
+
</label>
|
|
599
|
+
|
|
600
|
+
<div id="main-action" class="vs">
|
|
601
|
+
<button class="mdc-button" id="back-button" type="button">
|
|
602
|
+
<div class="mdc-button__ripple"></div>
|
|
603
|
+
<i class="material-icons mdc-button__icon" aria-hidden="true"
|
|
604
|
+
>arrow_back</i
|
|
605
|
+
>
|
|
606
|
+
<span class="mdc-button__label">Back</span>
|
|
607
|
+
</button>
|
|
608
|
+
<button class="mdc-button mdc-button--raised" id="sign-in" type="submit">
|
|
609
|
+
<span class="mdc-button__label">
|
|
610
|
+
Sign in with <span class="js-provider-id provider-name">Provider</span>
|
|
611
|
+
</span>
|
|
612
|
+
</button>
|
|
613
|
+
</div>
|
|
614
|
+
</form>
|
|
615
|
+
</div>
|
|
616
|
+
</div>
|
|
617
|
+
</div>
|
|
618
|
+
<script src="https://unpkg.com/material-components-web@10/dist/material-components-web.min.js"></script>
|
|
619
|
+
<script>${SCRIPT}</script>
|
|
620
|
+
`;
|