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,336 @@
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 webhooks_exports = {};
20
+ __export(webhooks_exports, {
21
+ runWebhooks: () => runWebhooks
22
+ });
23
+ module.exports = __toCommonJS(webhooks_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 webhookSummarySelection = {
32
+ id: true,
33
+ topic: true,
34
+ uri: true,
35
+ format: true,
36
+ createdAt: true,
37
+ updatedAt: true
38
+ };
39
+ const webhookFullSelection = {
40
+ ...webhookSummarySelection,
41
+ filter: true,
42
+ includeFields: true,
43
+ metafieldNamespaces: true
44
+ };
45
+ const getWebhookSelection = (view) => {
46
+ if (view === "ids") return { id: true };
47
+ if (view === "full") return webhookFullSelection;
48
+ if (view === "raw") return {};
49
+ return webhookSummarySelection;
50
+ };
51
+ const runWebhooks = async ({
52
+ ctx,
53
+ verb,
54
+ argv
55
+ }) => {
56
+ if (argv.includes("--help") || argv.includes("-h")) {
57
+ console.log(
58
+ [
59
+ "Usage:",
60
+ " shop webhooks <verb> [flags]",
61
+ "",
62
+ "Verbs:",
63
+ " create|get|list|update|delete|count",
64
+ " pubsub-create|pubsub-update",
65
+ " event-bridge-create|event-bridge-update",
66
+ "",
67
+ "Common output flags:",
68
+ " --view summary|ids|full|raw",
69
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
70
+ " --selection <graphql> (selection override; can be @file.gql)"
71
+ ].join("\n")
72
+ );
73
+ return;
74
+ }
75
+ if (verb === "count") {
76
+ const args = (0, import_router.parseStandardArgs)({
77
+ argv,
78
+ extraOptions: { limit: { type: "string" } }
79
+ });
80
+ const query = args.query;
81
+ const limitRaw = args.limit;
82
+ const limit = limitRaw === void 0 || limitRaw === null || limitRaw === "" ? void 0 : Number(limitRaw);
83
+ if (limit !== void 0 && (!Number.isFinite(limit) || limit <= 0)) {
84
+ throw new import_errors.CliError("--limit must be a positive number", 2);
85
+ }
86
+ const result = await (0, import_router.runQuery)(ctx, {
87
+ webhookSubscriptionsCount: {
88
+ __args: {
89
+ ...query ? { query } : {},
90
+ ...limit !== void 0 ? { limit: Math.floor(limit) } : {}
91
+ },
92
+ count: true,
93
+ precision: true
94
+ }
95
+ });
96
+ if (result === void 0) return;
97
+ if (ctx.quiet) return console.log(result.webhookSubscriptionsCount?.count ?? "");
98
+ (0, import_output.printJson)(result.webhookSubscriptionsCount, ctx.format !== "raw");
99
+ return;
100
+ }
101
+ if (verb === "event-bridge-create") {
102
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { topic: { type: "string" } } });
103
+ const topic = args.topic;
104
+ if (!topic) throw new import_errors.CliError("Missing --topic", 2);
105
+ const built = (0, import_input.buildInput)({
106
+ inputArg: args.input,
107
+ setArgs: args.set,
108
+ setJsonArgs: args["set-json"]
109
+ });
110
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json (webhookSubscription)", 2);
111
+ const result = await (0, import_router.runMutation)(ctx, {
112
+ eventBridgeWebhookSubscriptionCreate: {
113
+ __args: { topic, webhookSubscription: built.input },
114
+ webhookSubscription: webhookSummarySelection,
115
+ userErrors: { field: true, message: true }
116
+ }
117
+ });
118
+ if (result === void 0) return;
119
+ (0, import_userErrors.maybeFailOnUserErrors)({
120
+ payload: result.eventBridgeWebhookSubscriptionCreate,
121
+ failOnUserErrors: ctx.failOnUserErrors
122
+ });
123
+ if (ctx.quiet) return console.log(result.eventBridgeWebhookSubscriptionCreate?.webhookSubscription?.id ?? "");
124
+ (0, import_output.printJson)(result.eventBridgeWebhookSubscriptionCreate, ctx.format !== "raw");
125
+ return;
126
+ }
127
+ if (verb === "event-bridge-update") {
128
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
129
+ const id = (0, import_shared.requireId)(args.id, "WebhookSubscription");
130
+ const built = (0, import_input.buildInput)({
131
+ inputArg: args.input,
132
+ setArgs: args.set,
133
+ setJsonArgs: args["set-json"]
134
+ });
135
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json (webhookSubscription)", 2);
136
+ const result = await (0, import_router.runMutation)(ctx, {
137
+ eventBridgeWebhookSubscriptionUpdate: {
138
+ __args: { id, webhookSubscription: built.input },
139
+ webhookSubscription: webhookSummarySelection,
140
+ userErrors: { field: true, message: true }
141
+ }
142
+ });
143
+ if (result === void 0) return;
144
+ (0, import_userErrors.maybeFailOnUserErrors)({
145
+ payload: result.eventBridgeWebhookSubscriptionUpdate,
146
+ failOnUserErrors: ctx.failOnUserErrors
147
+ });
148
+ if (ctx.quiet) return console.log(result.eventBridgeWebhookSubscriptionUpdate?.webhookSubscription?.id ?? "");
149
+ (0, import_output.printJson)(result.eventBridgeWebhookSubscriptionUpdate, ctx.format !== "raw");
150
+ return;
151
+ }
152
+ if (verb === "get") {
153
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
154
+ const id = (0, import_shared.requireId)(args.id, "WebhookSubscription");
155
+ const selection = (0, import_select.resolveSelection)({
156
+ resource: "webhooks",
157
+ view: ctx.view,
158
+ baseSelection: getWebhookSelection(ctx.view),
159
+ select: args.select,
160
+ selection: args.selection,
161
+ include: args.include,
162
+ ensureId: ctx.quiet
163
+ });
164
+ const result = await (0, import_router.runQuery)(ctx, { webhookSubscription: { __args: { id }, ...selection } });
165
+ if (result === void 0) return;
166
+ (0, import_output.printNode)({ node: result.webhookSubscription, format: ctx.format, quiet: ctx.quiet });
167
+ return;
168
+ }
169
+ if (verb === "list") {
170
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
171
+ const first = (0, import_shared.parseFirst)(args.first);
172
+ const after = args.after;
173
+ const query = args.query;
174
+ const reverse = args.reverse;
175
+ const sortKey = args.sort;
176
+ const nodeSelection = (0, import_select.resolveSelection)({
177
+ resource: "webhooks",
178
+ view: ctx.view,
179
+ baseSelection: getWebhookSelection(ctx.view),
180
+ select: args.select,
181
+ selection: args.selection,
182
+ include: args.include,
183
+ ensureId: ctx.quiet
184
+ });
185
+ const result = await (0, import_router.runQuery)(ctx, {
186
+ webhookSubscriptions: {
187
+ __args: { first, after, query, reverse, sortKey },
188
+ pageInfo: { hasNextPage: true, endCursor: true },
189
+ nodes: nodeSelection
190
+ }
191
+ });
192
+ if (result === void 0) return;
193
+ (0, import_output.printConnection)({
194
+ connection: result.webhookSubscriptions,
195
+ format: ctx.format,
196
+ quiet: ctx.quiet,
197
+ nextPageArgs: (0, import_shared.buildListNextPageArgs)("webhooks", { first, query, sort: sortKey, reverse })
198
+ });
199
+ return;
200
+ }
201
+ if (verb === "pubsub-create") {
202
+ const args = (0, import_router.parseStandardArgs)({
203
+ argv,
204
+ extraOptions: { topic: { type: "string" }, "pubsub-project": { type: "string" }, "pubsub-topic": { type: "string" } }
205
+ });
206
+ const topic = args.topic;
207
+ if (!topic) throw new import_errors.CliError("Missing --topic", 2);
208
+ const built = (0, import_input.buildInput)({
209
+ inputArg: args.input,
210
+ setArgs: args.set,
211
+ setJsonArgs: args["set-json"]
212
+ });
213
+ const input = built.used ? built.input : {};
214
+ const pubSubProject = args["pubsub-project"] ?? input.pubSubProject;
215
+ const pubSubTopic = args["pubsub-topic"] ?? input.pubSubTopic;
216
+ if (!pubSubProject) throw new import_errors.CliError("Missing --pubsub-project", 2);
217
+ if (!pubSubTopic) throw new import_errors.CliError("Missing --pubsub-topic", 2);
218
+ const webhookSubscription = { ...input, pubSubProject, pubSubTopic };
219
+ const result = await (0, import_router.runMutation)(ctx, {
220
+ pubSubWebhookSubscriptionCreate: {
221
+ __args: { topic, webhookSubscription },
222
+ webhookSubscription: webhookSummarySelection,
223
+ userErrors: { field: true, message: true, code: true }
224
+ }
225
+ });
226
+ if (result === void 0) return;
227
+ (0, import_userErrors.maybeFailOnUserErrors)({
228
+ payload: result.pubSubWebhookSubscriptionCreate,
229
+ failOnUserErrors: ctx.failOnUserErrors
230
+ });
231
+ if (ctx.quiet) return console.log(result.pubSubWebhookSubscriptionCreate?.webhookSubscription?.id ?? "");
232
+ (0, import_output.printJson)(result.pubSubWebhookSubscriptionCreate, ctx.format !== "raw");
233
+ return;
234
+ }
235
+ if (verb === "pubsub-update") {
236
+ const args = (0, import_router.parseStandardArgs)({
237
+ argv,
238
+ extraOptions: { "pubsub-project": { type: "string" }, "pubsub-topic": { type: "string" } }
239
+ });
240
+ const id = (0, import_shared.requireId)(args.id, "WebhookSubscription");
241
+ const built = (0, import_input.buildInput)({
242
+ inputArg: args.input,
243
+ setArgs: args.set,
244
+ setJsonArgs: args["set-json"]
245
+ });
246
+ const input = built.used ? built.input : {};
247
+ const pubSubProject = args["pubsub-project"] ?? input.pubSubProject;
248
+ const pubSubTopic = args["pubsub-topic"] ?? input.pubSubTopic;
249
+ if (!pubSubProject) throw new import_errors.CliError("Missing --pubsub-project", 2);
250
+ if (!pubSubTopic) throw new import_errors.CliError("Missing --pubsub-topic", 2);
251
+ const webhookSubscription = { ...input, pubSubProject, pubSubTopic };
252
+ const result = await (0, import_router.runMutation)(ctx, {
253
+ pubSubWebhookSubscriptionUpdate: {
254
+ __args: { id, webhookSubscription },
255
+ webhookSubscription: webhookSummarySelection,
256
+ userErrors: { field: true, message: true, code: true }
257
+ }
258
+ });
259
+ if (result === void 0) return;
260
+ (0, import_userErrors.maybeFailOnUserErrors)({
261
+ payload: result.pubSubWebhookSubscriptionUpdate,
262
+ failOnUserErrors: ctx.failOnUserErrors
263
+ });
264
+ if (ctx.quiet) return console.log(result.pubSubWebhookSubscriptionUpdate?.webhookSubscription?.id ?? "");
265
+ (0, import_output.printJson)(result.pubSubWebhookSubscriptionUpdate, ctx.format !== "raw");
266
+ return;
267
+ }
268
+ if (verb === "create") {
269
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { topic: { type: "string" } } });
270
+ const topic = args.topic;
271
+ if (!topic) throw new import_errors.CliError("Missing --topic", 2);
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 (webhookSubscription)", 2);
278
+ const result = await (0, import_router.runMutation)(ctx, {
279
+ webhookSubscriptionCreate: {
280
+ __args: { topic, webhookSubscription: built.input },
281
+ webhookSubscription: webhookSummarySelection,
282
+ userErrors: { field: true, message: true }
283
+ }
284
+ });
285
+ if (result === void 0) return;
286
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.webhookSubscriptionCreate, failOnUserErrors: ctx.failOnUserErrors });
287
+ if (ctx.quiet) return console.log(result.webhookSubscriptionCreate?.webhookSubscription?.id ?? "");
288
+ (0, import_output.printJson)(result.webhookSubscriptionCreate, ctx.format !== "raw");
289
+ return;
290
+ }
291
+ if (verb === "update") {
292
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
293
+ const id = (0, import_shared.requireId)(args.id, "WebhookSubscription");
294
+ const built = (0, import_input.buildInput)({
295
+ inputArg: args.input,
296
+ setArgs: args.set,
297
+ setJsonArgs: args["set-json"]
298
+ });
299
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json (webhookSubscription)", 2);
300
+ const result = await (0, import_router.runMutation)(ctx, {
301
+ webhookSubscriptionUpdate: {
302
+ __args: { id, webhookSubscription: built.input },
303
+ webhookSubscription: webhookSummarySelection,
304
+ userErrors: { field: true, message: true }
305
+ }
306
+ });
307
+ if (result === void 0) return;
308
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.webhookSubscriptionUpdate, failOnUserErrors: ctx.failOnUserErrors });
309
+ if (ctx.quiet) return console.log(result.webhookSubscriptionUpdate?.webhookSubscription?.id ?? "");
310
+ (0, import_output.printJson)(result.webhookSubscriptionUpdate, ctx.format !== "raw");
311
+ return;
312
+ }
313
+ if (verb === "delete") {
314
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
315
+ const id = (0, import_shared.requireId)(args.id, "WebhookSubscription");
316
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
317
+ const result = await (0, import_router.runMutation)(ctx, {
318
+ webhookSubscriptionDelete: {
319
+ __args: { id },
320
+ deletedWebhookSubscriptionId: true,
321
+ userErrors: { field: true, message: true }
322
+ }
323
+ });
324
+ if (result === void 0) return;
325
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.webhookSubscriptionDelete, failOnUserErrors: ctx.failOnUserErrors });
326
+ if (ctx.quiet) return console.log(result.webhookSubscriptionDelete?.deletedWebhookSubscriptionId ?? "");
327
+ (0, import_output.printJson)(result.webhookSubscriptionDelete, ctx.format !== "raw");
328
+ return;
329
+ }
330
+ throw new import_errors.CliError(`Unknown verb for webhooks: ${verb}`, 2);
331
+ };
332
+ // Annotate the CommonJS export names for ESM import in node:
333
+ 0 && (module.exports = {
334
+ runWebhooks
335
+ });
336
+ //# sourceMappingURL=webhooks.js.map
@@ -0,0 +1,28 @@
1
+ import { type CommandContext } from '../../router';
2
+ export type StagedUploadResource = 'FILE' | 'IMAGE' | 'VIDEO' | 'MODEL_3D';
3
+ export type LocalFileForStagedUpload = {
4
+ filePath: string;
5
+ filename: string;
6
+ mimeType: string;
7
+ resource: StagedUploadResource;
8
+ fileSize: number;
9
+ };
10
+ export type StagedUploadTarget = {
11
+ url: string;
12
+ resourceUrl: string;
13
+ parameters: Array<{
14
+ name: string;
15
+ value: string;
16
+ }>;
17
+ };
18
+ export declare const buildLocalFilesForStagedUpload: ({ filePaths, contentType, resource, }: {
19
+ filePaths: string[];
20
+ contentType?: string;
21
+ resource?: StagedUploadResource;
22
+ }) => LocalFileForStagedUpload[];
23
+ export declare const stagedUploadsCreate: (ctx: CommandContext, localFiles: LocalFileForStagedUpload[]) => Promise<StagedUploadTarget[] | undefined>;
24
+ export declare const uploadToStagedTarget: ({ target, localFile, }: {
25
+ target: StagedUploadTarget;
26
+ localFile: LocalFileForStagedUpload;
27
+ }) => Promise<void>;
28
+ export declare const stagedUploadLocalFiles: (ctx: CommandContext, localFiles: LocalFileForStagedUpload[]) => Promise<StagedUploadTarget[] | undefined>;
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var stagedUploads_exports = {};
30
+ __export(stagedUploads_exports, {
31
+ buildLocalFilesForStagedUpload: () => buildLocalFilesForStagedUpload,
32
+ stagedUploadLocalFiles: () => stagedUploadLocalFiles,
33
+ stagedUploadsCreate: () => stagedUploadsCreate,
34
+ uploadToStagedTarget: () => uploadToStagedTarget
35
+ });
36
+ module.exports = __toCommonJS(stagedUploads_exports);
37
+ var import_node_fs = require("node:fs");
38
+ var import_node_path = __toESM(require("node:path"));
39
+ var import_mime_types = require("mime-types");
40
+ var import_errors = require("../../errors");
41
+ var import_router = require("../../router");
42
+ var import_userErrors = require("../../userErrors");
43
+ const guessMimeTypeFromFilename = (filename) => {
44
+ const mimeType = (0, import_mime_types.lookup)(filename);
45
+ if (typeof mimeType === "string") return mimeType;
46
+ return "application/octet-stream";
47
+ };
48
+ const inferStagedUploadResource = ({
49
+ filename,
50
+ mimeType
51
+ }) => {
52
+ if (mimeType.startsWith("image/")) return "IMAGE";
53
+ if (mimeType.startsWith("video/")) return "VIDEO";
54
+ const ext = import_node_path.default.extname(filename).toLowerCase();
55
+ if (mimeType.startsWith("model/") || ext === ".glb" || ext === ".gltf" || ext === ".usdz") {
56
+ return "MODEL_3D";
57
+ }
58
+ return "FILE";
59
+ };
60
+ const buildLocalFilesForStagedUpload = ({
61
+ filePaths,
62
+ contentType,
63
+ resource
64
+ }) => {
65
+ if (filePaths.length === 0) return [];
66
+ return filePaths.map((filePath) => {
67
+ const stats = (0, import_node_fs.statSync)(filePath);
68
+ if (!stats.isFile()) throw new import_errors.CliError(`Not a file: ${filePath}`, 2);
69
+ const filename = import_node_path.default.basename(filePath);
70
+ const mimeType = contentType ?? guessMimeTypeFromFilename(filename);
71
+ const inferredResource = inferStagedUploadResource({ filename, mimeType });
72
+ return {
73
+ filePath,
74
+ filename,
75
+ mimeType,
76
+ resource: resource ?? inferredResource,
77
+ fileSize: stats.size
78
+ };
79
+ });
80
+ };
81
+ const stagedUploadsCreate = async (ctx, localFiles) => {
82
+ const input = localFiles.map((f) => ({
83
+ filename: f.filename,
84
+ mimeType: f.mimeType,
85
+ resource: f.resource,
86
+ fileSize: String(f.fileSize),
87
+ httpMethod: "POST"
88
+ }));
89
+ if (ctx.dryRun) {
90
+ await (0, import_router.runMutation)(ctx, {
91
+ stagedUploadsCreate: {
92
+ __args: { input },
93
+ stagedTargets: {
94
+ url: true,
95
+ resourceUrl: true,
96
+ parameters: { name: true, value: true }
97
+ },
98
+ userErrors: { field: true, message: true }
99
+ }
100
+ });
101
+ return localFiles.map((f, i) => ({
102
+ url: `https://example.invalid/staged-uploads/${i}`,
103
+ resourceUrl: `https://example.invalid/staged-resources/${encodeURIComponent(f.filename)}`,
104
+ parameters: []
105
+ }));
106
+ }
107
+ const result = await (0, import_router.runMutation)(ctx, {
108
+ stagedUploadsCreate: {
109
+ __args: { input },
110
+ stagedTargets: {
111
+ url: true,
112
+ resourceUrl: true,
113
+ parameters: { name: true, value: true }
114
+ },
115
+ userErrors: { field: true, message: true }
116
+ }
117
+ });
118
+ if (result === void 0) return void 0;
119
+ (0, import_userErrors.maybeFailOnUserErrors)({
120
+ payload: result.stagedUploadsCreate,
121
+ failOnUserErrors: ctx.failOnUserErrors
122
+ });
123
+ const targets = result.stagedUploadsCreate?.stagedTargets ?? [];
124
+ if (!Array.isArray(targets) || targets.length !== localFiles.length) {
125
+ throw new import_errors.CliError(
126
+ `Expected ${localFiles.length} stagedTargets, got ${Array.isArray(targets) ? targets.length : "non-array"}`,
127
+ 2
128
+ );
129
+ }
130
+ return targets.map((t) => ({
131
+ url: String(t.url ?? ""),
132
+ resourceUrl: String(t.resourceUrl ?? ""),
133
+ parameters: (t.parameters ?? []).map((p) => ({ name: p.name, value: p.value }))
134
+ }));
135
+ };
136
+ const uploadToStagedTarget = async ({
137
+ target,
138
+ localFile
139
+ }) => {
140
+ const body = (0, import_node_fs.readFileSync)(localFile.filePath);
141
+ const form = new FormData();
142
+ for (const p of target.parameters) form.set(p.name, p.value);
143
+ form.set("file", new Blob([body], { type: localFile.mimeType }), localFile.filename);
144
+ const res = await fetch(target.url, { method: "POST", body: form });
145
+ if (res.ok) return;
146
+ let details = "";
147
+ try {
148
+ details = await res.text();
149
+ } catch {
150
+ }
151
+ throw new import_errors.CliError(
152
+ `Staged upload failed for ${localFile.filename}: ${res.status} ${res.statusText}${details ? `
153
+ ${details}` : ""}`,
154
+ 2
155
+ );
156
+ };
157
+ const stagedUploadLocalFiles = async (ctx, localFiles) => {
158
+ const targets = await stagedUploadsCreate(ctx, localFiles);
159
+ if (targets === void 0) return void 0;
160
+ if (ctx.dryRun) return targets;
161
+ for (let i = 0; i < targets.length; i++) {
162
+ const target = targets[i];
163
+ const localFile = localFiles[i];
164
+ await uploadToStagedTarget({ target, localFile });
165
+ }
166
+ return targets;
167
+ };
168
+ // Annotate the CommonJS export names for ESM import in node:
169
+ 0 && (module.exports = {
170
+ buildLocalFilesForStagedUpload,
171
+ stagedUploadLocalFiles,
172
+ stagedUploadsCreate,
173
+ uploadToStagedTarget
174
+ });
175
+ //# sourceMappingURL=stagedUploads.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../../router';
2
+ export declare const resolveInventoryItemId: ({ ctx, inventoryItemId, variantId, }: {
3
+ ctx: CommandContext;
4
+ inventoryItemId?: string;
5
+ variantId?: string;
6
+ }) => Promise<string>;
@@ -0,0 +1,59 @@
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 resolveInventoryItemId_exports = {};
20
+ __export(resolveInventoryItemId_exports, {
21
+ resolveInventoryItemId: () => resolveInventoryItemId
22
+ });
23
+ module.exports = __toCommonJS(resolveInventoryItemId_exports);
24
+ var import_errors = require("../../errors");
25
+ var import_gid = require("../../gid");
26
+ var import_router = require("../../router");
27
+ const resolveInventoryItemId = async ({
28
+ ctx,
29
+ inventoryItemId,
30
+ variantId
31
+ }) => {
32
+ if (inventoryItemId && variantId) {
33
+ throw new import_errors.CliError("Pass only one of --inventory-item-id or --variant-id", 2);
34
+ }
35
+ if (inventoryItemId) return (0, import_gid.coerceGid)(inventoryItemId, "InventoryItem");
36
+ if (!variantId) {
37
+ throw new import_errors.CliError("Missing --inventory-item-id or --variant-id", 2);
38
+ }
39
+ if (ctx.dryRun) {
40
+ throw new import_errors.CliError(
41
+ "--dry-run with --variant-id is not supported (pass --inventory-item-id instead)",
42
+ 2
43
+ );
44
+ }
45
+ const id = (0, import_gid.coerceGid)(variantId, "ProductVariant");
46
+ const result = await (0, import_router.runQuery)(ctx, {
47
+ productVariant: { __args: { id }, inventoryItem: { id: true } }
48
+ });
49
+ const inventoryItemGid = result?.productVariant?.inventoryItem?.id;
50
+ if (!inventoryItemGid) {
51
+ throw new import_errors.CliError(`Could not resolve inventory item for variant: ${variantId}`, 2);
52
+ }
53
+ return inventoryItemGid;
54
+ };
55
+ // Annotate the CommonJS export names for ESM import in node:
56
+ 0 && (module.exports = {
57
+ resolveInventoryItemId
58
+ });
59
+ //# sourceMappingURL=resolveInventoryItemId.js.map
@@ -0,0 +1,8 @@
1
+ import { type CommandContext } from '../../router';
2
+ export declare const upsertProductVariants: ({ ctx, productId, input, allowPartialUpdates, strategy, }: {
3
+ ctx: CommandContext;
4
+ productId: string | undefined;
5
+ input: any;
6
+ allowPartialUpdates: boolean;
7
+ strategy: string | undefined;
8
+ }) => Promise<any>;