shopify-cli 1.6.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +15 -2
- data/CHANGELOG.md +21 -0
- data/Gemfile +12 -12
- data/Gemfile.lock +14 -14
- data/Rakefile +32 -30
- data/bin/load_shopify.rb +6 -6
- data/bin/shopify +2 -2
- data/dev.yml +3 -0
- data/ext/shopify-cli/extconf.rb +7 -7
- data/lib/docgen/markdown.rb +12 -12
- data/lib/graphql/extension_create.graphql +17 -2
- 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 +56 -55
- 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 +14 -7
- data/lib/project_types/extension/commands/push.rb +10 -10
- data/lib/project_types/extension/commands/register.rb +22 -32
- data/lib/project_types/extension/commands/serve.rb +1 -7
- data/lib/project_types/extension/commands/tunnel.rb +12 -12
- data/lib/project_types/extension/extension_project.rb +22 -7
- data/lib/project_types/extension/extension_project_keys.rb +5 -4
- data/lib/project_types/extension/features/argo.rb +26 -42
- 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_renderer_package.rb +47 -0
- data/lib/project_types/extension/features/argo_serve.rb +69 -0
- data/lib/project_types/extension/features/argo_setup.rb +3 -3
- 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/message_loading.rb +3 -1
- data/lib/project_types/extension/messages/messages.rb +55 -55
- data/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
- data/lib/project_types/extension/models/registration.rb +1 -0
- data/lib/project_types/extension/models/specification.rb +6 -2
- data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
- data/lib/project_types/extension/models/specification_handlers/default.rb +10 -2
- data/lib/project_types/extension/models/specifications.rb +14 -3
- data/lib/project_types/extension/models/version.rb +1 -1
- data/lib/project_types/extension/tasks/configure_features.rb +7 -5
- data/lib/project_types/extension/tasks/converters/app_converter.rb +6 -6
- data/lib/project_types/extension/tasks/converters/registration_converter.rb +8 -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 +8 -28
- 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 -19
- data/lib/project_types/node/commands/connect.rb +3 -3
- data/lib/project_types/node/commands/create.rb +40 -38
- 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 +2 -24
- 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 +8 -7
- data/lib/project_types/rails/cli.rb +21 -21
- data/lib/project_types/rails/commands/connect.rb +3 -3
- data/lib/project_types/rails/commands/create.rb +51 -48
- 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 +34 -24
- data/lib/project_types/rails/gem.rb +23 -23
- data/lib/project_types/rails/messages/messages.rb +9 -8
- data/lib/project_types/rails/ruby.rb +2 -2
- data/lib/project_types/script/cli.rb +36 -40
- data/lib/project_types/script/commands/create.rb +9 -13
- data/lib/project_types/script/commands/push.rb +6 -5
- data/lib/project_types/script/config/extension_points.yml +25 -10
- data/lib/project_types/script/errors.rb +1 -19
- data/lib/project_types/script/forms/create.rb +7 -18
- data/lib/project_types/script/graphql/app_script_update_or_create.graphql +7 -5
- data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
- data/lib/project_types/script/layers/application/build_script.rb +6 -8
- data/lib/project_types/script/layers/application/create_script.rb +34 -24
- data/lib/project_types/script/layers/application/extension_points.rb +3 -2
- data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
- data/lib/project_types/script/layers/application/push_script.rb +10 -15
- data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
- data/lib/project_types/script/layers/domain/errors.rb +16 -0
- data/lib/project_types/script/layers/domain/extension_point.rb +60 -45
- data/lib/project_types/script/layers/domain/metadata.rb +18 -25
- data/lib/project_types/script/layers/domain/push_package.rb +9 -5
- data/lib/project_types/script/layers/domain/script_project.rb +38 -0
- data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +39 -10
- data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +9 -44
- data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
- data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +16 -21
- data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +4 -4
- data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +2 -2
- data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +179 -0
- data/lib/project_types/script/layers/infrastructure/script_service.rb +35 -78
- data/lib/project_types/script/messages/messages.rb +33 -57
- data/lib/project_types/script/ui/error_handler.rb +116 -88
- 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 +19 -19
- data/lib/project_types/theme/commands/connect.rb +12 -12
- data/lib/project_types/theme/commands/create.rb +11 -11
- data/lib/project_types/theme/commands/deploy.rb +8 -8
- data/lib/project_types/theme/commands/generate.rb +3 -3
- data/lib/project_types/theme/commands/generate/env.rb +15 -15
- data/lib/project_types/theme/commands/push.rb +15 -15
- data/lib/project_types/theme/commands/serve.rb +5 -5
- data/lib/project_types/theme/forms/connect.rb +4 -4
- data/lib/project_types/theme/forms/create.rb +5 -5
- data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +22 -22
- data/lib/project_types/theme/themekit.rb +15 -15
- data/lib/rubygems_plugin.rb +3 -3
- data/lib/shopify-cli/admin_api.rb +11 -11
- 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 +10 -10
- data/lib/shopify-cli/command.rb +1 -1
- data/lib/shopify-cli/commands.rb +9 -9
- data/lib/shopify-cli/commands/config.rb +28 -52
- data/lib/shopify-cli/commands/connect.rb +10 -10
- 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 +32 -32
- data/lib/shopify-cli/commands/version.rb +2 -2
- data/lib/shopify-cli/context.rb +51 -23
- 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 +16 -16
- data/lib/shopify-cli/db.rb +2 -2
- data/lib/shopify-cli/feature.rb +1 -1
- 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 +2 -2
- data/lib/shopify-cli/js_deps.rb +12 -12
- data/lib/shopify-cli/js_system.rb +7 -7
- data/lib/shopify-cli/lazy_delegator.rb +55 -0
- data/lib/shopify-cli/messages/messages.rb +7 -16
- data/lib/shopify-cli/method_object.rb +1 -1
- data/lib/shopify-cli/oauth.rb +27 -27
- data/lib/shopify-cli/oauth/servlet.rb +9 -9
- data/lib/shopify-cli/options.rb +3 -3
- data/lib/shopify-cli/packager.rb +25 -25
- data/lib/shopify-cli/partners_api.rb +16 -16
- data/lib/shopify-cli/partners_api/organizations.rb +10 -10
- data/lib/shopify-cli/process_supervision.rb +7 -7
- data/lib/shopify-cli/project.rb +16 -16
- data/lib/shopify-cli/project_type.rb +3 -3
- data/lib/shopify-cli/resolve_constant.rb +1 -1
- data/lib/shopify-cli/resources.rb +1 -1
- data/lib/shopify-cli/resources/env_file.rb +10 -10
- data/lib/shopify-cli/result.rb +11 -11
- data/lib/shopify-cli/shopifolk.rb +6 -9
- data/lib/shopify-cli/sub_command.rb +1 -1
- data/lib/shopify-cli/task.rb +3 -3
- data/lib/shopify-cli/tasks.rb +7 -7
- data/lib/shopify-cli/tasks/create_api_client.rb +5 -5
- data/lib/shopify-cli/tasks/ensure_dev_store.rb +12 -12
- data/lib/shopify-cli/tasks/ensure_env.rb +15 -15
- data/lib/shopify-cli/tasks/ensure_loopback_url.rb +4 -4
- data/lib/shopify-cli/tasks/select_org_and_shop.rb +19 -19
- 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 +30 -30
- data/lib/shopify-cli/version.rb +1 -1
- data/lib/shopify_cli.rb +56 -54
- data/shopify-cli.gemspec +6 -6
- data/vendor/deps/smart_properties/REVISION +1 -1
- data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
- data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
- data/vendor/gen/template/bin/update-deps +9 -9
- metadata +15 -11
- data/lib/project_types/extension/forms/register.rb +0 -47
- data/lib/project_types/script/commands/disable.rb +0 -25
- data/lib/project_types/script/commands/enable.rb +0 -78
- data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
- data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
- data/lib/project_types/script/layers/application/disable_script.rb +0 -21
- data/lib/project_types/script/layers/application/enable_script.rb +0 -23
- data/lib/project_types/script/script_project.rb +0 -63
@@ -19,11 +19,11 @@ module Extension
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def name
|
22
|
-
message(
|
22
|
+
message("name") || specification.name
|
23
23
|
end
|
24
24
|
|
25
25
|
def tagline
|
26
|
-
message(
|
26
|
+
message("tagline") || ""
|
27
27
|
end
|
28
28
|
|
29
29
|
def config(context)
|
@@ -42,6 +42,14 @@ module Extension
|
|
42
42
|
[]
|
43
43
|
end
|
44
44
|
|
45
|
+
def serve(context)
|
46
|
+
Features::ArgoServe.new(specification_handler: self, context: context).call
|
47
|
+
end
|
48
|
+
|
49
|
+
def renderer_package(context)
|
50
|
+
argo.renderer_package(context)
|
51
|
+
end
|
52
|
+
|
45
53
|
protected
|
46
54
|
|
47
55
|
def argo
|
@@ -5,7 +5,7 @@ module Extension
|
|
5
5
|
|
6
6
|
property! :custom_handler_root,
|
7
7
|
accepts: ->(d) { File.directory?(d) },
|
8
|
-
default: -> { File.expand_path(
|
8
|
+
default: -> { File.expand_path("lib/project_types/extension/models/specification_handlers", ShopifyCli::ROOT) }
|
9
9
|
|
10
10
|
property! :custom_handler_namespace,
|
11
11
|
accepts: ->(m) { m.respond_to?(:const_get) },
|
@@ -26,6 +26,10 @@ module Extension
|
|
26
26
|
handlers.values.each(&block)
|
27
27
|
end
|
28
28
|
|
29
|
+
def none?
|
30
|
+
each.none?
|
31
|
+
end
|
32
|
+
|
29
33
|
protected
|
30
34
|
|
31
35
|
def handlers
|
@@ -37,6 +41,8 @@ module Extension
|
|
37
41
|
def fetch_specifications_and_build_handlers
|
38
42
|
ShopifyCli::Result
|
39
43
|
.call(&fetch_specifications)
|
44
|
+
.map(&ShopifyCli::TransformDataStructure.new(symbolize_keys: true, underscore_keys: true))
|
45
|
+
.then(&method(:select_cli_extensions))
|
40
46
|
.then(&Tasks::ConfigureFeatures)
|
41
47
|
.then(&method(:ensure_legacy_compatibility))
|
42
48
|
.then(&method(:build_specifications))
|
@@ -64,14 +70,19 @@ module Extension
|
|
64
70
|
|
65
71
|
def ensure_legacy_compatibility(specification_attribute_sets)
|
66
72
|
specification_attribute_sets.each do |attributes|
|
67
|
-
next unless attributes.fetch(:identifier) ==
|
68
|
-
attributes[:
|
73
|
+
next unless attributes.fetch(:identifier) == "subscription_management"
|
74
|
+
attributes[:identifier] = "product_subscription"
|
75
|
+
attributes[:graphql_identifier] = "SUBSCRIPTION_MANAGEMENT"
|
69
76
|
end
|
70
77
|
end
|
71
78
|
|
72
79
|
def build_specifications(specification_attribute_sets)
|
73
80
|
specification_attribute_sets.map { |attributes| Models::Specification.new(**attributes) }
|
74
81
|
end
|
82
|
+
|
83
|
+
def select_cli_extensions(specification_attribute_sets)
|
84
|
+
specification_attribute_sets.select { |attributes| attributes.dig(:options, :management_experience) == "cli" }
|
85
|
+
end
|
75
86
|
end
|
76
87
|
end
|
77
88
|
end
|
@@ -9,7 +9,7 @@ module Extension
|
|
9
9
|
property! :last_user_interaction_at, accepts: Time
|
10
10
|
property :context, accepts: String
|
11
11
|
property :location, accepts: String
|
12
|
-
property :validation_errors, accepts: Models::ValidationError::IS_VALIDATION_ERROR_LIST, default: []
|
12
|
+
property :validation_errors, accepts: Models::ValidationError::IS_VALIDATION_ERROR_LIST, default: -> { [] }
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -24,7 +24,7 @@ module Extension
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def extract_surface_area(argo_configuration)
|
27
|
-
argo_configuration.fetch(:
|
27
|
+
argo_configuration.fetch(:surface) do
|
28
28
|
raise UnspecifiedSurfaceArea, "Argo configuration does not specify surface area"
|
29
29
|
end
|
30
30
|
end
|
@@ -38,12 +38,14 @@ module Extension
|
|
38
38
|
def surface_area_configurations
|
39
39
|
{
|
40
40
|
admin: {
|
41
|
-
git_template:
|
42
|
-
renderer_package_name:
|
41
|
+
git_template: "https://github.com/Shopify/argo-admin-template.git",
|
42
|
+
renderer_package_name: "@shopify/argo-admin",
|
43
|
+
required_fields: [:shop, :api_key],
|
44
|
+
required_shop_beta_flags: [:argo_admin_beta],
|
43
45
|
},
|
44
46
|
checkout: {
|
45
|
-
git_template:
|
46
|
-
renderer_package_name:
|
47
|
+
git_template: "https://github.com/Shopify/argo-checkout-template.git",
|
48
|
+
renderer_package_name: "@shopify/argo-checkout",
|
47
49
|
},
|
48
50
|
}
|
49
51
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
module Converters
|
7
7
|
module AppConverter
|
8
|
-
API_KEY_FIELD =
|
9
|
-
API_SECRET_KEYS_FIELD =
|
10
|
-
API_SECRET_FIELD =
|
11
|
-
TITLE_FIELD =
|
12
|
-
ORGANIZATION_NAME_FIELD =
|
8
|
+
API_KEY_FIELD = "apiKey"
|
9
|
+
API_SECRET_KEYS_FIELD = "apiSecretKeys"
|
10
|
+
API_SECRET_FIELD = "secret"
|
11
|
+
TITLE_FIELD = "title"
|
12
|
+
ORGANIZATION_NAME_FIELD = "businessName"
|
13
13
|
|
14
14
|
def self.from_hash(hash, organization = {})
|
15
15
|
return nil if hash.nil?
|
@@ -1,20 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
module Converters
|
7
7
|
module RegistrationConverter
|
8
|
-
ID_FIELD =
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
ID_FIELD = "id"
|
9
|
+
UUID_FIELD = "uuid"
|
10
|
+
TYPE_FIELD = "type"
|
11
|
+
TITLE_FIELD = "title"
|
12
|
+
DRAFT_VERSION_FIELD = "draftVersion"
|
12
13
|
|
13
14
|
def self.from_hash(context, hash)
|
14
|
-
context.abort(context.message(
|
15
|
+
context.abort(context.message("tasks.errors.parse_error")) if hash.nil?
|
15
16
|
|
16
17
|
Models::Registration.new(
|
17
18
|
id: hash[ID_FIELD].to_i,
|
19
|
+
uuid: hash[UUID_FIELD],
|
18
20
|
type: hash[TYPE_FIELD],
|
19
21
|
title: hash[TITLE_FIELD],
|
20
22
|
draft_version: VersionConverter.from_hash(context, hash[DRAFT_VERSION_FIELD])
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
module Converters
|
7
7
|
module ValidationErrorConverter
|
8
|
-
FIELD_FIELD =
|
9
|
-
MESSAGE_FIELD =
|
8
|
+
FIELD_FIELD = "field"
|
9
|
+
MESSAGE_FIELD = "message"
|
10
10
|
|
11
11
|
def self.from_array(context, errors)
|
12
12
|
return [] if errors.nil?
|
13
|
-
context.abort(context.message(
|
13
|
+
context.abort(context.message("tasks.errors.parse_error")) unless errors.is_a?(Array)
|
14
14
|
|
15
15
|
errors.map do |error|
|
16
16
|
Models::ValidationError.new(
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
module Converters
|
7
7
|
module VersionConverter
|
8
|
-
REGISTRATION_ID_FIELD =
|
9
|
-
CONTEXT_FIELD =
|
10
|
-
LAST_USER_INTERACTION_AT_FIELD =
|
11
|
-
LOCATION_FIELD =
|
12
|
-
VALIDATION_ERRORS_FIELD =
|
8
|
+
REGISTRATION_ID_FIELD = "registrationId"
|
9
|
+
CONTEXT_FIELD = "context"
|
10
|
+
LAST_USER_INTERACTION_AT_FIELD = "lastUserInteractionAt"
|
11
|
+
LOCATION_FIELD = "location"
|
12
|
+
VALIDATION_ERRORS_FIELD = "validationErrors"
|
13
13
|
|
14
14
|
def self.from_hash(context, hash)
|
15
|
-
context.abort(context.message(
|
15
|
+
context.abort(context.message("tasks.errors.parse_error")) if hash.nil?
|
16
16
|
|
17
17
|
Models::Version.new(
|
18
18
|
registration_id: hash[REGISTRATION_ID_FIELD].to_i,
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
class CreateExtension < ShopifyCli::Task
|
7
7
|
include UserErrors
|
8
8
|
|
9
|
-
GRAPHQL_FILE =
|
9
|
+
GRAPHQL_FILE = "extension_create"
|
10
10
|
|
11
11
|
RESPONSE_FIELD = %w(data extensionCreate)
|
12
|
-
REGISTRATION_FIELD =
|
12
|
+
REGISTRATION_FIELD = "extensionRegistration"
|
13
13
|
|
14
14
|
def call(context:, api_key:, type:, title:, config:, extension_context: nil)
|
15
15
|
input = {
|
@@ -21,7 +21,7 @@ module Extension
|
|
21
21
|
}
|
22
22
|
|
23
23
|
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, **input).dig(*RESPONSE_FIELD)
|
24
|
-
context.abort(context.message(
|
24
|
+
context.abort(context.message("tasks.errors.parse_error")) if response.nil?
|
25
25
|
|
26
26
|
abort_if_user_errors(context, response)
|
27
27
|
Converters::RegistrationConverter.from_hash(context, response.dig(REGISTRATION_FIELD))
|
@@ -3,35 +3,15 @@ module Extension
|
|
3
3
|
class FetchSpecifications
|
4
4
|
include ShopifyCli::MethodObject
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
product_subscription_specification,
|
9
|
-
checkout_post_purchase_specification,
|
10
|
-
]
|
11
|
-
end
|
12
|
-
|
13
|
-
private
|
6
|
+
property :context
|
7
|
+
property :api_key
|
14
8
|
|
15
|
-
def
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
},
|
22
|
-
},
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def checkout_post_purchase_specification
|
27
|
-
{
|
28
|
-
identifier: 'checkout_post_purchase',
|
29
|
-
features: {
|
30
|
-
argo: {
|
31
|
-
surface_area: 'checkout',
|
32
|
-
},
|
33
|
-
},
|
34
|
-
}
|
9
|
+
def call
|
10
|
+
response = ShopifyCli::PartnersAPI
|
11
|
+
.query(context, "fetch_specifications", api_key: api_key)
|
12
|
+
.dig("data", "extensionSpecifications")
|
13
|
+
context.abort(context.message("tasks.errors.parse_error")) if response.nil?
|
14
|
+
response
|
35
15
|
end
|
36
16
|
end
|
37
17
|
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
class GetApp < ShopifyCli::Task
|
7
|
-
GRAPHQL_FILE =
|
7
|
+
GRAPHQL_FILE = "get_app_by_api_key"
|
8
8
|
|
9
9
|
RESPONSE_FIELD = %w(data)
|
10
|
-
APP_FIELD =
|
10
|
+
APP_FIELD = "app"
|
11
11
|
|
12
12
|
def call(context:, api_key:)
|
13
13
|
input = { api_key: api_key }
|
14
14
|
|
15
15
|
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, **input).dig(*RESPONSE_FIELD)
|
16
|
-
context.abort(context.message(
|
16
|
+
context.abort(context.message("tasks.errors.parse_error")) if response.nil?
|
17
17
|
|
18
18
|
Converters::AppConverter.from_hash(response.dig(APP_FIELD))
|
19
19
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
@@ -18,9 +18,9 @@ module Extension
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def apps_owned_by_organization(organization)
|
21
|
-
return [] unless organization.key?(
|
21
|
+
return [] unless organization.key?("apps") && organization["apps"].any?
|
22
22
|
|
23
|
-
organization[
|
23
|
+
organization["apps"].map do |app|
|
24
24
|
Converters::AppConverter.from_hash(app, organization)
|
25
25
|
end
|
26
26
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
class UpdateDraft < ShopifyCli::Task
|
7
7
|
include UserErrors
|
8
8
|
|
9
|
-
GRAPHQL_FILE =
|
9
|
+
GRAPHQL_FILE = "extension_update_draft"
|
10
10
|
|
11
11
|
RESPONSE_FIELD = %w(data extensionUpdateDraft)
|
12
|
-
VERSION_FIELD =
|
12
|
+
VERSION_FIELD = "extensionVersion"
|
13
13
|
|
14
14
|
def call(context:, api_key:, registration_id:, config:, extension_context:)
|
15
15
|
input = {
|
@@ -19,7 +19,7 @@ module Extension
|
|
19
19
|
extension_context: extension_context,
|
20
20
|
}
|
21
21
|
response = ShopifyCli::PartnersAPI.query(context, GRAPHQL_FILE, **input).dig(*RESPONSE_FIELD)
|
22
|
-
context.abort(context.message(
|
22
|
+
context.abort(context.message("tasks.errors.parse_error")) if response.nil?
|
23
23
|
|
24
24
|
abort_if_user_errors(context, response)
|
25
25
|
Converters::VersionConverter.from_hash(context, response.dig(VERSION_FIELD))
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require
|
2
|
+
require "shopify_cli"
|
3
3
|
|
4
4
|
module Extension
|
5
5
|
module Tasks
|
6
6
|
module UserErrors
|
7
|
-
USER_ERRORS_FIELD =
|
8
|
-
MESSAGE_FIELD =
|
9
|
-
USER_ERRORS_PARSE_ERROR =
|
7
|
+
USER_ERRORS_FIELD = "userErrors"
|
8
|
+
MESSAGE_FIELD = "message"
|
9
|
+
USER_ERRORS_PARSE_ERROR = "Unable to parse errors from server."
|
10
10
|
|
11
11
|
def abort_if_user_errors(context, response)
|
12
12
|
return if response.nil?
|
@@ -1,32 +1,32 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Node
|
3
3
|
class Project < ShopifyCli::ProjectType
|
4
|
-
title(
|
5
|
-
creator(
|
6
|
-
connector(
|
4
|
+
title("Node.js App")
|
5
|
+
creator("Node::Commands::Create")
|
6
|
+
connector("Node::Commands::Connect")
|
7
7
|
|
8
|
-
register_command(
|
9
|
-
register_command(
|
10
|
-
register_command(
|
11
|
-
register_command(
|
12
|
-
register_command(
|
13
|
-
register_command(
|
8
|
+
register_command("Node::Commands::Deploy", "deploy")
|
9
|
+
register_command("Node::Commands::Generate", "generate")
|
10
|
+
register_command("Node::Commands::Open", "open")
|
11
|
+
register_command("Node::Commands::Populate", "populate")
|
12
|
+
register_command("Node::Commands::Serve", "serve")
|
13
|
+
register_command("Node::Commands::Tunnel", "tunnel")
|
14
14
|
# register_task('Node::Tasks::NodeTask', 'node_task')
|
15
15
|
|
16
|
-
require Project.project_filepath(
|
16
|
+
require Project.project_filepath("messages/messages")
|
17
17
|
register_messages(Node::Messages::MESSAGES)
|
18
18
|
end
|
19
19
|
|
20
20
|
# define/autoload project specific Commands
|
21
21
|
module Commands
|
22
|
-
autoload :Connect, Project.project_filepath(
|
23
|
-
autoload :Create, Project.project_filepath(
|
24
|
-
autoload :Deploy, Project.project_filepath(
|
25
|
-
autoload :Generate, Project.project_filepath(
|
26
|
-
autoload :Open, Project.project_filepath(
|
27
|
-
autoload :Populate, Project.project_filepath(
|
28
|
-
autoload :Serve, Project.project_filepath(
|
29
|
-
autoload :Tunnel, Project.project_filepath(
|
22
|
+
autoload :Connect, Project.project_filepath("commands/connect")
|
23
|
+
autoload :Create, Project.project_filepath("commands/create")
|
24
|
+
autoload :Deploy, Project.project_filepath("commands/deploy")
|
25
|
+
autoload :Generate, Project.project_filepath("commands/generate")
|
26
|
+
autoload :Open, Project.project_filepath("commands/open")
|
27
|
+
autoload :Populate, Project.project_filepath("commands/populate")
|
28
|
+
autoload :Serve, Project.project_filepath("commands/serve")
|
29
|
+
autoload :Tunnel, Project.project_filepath("commands/tunnel")
|
30
30
|
end
|
31
31
|
|
32
32
|
# define/autoload project specific Tasks
|
@@ -35,6 +35,6 @@ module Node
|
|
35
35
|
|
36
36
|
# define/autoload project specific Forms
|
37
37
|
module Forms
|
38
|
-
autoload :Create, Project.project_filepath(
|
38
|
+
autoload :Create, Project.project_filepath("forms/create")
|
39
39
|
end
|
40
40
|
end
|