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,313 @@
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 companies_exports = {};
20
+ __export(companies_exports, {
21
+ runCompanies: () => runCompanies
22
+ });
23
+ module.exports = __toCommonJS(companies_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 companySummarySelection = {
32
+ id: true,
33
+ name: true,
34
+ externalId: true,
35
+ mainContact: { id: true, customer: { displayName: true, email: true } },
36
+ contactCount: true,
37
+ locationsCount: { count: true },
38
+ ordersCount: { count: true },
39
+ createdAt: true
40
+ };
41
+ const companyFullSelection = {
42
+ ...companySummarySelection,
43
+ note: true,
44
+ contacts: {
45
+ __args: { first: 10 },
46
+ nodes: {
47
+ id: true,
48
+ isMainContact: true,
49
+ customer: { id: true, displayName: true, email: true },
50
+ roles: { __args: { first: 5 }, nodes: { id: true, name: true } }
51
+ }
52
+ },
53
+ locations: {
54
+ __args: { first: 10 },
55
+ nodes: {
56
+ id: true,
57
+ name: true,
58
+ billingAddress: { address1: true, city: true, countryCode: true },
59
+ shippingAddress: { address1: true, city: true, countryCode: true }
60
+ }
61
+ },
62
+ events: {
63
+ __args: { first: 5 },
64
+ nodes: { id: true, message: true, createdAt: true }
65
+ }
66
+ };
67
+ const getCompanySelection = (view) => {
68
+ if (view === "ids") return { id: true };
69
+ if (view === "full") return companyFullSelection;
70
+ if (view === "raw") return {};
71
+ return companySummarySelection;
72
+ };
73
+ const runCompanies = async ({
74
+ ctx,
75
+ verb,
76
+ argv
77
+ }) => {
78
+ if (argv.includes("--help") || argv.includes("-h")) {
79
+ console.log(
80
+ [
81
+ "Usage:",
82
+ " shop companies <verb> [flags]",
83
+ "",
84
+ "Verbs:",
85
+ " create|get|list|count|update|delete|bulk-delete",
86
+ " address-delete",
87
+ " assign-main-contact|revoke-main-contact|assign-customer",
88
+ "",
89
+ "Common output flags:",
90
+ " --view summary|ids|full|raw",
91
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
92
+ " --selection <graphql> (selection override; can be @file.gql)"
93
+ ].join("\n")
94
+ );
95
+ return;
96
+ }
97
+ if (verb === "address-delete") {
98
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "address-id": { type: "string" } } });
99
+ const addressId = (0, import_shared.requireGidFlag)(args["address-id"], "--address-id", "CompanyAddress");
100
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
101
+ const result = await (0, import_router.runMutation)(ctx, {
102
+ companyAddressDelete: {
103
+ __args: { addressId },
104
+ deletedAddressId: true,
105
+ userErrors: { field: true, message: true, code: true }
106
+ }
107
+ });
108
+ if (result === void 0) return;
109
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyAddressDelete, failOnUserErrors: ctx.failOnUserErrors });
110
+ if (ctx.quiet) return console.log(result.companyAddressDelete?.deletedAddressId ?? "");
111
+ (0, import_output.printJson)(result.companyAddressDelete, ctx.format !== "raw");
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, "Company");
117
+ const selection = (0, import_select.resolveSelection)({
118
+ resource: "companies",
119
+ view: ctx.view,
120
+ baseSelection: getCompanySelection(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, { company: { __args: { id }, ...selection } });
127
+ if (result === void 0) return;
128
+ (0, import_output.printNode)({ node: result.company, 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 query = args.query;
136
+ const reverse = args.reverse;
137
+ const sortKey = args.sort;
138
+ const nodeSelection = (0, import_select.resolveSelection)({
139
+ resource: "companies",
140
+ view: ctx.view,
141
+ baseSelection: getCompanySelection(ctx.view),
142
+ select: args.select,
143
+ selection: args.selection,
144
+ include: args.include,
145
+ ensureId: ctx.quiet
146
+ });
147
+ const result = await (0, import_router.runQuery)(ctx, {
148
+ companies: {
149
+ __args: { first, after, query, reverse, sortKey },
150
+ pageInfo: { hasNextPage: true, endCursor: true },
151
+ nodes: nodeSelection
152
+ }
153
+ });
154
+ if (result === void 0) return;
155
+ (0, import_output.printConnection)({
156
+ connection: result.companies,
157
+ format: ctx.format,
158
+ quiet: ctx.quiet,
159
+ nextPageArgs: (0, import_shared.buildListNextPageArgs)("companies", { first, query, sort: sortKey, reverse })
160
+ });
161
+ return;
162
+ }
163
+ if (verb === "count") {
164
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { limit: { type: "string" } } });
165
+ const limit = args.limit === void 0 ? void 0 : Number(args.limit);
166
+ if (args.limit !== void 0 && (!Number.isFinite(limit) || limit <= 0)) {
167
+ throw new import_errors.CliError("--limit must be a positive integer", 2);
168
+ }
169
+ const result = await (0, import_router.runQuery)(ctx, {
170
+ companiesCount: { __args: { ...limit ? { limit: Math.floor(limit) } : {} }, count: true, precision: true }
171
+ });
172
+ if (result === void 0) return;
173
+ if (ctx.quiet) return console.log(result.companiesCount?.count ?? "");
174
+ (0, import_output.printJson)(result.companiesCount, ctx.format !== "raw");
175
+ return;
176
+ }
177
+ if (verb === "create") {
178
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
179
+ const built = (0, import_input.buildInput)({
180
+ inputArg: args.input,
181
+ setArgs: args.set,
182
+ setJsonArgs: args["set-json"]
183
+ });
184
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
185
+ const result = await (0, import_router.runMutation)(ctx, {
186
+ companyCreate: {
187
+ __args: { input: built.input },
188
+ company: companySummarySelection,
189
+ userErrors: { field: true, message: true }
190
+ }
191
+ });
192
+ if (result === void 0) return;
193
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyCreate, failOnUserErrors: ctx.failOnUserErrors });
194
+ if (ctx.quiet) return console.log(result.companyCreate?.company?.id ?? "");
195
+ (0, import_output.printJson)(result.companyCreate, ctx.format !== "raw");
196
+ return;
197
+ }
198
+ if (verb === "update") {
199
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
200
+ const id = (0, import_shared.requireId)(args.id, "Company");
201
+ const built = (0, import_input.buildInput)({
202
+ inputArg: args.input,
203
+ setArgs: args.set,
204
+ setJsonArgs: args["set-json"]
205
+ });
206
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
207
+ const result = await (0, import_router.runMutation)(ctx, {
208
+ companyUpdate: {
209
+ __args: { companyId: id, input: built.input },
210
+ company: companySummarySelection,
211
+ userErrors: { field: true, message: true }
212
+ }
213
+ });
214
+ if (result === void 0) return;
215
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyUpdate, failOnUserErrors: ctx.failOnUserErrors });
216
+ if (ctx.quiet) return console.log(result.companyUpdate?.company?.id ?? "");
217
+ (0, import_output.printJson)(result.companyUpdate, ctx.format !== "raw");
218
+ return;
219
+ }
220
+ if (verb === "delete") {
221
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
222
+ const id = (0, import_shared.requireId)(args.id, "Company");
223
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
224
+ const result = await (0, import_router.runMutation)(ctx, {
225
+ companyDelete: {
226
+ __args: { id },
227
+ deletedCompanyId: true,
228
+ userErrors: { field: true, message: true }
229
+ }
230
+ });
231
+ if (result === void 0) return;
232
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyDelete, failOnUserErrors: ctx.failOnUserErrors });
233
+ if (ctx.quiet) return console.log(result.companyDelete?.deletedCompanyId ?? "");
234
+ (0, import_output.printJson)(result.companyDelete, ctx.format !== "raw");
235
+ return;
236
+ }
237
+ if (verb === "bulk-delete") {
238
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
239
+ if (!args.yes) throw new import_errors.CliError("Refusing to bulk-delete without --yes", 2);
240
+ const companyIds = (0, import_shared.parseIds)(args.ids, "Company");
241
+ const result = await (0, import_router.runMutation)(ctx, {
242
+ companiesDelete: {
243
+ __args: { companyIds },
244
+ deletedCompanyIds: true,
245
+ userErrors: { field: true, message: true }
246
+ }
247
+ });
248
+ if (result === void 0) return;
249
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companiesDelete, failOnUserErrors: ctx.failOnUserErrors });
250
+ if (ctx.quiet) return console.log((result.companiesDelete?.deletedCompanyIds ?? []).join("\n"));
251
+ (0, import_output.printJson)(result.companiesDelete, ctx.format !== "raw");
252
+ return;
253
+ }
254
+ if (verb === "assign-main-contact") {
255
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "contact-id": { type: "string" } } });
256
+ const companyId = (0, import_shared.requireId)(args.id, "Company");
257
+ const contactId = (0, import_shared.requireId)(args["contact-id"], "CompanyContact");
258
+ const result = await (0, import_router.runMutation)(ctx, {
259
+ companyAssignMainContact: {
260
+ __args: { companyId, companyContactId: contactId },
261
+ company: companySummarySelection,
262
+ userErrors: { field: true, message: true }
263
+ }
264
+ });
265
+ if (result === void 0) return;
266
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyAssignMainContact, failOnUserErrors: ctx.failOnUserErrors });
267
+ if (ctx.quiet) return console.log(result.companyAssignMainContact?.company?.id ?? "");
268
+ (0, import_output.printJson)(result.companyAssignMainContact, ctx.format !== "raw");
269
+ return;
270
+ }
271
+ if (verb === "revoke-main-contact") {
272
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
273
+ const companyId = (0, import_shared.requireId)(args.id, "Company");
274
+ const result = await (0, import_router.runMutation)(ctx, {
275
+ companyRevokeMainContact: {
276
+ __args: { companyId },
277
+ company: companySummarySelection,
278
+ userErrors: { field: true, message: true }
279
+ }
280
+ });
281
+ if (result === void 0) return;
282
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyRevokeMainContact, failOnUserErrors: ctx.failOnUserErrors });
283
+ if (ctx.quiet) return console.log(result.companyRevokeMainContact?.company?.id ?? "");
284
+ (0, import_output.printJson)(result.companyRevokeMainContact, ctx.format !== "raw");
285
+ return;
286
+ }
287
+ if (verb === "assign-customer") {
288
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "customer-id": { type: "string" } } });
289
+ const companyId = (0, import_shared.requireId)(args.id, "Company");
290
+ const customerId = (0, import_shared.requireId)(args["customer-id"], "Customer");
291
+ const result = await (0, import_router.runMutation)(ctx, {
292
+ companyAssignCustomerAsContact: {
293
+ __args: { companyId, customerId },
294
+ companyContact: { id: true, customer: { id: true, displayName: true, email: true } },
295
+ userErrors: { field: true, message: true }
296
+ }
297
+ });
298
+ if (result === void 0) return;
299
+ (0, import_userErrors.maybeFailOnUserErrors)({
300
+ payload: result.companyAssignCustomerAsContact,
301
+ failOnUserErrors: ctx.failOnUserErrors
302
+ });
303
+ if (ctx.quiet) return console.log(result.companyAssignCustomerAsContact?.companyContact?.id ?? "");
304
+ (0, import_output.printJson)(result.companyAssignCustomerAsContact, ctx.format !== "raw");
305
+ return;
306
+ }
307
+ throw new import_errors.CliError(`Unknown verb for companies: ${verb}`, 2);
308
+ };
309
+ // Annotate the CommonJS export names for ESM import in node:
310
+ 0 && (module.exports = {
311
+ runCompanies
312
+ });
313
+ //# sourceMappingURL=companies.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runCompanyContacts: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;
@@ -0,0 +1,314 @@
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 company_contacts_exports = {};
20
+ __export(company_contacts_exports, {
21
+ runCompanyContacts: () => runCompanyContacts
22
+ });
23
+ module.exports = __toCommonJS(company_contacts_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 companyContactSummarySelection = {
32
+ id: true,
33
+ isMainContact: true,
34
+ customer: { id: true, displayName: true, email: true }
35
+ };
36
+ const companyContactFullSelection = {
37
+ ...companyContactSummarySelection,
38
+ locale: true,
39
+ title: true,
40
+ roles: {
41
+ __args: { first: 10 },
42
+ nodes: { id: true, name: true }
43
+ }
44
+ };
45
+ const getCompanyContactSelection = (view) => {
46
+ if (view === "ids") return { id: true };
47
+ if (view === "full") return companyContactFullSelection;
48
+ if (view === "raw") return {};
49
+ return companyContactSummarySelection;
50
+ };
51
+ const companyContactRoleSelection = {
52
+ id: true,
53
+ name: true,
54
+ note: true
55
+ };
56
+ const runCompanyContacts = async ({
57
+ ctx,
58
+ verb,
59
+ argv
60
+ }) => {
61
+ if (argv.includes("--help") || argv.includes("-h")) {
62
+ console.log(
63
+ [
64
+ "Usage:",
65
+ " shop company-contacts <verb> [flags]",
66
+ "",
67
+ "Verbs:",
68
+ " create|get|update|delete|bulk-delete",
69
+ " role-get",
70
+ " assign-role|assign-roles|revoke-role|revoke-roles",
71
+ " remove-from-company|send-welcome-email",
72
+ "",
73
+ "Common output flags:",
74
+ " --view summary|ids|full|raw",
75
+ " --select <path> (repeatable; dot paths; adds to base view selection)",
76
+ " --selection <graphql> (selection override; can be @file.gql)"
77
+ ].join("\n")
78
+ );
79
+ return;
80
+ }
81
+ if (verb === "role-get") {
82
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
83
+ const id = (0, import_shared.requireId)(args.id, "CompanyContactRole");
84
+ const result = await (0, import_router.runQuery)(ctx, { companyContactRole: { __args: { id }, ...companyContactRoleSelection } });
85
+ if (result === void 0) return;
86
+ (0, import_output.printNode)({ node: result.companyContactRole, format: ctx.format, quiet: ctx.quiet });
87
+ return;
88
+ }
89
+ if (verb === "get") {
90
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
91
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
92
+ const selection = (0, import_select.resolveSelection)({
93
+ resource: "company-contacts",
94
+ view: ctx.view,
95
+ baseSelection: getCompanyContactSelection(ctx.view),
96
+ select: args.select,
97
+ selection: args.selection,
98
+ include: args.include,
99
+ ensureId: ctx.quiet
100
+ });
101
+ const result = await (0, import_router.runQuery)(ctx, { companyContact: { __args: { id }, ...selection } });
102
+ if (result === void 0) return;
103
+ (0, import_output.printNode)({ node: result.companyContact, format: ctx.format, quiet: ctx.quiet });
104
+ return;
105
+ }
106
+ if (verb === "create") {
107
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "company-id": { type: "string" } } });
108
+ const companyId = (0, import_shared.requireId)(args["company-id"], "Company");
109
+ const built = (0, import_input.buildInput)({
110
+ inputArg: args.input,
111
+ setArgs: args.set,
112
+ setJsonArgs: args["set-json"]
113
+ });
114
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
115
+ const result = await (0, import_router.runMutation)(ctx, {
116
+ companyContactCreate: {
117
+ __args: { companyId, input: built.input },
118
+ companyContact: companyContactSummarySelection,
119
+ userErrors: { field: true, message: true }
120
+ }
121
+ });
122
+ if (result === void 0) return;
123
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactCreate, failOnUserErrors: ctx.failOnUserErrors });
124
+ if (ctx.quiet) return console.log(result.companyContactCreate?.companyContact?.id ?? "");
125
+ (0, import_output.printJson)(result.companyContactCreate, ctx.format !== "raw");
126
+ return;
127
+ }
128
+ if (verb === "update") {
129
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
130
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
131
+ const built = (0, import_input.buildInput)({
132
+ inputArg: args.input,
133
+ setArgs: args.set,
134
+ setJsonArgs: args["set-json"]
135
+ });
136
+ if (!built.used) throw new import_errors.CliError("Missing --input or --set/--set-json", 2);
137
+ const result = await (0, import_router.runMutation)(ctx, {
138
+ companyContactUpdate: {
139
+ __args: { companyContactId: id, input: built.input },
140
+ companyContact: companyContactSummarySelection,
141
+ userErrors: { field: true, message: true }
142
+ }
143
+ });
144
+ if (result === void 0) return;
145
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactUpdate, failOnUserErrors: ctx.failOnUserErrors });
146
+ if (ctx.quiet) return console.log(result.companyContactUpdate?.companyContact?.id ?? "");
147
+ (0, import_output.printJson)(result.companyContactUpdate, ctx.format !== "raw");
148
+ return;
149
+ }
150
+ if (verb === "delete") {
151
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
152
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
153
+ if (!args.yes) throw new import_errors.CliError("Refusing to delete without --yes", 2);
154
+ const result = await (0, import_router.runMutation)(ctx, {
155
+ companyContactDelete: {
156
+ __args: { companyContactId: id },
157
+ deletedCompanyContactId: true,
158
+ userErrors: { field: true, message: true }
159
+ }
160
+ });
161
+ if (result === void 0) return;
162
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactDelete, failOnUserErrors: ctx.failOnUserErrors });
163
+ if (ctx.quiet) return console.log(result.companyContactDelete?.deletedCompanyContactId ?? "");
164
+ (0, import_output.printJson)(result.companyContactDelete, ctx.format !== "raw");
165
+ return;
166
+ }
167
+ if (verb === "bulk-delete") {
168
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
169
+ if (!args.yes) throw new import_errors.CliError("Refusing to bulk-delete without --yes", 2);
170
+ const companyContactIds = (0, import_shared.parseIds)(args.ids, "CompanyContact");
171
+ const result = await (0, import_router.runMutation)(ctx, {
172
+ companyContactsDelete: {
173
+ __args: { companyContactIds },
174
+ deletedCompanyContactIds: true,
175
+ userErrors: { field: true, message: true }
176
+ }
177
+ });
178
+ if (result === void 0) return;
179
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactsDelete, failOnUserErrors: ctx.failOnUserErrors });
180
+ if (ctx.quiet) return console.log((result.companyContactsDelete?.deletedCompanyContactIds ?? []).join("\n"));
181
+ (0, import_output.printJson)(result.companyContactsDelete, ctx.format !== "raw");
182
+ return;
183
+ }
184
+ if (verb === "assign-role") {
185
+ const args = (0, import_router.parseStandardArgs)({
186
+ argv,
187
+ extraOptions: {
188
+ "role-id": { type: "string" },
189
+ "location-id": { type: "string" }
190
+ }
191
+ });
192
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
193
+ const roleId = (0, import_shared.requireId)(args["role-id"], "CompanyContactRole");
194
+ const locationId = (0, import_shared.requireId)(args["location-id"], "CompanyLocation");
195
+ const result = await (0, import_router.runMutation)(ctx, {
196
+ companyContactAssignRole: {
197
+ __args: { companyContactId: id, companyContactRoleId: roleId, companyLocationId: locationId },
198
+ companyContactRoleAssignment: { id: true },
199
+ userErrors: { field: true, message: true }
200
+ }
201
+ });
202
+ if (result === void 0) return;
203
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactAssignRole, failOnUserErrors: ctx.failOnUserErrors });
204
+ if (ctx.quiet) return console.log(result.companyContactAssignRole?.companyContactRoleAssignment?.id ?? "");
205
+ (0, import_output.printJson)(result.companyContactAssignRole, ctx.format !== "raw");
206
+ return;
207
+ }
208
+ if (verb === "assign-roles") {
209
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "role-assignments": { type: "string" } } });
210
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
211
+ const rolesToAssign = (0, import_shared.parseJsonArg)(args["role-assignments"], "--role-assignments");
212
+ const result = await (0, import_router.runMutation)(ctx, {
213
+ companyContactAssignRoles: {
214
+ __args: { companyContactId: id, rolesToAssign },
215
+ roleAssignments: { id: true },
216
+ userErrors: { field: true, message: true }
217
+ }
218
+ });
219
+ if (result === void 0) return;
220
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactAssignRoles, failOnUserErrors: ctx.failOnUserErrors });
221
+ if (ctx.quiet) {
222
+ const ids = (result.companyContactAssignRoles?.roleAssignments ?? []).map((r) => r?.id);
223
+ return console.log(ids.filter(Boolean).join("\n"));
224
+ }
225
+ (0, import_output.printJson)(result.companyContactAssignRoles, ctx.format !== "raw");
226
+ return;
227
+ }
228
+ if (verb === "revoke-role") {
229
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { "role-assignment-id": { type: "string" } } });
230
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
231
+ const assignmentId = (0, import_shared.requireId)(args["role-assignment-id"], "CompanyContactRoleAssignment");
232
+ const result = await (0, import_router.runMutation)(ctx, {
233
+ companyContactRevokeRole: {
234
+ __args: { companyContactId: id, companyContactRoleAssignmentId: assignmentId },
235
+ revokedCompanyContactRoleAssignmentId: true,
236
+ userErrors: { field: true, message: true }
237
+ }
238
+ });
239
+ if (result === void 0) return;
240
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactRevokeRole, failOnUserErrors: ctx.failOnUserErrors });
241
+ if (ctx.quiet) return console.log(result.companyContactRevokeRole?.revokedCompanyContactRoleAssignmentId ?? "");
242
+ (0, import_output.printJson)(result.companyContactRevokeRole, ctx.format !== "raw");
243
+ return;
244
+ }
245
+ if (verb === "revoke-roles") {
246
+ const args = (0, import_router.parseStandardArgs)({
247
+ argv,
248
+ extraOptions: { "role-assignment-ids": { type: "string", multiple: true }, all: { type: "boolean" } }
249
+ });
250
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
251
+ const revokeAll = Boolean(args.all);
252
+ const roleAssignmentIds = revokeAll ? void 0 : (0, import_shared.parseStringList)(args["role-assignment-ids"], "--role-assignment-ids");
253
+ const result = await (0, import_router.runMutation)(ctx, {
254
+ companyContactRevokeRoles: {
255
+ __args: { companyContactId: id, revokeAll, ...roleAssignmentIds ? { roleAssignmentIds } : {} },
256
+ revokedRoleAssignmentIds: true,
257
+ userErrors: { field: true, message: true }
258
+ }
259
+ });
260
+ if (result === void 0) return;
261
+ (0, import_userErrors.maybeFailOnUserErrors)({ payload: result.companyContactRevokeRoles, failOnUserErrors: ctx.failOnUserErrors });
262
+ if (ctx.quiet) {
263
+ const ids = result.companyContactRevokeRoles?.revokedRoleAssignmentIds ?? [];
264
+ return console.log(ids.filter(Boolean).join("\n"));
265
+ }
266
+ (0, import_output.printJson)(result.companyContactRevokeRoles, ctx.format !== "raw");
267
+ return;
268
+ }
269
+ if (verb === "remove-from-company") {
270
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: {} });
271
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
272
+ const result = await (0, import_router.runMutation)(ctx, {
273
+ companyContactRemoveFromCompany: {
274
+ __args: { companyContactId: id },
275
+ removedCompanyContactId: true,
276
+ userErrors: { field: true, message: true }
277
+ }
278
+ });
279
+ if (result === void 0) return;
280
+ (0, import_userErrors.maybeFailOnUserErrors)({
281
+ payload: result.companyContactRemoveFromCompany,
282
+ failOnUserErrors: ctx.failOnUserErrors
283
+ });
284
+ if (ctx.quiet) return console.log(result.companyContactRemoveFromCompany?.removedCompanyContactId ?? "");
285
+ (0, import_output.printJson)(result.companyContactRemoveFromCompany, ctx.format !== "raw");
286
+ return;
287
+ }
288
+ if (verb === "send-welcome-email") {
289
+ const args = (0, import_router.parseStandardArgs)({ argv, extraOptions: { email: { type: "string" } } });
290
+ const id = (0, import_shared.requireId)(args.id, "CompanyContact");
291
+ const email = args.email ? (0, import_shared.parseJsonArg)(args.email, "--email", { allowEmpty: true }) : void 0;
292
+ const result = await (0, import_router.runMutation)(ctx, {
293
+ companyContactSendWelcomeEmail: {
294
+ __args: { companyContactId: id, ...email ? { email } : {} },
295
+ companyContact: companyContactSummarySelection,
296
+ userErrors: { field: true, message: true }
297
+ }
298
+ });
299
+ if (result === void 0) return;
300
+ (0, import_userErrors.maybeFailOnUserErrors)({
301
+ payload: result.companyContactSendWelcomeEmail,
302
+ failOnUserErrors: ctx.failOnUserErrors
303
+ });
304
+ if (ctx.quiet) return console.log(result.companyContactSendWelcomeEmail?.companyContact?.id ?? "");
305
+ (0, import_output.printJson)(result.companyContactSendWelcomeEmail, ctx.format !== "raw");
306
+ return;
307
+ }
308
+ throw new import_errors.CliError(`Unknown verb for company-contacts: ${verb}`, 2);
309
+ };
310
+ // Annotate the CommonJS export names for ESM import in node:
311
+ 0 && (module.exports = {
312
+ runCompanyContacts
313
+ });
314
+ //# sourceMappingURL=company-contacts.js.map
@@ -0,0 +1,6 @@
1
+ import { type CommandContext } from '../router';
2
+ export declare const runCompanyLocations: ({ ctx, verb, argv, }: {
3
+ ctx: CommandContext;
4
+ verb: string;
5
+ argv: string[];
6
+ }) => Promise<void>;