shopify-cli 1.4.1 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +2 -2
- data/.github/CONTRIBUTING.md +9 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +3 -2
- data/.github/workflows/release.yml +0 -1
- data/.github/workflows/triage.yml +22 -0
- data/.rubocop.yml +21 -7
- data/.rubocop_todo.yml +2 -15
- data/.travis.yml +1 -1
- data/CHANGELOG.md +28 -0
- data/Gemfile +12 -11
- data/Gemfile.lock +17 -14
- data/README.md +39 -7
- data/RELEASING.md +5 -13
- data/Rakefile +32 -28
- data/bin/load_shopify.rb +6 -6
- data/bin/shopify +2 -2
- data/dev.yml +2 -2
- data/docs/_config.yml +1 -18
- data/docs/app/node/commands/index.md +2 -80
- data/docs/app/node/index.md +2 -33
- data/docs/app/rails/commands/index.md +2 -78
- data/docs/app/rails/index.md +2 -34
- data/docs/core/index.md +2 -84
- data/docs/getting-started/index.md +2 -25
- data/docs/getting-started/install/index.md +1 -118
- data/docs/getting-started/migrate/index.md +2 -94
- data/docs/getting-started/uninstall/index.md +2 -35
- data/docs/getting-started/upgrade/index.md +2 -39
- data/docs/help/start-app/index.md +2 -4
- data/docs/index.md +2 -24
- data/ext/shopify-cli/extconf.rb +7 -7
- data/install.sh +1 -1
- data/lib/docgen/markdown.rb +12 -12
- data/lib/graphql/fetch_specifications.graphql +14 -0
- data/lib/{project_types/extension/graphql → graphql}/get_app_by_api_key.graphql +0 -0
- data/lib/project_types/extension/cli.rb +54 -47
- data/lib/project_types/extension/commands/build.rb +3 -3
- data/lib/project_types/extension/commands/create.rb +17 -10
- data/lib/project_types/extension/commands/extension_command.rb +12 -5
- data/lib/project_types/extension/commands/push.rb +8 -8
- data/lib/project_types/extension/commands/register.rb +19 -30
- data/lib/project_types/extension/commands/serve.rb +31 -3
- data/lib/project_types/extension/commands/tunnel.rb +12 -12
- data/lib/project_types/extension/extension_project.rb +8 -4
- data/lib/project_types/extension/extension_project_keys.rb +4 -4
- data/lib/project_types/extension/features/argo.rb +117 -0
- data/lib/project_types/extension/features/argo_config.rb +5 -5
- data/lib/project_types/extension/features/argo_dependencies.rb +5 -5
- data/lib/project_types/extension/features/argo_setup.rb +2 -2
- data/lib/project_types/extension/features/argo_setup_steps.rb +4 -4
- data/lib/project_types/extension/forms/create.rb +28 -34
- data/lib/project_types/extension/forms/questions/ask_app.rb +53 -0
- data/lib/project_types/extension/forms/questions/ask_name.rb +40 -0
- data/lib/project_types/extension/forms/questions/ask_type.rb +47 -0
- data/lib/project_types/extension/messages/messages.rb +55 -52
- data/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
- data/lib/project_types/extension/models/specification.rb +37 -0
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +19 -0
- data/lib/project_types/extension/models/specification_handlers/default.rb +67 -0
- data/lib/project_types/extension/models/specifications.rb +88 -0
- data/lib/project_types/extension/tasks/configure_features.rb +52 -0
- data/lib/project_types/extension/tasks/converters/app_converter.rb +6 -6
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +6 -6
- data/lib/project_types/extension/tasks/converters/validation_error_converter.rb +4 -4
- data/lib/project_types/extension/tasks/converters/version_converter.rb +7 -7
- data/lib/project_types/extension/tasks/create_extension.rb +4 -4
- data/lib/project_types/extension/tasks/fetch_specifications.rb +18 -0
- data/lib/project_types/extension/tasks/get_app.rb +4 -4
- data/lib/project_types/extension/tasks/get_apps.rb +3 -3
- data/lib/project_types/extension/tasks/update_draft.rb +4 -4
- data/lib/project_types/extension/tasks/user_errors.rb +4 -4
- data/lib/project_types/node/cli.rb +19 -16
- data/lib/project_types/node/commands/connect.rb +15 -0
- data/lib/project_types/node/commands/create.rb +44 -41
- data/lib/project_types/node/commands/deploy.rb +4 -4
- data/lib/project_types/node/commands/deploy/heroku.rb +24 -24
- data/lib/project_types/node/commands/generate.rb +9 -18
- data/lib/project_types/node/commands/open.rb +2 -2
- data/lib/project_types/node/commands/populate.rb +6 -6
- data/lib/project_types/node/commands/populate/customer.rb +5 -5
- data/lib/project_types/node/commands/populate/draft_order.rb +5 -5
- data/lib/project_types/node/commands/populate/product.rb +5 -5
- data/lib/project_types/node/commands/serve.rb +9 -9
- data/lib/project_types/node/commands/tunnel.rb +7 -7
- data/lib/project_types/node/forms/create.rb +17 -8
- data/lib/project_types/node/messages/messages.rb +20 -53
- data/lib/project_types/rails/cli.rb +21 -18
- data/lib/project_types/rails/commands/connect.rb +15 -0
- data/lib/project_types/rails/commands/create.rb +58 -57
- data/lib/project_types/rails/commands/deploy.rb +4 -4
- data/lib/project_types/rails/commands/deploy/heroku.rb +30 -30
- data/lib/project_types/rails/commands/generate.rb +7 -7
- data/lib/project_types/rails/commands/generate/webhook.rb +6 -6
- data/lib/project_types/rails/commands/open.rb +2 -2
- data/lib/project_types/rails/commands/populate.rb +6 -6
- data/lib/project_types/rails/commands/populate/customer.rb +5 -5
- data/lib/project_types/rails/commands/populate/draft_order.rb +5 -5
- data/lib/project_types/rails/commands/populate/product.rb +5 -5
- data/lib/project_types/rails/commands/serve.rb +11 -11
- data/lib/project_types/rails/commands/tunnel.rb +7 -7
- data/lib/project_types/rails/forms/create.rb +35 -25
- data/lib/project_types/rails/gem.rb +24 -24
- data/lib/project_types/rails/messages/messages.rb +13 -9
- data/lib/project_types/rails/ruby.rb +2 -2
- data/lib/project_types/script/cli.rb +44 -38
- data/lib/project_types/script/commands/create.rb +15 -10
- data/lib/project_types/script/commands/disable.rb +3 -3
- data/lib/project_types/script/commands/enable.rb +19 -9
- data/lib/project_types/script/commands/push.rb +10 -17
- data/lib/project_types/script/config/extension_points.yml +30 -12
- data/lib/project_types/script/errors.rb +22 -0
- data/lib/project_types/script/forms/create.rb +29 -5
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +12 -1
- data/lib/project_types/script/layers/application/build_script.rb +19 -19
- data/lib/project_types/script/layers/application/create_script.rb +45 -12
- data/lib/project_types/script/layers/application/disable_script.rb +2 -2
- data/lib/project_types/script/layers/application/enable_script.rb +2 -2
- data/lib/project_types/script/layers/application/extension_points.rb +24 -0
- data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
- data/lib/project_types/script/layers/application/push_script.rb +15 -18
- data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
- data/lib/project_types/script/layers/domain/errors.rb +23 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +67 -7
- data/lib/project_types/script/layers/domain/metadata.rb +55 -0
- data/lib/project_types/script/layers/domain/push_package.rb +29 -6
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +45 -55
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +41 -45
- data/lib/project_types/script/layers/infrastructure/config_ui_repository.rb +46 -0
- data/lib/project_types/script/layers/infrastructure/errors.rb +32 -5
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +12 -6
- data/lib/project_types/script/layers/infrastructure/project_creator.rb +2 -1
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +20 -13
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +72 -0
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +59 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +39 -17
- data/lib/project_types/script/layers/infrastructure/task_runner.rb +4 -3
- data/lib/project_types/script/messages/messages.rb +76 -10
- data/lib/project_types/script/script_project.rb +26 -16
- data/lib/project_types/script/ui/error_handler.rb +135 -50
- data/lib/project_types/script/ui/printing_spinner.rb +1 -1
- data/lib/project_types/script/ui/strict_spinner.rb +1 -1
- data/lib/project_types/theme/cli.rb +40 -0
- data/lib/project_types/theme/commands/connect.rb +54 -0
- data/lib/project_types/theme/commands/create.rb +48 -0
- data/lib/project_types/theme/commands/deploy.rb +38 -0
- data/lib/project_types/theme/commands/generate.rb +20 -0
- data/lib/project_types/theme/commands/generate/env.rb +79 -0
- data/lib/project_types/theme/commands/push.rb +55 -0
- data/lib/project_types/theme/commands/serve.rb +31 -0
- data/lib/project_types/theme/forms/connect.rb +34 -0
- data/lib/project_types/theme/forms/create.rb +22 -0
- data/lib/project_types/theme/messages/messages.rb +147 -0
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +78 -0
- data/lib/project_types/theme/themekit.rb +113 -0
- data/lib/rubygems_plugin.rb +3 -3
- data/lib/shopify-cli/admin_api.rb +52 -12
- data/lib/shopify-cli/admin_api/populate_resource_command.rb +17 -17
- data/lib/shopify-cli/admin_api/schema.rb +3 -3
- data/lib/shopify-cli/api.rb +36 -31
- data/lib/shopify-cli/command.rb +1 -1
- data/lib/shopify-cli/commands.rb +9 -9
- data/lib/shopify-cli/commands/config.rb +28 -28
- data/lib/shopify-cli/commands/connect.rb +35 -18
- data/lib/shopify-cli/commands/create.rb +5 -5
- data/lib/shopify-cli/commands/help.rb +6 -6
- data/lib/shopify-cli/commands/logout.rb +3 -3
- data/lib/shopify-cli/commands/system.rb +33 -33
- data/lib/shopify-cli/commands/version.rb +2 -2
- data/lib/shopify-cli/context.rb +43 -22
- data/lib/shopify-cli/core.rb +4 -4
- data/lib/shopify-cli/core/entry_point.rb +5 -5
- data/lib/shopify-cli/core/executor.rb +1 -1
- data/lib/shopify-cli/core/help_resolver.rb +2 -2
- data/lib/shopify-cli/core/monorail.rb +17 -16
- data/lib/shopify-cli/db.rb +2 -2
- data/lib/shopify-cli/feature.rb +1 -3
- data/lib/shopify-cli/form.rb +1 -1
- data/lib/shopify-cli/git.rb +17 -17
- data/lib/shopify-cli/helpers.rb +1 -1
- data/lib/shopify-cli/helpers/haikunator.rb +1 -1
- data/lib/shopify-cli/heroku.rb +28 -28
- data/lib/shopify-cli/http_request.rb +21 -9
- data/lib/shopify-cli/js_deps.rb +13 -13
- data/lib/shopify-cli/js_system.rb +5 -5
- data/lib/shopify-cli/lazy_delegator.rb +55 -0
- data/lib/shopify-cli/messages/messages.rb +21 -10
- data/lib/shopify-cli/method_object.rb +104 -0
- data/lib/shopify-cli/oauth.rb +25 -25
- data/lib/shopify-cli/oauth/servlet.rb +9 -9
- data/lib/shopify-cli/options.rb +3 -3
- data/lib/shopify-cli/packager.rb +24 -24
- data/lib/shopify-cli/partners_api.rb +38 -16
- data/lib/shopify-cli/partners_api/organizations.rb +10 -10
- data/lib/shopify-cli/process_supervision.rb +8 -8
- data/lib/shopify-cli/project.rb +27 -23
- data/lib/shopify-cli/project_type.rb +21 -5
- data/lib/shopify-cli/resolve_constant.rb +25 -0
- data/lib/shopify-cli/resources.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +9 -9
- data/lib/shopify-cli/result.rb +432 -0
- data/lib/shopify-cli/shopifolk.rb +35 -18
- data/lib/shopify-cli/sub_command.rb +1 -1
- data/lib/shopify-cli/task.rb +9 -1
- data/lib/shopify-cli/tasks.rb +7 -7
- data/lib/shopify-cli/tasks/create_api_client.rb +13 -4
- data/lib/shopify-cli/tasks/ensure_dev_store.rb +12 -12
- data/lib/shopify-cli/tasks/ensure_env.rb +18 -15
- data/lib/shopify-cli/tasks/ensure_loopback_url.rb +4 -4
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +28 -24
- data/lib/shopify-cli/tasks/update_dashboard_urls.rb +10 -10
- data/lib/shopify-cli/transform_data_structure.rb +86 -0
- data/lib/shopify-cli/tunnel.rb +36 -30
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +57 -52
- data/shopify-cli.gemspec +6 -6
- data/shopify.fish +1 -1
- data/shopify.sh +1 -1
- data/vendor/deps/cli-kit/REVISION +1 -1
- data/vendor/deps/cli-kit/lib/cli/kit/logger.rb +2 -2
- data/vendor/deps/cli-kit/lib/cli/kit/system.rb +3 -3
- data/vendor/deps/cli-ui/REVISION +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui.rb +26 -22
- data/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +4 -6
- data/vendor/deps/cli-ui/lib/cli/ui/frame.rb +3 -3
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +8 -9
- data/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +1 -0
- data/vendor/deps/cli-ui/lib/cli/ui/printer.rb +15 -3
- data/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +4 -11
- data/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +3 -5
- data/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +10 -10
- data/vendor/deps/cli-ui/lib/cli/ui/version.rb +1 -1
- data/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +56 -0
- data/vendor/deps/webrick/.gitignore +9 -0
- data/vendor/deps/webrick/Gemfile +3 -0
- data/vendor/deps/webrick/LICENSE.txt +22 -0
- data/vendor/deps/webrick/README.md +61 -0
- data/vendor/deps/webrick/Rakefile +10 -0
- data/vendor/deps/webrick/lib/webrick.rb +232 -0
- data/vendor/deps/webrick/lib/webrick/accesslog.rb +157 -0
- data/vendor/deps/webrick/lib/webrick/cgi.rb +313 -0
- data/vendor/deps/webrick/lib/webrick/compat.rb +36 -0
- data/vendor/deps/webrick/lib/webrick/config.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/cookie.rb +172 -0
- data/vendor/deps/webrick/lib/webrick/htmlutils.rb +30 -0
- data/vendor/deps/webrick/lib/webrick/httpauth.rb +96 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +117 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +116 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +395 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +132 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +97 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +158 -0
- data/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +53 -0
- data/vendor/deps/webrick/lib/webrick/httpproxy.rb +354 -0
- data/vendor/deps/webrick/lib/webrick/httprequest.rb +636 -0
- data/vendor/deps/webrick/lib/webrick/httpresponse.rb +564 -0
- data/vendor/deps/webrick/lib/webrick/https.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpserver.rb +294 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet.rb +23 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +152 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +126 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +88 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +552 -0
- data/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +47 -0
- data/vendor/deps/webrick/lib/webrick/httpstatus.rb +194 -0
- data/vendor/deps/webrick/lib/webrick/httputils.rb +512 -0
- data/vendor/deps/webrick/lib/webrick/httpversion.rb +76 -0
- data/vendor/deps/webrick/lib/webrick/log.rb +156 -0
- data/vendor/deps/webrick/lib/webrick/server.rb +381 -0
- data/vendor/deps/webrick/lib/webrick/ssl.rb +215 -0
- data/vendor/deps/webrick/lib/webrick/utils.rb +265 -0
- data/vendor/deps/webrick/lib/webrick/version.rb +18 -0
- data/vendor/deps/webrick/webrick.gemspec +74 -0
- data/vendor/gen/template/bin/update-deps +9 -9
- metadata +83 -29
- data/docs/Gemfile +0 -5
- data/docs/Gemfile.lock +0 -258
- data/docs/_data/nav.yml +0 -35
- data/docs/_includes/footer.html +0 -15
- data/docs/_includes/head.html +0 -19
- data/docs/_includes/sidebar_nav.html +0 -22
- data/docs/_includes/toc.html +0 -112
- data/docs/_layouts/default.html +0 -79
- data/docs/css/docs.css +0 -157
- data/docs/images/header.png +0 -0
- data/docs/installing-ruby.md +0 -28
- data/lib/project_types/extension/features/argo/admin.rb +0 -20
- data/lib/project_types/extension/features/argo/base.rb +0 -129
- data/lib/project_types/extension/features/argo/checkout.rb +0 -20
- data/lib/project_types/extension/forms/register.rb +0 -47
- data/lib/project_types/extension/models/type.rb +0 -81
- data/lib/project_types/extension/models/types/checkout_post_purchase.rb +0 -23
- data/lib/project_types/extension/models/types/product_subscription.rb +0 -24
- data/lib/project_types/node/commands/generate/billing.rb +0 -39
- data/lib/project_types/node/commands/generate/page.rb +0 -59
- data/lib/project_types/node/commands/generate/webhook.rb +0 -37
- data/lib/project_types/script/layers/domain/script.rb +0 -18
- data/lib/project_types/script/layers/infrastructure/assemblyscript_tsconfig.rb +0 -38
- data/lib/project_types/script/layers/infrastructure/script_repository.rb +0 -59
- data/lib/project_types/script/templates/ts/as-pect.config.js +0 -27
- data/lib/project_types/script/templates/ts/as-pect.d.ts +0 -1
|
@@ -15,24 +15,38 @@ module Script
|
|
|
15
15
|
script_name:,
|
|
16
16
|
script_content:,
|
|
17
17
|
compiled_type:,
|
|
18
|
+
description: nil,
|
|
18
19
|
api_key: nil,
|
|
19
|
-
force: false
|
|
20
|
+
force: false,
|
|
21
|
+
metadata:,
|
|
22
|
+
config_ui:
|
|
20
23
|
)
|
|
21
24
|
query_name = "app_script_update_or_create"
|
|
22
25
|
variables = {
|
|
23
26
|
extensionPointName: extension_point_type.upcase,
|
|
24
27
|
title: script_name,
|
|
28
|
+
description: description,
|
|
29
|
+
configUi: config_ui&.content,
|
|
25
30
|
sourceCode: Base64.encode64(script_content),
|
|
26
31
|
language: compiled_type,
|
|
27
32
|
force: force,
|
|
33
|
+
schemaMajorVersion: metadata.schema_major_version.to_s, # API expects string value
|
|
34
|
+
schemaMinorVersion: metadata.schema_minor_version.to_s, # API expects string value
|
|
35
|
+
useMsgpack: metadata.use_msgpack,
|
|
28
36
|
}
|
|
29
37
|
resp_hash = script_service_request(query_name: query_name, api_key: api_key, variables: variables)
|
|
30
38
|
user_errors = resp_hash["data"]["appScriptUpdateOrCreate"]["userErrors"]
|
|
31
39
|
|
|
32
40
|
return resp_hash if user_errors.empty?
|
|
33
41
|
|
|
34
|
-
if user_errors.any? { |e| e[
|
|
42
|
+
if user_errors.any? { |e| e["tag"] == "already_exists_error" }
|
|
35
43
|
raise Errors::ScriptRepushError, api_key
|
|
44
|
+
elsif (e = user_errors.any? { |err| err["tag"] == "config_ui_syntax_error" })
|
|
45
|
+
raise Errors::ConfigUiSyntaxError, config_ui&.filename
|
|
46
|
+
elsif (e = user_errors.find { |err| err["tag"] == "config_ui_missing_keys_error" })
|
|
47
|
+
raise Errors::ConfigUiMissingKeysError.new(config_ui&.filename, e["message"])
|
|
48
|
+
elsif (e = user_errors.find { |err| err["tag"] == "config_ui_fields_missing_keys_error" })
|
|
49
|
+
raise Errors::ConfigUiFieldsMissingKeysError.new(config_ui&.filename, e["message"])
|
|
36
50
|
else
|
|
37
51
|
raise Errors::ScriptServiceUserError.new(query_name, user_errors.to_s)
|
|
38
52
|
end
|
|
@@ -56,11 +70,11 @@ module Script
|
|
|
56
70
|
|
|
57
71
|
return resp_hash if user_errors.empty?
|
|
58
72
|
|
|
59
|
-
if user_errors.any? { |e| e[
|
|
73
|
+
if user_errors.any? { |e| e["tag"] == "app_script_not_found" }
|
|
60
74
|
raise Errors::AppScriptUndefinedError, api_key
|
|
61
|
-
elsif user_errors.any? { |e| e[
|
|
75
|
+
elsif user_errors.any? { |e| e["tag"] == "shop_script_conflict" }
|
|
62
76
|
raise Errors::ShopScriptConflictError
|
|
63
|
-
elsif user_errors.any? { |e| e[
|
|
77
|
+
elsif user_errors.any? { |e| e["tag"] == "app_script_not_pushed" }
|
|
64
78
|
raise Errors::AppScriptNotPushedError
|
|
65
79
|
else
|
|
66
80
|
raise Errors::ScriptServiceUserError.new(query_name, user_errors.to_s)
|
|
@@ -82,7 +96,7 @@ module Script
|
|
|
82
96
|
user_errors = resp_hash["data"]["shopScriptDelete"]["userErrors"]
|
|
83
97
|
return resp_hash if user_errors.empty?
|
|
84
98
|
|
|
85
|
-
if user_errors.any? { |e| e[
|
|
99
|
+
if user_errors.any? { |e| e["tag"] == "shop_script_not_found" }
|
|
86
100
|
raise Errors::ShopScriptUndefinedError, api_key
|
|
87
101
|
else
|
|
88
102
|
raise Errors::ScriptServiceUserError.new(query_name, user_errors.to_s)
|
|
@@ -106,13 +120,19 @@ module Script
|
|
|
106
120
|
def self.api_client(ctx, api_key, shop_domain)
|
|
107
121
|
new(
|
|
108
122
|
ctx: ctx,
|
|
109
|
-
url:
|
|
110
|
-
token:
|
|
123
|
+
url: "https://script-service.myshopify.io/graphql",
|
|
124
|
+
token: "",
|
|
111
125
|
api_key: api_key,
|
|
112
|
-
shop_id: shop_domain
|
|
126
|
+
shop_id: infer_shop_id(shop_domain)
|
|
113
127
|
)
|
|
114
128
|
end
|
|
115
129
|
|
|
130
|
+
def self.infer_shop_id(shop_domain)
|
|
131
|
+
return unless shop_domain
|
|
132
|
+
|
|
133
|
+
[shop_domain.to_i, 1].max
|
|
134
|
+
end
|
|
135
|
+
|
|
116
136
|
def auth_headers(*)
|
|
117
137
|
tokens = { "APP_KEY" => api_key, "SHOP_ID" => shop_id }.compact.to_json
|
|
118
138
|
{ "X-Shopify-Authenticated-Tokens" => tokens }
|
|
@@ -142,26 +162,28 @@ module Script
|
|
|
142
162
|
options[:variables] = variables.to_json if variables
|
|
143
163
|
resp = PartnersProxyAPI.query(ctx, query_name, **options)
|
|
144
164
|
raise_if_graphql_failed(resp)
|
|
145
|
-
JSON.parse(resp[
|
|
165
|
+
JSON.parse(resp["data"]["scriptServiceProxy"])
|
|
146
166
|
end
|
|
147
167
|
|
|
148
168
|
def raise_if_graphql_failed(response)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
169
|
+
raise Errors::EmptyResponseError if response.nil?
|
|
170
|
+
|
|
171
|
+
return unless response.key?("errors")
|
|
172
|
+
case error_code(response["errors"])
|
|
173
|
+
when "forbidden"
|
|
152
174
|
raise Errors::ForbiddenError
|
|
153
|
-
when
|
|
175
|
+
when "forbidden_on_shop"
|
|
154
176
|
raise Errors::ShopAuthenticationError
|
|
155
|
-
when
|
|
177
|
+
when "app_not_installed_on_shop"
|
|
156
178
|
raise Errors::AppNotInstalledError
|
|
157
179
|
else
|
|
158
|
-
raise Errors::GraphqlError, response[
|
|
180
|
+
raise Errors::GraphqlError, response["errors"].map { |e| e["message"] }
|
|
159
181
|
end
|
|
160
182
|
end
|
|
161
183
|
|
|
162
184
|
def error_code(errors)
|
|
163
185
|
errors.map do |e|
|
|
164
|
-
code = e.dig(
|
|
186
|
+
code = e.dig("extensions", "code")
|
|
165
187
|
return code if code
|
|
166
188
|
end
|
|
167
189
|
end
|
|
@@ -5,12 +5,13 @@ module Script
|
|
|
5
5
|
module Infrastructure
|
|
6
6
|
class TaskRunner
|
|
7
7
|
TASK_RUNNERS = {
|
|
8
|
-
"
|
|
8
|
+
"assemblyscript" => Infrastructure::AssemblyScriptTaskRunner,
|
|
9
|
+
"rust" => Infrastructure::RustTaskRunner,
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
def self.for(ctx, language, script_name
|
|
12
|
+
def self.for(ctx, language, script_name)
|
|
12
13
|
raise Errors::TaskRunnerNotFoundError unless TASK_RUNNERS[language]
|
|
13
|
-
TASK_RUNNERS[language].new(ctx, script_name
|
|
14
|
+
TASK_RUNNERS[language].new(ctx, script_name)
|
|
14
15
|
end
|
|
15
16
|
end
|
|
16
17
|
end
|
|
@@ -5,6 +5,9 @@ module Script
|
|
|
5
5
|
MESSAGES = {
|
|
6
6
|
script: {
|
|
7
7
|
error: {
|
|
8
|
+
deprecated_ep: "This project uses an extension point %s which has been deprecated. "\
|
|
9
|
+
"This Script will no longer function in production.",
|
|
10
|
+
deprecated_ep_cause: "Try using a different extension point.",
|
|
8
11
|
generic: "{{red:{{x}} Error}}",
|
|
9
12
|
eacces_cause: "You don't have permission to write to this directory.",
|
|
10
13
|
eacces_help: "Change your directory permissions and try again.",
|
|
@@ -18,16 +21,20 @@ module Script
|
|
|
18
21
|
invalid_context_cause: "Your .shopify-cli.yml file is not correct.",
|
|
19
22
|
invalid_context_help: "See https://help.shopify.com",
|
|
20
23
|
|
|
24
|
+
invalid_config_props_cause: "{{command:--config-props}} is formatted incorrectly.",
|
|
25
|
+
invalid_config_props_help: "Try again using this format: "\
|
|
26
|
+
"{{cyan:--config-props='name1:value1, name2:value2'}}",
|
|
27
|
+
|
|
21
28
|
invalid_script_name_cause: "Invalid script name.",
|
|
22
29
|
invalid_script_name_help: "Replace or remove unsupported characters. Valid characters "\
|
|
23
30
|
"are numbers, letters, hyphens, or underscores.",
|
|
24
31
|
|
|
25
32
|
no_existing_apps_cause: "You don't have any apps.",
|
|
26
|
-
no_existing_apps_help: "
|
|
33
|
+
no_existing_apps_help: "Create an app with {{command:shopify create}} or "\
|
|
27
34
|
"visit https://partners.shopify.com/.",
|
|
28
35
|
|
|
29
36
|
no_existing_orgs_cause: "You don't have any partner organizations.",
|
|
30
|
-
no_existing_orgs_help: "
|
|
37
|
+
no_existing_orgs_help: "Visit https://partners.shopify.com/ to create a partners account.",
|
|
31
38
|
|
|
32
39
|
no_existing_stores_cause: "You don't have any stores.",
|
|
33
40
|
no_existing_stores_help: "Visit https://partners.shopify.com/%{organization_id}/stores/ to create one.",
|
|
@@ -35,14 +42,56 @@ module Script
|
|
|
35
42
|
project_exists_cause: "Directory with the same name as the script already exists.",
|
|
36
43
|
project_exists_help: "Use different script name and try again.",
|
|
37
44
|
|
|
38
|
-
invalid_extension_cause: "Invalid extension point %s",
|
|
45
|
+
invalid_extension_cause: "Invalid extension point %s.",
|
|
39
46
|
invalid_extension_help: "Allowed values: %s.",
|
|
40
47
|
|
|
48
|
+
invalid_language_cause: "Invalid language %s.",
|
|
49
|
+
invalid_language_help: "Allowed values: %s.",
|
|
50
|
+
|
|
41
51
|
invalid_config: "Can't change the configuration values because %1$s is missing or "\
|
|
42
52
|
"it is not formatted properly.",
|
|
43
53
|
|
|
54
|
+
invalid_config_ui_definition_cause: "The UI configuration file %s contains invalid YAML.",
|
|
55
|
+
invalid_config_ui_definition_help: "Fix the errors and try again.",
|
|
56
|
+
|
|
57
|
+
missing_config_ui_definition_cause: "You are missing the UI configuration file %s.",
|
|
58
|
+
missing_config_ui_definition_help: "Create this file and try again.",
|
|
59
|
+
|
|
60
|
+
config_ui_syntax_error_cause: "The UI configuration file %{filename} is not formatted properly.",
|
|
61
|
+
config_ui_syntax_error_help: "Fix the errors and try again.",
|
|
62
|
+
|
|
63
|
+
config_ui_missing_keys_error_cause: "The UI configuration file %{filename} is missing required keys: "\
|
|
64
|
+
"%{missing_keys}.",
|
|
65
|
+
config_ui_missing_keys_error_help: "Add the keys and try again.",
|
|
66
|
+
|
|
67
|
+
config_ui_fields_missing_keys_error_cause: "A field entry in the UI configuration file %{filename} is "\
|
|
68
|
+
"missing required keys: %{missing_keys}.",
|
|
69
|
+
config_ui_fields_missing_keys_error_help: "Add the keys and try again.",
|
|
70
|
+
|
|
44
71
|
script_not_found_cause: "Couldn't find script %s for extension point %s",
|
|
45
72
|
|
|
73
|
+
service_failure_cause: "Internal service error.",
|
|
74
|
+
service_failure_help: "Ensure the 'shopify/scripts-toolchain-as' package is up to date.",
|
|
75
|
+
|
|
76
|
+
user_error_cause: "Invalid script extension metadata.",
|
|
77
|
+
user_error_help: "Ensure the 'shopify/scripts-toolchain-as' package is up to date.",
|
|
78
|
+
|
|
79
|
+
metadata_validation_cause: "Invalid script extension metadata.",
|
|
80
|
+
metadata_validation_help: "Ensure the 'shopify/scripts-toolchain-as' package is up to date.",
|
|
81
|
+
|
|
82
|
+
metadata_schema_versions_missing: "Invalid script metadata:" \
|
|
83
|
+
" 'schemaVersions' field is missing",
|
|
84
|
+
metadata_schema_versions_single_key: "Invalid script extension metadata:" \
|
|
85
|
+
" 'schemaVersions' can have only one extension point name.",
|
|
86
|
+
metadata_schema_versions_missing_major: "Invalid script extension metadata:" \
|
|
87
|
+
" 'schemaVersions' is missing the 'major' field",
|
|
88
|
+
metadata_schema_versions_missing_minor: "Invalid script extension metadata:" \
|
|
89
|
+
" 'schemaVersions' is missing the 'minor' field",
|
|
90
|
+
|
|
91
|
+
metadata_not_found_cause: "Script version file (%s) cannot be found.",
|
|
92
|
+
metadata_not_found_help: "Ensure the 'shopify/scripts-toolchain-as' package is up to date and " \
|
|
93
|
+
"'package.json' contains a 'scripts/build' entry with a " \
|
|
94
|
+
"'--metadata build/metadata.json' argument",
|
|
46
95
|
app_not_installed_cause: "App not installed on store.",
|
|
47
96
|
|
|
48
97
|
app_script_not_pushed_help: "Script isn't on the app. Run {{command:shopify push}}, and then try again.",
|
|
@@ -53,6 +102,9 @@ module Script
|
|
|
53
102
|
dependency_install_cause: "Something went wrong while installing the dependencies that are needed.",
|
|
54
103
|
dependency_install_help: "Correct the errors and try again.",
|
|
55
104
|
|
|
105
|
+
failed_api_request_cause: "Something went wrong while communicating with Shopify.",
|
|
106
|
+
failed_api_request_help: "Try again.",
|
|
107
|
+
|
|
56
108
|
forbidden_error_cause: "You do not have permission to do this action.",
|
|
57
109
|
|
|
58
110
|
graphql_error_cause: "An error was returned: %s.",
|
|
@@ -70,8 +122,18 @@ module Script
|
|
|
70
122
|
|
|
71
123
|
shop_script_undefined_cause: "Script is already turned off in store.",
|
|
72
124
|
|
|
73
|
-
|
|
74
|
-
|
|
125
|
+
invalid_build_script: "The root package.json contains an invalid build command that " \
|
|
126
|
+
"is needed to compile your script to WebAssembly.",
|
|
127
|
+
build_script_not_found: "The root package.json is missing the build command that " \
|
|
128
|
+
"is needed to compile your script to WebAssembly.",
|
|
129
|
+
# rubocop:disable Layout/LineLength
|
|
130
|
+
build_script_suggestion: "\n\nFor example, your package.json needs the following command:" \
|
|
131
|
+
"\nbuild: npx shopify-scripts-toolchain-as build --src src/shopify_main.ts --binary build/<script_name>.wasm --metadata build/metadata.json -- --lib node_modules --optimize --use Date=",
|
|
132
|
+
|
|
133
|
+
web_assembly_binary_not_found: "WebAssembly binary not found.",
|
|
134
|
+
web_assembly_binary_not_found_suggestion: "No WebAssembly binary found." \
|
|
135
|
+
"Check that your build npm script outputs the generated binary to the root of the directory." \
|
|
136
|
+
"Generated binary should match the script name: <script_name>.wasm",
|
|
75
137
|
},
|
|
76
138
|
|
|
77
139
|
create: {
|
|
@@ -80,7 +142,9 @@ module Script
|
|
|
80
142
|
Usage: {{command:%1$s create script}}
|
|
81
143
|
Options:
|
|
82
144
|
{{command:--name=NAME}} Script project name. Use any string.
|
|
83
|
-
{{command:--
|
|
145
|
+
{{command:--description=DESCRIPTION}} Description of the project. Use any string.
|
|
146
|
+
{{command:--extension-point=TYPE}} Extension point name. Allowed values: %2$s.
|
|
147
|
+
{{command:--no-config-ui}} Specify this option if you don’t want Scripts to render an interface in the Shopify admin.
|
|
84
148
|
HELP
|
|
85
149
|
|
|
86
150
|
error: {
|
|
@@ -89,7 +153,7 @@ module Script
|
|
|
89
153
|
|
|
90
154
|
change_directory_notice: "{{*}} Change directories to {{green:%s}} to run script commands",
|
|
91
155
|
creating: "Creating script",
|
|
92
|
-
created: "Created script
|
|
156
|
+
created: "Created script",
|
|
93
157
|
},
|
|
94
158
|
|
|
95
159
|
push: {
|
|
@@ -101,7 +165,7 @@ module Script
|
|
|
101
165
|
HELP
|
|
102
166
|
|
|
103
167
|
error: {
|
|
104
|
-
operation_failed: "Couldn't push script to app.",
|
|
168
|
+
operation_failed: "Couldn't push script to app (API key: %{api_key}).",
|
|
105
169
|
},
|
|
106
170
|
|
|
107
171
|
script_pushed: "{{v}} Script pushed to app (API key: %{api_key}).",
|
|
@@ -125,8 +189,8 @@ module Script
|
|
|
125
189
|
Turn on script in store.
|
|
126
190
|
Usage: {{command:%s enable}}
|
|
127
191
|
Options:
|
|
128
|
-
{{command:--
|
|
129
|
-
{{command:--config_file=<path/to/YAMLFilename>}} Optional. Define the configuration of your script using a YAML formatted file. --
|
|
192
|
+
{{command:--config-props='name1:value1, name2:value2'}} Optional. Define the configuration of your script by passing individual name and value pairs. If used with --config_file, then matching values in --config-props will override those set in the file.
|
|
193
|
+
{{command:--config_file=<path/to/YAMLFilename>}} Optional. Define the configuration of your script using a YAML formatted file. --config-props values override properties in this file.
|
|
130
194
|
HELP
|
|
131
195
|
|
|
132
196
|
info: "{{*}} A script always remains enabled until you disable it - even after pushing "\
|
|
@@ -151,7 +215,9 @@ module Script
|
|
|
151
215
|
forms: {
|
|
152
216
|
create: {
|
|
153
217
|
select_extension_point: "Which extension point do you want to use?",
|
|
218
|
+
select_language: "Which language do you want to use?",
|
|
154
219
|
script_name: "Script Name",
|
|
220
|
+
description: "Description",
|
|
155
221
|
},
|
|
156
222
|
},
|
|
157
223
|
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
module Script
|
|
4
4
|
class ScriptProject < ShopifyCli::Project
|
|
5
|
-
|
|
6
|
-
SOURCE_DIR = "src"
|
|
7
|
-
|
|
8
|
-
attr_reader :extension_point_type, :script_name, :language
|
|
5
|
+
attr_reader :extension_point_type, :script_name, :language, :description, :config_ui_file
|
|
9
6
|
|
|
10
7
|
def initialize(*args)
|
|
11
8
|
super
|
|
12
|
-
@extension_point_type = lookup_config(
|
|
13
|
-
@
|
|
14
|
-
@
|
|
9
|
+
@extension_point_type = lookup_config!("extension_point_type")
|
|
10
|
+
raise Errors::DeprecatedEPError, @extension_point_type if deprecated?(@extension_point_type)
|
|
11
|
+
@script_name = lookup_config!("script_name")
|
|
12
|
+
@description = lookup_config("description")
|
|
13
|
+
@config_ui_file = lookup_config("config_ui_file")
|
|
14
|
+
@language = lookup_language
|
|
15
15
|
ShopifyCli::Core::Monorail.metadata = {
|
|
16
16
|
"script_name" => @script_name,
|
|
17
17
|
"extension_point_type" => @extension_point_type,
|
|
@@ -19,25 +19,35 @@ module Script
|
|
|
19
19
|
}
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
def
|
|
23
|
-
|
|
22
|
+
def api_key
|
|
23
|
+
env[:api_key]
|
|
24
24
|
end
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
"#{SOURCE_DIR}/#{file_name}"
|
|
28
|
-
end
|
|
26
|
+
private
|
|
29
27
|
|
|
30
|
-
def
|
|
31
|
-
|
|
28
|
+
def deprecated?(ep)
|
|
29
|
+
Script::Layers::Application::ExtensionPoints.deprecated_types.include?(ep)
|
|
32
30
|
end
|
|
33
31
|
|
|
34
|
-
private
|
|
35
|
-
|
|
36
32
|
def lookup_config(key)
|
|
33
|
+
return nil unless config.key?(key)
|
|
34
|
+
config[key]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def lookup_config!(key)
|
|
37
38
|
raise Errors::InvalidContextError, key unless config.key?(key)
|
|
38
39
|
config[key]
|
|
39
40
|
end
|
|
40
41
|
|
|
42
|
+
def lookup_language
|
|
43
|
+
lang = lookup_config("language")&.downcase || Layers::Domain::ExtensionPointAssemblyScriptSDK.language
|
|
44
|
+
if Layers::Application::ExtensionPoints.supported_language?(type: extension_point_type, language: lang)
|
|
45
|
+
lang
|
|
46
|
+
else
|
|
47
|
+
raise Errors::InvalidLanguageError.new(lang, extension_point_type)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
41
51
|
class << self
|
|
42
52
|
def create(ctx, dir)
|
|
43
53
|
raise Errors::ScriptProjectAlreadyExistsError, dir if ctx.dir_exist?(dir)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "cli/ui"
|
|
2
2
|
|
|
3
3
|
module Script
|
|
4
4
|
module UI
|
|
5
5
|
module ErrorHandler
|
|
6
6
|
def self.display(failed_op:, cause_of_error:, help_suggestion:)
|
|
7
|
-
$stderr.puts(CLI::UI.fmt(ShopifyCli::Context.message(
|
|
7
|
+
$stderr.puts(CLI::UI.fmt(ShopifyCli::Context.message("script.error.generic")))
|
|
8
8
|
full_msg = failed_op ? failed_op.dup : ""
|
|
9
9
|
full_msg << " #{cause_of_error}" if cause_of_error
|
|
10
10
|
full_msg << " #{help_suggestion}" if help_suggestion
|
|
@@ -26,129 +26,214 @@ module Script
|
|
|
26
26
|
case e
|
|
27
27
|
when Errno::EACCES
|
|
28
28
|
{
|
|
29
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
30
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
29
|
+
cause_of_error: ShopifyCli::Context.message("script.error.eacces_cause"),
|
|
30
|
+
help_suggestion: ShopifyCli::Context.message("script.error.eacces_help"),
|
|
31
31
|
}
|
|
32
32
|
when Errno::ENOSPC
|
|
33
33
|
{
|
|
34
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
35
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
34
|
+
cause_of_error: ShopifyCli::Context.message("script.error.enospc_cause"),
|
|
35
|
+
help_suggestion: ShopifyCli::Context.message("script.error.enospc_help"),
|
|
36
36
|
}
|
|
37
37
|
when ShopifyCli::OAuth::Error
|
|
38
38
|
{
|
|
39
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
40
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
39
|
+
cause_of_error: ShopifyCli::Context.message("script.error.oauth_cause"),
|
|
40
|
+
help_suggestion: ShopifyCli::Context.message("script.error.oauth_help"),
|
|
41
41
|
}
|
|
42
42
|
when Errors::InvalidContextError
|
|
43
43
|
{
|
|
44
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
45
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
44
|
+
cause_of_error: ShopifyCli::Context.message("script.error.invalid_context_cause"),
|
|
45
|
+
help_suggestion: ShopifyCli::Context.message("script.error.invalid_context_help"),
|
|
46
|
+
}
|
|
47
|
+
when Errors::InvalidConfigProps
|
|
48
|
+
{
|
|
49
|
+
cause_of_error: ShopifyCli::Context.message("script.error.invalid_config_props_cause"),
|
|
50
|
+
help_suggestion: ShopifyCli::Context.message("script.error.invalid_config_props_help"),
|
|
46
51
|
}
|
|
47
52
|
when Errors::InvalidConfigYAMLError
|
|
48
53
|
{
|
|
49
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
54
|
+
cause_of_error: ShopifyCli::Context.message("script.error.invalid_config", e.config_file),
|
|
55
|
+
}
|
|
56
|
+
when Errors::InvalidLanguageError
|
|
57
|
+
{
|
|
58
|
+
cause_of_error: ShopifyCli::Context.message("script.error.invalid_language_cause", e.language),
|
|
59
|
+
help_suggestion: ShopifyCli::Context.message(
|
|
60
|
+
"script.error.invalid_language_help",
|
|
61
|
+
Script::Layers::Application::ExtensionPoints.languages(type: e.extension_point_type).join(", ")
|
|
62
|
+
),
|
|
50
63
|
}
|
|
51
64
|
when Errors::InvalidScriptNameError
|
|
52
65
|
{
|
|
53
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
54
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
66
|
+
cause_of_error: ShopifyCli::Context.message("script.error.invalid_script_name_cause"),
|
|
67
|
+
help_suggestion: ShopifyCli::Context.message("script.error.invalid_script_name_help"),
|
|
55
68
|
}
|
|
56
69
|
when Errors::NoExistingAppsError
|
|
57
70
|
{
|
|
58
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
59
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
71
|
+
cause_of_error: ShopifyCli::Context.message("script.error.no_existing_apps_cause"),
|
|
72
|
+
help_suggestion: ShopifyCli::Context.message("script.error.no_existing_apps_help"),
|
|
60
73
|
}
|
|
61
74
|
when Errors::NoExistingOrganizationsError
|
|
62
75
|
{
|
|
63
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
64
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
76
|
+
cause_of_error: ShopifyCli::Context.message("script.error.no_existing_orgs_cause"),
|
|
77
|
+
help_suggestion: ShopifyCli::Context.message("script.error.no_existing_orgs_help"),
|
|
65
78
|
}
|
|
66
79
|
when Errors::NoExistingStoresError
|
|
67
80
|
{
|
|
68
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
81
|
+
cause_of_error: ShopifyCli::Context.message("script.error.no_existing_stores_cause"),
|
|
69
82
|
help_suggestion: ShopifyCli::Context.message(
|
|
70
|
-
|
|
83
|
+
"script.error.no_existing_stores_help",
|
|
71
84
|
organization_id: e.organization_id
|
|
72
85
|
),
|
|
73
86
|
}
|
|
74
87
|
when Errors::ScriptProjectAlreadyExistsError
|
|
75
88
|
{
|
|
76
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
77
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
89
|
+
cause_of_error: ShopifyCli::Context.message("script.error.project_exists_cause"),
|
|
90
|
+
help_suggestion: ShopifyCli::Context.message("script.error.project_exists_help"),
|
|
91
|
+
}
|
|
92
|
+
when Errors::DeprecatedEPError
|
|
93
|
+
{
|
|
94
|
+
cause_of_error: ShopifyCli::Context.message("script.error.deprecated_ep", e.ep),
|
|
95
|
+
help_suggestion: ShopifyCli::Context.message("script.error.deprecated_ep_cause"),
|
|
78
96
|
}
|
|
79
97
|
when Layers::Domain::Errors::InvalidExtensionPointError
|
|
80
98
|
{
|
|
81
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
99
|
+
cause_of_error: ShopifyCli::Context.message("script.error.invalid_extension_cause", e.type),
|
|
82
100
|
help_suggestion: ShopifyCli::Context.message(
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
"script.error.invalid_extension_help",
|
|
102
|
+
Script::Layers::Application::ExtensionPoints.types.join(", ")
|
|
85
103
|
),
|
|
86
104
|
}
|
|
87
105
|
when Layers::Domain::Errors::ScriptNotFoundError
|
|
88
106
|
{
|
|
89
107
|
cause_of_error: ShopifyCli::Context.message(
|
|
90
|
-
|
|
108
|
+
"script.error.script_not_found_cause",
|
|
91
109
|
e.script_name,
|
|
92
110
|
e.extension_point_type
|
|
93
111
|
),
|
|
94
112
|
}
|
|
113
|
+
when Layers::Domain::Errors::ServiceFailureError
|
|
114
|
+
{
|
|
115
|
+
cause_of_error: ShopifyCli::Context.message("script.error.service_failure_cause"),
|
|
116
|
+
help_suggestion: ShopifyCli::Context.message("script.error.service_failure_help"),
|
|
117
|
+
}
|
|
118
|
+
when Layers::Domain::Errors::MetadataValidationError
|
|
119
|
+
{
|
|
120
|
+
cause_of_error: ShopifyCli::Context.message("script.error.metadata_validation_cause"),
|
|
121
|
+
help_suggestion: ShopifyCli::Context.message("script.error.metadata_validation_help"),
|
|
122
|
+
}
|
|
123
|
+
when Layers::Domain::Errors::MetadataNotFoundError
|
|
124
|
+
{
|
|
125
|
+
cause_of_error: ShopifyCli::Context.message("script.error.metadata_not_found_cause"),
|
|
126
|
+
help_suggestion: ShopifyCli::Context.message("script.error.metadata_not_found_help"),
|
|
127
|
+
}
|
|
128
|
+
when Layers::Domain::Errors::InvalidConfigUiDefinitionError
|
|
129
|
+
{
|
|
130
|
+
cause_of_error: ShopifyCli::Context
|
|
131
|
+
.message("script.error.invalid_config_ui_definition_cause", e.filename),
|
|
132
|
+
help_suggestion: ShopifyCli::Context.message("script.error.invalid_config_ui_definition_help"),
|
|
133
|
+
}
|
|
134
|
+
when Layers::Domain::Errors::MissingSpecifiedConfigUiDefinitionError
|
|
135
|
+
{
|
|
136
|
+
cause_of_error: ShopifyCli::Context
|
|
137
|
+
.message("script.error.missing_config_ui_definition_cause", e.filename),
|
|
138
|
+
help_suggestion: ShopifyCli::Context.message("script.error.missing_config_ui_definition_help"),
|
|
139
|
+
}
|
|
95
140
|
when Layers::Infrastructure::Errors::AppNotInstalledError
|
|
96
141
|
{
|
|
97
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
142
|
+
cause_of_error: ShopifyCli::Context.message("script.error.app_not_installed_cause"),
|
|
98
143
|
}
|
|
99
144
|
when Layers::Infrastructure::Errors::AppScriptNotPushedError,
|
|
100
145
|
Layers::Infrastructure::Errors::AppScriptUndefinedError
|
|
101
146
|
{
|
|
102
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
147
|
+
cause_of_error: ShopifyCli::Context.message("script.error.app_script_not_pushed_help"),
|
|
103
148
|
}
|
|
104
149
|
when Layers::Infrastructure::Errors::BuildError
|
|
105
150
|
{
|
|
106
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
107
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
151
|
+
cause_of_error: ShopifyCli::Context.message("script.error.build_error_cause"),
|
|
152
|
+
help_suggestion: ShopifyCli::Context.message("script.error.build_error_help"),
|
|
153
|
+
}
|
|
154
|
+
when Layers::Infrastructure::Errors::ConfigUiSyntaxError
|
|
155
|
+
{
|
|
156
|
+
cause_of_error: ShopifyCli::Context.message(
|
|
157
|
+
"script.error.config_ui_syntax_error_cause",
|
|
158
|
+
filename: e.message
|
|
159
|
+
),
|
|
160
|
+
help_suggestion: ShopifyCli::Context.message("script.error.config_ui_syntax_error_help"),
|
|
161
|
+
}
|
|
162
|
+
when Layers::Infrastructure::Errors::ConfigUiMissingKeysError
|
|
163
|
+
{
|
|
164
|
+
cause_of_error: ShopifyCli::Context.message(
|
|
165
|
+
"script.error.config_ui_missing_keys_error_cause",
|
|
166
|
+
filename: e.filename,
|
|
167
|
+
missing_keys: e.missing_keys
|
|
168
|
+
),
|
|
169
|
+
help_suggestion: ShopifyCli::Context.message("script.error.config_ui_missing_keys_error_help"),
|
|
170
|
+
}
|
|
171
|
+
when Layers::Infrastructure::Errors::ConfigUiFieldsMissingKeysError
|
|
172
|
+
{
|
|
173
|
+
cause_of_error: ShopifyCli::Context.message(
|
|
174
|
+
"script.error.config_ui_fields_missing_keys_error_cause",
|
|
175
|
+
filename: e.filename,
|
|
176
|
+
missing_keys: e.missing_keys
|
|
177
|
+
),
|
|
178
|
+
help_suggestion: ShopifyCli::Context.message("script.error.config_ui_fields_missing_keys_error_help"),
|
|
108
179
|
}
|
|
109
180
|
when Layers::Infrastructure::Errors::DependencyInstallError
|
|
110
181
|
{
|
|
111
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
112
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
182
|
+
cause_of_error: ShopifyCli::Context.message("script.error.dependency_install_cause"),
|
|
183
|
+
help_suggestion: ShopifyCli::Context.message("script.error.dependency_install_help"),
|
|
184
|
+
}
|
|
185
|
+
when Layers::Infrastructure::Errors::EmptyResponseError
|
|
186
|
+
{
|
|
187
|
+
cause_of_error: ShopifyCli::Context.message("script.error.failed_api_request_cause"),
|
|
188
|
+
help_suggestion: ShopifyCli::Context.message("script.error.failed_api_request_help"),
|
|
113
189
|
}
|
|
114
190
|
when Layers::Infrastructure::Errors::ForbiddenError
|
|
115
191
|
{
|
|
116
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
192
|
+
cause_of_error: ShopifyCli::Context.message("script.error.forbidden_error_cause"),
|
|
117
193
|
}
|
|
118
194
|
when Layers::Infrastructure::Errors::GraphqlError
|
|
119
195
|
{
|
|
120
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
121
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
196
|
+
cause_of_error: ShopifyCli::Context.message("script.error.graphql_error_cause", e.errors.join(", ")),
|
|
197
|
+
help_suggestion: ShopifyCli::Context.message("script.error.graphql_error_help"),
|
|
122
198
|
}
|
|
123
199
|
when Layers::Infrastructure::Errors::ScriptRepushError
|
|
124
200
|
{
|
|
125
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
126
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
201
|
+
cause_of_error: ShopifyCli::Context.message("script.error.script_repush_cause", e.api_key),
|
|
202
|
+
help_suggestion: ShopifyCli::Context.message("script.error.script_repush_help"),
|
|
203
|
+
}
|
|
204
|
+
when Layers::Infrastructure::Errors::ScriptServiceUserError
|
|
205
|
+
{
|
|
206
|
+
cause_of_error: ShopifyCli::Context.message("script.error.user_error_cause"),
|
|
207
|
+
help_suggestion: ShopifyCli::Context.message("script.error.user_error_help"),
|
|
127
208
|
}
|
|
128
209
|
when Layers::Infrastructure::Errors::ShopAuthenticationError
|
|
129
210
|
{
|
|
130
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
131
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
211
|
+
cause_of_error: ShopifyCli::Context.message("script.error.shop_auth_cause"),
|
|
212
|
+
help_suggestion: ShopifyCli::Context.message("script.error.shop_auth_help"),
|
|
132
213
|
}
|
|
133
214
|
when Layers::Infrastructure::Errors::ShopScriptConflictError
|
|
134
215
|
{
|
|
135
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
136
|
-
help_suggestion: ShopifyCli::Context.message(
|
|
216
|
+
cause_of_error: ShopifyCli::Context.message("script.error.shop_script_conflict_cause"),
|
|
217
|
+
help_suggestion: ShopifyCli::Context.message("script.error.shop_script_conflict_help"),
|
|
137
218
|
}
|
|
138
219
|
when Layers::Infrastructure::Errors::ShopScriptUndefinedError
|
|
139
220
|
{
|
|
140
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
221
|
+
cause_of_error: ShopifyCli::Context.message("script.error.shop_script_undefined_cause"),
|
|
141
222
|
}
|
|
142
|
-
when Layers::Infrastructure::Errors::
|
|
223
|
+
when Layers::Infrastructure::Errors::BuildScriptNotFoundError
|
|
143
224
|
{
|
|
144
|
-
cause_of_error: ShopifyCli::Context.message(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
225
|
+
cause_of_error: ShopifyCli::Context.message("script.error.build_script_not_found"),
|
|
226
|
+
help_suggestion: ShopifyCli::Context.message("script.error.build_script_suggestion"),
|
|
227
|
+
}
|
|
228
|
+
when Layers::Infrastructure::Errors::InvalidBuildScriptError
|
|
229
|
+
{
|
|
230
|
+
cause_of_error: ShopifyCli::Context.message("script.error.invalid_build_script"),
|
|
231
|
+
help_suggestion: ShopifyCli::Context.message("script.error.build_script_suggestion"),
|
|
232
|
+
}
|
|
233
|
+
when Layers::Infrastructure::Errors::WebAssemblyBinaryNotFoundError
|
|
234
|
+
{
|
|
235
|
+
cause_of_error: ShopifyCli::Context.message("script.error.web_assembly_binary_not_found"),
|
|
236
|
+
help_suggestion: ShopifyCli::Context.message("script.error.web_assembly_binary_not_found_suggestion"),
|
|
152
237
|
}
|
|
153
238
|
end
|
|
154
239
|
end
|