shop-cli 0.1.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 (340) 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 +5651 -0
  23. package/dist/cli/help/render.d.ts +7 -0
  24. package/dist/cli/help/render.js +352 -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/router.d.ts +29 -0
  42. package/dist/cli/router.js +480 -0
  43. package/dist/cli/selection/buildAllSelection.d.ts +13 -0
  44. package/dist/cli/selection/buildAllSelection.js +108 -0
  45. package/dist/cli/selection/graphqlSelection.d.ts +5 -0
  46. package/dist/cli/selection/graphqlSelection.js +301 -0
  47. package/dist/cli/selection/select.d.ts +13 -0
  48. package/dist/cli/selection/select.js +136 -0
  49. package/dist/cli/selection/stripDeprecated.d.ts +2 -0
  50. package/dist/cli/selection/stripDeprecated.js +63 -0
  51. package/dist/cli/userErrors.d.ts +4 -0
  52. package/dist/cli/userErrors.js +41 -0
  53. package/dist/cli/verbs/_shared.d.ts +38 -0
  54. package/dist/cli/verbs/_shared.js +180 -0
  55. package/dist/cli/verbs/abandoned-checkouts.d.ts +6 -0
  56. package/dist/cli/verbs/abandoned-checkouts.js +259 -0
  57. package/dist/cli/verbs/app-billing.d.ts +6 -0
  58. package/dist/cli/verbs/app-billing.js +452 -0
  59. package/dist/cli/verbs/apps.d.ts +6 -0
  60. package/dist/cli/verbs/apps.js +296 -0
  61. package/dist/cli/verbs/articles.d.ts +6 -0
  62. package/dist/cli/verbs/articles.js +251 -0
  63. package/dist/cli/verbs/backup.d.ts +6 -0
  64. package/dist/cli/verbs/backup.js +94 -0
  65. package/dist/cli/verbs/blogs.d.ts +6 -0
  66. package/dist/cli/verbs/blogs.js +273 -0
  67. package/dist/cli/verbs/bulk-operations.d.ts +6 -0
  68. package/dist/cli/verbs/bulk-operations.js +272 -0
  69. package/dist/cli/verbs/business-entities.d.ts +6 -0
  70. package/dist/cli/verbs/business-entities.js +102 -0
  71. package/dist/cli/verbs/carrier-services.d.ts +6 -0
  72. package/dist/cli/verbs/carrier-services.js +195 -0
  73. package/dist/cli/verbs/cart-transforms.d.ts +6 -0
  74. package/dist/cli/verbs/cart-transforms.js +141 -0
  75. package/dist/cli/verbs/cash-tracking.d.ts +6 -0
  76. package/dist/cli/verbs/cash-tracking.js +118 -0
  77. package/dist/cli/verbs/catalogs.d.ts +6 -0
  78. package/dist/cli/verbs/catalogs.js +267 -0
  79. package/dist/cli/verbs/channels.d.ts +6 -0
  80. package/dist/cli/verbs/channels.js +120 -0
  81. package/dist/cli/verbs/checkout-branding.d.ts +6 -0
  82. package/dist/cli/verbs/checkout-branding.js +144 -0
  83. package/dist/cli/verbs/checkout-profiles.d.ts +6 -0
  84. package/dist/cli/verbs/checkout-profiles.js +124 -0
  85. package/dist/cli/verbs/collections.d.ts +6 -0
  86. package/dist/cli/verbs/collections.js +485 -0
  87. package/dist/cli/verbs/comments.d.ts +6 -0
  88. package/dist/cli/verbs/comments.js +160 -0
  89. package/dist/cli/verbs/companies.d.ts +6 -0
  90. package/dist/cli/verbs/companies.js +313 -0
  91. package/dist/cli/verbs/company-contacts.d.ts +6 -0
  92. package/dist/cli/verbs/company-contacts.js +314 -0
  93. package/dist/cli/verbs/company-locations.d.ts +6 -0
  94. package/dist/cli/verbs/company-locations.js +467 -0
  95. package/dist/cli/verbs/customer-account-pages.d.ts +6 -0
  96. package/dist/cli/verbs/customer-account-pages.js +97 -0
  97. package/dist/cli/verbs/customer-payment-methods.d.ts +6 -0
  98. package/dist/cli/verbs/customer-payment-methods.js +358 -0
  99. package/dist/cli/verbs/customer-privacy.d.ts +6 -0
  100. package/dist/cli/verbs/customer-privacy.js +167 -0
  101. package/dist/cli/verbs/customer-segments.d.ts +6 -0
  102. package/dist/cli/verbs/customer-segments.js +193 -0
  103. package/dist/cli/verbs/customers.d.ts +6 -0
  104. package/dist/cli/verbs/customers.js +656 -0
  105. package/dist/cli/verbs/delegate-tokens.d.ts +6 -0
  106. package/dist/cli/verbs/delegate-tokens.js +95 -0
  107. package/dist/cli/verbs/delivery-customizations.d.ts +6 -0
  108. package/dist/cli/verbs/delivery-customizations.js +205 -0
  109. package/dist/cli/verbs/delivery-profile-locations.d.ts +6 -0
  110. package/dist/cli/verbs/delivery-profile-locations.js +90 -0
  111. package/dist/cli/verbs/delivery-profiles.d.ts +6 -0
  112. package/dist/cli/verbs/delivery-profiles.js +207 -0
  113. package/dist/cli/verbs/delivery-promises.d.ts +6 -0
  114. package/dist/cli/verbs/delivery-promises.js +262 -0
  115. package/dist/cli/verbs/delivery-settings.d.ts +6 -0
  116. package/dist/cli/verbs/delivery-settings.js +85 -0
  117. package/dist/cli/verbs/discount-nodes.d.ts +6 -0
  118. package/dist/cli/verbs/discount-nodes.js +169 -0
  119. package/dist/cli/verbs/discount-redeem-codes.d.ts +6 -0
  120. package/dist/cli/verbs/discount-redeem-codes.js +102 -0
  121. package/dist/cli/verbs/discount-saved-searches.d.ts +6 -0
  122. package/dist/cli/verbs/discount-saved-searches.js +113 -0
  123. package/dist/cli/verbs/discounts-automatic.d.ts +6 -0
  124. package/dist/cli/verbs/discounts-automatic.js +475 -0
  125. package/dist/cli/verbs/discounts-code.d.ts +6 -0
  126. package/dist/cli/verbs/discounts-code.js +523 -0
  127. package/dist/cli/verbs/disputes.d.ts +6 -0
  128. package/dist/cli/verbs/disputes.js +154 -0
  129. package/dist/cli/verbs/draft-orders.d.ts +6 -0
  130. package/dist/cli/verbs/draft-orders.js +429 -0
  131. package/dist/cli/verbs/events.d.ts +6 -0
  132. package/dist/cli/verbs/events.js +182 -0
  133. package/dist/cli/verbs/file-saved-searches.d.ts +6 -0
  134. package/dist/cli/verbs/file-saved-searches.js +83 -0
  135. package/dist/cli/verbs/files.d.ts +6 -0
  136. package/dist/cli/verbs/files.js +213 -0
  137. package/dist/cli/verbs/finance.d.ts +6 -0
  138. package/dist/cli/verbs/finance.js +115 -0
  139. package/dist/cli/verbs/flow.d.ts +6 -0
  140. package/dist/cli/verbs/flow.js +94 -0
  141. package/dist/cli/verbs/fulfillment-constraint-rules.d.ts +6 -0
  142. package/dist/cli/verbs/fulfillment-constraint-rules.js +139 -0
  143. package/dist/cli/verbs/fulfillment-orders.d.ts +6 -0
  144. package/dist/cli/verbs/fulfillment-orders.js +674 -0
  145. package/dist/cli/verbs/fulfillment-services.d.ts +6 -0
  146. package/dist/cli/verbs/fulfillment-services.js +212 -0
  147. package/dist/cli/verbs/fulfillments.d.ts +6 -0
  148. package/dist/cli/verbs/fulfillments.js +273 -0
  149. package/dist/cli/verbs/gift-cards.d.ts +6 -0
  150. package/dist/cli/verbs/gift-cards.js +359 -0
  151. package/dist/cli/verbs/graphql.d.ts +14 -0
  152. package/dist/cli/verbs/graphql.js +285 -0
  153. package/dist/cli/verbs/inventory-items.d.ts +6 -0
  154. package/dist/cli/verbs/inventory-items.js +164 -0
  155. package/dist/cli/verbs/inventory-shipments.d.ts +6 -0
  156. package/dist/cli/verbs/inventory-shipments.js +276 -0
  157. package/dist/cli/verbs/inventory-transfers.d.ts +6 -0
  158. package/dist/cli/verbs/inventory-transfers.js +396 -0
  159. package/dist/cli/verbs/inventory.d.ts +6 -0
  160. package/dist/cli/verbs/inventory.js +551 -0
  161. package/dist/cli/verbs/locales.d.ts +6 -0
  162. package/dist/cli/verbs/locales.js +61 -0
  163. package/dist/cli/verbs/locations.d.ts +6 -0
  164. package/dist/cli/verbs/locations.js +385 -0
  165. package/dist/cli/verbs/market-localizations.d.ts +6 -0
  166. package/dist/cli/verbs/market-localizations.js +291 -0
  167. package/dist/cli/verbs/market-web-presences.d.ts +6 -0
  168. package/dist/cli/verbs/market-web-presences.js +139 -0
  169. package/dist/cli/verbs/marketing-activities.d.ts +6 -0
  170. package/dist/cli/verbs/marketing-activities.js +353 -0
  171. package/dist/cli/verbs/marketing-events.d.ts +6 -0
  172. package/dist/cli/verbs/marketing-events.js +132 -0
  173. package/dist/cli/verbs/markets.d.ts +6 -0
  174. package/dist/cli/verbs/markets.js +324 -0
  175. package/dist/cli/verbs/menus.d.ts +6 -0
  176. package/dist/cli/verbs/menus.js +251 -0
  177. package/dist/cli/verbs/metafield-definition-tools.d.ts +6 -0
  178. package/dist/cli/verbs/metafield-definition-tools.js +289 -0
  179. package/dist/cli/verbs/metafield-definitions.d.ts +6 -0
  180. package/dist/cli/verbs/metafield-definitions.js +240 -0
  181. package/dist/cli/verbs/metafields.d.ts +6 -0
  182. package/dist/cli/verbs/metafields.js +112 -0
  183. package/dist/cli/verbs/metaobject-definition-tools.d.ts +6 -0
  184. package/dist/cli/verbs/metaobject-definition-tools.js +83 -0
  185. package/dist/cli/verbs/metaobject-definitions.d.ts +6 -0
  186. package/dist/cli/verbs/metaobject-definitions.js +176 -0
  187. package/dist/cli/verbs/metaobjects.d.ts +6 -0
  188. package/dist/cli/verbs/metaobjects.js +297 -0
  189. package/dist/cli/verbs/mobile-platform-applications.d.ts +6 -0
  190. package/dist/cli/verbs/mobile-platform-applications.js +247 -0
  191. package/dist/cli/verbs/order-edit.d.ts +6 -0
  192. package/dist/cli/verbs/order-edit.js +596 -0
  193. package/dist/cli/verbs/orders.d.ts +6 -0
  194. package/dist/cli/verbs/orders.js +781 -0
  195. package/dist/cli/verbs/pages.d.ts +6 -0
  196. package/dist/cli/verbs/pages.js +234 -0
  197. package/dist/cli/verbs/payment-customizations.d.ts +6 -0
  198. package/dist/cli/verbs/payment-customizations.js +193 -0
  199. package/dist/cli/verbs/payment-terms.d.ts +6 -0
  200. package/dist/cli/verbs/payment-terms.js +228 -0
  201. package/dist/cli/verbs/point-of-sale.d.ts +6 -0
  202. package/dist/cli/verbs/point-of-sale.js +57 -0
  203. package/dist/cli/verbs/price-lists.d.ts +6 -0
  204. package/dist/cli/verbs/price-lists.js +426 -0
  205. package/dist/cli/verbs/product-feeds.d.ts +6 -0
  206. package/dist/cli/verbs/product-feeds.js +187 -0
  207. package/dist/cli/verbs/product-variants.d.ts +6 -0
  208. package/dist/cli/verbs/product-variants.js +388 -0
  209. package/dist/cli/verbs/products.d.ts +6 -0
  210. package/dist/cli/verbs/products.js +1257 -0
  211. package/dist/cli/verbs/publications.d.ts +6 -0
  212. package/dist/cli/verbs/publications.js +256 -0
  213. package/dist/cli/verbs/publishables.d.ts +6 -0
  214. package/dist/cli/verbs/publishables.js +73 -0
  215. package/dist/cli/verbs/refunds.d.ts +6 -0
  216. package/dist/cli/verbs/refunds.js +226 -0
  217. package/dist/cli/verbs/resource-feedback.d.ts +6 -0
  218. package/dist/cli/verbs/resource-feedback.js +119 -0
  219. package/dist/cli/verbs/returnable-fulfillments.d.ts +6 -0
  220. package/dist/cli/verbs/returnable-fulfillments.js +102 -0
  221. package/dist/cli/verbs/returns.d.ts +6 -0
  222. package/dist/cli/verbs/returns.js +506 -0
  223. package/dist/cli/verbs/reverse-deliveries.d.ts +6 -0
  224. package/dist/cli/verbs/reverse-deliveries.js +203 -0
  225. package/dist/cli/verbs/reverse-fulfillment-orders.d.ts +6 -0
  226. package/dist/cli/verbs/reverse-fulfillment-orders.js +157 -0
  227. package/dist/cli/verbs/saved-searches.d.ts +6 -0
  228. package/dist/cli/verbs/saved-searches.js +150 -0
  229. package/dist/cli/verbs/script-tags.d.ts +6 -0
  230. package/dist/cli/verbs/script-tags.js +179 -0
  231. package/dist/cli/verbs/segments.d.ts +6 -0
  232. package/dist/cli/verbs/segments.js +343 -0
  233. package/dist/cli/verbs/selling-plan-group-products.d.ts +6 -0
  234. package/dist/cli/verbs/selling-plan-group-products.js +115 -0
  235. package/dist/cli/verbs/selling-plan-groups.d.ts +6 -0
  236. package/dist/cli/verbs/selling-plan-groups.js +208 -0
  237. package/dist/cli/verbs/server-pixels.d.ts +6 -0
  238. package/dist/cli/verbs/server-pixels.js +172 -0
  239. package/dist/cli/verbs/shipping-packages.d.ts +6 -0
  240. package/dist/cli/verbs/shipping-packages.js +107 -0
  241. package/dist/cli/verbs/shop-policies.d.ts +6 -0
  242. package/dist/cli/verbs/shop-policies.js +91 -0
  243. package/dist/cli/verbs/shop-utils.d.ts +6 -0
  244. package/dist/cli/verbs/shop-utils.js +147 -0
  245. package/dist/cli/verbs/shop.d.ts +6 -0
  246. package/dist/cli/verbs/shop.js +177 -0
  247. package/dist/cli/verbs/shopify-functions.d.ts +6 -0
  248. package/dist/cli/verbs/shopify-functions.js +127 -0
  249. package/dist/cli/verbs/shopify-payments.d.ts +6 -0
  250. package/dist/cli/verbs/shopify-payments.js +111 -0
  251. package/dist/cli/verbs/staff.d.ts +6 -0
  252. package/dist/cli/verbs/staff.js +127 -0
  253. package/dist/cli/verbs/staged-uploads.d.ts +6 -0
  254. package/dist/cli/verbs/staged-uploads.js +128 -0
  255. package/dist/cli/verbs/store-credit.d.ts +6 -0
  256. package/dist/cli/verbs/store-credit.js +209 -0
  257. package/dist/cli/verbs/storefront-access-tokens.d.ts +6 -0
  258. package/dist/cli/verbs/storefront-access-tokens.js +183 -0
  259. package/dist/cli/verbs/subscription-billing-cycles.d.ts +6 -0
  260. package/dist/cli/verbs/subscription-billing-cycles.js +391 -0
  261. package/dist/cli/verbs/subscription-billing.d.ts +6 -0
  262. package/dist/cli/verbs/subscription-billing.js +391 -0
  263. package/dist/cli/verbs/subscription-contracts.d.ts +6 -0
  264. package/dist/cli/verbs/subscription-contracts.js +391 -0
  265. package/dist/cli/verbs/subscription-drafts.d.ts +6 -0
  266. package/dist/cli/verbs/subscription-drafts.js +315 -0
  267. package/dist/cli/verbs/tags.d.ts +6 -0
  268. package/dist/cli/verbs/tags.js +73 -0
  269. package/dist/cli/verbs/tax.d.ts +6 -0
  270. package/dist/cli/verbs/tax.js +114 -0
  271. package/dist/cli/verbs/taxonomy.d.ts +6 -0
  272. package/dist/cli/verbs/taxonomy.js +99 -0
  273. package/dist/cli/verbs/tender-transactions.d.ts +6 -0
  274. package/dist/cli/verbs/tender-transactions.js +105 -0
  275. package/dist/cli/verbs/themes.d.ts +6 -0
  276. package/dist/cli/verbs/themes.js +297 -0
  277. package/dist/cli/verbs/translations.d.ts +6 -0
  278. package/dist/cli/verbs/translations.js +221 -0
  279. package/dist/cli/verbs/types.d.ts +4 -0
  280. package/dist/cli/verbs/types.js +224 -0
  281. package/dist/cli/verbs/url-redirects.d.ts +6 -0
  282. package/dist/cli/verbs/url-redirects.js +407 -0
  283. package/dist/cli/verbs/validations.d.ts +6 -0
  284. package/dist/cli/verbs/validations.js +181 -0
  285. package/dist/cli/verbs/web-pixels.d.ts +6 -0
  286. package/dist/cli/verbs/web-pixels.js +145 -0
  287. package/dist/cli/verbs/web-presences.d.ts +6 -0
  288. package/dist/cli/verbs/web-presences.js +186 -0
  289. package/dist/cli/verbs/webhooks.d.ts +6 -0
  290. package/dist/cli/verbs/webhooks.js +336 -0
  291. package/dist/cli/workflows/files/stagedUploads.d.ts +28 -0
  292. package/dist/cli/workflows/files/stagedUploads.js +175 -0
  293. package/dist/cli/workflows/inventory/resolveInventoryItemId.d.ts +6 -0
  294. package/dist/cli/workflows/inventory/resolveInventoryItemId.js +59 -0
  295. package/dist/cli/workflows/productVariants/upsert.d.ts +8 -0
  296. package/dist/cli/workflows/productVariants/upsert.js +110 -0
  297. package/dist/cli/workflows/products/metafieldsUpsert.d.ts +6 -0
  298. package/dist/cli/workflows/products/metafieldsUpsert.js +94 -0
  299. package/dist/cli/workflows/products/publishablePublish.d.ts +21 -0
  300. package/dist/cli/workflows/products/publishablePublish.js +131 -0
  301. package/dist/cli/workflows/publications/resolvePublicationId.d.ts +17 -0
  302. package/dist/cli/workflows/publications/resolvePublicationId.js +93 -0
  303. package/dist/cli.d.ts +1 -0
  304. package/dist/cli.js +152 -0
  305. package/dist/defaults.d.ts +2 -0
  306. package/dist/defaults.js +38 -0
  307. package/dist/generated/admin-2026-04/index.d.ts +25 -0
  308. package/dist/generated/admin-2026-04/index.js +70 -0
  309. package/dist/generated/admin-2026-04/runtime/batcher.d.ts +105 -0
  310. package/dist/generated/admin-2026-04/runtime/batcher.js +203 -0
  311. package/dist/generated/admin-2026-04/runtime/createClient.d.ts +17 -0
  312. package/dist/generated/admin-2026-04/runtime/createClient.js +59 -0
  313. package/dist/generated/admin-2026-04/runtime/error.d.ts +18 -0
  314. package/dist/generated/admin-2026-04/runtime/error.js +44 -0
  315. package/dist/generated/admin-2026-04/runtime/fetcher.d.ts +10 -0
  316. package/dist/generated/admin-2026-04/runtime/fetcher.js +104 -0
  317. package/dist/generated/admin-2026-04/runtime/generateGraphqlOperation.d.ts +30 -0
  318. package/dist/generated/admin-2026-04/runtime/generateGraphqlOperation.js +191 -0
  319. package/dist/generated/admin-2026-04/runtime/index.d.ts +11 -0
  320. package/dist/generated/admin-2026-04/runtime/index.js +46 -0
  321. package/dist/generated/admin-2026-04/runtime/linkTypeMap.d.ts +9 -0
  322. package/dist/generated/admin-2026-04/runtime/linkTypeMap.js +142 -0
  323. package/dist/generated/admin-2026-04/runtime/typeSelection.d.ts +28 -0
  324. package/dist/generated/admin-2026-04/runtime/typeSelection.js +17 -0
  325. package/dist/generated/admin-2026-04/runtime/types.d.ts +55 -0
  326. package/dist/generated/admin-2026-04/runtime/types.js +17 -0
  327. package/dist/generated/admin-2026-04/schema.d.ts +102240 -0
  328. package/dist/generated/admin-2026-04/schema.graphql +91596 -0
  329. package/dist/generated/admin-2026-04/schema.js +20322 -0
  330. package/dist/generated/admin-2026-04/types.d.ts +24224 -0
  331. package/dist/generated/admin-2026-04/types.js +62299 -0
  332. package/dist/generated/help/schema-help.d.ts +30 -0
  333. package/dist/generated/help/schema-help.js +61833 -0
  334. package/dist/graphqlValidator.d.ts +17 -0
  335. package/dist/graphqlValidator.js +84 -0
  336. package/dist/index.d.ts +1 -0
  337. package/dist/index.js +23 -0
  338. package/package.json +65 -0
  339. package/schema/2026-04.graphql +61256 -0
  340. package/schema/2026-04.introspection.json +1 -0
@@ -0,0 +1,179 @@
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 script_tags_exports = {};
20
+ __export(script_tags_exports, {
21
+ runScriptTags: () => runScriptTags
22
+ });
23
+ module.exports = __toCommonJS(script_tags_exports);
24
+ var import_errors = require("../errors");
25
+ var import_input = require("../input");
26
+ var import_output = require("../output");
27
+ var import_router = require("../router");
28
+ var import_select = require("../selection/select");
29
+ var import_userErrors = require("../userErrors");
30
+ var import_shared = require("./_shared");
31
+ const scriptTagSelection = {
32
+ id: true,
33
+ src: true,
34
+ displayScope: true,
35
+ cache: true,
36
+ createdAt: true,
37
+ updatedAt: true
38
+ };
39
+ const getScriptTagSelection = (view) => {
40
+ if (view === "ids") return { id: true };
41
+ if (view === "raw") return {};
42
+ return scriptTagSelection;
43
+ };
44
+ const runScriptTags = async ({
45
+ ctx,
46
+ verb,
47
+ argv
48
+ }) => {
49
+ if (argv.includes("--help") || argv.includes("-h")) {
50
+ console.log(
51
+ [
52
+ "Usage:",
53
+ " shop script-tags <verb> [flags]",
54
+ "",
55
+ "Verbs:",
56
+ " create|get|list|update|delete",
57
+ "",
58
+ "Common output flags:",
59
+ " --view summary|ids|raw",
60
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
61
+ " --selection <graphql> (selection override; can be @file.gql)"
62
+ ].join("\n")
63
+ );
64
+ return;
65
+ }
66
+ if (verb === "get") {
67
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
68
+ const id = (0, import_shared.requireId)(args.id, "ScriptTag");
69
+ const selection = (0, import_select.resolveSelection)({
70
+ resource: "script-tags",
71
+ view: ctx.view,
72
+ baseSelection: getScriptTagSelection(ctx.view),
73
+ select: args.select,
74
+ selection: args.selection,
75
+ include: args.include,
76
+ ensureId: ctx.quiet
77
+ });
78
+ const result = await (0, import_router.runQuery)(ctx, { scriptTag: { __args: { id }, ...selection } });
79
+ if (result === void 0) return;
80
+ (0, import_output.printNode)({ node: result.scriptTag, format: ctx.format, quiet: ctx.quiet });
81
+ return;
82
+ }
83
+ if (verb === "list") {
84
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
85
+ const first = (0, import_shared.parseFirst)(args.first);
86
+ const after = args.after;
87
+ const reverse = args.reverse;
88
+ const nodeSelection = (0, import_select.resolveSelection)({
89
+ resource: "script-tags",
90
+ view: ctx.view,
91
+ baseSelection: getScriptTagSelection(ctx.view),
92
+ select: args.select,
93
+ selection: args.selection,
94
+ include: args.include,
95
+ ensureId: ctx.quiet
96
+ });
97
+ const result = await (0, import_router.runQuery)(ctx, {
98
+ scriptTags: {
99
+ __args: { first, after, reverse },
100
+ pageInfo: { hasNextPage: true, endCursor: true },
101
+ nodes: nodeSelection
102
+ }
103
+ });
104
+ if (result === void 0) return;
105
+ (0, import_output.printConnection)({
106
+ connection: result.scriptTags,
107
+ format: ctx.format,
108
+ quiet: ctx.quiet,
109
+ nextPageArgs: (0, import_shared.buildListNextPageArgs)("script-tags", { first, reverse })
110
+ });
111
+ return;
112
+ }
113
+ if (verb === "create") {
114
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
115
+ const built = (0, import_input.buildInput)({
116
+ inputArg: args.input,
117
+ setArgs: args.set,
118
+ setJsonArgs: args["set-json"]
119
+ });
120
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
121
+ const result = await (0, import_router.runMutation)(ctx, {
122
+ scriptTagCreate: {
123
+ __args: { input: built.input },
124
+ scriptTag: scriptTagSelection,
125
+ userErrors: { field: true, message: true }
126
+ }
127
+ });
128
+ if (result === void 0) return;
129
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.scriptTagCreate, failOnUserErrors: ctx.failOnUserErrors });
130
+ if (ctx.quiet) return console.log(result.scriptTagCreate?.scriptTag?.id ?? "");
131
+ (0, import_output.printJson)(result.scriptTagCreate, ctx.format !== "raw");
132
+ return;
133
+ }
134
+ if (verb === "update") {
135
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
136
+ const id = (0, import_shared.requireId)(args.id, "ScriptTag");
137
+ const built = (0, import_input.buildInput)({
138
+ inputArg: args.input,
139
+ setArgs: args.set,
140
+ setJsonArgs: args["set-json"]
141
+ });
142
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
143
+ const result = await (0, import_router.runMutation)(ctx, {
144
+ scriptTagUpdate: {
145
+ __args: { id, input: built.input },
146
+ scriptTag: scriptTagSelection,
147
+ userErrors: { field: true, message: true }
148
+ }
149
+ });
150
+ if (result === void 0) return;
151
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.scriptTagUpdate, failOnUserErrors: ctx.failOnUserErrors });
152
+ if (ctx.quiet) return console.log(result.scriptTagUpdate?.scriptTag?.id ?? "");
153
+ (0, import_output.printJson)(result.scriptTagUpdate, ctx.format !== "raw");
154
+ return;
155
+ }
156
+ if (verb === "delete") {
157
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
158
+ const id = (0, import_shared.requireId)(args.id, "ScriptTag");
159
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
160
+ const result = await (0, import_router.runMutation)(ctx, {
161
+ scriptTagDelete: {
162
+ __args: { id },
163
+ deletedScriptTagId: true,
164
+ userErrors: { field: true, message: true }
165
+ }
166
+ });
167
+ if (result === void 0) return;
168
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.scriptTagDelete, failOnUserErrors: ctx.failOnUserErrors });
169
+ if (ctx.quiet) return console.log(result.scriptTagDelete?.deletedScriptTagId ?? "");
170
+ (0, import_output.printJson)(result.scriptTagDelete, ctx.format !== "raw");
171
+ return;
172
+ }
173
+ throw new import_errors.CliError(`Unknown verb for script-tags: ${verb}`, 2);
174
+ };
175
+ // Annotate the CommonJS export names for ESM import in node:
176
+ 0 && (module.exports = {
177
+ runScriptTags
178
+ });
179
+ //# sourceMappingURL=script-tags.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runSegments: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;
@@ -0,0 +1,343 @@
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 segments_exports = {};
20
+ __export(segments_exports, {
21
+ runSegments: () => runSegments
22
+ });
23
+ module.exports = __toCommonJS(segments_exports);
24
+ var import_errors = require("../errors");
25
+ var import_input = require("../input");
26
+ var import_output = require("../output");
27
+ var import_router = require("../router");
28
+ var import_select = require("../selection/select");
29
+ var import_userErrors = require("../userErrors");
30
+ var import_shared = require("./_shared");
31
+ const segmentFilterSelection = {
32
+ __typename: true,
33
+ queryName: true,
34
+ localizedName: true,
35
+ multiValue: true
36
+ };
37
+ const segmentValueSelection = {
38
+ __typename: true,
39
+ queryName: true,
40
+ localizedValue: true
41
+ };
42
+ const segmentMigrationSelection = {
43
+ id: true,
44
+ savedSearchId: true,
45
+ segmentId: true
46
+ };
47
+ const segmentSummarySelection = {
48
+ id: true,
49
+ name: true,
50
+ creationDate: true,
51
+ lastEditDate: true
52
+ };
53
+ const segmentFullSelection = {
54
+ ...segmentSummarySelection,
55
+ query: true
56
+ };
57
+ const getSegmentSelection = (view) => {
58
+ if (view === "ids") return { id: true };
59
+ if (view === "full") return segmentFullSelection;
60
+ if (view === "raw") return {};
61
+ return segmentSummarySelection;
62
+ };
63
+ const pickSegmentArgs = (value) => {
64
+ if (value === null || typeof value !== "object") throw new import_errors.CliError("Segment input must be an object", 2);
65
+ const out = {};
66
+ if (value.name !== void 0) out.name = value.name;
67
+ if (value.query !== void 0) out.query = value.query;
68
+ return out;
69
+ };
70
+ const runSegments = async ({
71
+ ctx,
72
+ verb,
73
+ argv
74
+ }) => {
75
+ if (argv.includes("--help") || argv.includes("-h")) {
76
+ console.log(
77
+ [
78
+ "Usage:",
79
+ " shop segments <verb> [flags]",
80
+ "",
81
+ "Verbs:",
82
+ " create|get|list|count|update|delete",
83
+ " filters|filter-suggestions|value-suggestions|migrations",
84
+ "",
85
+ "Common output flags:",
86
+ " --view summary|ids|full|raw",
87
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
88
+ " --selection <graphql> (selection override; can be @file.gql)"
89
+ ].join("\n")
90
+ );
91
+ return;
92
+ }
93
+ if (verb === "count") {
94
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { limit: { type: "string" } } });
95
+ const limitRaw = args.limit;
96
+ const limit = limitRaw === void 0 || limitRaw === null || limitRaw === "" ? void 0 : Number(limitRaw);
97
+ if (limit !== void 0 && (!Number.isFinite(limit) || limit <= 0)) {
98
+ throw new import_errors.CliError("--limit must be a positive number", 2);
99
+ }
100
+ const result = await (0, import_router.runQuery)(ctx, {
101
+ segmentsCount: {
102
+ __args: { ...limit !== void 0 ? { limit: Math.floor(limit) } : {} },
103
+ count: true,
104
+ precision: true
105
+ }
106
+ });
107
+ if (result === void 0) return;
108
+ if (ctx.quiet) return console.log(result.segmentsCount?.count ?? "");
109
+ (0, import_output.printJson)(result.segmentsCount, ctx.format !== "raw");
110
+ return;
111
+ }
112
+ if (verb === "filters") {
113
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
114
+ const first = (0, import_shared.parseFirst)(args.first);
115
+ const after = args.after;
116
+ const result = await (0, import_router.runQuery)(ctx, {
117
+ segmentFilters: {
118
+ __args: { first, after },
119
+ pageInfo: { hasNextPage: true, endCursor: true },
120
+ nodes: segmentFilterSelection
121
+ }
122
+ });
123
+ if (result === void 0) return;
124
+ (0, import_output.printConnection)({
125
+ connection: result.segmentFilters,
126
+ format: ctx.format,
127
+ quiet: ctx.quiet,
128
+ nextPageArgs: { base: "shop segments filters", first }
129
+ });
130
+ return;
131
+ }
132
+ if (verb === "filter-suggestions") {
133
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { search: { type: "string" } } });
134
+ const first = (0, import_shared.parseFirst)(args.first);
135
+ const after = args.after;
136
+ const search = args.search;
137
+ if (!search) throw new import_errors.CliError("Missing --search", 2);
138
+ const result = await (0, import_router.runQuery)(ctx, {
139
+ segmentFilterSuggestions: {
140
+ __args: { first, after, search },
141
+ pageInfo: { hasNextPage: true, endCursor: true },
142
+ nodes: segmentFilterSelection
143
+ }
144
+ });
145
+ if (result === void 0) return;
146
+ (0, import_output.printConnection)({
147
+ connection: result.segmentFilterSuggestions,
148
+ format: ctx.format,
149
+ quiet: ctx.quiet,
150
+ nextPageArgs: {
151
+ base: "shop segments filter-suggestions",
152
+ first,
153
+ extraFlags: [{ flag: "--search", value: search }]
154
+ }
155
+ });
156
+ return;
157
+ }
158
+ if (verb === "value-suggestions") {
159
+ const args = (0, import_router.parseStandardArgs)({
160
+ argv,
161
+ extraOptions: {
162
+ search: { type: "string" },
163
+ "filter-query-name": { type: "string" },
164
+ "function-parameter-query-name": { type: "string" }
165
+ }
166
+ });
167
+ const first = (0, import_shared.parseFirst)(args.first);
168
+ const after = args.after;
169
+ const search = args.search;
170
+ if (!search) throw new import_errors.CliError("Missing --search", 2);
171
+ const filterQueryName = args["filter-query-name"];
172
+ const functionParameterQueryName = args["function-parameter-query-name"];
173
+ const result = await (0, import_router.runQuery)(ctx, {
174
+ segmentValueSuggestions: {
175
+ __args: {
176
+ first,
177
+ after,
178
+ search,
179
+ ...filterQueryName ? { filterQueryName } : {},
180
+ ...functionParameterQueryName ? { functionParameterQueryName } : {}
181
+ },
182
+ pageInfo: { hasNextPage: true, endCursor: true },
183
+ nodes: segmentValueSelection
184
+ }
185
+ });
186
+ if (result === void 0) return;
187
+ const extraFlags = [{ flag: "--search", value: search }];
188
+ if (filterQueryName) extraFlags.push({ flag: "--filter-query-name", value: filterQueryName });
189
+ if (functionParameterQueryName) extraFlags.push({ flag: "--function-parameter-query-name", value: functionParameterQueryName });
190
+ (0, import_output.printConnection)({
191
+ connection: result.segmentValueSuggestions,
192
+ format: ctx.format,
193
+ quiet: ctx.quiet,
194
+ nextPageArgs: { base: "shop segments value-suggestions", first, extraFlags }
195
+ });
196
+ return;
197
+ }
198
+ if (verb === "migrations") {
199
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "saved-search-id": { type: "string" } } });
200
+ const first = (0, import_shared.parseFirst)(args.first);
201
+ const after = args.after;
202
+ const savedSearchId = args["saved-search-id"];
203
+ const result = await (0, import_router.runQuery)(ctx, {
204
+ segmentMigrations: {
205
+ __args: { first, after, ...savedSearchId ? { savedSearchId } : {} },
206
+ pageInfo: { hasNextPage: true, endCursor: true },
207
+ nodes: segmentMigrationSelection
208
+ }
209
+ });
210
+ if (result === void 0) return;
211
+ const extraFlags = [];
212
+ if (savedSearchId) extraFlags.push({ flag: "--saved-search-id", value: savedSearchId });
213
+ (0, import_output.printConnection)({
214
+ connection: result.segmentMigrations,
215
+ format: ctx.format,
216
+ quiet: ctx.quiet,
217
+ nextPageArgs: { base: "shop segments migrations", first, extraFlags }
218
+ });
219
+ return;
220
+ }
221
+ if (verb === "get") {
222
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
223
+ const id = (0, import_shared.requireId)(args.id, "Segment");
224
+ const selection = (0, import_select.resolveSelection)({
225
+ resource: "segments",
226
+ view: ctx.view,
227
+ baseSelection: getSegmentSelection(ctx.view),
228
+ select: args.select,
229
+ selection: args.selection,
230
+ include: args.include,
231
+ ensureId: ctx.quiet
232
+ });
233
+ const result = await (0, import_router.runQuery)(ctx, { segment: { __args: { id }, ...selection } });
234
+ if (result === void 0) return;
235
+ (0, import_output.printNode)({ node: result.segment, format: ctx.format, quiet: ctx.quiet });
236
+ return;
237
+ }
238
+ if (verb === "list") {
239
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
240
+ const first = (0, import_shared.parseFirst)(args.first);
241
+ const after = args.after;
242
+ const query = args.query;
243
+ const reverse = args.reverse;
244
+ const sortKey = args.sort;
245
+ const nodeSelection = (0, import_select.resolveSelection)({
246
+ resource: "segments",
247
+ view: ctx.view,
248
+ baseSelection: getSegmentSelection(ctx.view),
249
+ select: args.select,
250
+ selection: args.selection,
251
+ include: args.include,
252
+ ensureId: ctx.quiet
253
+ });
254
+ const result = await (0, import_router.runQuery)(ctx, {
255
+ segments: {
256
+ __args: { first, after, query, reverse, sortKey },
257
+ pageInfo: { hasNextPage: true, endCursor: true },
258
+ nodes: nodeSelection
259
+ }
260
+ });
261
+ if (result === void 0) return;
262
+ (0, import_output.printConnection)({
263
+ connection: result.segments,
264
+ format: ctx.format,
265
+ quiet: ctx.quiet,
266
+ nextPageArgs: (0, import_shared.buildListNextPageArgs)("segments", { first, query, sort: sortKey, reverse })
267
+ });
268
+ return;
269
+ }
270
+ if (verb === "create") {
271
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
272
+ const built = (0, import_input.buildInput)({
273
+ inputArg: args.input,
274
+ setArgs: args.set,
275
+ setJsonArgs: args["set-json"]
276
+ });
277
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
278
+ const input = pickSegmentArgs(built.input);
279
+ if (!input.name) throw new import_errors.CliError("Missing name in --input/--set", 2);
280
+ if (!input.query) throw new import_errors.CliError("Missing query in --input/--set", 2);
281
+ const result = await (0, import_router.runMutation)(ctx, {
282
+ segmentCreate: {
283
+ __args: { name: input.name, query: input.query },
284
+ segment: segmentSummarySelection,
285
+ userErrors: { field: true, message: true }
286
+ }
287
+ });
288
+ if (result === void 0) return;
289
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.segmentCreate, failOnUserErrors: ctx.failOnUserErrors });
290
+ if (ctx.quiet) return console.log(result.segmentCreate?.segment?.id ?? "");
291
+ (0, import_output.printJson)(result.segmentCreate, ctx.format !== "raw");
292
+ return;
293
+ }
294
+ if (verb === "update") {
295
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
296
+ const id = (0, import_shared.requireId)(args.id, "Segment");
297
+ const built = (0, import_input.buildInput)({
298
+ inputArg: args.input,
299
+ setArgs: args.set,
300
+ setJsonArgs: args["set-json"]
301
+ });
302
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
303
+ const input = pickSegmentArgs(built.input);
304
+ if (input.name === void 0 && input.query === void 0) {
305
+ throw new import_errors.CliError("Nothing to update (expected name and/or query)", 2);
306
+ }
307
+ const result = await (0, import_router.runMutation)(ctx, {
308
+ segmentUpdate: {
309
+ __args: { id, ...input },
310
+ segment: segmentSummarySelection,
311
+ userErrors: { field: true, message: true }
312
+ }
313
+ });
314
+ if (result === void 0) return;
315
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.segmentUpdate, failOnUserErrors: ctx.failOnUserErrors });
316
+ if (ctx.quiet) return console.log(result.segmentUpdate?.segment?.id ?? "");
317
+ (0, import_output.printJson)(result.segmentUpdate, ctx.format !== "raw");
318
+ return;
319
+ }
320
+ if (verb === "delete") {
321
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
322
+ const id = (0, import_shared.requireId)(args.id, "Segment");
323
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
324
+ const result = await (0, import_router.runMutation)(ctx, {
325
+ segmentDelete: {
326
+ __args: { id },
327
+ deletedSegmentId: true,
328
+ userErrors: { field: true, message: true }
329
+ }
330
+ });
331
+ if (result === void 0) return;
332
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.segmentDelete, failOnUserErrors: ctx.failOnUserErrors });
333
+ if (ctx.quiet) return console.log(result.segmentDelete?.deletedSegmentId ?? "");
334
+ (0, import_output.printJson)(result.segmentDelete, ctx.format !== "raw");
335
+ return;
336
+ }
337
+ throw new import_errors.CliError(`Unknown verb for segments: ${verb}`, 2);
338
+ };
339
+ // Annotate the CommonJS export names for ESM import in node:
340
+ 0 && (module.exports = {
341
+ runSegments
342
+ });
343
+ //# sourceMappingURL=segments.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runSellingPlanGroupProducts: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;
@@ -0,0 +1,115 @@
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 selling_plan_group_products_exports = {};
20
+ __export(selling_plan_group_products_exports, {
21
+ runSellingPlanGroupProducts: () => runSellingPlanGroupProducts
22
+ });
23
+ module.exports = __toCommonJS(selling_plan_group_products_exports);
24
+ var import_errors = require("../errors");
25
+ var import_gid = require("../gid");
26
+ var import_output = require("../output");
27
+ var import_router = require("../router");
28
+ var import_userErrors = require("../userErrors");
29
+ var import_shared = require("./_shared");
30
+ const sellingPlanGroupSummarySelection = {
31
+ id: true,
32
+ name: true,
33
+ merchantCode: true,
34
+ createdAt: true
35
+ };
36
+ const parseProductIds = (value) => {
37
+ const ids = (0, import_shared.parseStringList)(value, "--product-ids");
38
+ return ids.map((id) => (0, import_gid.coerceGid)(id, "Product"));
39
+ };
40
+ const parseVariantIds = (value) => {
41
+ const ids = (0, import_shared.parseStringList)(value, "--variant-ids");
42
+ return ids.map((id) => (0, import_gid.coerceGid)(id, "ProductVariant"));
43
+ };
44
+ const runSellingPlanGroupProducts = async ({
45
+ ctx,
46
+ verb,
47
+ argv
48
+ }) => {
49
+ if (argv.includes("--help") || argv.includes("-h")) {
50
+ console.log(
51
+ [
52
+ "Usage:",
53
+ " shop selling-plan-group-products <verb> [flags]",
54
+ "",
55
+ "Verbs:",
56
+ " add-products|remove-products|add-product-variants|remove-product-variants",
57
+ "",
58
+ "Notes:",
59
+ " Use --id for the SellingPlanGroup ID.",
60
+ " Use --product-ids / --variant-ids as a comma-separated list or repeatable flag."
61
+ ].join("\n")
62
+ );
63
+ return;
64
+ }
65
+ if (verb === "add-products" || verb === "remove-products") {
66
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "product-ids": { type: "string", multiple: true } } });
67
+ const id = (0, import_shared.requireId)(args.id, "SellingPlanGroup");
68
+ const productIds = parseProductIds(args["product-ids"]);
69
+ const mutationField = verb === "add-products" ? "sellingPlanGroupAddProducts" : "sellingPlanGroupRemoveProducts";
70
+ const selection = verb === "add-products" ? { sellingPlanGroup: sellingPlanGroupSummarySelection, userErrors: { field: true, message: true } } : { removedProductIds: true, userErrors: { field: true, message: true } };
71
+ const result = await (0, import_router.runMutation)(ctx, {
72
+ [mutationField]: {
73
+ __args: { id, productIds },
74
+ ...selection
75
+ }
76
+ });
77
+ if (result === void 0) return;
78
+ const payload = result[mutationField];
79
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload, failOnUserErrors: ctx.failOnUserErrors });
80
+ if (ctx.quiet) {
81
+ if (verb === "add-products") return console.log(payload?.sellingPlanGroup?.id ?? "");
82
+ return;
83
+ }
84
+ (0, import_output.printJson)(payload, ctx.format !== "raw");
85
+ return;
86
+ }
87
+ if (verb === "add-product-variants" || verb === "remove-product-variants") {
88
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "variant-ids": { type: "string", multiple: true } } });
89
+ const id = (0, import_shared.requireId)(args.id, "SellingPlanGroup");
90
+ const productVariantIds = parseVariantIds(args["variant-ids"]);
91
+ const mutationField = verb === "add-product-variants" ? "sellingPlanGroupAddProductVariants" : "sellingPlanGroupRemoveProductVariants";
92
+ const selection = verb === "add-product-variants" ? { sellingPlanGroup: sellingPlanGroupSummarySelection, userErrors: { field: true, message: true } } : { removedProductVariantIds: true, userErrors: { field: true, message: true } };
93
+ const result = await (0, import_router.runMutation)(ctx, {
94
+ [mutationField]: {
95
+ __args: { id, productVariantIds },
96
+ ...selection
97
+ }
98
+ });
99
+ if (result === void 0) return;
100
+ const payload = result[mutationField];
101
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload, failOnUserErrors: ctx.failOnUserErrors });
102
+ if (ctx.quiet) {
103
+ if (verb === "add-product-variants") return console.log(payload?.sellingPlanGroup?.id ?? "");
104
+ return;
105
+ }
106
+ (0, import_output.printJson)(payload, ctx.format !== "raw");
107
+ return;
108
+ }
109
+ throw new import_errors.CliError(`Unknown verb for selling-plan-group-products: ${verb}`, 2);
110
+ };
111
+ // Annotate the CommonJS export names for ESM import in node:
112
+ 0 && (module.exports = {
113
+ runSellingPlanGroupProducts
114
+ });
115
+ //# sourceMappingURL=selling-plan-group-products.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runSellingPlanGroups: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;