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,57 @@
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 point_of_sale_exports = {};
20
+ __export(point_of_sale_exports, {
21
+ runPointOfSale: () => runPointOfSale
22
+ });
23
+ module.exports = __toCommonJS(point_of_sale_exports);
24
+ var import_errors = require("../errors");
25
+ var import_output = require("../output");
26
+ var import_router = require("../router");
27
+ var import_select = require("../selection/select");
28
+ var import_shared = require("./_shared");
29
+ const deviceSelection = {
30
+ id: true
31
+ };
32
+ const runPointOfSale = async ({
33
+ ctx,
34
+ verb,
35
+ argv
36
+ }) => {
37
+ if (verb !== "get") throw new import_errors.CliError(`Unknown verb for point-of-sale: ${verb}`, 2);
38
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
39
+ const id = (0, import_shared.requireId)(args.id, "PointOfSaleDevice");
40
+ const selection = (0, import_select.resolveSelection)({
41
+ resource: "point-of-sale",
42
+ view: ctx.view,
43
+ baseSelection: deviceSelection,
44
+ select: args.select,
45
+ selection: args.selection,
46
+ include: args.include,
47
+ ensureId: ctx.quiet
48
+ });
49
+ const result = await (0, import_router.runQuery)(ctx, { pointOfSaleDevice: { __args: { id }, ...selection } });
50
+ if (result === void 0) return;
51
+ (0, import_output.printNode)({ node: result.pointOfSaleDevice, format: ctx.format, quiet: ctx.quiet });
52
+ };
53
+ // Annotate the CommonJS export names for ESM import in node:
54
+ 0 && (module.exports = {
55
+ runPointOfSale
56
+ });
57
+ //# sourceMappingURL=point-of-sale.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runPriceLists: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;
@@ -0,0 +1,426 @@
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 price_lists_exports = {};
20
+ __export(price_lists_exports, {
21
+ runPriceLists: () => runPriceLists
22
+ });
23
+ module.exports = __toCommonJS(price_lists_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 priceListSummarySelection = {
33
+ id: true,
34
+ name: true,
35
+ currency: true,
36
+ catalog: { id: true, title: true },
37
+ parent: {
38
+ adjustment: {
39
+ type: true,
40
+ value: true
41
+ }
42
+ },
43
+ fixedPricesCount: true
44
+ };
45
+ const priceListFullSelection = {
46
+ ...priceListSummarySelection,
47
+ prices: {
48
+ __args: { first: 10 },
49
+ nodes: {
50
+ variant: { id: true, displayName: true },
51
+ price: { amount: true, currencyCode: true },
52
+ compareAtPrice: { amount: true, currencyCode: true },
53
+ originType: true
54
+ },
55
+ pageInfo: { hasNextPage: true, endCursor: true }
56
+ },
57
+ quantityRules: {
58
+ __args: { first: 10 },
59
+ nodes: {
60
+ productVariant: { id: true, displayName: true },
61
+ minimum: true,
62
+ maximum: true,
63
+ increment: true,
64
+ originType: true
65
+ },
66
+ pageInfo: { hasNextPage: true, endCursor: true }
67
+ }
68
+ };
69
+ const getPriceListSelection = (view) => {
70
+ if (view === "ids") return { id: true };
71
+ if (view === "full") return priceListFullSelection;
72
+ if (view === "raw") return {};
73
+ return priceListSummarySelection;
74
+ };
75
+ const ensureInput = (built) => {
76
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
77
+ return built.input;
78
+ };
79
+ const extractArrayField = (input, field) => {
80
+ if (Array.isArray(input)) return input;
81
+ if (input && Array.isArray(input[field])) return input[field];
82
+ return void 0;
83
+ };
84
+ const hasListArg = (value) => Array.isArray(value) ? value.length > 0 : value !== void 0;
85
+ const runPriceLists = async ({
86
+ ctx,
87
+ verb,
88
+ argv
89
+ }) => {
90
+ if (argv.includes("--help") || argv.includes("-h")) {
91
+ console.log(
92
+ [
93
+ "Usage:",
94
+ " shop price-lists <verb> [flags]",
95
+ "",
96
+ "Verbs:",
97
+ " create|get|list|update|delete",
98
+ " add-prices|update-prices|update-prices-by-product|delete-prices",
99
+ " add-quantity-rules|delete-quantity-rules|update-quantity-pricing",
100
+ "",
101
+ "Common output flags:",
102
+ " --view summary|ids|full|raw",
103
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
104
+ " --selection <graphql> (selection override; can be @file.gql)",
105
+ "",
106
+ "Notes:",
107
+ " --variant-ids <gid,gid,...> applies to delete-prices/delete-quantity-rules.",
108
+ " --product-id <gid> can be used with update-prices-by-product to target a single product.",
109
+ " delete operations require --yes."
110
+ ].join("\n")
111
+ );
112
+ return;
113
+ }
114
+ if (verb === "get") {
115
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
116
+ const id = (0, import_shared.requireId)(args.id, "PriceList");
117
+ const selection = (0, import_select.resolveSelection)({
118
+ resource: "price-lists",
119
+ view: ctx.view,
120
+ baseSelection: getPriceListSelection(ctx.view),
121
+ select: args.select,
122
+ selection: args.selection,
123
+ include: args.include,
124
+ ensureId: ctx.quiet
125
+ });
126
+ const result = await (0, import_router.runQuery)(ctx, { priceList: { __args: { id }, ...selection } });
127
+ if (result === void 0) return;
128
+ (0, import_output.printNode)({ node: result.priceList, format: ctx.format, quiet: ctx.quiet });
129
+ return;
130
+ }
131
+ if (verb === "list") {
132
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
133
+ const first = (0, import_shared.parseFirst)(args.first);
134
+ const after = args.after;
135
+ const reverse = args.reverse;
136
+ const sortKey = args.sort;
137
+ const nodeSelection = (0, import_select.resolveSelection)({
138
+ resource: "price-lists",
139
+ view: ctx.view,
140
+ baseSelection: getPriceListSelection(ctx.view),
141
+ select: args.select,
142
+ selection: args.selection,
143
+ include: args.include,
144
+ ensureId: ctx.quiet
145
+ });
146
+ const result = await (0, import_router.runQuery)(ctx, {
147
+ priceLists: {
148
+ __args: { first, after, reverse, sortKey },
149
+ pageInfo: { hasNextPage: true, endCursor: true },
150
+ nodes: nodeSelection
151
+ }
152
+ });
153
+ if (result === void 0) return;
154
+ (0, import_output.printConnection)({
155
+ connection: result.priceLists,
156
+ format: ctx.format,
157
+ quiet: ctx.quiet,
158
+ nextPageArgs: (0, import_shared.buildListNextPageArgs)("price-lists", { first, sort: sortKey, reverse })
159
+ });
160
+ return;
161
+ }
162
+ if (verb === "create") {
163
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
164
+ const built = (0, import_input.buildInput)({
165
+ inputArg: args.input,
166
+ setArgs: args.set,
167
+ setJsonArgs: args["set-json"]
168
+ });
169
+ const input = ensureInput(built);
170
+ const result = await (0, import_router.runMutation)(ctx, {
171
+ priceListCreate: {
172
+ __args: { input },
173
+ priceList: priceListSummarySelection,
174
+ userErrors: { field: true, message: true }
175
+ }
176
+ });
177
+ if (result === void 0) return;
178
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.priceListCreate, failOnUserErrors: ctx.failOnUserErrors });
179
+ if (ctx.quiet) return console.log(result.priceListCreate?.priceList?.id ?? "");
180
+ (0, import_output.printJson)(result.priceListCreate, ctx.format !== "raw");
181
+ return;
182
+ }
183
+ if (verb === "update") {
184
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
185
+ const id = (0, import_shared.requireId)(args.id, "PriceList");
186
+ const built = (0, import_input.buildInput)({
187
+ inputArg: args.input,
188
+ setArgs: args.set,
189
+ setJsonArgs: args["set-json"]
190
+ });
191
+ const input = ensureInput(built);
192
+ const result = await (0, import_router.runMutation)(ctx, {
193
+ priceListUpdate: {
194
+ __args: { id, input },
195
+ priceList: priceListSummarySelection,
196
+ userErrors: { field: true, message: true }
197
+ }
198
+ });
199
+ if (result === void 0) return;
200
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.priceListUpdate, failOnUserErrors: ctx.failOnUserErrors });
201
+ if (ctx.quiet) return console.log(result.priceListUpdate?.priceList?.id ?? "");
202
+ (0, import_output.printJson)(result.priceListUpdate, ctx.format !== "raw");
203
+ return;
204
+ }
205
+ if (verb === "delete") {
206
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
207
+ const id = (0, import_shared.requireId)(args.id, "PriceList");
208
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
209
+ const result = await (0, import_router.runMutation)(ctx, {
210
+ priceListDelete: {
211
+ __args: { id },
212
+ deletedId: true,
213
+ userErrors: { field: true, message: true }
214
+ }
215
+ });
216
+ if (result === void 0) return;
217
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.priceListDelete, failOnUserErrors: ctx.failOnUserErrors });
218
+ if (ctx.quiet) return console.log(result.priceListDelete?.deletedId ?? "");
219
+ (0, import_output.printJson)(result.priceListDelete, ctx.format !== "raw");
220
+ return;
221
+ }
222
+ if (verb === "add-prices") {
223
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
224
+ const priceListId = (0, import_shared.requireId)(args.id, "PriceList");
225
+ const built = (0, import_input.buildInput)({
226
+ inputArg: args.input,
227
+ setArgs: args.set,
228
+ setJsonArgs: args["set-json"]
229
+ });
230
+ const input = ensureInput(built);
231
+ const prices = extractArrayField(input, "prices");
232
+ if (!prices) throw new import_errors.CliError("Expected prices array via --input or --set prices[0].*", 2);
233
+ const result = await (0, import_router.runMutation)(ctx, {
234
+ priceListFixedPricesAdd: {
235
+ __args: { priceListId, prices },
236
+ prices: { variant: { id: true }, price: { amount: true, currencyCode: true } },
237
+ userErrors: { field: true, message: true }
238
+ }
239
+ });
240
+ if (result === void 0) return;
241
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.priceListFixedPricesAdd, failOnUserErrors: ctx.failOnUserErrors });
242
+ if (ctx.quiet) {
243
+ const ids = (result.priceListFixedPricesAdd?.prices ?? []).map((p) => p?.variant?.id);
244
+ (0, import_output.printIds)(ids);
245
+ return;
246
+ }
247
+ (0, import_output.printJson)(result.priceListFixedPricesAdd, ctx.format !== "raw");
248
+ return;
249
+ }
250
+ if (verb === "update-prices") {
251
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "variant-ids": { type: "string", multiple: true } } });
252
+ const priceListId = (0, import_shared.requireId)(args.id, "PriceList");
253
+ const built = (0, import_input.buildInput)({
254
+ inputArg: args.input,
255
+ setArgs: args.set,
256
+ setJsonArgs: args["set-json"]
257
+ });
258
+ const input = ensureInput(built);
259
+ const pricesToAdd = input.pricesToAdd ?? input.prices ?? (Array.isArray(input) ? input : []);
260
+ const rawVariantIds = args["variant-ids"];
261
+ const variantIdsToDelete = input.variantIdsToDelete ?? (hasListArg(rawVariantIds) ? (0, import_shared.parseIds)(rawVariantIds, "ProductVariant") : []);
262
+ if ((pricesToAdd?.length ?? 0) === 0 && (variantIdsToDelete?.length ?? 0) === 0) {
263
+ throw new import_errors.CliError("Expected pricesToAdd and/or variantIdsToDelete", 2);
264
+ }
265
+ const result = await (0, import_router.runMutation)(ctx, {
266
+ priceListFixedPricesUpdate: {
267
+ __args: { priceListId, pricesToAdd, variantIdsToDelete },
268
+ priceList: { id: true },
269
+ pricesAdded: { variant: { id: true }, price: { amount: true, currencyCode: true } },
270
+ deletedFixedPriceVariantIds: true,
271
+ userErrors: { field: true, message: true }
272
+ }
273
+ });
274
+ if (result === void 0) return;
275
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.priceListFixedPricesUpdate, failOnUserErrors: ctx.failOnUserErrors });
276
+ if (ctx.quiet) return console.log(result.priceListFixedPricesUpdate?.priceList?.id ?? "");
277
+ (0, import_output.printJson)(result.priceListFixedPricesUpdate, ctx.format !== "raw");
278
+ return;
279
+ }
280
+ if (verb === "update-prices-by-product") {
281
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "product-id": { type: "string" } } });
282
+ const priceListId = (0, import_shared.requireId)(args.id, "PriceList");
283
+ const productId = args["product-id"];
284
+ const built = (0, import_input.buildInput)({
285
+ inputArg: args.input,
286
+ setArgs: args.set,
287
+ setJsonArgs: args["set-json"]
288
+ });
289
+ const input = ensureInput(built);
290
+ let pricesToAdd = input.pricesToAdd;
291
+ let pricesToDeleteByProductIds = input.pricesToDeleteByProductIds;
292
+ if (!pricesToAdd && !pricesToDeleteByProductIds && productId) {
293
+ const gid = (0, import_gid.coerceGid)(productId, "Product");
294
+ if (Array.isArray(input)) {
295
+ pricesToAdd = input.map((p) => ({ ...p, productId: p.productId ?? gid }));
296
+ } else {
297
+ const base = typeof input === "object" && input !== null ? input : {};
298
+ pricesToAdd = [{ ...base, productId: gid }];
299
+ }
300
+ }
301
+ if ((pricesToAdd?.length ?? 0) === 0 && (pricesToDeleteByProductIds?.length ?? 0) === 0) {
302
+ throw new import_errors.CliError("Expected pricesToAdd and/or pricesToDeleteByProductIds", 2);
303
+ }
304
+ const result = await (0, import_router.runMutation)(ctx, {
305
+ priceListFixedPricesByProductUpdate: {
306
+ __args: { priceListId, pricesToAdd, pricesToDeleteByProductIds },
307
+ priceList: { id: true },
308
+ pricesToAddProducts: { id: true },
309
+ pricesToDeleteProducts: { id: true },
310
+ userErrors: { field: true, message: true }
311
+ }
312
+ });
313
+ if (result === void 0) return;
314
+ (0, import_userErrors.maybeFailOnUserErrors)({
315
+ payload: result.priceListFixedPricesByProductUpdate,
316
+ failOnUserErrors: ctx.failOnUserErrors
317
+ });
318
+ if (ctx.quiet) return console.log(result.priceListFixedPricesByProductUpdate?.priceList?.id ?? "");
319
+ (0, import_output.printJson)(result.priceListFixedPricesByProductUpdate, ctx.format !== "raw");
320
+ return;
321
+ }
322
+ if (verb === "delete-prices") {
323
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "variant-ids": { type: "string", multiple: true } } });
324
+ const priceListId = (0, import_shared.requireId)(args.id, "PriceList");
325
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete prices without --yes", 2);
326
+ const variantIds = (0, import_shared.parseIds)(args["variant-ids"], "ProductVariant");
327
+ const result = await (0, import_router.runMutation)(ctx, {
328
+ priceListFixedPricesDelete: {
329
+ __args: { priceListId, variantIds },
330
+ deletedFixedPriceVariantIds: true,
331
+ userErrors: { field: true, message: true }
332
+ }
333
+ });
334
+ if (result === void 0) return;
335
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.priceListFixedPricesDelete, failOnUserErrors: ctx.failOnUserErrors });
336
+ if (ctx.quiet) {
337
+ (0, import_output.printIds)(result.priceListFixedPricesDelete?.deletedFixedPriceVariantIds ?? []);
338
+ return;
339
+ }
340
+ (0, import_output.printJson)(result.priceListFixedPricesDelete, ctx.format !== "raw");
341
+ return;
342
+ }
343
+ if (verb === "add-quantity-rules") {
344
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
345
+ const priceListId = (0, import_shared.requireId)(args.id, "PriceList");
346
+ const built = (0, import_input.buildInput)({
347
+ inputArg: args.input,
348
+ setArgs: args.set,
349
+ setJsonArgs: args["set-json"]
350
+ });
351
+ const input = ensureInput(built);
352
+ const quantityRules = extractArrayField(input, "quantityRules");
353
+ if (!quantityRules) throw new import_errors.CliError("Expected quantityRules array via --input or --set quantityRules[0].*", 2);
354
+ const result = await (0, import_router.runMutation)(ctx, {
355
+ quantityRulesAdd: {
356
+ __args: { priceListId, quantityRules },
357
+ quantityRules: { productVariant: { id: true }, minimum: true, maximum: true, increment: true },
358
+ userErrors: { field: true, message: true }
359
+ }
360
+ });
361
+ if (result === void 0) return;
362
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.quantityRulesAdd, failOnUserErrors: ctx.failOnUserErrors });
363
+ if (ctx.quiet) {
364
+ const ids = (result.quantityRulesAdd?.quantityRules ?? []).map((r) => r?.productVariant?.id);
365
+ (0, import_output.printIds)(ids);
366
+ return;
367
+ }
368
+ (0, import_output.printJson)(result.quantityRulesAdd, ctx.format !== "raw");
369
+ return;
370
+ }
371
+ if (verb === "delete-quantity-rules") {
372
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "variant-ids": { type: "string", multiple: true } } });
373
+ const priceListId = (0, import_shared.requireId)(args.id, "PriceList");
374
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete quantity rules without --yes", 2);
375
+ const variantIds = (0, import_shared.parseIds)(args["variant-ids"], "ProductVariant");
376
+ const result = await (0, import_router.runMutation)(ctx, {
377
+ quantityRulesDelete: {
378
+ __args: { priceListId, variantIds },
379
+ deletedQuantityRulesVariantIds: true,
380
+ userErrors: { field: true, message: true }
381
+ }
382
+ });
383
+ if (result === void 0) return;
384
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.quantityRulesDelete, failOnUserErrors: ctx.failOnUserErrors });
385
+ if (ctx.quiet) {
386
+ (0, import_output.printIds)(result.quantityRulesDelete?.deletedQuantityRulesVariantIds ?? []);
387
+ return;
388
+ }
389
+ (0, import_output.printJson)(result.quantityRulesDelete, ctx.format !== "raw");
390
+ return;
391
+ }
392
+ if (verb === "update-quantity-pricing") {
393
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
394
+ const priceListId = (0, import_shared.requireId)(args.id, "PriceList");
395
+ const built = (0, import_input.buildInput)({
396
+ inputArg: args.input,
397
+ setArgs: args.set,
398
+ setJsonArgs: args["set-json"]
399
+ });
400
+ const input = ensureInput(built);
401
+ const result = await (0, import_router.runMutation)(ctx, {
402
+ quantityPricingByVariantUpdate: {
403
+ __args: { priceListId, input },
404
+ productVariants: { id: true },
405
+ userErrors: { field: true, message: true }
406
+ }
407
+ });
408
+ if (result === void 0) return;
409
+ (0, import_userErrors.maybeFailOnUserErrors)({
410
+ payload: result.quantityPricingByVariantUpdate,
411
+ failOnUserErrors: ctx.failOnUserErrors
412
+ });
413
+ if (ctx.quiet) {
414
+ (0, import_output.printIds)((result.quantityPricingByVariantUpdate?.productVariants ?? []).map((v) => v?.id));
415
+ return;
416
+ }
417
+ (0, import_output.printJson)(result.quantityPricingByVariantUpdate, ctx.format !== "raw");
418
+ return;
419
+ }
420
+ throw new import_errors.CliError(`Unknown verb for price-lists: ${verb}`, 2);
421
+ };
422
+ // Annotate the CommonJS export names for ESM import in node:
423
+ 0 && (module.exports = {
424
+ runPriceLists
425
+ });
426
+ //# sourceMappingURL=price-lists.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runProductFeeds: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;
@@ -0,0 +1,187 @@
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 product_feeds_exports = {};
20
+ __export(product_feeds_exports, {
21
+ runProductFeeds: () => runProductFeeds
22
+ });
23
+ module.exports = __toCommonJS(product_feeds_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 productFeedSummarySelection = {
32
+ id: true,
33
+ country: true,
34
+ language: true,
35
+ status: true
36
+ };
37
+ const productFeedFullSelection = {
38
+ ...productFeedSummarySelection
39
+ };
40
+ const getProductFeedSelection = (view) => {
41
+ if (view === "ids") return { id: true };
42
+ if (view === "full") return productFeedFullSelection;
43
+ if (view === "raw") return {};
44
+ return productFeedSummarySelection;
45
+ };
46
+ const runProductFeeds = async ({
47
+ ctx,
48
+ verb,
49
+ argv
50
+ }) => {
51
+ if (argv.includes("--help") || argv.includes("-h")) {
52
+ console.log(
53
+ [
54
+ "Usage:",
55
+ " shop product-feeds <verb> [flags]",
56
+ "",
57
+ "Verbs:",
58
+ " get|list|create|delete|full-sync",
59
+ "",
60
+ "Common output flags:",
61
+ " --view summary|ids|full|raw",
62
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
63
+ " --selection <graphql> (selection override; can be @file.gql)"
64
+ ].join("\n")
65
+ );
66
+ return;
67
+ }
68
+ if (verb === "get") {
69
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
70
+ const id = (0, import_shared.requireId)(args.id, "ProductFeed");
71
+ const selection = (0, import_select.resolveSelection)({
72
+ resource: "product-feeds",
73
+ view: ctx.view,
74
+ baseSelection: getProductFeedSelection(ctx.view),
75
+ select: args.select,
76
+ selection: args.selection,
77
+ include: args.include,
78
+ ensureId: ctx.quiet
79
+ });
80
+ const result = await (0, import_router.runQuery)(ctx, { productFeed: { __args: { id }, ...selection } });
81
+ if (result === void 0) return;
82
+ (0, import_output.printNode)({ node: result.productFeed, format: ctx.format, quiet: ctx.quiet });
83
+ return;
84
+ }
85
+ if (verb === "list") {
86
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
87
+ const first = (0, import_shared.parseFirst)(args.first);
88
+ const after = args.after;
89
+ const reverse = args.reverse;
90
+ const nodeSelection = (0, import_select.resolveSelection)({
91
+ resource: "product-feeds",
92
+ view: ctx.view,
93
+ baseSelection: getProductFeedSelection(ctx.view),
94
+ select: args.select,
95
+ selection: args.selection,
96
+ include: args.include,
97
+ ensureId: ctx.quiet
98
+ });
99
+ const result = await (0, import_router.runQuery)(ctx, {
100
+ productFeeds: {
101
+ __args: { first, after, reverse },
102
+ pageInfo: { hasNextPage: true, endCursor: true },
103
+ nodes: nodeSelection
104
+ }
105
+ });
106
+ if (result === void 0) return;
107
+ (0, import_output.printConnection)({
108
+ connection: result.productFeeds,
109
+ format: ctx.format,
110
+ quiet: ctx.quiet,
111
+ nextPageArgs: (0, import_shared.buildListNextPageArgs)("product-feeds", { first, reverse })
112
+ });
113
+ return;
114
+ }
115
+ if (verb === "create") {
116
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
117
+ const built = (0, import_input.buildInput)({
118
+ inputArg: args.input,
119
+ setArgs: args.set,
120
+ setJsonArgs: args["set-json"]
121
+ });
122
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
123
+ const result = await (0, import_router.runMutation)(ctx, {
124
+ productFeedCreate: {
125
+ __args: { input: built.input },
126
+ productFeed: productFeedSummarySelection,
127
+ userErrors: { code: true, field: true, message: true }
128
+ }
129
+ });
130
+ if (result === void 0) return;
131
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.productFeedCreate, failOnUserErrors: ctx.failOnUserErrors });
132
+ if (ctx.quiet) return console.log(result.productFeedCreate?.productFeed?.id ?? "");
133
+ (0, import_output.printJson)(result.productFeedCreate, ctx.format !== "raw");
134
+ return;
135
+ }
136
+ if (verb === "delete") {
137
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
138
+ const id = (0, import_shared.requireId)(args.id, "ProductFeed");
139
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
140
+ const result = await (0, import_router.runMutation)(ctx, {
141
+ productFeedDelete: {
142
+ __args: { id },
143
+ deletedId: true,
144
+ userErrors: { code: true, field: true, message: true }
145
+ }
146
+ });
147
+ if (result === void 0) return;
148
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.productFeedDelete, failOnUserErrors: ctx.failOnUserErrors });
149
+ if (ctx.quiet) return console.log(result.productFeedDelete?.deletedId ?? "");
150
+ (0, import_output.printJson)(result.productFeedDelete, ctx.format !== "raw");
151
+ return;
152
+ }
153
+ if (verb === "full-sync") {
154
+ const args = (0, import_router.parseStandardArgs)({
155
+ argv,
156
+ extraOptions: {
157
+ "updated-at-since": { type: "string" },
158
+ "before-updated-at": { type: "string" }
159
+ }
160
+ });
161
+ const id = (0, import_shared.requireId)(args.id, "ProductFeed");
162
+ const updatedAtSince = args["updated-at-since"] ? (0, import_shared.parseDateTime)(args["updated-at-since"], "--updated-at-since") : void 0;
163
+ const beforeUpdatedAt = args["before-updated-at"] ? (0, import_shared.parseDateTime)(args["before-updated-at"], "--before-updated-at") : void 0;
164
+ const result = await (0, import_router.runMutation)(ctx, {
165
+ productFullSync: {
166
+ __args: {
167
+ id,
168
+ ...updatedAtSince ? { updatedAtSince } : {},
169
+ ...beforeUpdatedAt ? { beforeUpdatedAt } : {}
170
+ },
171
+ id: true,
172
+ userErrors: { code: true, field: true, message: true }
173
+ }
174
+ });
175
+ if (result === void 0) return;
176
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.productFullSync, failOnUserErrors: ctx.failOnUserErrors });
177
+ if (ctx.quiet) return console.log(result.productFullSync?.id ?? "");
178
+ (0, import_output.printJson)(result.productFullSync, ctx.format !== "raw");
179
+ return;
180
+ }
181
+ throw new import_errors.CliError(`Unknown verb for product-feeds: ${verb}`, 2);
182
+ };
183
+ // Annotate the CommonJS export names for ESM import in node:
184
+ 0 && (module.exports = {
185
+ runProductFeeds
186
+ });
187
+ //# sourceMappingURL=product-feeds.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runProductVariants: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;