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,7 @@
1
+ type VerbHelpOptions = {
2
+ showAllFields?: boolean;
3
+ };
4
+ export declare const renderTopLevelHelp: (command?: string) => string;
5
+ export declare const renderResourceHelp: (resource: string, command?: string) => string | undefined;
6
+ export declare const renderVerbHelp: (resourceName: string, verbName: string, options?: VerbHelpOptions, command?: string) => string | undefined;
7
+ export {};
@@ -0,0 +1,352 @@
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 render_exports = {};
20
+ __export(render_exports, {
21
+ renderResourceHelp: () => renderResourceHelp,
22
+ renderTopLevelHelp: () => renderTopLevelHelp,
23
+ renderVerbHelp: () => renderVerbHelp
24
+ });
25
+ module.exports = __toCommonJS(render_exports);
26
+ var import_format = require("./format");
27
+ var import_registry = require("./registry");
28
+ var import_schema_help = require("../../generated/help/schema-help");
29
+ var import_defaults = require("../../defaults");
30
+ var import_command = require("../command");
31
+ const PRIMITIVES = /* @__PURE__ */ new Set([
32
+ "String",
33
+ "Int",
34
+ "Float",
35
+ "Boolean",
36
+ "ID",
37
+ "DateTime",
38
+ "Date",
39
+ "JSON",
40
+ "Decimal",
41
+ "HTML",
42
+ "URL",
43
+ "Money",
44
+ "UnsignedInt64",
45
+ "FormattedString",
46
+ "Color",
47
+ "UtcOffset",
48
+ "ARN"
49
+ ]);
50
+ const findResource = (resource) => import_registry.commandRegistry.find((entry) => entry.resource === resource);
51
+ const findVerb = (resource, verb) => resource.verbs.find((entry) => entry.verb === verb);
52
+ const formatEnumValues = (enumName) => {
53
+ const values = import_schema_help.enumTypeHelp[enumName];
54
+ if (!values) return void 0;
55
+ const names = values.map((value) => value.name);
56
+ if (names.length <= 6) return names.join("|");
57
+ return `${names.slice(0, 6).join("|")}|...`;
58
+ };
59
+ const formatType = (field) => {
60
+ const enumValues = formatEnumValues(field.typeName);
61
+ let label = enumValues ?? field.typeName;
62
+ if (field.isList) label = `${label}[]`;
63
+ return label;
64
+ };
65
+ const operationHelpFor = (spec) => {
66
+ if (!spec.operation) return void 0;
67
+ if (spec.operation.type === "mutation") return import_schema_help.mutationHelp[spec.operation.name];
68
+ return import_schema_help.queryHelp[spec.operation.name];
69
+ };
70
+ const inputFieldsFor = (spec) => {
71
+ if (!spec.input || spec.input.mode !== "set") return void 0;
72
+ const opHelp = operationHelpFor(spec);
73
+ const inputArg = spec.input.arg ?? spec.operation?.inputArg ?? "input";
74
+ const arg = opHelp?.args.find((item) => item.name === inputArg);
75
+ if (!arg) return void 0;
76
+ return import_schema_help.inputTypeHelp[arg.typeName];
77
+ };
78
+ const formatFieldFlags = (fields) => {
79
+ return fields.map((field) => {
80
+ const type = formatType(field);
81
+ const required = field.required ? "Required. " : "";
82
+ const description = field.description ? `${required}${field.description}` : required.trim() || void 0;
83
+ return {
84
+ label: `--set ${field.name}=<${type}>`,
85
+ description
86
+ };
87
+ });
88
+ };
89
+ const formatOutputFlags = (spec) => {
90
+ const flags = [];
91
+ if (spec.output?.view) flags.push(...import_registry.commonOutputFlags);
92
+ if (spec.output?.pagination) flags.push(...import_registry.paginationFlags);
93
+ return flags;
94
+ };
95
+ const getReferencedInputTypes = (fields) => {
96
+ const types = [];
97
+ const seen = /* @__PURE__ */ new Set();
98
+ for (const field of fields) {
99
+ const typeName = field.typeName;
100
+ if (PRIMITIVES.has(typeName)) continue;
101
+ if (import_schema_help.enumTypeHelp[typeName]) continue;
102
+ if (!import_schema_help.inputTypeHelp[typeName]) continue;
103
+ if (seen.has(typeName)) continue;
104
+ seen.add(typeName);
105
+ types.push(typeName);
106
+ }
107
+ return types;
108
+ };
109
+ const collectNestedTypes = (fields, depth, visited) => {
110
+ const result = /* @__PURE__ */ new Map();
111
+ if (depth <= 0) return result;
112
+ for (const field of fields) {
113
+ const typeName = field.typeName;
114
+ if (PRIMITIVES.has(typeName)) continue;
115
+ if (import_schema_help.enumTypeHelp[typeName]) continue;
116
+ if (visited.has(typeName)) continue;
117
+ const nestedFields = import_schema_help.inputTypeHelp[typeName];
118
+ if (!nestedFields) continue;
119
+ visited.add(typeName);
120
+ result.set(typeName, nestedFields);
121
+ const deeper = collectNestedTypes(nestedFields, depth - 1, visited);
122
+ for (const [k, v] of deeper) {
123
+ result.set(k, v);
124
+ }
125
+ }
126
+ return result;
127
+ };
128
+ const formatFieldTypeWithMarkers = (field) => {
129
+ let label = field.typeName;
130
+ if (field.isList) label = `${label}[]`;
131
+ if (field.required) label = `${label}!`;
132
+ return label;
133
+ };
134
+ const wrapText = (text, width) => {
135
+ const words = text.split(/\s+/).filter(Boolean);
136
+ if (words.length === 0) return [""];
137
+ const lines = [];
138
+ let line = words[0];
139
+ for (let i = 1; i < words.length; i++) {
140
+ const word = words[i];
141
+ if (line.length + 1 + word.length > width) {
142
+ lines.push(line);
143
+ line = word;
144
+ } else {
145
+ line += ` ${word}`;
146
+ }
147
+ }
148
+ lines.push(line);
149
+ return lines;
150
+ };
151
+ const renderTypeShapesSection = (types, totalWidth = 108) => {
152
+ if (types.size === 0) return [];
153
+ const lines = ["Referenced types:"];
154
+ for (const [typeName, fields] of types) {
155
+ lines.push("");
156
+ lines.push(` ${typeName}:`);
157
+ const nameWidth = Math.max(...fields.map((f) => f.name.length), 4);
158
+ const typeWidth = Math.max(...fields.map((f) => formatFieldTypeWithMarkers(f).length), 4);
159
+ for (const field of fields) {
160
+ const name = field.name.padEnd(nameWidth);
161
+ const type = formatFieldTypeWithMarkers(field).padEnd(typeWidth);
162
+ const required = field.required ? "Required. " : "";
163
+ const desc = field.description ?? "";
164
+ const prefix = ` ${name} ${type} `;
165
+ const indent = " ".repeat(prefix.length);
166
+ const descWidth = Math.max(20, totalWidth - prefix.length);
167
+ const normalizedDesc = `${required}${desc}`.split("\n").filter((line) => line.trim() !== "").join(" ");
168
+ const wrappedLines = wrapText(normalizedDesc, descWidth);
169
+ lines.push(`${prefix}${wrappedLines[0]}`);
170
+ for (let i = 1; i < wrappedLines.length; i++) {
171
+ lines.push(`${indent}${wrappedLines[i]}`);
172
+ }
173
+ }
174
+ }
175
+ return lines;
176
+ };
177
+ const formatTypeDetailsFooter = (typeNames, command) => {
178
+ if (typeNames.length === 0) return [];
179
+ const lines = ["Type details:"];
180
+ for (const typeName of typeNames) {
181
+ lines.push(` ${command} types ${typeName}`);
182
+ }
183
+ return lines;
184
+ };
185
+ const formatWithCommand = (text, command) => (0, import_command.formatCommandRef)(text, command);
186
+ const renderTopLevelHelp = (command = (0, import_command.resolveCliCommand)()) => {
187
+ const resources = [...import_registry.commandRegistry].filter((r) => r.resource !== "graphql").sort((a, b) => a.resource.localeCompare(b.resource));
188
+ const resourceLines = resources.map((resource) => {
189
+ const verbs = resource.verbs.map((verb) => verb.verb).join("|");
190
+ return ` ${resource.resource}: ${verbs}`;
191
+ });
192
+ return [
193
+ "Usage:",
194
+ ` ${command} <resource> <verb> [flags]`,
195
+ "",
196
+ "Resources:",
197
+ ...resourceLines,
198
+ "",
199
+ "Auth (flags override env):",
200
+ " --shop <your-shop.myshopify.com> (or env SHOPIFY_SHOP)",
201
+ " --graphql-endpoint <url> (or env GRAPHQL_ENDPOINT; overrides shop domain)",
202
+ " --access-token <token> (or env SHOPIFY_ACCESS_TOKEN)",
203
+ ' --header "Name: value" (repeatable; also supports Name=value)',
204
+ ` (env SHOPIFY_HEADERS='{"Name":"value"}')`,
205
+ ` --api-version <YYYY-MM> (default: ${import_defaults.DEFAULT_ADMIN_API_VERSION})`,
206
+ "",
207
+ "Output:",
208
+ " --format json|jsonl|table|raw|markdown (default: json)",
209
+ " --view summary|ids|full|raw|all (default: summary)",
210
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
211
+ " --include <connection> (repeatable; only used with --view all)",
212
+ " --selection <graphql> (selection override; can be @file.gql)",
213
+ " --quiet (IDs only when possible)",
214
+ "",
215
+ "Debug:",
216
+ " --dry-run (print GraphQL op + variables, do not execute)",
217
+ " --no-fail-on-user-errors (do not exit non-zero on userErrors)",
218
+ "",
219
+ "Raw GraphQL:",
220
+ ` ${command} graphql <query> Execute raw GraphQL query or mutation`,
221
+ ` ${command} graphql @file.graphql Execute query from file`,
222
+ " --var <name>=<value> Set a variable (repeatable)",
223
+ " --variables <json> Variables as JSON (or @file.json)",
224
+ " --no-validate Skip local schema validation",
225
+ "",
226
+ "Schema introspection:",
227
+ ` ${command} types <TypeName> Explore input types and enums`,
228
+ "",
229
+ "Examples:",
230
+ ` ${command} products list --first 5 --format table`,
231
+ ` ${command} products create --set title="Hat" --set status="ACTIVE"`,
232
+ ` ${command} products add-tags --id 123 --tags "summer,featured"`,
233
+ ` ${command} publications resolve --publication "Online Store"`,
234
+ ` ${command} products publish --id 123 --publication "Online Store" --now`,
235
+ ` ${command} products metafields upsert --id 123 --set namespace=custom --set key=foo --set type=single_line_text_field --set value=bar`
236
+ ].join("\n");
237
+ };
238
+ const renderResourceHelp = (resource, command = (0, import_command.resolveCliCommand)()) => {
239
+ const spec = findResource(resource);
240
+ if (!spec) return void 0;
241
+ const verbs = spec.verbs.map((verb) => verb.verb).join("|");
242
+ const lines = ["Usage:", ` ${command} ${spec.resource} <verb> [flags]`, ""];
243
+ if (spec.description) lines.push(spec.description, "");
244
+ lines.push("Verbs:", ` ${verbs}`, "");
245
+ if (spec.flags && spec.flags.length > 0) {
246
+ lines.push(...(0, import_format.formatSection)("Flags:", (0, import_format.formatFlags)({ flags: spec.flags })));
247
+ lines.push("");
248
+ }
249
+ if (spec.notes && spec.notes.length > 0) {
250
+ lines.push("Notes:");
251
+ for (const note of spec.notes) lines.push(` ${formatWithCommand(note, command)}`);
252
+ lines.push("");
253
+ }
254
+ if (spec.examples && spec.examples.length > 0) {
255
+ lines.push("Examples:");
256
+ for (const example of spec.examples) lines.push(` ${formatWithCommand(example, command)}`);
257
+ lines.push("");
258
+ }
259
+ if (spec.resource !== "graphql") {
260
+ const outputFlags = (0, import_format.formatFlags)({ flags: import_registry.commonOutputFlags });
261
+ lines.push(...(0, import_format.formatSection)("Common output flags:", outputFlags));
262
+ }
263
+ return lines.join("\n");
264
+ };
265
+ const renderVerbHelp = (resourceName, verbName, options = {}, command = (0, import_command.resolveCliCommand)()) => {
266
+ const resource = findResource(resourceName);
267
+ if (!resource) return void 0;
268
+ const spec = findVerb(resource, verbName);
269
+ if (!spec) return void 0;
270
+ const lines = [];
271
+ if (spec.description) lines.push(spec.description, "");
272
+ lines.push("Usage:");
273
+ lines.push(` ${command} ${resource.resource} ${spec.verb} [flags]`);
274
+ lines.push("");
275
+ const requiredFlags = spec.requiredFlags ?? [];
276
+ if (requiredFlags.length > 0) {
277
+ lines.push(...(0, import_format.formatSection)("Required flags:", (0, import_format.formatFlags)({ flags: requiredFlags })));
278
+ lines.push("");
279
+ }
280
+ if (spec.input && spec.input.mode === "set") {
281
+ const title = spec.input.required ? "Input options (required):" : "Input options:";
282
+ lines.push(...(0, import_format.formatSection)(title, (0, import_format.formatFlags)({ flags: import_registry.standardInputFlags })));
283
+ lines.push("");
284
+ }
285
+ const inputFields = inputFieldsFor(spec);
286
+ let referencedTypeNames = [];
287
+ if (inputFields && inputFields.length > 0) {
288
+ const requiredFields = inputFields.filter((field) => field.required);
289
+ const optionalFields = inputFields.filter((field) => !field.required);
290
+ const ordered = [...requiredFields, ...optionalFields];
291
+ const maxFields = options.showAllFields ? ordered.length : 15;
292
+ const shown = ordered.slice(0, maxFields);
293
+ const fieldFlags = formatFieldFlags(shown);
294
+ lines.push(...(0, import_format.formatSection)("Input fields (via --set):", (0, import_format.formatFlags)({ flags: fieldFlags })));
295
+ const remaining = ordered.length - shown.length;
296
+ if (!options.showAllFields && remaining > 0) {
297
+ lines.push(
298
+ "",
299
+ `Additional fields (${remaining} more):`,
300
+ " Run with --help-full or --help-all to see all fields.",
301
+ ""
302
+ );
303
+ } else {
304
+ lines.push("");
305
+ }
306
+ const visited = /* @__PURE__ */ new Set();
307
+ const nestedTypes = collectNestedTypes(ordered, 2, visited);
308
+ if (options.showAllFields) {
309
+ if (nestedTypes.size > 0) {
310
+ lines.push(...renderTypeShapesSection(nestedTypes));
311
+ lines.push("");
312
+ }
313
+ } else {
314
+ referencedTypeNames = Array.from(nestedTypes.keys());
315
+ }
316
+ }
317
+ const optionalFlags = spec.flags ?? [];
318
+ if (optionalFlags.length > 0) {
319
+ lines.push(...(0, import_format.formatSection)("Flags:", (0, import_format.formatFlags)({ flags: optionalFlags })));
320
+ lines.push("");
321
+ }
322
+ const outputFlags = formatOutputFlags(spec);
323
+ if (outputFlags.length > 0) {
324
+ lines.push(...(0, import_format.formatSection)("Output flags:", (0, import_format.formatFlags)({ flags: outputFlags })));
325
+ lines.push("");
326
+ }
327
+ if (spec.notes && spec.notes.length > 0) {
328
+ lines.push("Notes:");
329
+ for (const note of spec.notes) lines.push(` ${formatWithCommand(note, command)}`);
330
+ lines.push("");
331
+ }
332
+ if (spec.examples && spec.examples.length > 0) {
333
+ lines.push("Examples:");
334
+ for (const example of spec.examples) lines.push(` ${formatWithCommand(example, command)}`);
335
+ lines.push("");
336
+ }
337
+ if (!options.showAllFields && referencedTypeNames.length > 0) {
338
+ const footerLines = formatTypeDetailsFooter(referencedTypeNames, command);
339
+ if (footerLines.length > 0) {
340
+ lines.push(...footerLines);
341
+ lines.push("");
342
+ }
343
+ }
344
+ return lines.join("\n").trimEnd();
345
+ };
346
+ // Annotate the CommonJS export names for ESM import in node:
347
+ 0 && (module.exports = {
348
+ renderResourceHelp,
349
+ renderTopLevelHelp,
350
+ renderVerbHelp
351
+ });
352
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1,39 @@
1
+ export type FlagSpec = {
2
+ label: string;
3
+ description?: string;
4
+ required?: boolean;
5
+ };
6
+ export type OperationSpec = {
7
+ type: 'mutation' | 'query';
8
+ name: string;
9
+ inputArg?: string;
10
+ };
11
+ export type InputSpec = {
12
+ mode: 'set' | 'none';
13
+ arg?: string;
14
+ required?: boolean;
15
+ };
16
+ export type VerbOutputSpec = {
17
+ view?: boolean;
18
+ selection?: boolean;
19
+ pagination?: boolean;
20
+ };
21
+ export type VerbSpec = {
22
+ verb: string;
23
+ description?: string;
24
+ operation?: OperationSpec;
25
+ input?: InputSpec;
26
+ requiredFlags?: FlagSpec[];
27
+ flags?: FlagSpec[];
28
+ output?: VerbOutputSpec;
29
+ examples?: string[];
30
+ notes?: string[];
31
+ };
32
+ export type ResourceSpec = {
33
+ resource: string;
34
+ description?: string;
35
+ verbs: VerbSpec[];
36
+ flags?: FlagSpec[];
37
+ notes?: string[];
38
+ examples?: string[];
39
+ };
@@ -0,0 +1,17 @@
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 __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var spec_exports = {};
16
+ module.exports = __toCommonJS(spec_exports);
17
+ //# sourceMappingURL=spec.js.map
@@ -0,0 +1,9 @@
1
+ export type BuiltInput = {
2
+ input: any;
3
+ used: boolean;
4
+ };
5
+ export declare const buildInput: ({ inputArg, setArgs, setJsonArgs, }: {
6
+ inputArg?: string;
7
+ setArgs?: string[];
8
+ setJsonArgs?: string[];
9
+ }) => BuiltInput;
@@ -0,0 +1,104 @@
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 input_exports = {};
20
+ __export(input_exports, {
21
+ buildInput: () => buildInput
22
+ });
23
+ module.exports = __toCommonJS(input_exports);
24
+ var import_node_fs = require("node:fs");
25
+ var import_errors = require("./errors");
26
+ const readUtf8 = (path) => (0, import_node_fs.readFileSync)(path, "utf8");
27
+ const parseJson = (value, label) => {
28
+ try {
29
+ return JSON.parse(value);
30
+ } catch (err) {
31
+ throw new import_errors.CliError(`${label} must be valid JSON: ${err.message}`, 2);
32
+ }
33
+ };
34
+ const parseJsonOrFile = (arg, label) => {
35
+ if (arg.startsWith("@file:")) return parseJson(readUtf8(arg.slice("@file:".length)), label);
36
+ if (arg.startsWith("@")) return parseJson(readUtf8(arg.slice(1)), label);
37
+ return parseJson(arg, label);
38
+ };
39
+ const parseSetValue = (raw) => {
40
+ if (raw.startsWith("@file:")) return readUtf8(raw.slice("@file:".length));
41
+ if (raw.startsWith("@json:")) return parseJson(readUtf8(raw.slice("@json:".length)), "--set-json");
42
+ const looksJson = raw.startsWith("{") || raw.startsWith("[") || raw.startsWith('"') || raw === "true" || raw === "false" || raw === "null" || /^-?\d+(\.\d+)?$/.test(raw);
43
+ if (looksJson) return parseJson(raw, "--set");
44
+ return raw;
45
+ };
46
+ const splitSetArg = (arg) => {
47
+ const eq = arg.indexOf("=");
48
+ if (eq === -1) throw new import_errors.CliError(`Expected --set path=value, got: ${arg}`, 2);
49
+ const path = arg.slice(0, eq).trim();
50
+ const value = arg.slice(eq + 1);
51
+ if (!path) throw new import_errors.CliError(`Expected --set path=value, got: ${arg}`, 2);
52
+ return { path, value };
53
+ };
54
+ const setDeep = (target, path, value) => {
55
+ const parts = path.split(".").filter(Boolean);
56
+ if (parts.length === 0) throw new import_errors.CliError(`Invalid --set path: ${path}`, 2);
57
+ let cursor = target;
58
+ for (let i = 0; i < parts.length; i++) {
59
+ const key = parts[i];
60
+ const isLast = i === parts.length - 1;
61
+ const nextKey = parts[i + 1];
62
+ const nextIsIndex = nextKey !== void 0 && /^\d+$/.test(nextKey);
63
+ if (isLast) {
64
+ if (Array.isArray(cursor) && /^\d+$/.test(key)) {
65
+ cursor[Number(key)] = value;
66
+ } else {
67
+ cursor[key] = value;
68
+ }
69
+ return;
70
+ }
71
+ if (Array.isArray(cursor) && /^\d+$/.test(key)) {
72
+ const idx = Number(key);
73
+ cursor[idx] ??= nextIsIndex ? [] : {};
74
+ cursor = cursor[idx];
75
+ } else {
76
+ cursor[key] ??= nextIsIndex ? [] : {};
77
+ cursor = cursor[key];
78
+ }
79
+ }
80
+ };
81
+ const buildInput = ({
82
+ inputArg,
83
+ setArgs,
84
+ setJsonArgs
85
+ }) => {
86
+ const hasAny = Boolean(inputArg) || (setArgs?.length ?? 0) > 0 || (setJsonArgs?.length ?? 0) > 0;
87
+ if (!hasAny) return { input: void 0, used: false };
88
+ let result = inputArg ? parseJsonOrFile(inputArg, "--input") : {};
89
+ for (const arg of setArgs ?? []) {
90
+ const { path, value } = splitSetArg(arg);
91
+ setDeep(result, path, parseSetValue(value));
92
+ }
93
+ for (const arg of setJsonArgs ?? []) {
94
+ const { path, value } = splitSetArg(arg);
95
+ const parsed = parseJsonOrFile(value, "--set-json");
96
+ setDeep(result, path, parsed);
97
+ }
98
+ return { input: result, used: true };
99
+ };
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ buildInput
103
+ });
104
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ export declare const isDeprecatedField: (typeName: string, fieldName: string) => boolean;
@@ -0,0 +1,83 @@
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 deprecations_exports = {};
20
+ __export(deprecations_exports, {
21
+ isDeprecatedField: () => isDeprecatedField
22
+ });
23
+ module.exports = __toCommonJS(deprecations_exports);
24
+ var import_node_fs = require("node:fs");
25
+ var import_node_path = require("node:path");
26
+ var import_graphql = require("graphql");
27
+ let cachedDeprecatedFieldMap;
28
+ const schemaPath = (() => {
29
+ if (typeof __dirname === "string") {
30
+ return (0, import_node_path.resolve)(__dirname, "../../generated/admin-2026-04/schema.graphql");
31
+ }
32
+ const packageRoot = process.env.SHOP_CLI_PACKAGE_ROOT;
33
+ if (packageRoot) {
34
+ const distPath = (0, import_node_path.resolve)(packageRoot, "dist", "generated", "admin-2026-04", "schema.graphql");
35
+ if ((0, import_node_fs.existsSync)(distPath)) return distPath;
36
+ const srcPath = (0, import_node_path.resolve)(packageRoot, "src", "generated", "admin-2026-04", "schema.graphql");
37
+ if ((0, import_node_fs.existsSync)(srcPath)) return srcPath;
38
+ }
39
+ throw new Error("Unable to locate schema.graphql; set SHOP_CLI_PACKAGE_ROOT or run the compiled CLI");
40
+ })();
41
+ const hasDeprecatedDirective = (directives) => Array.isArray(directives) && directives.some((d) => d?.name?.value === "deprecated");
42
+ const addDeprecatedFields = (map, typeName, fields) => {
43
+ if (!fields || fields.length === 0) return;
44
+ for (const f of fields) {
45
+ const fieldName = f?.name?.value;
46
+ if (!fieldName) continue;
47
+ if (!hasDeprecatedDirective(f.directives)) continue;
48
+ const set = map.get(typeName) ?? /* @__PURE__ */ new Set();
49
+ set.add(fieldName);
50
+ map.set(typeName, set);
51
+ }
52
+ };
53
+ const buildDeprecatedFieldMap = (doc) => {
54
+ const map = /* @__PURE__ */ new Map();
55
+ for (const def of doc.definitions) {
56
+ if (def.kind === import_graphql.Kind.OBJECT_TYPE_DEFINITION || def.kind === import_graphql.Kind.OBJECT_TYPE_EXTENSION) {
57
+ addDeprecatedFields(map, def.name.value, def.fields);
58
+ continue;
59
+ }
60
+ if (def.kind === import_graphql.Kind.INTERFACE_TYPE_DEFINITION || def.kind === import_graphql.Kind.INTERFACE_TYPE_EXTENSION) {
61
+ addDeprecatedFields(map, def.name.value, def.fields);
62
+ continue;
63
+ }
64
+ if (def.kind === import_graphql.Kind.INPUT_OBJECT_TYPE_DEFINITION || def.kind === import_graphql.Kind.INPUT_OBJECT_TYPE_EXTENSION) {
65
+ addDeprecatedFields(map, def.name.value, def.fields);
66
+ continue;
67
+ }
68
+ }
69
+ return map;
70
+ };
71
+ const getDeprecatedFieldMap = () => {
72
+ if (!cachedDeprecatedFieldMap) {
73
+ const sdl = (0, import_node_fs.readFileSync)(schemaPath, "utf8");
74
+ cachedDeprecatedFieldMap = buildDeprecatedFieldMap((0, import_graphql.parse)(sdl));
75
+ }
76
+ return cachedDeprecatedFieldMap;
77
+ };
78
+ const isDeprecatedField = (typeName, fieldName) => getDeprecatedFieldMap().get(typeName)?.has(fieldName) ?? false;
79
+ // Annotate the CommonJS export names for ESM import in node:
80
+ 0 && (module.exports = {
81
+ isDeprecatedField
82
+ });
83
+ //# sourceMappingURL=deprecations.js.map
@@ -0,0 +1,6 @@
1
+ import type { FieldInfo } from './index';
2
+ export declare const printFieldsTable: ({ resource, typeName, fields, }: {
3
+ resource: string;
4
+ typeName: string;
5
+ fields: FieldInfo[];
6
+ }) => void;