shopify-cli 1.6.0 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +15 -2
  3. data/CHANGELOG.md +21 -0
  4. data/Gemfile +12 -12
  5. data/Gemfile.lock +14 -14
  6. data/Rakefile +32 -30
  7. data/bin/load_shopify.rb +6 -6
  8. data/bin/shopify +2 -2
  9. data/dev.yml +3 -0
  10. data/ext/shopify-cli/extconf.rb +7 -7
  11. data/lib/docgen/markdown.rb +12 -12
  12. data/lib/graphql/extension_create.graphql +17 -2
  13. data/lib/graphql/fetch_specifications.graphql +14 -0
  14. data/lib/{project_types/extension/graphql → graphql}/get_app_by_api_key.graphql +0 -0
  15. data/lib/project_types/extension/cli.rb +56 -55
  16. data/lib/project_types/extension/commands/build.rb +3 -3
  17. data/lib/project_types/extension/commands/create.rb +17 -10
  18. data/lib/project_types/extension/commands/extension_command.rb +14 -7
  19. data/lib/project_types/extension/commands/push.rb +10 -10
  20. data/lib/project_types/extension/commands/register.rb +22 -32
  21. data/lib/project_types/extension/commands/serve.rb +1 -7
  22. data/lib/project_types/extension/commands/tunnel.rb +12 -12
  23. data/lib/project_types/extension/extension_project.rb +22 -7
  24. data/lib/project_types/extension/extension_project_keys.rb +5 -4
  25. data/lib/project_types/extension/features/argo.rb +26 -42
  26. data/lib/project_types/extension/features/argo_config.rb +5 -5
  27. data/lib/project_types/extension/features/argo_dependencies.rb +5 -5
  28. data/lib/project_types/extension/features/argo_renderer_package.rb +47 -0
  29. data/lib/project_types/extension/features/argo_serve.rb +69 -0
  30. data/lib/project_types/extension/features/argo_setup.rb +3 -3
  31. data/lib/project_types/extension/features/argo_setup_steps.rb +4 -4
  32. data/lib/project_types/extension/forms/create.rb +28 -34
  33. data/lib/project_types/extension/forms/questions/ask_app.rb +53 -0
  34. data/lib/project_types/extension/forms/questions/ask_name.rb +40 -0
  35. data/lib/project_types/extension/forms/questions/ask_type.rb +47 -0
  36. data/lib/project_types/extension/messages/message_loading.rb +3 -1
  37. data/lib/project_types/extension/messages/messages.rb +55 -55
  38. data/lib/project_types/extension/models/lazy_specification_handler.rb +12 -0
  39. data/lib/project_types/extension/models/registration.rb +1 -0
  40. data/lib/project_types/extension/models/specification.rb +6 -2
  41. data/lib/project_types/extension/models/specification_handlers/checkout_post_purchase.rb +1 -1
  42. data/lib/project_types/extension/models/specification_handlers/default.rb +10 -2
  43. data/lib/project_types/extension/models/specifications.rb +14 -3
  44. data/lib/project_types/extension/models/version.rb +1 -1
  45. data/lib/project_types/extension/tasks/configure_features.rb +7 -5
  46. data/lib/project_types/extension/tasks/converters/app_converter.rb +6 -6
  47. data/lib/project_types/extension/tasks/converters/registration_converter.rb +8 -6
  48. data/lib/project_types/extension/tasks/converters/validation_error_converter.rb +4 -4
  49. data/lib/project_types/extension/tasks/converters/version_converter.rb +7 -7
  50. data/lib/project_types/extension/tasks/create_extension.rb +4 -4
  51. data/lib/project_types/extension/tasks/fetch_specifications.rb +8 -28
  52. data/lib/project_types/extension/tasks/get_app.rb +4 -4
  53. data/lib/project_types/extension/tasks/get_apps.rb +3 -3
  54. data/lib/project_types/extension/tasks/update_draft.rb +4 -4
  55. data/lib/project_types/extension/tasks/user_errors.rb +4 -4
  56. data/lib/project_types/node/cli.rb +19 -19
  57. data/lib/project_types/node/commands/connect.rb +3 -3
  58. data/lib/project_types/node/commands/create.rb +40 -38
  59. data/lib/project_types/node/commands/deploy.rb +4 -4
  60. data/lib/project_types/node/commands/deploy/heroku.rb +24 -24
  61. data/lib/project_types/node/commands/generate.rb +2 -24
  62. data/lib/project_types/node/commands/open.rb +2 -2
  63. data/lib/project_types/node/commands/populate.rb +6 -6
  64. data/lib/project_types/node/commands/populate/customer.rb +5 -5
  65. data/lib/project_types/node/commands/populate/draft_order.rb +5 -5
  66. data/lib/project_types/node/commands/populate/product.rb +5 -5
  67. data/lib/project_types/node/commands/serve.rb +9 -9
  68. data/lib/project_types/node/commands/tunnel.rb +7 -7
  69. data/lib/project_types/node/forms/create.rb +17 -8
  70. data/lib/project_types/node/messages/messages.rb +8 -7
  71. data/lib/project_types/rails/cli.rb +21 -21
  72. data/lib/project_types/rails/commands/connect.rb +3 -3
  73. data/lib/project_types/rails/commands/create.rb +51 -48
  74. data/lib/project_types/rails/commands/deploy.rb +4 -4
  75. data/lib/project_types/rails/commands/deploy/heroku.rb +30 -30
  76. data/lib/project_types/rails/commands/generate.rb +7 -7
  77. data/lib/project_types/rails/commands/generate/webhook.rb +6 -6
  78. data/lib/project_types/rails/commands/open.rb +2 -2
  79. data/lib/project_types/rails/commands/populate.rb +6 -6
  80. data/lib/project_types/rails/commands/populate/customer.rb +5 -5
  81. data/lib/project_types/rails/commands/populate/draft_order.rb +5 -5
  82. data/lib/project_types/rails/commands/populate/product.rb +5 -5
  83. data/lib/project_types/rails/commands/serve.rb +11 -11
  84. data/lib/project_types/rails/commands/tunnel.rb +7 -7
  85. data/lib/project_types/rails/forms/create.rb +34 -24
  86. data/lib/project_types/rails/gem.rb +23 -23
  87. data/lib/project_types/rails/messages/messages.rb +9 -8
  88. data/lib/project_types/rails/ruby.rb +2 -2
  89. data/lib/project_types/script/cli.rb +36 -40
  90. data/lib/project_types/script/commands/create.rb +9 -13
  91. data/lib/project_types/script/commands/push.rb +6 -5
  92. data/lib/project_types/script/config/extension_points.yml +25 -10
  93. data/lib/project_types/script/errors.rb +1 -19
  94. data/lib/project_types/script/forms/create.rb +7 -18
  95. data/lib/project_types/script/graphql/app_script_update_or_create.graphql +7 -5
  96. data/lib/project_types/script/graphql/script_service_proxy.graphql +1 -2
  97. data/lib/project_types/script/layers/application/build_script.rb +6 -8
  98. data/lib/project_types/script/layers/application/create_script.rb +34 -24
  99. data/lib/project_types/script/layers/application/extension_points.rb +3 -2
  100. data/lib/project_types/script/layers/application/project_dependencies.rb +4 -4
  101. data/lib/project_types/script/layers/application/push_script.rb +10 -15
  102. data/lib/project_types/script/layers/domain/config_ui.rb +16 -0
  103. data/lib/project_types/script/layers/domain/errors.rb +16 -0
  104. data/lib/project_types/script/layers/domain/extension_point.rb +60 -45
  105. data/lib/project_types/script/layers/domain/metadata.rb +18 -25
  106. data/lib/project_types/script/layers/domain/push_package.rb +9 -5
  107. data/lib/project_types/script/layers/domain/script_project.rb +38 -0
  108. data/lib/project_types/script/layers/infrastructure/assemblyscript_project_creator.rb +39 -10
  109. data/lib/project_types/script/layers/infrastructure/assemblyscript_task_runner.rb +9 -44
  110. data/lib/project_types/script/layers/infrastructure/errors.rb +50 -19
  111. data/lib/project_types/script/layers/infrastructure/extension_point_repository.rb +2 -2
  112. data/lib/project_types/script/layers/infrastructure/push_package_repository.rb +16 -21
  113. data/lib/project_types/script/layers/infrastructure/rust_project_creator.rb +4 -4
  114. data/lib/project_types/script/layers/infrastructure/rust_task_runner.rb +2 -2
  115. data/lib/project_types/script/layers/infrastructure/script_project_repository.rb +179 -0
  116. data/lib/project_types/script/layers/infrastructure/script_service.rb +35 -78
  117. data/lib/project_types/script/messages/messages.rb +33 -57
  118. data/lib/project_types/script/ui/error_handler.rb +116 -88
  119. data/lib/project_types/script/ui/printing_spinner.rb +1 -1
  120. data/lib/project_types/script/ui/strict_spinner.rb +1 -1
  121. data/lib/project_types/theme/cli.rb +19 -19
  122. data/lib/project_types/theme/commands/connect.rb +12 -12
  123. data/lib/project_types/theme/commands/create.rb +11 -11
  124. data/lib/project_types/theme/commands/deploy.rb +8 -8
  125. data/lib/project_types/theme/commands/generate.rb +3 -3
  126. data/lib/project_types/theme/commands/generate/env.rb +15 -15
  127. data/lib/project_types/theme/commands/push.rb +15 -15
  128. data/lib/project_types/theme/commands/serve.rb +5 -5
  129. data/lib/project_types/theme/forms/connect.rb +4 -4
  130. data/lib/project_types/theme/forms/create.rb +5 -5
  131. data/lib/project_types/theme/tasks/ensure_themekit_installed.rb +22 -22
  132. data/lib/project_types/theme/themekit.rb +15 -15
  133. data/lib/rubygems_plugin.rb +3 -3
  134. data/lib/shopify-cli/admin_api.rb +11 -11
  135. data/lib/shopify-cli/admin_api/populate_resource_command.rb +17 -17
  136. data/lib/shopify-cli/admin_api/schema.rb +3 -3
  137. data/lib/shopify-cli/api.rb +10 -10
  138. data/lib/shopify-cli/command.rb +1 -1
  139. data/lib/shopify-cli/commands.rb +9 -9
  140. data/lib/shopify-cli/commands/config.rb +28 -52
  141. data/lib/shopify-cli/commands/connect.rb +10 -10
  142. data/lib/shopify-cli/commands/create.rb +5 -5
  143. data/lib/shopify-cli/commands/help.rb +6 -6
  144. data/lib/shopify-cli/commands/logout.rb +3 -3
  145. data/lib/shopify-cli/commands/system.rb +32 -32
  146. data/lib/shopify-cli/commands/version.rb +2 -2
  147. data/lib/shopify-cli/context.rb +51 -23
  148. data/lib/shopify-cli/core.rb +4 -4
  149. data/lib/shopify-cli/core/entry_point.rb +5 -5
  150. data/lib/shopify-cli/core/executor.rb +1 -1
  151. data/lib/shopify-cli/core/help_resolver.rb +2 -2
  152. data/lib/shopify-cli/core/monorail.rb +16 -16
  153. data/lib/shopify-cli/db.rb +2 -2
  154. data/lib/shopify-cli/feature.rb +1 -1
  155. data/lib/shopify-cli/form.rb +1 -1
  156. data/lib/shopify-cli/git.rb +17 -17
  157. data/lib/shopify-cli/helpers.rb +1 -1
  158. data/lib/shopify-cli/helpers/haikunator.rb +1 -1
  159. data/lib/shopify-cli/heroku.rb +28 -28
  160. data/lib/shopify-cli/http_request.rb +2 -2
  161. data/lib/shopify-cli/js_deps.rb +12 -12
  162. data/lib/shopify-cli/js_system.rb +7 -7
  163. data/lib/shopify-cli/lazy_delegator.rb +55 -0
  164. data/lib/shopify-cli/messages/messages.rb +7 -16
  165. data/lib/shopify-cli/method_object.rb +1 -1
  166. data/lib/shopify-cli/oauth.rb +27 -27
  167. data/lib/shopify-cli/oauth/servlet.rb +9 -9
  168. data/lib/shopify-cli/options.rb +3 -3
  169. data/lib/shopify-cli/packager.rb +25 -25
  170. data/lib/shopify-cli/partners_api.rb +16 -16
  171. data/lib/shopify-cli/partners_api/organizations.rb +10 -10
  172. data/lib/shopify-cli/process_supervision.rb +7 -7
  173. data/lib/shopify-cli/project.rb +16 -16
  174. data/lib/shopify-cli/project_type.rb +3 -3
  175. data/lib/shopify-cli/resolve_constant.rb +1 -1
  176. data/lib/shopify-cli/resources.rb +1 -1
  177. data/lib/shopify-cli/resources/env_file.rb +10 -10
  178. data/lib/shopify-cli/result.rb +11 -11
  179. data/lib/shopify-cli/shopifolk.rb +6 -9
  180. data/lib/shopify-cli/sub_command.rb +1 -1
  181. data/lib/shopify-cli/task.rb +3 -3
  182. data/lib/shopify-cli/tasks.rb +7 -7
  183. data/lib/shopify-cli/tasks/create_api_client.rb +5 -5
  184. data/lib/shopify-cli/tasks/ensure_dev_store.rb +12 -12
  185. data/lib/shopify-cli/tasks/ensure_env.rb +15 -15
  186. data/lib/shopify-cli/tasks/ensure_loopback_url.rb +4 -4
  187. data/lib/shopify-cli/tasks/select_org_and_shop.rb +19 -19
  188. data/lib/shopify-cli/tasks/update_dashboard_urls.rb +10 -10
  189. data/lib/shopify-cli/transform_data_structure.rb +86 -0
  190. data/lib/shopify-cli/tunnel.rb +30 -30
  191. data/lib/shopify-cli/version.rb +1 -1
  192. data/lib/shopify_cli.rb +56 -54
  193. data/shopify-cli.gemspec +6 -6
  194. data/vendor/deps/smart_properties/REVISION +1 -1
  195. data/vendor/deps/smart_properties/lib/smart_properties/property.rb +7 -1
  196. data/vendor/deps/smart_properties/lib/smart_properties/version.rb +1 -1
  197. data/vendor/gen/template/bin/update-deps +9 -9
  198. metadata +15 -11
  199. data/lib/project_types/extension/forms/register.rb +0 -47
  200. data/lib/project_types/script/commands/disable.rb +0 -25
  201. data/lib/project_types/script/commands/enable.rb +0 -78
  202. data/lib/project_types/script/graphql/shop_script_delete.graphql +0 -14
  203. data/lib/project_types/script/graphql/shop_script_update_or_create.graphql +0 -28
  204. data/lib/project_types/script/layers/application/disable_script.rb +0 -21
  205. data/lib/project_types/script/layers/application/enable_script.rb +0 -23
  206. data/lib/project_types/script/script_project.rb +0 -63
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
- require 'base64'
2
+ require "base64"
3
3
 
4
4
  module Extension
5
5
  module Models
@@ -19,11 +19,11 @@ module Extension
19
19
  end
20
20
 
21
21
  def name
22
- message('name')
22
+ message("name") || specification.name
23
23
  end
24
24
 
25
25
  def tagline
26
- message('tagline') || ""
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('lib/project_types/extension/models/specification_handlers', ShopifyCli::ROOT) }
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) == 'product_subscription'
68
- attributes[:graphql_identifier] = 'SUBSCRIPTION_MANAGEMENT'
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(:surface_area) do
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: 'https://github.com/Shopify/argo-admin-template.git',
42
- renderer_package_name: '@shopify/argo-admin',
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: 'https://github.com/Shopify/argo-checkout-template.git',
46
- renderer_package_name: '@shopify/argo-checkout',
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 'shopify_cli'
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 = 'apiKey'
9
- API_SECRET_KEYS_FIELD = 'apiSecretKeys'
10
- API_SECRET_FIELD = 'secret'
11
- TITLE_FIELD = 'title'
12
- ORGANIZATION_NAME_FIELD = 'businessName'
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 'shopify_cli'
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 = 'id'
9
- TYPE_FIELD = 'type'
10
- TITLE_FIELD = 'title'
11
- DRAFT_VERSION_FIELD = 'draftVersion'
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('tasks.errors.parse_error')) if hash.nil?
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 'shopify_cli'
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 = 'field'
9
- MESSAGE_FIELD = 'message'
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('tasks.errors.parse_error')) unless errors.is_a?(Array)
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 'shopify_cli'
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 = 'registrationId'
9
- CONTEXT_FIELD = 'context'
10
- LAST_USER_INTERACTION_AT_FIELD = 'lastUserInteractionAt'
11
- LOCATION_FIELD = 'location'
12
- VALIDATION_ERRORS_FIELD = 'validationErrors'
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('tasks.errors.parse_error')) if hash.nil?
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 'shopify_cli'
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 = 'extension_create'
9
+ GRAPHQL_FILE = "extension_create"
10
10
 
11
11
  RESPONSE_FIELD = %w(data extensionCreate)
12
- REGISTRATION_FIELD = 'extensionRegistration'
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('tasks.errors.parse_error')) if response.nil?
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
- def call
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 product_subscription_specification
16
- {
17
- identifier: 'product_subscription',
18
- features: {
19
- argo: {
20
- surface_area: 'admin',
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 'shopify_cli'
2
+ require "shopify_cli"
3
3
 
4
4
  module Extension
5
5
  module Tasks
6
6
  class GetApp < ShopifyCli::Task
7
- GRAPHQL_FILE = 'get_app_by_api_key'
7
+ GRAPHQL_FILE = "get_app_by_api_key"
8
8
 
9
9
  RESPONSE_FIELD = %w(data)
10
- APP_FIELD = 'app'
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('tasks.errors.parse_error')) if response.nil?
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 'shopify_cli'
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?('apps') && organization['apps'].any?
21
+ return [] unless organization.key?("apps") && organization["apps"].any?
22
22
 
23
- organization['apps'].map do |app|
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 'shopify_cli'
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 = 'extension_update_draft'
9
+ GRAPHQL_FILE = "extension_update_draft"
10
10
 
11
11
  RESPONSE_FIELD = %w(data extensionUpdateDraft)
12
- VERSION_FIELD = 'extensionVersion'
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('tasks.errors.parse_error')) if response.nil?
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 'shopify_cli'
2
+ require "shopify_cli"
3
3
 
4
4
  module Extension
5
5
  module Tasks
6
6
  module UserErrors
7
- USER_ERRORS_FIELD = 'userErrors'
8
- MESSAGE_FIELD = 'message'
9
- USER_ERRORS_PARSE_ERROR = 'Unable to parse errors from server.'
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('Node.js App')
5
- creator('Node::Commands::Create')
6
- connector('Node::Commands::Connect')
4
+ title("Node.js App")
5
+ creator("Node::Commands::Create")
6
+ connector("Node::Commands::Connect")
7
7
 
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")
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('messages/messages')
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('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')
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('forms/create')
38
+ autoload :Create, Project.project_filepath("forms/create")
39
39
  end
40
40
  end