shop-cli 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +392 -0
  3. package/bin/shop-cli.js +17 -0
  4. package/bin/shop.js +16 -0
  5. package/dist/adminClient.d.ts +34 -0
  6. package/dist/adminClient.js +144 -0
  7. package/dist/cli/client.d.ts +10 -0
  8. package/dist/cli/client.js +56 -0
  9. package/dist/cli/command.d.ts +5 -0
  10. package/dist/cli/command.js +62 -0
  11. package/dist/cli/errors.d.ts +4 -0
  12. package/dist/cli/errors.js +35 -0
  13. package/dist/cli/gid.d.ts +3 -0
  14. package/dist/cli/gid.js +42 -0
  15. package/dist/cli/globalFlags.d.ts +15 -0
  16. package/dist/cli/globalFlags.js +100 -0
  17. package/dist/cli/headers.d.ts +2 -0
  18. package/dist/cli/headers.js +79 -0
  19. package/dist/cli/help/format.d.ts +8 -0
  20. package/dist/cli/help/format.js +78 -0
  21. package/dist/cli/help/registry.d.ts +5 -0
  22. package/dist/cli/help/registry.js +6443 -0
  23. package/dist/cli/help/render.d.ts +8 -0
  24. package/dist/cli/help/render.js +399 -0
  25. package/dist/cli/help/spec.d.ts +39 -0
  26. package/dist/cli/help/spec.js +17 -0
  27. package/dist/cli/input.d.ts +9 -0
  28. package/dist/cli/input.js +104 -0
  29. package/dist/cli/introspection/deprecations.d.ts +1 -0
  30. package/dist/cli/introspection/deprecations.js +83 -0
  31. package/dist/cli/introspection/format.d.ts +6 -0
  32. package/dist/cli/introspection/format.js +63 -0
  33. package/dist/cli/introspection/index.d.ts +14 -0
  34. package/dist/cli/introspection/index.js +89 -0
  35. package/dist/cli/introspection/resources.d.ts +1 -0
  36. package/dist/cli/introspection/resources.js +127 -0
  37. package/dist/cli/output/computedFields.d.ts +39 -0
  38. package/dist/cli/output/computedFields.js +104 -0
  39. package/dist/cli/output.d.ts +37 -0
  40. package/dist/cli/output.js +332 -0
  41. package/dist/cli/parse-command.d.ts +18 -0
  42. package/dist/cli/parse-command.js +109 -0
  43. package/dist/cli/router.d.ts +29 -0
  44. package/dist/cli/router.js +480 -0
  45. package/dist/cli/selection/buildAllSelection.d.ts +13 -0
  46. package/dist/cli/selection/buildAllSelection.js +108 -0
  47. package/dist/cli/selection/graphqlSelection.d.ts +5 -0
  48. package/dist/cli/selection/graphqlSelection.js +301 -0
  49. package/dist/cli/selection/select.d.ts +13 -0
  50. package/dist/cli/selection/select.js +136 -0
  51. package/dist/cli/selection/stripDeprecated.d.ts +2 -0
  52. package/dist/cli/selection/stripDeprecated.js +63 -0
  53. package/dist/cli/suggest.d.ts +5 -0
  54. package/dist/cli/suggest.js +88 -0
  55. package/dist/cli/userErrors.d.ts +4 -0
  56. package/dist/cli/userErrors.js +41 -0
  57. package/dist/cli/verbs/_shared.d.ts +38 -0
  58. package/dist/cli/verbs/_shared.js +181 -0
  59. package/dist/cli/verbs/abandoned-checkouts.d.ts +6 -0
  60. package/dist/cli/verbs/abandoned-checkouts.js +259 -0
  61. package/dist/cli/verbs/app-billing.d.ts +6 -0
  62. package/dist/cli/verbs/app-billing.js +452 -0
  63. package/dist/cli/verbs/apps.d.ts +6 -0
  64. package/dist/cli/verbs/apps.js +296 -0
  65. package/dist/cli/verbs/articles.d.ts +6 -0
  66. package/dist/cli/verbs/articles.js +251 -0
  67. package/dist/cli/verbs/backup.d.ts +6 -0
  68. package/dist/cli/verbs/backup.js +94 -0
  69. package/dist/cli/verbs/blogs.d.ts +6 -0
  70. package/dist/cli/verbs/blogs.js +273 -0
  71. package/dist/cli/verbs/bulk-operations.d.ts +6 -0
  72. package/dist/cli/verbs/bulk-operations.js +272 -0
  73. package/dist/cli/verbs/business-entities.d.ts +6 -0
  74. package/dist/cli/verbs/business-entities.js +102 -0
  75. package/dist/cli/verbs/carrier-services.d.ts +6 -0
  76. package/dist/cli/verbs/carrier-services.js +195 -0
  77. package/dist/cli/verbs/cart-transforms.d.ts +6 -0
  78. package/dist/cli/verbs/cart-transforms.js +141 -0
  79. package/dist/cli/verbs/cash-tracking.d.ts +6 -0
  80. package/dist/cli/verbs/cash-tracking.js +118 -0
  81. package/dist/cli/verbs/catalogs.d.ts +6 -0
  82. package/dist/cli/verbs/catalogs.js +267 -0
  83. package/dist/cli/verbs/channels.d.ts +6 -0
  84. package/dist/cli/verbs/channels.js +120 -0
  85. package/dist/cli/verbs/checkout-branding.d.ts +6 -0
  86. package/dist/cli/verbs/checkout-branding.js +144 -0
  87. package/dist/cli/verbs/checkout-profiles.d.ts +6 -0
  88. package/dist/cli/verbs/checkout-profiles.js +124 -0
  89. package/dist/cli/verbs/collections.d.ts +6 -0
  90. package/dist/cli/verbs/collections.js +620 -0
  91. package/dist/cli/verbs/comments.d.ts +6 -0
  92. package/dist/cli/verbs/comments.js +160 -0
  93. package/dist/cli/verbs/companies.d.ts +6 -0
  94. package/dist/cli/verbs/companies.js +313 -0
  95. package/dist/cli/verbs/company-contacts.d.ts +6 -0
  96. package/dist/cli/verbs/company-contacts.js +318 -0
  97. package/dist/cli/verbs/company-locations.d.ts +6 -0
  98. package/dist/cli/verbs/company-locations.js +467 -0
  99. package/dist/cli/verbs/customer-account-pages.d.ts +6 -0
  100. package/dist/cli/verbs/customer-account-pages.js +97 -0
  101. package/dist/cli/verbs/customer-payment-methods.d.ts +6 -0
  102. package/dist/cli/verbs/customer-payment-methods.js +358 -0
  103. package/dist/cli/verbs/customer-privacy.d.ts +6 -0
  104. package/dist/cli/verbs/customer-privacy.js +167 -0
  105. package/dist/cli/verbs/customer-segments.d.ts +6 -0
  106. package/dist/cli/verbs/customer-segments.js +193 -0
  107. package/dist/cli/verbs/customers.d.ts +6 -0
  108. package/dist/cli/verbs/customers.js +793 -0
  109. package/dist/cli/verbs/delegate-tokens.d.ts +6 -0
  110. package/dist/cli/verbs/delegate-tokens.js +95 -0
  111. package/dist/cli/verbs/delivery-customizations.d.ts +6 -0
  112. package/dist/cli/verbs/delivery-customizations.js +205 -0
  113. package/dist/cli/verbs/delivery-profile-locations.d.ts +6 -0
  114. package/dist/cli/verbs/delivery-profile-locations.js +90 -0
  115. package/dist/cli/verbs/delivery-profiles.d.ts +6 -0
  116. package/dist/cli/verbs/delivery-profiles.js +207 -0
  117. package/dist/cli/verbs/delivery-promises.d.ts +6 -0
  118. package/dist/cli/verbs/delivery-promises.js +262 -0
  119. package/dist/cli/verbs/delivery-settings.d.ts +6 -0
  120. package/dist/cli/verbs/delivery-settings.js +85 -0
  121. package/dist/cli/verbs/discount-nodes.d.ts +6 -0
  122. package/dist/cli/verbs/discount-nodes.js +169 -0
  123. package/dist/cli/verbs/discount-redeem-codes.d.ts +6 -0
  124. package/dist/cli/verbs/discount-redeem-codes.js +102 -0
  125. package/dist/cli/verbs/discount-saved-searches.d.ts +6 -0
  126. package/dist/cli/verbs/discount-saved-searches.js +113 -0
  127. package/dist/cli/verbs/discounts-automatic.d.ts +6 -0
  128. package/dist/cli/verbs/discounts-automatic.js +501 -0
  129. package/dist/cli/verbs/discounts-code.d.ts +6 -0
  130. package/dist/cli/verbs/discounts-code.js +540 -0
  131. package/dist/cli/verbs/disputes.d.ts +6 -0
  132. package/dist/cli/verbs/disputes.js +154 -0
  133. package/dist/cli/verbs/draft-orders.d.ts +6 -0
  134. package/dist/cli/verbs/draft-orders.js +475 -0
  135. package/dist/cli/verbs/events.d.ts +6 -0
  136. package/dist/cli/verbs/events.js +182 -0
  137. package/dist/cli/verbs/file-saved-searches.d.ts +6 -0
  138. package/dist/cli/verbs/file-saved-searches.js +83 -0
  139. package/dist/cli/verbs/files.d.ts +6 -0
  140. package/dist/cli/verbs/files.js +329 -0
  141. package/dist/cli/verbs/finance.d.ts +6 -0
  142. package/dist/cli/verbs/finance.js +115 -0
  143. package/dist/cli/verbs/flow.d.ts +6 -0
  144. package/dist/cli/verbs/flow.js +94 -0
  145. package/dist/cli/verbs/fulfillment-constraint-rules.d.ts +6 -0
  146. package/dist/cli/verbs/fulfillment-constraint-rules.js +139 -0
  147. package/dist/cli/verbs/fulfillment-orders.d.ts +6 -0
  148. package/dist/cli/verbs/fulfillment-orders.js +689 -0
  149. package/dist/cli/verbs/fulfillment-services.d.ts +6 -0
  150. package/dist/cli/verbs/fulfillment-services.js +212 -0
  151. package/dist/cli/verbs/fulfillments.d.ts +6 -0
  152. package/dist/cli/verbs/fulfillments.js +279 -0
  153. package/dist/cli/verbs/gift-cards.d.ts +6 -0
  154. package/dist/cli/verbs/gift-cards.js +359 -0
  155. package/dist/cli/verbs/graphql.d.ts +14 -0
  156. package/dist/cli/verbs/graphql.js +285 -0
  157. package/dist/cli/verbs/inventory-items.d.ts +6 -0
  158. package/dist/cli/verbs/inventory-items.js +164 -0
  159. package/dist/cli/verbs/inventory-shipments.d.ts +6 -0
  160. package/dist/cli/verbs/inventory-shipments.js +276 -0
  161. package/dist/cli/verbs/inventory-transfers.d.ts +6 -0
  162. package/dist/cli/verbs/inventory-transfers.js +396 -0
  163. package/dist/cli/verbs/inventory.d.ts +6 -0
  164. package/dist/cli/verbs/inventory.js +557 -0
  165. package/dist/cli/verbs/locales.d.ts +6 -0
  166. package/dist/cli/verbs/locales.js +61 -0
  167. package/dist/cli/verbs/locations.d.ts +6 -0
  168. package/dist/cli/verbs/locations.js +385 -0
  169. package/dist/cli/verbs/market-localizations.d.ts +6 -0
  170. package/dist/cli/verbs/market-localizations.js +291 -0
  171. package/dist/cli/verbs/market-web-presences.d.ts +6 -0
  172. package/dist/cli/verbs/market-web-presences.js +139 -0
  173. package/dist/cli/verbs/marketing-activities.d.ts +6 -0
  174. package/dist/cli/verbs/marketing-activities.js +353 -0
  175. package/dist/cli/verbs/marketing-events.d.ts +6 -0
  176. package/dist/cli/verbs/marketing-events.js +132 -0
  177. package/dist/cli/verbs/markets.d.ts +6 -0
  178. package/dist/cli/verbs/markets.js +357 -0
  179. package/dist/cli/verbs/menus.d.ts +6 -0
  180. package/dist/cli/verbs/menus.js +251 -0
  181. package/dist/cli/verbs/metafield-definition-tools.d.ts +6 -0
  182. package/dist/cli/verbs/metafield-definition-tools.js +289 -0
  183. package/dist/cli/verbs/metafield-definitions.d.ts +6 -0
  184. package/dist/cli/verbs/metafield-definitions.js +240 -0
  185. package/dist/cli/verbs/metafields.d.ts +6 -0
  186. package/dist/cli/verbs/metafields.js +112 -0
  187. package/dist/cli/verbs/metaobject-definition-tools.d.ts +6 -0
  188. package/dist/cli/verbs/metaobject-definition-tools.js +83 -0
  189. package/dist/cli/verbs/metaobject-definitions.d.ts +6 -0
  190. package/dist/cli/verbs/metaobject-definitions.js +176 -0
  191. package/dist/cli/verbs/metaobjects.d.ts +6 -0
  192. package/dist/cli/verbs/metaobjects.js +306 -0
  193. package/dist/cli/verbs/mobile-platform-applications.d.ts +6 -0
  194. package/dist/cli/verbs/mobile-platform-applications.js +247 -0
  195. package/dist/cli/verbs/order-edit.d.ts +6 -0
  196. package/dist/cli/verbs/order-edit.js +596 -0
  197. package/dist/cli/verbs/orders.d.ts +6 -0
  198. package/dist/cli/verbs/orders.js +853 -0
  199. package/dist/cli/verbs/pages.d.ts +6 -0
  200. package/dist/cli/verbs/pages.js +234 -0
  201. package/dist/cli/verbs/payment-customizations.d.ts +6 -0
  202. package/dist/cli/verbs/payment-customizations.js +193 -0
  203. package/dist/cli/verbs/payment-terms.d.ts +6 -0
  204. package/dist/cli/verbs/payment-terms.js +228 -0
  205. package/dist/cli/verbs/point-of-sale.d.ts +6 -0
  206. package/dist/cli/verbs/point-of-sale.js +57 -0
  207. package/dist/cli/verbs/price-lists.d.ts +6 -0
  208. package/dist/cli/verbs/price-lists.js +426 -0
  209. package/dist/cli/verbs/product-feeds.d.ts +6 -0
  210. package/dist/cli/verbs/product-feeds.js +187 -0
  211. package/dist/cli/verbs/product-variants.d.ts +6 -0
  212. package/dist/cli/verbs/product-variants.js +439 -0
  213. package/dist/cli/verbs/products.d.ts +6 -0
  214. package/dist/cli/verbs/products.js +2309 -0
  215. package/dist/cli/verbs/publications.d.ts +6 -0
  216. package/dist/cli/verbs/publications.js +256 -0
  217. package/dist/cli/verbs/publishables.d.ts +6 -0
  218. package/dist/cli/verbs/publishables.js +73 -0
  219. package/dist/cli/verbs/refunds.d.ts +6 -0
  220. package/dist/cli/verbs/refunds.js +226 -0
  221. package/dist/cli/verbs/resource-feedback.d.ts +6 -0
  222. package/dist/cli/verbs/resource-feedback.js +119 -0
  223. package/dist/cli/verbs/returnable-fulfillments.d.ts +6 -0
  224. package/dist/cli/verbs/returnable-fulfillments.js +102 -0
  225. package/dist/cli/verbs/returns.d.ts +6 -0
  226. package/dist/cli/verbs/returns.js +506 -0
  227. package/dist/cli/verbs/reverse-deliveries.d.ts +6 -0
  228. package/dist/cli/verbs/reverse-deliveries.js +203 -0
  229. package/dist/cli/verbs/reverse-fulfillment-orders.d.ts +6 -0
  230. package/dist/cli/verbs/reverse-fulfillment-orders.js +157 -0
  231. package/dist/cli/verbs/saved-searches.d.ts +6 -0
  232. package/dist/cli/verbs/saved-searches.js +150 -0
  233. package/dist/cli/verbs/script-tags.d.ts +6 -0
  234. package/dist/cli/verbs/script-tags.js +179 -0
  235. package/dist/cli/verbs/segments.d.ts +6 -0
  236. package/dist/cli/verbs/segments.js +343 -0
  237. package/dist/cli/verbs/selling-plan-group-products.d.ts +6 -0
  238. package/dist/cli/verbs/selling-plan-group-products.js +115 -0
  239. package/dist/cli/verbs/selling-plan-groups.d.ts +6 -0
  240. package/dist/cli/verbs/selling-plan-groups.js +230 -0
  241. package/dist/cli/verbs/server-pixels.d.ts +6 -0
  242. package/dist/cli/verbs/server-pixels.js +172 -0
  243. package/dist/cli/verbs/shipping-packages.d.ts +6 -0
  244. package/dist/cli/verbs/shipping-packages.js +107 -0
  245. package/dist/cli/verbs/shop-policies.d.ts +6 -0
  246. package/dist/cli/verbs/shop-policies.js +91 -0
  247. package/dist/cli/verbs/shop-utils.d.ts +6 -0
  248. package/dist/cli/verbs/shop-utils.js +147 -0
  249. package/dist/cli/verbs/shop.d.ts +6 -0
  250. package/dist/cli/verbs/shop.js +177 -0
  251. package/dist/cli/verbs/shopify-functions.d.ts +6 -0
  252. package/dist/cli/verbs/shopify-functions.js +127 -0
  253. package/dist/cli/verbs/shopify-payments.d.ts +6 -0
  254. package/dist/cli/verbs/shopify-payments.js +111 -0
  255. package/dist/cli/verbs/staff.d.ts +6 -0
  256. package/dist/cli/verbs/staff.js +127 -0
  257. package/dist/cli/verbs/staged-uploads.d.ts +6 -0
  258. package/dist/cli/verbs/staged-uploads.js +128 -0
  259. package/dist/cli/verbs/store-credit.d.ts +6 -0
  260. package/dist/cli/verbs/store-credit.js +209 -0
  261. package/dist/cli/verbs/storefront-access-tokens.d.ts +6 -0
  262. package/dist/cli/verbs/storefront-access-tokens.js +183 -0
  263. package/dist/cli/verbs/subscription-billing-cycles.d.ts +6 -0
  264. package/dist/cli/verbs/subscription-billing-cycles.js +391 -0
  265. package/dist/cli/verbs/subscription-billing.d.ts +6 -0
  266. package/dist/cli/verbs/subscription-billing.js +391 -0
  267. package/dist/cli/verbs/subscription-contracts.d.ts +6 -0
  268. package/dist/cli/verbs/subscription-contracts.js +392 -0
  269. package/dist/cli/verbs/subscription-drafts.d.ts +6 -0
  270. package/dist/cli/verbs/subscription-drafts.js +315 -0
  271. package/dist/cli/verbs/tags.d.ts +6 -0
  272. package/dist/cli/verbs/tags.js +73 -0
  273. package/dist/cli/verbs/tax.d.ts +6 -0
  274. package/dist/cli/verbs/tax.js +114 -0
  275. package/dist/cli/verbs/taxonomy.d.ts +6 -0
  276. package/dist/cli/verbs/taxonomy.js +99 -0
  277. package/dist/cli/verbs/tender-transactions.d.ts +6 -0
  278. package/dist/cli/verbs/tender-transactions.js +105 -0
  279. package/dist/cli/verbs/themes.d.ts +6 -0
  280. package/dist/cli/verbs/themes.js +315 -0
  281. package/dist/cli/verbs/translations.d.ts +6 -0
  282. package/dist/cli/verbs/translations.js +221 -0
  283. package/dist/cli/verbs/types.d.ts +4 -0
  284. package/dist/cli/verbs/types.js +224 -0
  285. package/dist/cli/verbs/url-redirects.d.ts +6 -0
  286. package/dist/cli/verbs/url-redirects.js +465 -0
  287. package/dist/cli/verbs/validations.d.ts +6 -0
  288. package/dist/cli/verbs/validations.js +181 -0
  289. package/dist/cli/verbs/web-pixels.d.ts +6 -0
  290. package/dist/cli/verbs/web-pixels.js +145 -0
  291. package/dist/cli/verbs/web-presences.d.ts +6 -0
  292. package/dist/cli/verbs/web-presences.js +186 -0
  293. package/dist/cli/verbs/webhooks.d.ts +6 -0
  294. package/dist/cli/verbs/webhooks.js +336 -0
  295. package/dist/cli/workflows/files/stagedUploads.d.ts +28 -0
  296. package/dist/cli/workflows/files/stagedUploads.js +227 -0
  297. package/dist/cli/workflows/files/stdinFile.d.ts +7 -0
  298. package/dist/cli/workflows/files/stdinFile.js +65 -0
  299. package/dist/cli/workflows/files/urlDownloads.d.ts +14 -0
  300. package/dist/cli/workflows/files/urlDownloads.js +114 -0
  301. package/dist/cli/workflows/files/waitForReady.d.ts +20 -0
  302. package/dist/cli/workflows/files/waitForReady.js +114 -0
  303. package/dist/cli/workflows/inventory/resolveInventoryItemId.d.ts +6 -0
  304. package/dist/cli/workflows/inventory/resolveInventoryItemId.js +59 -0
  305. package/dist/cli/workflows/productVariants/upsert.d.ts +8 -0
  306. package/dist/cli/workflows/productVariants/upsert.js +110 -0
  307. package/dist/cli/workflows/products/metafieldsUpsert.d.ts +6 -0
  308. package/dist/cli/workflows/products/metafieldsUpsert.js +94 -0
  309. package/dist/cli/workflows/products/publishablePublish.d.ts +21 -0
  310. package/dist/cli/workflows/products/publishablePublish.js +131 -0
  311. package/dist/cli/workflows/publications/resolvePublicationId.d.ts +17 -0
  312. package/dist/cli/workflows/publications/resolvePublicationId.js +93 -0
  313. package/dist/cli.d.ts +1 -0
  314. package/dist/cli.js +238 -0
  315. package/dist/defaults.d.ts +2 -0
  316. package/dist/defaults.js +38 -0
  317. package/dist/generated/admin-2026-04/index.d.ts +25 -0
  318. package/dist/generated/admin-2026-04/index.js +70 -0
  319. package/dist/generated/admin-2026-04/runtime/batcher.d.ts +105 -0
  320. package/dist/generated/admin-2026-04/runtime/batcher.js +203 -0
  321. package/dist/generated/admin-2026-04/runtime/createClient.d.ts +17 -0
  322. package/dist/generated/admin-2026-04/runtime/createClient.js +59 -0
  323. package/dist/generated/admin-2026-04/runtime/error.d.ts +18 -0
  324. package/dist/generated/admin-2026-04/runtime/error.js +44 -0
  325. package/dist/generated/admin-2026-04/runtime/fetcher.d.ts +10 -0
  326. package/dist/generated/admin-2026-04/runtime/fetcher.js +104 -0
  327. package/dist/generated/admin-2026-04/runtime/generateGraphqlOperation.d.ts +30 -0
  328. package/dist/generated/admin-2026-04/runtime/generateGraphqlOperation.js +191 -0
  329. package/dist/generated/admin-2026-04/runtime/index.d.ts +11 -0
  330. package/dist/generated/admin-2026-04/runtime/index.js +46 -0
  331. package/dist/generated/admin-2026-04/runtime/linkTypeMap.d.ts +9 -0
  332. package/dist/generated/admin-2026-04/runtime/linkTypeMap.js +142 -0
  333. package/dist/generated/admin-2026-04/runtime/typeSelection.d.ts +28 -0
  334. package/dist/generated/admin-2026-04/runtime/typeSelection.js +17 -0
  335. package/dist/generated/admin-2026-04/runtime/types.d.ts +55 -0
  336. package/dist/generated/admin-2026-04/runtime/types.js +17 -0
  337. package/dist/generated/admin-2026-04/schema.d.ts +102240 -0
  338. package/dist/generated/admin-2026-04/schema.graphql +91596 -0
  339. package/dist/generated/admin-2026-04/schema.js +20322 -0
  340. package/dist/generated/admin-2026-04/types.d.ts +24224 -0
  341. package/dist/generated/admin-2026-04/types.js +62299 -0
  342. package/dist/generated/help/schema-help.d.ts +30 -0
  343. package/dist/generated/help/schema-help.js +61833 -0
  344. package/dist/graphqlValidator.d.ts +17 -0
  345. package/dist/graphqlValidator.js +84 -0
  346. package/dist/index.d.ts +1 -0
  347. package/dist/index.js +23 -0
  348. package/package.json +66 -0
  349. package/schema/2026-04.graphql +61256 -0
  350. package/schema/2026-04.introspection.json +1 -0
@@ -0,0 +1,385 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var locations_exports = {};
20
+ __export(locations_exports, {
21
+ runLocations: () => runLocations
22
+ });
23
+ module.exports = __toCommonJS(locations_exports);
24
+ var import_node_crypto = require("node:crypto");
25
+ var import_errors = require("../errors");
26
+ var import_gid = require("../gid");
27
+ var import_input = require("../input");
28
+ var import_output = require("../output");
29
+ var import_router = require("../router");
30
+ var import_select = require("../selection/select");
31
+ var import_userErrors = require("../userErrors");
32
+ var import_shared = require("./_shared");
33
+ const locationSummarySelection = {
34
+ id: true,
35
+ name: true,
36
+ address: {
37
+ address1: true,
38
+ city: true,
39
+ provinceCode: true,
40
+ countryCode: true,
41
+ zip: true
42
+ },
43
+ isActive: true,
44
+ fulfillsOnlineOrders: true,
45
+ hasActiveInventory: true,
46
+ localPickupSettingsV2: { instructions: true, pickupTime: true }
47
+ };
48
+ const locationFullSelection = {
49
+ ...locationSummarySelection,
50
+ address: {
51
+ address1: true,
52
+ address2: true,
53
+ city: true,
54
+ province: true,
55
+ provinceCode: true,
56
+ country: true,
57
+ countryCode: true,
58
+ zip: true,
59
+ phone: true,
60
+ formatted: true
61
+ },
62
+ fulfillmentService: { id: true, serviceName: true },
63
+ shipsInventory: true,
64
+ suggestedAddresses: { address1: true, city: true, zip: true }
65
+ };
66
+ const getLocationSelection = (view) => {
67
+ if (view === "ids") return { id: true };
68
+ if (view === "full") return locationFullSelection;
69
+ if (view === "raw") return {};
70
+ return locationSummarySelection;
71
+ };
72
+ const ensureObjectInput = (value, label) => {
73
+ if (value === null || typeof value !== "object") throw new import_errors.CliError(`${label} must be an object`, 2);
74
+ return value;
75
+ };
76
+ const maybeFailOnNamedUserErrors = (errors, ctx) => {
77
+ if (!Array.isArray(errors) || errors.length === 0) return;
78
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: { userErrors: errors }, failOnUserErrors: ctx.failOnUserErrors });
79
+ };
80
+ const parseCustomIdInput = ({
81
+ namespace,
82
+ key,
83
+ value
84
+ }) => {
85
+ const customKey = typeof key === "string" ? key : void 0;
86
+ const customValue = typeof value === "string" ? value : void 0;
87
+ if (!customKey || !customValue) return void 0;
88
+ const ns = typeof namespace === "string" && namespace ? namespace : void 0;
89
+ return { ...ns ? { namespace: ns } : {}, key: customKey, value: customValue };
90
+ };
91
+ const runLocations = async ({
92
+ ctx,
93
+ verb,
94
+ argv
95
+ }) => {
96
+ if (argv.includes("--help") || argv.includes("-h")) {
97
+ console.log(
98
+ [
99
+ "Usage:",
100
+ " shop locations <verb> [flags]",
101
+ "",
102
+ "Verbs:",
103
+ " create|get|list|count|update|delete",
104
+ " by-identifier",
105
+ " activate|deactivate|enable-local-pickup|disable-local-pickup",
106
+ "",
107
+ "Common output flags:",
108
+ " --view summary|ids|full|raw",
109
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
110
+ " --selection <graphql> (selection override; can be @file.gql)",
111
+ "",
112
+ "Special flags:",
113
+ " --destination-location-id <gid|num> (deactivate)",
114
+ " --include-inactive (list)",
115
+ " --include-legacy (list)"
116
+ ].join("\n")
117
+ );
118
+ return;
119
+ }
120
+ if (verb === "by-identifier") {
121
+ const args = (0, import_router.parseStandardArgs)({
122
+ argv,
123
+ extraOptions: {
124
+ "custom-id-namespace": { type: "string" },
125
+ "custom-id-key": { type: "string" },
126
+ "custom-id-value": { type: "string" }
127
+ }
128
+ });
129
+ const idRaw = args.id;
130
+ const customId = parseCustomIdInput({
131
+ namespace: args["custom-id-namespace"],
132
+ key: args["custom-id-key"],
133
+ value: args["custom-id-value"]
134
+ });
135
+ if (!idRaw && !customId) throw new import_errors.CliError("Missing --id or --custom-id-key/--custom-id-value", 2);
136
+ const identifier = {
137
+ ...idRaw ? { id: (0, import_gid.coerceGid)(idRaw, "Location") } : {},
138
+ ...customId ? { customId } : {}
139
+ };
140
+ const selection = (0, import_select.resolveSelection)({
141
+ resource: "locations",
142
+ view: ctx.view,
143
+ baseSelection: getLocationSelection(ctx.view),
144
+ select: args.select,
145
+ selection: args.selection,
146
+ include: args.include,
147
+ ensureId: ctx.quiet
148
+ });
149
+ const result = await (0, import_router.runQuery)(ctx, {
150
+ locationByIdentifier: {
151
+ __args: { identifier },
152
+ ...selection
153
+ }
154
+ });
155
+ if (result === void 0) return;
156
+ (0, import_output.printNode)({ node: result.locationByIdentifier, format: ctx.format, quiet: ctx.quiet });
157
+ return;
158
+ }
159
+ if (verb === "get") {
160
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
161
+ const id = (0, import_shared.requireId)(args.id, "Location");
162
+ const selection = (0, import_select.resolveSelection)({
163
+ resource: "locations",
164
+ view: ctx.view,
165
+ baseSelection: getLocationSelection(ctx.view),
166
+ select: args.select,
167
+ selection: args.selection,
168
+ include: args.include,
169
+ ensureId: ctx.quiet
170
+ });
171
+ const result = await (0, import_router.runQuery)(ctx, { location: { __args: { id }, ...selection } });
172
+ if (result === void 0) return;
173
+ (0, import_output.printNode)({ node: result.location, format: ctx.format, quiet: ctx.quiet });
174
+ return;
175
+ }
176
+ if (verb === "list") {
177
+ const args = (0, import_router.parseStandardArgs)({
178
+ argv,
179
+ extraOptions: {
180
+ "include-inactive": { type: "boolean" },
181
+ "include-legacy": { type: "boolean" }
182
+ }
183
+ });
184
+ const first = (0, import_shared.parseFirst)(args.first);
185
+ const after = args.after;
186
+ const query = args.query;
187
+ const reverse = args.reverse;
188
+ const sortKey = args.sort;
189
+ const includeInactive = args["include-inactive"];
190
+ const includeLegacy = args["include-legacy"];
191
+ const nodeSelection = (0, import_select.resolveSelection)({
192
+ resource: "locations",
193
+ view: ctx.view,
194
+ baseSelection: getLocationSelection(ctx.view),
195
+ select: args.select,
196
+ selection: args.selection,
197
+ include: args.include,
198
+ ensureId: ctx.quiet
199
+ });
200
+ const result = await (0, import_router.runQuery)(ctx, {
201
+ locations: {
202
+ __args: {
203
+ first,
204
+ after,
205
+ query,
206
+ reverse,
207
+ sortKey,
208
+ ...includeInactive ? { includeInactive } : {},
209
+ ...includeLegacy ? { includeLegacy } : {}
210
+ },
211
+ pageInfo: { hasNextPage: true, endCursor: true },
212
+ nodes: nodeSelection
213
+ }
214
+ });
215
+ if (result === void 0) return;
216
+ (0, import_output.printConnection)({
217
+ connection: result.locations,
218
+ format: ctx.format,
219
+ quiet: ctx.quiet,
220
+ nextPageArgs: (0, import_shared.buildListNextPageArgs)(
221
+ "locations",
222
+ { first, query, sort: sortKey, reverse },
223
+ [
224
+ ...includeInactive ? [{ flag: "--include-inactive", value: true }] : [],
225
+ ...includeLegacy ? [{ flag: "--include-legacy", value: true }] : []
226
+ ]
227
+ )
228
+ });
229
+ return;
230
+ }
231
+ if (verb === "count") {
232
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
233
+ const query = args.query;
234
+ const result = await (0, import_router.runQuery)(ctx, { locationsCount: { __args: { query }, count: true, precision: true } });
235
+ if (result === void 0) return;
236
+ if (ctx.quiet) return console.log(result.locationsCount?.count ?? "");
237
+ (0, import_output.printJson)(result.locationsCount, ctx.format !== "raw");
238
+ return;
239
+ }
240
+ if (verb === "create") {
241
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
242
+ const built = (0, import_input.buildInput)({
243
+ inputArg: args.input,
244
+ setArgs: args.set,
245
+ setJsonArgs: args["set-json"]
246
+ });
247
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
248
+ const result = await (0, import_router.runMutation)(ctx, {
249
+ locationAdd: {
250
+ __args: { input: built.input },
251
+ location: locationSummarySelection,
252
+ userErrors: { field: true, message: true }
253
+ }
254
+ });
255
+ if (result === void 0) return;
256
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.locationAdd, failOnUserErrors: ctx.failOnUserErrors });
257
+ if (ctx.quiet) return console.log(result.locationAdd?.location?.id ?? "");
258
+ (0, import_output.printJson)(result.locationAdd, ctx.format !== "raw");
259
+ return;
260
+ }
261
+ if (verb === "update") {
262
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
263
+ const id = (0, import_shared.requireId)(args.id, "Location");
264
+ const built = (0, import_input.buildInput)({
265
+ inputArg: args.input,
266
+ setArgs: args.set,
267
+ setJsonArgs: args["set-json"]
268
+ });
269
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
270
+ const result = await (0, import_router.runMutation)(ctx, {
271
+ locationEdit: {
272
+ __args: { id, input: built.input },
273
+ location: locationSummarySelection,
274
+ userErrors: { field: true, message: true }
275
+ }
276
+ });
277
+ if (result === void 0) return;
278
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.locationEdit, failOnUserErrors: ctx.failOnUserErrors });
279
+ if (ctx.quiet) return console.log(result.locationEdit?.location?.id ?? "");
280
+ (0, import_output.printJson)(result.locationEdit, ctx.format !== "raw");
281
+ return;
282
+ }
283
+ if (verb === "delete") {
284
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
285
+ const id = (0, import_shared.requireId)(args.id, "Location");
286
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
287
+ const result = await (0, import_router.runMutation)(ctx, {
288
+ locationDelete: {
289
+ __args: { locationId: id },
290
+ deletedLocationId: true,
291
+ locationDeleteUserErrors: { field: true, message: true }
292
+ }
293
+ });
294
+ if (result === void 0) return;
295
+ maybeFailOnNamedUserErrors(result.locationDelete?.locationDeleteUserErrors, ctx);
296
+ if (ctx.quiet) return console.log(result.locationDelete?.deletedLocationId ?? "");
297
+ (0, import_output.printJson)(result.locationDelete, ctx.format !== "raw");
298
+ return;
299
+ }
300
+ if (verb === "activate") {
301
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
302
+ const id = (0, import_shared.requireId)(args.id, "Location");
303
+ const result = await (0, import_router.runMutation)(ctx, {
304
+ locationActivate: {
305
+ __directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
306
+ __args: { locationId: id },
307
+ location: locationSummarySelection,
308
+ locationActivateUserErrors: { field: true, message: true }
309
+ }
310
+ });
311
+ if (result === void 0) return;
312
+ maybeFailOnNamedUserErrors(result.locationActivate?.locationActivateUserErrors, ctx);
313
+ if (ctx.quiet) return console.log(result.locationActivate?.location?.id ?? "");
314
+ (0, import_output.printJson)(result.locationActivate, ctx.format !== "raw");
315
+ return;
316
+ }
317
+ if (verb === "deactivate") {
318
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "destination-location-id": { type: "string" } } });
319
+ const id = (0, import_shared.requireId)(args.id, "Location");
320
+ const destinationLocationId = args["destination-location-id"];
321
+ const result = await (0, import_router.runMutation)(ctx, {
322
+ locationDeactivate: {
323
+ __directives: { idempotent: { key: (0, import_node_crypto.randomUUID)() } },
324
+ __args: {
325
+ locationId: id,
326
+ ...destinationLocationId ? { destinationLocationId: (0, import_shared.requireId)(destinationLocationId, "Location") } : {}
327
+ },
328
+ location: locationSummarySelection,
329
+ locationDeactivateUserErrors: { field: true, message: true }
330
+ }
331
+ });
332
+ if (result === void 0) return;
333
+ maybeFailOnNamedUserErrors(result.locationDeactivate?.locationDeactivateUserErrors, ctx);
334
+ if (ctx.quiet) return console.log(result.locationDeactivate?.location?.id ?? "");
335
+ (0, import_output.printJson)(result.locationDeactivate, ctx.format !== "raw");
336
+ return;
337
+ }
338
+ if (verb === "enable-local-pickup") {
339
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
340
+ const id = (0, import_shared.requireId)(args.id, "Location");
341
+ const built = (0, import_input.buildInput)({
342
+ inputArg: args.input,
343
+ setArgs: args.set,
344
+ setJsonArgs: args["set-json"]
345
+ });
346
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
347
+ const input = ensureObjectInput(built.input, "Local pickup settings");
348
+ if (input.locationId === void 0) input.locationId = id;
349
+ if (!input.locationId) throw new import_errors.CliError("Missing locationId in --input/--set (or provide --id)", 2);
350
+ if (input.pickupTime === void 0) throw new import_errors.CliError("Missing pickupTime in --input/--set", 2);
351
+ const result = await (0, import_router.runMutation)(ctx, {
352
+ locationLocalPickupEnable: {
353
+ __args: { localPickupSettings: input },
354
+ localPickupSettings: { instructions: true, pickupTime: true },
355
+ userErrors: { field: true, message: true }
356
+ }
357
+ });
358
+ if (result === void 0) return;
359
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.locationLocalPickupEnable, failOnUserErrors: ctx.failOnUserErrors });
360
+ (0, import_output.printJson)(result.locationLocalPickupEnable, ctx.format !== "raw");
361
+ return;
362
+ }
363
+ if (verb === "disable-local-pickup") {
364
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
365
+ const id = (0, import_shared.requireId)(args.id, "Location");
366
+ const result = await (0, import_router.runMutation)(ctx, {
367
+ locationLocalPickupDisable: {
368
+ __args: { locationId: id },
369
+ locationId: true,
370
+ userErrors: { field: true, message: true }
371
+ }
372
+ });
373
+ if (result === void 0) return;
374
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.locationLocalPickupDisable, failOnUserErrors: ctx.failOnUserErrors });
375
+ if (ctx.quiet) return console.log(result.locationLocalPickupDisable?.locationId ?? "");
376
+ (0, import_output.printJson)(result.locationLocalPickupDisable, ctx.format !== "raw");
377
+ return;
378
+ }
379
+ throw new import_errors.CliError(`Unknown verb for locations: ${verb}`, 2);
380
+ };
381
+ // Annotate the CommonJS export names for ESM import in node:
382
+ 0 && (module.exports = {
383
+ runLocations
384
+ });
385
+ //# sourceMappingURL=locations.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runMarketLocalizations: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;
@@ -0,0 +1,291 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var market_localizations_exports = {};
20
+ __export(market_localizations_exports, {
21
+ runMarketLocalizations: () => runMarketLocalizations
22
+ });
23
+ module.exports = __toCommonJS(market_localizations_exports);
24
+ var import_errors = require("../errors");
25
+ var import_gid = require("../gid");
26
+ var import_input = require("../input");
27
+ var import_output = require("../output");
28
+ var import_router = require("../router");
29
+ var import_select = require("../selection/select");
30
+ var import_userErrors = require("../userErrors");
31
+ var import_shared = require("./_shared");
32
+ const marketLocalizationsSelection = (marketId) => ({
33
+ __args: { marketId },
34
+ key: true,
35
+ value: true,
36
+ outdated: true,
37
+ updatedAt: true,
38
+ market: { id: true, name: true, handle: true }
39
+ });
40
+ const marketLocalizableResourceSummarySelection = (marketId) => ({
41
+ resourceId: true,
42
+ marketLocalizableContent: { key: true, digest: true },
43
+ marketLocalizations: marketLocalizationsSelection(marketId)
44
+ });
45
+ const marketLocalizableResourceFullSelection = (marketId) => ({
46
+ ...marketLocalizableResourceSummarySelection(marketId),
47
+ marketLocalizableContent: { key: true, digest: true, value: true }
48
+ });
49
+ const getMarketLocalizableResourceSelection = (view, marketId) => {
50
+ if (view === "ids") return { resourceId: true };
51
+ if (view === "full") return marketLocalizableResourceFullSelection(marketId);
52
+ if (view === "raw") return {};
53
+ return marketLocalizableResourceSummarySelection(marketId);
54
+ };
55
+ const ensureResourceIdSelected = (selection) => {
56
+ if (!("resourceId" in selection)) selection.resourceId = true;
57
+ return selection;
58
+ };
59
+ const withSyntheticId = (node) => {
60
+ if (!node || typeof node !== "object") return node;
61
+ const resourceId = node.resourceId;
62
+ if (typeof resourceId === "string" && !("id" in node)) return { id: resourceId, ...node };
63
+ return node;
64
+ };
65
+ const extractArrayField = (input, field) => {
66
+ if (Array.isArray(input)) return input;
67
+ if (input && Array.isArray(input[field])) return input[field];
68
+ return void 0;
69
+ };
70
+ const parseMarketIds = (value) => {
71
+ const ids = (0, import_shared.parseStringList)(value, "--market-ids");
72
+ return ids.map((id) => (0, import_gid.coerceGid)(id, "Market"));
73
+ };
74
+ const runMarketLocalizations = async ({
75
+ ctx,
76
+ verb,
77
+ argv
78
+ }) => {
79
+ if (argv.includes("--help") || argv.includes("-h")) {
80
+ console.log(
81
+ [
82
+ "Usage:",
83
+ " shop market-localizations <verb> [flags]",
84
+ "",
85
+ "Verbs:",
86
+ " localizable-resource|localizable-resources|localizable-resources-by-ids",
87
+ " register|remove",
88
+ "",
89
+ "Notes:",
90
+ " Market localizable resources are limited to resource types: METAOBJECT, METAFIELD.",
91
+ " The marketLocalizations field requires --market-id.",
92
+ "",
93
+ "Common output flags:",
94
+ " --view summary|ids|full|raw|all",
95
+ " --format json|jsonl|table|markdown|raw",
96
+ " --quiet",
97
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
98
+ " --selection <graphql> (selection override; can be @file.gql)"
99
+ ].join("\n")
100
+ );
101
+ return;
102
+ }
103
+ if (verb === "localizable-resource") {
104
+ const args = (0, import_router.parseStandardArgs)({
105
+ argv,
106
+ extraOptions: { "resource-id": { type: "string" }, "market-id": { type: "string" } }
107
+ });
108
+ const resourceId = args["resource-id"];
109
+ if (!resourceId) throw new import_errors.CliError("Missing --resource-id", 2);
110
+ const marketIdRaw = args["market-id"];
111
+ if (!marketIdRaw) throw new import_errors.CliError("Missing --market-id", 2);
112
+ const marketId = (0, import_gid.coerceGid)(marketIdRaw, "Market");
113
+ const selection = ensureResourceIdSelected(
114
+ (0, import_select.resolveSelection)({
115
+ typeName: "MarketLocalizableResource",
116
+ view: ctx.view,
117
+ baseSelection: getMarketLocalizableResourceSelection(ctx.view, marketId),
118
+ select: args.select,
119
+ selection: args.selection,
120
+ include: args.include,
121
+ ensureId: false
122
+ })
123
+ );
124
+ const result = await (0, import_router.runQuery)(ctx, {
125
+ marketLocalizableResource: { __args: { resourceId }, ...selection }
126
+ });
127
+ if (result === void 0) return;
128
+ const node = result.marketLocalizableResource;
129
+ if (ctx.quiet) return (0, import_output.printIds)([node?.resourceId]);
130
+ (0, import_output.printNode)({ node: withSyntheticId(node), format: ctx.format, quiet: false });
131
+ return;
132
+ }
133
+ if (verb === "localizable-resources") {
134
+ const args = (0, import_router.parseStandardArgs)({
135
+ argv,
136
+ extraOptions: { "resource-type": { type: "string" }, "market-id": { type: "string" } }
137
+ });
138
+ const first = (0, import_shared.parseFirst)(args.first);
139
+ const after = args.after;
140
+ const reverse = args.reverse;
141
+ const resourceTypeRaw = args["resource-type"];
142
+ if (!resourceTypeRaw) throw new import_errors.CliError("Missing --resource-type", 2);
143
+ const resourceType = resourceTypeRaw.trim().toUpperCase();
144
+ const marketIdRaw = args["market-id"];
145
+ if (!marketIdRaw) throw new import_errors.CliError("Missing --market-id", 2);
146
+ const marketId = (0, import_gid.coerceGid)(marketIdRaw, "Market");
147
+ const nodeSelection = ensureResourceIdSelected(
148
+ (0, import_select.resolveSelection)({
149
+ typeName: "MarketLocalizableResource",
150
+ view: ctx.view,
151
+ baseSelection: getMarketLocalizableResourceSelection(ctx.view, marketId),
152
+ select: args.select,
153
+ selection: args.selection,
154
+ include: args.include,
155
+ ensureId: false
156
+ })
157
+ );
158
+ const result = await (0, import_router.runQuery)(ctx, {
159
+ marketLocalizableResources: {
160
+ __args: { first, after, reverse, resourceType },
161
+ pageInfo: { hasNextPage: true, endCursor: true },
162
+ nodes: nodeSelection
163
+ }
164
+ });
165
+ if (result === void 0) return;
166
+ const nodes = (result.marketLocalizableResources?.nodes ?? []).map(withSyntheticId);
167
+ const connection = { ...result.marketLocalizableResources, nodes };
168
+ if (ctx.quiet) return (0, import_output.printIds)(nodes.map((n) => n?.id));
169
+ (0, import_output.printConnection)({
170
+ connection,
171
+ format: ctx.format,
172
+ quiet: false,
173
+ nextPageArgs: {
174
+ base: "shop market-localizations localizable-resources",
175
+ first,
176
+ reverse: reverse === true,
177
+ extraFlags: [{ flag: "--resource-type", value: resourceType }]
178
+ }
179
+ });
180
+ return;
181
+ }
182
+ if (verb === "localizable-resources-by-ids") {
183
+ const args = (0, import_router.parseStandardArgs)({
184
+ argv,
185
+ extraOptions: { "resource-ids": { type: "string", multiple: true }, "market-id": { type: "string" } }
186
+ });
187
+ const first = (0, import_shared.parseFirst)(args.first);
188
+ const after = args.after;
189
+ const reverse = args.reverse;
190
+ const resourceIds = (0, import_shared.parseStringList)(args["resource-ids"], "--resource-ids");
191
+ const marketIdRaw = args["market-id"];
192
+ if (!marketIdRaw) throw new import_errors.CliError("Missing --market-id", 2);
193
+ const marketId = (0, import_gid.coerceGid)(marketIdRaw, "Market");
194
+ const nodeSelection = ensureResourceIdSelected(
195
+ (0, import_select.resolveSelection)({
196
+ typeName: "MarketLocalizableResource",
197
+ view: ctx.view,
198
+ baseSelection: getMarketLocalizableResourceSelection(ctx.view, marketId),
199
+ select: args.select,
200
+ selection: args.selection,
201
+ include: args.include,
202
+ ensureId: false
203
+ })
204
+ );
205
+ const result = await (0, import_router.runQuery)(ctx, {
206
+ marketLocalizableResourcesByIds: {
207
+ __args: { first, after, reverse, resourceIds },
208
+ pageInfo: { hasNextPage: true, endCursor: true },
209
+ nodes: nodeSelection
210
+ }
211
+ });
212
+ if (result === void 0) return;
213
+ const nodes = (result.marketLocalizableResourcesByIds?.nodes ?? []).map(withSyntheticId);
214
+ const connection = { ...result.marketLocalizableResourcesByIds, nodes };
215
+ if (ctx.quiet) return (0, import_output.printIds)(nodes.map((n) => n?.id));
216
+ (0, import_output.printConnection)({
217
+ connection,
218
+ format: ctx.format,
219
+ quiet: false,
220
+ nextPageArgs: {
221
+ base: "shop market-localizations localizable-resources-by-ids",
222
+ first,
223
+ reverse: reverse === true,
224
+ extraFlags: resourceIds.map((id) => ({ flag: "--resource-ids", value: id }))
225
+ }
226
+ });
227
+ return;
228
+ }
229
+ if (verb === "register") {
230
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "resource-id": { type: "string" } } });
231
+ const resourceId = args["resource-id"];
232
+ if (!resourceId) throw new import_errors.CliError("Missing --resource-id", 2);
233
+ const built = (0, import_input.buildInput)({
234
+ inputArg: args.input,
235
+ setArgs: args.set,
236
+ setJsonArgs: args["set-json"]
237
+ });
238
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
239
+ let marketLocalizations = extractArrayField(built.input, "marketLocalizations");
240
+ if (!marketLocalizations || marketLocalizations.length === 0) {
241
+ throw new import_errors.CliError("Missing marketLocalizations array (use --input [...] or --set marketLocalizations[0].*)", 2);
242
+ }
243
+ const result = await (0, import_router.runMutation)(ctx, {
244
+ marketLocalizationsRegister: {
245
+ __args: { resourceId, marketLocalizations },
246
+ marketLocalizations: { key: true, value: true, market: { id: true, name: true } },
247
+ userErrors: { field: true, message: true }
248
+ }
249
+ });
250
+ if (result === void 0) return;
251
+ (0, import_userErrors.maybeFailOnUserErrors)({
252
+ payload: result.marketLocalizationsRegister,
253
+ failOnUserErrors: ctx.failOnUserErrors
254
+ });
255
+ if (ctx.quiet) return;
256
+ (0, import_output.printJson)(result.marketLocalizationsRegister, ctx.format !== "raw");
257
+ return;
258
+ }
259
+ if (verb === "remove") {
260
+ const args = (0, import_router.parseStandardArgs)({
261
+ argv,
262
+ extraOptions: {
263
+ "resource-id": { type: "string" },
264
+ "market-ids": { type: "string", multiple: true },
265
+ keys: { type: "string" }
266
+ }
267
+ });
268
+ const resourceId = args["resource-id"];
269
+ if (!resourceId) throw new import_errors.CliError("Missing --resource-id", 2);
270
+ const marketIds = parseMarketIds(args["market-ids"]);
271
+ const marketLocalizationKeys = (0, import_shared.parseCsv)(args.keys, "--keys");
272
+ const result = await (0, import_router.runMutation)(ctx, {
273
+ marketLocalizationsRemove: {
274
+ __args: { resourceId, marketIds, marketLocalizationKeys },
275
+ marketLocalizations: { key: true, value: true, market: { id: true, name: true } },
276
+ userErrors: { field: true, message: true }
277
+ }
278
+ });
279
+ if (result === void 0) return;
280
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.marketLocalizationsRemove, failOnUserErrors: ctx.failOnUserErrors });
281
+ if (ctx.quiet) return;
282
+ (0, import_output.printJson)(result.marketLocalizationsRemove, ctx.format !== "raw");
283
+ return;
284
+ }
285
+ throw new import_errors.CliError(`Unknown verb for market-localizations: ${verb}`, 2);
286
+ };
287
+ // Annotate the CommonJS export names for ESM import in node:
288
+ 0 && (module.exports = {
289
+ runMarketLocalizations
290
+ });
291
+ //# sourceMappingURL=market-localizations.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runMarketWebPresences: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;