@shopify/cli-kit 0.0.0-nightly-20230110194301
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 +8 -0
- package/README.md +63 -0
- package/assets/auth-error.html +23 -0
- package/assets/empty-url.html +23 -0
- package/assets/favicon.svg +26 -0
- package/assets/missing-code.html +23 -0
- package/assets/missing-state.html +23 -0
- package/assets/style.css +58 -0
- package/assets/success.html +20 -0
- package/dist/api/admin.d.ts +3 -0
- package/dist/api/admin.js +56 -0
- package/dist/api/admin.js.map +1 -0
- package/dist/api/common.d.ts +21 -0
- package/dist/api/common.js +87 -0
- package/dist/api/common.js.map +1 -0
- package/dist/api/graphql/all_app_extension_registrations.d.ts +20 -0
- package/dist/api/graphql/all_app_extension_registrations.js +20 -0
- package/dist/api/graphql/all_app_extension_registrations.js.map +1 -0
- package/dist/api/graphql/all_dev_stores_by_org.d.ts +18 -0
- package/dist/api/graphql/all_dev_stores_by_org.js +21 -0
- package/dist/api/graphql/all_dev_stores_by_org.js.map +1 -0
- package/dist/api/graphql/all_orgs.d.ts +12 -0
- package/dist/api/graphql/all_orgs.js +14 -0
- package/dist/api/graphql/all_orgs.js.map +1 -0
- package/dist/api/graphql/convert_dev_to_test_store.d.ts +16 -0
- package/dist/api/graphql/convert_dev_to_test_store.js +13 -0
- package/dist/api/graphql/convert_dev_to_test_store.js.map +1 -0
- package/dist/api/graphql/create_app.d.ts +29 -0
- package/dist/api/graphql/create_app.js +33 -0
- package/dist/api/graphql/create_app.js.map +1 -0
- package/dist/api/graphql/create_deployment.d.ts +33 -0
- package/dist/api/graphql/create_deployment.js +25 -0
- package/dist/api/graphql/create_deployment.js.map +1 -0
- package/dist/api/graphql/extension_create.d.ts +30 -0
- package/dist/api/graphql/extension_create.js +26 -0
- package/dist/api/graphql/extension_create.js.map +1 -0
- package/dist/api/graphql/extension_specifications.d.ts +27 -0
- package/dist/api/graphql/extension_specifications.js +22 -0
- package/dist/api/graphql/extension_specifications.js.map +1 -0
- package/dist/api/graphql/find_app.d.ts +14 -0
- package/dist/api/graphql/find_app.js +17 -0
- package/dist/api/graphql/find_app.js.map +1 -0
- package/dist/api/graphql/find_org.d.ts +18 -0
- package/dist/api/graphql/find_org.js +21 -0
- package/dist/api/graphql/find_org.js.map +1 -0
- package/dist/api/graphql/find_org_basic.d.ts +11 -0
- package/dist/api/graphql/find_org_basic.js +14 -0
- package/dist/api/graphql/find_org_basic.js.map +1 -0
- package/dist/api/graphql/find_store_by_domain.d.ts +21 -0
- package/dist/api/graphql/find_store_by_domain.js +24 -0
- package/dist/api/graphql/find_store_by_domain.js.map +1 -0
- package/dist/api/graphql/functions/api_schema_definition.d.ts +9 -0
- package/dist/api/graphql/functions/api_schema_definition.js +7 -0
- package/dist/api/graphql/functions/api_schema_definition.js.map +1 -0
- package/dist/api/graphql/functions/app_function_set.d.ts +30 -0
- package/dist/api/graphql/functions/app_function_set.js +38 -0
- package/dist/api/graphql/functions/app_function_set.js.map +1 -0
- package/dist/api/graphql/functions/function_service_proxy.d.ts +4 -0
- package/dist/api/graphql/functions/function_service_proxy.js +7 -0
- package/dist/api/graphql/functions/function_service_proxy.js.map +1 -0
- package/dist/api/graphql/functions/upload_url_generate.d.ts +12 -0
- package/dist/api/graphql/functions/upload_url_generate.js +11 -0
- package/dist/api/graphql/functions/upload_url_generate.js.map +1 -0
- package/dist/api/graphql/generate_signed_upload_url.d.ts +15 -0
- package/dist/api/graphql/generate_signed_upload_url.js +15 -0
- package/dist/api/graphql/generate_signed_upload_url.js.map +1 -0
- package/dist/api/graphql/get_urls.d.ts +10 -0
- package/dist/api/graphql/get_urls.js +10 -0
- package/dist/api/graphql/get_urls.js.map +1 -0
- package/dist/api/graphql/get_variant_id.d.ts +17 -0
- package/dist/api/graphql/get_variant_id.js +20 -0
- package/dist/api/graphql/get_variant_id.js.map +1 -0
- package/dist/api/graphql/index.d.ts +21 -0
- package/dist/api/graphql/index.js +22 -0
- package/dist/api/graphql/index.js.map +1 -0
- package/dist/api/graphql/update_draft.d.ts +33 -0
- package/dist/api/graphql/update_draft.js +24 -0
- package/dist/api/graphql/update_draft.js.map +1 -0
- package/dist/api/graphql/update_urls.d.ts +14 -0
- package/dist/api/graphql/update_urls.js +12 -0
- package/dist/api/graphql/update_urls.js.map +1 -0
- package/dist/api/identity.d.ts +1 -0
- package/dist/api/identity.js +41 -0
- package/dist/api/identity.js.map +1 -0
- package/dist/api/oxygen.d.ts +5 -0
- package/dist/api/oxygen.js +30 -0
- package/dist/api/oxygen.js.map +1 -0
- package/dist/api/partners.d.ts +14 -0
- package/dist/api/partners.js +44 -0
- package/dist/api/partners.js.map +1 -0
- package/dist/api.d.ts +6 -0
- package/dist/api.js +7 -0
- package/dist/api.js.map +1 -0
- package/dist/cli.d.ts +8 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/constants.d.ts +52 -0
- package/dist/constants.js +71 -0
- package/dist/constants.js.map +1 -0
- package/dist/content-tokens.d.ts +44 -0
- package/dist/content-tokens.js +105 -0
- package/dist/content-tokens.js.map +1 -0
- package/dist/environment/fqdn.d.ts +29 -0
- package/dist/environment/fqdn.js +72 -0
- package/dist/environment/fqdn.js.map +1 -0
- package/dist/environment/local.d.ts +92 -0
- package/dist/environment/local.js +169 -0
- package/dist/environment/local.js.map +1 -0
- package/dist/environment/service.d.ts +4 -0
- package/dist/environment/service.js +19 -0
- package/dist/environment/service.js.map +1 -0
- package/dist/environment/spin-cache.d.ts +2 -0
- package/dist/environment/spin-cache.js +8 -0
- package/dist/environment/spin-cache.js.map +1 -0
- package/dist/environment/spin.d.ts +50 -0
- package/dist/environment/spin.js +99 -0
- package/dist/environment/spin.js.map +1 -0
- package/dist/environment/utilities.d.ts +8 -0
- package/dist/environment/utilities.js +19 -0
- package/dist/environment/utilities.js.map +1 -0
- package/dist/environment.d.ts +7 -0
- package/dist/environment.js +8 -0
- package/dist/environment.js.map +1 -0
- package/dist/error.d.ts +68 -0
- package/dist/error.js +143 -0
- package/dist/error.js.map +1 -0
- package/dist/file.d.ts +98 -0
- package/dist/file.js +216 -0
- package/dist/file.js.map +1 -0
- package/dist/git.d.ts +36 -0
- package/dist/git.js +133 -0
- package/dist/git.js.map +1 -0
- package/dist/http/fetch.d.ts +22 -0
- package/dist/http/fetch.js +44 -0
- package/dist/http/fetch.js.map +1 -0
- package/dist/http/formdata.d.ts +3 -0
- package/dist/http/formdata.js +6 -0
- package/dist/http/formdata.js.map +1 -0
- package/dist/http/graphql.d.ts +13 -0
- package/dist/http/graphql.js +12 -0
- package/dist/http/graphql.js.map +1 -0
- package/dist/http.d.ts +27 -0
- package/dist/http.js +32 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata.d.ts +53 -0
- package/dist/metadata.js +62 -0
- package/dist/metadata.js.map +1 -0
- package/dist/monorail.d.ts +100 -0
- package/dist/monorail.js +39 -0
- package/dist/monorail.js.map +1 -0
- package/dist/network/api.d.ts +2 -0
- package/dist/network/api.js +2 -0
- package/dist/network/api.js.map +1 -0
- package/dist/network/service.d.ts +14 -0
- package/dist/network/service.js +11 -0
- package/dist/network/service.js.map +1 -0
- package/dist/npm.d.ts +27 -0
- package/dist/npm.js +20 -0
- package/dist/npm.js.map +1 -0
- package/dist/output.d.ts +129 -0
- package/dist/output.js +310 -0
- package/dist/output.js.map +1 -0
- package/dist/path.d.ts +25 -0
- package/dist/path.js +48 -0
- package/dist/path.js.map +1 -0
- package/dist/plugins.d.ts +73 -0
- package/dist/plugins.js +49 -0
- package/dist/plugins.js.map +1 -0
- package/dist/private/common/json.d.ts +6 -0
- package/dist/private/common/json.js +2 -0
- package/dist/private/common/json.js.map +1 -0
- package/dist/private/common/lodash.d.ts +47 -0
- package/dist/private/common/lodash.js +2 -0
- package/dist/private/common/lodash.js.map +1 -0
- package/dist/private/node/analytics.d.ts +27 -0
- package/dist/private/node/analytics.js +57 -0
- package/dist/private/node/analytics.js.map +1 -0
- package/dist/private/node/ui/alert.d.ts +2 -0
- package/dist/private/node/ui/alert.js +18 -0
- package/dist/private/node/ui/alert.js.map +1 -0
- package/dist/private/node/ui/components/Alert.d.ts +17 -0
- package/dist/private/node/ui/components/Alert.js +21 -0
- package/dist/private/node/ui/components/Alert.js.map +1 -0
- package/dist/private/node/ui/components/Alert.test.d.ts +1 -0
- package/dist/private/node/ui/components/Alert.test.js +95 -0
- package/dist/private/node/ui/components/Alert.test.js.map +1 -0
- package/dist/private/node/ui/components/Banner.d.ts +8 -0
- package/dist/private/node/ui/components/Banner.js +41 -0
- package/dist/private/node/ui/components/Banner.js.map +1 -0
- package/dist/private/node/ui/components/Banner.test.d.ts +1 -0
- package/dist/private/node/ui/components/Banner.test.js +52 -0
- package/dist/private/node/ui/components/Banner.test.js.map +1 -0
- package/dist/private/node/ui/components/Command.d.ts +9 -0
- package/dist/private/node/ui/components/Command.js +13 -0
- package/dist/private/node/ui/components/Command.js.map +1 -0
- package/dist/private/node/ui/components/Command.test.d.ts +1 -0
- package/dist/private/node/ui/components/Command.test.js +11 -0
- package/dist/private/node/ui/components/Command.test.js.map +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.d.ts +47 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js +86 -0
- package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.test.d.ts +1 -0
- package/dist/private/node/ui/components/ConcurrentOutput.test.js +54 -0
- package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -0
- package/dist/private/node/ui/components/FatalError.d.ts +7 -0
- package/dist/private/node/ui/components/FatalError.js +54 -0
- package/dist/private/node/ui/components/FatalError.js.map +1 -0
- package/dist/private/node/ui/components/FatalError.test.d.ts +1 -0
- package/dist/private/node/ui/components/FatalError.test.js +119 -0
- package/dist/private/node/ui/components/FatalError.test.js.map +1 -0
- package/dist/private/node/ui/components/FilePath.d.ts +9 -0
- package/dist/private/node/ui/components/FilePath.js +13 -0
- package/dist/private/node/ui/components/FilePath.js.map +1 -0
- package/dist/private/node/ui/components/FilePath.test.d.ts +1 -0
- package/dist/private/node/ui/components/FilePath.test.js +11 -0
- package/dist/private/node/ui/components/FilePath.test.js.map +1 -0
- package/dist/private/node/ui/components/FullScreen.d.ts +8 -0
- package/dist/private/node/ui/components/FullScreen.js +32 -0
- package/dist/private/node/ui/components/FullScreen.js.map +1 -0
- package/dist/private/node/ui/components/Link.d.ts +10 -0
- package/dist/private/node/ui/components/Link.js +15 -0
- package/dist/private/node/ui/components/Link.js.map +1 -0
- package/dist/private/node/ui/components/Link.test.d.ts +1 -0
- package/dist/private/node/ui/components/Link.test.js +22 -0
- package/dist/private/node/ui/components/Link.test.js.map +1 -0
- package/dist/private/node/ui/components/List.d.ts +13 -0
- package/dist/private/node/ui/components/List.js +19 -0
- package/dist/private/node/ui/components/List.js.map +1 -0
- package/dist/private/node/ui/components/List.test.d.ts +1 -0
- package/dist/private/node/ui/components/List.test.js +34 -0
- package/dist/private/node/ui/components/List.test.js.map +1 -0
- package/dist/private/node/ui/components/SelectInput.d.ts +12 -0
- package/dist/private/node/ui/components/SelectInput.js +87 -0
- package/dist/private/node/ui/components/SelectInput.js.map +1 -0
- package/dist/private/node/ui/components/SelectInput.test.d.ts +1 -0
- package/dist/private/node/ui/components/SelectInput.test.js +230 -0
- package/dist/private/node/ui/components/SelectInput.test.js.map +1 -0
- package/dist/private/node/ui/components/SelectPrompt.d.ts +11 -0
- package/dist/private/node/ui/components/SelectPrompt.js +34 -0
- package/dist/private/node/ui/components/SelectPrompt.js.map +1 -0
- package/dist/private/node/ui/components/SelectPrompt.test.d.ts +1 -0
- package/dist/private/node/ui/components/SelectPrompt.test.js +74 -0
- package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -0
- package/dist/private/node/ui/components/Table.d.ts +8 -0
- package/dist/private/node/ui/components/Table.js +17 -0
- package/dist/private/node/ui/components/Table.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.d.ts +10 -0
- package/dist/private/node/ui/components/Tasks.js +27 -0
- package/dist/private/node/ui/components/Tasks.js.map +1 -0
- package/dist/private/node/ui/components/Tasks.test.d.ts +1 -0
- package/dist/private/node/ui/components/Tasks.test.js +50 -0
- package/dist/private/node/ui/components/Tasks.test.js.map +1 -0
- package/dist/private/node/ui/components/TextAnimation.d.ts +9 -0
- package/dist/private/node/ui/components/TextAnimation.js +35 -0
- package/dist/private/node/ui/components/TextAnimation.js.map +1 -0
- package/dist/private/node/ui/components/TextInput.d.ts +9 -0
- package/dist/private/node/ui/components/TextInput.js +74 -0
- package/dist/private/node/ui/components/TextInput.js.map +1 -0
- package/dist/private/node/ui/components/TextInput.test.d.ts +1 -0
- package/dist/private/node/ui/components/TextInput.test.js +139 -0
- package/dist/private/node/ui/components/TextInput.test.js.map +1 -0
- package/dist/private/node/ui/components/TextPrompt.d.ts +8 -0
- package/dist/private/node/ui/components/TextPrompt.js +52 -0
- package/dist/private/node/ui/components/TextPrompt.js.map +1 -0
- package/dist/private/node/ui/components/TextPrompt.test.d.ts +1 -0
- package/dist/private/node/ui/components/TextPrompt.test.js +68 -0
- package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.d.ts +36 -0
- package/dist/private/node/ui/components/TokenizedText.js +70 -0
- package/dist/private/node/ui/components/TokenizedText.js.map +1 -0
- package/dist/private/node/ui/components/TokenizedText.test.d.ts +1 -0
- package/dist/private/node/ui/components/TokenizedText.test.js +44 -0
- package/dist/private/node/ui/components/TokenizedText.test.js.map +1 -0
- package/dist/private/node/ui/components/UserInput.d.ts +10 -0
- package/dist/private/node/ui/components/UserInput.js +11 -0
- package/dist/private/node/ui/components/UserInput.js.map +1 -0
- package/dist/private/node/ui/components/UserInput.test.d.ts +1 -0
- package/dist/private/node/ui/components/UserInput.test.js +11 -0
- package/dist/private/node/ui/components/UserInput.test.js.map +1 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.d.ts +6 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js +17 -0
- package/dist/private/node/ui/hooks/use-async-and-unmount.js.map +1 -0
- package/dist/private/node/ui/hooks/use-layout.d.ts +6 -0
- package/dist/private/node/ui/hooks/use-layout.js +30 -0
- package/dist/private/node/ui/hooks/use-layout.js.map +1 -0
- package/dist/private/node/ui.d.ts +23 -0
- package/dist/private/node/ui.js +53 -0
- package/dist/private/node/ui.js.map +1 -0
- package/dist/public/common/array.d.ts +37 -0
- package/dist/public/common/array.js +51 -0
- package/dist/public/common/array.js.map +1 -0
- package/dist/public/common/collection.d.ts +23 -0
- package/dist/public/common/collection.js +29 -0
- package/dist/public/common/collection.js.map +1 -0
- package/dist/public/common/function.d.ts +30 -0
- package/dist/public/common/function.js +40 -0
- package/dist/public/common/function.js.map +1 -0
- package/dist/public/common/lang.d.ts +16 -0
- package/dist/public/common/lang.js +22 -0
- package/dist/public/common/lang.js.map +1 -0
- package/dist/public/common/object.d.ts +32 -0
- package/dist/public/common/object.js +45 -0
- package/dist/public/common/object.js.map +1 -0
- package/dist/public/common/string.d.ts +6 -0
- package/dist/public/common/string.js +109 -0
- package/dist/public/common/string.js.map +1 -0
- package/dist/public/common/url.d.ts +7 -0
- package/dist/public/common/url.js +17 -0
- package/dist/public/common/url.js.map +1 -0
- package/dist/public/node/abort.d.ts +16 -0
- package/dist/public/node/abort.js +17 -0
- package/dist/public/node/abort.js.map +1 -0
- package/dist/public/node/analytics.d.ts +13 -0
- package/dist/public/node/analytics.js +82 -0
- package/dist/public/node/analytics.js.map +1 -0
- package/dist/public/node/archiver.d.ts +9 -0
- package/dist/public/node/archiver.js +34 -0
- package/dist/public/node/archiver.js.map +1 -0
- package/dist/public/node/base-command.d.ts +26 -0
- package/dist/public/node/base-command.js +172 -0
- package/dist/public/node/base-command.js.map +1 -0
- package/dist/public/node/checksum.d.ts +20 -0
- package/dist/public/node/checksum.js +32 -0
- package/dist/public/node/checksum.js.map +1 -0
- package/dist/public/node/cli.d.ts +29 -0
- package/dist/public/node/cli.js +106 -0
- package/dist/public/node/cli.js.map +1 -0
- package/dist/public/node/colors.d.ts +2 -0
- package/dist/public/node/colors.js +3 -0
- package/dist/public/node/colors.js.map +1 -0
- package/dist/public/node/dot-env.d.ts +42 -0
- package/dist/public/node/dot-env.js +67 -0
- package/dist/public/node/dot-env.js.map +1 -0
- package/dist/public/node/error-handler.d.ts +41 -0
- package/dist/public/node/error-handler.js +198 -0
- package/dist/public/node/error-handler.js.map +1 -0
- package/dist/public/node/error.d.ts +4 -0
- package/dist/public/node/error.js +5 -0
- package/dist/public/node/error.js.map +1 -0
- package/dist/public/node/framework.d.ts +8 -0
- package/dist/public/node/framework.js +135 -0
- package/dist/public/node/framework.js.map +1 -0
- package/dist/public/node/fs.d.ts +17 -0
- package/dist/public/node/fs.js +21 -0
- package/dist/public/node/fs.js.map +1 -0
- package/dist/public/node/github.d.ts +50 -0
- package/dist/public/node/github.js +71 -0
- package/dist/public/node/github.js.map +1 -0
- package/dist/public/node/hooks/postrun.d.ts +2 -0
- package/dist/public/node/hooks/postrun.js +9 -0
- package/dist/public/node/hooks/postrun.js.map +1 -0
- package/dist/public/node/hooks/prerun.d.ts +12 -0
- package/dist/public/node/hooks/prerun.js +66 -0
- package/dist/public/node/hooks/prerun.js.map +1 -0
- package/dist/public/node/node-package-manager.d.ts +243 -0
- package/dist/public/node/node-package-manager.js +369 -0
- package/dist/public/node/node-package-manager.js.map +1 -0
- package/dist/public/node/os.d.ts +16 -0
- package/dist/public/node/os.js +77 -0
- package/dist/public/node/os.js.map +1 -0
- package/dist/public/node/plugins/tunnel.d.ts +47 -0
- package/dist/public/node/plugins/tunnel.js +19 -0
- package/dist/public/node/plugins/tunnel.js.map +1 -0
- package/dist/public/node/presets.d.ts +8 -0
- package/dist/public/node/presets.js +26 -0
- package/dist/public/node/presets.js.map +1 -0
- package/dist/public/node/result.d.ts +94 -0
- package/dist/public/node/result.js +134 -0
- package/dist/public/node/result.js.map +1 -0
- package/dist/public/node/ruby.d.ts +38 -0
- package/dist/public/node/ruby.js +234 -0
- package/dist/public/node/ruby.js.map +1 -0
- package/dist/public/node/semver.d.ts +3 -0
- package/dist/public/node/semver.js +6 -0
- package/dist/public/node/semver.js.map +1 -0
- package/dist/public/node/tcp.d.ts +5 -0
- package/dist/public/node/tcp.js +35 -0
- package/dist/public/node/tcp.js.map +1 -0
- package/dist/public/node/ui.d.ts +184 -0
- package/dist/public/node/ui.js +203 -0
- package/dist/public/node/ui.js.map +1 -0
- package/dist/schema.d.ts +1 -0
- package/dist/schema.js +2 -0
- package/dist/schema.js.map +1 -0
- package/dist/secure-store.d.ts +19 -0
- package/dist/secure-store.js +63 -0
- package/dist/secure-store.js.map +1 -0
- package/dist/session/authorize.d.ts +7 -0
- package/dist/session/authorize.js +52 -0
- package/dist/session/authorize.js.map +1 -0
- package/dist/session/device-authorization.d.ts +32 -0
- package/dist/session/device-authorization.js +92 -0
- package/dist/session/device-authorization.js.map +1 -0
- package/dist/session/exchange.d.ts +48 -0
- package/dist/session/exchange.js +159 -0
- package/dist/session/exchange.js.map +1 -0
- package/dist/session/identity.d.ts +3 -0
- package/dist/session/identity.js +58 -0
- package/dist/session/identity.js.map +1 -0
- package/dist/session/post-auth.d.ts +13 -0
- package/dist/session/post-auth.js +62 -0
- package/dist/session/post-auth.js.map +1 -0
- package/dist/session/redirect-listener.d.ts +34 -0
- package/dist/session/redirect-listener.js +106 -0
- package/dist/session/redirect-listener.js.map +1 -0
- package/dist/session/schema.d.ts +175 -0
- package/dist/session/schema.js +60 -0
- package/dist/session/schema.js.map +1 -0
- package/dist/session/scopes.d.ts +16 -0
- package/dist/session/scopes.js +53 -0
- package/dist/session/scopes.js.map +1 -0
- package/dist/session/store.d.ts +24 -0
- package/dist/session/store.js +89 -0
- package/dist/session/store.js.map +1 -0
- package/dist/session/token.d.ts +40 -0
- package/dist/session/token.js +22 -0
- package/dist/session/token.js.map +1 -0
- package/dist/session/validate.d.ts +17 -0
- package/dist/session/validate.js +65 -0
- package/dist/session/validate.js.map +1 -0
- package/dist/session.d.ts +96 -0
- package/dist/session.js +293 -0
- package/dist/session.js.map +1 -0
- package/dist/store/schema.d.ts +3 -0
- package/dist/store/schema.js +27 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store.d.ts +53 -0
- package/dist/store.js +134 -0
- package/dist/store.js.map +1 -0
- package/dist/string.d.ts +28 -0
- package/dist/string.js +77 -0
- package/dist/string.js.map +1 -0
- package/dist/system.d.ts +51 -0
- package/dist/system.js +128 -0
- package/dist/system.js.map +1 -0
- package/dist/template.d.ts +11 -0
- package/dist/template.js +50 -0
- package/dist/template.js.map +1 -0
- package/dist/testing/output.d.ts +10 -0
- package/dist/testing/output.js +16 -0
- package/dist/testing/output.js.map +1 -0
- package/dist/testing/store.d.ts +7 -0
- package/dist/testing/store.js +26 -0
- package/dist/testing/store.js.map +1 -0
- package/dist/testing/ui.d.ts +5 -0
- package/dist/testing/ui.js +23 -0
- package/dist/testing/ui.js.map +1 -0
- package/dist/toml.d.ts +3 -0
- package/dist/toml.js +8 -0
- package/dist/toml.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/typing/deep-required.d.ts +12 -0
- package/dist/typing/deep-required.js +2 -0
- package/dist/typing/deep-required.js.map +1 -0
- package/dist/typing/overloaded-parameters.d.ts +6 -0
- package/dist/typing/overloaded-parameters.js +2 -0
- package/dist/typing/overloaded-parameters.js.map +1 -0
- package/dist/typing/pick-by-prefix.d.ts +12 -0
- package/dist/typing/pick-by-prefix.js +2 -0
- package/dist/typing/pick-by-prefix.js.map +1 -0
- package/dist/typing/simple-definitions.d.ts +4 -0
- package/dist/typing/simple-definitions.js +2 -0
- package/dist/typing/simple-definitions.js.map +1 -0
- package/dist/ui/executor.d.ts +14 -0
- package/dist/ui/executor.js +90 -0
- package/dist/ui/executor.js.map +1 -0
- package/dist/ui/inquirer/autocomplete.d.ts +11 -0
- package/dist/ui/inquirer/autocomplete.js +110 -0
- package/dist/ui/inquirer/autocomplete.js.map +1 -0
- package/dist/ui/inquirer/input.d.ts +16 -0
- package/dist/ui/inquirer/input.js +45 -0
- package/dist/ui/inquirer/input.js.map +1 -0
- package/dist/ui/inquirer/password.d.ts +7 -0
- package/dist/ui/inquirer/password.js +8 -0
- package/dist/ui/inquirer/password.js.map +1 -0
- package/dist/ui/inquirer/select.d.ts +14 -0
- package/dist/ui/inquirer/select.js +26 -0
- package/dist/ui/inquirer/select.js.map +1 -0
- package/dist/ui.d.ts +54 -0
- package/dist/ui.js +128 -0
- package/dist/ui.js.map +1 -0
- package/dist/vscode.d.ts +8 -0
- package/dist/vscode.js +36 -0
- package/dist/vscode.js.map +1 -0
- package/package.json +177 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* A scope supported by the Shopify Admin API.
|
|
4
|
+
*/
|
|
5
|
+
declare type AdminAPIScope = 'graphql' | 'themes' | 'collaborator' | string;
|
|
6
|
+
/**
|
|
7
|
+
* It represents the options to authenticate against the Shopify Admin API.
|
|
8
|
+
*/
|
|
9
|
+
interface AdminAPIOAuthOptions {
|
|
10
|
+
/** Store to request permissions for */
|
|
11
|
+
storeFqdn: string;
|
|
12
|
+
/** List of scopes to request permissions for */
|
|
13
|
+
scopes: AdminAPIScope[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A scope supported by the Partners API.
|
|
17
|
+
*/
|
|
18
|
+
declare type PartnersAPIScope = 'cli' | string;
|
|
19
|
+
interface PartnersAPIOAuthOptions {
|
|
20
|
+
/** List of scopes to request permissions for */
|
|
21
|
+
scopes: PartnersAPIScope[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A scope supported by the Storefront Renderer API.
|
|
25
|
+
*/
|
|
26
|
+
declare type StorefrontRendererScope = 'devtools' | string;
|
|
27
|
+
interface StorefrontRendererAPIOAuthOptions {
|
|
28
|
+
/** List of scopes to request permissions for */
|
|
29
|
+
scopes: StorefrontRendererScope[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* It represents the authentication requirements and
|
|
33
|
+
* is the input necessary to trigger the authentication
|
|
34
|
+
* flow.
|
|
35
|
+
*/
|
|
36
|
+
export interface OAuthApplications {
|
|
37
|
+
adminApi?: AdminAPIOAuthOptions;
|
|
38
|
+
storefrontRendererApi?: StorefrontRendererAPIOAuthOptions;
|
|
39
|
+
partnersApi?: PartnersAPIOAuthOptions;
|
|
40
|
+
}
|
|
41
|
+
export interface AdminSession {
|
|
42
|
+
token: string;
|
|
43
|
+
storeFqdn: string;
|
|
44
|
+
}
|
|
45
|
+
export interface OAuthSession {
|
|
46
|
+
admin?: AdminSession;
|
|
47
|
+
partners?: string;
|
|
48
|
+
storefront?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Ensure that we have a valid session to access the Partners API.
|
|
52
|
+
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token
|
|
53
|
+
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored
|
|
54
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
55
|
+
* @returns The access token for the Partners API.
|
|
56
|
+
*/
|
|
57
|
+
export declare function ensureAuthenticatedPartners(scopes?: string[], env?: NodeJS.ProcessEnv): Promise<string>;
|
|
58
|
+
/**
|
|
59
|
+
* Ensure that we have a valid session to access the Storefront API.
|
|
60
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
61
|
+
* @returns The access token for the Storefront API.
|
|
62
|
+
*/
|
|
63
|
+
export declare function ensureAuthenticatedStorefront(scopes?: string[], password?: string | undefined): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Ensure that we have a valid Admin session for the given store.
|
|
66
|
+
* @param store - Store fqdn to request auth for
|
|
67
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
68
|
+
* @returns The access token for the Admin API
|
|
69
|
+
*/
|
|
70
|
+
export declare function ensureAuthenticatedAdmin(store: string, scopes?: string[], forceRefresh?: boolean): Promise<AdminSession>;
|
|
71
|
+
/**
|
|
72
|
+
* Ensure that we have a valid session to access the Theme API.
|
|
73
|
+
* If a password is provided, that token will be used against Theme Access API.
|
|
74
|
+
* Otherwise, it will ensure that the user is authenticated with the Admin API.
|
|
75
|
+
* @param store - Store fqdn to request auth for
|
|
76
|
+
* @param password - Password generated from Theme Access app
|
|
77
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
78
|
+
* @returns The access token and store
|
|
79
|
+
*/
|
|
80
|
+
export declare function ensureAuthenticatedThemes(store: string, password: string | undefined, scopes?: string[], forceRefresh?: boolean): Promise<AdminSession>;
|
|
81
|
+
/**
|
|
82
|
+
* This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.
|
|
83
|
+
* @param applications - An object containing the applications we need to be authenticated with.
|
|
84
|
+
* @returns An instance with the access tokens organized by application.
|
|
85
|
+
*/
|
|
86
|
+
export declare function ensureAuthenticated(applications: OAuthApplications, env?: NodeJS.ProcessEnv, forceRefresh?: boolean): Promise<OAuthSession>;
|
|
87
|
+
export declare function hasPartnerAccount(partnersToken: string): Promise<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* If the user creates an account from the Identity website, the created
|
|
90
|
+
* account won't get a Partner organization created. We need to detect that
|
|
91
|
+
* and take the user to create a partner organization.
|
|
92
|
+
* @param partnersToken - Partners token
|
|
93
|
+
*/
|
|
94
|
+
export declare function ensureUserHasPartnerAccount(partnersToken: string): Promise<void>;
|
|
95
|
+
export declare function logout(): Promise<void>;
|
|
96
|
+
export {};
|
package/dist/session.js
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import { applicationId } from './session/identity.js';
|
|
2
|
+
import { Abort, Bug } from './error.js';
|
|
3
|
+
import { validateSession } from './session/validate.js';
|
|
4
|
+
import { allDefaultScopes, apiScopes } from './session/scopes.js';
|
|
5
|
+
import { identity as identityFqdn, normalizeStoreName, partners as partnersFqdn } from './environment/fqdn.js';
|
|
6
|
+
import { open } from './system.js';
|
|
7
|
+
import { exchangeAccessForApplicationTokens, exchangeCodeForAccessToken, exchangeCustomPartnerToken, refreshAccessToken, InvalidGrantError, InvalidRequestError, } from './session/exchange.js';
|
|
8
|
+
import { content, token, debug } from './output.js';
|
|
9
|
+
import { keypress } from './ui.js';
|
|
10
|
+
import { authorize } from './session/authorize.js';
|
|
11
|
+
import * as secureStore from './session/store.js';
|
|
12
|
+
import constants from './constants.js';
|
|
13
|
+
import * as output from './output.js';
|
|
14
|
+
import { partners } from './api.js';
|
|
15
|
+
import { RequestClientError } from './api/common.js';
|
|
16
|
+
import { firstPartyDev, useDeviceAuth } from './environment/local.js';
|
|
17
|
+
import { pollForDeviceAuthorization, requestDeviceAuthorization } from './session/device-authorization.js';
|
|
18
|
+
import { AbortError } from './public/node/error.js';
|
|
19
|
+
import { gql } from 'graphql-request';
|
|
20
|
+
const NoSessionError = new Bug('No session found after ensuring authenticated');
|
|
21
|
+
const MissingPartnerTokenError = new Bug('No partners token found after ensuring authenticated');
|
|
22
|
+
const MissingAdminTokenError = new Bug('No admin token found after ensuring authenticated');
|
|
23
|
+
const MissingStorefrontTokenError = new Bug('No storefront token found after ensuring authenticated');
|
|
24
|
+
/**
|
|
25
|
+
* Ensure that we have a valid session to access the Partners API.
|
|
26
|
+
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token
|
|
27
|
+
* If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored
|
|
28
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
29
|
+
* @returns The access token for the Partners API.
|
|
30
|
+
*/
|
|
31
|
+
export async function ensureAuthenticatedPartners(scopes = [], env = process.env) {
|
|
32
|
+
debug(content `Ensuring that the user is authenticated with the Partners API with the following scopes:
|
|
33
|
+
${token.json(scopes)}
|
|
34
|
+
`);
|
|
35
|
+
const envToken = env[constants.environmentVariables.partnersToken];
|
|
36
|
+
if (envToken) {
|
|
37
|
+
return (await exchangeCustomPartnerToken(envToken)).accessToken;
|
|
38
|
+
}
|
|
39
|
+
const tokens = await ensureAuthenticated({ partnersApi: { scopes } });
|
|
40
|
+
if (!tokens.partners) {
|
|
41
|
+
throw MissingPartnerTokenError;
|
|
42
|
+
}
|
|
43
|
+
return tokens.partners;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Ensure that we have a valid session to access the Storefront API.
|
|
47
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
48
|
+
* @returns The access token for the Storefront API.
|
|
49
|
+
*/
|
|
50
|
+
export async function ensureAuthenticatedStorefront(scopes = [], password = undefined) {
|
|
51
|
+
if (password)
|
|
52
|
+
return password;
|
|
53
|
+
debug(content `Ensuring that the user is authenticated with the Storefront API with the following scopes:
|
|
54
|
+
${token.json(scopes)}
|
|
55
|
+
`);
|
|
56
|
+
const tokens = await ensureAuthenticated({ storefrontRendererApi: { scopes } });
|
|
57
|
+
if (!tokens.storefront) {
|
|
58
|
+
throw MissingStorefrontTokenError;
|
|
59
|
+
}
|
|
60
|
+
return tokens.storefront;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Ensure that we have a valid Admin session for the given store.
|
|
64
|
+
* @param store - Store fqdn to request auth for
|
|
65
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
66
|
+
* @returns The access token for the Admin API
|
|
67
|
+
*/
|
|
68
|
+
export async function ensureAuthenticatedAdmin(store, scopes = [], forceRefresh = false) {
|
|
69
|
+
debug(content `Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${token.raw(store)}:
|
|
70
|
+
${token.json(scopes)}
|
|
71
|
+
`);
|
|
72
|
+
const tokens = await ensureAuthenticated({ adminApi: { scopes, storeFqdn: store } }, process.env, forceRefresh);
|
|
73
|
+
if (!tokens.admin) {
|
|
74
|
+
throw MissingAdminTokenError;
|
|
75
|
+
}
|
|
76
|
+
return tokens.admin;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Ensure that we have a valid session to access the Theme API.
|
|
80
|
+
* If a password is provided, that token will be used against Theme Access API.
|
|
81
|
+
* Otherwise, it will ensure that the user is authenticated with the Admin API.
|
|
82
|
+
* @param store - Store fqdn to request auth for
|
|
83
|
+
* @param password - Password generated from Theme Access app
|
|
84
|
+
* @param scopes - Optional array of extra scopes to authenticate with.
|
|
85
|
+
* @returns The access token and store
|
|
86
|
+
*/
|
|
87
|
+
export async function ensureAuthenticatedThemes(store, password, scopes = [], forceRefresh = false) {
|
|
88
|
+
debug(content `Ensuring that the user is authenticated with the Theme API with the following scopes:
|
|
89
|
+
${token.json(scopes)}
|
|
90
|
+
`);
|
|
91
|
+
if (password)
|
|
92
|
+
return { token: password, storeFqdn: await normalizeStoreName(store) };
|
|
93
|
+
return ensureAuthenticatedAdmin(store, scopes, forceRefresh);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.
|
|
97
|
+
* @param applications - An object containing the applications we need to be authenticated with.
|
|
98
|
+
* @returns An instance with the access tokens organized by application.
|
|
99
|
+
*/
|
|
100
|
+
export async function ensureAuthenticated(applications, env = process.env, forceRefresh = false) {
|
|
101
|
+
const fqdn = await identityFqdn();
|
|
102
|
+
const previousStoreFqdn = applications.adminApi?.storeFqdn;
|
|
103
|
+
if (previousStoreFqdn) {
|
|
104
|
+
const normalizedStoreName = await normalizeStoreName(previousStoreFqdn);
|
|
105
|
+
if (previousStoreFqdn === applications.adminApi?.storeFqdn) {
|
|
106
|
+
applications.adminApi.storeFqdn = normalizedStoreName;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const currentSession = (await secureStore.fetch()) || {};
|
|
110
|
+
const fqdnSession = currentSession[fqdn];
|
|
111
|
+
const scopes = getFlattenScopes(applications);
|
|
112
|
+
debug(content `Validating existing session against the scopes:
|
|
113
|
+
${token.json(scopes)}
|
|
114
|
+
For applications:
|
|
115
|
+
${token.json(applications)}
|
|
116
|
+
`);
|
|
117
|
+
const validationResult = await validateSession(scopes, applications, fqdnSession);
|
|
118
|
+
let newSession = {};
|
|
119
|
+
if (validationResult === 'needs_full_auth') {
|
|
120
|
+
debug(content `Initiating the full authentication flow...`);
|
|
121
|
+
newSession = await executeCompleteFlow(applications, fqdn);
|
|
122
|
+
}
|
|
123
|
+
else if (validationResult === 'needs_refresh' || forceRefresh) {
|
|
124
|
+
debug(content `The current session is valid but needs refresh. Refreshing...`);
|
|
125
|
+
try {
|
|
126
|
+
newSession = await refreshTokens(fqdnSession.identity, applications, fqdn);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (error instanceof InvalidGrantError) {
|
|
130
|
+
newSession = await executeCompleteFlow(applications, fqdn);
|
|
131
|
+
}
|
|
132
|
+
else if (error instanceof InvalidRequestError) {
|
|
133
|
+
await secureStore.remove();
|
|
134
|
+
throw new AbortError('\nError validating auth session', "We've cleared the current session, please try again");
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const completeSession = { ...currentSession, ...newSession };
|
|
142
|
+
await secureStore.store(completeSession);
|
|
143
|
+
const tokens = await tokensFor(applications, completeSession, fqdn);
|
|
144
|
+
// Overwrite partners token if using a custom CLI Token
|
|
145
|
+
const envToken = env[constants.environmentVariables.partnersToken];
|
|
146
|
+
if (envToken && applications.partnersApi) {
|
|
147
|
+
tokens.partners = (await exchangeCustomPartnerToken(envToken)).accessToken;
|
|
148
|
+
}
|
|
149
|
+
if (!envToken && tokens.partners) {
|
|
150
|
+
await ensureUserHasPartnerAccount(tokens.partners);
|
|
151
|
+
}
|
|
152
|
+
return tokens;
|
|
153
|
+
}
|
|
154
|
+
export async function hasPartnerAccount(partnersToken) {
|
|
155
|
+
try {
|
|
156
|
+
await partners.request(gql `
|
|
157
|
+
{
|
|
158
|
+
organizations(first: 1) {
|
|
159
|
+
nodes {
|
|
160
|
+
id
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`, partnersToken);
|
|
165
|
+
return true;
|
|
166
|
+
// eslint-disable-next-line no-catch-all/no-catch-all
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
if (error instanceof RequestClientError && error.statusCode === 404) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* If the user creates an account from the Identity website, the created
|
|
179
|
+
* account won't get a Partner organization created. We need to detect that
|
|
180
|
+
* and take the user to create a partner organization.
|
|
181
|
+
* @param partnersToken - Partners token
|
|
182
|
+
*/
|
|
183
|
+
export async function ensureUserHasPartnerAccount(partnersToken) {
|
|
184
|
+
debug(content `Verifying that the user has a Partner organization`);
|
|
185
|
+
if (!(await hasPartnerAccount(partnersToken))) {
|
|
186
|
+
output.info(`\nA Shopify Partners organization is needed to proceed.`);
|
|
187
|
+
output.info(`👉 Press any key to create one`);
|
|
188
|
+
await keypress();
|
|
189
|
+
await open(`https://${await partnersFqdn()}/signup`);
|
|
190
|
+
output.info(output.content `👉 Press any key when you have ${output.token.cyan('created the organization')}`);
|
|
191
|
+
output.warn(output.content `Make sure you've confirmed your Shopify and the Partner organization from the email`);
|
|
192
|
+
await keypress();
|
|
193
|
+
if (!(await hasPartnerAccount(partnersToken))) {
|
|
194
|
+
throw new Abort(`Couldn't find your Shopify Partners organization`, `Have you confirmed your accounts from the emails you received?`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async function executeCompleteFlow(applications, identityFqdn) {
|
|
199
|
+
const scopes = getFlattenScopes(applications);
|
|
200
|
+
const exchangeScopes = getExchangeScopes(applications);
|
|
201
|
+
const store = applications.adminApi?.storeFqdn;
|
|
202
|
+
if (firstPartyDev()) {
|
|
203
|
+
debug(content `Authenticating as Shopify Employee...`);
|
|
204
|
+
scopes.push('employee');
|
|
205
|
+
}
|
|
206
|
+
let identityToken;
|
|
207
|
+
if (useDeviceAuth()) {
|
|
208
|
+
// Request a device code to authorize without a browser redirect.
|
|
209
|
+
debug(content `Requesting device authorization code...`);
|
|
210
|
+
const deviceAuth = await requestDeviceAuthorization(scopes);
|
|
211
|
+
// Poll for the identity token
|
|
212
|
+
debug(content `Starting polling for the identity token...`);
|
|
213
|
+
identityToken = await pollForDeviceAuthorization(deviceAuth.deviceCode, deviceAuth.interval);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
// Authorize user via browser
|
|
217
|
+
debug(content `Authorizing through Identity's website...`);
|
|
218
|
+
const code = await authorize(scopes);
|
|
219
|
+
// Exchange code for identity token
|
|
220
|
+
debug(content `Authorization code received. Exchanging it for a CLI token...`);
|
|
221
|
+
identityToken = await exchangeCodeForAccessToken(code);
|
|
222
|
+
}
|
|
223
|
+
// Exchange identity token for application tokens
|
|
224
|
+
debug(content `CLI token received. Exchanging it for application tokens...`);
|
|
225
|
+
const result = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, store);
|
|
226
|
+
const session = {
|
|
227
|
+
[identityFqdn]: {
|
|
228
|
+
identity: identityToken,
|
|
229
|
+
applications: result,
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
output.completed('Logged in.');
|
|
233
|
+
return session;
|
|
234
|
+
}
|
|
235
|
+
async function refreshTokens(token, applications, fqdn) {
|
|
236
|
+
// Refresh Identity Token
|
|
237
|
+
const identityToken = await refreshAccessToken(token);
|
|
238
|
+
// Exchange new identity token for application tokens
|
|
239
|
+
const exchangeScopes = getExchangeScopes(applications);
|
|
240
|
+
const applicationTokens = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, applications.adminApi?.storeFqdn);
|
|
241
|
+
return {
|
|
242
|
+
[fqdn]: {
|
|
243
|
+
identity: identityToken,
|
|
244
|
+
applications: applicationTokens,
|
|
245
|
+
},
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
async function tokensFor(applications, session, fqdn) {
|
|
249
|
+
const fqdnSession = session[fqdn];
|
|
250
|
+
if (!fqdnSession) {
|
|
251
|
+
throw NoSessionError;
|
|
252
|
+
}
|
|
253
|
+
const tokens = {};
|
|
254
|
+
if (applications.adminApi) {
|
|
255
|
+
const appId = applicationId('admin');
|
|
256
|
+
const realAppId = `${applications.adminApi.storeFqdn}-${appId}`;
|
|
257
|
+
const token = fqdnSession.applications[realAppId]?.accessToken;
|
|
258
|
+
if (token) {
|
|
259
|
+
tokens.admin = { token, storeFqdn: applications.adminApi.storeFqdn };
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (applications.partnersApi) {
|
|
263
|
+
const appId = applicationId('partners');
|
|
264
|
+
tokens.partners = fqdnSession.applications[appId]?.accessToken;
|
|
265
|
+
}
|
|
266
|
+
if (applications.storefrontRendererApi) {
|
|
267
|
+
const appId = applicationId('storefront-renderer');
|
|
268
|
+
tokens.storefront = fqdnSession.applications[appId]?.accessToken;
|
|
269
|
+
}
|
|
270
|
+
return tokens;
|
|
271
|
+
}
|
|
272
|
+
// Scope Helpers
|
|
273
|
+
function getFlattenScopes(apps) {
|
|
274
|
+
const admin = apps.adminApi?.scopes || [];
|
|
275
|
+
const partner = apps.partnersApi?.scopes || [];
|
|
276
|
+
const storefront = apps.storefrontRendererApi?.scopes || [];
|
|
277
|
+
const requestedScopes = [...admin, ...partner, ...storefront];
|
|
278
|
+
return allDefaultScopes(requestedScopes);
|
|
279
|
+
}
|
|
280
|
+
function getExchangeScopes(apps) {
|
|
281
|
+
const adminScope = apps.adminApi?.scopes || [];
|
|
282
|
+
const partnerScope = apps.partnersApi?.scopes || [];
|
|
283
|
+
const storefrontScopes = apps.storefrontRendererApi?.scopes || [];
|
|
284
|
+
return {
|
|
285
|
+
admin: apiScopes('admin', adminScope),
|
|
286
|
+
partners: apiScopes('partners', partnerScope),
|
|
287
|
+
storefront: apiScopes('storefront-renderer', storefrontScopes),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
export function logout() {
|
|
291
|
+
return secureStore.remove();
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAC,KAAK,EAAE,GAAG,EAAC,MAAM,YAAY,CAAA;AACrC,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAC,QAAQ,IAAI,YAAY,EAAE,kBAAkB,EAAE,QAAQ,IAAI,YAAY,EAAC,MAAM,uBAAuB,CAAA;AAC5G,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAChC,OAAO,EACL,kCAAkC,EAClC,0BAA0B,EAC1B,0BAA0B,EAE1B,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EAAC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACjD,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAA;AAEhC,OAAO,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AAEhD,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,SAAS,MAAM,gBAAgB,CAAA;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAA;AACjC,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,wBAAwB,CAAA;AACnE,OAAO,E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AAS,gBAAgB,CAAC,IAAuB;IAC/C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAA;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,IAAI,EAAE,CAAA;IAC9C,MAAM,UAAU,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,IAAI,EAAE,CAAA;IAC3D,MAAM,eAAe,GAAG,CAAC,GAAG,KAAK,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,CAAC,CAAA;IAC7D,OAAO,gBAAgB,CAAC,eAAe,CAAC,CAAA;AAC1C,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAuB;IAChD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,CAAA;IAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,IAAI,EAAE,CAAA;IACnD,MAAM,gBAAgB,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,IAAI,EAAE,CAAA;IACjE,OAAO;QACL,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC;QACrC,QAAQ,EAAE,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC;QAC7C,UAAU,EAAE,SAAS,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;KAC/D,CAAA;AACH,CAAC;AAED,MAAM,UAAU,MAAM;IACpB,OAAO,WAAW,CAAC,MAAM,EAAE,CAAA;AAC7B,CAAC","sourcesContent":["import {applicationId} from './session/identity.js'\nimport {Abort, Bug} from './error.js'\nimport {validateSession} from './session/validate.js'\nimport {allDefaultScopes, apiScopes} from './session/scopes.js'\nimport {identity as identityFqdn, normalizeStoreName, partners as partnersFqdn} from './environment/fqdn.js'\nimport {open} from './system.js'\nimport {\n exchangeAccessForApplicationTokens,\n exchangeCodeForAccessToken,\n exchangeCustomPartnerToken,\n ExchangeScopes,\n refreshAccessToken,\n InvalidGrantError,\n InvalidRequestError,\n} from './session/exchange.js'\n\nimport {content, token, debug} from './output.js'\nimport {keypress} from './ui.js'\n\nimport {authorize} from './session/authorize.js'\nimport {IdentityToken, Session} from './session/schema.js'\nimport * as secureStore from './session/store.js'\nimport constants from './constants.js'\nimport * as output from './output.js'\nimport {partners} from './api.js'\nimport {RequestClientError} from './api/common.js'\nimport {firstPartyDev, useDeviceAuth} from './environment/local.js'\nimport {pollForDeviceAuthorization, requestDeviceAuthorization} from './session/device-authorization.js'\nimport {AbortError} from './public/node/error.js'\nimport {gql} from 'graphql-request'\n\nconst NoSessionError = new Bug('No session found after ensuring authenticated')\nconst MissingPartnerTokenError = new Bug('No partners token found after ensuring authenticated')\nconst MissingAdminTokenError = new Bug('No admin token found after ensuring authenticated')\nconst MissingStorefrontTokenError = new Bug('No storefront token found after ensuring authenticated')\n\n/**\n * A scope supported by the Shopify Admin API.\n */\ntype AdminAPIScope = 'graphql' | 'themes' | 'collaborator' | string\n\n/**\n * It represents the options to authenticate against the Shopify Admin API.\n */\ninterface AdminAPIOAuthOptions {\n /** Store to request permissions for */\n storeFqdn: string\n /** List of scopes to request permissions for */\n scopes: AdminAPIScope[]\n}\n\n/**\n * A scope supported by the Partners API.\n */\ntype PartnersAPIScope = 'cli' | string\ninterface PartnersAPIOAuthOptions {\n /** List of scopes to request permissions for */\n scopes: PartnersAPIScope[]\n}\n\n/**\n * A scope supported by the Storefront Renderer API.\n */\ntype StorefrontRendererScope = 'devtools' | string\ninterface StorefrontRendererAPIOAuthOptions {\n /** List of scopes to request permissions for */\n scopes: StorefrontRendererScope[]\n}\n\n/**\n * It represents the authentication requirements and\n * is the input necessary to trigger the authentication\n * flow.\n */\nexport interface OAuthApplications {\n adminApi?: AdminAPIOAuthOptions\n storefrontRendererApi?: StorefrontRendererAPIOAuthOptions\n partnersApi?: PartnersAPIOAuthOptions\n}\n\nexport interface AdminSession {\n token: string\n storeFqdn: string\n}\n\nexport interface OAuthSession {\n admin?: AdminSession\n partners?: string\n storefront?: string\n}\n\n/**\n * Ensure that we have a valid session to access the Partners API.\n * If SHOPIFY_CLI_PARTNERS_TOKEN exists, that token will be used to obtain a valid Partners Token\n * If SHOPIFY_CLI_PARTNERS_TOKEN exists, scopes will be ignored\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @returns The access token for the Partners API.\n */\nexport async function ensureAuthenticatedPartners(scopes: string[] = [], env = process.env): Promise<string> {\n debug(content`Ensuring that the user is authenticated with the Partners API with the following scopes:\n${token.json(scopes)}\n`)\n const envToken = env[constants.environmentVariables.partnersToken]\n if (envToken) {\n return (await exchangeCustomPartnerToken(envToken)).accessToken\n }\n const tokens = await ensureAuthenticated({partnersApi: {scopes}})\n if (!tokens.partners) {\n throw MissingPartnerTokenError\n }\n return tokens.partners\n}\n\n/**\n * Ensure that we have a valid session to access the Storefront API.\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @returns The access token for the Storefront API.\n */\nexport async function ensureAuthenticatedStorefront(\n scopes: string[] = [],\n password: string | undefined = undefined,\n): Promise<string> {\n if (password) return password\n\n debug(content`Ensuring that the user is authenticated with the Storefront API with the following scopes:\n${token.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({storefrontRendererApi: {scopes}})\n if (!tokens.storefront) {\n throw MissingStorefrontTokenError\n }\n return tokens.storefront\n}\n\n/**\n * Ensure that we have a valid Admin session for the given store.\n * @param store - Store fqdn to request auth for\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @returns The access token for the Admin API\n */\nexport async function ensureAuthenticatedAdmin(\n store: string,\n scopes: string[] = [],\n forceRefresh = false,\n): Promise<AdminSession> {\n debug(content`Ensuring that the user is authenticated with the Admin API with the following scopes for the store ${token.raw(\n store,\n )}:\n${token.json(scopes)}\n`)\n const tokens = await ensureAuthenticated({adminApi: {scopes, storeFqdn: store}}, process.env, forceRefresh)\n if (!tokens.admin) {\n throw MissingAdminTokenError\n }\n return tokens.admin\n}\n\n/**\n * Ensure that we have a valid session to access the Theme API.\n * If a password is provided, that token will be used against Theme Access API.\n * Otherwise, it will ensure that the user is authenticated with the Admin API.\n * @param store - Store fqdn to request auth for\n * @param password - Password generated from Theme Access app\n * @param scopes - Optional array of extra scopes to authenticate with.\n * @returns The access token and store\n */\nexport async function ensureAuthenticatedThemes(\n store: string,\n password: string | undefined,\n scopes: string[] = [],\n forceRefresh = false,\n): Promise<AdminSession> {\n debug(content`Ensuring that the user is authenticated with the Theme API with the following scopes:\n${token.json(scopes)}\n`)\n if (password) return {token: password, storeFqdn: await normalizeStoreName(store)}\n return ensureAuthenticatedAdmin(store, scopes, forceRefresh)\n}\n\n/**\n * This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.\n * @param applications - An object containing the applications we need to be authenticated with.\n * @returns An instance with the access tokens organized by application.\n */\nexport async function ensureAuthenticated(\n applications: OAuthApplications,\n env = process.env,\n forceRefresh = false,\n): Promise<OAuthSession> {\n const fqdn = await identityFqdn()\n\n const previousStoreFqdn = applications.adminApi?.storeFqdn\n if (previousStoreFqdn) {\n const normalizedStoreName = await normalizeStoreName(previousStoreFqdn)\n if (previousStoreFqdn === applications.adminApi?.storeFqdn) {\n applications.adminApi.storeFqdn = normalizedStoreName\n }\n }\n\n const currentSession = (await secureStore.fetch()) || {}\n const fqdnSession = currentSession[fqdn]!\n const scopes = getFlattenScopes(applications)\n\n debug(content`Validating existing session against the scopes:\n${token.json(scopes)}\nFor applications:\n${token.json(applications)}\n`)\n const validationResult = await validateSession(scopes, applications, fqdnSession)\n\n let newSession = {}\n\n if (validationResult === 'needs_full_auth') {\n debug(content`Initiating the full authentication flow...`)\n newSession = await executeCompleteFlow(applications, fqdn)\n } else if (validationResult === 'needs_refresh' || forceRefresh) {\n debug(content`The current session is valid but needs refresh. Refreshing...`)\n try {\n newSession = await refreshTokens(fqdnSession.identity, applications, fqdn)\n } catch (error) {\n if (error instanceof InvalidGrantError) {\n newSession = await executeCompleteFlow(applications, fqdn)\n } else if (error instanceof InvalidRequestError) {\n await secureStore.remove()\n throw new AbortError('\\nError validating auth session', \"We've cleared the current session, please try again\")\n } else {\n throw error\n }\n }\n }\n\n const completeSession: Session = {...currentSession, ...newSession}\n await secureStore.store(completeSession)\n const tokens = await tokensFor(applications, completeSession, fqdn)\n\n // Overwrite partners token if using a custom CLI Token\n const envToken = env[constants.environmentVariables.partnersToken]\n if (envToken && applications.partnersApi) {\n tokens.partners = (await exchangeCustomPartnerToken(envToken)).accessToken\n }\n if (!envToken && tokens.partners) {\n await ensureUserHasPartnerAccount(tokens.partners)\n }\n\n return tokens\n}\n\nexport async function hasPartnerAccount(partnersToken: string): Promise<boolean> {\n try {\n await partners.request(\n gql`\n {\n organizations(first: 1) {\n nodes {\n id\n }\n }\n }\n `,\n partnersToken,\n )\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n if (error instanceof RequestClientError && error.statusCode === 404) {\n return false\n } else {\n return true\n }\n }\n}\n\n/**\n * If the user creates an account from the Identity website, the created\n * account won't get a Partner organization created. We need to detect that\n * and take the user to create a partner organization.\n * @param partnersToken - Partners token\n */\nexport async function ensureUserHasPartnerAccount(partnersToken: string) {\n debug(content`Verifying that the user has a Partner organization`)\n if (!(await hasPartnerAccount(partnersToken))) {\n output.info(`\\nA Shopify Partners organization is needed to proceed.`)\n output.info(`👉 Press any key to create one`)\n await keypress()\n await open(`https://${await partnersFqdn()}/signup`)\n output.info(output.content`👉 Press any key when you have ${output.token.cyan('created the organization')}`)\n output.warn(output.content`Make sure you've confirmed your Shopify and the Partner organization from the email`)\n await keypress()\n if (!(await hasPartnerAccount(partnersToken))) {\n throw new Abort(\n `Couldn't find your Shopify Partners organization`,\n `Have you confirmed your accounts from the emails you received?`,\n )\n }\n }\n}\n\nasync function executeCompleteFlow(applications: OAuthApplications, identityFqdn: string): Promise<Session> {\n const scopes = getFlattenScopes(applications)\n const exchangeScopes = getExchangeScopes(applications)\n const store = applications.adminApi?.storeFqdn\n if (firstPartyDev()) {\n debug(content`Authenticating as Shopify Employee...`)\n scopes.push('employee')\n }\n\n let identityToken: IdentityToken\n if (useDeviceAuth()) {\n // Request a device code to authorize without a browser redirect.\n debug(content`Requesting device authorization code...`)\n const deviceAuth = await requestDeviceAuthorization(scopes)\n\n // Poll for the identity token\n debug(content`Starting polling for the identity token...`)\n identityToken = await pollForDeviceAuthorization(deviceAuth.deviceCode, deviceAuth.interval)\n } else {\n // Authorize user via browser\n debug(content`Authorizing through Identity's website...`)\n const code = await authorize(scopes)\n\n // Exchange code for identity token\n debug(content`Authorization code received. Exchanging it for a CLI token...`)\n identityToken = await exchangeCodeForAccessToken(code)\n }\n\n // Exchange identity token for application tokens\n debug(content`CLI token received. Exchanging it for application tokens...`)\n const result = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, store)\n\n const session: Session = {\n [identityFqdn]: {\n identity: identityToken,\n applications: result,\n },\n }\n\n output.completed('Logged in.')\n\n return session\n}\n\nasync function refreshTokens(token: IdentityToken, applications: OAuthApplications, fqdn: string): Promise<Session> {\n // Refresh Identity Token\n const identityToken = await refreshAccessToken(token)\n // Exchange new identity token for application tokens\n const exchangeScopes = getExchangeScopes(applications)\n const applicationTokens = await exchangeAccessForApplicationTokens(\n identityToken,\n exchangeScopes,\n applications.adminApi?.storeFqdn,\n )\n\n return {\n [fqdn]: {\n identity: identityToken,\n applications: applicationTokens,\n },\n }\n}\n\nasync function tokensFor(applications: OAuthApplications, session: Session, fqdn: string): Promise<OAuthSession> {\n const fqdnSession = session[fqdn]\n if (!fqdnSession) {\n throw NoSessionError\n }\n const tokens: OAuthSession = {}\n if (applications.adminApi) {\n const appId = applicationId('admin')\n const realAppId = `${applications.adminApi.storeFqdn}-${appId}`\n const token = fqdnSession.applications[realAppId]?.accessToken\n if (token) {\n tokens.admin = {token, storeFqdn: applications.adminApi.storeFqdn}\n }\n }\n\n if (applications.partnersApi) {\n const appId = applicationId('partners')\n tokens.partners = fqdnSession.applications[appId]?.accessToken\n }\n\n if (applications.storefrontRendererApi) {\n const appId = applicationId('storefront-renderer')\n tokens.storefront = fqdnSession.applications[appId]?.accessToken\n }\n return tokens\n}\n\n// Scope Helpers\nfunction getFlattenScopes(apps: OAuthApplications): string[] {\n const admin = apps.adminApi?.scopes || []\n const partner = apps.partnersApi?.scopes || []\n const storefront = apps.storefrontRendererApi?.scopes || []\n const requestedScopes = [...admin, ...partner, ...storefront]\n return allDefaultScopes(requestedScopes)\n}\n\nfunction getExchangeScopes(apps: OAuthApplications): ExchangeScopes {\n const adminScope = apps.adminApi?.scopes || []\n const partnerScope = apps.partnersApi?.scopes || []\n const storefrontScopes = apps.storefrontRendererApi?.scopes || []\n return {\n admin: apiScopes('admin', adminScope),\n partners: apiScopes('partners', partnerScope),\n storefront: apiScopes('storefront-renderer', storefrontScopes),\n }\n}\n\nexport function logout() {\n return secureStore.remove()\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const schema = {
|
|
2
|
+
appInfo: {
|
|
3
|
+
type: 'array',
|
|
4
|
+
items: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
appId: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
},
|
|
10
|
+
title: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
},
|
|
13
|
+
orgId: {
|
|
14
|
+
type: 'string',
|
|
15
|
+
},
|
|
16
|
+
storeFqdn: {
|
|
17
|
+
type: 'string',
|
|
18
|
+
},
|
|
19
|
+
directory: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export default schema;
|
|
27
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/store/schema.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAoB;IAC9B,OAAO,EAAE;QACP,IAAI,EAAE,OAAO;QACb,KAAK,EAAE;YACL,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;iBACf;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;iBACf;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;KACF;CACF,CAAA;AAED,eAAe,MAAM,CAAA","sourcesContent":["import type {Schema} from 'conf'\n\nconst schema: Schema<unknown> = {\n appInfo: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n appId: {\n type: 'string',\n },\n title: {\n type: 'string',\n },\n orgId: {\n type: 'string',\n },\n storeFqdn: {\n type: 'string',\n },\n directory: {\n type: 'string',\n },\n },\n },\n },\n}\n\nexport default schema\n"]}
|
package/dist/store.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Conf from 'conf';
|
|
2
|
+
export interface CachedAppInfo {
|
|
3
|
+
directory: string;
|
|
4
|
+
appId?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
orgId?: string;
|
|
7
|
+
storeFqdn?: string;
|
|
8
|
+
updateURLs?: boolean;
|
|
9
|
+
tunnelPlugin?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ConfSchema {
|
|
12
|
+
appInfo: CachedAppInfo[];
|
|
13
|
+
themeStore: string;
|
|
14
|
+
session: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function cliKitStore(): Promise<CLIKitStore>;
|
|
17
|
+
export declare function getAppInfo(directory: string): Promise<CachedAppInfo | undefined>;
|
|
18
|
+
export declare function setAppInfo(options: {
|
|
19
|
+
directory: string;
|
|
20
|
+
appId?: string;
|
|
21
|
+
title?: string;
|
|
22
|
+
storeFqdn?: string;
|
|
23
|
+
orgId?: string;
|
|
24
|
+
updateURLs?: boolean;
|
|
25
|
+
tunnelPlugin?: string;
|
|
26
|
+
}): Promise<void>;
|
|
27
|
+
export declare function clearAppInfo(directory: string): Promise<void>;
|
|
28
|
+
export declare function getThemeStore(): Promise<string | undefined>;
|
|
29
|
+
export declare function setThemeStore(themeStore: string): Promise<void>;
|
|
30
|
+
export declare function getSession(): Promise<string | undefined>;
|
|
31
|
+
export declare function setSession(session: string): Promise<void>;
|
|
32
|
+
export declare function removeSession(): Promise<void>;
|
|
33
|
+
export declare function clearAllAppInfo(): Promise<void>;
|
|
34
|
+
export declare class CLIKitStore extends Conf<ConfSchema> {
|
|
35
|
+
getAppInfo(directory: string): CachedAppInfo | undefined;
|
|
36
|
+
setAppInfo(options: {
|
|
37
|
+
directory: string;
|
|
38
|
+
appId?: string;
|
|
39
|
+
title?: string;
|
|
40
|
+
storeFqdn?: string;
|
|
41
|
+
orgId?: string;
|
|
42
|
+
updateURLs?: boolean;
|
|
43
|
+
tunnelPlugin?: string;
|
|
44
|
+
}): void;
|
|
45
|
+
clearAppInfo(directory: string): void;
|
|
46
|
+
clearAllAppInfo(): void;
|
|
47
|
+
getThemeStore(): string | undefined;
|
|
48
|
+
setThemeStore(themeStore: string): void;
|
|
49
|
+
getSession(): string | undefined;
|
|
50
|
+
setSession(session: string): void;
|
|
51
|
+
removeSession(): void;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
package/dist/store.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { content, token, debug } from './output.js';
|
|
2
|
+
import constants from './constants.js';
|
|
3
|
+
import Conf from 'conf';
|
|
4
|
+
const migrations = {};
|
|
5
|
+
const schema = {
|
|
6
|
+
appInfo: {
|
|
7
|
+
type: 'array',
|
|
8
|
+
items: {
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
appId: {
|
|
12
|
+
type: 'string',
|
|
13
|
+
},
|
|
14
|
+
orgId: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
},
|
|
17
|
+
storeFqdn: {
|
|
18
|
+
type: 'string',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
let _instance;
|
|
25
|
+
export async function cliKitStore() {
|
|
26
|
+
if (!_instance) {
|
|
27
|
+
// eslint-disable-next-line require-atomic-updates
|
|
28
|
+
_instance = new CLIKitStore({
|
|
29
|
+
schema,
|
|
30
|
+
migrations,
|
|
31
|
+
projectName: 'shopify-cli-kit',
|
|
32
|
+
projectVersion: await constants.versions.cliKit(),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return _instance;
|
|
36
|
+
}
|
|
37
|
+
export async function getAppInfo(directory) {
|
|
38
|
+
const store = await cliKitStore();
|
|
39
|
+
return store.getAppInfo(directory);
|
|
40
|
+
}
|
|
41
|
+
export async function setAppInfo(options) {
|
|
42
|
+
const store = await cliKitStore();
|
|
43
|
+
store.setAppInfo(options);
|
|
44
|
+
}
|
|
45
|
+
export async function clearAppInfo(directory) {
|
|
46
|
+
const store = await cliKitStore();
|
|
47
|
+
store.clearAppInfo(directory);
|
|
48
|
+
}
|
|
49
|
+
export async function getThemeStore() {
|
|
50
|
+
const store = await cliKitStore();
|
|
51
|
+
return store.getThemeStore();
|
|
52
|
+
}
|
|
53
|
+
export async function setThemeStore(themeStore) {
|
|
54
|
+
const store = await cliKitStore();
|
|
55
|
+
store.setThemeStore(themeStore);
|
|
56
|
+
}
|
|
57
|
+
export async function getSession() {
|
|
58
|
+
const store = await cliKitStore();
|
|
59
|
+
return store.getSession();
|
|
60
|
+
}
|
|
61
|
+
export async function setSession(session) {
|
|
62
|
+
const store = await cliKitStore();
|
|
63
|
+
store.setSession(session);
|
|
64
|
+
}
|
|
65
|
+
export async function removeSession() {
|
|
66
|
+
const store = await cliKitStore();
|
|
67
|
+
store.removeSession();
|
|
68
|
+
}
|
|
69
|
+
export async function clearAllAppInfo() {
|
|
70
|
+
const store = await cliKitStore();
|
|
71
|
+
store.clearAllAppInfo();
|
|
72
|
+
}
|
|
73
|
+
export class CLIKitStore extends Conf {
|
|
74
|
+
getAppInfo(directory) {
|
|
75
|
+
debug(content `Reading cached app information for directory ${token.path(directory)}...`);
|
|
76
|
+
const apps = this.get('appInfo') ?? [];
|
|
77
|
+
return apps.find((app) => app.directory === directory);
|
|
78
|
+
}
|
|
79
|
+
setAppInfo(options) {
|
|
80
|
+
debug(content `Storing app information for directory ${token.path(options.directory)}:${token.json(options)}`);
|
|
81
|
+
const apps = this.get('appInfo') ?? [];
|
|
82
|
+
const index = apps.findIndex((saved) => saved.directory === options.directory);
|
|
83
|
+
if (index === -1) {
|
|
84
|
+
apps.push(options);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const app = apps[index];
|
|
88
|
+
apps[index] = {
|
|
89
|
+
directory: options.directory,
|
|
90
|
+
appId: options.appId ?? app.appId,
|
|
91
|
+
title: options.title ?? app.title,
|
|
92
|
+
storeFqdn: options.storeFqdn ?? app.storeFqdn,
|
|
93
|
+
orgId: options.orgId ?? app.orgId,
|
|
94
|
+
updateURLs: options.updateURLs ?? app.updateURLs,
|
|
95
|
+
tunnelPlugin: options.tunnelPlugin ?? app.tunnelPlugin,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
this.set('appInfo', apps);
|
|
99
|
+
}
|
|
100
|
+
clearAppInfo(directory) {
|
|
101
|
+
debug(content `Clearing app information for directory ${token.path(directory)}...`);
|
|
102
|
+
const apps = this.get('appInfo') ?? [];
|
|
103
|
+
const index = apps.findIndex((saved) => saved.directory === directory);
|
|
104
|
+
if (index !== -1) {
|
|
105
|
+
apps.splice(index, 1);
|
|
106
|
+
}
|
|
107
|
+
this.set('appInfo', apps);
|
|
108
|
+
}
|
|
109
|
+
clearAllAppInfo() {
|
|
110
|
+
debug(content `Clearing all app information...`);
|
|
111
|
+
this.set('appInfo', []);
|
|
112
|
+
}
|
|
113
|
+
getThemeStore() {
|
|
114
|
+
debug(content `Getting theme store...`);
|
|
115
|
+
return this.get('themeStore');
|
|
116
|
+
}
|
|
117
|
+
setThemeStore(themeStore) {
|
|
118
|
+
debug(content `Setting theme store...`);
|
|
119
|
+
this.set('themeStore', themeStore);
|
|
120
|
+
}
|
|
121
|
+
getSession() {
|
|
122
|
+
debug(content `Getting session store...`);
|
|
123
|
+
return this.get('sessionStore');
|
|
124
|
+
}
|
|
125
|
+
setSession(session) {
|
|
126
|
+
debug(content `Setting session store...`);
|
|
127
|
+
this.set('sessionStore', session);
|
|
128
|
+
}
|
|
129
|
+
removeSession() {
|
|
130
|
+
debug(content `Removing session store...`);
|
|
131
|
+
this.set('sessionStore', '');
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=store.js.map
|