shopify 5.1.0 → 5.2.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 (367) hide show
  1. package/dist/analytics-23GM6KJU.js +1 -0
  2. package/dist/analytics-743FYOAE.js +1 -0
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/{chunk-HSTZV6H7.js → chunk-2EQRXSF6.js} +1 -1
  5. package/dist/{chunk-AY3AAV77.js → chunk-2IXP3IPE.js} +1 -1
  6. package/dist/{chunk-OTMYJWIP.js → chunk-2KACAQJS.js} +1 -1
  7. package/dist/{chunk-24Q6X53V.js → chunk-2OCSYLKZ.js} +1 -1
  8. package/dist/{chunk-QCLE5REL.js → chunk-2PILNMHJ.js} +1 -1
  9. package/dist/{chunk-WPDJVUTY.js → chunk-36S6MFJQ.js} +1 -1
  10. package/dist/{chunk-YNZLLZU2.js → chunk-3DB4EC62.js} +1 -1
  11. package/dist/{chunk-FQLXQ7WN.js → chunk-3GL3IT4K.js} +1 -1
  12. package/dist/{chunk-JALDNBTU.js → chunk-3JRB7Q3T.js} +1 -1
  13. package/dist/{chunk-7A77JCED.js → chunk-3OYMK5X6.js} +1 -1
  14. package/dist/{chunk-ORMXPSJM.js → chunk-422BGHXN.js} +1 -1
  15. package/dist/{chunk-ZMU4EYXT.js → chunk-43C32FUQ.js} +1 -1
  16. package/dist/{chunk-ELR6AZT4.js → chunk-4AN7ECPE.js} +1 -1
  17. package/dist/chunk-4AWVU2OV.js +1 -0
  18. package/dist/chunk-4KBOLN7Q.js +8 -0
  19. package/dist/{chunk-YYWSHRO2.js → chunk-4LJERO23.js} +3 -3
  20. package/dist/{chunk-4FWPOGPQ.js → chunk-4M5WHOZW.js} +1 -1
  21. package/dist/{chunk-OWQEFORZ.js → chunk-4RO35FFQ.js} +1 -1
  22. package/dist/{chunk-6I7DT7QR.js → chunk-4ZS5354G.js} +1 -1
  23. package/dist/{chunk-ZXZWMXXK.js → chunk-55AWBPKU.js} +1 -1
  24. package/dist/{chunk-7PHDEILV.js → chunk-5BUYR23E.js} +1 -1
  25. package/dist/{chunk-AHYI27QL.js → chunk-5EDA7PVE.js} +3 -3
  26. package/dist/{chunk-5C6CXU74.js → chunk-5P6OELKZ.js} +1 -1
  27. package/dist/{chunk-SPJM7RTD.js → chunk-5PVXLQNX.js} +1 -1
  28. package/dist/{chunk-FU7PYW7H.js → chunk-5S2P4MHJ.js} +1 -1
  29. package/dist/{chunk-SBN3ILXO.js → chunk-5TJJVSCI.js} +1 -1
  30. package/dist/{chunk-VE3IIC7H.js → chunk-5TOK5OJS.js} +1 -1
  31. package/dist/{chunk-LGDWE3H3.js → chunk-5ZG2SWU2.js} +1 -1
  32. package/dist/{chunk-DDZYIC76.js → chunk-62F4ZMSC.js} +1 -1
  33. package/dist/{chunk-4NFX7YCT.js → chunk-652NT7OW.js} +1 -1
  34. package/dist/{chunk-5534MHZW.js → chunk-6B5KM3A4.js} +1 -1
  35. package/dist/{chunk-CRQQCT7F.js → chunk-6LCESSY3.js} +1 -1
  36. package/dist/chunk-6QHDMCAA.js +1 -0
  37. package/dist/{chunk-2KUM2RU4.js → chunk-7A4ZE5IS.js} +2 -2
  38. package/dist/{chunk-R6US7F33.js → chunk-7AQZKPJU.js} +1 -1
  39. package/dist/{chunk-HMPRWNGG.js → chunk-7FBOMPO5.js} +2 -2
  40. package/dist/{chunk-DGIIUQH3.js → chunk-7UK565VJ.js} +1 -1
  41. package/dist/{chunk-DOLVBTCB.js → chunk-A5BSUUNQ.js} +1 -1
  42. package/dist/{chunk-SCDGLREP.js → chunk-ADGE7MKB.js} +1 -1
  43. package/dist/{chunk-65NCQJYR.js → chunk-AEWRZ7AE.js} +1 -1
  44. package/dist/chunk-ALDJTWCO.js +1 -0
  45. package/dist/chunk-ARL5WBDK.js +1 -0
  46. package/dist/chunk-AXFEIJC7.js +1 -0
  47. package/dist/{chunk-JNSVKDBY.js → chunk-AYGL6F3P.js} +1 -1
  48. package/dist/{chunk-F6IQWX2F.js → chunk-AYTTE7X5.js} +1 -1
  49. package/dist/{chunk-JIYCZXK5.js → chunk-BDIZUTKC.js} +1 -1
  50. package/dist/{chunk-Z5WFRYVQ.js → chunk-BQKF4SRH.js} +1 -1
  51. package/dist/{chunk-7ART2IKU.js → chunk-C2AOCLEZ.js} +1 -1
  52. package/dist/{chunk-NYMKGE3J.js → chunk-C2SGJ5IG.js} +1 -1
  53. package/dist/{chunk-LPPEAMI6.js → chunk-C3S3UMV3.js} +1 -1
  54. package/dist/{chunk-S3RROJGG.js → chunk-C5DKLOW4.js} +1 -1
  55. package/dist/{chunk-DC7ITY6T.js → chunk-CA3GVT4D.js} +1 -1
  56. package/dist/{chunk-KFR7HWCG.js → chunk-CCLU5ZRK.js} +1 -1
  57. package/dist/{chunk-3FZ4LE6A.js → chunk-CE6XQDAG.js} +2 -2
  58. package/dist/{chunk-RKNVTEO3.js → chunk-CEJ5WS4I.js} +1 -1
  59. package/dist/chunk-CIBBQO2L.js +6 -0
  60. package/dist/{chunk-L2PUDV7Y.js → chunk-CKJXJ6HD.js} +1 -1
  61. package/dist/{chunk-KHZF73BL.js → chunk-COGKVNQB.js} +1 -1
  62. package/dist/{chunk-OY5M52EF.js → chunk-CQPZOXWO.js} +1 -1
  63. package/dist/{chunk-AVJJGQOP.js → chunk-CZYQIWNL.js} +1 -1
  64. package/dist/{chunk-VA2S7W7H.js → chunk-DA5RQFXA.js} +1 -1
  65. package/dist/{chunk-NUBJ2HK7.js → chunk-DESZFFOK.js} +1 -1
  66. package/dist/{chunk-WLYXBQ2M.js → chunk-DKR7562G.js} +1 -1
  67. package/dist/{chunk-KM4LE7K4.js → chunk-DNNTAMC5.js} +1 -1
  68. package/dist/{chunk-V4FC72R6.js → chunk-DUPQUQ2Z.js} +1 -1
  69. package/dist/{chunk-FHKK3QU7.js → chunk-DUTIWCJ2.js} +1 -1
  70. package/dist/chunk-E6JEBSHZ.js +20 -0
  71. package/dist/{chunk-VQSRU5XL.js → chunk-E6KNAPIY.js} +1 -1
  72. package/dist/{chunk-MTT6EAQO.js → chunk-E7XCCLQH.js} +1 -1
  73. package/dist/chunk-EE72PCKT.js +1 -0
  74. package/dist/{chunk-AGTUAQHX.js → chunk-EEYXBKR7.js} +1 -1
  75. package/dist/{chunk-H2KGP2FM.js → chunk-EGLA3WLZ.js} +1 -1
  76. package/dist/{chunk-JMSAHCBU.js → chunk-FDFE3SSG.js} +1 -1
  77. package/dist/{chunk-TSPJAMYB.js → chunk-FI5TQHUA.js} +1 -1
  78. package/dist/{chunk-QKPAB245.js → chunk-FIKZQ4RA.js} +1 -1
  79. package/dist/chunk-FJOVMEPN.js +3 -0
  80. package/dist/{chunk-5PSQFQL6.js → chunk-FLARCZ5F.js} +1 -1
  81. package/dist/{chunk-WE5KY6T6.js → chunk-FOMMPAWZ.js} +1 -1
  82. package/dist/chunk-G3DXNSA2.js +1 -0
  83. package/dist/{chunk-HYCNYUHW.js → chunk-G7JO3W2R.js} +1 -1
  84. package/dist/{chunk-C2HJEGTS.js → chunk-GABIWYY3.js} +1 -1
  85. package/dist/{chunk-OXZR2MB4.js → chunk-GFSEU7PF.js} +1 -1
  86. package/dist/{chunk-AMVWKHNY.js → chunk-GFVUWVEM.js} +1 -1
  87. package/dist/{chunk-D7IMC2G4.js → chunk-GHNSXX7R.js} +1 -1
  88. package/dist/{chunk-7N7KRZOM.js → chunk-GQ3LY7BY.js} +1 -1
  89. package/dist/{chunk-PJZZZNWR.js → chunk-H45S4MGC.js} +1 -1
  90. package/dist/{chunk-OJOF6IYG.js → chunk-HEB4YYM6.js} +4 -4
  91. package/dist/{chunk-I3WRA2LH.js → chunk-HI5FTI3M.js} +1 -1
  92. package/dist/{chunk-WFPVT2IY.js → chunk-HJ24NEP5.js} +1 -1
  93. package/dist/{chunk-LFBFPK22.js → chunk-HQFXVVTB.js} +1 -1
  94. package/dist/{chunk-27JT4NA4.js → chunk-HR6R7JXN.js} +1 -1
  95. package/dist/{chunk-JVY6CCLE.js → chunk-HRHJA5ZP.js} +1 -1
  96. package/dist/{chunk-5HOZDOJ7.js → chunk-HT5JQJMB.js} +1 -1
  97. package/dist/chunk-HT7273V7.js +1 -0
  98. package/dist/{chunk-ONZULPQH.js → chunk-HUB4HDWN.js} +75 -75
  99. package/dist/{chunk-HGZ2HRPO.js → chunk-IATNIWOC.js} +1 -1
  100. package/dist/{chunk-T6C4WC3Z.js → chunk-IHVWDKDV.js} +1 -1
  101. package/dist/{chunk-DMOLPSXF.js → chunk-IKXUYCK7.js} +1 -1
  102. package/dist/{chunk-HP4QYSBQ.js → chunk-IVQN2RUP.js} +1 -1
  103. package/dist/{chunk-FYQE5E6U.js → chunk-J324ZPO6.js} +1 -1
  104. package/dist/{chunk-3MZ7ELHS.js → chunk-JJQ3DJG5.js} +1 -1
  105. package/dist/{chunk-RLOEI6VE.js → chunk-JLAN6JXJ.js} +1 -1
  106. package/dist/{chunk-XRNBCV2B.js → chunk-K2GCCCCV.js} +1 -1
  107. package/dist/{chunk-ASKBYEO7.js → chunk-K4KKSBUW.js} +1 -1
  108. package/dist/{chunk-JC37YZ4I.js → chunk-K5UVCBIP.js} +1 -1
  109. package/dist/{chunk-3C72S6LO.js → chunk-KN2JIDNO.js} +1 -1
  110. package/dist/{chunk-WBJFTCEJ.js → chunk-KORVOCNN.js} +1 -1
  111. package/dist/{chunk-MGWCXTGD.js → chunk-KRQCQ57O.js} +1 -1
  112. package/dist/{chunk-3GD5ESWN.js → chunk-KT2AMFVW.js} +1 -1
  113. package/dist/{chunk-VRIFLMA3.js → chunk-L23Q53FM.js} +1 -1
  114. package/dist/{chunk-OXPEBT4I.js → chunk-L3DTONOI.js} +1 -1
  115. package/dist/{chunk-CEQGOCKX.js → chunk-LRETOC6P.js} +1 -1
  116. package/dist/{chunk-F5QKMDP3.js → chunk-LXFWK3O2.js} +1 -1
  117. package/dist/{chunk-KCAWHJGF.js → chunk-LZ2TN7EZ.js} +1 -1
  118. package/dist/{chunk-EDWIWZWM.js → chunk-MBAPM5HA.js} +1 -1
  119. package/dist/{chunk-IRLYC626.js → chunk-MGZK5EQW.js} +1 -1
  120. package/dist/{chunk-GSFWBFFH.js → chunk-MKUXSM33.js} +1 -1
  121. package/dist/chunk-MQ55QUOJ.js +276 -0
  122. package/dist/{chunk-A2NSORBM.js → chunk-NAQJMRPT.js} +1 -1
  123. package/dist/{chunk-Z5QEXS6F.js → chunk-NMXRDF4T.js} +1 -1
  124. package/dist/{chunk-SODCXZ5U.js → chunk-NOWM3CCG.js} +1 -1
  125. package/dist/{chunk-TXP6KFWO.js → chunk-NVDFXEQ5.js} +1 -1
  126. package/dist/{chunk-TP7CTMMT.js → chunk-OCILF2DD.js} +1 -1
  127. package/dist/{chunk-XWLNCBAG.js → chunk-OGBMFGYC.js} +1 -1
  128. package/dist/{chunk-ZMOW2YZ4.js → chunk-OIQ5NQ5I.js} +3 -3
  129. package/dist/{chunk-YTL45RXR.js → chunk-OKRKVVTK.js} +1 -1
  130. package/dist/{chunk-JQU2BJDH.js → chunk-ONNUEQGR.js} +1 -1
  131. package/dist/chunk-OSASE35V.js +6 -0
  132. package/dist/{chunk-6IMTMS2S.js → chunk-OTMTS5L4.js} +1 -1
  133. package/dist/{chunk-MKFRKNHF.js → chunk-OWPAHXDF.js} +1 -1
  134. package/dist/{chunk-YVPB7OT6.js → chunk-P7HZGJRU.js} +1 -1
  135. package/dist/{chunk-5T3ZT6CC.js → chunk-PIU3GVJ4.js} +1 -1
  136. package/dist/{chunk-DVD7I2TX.js → chunk-PSNCWS3Q.js} +1 -1
  137. package/dist/{chunk-XEZPN5TR.js → chunk-PSREELSQ.js} +4 -4
  138. package/dist/{chunk-SURFUFAZ.js → chunk-Q2CKRCPM.js} +1 -1
  139. package/dist/{chunk-WWCYEZUU.js → chunk-QA2D7DT2.js} +1 -1
  140. package/dist/{chunk-G3EWGBXR.js → chunk-QDMTJKQ3.js} +1 -1
  141. package/dist/{chunk-NY5N4ANL.js → chunk-QIJ7D2JS.js} +1 -1
  142. package/dist/{chunk-7DBKSSDK.js → chunk-QLN6IOOY.js} +1 -1
  143. package/dist/{chunk-A54TADAZ.js → chunk-QU3USVKT.js} +1 -1
  144. package/dist/chunk-R2E6TMBE.js +22 -0
  145. package/dist/chunk-R5COVIJM.js +1 -0
  146. package/dist/{chunk-S4KNPCW3.js → chunk-RFJ2LI64.js} +1 -1
  147. package/dist/chunk-RNF6T6IO.js +5 -0
  148. package/dist/{chunk-DVFVO6ZE.js → chunk-RSNFNZ6F.js} +1 -1
  149. package/dist/{chunk-7BPT5V24.js → chunk-RZ3UGOV4.js} +2 -2
  150. package/dist/{chunk-GGCP2TIK.js → chunk-S23ZG2RG.js} +1 -1
  151. package/dist/{chunk-3PS52ZT4.js → chunk-SAK42CAY.js} +1 -1
  152. package/dist/{chunk-G3RNO2TC.js → chunk-SBX7CMHM.js} +1 -1
  153. package/dist/{chunk-TUSS6PXB.js → chunk-SGQTRKYZ.js} +1 -1
  154. package/dist/{chunk-SQL67BKI.js → chunk-SNPJVVVE.js} +1 -1
  155. package/dist/{chunk-QUPZOBTB.js → chunk-SNRGS3YU.js} +1 -1
  156. package/dist/{chunk-FKKJQGYX.js → chunk-SUTSCIXU.js} +1 -1
  157. package/dist/{chunk-SHOMIS6Q.js → chunk-SWFCT5B7.js} +1 -1
  158. package/dist/{chunk-WZBZ7FWP.js → chunk-SZ64GAVG.js} +1 -1
  159. package/dist/{chunk-DTKGI43P.js → chunk-TDHIOONG.js} +1 -1
  160. package/dist/{chunk-7NRHZG5Y.js → chunk-TLN4BKXJ.js} +1 -1
  161. package/dist/{chunk-XLMKHTJ5.js → chunk-TXMZPF2U.js} +1 -1
  162. package/dist/{chunk-6BYHL3DS.js → chunk-TZOB52QK.js} +1 -1
  163. package/dist/{chunk-HVUMVDUG.js → chunk-U5BKU3OL.js} +1 -1
  164. package/dist/chunk-UK3BDOHR.js +7 -0
  165. package/dist/{chunk-YKDRUAY3.js → chunk-UORSJB4A.js} +90 -90
  166. package/dist/{chunk-Z6ZRS256.js → chunk-UY44O4IZ.js} +1 -1
  167. package/dist/{chunk-JG4FAT2T.js → chunk-V3H6SYK3.js} +1 -1
  168. package/dist/{chunk-AE3IQG7S.js → chunk-VBPMVVLV.js} +1 -1
  169. package/dist/{chunk-SVQDMZJO.js → chunk-VGBCG3I5.js} +1 -1
  170. package/dist/{chunk-MYMBHVC4.js → chunk-VHRUPKWH.js} +1 -1
  171. package/dist/{chunk-CZNUBAAG.js → chunk-VVHJ2AUF.js} +1 -1
  172. package/dist/{chunk-T4ZOTYOY.js → chunk-WB5GRBHW.js} +1 -1
  173. package/dist/{chunk-YNFQBYSL.js → chunk-WBKQSSWW.js} +1 -1
  174. package/dist/{chunk-MU7IVBGI.js → chunk-WDXDT7XY.js} +2 -2
  175. package/dist/{chunk-FAVPTYIR.js → chunk-WHOD5I7N.js} +1 -1
  176. package/dist/{chunk-7CT3NIXI.js → chunk-WL3M63DG.js} +1 -1
  177. package/dist/{chunk-25MYHE4W.js → chunk-WLJDMI7E.js} +1 -1
  178. package/dist/{chunk-VJG7VXFU.js → chunk-WZ3QWPK5.js} +2 -2
  179. package/dist/{chunk-BPKQA2EO.js → chunk-X5V7AGVU.js} +1 -1
  180. package/dist/{chunk-UFY4L5KQ.js → chunk-X76AYO36.js} +1 -1
  181. package/dist/{chunk-WBPP6PO7.js → chunk-XB7H2RYV.js} +1 -1
  182. package/dist/chunk-XHHAVKKV.js +1 -0
  183. package/dist/{chunk-4TCXPHKN.js → chunk-XKNDU62O.js} +1 -1
  184. package/dist/{chunk-7KID5BIR.js → chunk-XVJRGOJA.js} +1 -1
  185. package/dist/{chunk-CDSDQTNB.js → chunk-Y3ZAQZPH.js} +1 -1
  186. package/dist/{chunk-Q2LQJYRK.js → chunk-YGN65N6W.js} +1 -1
  187. package/dist/{chunk-UC4TOM36.js → chunk-YTC367JI.js} +1 -1
  188. package/dist/{chunk-TTAT62N3.js → chunk-Z2FGYMJ6.js} +1 -1
  189. package/dist/chunk-Z3QZNLT5.js +1 -0
  190. package/dist/{chunk-TSVEV2UD.js → chunk-ZC3EDADH.js} +1 -1
  191. package/dist/{chunk-O7HZ3EIP.js → chunk-ZLITAXPT.js} +1 -1
  192. package/dist/{chunk-WWVDZ3GC.js → chunk-ZNEQZV5K.js} +1 -1
  193. package/dist/{chunk-OVJVFB5E.js → chunk-ZOU6SOXW.js} +1 -1
  194. package/dist/{chunk-KFO2JNF5.js → chunk-ZQNGYJKJ.js} +1 -1
  195. package/dist/{chunk-MZDBH4XV.js → chunk-ZRM7ESSS.js} +1 -1
  196. package/dist/{chunk-ORYEDUKM.js → chunk-ZX33FUW3.js} +1 -1
  197. package/dist/cli/commands/app/build.js +1 -1
  198. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  199. package/dist/cli/commands/app/bulk/execute.js +1 -1
  200. package/dist/cli/commands/app/bulk/status.js +1 -1
  201. package/dist/cli/commands/app/config/link.js +1 -1
  202. package/dist/cli/commands/app/config/pull.js +1 -1
  203. package/dist/cli/commands/app/config/use.js +1 -1
  204. package/dist/cli/commands/app/config/validate.js +1 -1
  205. package/dist/cli/commands/app/demo/watcher.js +1 -1
  206. package/dist/cli/commands/app/deploy.js +1 -1
  207. package/dist/cli/commands/app/dev/clean.js +1 -1
  208. package/dist/cli/commands/app/dev.js +1 -1
  209. package/dist/cli/commands/app/env/pull.js +1 -1
  210. package/dist/cli/commands/app/env/show.js +1 -1
  211. package/dist/cli/commands/app/execute.js +1 -1
  212. package/dist/cli/commands/app/function/build.js +1 -1
  213. package/dist/cli/commands/app/function/info.js +1 -1
  214. package/dist/cli/commands/app/function/replay.js +1 -1
  215. package/dist/cli/commands/app/function/run.js +1 -1
  216. package/dist/cli/commands/app/function/schema.js +1 -1
  217. package/dist/cli/commands/app/function/typegen.js +1 -1
  218. package/dist/cli/commands/app/generate/extension.js +1 -1
  219. package/dist/cli/commands/app/graphiql.js +1 -1
  220. package/dist/cli/commands/app/import/channel-config.js +1 -1
  221. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  222. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  223. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  224. package/dist/cli/commands/app/import-extensions.js +1 -1
  225. package/dist/cli/commands/app/info.js +1 -1
  226. package/dist/cli/commands/app/init.js +1 -1
  227. package/dist/cli/commands/app/logs.js +1 -1
  228. package/dist/cli/commands/app/release.js +1 -1
  229. package/dist/cli/commands/app/security/check.js +1 -1
  230. package/dist/cli/commands/app/security/clean.js +1 -1
  231. package/dist/cli/commands/app/security/instructions.js +1 -1
  232. package/dist/cli/commands/app/security/record.js +1 -1
  233. package/dist/cli/commands/app/security/review.js +1 -1
  234. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  235. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  236. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  237. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  238. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  239. package/dist/cli/commands/app/versions/list.js +1 -1
  240. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  241. package/dist/cli/commands/auth/login.js +1 -1
  242. package/dist/cli/commands/auth/logout.js +1 -1
  243. package/dist/cli/commands/cache/clear.js +1 -1
  244. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  245. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  246. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  247. package/dist/cli/commands/debug/command-flags.js +1 -1
  248. package/dist/cli/commands/doc/fetch.js +1 -1
  249. package/dist/cli/commands/doc/search.js +1 -1
  250. package/dist/cli/commands/docs/generate.js +1 -1
  251. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  252. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  253. package/dist/cli/commands/help.js +1 -1
  254. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  255. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  256. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  257. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  258. package/dist/cli/commands/notifications/generate.js +1 -1
  259. package/dist/cli/commands/notifications/list.js +1 -1
  260. package/dist/cli/commands/organization/list.js +1 -1
  261. package/dist/cli/commands/search.js +1 -1
  262. package/dist/cli/commands/send-analytics.js +1 -1
  263. package/dist/cli/commands/theme/check.js +1 -1
  264. package/dist/cli/commands/theme/console.js +1 -1
  265. package/dist/cli/commands/theme/delete.js +1 -1
  266. package/dist/cli/commands/theme/dev.js +1 -1
  267. package/dist/cli/commands/theme/duplicate.js +1 -1
  268. package/dist/cli/commands/theme/info.js +1 -1
  269. package/dist/cli/commands/theme/init.js +1 -1
  270. package/dist/cli/commands/theme/language-server.js +1 -1
  271. package/dist/cli/commands/theme/list.js +1 -1
  272. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  273. package/dist/cli/commands/theme/open.js +1 -1
  274. package/dist/cli/commands/theme/package.js +1 -1
  275. package/dist/cli/commands/theme/preview.js +1 -1
  276. package/dist/cli/commands/theme/profile.js +1 -1
  277. package/dist/cli/commands/theme/publish.js +1 -1
  278. package/dist/cli/commands/theme/pull.js +1 -1
  279. package/dist/cli/commands/theme/push.js +1 -1
  280. package/dist/cli/commands/theme/rename.js +1 -1
  281. package/dist/cli/commands/theme/share.js +1 -1
  282. package/dist/cli/commands/upgrade.js +1 -1
  283. package/dist/cli/commands/version.js +1 -1
  284. package/dist/cli/help.js +1 -1
  285. package/dist/{cli-version-check-V25AVSZ6.js → cli-version-check-BW2CUMX4.js} +1 -1
  286. package/dist/{command-json-schema-C5UZXP2W.js → command-json-schema-LGR44Q2G.js} +1 -1
  287. package/dist/command-registry.js +1 -1
  288. package/dist/{conf-store-OCGEEV4U.js → conf-store-TODPQ2LC.js} +1 -1
  289. package/dist/configs/all.yml +9 -0
  290. package/dist/configs/recommended.yml +9 -0
  291. package/dist/{custom-oclif-loader-ZVUKMRGH.js → custom-oclif-loader-BPE2TH4B.js} +1 -1
  292. package/dist/data/objects.json +204 -11
  293. package/dist/data/section.json +14 -0
  294. package/dist/data/setting.json +9 -5
  295. package/dist/data/shopify_system_translations.json +84 -21
  296. package/dist/{deprecations-A5AXXKIK.js → deprecations-5CSI24TV.js} +1 -1
  297. package/dist/dist-LPKYTX3M.js +1 -0
  298. package/dist/dist-WT6MPTKJ.js +1 -0
  299. package/dist/{environments-Y5JEI3U3.js → environments-3HTT5CVC.js} +1 -1
  300. package/dist/error-PFOKPWFX.js +1 -0
  301. package/dist/error-handler-23FASAEU.js +1 -0
  302. package/dist/{fs-UOOLPOHJ.js → fs-RA25PWSJ.js} +1 -1
  303. package/dist/hooks/did-you-mean.js +1 -1
  304. package/dist/hooks/hydrogen-init.js +1 -1
  305. package/dist/hooks/plugin-plugins.js +1 -1
  306. package/dist/hooks/postrun.js +1 -1
  307. package/dist/hooks/prerun.js +1 -1
  308. package/dist/hooks/public-metadata.js +1 -1
  309. package/dist/hooks/sensitive-metadata.js +1 -1
  310. package/dist/hooks/tunnel-provider.js +1 -1
  311. package/dist/hooks/tunnel-start.js +1 -1
  312. package/dist/http-EVDTYINS.js +1 -0
  313. package/dist/index.js +12 -12
  314. package/dist/{is-global-CI77T7NE.js → is-global-3DNAMKUU.js} +1 -1
  315. package/dist/{json-error-6PBUR4LQ.js → json-error-HGCRNJRF.js} +1 -1
  316. package/dist/{lib-4JVADMNT.js → lib-4ZA53LTZ.js} +1 -1
  317. package/dist/{lib-L4STV5B2.js → lib-F3MES3XF.js} +1 -1
  318. package/dist/{lib-LEEN55OD.js → lib-XPJABU24.js} +1 -1
  319. package/dist/{local-5NIWPWDS.js → local-LNGPIGLG.js} +1 -1
  320. package/dist/{metadata-IXPNNPNJ.js → metadata-VHLSUKCW.js} +1 -1
  321. package/dist/{node-package-manager-ALFEGGD6.js → node-package-manager-SSFNUVWB.js} +1 -1
  322. package/dist/notifications-system-3NQRYYKW.js +1 -0
  323. package/dist/{os-6TNQTEUN.js → os-KIKVJONE.js} +1 -1
  324. package/dist/{output-LEOB5LAM.js → output-DUJTSURG.js} +1 -1
  325. package/dist/{prettier-VLTY4MIE.js → prettier-NOE3TJJ5.js} +1 -1
  326. package/dist/{system-J4CTESP5.js → system-CGOZSROX.js} +1 -1
  327. package/dist/tsconfig.tsbuildinfo +1 -1
  328. package/dist/{ui-YDUI56E3.js → ui-YMBFS3NG.js} +1 -1
  329. package/dist/upgrade-73RRPDSC.js +1 -0
  330. package/dist/version-AMUEEBIG.js +1 -0
  331. package/dist/{version-2YL4YEQ2.js → version-S4MGCKDO.js} +1 -1
  332. package/dist/{workerd-5UPTEWNI.js → workerd-DRWNY3S4.js} +1 -1
  333. package/oclif.manifest.json +23 -62
  334. package/package.json +7 -7
  335. package/dist/analytics-QFDTQYPM.js +0 -1
  336. package/dist/analytics-XADBBHOH.js +0 -1
  337. package/dist/chunk-2BYW3BYX.js +0 -1
  338. package/dist/chunk-2PD7TNFS.js +0 -275
  339. package/dist/chunk-3Z75BVGJ.js +0 -1
  340. package/dist/chunk-4WBWZIN5.js +0 -6
  341. package/dist/chunk-62NW4EPI.js +0 -17
  342. package/dist/chunk-ALINJ6J2.js +0 -1
  343. package/dist/chunk-BFAOTQGH.js +0 -1
  344. package/dist/chunk-CIGWIKOW.js +0 -1
  345. package/dist/chunk-DXEMSLI6.js +0 -1
  346. package/dist/chunk-H4K3F7PP.js +0 -5
  347. package/dist/chunk-JGLLABZR.js +0 -8
  348. package/dist/chunk-JIY6XWSC.js +0 -1
  349. package/dist/chunk-LXIWMYM4.js +0 -1
  350. package/dist/chunk-MGX7UG44.js +0 -1
  351. package/dist/chunk-QGQWVA7N.js +0 -1
  352. package/dist/chunk-RSZAAN37.js +0 -1
  353. package/dist/chunk-SN3PMWUF.js +0 -6
  354. package/dist/chunk-TD6JBHUS.js +0 -1
  355. package/dist/chunk-TIM4CIXZ.js +0 -22
  356. package/dist/chunk-WNVOEE6T.js +0 -7
  357. package/dist/chunk-YOYPYB4H.js +0 -1
  358. package/dist/cli/commands/app/logs-next.js +0 -1
  359. package/dist/dist-NORLLIHQ.js +0 -1
  360. package/dist/dist-XBM4XZS4.js +0 -1
  361. package/dist/error-GI4DXVDU.js +0 -1
  362. package/dist/error-handler-BS2ZENQV.js +0 -1
  363. package/dist/http-2OXOS2AW.js +0 -1
  364. package/dist/notifications-system-FQW3GKH2.js +0 -1
  365. package/dist/upgrade-LBCZORG2.js +0 -1
  366. package/dist/version-X2CPQVWQ.js +0 -1
  367. /package/dist/{chunk-2S3FHQFS.js → chunk-HVECVOIO.js} +0 -0
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import{a as gt}from"./chunk-L2PUDV7Y.js";import{a as St,b as qr}from"./chunk-MU7IVBGI.js";import"./chunk-LQ7ENG4V.js";import"./chunk-IRLYC626.js";import{a as Mr}from"./chunk-A54TADAZ.js";import{a as Cn}from"./chunk-3Z75BVGJ.js";import{a as Kr}from"./chunk-TSVEV2UD.js";import{a as yn}from"./chunk-SODCXZ5U.js";import{a as wn}from"./chunk-UC4TOM36.js";import{a as kn}from"./chunk-TSPJAMYB.js";import{a as bn}from"./chunk-AMVWKHNY.js";import{a as vn}from"./chunk-QKPAB245.js";import"./chunk-5HOZDOJ7.js";import"./chunk-AVJJGQOP.js";import"./chunk-FU7PYW7H.js";import"./chunk-5534MHZW.js";import{a as An}from"./chunk-MGWCXTGD.js";import{a as xn}from"./chunk-TTAT62N3.js";import{a as hn}from"./chunk-VA2S7W7H.js";import{a as Xr}from"./chunk-CIGWIKOW.js";import{a as Zr}from"./chunk-62NW4EPI.js";import{a as gn}from"./chunk-7KID5BIR.js";import{a as Vr}from"./chunk-MZDBH4XV.js";import"./chunk-FKKJQGYX.js";import{a as Wr}from"./chunk-SPJM7RTD.js";import{a as Qr}from"./chunk-MTT6EAQO.js";import"./chunk-FQLXQ7WN.js";import{a as Yr}from"./chunk-7ART2IKU.js";import"./chunk-4FWPOGPQ.js";import"./chunk-ZMU4EYXT.js";import"./chunk-G3RNO2TC.js";import"./chunk-A2NSORBM.js";import{a as dn}from"./chunk-KM4LE7K4.js";import{a as Dr,b as Lr,c as Rr,d as nn}from"./chunk-JQU2BJDH.js";import{a as Fn}from"./chunk-C2HJEGTS.js";import{a as ln}from"./chunk-D7IMC2G4.js";import"./chunk-WLYXBQ2M.js";import{a as _n}from"./chunk-ZXZWMXXK.js";import{a as Nn}from"./chunk-AGTUAQHX.js";import{a as mn}from"./chunk-LFBFPK22.js";import{a as fn}from"./chunk-AHYI27QL.js";import{a as tn}from"./chunk-SCDGLREP.js";import"./chunk-XWLNCBAG.js";import{a as rn}from"./chunk-HP4QYSBQ.js";import{a as an}from"./chunk-V4FC72R6.js";import{a as En}from"./chunk-Q2LQJYRK.js";import{a as sn}from"./chunk-KFR7HWCG.js";import{a as cn}from"./chunk-ORMXPSJM.js";import"./chunk-G3EWGBXR.js";import{a as un}from"./chunk-QUPZOBTB.js";import{a as pn}from"./chunk-65NCQJYR.js";import"./chunk-5T3ZT6CC.js";import{a as Br}from"./chunk-VQSRU5XL.js";import{a as Hr}from"./chunk-CRQQCT7F.js";import{a as jr}from"./chunk-4TCXPHKN.js";import{a as Sn}from"./chunk-WWVDZ3GC.js";import{a as Gr}from"./chunk-DDZYIC76.js";import"./chunk-JG4FAT2T.js";import{a as ht,b as Jr}from"./chunk-TIM4CIXZ.js";import"./chunk-UOHNRH6E.js";import"./chunk-SURFUFAZ.js";import{a as Ca}from"./chunk-3PS52ZT4.js";import"./chunk-WBPP6PO7.js";import"./chunk-QCLE5REL.js";import"./chunk-OXPEBT4I.js";import{h as Pa}from"./chunk-MKFRKNHF.js";import"./chunk-DTKGI43P.js";import"./chunk-ONZULPQH.js";import"./chunk-OWQEFORZ.js";import"./chunk-6I7DT7QR.js";import"./chunk-3MZ7ELHS.js";import"./chunk-JC37YZ4I.js";import"./chunk-VE3IIC7H.js";import"./chunk-HSTZV6H7.js";import"./chunk-OVJVFB5E.js";import"./chunk-KCAWHJGF.js";import"./chunk-HGZ2HRPO.js";import"./chunk-DVD7I2TX.js";import"./chunk-YR4J46US.js";import"./chunk-JMSAHCBU.js";import"./chunk-YF4AXKM4.js";import"./chunk-KHZF73BL.js";import"./chunk-WBJFTCEJ.js";import"./chunk-YTL45RXR.js";import"./chunk-JLGA3B7P.js";import"./chunk-YNZLLZU2.js";import"./chunk-WPDJVUTY.js";import"./chunk-JVY6CCLE.js";import"./chunk-FRWQJAW2.js";import"./chunk-Z6ZRS256.js";import"./chunk-XLMKHTJ5.js";import"./chunk-PJZZZNWR.js";import"./chunk-R6US7F33.js";import"./chunk-6BYHL3DS.js";import"./chunk-YY6TFARF.js";import"./chunk-7N7KRZOM.js";import{b as Fa}from"./chunk-O7HZ3EIP.js";import"./chunk-DVFVO6ZE.js";import"./chunk-7HECBXSP.js";import{a as H,b as lr,c as Y,d as Se,e as ge}from"./chunk-CZNUBAAG.js";import"./chunk-7CT3NIXI.js";import"./chunk-JNSVKDBY.js";import"./chunk-FAVPTYIR.js";import"./chunk-VJG7VXFU.js";import"./chunk-7NRHZG5Y.js";import"./chunk-BPKQA2EO.js";import"./chunk-FDSNRKGQ.js";import"./chunk-EDWIWZWM.js";import"./chunk-JALDNBTU.js";import"./chunk-TXP6KFWO.js";import"./chunk-Z5WFRYVQ.js";import"./chunk-4IP37MBX.js";import"./chunk-MGX7UG44.js";import"./chunk-VRIFLMA3.js";import"./chunk-UWHAOGO4.js";import"./chunk-ZI7LK3LW.js";import"./chunk-ZNEPRGFY.js";import"./chunk-SBN3ILXO.js";import{a as Tn}from"./chunk-ORYEDUKM.js";import{a as en}from"./chunk-7A77JCED.js";import"./chunk-FKIVKNOV.js";import"./chunk-7PHDEILV.js";import"./chunk-DDRP6QTC.js";import{a as pr}from"./chunk-OXZR2MB4.js";import{a as dr}from"./chunk-YVPB7OT6.js";import{a as mr}from"./chunk-OY5M52EF.js";import"./chunk-HYCNYUHW.js";import{a as tr}from"./chunk-GGCP2TIK.js";import{a as $r}from"./chunk-DGIIUQH3.js";import"./chunk-ALINJ6J2.js";import"./chunk-RLOEI6VE.js";import{a as Ur}from"./chunk-T6C4WC3Z.js";import{a as on}from"./chunk-WZBZ7FWP.js";import{a as zr}from"./chunk-RKNVTEO3.js";import"./chunk-6IMTMS2S.js";import"./chunk-4NFX7YCT.js";import{a as se,b as hr,c as ye,e as we,f as Pe,g as Sr,h as gr,i as yr,j as wr,k as kr,l as br,m as mt,n as vr,o as Ar,p as xr,q as Or,r as Ir,s as no}from"./chunk-Z5QEXS6F.js";import"./chunk-LXIWMYM4.js";import"./chunk-RSZAAN37.js";import"./chunk-3GD5ESWN.js";import"./chunk-ASKBYEO7.js";import{a as nr}from"./chunk-TP7CTMMT.js";import{a as er}from"./chunk-MYMBHVC4.js";import{a as Yo}from"./chunk-5C6CXU74.js";import{a as Zo}from"./chunk-NY5N4ANL.js";import"./chunk-3C72S6LO.js";import{a as Ko}from"./chunk-5PSQFQL6.js";import"./chunk-GSFWBFFH.js";import"./chunk-VUMUCNI7.js";import{a as Xo}from"./chunk-SVQDMZJO.js";import"./chunk-WNVOEE6T.js";import{a as cr}from"./chunk-NYMKGE3J.js";import{a as sr}from"./chunk-TUSS6PXB.js";import"./chunk-SHOMIS6Q.js";import{a as Go}from"./chunk-LPPEAMI6.js";import"./chunk-SQL67BKI.js";import"./chunk-LGDWE3H3.js";import"./chunk-WE5KY6T6.js";import{a as Ho}from"./chunk-XRNBCV2B.js";import{a as Wo}from"./chunk-DXEMSLI6.js";import{a as Vo}from"./chunk-CEQGOCKX.js";import{a as ur}from"./chunk-FHKK3QU7.js";import{a as Qo}from"./chunk-UFY4L5KQ.js";import{a as or}from"./chunk-H2KGP2FM.js";import{a as rr}from"./chunk-SN3PMWUF.js";import"./chunk-K4QJEQI4.js";import{a as On}from"./chunk-WWCYEZUU.js";import"./chunk-HMPRWNGG.js";import"./chunk-2S3FHQFS.js";import"./chunk-JGLLABZR.js";import{d as fr,f as ae}from"./chunk-2BYW3BYX.js";import"./chunk-YYWSHRO2.js";import"./chunk-DC7ITY6T.js";import"./chunk-VJEKDBGZ.js";import{a as V,b as K,d as Tr,f as Er,g as lt,h as _r,i as Nr,j as ft,l as io,m as A,n as ce,o as ao,p as so,q as Fr,r as Cr,s as Pr}from"./chunk-OJOF6IYG.js";import"./chunk-7DBKSSDK.js";import"./chunk-KFO2JNF5.js";import"./chunk-2PD7TNFS.js";import"./chunk-IWOTLFOY.js";import"./chunk-27JT4NA4.js";import"./chunk-F5QKMDP3.js";import"./chunk-OTMYJWIP.js";import{a as In}from"./chunk-JIYCZXK5.js";import"./chunk-HVUMVDUG.js";import{a as qa}from"./chunk-YNFQBYSL.js";import{d as Ra}from"./chunk-F6IQWX2F.js";import{a as ir}from"./chunk-24Q6X53V.js";import{a as Mo}from"./chunk-ELR6AZT4.js";import{a as Jo}from"./chunk-YOYPYB4H.js";import{a as ar,b as Na}from"./chunk-7BPT5V24.js";import"./chunk-NUBJ2HK7.js";import{c as yt,d as La}from"./chunk-CDSDQTNB.js";import{b as Q}from"./chunk-XEZPN5TR.js";import"./chunk-LFOBYEWG.js";import{B as _,J as z,K as re,L as q,V as B,W as at,X as le,b as _a,ma as fe,p as Xt,q as Zt,qa as ne,va as to,x as eo}from"./chunk-YKDRUAY3.js";import"./chunk-ZDF5N422.js";import"./chunk-4WBWZIN5.js";import"./chunk-T4ZOTYOY.js";import{e as Co}from"./chunk-3FZ4LE6A.js";import"./chunk-MPW2YJWU.js";import{a as Vt}from"./chunk-JIY6XWSC.js";import"./chunk-BFAOTQGH.js";import{a as Bo,b as y,c as w,e as jo,f as dt}from"./chunk-DMOLPSXF.js";import"./chunk-T7KHS6RF.js";import{A as W,E as Lo,F as he,H as j,J as Ro,L as ct,M as ut,S as $o,U as pt,Y as Uo,a as Fo,x as I,y as T,z as ie}from"./chunk-2KUM2RU4.js";import"./chunk-7Y7AZRL3.js";import"./chunk-25MYHE4W.js";import"./chunk-H4K3F7PP.js";import"./chunk-5HBIIYSK.js";import"./chunk-RJ5VF3QY.js";import"./chunk-7UNQOKZW.js";import"./chunk-GB3YC4TI.js";import"./chunk-2KFYIYLI.js";import{b as No,d as it}from"./chunk-QBRRFFMZ.js";import"./chunk-Z2AV4BWZ.js";import{a as x}from"./chunk-LG3KEHGD.js";import{d as Po,e as Do}from"./chunk-I3WRA2LH.js";import{i as c,k as qo,l as J}from"./chunk-TD6JBHUS.js";import{a as ke,b as Da}from"./chunk-S3RROJGG.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-EVQPYZ7F.js";import"./chunk-636CTEW7.js";import"./chunk-WFPVT2IY.js";import"./chunk-AY3AAV77.js";import{Bb as P,Db as zo,Eb as f,Fb as oo,Gb as ro,N as Eo,Sa as Ce,V as _o,Z as oe,ba as Yt,ga as Kt,la as Ne,ta as Fe,tb as u,vb as d,zb as g}from"./chunk-ZMOW2YZ4.js";import{i as st}from"./chunk-B4OMIONW.js";import"./chunk-UU6UQ2QY.js";import"./chunk-5B76DT7X.js";import"./chunk-JJZNUFPD.js";import{b as s,c as nt,d as Wt,e as Qt}from"./chunk-3PYDIBTX.js";import"./chunk-DOLVBTCB.js";import{b as To}from"./chunk-QGQWVA7N.js";import{b as M}from"./chunk-AE3IQG7S.js";import"./chunk-R4E2E4NN.js";import"./chunk-JD5P5RAJ.js";import{e as G}from"./chunk-IWTNUJGY.js";import"./chunk-3KGN6N7E.js";import"./chunk-S4KNPCW3.js";import"./chunk-CQAD5WML.js";import"./chunk-I5A6BPCP.js";import"./chunk-O472FAYX.js";import"./chunk-IGE4Y5SE.js";import"./chunk-JFBCE4HN.js";import{e as R,g as n}from"./chunk-VKWPEFWQ.js";n();var Ea=R(Na(),1);n();n();n();n();function co(e){return lr(e).map(t=>({store:t.store,userId:t.userId,scopes:t.scopes,acquiredAt:t.acquiredAt,...t.expiresAt?{expiresAt:t.expiresAt}:{},...t.refreshTokenExpiresAt?{refreshTokenExpiresAt:t.refreshTokenExpiresAt}:{},...t.associatedUser?{associatedUser:t.associatedUser}:{}})).sort((t,o)=>o.acquiredAt.localeCompare(t.acquiredAt)||t.store.localeCompare(o.store))}n();var $a=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"2-digit",year:"numeric"});function wt(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":$a.format(t)}function kt(e){let t=z(e);if(t)return t.split(".")[0]}function Pn(){let e=co().map(t=>({subdomain:kt(t.store)??t.store,connected:wt(t.acquiredAt),store:t.store,userId:t.userId,scopes:t.scopes,acquiredAt:t.acquiredAt,...t.expiresAt?{expiresAt:t.expiresAt}:{},...t.refreshTokenExpiresAt?{refreshTokenExpiresAt:t.refreshTokenExpiresAt}:{},...t.associatedUser?{associatedUser:t.associatedUser}:{}}));return{sessions:e,...e.length===0?{message:Ua()}:{}}}function Ua(){return["No stores are authenticated directly with `shopify store auth`.","","Run `shopify store auth --store <domain> --scopes <scopes>` to authenticate a store.","Run `shopify store list` to list stores in a Shopify organization."].join(`
2
- `)}n();n();n();var bt=s.object({id:s.number(),email:s.string().optional(),firstName:s.string().optional(),lastName:s.string().optional(),accountOwner:s.boolean().optional()}),ue=s.object({store:s.string(),userId:s.string(),scopes:s.array(s.string()),acquiredAt:s.string(),expiresAt:s.string().optional(),refreshTokenExpiresAt:s.string().optional(),associatedUser:bt.optional()}),be=x({name:"StoreAuthResult",schema:ue.omit({associatedUser:!0}).extend({hasRefreshToken:s.boolean(),associatedUser:ue.shape.associatedUser}),definitions:{StoreAuthAssociatedUser:bt}});var Dn=s.object({subdomain:s.string(),connected:s.string(),...ue.partial().shape,acquiredAt:ue.shape.acquiredAt.optional().describe("When the stored token was acquired, in ISO 8601 format."),expiresAt:ue.shape.expiresAt.describe("When the stored access token expires, in ISO 8601 format."),refreshTokenExpiresAt:ue.shape.refreshTokenExpiresAt.describe("When the stored refresh token expires, in ISO 8601 format.")}),vt=x({name:"StoreAuthListResult",schema:s.object({sessions:s.array(Dn),message:s.string().optional()}),definitions:{StoreAuthListSession:Dn,StoreAuthAssociatedUser:bt}});function Ln(e,t){if(t==="json"){g(vt.encode(e));return}za(e)}function za(e){if(e.sessions.length===0){P(e.message??"");return}he({rows:e.sessions.map(({subdomain:t,connected:o})=>({subdomain:t,connected:o})),columns:{subdomain:{header:"Subdomain"},connected:{header:"Connected"}}})}var De=class e extends Q{static summary="List stores authenticated directly with store auth.";static descriptionWithMarkdown="Lists stores authenticated directly on this machine with `shopify store auth`.\n\nUse this command to find stores that can be used with store-authenticated commands such as `shopify store execute`.\nTo list stores in a Shopify organization, run `shopify store list`.";static jsonOutputSchema=vt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --json"];static flags={...y,...w};async run(){let{flags:t}=await this.parse(e),o=Pn();Ln(o,t.json?"json":"text")}};n();n();n();var Rn=13387,At="/auth/callback",uo="/auth/handoff";function qn(e){return`http://127.0.0.1:${e}${At}`}function $n(e,t){return`http://127.0.0.1:${e}${uo}?nonce=${encodeURIComponent(t)}`}function D(e){return e.length<=10?"***":`${e.slice(0,10)}***`}n();function Un(e,t=300){return e.slice(0,t)}async function zn(e){let t=`https://${e.store}/admin/oauth/access_token`;f(d`Exchanging authorization code for token at ${u.raw(t)}`);let o=await Xt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:H,code:e.code,code_verifier:e.codeVerifier,redirect_uri:e.redirectUri})}),r=await o.text();if(!o.ok)throw f(d`Token exchange failed with HTTP ${u.raw(String(o.status))}: ${u.raw(Un(r||o.statusText))}`),new c(`Failed to exchange OAuth code for an access token (HTTP ${o.status}).`,r||o.statusText);let i;try{i=JSON.parse(r)}catch{throw new c("Received an invalid token response from Shopify.")}return f(d`Token exchange succeeded: access_token=${u.raw(D(i.access_token))}, refresh_token=${u.raw(i.refresh_token?D(i.refresh_token):"none")}, expires_in=${u.raw(String(i.expires_in??"unknown"))}s, user=${u.raw(String(i.associated_user?.id??"unknown"))} (${u.raw(i.associated_user?.email??"no email")})`),i}async function Bn(e){let t=`https://${e.store}/admin/oauth/access_token`;f(d`Refreshing access token for ${u.raw(e.store)} using refresh_token=${u.raw(D(e.refreshToken))}`);let o=await Xt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:H,grant_type:"refresh_token",refresh_token:e.refreshToken}),signal:e.signal}),r=await o.text();if(!o.ok)throw f(d`Token refresh failed with HTTP ${u.raw(String(o.status))}: ${u.raw(Un(r||o.statusText))}`),new c(`Token refresh failed for ${e.store} (HTTP ${o.status}).`);let i;try{i=JSON.parse(r)}catch{throw new c("Received an invalid refresh response from Shopify.")}if(!i.access_token)throw new c(`Token refresh returned an invalid response for ${e.store}.`);return{accessToken:i.access_token,refreshToken:i.refresh_token,expiresIn:i.expires_in,refreshTokenExpiresIn:i.refresh_token_expires_in}}var Ba=`#graphql
1
+ import{a as gt}from"./chunk-CKJXJ6HD.js";import{a as St,b as qr}from"./chunk-WDXDT7XY.js";import"./chunk-LQ7ENG4V.js";import"./chunk-MGZK5EQW.js";import{a as Fn}from"./chunk-AXFEIJC7.js";import{a as gn}from"./chunk-NOWM3CCG.js";import{a as yn}from"./chunk-YTC367JI.js";import{a as wn}from"./chunk-FI5TQHUA.js";import{a as kn}from"./chunk-GFVUWVEM.js";import{a as bn}from"./chunk-FIKZQ4RA.js";import"./chunk-HT5JQJMB.js";import"./chunk-CZYQIWNL.js";import"./chunk-5S2P4MHJ.js";import"./chunk-6B5KM3A4.js";import{a as vn}from"./chunk-KRQCQ57O.js";import{a as An}from"./chunk-Z2FGYMJ6.js";import{a as Mr}from"./chunk-QU3USVKT.js";import{a as fn}from"./chunk-DA5RQFXA.js";import{a as Xr}from"./chunk-E6JEBSHZ.js";import{a as Sn}from"./chunk-XVJRGOJA.js";import{a as Vr}from"./chunk-ZRM7ESSS.js";import{a as Wr}from"./chunk-5PVXLQNX.js";import{a as Qr}from"./chunk-E7XCCLQH.js";import"./chunk-3GL3IT4K.js";import{a as Yr}from"./chunk-C2AOCLEZ.js";import{a as Kr}from"./chunk-ZC3EDADH.js";import"./chunk-SUTSCIXU.js";import"./chunk-4M5WHOZW.js";import"./chunk-43C32FUQ.js";import"./chunk-SBX7CMHM.js";import"./chunk-NAQJMRPT.js";import{a as pn}from"./chunk-DNNTAMC5.js";import{a as Dr,b as Lr,c as Rr,d as rn}from"./chunk-ONNUEQGR.js";import{a as Nn}from"./chunk-GABIWYY3.js";import{a as mn}from"./chunk-GHNSXX7R.js";import"./chunk-DKR7562G.js";import{a as En}from"./chunk-55AWBPKU.js";import{a as _n}from"./chunk-EEYXBKR7.js";import{a as dn}from"./chunk-HQFXVVTB.js";import{a as ln}from"./chunk-5EDA7PVE.js";import{a as en}from"./chunk-ADGE7MKB.js";import"./chunk-OGBMFGYC.js";import{a as on}from"./chunk-IVQN2RUP.js";import{a as nn}from"./chunk-DUPQUQ2Z.js";import{a as Tn}from"./chunk-YGN65N6W.js";import{a as an}from"./chunk-CCLU5ZRK.js";import{a as sn}from"./chunk-422BGHXN.js";import"./chunk-QDMTJKQ3.js";import{a as cn}from"./chunk-SNRGS3YU.js";import{a as un}from"./chunk-AEWRZ7AE.js";import"./chunk-PIU3GVJ4.js";import{a as Br}from"./chunk-E6KNAPIY.js";import{a as Hr}from"./chunk-6LCESSY3.js";import{a as jr}from"./chunk-XKNDU62O.js";import{a as hn}from"./chunk-ZNEQZV5K.js";import{a as Gr}from"./chunk-62F4ZMSC.js";import"./chunk-V3H6SYK3.js";import{a as ht,b as Jr}from"./chunk-R2E6TMBE.js";import"./chunk-UOHNRH6E.js";import{a as Fa}from"./chunk-SAK42CAY.js";import"./chunk-XB7H2RYV.js";import"./chunk-2PILNMHJ.js";import"./chunk-L3DTONOI.js";import{h as Ca}from"./chunk-OWPAHXDF.js";import"./chunk-HUB4HDWN.js";import"./chunk-4RO35FFQ.js";import"./chunk-4ZS5354G.js";import"./chunk-JJQ3DJG5.js";import"./chunk-K5UVCBIP.js";import"./chunk-5TOK5OJS.js";import"./chunk-2EQRXSF6.js";import"./chunk-Q2CKRCPM.js";import"./chunk-ZOU6SOXW.js";import"./chunk-LZ2TN7EZ.js";import"./chunk-IATNIWOC.js";import"./chunk-PSNCWS3Q.js";import"./chunk-YR4J46US.js";import"./chunk-FDFE3SSG.js";import"./chunk-YF4AXKM4.js";import"./chunk-COGKVNQB.js";import"./chunk-KORVOCNN.js";import"./chunk-OKRKVVTK.js";import"./chunk-JLGA3B7P.js";import"./chunk-3DB4EC62.js";import"./chunk-36S6MFJQ.js";import"./chunk-HRHJA5ZP.js";import"./chunk-FRWQJAW2.js";import"./chunk-UY44O4IZ.js";import"./chunk-TXMZPF2U.js";import"./chunk-H45S4MGC.js";import"./chunk-7AQZKPJU.js";import"./chunk-TZOB52QK.js";import"./chunk-YY6TFARF.js";import"./chunk-GQ3LY7BY.js";import{b as Na}from"./chunk-ZLITAXPT.js";import"./chunk-RSNFNZ6F.js";import"./chunk-7HECBXSP.js";import"./chunk-TDHIOONG.js";import{a as H,b as lr,c as Y,d as Se,e as ge}from"./chunk-VVHJ2AUF.js";import"./chunk-WL3M63DG.js";import"./chunk-AYGL6F3P.js";import"./chunk-WHOD5I7N.js";import"./chunk-WZ3QWPK5.js";import"./chunk-TLN4BKXJ.js";import"./chunk-X5V7AGVU.js";import"./chunk-FDSNRKGQ.js";import"./chunk-MBAPM5HA.js";import"./chunk-3JRB7Q3T.js";import"./chunk-NVDFXEQ5.js";import"./chunk-BQKF4SRH.js";import"./chunk-4IP37MBX.js";import"./chunk-G3DXNSA2.js";import"./chunk-L23Q53FM.js";import"./chunk-UWHAOGO4.js";import"./chunk-ZI7LK3LW.js";import"./chunk-ZNEPRGFY.js";import"./chunk-5TJJVSCI.js";import{a as In}from"./chunk-ZX33FUW3.js";import{a as Zr}from"./chunk-3OYMK5X6.js";import"./chunk-FKIVKNOV.js";import"./chunk-5BUYR23E.js";import"./chunk-DDRP6QTC.js";import{a as pr}from"./chunk-GFSEU7PF.js";import{a as dr}from"./chunk-P7HZGJRU.js";import{a as mr}from"./chunk-CQPZOXWO.js";import"./chunk-G7JO3W2R.js";import{a as tr}from"./chunk-S23ZG2RG.js";import{a as $r}from"./chunk-7UK565VJ.js";import"./chunk-HT7273V7.js";import"./chunk-JLAN6JXJ.js";import{a as Ur}from"./chunk-IHVWDKDV.js";import{a as tn}from"./chunk-SZ64GAVG.js";import{a as zr}from"./chunk-CEJ5WS4I.js";import"./chunk-OTMTS5L4.js";import"./chunk-652NT7OW.js";import{a as se,b as hr,c as ye,e as we,f as Pe,g as Sr,h as gr,i as yr,j as wr,k as kr,l as br,m as mt,n as vr,o as Ar,p as xr,q as Or,r as Ir,s as no}from"./chunk-NMXRDF4T.js";import"./chunk-Z3QZNLT5.js";import"./chunk-R5COVIJM.js";import"./chunk-KT2AMFVW.js";import"./chunk-K4KKSBUW.js";import{a as nr}from"./chunk-OCILF2DD.js";import{a as er}from"./chunk-VHRUPKWH.js";import{a as Yo}from"./chunk-5P6OELKZ.js";import{a as Zo}from"./chunk-QIJ7D2JS.js";import"./chunk-KN2JIDNO.js";import{a as Ko}from"./chunk-FLARCZ5F.js";import"./chunk-MKUXSM33.js";import"./chunk-VUMUCNI7.js";import{a as Xo}from"./chunk-VGBCG3I5.js";import"./chunk-UK3BDOHR.js";import{a as cr}from"./chunk-C2SGJ5IG.js";import{a as sr}from"./chunk-SGQTRKYZ.js";import"./chunk-SWFCT5B7.js";import{a as Go}from"./chunk-C3S3UMV3.js";import"./chunk-SNPJVVVE.js";import"./chunk-5ZG2SWU2.js";import"./chunk-FOMMPAWZ.js";import{a as Ho}from"./chunk-K2GCCCCV.js";import{a as Wo}from"./chunk-ALDJTWCO.js";import{a as Vo}from"./chunk-LRETOC6P.js";import{a as ur}from"./chunk-DUTIWCJ2.js";import{a as Qo}from"./chunk-X76AYO36.js";import{a as or}from"./chunk-EGLA3WLZ.js";import{a as rr}from"./chunk-CIBBQO2L.js";import"./chunk-K4QJEQI4.js";import{a as xn}from"./chunk-QA2D7DT2.js";import"./chunk-7FBOMPO5.js";import"./chunk-HVECVOIO.js";import"./chunk-4KBOLN7Q.js";import{d as fr,f as ae}from"./chunk-XHHAVKKV.js";import"./chunk-4LJERO23.js";import"./chunk-CA3GVT4D.js";import{a as V,b as K,d as Tr,f as Er,g as lt,h as _r,i as Nr,j as ft,l as io,m as A,n as ce,o as ao,p as so,q as Fr,r as Cr,s as Pr}from"./chunk-HEB4YYM6.js";import"./chunk-QLN6IOOY.js";import"./chunk-ZQNGYJKJ.js";import"./chunk-MQ55QUOJ.js";import"./chunk-IWOTLFOY.js";import"./chunk-VJEKDBGZ.js";import"./chunk-HR6R7JXN.js";import"./chunk-LXFWK3O2.js";import"./chunk-2KACAQJS.js";import{a as On}from"./chunk-BDIZUTKC.js";import"./chunk-U5BKU3OL.js";import{a as Ra}from"./chunk-WBKQSSWW.js";import{d as La}from"./chunk-AYTTE7X5.js";import{a as ir}from"./chunk-2OCSYLKZ.js";import{a as Mo}from"./chunk-4AN7ECPE.js";import{a as Jo}from"./chunk-6QHDMCAA.js";import{a as ar,b as _a}from"./chunk-RZ3UGOV4.js";import"./chunk-DESZFFOK.js";import{c as yt,d as Da}from"./chunk-Y3ZAQZPH.js";import{b as Q}from"./chunk-PSREELSQ.js";import"./chunk-LFOBYEWG.js";import{B as _,J as z,K as re,L as q,V as B,W as at,X as le,b as Ea,ma as fe,p as Xt,q as Zt,ra as ne,wa as to,x as eo}from"./chunk-UORSJB4A.js";import"./chunk-ZDF5N422.js";import"./chunk-OSASE35V.js";import"./chunk-WB5GRBHW.js";import{e as Co}from"./chunk-CE6XQDAG.js";import"./chunk-MPW2YJWU.js";import{a as Vt}from"./chunk-EE72PCKT.js";import"./chunk-ARL5WBDK.js";import{a as Bo,b as y,c as w,e as jo,f as dt}from"./chunk-IKXUYCK7.js";import"./chunk-T7KHS6RF.js";import{A as W,E as Lo,F as he,H as j,J as Ro,L as ct,M as ut,S as $o,U as pt,Y as Uo,a as Fo,x as I,y as T,z as ie}from"./chunk-7A4ZE5IS.js";import"./chunk-7Y7AZRL3.js";import"./chunk-WLJDMI7E.js";import"./chunk-RNF6T6IO.js";import"./chunk-5HBIIYSK.js";import"./chunk-RJ5VF3QY.js";import"./chunk-7UNQOKZW.js";import"./chunk-GB3YC4TI.js";import"./chunk-2KFYIYLI.js";import{b as No,d as it}from"./chunk-QBRRFFMZ.js";import"./chunk-Z2AV4BWZ.js";import{a as x}from"./chunk-LG3KEHGD.js";import{d as Po,e as Do}from"./chunk-HI5FTI3M.js";import{j as c,m as qo,n as J}from"./chunk-FJOVMEPN.js";import{a as ke,b as Pa}from"./chunk-C5DKLOW4.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-EVQPYZ7F.js";import"./chunk-636CTEW7.js";import"./chunk-HJ24NEP5.js";import"./chunk-2IXP3IPE.js";import{Bb as P,Db as zo,Eb as f,Fb as oo,Gb as ro,N as Eo,Sa as Ce,V as _o,Z as oe,ba as Yt,ga as Kt,la as Ne,ta as Fe,tb as u,vb as d,zb as g}from"./chunk-OIQ5NQ5I.js";import{i as st}from"./chunk-B4OMIONW.js";import"./chunk-UU6UQ2QY.js";import"./chunk-5B76DT7X.js";import"./chunk-JJZNUFPD.js";import{b as s,c as nt,d as Wt,e as Qt}from"./chunk-3PYDIBTX.js";import"./chunk-A5BSUUNQ.js";import{b as To}from"./chunk-4AWVU2OV.js";import"./chunk-R4E2E4NN.js";import{b as M}from"./chunk-VBPMVVLV.js";import"./chunk-JD5P5RAJ.js";import{e as G}from"./chunk-IWTNUJGY.js";import"./chunk-3KGN6N7E.js";import"./chunk-RFJ2LI64.js";import"./chunk-CQAD5WML.js";import"./chunk-I5A6BPCP.js";import"./chunk-O472FAYX.js";import"./chunk-IGE4Y5SE.js";import"./chunk-JFBCE4HN.js";import{e as R,g as n}from"./chunk-VKWPEFWQ.js";n();var Ta=R(_a(),1);n();n();n();n();function co(e){return lr(e).map(t=>({store:t.store,userId:t.userId,scopes:t.scopes,acquiredAt:t.acquiredAt,...t.expiresAt?{expiresAt:t.expiresAt}:{},...t.refreshTokenExpiresAt?{refreshTokenExpiresAt:t.refreshTokenExpiresAt}:{},...t.associatedUser?{associatedUser:t.associatedUser}:{}})).sort((t,o)=>o.acquiredAt.localeCompare(t.acquiredAt)||t.store.localeCompare(o.store))}n();var qa=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"2-digit",year:"numeric"});function wt(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":qa.format(t)}function kt(e){let t=z(e);if(t)return t.split(".")[0]}function Cn(){let e=co().map(t=>({subdomain:kt(t.store)??t.store,connected:wt(t.acquiredAt),store:t.store,userId:t.userId,scopes:t.scopes,acquiredAt:t.acquiredAt,...t.expiresAt?{expiresAt:t.expiresAt}:{},...t.refreshTokenExpiresAt?{refreshTokenExpiresAt:t.refreshTokenExpiresAt}:{},...t.associatedUser?{associatedUser:t.associatedUser}:{}}));return{sessions:e,...e.length===0?{message:$a()}:{}}}function $a(){return["No stores are authenticated directly with `shopify store auth`.","","Run `shopify store auth --store <domain> --scopes <scopes>` to authenticate a store.","Run `shopify store list` to list stores in a Shopify organization."].join(`
2
+ `)}n();n();n();var bt=s.object({id:s.number(),email:s.string().optional(),firstName:s.string().optional(),lastName:s.string().optional(),accountOwner:s.boolean().optional()}),ue=s.object({store:s.string(),userId:s.string(),scopes:s.array(s.string()),acquiredAt:s.string(),expiresAt:s.string().optional(),refreshTokenExpiresAt:s.string().optional(),associatedUser:bt.optional()}),be=x({name:"StoreAuthResult",schema:ue.omit({associatedUser:!0}).extend({hasRefreshToken:s.boolean(),associatedUser:ue.shape.associatedUser}),definitions:{StoreAuthAssociatedUser:bt}});var Pn=s.object({subdomain:s.string(),connected:s.string(),...ue.partial().shape,acquiredAt:ue.shape.acquiredAt.optional().describe("When the stored token was acquired, in ISO 8601 format."),expiresAt:ue.shape.expiresAt.describe("When the stored access token expires, in ISO 8601 format."),refreshTokenExpiresAt:ue.shape.refreshTokenExpiresAt.describe("When the stored refresh token expires, in ISO 8601 format.")}),vt=x({name:"StoreAuthListResult",schema:s.object({sessions:s.array(Pn),message:s.string().optional()}),definitions:{StoreAuthListSession:Pn,StoreAuthAssociatedUser:bt}});function Dn(e,t){if(t==="json"){g(vt.encode(e));return}Ua(e)}function Ua(e){if(e.sessions.length===0){P(e.message??"");return}he({rows:e.sessions.map(({subdomain:t,connected:o})=>({subdomain:t,connected:o})),columns:{subdomain:{header:"Subdomain"},connected:{header:"Connected"}}})}var De=class e extends Q{static summary="List stores authenticated directly with store auth.";static descriptionWithMarkdown="Lists stores authenticated directly on this machine with `shopify store auth`.\n\nUse this command to find stores that can be used with store-authenticated commands such as `shopify store execute`.\nTo list stores in a Shopify organization, run `shopify store list`.";static jsonOutputSchema=vt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --json"];static flags={...y,...w};async run(){let{flags:t}=await this.parse(e),o=Cn();Dn(o,t.json?"json":"text")}};n();n();n();var Ln=13387,At="/auth/callback",uo="/auth/handoff";function Rn(e){return`http://127.0.0.1:${e}${At}`}function qn(e,t){return`http://127.0.0.1:${e}${uo}?nonce=${encodeURIComponent(t)}`}function D(e){return e.length<=10?"***":`${e.slice(0,10)}***`}n();function $n(e,t=300){return e.slice(0,t)}async function Un(e){let t=`https://${e.store}/admin/oauth/access_token`;f(d`Exchanging authorization code for token at ${u.raw(t)}`);let o=await Xt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:H,code:e.code,code_verifier:e.codeVerifier,redirect_uri:e.redirectUri})}),r=await o.text();if(!o.ok)throw f(d`Token exchange failed with HTTP ${u.raw(String(o.status))}: ${u.raw($n(r||o.statusText))}`),new c(`Failed to exchange OAuth code for an access token (HTTP ${o.status}).`,r||o.statusText);let i;try{i=JSON.parse(r)}catch{throw new c("Received an invalid token response from Shopify.")}return f(d`Token exchange succeeded: access_token=${u.raw(D(i.access_token))}, refresh_token=${u.raw(i.refresh_token?D(i.refresh_token):"none")}, expires_in=${u.raw(String(i.expires_in??"unknown"))}s, user=${u.raw(String(i.associated_user?.id??"unknown"))} (${u.raw(i.associated_user?.email??"no email")})`),i}async function zn(e){let t=`https://${e.store}/admin/oauth/access_token`;f(d`Refreshing access token for ${u.raw(e.store)} using refresh_token=${u.raw(D(e.refreshToken))}`);let o=await Xt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:H,grant_type:"refresh_token",refresh_token:e.refreshToken}),signal:e.signal}),r=await o.text();if(!o.ok)throw f(d`Token refresh failed with HTTP ${u.raw(String(o.status))}: ${u.raw($n(r||o.statusText))}`),new c(`Token refresh failed for ${e.store} (HTTP ${o.status}).`);let i;try{i=JSON.parse(r)}catch{throw new c("Received an invalid refresh response from Shopify.")}if(!i.access_token)throw new c(`Token refresh returned an invalid response for ${e.store}.`);return{accessToken:i.access_token,refreshToken:i.refresh_token,expiresIn:i.expires_in,refreshTokenExpiresIn:i.refresh_token_expires_in}}var za=`#graphql
3
3
  query CurrentAppInstallationAccessScopes {
4
4
  currentAppInstallation {
5
5
  accessScopes {
@@ -7,7 +7,7 @@ import{a as gt}from"./chunk-L2PUDV7Y.js";import{a as St,b as qr}from"./chunk-MU7
7
7
  }
8
8
  }
9
9
  }
10
- `;async function jn(e){f(d`Fetching current app installation scopes for ${u.raw(e.store)} using token ${u.raw(D(e.accessToken))}`);let t=await ne({query:Ba,api:"Admin",url:ae(e.store,"unstable"),token:e.accessToken,responseOptions:{handleErrors:!1}});if(!Array.isArray(t.currentAppInstallation?.accessScopes))throw new Error("Shopify did not return currentAppInstallation.accessScopes.");return t.currentAppInstallation.accessScopes.flatMap(o=>typeof o.handle=="string"?[o.handle]:[])}n();n();var po="<comma-separated-scopes>";function Hn(e,t){return{command:`shopify store auth --store ${e} --scopes ${t}`}}function ja(e){return[[Hn(e,po)]]}function Mn(e,t,o){return[["Run",Hn(e,t),o]]}function Ha(e){return e.kind==="preview"?po:e.scopes.join(",")}function Gn(e){throw new c(`No stored app authentication found for ${e}.`,void 0,Mn(e,po,"to authenticate"))}function Le(e,t){throw new c(e,void 0,Mn(t.store,Ha(t),"to re-authenticate"))}function xt(e){let t=e.kind==="preview"?`The preview store ${e.store} has likely been claimed, so its stored authentication is no longer valid.`:`Stored app authentication for ${e.store} is no longer valid.`;Le(t,e)}function Jn(e){return new c("OAuth callback store does not match the requested store.",`Shopify returned ${e} during authentication. Re-run using the permanent store domain:`,ja(e))}import{timingSafeEqual as Ma}from"crypto";import{createServer as Ga}from"http";function Ja(e){let t=[e["sec-purpose"],e.purpose,e["x-moz"]].flat().join(" ");return t.includes("prefetch")||t.includes("prerender")}function Vn(e,t){let o=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),r=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");return`<!doctype html>
10
+ `;async function Bn(e){f(d`Fetching current app installation scopes for ${u.raw(e.store)} using token ${u.raw(D(e.accessToken))}`);let t=await ne({query:za,api:"Admin",url:ae(e.store,"unstable"),token:e.accessToken,responseOptions:{handleErrors:!1}});if(!Array.isArray(t.currentAppInstallation?.accessScopes))throw new Error("Shopify did not return currentAppInstallation.accessScopes.");return t.currentAppInstallation.accessScopes.flatMap(o=>typeof o.handle=="string"?[o.handle]:[])}n();n();var po="<comma-separated-scopes>";function jn(e,t){return{command:`shopify store auth --store ${e} --scopes ${t}`}}function Ba(e){return[[jn(e,po)]]}function Hn(e,t,o){return[["Run",jn(e,t),o]]}function ja(e){return e.kind==="preview"?po:e.scopes.join(",")}function Mn(e){throw new c(`No stored app authentication found for ${e}.`,void 0,Hn(e,po,"to authenticate"))}function Le(e,t){throw new c(e,void 0,Hn(t.store,ja(t),"to re-authenticate"))}function xt(e){let t=e.kind==="preview"?`The preview store ${e.store} has likely been claimed, so its stored authentication is no longer valid.`:`Stored app authentication for ${e.store} is no longer valid.`;Le(t,e)}function Gn(e){return new c("OAuth callback store does not match the requested store.",`Shopify returned ${e} during authentication. Re-run using the permanent store domain:`,Ba(e))}import{timingSafeEqual as Ha}from"crypto";import{createServer as Ma}from"http";function Ga(e){let t=[e["sec-purpose"],e.purpose,e["x-moz"]].flat().join(" ");return t.includes("prefetch")||t.includes("prerender")}function Jn(e,t){let o=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;"),r=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");return`<!doctype html>
11
11
  <html lang="en">
12
12
  <head>
13
13
  <meta charset="utf-8" />
@@ -76,13 +76,13 @@ import{a as gt}from"./chunk-L2PUDV7Y.js";import{a as St,b as qr}from"./chunk-MU7
76
76
  </main>
77
77
  </div>
78
78
  </body>
79
- </html>`}async function Qn({store:e,state:t,port:o,timeoutMs:r=300*1e3,onListening:i,authorizationRedirect:a}){let p=_(e);return new Promise((m,l)=>{let S=!1,O=!1,h=!1,L=setTimeout(()=>{C(new c("Timed out waiting for OAuth callback."))},r),U=Ga((E,v)=>{let ot=new URL(E.url??"/",`http://127.0.0.1:${o}`),bo=()=>{v.statusCode=404,v.setHeader("Cache-Control","no-store"),v.setHeader("Connection","close"),v.end("Not found")};if(ot.pathname===uo){let me=ot.searchParams.get("nonce");if(!(a!==void 0&&!h&&E.method==="GET"&&me!==null&&Wn(me,a.nonce))||Ja(E.headers)){bo();return}h=!0,v.statusCode=302,v.setHeader("Location",a.authorizationUrl),v.setHeader("Cache-Control","no-store"),v.setHeader("Referrer-Policy","no-referrer"),v.setHeader("Connection","close"),v.end();return}if(ot.pathname!==At){bo();return}let{searchParams:rt}=ot,_e=(me,Oo)=>{let Io=typeof me=="string"?new c(me,Oo):me;v.statusCode=400,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>C(Io)),v.end(Vn("Authentication failed",Io.message))},Gt=rt.get("shop");if(f(d`Received OAuth callback for shop ${u.raw(Gt??"unknown")}`),!Gt){_e("OAuth callback store does not match the requested store.");return}let vo=_(Gt);if(vo!==p){_e(Jn(vo));return}let Ao=rt.get("state");if(!Ao||!Wn(Ao,t)){_e("OAuth callback state does not match the original request.");return}let xo=rt.get("error");if(xo){_e(`Shopify returned an OAuth error: ${xo}`);return}let Jt=rt.get("code");if(!Jt){_e("OAuth callback did not include an authorization code.");return}f(d`Received authorization code ${u.raw(D(Jt))}`),v.statusCode=200,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>de(()=>m(Jt))),v.end(Vn("Authentication succeeded","Close this window and return to the terminal"))}),de=E=>{if(S)return;S=!0,clearTimeout(L);let v=()=>{E()};if(!O){v();return}U.close(()=>{O=!1,v()}),U.closeIdleConnections?.()},C=E=>{de(()=>l(E))};U.on("error",E=>{if(E.code==="EADDRINUSE"){C(new c(`Port ${o} is already in use.`,`Free port ${o} and re-run ${u.genericShellCommand(`shopify store auth --store ${e} --scopes <comma-separated-scopes>`).value}. Ensure that redirect URI is allowed in the app configuration.`));return}C(E)}),U.listen(o,"127.0.0.1",()=>{O=!0,f(d`PKCE callback server listening on http://127.0.0.1:${u.raw(String(o))}${u.raw(At)}`),i&&Promise.resolve(i()).catch(E=>{C(E instanceof Error?E:new Error(String(E)))})})})}function Wn(e,t){return e.length!==t.length?!1:Ma(Buffer.from(e,"utf8"),Buffer.from(t,"utf8"))}n();import{createHash as Va,randomBytes as Yn}from"crypto";function Wa(){return Yn(32).toString("base64url")}function Qa(e){return Va("sha256").update(e).digest("base64url")}function Ya(e){let t=new URLSearchParams;return t.set("client_id",H),t.set("scope",e.scopes.join(",")),t.set("redirect_uri",e.redirectUri),t.set("state",e.state),t.set("response_type","code"),t.set("code_challenge",e.codeChallenge),t.set("code_challenge_method","S256"),`https://${e.store}/admin/oauth/authorize?${t.toString()}`}function Ka(e,t){let o=new URL(e);return o.searchParams.set("signup",t),{nonce:Yn(32).toString("base64url"),authorizationUrl:o.toString()}}function Kn(e){let{store:t,scopes:o,signup:r,exchangeCodeForToken:i}=e,a=Rn,p=it(),m=qn(a),l=Wa(),S=Qa(l),O=Ya({store:t,scopes:o,state:p,redirectUri:m,codeChallenge:S}),h=r?Ka(O,r):void 0,L=h?$n(a,h.nonce):O;return f(d`Starting PKCE auth for ${u.raw(t)} with scopes ${u.raw(o.join(","))} (redirect_uri=${u.raw(m)})`),{authorization:{store:t,scopes:o,state:p,port:a,redirectUri:m,authorizationUrl:L,codeVerifier:l},waitForAuthCodeOptions:{store:t,state:p,port:a,authorizationRedirect:h},exchangeCodeForToken:U=>i({store:t,code:U,codeVerifier:l,redirectUri:m})}}n();function lo(e){let t=e.split(/[ ,]+/).filter(Boolean);if(t.length===0)throw new c("At least one scope is required.","Pass --scopes as a comma-separated list.");return Eo(t)}function mo(e){let t=new Set(e);for(let o of e){let r=o.match(/^(unauthenticated_)?write_(.*)$/);r&&t.add(`${r[1]??""}read_${r[2]}`)}return t}function Xn(e,t){let o=[...t],r=mo(t);for(let i of e)if(!r.has(i)){o.push(i);for(let a of mo([i]))r.add(a)}return o}function Zn(e,t){if(!e.scope)return f(d`Token response did not include scope; falling back to requested scopes`),t;let o=lo(e.scope),r=mo(o),i=t.filter(a=>!r.has(a));if(i.length>0)throw new c("Shopify granted fewer scopes than were requested.",`Missing scopes: ${i.join(", ")}.`,["Update the app or store installation scopes.","See https://shopify.dev/app/scopes","Re-run shopify store auth."]);return o}n();n();var Xa=240*1e3;function Za(e){if(!e.expiresAt)return!1;let t=new Date(e.expiresAt).getTime();return Number.isNaN(t)?!0:t-Xa<Date.now()}function es(e,t){let o=Date.now(),r=t.expiresIn?new Date(o+t.expiresIn*1e3).toISOString():e.expiresAt;return{...e,accessToken:t.accessToken,refreshToken:t.refreshToken??e.refreshToken,expiresAt:r,refreshTokenExpiresAt:t.refreshTokenExpiresIn?new Date(o+t.refreshTokenExpiresIn*1e3).toISOString():e.refreshTokenExpiresAt,acquiredAt:new Date(o).toISOString()}}async function $(e,t){t?.throwIfAborted();let o=Y(e);if(o||Gn(e),f(d`Loaded stored session for ${u.raw(e)}: token=${u.raw(D(o.accessToken))}, expires=${u.raw(o.expiresAt??"unknown")}`),!Za(o))return o;o.refreshToken||Le(`No refresh token stored for ${o.store}.`,o),f(d`Refreshing expired token for ${u.raw(o.store)} (expired at ${u.raw(o.expiresAt??"unknown")}, refresh_token=${u.raw(D(o.refreshToken))})`);let r=o.accessToken,i={store:o.store,refreshToken:o.refreshToken,...t?{signal:t}:{}},a;try{a=await Bn(i)}catch(p){throw t?.aborted||(ge(o.store,o.userId),p instanceof c&&p.message.startsWith(`Token refresh failed for ${o.store} (HTTP `)&&Le(p.message,o),p instanceof c&&p.message===`Token refresh returned an invalid response for ${o.store}.`&&Le(p.message,o),p instanceof c&&p.message==="Received an invalid refresh response from Shopify."),p}return o=es(o,a),f(d`Token refresh succeeded for ${u.raw(o.store)}: ${u.raw(D(r))} → ${u.raw(D(o.accessToken))}, new expiry ${u.raw(o.expiresAt??"unknown")}`),Se(o),o}function ei(e,t=300){return e.slice(0,t)}function ts(e){if(e&&typeof e=="object"&&"response"in e){let t=e.response,o=t?.status,r=t?.errors;if(typeof o=="number"){let i=typeof r=="string"?r:JSON.stringify(r);return ei(i?`HTTP ${o}: ${i}`:`HTTP ${o}`)}}return ei(e instanceof Error?e.message:String(e))}async function ti(e){let t=_(e),o=Y(t);if(!o)return{scopes:[],authoritative:!0};try{let r=await $(t),i=await jn({store:r.store,accessToken:r.accessToken});return f(d`Resolved current remote scopes for ${u.raw(t)}: ${u.raw(i.join(",")||"none")}`),{scopes:i,authoritative:!0}}catch(r){if(r instanceof Error)return f(d`Falling back to locally stored scopes for ${u.raw(t)} after remote scope lookup failed: ${u.raw(ts(r))}`),{scopes:o.scopes,authoritative:!1};throw r}}n();function os(e){return{completed:["Logged in.",`Authenticated${e.associatedUser?.email?` as ${e.associatedUser.email}`:""} against ${e.store}.`],info:["","To verify that authentication worked, run:",`shopify store execute --store ${e.store} --query 'query { shop { name id } }'`]}}function rs(){P("Shopify CLI will open the app authorization page in your browser."),P("")}function ns(e){return URL.canParse(e)?new URL(e).searchParams.has("signup"):!0}function is(e,t={}){return t.sensitive||ns(e)?(P("Browser did not open automatically. The manual authorization URL contains sensitive credentials and was not printed."),P("Run this command again in an environment where Shopify CLI can open a browser automatically."),P(""),!1):(P("Browser did not open automatically. Open this URL manually:"),P(d`${u.link(e)}`),P(""),!0)}function as(e,t="text"){if(t==="json"){g(be.encode(e));return}let o=os(e);o.completed.forEach(r=>zo(r)),o.info.forEach(r=>P(r))}function ve(e="text"){return{openingBrowser:rs,manualAuthUrl:is,success(t){as(t,e)}}}n();async function N(e,t,o){await Do(()=>({store_fqdn:e})),await Po(()=>({store_fqdn_hash:No(e),store_fqdn_validated:t,store_domain:e,store_id:_o(o)}))}var ss={openURL:ut,waitForStoreAuthCode:Qn,exchangeStoreAuthCodeForToken:zn,resolveExistingScopes:ti,getCurrentStoredStoreAppSession:Y,presenter:ve("text")};async function Ot(e,t={}){let o={...ss,...t},r=_(e.store);if(cs(r,o),To())throw new c("Store authentication requires browser interaction, but user input is disabled.","Remove `--no-input` and run the command in an interactive terminal.");await N(r,!1);let i=lo(e.scopes),a=await o.resolveExistingScopes(r),p=Xn(i,a.scopes),m=a.authoritative?p:i;a.scopes.length>0&&f(d`Merged requested scopes ${u.raw(i.join(","))} with existing scopes ${u.raw(a.scopes.join(","))} for ${u.raw(r)}`);let l=Kn({store:r,scopes:p,signup:e.signup,exchangeCodeForToken:o.exchangeStoreAuthCodeForToken}),{authorization:{authorizationUrl:S}}=l;o.presenter.openingBrowser();let O=await o.waitForStoreAuthCode({...l.waitForAuthCodeOptions,onListening:async()=>{if(await o.openURL(S))return;if(!o.presenter.manualAuthUrl(S))throw new c("Authentication can't continue without a browser.")}}),h=await l.exchangeCodeForToken(O);await N(r,!0);let L=h.associated_user?.id?.toString();if(!L)throw new c("Shopify did not return associated user information for the online access token.");q(L);let U=Date.now(),de=h.expires_in?new Date(U+h.expires_in*1e3).toISOString():void 0,C={store:r,userId:L,scopes:Zn(h,m),acquiredAt:new Date(U).toISOString(),expiresAt:de,refreshTokenExpiresAt:h.refresh_token_expires_in?new Date(U+h.refresh_token_expires_in*1e3).toISOString():void 0,hasRefreshToken:!!h.refresh_token,associatedUser:h.associated_user?{id:h.associated_user.id,email:h.associated_user.email,firstName:h.associated_user.first_name,lastName:h.associated_user.last_name,accountOwner:h.associated_user.account_owner}:void 0};return Se({store:r,clientId:H,userId:L,accessToken:h.access_token,refreshToken:h.refresh_token,scopes:C.scopes,acquiredAt:C.acquiredAt,expiresAt:de,refreshTokenExpiresAt:C.refreshTokenExpiresAt,associatedUser:C.associatedUser}),f(d`Session persisted for ${u.raw(r)} (user ${u.raw(L)}, expires ${u.raw(de??"unknown")})`),o.presenter.success(C),C}function cs(e,t){let o=t.getCurrentStoredStoreAppSession(e);if(o?.kind!=="preview")return;let r=o.scopes,i=r.length>0?r.join(", "):"none";throw new c("`store auth` is unavailable for preview stores. Additional Admin API scopes can't be granted.",`The following scopes are available: ${i}.
79
+ </html>`}async function Wn({store:e,state:t,port:o,timeoutMs:r=300*1e3,onListening:i,authorizationRedirect:a}){let p=_(e);return new Promise((m,l)=>{let S=!1,O=!1,h=!1,L=setTimeout(()=>{C(new c("Timed out waiting for OAuth callback."))},r),U=Ma((E,v)=>{let ot=new URL(E.url??"/",`http://127.0.0.1:${o}`),bo=()=>{v.statusCode=404,v.setHeader("Cache-Control","no-store"),v.setHeader("Connection","close"),v.end("Not found")};if(ot.pathname===uo){let me=ot.searchParams.get("nonce");if(!(a!==void 0&&!h&&E.method==="GET"&&me!==null&&Vn(me,a.nonce))||Ga(E.headers)){bo();return}h=!0,v.statusCode=302,v.setHeader("Location",a.authorizationUrl),v.setHeader("Cache-Control","no-store"),v.setHeader("Referrer-Policy","no-referrer"),v.setHeader("Connection","close"),v.end();return}if(ot.pathname!==At){bo();return}let{searchParams:rt}=ot,_e=(me,Oo)=>{let Io=typeof me=="string"?new c(me,Oo):me;v.statusCode=400,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>C(Io)),v.end(Jn("Authentication failed",Io.message))},Gt=rt.get("shop");if(f(d`Received OAuth callback for shop ${u.raw(Gt??"unknown")}`),!Gt){_e("OAuth callback store does not match the requested store.");return}let vo=_(Gt);if(vo!==p){_e(Gn(vo));return}let Ao=rt.get("state");if(!Ao||!Vn(Ao,t)){_e("OAuth callback state does not match the original request.");return}let xo=rt.get("error");if(xo){_e(`Shopify returned an OAuth error: ${xo}`);return}let Jt=rt.get("code");if(!Jt){_e("OAuth callback did not include an authorization code.");return}f(d`Received authorization code ${u.raw(D(Jt))}`),v.statusCode=200,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>de(()=>m(Jt))),v.end(Jn("Authentication succeeded","Close this window and return to the terminal"))}),de=E=>{if(S)return;S=!0,clearTimeout(L);let v=()=>{E()};if(!O){v();return}U.close(()=>{O=!1,v()}),U.closeIdleConnections?.()},C=E=>{de(()=>l(E))};U.on("error",E=>{if(E.code==="EADDRINUSE"){C(new c(`Port ${o} is already in use.`,`Free port ${o} and re-run ${u.genericShellCommand(`shopify store auth --store ${e} --scopes <comma-separated-scopes>`).value}. Ensure that redirect URI is allowed in the app configuration.`));return}C(E)}),U.listen(o,"127.0.0.1",()=>{O=!0,f(d`PKCE callback server listening on http://127.0.0.1:${u.raw(String(o))}${u.raw(At)}`),i&&Promise.resolve(i()).catch(E=>{C(E instanceof Error?E:new Error(String(E)))})})})}function Vn(e,t){return e.length!==t.length?!1:Ha(Buffer.from(e,"utf8"),Buffer.from(t,"utf8"))}n();import{createHash as Ja,randomBytes as Qn}from"crypto";function Va(){return Qn(32).toString("base64url")}function Wa(e){return Ja("sha256").update(e).digest("base64url")}function Qa(e){let t=new URLSearchParams;return t.set("client_id",H),t.set("scope",e.scopes.join(",")),t.set("redirect_uri",e.redirectUri),t.set("state",e.state),t.set("response_type","code"),t.set("code_challenge",e.codeChallenge),t.set("code_challenge_method","S256"),`https://${e.store}/admin/oauth/authorize?${t.toString()}`}function Ya(e,t){let o=new URL(e);return o.searchParams.set("signup",t),{nonce:Qn(32).toString("base64url"),authorizationUrl:o.toString()}}function Yn(e){let{store:t,scopes:o,signup:r,exchangeCodeForToken:i}=e,a=Ln,p=it(),m=Rn(a),l=Va(),S=Wa(l),O=Qa({store:t,scopes:o,state:p,redirectUri:m,codeChallenge:S}),h=r?Ya(O,r):void 0,L=h?qn(a,h.nonce):O;return f(d`Starting PKCE auth for ${u.raw(t)} with scopes ${u.raw(o.join(","))} (redirect_uri=${u.raw(m)})`),{authorization:{store:t,scopes:o,state:p,port:a,redirectUri:m,authorizationUrl:L,codeVerifier:l},waitForAuthCodeOptions:{store:t,state:p,port:a,authorizationRedirect:h},exchangeCodeForToken:U=>i({store:t,code:U,codeVerifier:l,redirectUri:m})}}n();function lo(e){let t=e.split(/[ ,]+/).filter(Boolean);if(t.length===0)throw new c("At least one scope is required.","Pass --scopes as a comma-separated list.");return Eo(t)}function mo(e){let t=new Set(e);for(let o of e){let r=o.match(/^(unauthenticated_)?write_(.*)$/);r&&t.add(`${r[1]??""}read_${r[2]}`)}return t}function Kn(e,t){let o=[...t],r=mo(t);for(let i of e)if(!r.has(i)){o.push(i);for(let a of mo([i]))r.add(a)}return o}function Xn(e,t){if(!e.scope)return f(d`Token response did not include scope; falling back to requested scopes`),t;let o=lo(e.scope),r=mo(o),i=t.filter(a=>!r.has(a));if(i.length>0)throw new c("Shopify granted fewer scopes than were requested.",`Missing scopes: ${i.join(", ")}.`,["Update the app or store installation scopes.","See https://shopify.dev/app/scopes","Re-run shopify store auth."]);return o}n();n();var Ka=240*1e3;function Xa(e){if(!e.expiresAt)return!1;let t=new Date(e.expiresAt).getTime();return Number.isNaN(t)?!0:t-Ka<Date.now()}function Za(e,t){let o=Date.now(),r=t.expiresIn?new Date(o+t.expiresIn*1e3).toISOString():e.expiresAt;return{...e,accessToken:t.accessToken,refreshToken:t.refreshToken??e.refreshToken,expiresAt:r,refreshTokenExpiresAt:t.refreshTokenExpiresIn?new Date(o+t.refreshTokenExpiresIn*1e3).toISOString():e.refreshTokenExpiresAt,acquiredAt:new Date(o).toISOString()}}async function $(e,t){t?.throwIfAborted();let o=Y(e);if(o||Mn(e),f(d`Loaded stored session for ${u.raw(e)}: token=${u.raw(D(o.accessToken))}, expires=${u.raw(o.expiresAt??"unknown")}`),!Xa(o))return o;o.refreshToken||Le(`No refresh token stored for ${o.store}.`,o),f(d`Refreshing expired token for ${u.raw(o.store)} (expired at ${u.raw(o.expiresAt??"unknown")}, refresh_token=${u.raw(D(o.refreshToken))})`);let r=o.accessToken,i={store:o.store,refreshToken:o.refreshToken,...t?{signal:t}:{}},a;try{a=await zn(i)}catch(p){throw t?.aborted||(ge(o.store,o.userId),p instanceof c&&p.message.startsWith(`Token refresh failed for ${o.store} (HTTP `)&&Le(p.message,o),p instanceof c&&p.message===`Token refresh returned an invalid response for ${o.store}.`&&Le(p.message,o),p instanceof c&&p.message==="Received an invalid refresh response from Shopify."),p}return o=Za(o,a),f(d`Token refresh succeeded for ${u.raw(o.store)}: ${u.raw(D(r))} → ${u.raw(D(o.accessToken))}, new expiry ${u.raw(o.expiresAt??"unknown")}`),Se(o),o}function Zn(e,t=300){return e.slice(0,t)}function es(e){if(e&&typeof e=="object"&&"response"in e){let t=e.response,o=t?.status,r=t?.errors;if(typeof o=="number"){let i=typeof r=="string"?r:JSON.stringify(r);return Zn(i?`HTTP ${o}: ${i}`:`HTTP ${o}`)}}return Zn(e instanceof Error?e.message:String(e))}async function ei(e){let t=_(e),o=Y(t);if(!o)return{scopes:[],authoritative:!0};try{let r=await $(t),i=await Bn({store:r.store,accessToken:r.accessToken});return f(d`Resolved current remote scopes for ${u.raw(t)}: ${u.raw(i.join(",")||"none")}`),{scopes:i,authoritative:!0}}catch(r){if(r instanceof Error)return f(d`Falling back to locally stored scopes for ${u.raw(t)} after remote scope lookup failed: ${u.raw(es(r))}`),{scopes:o.scopes,authoritative:!1};throw r}}n();function ts(e){return{completed:["Logged in.",`Authenticated${e.associatedUser?.email?` as ${e.associatedUser.email}`:""} against ${e.store}.`],info:["","To verify that authentication worked, run:",`shopify store execute --store ${e.store} --query 'query { shop { name id } }'`]}}function os(){P("Shopify CLI will open the app authorization page in your browser."),P("")}function rs(e){return URL.canParse(e)?new URL(e).searchParams.has("signup"):!0}function ns(e,t={}){return t.sensitive||rs(e)?(P("Browser did not open automatically. The manual authorization URL contains sensitive credentials and was not printed."),P("Run this command again in an environment where Shopify CLI can open a browser automatically."),P(""),!1):(P("Browser did not open automatically. Open this URL manually:"),P(d`${u.link(e)}`),P(""),!0)}function is(e,t="text"){if(t==="json"){g(be.encode(e));return}let o=ts(e);o.completed.forEach(r=>zo(r)),o.info.forEach(r=>P(r))}function ve(e="text"){return{openingBrowser:os,manualAuthUrl:ns,success(t){is(t,e)}}}n();async function N(e,t,o){await Do(()=>({store_fqdn:e})),await Po(()=>({store_fqdn_hash:No(e),store_fqdn_validated:t,store_domain:e,store_id:_o(o)}))}var as={openURL:ut,waitForStoreAuthCode:Wn,exchangeStoreAuthCodeForToken:Un,resolveExistingScopes:ei,getCurrentStoredStoreAppSession:Y,presenter:ve("text")};async function Ot(e,t={}){let o={...as,...t},r=_(e.store);if(ss(r,o),To())throw new c("Store authentication requires browser interaction, but user input is disabled.","Remove `--no-input` and run the command in an interactive terminal.");await N(r,!1);let i=lo(e.scopes),a=await o.resolveExistingScopes(r),p=Kn(i,a.scopes),m=a.authoritative?p:i;a.scopes.length>0&&f(d`Merged requested scopes ${u.raw(i.join(","))} with existing scopes ${u.raw(a.scopes.join(","))} for ${u.raw(r)}`);let l=Yn({store:r,scopes:p,signup:e.signup,exchangeCodeForToken:o.exchangeStoreAuthCodeForToken}),{authorization:{authorizationUrl:S}}=l;o.presenter.openingBrowser();let O=await o.waitForStoreAuthCode({...l.waitForAuthCodeOptions,onListening:async()=>{if(await o.openURL(S))return;if(!o.presenter.manualAuthUrl(S))throw new c("Authentication can't continue without a browser.")}}),h=await l.exchangeCodeForToken(O);await N(r,!0);let L=h.associated_user?.id?.toString();if(!L)throw new c("Shopify did not return associated user information for the online access token.");q(L);let U=Date.now(),de=h.expires_in?new Date(U+h.expires_in*1e3).toISOString():void 0,C={store:r,userId:L,scopes:Xn(h,m),acquiredAt:new Date(U).toISOString(),expiresAt:de,refreshTokenExpiresAt:h.refresh_token_expires_in?new Date(U+h.refresh_token_expires_in*1e3).toISOString():void 0,hasRefreshToken:!!h.refresh_token,associatedUser:h.associated_user?{id:h.associated_user.id,email:h.associated_user.email,firstName:h.associated_user.first_name,lastName:h.associated_user.last_name,accountOwner:h.associated_user.account_owner}:void 0};return Se({store:r,clientId:H,userId:L,accessToken:h.access_token,refreshToken:h.refresh_token,scopes:C.scopes,acquiredAt:C.acquiredAt,expiresAt:de,refreshTokenExpiresAt:C.refreshTokenExpiresAt,associatedUser:C.associatedUser}),f(d`Session persisted for ${u.raw(r)} (user ${u.raw(L)}, expires ${u.raw(de??"unknown")})`),o.presenter.success(C),C}function ss(e,t){let o=t.getCurrentStoredStoreAppSession(e);if(o?.kind!=="preview")return;let r=o.scopes,i=r.length>0?r.join(", "):"none";throw new c("`store auth` is unavailable for preview stores. Additional Admin API scopes can't be granted.",`The following scopes are available: ${i}.
80
80
 
81
- Run \`shopify store info --store ${e} --json\` to view this list again at any time.`,["Run `shopify store execute` directly against the preview store; no `store auth` step is needed."])}n();var k=class extends Q{};n();var F=R(M(),1),us="Country must be a two-letter country code, for example: US.";function ps(e){return/^[A-Z]{2}$/.test(e)}var It=F.Flags.string({description:"Two-letter country code for the store, such as US, CA, or GB. Follows the ISO 3166-1 alpha-2 standard.",env:"SHOPIFY_FLAG_STORE_COUNTRY",required:!1,parse:async e=>{let t=e.trim().toUpperCase();if(!ps(t))throw new c(us);return t}}),b={store:F.Flags.string({char:"s",description:"The myshopify.com domain of the store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>_(e),required:!0}),"organization-id":F.Flags.integer({description:"The numeric organization ID. Auto-selects if you belong to a single organization.",env:"SHOPIFY_FLAG_ORGANIZATION_ID"})},oi={env:"SHOPIFY_FLAG_ID",parse:async e=>hr(e)},ri=F.Flags.string({...oi,description:"The bulk operation ID (numeric ID or full GID). If not provided, lists all bulk operations on this store in the last 7 days."}),ni=F.Flags.string({...oi,description:"The bulk operation ID to cancel (numeric ID or full GID).",required:!0}),ii={query:F.Flags.string({char:"q",description:"The GraphQL query or mutation to run as a bulk operation.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":F.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async e=>G(e),exactlyOne:["query","query-file"]}),variables:F.Flags.string({char:"v",description:"The values for any GraphQL variables in your mutation, in JSON format. Can be specified multiple times.",env:"SHOPIFY_FLAG_VARIABLES",multiple:!0,exclusive:["variable-file"]}),"variable-file":F.Flags.string({description:"Path to a file containing GraphQL variables in JSONL format (one JSON object per line). Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async e=>G(e),exclusive:["variables"]}),watch:F.Flags.boolean({description:"Wait for bulk operation results before exiting. Defaults to false.",env:"SHOPIFY_FLAG_WATCH"}),"output-file":F.Flags.string({description:"The file path where results should be written if --watch is specified. If not specified, results will be written to STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",dependsOn:["watch"]}),version:F.Flags.string({description:"The API version to use for the bulk operation. If not specified, uses the latest stable version.",env:"SHOPIFY_FLAG_VERSION"}),"allow-mutations":F.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};var ai=R(M(),1),Re=class e extends k{static summary="Authenticate an app against a store for store commands.";static descriptionWithMarkdown=`Authenticates the app against the specified store for store commands and stores an online access token for later reuse.
81
+ Run \`shopify store info --store ${e} --json\` to view this list again at any time.`,["Run `shopify store execute` directly against the preview store; no `store auth` step is needed."])}n();var k=class extends Q{};n();var F=R(M(),1),cs="Country must be a two-letter country code, for example: US.";function us(e){return/^[A-Z]{2}$/.test(e)}var It=F.Flags.string({description:"Two-letter country code for the store, such as US, CA, or GB. Follows the ISO 3166-1 alpha-2 standard.",env:"SHOPIFY_FLAG_STORE_COUNTRY",required:!1,parse:async e=>{let t=e.trim().toUpperCase();if(!us(t))throw new c(cs);return t}}),b={store:F.Flags.string({char:"s",description:"The myshopify.com domain of the store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>_(e),required:!0}),"organization-id":F.Flags.integer({description:"The numeric organization ID. Auto-selects if you belong to a single organization.",env:"SHOPIFY_FLAG_ORGANIZATION_ID"})},ti={env:"SHOPIFY_FLAG_ID",parse:async e=>hr(e)},oi=F.Flags.string({...ti,description:"The bulk operation ID (numeric ID or full GID). If not provided, lists all bulk operations on this store in the last 7 days."}),ri=F.Flags.string({...ti,description:"The bulk operation ID to cancel (numeric ID or full GID).",required:!0}),ni={query:F.Flags.string({char:"q",description:"The GraphQL query or mutation to run as a bulk operation.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":F.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async e=>G(e),exactlyOne:["query","query-file"]}),variables:F.Flags.string({char:"v",description:"The values for any GraphQL variables in your mutation, in JSON format. Can be specified multiple times.",env:"SHOPIFY_FLAG_VARIABLES",multiple:!0,exclusive:["variable-file"]}),"variable-file":F.Flags.string({description:"Path to a file containing GraphQL variables in JSONL format (one JSON object per line). Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async e=>G(e),exclusive:["variables"]}),watch:F.Flags.boolean({description:"Wait for bulk operation results before exiting. Defaults to false.",env:"SHOPIFY_FLAG_WATCH"}),"output-file":F.Flags.string({description:"The file path where results should be written if --watch is specified. If not specified, results will be written to STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",dependsOn:["watch"]}),version:F.Flags.string({description:"The API version to use for the bulk operation. If not specified, uses the latest stable version.",env:"SHOPIFY_FLAG_VERSION"}),"allow-mutations":F.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};var ii=R(M(),1),Re=class e extends k{static summary="Authenticate an app against a store for store commands.";static descriptionWithMarkdown=`Authenticates the app against the specified store for store commands and stores an online access token for later reuse.
82
82
 
83
- Re-run this command if the stored token is missing, expires, or no longer has the scopes you need.`;static jsonOutputSchema=be;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --json"];static flags={...y,...w,store:b.store,scopes:ai.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0})};async run(){let{flags:t}=await this.parse(e);await Ot({store:t.store,scopes:t.scopes},{presenter:ve(t.json?"json":"text")})}};n();n();async function si(e){let t=await br(e);return{store:e.adminSession.storeFqdn,apiVersion:e.version??se,operation:t?.bulkOperation??null,userErrors:t?.userErrors??[]}}n();async function Ae(e){le();let t=await $(e);return await N(t.store,!0),q(t.userId),{token:t.accessToken,storeFqdn:t.store}}n();n();var mi=s.string().regex(/^gid:\/\/shopify\/BulkOperation\/[^/]+$/).describe("The Shopify global ID of a bulk operation."),pe=s.object({gid:mi,type:s.string(),status:s.string(),errorCode:s.string().nullable(),createdAt:Wt,completedAt:Wt.nullable(),objectCount:s.string().regex(/^\d+$/).describe("A nonnegative decimal count, without loss of integer precision."),url:s.string().url().nullable(),partialDataUrl:s.string().url().nullable()}).strict(),li=pe.omit({type:!0}),Tt=s.object({storeDomain:nt.nullable(),apiVersion:s.string().nullable().describe("The API version selected for the request.")}).strict(),Et=x({name:"CancelBulkOperationResult",schema:Tt.extend({status:s.literal("success"),operation:pe}),definitions:{BulkOperation:pe}}),ci=Tt.extend({status:s.enum(["success","partial","cancelled"]),reason:s.literal("watch-aborted").optional(),operation:pe,resultsJsonl:s.string().optional().describe("Downloaded results in their native JSONL format.")}),ui=s.object({path:s.string().describe("The absolute path of the downloaded results file."),format:s.literal("jsonl")}).strict(),qe=x({name:"ExecuteBulkOperationResult",schema:s.union([ci,ui]),definitions:{BulkOperation:pe,ExecuteBulkOperationResult:ci,BulkOperationFile:ui}}),pi=Tt.extend({operationGid:mi,operation:pe.nullable()}),di=Tt.extend({operations:s.array(li),pageInfo:s.object({hasNextPage:s.boolean().nullable().describe("Unknown when the API result reaches the fetch limit.")}).strict()}),_t=x({name:"BulkOperationStatusResult",schema:s.union([pi,di]),definitions:{GetBulkOperationStatusResult:pi,ListBulkOperationsResult:di,BulkOperation:pe,ListedBulkOperation:li}});n();function X(e){let t=re(e.store);return{storeDomain:t?`${t}.myshopify.com`:null,apiVersion:e.apiVersion??null}}function Z(e){if(typeof e.objectCount=="number"&&!Number.isSafeInteger(e.objectCount))throw new J("Shopify returned a bulk operation count that can't be represented exactly.");return{gid:e.id,..."type"in e?{type:e.type}:{},status:e.status,errorCode:e.errorCode??null,createdAt:Qt(new Date(String(e.createdAt))),completedAt:e.completedAt?Qt(new Date(String(e.completedAt))):null,objectCount:String(e.objectCount),url:e.url??null,partialDataUrl:e.partialDataUrl??null}}function fi(e,t,o){if(o==="json"){if(e.userErrors.length||!e.operation){let i=new c("Failed to cancel bulk operation.");throw i.details={...X(e),operationGid:t,userErrors:e.userErrors},i}g(Et.encode({...X(e),status:"success",operation:Z(e.operation)}));return}if(e.userErrors.length){vr(e.userErrors,"Failed to cancel bulk operation.");return}let r=e.operation;if(r){let i=Ar(r),a=r.status==="CANCELING"?[`This may take a few moments. Check the status with:
84
- `,{command:`shopify store bulk status --id=${ye(r.id)}`}]:i.body,p={headline:i.headline,...a&&{body:a},...i.customSections&&{customSections:i.customSections}};switch(i.renderType){case"success":T(p);break;case"warning":ie(p);break;case"info":I(p);break}}else W({headline:"Bulk operation not found or could not be canceled.",body:d`ID: ${u.yellow(t)}`.value})}n();n();function hi(e){let{storeFqdn:t,version:o}=e,r=[`Store: ${t}`];return o&&r.push(`API version: ${o}`),r}function Si(e,t=!1){if(we(e)&&!t)throw new c("Mutations are disabled by default for shopify store bulk execute.","Re-run with --allow-mutations if you intend to modify store data.")}function xe(e,t){let o=[...t.operationId?[`ID: ${t.operationId}`]:[],...hi(t)];I({headline:e,body:[{list:{items:o}}]})}var $e=class e extends k{static summary="Cancel a bulk operation on a store.";static descriptionWithMarkdown="Cancels a running bulk operation by ID, using previously stored app authentication.\n\n Run `shopify store auth` first to create stored auth for the store.";static jsonOutputSchema=Et;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];static flags={...y,...w,store:b.store,id:ni};async run(){let{flags:t}=await this.parse(e),o=t.json?"json":"text",r=await Ae(t.store);xe("Canceling bulk operation.",{storeFqdn:r.storeFqdn,operationId:t.id});let i=await si({adminSession:r,operationId:t.id});fi(i,t.id,o)}};n();n();async function ds(e,t){if(e)return e.join(`
85
- `);if(t){if(!await Ce(t))throw new c(d`Variable file not found at ${u.path(t)}. Please check the path and try again.`);return Ne(t,{encoding:"utf8"})}else return}async function gi(e){let{store:t,query:o,variables:r,variableFile:i,watch:a=!1,version:p,allowMutations:m=!1}=e;Si(o,m);let{adminSession:l,version:S}=await j({title:d`Authenticating`,task:async()=>{let h=await Ae(t),L=await Pe({adminSession:h,userSpecifiedVersion:p,minimumDefaultVersion:se});return{adminSession:h,version:L}},renderOptions:{stdout:process.stderr}}),O=await ds(r,i);return ms(o,O),{adminSession:l,version:S,query:o,variablesJsonl:O,watch:a}}async function yi(e){let{adminSession:t,version:o,query:r,variablesJsonl:i,watch:a}=e,p=we(r)?await yr({adminSession:t,query:r,variablesJsonl:i,version:o}):await gr({adminSession:t,query:r,version:o});if(p?.userErrors?.length||!p?.bulkOperation)return{store:t.storeFqdn,apiVersion:o,operation:p?.bulkOperation??null,userErrors:p?.userErrors??[],watchAborted:!1};let m=new Fo,l=a?await Or(t,p.bulkOperation.id,m.signal,()=>m.abort()):await xr(t,p.bulkOperation.id),S=a&&!m.signal.aborted&&l.status==="COMPLETED"&&l.url?await Ir(l.url):void 0;return{store:t.storeFqdn,apiVersion:o,operation:l,userErrors:[],watchAborted:m.signal.aborted,results:S}}function ms(e,t){if(we(e)&&!t)throw new c(d`Bulk mutations require variables. Provide a JSONL file with ${u.yellow("--variable-file")} or individual JSON objects with ${u.yellow("--variables")}.`);if(!we(e)&&t)throw new c(d`The ${u.yellow("--variables")} and ${u.yellow("--variable-file")} flags can only be used with mutations, not queries.`)}n();async function wi(e,t){let{format:o,watch:r,outputFile:i}=t,{operation:a,userErrors:p,watchAborted:m,results:l}=e;if(!a&&p.length===0)throw ie({headline:"Bulk operation not created successfully.",body:"This is an unexpected error. Please try again later."}),new J("Bulk operation response returned null with no error message.");if(o==="json"){if(p.length||a&&["FAILED","CANCELED","EXPIRED"].includes(a.status)){let h=new c("Bulk operation failed.");throw h.details={...X(e),operation:a?Z(a):null,userErrors:p},h}if(!a)throw new J("Bulk operation response returned no operation.");let S=l!==void 0&&no(l),O=S?"partial":"success";if(m&&(O="cancelled"),S&&(process.exitCode=1),i&&l===void 0&&!m)throw new c("No results are available to write to the output file.");if(i&&l!==void 0){let h=G(i);await Fe(h,l),g(qe.encode({path:h,format:"jsonl"}))}else g(qe.encode({...X(e),status:O,...m?{reason:"watch-aborted"}:{},operation:Z(a),...l===void 0?{}:{resultsJsonl:l}}));return}if(i&&l!==void 0&&await Fe(i,l),p.length){W({headline:"Error creating bulk operation.",body:{list:{items:p.map(S=>S.field?`${S.field.join(".")}: ${S.message}`:S.message)}}});return}a&&(m?I({headline:`Bulk operation ${a.id} is still running in the background.`,body:Nt(a.id)}):r||["FAILED","CANCELED","EXPIRED"].includes(a.status)?ls(a,l,i):T({headline:"Bulk operation is running.",body:Nt(a.id),customSections:[{body:[{list:{items:[d`ID: ${u.cyan(a.id)}`.value]}}]}]}))}function ls(e,t,o){let r=mt(e).value,a=[{body:[{list:{items:[d`ID: ${u.cyan(e.id)}`.value,d`Status: ${u.yellow(e.status)}`.value,d`Created at: ${u.gray(String(e.createdAt))}`.value,...e.completedAt?[d`Completed at: ${u.gray(String(e.completedAt))}`.value]:[]]}}]}];switch(e.status){case"CREATED":T({headline:"Bulk operation started.",body:Nt(e.id),customSections:a});break;case"RUNNING":T({headline:"Bulk operation is running.",body:Nt(e.id),customSections:a});break;case"COMPLETED":if(t===void 0)T({headline:r,customSections:a});else{let p=no(t);o||g(t),p?ie({headline:"Bulk operation completed with errors.",body:o?`Results written to ${o}. Check file for error details.`:"Check results for error details.",customSections:a}):T({headline:r,body:o?[`Results written to ${o}`]:void 0,customSections:a})}break;case"CANCELED":case"CANCELING":case"EXPIRED":case"FAILED":W({headline:r,customSections:a});break}}function Nt(e){return[`Monitor its progress with:
83
+ Re-run this command if the stored token is missing, expires, or no longer has the scopes you need.`;static jsonOutputSchema=be;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --json"];static flags={...y,...w,store:b.store,scopes:ii.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0})};async run(){let{flags:t}=await this.parse(e);await Ot({store:t.store,scopes:t.scopes},{presenter:ve(t.json?"json":"text")})}};n();n();async function ai(e){let t=await br(e);return{store:e.adminSession.storeFqdn,apiVersion:e.version??se,operation:t?.bulkOperation??null,userErrors:t?.userErrors??[]}}n();async function Ae(e){le();let t=await $(e);return await N(t.store,!0),q(t.userId),{token:t.accessToken,storeFqdn:t.store}}n();n();var di=s.string().regex(/^gid:\/\/shopify\/BulkOperation\/[^/]+$/).describe("The Shopify global ID of a bulk operation."),pe=s.object({gid:di,type:s.string(),status:s.string(),errorCode:s.string().nullable(),createdAt:Wt,completedAt:Wt.nullable(),objectCount:s.string().regex(/^\d+$/).describe("A nonnegative decimal count, without loss of integer precision."),url:s.string().url().nullable(),partialDataUrl:s.string().url().nullable()}).strict(),mi=pe.omit({type:!0}),Tt=s.object({storeDomain:nt.nullable(),apiVersion:s.string().nullable().describe("The API version selected for the request.")}).strict(),Et=x({name:"CancelBulkOperationResult",schema:Tt.extend({status:s.literal("success"),operation:pe}),definitions:{BulkOperation:pe}}),si=Tt.extend({status:s.enum(["success","partial","cancelled"]),reason:s.literal("watch-aborted").optional(),operation:pe,resultsJsonl:s.string().optional().describe("Downloaded results in their native JSONL format.")}),ci=s.object({path:s.string().describe("The absolute path of the downloaded results file."),format:s.literal("jsonl")}).strict(),qe=x({name:"ExecuteBulkOperationResult",schema:s.union([si,ci]),definitions:{BulkOperation:pe,ExecuteBulkOperationResult:si,BulkOperationFile:ci}}),ui=Tt.extend({operationGid:di,operation:pe.nullable()}),pi=Tt.extend({operations:s.array(mi),pageInfo:s.object({hasNextPage:s.boolean().nullable().describe("Unknown when the API result reaches the fetch limit.")}).strict()}),_t=x({name:"BulkOperationStatusResult",schema:s.union([ui,pi]),definitions:{GetBulkOperationStatusResult:ui,ListBulkOperationsResult:pi,BulkOperation:pe,ListedBulkOperation:mi}});n();function X(e){let t=re(e.store);return{storeDomain:t?`${t}.myshopify.com`:null,apiVersion:e.apiVersion??null}}function Z(e){if(typeof e.objectCount=="number"&&!Number.isSafeInteger(e.objectCount))throw new J("Shopify returned a bulk operation count that can't be represented exactly.");return{gid:e.id,..."type"in e?{type:e.type}:{},status:e.status,errorCode:e.errorCode??null,createdAt:Qt(new Date(String(e.createdAt))),completedAt:e.completedAt?Qt(new Date(String(e.completedAt))):null,objectCount:String(e.objectCount),url:e.url??null,partialDataUrl:e.partialDataUrl??null}}function li(e,t,o){if(o==="json"){if(e.userErrors.length||!e.operation){let i=new c("Failed to cancel bulk operation.");throw i.details={...X(e),operationGid:t,userErrors:e.userErrors},i}g(Et.encode({...X(e),status:"success",operation:Z(e.operation)}));return}if(e.userErrors.length){vr(e.userErrors,"Failed to cancel bulk operation.");return}let r=e.operation;if(r){let i=Ar(r),a=r.status==="CANCELING"?[`This may take a few moments. Check the status with:
84
+ `,{command:`shopify store bulk status --id=${ye(r.id)}`}]:i.body,p={headline:i.headline,...a&&{body:a},...i.customSections&&{customSections:i.customSections}};switch(i.renderType){case"success":T(p);break;case"warning":ie(p);break;case"info":I(p);break}}else W({headline:"Bulk operation not found or could not be canceled.",body:d`ID: ${u.yellow(t)}`.value})}n();n();function fi(e){let{storeFqdn:t,version:o}=e,r=[`Store: ${t}`];return o&&r.push(`API version: ${o}`),r}function hi(e,t=!1){if(we(e)&&!t)throw new c("Mutations are disabled by default for shopify store bulk execute.","Re-run with --allow-mutations if you intend to modify store data.")}function xe(e,t){let o=[...t.operationId?[`ID: ${t.operationId}`]:[],...fi(t)];I({headline:e,body:[{list:{items:o}}]})}var $e=class e extends k{static summary="Cancel a bulk operation on a store.";static descriptionWithMarkdown="Cancels a running bulk operation by ID, using previously stored app authentication.\n\n Run `shopify store auth` first to create stored auth for the store.";static jsonOutputSchema=Et;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];static flags={...y,...w,store:b.store,id:ri};async run(){let{flags:t}=await this.parse(e),o=t.json?"json":"text",r=await Ae(t.store);xe("Canceling bulk operation.",{storeFqdn:r.storeFqdn,operationId:t.id});let i=await ai({adminSession:r,operationId:t.id});li(i,t.id,o)}};n();n();async function ps(e,t){if(e)return e.join(`
85
+ `);if(t){if(!await Ce(t))throw new c(d`Variable file not found at ${u.path(t)}. Please check the path and try again.`);return Ne(t,{encoding:"utf8"})}else return}async function Si(e){let{store:t,query:o,variables:r,variableFile:i,watch:a=!1,version:p,allowMutations:m=!1}=e;hi(o,m);let{adminSession:l,version:S}=await j({title:d`Authenticating`,task:async()=>{let h=await Ae(t),L=await Pe({adminSession:h,userSpecifiedVersion:p,minimumDefaultVersion:se});return{adminSession:h,version:L}},renderOptions:{stdout:process.stderr}}),O=await ps(r,i);return ds(o,O),{adminSession:l,version:S,query:o,variablesJsonl:O,watch:a}}async function gi(e){let{adminSession:t,version:o,query:r,variablesJsonl:i,watch:a}=e,p=we(r)?await yr({adminSession:t,query:r,variablesJsonl:i,version:o}):await gr({adminSession:t,query:r,version:o});if(p?.userErrors?.length||!p?.bulkOperation)return{store:t.storeFqdn,apiVersion:o,operation:p?.bulkOperation??null,userErrors:p?.userErrors??[],watchAborted:!1};let m=new Fo,l=a?await Or(t,p.bulkOperation.id,m.signal,()=>m.abort()):await xr(t,p.bulkOperation.id),S=a&&!m.signal.aborted&&l.status==="COMPLETED"&&l.url?await Ir(l.url):void 0;return{store:t.storeFqdn,apiVersion:o,operation:l,userErrors:[],watchAborted:m.signal.aborted,results:S}}function ds(e,t){if(we(e)&&!t)throw new c(d`Bulk mutations require variables. Provide a JSONL file with ${u.yellow("--variable-file")} or individual JSON objects with ${u.yellow("--variables")}.`);if(!we(e)&&t)throw new c(d`The ${u.yellow("--variables")} and ${u.yellow("--variable-file")} flags can only be used with mutations, not queries.`)}n();async function yi(e,t){let{format:o,watch:r,outputFile:i}=t,{operation:a,userErrors:p,watchAborted:m,results:l}=e;if(!a&&p.length===0)throw ie({headline:"Bulk operation not created successfully.",body:"This is an unexpected error. Please try again later."}),new J("Bulk operation response returned null with no error message.");if(o==="json"){if(p.length||a&&["FAILED","CANCELED","EXPIRED"].includes(a.status)){let h=new c("Bulk operation failed.");throw h.details={...X(e),operation:a?Z(a):null,userErrors:p},h}if(!a)throw new J("Bulk operation response returned no operation.");let S=l!==void 0&&no(l),O=S?"partial":"success";if(m&&(O="cancelled"),S&&(process.exitCode=1),i&&l===void 0&&!m)throw new c("No results are available to write to the output file.");if(i&&l!==void 0){let h=G(i);await Fe(h,l),g(qe.encode({path:h,format:"jsonl"}))}else g(qe.encode({...X(e),status:O,...m?{reason:"watch-aborted"}:{},operation:Z(a),...l===void 0?{}:{resultsJsonl:l}}));return}if(i&&l!==void 0&&await Fe(i,l),p.length){W({headline:"Error creating bulk operation.",body:{list:{items:p.map(S=>S.field?`${S.field.join(".")}: ${S.message}`:S.message)}}});return}a&&(m?I({headline:`Bulk operation ${a.id} is still running in the background.`,body:Nt(a.id)}):r||["FAILED","CANCELED","EXPIRED"].includes(a.status)?ms(a,l,i):T({headline:"Bulk operation is running.",body:Nt(a.id),customSections:[{body:[{list:{items:[d`ID: ${u.cyan(a.id)}`.value]}}]}]}))}function ms(e,t,o){let r=mt(e).value,a=[{body:[{list:{items:[d`ID: ${u.cyan(e.id)}`.value,d`Status: ${u.yellow(e.status)}`.value,d`Created at: ${u.gray(String(e.createdAt))}`.value,...e.completedAt?[d`Completed at: ${u.gray(String(e.completedAt))}`.value]:[]]}}]}];switch(e.status){case"CREATED":T({headline:"Bulk operation started.",body:Nt(e.id),customSections:a});break;case"RUNNING":T({headline:"Bulk operation is running.",body:Nt(e.id),customSections:a});break;case"COMPLETED":if(t===void 0)T({headline:r,customSections:a});else{let p=no(t);o||g(t),p?ie({headline:"Bulk operation completed with errors.",body:o?`Results written to ${o}. Check file for error details.`:"Check results for error details.",customSections:a}):T({headline:r,body:o?[`Results written to ${o}`]:void 0,customSections:a})}break;case"CANCELED":case"CANCELING":case"EXPIRED":case"FAILED":W({headline:r,customSections:a});break}}function Nt(e){return[`Monitor its progress with:
86
86
  `,{command:`shopify store bulk status --id=${ye(e)}`}]}var Ue=class e extends k{static summary="Execute bulk operations on a store.";static descriptionWithMarkdown=`Executes an Admin API GraphQL query or mutation on the specified store as a bulk operation, using previously stored app authentication.
87
87
 
88
88
  Run \`shopify store auth\` first to create stored auth for the store.
@@ -91,14 +91,14 @@ Re-run this command if the stored token is missing, expires, or no longer has th
91
91
 
92
92
  Mutations are disabled by default. Re-run with \`--allow-mutations\` if you intend to modify store data.
93
93
 
94
- Use [\`store bulk status\`](https://shopify.dev/docs/api/shopify-cli/store/store-bulk-status) to check the status of your bulk operations.`;static jsonOutputSchema=qe;static description=this.descriptionForHelp();static examples=['<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "query { products { edges { node { id } } } }"',"<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query-file ./operation.graphql --watch","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query-file ./mutation.graphql --variable-file ./variables.jsonl --allow-mutations"];static flags={...y,...w,store:b.store,...ii};async run(){let{flags:t}=await this.parse(e),o=await Sr({query:t.query,queryFile:t["query-file"]}),r=await gi({store:t.store,query:o,variables:t.variables,variableFile:t["variable-file"],watch:t.watch??!1,allowMutations:t["allow-mutations"],...t.version&&{version:t.version}}),i=t.json?"json":"text";xe("Starting bulk operation.",{storeFqdn:r.adminSession.storeFqdn,version:r.version});let a=await yi(r);await wi(a,{format:i,watch:r.watch,outputFile:t["output-file"]})}};n();n();async function ki(e){let t=await Pe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await wr({...e,version:t});return{store:e.adminSession.storeFqdn,apiVersion:t,operationId:e.operationId,operation:o??null}}async function bi(e){let t=await Pe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await kr({...e,version:t,first:100});return{store:e.adminSession.storeFqdn,apiVersion:t,operations:o}}n();function vi(e,t){if(t==="json"){g(_t.encode({...X(e),..."operation"in e?{operationGid:e.operationId,operation:e.operation?Z(e.operation):null}:{operations:e.operations.map(Z),pageInfo:{hasNextPage:e.operations.length<100?!1:null}}}));return}if("operation"in e){e.operation?fs(e.operation):W({headline:"Bulk operation not found.",body:d`ID: ${u.yellow(e.operationId)}`.value});return}let o=e.operations.map(r=>({id:ye(r.id),status:Ss(r.status),count:gs(r.objectCount),dateCreated:Yt(new Date(String(r.createdAt))),dateFinished:r.completedAt?Yt(new Date(String(r.completedAt))):"",results:ys(r.url??r.partialDataUrl)}));ro(),o.length===0?I({body:"No bulk operations found in the last 7 days."}):he({rows:o,columns:{id:{header:"ID",color:"yellow"},status:{header:"STATUS"},count:{header:"COUNT"},dateCreated:{header:"DATE CREATED",color:"cyan"},dateFinished:{header:"DATE FINISHED",color:"cyan"},results:{header:"RESULTS"}}}),ro()}function fs(e){let{id:t,status:o,createdAt:r,completedAt:i,url:a,partialDataUrl:p}=e,m=mt(e).value,l=hs(r,i),S=d`ID: ${u.yellow(t)}\n${l}`.value;if(o==="COMPLETED"){let O=a?u.link("Download results",a):"";T({headline:m,body:d`${S}\n${O}`.value})}else if(o==="FAILED"){let O=p?u.link("Download partial results",p):"";W({headline:m,body:d`${S}\n${O}`.value})}else I({headline:m,body:S})}function hs(e,t){let o=new Date;return t?`Finished ${Kt(new Date(String(t)),o)}`:`Started ${Kt(new Date(String(e)),o)}`}function Ss(e){return e==="COMPLETED"?st.green(e):e==="FAILED"?st.red(e):st.dim(e)}function gs(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function ys(e){return e?d`${u.link("download",e)}`.value:""}var ze=class e extends k{static summary="Check the status of bulk operations on a store.";static descriptionWithMarkdown="Check the status of a specific bulk operation by ID, or list all bulk operations on this store in the last 7 days, using previously stored app authentication.\n\n Run `shopify store auth` first to create stored auth for the store.\n\n Use [`store bulk execute`](https://shopify.dev/docs/api/shopify-cli/store/store-bulk-execute) to start a new bulk operation.";static jsonOutputSchema=_t;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];static flags={...y,...w,store:b.store,id:ri};async run(){let{flags:t}=await this.parse(e),o=t.json?"json":"text",r=await Ae(t.store);xe(t.id?"Checking bulk operation status.":"Listing bulk operations.",{storeFqdn:r.storeFqdn});let i=t.id?await ki({adminSession:r,operationId:t.id}):await bi({adminSession:r});vi(i,o)}};n();var fo=R(M(),1),Be=class e extends k{static hidden=!0;static summary="Authenticate for store commands.";static descriptionWithMarkdown="Authenticates to a store then stores an online access token for later reuse. Pass the provided JWT to --signup or stdin.";static jsonOutputSchema=be;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --signup <signup-jwt>","printf %s <signup-jwt> | <%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --signup <signup-jwt> --json"];static flags={...y,...w,store:b.store,scopes:fo.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0}),signup:fo.Flags.string({description:"Provide JWT for the store. When omitted, the JWT is read from stdin.",env:"SHOPIFY_FLAG_SIGNUP",required:!1})};async run(){let{flags:t}=await this.parse(e),o=ks(t.signup)??await bs();await Ot({store:t.store,scopes:t.scopes,signup:o},{presenter:ve(t.json?"json":"text")})}},ws=8*1024,Ai="Missing signup JWT.",xi="Pass --signup <jwt>, set SHOPIFY_FLAG_SIGNUP, or pipe the JWT to stdin.";function ks(e){let t=e?.trim();return t===""?void 0:t}async function bs(e=process.stdin){if(e===process.stdin&&!Uo())throw new c(Ai,xi);let t=[],o=0;for await(let i of e){let a=Buffer.isBuffer(i)?i:Buffer.from(i);if(o+=a.length,o>ws)throw new c("The input piped to stdin is too large to be a signup JWT.","Pipe only the signup JWT.");t.push(a)}let r=Buffer.concat(t).toString("utf8").trim();if(!r)throw new c(Ai,xi);return r}n();n();n();var Oe=s.object({error:s.literal(!0),message:s.string(),nextSteps:s.array(s.unknown()).describe("Suggested next steps, as text or formatted UI tokens."),exitCode:s.literal(1)});var ho=x({name:"CreateDevStoreResult",schema:s.union([ao.schema,Oe]),definitions:{...ao.definitions,StoreCommandError:Oe}});n();var Oi={basic:"basic",professional:"grow",grow:"grow",unlimited:"advanced",advanced:"advanced",shopify_plus:"plus",plus:"plus"};n();var Ii=Fr,Ti=Cr,Ei=Pr;var je=R(M(),1),He=class e extends Q{static summary="Create a new dev store.";static descriptionWithMarkdown="Creates a new dev store in your organization.";static jsonOutputSchema=ho;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>",'<%= config.bin %> <%= command.id %> --name "Lavender Candles" --organization-id 1234567 --plan basic','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --organization-id 1234567 --plan basic --demo-data','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --organization-id 1234567 --plan basic --json'];static flags={...y,...w,name:dt(je.Flags.string({description:"Name for the new dev store.",env:"SHOPIFY_FLAG_STORE_NAME"})),"organization-id":dt(b["organization-id"]),plan:dt(je.Flags.string({description:"The Shopify plan to use for the new dev store.",options:io,env:"SHOPIFY_FLAG_STORE_PLAN"})),"feature-preview":je.Flags.string({description:"The handle of a feature preview to enable on the new dev store.",env:"SHOPIFY_FLAG_STORE_FEATURE_PREVIEW"}),"demo-data":je.Flags.boolean({description:"Populate the new dev store with demo data.",allowNo:!0,env:"SHOPIFY_FLAG_STORE_DEMO_DATA"}),country:It};async run(){let{flags:t}=await this.parse(e),o=await ft(t["organization-id"]?.toString()),r=t.name??await Ii(),i=t.plan??await Ti(),a=t["demo-data"]??(pt()?await Ei():!1);try{await so({name:r,organization:o,plan:i,featurePreview:t["feature-preview"],withDemoData:a,country:t.country,json:t.json})}catch(p){throw t.json&&p instanceof c&&(g(ho.encode({error:!0,message:p.message,nextSteps:p.nextSteps??[],exitCode:1})),process.exit(1)),p}}};n();n();n();var vs="X-Shopify-CLI-Instance",As="X-Shopify-CLI-Version",_i;function xs(){return _i??=new Co({projectName:"shopify-cli-store"}),_i}var Me=class extends c{status;constructor(t,o,r){super(o,r??null),this.status=t}};function Ni(e=xs()){let t=e.get("cliInstanceId");if(typeof t=="string"&&t.length>0)return t;let o=it();return e.set("cliInstanceId",o),o}function Fi(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":`Shopify CLI; v=${Vt}`,[vs]:e,[As]:Vt}}function Os(e){return Fi(e)}function Is(e,t){return{...Fi(e),authorization:t,"X-Shopify-Access-Token":t}}async function Ci(e,t={}){let r=`https://${await eo()}/services/preview-stores`,i=JSON.stringify({...e.name?{name:e.name}:{},...e.country?{variables:{storeCreatePayload:{country:e.country}}}:{}}),a=await Zt(r,{method:"POST",headers:Os(Ni(t.storage)),body:i}),p=await a.text();if(!a.ok){let l=Ts(a.status,p);throw new c(l.message,l.tryMessage)}let m;try{m=JSON.parse(p)}catch(l){let S=l instanceof Error?l.message:"Unknown error";throw new c("Preview store creation returned a non-JSON response.",`Parse error: ${S}. Body (truncated): ${Ft(p).slice(0,500)}`)}return _s(m)}async function Pi(e,t={}){let r=`https://${await eo()}/services/preview-stores/${e.shopId}`,i=await Zt(r,{method:"GET",headers:Is(Ni(t.storage),e.adminApiToken)}),a=await i.text();if(!i.ok){let m=Es(i.status,a);throw new Me(i.status,m.message,m.tryMessage)}let p;try{p=JSON.parse(a)}catch(m){let l=m instanceof Error?m.message:"Unknown error";throw new c("Preview store lookup returned a non-JSON response.",`Parse error: ${l}. Body (truncated): ${Ft(a).slice(0,500)}`)}return Ns(p)}function Ts(e,t){let o=Di(t),r=o.error_code,i=o.message;if(r==="not_in_rollout")return{message:"Preview store creation is not enabled yet.",tryMessage:"Try again later."};if(r==="service_unavailable")return{message:"Preview store creation is temporarily unavailable.",tryMessage:"Try again later."};if(r==="rate_limited")return{message:"Too many preview store creation requests.",tryMessage:"Try again later."};if(r==="preview_store_create_failed")return{message:"Preview store creation failed.",tryMessage:"Try again later."};if(r==="shop_name_banned_keyword"||r==="shop_name_invalid")return{message:"The preview store name was rejected.",tryMessage:"Use a different store name and try again."};if(r==="country_invalid")return{message:"The preview store country was rejected.",tryMessage:"Use a different country and try again."};let a=Ft(t);return{message:`Preview store creation failed with HTTP ${e}.`,tryMessage:i??(a.length>0?a.slice(0,1e3):"No response body returned.")}}function Di(e){if(e.length===0)return{};try{let t=JSON.parse(e);if(!t||typeof t!="object")return{};let o=t;return{...typeof o.error_code=="string"?{error_code:o.error_code}:{},...typeof o.message=="string"?{message:o.message}:{}}}catch(t){if(t instanceof SyntaxError)return{};throw t}}function Es(e,t){let o=Di(t),r=Ft(t);return{message:`Preview store lookup failed with HTTP ${e}.`,tryMessage:o.message??(r.length>0?r.slice(0,1e3):"No response body returned.")}}function _s(e){let t=e.shop,o=typeof t?.id=="string"||typeof t?.id=="number"?String(t.id):void 0,r=typeof t?.name=="string"?t.name:void 0,i=typeof t?.domain=="string"?_(t.domain):void 0,a=typeof e.admin_api_token=="string"?e.admin_api_token:void 0,p=typeof e.access_url=="string"?e.access_url:void 0,m=typeof e.placeholder_account_uuid=="string"?e.placeholder_account_uuid:void 0,l=Array.isArray(e.admin_api_scopes)?e.admin_api_scopes.filter(S=>typeof S=="string"):void 0;if(!o||!r||!i||!a||!p||!l)throw new c("Preview store creation response is missing required fields.",`Got: ${JSON.stringify(Fs(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},adminApiToken:a,adminApiScopes:l,accessUrl:p,...m?{placeholderAccountUuid:m}:{}}}function Ns(e){let t=e.shop,o=typeof t?.id=="string"||typeof t?.id=="number"?String(t.id):void 0,r=typeof t?.name=="string"?t.name:void 0,i=typeof t?.domain=="string"?_(t.domain):void 0,a=typeof e.access_url=="string"?e.access_url:void 0,p=typeof e.claim_url=="string"?e.claim_url:void 0;if(!o||!r||!i||!a)throw new c("Preview store lookup response is missing required fields.",`Got: ${JSON.stringify(Cs(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},accessUrl:a,...p?{claimUrl:p}:{}}}function Fs(e){return{...e,...e.admin_api_token?{admin_api_token:"[REDACTED]"}:{},...e.access_url?{access_url:"[REDACTED]"}:{}}}function Ft(e){return e.replace(/(["']?(?:admin_api_token|adminApiToken)["']?\s*:\s*["'])[^"']+/gi,"$1[REDACTED]").replace(/(["']?(?:access_url|accessUrl|claim_url|claimUrl)["']?\s*:\s*["'])[^"']+/gi,"$1[REDACTED]").replace(/([?&](?:token|access_token)=)[^&\s"'<>]+/gi,"$1[REDACTED]")}function Cs(e){return{...e,...e.access_url?{access_url:"[REDACTED]"}:{},...e.claim_url?{claim_url:"[REDACTED]"}:{}}}var Ps={createPreviewStore:Ci,setStoredStoreAppSession:Se,recordStoreFqdnMetadata:N,setLastSeenUserId:q,now:()=>new Date};async function Li(e,t={}){let o={...Ps,...t},r=await o.createPreviewStore({name:e.name,country:e.country},e.client);return Ls(r,e.country,o)}function Ds(e){return e.placeholderAccountUuid??e.shop.id}async function Ls(e,t,o){let r=o.now().toISOString(),i=Ds(e);o.setStoredStoreAppSession({store:e.shop.domain,clientId:H,userId:i,accessToken:e.adminApiToken,scopes:e.adminApiScopes,acquiredAt:r,kind:"preview",preview:{shopId:e.shop.id,name:e.shop.name,createdAt:r,...e.placeholderAccountUuid?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...t?{country:t}:{},accessUrl:e.accessUrl}}),o.setLastSeenUserId(i);try{await o.recordStoreFqdnMetadata(e.shop.domain,!0,e.shop.id)}catch{}return{status:"success",message:`Your Shopify store "${e.shop.name}" is ready. This store is temporary. Create a free Shopify account to save it and start selling.`,store:{id:e.shop.id,name:e.shop.name,subdomain:e.shop.domain,...t?{country:t}:{},storefrontUrl:e.accessUrl,type:"preview",authScopes:e.adminApiScopes},next_steps:Rs(e.shop.domain)}}function Rs(e){return[`Use \`shopify store open --store ${e}\` to preview the storefront.`,`Use \`shopify store execute --store ${e}\` to add products, collections, pages, and more.`,`Use \`shopify theme pull --store ${e}\` and \`shopify theme push --store ${e}\` to edit your store design.`]}n();n();var Ri=A.pick({id:!0,name:!0,subdomain:!0,country:!0}).extend({storefrontUrl:s.string(),type:s.literal("preview").optional(),authScopes:A.shape.authScopes.describe("Preapproved Admin API scopes for the preview store.")}),Ct=x({name:"CreatePreviewStoreResult",schema:s.object({status:s.literal("success"),message:s.string(),store:Ri,next_steps:s.array(s.string())}),definitions:{PreviewStore:Ri}});function qi(e,t){if(t==="json"){g(Ct.encode(e));return}$s(e)}function qs(e){return e.split(/(`[^`]+`)/).map(t=>t.startsWith("`")&&t.endsWith("`")?{command:t.slice(1,-1)}:t)}function $s(e){T({headline:"Store created",customSections:[{body:e.message},{title:"Next steps",body:{list:{items:e.next_steps.map(qs)}}}]})}var $i=R(M(),1),Ge=class e extends k{static summary="Create a preview Shopify store.";static descriptionWithMarkdown="Creates a new Shopify store, with no need for an existing account.";static jsonOutputSchema=Ct;static description=this.descriptionForHelp();static examples=['<%= config.bin %> <%= command.id %> --name "Lavender Candles"','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --country US','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --json'];static flags={...y,...w,name:$i.Flags.string({description:"The name of the store.",env:"SHOPIFY_FLAG_PREVIEW_STORE_NAME",required:!1}),country:It};async run(){let{flags:t}=await this.parse(e),o=await j({title:d`Creating store`,task:async()=>Li({name:t.name,country:t.country})});qi(o,t.json?"json":"text")}};n();n();var Ui=s.object({domain:A.shape.subdomain,deletionRequested:s.literal(!0),deletionConfirmed:s.boolean()}),Je=x({name:"DeleteDevStoreResult",schema:s.union([s.object({store:Ui,organization:ce,message:s.string().optional()}),Oe]),definitions:{DeletedStore:Ui,StoreOrganization:ce,StoreCommandError:Oe}});n();n();n();n();var zi={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"StoreInfoShop"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"search"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"accessibleShops"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"5"}},{kind:"Argument",name:{kind:"Name",value:"search"},value:{kind:"Variable",name:{kind:"Name",value:"search"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"edges"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"node"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shopifyShopId"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"primaryDomain"}},{kind:"Field",name:{kind:"Name",value:"storeType"}},{kind:"Field",name:{kind:"Name",value:"developerPreviewHandle"}},{kind:"Field",name:{kind:"Name",value:"planName"}},{kind:"Field",name:{kind:"Name",value:"ownerDetails"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"fullName"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function Bi(e){let t=await Ve(e);if(!t)throw new c(`Couldn't find shop ${e.store} inside organization ${e.organizationId}.`,"The shop matched a global lookup but is not listed under its parent organization. This usually means the search index is stale; try again in a moment.");return t}async function Ve(e){let t=e.token??await B([],{noPrompt:e.noPrompt,allowAutomationToken:!0}),o=V({noPrompt:e.noPrompt}),r={id:e.organizationId,businessName:e.organizationName},a=(await K(r,{query:zi,token:t,variables:{search:e.store},unauthorizedHandler:o})).organization?.accessibleShops?.edges??[],p=e.store.toLowerCase(),m=a.find(l=>z(l.node.primaryDomain)===p)?.node;if(m)return{shopifyShopId:m.shopifyShopId??void 0,name:m.name,primaryDomain:m.primaryDomain??void 0,storeType:m.storeType??void 0,developerPreviewHandle:m.developerPreviewHandle??void 0,planName:m.planName??void 0,ownerName:m.ownerDetails?.fullName??void 0,ownerEmail:m.ownerDetails?.email??void 0}}n();var ji={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteAppDevelopmentStore"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"storeFqdn"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deleteAppDevelopmentStore"},arguments:[{kind:"Argument",name:{kind:"Name",value:"storeFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"storeFqdn"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"success"}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};n();var Hi={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"OrganizationAccessibleShop"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ShopifyShopID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"accessibleShop"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shopifyShopId"}},{kind:"Field",name:{kind:"Name",value:"planName"}},{kind:"Field",name:{kind:"Name",value:"storeType"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var Us="cancelled",zs=5,Bs=300*1e3;async function Gi(e){let{organization:t,store:o}=e,r=await B([],{allowAutomationToken:!0}),i=V(),a=await Mi({store:o,organization:t,token:r}),m=(await K(t,{query:ji,token:r,variables:{storeFqdn:o},unauthorizedHandler:i})).deleteAppDevelopmentStore;if(!m)throw new c("Store deletion failed: unexpected empty response.");let l=m.userErrors;if(l&&l.length>0){let O=l.map(h=>h.message).join(", ");throw new c(`Failed to delete dev store: ${O}`)}if(m.success===!1)throw new c("Store deletion failed.");a??=await Mi({store:o,organization:t,token:r});let S=a?await Hs({shopifyShopId:a,organization:t,token:r,unauthorizedHandler:i}):!1;e.json?g(Gs({store:o,organization:t,deletionConfirmed:S})):S?T({headline:`Dev store "${o}" deleted successfully.`,body:["The store was deleted."]}):ie({headline:`Dev store "${o}" deletion was requested, but not confirmed.`,body:["Shopify accepted the deletion request, but deletion was not confirmed before the CLI stopped waiting.","The store may still finish deleting asynchronously."]})}async function Mi(e){let{store:t,organization:o,token:r}=e;return(await Ve({store:t,organizationId:o.id,organizationName:o.businessName,token:r}))?.shopifyShopId}function js(e){let t=String(e),o=t.match(/^(?:gid:\/\/shopify\/Shop\/)?(\d+)$/)?.[1];if(!o)throw new Error(`Invalid Shopify shop ID: ${t}`);return Buffer.from(`gid://organization/ShopifyShop/${o}`).toString("base64url")}async function Hs(e){let t=js(e.shopifyShopId);return j({title:d`Dev store deletion requested. Waiting for deletion confirmation`,task:async o=>{let r=Date.now();for(;;){if(Date.now()-r>Bs)return!1;if((await K(e.organization,{query:Hi,token:e.token,variables:{id:t},unauthorizedHandler:e.unauthorizedHandler})).organization?.accessibleShop?.planName?.toLowerCase()===Us.toLowerCase())return!0;o(d`${Ms()}`),await $o(zs)}},renderOptions:{stdout:process.stderr}})}function Ms(){return"Waiting for deletion confirmation"}function Gs(e){let{store:t,organization:o,deletionConfirmed:r}=e;return Je.encode({store:{domain:t,deletionRequested:!0,deletionConfirmed:r},organization:{id:o.id,name:o.businessName},...r?{}:{message:"Deletion was requested, but has not been confirmed yet. The store may still finish deleting asynchronously."}})}n();n();n();var Ji={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"StoreInfoDestinations"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"search"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"currentUserAccount"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"destinations"},arguments:[{kind:"Argument",name:{kind:"Name",value:"search"},value:{kind:"Variable",name:{kind:"Name",value:"search"}}},{kind:"Argument",name:{kind:"Name",value:"shopsOnly"},value:{kind:"BooleanValue",value:!0}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"25"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"publicId"}},{kind:"Field",name:{kind:"Name",value:"primaryDomain"}},{kind:"Field",name:{kind:"Name",value:"webUrl"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};n();var Vi={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"StoreInfoOwningOrg"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"destinationPublicId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"DestinationPublicID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"currentUserAccount"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organizationForDestination"},arguments:[{kind:"Argument",name:{kind:"Name",value:"destinationPublicId"},value:{kind:"Variable",name:{kind:"Name",value:"destinationPublicId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var Ie=class extends c{};async function Pt(e){let t=e.token??await B([],{noPrompt:e.noPrompt,allowAutomationToken:!0}),o=V({noPrompt:e.noPrompt}),r=z(e.store)??e.store.toLowerCase(),i=r.split(".")[0]??r,m=((await to({query:Ji,token:t,variables:{search:i},unauthorizedHandler:o})).currentUserAccount?.destinations.nodes??[]).find(S=>Ws(S,r));if(!m)throw new Ie(`Couldn't find a store with domain ${e.store} for the current account.`,Js());let l=await Vs(String(m.publicId),t,o);return{...l?{owningOrg:l}:{}}}function Js(){let e="Check the domain (it must be the permanent `myshopify.com` domain)";return at()?`${e} and that the service account has access to the store: it can open the stores it created, or any store in an organization where it has Dev store management access. Inactive stores aren't searchable.`:`${e} and that you're logged in to an account with access to the store. Inactive stores aren't searchable.`}async function Vs(e,t,o){try{let i=(await to({query:Vi,token:t,variables:{destinationPublicId:e},unauthorizedHandler:o})).currentUserAccount?.organizationForDestination;if(!i){f(`No owning organization returned for destination ${e}.`);return}let a=i.id?Tr(i.id):void 0;return{name:i.name,...a?{id:a}:{}}}catch(r){f(`Failed to resolve owning organization: ${Qs(r)}`);return}}function Ws(e,t){return[e.primaryDomain,e.webUrl].some(o=>z(o)===t)}function Qs(e){return e instanceof Error?e.message:String(e)}async function Ys(e){let{store:t}=e;try{let r=(await Pt(e)).owningOrg;if(!r?.id){f(`Could not infer an owning organization ID for ${t}.`);return}return{id:r.id,businessName:r.name}}catch(o){f(`Could not infer the owning organization for ${t}: ${Ks(o)}`);return}}function Ks(e){return e instanceof Error?e.message:String(e)}async function Wi(e,t){if(t)return ft(t);let o=pt(),r=await Ys({store:e,noPrompt:!o});if(r)return r;let i=await B([],{noPrompt:!o,allowAutomationToken:!0}),{organizations:a}=await lt(i);if(a.length===1)return f(`Using ${a[0].businessName}, the only organization the account belongs to, for ${e}.`),a[0];if(a.length===0)throw new c("No organizations found.","Make sure you have access to a Shopify organization.");if(!o)throw new c(`Could not determine which organization owns ${e}.`,"Provide `--organization-id`, for example `--organization-id 1234567`. Run `shopify organization list` to find IDs.");return I({headline:`Could not determine which organization owns ${e}.`,body:["Select one below, or specify it with",{command:"--organization-id"},{char:"."}]}),Nr(a)}var Qi=R(M(),1),We=class e extends Q{static summary="Delete a dev store.";static descriptionWithMarkdown="Deletes a dev store from your organization.";static jsonOutputSchema=Je;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --organization-id 1234567","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --organization-id 1234567 --json","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --organization-id 1234567 --force"];static flags={...y,...w,store:b.store,"organization-id":b["organization-id"],force:Qi.Flags.boolean({char:"f",description:"Skip confirmation. Required if non interactive.",env:"SHOPIFY_FLAG_FORCE",default:!1})};async run(){let{flags:t}=await this.parse(e);try{if(!t.force&&!ct())throw new c(`Deleting the dev store ${t.store} requires confirmation.`,null,["Use the `--force` flag to skip confirmation when running non-interactively."]);let o=await Wi(t.store,t["organization-id"]?.toString());if(!t.force&&!await Ro({message:`Delete dev store ${t.store}? This can't be undone.`,confirmation:t.store}))throw new qo;await Gi({store:t.store,organization:o,json:t.json})}catch(o){throw t.json&&o instanceof c&&(g(Je.encode({error:!0,message:o.message,nextSteps:o.nextSteps??[],exitCode:1})),process.exit(1)),o}}};n();n();n();var Ki=R(_a(),1);async function Xs(e){if(e.query!==void 0){if(!e.query.trim())throw new c("The --query flag value is empty. Please provide a valid GraphQL query or mutation.");return e.query}if(e.queryFile){if(!await Ce(e.queryFile))throw new c(d`Query file not found at ${u.path(e.queryFile)}. Please check the path and try again.`);let t=await Ne(e.queryFile,{encoding:"utf8"});if(!t.trim())throw new c(d`Query file at ${u.path(e.queryFile)} is empty. Please provide a valid GraphQL query or mutation.`);return t}throw new J("Query should have been provided via --query or --query-file flags due to exactlyOne constraint. This indicates the oclif flag validation failed.")}function Yi(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new c(d`Invalid variables in ${t}: expected a non-null JSON object.`,"Please provide a JSON object for variables.");return e}async function Zs(e,t){if(e!==void 0){if(!e.trim())throw new c(d`The ${u.yellow("--variables")} flag value is empty.`,"Please provide a non-null JSON object for variables.");try{return Yi(JSON.parse(e),u.yellow("--variables"))}catch(o){if(o instanceof c)throw o;let r=o instanceof Error?o.message:"Unknown error";throw new c(d`Invalid JSON in ${u.yellow("--variables")} flag: ${r}`,"Please provide valid JSON format.")}}else if(t){if(!await Ce(t))throw new c(d`Variable file not found at ${u.path(t)}. Please check the path and try again.`);let o=await Ne(t,{encoding:"utf8"});try{return Yi(JSON.parse(o),u.path(t))}catch(r){if(r instanceof c)throw r;let i=r instanceof Error?r.message:"Unknown error";throw new c(d`Invalid JSON in variable file ${u.path(t)}: ${i}`,"Please provide valid JSON format.")}}}function ec(e){let t;try{t=(0,Ki.parse)(e)}catch(r){throw r instanceof Error?new c(`Invalid GraphQL syntax: ${r.message}`):r}let o=t.definitions.filter(r=>r.kind==="OperationDefinition");if(o.length!==1)throw new c("GraphQL document must contain exactly one operation definition. Multiple operations are not supported.");return{operationDefinition:o[0]}}function tc(e){return e.operationDefinition.operation==="mutation"}function oc(e,t=!1){if(tc(e)&&!t)throw new c("Mutations are disabled by default for shopify store execute.","Re-run with --allow-mutations if you intend to modify store data.")}async function Xi(e){let t=await Xs({query:e.query,queryFile:e.queryFile}),o=ec(t);oc(o,e.allowMutations);let r=await Zs(e.variables,e.variableFile);return{query:t,parsedOperation:o,parsedVariables:r,requestedVersion:e.version}}n();n();n();n();var Te=x({name:"StoreExecuteResult",schema:s.object({data:s.record(s.unknown()).nullable().describe("GraphQL response data, preserving query fields and aliases."),extensions:s.record(s.unknown()).optional().describe("Response-level GraphQL metadata, when returned by the API.")}).strict()});n();function Dt(e){if(!e||typeof e!="object"||!("response"in e))return!1;let t=e.response;return!!t&&typeof t=="object"}function Zi(e){if(!Dt(e))return;let t=e.response.status;return typeof t=="number"?t:void 0}var ea=["the user aborted a request","the operation was aborted"];function rc(e){if(!(e instanceof Error))return!1;if(e.name==="AbortError")return!0;let t=e.message.toLowerCase();return ea.some(o=>t.includes(o))}function Qe(e,t){if(Zi(e)===402)return new c(`The store ${t} is currently unavailable.`,"Check the store in the Shopify admin and try again once it is reactivated.");if(rc(e))return new c(`Request to ${t} was aborted before it completed.`)}function Ye(e,t){let o=Zi(e);o!==401&&o!==404||(ge(t.store,t.userId),xt(t))}var nc=`
94
+ Use [\`store bulk status\`](https://shopify.dev/docs/api/shopify-cli/store/store-bulk-status) to check the status of your bulk operations.`;static jsonOutputSchema=qe;static description=this.descriptionForHelp();static examples=['<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "query { products { edges { node { id } } } }"',"<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query-file ./operation.graphql --watch","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query-file ./mutation.graphql --variable-file ./variables.jsonl --allow-mutations"];static flags={...y,...w,store:b.store,...ni};async run(){let{flags:t}=await this.parse(e),o=await Sr({query:t.query,queryFile:t["query-file"]}),r=await Si({store:t.store,query:o,variables:t.variables,variableFile:t["variable-file"],watch:t.watch??!1,allowMutations:t["allow-mutations"],...t.version&&{version:t.version}}),i=t.json?"json":"text";xe("Starting bulk operation.",{storeFqdn:r.adminSession.storeFqdn,version:r.version});let a=await gi(r);await yi(a,{format:i,watch:r.watch,outputFile:t["output-file"]})}};n();n();async function wi(e){let t=await Pe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await wr({...e,version:t});return{store:e.adminSession.storeFqdn,apiVersion:t,operationId:e.operationId,operation:o??null}}async function ki(e){let t=await Pe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await kr({...e,version:t,first:100});return{store:e.adminSession.storeFqdn,apiVersion:t,operations:o}}n();function bi(e,t){if(t==="json"){g(_t.encode({...X(e),..."operation"in e?{operationGid:e.operationId,operation:e.operation?Z(e.operation):null}:{operations:e.operations.map(Z),pageInfo:{hasNextPage:e.operations.length<100?!1:null}}}));return}if("operation"in e){e.operation?ls(e.operation):W({headline:"Bulk operation not found.",body:d`ID: ${u.yellow(e.operationId)}`.value});return}let o=e.operations.map(r=>({id:ye(r.id),status:hs(r.status),count:Ss(r.objectCount),dateCreated:Yt(new Date(String(r.createdAt))),dateFinished:r.completedAt?Yt(new Date(String(r.completedAt))):"",results:gs(r.url??r.partialDataUrl)}));ro(),o.length===0?I({body:"No bulk operations found in the last 7 days."}):he({rows:o,columns:{id:{header:"ID",color:"yellow"},status:{header:"STATUS"},count:{header:"COUNT"},dateCreated:{header:"DATE CREATED",color:"cyan"},dateFinished:{header:"DATE FINISHED",color:"cyan"},results:{header:"RESULTS"}}}),ro()}function ls(e){let{id:t,status:o,createdAt:r,completedAt:i,url:a,partialDataUrl:p}=e,m=mt(e).value,l=fs(r,i),S=d`ID: ${u.yellow(t)}\n${l}`.value;if(o==="COMPLETED"){let O=a?u.link("Download results",a):"";T({headline:m,body:d`${S}\n${O}`.value})}else if(o==="FAILED"){let O=p?u.link("Download partial results",p):"";W({headline:m,body:d`${S}\n${O}`.value})}else I({headline:m,body:S})}function fs(e,t){let o=new Date;return t?`Finished ${Kt(new Date(String(t)),o)}`:`Started ${Kt(new Date(String(e)),o)}`}function hs(e){return e==="COMPLETED"?st.green(e):e==="FAILED"?st.red(e):st.dim(e)}function Ss(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function gs(e){return e?d`${u.link("download",e)}`.value:""}var ze=class e extends k{static summary="Check the status of bulk operations on a store.";static descriptionWithMarkdown="Check the status of a specific bulk operation by ID, or list all bulk operations on this store in the last 7 days, using previously stored app authentication.\n\n Run `shopify store auth` first to create stored auth for the store.\n\n Use [`store bulk execute`](https://shopify.dev/docs/api/shopify-cli/store/store-bulk-execute) to start a new bulk operation.";static jsonOutputSchema=_t;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];static flags={...y,...w,store:b.store,id:oi};async run(){let{flags:t}=await this.parse(e),o=t.json?"json":"text",r=await Ae(t.store);xe(t.id?"Checking bulk operation status.":"Listing bulk operations.",{storeFqdn:r.storeFqdn});let i=t.id?await wi({adminSession:r,operationId:t.id}):await ki({adminSession:r});bi(i,o)}};n();var fo=R(M(),1),Be=class e extends k{static hidden=!0;static summary="Authenticate for store commands.";static descriptionWithMarkdown="Authenticates to a store then stores an online access token for later reuse. Pass the provided JWT to --signup or stdin.";static jsonOutputSchema=be;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --signup <signup-jwt>","printf %s <signup-jwt> | <%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --signup <signup-jwt> --json"];static flags={...y,...w,store:b.store,scopes:fo.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0}),signup:fo.Flags.string({description:"Provide JWT for the store. When omitted, the JWT is read from stdin.",env:"SHOPIFY_FLAG_SIGNUP",required:!1})};async run(){let{flags:t}=await this.parse(e),o=ws(t.signup)??await ks();await Ot({store:t.store,scopes:t.scopes,signup:o},{presenter:ve(t.json?"json":"text")})}},ys=8*1024,vi="Missing signup JWT.",Ai="Pass --signup <jwt>, set SHOPIFY_FLAG_SIGNUP, or pipe the JWT to stdin.";function ws(e){let t=e?.trim();return t===""?void 0:t}async function ks(e=process.stdin){if(e===process.stdin&&!Uo())throw new c(vi,Ai);let t=[],o=0;for await(let i of e){let a=Buffer.isBuffer(i)?i:Buffer.from(i);if(o+=a.length,o>ys)throw new c("The input piped to stdin is too large to be a signup JWT.","Pipe only the signup JWT.");t.push(a)}let r=Buffer.concat(t).toString("utf8").trim();if(!r)throw new c(vi,Ai);return r}n();n();n();var Oe=s.object({error:s.literal(!0),message:s.string(),nextSteps:s.array(s.unknown()).describe("Suggested next steps, as text or formatted UI tokens."),exitCode:s.literal(1)});var ho=x({name:"CreateDevStoreResult",schema:s.union([ao.schema,Oe]),definitions:{...ao.definitions,StoreCommandError:Oe}});n();var xi={basic:"basic",professional:"grow",grow:"grow",unlimited:"advanced",advanced:"advanced",shopify_plus:"plus",plus:"plus"};n();var Oi=Fr,Ii=Cr,Ti=Pr;var je=R(M(),1),He=class e extends Q{static summary="Create a new dev store.";static descriptionWithMarkdown="Creates a new dev store in your organization.";static jsonOutputSchema=ho;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>",'<%= config.bin %> <%= command.id %> --name "Lavender Candles" --organization-id 1234567 --plan basic','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --organization-id 1234567 --plan basic --demo-data','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --organization-id 1234567 --plan basic --json'];static flags={...y,...w,name:dt(je.Flags.string({description:"Name for the new dev store.",env:"SHOPIFY_FLAG_STORE_NAME"})),"organization-id":dt(b["organization-id"]),plan:dt(je.Flags.string({description:"The Shopify plan to use for the new dev store.",options:io,env:"SHOPIFY_FLAG_STORE_PLAN"})),"feature-preview":je.Flags.string({description:"The handle of a feature preview to enable on the new dev store.",env:"SHOPIFY_FLAG_STORE_FEATURE_PREVIEW"}),"demo-data":je.Flags.boolean({description:"Populate the new dev store with demo data.",allowNo:!0,env:"SHOPIFY_FLAG_STORE_DEMO_DATA"}),country:It};async run(){let{flags:t}=await this.parse(e),o=await ft(t["organization-id"]?.toString()),r=t.name??await Oi(),i=t.plan??await Ii(),a=t["demo-data"]??(pt()?await Ti():!1);try{await so({name:r,organization:o,plan:i,featurePreview:t["feature-preview"],withDemoData:a,country:t.country,json:t.json})}catch(p){throw t.json&&p instanceof c&&(g(ho.encode({error:!0,message:p.message,nextSteps:p.nextSteps??[],exitCode:1})),process.exit(1)),p}}};n();n();n();var bs="X-Shopify-CLI-Instance",vs="X-Shopify-CLI-Version",Ei;function As(){return Ei??=new Co({projectName:"shopify-cli-store"}),Ei}var Me=class extends c{status;constructor(t,o,r){super(o,r??null),this.status=t}};function _i(e=As()){let t=e.get("cliInstanceId");if(typeof t=="string"&&t.length>0)return t;let o=it();return e.set("cliInstanceId",o),o}function Ni(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":`Shopify CLI; v=${Vt}`,[bs]:e,[vs]:Vt}}function xs(e){return Ni(e)}function Os(e,t){return{...Ni(e),authorization:t,"X-Shopify-Access-Token":t}}async function Fi(e,t={}){let r=`https://${await eo()}/services/preview-stores`,i=JSON.stringify({...e.name?{name:e.name}:{},...e.country?{variables:{storeCreatePayload:{country:e.country}}}:{}}),a=await Zt(r,{method:"POST",headers:xs(_i(t.storage)),body:i}),p=await a.text();if(!a.ok){let l=Is(a.status,p);throw new c(l.message,l.tryMessage)}let m;try{m=JSON.parse(p)}catch(l){let S=l instanceof Error?l.message:"Unknown error";throw new c("Preview store creation returned a non-JSON response.",`Parse error: ${S}. Body (truncated): ${Ft(p).slice(0,500)}`)}return Es(m)}async function Ci(e,t={}){let r=`https://${await eo()}/services/preview-stores/${e.shopId}`,i=await Zt(r,{method:"GET",headers:Os(_i(t.storage),e.adminApiToken)}),a=await i.text();if(!i.ok){let m=Ts(i.status,a);throw new Me(i.status,m.message,m.tryMessage)}let p;try{p=JSON.parse(a)}catch(m){let l=m instanceof Error?m.message:"Unknown error";throw new c("Preview store lookup returned a non-JSON response.",`Parse error: ${l}. Body (truncated): ${Ft(a).slice(0,500)}`)}return _s(p)}function Is(e,t){let o=Pi(t),r=o.error_code,i=o.message;if(r==="not_in_rollout")return{message:"Preview store creation is not enabled yet.",tryMessage:"Try again later."};if(r==="service_unavailable")return{message:"Preview store creation is temporarily unavailable.",tryMessage:"Try again later."};if(r==="rate_limited")return{message:"Too many preview store creation requests.",tryMessage:"Try again later."};if(r==="preview_store_create_failed")return{message:"Preview store creation failed.",tryMessage:"Try again later."};if(r==="shop_name_banned_keyword"||r==="shop_name_invalid")return{message:"The preview store name was rejected.",tryMessage:"Use a different store name and try again."};if(r==="country_invalid")return{message:"The preview store country was rejected.",tryMessage:"Use a different country and try again."};let a=Ft(t);return{message:`Preview store creation failed with HTTP ${e}.`,tryMessage:i??(a.length>0?a.slice(0,1e3):"No response body returned.")}}function Pi(e){if(e.length===0)return{};try{let t=JSON.parse(e);if(!t||typeof t!="object")return{};let o=t;return{...typeof o.error_code=="string"?{error_code:o.error_code}:{},...typeof o.message=="string"?{message:o.message}:{}}}catch(t){if(t instanceof SyntaxError)return{};throw t}}function Ts(e,t){let o=Pi(t),r=Ft(t);return{message:`Preview store lookup failed with HTTP ${e}.`,tryMessage:o.message??(r.length>0?r.slice(0,1e3):"No response body returned.")}}function Es(e){let t=e.shop,o=typeof t?.id=="string"||typeof t?.id=="number"?String(t.id):void 0,r=typeof t?.name=="string"?t.name:void 0,i=typeof t?.domain=="string"?_(t.domain):void 0,a=typeof e.admin_api_token=="string"?e.admin_api_token:void 0,p=typeof e.access_url=="string"?e.access_url:void 0,m=typeof e.placeholder_account_uuid=="string"?e.placeholder_account_uuid:void 0,l=Array.isArray(e.admin_api_scopes)?e.admin_api_scopes.filter(S=>typeof S=="string"):void 0;if(!o||!r||!i||!a||!p||!l)throw new c("Preview store creation response is missing required fields.",`Got: ${JSON.stringify(Ns(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},adminApiToken:a,adminApiScopes:l,accessUrl:p,...m?{placeholderAccountUuid:m}:{}}}function _s(e){let t=e.shop,o=typeof t?.id=="string"||typeof t?.id=="number"?String(t.id):void 0,r=typeof t?.name=="string"?t.name:void 0,i=typeof t?.domain=="string"?_(t.domain):void 0,a=typeof e.access_url=="string"?e.access_url:void 0,p=typeof e.claim_url=="string"?e.claim_url:void 0;if(!o||!r||!i||!a)throw new c("Preview store lookup response is missing required fields.",`Got: ${JSON.stringify(Fs(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},accessUrl:a,...p?{claimUrl:p}:{}}}function Ns(e){return{...e,...e.admin_api_token?{admin_api_token:"[REDACTED]"}:{},...e.access_url?{access_url:"[REDACTED]"}:{}}}function Ft(e){return e.replace(/(["']?(?:admin_api_token|adminApiToken)["']?\s*:\s*["'])[^"']+/gi,"$1[REDACTED]").replace(/(["']?(?:access_url|accessUrl|claim_url|claimUrl)["']?\s*:\s*["'])[^"']+/gi,"$1[REDACTED]").replace(/([?&](?:token|access_token)=)[^&\s"'<>]+/gi,"$1[REDACTED]")}function Fs(e){return{...e,...e.access_url?{access_url:"[REDACTED]"}:{},...e.claim_url?{claim_url:"[REDACTED]"}:{}}}var Cs={createPreviewStore:Fi,setStoredStoreAppSession:Se,recordStoreFqdnMetadata:N,setLastSeenUserId:q,now:()=>new Date};async function Di(e,t={}){let o={...Cs,...t},r=await o.createPreviewStore({name:e.name,country:e.country},e.client);return Ds(r,e.country,o)}function Ps(e){return e.placeholderAccountUuid??e.shop.id}async function Ds(e,t,o){let r=o.now().toISOString(),i=Ps(e);o.setStoredStoreAppSession({store:e.shop.domain,clientId:H,userId:i,accessToken:e.adminApiToken,scopes:e.adminApiScopes,acquiredAt:r,kind:"preview",preview:{shopId:e.shop.id,name:e.shop.name,createdAt:r,...e.placeholderAccountUuid?{placeholderAccountUuid:e.placeholderAccountUuid}:{},...t?{country:t}:{},accessUrl:e.accessUrl}}),o.setLastSeenUserId(i);try{await o.recordStoreFqdnMetadata(e.shop.domain,!0,e.shop.id)}catch{}return{status:"success",message:`Your Shopify store "${e.shop.name}" is ready. This store is temporary. Create a free Shopify account to save it and start selling.`,store:{id:e.shop.id,name:e.shop.name,subdomain:e.shop.domain,...t?{country:t}:{},storefrontUrl:e.accessUrl,type:"preview",authScopes:e.adminApiScopes},next_steps:Ls(e.shop.domain)}}function Ls(e){return[`Use \`shopify store open --store ${e}\` to preview the storefront.`,`Use \`shopify store execute --store ${e}\` to add products, collections, pages, and more.`,`Use \`shopify theme pull --store ${e}\` and \`shopify theme push --store ${e}\` to edit your store design.`]}n();n();var Li=A.pick({id:!0,name:!0,subdomain:!0,country:!0}).extend({storefrontUrl:s.string(),type:s.literal("preview").optional(),authScopes:A.shape.authScopes.describe("Preapproved Admin API scopes for the preview store.")}),Ct=x({name:"CreatePreviewStoreResult",schema:s.object({status:s.literal("success"),message:s.string(),store:Li,next_steps:s.array(s.string())}),definitions:{PreviewStore:Li}});function Ri(e,t){if(t==="json"){g(Ct.encode(e));return}qs(e)}function Rs(e){return e.split(/(`[^`]+`)/).map(t=>t.startsWith("`")&&t.endsWith("`")?{command:t.slice(1,-1)}:t)}function qs(e){T({headline:"Store created",customSections:[{body:e.message},{title:"Next steps",body:{list:{items:e.next_steps.map(Rs)}}}]})}var qi=R(M(),1),Ge=class e extends k{static summary="Create a preview Shopify store.";static descriptionWithMarkdown="Creates a new Shopify store, with no need for an existing account.";static jsonOutputSchema=Ct;static description=this.descriptionForHelp();static examples=['<%= config.bin %> <%= command.id %> --name "Lavender Candles"','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --country US','<%= config.bin %> <%= command.id %> --name "Lavender Candles" --json'];static flags={...y,...w,name:qi.Flags.string({description:"The name of the store.",env:"SHOPIFY_FLAG_PREVIEW_STORE_NAME",required:!1}),country:It};async run(){let{flags:t}=await this.parse(e),o=await j({title:d`Creating store`,task:async()=>Di({name:t.name,country:t.country})});Ri(o,t.json?"json":"text")}};n();n();var $i=s.object({domain:A.shape.subdomain,deletionRequested:s.literal(!0),deletionConfirmed:s.boolean()}),Je=x({name:"DeleteDevStoreResult",schema:s.union([s.object({store:$i,organization:ce,message:s.string().optional()}),Oe]),definitions:{DeletedStore:$i,StoreOrganization:ce,StoreCommandError:Oe}});n();n();n();n();var Ui={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"StoreInfoShop"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"search"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"accessibleShops"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"5"}},{kind:"Argument",name:{kind:"Name",value:"search"},value:{kind:"Variable",name:{kind:"Name",value:"search"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"edges"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"node"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shopifyShopId"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"primaryDomain"}},{kind:"Field",name:{kind:"Name",value:"storeType"}},{kind:"Field",name:{kind:"Name",value:"developerPreviewHandle"}},{kind:"Field",name:{kind:"Name",value:"planName"}},{kind:"Field",name:{kind:"Name",value:"ownerDetails"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"fullName"}},{kind:"Field",name:{kind:"Name",value:"email"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function zi(e){let t=await Ve(e);if(!t)throw new c(`Couldn't find shop ${e.store} inside organization ${e.organizationId}.`,"The shop matched a global lookup but is not listed under its parent organization. This usually means the search index is stale; try again in a moment.");return t}async function Ve(e){let t=e.token??await B([],{noPrompt:e.noPrompt,allowAutomationToken:!0}),o=V({noPrompt:e.noPrompt}),r={id:e.organizationId,businessName:e.organizationName},a=(await K(r,{query:Ui,token:t,variables:{search:e.store},unauthorizedHandler:o})).organization?.accessibleShops?.edges??[],p=e.store.toLowerCase(),m=a.find(l=>z(l.node.primaryDomain)===p)?.node;if(m)return{shopifyShopId:m.shopifyShopId??void 0,name:m.name,primaryDomain:m.primaryDomain??void 0,storeType:m.storeType??void 0,developerPreviewHandle:m.developerPreviewHandle??void 0,planName:m.planName??void 0,ownerName:m.ownerDetails?.fullName??void 0,ownerEmail:m.ownerDetails?.email??void 0}}n();var Bi={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteAppDevelopmentStore"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"storeFqdn"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deleteAppDevelopmentStore"},arguments:[{kind:"Argument",name:{kind:"Name",value:"storeFqdn"},value:{kind:"Variable",name:{kind:"Name",value:"storeFqdn"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"success"}},{kind:"Field",name:{kind:"Name",value:"userErrors"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"code"}},{kind:"Field",name:{kind:"Name",value:"field"}},{kind:"Field",name:{kind:"Name",value:"message"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};n();var ji={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"OrganizationAccessibleShop"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ShopifyShopID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"accessibleShop"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shopifyShopId"}},{kind:"Field",name:{kind:"Name",value:"planName"}},{kind:"Field",name:{kind:"Name",value:"storeType"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var $s="cancelled",Us=5,zs=300*1e3;async function Mi(e){let{organization:t,store:o}=e,r=await B([],{allowAutomationToken:!0}),i=V(),a=await Hi({store:o,organization:t,token:r}),m=(await K(t,{query:Bi,token:r,variables:{storeFqdn:o},unauthorizedHandler:i})).deleteAppDevelopmentStore;if(!m)throw new c("Store deletion failed: unexpected empty response.");let l=m.userErrors;if(l&&l.length>0){let O=l.map(h=>h.message).join(", ");throw new c(`Failed to delete dev store: ${O}`)}if(m.success===!1)throw new c("Store deletion failed.");a??=await Hi({store:o,organization:t,token:r});let S=a?await js({shopifyShopId:a,organization:t,token:r,unauthorizedHandler:i}):!1;e.json?g(Ms({store:o,organization:t,deletionConfirmed:S})):S?T({headline:`Dev store "${o}" deleted successfully.`,body:["The store was deleted."]}):ie({headline:`Dev store "${o}" deletion was requested, but not confirmed.`,body:["Shopify accepted the deletion request, but deletion was not confirmed before the CLI stopped waiting.","The store may still finish deleting asynchronously."]})}async function Hi(e){let{store:t,organization:o,token:r}=e;return(await Ve({store:t,organizationId:o.id,organizationName:o.businessName,token:r}))?.shopifyShopId}function Bs(e){let t=String(e),o=t.match(/^(?:gid:\/\/shopify\/Shop\/)?(\d+)$/)?.[1];if(!o)throw new Error(`Invalid Shopify shop ID: ${t}`);return Buffer.from(`gid://organization/ShopifyShop/${o}`).toString("base64url")}async function js(e){let t=Bs(e.shopifyShopId);return j({title:d`Dev store deletion requested. Waiting for deletion confirmation`,task:async o=>{let r=Date.now();for(;;){if(Date.now()-r>zs)return!1;if((await K(e.organization,{query:ji,token:e.token,variables:{id:t},unauthorizedHandler:e.unauthorizedHandler})).organization?.accessibleShop?.planName?.toLowerCase()===$s.toLowerCase())return!0;o(d`${Hs()}`),await $o(Us)}},renderOptions:{stdout:process.stderr}})}function Hs(){return"Waiting for deletion confirmation"}function Ms(e){let{store:t,organization:o,deletionConfirmed:r}=e;return Je.encode({store:{domain:t,deletionRequested:!0,deletionConfirmed:r},organization:{id:o.id,name:o.businessName},...r?{}:{message:"Deletion was requested, but has not been confirmed yet. The store may still finish deleting asynchronously."}})}n();n();n();var Gi={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"StoreInfoDestinations"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"search"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"currentUserAccount"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"destinations"},arguments:[{kind:"Argument",name:{kind:"Name",value:"search"},value:{kind:"Variable",name:{kind:"Name",value:"search"}}},{kind:"Argument",name:{kind:"Name",value:"shopsOnly"},value:{kind:"BooleanValue",value:!0}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"25"}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"publicId"}},{kind:"Field",name:{kind:"Name",value:"primaryDomain"}},{kind:"Field",name:{kind:"Name",value:"webUrl"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};n();var Ji={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"StoreInfoOwningOrg"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"destinationPublicId"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"DestinationPublicID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"currentUserAccount"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organizationForDestination"},arguments:[{kind:"Argument",name:{kind:"Name",value:"destinationPublicId"},value:{kind:"Variable",name:{kind:"Name",value:"destinationPublicId"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var Ie=class extends c{};async function Pt(e){let t=e.token??await B([],{noPrompt:e.noPrompt,allowAutomationToken:!0}),o=V({noPrompt:e.noPrompt}),r=z(e.store)??e.store.toLowerCase(),i=r.split(".")[0]??r,m=((await to({query:Gi,token:t,variables:{search:i},unauthorizedHandler:o})).currentUserAccount?.destinations.nodes??[]).find(S=>Vs(S,r));if(!m)throw new Ie(`Couldn't find a store with domain ${e.store} for the current account.`,Gs());let l=await Js(String(m.publicId),t,o);return{...l?{owningOrg:l}:{}}}function Gs(){let e="Check the domain (it must be the permanent `myshopify.com` domain)";return at()?`${e} and that the service account has access to the store: it can open the stores it created, or any store in an organization where it has Dev store management access. Inactive stores aren't searchable.`:`${e} and that you're logged in to an account with access to the store. Inactive stores aren't searchable.`}async function Js(e,t,o){try{let i=(await to({query:Ji,token:t,variables:{destinationPublicId:e},unauthorizedHandler:o})).currentUserAccount?.organizationForDestination;if(!i){f(`No owning organization returned for destination ${e}.`);return}let a=i.id?Tr(i.id):void 0;return{name:i.name,...a?{id:a}:{}}}catch(r){f(`Failed to resolve owning organization: ${Ws(r)}`);return}}function Vs(e,t){return[e.primaryDomain,e.webUrl].some(o=>z(o)===t)}function Ws(e){return e instanceof Error?e.message:String(e)}async function Qs(e){let{store:t}=e;try{let r=(await Pt(e)).owningOrg;if(!r?.id){f(`Could not infer an owning organization ID for ${t}.`);return}return{id:r.id,businessName:r.name}}catch(o){f(`Could not infer the owning organization for ${t}: ${Ys(o)}`);return}}function Ys(e){return e instanceof Error?e.message:String(e)}async function Vi(e,t){if(t)return ft(t);let o=pt(),r=await Qs({store:e,noPrompt:!o});if(r)return r;let i=await B([],{noPrompt:!o,allowAutomationToken:!0}),{organizations:a}=await lt(i);if(a.length===1)return f(`Using ${a[0].businessName}, the only organization the account belongs to, for ${e}.`),a[0];if(a.length===0)throw new c("No organizations found.","Make sure you have access to a Shopify organization.");if(!o)throw new c(`Could not determine which organization owns ${e}.`,"Provide `--organization-id`, for example `--organization-id 1234567`. Run `shopify organization list` to find IDs.");return I({headline:`Could not determine which organization owns ${e}.`,body:["Select one below, or specify it with",{command:"--organization-id"},{char:"."}]}),Nr(a)}var Wi=R(M(),1),We=class e extends Q{static summary="Delete a dev store.";static descriptionWithMarkdown="Deletes a dev store from your organization.";static jsonOutputSchema=Je;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --organization-id 1234567","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --organization-id 1234567 --json","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --organization-id 1234567 --force"];static flags={...y,...w,store:b.store,"organization-id":b["organization-id"],force:Wi.Flags.boolean({char:"f",description:"Skip confirmation. Required if non interactive.",env:"SHOPIFY_FLAG_FORCE",default:!1})};async run(){let{flags:t}=await this.parse(e);try{if(!t.force&&!ct())throw new c(`Deleting the dev store ${t.store} requires confirmation.`,null,["Use the `--force` flag to skip confirmation when running non-interactively."]);let o=await Vi(t.store,t["organization-id"]?.toString());if(!t.force&&!await Ro({message:`Delete dev store ${t.store}? This can't be undone.`,confirmation:t.store}))throw new qo;await Mi({store:t.store,organization:o,json:t.json})}catch(o){throw t.json&&o instanceof c&&(g(Je.encode({error:!0,message:o.message,nextSteps:o.nextSteps??[],exitCode:1})),process.exit(1)),o}}};n();n();n();var Yi=R(Ea(),1);async function Ks(e){if(e.query!==void 0){if(!e.query.trim())throw new c("The --query flag value is empty. Please provide a valid GraphQL query or mutation.");return e.query}if(e.queryFile){if(!await Ce(e.queryFile))throw new c(d`Query file not found at ${u.path(e.queryFile)}. Please check the path and try again.`);let t=await Ne(e.queryFile,{encoding:"utf8"});if(!t.trim())throw new c(d`Query file at ${u.path(e.queryFile)} is empty. Please provide a valid GraphQL query or mutation.`);return t}throw new J("Query should have been provided via --query or --query-file flags due to exactlyOne constraint. This indicates the oclif flag validation failed.")}function Qi(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new c(d`Invalid variables in ${t}: expected a non-null JSON object.`,"Please provide a JSON object for variables.");return e}async function Xs(e,t){if(e!==void 0){if(!e.trim())throw new c(d`The ${u.yellow("--variables")} flag value is empty.`,"Please provide a non-null JSON object for variables.");try{return Qi(JSON.parse(e),u.yellow("--variables"))}catch(o){if(o instanceof c)throw o;let r=o instanceof Error?o.message:"Unknown error";throw new c(d`Invalid JSON in ${u.yellow("--variables")} flag: ${r}`,"Please provide valid JSON format.")}}else if(t){if(!await Ce(t))throw new c(d`Variable file not found at ${u.path(t)}. Please check the path and try again.`);let o=await Ne(t,{encoding:"utf8"});try{return Qi(JSON.parse(o),u.path(t))}catch(r){if(r instanceof c)throw r;let i=r instanceof Error?r.message:"Unknown error";throw new c(d`Invalid JSON in variable file ${u.path(t)}: ${i}`,"Please provide valid JSON format.")}}}function Zs(e){let t;try{t=(0,Yi.parse)(e)}catch(r){throw r instanceof Error?new c(`Invalid GraphQL syntax: ${r.message}`):r}let o=t.definitions.filter(r=>r.kind==="OperationDefinition");if(o.length!==1)throw new c("GraphQL document must contain exactly one operation definition. Multiple operations are not supported.");return{operationDefinition:o[0]}}function ec(e){return e.operationDefinition.operation==="mutation"}function tc(e,t=!1){if(ec(e)&&!t)throw new c("Mutations are disabled by default for shopify store execute.","Re-run with --allow-mutations if you intend to modify store data.")}async function Ki(e){let t=await Ks({query:e.query,queryFile:e.queryFile}),o=Zs(t);tc(o,e.allowMutations);let r=await Xs(e.variables,e.variableFile);return{query:t,parsedOperation:o,parsedVariables:r,requestedVersion:e.version}}n();n();n();n();var Te=x({name:"StoreExecuteResult",schema:s.object({data:s.record(s.unknown()).nullable().describe("GraphQL response data, preserving query fields and aliases."),extensions:s.record(s.unknown()).optional().describe("Response-level GraphQL metadata, when returned by the API.")}).strict()});n();function Dt(e){if(!e||typeof e!="object"||!("response"in e))return!1;let t=e.response;return!!t&&typeof t=="object"}function Xi(e){if(!Dt(e))return;let t=e.response.status;return typeof t=="number"?t:void 0}var Zi=["the user aborted a request","the operation was aborted"];function oc(e){if(!(e instanceof Error))return!1;if(e.name==="AbortError")return!0;let t=e.message.toLowerCase();return Zi.some(o=>t.includes(o))}function Qe(e,t){if(Xi(e)===402)return new c(`The store ${t} is currently unavailable.`,"Check the store in the Shopify admin and try again once it is reactivated.");if(oc(e))return new c(`Request to ${t} was aborted before it completed.`)}function Ye(e,t){let o=Xi(e);o!==401&&o!==404||(ge(t.store,t.userId),xt(t))}var rc=`
95
95
  query StoreExecutePublicApiVersions {
96
96
  publicApiVersions {
97
97
  handle
98
98
  supported
99
99
  }
100
100
  }
101
- `;async function ta(e){try{return(await ne({query:nc,api:"Admin",url:ae(e.adminSession.storeFqdn,"unstable",e.adminSession),token:e.adminSession.token,responseOptions:{handleErrors:!1}})).publicApiVersions}catch(t){Ye(t,e.session);let o=Qe(t,e.adminSession.storeFqdn);throw o||(Dt(t)&&typeof t.response.status=="number"&&t.response.status>=500?new fr(e.adminSession.storeFqdn,t.response.status):t)}}async function oa(e){try{return await j({title:d`Executing GraphQL operation`,task:async()=>{let t,o=await ne({query:e.request.query,api:"Admin",url:ae(e.context.adminSession.storeFqdn,e.context.version,e.context.adminSession),token:e.context.adminSession.token,variables:e.request.parsedVariables,responseOptions:{handleErrors:!1,onResponse:r=>{t=r.extensions}}});return Te.validate({data:o,...t===void 0?{}:{extensions:t}})},renderOptions:{stdout:process.stderr}})}catch(t){Ye(t,e.context.session);let o=Qe(t,e.context.adminSession.storeFqdn);if(o)throw o;if(Dt(t)&&t.response.errors){let{errors:r,extensions:i,data:a}=t.response,p={errors:r,...i===void 0?{}:{extensions:i},...a===void 0?{}:{data:a}},m=new c("GraphQL operation failed.",JSON.stringify({errors:r},null,2));throw m.details=p,m}throw t}}n();async function So(e){le();let t=await $(_(e));return await N(t.store,!0),q(t.userId),{adminSession:{token:t.accessToken,storeFqdn:t.store},session:t}}async function ic(e){let{session:t,adminSession:o,userSpecifiedVersion:r}=e;if(r==="unstable")return r;let i=await ta({adminSession:o,session:t});if(!r)return i.filter(m=>m.supported).map(m=>m.handle).sort().reverse()[0];let a=i.map(p=>p.handle);if(a.includes(r))return r;throw new c(`Invalid API version: ${r}`,`Allowed versions: ${a.join(", ")}`)}async function ra(e){let{adminSession:t,session:o}=await So(e.store),r=await ic({session:o,adminSession:t,userSpecifiedVersion:e.userSpecifiedVersion});return{adminSession:t,version:r,session:o}}var ac={id:"admin",prepareContext:async({store:e,requestedVersion:t})=>ra({store:e,userSpecifiedVersion:t}),execute:async({context:e,request:t})=>oa({context:e,request:t})};function na(e){if(e==="admin")return ac;throw new J(`Unsupported store GraphQL API target: ${e}`)}async function ia(e){await N(e.store,!1);let t=na(e.api??"admin"),o=await Xi({query:e.query,queryFile:e.queryFile,variables:e.variables,variableFile:e.variableFile,version:e.version,allowMutations:e.allowMutations}),r=await j({title:d`Loading stored store auth`,task:async()=>t.prepareContext({store:e.store,requestedVersion:o.requestedVersion}),renderOptions:{stdout:process.stderr}});return t.execute({context:r,request:o})}n();function aa(e){if(e){T({headline:"Operation succeeded.",body:`Results written to ${e}`});return}T({headline:"Operation succeeded."})}async function sa(e,t,o="text"){let r=o==="json"?Te.encode(e):JSON.stringify(e.data,null,2);if(t){await Fe(t,r),o==="text"&&aa(t);return}o==="text"&&aa(),g(r)}var ee=R(M(),1),Ke=class e extends k{static summary="Execute GraphQL queries and mutations on a store.";static descriptionWithMarkdown="Executes an Admin API GraphQL query or mutation on the specified store using previously stored app authentication.\n\nRun `shopify store auth` first to create stored auth for the store.\n\nMutations are disabled by default. Re-run with `--allow-mutations` if you intend to modify store data.";static jsonOutputSchema=Te;static description=this.descriptionForHelp();static examples=['<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "query { shop { name } }"',`<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query-file ./operation.graphql --variables '{"id":"gid://shopify/Product/1"}'`,'<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "mutation { shop { id } }" --allow-mutations','<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "query { shop { name } }" --json'];static flags={...y,...w,query:ee.Flags.string({char:"q",description:"The GraphQL query or mutation, as a string.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":ee.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async t=>G(t),exactlyOne:["query","query-file"]}),variables:ee.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES",exclusive:["variable-file"]}),"variable-file":ee.Flags.string({description:"Path to a file containing GraphQL variables in JSON format. Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async t=>G(t),exclusive:["variables"]}),store:b.store,version:ee.Flags.string({description:"The API version to use for the query or mutation. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"}),"output-file":ee.Flags.string({description:"The file name where results should be written, instead of STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",parse:async t=>G(t)}),"allow-mutations":ee.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};async run(){let{flags:t}=await this.parse(e),o=await ia({store:t.store,query:t.query,queryFile:t["query-file"],variables:t.variables,variableFile:t["variable-file"],version:t.version,allowMutations:t["allow-mutations"]});await sa(o,t["output-file"],t.json?"json":"text")}};n();n();async function ca(e){le();let t=sc(e.store),o=Lr();await Rr({port:e.port,storeFqdn:e.store,tokenProvider:t,key:o,protectMutations:!e.allowMutations,query:e.query,variables:e.variables,apiVersion:e.apiVersion,outputFormat:e.outputFormat,additionalReadyMessages:[d`Mutations are ${e.allowMutations?u.green("allowed"):u.yellow("blocked")}.`],abortSignal:e.abortSignal})}function sc(e){return{getToken:async t=>(await $(e,t)).accessToken,refreshToken:async t=>(await $(e,t)).accessToken}}var Lt=R(M(),1);var Xe=class e extends k{static summary="Open a local GraphiQL UI for a store.";static descriptionWithMarkdown="Opens an authenticated Admin API GraphiQL UI for the specified store using previously stored app authentication.\n\nRun `shopify store auth` first to create stored auth for the store.\n\nMutations are disabled by default. Re-run with `--allow-mutations` if you intend to modify store data.";static jsonOutputSchema=Dr;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --allow-mutations","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --port 9123"];static flags={...y,...w,store:b.store,port:jo({description:"Local port for the GraphiQL server.",env:"SHOPIFY_FLAG_PORT"}),"allow-mutations":Lt.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1}),variables:Lt.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES"}),version:Lt.Flags.string({description:"The API version to use in GraphiQL. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"})};async run(){let{flags:t}=await this.parse(e);return this.runWithParsedOutput(t,async()=>{await ca({store:t.store,port:t.port,allowMutations:t["allow-mutations"],variables:t.variables,apiVersion:t.version,outputFormat:t.json?"json":"text"})})}};n();n();n();function Rt(e){if(e)return Oi[e.toLowerCase()]}function ua(e){return e?oe(e):""}n();var cc={APP_DEVELOPMENT:"dev",CLIENT_TRANSFER:"client-transfer",COLLABORATOR:"collaborator",DEVELOPMENT:"dev",DEVELOPMENT_SUPERSET:"dev",PRODUCTION:"production"};function qt(e){if(e)return cc[e]}function pa(e){return e?oe(e):""}var da={dev:"development_superset",production:"production","client-transfer":"client_transfer",collaborator:"collaborator"},$t=Object.keys(da);function ma(e){return da[e]}var uc=`#graphql
101
+ `;async function ea(e){try{return(await ne({query:rc,api:"Admin",url:ae(e.adminSession.storeFqdn,"unstable",e.adminSession),token:e.adminSession.token,responseOptions:{handleErrors:!1}})).publicApiVersions}catch(t){Ye(t,e.session);let o=Qe(t,e.adminSession.storeFqdn);throw o||(Dt(t)&&typeof t.response.status=="number"&&t.response.status>=500?new fr(e.adminSession.storeFqdn,t.response.status):t)}}async function ta(e){try{return await j({title:d`Executing GraphQL operation`,task:async()=>{let t,o=await ne({query:e.request.query,api:"Admin",url:ae(e.context.adminSession.storeFqdn,e.context.version,e.context.adminSession),token:e.context.adminSession.token,variables:e.request.parsedVariables,responseOptions:{handleErrors:!1,onResponse:r=>{t=r.extensions}}});return Te.validate({data:o,...t===void 0?{}:{extensions:t}})},renderOptions:{stdout:process.stderr}})}catch(t){Ye(t,e.context.session);let o=Qe(t,e.context.adminSession.storeFqdn);if(o)throw o;if(Dt(t)&&t.response.errors){let{errors:r,extensions:i,data:a}=t.response,p={errors:r,...i===void 0?{}:{extensions:i},...a===void 0?{}:{data:a}},m=new c("GraphQL operation failed.",JSON.stringify({errors:r},null,2));throw m.details=p,m}throw t}}n();async function So(e){le();let t=await $(_(e));return await N(t.store,!0),q(t.userId),{adminSession:{token:t.accessToken,storeFqdn:t.store},session:t}}async function nc(e){let{session:t,adminSession:o,userSpecifiedVersion:r}=e;if(r==="unstable")return r;let i=await ea({adminSession:o,session:t});if(!r)return i.filter(m=>m.supported).map(m=>m.handle).sort().reverse()[0];let a=i.map(p=>p.handle);if(a.includes(r))return r;throw new c(`Invalid API version: ${r}`,`Allowed versions: ${a.join(", ")}`)}async function oa(e){let{adminSession:t,session:o}=await So(e.store),r=await nc({session:o,adminSession:t,userSpecifiedVersion:e.userSpecifiedVersion});return{adminSession:t,version:r,session:o}}var ic={id:"admin",prepareContext:async({store:e,requestedVersion:t})=>oa({store:e,userSpecifiedVersion:t}),execute:async({context:e,request:t})=>ta({context:e,request:t})};function ra(e){if(e==="admin")return ic;throw new J(`Unsupported store GraphQL API target: ${e}`)}async function na(e){await N(e.store,!1);let t=ra(e.api??"admin"),o=await Ki({query:e.query,queryFile:e.queryFile,variables:e.variables,variableFile:e.variableFile,version:e.version,allowMutations:e.allowMutations}),r=await j({title:d`Loading stored store auth`,task:async()=>t.prepareContext({store:e.store,requestedVersion:o.requestedVersion}),renderOptions:{stdout:process.stderr}});return t.execute({context:r,request:o})}n();function ia(e){if(e){T({headline:"Operation succeeded.",body:`Results written to ${e}`});return}T({headline:"Operation succeeded."})}async function aa(e,t,o="text"){let r=o==="json"?Te.encode(e):JSON.stringify(e.data,null,2);if(t){await Fe(t,r),o==="text"&&ia(t);return}o==="text"&&ia(),g(r)}var ee=R(M(),1),Ke=class e extends k{static summary="Execute GraphQL queries and mutations on a store.";static descriptionWithMarkdown="Executes an Admin API GraphQL query or mutation on the specified store using previously stored app authentication.\n\nRun `shopify store auth` first to create stored auth for the store.\n\nMutations are disabled by default. Re-run with `--allow-mutations` if you intend to modify store data.";static jsonOutputSchema=Te;static description=this.descriptionForHelp();static examples=['<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "query { shop { name } }"',`<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query-file ./operation.graphql --variables '{"id":"gid://shopify/Product/1"}'`,'<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "mutation { shop { id } }" --allow-mutations','<%= config.bin %> <%= command.id %> --store shop.myshopify.com --query "query { shop { name } }" --json'];static flags={...y,...w,query:ee.Flags.string({char:"q",description:"The GraphQL query or mutation, as a string.",env:"SHOPIFY_FLAG_QUERY",required:!1,exactlyOne:["query","query-file"]}),"query-file":ee.Flags.string({description:"Path to a file containing the GraphQL query or mutation. Can't be used with --query.",env:"SHOPIFY_FLAG_QUERY_FILE",parse:async t=>G(t),exactlyOne:["query","query-file"]}),variables:ee.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES",exclusive:["variable-file"]}),"variable-file":ee.Flags.string({description:"Path to a file containing GraphQL variables in JSON format. Can't be used with --variables.",env:"SHOPIFY_FLAG_VARIABLE_FILE",parse:async t=>G(t),exclusive:["variables"]}),store:b.store,version:ee.Flags.string({description:"The API version to use for the query or mutation. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"}),"output-file":ee.Flags.string({description:"The file name where results should be written, instead of STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",parse:async t=>G(t)}),"allow-mutations":ee.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};async run(){let{flags:t}=await this.parse(e),o=await na({store:t.store,query:t.query,queryFile:t["query-file"],variables:t.variables,variableFile:t["variable-file"],version:t.version,allowMutations:t["allow-mutations"]});await aa(o,t["output-file"],t.json?"json":"text")}};n();n();async function sa(e){le();let t=ac(e.store),o=Lr();await Rr({port:e.port,storeFqdn:e.store,tokenProvider:t,key:o,protectMutations:!e.allowMutations,query:e.query,variables:e.variables,apiVersion:e.apiVersion,outputFormat:e.outputFormat,additionalReadyMessages:[d`Mutations are ${e.allowMutations?u.green("allowed"):u.yellow("blocked")}.`],abortSignal:e.abortSignal})}function ac(e){return{getToken:async t=>(await $(e,t)).accessToken,refreshToken:async t=>(await $(e,t)).accessToken}}var Lt=R(M(),1);var Xe=class e extends k{static summary="Open a local GraphiQL UI for a store.";static descriptionWithMarkdown="Opens an authenticated Admin API GraphiQL UI for the specified store using previously stored app authentication.\n\nRun `shopify store auth` first to create stored auth for the store.\n\nMutations are disabled by default. Re-run with `--allow-mutations` if you intend to modify store data.";static jsonOutputSchema=Dr;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --allow-mutations","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --port 9123"];static flags={...y,...w,store:b.store,port:jo({description:"Local port for the GraphiQL server.",env:"SHOPIFY_FLAG_PORT"}),"allow-mutations":Lt.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1}),variables:Lt.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES"}),version:Lt.Flags.string({description:"The API version to use in GraphiQL. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"})};async run(){let{flags:t}=await this.parse(e);return this.runWithParsedOutput(t,async()=>{await sa({store:t.store,port:t.port,allowMutations:t["allow-mutations"],variables:t.variables,apiVersion:t.version,outputFormat:t.json?"json":"text"})})}};n();n();n();function Rt(e){if(e)return xi[e.toLowerCase()]}function ca(e){return e?oe(e):""}n();var sc={APP_DEVELOPMENT:"dev",CLIENT_TRANSFER:"client-transfer",COLLABORATOR:"collaborator",DEVELOPMENT:"dev",DEVELOPMENT_SUPERSET:"dev",PRODUCTION:"production"};function qt(e){if(e)return sc[e]}function ua(e){return e?oe(e):""}var pa={dev:"development_superset",production:"production","client-transfer":"client_transfer",collaborator:"collaborator"},$t=Object.keys(pa);function da(e){return pa[e]}var cc=`#graphql
102
102
  query StoreInfoAdminShop {
103
103
  shop {
104
104
  id
@@ -112,8 +112,8 @@ Re-run this command if the stored token is missing, expires, or no longer has th
112
112
  }
113
113
  }
114
114
  }
115
- `;async function Ut(e){let t=e.store;if(!t)throw new c("No store specified.","Pass the `myshopify.com` domain via the `--store` flag, e.g. `shopify store info --store shop.myshopify.com`.");let o=at()?void 0:Y(t);if(fc(o)){await N(o.store,!0,o.preview.shopId),q(o.userId);let i=await hc(o);return kc({store:t,previewSession:o,previewStoreUrls:i})}let r=!!o;try{return await dc(t,{noPrompt:r})}catch(i){if(!r||!gc(i))throw i;return f(`BP store info lookup failed; falling back to stored store auth: ${go(i)}`),pc(t)}}async function pc(e){let t=await $(e);await N(t.store,!0),q(t.userId);let o=await lc(t);return{...wc({store:t.store,shop:o}),authScopes:t.scopes}}async function dc(e,t={}){let o;try{o=await Pt({store:e,noPrompt:t.noPrompt})}catch(i){if(!(i instanceof Ie))throw i;let a=await mc(e,t);if(!a)throw i;return a}let r=await Sc(o,e,{noPrompt:t.noPrompt});return la({store:e,destinationsCtx:o,orgShop:r})}async function mc(e,t){let o;try{let i=await Er();if(i.length!==1)return;o=i[0]}catch(i){f(`Could not list the account's organizations: ${go(i)}`);return}let r;try{r=await Ve({store:e,organizationId:o.id,noPrompt:t.noPrompt})}catch(i){f(`BP Organizations shop lookup in ${o.businessName} failed: ${go(i)}`);return}if(r)return f(`Found ${e} in ${o.businessName}, the only organization the account belongs to.`),la({store:e,destinationsCtx:{owningOrg:{id:o.id,name:o.businessName}},orgShop:r})}async function lc(e){try{let t=await ne({query:uc,api:"Admin",url:ae(e.store,"unstable"),token:e.accessToken,responseOptions:{handleErrors:!1}});if(!t.shop)throw new c(`Shopify did not return store information for ${e.store}.`);return t.shop}catch(t){Ye(t,e);let o=Qe(t,e.store);throw o||t}}function fc(e){return e?.kind==="preview"&&e.preview!==void 0}async function hc(e){try{let t=await Pi({shopId:e.preview.shopId,adminApiToken:e.accessToken});return{accessUrl:t.accessUrl,...t.claimUrl?{saveUrl:t.claimUrl}:{}}}catch(t){throw t instanceof Me&&(t.status===401||t.status===404)&&(ge(e.store,e.userId),xt(e)),t}}async function Sc(e,t,o={}){if(!e.owningOrg?.id){f("Owning organization id is unknown; skipping BP Organizations shop lookup.");return}try{return await Bi({store:t,organizationId:e.owningOrg.id,organizationName:e.owningOrg.name,noPrompt:o.noPrompt})}catch(r){f(`BP Organizations shop lookup failed: ${r instanceof Error?r.message:String(r)}`);return}}function gc(e){return e instanceof Ie||yc(e)}function yc(e){return e instanceof c&&e.message.includes("unable to prompt for reauthentication")}function go(e){return e instanceof Error?e.message:String(e)}function wc(e){let{store:t,shop:o}=e,r=o.myshopifyDomain??t,i={id:o.id,displayName:o.name,storeOwner:bc(o),type:o.plan?.partnerDevelopment?"dev":void 0,plan:o.plan?.publicDisplayName,adminUrl:ha(re(r))};return{...fe(i),subdomain:r}}function la(e){let{store:t,destinationsCtx:o,orgShop:r}=e,i={id:fa(r?.shopifyShopId),displayName:r?.name,organizationId:o.owningOrg?.id,organizationName:o.owningOrg?.name,storeOwner:vc(r),type:qt(r?.storeType),plan:Rt(r?.planName),featurePreview:r?.developerPreviewHandle,adminUrl:ha(re(t))};return{...fe(i),subdomain:t}}function kc(e){let{store:t,previewSession:o,previewStoreUrls:r}=e,i={id:fa(o.preview.shopId),displayName:o.preview.name,type:"preview",country:o.preview.country,accessUrl:r.accessUrl,saveUrl:r.saveUrl};return{...fe(i),subdomain:t,authScopes:o.scopes}}function fa(e){if(e)return`gid://shopify/Shop/${e}`}function bc(e){let t=fe({name:e.shopOwnerName,email:e.email});return Object.keys(t).length>0?t:void 0}function vc(e){if(!e)return;let t=fe({name:e.ownerName,email:e.ownerEmail});return Object.keys(t).length>0?t:void 0}function ha(e){if(e)return`https://admin.shopify.com/store/${encodeURIComponent(e)}`}n();n();var Sa=s.object({name:s.string().optional(),email:s.string().optional()}),zt=x({name:"StoreInfoResult",schema:s.object({id:A.shape.id.optional(),displayName:A.shape.name.optional(),subdomain:A.shape.subdomain,organizationId:A.shape.organizationId.optional(),organizationName:A.shape.organizationName.optional(),storeOwner:Sa.optional(),type:A.shape.type,country:A.shape.country.describe("The country selected when creating the preview store, if specified."),plan:A.shape.plan,featurePreview:s.string().optional(),adminUrl:s.string().optional(),accessUrl:s.string().optional(),saveUrl:s.string().optional(),authScopes:A.shape.authScopes}),definitions:{StoreInfoStoreOwner:Sa}});function ga(e,t){if(t==="json"){g(zt.encode(e));return}let o=xc(e);I({customSections:[{title:"Store details",body:{tabularData:Ac(e),firstColumnSubdued:!0}},...o.length>0?[{body:{list:{title:{bold:"Next steps"},items:o}}}]:[]]})}function Ac(e){let t=[];return te(t,"ID",e.id),te(t,"Display Name",e.displayName),te(t,"Subdomain",e.subdomain),te(t,"Organization",e.organizationName),te(t,"Store owner",Oc(e.storeOwner)),te(t,"Type",e.type?oe(e.type):void 0),te(t,"Plan",e.plan?oe(e.plan):void 0),te(t,"Feature Preview",e.featurePreview),t}function xc(e){let t=[];return yo(t,e.adminUrl,"Manage this store in the Shopify admin"),yo(t,e.accessUrl,"View your store"),yo(t,e.saveUrl,"Save your store"),t}function Oc(e){if(e)return e.name&&e.email?`${e.name} (${e.email})`:e.name??e.email}function te(e,t,o){o&&e.push([t,o])}function yo(e,t,o){t&&e.push({link:{label:o,url:t}})}var Ze=class e extends k{static summary="Surface metadata about a Shopify store.";static descriptionWithMarkdown=`Returns available metadata about a store you have access to, such as its id, display name, subdomain, organization, store owner, type, plan, feature preview, admin URL, and access and save URLs for preview stores.
115
+ `;async function Ut(e){let t=e.store;if(!t)throw new c("No store specified.","Pass the `myshopify.com` domain via the `--store` flag, e.g. `shopify store info --store shop.myshopify.com`.");let o=at()?void 0:Y(t);if(lc(o)){await N(o.store,!0,o.preview.shopId),q(o.userId);let i=await fc(o);return wc({store:t,previewSession:o,previewStoreUrls:i})}let r=!!o;try{return await pc(t,{noPrompt:r})}catch(i){if(!r||!Sc(i))throw i;return f(`BP store info lookup failed; falling back to stored store auth: ${go(i)}`),uc(t)}}async function uc(e){let t=await $(e);await N(t.store,!0),q(t.userId);let o=await mc(t);return{...yc({store:t.store,shop:o}),authScopes:t.scopes}}async function pc(e,t={}){let o;try{o=await Pt({store:e,noPrompt:t.noPrompt})}catch(i){if(!(i instanceof Ie))throw i;let a=await dc(e,t);if(!a)throw i;return a}let r=await hc(o,e,{noPrompt:t.noPrompt});return ma({store:e,destinationsCtx:o,orgShop:r})}async function dc(e,t){let o;try{let i=await Er();if(i.length!==1)return;o=i[0]}catch(i){f(`Could not list the account's organizations: ${go(i)}`);return}let r;try{r=await Ve({store:e,organizationId:o.id,noPrompt:t.noPrompt})}catch(i){f(`BP Organizations shop lookup in ${o.businessName} failed: ${go(i)}`);return}if(r)return f(`Found ${e} in ${o.businessName}, the only organization the account belongs to.`),ma({store:e,destinationsCtx:{owningOrg:{id:o.id,name:o.businessName}},orgShop:r})}async function mc(e){try{let t=await ne({query:cc,api:"Admin",url:ae(e.store,"unstable"),token:e.accessToken,responseOptions:{handleErrors:!1}});if(!t.shop)throw new c(`Shopify did not return store information for ${e.store}.`);return t.shop}catch(t){Ye(t,e);let o=Qe(t,e.store);throw o||t}}function lc(e){return e?.kind==="preview"&&e.preview!==void 0}async function fc(e){try{let t=await Ci({shopId:e.preview.shopId,adminApiToken:e.accessToken});return{accessUrl:t.accessUrl,...t.claimUrl?{saveUrl:t.claimUrl}:{}}}catch(t){throw t instanceof Me&&(t.status===401||t.status===404)&&(ge(e.store,e.userId),xt(e)),t}}async function hc(e,t,o={}){if(!e.owningOrg?.id){f("Owning organization id is unknown; skipping BP Organizations shop lookup.");return}try{return await zi({store:t,organizationId:e.owningOrg.id,organizationName:e.owningOrg.name,noPrompt:o.noPrompt})}catch(r){f(`BP Organizations shop lookup failed: ${r instanceof Error?r.message:String(r)}`);return}}function Sc(e){return e instanceof Ie||gc(e)}function gc(e){return e instanceof c&&e.message.includes("unable to prompt for reauthentication")}function go(e){return e instanceof Error?e.message:String(e)}function yc(e){let{store:t,shop:o}=e,r=o.myshopifyDomain??t,i={id:o.id,displayName:o.name,storeOwner:kc(o),type:o.plan?.partnerDevelopment?"dev":void 0,plan:o.plan?.publicDisplayName,adminUrl:fa(re(r))};return{...fe(i),subdomain:r}}function ma(e){let{store:t,destinationsCtx:o,orgShop:r}=e,i={id:la(r?.shopifyShopId),displayName:r?.name,organizationId:o.owningOrg?.id,organizationName:o.owningOrg?.name,storeOwner:bc(r),type:qt(r?.storeType),plan:Rt(r?.planName),featurePreview:r?.developerPreviewHandle,adminUrl:fa(re(t))};return{...fe(i),subdomain:t}}function wc(e){let{store:t,previewSession:o,previewStoreUrls:r}=e,i={id:la(o.preview.shopId),displayName:o.preview.name,type:"preview",country:o.preview.country,accessUrl:r.accessUrl,saveUrl:r.saveUrl};return{...fe(i),subdomain:t,authScopes:o.scopes}}function la(e){if(e)return`gid://shopify/Shop/${e}`}function kc(e){let t=fe({name:e.shopOwnerName,email:e.email});return Object.keys(t).length>0?t:void 0}function bc(e){if(!e)return;let t=fe({name:e.ownerName,email:e.ownerEmail});return Object.keys(t).length>0?t:void 0}function fa(e){if(e)return`https://admin.shopify.com/store/${encodeURIComponent(e)}`}n();n();var ha=s.object({name:s.string().optional(),email:s.string().optional()}),zt=x({name:"StoreInfoResult",schema:s.object({id:A.shape.id.optional(),displayName:A.shape.name.optional(),subdomain:A.shape.subdomain,organizationId:A.shape.organizationId.optional(),organizationName:A.shape.organizationName.optional(),storeOwner:ha.optional(),type:A.shape.type,country:A.shape.country.describe("The country selected when creating the preview store, if specified."),plan:A.shape.plan,featurePreview:s.string().optional(),adminUrl:s.string().optional(),accessUrl:s.string().optional(),saveUrl:s.string().optional(),authScopes:A.shape.authScopes}),definitions:{StoreInfoStoreOwner:ha}});function Sa(e,t){if(t==="json"){g(zt.encode(e));return}let o=Ac(e);I({customSections:[{title:"Store details",body:{tabularData:vc(e),firstColumnSubdued:!0}},...o.length>0?[{body:{list:{title:{bold:"Next steps"},items:o}}}]:[]]})}function vc(e){let t=[];return te(t,"ID",e.id),te(t,"Display Name",e.displayName),te(t,"Subdomain",e.subdomain),te(t,"Organization",e.organizationName),te(t,"Store owner",xc(e.storeOwner)),te(t,"Type",e.type?oe(e.type):void 0),te(t,"Plan",e.plan?oe(e.plan):void 0),te(t,"Feature Preview",e.featurePreview),t}function Ac(e){let t=[];return yo(t,e.adminUrl,"Manage this store in the Shopify admin"),yo(t,e.accessUrl,"View your store"),yo(t,e.saveUrl,"Save your store"),t}function xc(e){if(e)return e.name&&e.email?`${e.name} (${e.email})`:e.name??e.email}function te(e,t,o){o&&e.push([t,o])}function yo(e,t,o){t&&e.push({link:{label:o,url:t}})}var Ze=class e extends k{static summary="Surface metadata about a Shopify store.";static descriptionWithMarkdown=`Returns available metadata about a store you have access to, such as its id, display name, subdomain, organization, store owner, type, plan, feature preview, admin URL, and access and save URLs for preview stores.
116
116
 
117
117
  Some details may be omitted when they are not available for the store.
118
118
 
119
- Use \`--json\` for machine-readable output.`;static jsonOutputSchema=zt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --json"];static flags={...y,...w,store:b.store};async run(){let{flags:t}=await this.parse(e),o=await Ut({store:t.store});ga(o,t.json?"json":"text")}};n();n();n();n();n();var ya={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListAccessibleShops"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"filters"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ShopFilterInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"accessibleShops"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}},{kind:"Argument",name:{kind:"Name",value:"sort"},value:{kind:"EnumValue",value:"SHOP_CREATED_AT_DESC"}},{kind:"Argument",name:{kind:"Name",value:"filters"},value:{kind:"Variable",name:{kind:"Name",value:"filters"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"edges"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"node"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"shopifyShopId"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"storeType"}},{kind:"Field",name:{kind:"Name",value:"planName"}},{kind:"Field",name:{kind:"Name",value:"primaryDomain"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function wa(e){let{entries:t,hasMore:o}=await Ic(e.token,e.organization,e.storeType);return{entries:t.sort(_c),hasMore:o}}async function Ic(e,t,o){let r=V(),a=(await K(t,{query:ya,token:e,variables:{first:250,filters:Tc(o)},unauthorizedHandler:r})).organization?.accessibleShops;if(!a)return{entries:[],hasMore:!1};let p=[];for(let m of a.edges){let l=Ec(m.node,t);l&&p.push(l)}return{entries:p,hasMore:a.pageInfo.hasNextPage}}function Tc(e){let t=[{field:"STORE_STATUS",operator:"EQUALS",value:"active"}];return e&&t.push({field:"STORE_TYPE",operator:"EQUALS",value:ma(e)}),t}function Ec(e,t){let o=e.url??e.primaryDomain;if(o)return{...e.shopifyShopId?{id:`gid://shopify/Shop/${e.shopifyShopId}`}:{},store:z(o)??o,...e.primaryDomain?{primaryDomain:z(e.primaryDomain)??e.primaryDomain}:{},createdAt:typeof e.createdAt=="string"?e.createdAt:String(e.createdAt),organizationId:t.id,organizationName:t.businessName,name:e.name,type:qt(e.storeType),plan:Rt(e.planName)}}function _c(e,t){return e.createdAt===t.createdAt?e.store.localeCompare(t.store):t.createdAt.localeCompare(e.createdAt)}async function ba(e={}){let t=await B([],{allowAutomationToken:!0});if(e.organizationId){let i=await _r(e.organizationId.toString(),t);if(i)return ka(t,i,e.storeType)}let o=await lt(t);if(!o.currentUserResolved)return{stores:[],notice:"Couldn't resolve a Shopify account for the current CLI session."};if(o.organizations.length===0)return{stores:[]};if(!e.organizationId&&o.organizations.length>1&&!ct())throw new c("An organization ID is required to list stores non-interactively.","Provide `--organization-id`, for example `--organization-id 1234567`. Run `shopify organization list` to find IDs.");let r=await Nc(o.organizations,e.organizationId);return ka(t,r,e.storeType)}async function ka(e,t,o){let r=await wa({token:e,organization:t,storeType:o}),{stores:i,truncated:a}=Cc(r.entries,r.hasMore);return{stores:i,organization:Fc(t),...o?{storeType:o}:{},...a?{truncated:!0}:{}}}async function Nc(e,t){if(t){let a=e.find(p=>p.id===t.toString());if(!a)throw new c(`Organization with ID ${t} not found.`,`Available organizations: ${e.map(p=>`${p.businessName} (${p.id})`).join(", ")}`);return a}if(e.length===1)return e[0];let r=new Set(e.map(a=>a.businessName)).size<e.length,i=await Lo({message:"Which organization do you want to use?",choices:e.map(a=>({label:r?`${a.businessName} (${a.id})`:a.businessName,value:a.id}))});return e.find(a=>a.id===i)}function Fc(e){return{id:e.id,name:e.businessName}}function Cc(e,t){return{stores:e.slice(0,250),truncated:t||e.length>250}}n();n();var va=s.object({id:A.shape.id.optional(),store:A.shape.subdomain,primaryDomain:s.string().optional().describe("The primary storefront hostname, which may be a custom domain."),createdAt:s.string(),organizationId:A.shape.organizationId,organizationName:A.shape.organizationName,name:A.shape.name.optional(),type:A.shape.type,plan:A.shape.plan}),Bt=x({name:"StoreListResult",schema:s.object({stores:s.array(va),organization:ce.optional(),storeType:s.enum($t).optional(),notice:s.string().optional(),truncated:s.boolean().optional()}),definitions:{StoreListEntry:va,StoreListOrganization:ce}});var Pc=["To list stores authenticated directly with",{command:"shopify store auth"},{char:","},"run",{command:"shopify store auth list"},{char:"."}];function Aa(e,t){if(e.notice&&oo(e.notice),e.truncated&&oo(Dc(e)),t==="json"){g(Bt.encode(e));return}Lc(e)}function Dc(e){let t=e.organization?` in ${e.organization.name}`:" in this organization";return`Showing the ${250} most recent ${xa(e.storeType)}${t}. More stores exist.`}function xa(e){return e?`${e.replaceAll("-"," ")} stores`:"stores"}function Lc(e){I({headline:Rc(e),customSections:[...qc(e.organization),{body:Pc}]}),e.stores.length>0&&$c(e.stores)}function Rc(e){let t=xa(e.storeType);return e.stores.length>0?`Listing ${t}.`:e.notice?`No ${t} were returned for the current CLI session.`:`No ${t} found.`}function qc(e){return e?[{body:{tabularData:[["Organization",`${e.name} (${e.id})`]],firstColumnSubdued:!0}}]:[]}function $c(e){he({rows:e.map(t=>({subdomain:Uc(t.store),name:t.name??"",type:pa(t.type),plan:ua(t.plan),created:wt(t.createdAt)})),columns:{subdomain:{header:"Subdomain"},name:{header:"Name"},type:{header:"Type"},plan:{header:"Plan"},created:{header:"Created"}}})}function Uc(e){return kt(e)??e}var wo=R(M(),1),et=class e extends k{static summary="List stores in a Shopify organization.";static descriptionWithMarkdown="Lists stores in a Shopify organization available to the current CLI account.\n\nWhen more than one organization is available, the command prompts you to pick one unless you provide `--organization-id`. In that case, `--organization-id` is required in non-interactive environments.\n\nRun `<%= config.bin %> organization list` to find organization IDs.";static jsonOutputSchema=Bt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --organization-id 1234567","<%= config.bin %> <%= command.id %> --type dev","<%= config.bin %> <%= command.id %> --json"];static flags={...y,...w,"organization-id":wo.Flags.integer({description:`${b["organization-id"].description} Required if non interactive when more than one organization is available.`,env:"SHOPIFY_FLAG_ORGANIZATION_ID"}),type:wo.Flags.string({description:"List only stores of this type.",options:$t,env:"SHOPIFY_FLAG_STORE_TYPE"})};async run(){let{flags:t}=await this.parse(e),o=await ba({organizationId:t["organization-id"],storeType:t.type});Aa(o,t.json?"json":"text")}};n();n();var zc={getStoreInfo:Ut,openURL:ut};async function Oa(e,t={}){let{getStoreInfo:o,openURL:r}={...zc,...t},i=await o({store:e.store}),a=Bc(i),p=await r(a),m=re(i.subdomain);return{storeDomain:m?`${m}.myshopify.com`:null,url:a,opened:p}}function Bc(e){return e.accessUrl??`https://${e.subdomain}`}n();n();var jt=x({name:"OpenStoreResult",schema:s.object({storeDomain:nt.nullable(),url:s.string().url(),opened:s.boolean()}).strict()});function Ia(e,t){if(t==="json"){g(jt.encode(e));return}if(e.opened){I({headline:`Opening the storefront for ${e.storeDomain??e.url} in your browser.`});return}I({headline:"Browser didn't open automatically. Open the storefront manually:",body:[d`${u.link(e.url,e.url)}`.value]})}var tt=class e extends k{static summary="Open your Shopify store in the default web browser.";static descriptionWithMarkdown="Opens the storefront for a store you have access to in your default web browser.";static jsonOutputSchema=jt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com"];static flags={...y,...w,store:b.store};async run(){let{flags:t}=await this.parse(e),o=await Oa({store:t.store});Ia(o,t.json?"json":"text")}};var jc={"store:auth:list":De,"store:auth":Re,"store:bulk:cancel":$e,"store:bulk:execute":Ue,"store:bulk:status":ze,"store:stripe-auth":Be,"store:create:dev":He,"store:create:preview":Ge,"store:delete":We,"store:execute":Ke,"store:graphiql":Xe,"store:info":Ze,"store:list":et,"store:open":tt},Ht=jc;n();var Mt={"app:build":$r,"app:bulk:cancel":Ur,"app:bulk:status":zr,"app:deploy":Gr,"app:dev":Jr,"app:dev:clean":Tn,"app:security:check":Vr,"app:security:clean":Wr,"app:security:instructions":Qr,"app:security:record":Yr,"app:security:review":Kr,"app:logs":Xr,"app:logs-next":Zr,"app:import:channel-config":_n,"app:import:custom-data-definitions":Nn,"app:import:dashboard-extensions":mn,"app:import-custom-data-definitions":Fn,"app:import-extensions":ln,"app:info":fn,"app:init":hn,"app:config:validate":Sn,"app:release":gn,"app:subscription-migrations:cancel":yn,"app:subscription-migrations:list":wn,"app:subscription-migrations:schedule":kn,"app:subscription-migrations:status":bn,"app:subscription-migrations:unschedule":vn,"app:config:link":Br,"app:config:use":jr,"app:config:pull":Hr,"app:env:pull":en,"app:env:show":tn,"app:execute":rn,"app:graphiql":nn,"app:bulk:execute":on,"app:function:build":an,"app:function:replay":sn,"app:function:run":cn,"app:function:info":En,"app:function:schema":un,"app:function:typegen":pn,"app:generate:extension":dn,"app:versions:list":An,"app:webhook:trigger":xn,"demo:watcher":Mr,"organization:list":Cn},Hc=In,Mc=On;var ob=qr.init;(0,Ea.createGlobalProxyAgent)({environmentVariableNamespace:"SHOPIFY_",forceGlobalAgent:!0,socketConnectionTimeout:6e4});process.on("uncaughtException",async e=>{await ar(e),process.exit(1)});var Gc=process,ko=!1,Jc=["SIGINT","SIGTERM","SIGQUIT"];Jc.forEach(e=>{process.on(e,()=>{ko||(ko=Gc.emit("shopify:signal",e),ko||process.exit(1))})});var Ta=Number(process.env.SHOPIFY_CLI_COLUMNS);isNaN(Ta)||(process.stdout.columns=Ta);async function Vc({development:e}){await Bo({moduleURL:import.meta.url,development:e})}ke.plugins.hidden=!0;ke["plugins:install"].description="";var Wc=Object.keys(Mt);Wc.forEach(e=>{Mt[e].customPluginName="@shopify/app"});var Qc=Object.keys(ht);Qc.forEach(e=>{ht[e].customPluginName="@shopify/theme"});var Yc=Object.keys(St);Yc.forEach(e=>{St[e].customPluginName="@shopify/cli-hydrogen"});var Kc=Object.keys(Ht);Kc.forEach(e=>{Ht[e].customPluginName="@shopify/store"});var Xc=Object.keys(gt);Xc.forEach(e=>{gt[e].customPluginName="@oclif/plugin-commands"});var Zc=Object.keys(yt);Zc.forEach(e=>{yt[e].customPluginName="@shopify/plugin-did-you-mean"});var eu=Object.keys(ke);eu.forEach(e=>{ke[e].customPluginName="@oclif/plugin-plugins"});var rb={...Mt,...ht,...ke,...yt,...gt,...St,...Ht,search:Mo,upgrade:Go,version:Ho,"send-analytics":Jo,help:ir,"auth:logout":Vo,"auth:login":Wo,"debug:command-flags":Qo,"kitchen-sink":Zo,"kitchen-sink:async":Yo,"kitchen-sink:prompts":Ko,"kitchen-sink:static":Xo,"doctor-release":er,"doctor-release:theme":tr,"doc:fetch":or,"doc:search":rr,"docs:generate":nr,"notifications:list":sr,"notifications:generate":cr,"cache:clear":ur,"config:autoupgrade:off":pr,"config:autoupgrade:on":dr,"config:autoupgrade:status":mr},nb=Vc;export{Mc as AppPublicMetadataHook,Hc as AppSensitiveMetadataHook,rb as COMMANDS,La as DidYouMeanHook,ob as HydrogenInitHook,Da as PluginHook,Ra as TunnelProviderHook,qa as TunnelStartHook,nb as default,Fa as fetchStoreThemes,Ca as pull,Pa as push};
119
+ Use \`--json\` for machine-readable output.`;static jsonOutputSchema=zt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --json"];static flags={...y,...w,store:b.store};async run(){let{flags:t}=await this.parse(e),o=await Ut({store:t.store});Sa(o,t.json?"json":"text")}};n();n();n();n();n();var ga={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"ListAccessibleShops"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"filters"}},type:{kind:"ListType",type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ShopFilterInput"}}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"accessibleShops"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}},{kind:"Argument",name:{kind:"Name",value:"sort"},value:{kind:"EnumValue",value:"SHOP_CREATED_AT_DESC"}},{kind:"Argument",name:{kind:"Name",value:"filters"},value:{kind:"Variable",name:{kind:"Name",value:"filters"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"edges"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"node"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"shopifyShopId"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"storeType"}},{kind:"Field",name:{kind:"Name",value:"planName"}},{kind:"Field",name:{kind:"Name",value:"primaryDomain"}},{kind:"Field",name:{kind:"Name",value:"url"}},{kind:"Field",name:{kind:"Name",value:"createdAt"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};async function ya(e){let{entries:t,hasMore:o}=await Oc(e.token,e.organization,e.storeType);return{entries:t.sort(Ec),hasMore:o}}async function Oc(e,t,o){let r=V(),a=(await K(t,{query:ga,token:e,variables:{first:250,filters:Ic(o)},unauthorizedHandler:r})).organization?.accessibleShops;if(!a)return{entries:[],hasMore:!1};let p=[];for(let m of a.edges){let l=Tc(m.node,t);l&&p.push(l)}return{entries:p,hasMore:a.pageInfo.hasNextPage}}function Ic(e){let t=[{field:"STORE_STATUS",operator:"EQUALS",value:"active"}];return e&&t.push({field:"STORE_TYPE",operator:"EQUALS",value:da(e)}),t}function Tc(e,t){let o=e.url??e.primaryDomain;if(o)return{...e.shopifyShopId?{id:`gid://shopify/Shop/${e.shopifyShopId}`}:{},store:z(o)??o,...e.primaryDomain?{primaryDomain:z(e.primaryDomain)??e.primaryDomain}:{},createdAt:typeof e.createdAt=="string"?e.createdAt:String(e.createdAt),organizationId:t.id,organizationName:t.businessName,name:e.name,type:qt(e.storeType),plan:Rt(e.planName)}}function Ec(e,t){return e.createdAt===t.createdAt?e.store.localeCompare(t.store):t.createdAt.localeCompare(e.createdAt)}async function ka(e={}){let t=await B([],{allowAutomationToken:!0});if(e.organizationId){let i=await _r(e.organizationId.toString(),t);if(i)return wa(t,i,e.storeType)}let o=await lt(t);if(!o.currentUserResolved)return{stores:[],notice:"Couldn't resolve a Shopify account for the current CLI session."};if(o.organizations.length===0)return{stores:[]};if(!e.organizationId&&o.organizations.length>1&&!ct())throw new c("An organization ID is required to list stores non-interactively.","Provide `--organization-id`, for example `--organization-id 1234567`. Run `shopify organization list` to find IDs.");let r=await _c(o.organizations,e.organizationId);return wa(t,r,e.storeType)}async function wa(e,t,o){let r=await ya({token:e,organization:t,storeType:o}),{stores:i,truncated:a}=Fc(r.entries,r.hasMore);return{stores:i,organization:Nc(t),...o?{storeType:o}:{},...a?{truncated:!0}:{}}}async function _c(e,t){if(t){let a=e.find(p=>p.id===t.toString());if(!a)throw new c(`Organization with ID ${t} not found.`,`Available organizations: ${e.map(p=>`${p.businessName} (${p.id})`).join(", ")}`);return a}if(e.length===1)return e[0];let r=new Set(e.map(a=>a.businessName)).size<e.length,i=await Lo({message:"Which organization do you want to use?",choices:e.map(a=>({label:r?`${a.businessName} (${a.id})`:a.businessName,value:a.id}))});return e.find(a=>a.id===i)}function Nc(e){return{id:e.id,name:e.businessName}}function Fc(e,t){return{stores:e.slice(0,250),truncated:t||e.length>250}}n();n();var ba=s.object({id:A.shape.id.optional(),store:A.shape.subdomain,primaryDomain:s.string().optional().describe("The primary storefront hostname, which may be a custom domain."),createdAt:s.string(),organizationId:A.shape.organizationId,organizationName:A.shape.organizationName,name:A.shape.name.optional(),type:A.shape.type,plan:A.shape.plan}),Bt=x({name:"StoreListResult",schema:s.object({stores:s.array(ba),organization:ce.optional(),storeType:s.enum($t).optional(),notice:s.string().optional(),truncated:s.boolean().optional()}),definitions:{StoreListEntry:ba,StoreListOrganization:ce}});var Cc=["To list stores authenticated directly with",{command:"shopify store auth"},{char:","},"run",{command:"shopify store auth list"},{char:"."}];function va(e,t){if(e.notice&&oo(e.notice),e.truncated&&oo(Pc(e)),t==="json"){g(Bt.encode(e));return}Dc(e)}function Pc(e){let t=e.organization?` in ${e.organization.name}`:" in this organization";return`Showing the ${250} most recent ${Aa(e.storeType)}${t}. More stores exist.`}function Aa(e){return e?`${e.replaceAll("-"," ")} stores`:"stores"}function Dc(e){I({headline:Lc(e),customSections:[...Rc(e.organization),{body:Cc}]}),e.stores.length>0&&qc(e.stores)}function Lc(e){let t=Aa(e.storeType);return e.stores.length>0?`Listing ${t}.`:e.notice?`No ${t} were returned for the current CLI session.`:`No ${t} found.`}function Rc(e){return e?[{body:{tabularData:[["Organization",`${e.name} (${e.id})`]],firstColumnSubdued:!0}}]:[]}function qc(e){he({rows:e.map(t=>({subdomain:$c(t.store),name:t.name??"",type:ua(t.type),plan:ca(t.plan),created:wt(t.createdAt)})),columns:{subdomain:{header:"Subdomain"},name:{header:"Name"},type:{header:"Type"},plan:{header:"Plan"},created:{header:"Created"}}})}function $c(e){return kt(e)??e}var wo=R(M(),1),et=class e extends k{static summary="List stores in a Shopify organization.";static descriptionWithMarkdown="Lists stores in a Shopify organization available to the current CLI account.\n\nWhen more than one organization is available, the command prompts you to pick one unless you provide `--organization-id`. In that case, `--organization-id` is required in non-interactive environments.\n\nRun `<%= config.bin %> organization list` to find organization IDs.";static jsonOutputSchema=Bt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --organization-id 1234567","<%= config.bin %> <%= command.id %> --type dev","<%= config.bin %> <%= command.id %> --json"];static flags={...y,...w,"organization-id":wo.Flags.integer({description:`${b["organization-id"].description} Required if non interactive when more than one organization is available.`,env:"SHOPIFY_FLAG_ORGANIZATION_ID"}),type:wo.Flags.string({description:"List only stores of this type.",options:$t,env:"SHOPIFY_FLAG_STORE_TYPE"})};async run(){let{flags:t}=await this.parse(e),o=await ka({organizationId:t["organization-id"],storeType:t.type});va(o,t.json?"json":"text")}};n();n();var Uc={getStoreInfo:Ut,openURL:ut};async function xa(e,t={}){let{getStoreInfo:o,openURL:r}={...Uc,...t},i=await o({store:e.store}),a=zc(i),p=await r(a),m=re(i.subdomain);return{storeDomain:m?`${m}.myshopify.com`:null,url:a,opened:p}}function zc(e){return e.accessUrl??`https://${e.subdomain}`}n();n();var jt=x({name:"OpenStoreResult",schema:s.object({storeDomain:nt.nullable(),url:s.string().url(),opened:s.boolean()}).strict()});function Oa(e,t){if(t==="json"){g(jt.encode(e));return}if(e.opened){I({headline:`Opening the storefront for ${e.storeDomain??e.url} in your browser.`});return}I({headline:"Browser didn't open automatically. Open the storefront manually:",body:[d`${u.link(e.url,e.url)}`.value]})}var tt=class e extends k{static summary="Open your Shopify store in the default web browser.";static descriptionWithMarkdown="Opens the storefront for a store you have access to in your default web browser.";static jsonOutputSchema=jt;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com"];static flags={...y,...w,store:b.store};async run(){let{flags:t}=await this.parse(e),o=await xa({store:t.store});Oa(o,t.json?"json":"text")}};var Bc={"store:auth:list":De,"store:auth":Re,"store:bulk:cancel":$e,"store:bulk:execute":Ue,"store:bulk:status":ze,"store:stripe-auth":Be,"store:create:dev":He,"store:create:preview":Ge,"store:delete":We,"store:execute":Ke,"store:graphiql":Xe,"store:info":Ze,"store:list":et,"store:open":tt},Ht=Bc;n();var Mt={"app:build":$r,"app:bulk:cancel":Ur,"app:bulk:status":zr,"app:deploy":Gr,"app:dev":Jr,"app:dev:clean":In,"app:security:check":Vr,"app:security:clean":Wr,"app:security:instructions":Qr,"app:security:record":Yr,"app:security:review":Kr,"app:logs":Xr,"app:import:channel-config":En,"app:import:custom-data-definitions":_n,"app:import:dashboard-extensions":dn,"app:import-custom-data-definitions":Nn,"app:import-extensions":mn,"app:info":ln,"app:init":fn,"app:config:validate":hn,"app:release":Sn,"app:subscription-migrations:cancel":gn,"app:subscription-migrations:list":yn,"app:subscription-migrations:schedule":wn,"app:subscription-migrations:status":kn,"app:subscription-migrations:unschedule":bn,"app:config:link":Br,"app:config:use":jr,"app:config:pull":Hr,"app:env:pull":Zr,"app:env:show":en,"app:execute":on,"app:graphiql":rn,"app:bulk:execute":tn,"app:function:build":nn,"app:function:replay":an,"app:function:run":sn,"app:function:info":Tn,"app:function:schema":cn,"app:function:typegen":un,"app:generate:extension":pn,"app:versions:list":vn,"app:webhook:trigger":An,"demo:watcher":Mr,"organization:list":Fn},jc=On,Hc=xn;var eb=qr.init;(0,Ta.createGlobalProxyAgent)({environmentVariableNamespace:"SHOPIFY_",forceGlobalAgent:!0,socketConnectionTimeout:6e4});process.on("uncaughtException",async e=>{await ar(e),process.exit(1)});var Mc=process,ko=!1,Gc=["SIGINT","SIGTERM","SIGQUIT"];Gc.forEach(e=>{process.on(e,()=>{ko||(ko=Mc.emit("shopify:signal",e),ko||process.exit(1))})});var Ia=Number(process.env.SHOPIFY_CLI_COLUMNS);isNaN(Ia)||(process.stdout.columns=Ia);async function Jc({development:e}){await Bo({moduleURL:import.meta.url,development:e})}ke.plugins.hidden=!0;ke["plugins:install"].description="";var Vc=Object.keys(Mt);Vc.forEach(e=>{Mt[e].customPluginName="@shopify/app"});var Wc=Object.keys(ht);Wc.forEach(e=>{ht[e].customPluginName="@shopify/theme"});var Qc=Object.keys(St);Qc.forEach(e=>{St[e].customPluginName="@shopify/cli-hydrogen"});var Yc=Object.keys(Ht);Yc.forEach(e=>{Ht[e].customPluginName="@shopify/store"});var Kc=Object.keys(gt);Kc.forEach(e=>{gt[e].customPluginName="@oclif/plugin-commands"});var Xc=Object.keys(yt);Xc.forEach(e=>{yt[e].customPluginName="@shopify/plugin-did-you-mean"});var Zc=Object.keys(ke);Zc.forEach(e=>{ke[e].customPluginName="@oclif/plugin-plugins"});var tb={...Mt,...ht,...ke,...yt,...gt,...St,...Ht,search:Mo,upgrade:Go,version:Ho,"send-analytics":Jo,help:ir,"auth:logout":Vo,"auth:login":Wo,"debug:command-flags":Qo,"kitchen-sink":Zo,"kitchen-sink:async":Yo,"kitchen-sink:prompts":Ko,"kitchen-sink:static":Xo,"doctor-release":er,"doctor-release:theme":tr,"doc:fetch":or,"doc:search":rr,"docs:generate":nr,"notifications:list":sr,"notifications:generate":cr,"cache:clear":ur,"config:autoupgrade:off":pr,"config:autoupgrade:on":dr,"config:autoupgrade:status":mr},ob=Jc;export{Hc as AppPublicMetadataHook,jc as AppSensitiveMetadataHook,tb as COMMANDS,Da as DidYouMeanHook,eb as HydrogenInitHook,Pa as PluginHook,La as TunnelProviderHook,Ra as TunnelStartHook,ob as default,Na as fetchStoreThemes,Fa as pull,Ca as push};