@shopify/cli-kit 3.69.4 → 3.71.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.
Files changed (571) hide show
  1. package/{assets/cli-ruby/LICENSE → LICENSE} +0 -2
  2. package/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.d.ts +41 -0
  3. package/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.js +165 -0
  4. package/dist/cli/api/graphql/admin/generated/get_theme_file_bodies.js.map +1 -0
  5. package/dist/cli/api/graphql/admin/generated/get_theme_file_checksums.d.ts +29 -0
  6. package/dist/cli/api/graphql/admin/generated/get_theme_file_checksums.js +100 -0
  7. package/dist/cli/api/graphql/admin/generated/get_theme_file_checksums.js.map +1 -0
  8. package/dist/cli/api/graphql/admin/generated/theme_delete.d.ts +17 -0
  9. package/dist/cli/api/graphql/admin/generated/theme_delete.js +53 -0
  10. package/dist/cli/api/graphql/admin/generated/theme_delete.js.map +1 -0
  11. package/dist/cli/api/graphql/admin/generated/theme_files_upsert.d.ts +21 -0
  12. package/dist/cli/api/graphql/admin/generated/theme_files_upsert.js +82 -0
  13. package/dist/cli/api/graphql/admin/generated/theme_files_upsert.js.map +1 -0
  14. package/dist/cli/api/graphql/admin/generated/theme_publish.d.ts +21 -0
  15. package/dist/cli/api/graphql/admin/generated/theme_publish.js +65 -0
  16. package/dist/cli/api/graphql/admin/generated/theme_publish.js.map +1 -0
  17. package/dist/cli/api/graphql/admin/generated/theme_update.d.ts +23 -0
  18. package/dist/cli/api/graphql/admin/generated/theme_update.js +75 -0
  19. package/dist/cli/api/graphql/admin/generated/theme_update.js.map +1 -0
  20. package/dist/private/node/api/graphql.d.ts +2 -2
  21. package/dist/private/node/api/graphql.js +4 -4
  22. package/dist/private/node/api/graphql.js.map +1 -1
  23. package/dist/private/node/api/headers.js +1 -1
  24. package/dist/private/node/api/headers.js.map +1 -1
  25. package/dist/private/node/api/rest.d.ts +1 -2
  26. package/dist/private/node/api/rest.js +2 -3
  27. package/dist/private/node/api/rest.js.map +1 -1
  28. package/dist/private/node/api.d.ts +1 -1
  29. package/dist/private/node/api.js +41 -2
  30. package/dist/private/node/api.js.map +1 -1
  31. package/dist/private/node/conf-store.d.ts +9 -4
  32. package/dist/private/node/conf-store.js +8 -6
  33. package/dist/private/node/conf-store.js.map +1 -1
  34. package/dist/private/node/constants.d.ts +3 -0
  35. package/dist/private/node/constants.js +3 -0
  36. package/dist/private/node/constants.js.map +1 -1
  37. package/dist/private/node/session/exchange.js +2 -2
  38. package/dist/private/node/session/exchange.js.map +1 -1
  39. package/dist/private/node/session/schema.d.ts +40 -40
  40. package/dist/private/node/session/scopes.js +3 -5
  41. package/dist/private/node/session/scopes.js.map +1 -1
  42. package/dist/private/node/session.js +2 -3
  43. package/dist/private/node/session.js.map +1 -1
  44. package/dist/private/node/ui/alert.js +1 -3
  45. package/dist/private/node/ui/alert.js.map +1 -1
  46. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +1 -0
  47. package/dist/private/node/ui/components/ConcurrentOutput.js +4 -4
  48. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  49. package/dist/private/node/ui/components/Link.js +3 -0
  50. package/dist/private/node/ui/components/Link.js.map +1 -1
  51. package/dist/private/node/ui/components/Link.test.js +23 -0
  52. package/dist/private/node/ui/components/Link.test.js.map +1 -1
  53. package/dist/private/node/ui.js +1 -1
  54. package/dist/private/node/ui.js.map +1 -1
  55. package/dist/public/common/version.d.ts +1 -1
  56. package/dist/public/common/version.js +1 -1
  57. package/dist/public/common/version.js.map +1 -1
  58. package/dist/public/node/analytics.js +1 -2
  59. package/dist/public/node/analytics.js.map +1 -1
  60. package/dist/public/node/api/admin.d.ts +2 -1
  61. package/dist/public/node/api/admin.js +36 -10
  62. package/dist/public/node/api/admin.js.map +1 -1
  63. package/dist/public/node/api/graphql.d.ts +2 -0
  64. package/dist/public/node/api/graphql.js +3 -3
  65. package/dist/public/node/api/graphql.js.map +1 -1
  66. package/dist/public/node/api/webhooks.d.ts +13 -0
  67. package/dist/public/node/api/webhooks.js +34 -0
  68. package/dist/public/node/api/webhooks.js.map +1 -0
  69. package/dist/public/node/base-command.js +4 -0
  70. package/dist/public/node/base-command.js.map +1 -1
  71. package/dist/public/node/cli-launcher.d.ts +12 -0
  72. package/dist/public/node/cli-launcher.js +29 -0
  73. package/dist/public/node/cli-launcher.js.map +1 -0
  74. package/dist/public/node/cli.d.ts +16 -10
  75. package/dist/public/node/cli.js +45 -101
  76. package/dist/public/node/cli.js.map +1 -1
  77. package/dist/public/node/context/fqdn.js +11 -7
  78. package/dist/public/node/context/fqdn.js.map +1 -1
  79. package/dist/public/node/context/local.d.ts +7 -0
  80. package/dist/public/node/context/local.js +16 -0
  81. package/dist/public/node/context/local.js.map +1 -1
  82. package/dist/public/node/environment.d.ts +7 -0
  83. package/dist/public/node/environment.js +11 -0
  84. package/dist/public/node/environment.js.map +1 -1
  85. package/dist/public/node/error-handler.js +2 -4
  86. package/dist/public/node/error-handler.js.map +1 -1
  87. package/dist/public/node/error.js +4 -13
  88. package/dist/public/node/error.js.map +1 -1
  89. package/dist/public/node/global-context.d.ts +15 -0
  90. package/dist/public/node/global-context.js +29 -0
  91. package/dist/public/node/global-context.js.map +1 -0
  92. package/dist/public/node/hooks/prerun.js +0 -2
  93. package/dist/public/node/hooks/prerun.js.map +1 -1
  94. package/dist/public/node/is-global.js +2 -1
  95. package/dist/public/node/is-global.js.map +1 -1
  96. package/dist/public/node/json-schema.d.ts +2 -1
  97. package/dist/public/node/json-schema.js +8 -3
  98. package/dist/public/node/json-schema.js.map +1 -1
  99. package/dist/public/node/node-package-manager.js +1 -1
  100. package/dist/public/node/node-package-manager.js.map +1 -1
  101. package/dist/public/node/notifications-system.d.ts +193 -0
  102. package/dist/public/node/notifications-system.js +242 -0
  103. package/dist/public/node/notifications-system.js.map +1 -0
  104. package/dist/public/node/output.d.ts +1 -6
  105. package/dist/public/node/output.js +1 -5
  106. package/dist/public/node/output.js.map +1 -1
  107. package/dist/public/node/path.d.ts +3 -3
  108. package/dist/public/node/path.js +4 -5
  109. package/dist/public/node/path.js.map +1 -1
  110. package/dist/public/node/system.js +14 -2
  111. package/dist/public/node/system.js.map +1 -1
  112. package/dist/public/node/themes/api.d.ts +4 -12
  113. package/dist/public/node/themes/api.js +225 -36
  114. package/dist/public/node/themes/api.js.map +1 -1
  115. package/dist/public/node/themes/factories.d.ts +1 -3
  116. package/dist/public/node/themes/factories.js +0 -16
  117. package/dist/public/node/themes/factories.js.map +1 -1
  118. package/dist/public/node/themes/types.d.ts +1 -0
  119. package/dist/public/node/themes/types.js.map +1 -1
  120. package/dist/public/node/themes/utils.d.ts +2 -0
  121. package/dist/public/node/themes/utils.js +11 -0
  122. package/dist/public/node/themes/utils.js.map +1 -1
  123. package/dist/public/node/tree-kill.js +0 -2
  124. package/dist/public/node/tree-kill.js.map +1 -1
  125. package/dist/public/node/ui.js +30 -80
  126. package/dist/public/node/ui.js.map +1 -1
  127. package/dist/public/node/vendor/dev_server/DevServer.d.ts +19 -0
  128. package/dist/public/node/vendor/dev_server/DevServer.js +170 -0
  129. package/dist/public/node/vendor/dev_server/DevServer.js.map +1 -0
  130. package/dist/public/node/version.d.ts +13 -0
  131. package/dist/public/node/version.js +38 -0
  132. package/dist/public/node/version.js.map +1 -0
  133. package/dist/tsconfig.tsbuildinfo +1 -1
  134. package/package.json +9 -7
  135. package/assets/cli-ruby/.devcontainer.json +0 -5
  136. package/assets/cli-ruby/.rubocop.yml +0 -102
  137. package/assets/cli-ruby/.rubocop_todo.yml +0 -24
  138. package/assets/cli-ruby/CHANGELOG.md +0 -634
  139. package/assets/cli-ruby/CONTRIBUTING.md +0 -3
  140. package/assets/cli-ruby/Codespace.dockerfile +0 -35
  141. package/assets/cli-ruby/Gemfile +0 -32
  142. package/assets/cli-ruby/README.md +0 -30
  143. package/assets/cli-ruby/Rakefile +0 -167
  144. package/assets/cli-ruby/SECURITY.md +0 -59
  145. package/assets/cli-ruby/Tests.dockerfile +0 -35
  146. package/assets/cli-ruby/assets/logo.png +0 -0
  147. package/assets/cli-ruby/bin/console +0 -11
  148. package/assets/cli-ruby/bin/load_shopify.rb +0 -22
  149. package/assets/cli-ruby/bin/shopify +0 -67
  150. package/assets/cli-ruby/bin/shopify.bat +0 -3
  151. package/assets/cli-ruby/dev.yml +0 -29
  152. package/assets/cli-ruby/docs/README.md +0 -13
  153. package/assets/cli-ruby/docs/contributors/testing.md +0 -27
  154. package/assets/cli-ruby/docs/users/installation.md +0 -3
  155. package/assets/cli-ruby/docs/users/migrate-from-themekit.md +0 -18
  156. package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.1.0.gz.sha256 +0 -1
  157. package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.0.gz.sha256 +0 -1
  158. package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.2.1.gz.sha256 +0 -1
  159. package/assets/cli-ruby/ext/javy/hashes/javy-arm-macos-v0.3.0.gz.sha256 +0 -1
  160. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.1.0.gz.sha256 +0 -1
  161. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.0.gz.sha256 +0 -1
  162. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.2.1.gz.sha256 +0 -1
  163. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-linux-v0.3.0.gz.sha256 +0 -1
  164. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.1.0.gz.sha256 +0 -1
  165. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.0.gz.sha256 +0 -1
  166. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.2.1.gz.sha256 +0 -1
  167. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-macos-v0.3.0.gz.sha256 +0 -1
  168. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.1.0.gz.sha256 +0 -1
  169. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.0.gz.sha256 +0 -1
  170. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.2.1.gz.sha256 +0 -1
  171. package/assets/cli-ruby/ext/javy/hashes/javy-x86_64-windows-v0.3.0.gz.sha256 +0 -1
  172. package/assets/cli-ruby/ext/javy/javy.rb +0 -204
  173. package/assets/cli-ruby/ext/javy/version +0 -1
  174. package/assets/cli-ruby/ext/shopify-extensions/extconf.rb +0 -21
  175. package/assets/cli-ruby/ext/shopify-extensions/shopify_extensions.rb +0 -152
  176. package/assets/cli-ruby/ext/shopify-extensions/version +0 -1
  177. package/assets/cli-ruby/features/support/assertions.rb +0 -17
  178. package/assets/cli-ruby/features/support/cli.rb +0 -7
  179. package/assets/cli-ruby/features/support/process.rb +0 -27
  180. package/assets/cli-ruby/features/support/requires.rb +0 -3
  181. package/assets/cli-ruby/lib/docgen/class_template.md.erb +0 -81
  182. package/assets/cli-ruby/lib/docgen/index_template.md.erb +0 -5
  183. package/assets/cli-ruby/lib/docgen/markdown.rb +0 -101
  184. package/assets/cli-ruby/lib/graphql/admin_introspection.graphql +0 -87
  185. package/assets/cli-ruby/lib/graphql/all_organizations.graphql +0 -19
  186. package/assets/cli-ruby/lib/graphql/all_orgs_with_apps.graphql +0 -30
  187. package/assets/cli-ruby/lib/graphql/api_versions.graphql +0 -6
  188. package/assets/cli-ruby/lib/graphql/convert_dev_to_test_store.graphql +0 -10
  189. package/assets/cli-ruby/lib/graphql/create_app.graphql +0 -20
  190. package/assets/cli-ruby/lib/graphql/create_customer.graphql +0 -9
  191. package/assets/cli-ruby/lib/graphql/create_draft_order.graphql +0 -8
  192. package/assets/cli-ruby/lib/graphql/create_product.graphql +0 -9
  193. package/assets/cli-ruby/lib/graphql/extension_create.graphql +0 -37
  194. package/assets/cli-ruby/lib/graphql/extension_update_draft.graphql +0 -19
  195. package/assets/cli-ruby/lib/graphql/fetch_specifications.graphql +0 -14
  196. package/assets/cli-ruby/lib/graphql/find_organization.graphql +0 -18
  197. package/assets/cli-ruby/lib/graphql/find_organization_with_apps.graphql +0 -20
  198. package/assets/cli-ruby/lib/graphql/get_app_by_api_key.graphql +0 -9
  199. package/assets/cli-ruby/lib/graphql/get_app_urls.graphql +0 -6
  200. package/assets/cli-ruby/lib/graphql/get_extension_registrations.graphql +0 -28
  201. package/assets/cli-ruby/lib/graphql/get_variant_id.graphql +0 -16
  202. package/assets/cli-ruby/lib/graphql/update_dashboard_urls.graphql +0 -8
  203. package/assets/cli-ruby/lib/project_types/extension/cli.rb +0 -75
  204. package/assets/cli-ruby/lib/project_types/extension/commands/extension_command.rb +0 -29
  205. package/assets/cli-ruby/lib/project_types/extension/commands/serve.rb +0 -164
  206. package/assets/cli-ruby/lib/project_types/extension/errors.rb +0 -9
  207. package/assets/cli-ruby/lib/project_types/extension/extension_project.rb +0 -151
  208. package/assets/cli-ruby/lib/project_types/extension/extension_project_keys.rb +0 -12
  209. package/assets/cli-ruby/lib/project_types/extension/features/argo.rb +0 -50
  210. package/assets/cli-ruby/lib/project_types/extension/features/argo_config.rb +0 -59
  211. package/assets/cli-ruby/lib/project_types/extension/features/argo_dependencies.rb +0 -28
  212. package/assets/cli-ruby/lib/project_types/extension/features/argo_runtime.rb +0 -15
  213. package/assets/cli-ruby/lib/project_types/extension/features/argo_serve.rb +0 -115
  214. package/assets/cli-ruby/lib/project_types/extension/features/argo_setup.rb +0 -54
  215. package/assets/cli-ruby/lib/project_types/extension/features/argo_setup_step.rb +0 -31
  216. package/assets/cli-ruby/lib/project_types/extension/features/argo_setup_steps.rb +0 -51
  217. package/assets/cli-ruby/lib/project_types/extension/features/runtimes/admin.rb +0 -29
  218. package/assets/cli-ruby/lib/project_types/extension/features/runtimes/base.rb +0 -19
  219. package/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_post_purchase.rb +0 -23
  220. package/assets/cli-ruby/lib/project_types/extension/features/runtimes/checkout_ui_extension.rb +0 -29
  221. package/assets/cli-ruby/lib/project_types/extension/loaders/project.rb +0 -50
  222. package/assets/cli-ruby/lib/project_types/extension/loaders/specification_handler.rb +0 -22
  223. package/assets/cli-ruby/lib/project_types/extension/messages/message_loading.rb +0 -34
  224. package/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +0 -320
  225. package/assets/cli-ruby/lib/project_types/extension/models/app.rb +0 -14
  226. package/assets/cli-ruby/lib/project_types/extension/models/lazy_specification_handler.rb +0 -12
  227. package/assets/cli-ruby/lib/project_types/extension/models/specification.rb +0 -41
  228. package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/default.rb +0 -145
  229. package/assets/cli-ruby/lib/project_types/extension/models/specification_handlers/theme_app_extension.rb +0 -134
  230. package/assets/cli-ruby/lib/project_types/extension/models/specifications.rb +0 -91
  231. package/assets/cli-ruby/lib/project_types/extension/models/validation_error.rb +0 -17
  232. package/assets/cli-ruby/lib/project_types/extension/models/version.rb +0 -15
  233. package/assets/cli-ruby/lib/project_types/extension/tasks/configure_features.rb +0 -73
  234. package/assets/cli-ruby/lib/project_types/extension/tasks/configure_options.rb +0 -21
  235. package/assets/cli-ruby/lib/project_types/extension/tasks/converters/validation_error_converter.rb +0 -25
  236. package/assets/cli-ruby/lib/project_types/extension/tasks/converters/version_converter.rb +0 -28
  237. package/assets/cli-ruby/lib/project_types/extension/tasks/fetch_specifications.rb +0 -21
  238. package/assets/cli-ruby/lib/project_types/node/cli.rb +0 -12
  239. package/assets/cli-ruby/lib/project_types/node/forms/create.rb +0 -45
  240. package/assets/cli-ruby/lib/project_types/node/messages/messages.rb +0 -33
  241. package/assets/cli-ruby/lib/project_types/php/cli.rb +0 -16
  242. package/assets/cli-ruby/lib/project_types/php/forms/create.rb +0 -44
  243. package/assets/cli-ruby/lib/project_types/php/messages/messages.rb +0 -29
  244. package/assets/cli-ruby/lib/project_types/rails/cli.rb +0 -15
  245. package/assets/cli-ruby/lib/project_types/rails/forms/create.rb +0 -75
  246. package/assets/cli-ruby/lib/project_types/rails/gem.rb +0 -110
  247. package/assets/cli-ruby/lib/project_types/rails/messages/messages.rb +0 -101
  248. package/assets/cli-ruby/lib/project_types/script/cli.rb +0 -27
  249. package/assets/cli-ruby/lib/project_types/script/commands/connect.rb +0 -16
  250. package/assets/cli-ruby/lib/project_types/script/commands/create.rb +0 -24
  251. package/assets/cli-ruby/lib/project_types/script/commands/javy.rb +0 -24
  252. package/assets/cli-ruby/lib/project_types/script/commands/push.rb +0 -26
  253. package/assets/cli-ruby/lib/project_types/script/loaders/project.rb +0 -46
  254. package/assets/cli-ruby/lib/project_types/script/loaders/specification_handler.rb +0 -22
  255. package/assets/cli-ruby/lib/project_types/script/messages/messages.rb +0 -11
  256. package/assets/cli-ruby/lib/project_types/theme/cli.rb +0 -33
  257. package/assets/cli-ruby/lib/project_types/theme/commands/common/root_helper.rb +0 -94
  258. package/assets/cli-ruby/lib/project_types/theme/commands/common/shop_helper.rb +0 -13
  259. package/assets/cli-ruby/lib/project_types/theme/commands/console.rb +0 -23
  260. package/assets/cli-ruby/lib/project_types/theme/commands/delete.rb +0 -70
  261. package/assets/cli-ruby/lib/project_types/theme/commands/init.rb +0 -46
  262. package/assets/cli-ruby/lib/project_types/theme/commands/list.rb +0 -33
  263. package/assets/cli-ruby/lib/project_types/theme/commands/open.rb +0 -73
  264. package/assets/cli-ruby/lib/project_types/theme/commands/package.rb +0 -73
  265. package/assets/cli-ruby/lib/project_types/theme/commands/publish.rb +0 -49
  266. package/assets/cli-ruby/lib/project_types/theme/commands/pull.rb +0 -118
  267. package/assets/cli-ruby/lib/project_types/theme/commands/push.rb +0 -160
  268. package/assets/cli-ruby/lib/project_types/theme/commands/serve.rb +0 -91
  269. package/assets/cli-ruby/lib/project_types/theme/commands/share.rb +0 -62
  270. package/assets/cli-ruby/lib/project_types/theme/commands/token.rb +0 -22
  271. package/assets/cli-ruby/lib/project_types/theme/conversions/base_glob.rb +0 -65
  272. package/assets/cli-ruby/lib/project_types/theme/conversions/ignore_glob.rb +0 -15
  273. package/assets/cli-ruby/lib/project_types/theme/conversions/include_glob.rb +0 -15
  274. package/assets/cli-ruby/lib/project_types/theme/forms/confirm_store.rb +0 -15
  275. package/assets/cli-ruby/lib/project_types/theme/forms/select.rb +0 -34
  276. package/assets/cli-ruby/lib/project_types/theme/messages/messages.rb +0 -429
  277. package/assets/cli-ruby/lib/project_types/theme/models/specification_handlers/theme.rb +0 -19
  278. package/assets/cli-ruby/lib/project_types/theme/presenters/theme_presenter.rb +0 -48
  279. package/assets/cli-ruby/lib/project_types/theme/presenters/themes_presenter.rb +0 -29
  280. package/assets/cli-ruby/lib/project_types/theme/ui/sync_progress_bar.rb +0 -20
  281. package/assets/cli-ruby/lib/rubygems_plugin.rb +0 -26
  282. package/assets/cli-ruby/lib/shopify_cli/admin_api.rb +0 -160
  283. package/assets/cli-ruby/lib/shopify_cli/api.rb +0 -130
  284. package/assets/cli-ruby/lib/shopify_cli/command/project_command.rb +0 -31
  285. package/assets/cli-ruby/lib/shopify_cli/command/sub_command.rb +0 -20
  286. package/assets/cli-ruby/lib/shopify_cli/command.rb +0 -166
  287. package/assets/cli-ruby/lib/shopify_cli/commands.rb +0 -21
  288. package/assets/cli-ruby/lib/shopify_cli/constants.rb +0 -101
  289. package/assets/cli-ruby/lib/shopify_cli/context.rb +0 -709
  290. package/assets/cli-ruby/lib/shopify_cli/core/cli_version.rb +0 -20
  291. package/assets/cli-ruby/lib/shopify_cli/core/entry_point.rb +0 -64
  292. package/assets/cli-ruby/lib/shopify_cli/core/executor.rb +0 -23
  293. package/assets/cli-ruby/lib/shopify_cli/core/finalize.rb +0 -13
  294. package/assets/cli-ruby/lib/shopify_cli/core/monorail.rb +0 -122
  295. package/assets/cli-ruby/lib/shopify_cli/core.rb +0 -8
  296. package/assets/cli-ruby/lib/shopify_cli/db.rb +0 -114
  297. package/assets/cli-ruby/lib/shopify_cli/environment.rb +0 -217
  298. package/assets/cli-ruby/lib/shopify_cli/exception_reporter.rb +0 -80
  299. package/assets/cli-ruby/lib/shopify_cli/feature.rb +0 -95
  300. package/assets/cli-ruby/lib/shopify_cli/file_system_listener.rb +0 -30
  301. package/assets/cli-ruby/lib/shopify_cli/form.rb +0 -42
  302. package/assets/cli-ruby/lib/shopify_cli/git.rb +0 -320
  303. package/assets/cli-ruby/lib/shopify_cli/github/issue_url_generator.rb +0 -30
  304. package/assets/cli-ruby/lib/shopify_cli/github.rb +0 -5
  305. package/assets/cli-ruby/lib/shopify_cli/helpers/haikunator.rb +0 -92
  306. package/assets/cli-ruby/lib/shopify_cli/helpers.rb +0 -5
  307. package/assets/cli-ruby/lib/shopify_cli/http_request.rb +0 -43
  308. package/assets/cli-ruby/lib/shopify_cli/identity_auth/env_auth_token.rb +0 -34
  309. package/assets/cli-ruby/lib/shopify_cli/identity_auth.rb +0 -332
  310. package/assets/cli-ruby/lib/shopify_cli/js_system.rb +0 -115
  311. package/assets/cli-ruby/lib/shopify_cli/lazy_delegator.rb +0 -55
  312. package/assets/cli-ruby/lib/shopify_cli/messages/messages.rb +0 -863
  313. package/assets/cli-ruby/lib/shopify_cli/method_object.rb +0 -123
  314. package/assets/cli-ruby/lib/shopify_cli/migrator/migration.rb +0 -27
  315. package/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1631709766_noop.rb +0 -13
  316. package/assets/cli-ruby/lib/shopify_cli/migrator/migrations/1633691650_merge_reporting_configuration.rb +0 -41
  317. package/assets/cli-ruby/lib/shopify_cli/migrator.rb +0 -46
  318. package/assets/cli-ruby/lib/shopify_cli/options.rb +0 -40
  319. package/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions/job.rb +0 -36
  320. package/assets/cli-ruby/lib/shopify_cli/partners_api/app_extensions.rb +0 -46
  321. package/assets/cli-ruby/lib/shopify_cli/partners_api/organizations.rb +0 -45
  322. package/assets/cli-ruby/lib/shopify_cli/partners_api.rb +0 -91
  323. package/assets/cli-ruby/lib/shopify_cli/project.rb +0 -199
  324. package/assets/cli-ruby/lib/shopify_cli/project_type.rb +0 -66
  325. package/assets/cli-ruby/lib/shopify_cli/reporting_configuration_controller.rb +0 -29
  326. package/assets/cli-ruby/lib/shopify_cli/resolve_constant.rb +0 -25
  327. package/assets/cli-ruby/lib/shopify_cli/resources/env_file.rb +0 -108
  328. package/assets/cli-ruby/lib/shopify_cli/resources.rb +0 -5
  329. package/assets/cli-ruby/lib/shopify_cli/result.rb +0 -448
  330. package/assets/cli-ruby/lib/shopify_cli/shopifolk.rb +0 -82
  331. package/assets/cli-ruby/lib/shopify_cli/task.rb +0 -20
  332. package/assets/cli-ruby/lib/shopify_cli/tasks/confirm_store.rb +0 -18
  333. package/assets/cli-ruby/lib/shopify_cli/tasks/create_api_client.rb +0 -40
  334. package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_authenticated.rb +0 -19
  335. package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_dev_store.rb +0 -41
  336. package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_env.rb +0 -90
  337. package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_git_dependency.rb +0 -14
  338. package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_loopback_url.rb +0 -20
  339. package/assets/cli-ruby/lib/shopify_cli/tasks/ensure_project_type.rb +0 -14
  340. package/assets/cli-ruby/lib/shopify_cli/tasks/select_org_and_shop.rb +0 -81
  341. package/assets/cli-ruby/lib/shopify_cli/tasks/update_dashboard_urls.rb +0 -57
  342. package/assets/cli-ruby/lib/shopify_cli/tasks.rb +0 -44
  343. package/assets/cli-ruby/lib/shopify_cli/theme/backoff_helper.rb +0 -47
  344. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/cdn_fonts.rb +0 -82
  345. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/certificate_manager.rb +0 -79
  346. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/errors.rb +0 -9
  347. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/header_hash.rb +0 -98
  348. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hooks/file_change_hook.rb +0 -77
  349. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_deleter.rb +0 -62
  350. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/remote_file_reloader.rb +0 -63
  351. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot-reload-no-script.html +0 -27
  352. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/hot_reload.js +0 -48
  353. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/sse_client.js +0 -43
  354. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme.js +0 -114
  355. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/resources/theme_extension.js +0 -121
  356. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/script_injector.rb +0 -57
  357. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload/sections_index.rb +0 -50
  358. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/hot_reload.rb +0 -75
  359. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/local_assets.rb +0 -101
  360. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy.rb +0 -313
  361. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/proxy_param_builder.rb +0 -84
  362. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/reload_mode.rb +0 -34
  363. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher/json_files_update_job.rb +0 -35
  364. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/remote_watcher.rb +0 -44
  365. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/sse.rb +0 -75
  366. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/watcher.rb +0 -64
  367. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server/web_server.rb +0 -140
  368. package/assets/cli-ruby/lib/shopify_cli/theme/dev_server.rb +0 -332
  369. package/assets/cli-ruby/lib/shopify_cli/theme/development_theme.rb +0 -101
  370. package/assets/cli-ruby/lib/shopify_cli/theme/extension/app_extension.rb +0 -40
  371. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hooks/file_change_hook.rb +0 -76
  372. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload/script_injector.rb +0 -30
  373. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/hot_reload.rb +0 -13
  374. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/local_assets.rb +0 -31
  375. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/proxy_param_builder.rb +0 -94
  376. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server/watcher.rb +0 -49
  377. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server.rb +0 -175
  378. package/assets/cli-ruby/lib/shopify_cli/theme/extension/host_theme.rb +0 -109
  379. package/assets/cli-ruby/lib/shopify_cli/theme/extension/ignore_helper.rb +0 -35
  380. package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/extension_serve_job.rb +0 -120
  381. package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer/operation.rb +0 -25
  382. package/assets/cli-ruby/lib/shopify_cli/theme/extension/syncer.rb +0 -100
  383. package/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_progress_bar.rb +0 -35
  384. package/assets/cli-ruby/lib/shopify_cli/theme/extension/ui/host_theme_raw_progress_bar.rb +0 -40
  385. package/assets/cli-ruby/lib/shopify_cli/theme/file.rb +0 -133
  386. package/assets/cli-ruby/lib/shopify_cli/theme/filter/path_matcher.rb +0 -38
  387. package/assets/cli-ruby/lib/shopify_cli/theme/ignore_filter.rb +0 -112
  388. package/assets/cli-ruby/lib/shopify_cli/theme/ignore_helper.rb +0 -37
  389. package/assets/cli-ruby/lib/shopify_cli/theme/include_filter.rb +0 -67
  390. package/assets/cli-ruby/lib/shopify_cli/theme/mime_type.rb +0 -34
  391. package/assets/cli-ruby/lib/shopify_cli/theme/notifier.rb +0 -52
  392. package/assets/cli-ruby/lib/shopify_cli/theme/repl/api.rb +0 -109
  393. package/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_dev_server.rb +0 -93
  394. package/assets/cli-ruby/lib/shopify_cli/theme/repl/auth_middleware.rb +0 -97
  395. package/assets/cli-ruby/lib/shopify_cli/theme/repl/remote_evaluator.rb +0 -166
  396. package/assets/cli-ruby/lib/shopify_cli/theme/repl/resources/success.html +0 -78
  397. package/assets/cli-ruby/lib/shopify_cli/theme/repl/resources/template.liquid +0 -15
  398. package/assets/cli-ruby/lib/shopify_cli/theme/repl/snippet.rb +0 -81
  399. package/assets/cli-ruby/lib/shopify_cli/theme/repl.rb +0 -88
  400. package/assets/cli-ruby/lib/shopify_cli/theme/root.rb +0 -62
  401. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/checksums.rb +0 -66
  402. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/downloader.rb +0 -63
  403. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/error_reporter.rb +0 -45
  404. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/merger.rb +0 -53
  405. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/operation.rb +0 -49
  406. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/standard_reporter.rb +0 -32
  407. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/unsupported_script_warning.rb +0 -90
  408. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk.rb +0 -133
  409. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_item.rb +0 -64
  410. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_job.rb +0 -139
  411. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/bulk_request.rb +0 -30
  412. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all.rb +0 -41
  413. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/apply_to_all_form.rb +0 -37
  414. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/base_strategy_form.rb +0 -64
  415. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_delete_strategy.rb +0 -29
  416. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/forms/select_update_strategy.rb +0 -30
  417. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_delete_handler.rb +0 -49
  418. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader/json_update_handler.rb +0 -71
  419. package/assets/cli-ruby/lib/shopify_cli/theme/syncer/uploader.rb +0 -231
  420. package/assets/cli-ruby/lib/shopify_cli/theme/syncer.rb +0 -391
  421. package/assets/cli-ruby/lib/shopify_cli/theme/theme.rb +0 -212
  422. package/assets/cli-ruby/lib/shopify_cli/theme/theme_access_api.rb +0 -89
  423. package/assets/cli-ruby/lib/shopify_cli/theme/theme_admin_api.rb +0 -101
  424. package/assets/cli-ruby/lib/shopify_cli/thread_pool/job.rb +0 -35
  425. package/assets/cli-ruby/lib/shopify_cli/thread_pool.rb +0 -49
  426. package/assets/cli-ruby/lib/shopify_cli/transform_data_structure.rb +0 -87
  427. package/assets/cli-ruby/lib/shopify_cli/utilities.rb +0 -21
  428. package/assets/cli-ruby/lib/shopify_cli/version.rb +0 -3
  429. package/assets/cli-ruby/lib/shopify_cli.rb +0 -182
  430. package/assets/cli-ruby/shipit.rubygems.yml +0 -3
  431. package/assets/cli-ruby/shopify-cli.gemspec +0 -46
  432. package/assets/cli-ruby/shopify-dev +0 -16
  433. package/assets/cli-ruby/test/minitest_ext.rb +0 -115
  434. package/assets/cli-ruby/test/project_types/extension/extension_test_helpers.rb +0 -70
  435. package/assets/cli-ruby/test/shopify-cli/migrator/migrations/migration_helper.rb +0 -20
  436. package/assets/cli-ruby/test/test_helpers.rb +0 -16
  437. package/assets/cli-ruby/utilities/constants.rb +0 -7
  438. package/assets/cli-ruby/utilities/docker/container.rb +0 -104
  439. package/assets/cli-ruby/utilities/docker.rb +0 -89
  440. package/assets/cli-ruby/utilities/utilities.rb +0 -6
  441. package/assets/cli-ruby/vendor/deps/cli-kit/REVISION +0 -1
  442. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/autocall.rb +0 -21
  443. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/base_command.rb +0 -49
  444. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/command_registry.rb +0 -94
  445. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/config.rb +0 -133
  446. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/error_handler.rb +0 -123
  447. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/executor.rb +0 -79
  448. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ini.rb +0 -102
  449. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/levenshtein.rb +0 -82
  450. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/logger.rb +0 -82
  451. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/resolver.rb +0 -60
  452. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/ruby_backports/enumerable.rb +0 -6
  453. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support/test_helper.rb +0 -244
  454. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/support.rb +0 -9
  455. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/system.rb +0 -243
  456. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/util.rb +0 -193
  457. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit/version.rb +0 -5
  458. package/assets/cli-ruby/vendor/deps/cli-kit/lib/cli/kit.rb +0 -60
  459. package/assets/cli-ruby/vendor/deps/cli-ui/REVISION +0 -1
  460. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/ansi.rb +0 -157
  461. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/color.rb +0 -84
  462. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/formatter.rb +0 -193
  463. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_stack.rb +0 -98
  464. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/box.rb +0 -166
  465. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style/bracket.rb +0 -139
  466. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame/frame_style.rb +0 -120
  467. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/frame.rb +0 -269
  468. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/glyph.rb +0 -84
  469. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/os.rb +0 -73
  470. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/printer.rb +0 -59
  471. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress.rb +0 -90
  472. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/progress_plain.rb +0 -50
  473. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/interactive_options.rb +0 -484
  474. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt/options_handler.rb +0 -29
  475. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/prompt.rb +0 -282
  476. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/async.rb +0 -40
  477. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner/spin_group.rb +0 -263
  478. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/spinner.rb +0 -66
  479. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/stdout_router.rb +0 -232
  480. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/terminal.rb +0 -46
  481. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/truncater.rb +0 -102
  482. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/version.rb +0 -5
  483. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/base.rb +0 -27
  484. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets/status.rb +0 -61
  485. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/widgets.rb +0 -77
  486. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui/wrap.rb +0 -56
  487. package/assets/cli-ruby/vendor/deps/cli-ui/lib/cli/ui.rb +0 -234
  488. package/assets/cli-ruby/vendor/deps/ruby2_keywords/LICENSE +0 -22
  489. package/assets/cli-ruby/vendor/deps/ruby2_keywords/README.md +0 -67
  490. package/assets/cli-ruby/vendor/deps/ruby2_keywords/Rakefile +0 -54
  491. package/assets/cli-ruby/vendor/deps/ruby2_keywords/lib/ruby2_keywords.rb +0 -57
  492. package/assets/cli-ruby/vendor/deps/ruby2_keywords/ruby2_keywords.gemspec +0 -18
  493. package/assets/cli-ruby/vendor/deps/ruby2_keywords/test/test_keyword.rb +0 -41
  494. package/assets/cli-ruby/vendor/deps/smart_properties/REVISION +0 -1
  495. package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/errors.rb +0 -114
  496. package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property.rb +0 -168
  497. package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/property_collection.rb +0 -83
  498. package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations/ancestor.rb +0 -27
  499. package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/validations.rb +0 -8
  500. package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties/version.rb +0 -3
  501. package/assets/cli-ruby/vendor/deps/smart_properties/lib/smart_properties.rb +0 -174
  502. package/assets/cli-ruby/vendor/deps/webrick/Gemfile +0 -3
  503. package/assets/cli-ruby/vendor/deps/webrick/LICENSE.txt +0 -22
  504. package/assets/cli-ruby/vendor/deps/webrick/README.md +0 -61
  505. package/assets/cli-ruby/vendor/deps/webrick/Rakefile +0 -10
  506. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/accesslog.rb +0 -157
  507. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cgi.rb +0 -313
  508. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/compat.rb +0 -36
  509. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/config.rb +0 -158
  510. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/cookie.rb +0 -172
  511. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/htmlutils.rb +0 -30
  512. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/authenticator.rb +0 -117
  513. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/basicauth.rb +0 -116
  514. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/digestauth.rb +0 -395
  515. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htdigest.rb +0 -132
  516. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htgroup.rb +0 -97
  517. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/htpasswd.rb +0 -158
  518. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth/userdb.rb +0 -53
  519. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpauth.rb +0 -96
  520. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpproxy.rb +0 -354
  521. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httprequest.rb +0 -636
  522. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpresponse.rb +0 -564
  523. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/https.rb +0 -152
  524. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpserver.rb +0 -294
  525. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/abstract.rb +0 -152
  526. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgi_runner.rb +0 -47
  527. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/cgihandler.rb +0 -126
  528. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/erbhandler.rb +0 -88
  529. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/filehandler.rb +0 -552
  530. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet/prochandler.rb +0 -47
  531. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpservlet.rb +0 -23
  532. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpstatus.rb +0 -194
  533. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httputils.rb +0 -512
  534. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/httpversion.rb +0 -76
  535. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/log.rb +0 -156
  536. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/server.rb +0 -381
  537. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/ssl.rb +0 -215
  538. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/utils.rb +0 -265
  539. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick/version.rb +0 -18
  540. package/assets/cli-ruby/vendor/deps/webrick/lib/webrick.rb +0 -232
  541. package/assets/cli-ruby/vendor/deps/webrick/webrick.gemspec +0 -74
  542. package/assets/cli-ruby/vendor/gen/lib/gen/commands/help.rb +0 -20
  543. package/assets/cli-ruby/vendor/gen/lib/gen/commands/new.rb +0 -21
  544. package/assets/cli-ruby/vendor/gen/lib/gen/commands.rb +0 -18
  545. package/assets/cli-ruby/vendor/gen/lib/gen/entry_point.rb +0 -10
  546. package/assets/cli-ruby/vendor/gen/lib/gen/generator.rb +0 -165
  547. package/assets/cli-ruby/vendor/gen/lib/gen.rb +0 -39
  548. package/assets/cli-ruby/vendor/gen/template/Gemfile +0 -10
  549. package/assets/cli-ruby/vendor/gen/template/README.md +0 -1
  550. package/assets/cli-ruby/vendor/gen/template/bin/testunit +0 -23
  551. package/assets/cli-ruby/vendor/gen/template/bin/update-deps +0 -97
  552. package/assets/cli-ruby/vendor/gen/template/dev-gems.yml +0 -3
  553. package/assets/cli-ruby/vendor/gen/template/dev-vendor.yml +0 -4
  554. package/assets/cli-ruby/vendor/gen/template/exe/__app__-gems +0 -17
  555. package/assets/cli-ruby/vendor/gen/template/exe/__app__-vendor +0 -18
  556. package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/example.rb +0 -19
  557. package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands/help.rb +0 -21
  558. package/assets/cli-ruby/vendor/gen/template/lib/__app__/commands.rb +0 -18
  559. package/assets/cli-ruby/vendor/gen/template/lib/__app__/entry_point.rb +0 -10
  560. package/assets/cli-ruby/vendor/gen/template/lib/__app__.rb +0 -33
  561. package/assets/cli-ruby/vendor/gen/template/test/example_test.rb +0 -17
  562. package/assets/cli-ruby/vendor/gen/template/test/test_helper.rb +0 -22
  563. package/assets/cli-ruby/vendor/lib/semantic/LICENSE +0 -20
  564. package/assets/cli-ruby/vendor/lib/semantic/semantic.rb +0 -4
  565. package/assets/cli-ruby/vendor/lib/semantic/version.rb +0 -179
  566. package/dist/private/node/demo-recorder.d.ts +0 -17
  567. package/dist/private/node/demo-recorder.js +0 -121
  568. package/dist/private/node/demo-recorder.js.map +0 -1
  569. package/dist/public/node/ruby.d.ts +0 -38
  570. package/dist/public/node/ruby.js +0 -327
  571. package/dist/public/node/ruby.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/private/node/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA;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EAAE,CAAA;IAC/D,OAAO;QACL,KAAK,EAAE,SAAS,CAAC,OAAO,EAAE,UAAU,CAAC;QACrC,QAAQ,EAAE,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC;QAC7C,UAAU,EAAE,SAAS,CAAC,qBAAqB,EAAE,gBAAgB,CAAC;QAC9D,gBAAgB,EAAE,SAAS,CAAC,mBAAmB,EAAE,sBAAsB,CAAC;QACxE,aAAa,EAAE,SAAS,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;KAChE,CAAA;AACH,CAAC;AAED,SAAS,yBAAyB,CAChC,MAAgB,EAChB,wBAAqF;IAErF,OAAO;QACL,GAAG,wBAAwB;QAC3B,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC1D,MAAM;KACP,CAAA;AACH,CAAC","sourcesContent":["import {applicationId} from './session/identity.js'\nimport {validateSession} from './session/validate.js'\nimport {allDefaultScopes, apiScopes} from './session/scopes.js'\nimport {\n exchangeAccessForApplicationTokens,\n exchangeCustomPartnerToken,\n ExchangeScopes,\n refreshAccessToken,\n InvalidGrantError,\n InvalidRequestError,\n} from './session/exchange.js'\nimport {IdentityToken, Session} from './session/schema.js'\nimport * as secureStore from './session/store.js'\nimport {pollForDeviceAuthorization, requestDeviceAuthorization} from './session/device-authorization.js'\nimport {RequestClientError} from './api/headers.js'\nimport {getCachedPartnerAccountStatus, setCachedPartnerAccountStatus} from './conf-store.js'\nimport {isThemeAccessSession} from './api/rest.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {firstPartyDev, themeToken} from '../../public/node/context/local.js'\nimport {AbortError, BugError} from '../../public/node/error.js'\nimport {partnersRequest} from '../../public/node/api/partners.js'\nimport {normalizeStoreFqdn, partnersFqdn, identityFqdn} from '../../public/node/context/fqdn.js'\nimport {openURL} from '../../public/node/system.js'\nimport {keypress} from '../../public/node/ui.js'\nimport {getIdentityTokenInformation, getPartnersToken} from '../../public/node/environment.js'\nimport {gql} from 'graphql-request'\nimport {AdminSession} from '@shopify/cli-kit/node/session'\nimport {outputCompleted, outputInfo, outputWarn} from '@shopify/cli-kit/node/output'\nimport {isTruthy} from '@shopify/cli-kit/node/context/utilities'\nimport {isSpin} from '@shopify/cli-kit/node/context/spin'\nimport {nonRandomUUID} from '@shopify/cli-kit/node/crypto'\n\n/**\n * A scope supported by the Shopify Admin API.\n */\nexport type AdminAPIScope = 'graphql' | 'themes' | 'collaborator'\n\n/**\n * It represents the options to authenticate against the Shopify Admin API.\n */\n\ninterface AdminAPIOAuthOptions {\n /** Store to request permissions for. */\n storeFqdn: string\n /** List of scopes to request permissions for. */\n scopes: AdminAPIScope[]\n}\n\n/**\n * A scope supported by the Partners API.\n */\nexport type PartnersAPIScope = 'cli'\ninterface PartnersAPIOAuthOptions {\n /** List of scopes to request permissions for. */\n scopes: PartnersAPIScope[]\n}\n\n/**\n * A scope supported by the Developer Platform API.\n */\nexport type AppManagementAPIScope = 'https://api.shopify.com/auth/organization.apps.manage'\ninterface AppManagementAPIOauthOptions {\n /** List of scopes to request permissions for. */\n scopes: AppManagementAPIScope[]\n}\n\n/**\n * A scope supported by the Storefront Renderer API.\n */\nexport type StorefrontRendererScope = 'devtools'\ninterface StorefrontRendererAPIOAuthOptions {\n /** List of scopes to request permissions for. */\n scopes: StorefrontRendererScope[]\n}\n\nexport type BusinessPlatformScope = 'destinations'\ninterface BusinessPlatformAPIOAuthOptions {\n /** List of scopes to request permissions for. */\n scopes: BusinessPlatformScope[]\n}\n\n/**\n * It represents the authentication requirements and\n * is the input necessary to trigger the authentication\n * flow.\n */\nexport interface OAuthApplications {\n adminApi?: AdminAPIOAuthOptions\n storefrontRendererApi?: StorefrontRendererAPIOAuthOptions\n partnersApi?: PartnersAPIOAuthOptions\n businessPlatformApi?: BusinessPlatformAPIOAuthOptions\n appManagementApi?: AppManagementAPIOauthOptions\n}\n\nexport interface OAuthSession {\n admin?: AdminSession\n partners?: string\n storefront?: string\n businessPlatform?: string\n appManagement?: string\n userId: string\n}\n\ntype AuthMethod = 'partners_token' | 'device_auth' | 'theme_access_token' | 'custom_app_token' | 'none'\n\nlet userId: undefined | string\nlet authMethod: AuthMethod = 'none'\n\n/**\n * Retrieves the user ID from the current session or returns 'unknown' if not found.\n *\n * This function performs the following steps:\n * 1. Checks for a cached user ID in memory (obtained in the current run).\n * 2. Attempts to fetch it from the secure store (from a previous auth session).\n * 3. Checks if a custom token was used (either as a theme password or partners token).\n * 4. If a custom token is present in the environment, generates a UUID and uses it as userId.\n * 5. If after all this we don't have a userId, then reports as 'unknown'.\n *\n * @returns A Promise that resolves to the user ID as a string.\n */\nexport async function getLastSeenUserIdAfterAuth(): Promise<string> {\n if (userId) return userId\n\n const currentSession = (await secureStore.fetch()) || {}\n const fqdn = await identityFqdn()\n const cachedUserId = currentSession[fqdn]?.identity.userId\n if (cachedUserId) return cachedUserId\n\n const customToken = getPartnersToken() ?? themeToken()\n return customToken ? nonRandomUUID(customToken) : 'unknown'\n}\n\nexport function setLastSeenUserIdAfterAuth(id: string) {\n userId = id\n}\n\n/**\n * Retrieves the last seen authentication method used in the current session.\n *\n * This function checks for the authentication method in the following order:\n * 1. Returns the cached auth method if it's not 'none'.\n * 2. Checks for a cached session, which implies 'device_auth' was used.\n * 3. Checks for a partners token in the environment.\n * 4. Checks for a theme password in the environment.\n * 5. If none of the above are true, returns 'none'.\n *\n * @returns A Promise that resolves to the last seen authentication method as an AuthMethod type.\n */\nexport async function getLastSeenAuthMethod(): Promise<AuthMethod> {\n if (authMethod !== 'none') return authMethod\n\n const currentSession = (await secureStore.fetch()) || {}\n const fqdn = await identityFqdn()\n const cachedUserId = currentSession[fqdn]?.identity.userId\n if (cachedUserId) return 'device_auth'\n\n const partnersToken = getPartnersToken()\n if (partnersToken) return 'partners_token'\n\n const themePassword = themeToken()\n if (themePassword) {\n return isThemeAccessSession({token: themePassword, storeFqdn: ''}) ? 'theme_access_token' : 'custom_app_token'\n }\n\n return 'none'\n}\n\nexport function setLastSeenAuthMethod(method: AuthMethod) {\n authMethod = method\n}\n\n/**\n * This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.\n *\n * @param applications - An object containing the applications we need to be authenticated with.\n * @param _env - Optional environment variables to use.\n * @param forceRefresh - Optional flag to force a refresh of the token.\n * @returns An instance with the access tokens organized by application.\n */\nexport async function ensureAuthenticated(\n applications: OAuthApplications,\n _env?: NodeJS.ProcessEnv,\n {forceRefresh = false, noPrompt = false}: {forceRefresh?: boolean; noPrompt?: boolean} = {},\n): Promise<OAuthSession> {\n const fqdn = await identityFqdn()\n\n const previousStoreFqdn = applications.adminApi?.storeFqdn\n if (previousStoreFqdn) {\n const normalizedStoreName = await normalizeStoreFqdn(previousStoreFqdn)\n if (previousStoreFqdn === applications.adminApi?.storeFqdn) {\n applications.adminApi.storeFqdn = normalizedStoreName\n }\n }\n\n const currentSession = (await secureStore.fetch()) || {}\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const fqdnSession = currentSession[fqdn]!\n const scopes = getFlattenScopes(applications)\n\n outputDebug(outputContent`Validating existing session against the scopes:\n${outputToken.json(scopes)}\nFor applications:\n${outputToken.json(applications)}\n`)\n const validationResult = await validateSession(scopes, applications, fqdnSession)\n\n let newSession = {}\n\n function throwOnNoPrompt() {\n if (!noPrompt || (isSpin() && firstPartyDev())) return\n throw new AbortError(\n `The currently available CLI credentials are invalid.\n\nThe CLI is currently unable to prompt for reauthentication.`,\n 'Restart the CLI process you were running. If in an interactive terminal, you will be prompted to reauthenticate. If in a non-interactive terminal, ensure the correct credentials are available in the program environment.',\n )\n }\n\n if (validationResult === 'needs_full_auth') {\n throwOnNoPrompt()\n outputDebug(outputContent`Initiating the full authentication flow...`)\n newSession = await executeCompleteFlow(applications, fqdn)\n } else if (validationResult === 'needs_refresh' || forceRefresh) {\n outputDebug(outputContent`The current session is valid but needs refresh. Refreshing...`)\n try {\n newSession = await refreshTokens(fqdnSession.identity, applications, fqdn)\n } catch (error) {\n if (error instanceof InvalidGrantError) {\n throwOnNoPrompt()\n newSession = await executeCompleteFlow(applications, fqdn)\n } else if (error instanceof InvalidRequestError) {\n await secureStore.remove()\n throw new AbortError('\\nError validating auth session', \"We've cleared the current session, please try again\")\n } else {\n throw error\n }\n }\n }\n\n const completeSession: Session = {...currentSession, ...newSession}\n\n // Save the new session info if it has changed\n if (Object.keys(newSession).length > 0) await secureStore.store(completeSession)\n const tokens = await tokensFor(applications, completeSession, fqdn)\n\n // Overwrite partners token if using a custom CLI Token\n const envToken = getPartnersToken()\n if (envToken && applications.partnersApi) {\n tokens.partners = (await exchangeCustomPartnerToken(envToken)).accessToken\n }\n if (!envToken && tokens.partners) {\n await ensureUserHasPartnerAccount(tokens.partners, tokens.userId)\n }\n\n setLastSeenAuthMethod(envToken ? 'partners_token' : 'device_auth')\n setLastSeenUserIdAfterAuth(tokens.userId)\n return tokens\n}\n\n/**\n * Execute the full authentication flow.\n *\n * @param applications - An object containing the applications we need to be authenticated with.\n * @param identityFqdn - The identity FQDN.\n */\nasync function executeCompleteFlow(applications: OAuthApplications, identityFqdn: string): Promise<Session> {\n const scopes = getFlattenScopes(applications)\n const exchangeScopes = getExchangeScopes(applications)\n const store = applications.adminApi?.storeFqdn\n if (firstPartyDev()) {\n outputDebug(outputContent`Authenticating as Shopify Employee...`)\n scopes.push('employee')\n }\n\n let identityToken: IdentityToken\n const identityTokenInformation = getIdentityTokenInformation()\n if (identityTokenInformation) {\n identityToken = buildIdentityTokenFromEnv(scopes, identityTokenInformation)\n } else {\n // Request a device code to authorize without a browser redirect.\n outputDebug(outputContent`Requesting device authorization code...`)\n const deviceAuth = await requestDeviceAuthorization(scopes)\n\n // Poll for the identity token\n outputDebug(outputContent`Starting polling for the identity token...`)\n identityToken = await pollForDeviceAuthorization(deviceAuth.deviceCode, deviceAuth.interval)\n }\n\n // Exchange identity token for application tokens\n outputDebug(outputContent`CLI token received. Exchanging it for application tokens...`)\n const result = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, store)\n\n const session: Session = {\n [identityFqdn]: {\n identity: identityToken,\n applications: result,\n },\n }\n\n outputCompleted('Logged in.')\n\n return session\n}\n\n/**\n * If the user creates an account from the Identity website, the created\n * account won't get a Partner organization created. We need to detect that\n * and take the user to create a partner organization.\n *\n * @param partnersToken - Partners token.\n */\nasync function ensureUserHasPartnerAccount(partnersToken: string, userId: string | undefined) {\n if (isTruthy(process.env.USE_APP_MANAGEMENT_API)) return\n\n outputDebug(outputContent`Verifying that the user has a Partner organization`)\n if (!(await hasPartnerAccount(partnersToken, userId))) {\n outputInfo(`\\nA Shopify Partners organization is needed to proceed.`)\n outputInfo(`👉 Press any key to create one`)\n await keypress()\n await openURL(`https://${await partnersFqdn()}/signup`)\n outputInfo(outputContent`👉 Press any key when you have ${outputToken.cyan('created the organization')}`)\n outputWarn(outputContent`Make sure you've confirmed your Shopify and the Partner organization from the email`)\n await keypress()\n if (!(await hasPartnerAccount(partnersToken, userId))) {\n throw new AbortError(\n `Couldn't find your Shopify Partners organization`,\n `Have you confirmed your accounts from the emails you received?`,\n )\n }\n }\n}\n\n// eslint-disable-next-line @shopify/cli/no-inline-graphql\nconst getFirstOrganization = gql`\n {\n organizations(first: 1) {\n nodes {\n id\n }\n }\n }\n`\n\n/**\n * Validate if the current token is valid for partners API.\n *\n * @param partnersToken - Partners token.\n * @returns A promise that resolves to true if the token is valid for partners API.\n */\nasync function hasPartnerAccount(partnersToken: string, userId?: string): Promise<boolean> {\n const cacheKey = userId ?? partnersToken\n const cachedStatus = getCachedPartnerAccountStatus(cacheKey)\n\n if (cachedStatus) {\n outputDebug(`Confirmed partner account exists from cache`)\n return true\n }\n\n try {\n await partnersRequest(getFirstOrganization, partnersToken)\n setCachedPartnerAccountStatus(cacheKey)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n if (error instanceof RequestClientError && error.statusCode === 404) {\n return false\n } else {\n return true\n }\n }\n}\n\n/**\n * Refresh the tokens for a given session.\n *\n * @param token - Identity token.\n * @param applications - An object containing the applications we need to be authenticated with.\n * @param fqdn - The identity FQDN.\n */\nasync function refreshTokens(token: IdentityToken, applications: OAuthApplications, fqdn: string): Promise<Session> {\n // Refresh Identity Token\n const identityToken = await refreshAccessToken(token)\n // Exchange new identity token for application tokens\n const exchangeScopes = getExchangeScopes(applications)\n const applicationTokens = await exchangeAccessForApplicationTokens(\n identityToken,\n exchangeScopes,\n applications.adminApi?.storeFqdn,\n )\n\n return {\n [fqdn]: {\n identity: identityToken,\n applications: applicationTokens,\n },\n }\n}\n\n/**\n * Get the application tokens for a given session.\n *\n * @param applications - An object containing the applications we need the tokens for.\n * @param session - The current session.\n * @param fqdn - The identity FQDN.\n */\nasync function tokensFor(applications: OAuthApplications, session: Session, fqdn: string): Promise<OAuthSession> {\n const fqdnSession = session[fqdn]\n if (!fqdnSession) {\n throw new BugError('No session found after ensuring authenticated')\n }\n const tokens: OAuthSession = {\n userId: fqdnSession.identity.userId,\n }\n if (applications.adminApi) {\n const appId = applicationId('admin')\n const realAppId = `${applications.adminApi.storeFqdn}-${appId}`\n const token = fqdnSession.applications[realAppId]?.accessToken\n if (token) {\n tokens.admin = {token, storeFqdn: applications.adminApi.storeFqdn}\n }\n }\n\n if (applications.partnersApi) {\n const appId = applicationId('partners')\n tokens.partners = fqdnSession.applications[appId]?.accessToken\n }\n\n if (applications.storefrontRendererApi) {\n const appId = applicationId('storefront-renderer')\n tokens.storefront = fqdnSession.applications[appId]?.accessToken\n }\n\n if (applications.businessPlatformApi) {\n const appId = applicationId('business-platform')\n tokens.businessPlatform = fqdnSession.applications[appId]?.accessToken\n }\n\n if (applications.appManagementApi) {\n const appId = applicationId('app-management')\n tokens.appManagement = fqdnSession.applications[appId]?.accessToken\n }\n\n return tokens\n}\n\n// Scope Helpers\n/**\n * Get a flattened array of scopes for the given applications.\n *\n * @param apps - An object containing the applications we need the scopes for.\n * @returns A flattened array of scopes.\n */\nfunction getFlattenScopes(apps: OAuthApplications): string[] {\n const admin = apps.adminApi?.scopes || []\n const partner = apps.partnersApi?.scopes || []\n const storefront = apps.storefrontRendererApi?.scopes || []\n const businessPlatform = apps.businessPlatformApi?.scopes || []\n const appManagement = apps.appManagementApi?.scopes || []\n const requestedScopes = [...admin, ...partner, ...storefront, ...businessPlatform, ...appManagement]\n return allDefaultScopes(requestedScopes)\n}\n\n/**\n * Get the scopes for the given applications.\n *\n * @param apps - An object containing the applications we need the scopes for.\n * @returns An object containing the scopes for each application.\n */\nfunction getExchangeScopes(apps: OAuthApplications): ExchangeScopes {\n const adminScope = apps.adminApi?.scopes || []\n const partnerScope = apps.partnersApi?.scopes || []\n const storefrontScopes = apps.storefrontRendererApi?.scopes || []\n const businessPlatformScopes = apps.businessPlatformApi?.scopes || []\n const appManagementScopes = apps.appManagementApi?.scopes || []\n return {\n admin: apiScopes('admin', adminScope),\n partners: apiScopes('partners', partnerScope),\n storefront: apiScopes('storefront-renderer', storefrontScopes),\n businessPlatform: apiScopes('business-platform', businessPlatformScopes),\n appManagement: apiScopes('app-management', appManagementScopes),\n }\n}\n\nfunction buildIdentityTokenFromEnv(\n scopes: string[],\n identityTokenInformation: {accessToken: string; refreshToken: string; userId: string},\n) {\n return {\n ...identityTokenInformation,\n expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),\n scopes,\n }\n}\n"]}
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/private/node/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EACL,kCAAkC,EAClC,0BAA0B,EAE1B,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAA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EAAE,SAAS,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;KAChE,CAAA;AACH,CAAC;AAED,SAAS,yBAAyB,CAChC,MAAgB,EAChB,wBAAqF;IAErF,OAAO;QACL,GAAG,wBAAwB;QAC3B,SAAS,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAC1D,MAAM;KACP,CAAA;AACH,CAAC","sourcesContent":["import {applicationId} from './session/identity.js'\nimport {validateSession} from './session/validate.js'\nimport {allDefaultScopes, apiScopes} from './session/scopes.js'\nimport {\n exchangeAccessForApplicationTokens,\n exchangeCustomPartnerToken,\n ExchangeScopes,\n refreshAccessToken,\n InvalidGrantError,\n InvalidRequestError,\n} from './session/exchange.js'\nimport {IdentityToken, Session} from './session/schema.js'\nimport * as secureStore from './session/store.js'\nimport {pollForDeviceAuthorization, requestDeviceAuthorization} from './session/device-authorization.js'\nimport {RequestClientError} from './api/headers.js'\nimport {getCachedPartnerAccountStatus, setCachedPartnerAccountStatus} from './conf-store.js'\nimport {isThemeAccessSession} from './api/rest.js'\nimport {outputContent, outputToken, outputDebug} from '../../public/node/output.js'\nimport {firstPartyDev, isAppManagementEnabled, themeToken} from '../../public/node/context/local.js'\nimport {AbortError, BugError} from '../../public/node/error.js'\nimport {partnersRequest} from '../../public/node/api/partners.js'\nimport {normalizeStoreFqdn, partnersFqdn, identityFqdn} from '../../public/node/context/fqdn.js'\nimport {openURL} from '../../public/node/system.js'\nimport {keypress} from '../../public/node/ui.js'\nimport {getIdentityTokenInformation, getPartnersToken} from '../../public/node/environment.js'\nimport {gql} from 'graphql-request'\nimport {AdminSession} from '@shopify/cli-kit/node/session'\nimport {outputCompleted, outputInfo, outputWarn} from '@shopify/cli-kit/node/output'\nimport {isSpin} from '@shopify/cli-kit/node/context/spin'\nimport {nonRandomUUID} from '@shopify/cli-kit/node/crypto'\n\n/**\n * A scope supported by the Shopify Admin API.\n */\nexport type AdminAPIScope = 'graphql' | 'themes' | 'collaborator'\n\n/**\n * It represents the options to authenticate against the Shopify Admin API.\n */\n\ninterface AdminAPIOAuthOptions {\n /** Store to request permissions for. */\n storeFqdn: string\n /** List of scopes to request permissions for. */\n scopes: AdminAPIScope[]\n}\n\n/**\n * A scope supported by the Partners API.\n */\nexport type PartnersAPIScope = 'cli'\ninterface PartnersAPIOAuthOptions {\n /** List of scopes to request permissions for. */\n scopes: PartnersAPIScope[]\n}\n\n/**\n * A scope supported by the Developer Platform API.\n */\nexport type AppManagementAPIScope = 'https://api.shopify.com/auth/organization.apps.manage'\ninterface AppManagementAPIOauthOptions {\n /** List of scopes to request permissions for. */\n scopes: AppManagementAPIScope[]\n}\n\n/**\n * A scope supported by the Storefront Renderer API.\n */\nexport type StorefrontRendererScope = 'devtools'\ninterface StorefrontRendererAPIOAuthOptions {\n /** List of scopes to request permissions for. */\n scopes: StorefrontRendererScope[]\n}\n\nexport type BusinessPlatformScope = 'destinations'\ninterface BusinessPlatformAPIOAuthOptions {\n /** List of scopes to request permissions for. */\n scopes: BusinessPlatformScope[]\n}\n\n/**\n * It represents the authentication requirements and\n * is the input necessary to trigger the authentication\n * flow.\n */\nexport interface OAuthApplications {\n adminApi?: AdminAPIOAuthOptions\n storefrontRendererApi?: StorefrontRendererAPIOAuthOptions\n partnersApi?: PartnersAPIOAuthOptions\n businessPlatformApi?: BusinessPlatformAPIOAuthOptions\n appManagementApi?: AppManagementAPIOauthOptions\n}\n\nexport interface OAuthSession {\n admin?: AdminSession\n partners?: string\n storefront?: string\n businessPlatform?: string\n appManagement?: string\n userId: string\n}\n\ntype AuthMethod = 'partners_token' | 'device_auth' | 'theme_access_token' | 'custom_app_token' | 'none'\n\nlet userId: undefined | string\nlet authMethod: AuthMethod = 'none'\n\n/**\n * Retrieves the user ID from the current session or returns 'unknown' if not found.\n *\n * This function performs the following steps:\n * 1. Checks for a cached user ID in memory (obtained in the current run).\n * 2. Attempts to fetch it from the secure store (from a previous auth session).\n * 3. Checks if a custom token was used (either as a theme password or partners token).\n * 4. If a custom token is present in the environment, generates a UUID and uses it as userId.\n * 5. If after all this we don't have a userId, then reports as 'unknown'.\n *\n * @returns A Promise that resolves to the user ID as a string.\n */\nexport async function getLastSeenUserIdAfterAuth(): Promise<string> {\n if (userId) return userId\n\n const currentSession = (await secureStore.fetch()) || {}\n const fqdn = await identityFqdn()\n const cachedUserId = currentSession[fqdn]?.identity.userId\n if (cachedUserId) return cachedUserId\n\n const customToken = getPartnersToken() ?? themeToken()\n return customToken ? nonRandomUUID(customToken) : 'unknown'\n}\n\nexport function setLastSeenUserIdAfterAuth(id: string) {\n userId = id\n}\n\n/**\n * Retrieves the last seen authentication method used in the current session.\n *\n * This function checks for the authentication method in the following order:\n * 1. Returns the cached auth method if it's not 'none'.\n * 2. Checks for a cached session, which implies 'device_auth' was used.\n * 3. Checks for a partners token in the environment.\n * 4. Checks for a theme password in the environment.\n * 5. If none of the above are true, returns 'none'.\n *\n * @returns A Promise that resolves to the last seen authentication method as an AuthMethod type.\n */\nexport async function getLastSeenAuthMethod(): Promise<AuthMethod> {\n if (authMethod !== 'none') return authMethod\n\n const currentSession = (await secureStore.fetch()) || {}\n const fqdn = await identityFqdn()\n const cachedUserId = currentSession[fqdn]?.identity.userId\n if (cachedUserId) return 'device_auth'\n\n const partnersToken = getPartnersToken()\n if (partnersToken) return 'partners_token'\n\n const themePassword = themeToken()\n if (themePassword) {\n return isThemeAccessSession({token: themePassword, storeFqdn: ''}) ? 'theme_access_token' : 'custom_app_token'\n }\n\n return 'none'\n}\n\nexport function setLastSeenAuthMethod(method: AuthMethod) {\n authMethod = method\n}\n\n/**\n * This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.\n *\n * @param applications - An object containing the applications we need to be authenticated with.\n * @param _env - Optional environment variables to use.\n * @param forceRefresh - Optional flag to force a refresh of the token.\n * @returns An instance with the access tokens organized by application.\n */\nexport async function ensureAuthenticated(\n applications: OAuthApplications,\n _env?: NodeJS.ProcessEnv,\n {forceRefresh = false, noPrompt = false}: {forceRefresh?: boolean; noPrompt?: boolean} = {},\n): Promise<OAuthSession> {\n const fqdn = await identityFqdn()\n\n const previousStoreFqdn = applications.adminApi?.storeFqdn\n if (previousStoreFqdn) {\n const normalizedStoreName = await normalizeStoreFqdn(previousStoreFqdn)\n if (previousStoreFqdn === applications.adminApi?.storeFqdn) {\n applications.adminApi.storeFqdn = normalizedStoreName\n }\n }\n\n const currentSession = (await secureStore.fetch()) || {}\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const fqdnSession = currentSession[fqdn]!\n const scopes = getFlattenScopes(applications)\n\n outputDebug(outputContent`Validating existing session against the scopes:\n${outputToken.json(scopes)}\nFor applications:\n${outputToken.json(applications)}\n`)\n const validationResult = await validateSession(scopes, applications, fqdnSession)\n\n let newSession = {}\n\n function throwOnNoPrompt() {\n if (!noPrompt || (isSpin() && firstPartyDev())) return\n throw new AbortError(\n `The currently available CLI credentials are invalid.\n\nThe CLI is currently unable to prompt for reauthentication.`,\n 'Restart the CLI process you were running. If in an interactive terminal, you will be prompted to reauthenticate. If in a non-interactive terminal, ensure the correct credentials are available in the program environment.',\n )\n }\n\n if (validationResult === 'needs_full_auth') {\n throwOnNoPrompt()\n outputDebug(outputContent`Initiating the full authentication flow...`)\n newSession = await executeCompleteFlow(applications, fqdn)\n } else if (validationResult === 'needs_refresh' || forceRefresh) {\n outputDebug(outputContent`The current session is valid but needs refresh. Refreshing...`)\n try {\n newSession = await refreshTokens(fqdnSession.identity, applications, fqdn)\n } catch (error) {\n if (error instanceof InvalidGrantError) {\n throwOnNoPrompt()\n newSession = await executeCompleteFlow(applications, fqdn)\n } else if (error instanceof InvalidRequestError) {\n await secureStore.remove()\n throw new AbortError('\\nError validating auth session', \"We've cleared the current session, please try again\")\n } else {\n throw error\n }\n }\n }\n\n const completeSession: Session = {...currentSession, ...newSession}\n\n // Save the new session info if it has changed\n if (Object.keys(newSession).length > 0) await secureStore.store(completeSession)\n const tokens = await tokensFor(applications, completeSession, fqdn)\n\n // Overwrite partners token if using a custom CLI Token\n const envToken = getPartnersToken()\n if (envToken && applications.partnersApi) {\n tokens.partners = (await exchangeCustomPartnerToken(envToken)).accessToken\n }\n if (!envToken && tokens.partners) {\n await ensureUserHasPartnerAccount(tokens.partners, tokens.userId)\n }\n\n setLastSeenAuthMethod(envToken ? 'partners_token' : 'device_auth')\n setLastSeenUserIdAfterAuth(tokens.userId)\n return tokens\n}\n\n/**\n * Execute the full authentication flow.\n *\n * @param applications - An object containing the applications we need to be authenticated with.\n * @param identityFqdn - The identity FQDN.\n */\nasync function executeCompleteFlow(applications: OAuthApplications, identityFqdn: string): Promise<Session> {\n const scopes = getFlattenScopes(applications)\n const exchangeScopes = getExchangeScopes(applications)\n const store = applications.adminApi?.storeFqdn\n if (firstPartyDev()) {\n outputDebug(outputContent`Authenticating as Shopify Employee...`)\n scopes.push('employee')\n }\n\n let identityToken: IdentityToken\n const identityTokenInformation = getIdentityTokenInformation()\n if (identityTokenInformation) {\n identityToken = buildIdentityTokenFromEnv(scopes, identityTokenInformation)\n } else {\n // Request a device code to authorize without a browser redirect.\n outputDebug(outputContent`Requesting device authorization code...`)\n const deviceAuth = await requestDeviceAuthorization(scopes)\n\n // Poll for the identity token\n outputDebug(outputContent`Starting polling for the identity token...`)\n identityToken = await pollForDeviceAuthorization(deviceAuth.deviceCode, deviceAuth.interval)\n }\n\n // Exchange identity token for application tokens\n outputDebug(outputContent`CLI token received. Exchanging it for application tokens...`)\n const result = await exchangeAccessForApplicationTokens(identityToken, exchangeScopes, store)\n\n const session: Session = {\n [identityFqdn]: {\n identity: identityToken,\n applications: result,\n },\n }\n\n outputCompleted('Logged in.')\n\n return session\n}\n\n/**\n * If the user creates an account from the Identity website, the created\n * account won't get a Partner organization created. We need to detect that\n * and take the user to create a partner organization.\n *\n * @param partnersToken - Partners token.\n */\nasync function ensureUserHasPartnerAccount(partnersToken: string, userId: string | undefined) {\n if (isAppManagementEnabled()) return\n\n outputDebug(outputContent`Verifying that the user has a Partner organization`)\n if (!(await hasPartnerAccount(partnersToken, userId))) {\n outputInfo(`\\nA Shopify Partners organization is needed to proceed.`)\n outputInfo(`👉 Press any key to create one`)\n await keypress()\n await openURL(`https://${await partnersFqdn()}/signup`)\n outputInfo(outputContent`👉 Press any key when you have ${outputToken.cyan('created the organization')}`)\n outputWarn(outputContent`Make sure you've confirmed your Shopify and the Partner organization from the email`)\n await keypress()\n if (!(await hasPartnerAccount(partnersToken, userId))) {\n throw new AbortError(\n `Couldn't find your Shopify Partners organization`,\n `Have you confirmed your accounts from the emails you received?`,\n )\n }\n }\n}\n\n// eslint-disable-next-line @shopify/cli/no-inline-graphql\nconst getFirstOrganization = gql`\n {\n organizations(first: 1) {\n nodes {\n id\n }\n }\n }\n`\n\n/**\n * Validate if the current token is valid for partners API.\n *\n * @param partnersToken - Partners token.\n * @returns A promise that resolves to true if the token is valid for partners API.\n */\nasync function hasPartnerAccount(partnersToken: string, userId?: string): Promise<boolean> {\n const cacheKey = userId ?? partnersToken\n const cachedStatus = getCachedPartnerAccountStatus(cacheKey)\n\n if (cachedStatus) {\n outputDebug(`Confirmed partner account exists from cache`)\n return true\n }\n\n try {\n await partnersRequest(getFirstOrganization, partnersToken)\n setCachedPartnerAccountStatus(cacheKey)\n return true\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n if (error instanceof RequestClientError && error.statusCode === 404) {\n return false\n } else {\n return true\n }\n }\n}\n\n/**\n * Refresh the tokens for a given session.\n *\n * @param token - Identity token.\n * @param applications - An object containing the applications we need to be authenticated with.\n * @param fqdn - The identity FQDN.\n */\nasync function refreshTokens(token: IdentityToken, applications: OAuthApplications, fqdn: string): Promise<Session> {\n // Refresh Identity Token\n const identityToken = await refreshAccessToken(token)\n // Exchange new identity token for application tokens\n const exchangeScopes = getExchangeScopes(applications)\n const applicationTokens = await exchangeAccessForApplicationTokens(\n identityToken,\n exchangeScopes,\n applications.adminApi?.storeFqdn,\n )\n\n return {\n [fqdn]: {\n identity: identityToken,\n applications: applicationTokens,\n },\n }\n}\n\n/**\n * Get the application tokens for a given session.\n *\n * @param applications - An object containing the applications we need the tokens for.\n * @param session - The current session.\n * @param fqdn - The identity FQDN.\n */\nasync function tokensFor(applications: OAuthApplications, session: Session, fqdn: string): Promise<OAuthSession> {\n const fqdnSession = session[fqdn]\n if (!fqdnSession) {\n throw new BugError('No session found after ensuring authenticated')\n }\n const tokens: OAuthSession = {\n userId: fqdnSession.identity.userId,\n }\n if (applications.adminApi) {\n const appId = applicationId('admin')\n const realAppId = `${applications.adminApi.storeFqdn}-${appId}`\n const token = fqdnSession.applications[realAppId]?.accessToken\n if (token) {\n tokens.admin = {token, storeFqdn: applications.adminApi.storeFqdn}\n }\n }\n\n if (applications.partnersApi) {\n const appId = applicationId('partners')\n tokens.partners = fqdnSession.applications[appId]?.accessToken\n }\n\n if (applications.storefrontRendererApi) {\n const appId = applicationId('storefront-renderer')\n tokens.storefront = fqdnSession.applications[appId]?.accessToken\n }\n\n if (applications.businessPlatformApi) {\n const appId = applicationId('business-platform')\n tokens.businessPlatform = fqdnSession.applications[appId]?.accessToken\n }\n\n if (applications.appManagementApi) {\n const appId = applicationId('app-management')\n tokens.appManagement = fqdnSession.applications[appId]?.accessToken\n }\n\n return tokens\n}\n\n// Scope Helpers\n/**\n * Get a flattened array of scopes for the given applications.\n *\n * @param apps - An object containing the applications we need the scopes for.\n * @returns A flattened array of scopes.\n */\nfunction getFlattenScopes(apps: OAuthApplications): string[] {\n const admin = apps.adminApi?.scopes || []\n const partner = apps.partnersApi?.scopes || []\n const storefront = apps.storefrontRendererApi?.scopes || []\n const businessPlatform = apps.businessPlatformApi?.scopes || []\n const appManagement = apps.appManagementApi?.scopes || []\n const requestedScopes = [...admin, ...partner, ...storefront, ...businessPlatform, ...appManagement]\n return allDefaultScopes(requestedScopes)\n}\n\n/**\n * Get the scopes for the given applications.\n *\n * @param apps - An object containing the applications we need the scopes for.\n * @returns An object containing the scopes for each application.\n */\nfunction getExchangeScopes(apps: OAuthApplications): ExchangeScopes {\n const adminScope = apps.adminApi?.scopes || []\n const partnerScope = apps.partnersApi?.scopes || []\n const storefrontScopes = apps.storefrontRendererApi?.scopes || []\n const businessPlatformScopes = apps.businessPlatformApi?.scopes || []\n const appManagementScopes = apps.appManagementApi?.scopes || []\n return {\n admin: apiScopes('admin', adminScope),\n partners: apiScopes('partners', partnerScope),\n storefront: apiScopes('storefront-renderer', storefrontScopes),\n businessPlatform: apiScopes('business-platform', businessPlatformScopes),\n appManagement: apiScopes('app-management', appManagementScopes),\n }\n}\n\nfunction buildIdentityTokenFromEnv(\n scopes: string[],\n identityTokenInformation: {accessToken: string; refreshToken: string; userId: string},\n) {\n return {\n ...identityTokenInformation,\n expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),\n scopes,\n }\n}\n"]}
@@ -1,7 +1,6 @@
1
1
  import { Alert } from './components/Alert.js';
2
2
  import { renderOnce } from '../ui.js';
3
3
  import { consoleError, consoleLog, consoleWarn } from '../../../public/node/output.js';
4
- import { recordUIEvent } from '../demo-recorder.js';
5
4
  import React from 'react';
6
5
  const typeToLogLevel = {
7
6
  info: 'info',
@@ -17,8 +16,7 @@ const typeToLogger = {
17
16
  };
18
17
  export function alert({ type, headline, body, nextSteps, reference, link, customSections, orderedNextSteps = false, renderOptions, }) {
19
18
  // eslint-disable-next-line prefer-rest-params
20
- const { type: alertType, ...eventProps } = arguments[0];
21
- recordUIEvent({ type, properties: eventProps });
19
+ const { type: alertType, ..._eventProps } = arguments[0];
22
20
  return renderOnce(React.createElement(Alert, { type: type, headline: headline, body: body, nextSteps: nextSteps, reference: reference, link: link, orderedNextSteps: orderedNextSteps, customSections: customSections }), { logLevel: typeToLogLevel[type], logger: typeToLogger[type], renderOptions });
23
21
  }
24
22
  //# sourceMappingURL=alert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../../src/private/node/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EAAC,CAC5E,CAAA;AACH,CAAC","sourcesContent":["import {Alert, AlertProps} from './components/Alert.js'\nimport {renderOnce} from '../ui.js'\nimport {consoleError, consoleLog, consoleWarn, Logger, LogLevel} from '../../../public/node/output.js'\nimport {recordUIEvent} from '../demo-recorder.js'\nimport React from 'react'\nimport {RenderOptions} from 'ink'\n\nconst typeToLogLevel: {[key in AlertProps['type']]: LogLevel} = {\n info: 'info',\n warning: 'warn',\n success: 'info',\n error: 'error',\n}\n\nconst typeToLogger: {[key in AlertProps['type']]: Logger} = {\n info: consoleLog,\n warning: consoleWarn,\n success: consoleLog,\n error: consoleError,\n}\n\nexport interface AlertOptions extends AlertProps {\n renderOptions?: RenderOptions\n}\n\nexport function alert({\n type,\n headline,\n body,\n nextSteps,\n reference,\n link,\n customSections,\n orderedNextSteps = false,\n renderOptions,\n}: AlertOptions) {\n // eslint-disable-next-line prefer-rest-params\n const {type: alertType, ...eventProps} = arguments[0]\n recordUIEvent({type, properties: eventProps})\n\n return renderOnce(\n <Alert\n type={type}\n headline={headline}\n body={body}\n nextSteps={nextSteps}\n reference={reference}\n link={link}\n orderedNextSteps={orderedNextSteps}\n customSections={customSections}\n />,\n {logLevel: typeToLogLevel[type], logger: typeToLogger[type], renderOptions},\n )\n}\n"]}
1
+ {"version":3,"file":"alert.js","sourceRoot":"","sources":["../../../../src/private/node/ui/alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAa,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAA;AACnC,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,WAAW,EAAmB,MAAM,gCAAgC,CAAA;AACtG,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,cAAc,GAA4C;IAC9D,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,OAAO;CACf,CAAA;AAED,MAAM,YAAY,GAA0C;IAC1D,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,YAAY;CACpB,CAAA;AAMD,MAAM,UAAU,KAAK,CAAC,EACpB,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,SAAS,EACT,IAAI,EACJ,cAAc,EACd,gBAAgB,GAAG,KAAK,EACxB,aAAa,GACA;IACb,8CAA8C;IAC9C,MAAM,EAAC,IAAI,EAAE,SAAS,EAAE,GAAG,WAAW,EAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;IAEtD,OAAO,UAAU,CACf,oBAAC,KAAK,IACJ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,gBAAgB,EAClC,cAAc,EAAE,cAAc,GAC9B,EACF,EAAC,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,aAAa,EAAC,CAC5E,CAAA;AACH,CAAC","sourcesContent":["import {Alert, AlertProps} from './components/Alert.js'\nimport {renderOnce} from '../ui.js'\nimport {consoleError, consoleLog, consoleWarn, Logger, LogLevel} from '../../../public/node/output.js'\nimport React from 'react'\nimport {RenderOptions} from 'ink'\n\nconst typeToLogLevel: {[key in AlertProps['type']]: LogLevel} = {\n info: 'info',\n warning: 'warn',\n success: 'info',\n error: 'error',\n}\n\nconst typeToLogger: {[key in AlertProps['type']]: Logger} = {\n info: consoleLog,\n warning: consoleWarn,\n success: consoleLog,\n error: consoleError,\n}\n\nexport interface AlertOptions extends AlertProps {\n renderOptions?: RenderOptions\n}\n\nexport function alert({\n type,\n headline,\n body,\n nextSteps,\n reference,\n link,\n customSections,\n orderedNextSteps = false,\n renderOptions,\n}: AlertOptions) {\n // eslint-disable-next-line prefer-rest-params\n const {type: alertType, ..._eventProps} = arguments[0]\n\n return renderOnce(\n <Alert\n type={type}\n headline={headline}\n body={body}\n nextSteps={nextSteps}\n reference={reference}\n link={link}\n orderedNextSteps={orderedNextSteps}\n customSections={customSections}\n />,\n {logLevel: typeToLogLevel[type], logger: typeToLogger[type], renderOptions},\n )\n}\n"]}
@@ -7,6 +7,7 @@ export interface ConcurrentOutputProps {
7
7
  abortSignal: AbortSignal;
8
8
  showTimestamps?: boolean;
9
9
  keepRunningAfterProcessesResolve?: boolean;
10
+ useAlternativeColorPalette?: boolean;
10
11
  }
11
12
  interface ConcurrentOutputContext {
12
13
  outputPrefix?: string;
@@ -1,4 +1,3 @@
1
- import { addOrUpdateConcurrentUIEventOutput } from '../../demo-recorder.js';
2
1
  import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
2
  import { Box, Static, Text, useApp } from 'ink';
4
3
  import figures from 'figures';
@@ -57,10 +56,12 @@ function useConcurrentOutputContext(context, callback) {
57
56
  *
58
57
  * ```
59
58
  */
60
- const ConcurrentOutput = ({ processes, prefixColumnSize, abortSignal, showTimestamps = true, keepRunningAfterProcessesResolve = false, }) => {
59
+ const ConcurrentOutput = ({ processes, prefixColumnSize, abortSignal, showTimestamps = true, keepRunningAfterProcessesResolve = false, useAlternativeColorPalette = false, }) => {
61
60
  const [processOutput, setProcessOutput] = useState([]);
62
61
  const { exit: unmountInk } = useApp();
63
- const concurrentColors = useMemo(() => ['yellow', 'cyan', 'magenta', 'green', 'blue'], []);
62
+ const concurrentColors = useMemo(() => useAlternativeColorPalette
63
+ ? ['#b994c3', '#e69e19', '#d17a73', 'cyan', 'magenta', 'blue']
64
+ : ['yellow', 'cyan', 'magenta', 'green', 'blue'], [useAlternativeColorPalette]);
64
65
  const calculatedPrefixColumnSize = useMemo(() => {
65
66
  const maxColumnSize = 25;
66
67
  // If the prefixColumnSize is not provided, we calculate it based on the longest process prefix
@@ -90,7 +91,6 @@ const ConcurrentOutput = ({ processes, prefixColumnSize, abortSignal, showTimest
90
91
  const log = chunk.toString('utf8').replace(/(\n)$/, '');
91
92
  const index = addPrefix(prefix, prefixes);
92
93
  const lines = shouldStripAnsi ? stripAnsi(log).split(/\n/) : log.split(/\n/);
93
- addOrUpdateConcurrentUIEventOutput({ prefix, index, output: lines.join('\n') });
94
94
  setProcessOutput((previousProcessOutput) => [
95
95
  ...previousProcessOutput,
96
96
  {
@@ -1 +1 @@
1
- {"version":3,"file":"ConcurrentOutput.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/ConcurrentOutput.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,kCAAkC,EAAC,MAAM,wBAAwB,CAAA;AACzE,OAAO,KAAK,EAAE,EAAoB,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AACzF,OAAO,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAa,MAAM,EAAC,MAAM,KAAK,CAAA;AACxD,OAAO,OAAO,MAAM,SAAS,CAAA;AAC7B,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAC,iBAAiB,EAAC,MAAM,kBAAkB,CAAA;AAgBlD,SAAS,cAAc,CAAC,MAAc;IACpC,IAAI,MAAM,GAAG,EAAE,EAAE;QACf,OAAO,IAAI,MAAM,EAAE,CAAA;KACpB;SAAM;QACL,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAA;KACzB;AACH,CAAC;AAED,SAAS,WAAW;IAClB,MAAM,eAAe,GAAG,IAAI,IAAI,EAAE,CAAA;IAClC,MAAM,KAAK,GAAG,cAAc,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAA;IACxD,MAAM,OAAO,GAAG,cAAc,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,CAAA;IAC5D,MAAM,OAAO,GAAG,cAAc,CAAC,eAAe,CAAC,UAAU,EAAE,CAA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AAE;gBACvB,IAAI,CAAC,gCAAgC,EAAE;oBACrC,UAAU,CAAC,KAA0B,CAAC,CAAA;iBACvC;aACF;QACH,CAAC,CAAA;QAED,mEAAmE;QACnE,YAAY,EAAE,CAAA;IAChB,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,gCAAgC,CAAC,CAAC,CAAA;IAE1F,MAAM,EAAC,YAAY,EAAC,GAAG,OAAO,CAAA;IAE9B,OAAO,CACL,oBAAC,MAAM,IAAC,KAAK,EAAE,aAAa,IACzB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAChB,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,KAAK,IACnC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,KAAK;YAClC,oBAAC,IAAI;gBACF,cAAc,CAAC,CAAC,CAAC,CAChB,oBAAC,IAAI;oBACF,WAAW,EAAE;;oBAAG,YAAY;oBAAE,GAAG,CAC7B,CACR,CAAC,CAAC,CAAC,IAAI;gBACR,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAG,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAQ;gBAC7D,oBAAC,IAAI;oBACF,GAAG;oBACH,YAAY;;oBAAG,IAAI,CACf,CACF,CACH,CACP,CAAC,CACE,CACP,CAAA;IACH,CAAC,CACM,CACV,CAAA;AACH,CAAC,CAAA;AACD,OAAO,EAAC,gBAAgB,EAA2B,0BAA0B,EAAC,CAAA","sourcesContent":["import {OutputProcess} from '../../../../public/node/output.js'\nimport {AbortSignal} from '../../../../public/node/abort.js'\nimport {addOrUpdateConcurrentUIEventOutput} from '../../demo-recorder.js'\nimport React, {FunctionComponent, useCallback, useEffect, useMemo, useState} from 'react'\nimport {Box, Static, Text, TextProps, useApp} from 'ink'\nimport figures from 'figures'\nimport stripAnsi from 'strip-ansi'\nimport {Writable} from 'stream'\nimport {AsyncLocalStorage} from 'node:async_hooks'\n\nexport interface ConcurrentOutputProps {\n processes: OutputProcess[]\n prefixColumnSize?: number\n abortSignal: AbortSignal\n showTimestamps?: boolean\n keepRunningAfterProcessesResolve?: boolean\n}\n\ninterface Chunk {\n color: TextProps['color']\n prefix: string\n lines: string[]\n}\n\nfunction addLeadingZero(number: number) {\n if (number < 10) {\n return `0${number}`\n } else {\n return number.toString()\n }\n}\n\nfunction currentTime() {\n const currentDateTime = new Date()\n const hours = addLeadingZero(currentDateTime.getHours())\n const minutes = addLeadingZero(currentDateTime.getMinutes())\n const seconds = addLeadingZero(currentDateTime.getSeconds())\n return `${hours}:${minutes}:${seconds}`\n}\n\ninterface ConcurrentOutputContext {\n outputPrefix?: string\n stripAnsi?: boolean\n}\n\nconst outputContextStore = new AsyncLocalStorage<ConcurrentOutputContext>()\n\nfunction useConcurrentOutputContext<T>(context: ConcurrentOutputContext, callback: () => T): T {\n return outputContextStore.run(context, callback)\n}\n\n/**\n * Renders output from concurrent processes to the terminal.\n * Output will be divided in a three column layout\n * with the left column containing the timestamp,\n * the right column containing the output,\n * and the middle column containing the process prefix.\n * Every process will be rendered with a different color, up to 4 colors.\n *\n * For example running `shopify app dev`:\n *\n * ```shell\n * 2022-10-10 13:11:03 | backend | npm\n * 2022-10-10 13:11:03 | backend | WARN ignoring workspace config at ...\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | > shopify-app-template-node@0.1.0 dev\n * 2022-10-10 13:11:03 | backend | > cross-env NODE_ENV=development nodemon backend/index.js --watch ./backend\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend | > starter-react-frontend-app@0.1.0 dev\n * 2022-10-10 13:11:03 | frontend | > cross-env NODE_ENV=development node vite-server.js\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | [nodemon] to restart at any time, enter `rs`\n * 2022-10-10 13:11:03 | backend | [nodemon] watching path(s): backend/\n * 2022-10-10 13:11:03 | backend | [nodemon] watching extensions: js,mjs,json\n * 2022-10-10 13:11:03 | backend | [nodemon] starting `node backend/index.js`\n * 2022-10-10 13:11:03 | backend |\n *\n * ```\n */\nconst ConcurrentOutput: FunctionComponent<ConcurrentOutputProps> = ({\n processes,\n prefixColumnSize,\n abortSignal,\n showTimestamps = true,\n keepRunningAfterProcessesResolve = false,\n}) => {\n const [processOutput, setProcessOutput] = useState<Chunk[]>([])\n const {exit: unmountInk} = useApp()\n const concurrentColors: TextProps['color'][] = useMemo(() => ['yellow', 'cyan', 'magenta', 'green', 'blue'], [])\n\n const calculatedPrefixColumnSize = useMemo(() => {\n const maxColumnSize = 25\n\n // If the prefixColumnSize is not provided, we calculate it based on the longest process prefix\n const columnSize =\n prefixColumnSize ??\n processes.reduce((maxPrefixLength, process) => Math.max(maxPrefixLength, process.prefix.length), 0)\n\n // Apply overall limit to the prefix column size\n return Math.min(columnSize, maxColumnSize)\n }, [processes, prefixColumnSize])\n\n const addPrefix = (prefix: string, prefixes: string[]) => {\n const index = prefixes.indexOf(prefix)\n if (index !== -1) {\n return index\n }\n prefixes.push(prefix)\n return prefixes.length - 1\n }\n\n const lineColor = useCallback(\n (index: number) => {\n const colorIndex = index % concurrentColors.length\n return concurrentColors[colorIndex]\n },\n [concurrentColors],\n )\n\n const writableStream = useCallback(\n (process: OutputProcess, prefixes: string[]) => {\n return new Writable({\n write(chunk, _encoding, next) {\n const context = outputContextStore.getStore()\n const prefix = context?.outputPrefix ?? process.prefix\n const shouldStripAnsi = context?.stripAnsi ?? true\n const log = chunk.toString('utf8').replace(/(\\n)$/, '')\n\n const index = addPrefix(prefix, prefixes)\n\n const lines = shouldStripAnsi ? stripAnsi(log).split(/\\n/) : log.split(/\\n/)\n addOrUpdateConcurrentUIEventOutput({prefix, index, output: lines.join('\\n')})\n setProcessOutput((previousProcessOutput) => [\n ...previousProcessOutput,\n {\n color: lineColor(index),\n prefix,\n lines,\n },\n ])\n next()\n },\n })\n },\n [lineColor],\n )\n\n const formatPrefix = (prefix: string) => {\n // Truncate prefix if needed\n if (prefix.length > calculatedPrefixColumnSize) {\n return prefix.substring(0, calculatedPrefixColumnSize)\n }\n\n return `${' '.repeat(calculatedPrefixColumnSize - prefix.length)}${prefix}`\n }\n\n useEffect(() => {\n const runProcesses = async () => {\n const prefixes: string[] = []\n\n try {\n await Promise.all(\n processes.map(async (process) => {\n const stdout = writableStream(process, prefixes)\n const stderr = writableStream(process, prefixes)\n await process.action(stdout, stderr, abortSignal)\n }),\n )\n if (!keepRunningAfterProcessesResolve) {\n unmountInk()\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error: unknown) {\n if (!keepRunningAfterProcessesResolve) {\n unmountInk(error as Error | undefined)\n }\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n runProcesses()\n }, [abortSignal, processes, writableStream, unmountInk, keepRunningAfterProcessesResolve])\n\n const {lineVertical} = figures\n\n return (\n <Static items={processOutput}>\n {(chunk, index) => {\n return (\n <Box flexDirection=\"column\" key={index}>\n {chunk.lines.map((line, index) => (\n <Box key={index} flexDirection=\"row\">\n <Text>\n {showTimestamps ? (\n <Text>\n {currentTime()} {lineVertical}{' '}\n </Text>\n ) : null}\n <Text color={chunk.color}>{formatPrefix(chunk.prefix)}</Text>\n <Text>\n {' '}\n {lineVertical} {line}\n </Text>\n </Text>\n </Box>\n ))}\n </Box>\n )\n }}\n </Static>\n )\n}\nexport {ConcurrentOutput, ConcurrentOutputContext, useConcurrentOutputContext}\n"]}
1
+ {"version":3,"file":"ConcurrentOutput.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/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IACzB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAChB,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,GAAG,EAAE,KAAK,IACnC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,KAAK;YAClC,oBAAC,IAAI;gBACF,cAAc,CAAC,CAAC,CAAC,CAChB,oBAAC,IAAI;oBACF,WAAW,EAAE;;oBAAG,YAAY;oBAAE,GAAG,CAC7B,CACR,CAAC,CAAC,CAAC,IAAI;gBACR,oBAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAG,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAQ;gBAC7D,oBAAC,IAAI;oBACF,GAAG;oBACH,YAAY;;oBAAG,IAAI,CACf,CACF,CACH,CACP,CAAC,CACE,CACP,CAAA;IACH,CAAC,CACM,CACV,CAAA;AACH,CAAC,CAAA;AACD,OAAO,EAAC,gBAAgB,EAA2B,0BAA0B,EAAC,CAAA","sourcesContent":["import {OutputProcess} from '../../../../public/node/output.js'\nimport {AbortSignal} from '../../../../public/node/abort.js'\nimport React, {FunctionComponent, useCallback, useEffect, useMemo, useState} from 'react'\nimport {Box, Static, Text, TextProps, useApp} from 'ink'\nimport figures from 'figures'\nimport stripAnsi from 'strip-ansi'\nimport {Writable} from 'stream'\nimport {AsyncLocalStorage} from 'node:async_hooks'\n\nexport interface ConcurrentOutputProps {\n processes: OutputProcess[]\n prefixColumnSize?: number\n abortSignal: AbortSignal\n showTimestamps?: boolean\n keepRunningAfterProcessesResolve?: boolean\n useAlternativeColorPalette?: boolean\n}\n\ninterface Chunk {\n color: TextProps['color']\n prefix: string\n lines: string[]\n}\n\nfunction addLeadingZero(number: number) {\n if (number < 10) {\n return `0${number}`\n } else {\n return number.toString()\n }\n}\n\nfunction currentTime() {\n const currentDateTime = new Date()\n const hours = addLeadingZero(currentDateTime.getHours())\n const minutes = addLeadingZero(currentDateTime.getMinutes())\n const seconds = addLeadingZero(currentDateTime.getSeconds())\n return `${hours}:${minutes}:${seconds}`\n}\n\ninterface ConcurrentOutputContext {\n outputPrefix?: string\n stripAnsi?: boolean\n}\n\nconst outputContextStore = new AsyncLocalStorage<ConcurrentOutputContext>()\n\nfunction useConcurrentOutputContext<T>(context: ConcurrentOutputContext, callback: () => T): T {\n return outputContextStore.run(context, callback)\n}\n\n/**\n * Renders output from concurrent processes to the terminal.\n * Output will be divided in a three column layout\n * with the left column containing the timestamp,\n * the right column containing the output,\n * and the middle column containing the process prefix.\n * Every process will be rendered with a different color, up to 4 colors.\n *\n * For example running `shopify app dev`:\n *\n * ```shell\n * 2022-10-10 13:11:03 | backend | npm\n * 2022-10-10 13:11:03 | backend | WARN ignoring workspace config at ...\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | > shopify-app-template-node@0.1.0 dev\n * 2022-10-10 13:11:03 | backend | > cross-env NODE_ENV=development nodemon backend/index.js --watch ./backend\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend | > starter-react-frontend-app@0.1.0 dev\n * 2022-10-10 13:11:03 | frontend | > cross-env NODE_ENV=development node vite-server.js\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | frontend |\n * 2022-10-10 13:11:03 | backend |\n * 2022-10-10 13:11:03 | backend | [nodemon] to restart at any time, enter `rs`\n * 2022-10-10 13:11:03 | backend | [nodemon] watching path(s): backend/\n * 2022-10-10 13:11:03 | backend | [nodemon] watching extensions: js,mjs,json\n * 2022-10-10 13:11:03 | backend | [nodemon] starting `node backend/index.js`\n * 2022-10-10 13:11:03 | backend |\n *\n * ```\n */\nconst ConcurrentOutput: FunctionComponent<ConcurrentOutputProps> = ({\n processes,\n prefixColumnSize,\n abortSignal,\n showTimestamps = true,\n keepRunningAfterProcessesResolve = false,\n useAlternativeColorPalette = false,\n}) => {\n const [processOutput, setProcessOutput] = useState<Chunk[]>([])\n const {exit: unmountInk} = useApp()\n const concurrentColors: TextProps['color'][] = useMemo(\n () =>\n useAlternativeColorPalette\n ? ['#b994c3', '#e69e19', '#d17a73', 'cyan', 'magenta', 'blue']\n : ['yellow', 'cyan', 'magenta', 'green', 'blue'],\n [useAlternativeColorPalette],\n )\n\n const calculatedPrefixColumnSize = useMemo(() => {\n const maxColumnSize = 25\n\n // If the prefixColumnSize is not provided, we calculate it based on the longest process prefix\n const columnSize =\n prefixColumnSize ??\n processes.reduce((maxPrefixLength, process) => Math.max(maxPrefixLength, process.prefix.length), 0)\n\n // Apply overall limit to the prefix column size\n return Math.min(columnSize, maxColumnSize)\n }, [processes, prefixColumnSize])\n\n const addPrefix = (prefix: string, prefixes: string[]) => {\n const index = prefixes.indexOf(prefix)\n if (index !== -1) {\n return index\n }\n prefixes.push(prefix)\n return prefixes.length - 1\n }\n\n const lineColor = useCallback(\n (index: number) => {\n const colorIndex = index % concurrentColors.length\n return concurrentColors[colorIndex]\n },\n [concurrentColors],\n )\n\n const writableStream = useCallback(\n (process: OutputProcess, prefixes: string[]) => {\n return new Writable({\n write(chunk, _encoding, next) {\n const context = outputContextStore.getStore()\n const prefix = context?.outputPrefix ?? process.prefix\n const shouldStripAnsi = context?.stripAnsi ?? true\n const log = chunk.toString('utf8').replace(/(\\n)$/, '')\n\n const index = addPrefix(prefix, prefixes)\n\n const lines = shouldStripAnsi ? stripAnsi(log).split(/\\n/) : log.split(/\\n/)\n setProcessOutput((previousProcessOutput) => [\n ...previousProcessOutput,\n {\n color: lineColor(index),\n prefix,\n lines,\n },\n ])\n next()\n },\n })\n },\n [lineColor],\n )\n\n const formatPrefix = (prefix: string) => {\n // Truncate prefix if needed\n if (prefix.length > calculatedPrefixColumnSize) {\n return prefix.substring(0, calculatedPrefixColumnSize)\n }\n\n return `${' '.repeat(calculatedPrefixColumnSize - prefix.length)}${prefix}`\n }\n\n useEffect(() => {\n const runProcesses = async () => {\n const prefixes: string[] = []\n\n try {\n await Promise.all(\n processes.map(async (process) => {\n const stdout = writableStream(process, prefixes)\n const stderr = writableStream(process, prefixes)\n await process.action(stdout, stderr, abortSignal)\n }),\n )\n if (!keepRunningAfterProcessesResolve) {\n unmountInk()\n }\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error: unknown) {\n if (!keepRunningAfterProcessesResolve) {\n unmountInk(error as Error | undefined)\n }\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n runProcesses()\n }, [abortSignal, processes, writableStream, unmountInk, keepRunningAfterProcessesResolve])\n\n const {lineVertical} = figures\n\n return (\n <Static items={processOutput}>\n {(chunk, index) => {\n return (\n <Box flexDirection=\"column\" key={index}>\n {chunk.lines.map((line, index) => (\n <Box key={index} flexDirection=\"row\">\n <Text>\n {showTimestamps ? (\n <Text>\n {currentTime()} {lineVertical}{' '}\n </Text>\n ) : null}\n <Text color={chunk.color}>{formatPrefix(chunk.prefix)}</Text>\n <Text>\n {' '}\n {lineVertical} {line}\n </Text>\n </Text>\n </Box>\n ))}\n </Box>\n )\n }}\n </Static>\n )\n}\nexport {ConcurrentOutput, ConcurrentOutputContext, useConcurrentOutputContext}\n"]}
@@ -6,6 +6,9 @@ import supportsHyperlinks from 'supports-hyperlinks';
6
6
  import chalk from 'chalk';
7
7
  function link(label, url, linksContext) {
8
8
  if (!supportsHyperlinks.stdout) {
9
+ if (url === (label ?? url)) {
10
+ return url;
11
+ }
9
12
  if (linksContext === null) {
10
13
  return label ? `${label} ${chalk.dim(`( ${url} )`)}` : url;
11
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAoC,MAAM,6BAA6B,CAAA;AAC3F,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,EAAoB,UAAU,EAAC,MAAM,OAAO,CAAA;AAC1D,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,kBAAkB,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,SAAS,IAAI,CAAC,KAAyB,EAAE,GAAW,EAAE,YAAsC;IAC1F,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QAC9B,IAAI,YAAY,KAAK,IAAI,EAAE;YACzB,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;SAC3D;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QAC/C,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,MAAM,GAAG,CAAA;KACrC;IAED,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAA;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,IAAI,GAAiC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAe,EAAE;IACvE,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;IAE7C,OAAO,oBAAC,IAAI,QAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAQ,CAAA;AACtD,CAAC,CAAA;AAED,OAAO,EAAC,IAAI,EAAC,CAAA","sourcesContent":["import {LinksContext, ContextValue as LinksContextValue} from '../contexts/LinksContext.js'\nimport {Text} from 'ink'\nimport React, {FunctionComponent, useContext} from 'react'\nimport ansiEscapes from 'ansi-escapes'\nimport supportsHyperlinks from 'supports-hyperlinks'\nimport chalk from 'chalk'\n\ninterface LinkProps {\n url: string\n label?: string\n}\n\nfunction link(label: string | undefined, url: string, linksContext: LinksContextValue | null) {\n if (!supportsHyperlinks.stdout) {\n if (linksContext === null) {\n return label ? `${label} ${chalk.dim(`( ${url} )`)}` : url\n }\n\n const linkId = linksContext.addLink(label, url)\n return `${label ?? url} [${linkId}]`\n }\n\n return ansiEscapes.link(label ?? url, url)\n}\n\n/**\n * `Link` displays a clickable link when supported by the terminal.\n */\nconst Link: FunctionComponent<LinkProps> = ({label, url}): JSX.Element => {\n const linksContext = useContext(LinksContext)\n\n return <Text>{link(label, url, linksContext)}</Text>\n}\n\nexport {Link}\n"]}
1
+ {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAoC,MAAM,6BAA6B,CAAA;AAC3F,OAAO,EAAC,IAAI,EAAC,MAAM,KAAK,CAAA;AACxB,OAAO,KAAK,EAAE,EAAoB,UAAU,EAAC,MAAM,OAAO,CAAA;AAC1D,OAAO,WAAW,MAAM,cAAc,CAAA;AACtC,OAAO,kBAAkB,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,SAAS,IAAI,CAAC,KAAyB,EAAE,GAAW,EAAE,YAAsC;IAC1F,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE;QAC9B,IAAI,GAAG,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,EAAE;YAC1B,OAAO,GAAG,CAAA;SACX;QAED,IAAI,YAAY,KAAK,IAAI,EAAE;YACzB,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAA;SAC3D;QAED,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;QAC/C,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,MAAM,GAAG,CAAA;KACrC;IAED,OAAO,WAAW,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,CAAC,CAAA;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,IAAI,GAAiC,CAAC,EAAC,KAAK,EAAE,GAAG,EAAC,EAAe,EAAE;IACvE,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAA;IAE7C,OAAO,oBAAC,IAAI,QAAE,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,CAAQ,CAAA;AACtD,CAAC,CAAA;AAED,OAAO,EAAC,IAAI,EAAC,CAAA","sourcesContent":["import {LinksContext, ContextValue as LinksContextValue} from '../contexts/LinksContext.js'\nimport {Text} from 'ink'\nimport React, {FunctionComponent, useContext} from 'react'\nimport ansiEscapes from 'ansi-escapes'\nimport supportsHyperlinks from 'supports-hyperlinks'\nimport chalk from 'chalk'\n\ninterface LinkProps {\n url: string\n label?: string\n}\n\nfunction link(label: string | undefined, url: string, linksContext: LinksContextValue | null) {\n if (!supportsHyperlinks.stdout) {\n if (url === (label ?? url)) {\n return url\n }\n\n if (linksContext === null) {\n return label ? `${label} ${chalk.dim(`( ${url} )`)}` : url\n }\n\n const linkId = linksContext.addLink(label, url)\n return `${label ?? url} [${linkId}]`\n }\n\n return ansiEscapes.link(label ?? url, url)\n}\n\n/**\n * `Link` displays a clickable link when supported by the terminal.\n */\nconst Link: FunctionComponent<LinkProps> = ({label, url}): JSX.Element => {\n const linksContext = useContext(LinksContext)\n\n return <Text>{link(label, url, linksContext)}</Text>\n}\n\nexport {Link}\n"]}
@@ -51,6 +51,29 @@ describe('Link', async () => {
51
51
  // Then
52
52
  expect(lastFrame()).toMatchInlineSnapshot(`"${asLink('https://example.com')}"`);
53
53
  });
54
+ test("it renders the link as plain text when the terminal doesn't support hyperlinks and the link URL is the same as the label", async () => {
55
+ // Given
56
+ supportHyperLinks(false);
57
+ const link = {
58
+ url: 'https://example.com',
59
+ label: 'https://example.com',
60
+ };
61
+ // When
62
+ const { lastFrame } = render(React.createElement(Link, { ...link }));
63
+ // Then
64
+ expect(lastFrame()).toMatchInlineSnapshot('"https://example.com"');
65
+ });
66
+ test("it renders the link as plain text when the terminal doesn't support hyperlinks and no label is passed", async () => {
67
+ // Given
68
+ supportHyperLinks(false);
69
+ const link = {
70
+ url: 'https://example.com',
71
+ };
72
+ // When
73
+ const { lastFrame } = render(React.createElement(Link, { ...link }));
74
+ // Then
75
+ expect(lastFrame()).toMatchInlineSnapshot('"https://example.com"');
76
+ });
54
77
  function supportHyperLinks(isSupported) {
55
78
  vi.mocked(supportsHyperlinks).stdout = isSupported;
56
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Link.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Link.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AACjD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,kBAAkB,MAAM,qBAAqB,CAAA;AAEpD,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;AAE9B,QAAQ,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;IAC1B,IAAI,CAAC,+EAA+E,EAAE,KAAK,IAAI,EAAE;QAC/F,QAAQ;QACR,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAExB,MAAM,IAAI,GAAG;YACX,GAAG,EAAE,qBAAqB;YAC1B,KAAK,EAAE,SAAS;SACjB,CAAA;QAED,OAAO;QACP,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,IAAI,OAAK,IAAI,GAAI,CAAC,CAAA;QAE9C,OAAO;QACP,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,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AC,qBAAqB,CAAC,GAAG,CAAC,CAAA;IACjF,CAAC,CAAC,CAAA;IAEF,SAAS,iBAAiB,CAAC,WAAoB;QAC7C,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,MAAM,GAAG,WAAW,CAAA;IACpD,CAAC;IAED,SAAS,MAAM,CAAC,GAAW,EAAE,KAAc;QACzC,OAAO,aAAa,GAAG,SAAS,KAAK,IAAI,GAAG,kBAAkB,CAAA;IAChE,CAAC;AACH,CAAC,CAAC,CAAA","sourcesContent":["import {Link} from './Link.js'\nimport {render} from '../../testing/ui.js'\nimport {describe, expect, test, vi} from 'vitest'\nimport React from 'react'\nimport supportsHyperlinks from 'supports-hyperlinks'\n\nvi.mock('supports-hyperlinks')\n\ndescribe('Link', async () => {\n test(\"renders correctly with a fallback for terminals that don't support hyperlinks\", async () => {\n // Given\n supportHyperLinks(false)\n\n const link = {\n url: 'https://example.com',\n label: 'Example',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot('\"Example \u001b[2m( https://example.com )\u001b[22m\"')\n })\n\n test('renders correctly with a fallback for terminals support hyperlinks', async () => {\n // Given\n supportHyperLinks(true)\n\n const link = {\n url: 'https://example.com',\n label: 'Example',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot(`\"${asLink('https://example.com', 'Example')}\"`)\n })\n\n test(\"it doesn't render a fallback if only url is passed and the terminal doesn't support hyperlinks\", async () => {\n // Given\n supportHyperLinks(false)\n\n const link = {\n url: 'https://example.com',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot('\"https://example.com\"')\n })\n\n test(\"it doesn't render a fallback if only url is passed and the terminal supports hyperlinks\", async () => {\n // Given\n supportHyperLinks(true)\n\n const link = {\n url: 'https://example.com',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot(`\"${asLink('https://example.com')}\"`)\n })\n\n function supportHyperLinks(isSupported: boolean) {\n vi.mocked(supportsHyperlinks).stdout = isSupported\n }\n\n function asLink(url: string, label?: string) {\n return `\\u001b]8;;${url}\\u0007${label ?? url}\\u001b]8;;\\u0007`\n }\n})\n"]}
1
+ {"version":3,"file":"Link.test.js","sourceRoot":"","sources":["../../../../../src/private/node/ui/components/Link.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,MAAM,QAAQ,CAAA;AACjD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,kBAAkB,MAAM,qBAAqB,CAAA;AAEpD,EAAE,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;AAE9B,QAAQ,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;IAC1B,IAAI,CAAC,+EAA+E,EAAE,KAAK,IAAI,EAAE;QAC/F,QAAQ;QACR,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAExB,MAAM,IAAI,GAAG;YACX,GAAG,EAAE,qBAAqB;YAC1B,KAAK,EAAE,SAAS;SACjB,CAAA;QAED,OAAO;QACP,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,IAAI,OAAK,IAAI,GAAI,CAAC,CAAA;QAE9C,OAAO;QACP,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC,4CAA4C,CAAC,CAAA;IACzF,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,oEAAoE,EAAE,KAAK,IAAI,EAAE;QACpF,QAAQ;QACR,iBAAiB,CAAC,IAAI,CAAC,CAAA;QAEvB,MAAM,IAAI,GAAG;YACX,GAAG,EAAE,qBAAqB;YAC1B,KAAK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K,EAAE,qBAAqB;SAC7B,CAAA;QAED,OAAO;QACP,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,IAAI,OAAK,IAAI,GAAI,CAAC,CAAA;QAE9C,OAAO;QACP,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAA;IACpE,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,uGAAuG,EAAE,KAAK,IAAI,EAAE;QACvH,QAAQ;QACR,iBAAiB,CAAC,KAAK,CAAC,CAAA;QAExB,MAAM,IAAI,GAAG;YACX,GAAG,EAAE,qBAAqB;SAC3B,CAAA;QAED,OAAO;QACP,MAAM,EAAC,SAAS,EAAC,GAAG,MAAM,CAAC,oBAAC,IAAI,OAAK,IAAI,GAAI,CAAC,CAAA;QAE9C,OAAO;QACP,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,qBAAqB,CAAC,uBAAuB,CAAC,CAAA;IACpE,CAAC,CAAC,CAAA;IAEF,SAAS,iBAAiB,CAAC,WAAoB;QAC7C,EAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,MAAM,GAAG,WAAW,CAAA;IACpD,CAAC;IAED,SAAS,MAAM,CAAC,GAAW,EAAE,KAAc;QACzC,OAAO,aAAa,GAAG,SAAS,KAAK,IAAI,GAAG,kBAAkB,CAAA;IAChE,CAAC;AACH,CAAC,CAAC,CAAA","sourcesContent":["import {Link} from './Link.js'\nimport {render} from '../../testing/ui.js'\nimport {describe, expect, test, vi} from 'vitest'\nimport React from 'react'\nimport supportsHyperlinks from 'supports-hyperlinks'\n\nvi.mock('supports-hyperlinks')\n\ndescribe('Link', async () => {\n test(\"renders correctly with a fallback for terminals that don't support hyperlinks\", async () => {\n // Given\n supportHyperLinks(false)\n\n const link = {\n url: 'https://example.com',\n label: 'Example',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot('\"Example \u001b[2m( https://example.com )\u001b[22m\"')\n })\n\n test('renders correctly with a fallback for terminals support hyperlinks', async () => {\n // Given\n supportHyperLinks(true)\n\n const link = {\n url: 'https://example.com',\n label: 'Example',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot(`\"${asLink('https://example.com', 'Example')}\"`)\n })\n\n test(\"it doesn't render a fallback if only url is passed and the terminal doesn't support hyperlinks\", async () => {\n // Given\n supportHyperLinks(false)\n\n const link = {\n url: 'https://example.com',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot('\"https://example.com\"')\n })\n\n test(\"it doesn't render a fallback if only url is passed and the terminal supports hyperlinks\", async () => {\n // Given\n supportHyperLinks(true)\n\n const link = {\n url: 'https://example.com',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot(`\"${asLink('https://example.com')}\"`)\n })\n\n test(\"it renders the link as plain text when the terminal doesn't support hyperlinks and the link URL is the same as the label\", async () => {\n // Given\n supportHyperLinks(false)\n\n const link = {\n url: 'https://example.com',\n label: 'https://example.com',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot('\"https://example.com\"')\n })\n\n test(\"it renders the link as plain text when the terminal doesn't support hyperlinks and no label is passed\", async () => {\n // Given\n supportHyperLinks(false)\n\n const link = {\n url: 'https://example.com',\n }\n\n // When\n const {lastFrame} = render(<Link {...link} />)\n\n // Then\n expect(lastFrame()).toMatchInlineSnapshot('\"https://example.com\"')\n })\n\n function supportHyperLinks(isSupported: boolean) {\n vi.mocked(supportsHyperlinks).stdout = isSupported\n }\n\n function asLink(url: string, label?: string) {\n return `\\u001b]8;;${url}\\u0007${label ?? url}\\u001b]8;;\\u0007`\n }\n})\n"]}
@@ -8,7 +8,7 @@ export function renderOnce(element, { logLevel = 'info', logger = consoleLog, re
8
8
  if (output) {
9
9
  if (isUnitTest())
10
10
  collectLog(logLevel, output);
11
- outputWhereAppropriate(logLevel, logger, output, { skipUIEvent: true });
11
+ outputWhereAppropriate(logLevel, logger, output);
12
12
  }
13
13
  unmount();
14
14
  return output;
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/private/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,UAAU,EAAoB,sBAAsB,EAAC,MAAM,6BAA6B,CAAA;AAC5G,OAAO,EAAC,UAAU,EAAC,MAAM,oCAAoC,CAAA;AAC7D,OAAO,EAAC,QAAQ,EAAC,MAAM,gCAAgC,CAAA;AAEvD,OAAO,EAAM,MAAM,IAAI,SAAS,EAAgB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAQnC,MAAM,UAAU,UAAU,CACxB,OAAoB,EACpB,EAAC,QAAQ,GAAG,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,aAAa,EAAoB;IAE1E,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IAE9D,IAAI,MAAM,EAAE;QACV,IAAI,UAAU,EAAE;YAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC9C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,EAAC,WAAW,EAAE,IAAI,EAAC,CAAC,CAAA;KACtE;IAED,OAAO,EAAE,CAAA;IAET,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAoB,EAAE,OAAuB;IACxE,MAAM,EAAC,aAAa,EAAC,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,MAAM,aAAa,EAAE,CAAA;IACrB,4FAA4F;IAC5F,OAAO,IAAI,OAAO,CAAC,CAAC,OAA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AAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AACjC,CAAC;IAED,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE;QAC7B,gEAAgE;QAChE,IAAI,EAAE,CAAA;KACP;AACH,CAAC","sourcesContent":["import {collectLog, consoleLog, Logger, LogLevel, outputWhereAppropriate} from '../../public/node/output.js'\nimport {isUnitTest} from '../../public/node/context/local.js'\nimport {treeKill} from '../../public/node/tree-kill.js'\nimport {ReactElement} from 'react'\nimport {Key, render as inkRender, RenderOptions} from 'ink'\nimport {EventEmitter} from 'events'\n\ninterface RenderOnceOptions {\n logLevel?: LogLevel\n logger?: Logger\n renderOptions?: RenderOptions\n}\n\nexport function renderOnce(\n element: JSX.Element,\n {logLevel = 'info', logger = consoleLog, renderOptions}: RenderOnceOptions,\n) {\n const {output, unmount} = renderString(element, renderOptions)\n\n if (output) {\n if (isUnitTest()) collectLog(logLevel, output)\n outputWhereAppropriate(logLevel, logger, output, {skipUIEvent: true})\n }\n\n unmount()\n\n return output\n}\n\nexport async function render(element: JSX.Element, options?: RenderOptions) {\n const {waitUntilExit} = inkRender(element, options)\n await waitUntilExit()\n // We need to wait for other pending tasks -- unmounting of the ink component -- to complete\n return new Promise((resolve) => setImmediate(resolve))\n}\n\ninterface Instance {\n output: string | undefined\n unmount: () => void\n}\n\nexport class Stdout extends EventEmitter {\n columns: number\n rows: number\n readonly frames: string[] = []\n private _lastFrame?: string\n\n constructor(options: {columns?: number; rows?: number}) {\n super()\n this.columns = options.columns ?? 80\n this.rows = options.rows ?? 80\n }\n\n write = (frame: string) => {\n this.frames.push(frame)\n this._lastFrame = frame\n }\n\n lastFrame = () => {\n return this._lastFrame\n }\n}\n\nconst renderString = (element: ReactElement, renderOptions?: RenderOptions): Instance => {\n const columns = isUnitTest() ? 80 : process.stdout.columns\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const stdout = (renderOptions?.stdout as any) ?? new Stdout({columns})\n\n const instance = inkRender(element, {\n stdout,\n debug: true,\n exitOnCtrlC: false,\n patchConsole: false,\n })\n\n return {\n output: stdout.lastFrame(),\n unmount: instance.unmount,\n }\n}\n\nexport function handleCtrlC(\n input: string,\n key: Key,\n exit = () => {\n treeKill(process.pid, 'SIGINT')\n },\n) {\n if (input === 'c' && key.ctrl) {\n // Exceptions thrown in hooks aren't caught by our errorHandler.\n exit()\n }\n}\n"]}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/private/node/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,UAAU,EAAoB,sBAAsB,EAAC,MAAM,6BAA6B,CAAA;AAC5G,OAAO,EAAC,UAAU,EAAC,MAAM,oCAAoC,CAAA;AAC7D,OAAO,EAAC,QAAQ,EAAC,MAAM,gCAAgC,CAAA;AAEvD,OAAO,EAAM,MAAM,IAAI,SAAS,EAAgB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAQnC,MAAM,UAAU,UAAU,CACxB,OAAoB,EACpB,EAAC,QAAQ,GAAG,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,aAAa,EAAoB;IAE1E,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;IAE9D,IAAI,MAAM,EAAE;QACV,IAAI,UAAU,EAAE;YAAE,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QAC9C,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;KACjD;IAED,OAAO,EAAE,CAAA;IAET,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,OAAoB,EAAE,OAAuB;IACxE,MAAM,EAAC,aAAa,EAAC,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACnD,MAAM,aAAa,EAAE,CAAA;IACrB,4FAA4F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AAI,GAAG,GAAG,EAAE;IACV,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AACjC,CAAC;IAED,IAAI,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE;QAC7B,gEAAgE;QAChE,IAAI,EAAE,CAAA;KACP;AACH,CAAC","sourcesContent":["import {collectLog, consoleLog, Logger, LogLevel, outputWhereAppropriate} from '../../public/node/output.js'\nimport {isUnitTest} from '../../public/node/context/local.js'\nimport {treeKill} from '../../public/node/tree-kill.js'\nimport {ReactElement} from 'react'\nimport {Key, render as inkRender, RenderOptions} from 'ink'\nimport {EventEmitter} from 'events'\n\ninterface RenderOnceOptions {\n logLevel?: LogLevel\n logger?: Logger\n renderOptions?: RenderOptions\n}\n\nexport function renderOnce(\n element: JSX.Element,\n {logLevel = 'info', logger = consoleLog, renderOptions}: RenderOnceOptions,\n) {\n const {output, unmount} = renderString(element, renderOptions)\n\n if (output) {\n if (isUnitTest()) collectLog(logLevel, output)\n outputWhereAppropriate(logLevel, logger, output)\n }\n\n unmount()\n\n return output\n}\n\nexport async function render(element: JSX.Element, options?: RenderOptions) {\n const {waitUntilExit} = inkRender(element, options)\n await waitUntilExit()\n // We need to wait for other pending tasks -- unmounting of the ink component -- to complete\n return new Promise((resolve) => setImmediate(resolve))\n}\n\ninterface Instance {\n output: string | undefined\n unmount: () => void\n}\n\nexport class Stdout extends EventEmitter {\n columns: number\n rows: number\n readonly frames: string[] = []\n private _lastFrame?: string\n\n constructor(options: {columns?: number; rows?: number}) {\n super()\n this.columns = options.columns ?? 80\n this.rows = options.rows ?? 80\n }\n\n write = (frame: string) => {\n this.frames.push(frame)\n this._lastFrame = frame\n }\n\n lastFrame = () => {\n return this._lastFrame\n }\n}\n\nconst renderString = (element: ReactElement, renderOptions?: RenderOptions): Instance => {\n const columns = isUnitTest() ? 80 : process.stdout.columns\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const stdout = (renderOptions?.stdout as any) ?? new Stdout({columns})\n\n const instance = inkRender(element, {\n stdout,\n debug: true,\n exitOnCtrlC: false,\n patchConsole: false,\n })\n\n return {\n output: stdout.lastFrame(),\n unmount: instance.unmount,\n }\n}\n\nexport function handleCtrlC(\n input: string,\n key: Key,\n exit = () => {\n treeKill(process.pid, 'SIGINT')\n },\n) {\n if (input === 'c' && key.ctrl) {\n // Exceptions thrown in hooks aren't caught by our errorHandler.\n exit()\n }\n}\n"]}
@@ -1 +1 @@
1
- export declare const CLI_KIT_VERSION = "3.69.4";
1
+ export declare const CLI_KIT_VERSION = "3.71.0";
@@ -1,2 +1,2 @@
1
- export const CLI_KIT_VERSION = '3.69.4';
1
+ export const CLI_KIT_VERSION = '3.71.0';
2
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.69.4'\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/public/common/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,QAAQ,CAAA","sourcesContent":["export const CLI_KIT_VERSION = '3.71.0'\n"]}
@@ -1,4 +1,3 @@
1
- import { version as rubyVersion } from './ruby.js';
2
1
  import { alwaysLogAnalytics, alwaysLogMetrics, analyticsDisabled, isShopify } from './context/local.js';
3
2
  import * as metadata from './metadata.js';
4
3
  import { publishMonorailEvent, MONORAIL_COMMAND_TOPIC } from './monorail.js';
@@ -109,7 +108,7 @@ async function buildPayload({ config, errorMessage, exitMode }) {
109
108
  total_time: wallClockElapsed,
110
109
  success: exitMode === 'ok' && errorMessage === undefined,
111
110
  cli_version: CLI_KIT_VERSION,
112
- ruby_version: (await rubyVersion()) || '',
111
+ ruby_version: '',
113
112
  node_version: process.version.replace('v', ''),
114
113
  is_employee: await isShopify(),
115
114
  ...environmentData,
@@ -1 +1 @@
1
- {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/public/node/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,IAAI,WAAW,EAAC,MAAM,WAAW,CAAA;AAChD,OAAO,EAAC,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAA;AACrG,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AAExC,OAAO,EAAC,aAAa,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,6BAA6B,CAAA;AACnF,OAAO,EAAC,kBAAkB,EAAE,2BAA2B,EAAC,MAAM,iCAAiC,CAAA;AAC/F,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAC,aAAa,EAAC,MAAM,oCAAoC,CAAA;AAChE,OAAO,EAAC,gBAAgB,EAAC,MAAM,kCAAkC,CAAA;AACjE,OAAO,EAAC,kBAAkB,EAAC,MAAM,iCAAiC,CAAA;AAClE,OAAO,EAAC,0BAA0B,EAAC,MAAM,+BAA+B,CAAA;AAiBxE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAoC;IAC7E,IAAI;QACF,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAA;QAC3C,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,iBAAiB;YACjB,OAAM;SACP;QAED,IAAI,eAAe,GAAG,KAAK,CAAA;QAC3B,MAAM,gBAAgB,CAAC;YACrB,GAAG,EAAE,wBAAwB;YAC7B,GAAG,kBAAkB;YACrB,IAAI,EAAE,KAAK,IAAI,EAAE;gBACf,eAAe,GAAG,IAAI,CAAA;YACxB,CAAC;SACF,CAAC,CAAA;QACF,I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,aAAa,EAAE,YAAY;YAC3B,GAAG,wBAAwB;YAC3B,GAAG,wBAAwB;YAC3B,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC;gBACvB,GAAG,iBAAiB;gBACpB,WAAW,EAAE;oBACX,GAAG,qBAAqB;iBACzB;gBACD,cAAc,EAAE,EAAC,GAAG,wBAAwB,EAAC;aAC9C,CAAC;SACH;KACF,CAAA;IAED,4BAA4B;IAC5B,MAAM,aAAa,GAAG,CAAC,0BAA0B,EAAE,2BAA2B,EAAE,2BAA2B,CAAU,CAAA;IACrH,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QACtC,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;SAC7C;IACH,CAAC,CAAC,CAAA;IAEF,kGAAkG;IAClG,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAE7C,OAAO,eAAe,CAAC,OAAO,CAAC,CAAA;AACjC,CAAC;AAED,SAAS,eAAe,CAAI,OAAU;IACpC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAC7C,iDAAiD;IACjD,MAAM,sBAAsB,GAAG,aAAa,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IAC5E,OAAO,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import {version as rubyVersion} from './ruby.js'\nimport {alwaysLogAnalytics, alwaysLogMetrics, analyticsDisabled, isShopify} from './context/local.js'\nimport * as metadata from './metadata.js'\nimport {publishMonorailEvent, MONORAIL_COMMAND_TOPIC} from './monorail.js'\nimport {fanoutHooks} from './plugins.js'\n\nimport {outputContent, outputDebug, outputToken} from '../../public/node/output.js'\nimport {getEnvironmentData, getSensitiveEnvironmentData} from '../../private/node/analytics.js'\nimport {CLI_KIT_VERSION} from '../common/version.js'\nimport {recordMetrics} from '../../private/node/otel-metrics.js'\nimport {runWithRateLimit} from '../../private/node/conf-store.js'\nimport {reportingRateLimit} from '../../private/node/constants.js'\nimport {getLastSeenUserIdAfterAuth} from '../../private/node/session.js'\nimport {Interfaces} from '@oclif/core'\n\nexport type CommandExitMode =\n // The command completed successfully\n | 'ok'\n // The command exited for some unexpected reason -- i.e. a bug\n | 'unexpected_error'\n // The command exited with an error, but its one we expect and doesn't point to a bug -- i.e. malformed config files\n | 'expected_error'\n\ninterface ReportAnalyticsEventOptions {\n config: Interfaces.Config\n errorMessage?: string\n exitMode: CommandExitMode\n}\n\n/**\n * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.\n *\n * The payload for an event includes both generic data, and data gathered from installed plug-ins.\n *\n */\nexport async function reportAnalyticsEvent(options: ReportAnalyticsEventOptions): Promise<void> {\n try {\n const payload = await buildPayload(options)\n if (payload === undefined) {\n // Nothing to log\n return\n }\n\n let withinRateLimit = false\n await runWithRateLimit({\n key: 'report-analytics-event',\n ...reportingRateLimit,\n task: async () => {\n withinRateLimit = true\n },\n })\n if (!withinRateLimit) {\n outputDebug(outputContent`Skipping command analytics due to rate limiting, payload: ${outputToken.json(payload)}`)\n return\n }\n\n const skipMonorailAnalytics = !alwaysLogAnalytics() && analyticsDisabled()\n const skipMetricAnalytics = !alwaysLogMetrics() && analyticsDisabled()\n if (skipMonorailAnalytics || skipMetricAnalytics) {\n outputDebug(outputContent`Skipping command analytics, payload: ${outputToken.json(payload)}`)\n }\n\n const doMonorail = async () => {\n if (skipMonorailAnalytics) {\n return\n }\n const response = await publishMonorailEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive)\n if (response.type === 'error') {\n outputDebug(response.message)\n }\n }\n const doOpenTelemetry = async () => {\n const active = payload.public.cmd_all_timing_active_ms || 0\n const network = payload.public.cmd_all_timing_network_ms || 0\n const prompt = payload.public.cmd_all_timing_prompts_ms || 0\n\n return recordMetrics(\n {\n skipMetricAnalytics,\n cliVersion: payload.public.cli_version,\n owningPlugin: payload.public.cmd_all_plugin || '@shopify/cli',\n command: payload.public.command,\n exitMode: options.exitMode,\n },\n {\n active,\n network,\n prompt,\n },\n )\n }\n await Promise.all([doMonorail(), doOpenTelemetry()])\n\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n outputDebug(message)\n }\n}\n\nasync function buildPayload({config, errorMessage, exitMode}: ReportAnalyticsEventOptions) {\n const {commandStartOptions, environmentFlags, ...sensitiveMetadata} = metadata.getAllSensitiveMetadata()\n if (commandStartOptions === undefined) {\n outputDebug('Unable to log analytics event - no information on executed command')\n return\n }\n const {startCommand, startArgs, startTime} = commandStartOptions\n const currentTime = new Date().getTime()\n\n // All bundled plugins appear as `@shopify/cli` in the payload\n const {'@shopify/cli': internalPluginsPublic, ...externalPluginsPublic} = await fanoutHooks(\n config,\n 'public_command_metadata',\n {},\n )\n const {'@shopify/cli': internalPluginsSensitive, ...externalPluginsSensitive} = await fanoutHooks(\n config,\n 'sensitive_command_metadata',\n {},\n )\n\n const environmentData = await getEnvironmentData(config)\n const sensitiveEnvironmentData = await getSensitiveEnvironmentData(config)\n const publicMetadata = metadata.getAllPublicMetadata()\n\n // Automatically calculate the total time spent in the command, excluding time spent in subtimers.\n const subTimers = ['cmd_all_timing_network_ms', 'cmd_all_timing_prompts_ms'] as const\n const totalTimeFromSubtimers = subTimers.reduce((total, timer) => {\n const value = publicMetadata[timer]\n if (value !== undefined) {\n return total + value\n }\n return total\n }, 0)\n const wallClockElapsed = currentTime - startTime\n const totalTimeWithoutSubtimers = wallClockElapsed - totalTimeFromSubtimers\n\n let payload = {\n public: {\n command: startCommand,\n time_start: startTime,\n time_end: currentTime,\n total_time: wallClockElapsed,\n success: exitMode === 'ok' && errorMessage === undefined,\n cli_version: CLI_KIT_VERSION,\n ruby_version: (await rubyVersion()) || '',\n node_version: process.version.replace('v', ''),\n is_employee: await isShopify(),\n ...environmentData,\n ...internalPluginsPublic,\n ...publicMetadata,\n cmd_all_timing_active_ms: totalTimeWithoutSubtimers,\n cmd_all_exit: exitMode,\n user_id: await getLastSeenUserIdAfterAuth(),\n },\n sensitive: {\n args: startArgs.join(' '),\n cmd_all_environment_flags: environmentFlags,\n error_message: errorMessage,\n ...internalPluginsSensitive,\n ...sensitiveEnvironmentData,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...externalPluginsPublic,\n },\n extraSensitive: {...externalPluginsSensitive},\n }),\n },\n }\n\n // round down timing metrics\n const timingMetrics = ['cmd_all_timing_active_ms', 'cmd_all_timing_network_ms', 'cmd_all_timing_prompts_ms'] as const\n timingMetrics.forEach((metric) => {\n const current = payload.public[metric]\n if (current !== undefined) {\n payload.public[metric] = Math.floor(current)\n }\n })\n\n // strip undefined fields -- they make up the majority of payloads due to wide metadata structure.\n payload = JSON.parse(JSON.stringify(payload))\n\n return sanitizePayload(payload)\n}\n\nfunction sanitizePayload<T>(payload: T): T {\n const payloadString = JSON.stringify(payload)\n // Remove Theme Access passwords from the payload\n const sanitizedPayloadString = payloadString.replace(/shptka_\\w*/g, '*****')\n return JSON.parse(sanitizedPayloadString)\n}\n"]}
1
+ {"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../../src/public/node/analytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,SAAS,EAAC,MAAM,oBAAoB,CAAA;AACrG,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,EAAC,oBAAoB,EAAE,sBAAsB,EAAC,MAAM,eAAe,CAAA;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,cAAc,CAAA;AAExC,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AM,CAAC,CAAA;QACtC,IAAI,OAAO,KAAK,SAAS,EAAE;YACzB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;SAC7C;IACH,CAAC,CAAC,CAAA;IAEF,kGAAkG;IAClG,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;IAE7C,OAAO,eAAe,CAAC,OAAO,CAAC,CAAA;AACjC,CAAC;AAED,SAAS,eAAe,CAAI,OAAU;IACpC,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IAC7C,iDAAiD;IACjD,MAAM,sBAAsB,GAAG,aAAa,CAAC,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAA;IAC5E,OAAO,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import {alwaysLogAnalytics, alwaysLogMetrics, analyticsDisabled, isShopify} from './context/local.js'\nimport * as metadata from './metadata.js'\nimport {publishMonorailEvent, MONORAIL_COMMAND_TOPIC} from './monorail.js'\nimport {fanoutHooks} from './plugins.js'\n\nimport {outputContent, outputDebug, outputToken} from '../../public/node/output.js'\nimport {getEnvironmentData, getSensitiveEnvironmentData} from '../../private/node/analytics.js'\nimport {CLI_KIT_VERSION} from '../common/version.js'\nimport {recordMetrics} from '../../private/node/otel-metrics.js'\nimport {runWithRateLimit} from '../../private/node/conf-store.js'\nimport {reportingRateLimit} from '../../private/node/constants.js'\nimport {getLastSeenUserIdAfterAuth} from '../../private/node/session.js'\nimport {Interfaces} from '@oclif/core'\n\nexport type CommandExitMode =\n // The command completed successfully\n | 'ok'\n // The command exited for some unexpected reason -- i.e. a bug\n | 'unexpected_error'\n // The command exited with an error, but its one we expect and doesn't point to a bug -- i.e. malformed config files\n | 'expected_error'\n\ninterface ReportAnalyticsEventOptions {\n config: Interfaces.Config\n errorMessage?: string\n exitMode: CommandExitMode\n}\n\n/**\n * Report an analytics event, sending it off to Monorail -- Shopify's internal analytics service.\n *\n * The payload for an event includes both generic data, and data gathered from installed plug-ins.\n *\n */\nexport async function reportAnalyticsEvent(options: ReportAnalyticsEventOptions): Promise<void> {\n try {\n const payload = await buildPayload(options)\n if (payload === undefined) {\n // Nothing to log\n return\n }\n\n let withinRateLimit = false\n await runWithRateLimit({\n key: 'report-analytics-event',\n ...reportingRateLimit,\n task: async () => {\n withinRateLimit = true\n },\n })\n if (!withinRateLimit) {\n outputDebug(outputContent`Skipping command analytics due to rate limiting, payload: ${outputToken.json(payload)}`)\n return\n }\n\n const skipMonorailAnalytics = !alwaysLogAnalytics() && analyticsDisabled()\n const skipMetricAnalytics = !alwaysLogMetrics() && analyticsDisabled()\n if (skipMonorailAnalytics || skipMetricAnalytics) {\n outputDebug(outputContent`Skipping command analytics, payload: ${outputToken.json(payload)}`)\n }\n\n const doMonorail = async () => {\n if (skipMonorailAnalytics) {\n return\n }\n const response = await publishMonorailEvent(MONORAIL_COMMAND_TOPIC, payload.public, payload.sensitive)\n if (response.type === 'error') {\n outputDebug(response.message)\n }\n }\n const doOpenTelemetry = async () => {\n const active = payload.public.cmd_all_timing_active_ms || 0\n const network = payload.public.cmd_all_timing_network_ms || 0\n const prompt = payload.public.cmd_all_timing_prompts_ms || 0\n\n return recordMetrics(\n {\n skipMetricAnalytics,\n cliVersion: payload.public.cli_version,\n owningPlugin: payload.public.cmd_all_plugin || '@shopify/cli',\n command: payload.public.command,\n exitMode: options.exitMode,\n },\n {\n active,\n network,\n prompt,\n },\n )\n }\n await Promise.all([doMonorail(), doOpenTelemetry()])\n\n // eslint-disable-next-line no-catch-all/no-catch-all\n } catch (error) {\n let message = 'Failed to report usage analytics'\n if (error instanceof Error) {\n message = message.concat(`: ${error.message}`)\n }\n outputDebug(message)\n }\n}\n\nasync function buildPayload({config, errorMessage, exitMode}: ReportAnalyticsEventOptions) {\n const {commandStartOptions, environmentFlags, ...sensitiveMetadata} = metadata.getAllSensitiveMetadata()\n if (commandStartOptions === undefined) {\n outputDebug('Unable to log analytics event - no information on executed command')\n return\n }\n const {startCommand, startArgs, startTime} = commandStartOptions\n const currentTime = new Date().getTime()\n\n // All bundled plugins appear as `@shopify/cli` in the payload\n const {'@shopify/cli': internalPluginsPublic, ...externalPluginsPublic} = await fanoutHooks(\n config,\n 'public_command_metadata',\n {},\n )\n const {'@shopify/cli': internalPluginsSensitive, ...externalPluginsSensitive} = await fanoutHooks(\n config,\n 'sensitive_command_metadata',\n {},\n )\n\n const environmentData = await getEnvironmentData(config)\n const sensitiveEnvironmentData = await getSensitiveEnvironmentData(config)\n const publicMetadata = metadata.getAllPublicMetadata()\n\n // Automatically calculate the total time spent in the command, excluding time spent in subtimers.\n const subTimers = ['cmd_all_timing_network_ms', 'cmd_all_timing_prompts_ms'] as const\n const totalTimeFromSubtimers = subTimers.reduce((total, timer) => {\n const value = publicMetadata[timer]\n if (value !== undefined) {\n return total + value\n }\n return total\n }, 0)\n const wallClockElapsed = currentTime - startTime\n const totalTimeWithoutSubtimers = wallClockElapsed - totalTimeFromSubtimers\n\n let payload = {\n public: {\n command: startCommand,\n time_start: startTime,\n time_end: currentTime,\n total_time: wallClockElapsed,\n success: exitMode === 'ok' && errorMessage === undefined,\n cli_version: CLI_KIT_VERSION,\n ruby_version: '',\n node_version: process.version.replace('v', ''),\n is_employee: await isShopify(),\n ...environmentData,\n ...internalPluginsPublic,\n ...publicMetadata,\n cmd_all_timing_active_ms: totalTimeWithoutSubtimers,\n cmd_all_exit: exitMode,\n user_id: await getLastSeenUserIdAfterAuth(),\n },\n sensitive: {\n args: startArgs.join(' '),\n cmd_all_environment_flags: environmentFlags,\n error_message: errorMessage,\n ...internalPluginsSensitive,\n ...sensitiveEnvironmentData,\n metadata: JSON.stringify({\n ...sensitiveMetadata,\n extraPublic: {\n ...externalPluginsPublic,\n },\n extraSensitive: {...externalPluginsSensitive},\n }),\n },\n }\n\n // round down timing metrics\n const timingMetrics = ['cmd_all_timing_active_ms', 'cmd_all_timing_network_ms', 'cmd_all_timing_prompts_ms'] as const\n timingMetrics.forEach((metric) => {\n const current = payload.public[metric]\n if (current !== undefined) {\n payload.public[metric] = Math.floor(current)\n }\n })\n\n // strip undefined fields -- they make up the majority of payloads due to wide metadata structure.\n payload = JSON.parse(JSON.stringify(payload))\n\n return sanitizePayload(payload)\n}\n\nfunction sanitizePayload<T>(payload: T): T {\n const payloadString = JSON.stringify(payload)\n // Remove Theme Access passwords from the payload\n const sanitizedPayloadString = payloadString.replace(/shptka_\\w*/g, '*****')\n return JSON.parse(sanitizedPayloadString)\n}\n"]}
@@ -34,9 +34,10 @@ export declare function supportedApiVersions(session: AdminSession): Promise<str
34
34
  *
35
35
  * @param store - Store FQDN.
36
36
  * @param version - API version.
37
+ * @param session - User session.
37
38
  * @returns - Admin API URL.
38
39
  */
39
- export declare function adminUrl(store: string, version: string | undefined): string;
40
+ export declare function adminUrl(store: string, version: string | undefined, session?: AdminSession): string;
40
41
  /**
41
42
  * Executes a REST request against the Admin API.
42
43
  *
@@ -1,11 +1,13 @@
1
1
  import { graphqlRequest, graphqlRequestDoc } from './graphql.js';
2
2
  import { outputContent, outputToken } from '../../../public/node/output.js';
3
3
  import { BugError, AbortError } from '../error.js';
4
- import { restRequestBody, restRequestHeaders, restRequestUrl } from '../../../private/node/api/rest.js';
4
+ import { restRequestBody, restRequestHeaders, restRequestUrl, isThemeAccessSession, } from '../../../private/node/api/rest.js';
5
5
  import { fetch } from '../http.js';
6
6
  import { PublicApiVersions } from '../../../cli/api/graphql/admin/generated/public_api_versions.js';
7
7
  import { normalizeStoreFqdn } from '../context/fqdn.js';
8
+ import { themeKitAccessDomain } from '../../../private/node/constants.js';
8
9
  import { ClientError } from 'graphql-request';
10
+ const LatestApiVersionByFQDN = new Map();
9
11
  /**
10
12
  * Executes a GraphQL query against the Admin API.
11
13
  *
@@ -18,8 +20,9 @@ export async function adminRequest(query, session, variables) {
18
20
  const api = 'Admin';
19
21
  const version = await fetchLatestSupportedApiVersion(session);
20
22
  const store = await normalizeStoreFqdn(session.storeFqdn);
21
- const url = adminUrl(store, version);
22
- return graphqlRequest({ query, api, url, token: session.token, variables });
23
+ const url = adminUrl(store, version, session);
24
+ const addedHeaders = themeAccessHeaders(session);
25
+ return graphqlRequest({ query, api, addedHeaders, url, token: session.token, variables });
23
26
  }
24
27
  /**
25
28
  * Executes a GraphQL query against the Admin API. Uses typed documents.
@@ -32,19 +35,36 @@ export async function adminRequest(query, session, variables) {
32
35
  * @returns The response of the query of generic type <TResult>.
33
36
  */
34
37
  export async function adminRequestDoc(query, session, variables, version, responseOptions) {
35
- let apiVersion = version;
36
- if (!version) {
38
+ let apiVersion = version ?? LatestApiVersionByFQDN.get(session.storeFqdn);
39
+ if (!apiVersion) {
37
40
  apiVersion = await fetchLatestSupportedApiVersion(session);
38
41
  }
39
42
  const store = await normalizeStoreFqdn(session.storeFqdn);
43
+ const addedHeaders = themeAccessHeaders(session);
40
44
  const opts = {
41
- url: adminUrl(store, apiVersion),
45
+ url: adminUrl(store, apiVersion, session),
42
46
  api: 'Admin',
43
47
  token: session.token,
48
+ addedHeaders,
44
49
  };
45
- const result = graphqlRequestDoc({ ...opts, query, variables, responseOptions });
50
+ let unauthorizedHandler;
51
+ if ('refresh' in session) {
52
+ unauthorizedHandler = session.refresh;
53
+ }
54
+ const result = graphqlRequestDoc({
55
+ ...opts,
56
+ query,
57
+ variables,
58
+ responseOptions,
59
+ unauthorizedHandler,
60
+ });
46
61
  return result;
47
62
  }
63
+ function themeAccessHeaders(session) {
64
+ return isThemeAccessSession(session)
65
+ ? { 'X-Shopify-Shop': session.storeFqdn, 'X-Shopify-Access-Token': session.token }
66
+ : {};
67
+ }
48
68
  /**
49
69
  * GraphQL query to retrieve the latest supported API version.
50
70
  *
@@ -54,7 +74,9 @@ export async function adminRequestDoc(query, session, variables, version, respon
54
74
  async function fetchLatestSupportedApiVersion(session) {
55
75
  const apiVersions = await supportedApiVersions(session);
56
76
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
57
- return apiVersions.reverse()[0];
77
+ const latest = apiVersions.reverse()[0];
78
+ LatestApiVersionByFQDN.set(session.storeFqdn, latest);
79
+ return latest;
58
80
  }
59
81
  /**
60
82
  * GraphQL query to retrieve all supported API versions.
@@ -98,11 +120,15 @@ async function fetchApiVersions(session) {
98
120
  *
99
121
  * @param store - Store FQDN.
100
122
  * @param version - API version.
123
+ * @param session - User session.
101
124
  * @returns - Admin API URL.
102
125
  */
103
- export function adminUrl(store, version) {
126
+ export function adminUrl(store, version, session) {
104
127
  const realVersion = version ?? 'unstable';
105
- return `https://${store}/admin/api/${realVersion}/graphql.json`;
128
+ const url = session && isThemeAccessSession(session)
129
+ ? `https://${themeKitAccessDomain}/cli/admin/api/${realVersion}/graphql.json`
130
+ : `https://${store}/admin/api/${realVersion}/graphql.json`;
131
+ return url;
106
132
  }
107
133
  /**
108
134
  * Executes a REST request against the Admin API.