shopify 5.0.0 → 5.0.2

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 (330) hide show
  1. package/dist/{analytics-Q6QDIDYT.js → analytics-NMMVOF4B.js} +1 -1
  2. package/dist/{analytics-VKKJNJ62.js → analytics-UK77WNLG.js} +1 -1
  3. package/dist/bootstrap.js +1 -1
  4. package/dist/{chunk-Q5MEFIMV.js → chunk-224UPIYS.js} +1 -1
  5. package/dist/{chunk-XBQDMGUN.js → chunk-26PWHH3B.js} +1 -1
  6. package/dist/{chunk-46MSIQ6Z.js → chunk-27NXPOAS.js} +1 -1
  7. package/dist/{chunk-SFPXYHHL.js → chunk-2A2JSAAA.js} +1 -1
  8. package/dist/{chunk-P33TONYG.js → chunk-2L6AN3QA.js} +1 -1
  9. package/dist/{chunk-43KLFFP7.js → chunk-2MT3LSMZ.js} +1 -1
  10. package/dist/{chunk-PGLWZMJU.js → chunk-2T4HDR6R.js} +1 -1
  11. package/dist/{chunk-5UWMXOHM.js → chunk-2WJOTJOD.js} +1 -1
  12. package/dist/{chunk-HIRTL45Q.js → chunk-2ZBXHCQZ.js} +1 -1
  13. package/dist/chunk-33ZE3DRQ.js +16 -0
  14. package/dist/{chunk-WFWISGLS.js → chunk-34MOWGRL.js} +1 -1
  15. package/dist/{chunk-AXC2MHHO.js → chunk-35XFNKNB.js} +1 -1
  16. package/dist/{chunk-LHKVXJPX.js → chunk-3JSKNXL7.js} +1 -1
  17. package/dist/{chunk-Q2SZCZE7.js → chunk-3KM5ZOW2.js} +1 -1
  18. package/dist/{chunk-KJQDS5HI.js → chunk-3MG4MTWQ.js} +1 -1
  19. package/dist/{chunk-MDRVCBDO.js → chunk-3MYDSQHF.js} +1 -1
  20. package/dist/{chunk-MYAIWSOO.js → chunk-3ODQKAEA.js} +1 -1
  21. package/dist/{chunk-6DXP7PQ7.js → chunk-3XRI3D44.js} +1 -1
  22. package/dist/{chunk-KGRIYAMA.js → chunk-3Z3MADXZ.js} +1 -1
  23. package/dist/{chunk-GB6E3ATN.js → chunk-4KECSZTL.js} +1 -1
  24. package/dist/{chunk-G6ZMSWEU.js → chunk-4WYKPIN3.js} +1 -1
  25. package/dist/{chunk-M3ACZWMR.js → chunk-5AEZJZNQ.js} +1 -1
  26. package/dist/chunk-5ED7SOQZ.js +20 -0
  27. package/dist/{chunk-FFHH5LOR.js → chunk-5IDJALJH.js} +1 -1
  28. package/dist/{chunk-GXORLBVN.js → chunk-62EOM3Y2.js} +1 -1
  29. package/dist/{chunk-EXFBZPZS.js → chunk-64G5TGFF.js} +1 -1
  30. package/dist/{chunk-QN3774QI.js → chunk-66TMIQMB.js} +1 -1
  31. package/dist/{chunk-L7MSPGDS.js → chunk-67L7FIB6.js} +1 -1
  32. package/dist/{chunk-7UOA4DI7.js → chunk-6ES4KRFW.js} +1 -1
  33. package/dist/{chunk-XMODGI45.js → chunk-74NRFUGQ.js} +1 -1
  34. package/dist/{chunk-YVY32DNA.js → chunk-7CCTPBCT.js} +1 -1
  35. package/dist/{chunk-2DID73ML.js → chunk-7GUMJ5E4.js} +1 -1
  36. package/dist/{chunk-IUTZIN2T.js → chunk-7NFTSBHQ.js} +1 -1
  37. package/dist/{chunk-TPSA4JN5.js → chunk-ACZNWIRY.js} +1 -1
  38. package/dist/{chunk-CCMDZX35.js → chunk-AQ6EVL73.js} +1 -1
  39. package/dist/{chunk-7WPUV7GY.js → chunk-AQKWPRZE.js} +1 -1
  40. package/dist/chunk-AUE7LM32.js +1 -0
  41. package/dist/{chunk-PIAD3F6M.js → chunk-AXL2VIWA.js} +1 -1
  42. package/dist/{chunk-CVVQQLCF.js → chunk-B2O3ANRZ.js} +1 -1
  43. package/dist/chunk-B3ZJGYZY.js +3 -0
  44. package/dist/{chunk-4SS6DXC7.js → chunk-BWN2QG6D.js} +1 -1
  45. package/dist/{chunk-6BNKBCCU.js → chunk-C3RFAKWR.js} +1 -1
  46. package/dist/{chunk-SNNZ4U2W.js → chunk-CCUQM4FX.js} +1 -1
  47. package/dist/{chunk-EITIW5OX.js → chunk-CGVROSPS.js} +1 -1
  48. package/dist/{chunk-7QUZWCJZ.js → chunk-CLUUA3HX.js} +1 -1
  49. package/dist/{chunk-X7HVAVSZ.js → chunk-CXI3RHPW.js} +1 -1
  50. package/dist/chunk-CYEEGTVZ.js +11 -0
  51. package/dist/{chunk-CZ22VZDA.js → chunk-D2KIGKBI.js} +108 -108
  52. package/dist/chunk-DBDTE3EE.js +5 -0
  53. package/dist/{chunk-YKS7MH3F.js → chunk-DLVB3237.js} +1 -1
  54. package/dist/{chunk-UZROQRLX.js → chunk-DN6X7SHW.js} +1 -1
  55. package/dist/{chunk-OGWPS55W.js → chunk-DZKFP6H2.js} +1 -1
  56. package/dist/{chunk-S67I4E7M.js → chunk-E5COIKGY.js} +1 -1
  57. package/dist/{chunk-CW2T7EOQ.js → chunk-E6RONHMT.js} +1 -1
  58. package/dist/{chunk-2CMEKSI7.js → chunk-EAZIQI2D.js} +1 -1
  59. package/dist/{chunk-FNLECT7B.js → chunk-EEY4FKAW.js} +1 -1
  60. package/dist/{chunk-YGYEM6QO.js → chunk-EKFPTBXC.js} +1 -1
  61. package/dist/{chunk-VW6QS7DO.js → chunk-ER6C5WS3.js} +1 -1
  62. package/dist/{chunk-MR2AUT7Q.js → chunk-ESFCYB46.js} +1 -1
  63. package/dist/{chunk-GRGFA26K.js → chunk-F3CK3EJJ.js} +1 -1
  64. package/dist/{chunk-M4BVLMPH.js → chunk-FEBOZ2XX.js} +1 -1
  65. package/dist/{chunk-5OMJFPQW.js → chunk-GNCVDN7U.js} +1 -1
  66. package/dist/{chunk-H4V55Y3Z.js → chunk-GQLNG537.js} +83 -83
  67. package/dist/{chunk-IEQ4UOH3.js → chunk-GVI3DWSB.js} +1 -1
  68. package/dist/{chunk-DFQ4WTET.js → chunk-GW7YIJPJ.js} +1 -1
  69. package/dist/{chunk-SFQEHDJY.js → chunk-H6GNKWYM.js} +1 -1
  70. package/dist/{chunk-5TB52UUV.js → chunk-H6GYBLVQ.js} +1 -1
  71. package/dist/chunk-HSKDFEXW.js +1 -0
  72. package/dist/{chunk-JYMDWR25.js → chunk-HTRJU4R4.js} +1 -1
  73. package/dist/{chunk-EMSF57ZB.js → chunk-HXZAY5OA.js} +1 -1
  74. package/dist/{chunk-WJSUIUBW.js → chunk-I4CEH7AK.js} +1 -1
  75. package/dist/{chunk-4ARCB6DT.js → chunk-I7PEEJVH.js} +1 -1
  76. package/dist/{chunk-CCQNP5YR.js → chunk-IHMATNOR.js} +1 -1
  77. package/dist/{chunk-N2RFDHRY.js → chunk-IHXGZW42.js} +1 -1
  78. package/dist/chunk-IJY3RJPJ.js +47 -0
  79. package/dist/{chunk-52FDK2LC.js → chunk-ISKQQXLZ.js} +1 -1
  80. package/dist/{chunk-UVRKTMF7.js → chunk-J55GQLP4.js} +1 -1
  81. package/dist/{chunk-3LVCG4JB.js → chunk-J5ERDFIC.js} +1 -1
  82. package/dist/{chunk-LWCTKI4Z.js → chunk-JLQRDFR5.js} +3 -3
  83. package/dist/{chunk-HCZG7YJ6.js → chunk-JPWRZ5SL.js} +1 -1
  84. package/dist/{chunk-BWRNXCVN.js → chunk-K7ZSPQKL.js} +1 -1
  85. package/dist/{chunk-4GCI2YCZ.js → chunk-KNWT7JLL.js} +1 -1
  86. package/dist/{chunk-U25W35TX.js → chunk-KZRLZWOU.js} +1 -1
  87. package/dist/chunk-L5TSPCSY.js +26 -0
  88. package/dist/{chunk-J6TW43TG.js → chunk-LEHBZKK3.js} +1 -1
  89. package/dist/chunk-LGXI7EGM.js +8 -0
  90. package/dist/{chunk-3A3DZVEJ.js → chunk-LHXFTFFM.js} +1 -1
  91. package/dist/{chunk-4RDFMBRG.js → chunk-LUGMXSRI.js} +1 -1
  92. package/dist/chunk-M2CWCOFU.js +11 -0
  93. package/dist/{chunk-2VSNFOKD.js → chunk-M5VIFG2V.js} +1 -1
  94. package/dist/{chunk-IWEKM5Y3.js → chunk-MADINS4Z.js} +1 -1
  95. package/dist/{chunk-VMMUJN4T.js → chunk-MEYVUHQH.js} +1 -1
  96. package/dist/{chunk-PEVIRAMR.js → chunk-MGHPF7HU.js} +1 -1
  97. package/dist/{chunk-ZT5WFUKJ.js → chunk-MHR5OHT5.js} +1 -1
  98. package/dist/{chunk-5NEGOQT6.js → chunk-MXEXP3HT.js} +1 -1
  99. package/dist/{chunk-IQVRP7CT.js → chunk-N57Y7THE.js} +1 -1
  100. package/dist/{chunk-FWB3GLMW.js → chunk-NVKJ7ZLP.js} +1 -1
  101. package/dist/{chunk-GQNOVEKP.js → chunk-NXAEBGMO.js} +1 -1
  102. package/dist/{chunk-PYIICTLX.js → chunk-OJULL7HT.js} +1 -1
  103. package/dist/{chunk-SL3VBI62.js → chunk-OMPQ7REW.js} +1 -1
  104. package/dist/{chunk-NK2MGR6A.js → chunk-OR4IJ4BQ.js} +1 -1
  105. package/dist/{chunk-CIK5BF7V.js → chunk-P2RMFHQP.js} +1 -1
  106. package/dist/{chunk-R7EMV77H.js → chunk-P4VZYOKO.js} +2 -2
  107. package/dist/{chunk-NDKSG4CC.js → chunk-PDZBKVWL.js} +1 -1
  108. package/dist/{chunk-QKVVJXWS.js → chunk-PF53E2DC.js} +1 -1
  109. package/dist/{chunk-XNNKLUTN.js → chunk-PLSS456F.js} +1 -1
  110. package/dist/{chunk-XM7YUXTF.js → chunk-PTSCGSQV.js} +2 -2
  111. package/dist/{chunk-KSDU4YOB.js → chunk-PWAT52M4.js} +1 -1
  112. package/dist/{chunk-NOH63WC6.js → chunk-Q2KWXZQB.js} +1 -1
  113. package/dist/{chunk-EGCWR5AS.js → chunk-Q4JYAUVL.js} +1 -1
  114. package/dist/{chunk-4CRBTSVP.js → chunk-Q5IC3IYY.js} +1 -1
  115. package/dist/{chunk-Z5SILNH2.js → chunk-QDCLL5OI.js} +1 -1
  116. package/dist/{chunk-VB7YQMAM.js → chunk-QEKGGTMN.js} +1 -1
  117. package/dist/{chunk-BJPDJIS4.js → chunk-QEVTBD33.js} +1 -1
  118. package/dist/{chunk-PZUGDE7N.js → chunk-QF5WKTPD.js} +1 -1
  119. package/dist/{chunk-7NSK77WG.js → chunk-QFSENE5T.js} +1 -1
  120. package/dist/{chunk-IUP7POIE.js → chunk-QQJNQNKP.js} +1 -1
  121. package/dist/{chunk-PSSYLJG4.js → chunk-QW52RPAU.js} +1 -1
  122. package/dist/{chunk-ULD7CIOY.js → chunk-R4UVIYZP.js} +1 -1
  123. package/dist/{chunk-M5TGCSUK.js → chunk-RLNIOJH3.js} +1 -1
  124. package/dist/{chunk-ZYQ2XWC5.js → chunk-RPCIFYCY.js} +1 -1
  125. package/dist/{chunk-C3KEDG33.js → chunk-RPVZ2JON.js} +1 -1
  126. package/dist/{chunk-I4OVLRQR.js → chunk-RW6G4ZPU.js} +1 -1
  127. package/dist/{chunk-4GOJQKY5.js → chunk-S4LOWCGS.js} +1 -1
  128. package/dist/{chunk-OQU3HLAE.js → chunk-S5P7KWY4.js} +1 -1
  129. package/dist/{chunk-UWMZ5CSB.js → chunk-SACNUF4I.js} +1 -1
  130. package/dist/chunk-SB27UOXX.js +1 -0
  131. package/dist/{chunk-YVVU4J5O.js → chunk-SHD4VV5V.js} +1 -1
  132. package/dist/{chunk-M7LPHCP2.js → chunk-SIL6HPMK.js} +2 -2
  133. package/dist/{chunk-AJMDF3QC.js → chunk-SK7EPN6C.js} +1 -1
  134. package/dist/{chunk-XITZIDCL.js → chunk-SLY27GDC.js} +1 -1
  135. package/dist/{chunk-C7V755IT.js → chunk-SNH4XZ6E.js} +1 -1
  136. package/dist/{chunk-POKY4RWR.js → chunk-T4XJKM6B.js} +1 -1
  137. package/dist/{chunk-7MVWDCI3.js → chunk-TAWCKJKP.js} +1 -1
  138. package/dist/{chunk-BCYTZ7LM.js → chunk-TFPW2VGN.js} +1 -1
  139. package/dist/{chunk-UOS2XLGG.js → chunk-TODZ3TJR.js} +1 -1
  140. package/dist/chunk-U2T5HPRD.js +319 -0
  141. package/dist/{chunk-XTREQ4A2.js → chunk-U6YOP562.js} +1 -1
  142. package/dist/{chunk-53BG3NLH.js → chunk-UBP3LQFY.js} +1 -1
  143. package/dist/{chunk-GFVKTWFT.js → chunk-UKWIWCOH.js} +1 -1
  144. package/dist/{chunk-GAMC2BNY.js → chunk-UPPO3BMT.js} +1 -1
  145. package/dist/{chunk-Q2XRITUG.js → chunk-URXM5A2K.js} +1 -1
  146. package/dist/chunk-USXIXANP.js +103 -0
  147. package/dist/{chunk-R2BDABJD.js → chunk-UUAKOX7E.js} +1 -1
  148. package/dist/{chunk-WGUOLSMG.js → chunk-UV5GAGAD.js} +1 -1
  149. package/dist/{chunk-AYL6KBPE.js → chunk-UXVXVI6O.js} +1 -1
  150. package/dist/{chunk-VWH3VPYI.js → chunk-UY6W2EVZ.js} +1 -1
  151. package/dist/{chunk-BVSKBX7T.js → chunk-UYELAINQ.js} +1 -1
  152. package/dist/{chunk-KDPQXURV.js → chunk-VAVXDIUX.js} +1 -1
  153. package/dist/{chunk-OX7UVDSU.js → chunk-VEUKT5EI.js} +1 -1
  154. package/dist/chunk-VGSH52JM.js +1 -0
  155. package/dist/chunk-VHZ6RL67.js +1 -0
  156. package/dist/{chunk-UK6576EO.js → chunk-VQA3X7O3.js} +1 -1
  157. package/dist/{chunk-TTEF7GTX.js → chunk-VZCMJRYV.js} +1 -1
  158. package/dist/{chunk-3G4HJO72.js → chunk-W37IFK3P.js} +1 -1
  159. package/dist/{chunk-LMQGNECW.js → chunk-W56ZGEQQ.js} +1 -1
  160. package/dist/{chunk-GCNA3HXH.js → chunk-WBVS5NBV.js} +1 -1
  161. package/dist/{chunk-XKRJKUA7.js → chunk-WCC52MR2.js} +1 -1
  162. package/dist/{chunk-LDU5T3DN.js → chunk-WESTVWWD.js} +1 -1
  163. package/dist/{chunk-24NUJTIH.js → chunk-WRZWHT6M.js} +1 -1
  164. package/dist/{chunk-4TI7U2PN.js → chunk-WSDKCQH6.js} +1 -1
  165. package/dist/{chunk-UIQL5ZF3.js → chunk-X2PFXSU4.js} +1 -1
  166. package/dist/{chunk-NB4BRW3H.js → chunk-X5NIAZA4.js} +1 -1
  167. package/dist/{chunk-RFGEM5JC.js → chunk-XBMD3FEZ.js} +1 -1
  168. package/dist/{chunk-I6FRVYGE.js → chunk-XDVPIGXE.js} +1 -1
  169. package/dist/chunk-XLIJYJ6Q.js +1 -0
  170. package/dist/chunk-XUHGWIWW.js +4 -0
  171. package/dist/{chunk-2ORRV7GH.js → chunk-XWSWXQCC.js} +1 -1
  172. package/dist/{chunk-Q66CI37F.js → chunk-Y55T4IIQ.js} +1 -1
  173. package/dist/{chunk-WMAFG2JD.js → chunk-Y5CVX5LJ.js} +1 -1
  174. package/dist/{chunk-VHUD3CBC.js → chunk-Y6J46XYF.js} +1 -1
  175. package/dist/{chunk-DJAZBPYA.js → chunk-YKMINHYY.js} +1 -1
  176. package/dist/{chunk-KKPOOIE4.js → chunk-YSWVYPWR.js} +1 -1
  177. package/dist/{chunk-D7NB7YR6.js → chunk-YV2TP44L.js} +1 -1
  178. package/dist/{chunk-7IFE4UQY.js → chunk-Z2WAW6MM.js} +1 -1
  179. package/dist/chunk-ZBL7XMJ6.js +25 -0
  180. package/dist/{chunk-YTUDXZLN.js → chunk-ZGBTO46A.js} +1 -1
  181. package/dist/{chunk-ZQDDRIBA.js → chunk-ZJOX5HW4.js} +4 -4
  182. package/dist/{chunk-MXJAH2GW.js → chunk-ZOOT3GBY.js} +1 -1
  183. package/dist/{chunk-ZAA2DXK5.js → chunk-ZRI3SSLG.js} +1 -1
  184. package/dist/cli/commands/app/build.js +1 -1
  185. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  186. package/dist/cli/commands/app/bulk/execute.js +1 -1
  187. package/dist/cli/commands/app/bulk/status.js +1 -1
  188. package/dist/cli/commands/app/config/link.js +1 -1
  189. package/dist/cli/commands/app/config/pull.js +1 -1
  190. package/dist/cli/commands/app/config/use.js +1 -1
  191. package/dist/cli/commands/app/config/validate.js +1 -1
  192. package/dist/cli/commands/app/demo/watcher.js +1 -1
  193. package/dist/cli/commands/app/deploy.js +1 -1
  194. package/dist/cli/commands/app/dev/clean.js +1 -1
  195. package/dist/cli/commands/app/dev.js +1 -1
  196. package/dist/cli/commands/app/env/pull.js +1 -1
  197. package/dist/cli/commands/app/env/show.js +1 -1
  198. package/dist/cli/commands/app/execute.js +1 -1
  199. package/dist/cli/commands/app/function/build.js +1 -1
  200. package/dist/cli/commands/app/function/info.js +1 -1
  201. package/dist/cli/commands/app/function/replay.js +1 -1
  202. package/dist/cli/commands/app/function/run.js +1 -1
  203. package/dist/cli/commands/app/function/schema.js +1 -1
  204. package/dist/cli/commands/app/function/typegen.js +1 -1
  205. package/dist/cli/commands/app/generate/extension.js +1 -1
  206. package/dist/cli/commands/app/graphiql.js +1 -1
  207. package/dist/cli/commands/app/import/channel-config.js +1 -1
  208. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  209. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  210. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  211. package/dist/cli/commands/app/import-extensions.js +1 -1
  212. package/dist/cli/commands/app/info.js +1 -1
  213. package/dist/cli/commands/app/init.js +1 -1
  214. package/dist/cli/commands/app/logs.js +1 -1
  215. package/dist/cli/commands/app/release.js +1 -1
  216. package/dist/cli/commands/app/security/check.js +1 -1
  217. package/dist/cli/commands/app/security/clean.js +1 -1
  218. package/dist/cli/commands/app/security/instructions.js +1 -1
  219. package/dist/cli/commands/app/security/record.js +1 -1
  220. package/dist/cli/commands/app/security/review.js +1 -1
  221. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  222. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  223. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  224. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  225. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  226. package/dist/cli/commands/app/versions/list.js +1 -1
  227. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  228. package/dist/cli/commands/auth/login.js +1 -1
  229. package/dist/cli/commands/auth/logout.js +1 -1
  230. package/dist/cli/commands/cache/clear.js +1 -1
  231. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  232. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  233. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  234. package/dist/cli/commands/debug/command-flags.js +1 -1
  235. package/dist/cli/commands/doc/fetch.js +1 -1
  236. package/dist/cli/commands/doc/search.js +1 -1
  237. package/dist/cli/commands/docs/generate.js +1 -1
  238. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  239. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  240. package/dist/cli/commands/help.js +1 -1
  241. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  242. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  243. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  244. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  245. package/dist/cli/commands/notifications/generate.js +1 -1
  246. package/dist/cli/commands/notifications/list.js +1 -1
  247. package/dist/cli/commands/organization/list.js +1 -1
  248. package/dist/cli/commands/search.js +1 -1
  249. package/dist/cli/commands/send-analytics.js +1 -1
  250. package/dist/cli/commands/theme/check.js +1 -1
  251. package/dist/cli/commands/theme/console.js +1 -1
  252. package/dist/cli/commands/theme/delete.js +1 -1
  253. package/dist/cli/commands/theme/dev.js +1 -1
  254. package/dist/cli/commands/theme/duplicate.js +1 -1
  255. package/dist/cli/commands/theme/info.js +1 -1
  256. package/dist/cli/commands/theme/init.js +1 -1
  257. package/dist/cli/commands/theme/language-server.js +1 -1
  258. package/dist/cli/commands/theme/list.js +1 -1
  259. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  260. package/dist/cli/commands/theme/open.js +1 -1
  261. package/dist/cli/commands/theme/package.js +1 -1
  262. package/dist/cli/commands/theme/preview.js +1 -1
  263. package/dist/cli/commands/theme/profile.js +1 -1
  264. package/dist/cli/commands/theme/publish.js +1 -1
  265. package/dist/cli/commands/theme/pull.js +1 -1
  266. package/dist/cli/commands/theme/push.js +1 -1
  267. package/dist/cli/commands/theme/rename.js +1 -1
  268. package/dist/cli/commands/theme/share.js +1 -1
  269. package/dist/cli/commands/upgrade.js +1 -1
  270. package/dist/cli/commands/version.js +1 -1
  271. package/dist/cli/help.js +1 -1
  272. package/dist/{command-json-schema-2UMKY7MY.js → command-json-schema-F5XF7XHL.js} +1 -1
  273. package/dist/command-registry.js +1 -1
  274. package/dist/{conf-store-RI3TL6I4.js → conf-store-5CBLWTOC.js} +1 -1
  275. package/dist/{custom-oclif-loader-IZCKN67O.js → custom-oclif-loader-UDVUFKMD.js} +1 -1
  276. package/dist/{deprecations-IFVUXXDB.js → deprecations-EOHPSTCS.js} +1 -1
  277. package/dist/dist-RNV3GFZ7.js +1 -0
  278. package/dist/dist-ZFKWJVNB.js +1 -0
  279. package/dist/{environments-CYMEN7NV.js → environments-4FLRZW4P.js} +1 -1
  280. package/dist/{error-IL6WQMSW.js → error-JY2ADS6S.js} +1 -1
  281. package/dist/{error-handler-74HKA23T.js → error-handler-4GCXKC6I.js} +1 -1
  282. package/dist/{fs-AINFLJ2E.js → fs-XS5YF34R.js} +1 -1
  283. package/dist/hooks/did-you-mean.js +1 -1
  284. package/dist/hooks/hydrogen-init.js +1 -1
  285. package/dist/hooks/postrun.js +1 -1
  286. package/dist/hooks/prerun.js +1 -1
  287. package/dist/hooks/public-metadata.js +1 -1
  288. package/dist/hooks/sensitive-metadata.js +1 -1
  289. package/dist/hooks/tunnel-provider.js +1 -1
  290. package/dist/hooks/tunnel-start.js +1 -1
  291. package/dist/index.js +12 -12
  292. package/dist/{is-global-2VLKV46Q.js → is-global-27MUENOK.js} +1 -1
  293. package/dist/{json-error-HZB5YIHV.js → json-error-S5XFS3UX.js} +1 -1
  294. package/dist/{local-KOZETREJ.js → local-OKPVB4NH.js} +1 -1
  295. package/dist/{metadata-IBPHZB7N.js → metadata-2YJBAKR7.js} +1 -1
  296. package/dist/{node-package-manager-DXSRNEDC.js → node-package-manager-B3OW3PFQ.js} +1 -1
  297. package/dist/{notifications-system-XA3EBOGJ.js → notifications-system-BWTDYBG2.js} +1 -1
  298. package/dist/{os-X73O7BAB.js → os-F6QKJCFW.js} +1 -1
  299. package/dist/{output-3OYXK3Z5.js → output-BRIPK7UC.js} +1 -1
  300. package/dist/{system-JWYYT4PM.js → system-466QKFDI.js} +1 -1
  301. package/dist/tsconfig.tsbuildinfo +1 -1
  302. package/dist/{ui-PCG5D6RZ.js → ui-VJTNGCS6.js} +1 -1
  303. package/dist/{upgrade-7U2TUNC4.js → upgrade-VHVJLXKX.js} +1 -1
  304. package/dist/{version-7DGU2KYH.js → version-FETZRLZO.js} +1 -1
  305. package/dist/version-T4XXTJMB.js +1 -0
  306. package/dist/{workerd-MQZ3NKJI.js → workerd-32DMKLMN.js} +1 -1
  307. package/oclif.manifest.json +6 -3
  308. package/package.json +7 -7
  309. package/dist/chunk-3C6VLJ5D.js +0 -319
  310. package/dist/chunk-4C2DAX5T.js +0 -1
  311. package/dist/chunk-7LAKWAKX.js +0 -25
  312. package/dist/chunk-7RPFJZLP.js +0 -1
  313. package/dist/chunk-CEIJKJOF.js +0 -11
  314. package/dist/chunk-DNMXVMJM.js +0 -47
  315. package/dist/chunk-FDXHQZTO.js +0 -26
  316. package/dist/chunk-JDR6UVZA.js +0 -8
  317. package/dist/chunk-JEA3C7ON.js +0 -3
  318. package/dist/chunk-JOJV5E2K.js +0 -1
  319. package/dist/chunk-LVLAOBJM.js +0 -103
  320. package/dist/chunk-OQ5CLM2H.js +0 -4
  321. package/dist/chunk-OVWUGAEU.js +0 -11
  322. package/dist/chunk-PMHP57MH.js +0 -20
  323. package/dist/chunk-RVQV6G5M.js +0 -1
  324. package/dist/chunk-T2IUXXCT.js +0 -1
  325. package/dist/chunk-WDFCOZAY.js +0 -16
  326. package/dist/chunk-X2H6I2WW.js +0 -5
  327. package/dist/chunk-ZGV3HNEV.js +0 -1
  328. package/dist/dist-4H2B7BMN.js +0 -1
  329. package/dist/dist-QNWOGQN3.js +0 -1
  330. package/dist/version-SXQTRBXB.js +0 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import{a as lt}from"./chunk-IILLQOUC.js";import{a as mt,b as Fr}from"./chunk-M7LPHCP2.js";import"./chunk-LQ7ENG4V.js";import"./chunk-R2BDABJD.js";import{a as On}from"./chunk-WGUOLSMG.js";import{a as dn}from"./chunk-2DID73ML.js";import{a as mn}from"./chunk-VHUD3CBC.js";import{a as ln}from"./chunk-UK6576EO.js";import{a as fn}from"./chunk-TTEF7GTX.js";import{a as hn}from"./chunk-TPSA4JN5.js";import"./chunk-VB7YQMAM.js";import"./chunk-GXORLBVN.js";import"./chunk-3LVCG4JB.js";import"./chunk-NDKSG4CC.js";import{a as Sn}from"./chunk-VWH3VPYI.js";import{a as gn}from"./chunk-7LAKWAKX.js";import{a as $r}from"./chunk-G6ZMSWEU.js";import{a as cn}from"./chunk-IUTZIN2T.js";import{a as Jr}from"./chunk-XKRJKUA7.js";import{a as pn}from"./chunk-ULD7CIOY.js";import{a as Br}from"./chunk-IEQ4UOH3.js";import{a as Hr}from"./chunk-JYMDWR25.js";import{a as jr}from"./chunk-WFWISGLS.js";import"./chunk-HCZG7YJ6.js";import{a as Mr}from"./chunk-CCQNP5YR.js";import{a as Gr}from"./chunk-NOH63WC6.js";import"./chunk-V75WUEFU.js";import"./chunk-HB3MJYBK.js";import"./chunk-NB4BRW3H.js";import"./chunk-QN3774QI.js";import"./chunk-LMQGNECW.js";import{a as rn}from"./chunk-JDR6UVZA.js";import{a as _r,b as Nr,c as Kr}from"./chunk-JEA3C7ON.js";import{a as xn}from"./chunk-LDU5T3DN.js";import{a as an}from"./chunk-52FDK2LC.js";import"./chunk-XNNKLUTN.js";import{a as vn}from"./chunk-GAMC2BNY.js";import{a as An}from"./chunk-OQ5CLM2H.js";import{a as nn}from"./chunk-KJQDS5HI.js";import{a as sn}from"./chunk-CEIJKJOF.js";import{a as Wr}from"./chunk-XMODGI45.js";import"./chunk-L7MSPGDS.js";import{a as Yr}from"./chunk-I4OVLRQR.js";import{a as Xr}from"./chunk-YGYEM6QO.js";import{a as bn}from"./chunk-PIAD3F6M.js";import{a as Zr}from"./chunk-4SS6DXC7.js";import{a as en}from"./chunk-4ARCB6DT.js";import"./chunk-2CMEKSI7.js";import{a as tn}from"./chunk-YTUDXZLN.js";import{a as on}from"./chunk-M3ACZWMR.js";import"./chunk-4GOJQKY5.js";import{a as Lr}from"./chunk-Q5MEFIMV.js";import{a as qr}from"./chunk-NK2MGR6A.js";import{a as Rr}from"./chunk-UIQL5ZF3.js";import{a as un}from"./chunk-7NSK77WG.js";import{a as Ur}from"./chunk-XITZIDCL.js";import"./chunk-PZUGDE7N.js";import{a as dt,b as zr}from"./chunk-FDXHQZTO.js";import"./chunk-UOHNRH6E.js";import{a as xa}from"./chunk-QKVVJXWS.js";import"./chunk-YKS7MH3F.js";import"./chunk-7WPUV7GY.js";import"./chunk-53BG3NLH.js";import{h as Oa}from"./chunk-YVVU4J5O.js";import"./chunk-AYL6KBPE.js";import"./chunk-PYIICTLX.js";import"./chunk-SL3VBI62.js";import"./chunk-4GCI2YCZ.js";import"./chunk-Z5SILNH2.js";import"./chunk-HIRTL45Q.js";import"./chunk-ZYQ2XWC5.js";import"./chunk-CCMDZX35.js";import"./chunk-PMHP57MH.js";import"./chunk-5NEGOQT6.js";import"./chunk-5UWMXOHM.js";import"./chunk-HF4NDEX3.js";import"./chunk-M4BVLMPH.js";import"./chunk-J3JPJCWP.js";import"./chunk-VMMUJN4T.js";import"./chunk-IWEKM5Y3.js";import"./chunk-LVLAOBJM.js";import"./chunk-JLGA3B7P.js";import"./chunk-BCYTZ7LM.js";import"./chunk-DNMXVMJM.js";import"./chunk-RFGEM5JC.js";import"./chunk-6PUU6ZNQ.js";import"./chunk-KSDU4YOB.js";import"./chunk-PSSYLJG4.js";import"./chunk-SFPXYHHL.js";import"./chunk-EITIW5OX.js";import"./chunk-N2RFDHRY.js";import"./chunk-YY6TFARF.js";import"./chunk-P33TONYG.js";import{b as Aa}from"./chunk-LHKVXJPX.js";import"./chunk-QFWWCZOI.js";import"./chunk-5TB52UUV.js";import"./chunk-GCNA3HXH.js";import{a as H,b as pr,c as Y,d as Se,e as ge}from"./chunk-DJAZBPYA.js";import"./chunk-7IFE4UQY.js";import"./chunk-U25W35TX.js";import"./chunk-UWMZ5CSB.js";import"./chunk-XM7YUXTF.js";import"./chunk-3G4HJO72.js";import"./chunk-SFQEHDJY.js";import"./chunk-Q7BOSHWX.js";import"./chunk-R7EMV77H.js";import"./chunk-6BNKBCCU.js";import"./chunk-MXJAH2GW.js";import"./chunk-PEVIRAMR.js";import"./chunk-EMSF57ZB.js";import"./chunk-PGLWZMJU.js";import"./chunk-UWHAOGO4.js";import"./chunk-ZI7LK3LW.js";import"./chunk-ACA2BGAD.js";import"./chunk-XBQDMGUN.js";import{a as kn}from"./chunk-S67I4E7M.js";import{a as Vr}from"./chunk-OVWUGAEU.js";import"./chunk-FKIVKNOV.js";import"./chunk-T2IUXXCT.js";import"./chunk-7GHSE7SG.js";import{a as sr}from"./chunk-4TI7U2PN.js";import{a as cr}from"./chunk-SNNZ4U2W.js";import{a as ur}from"./chunk-KDPQXURV.js";import"./chunk-2ORRV7GH.js";import{a as Xo}from"./chunk-AXC2MHHO.js";import{a as Cr}from"./chunk-CIK5BF7V.js";import"./chunk-7RPFJZLP.js";import"./chunk-YVY32DNA.js";import{a as Pr}from"./chunk-UZROQRLX.js";import{a as Qr}from"./chunk-GB6E3ATN.js";import{a as Dr}from"./chunk-X2H6I2WW.js";import"./chunk-7QUZWCJZ.js";import"./chunk-RVQV6G5M.js";import{a as se,b as dr,c as ye,e as we,f as Ce,g as mr,h as lr,i as fr,j as hr,k as Sr,l as gr,m as pt,n as yr,o as wr,p as kr,q as br,r as vr,s as eo}from"./chunk-OGWPS55W.js";import"./chunk-UVRKTMF7.js";import"./chunk-ZGV3HNEV.js";import"./chunk-MDRVCBDO.js";import"./chunk-FWB3GLMW.js";import{a as tr}from"./chunk-CVVQQLCF.js";import{a as Ko}from"./chunk-BJPDJIS4.js";import{a as Vo}from"./chunk-GFVKTWFT.js";import{a as Yo}from"./chunk-KGRIYAMA.js";import"./chunk-EXFBZPZS.js";import{a as Wo}from"./chunk-VW6QS7DO.js";import"./chunk-7MVWDCI3.js";import"./chunk-VUMUCNI7.js";import{a as Qo}from"./chunk-C7V755IT.js";import"./chunk-Q66CI37F.js";import{a as ir}from"./chunk-24NUJTIH.js";import{a as nr}from"./chunk-OQU3HLAE.js";import"./chunk-I6FRVYGE.js";import{a as Ho}from"./chunk-46MSIQ6Z.js";import"./chunk-BWRNXCVN.js";import"./chunk-XTREQ4A2.js";import{a as zo}from"./chunk-CW2T7EOQ.js";import{a as Go}from"./chunk-6DXP7PQ7.js";import{a as Mo}from"./chunk-43KLFFP7.js";import{a as ar}from"./chunk-EGCWR5AS.js";import{a as Jo}from"./chunk-C3KEDG33.js";import{a as Zo}from"./chunk-ZAA2DXK5.js";import{a as er}from"./chunk-OX7UVDSU.js";import"./chunk-BAHIL37I.js";import{a as yn}from"./chunk-FNLECT7B.js";import"./chunk-3C6VLJ5D.js";import"./chunk-7UOA4DI7.js";import"./chunk-YLQ3LNNY.js";import{a as J,b as K,d as Ar,e as xr,f as Or,h as Pe,j as to,k as A,l as ce,m as oo,n as ro,o as Tr,p as Ir,q as Er}from"./chunk-WDFCOZAY.js";import"./chunk-D7NB7YR6.js";import"./chunk-M5TGCSUK.js";import"./chunk-IWOTLFOY.js";import"./chunk-FFSDGRAN.js";import{e as ae}from"./chunk-AJMDF3QC.js";import"./chunk-VJEKDBGZ.js";import"./chunk-UOS2XLGG.js";import"./chunk-WMAFG2JD.js";import"./chunk-POKY4RWR.js";import{a as wn}from"./chunk-MYAIWSOO.js";import"./chunk-IQVRP7CT.js";import{a as _a}from"./chunk-KKPOOIE4.js";import{d as Ea}from"./chunk-Q2XRITUG.js";import{a as or}from"./chunk-5OMJFPQW.js";import{a as Bo}from"./chunk-4RDFMBRG.js";import{a as jo}from"./chunk-JOJV5E2K.js";import{a as rr,b as va}from"./chunk-WJSUIUBW.js";import"./chunk-4CRBTSVP.js";import{c as ft,d as Ia}from"./chunk-BVSKBX7T.js";import{b as Q}from"./chunk-ZQDDRIBA.js";import"./chunk-LFOBYEWG.js";import{C as z,D as re,E as q,O as V,P as _o,Q as le,b as ba,fa as fe,ha as ne,j as Wt,k as Qt,ma as Kt,q as Yt,u as _}from"./chunk-H4V55Y3Z.js";import"./chunk-ZDF5N422.js";import"./chunk-IUP7POIE.js";import"./chunk-MPW2YJWU.js";import{e as Eo}from"./chunk-ZT5WFUKJ.js";import{a as jt}from"./chunk-4C2DAX5T.js";import"./chunk-GRGFA26K.js";import{a as $o,b as y,c as w,e as Uo,f as ut}from"./chunk-Q2SZCZE7.js";import"./chunk-T7KHS6RF.js";import{A as I,B as ie,C as W,G as Co,H as he,J as B,L as Po,N as at,O as st,U as Lo,W as ct,_ as Ro,a as Io,z as T}from"./chunk-CZ22VZDA.js";import"./chunk-7Y7AZRL3.js";import"./chunk-J6TW43TG.js";import"./chunk-DFQ4WTET.js";import"./chunk-5HBIIYSK.js";import"./chunk-GB3YC4TI.js";import{b as To,d as nt}from"./chunk-335BUVBP.js";import"./chunk-YRHFPXC3.js";import{a as x}from"./chunk-BN7ZXAZJ.js";import"./chunk-RJ5VF3QY.js";import"./chunk-7UNQOKZW.js";import{d as No,e as Fo}from"./chunk-X7HVAVSZ.js";import{h as c,j as Do,k as G}from"./chunk-2VSNFOKD.js";import{a as ke,b as Ta}from"./chunk-WBJ6ZHYH.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-636CTEW7.js";import"./chunk-FFHH5LOR.js";import"./chunk-GQNOVEKP.js";import{Ab as qo,Bb as f,Cb as Xt,Db as Zt,N as xo,Sa as Fe,V as Oo,Z as oe,ba as Jt,ga as Vt,la as _e,qb as u,sb as d,ta as Ne,wb as g,yb as P}from"./chunk-LWCTKI4Z.js";import{i as it}from"./chunk-B4OMIONW.js";import"./chunk-BOAGJ6P5.js";import"./chunk-5B76DT7X.js";import"./chunk-JJZNUFPD.js";import{b as s,c as Mt,d as Gt}from"./chunk-FZCGRIOM.js";import"./chunk-3A3DZVEJ.js";import{b as Ao}from"./chunk-43R5VGKT.js";import"./chunk-ZDQO6CNY.js";import{b as j}from"./chunk-YTUUU33R.js";import"./chunk-JD5P5RAJ.js";import{e as M}from"./chunk-IWTNUJGY.js";import"./chunk-QFYLJVJW.js";import"./chunk-ZGASBRSQ.js";import"./chunk-I5A6BPCP.js";import"./chunk-CX5CC6P5.js";import"./chunk-IGE4Y5SE.js";import"./chunk-JFBCE4HN.js";import{e as R,g as n}from"./chunk-VKWPEFWQ.js";n();var ka=R(va(),1);n();n();n();n();function no(e){return pr(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 Na=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"2-digit",year:"numeric"});function ht(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":Na.format(t)}function St(e){let t=z(e);if(t)return t.split(".")[0]}function Tn(){let e=no().map(t=>({subdomain:St(t.store)??t.store,connected:ht(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:Fa()}:{}}}function Fa(){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 gt=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:gt.optional()}),be=x({name:"StoreAuthResult",schema:ue.omit({associatedUser:!0}).extend({hasRefreshToken:s.boolean(),associatedUser:ue.shape.associatedUser}),definitions:{StoreAuthAssociatedUser:gt}});var In=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.")}),yt=x({name:"StoreAuthListResult",schema:s.object({sessions:s.array(In),message:s.string().optional()}),definitions:{StoreAuthListSession:In,StoreAuthAssociatedUser:gt}});function En(e,t){if(t==="json"){g(yt.encode(e));return}Ca(e)}function Ca(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 description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --json"];static flags={...y,...w};static get jsonOutputSchema(){return yt}async run(){let{flags:t}=await this.parse(e),o=Tn();En(o,t.json?"json":"text")}};n();n();n();var _n=13387,wt="/auth/callback",io="/auth/handoff";function Nn(e){return`http://127.0.0.1:${e}${wt}`}function Fn(e,t){return`http://127.0.0.1:${e}${io}?nonce=${encodeURIComponent(t)}`}function D(e){return e.length<=10?"***":`${e.slice(0,10)}***`}n();function Cn(e,t=300){return e.slice(0,t)}async function Pn(e){let t=`https://${e.store}/admin/oauth/access_token`;f(d`Exchanging authorization code for token at ${u.raw(t)}`);let o=await Wt(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(Cn(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 Dn(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 Wt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:H,grant_type:"refresh_token",refresh_token:e.refreshToken})}),r=await o.text();if(!o.ok)throw f(d`Token refresh failed with HTTP ${u.raw(String(o.status))}: ${u.raw(Cn(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 Pa=`#graphql
1
+ import{a as gt}from"./chunk-IILLQOUC.js";import{a as ht,b as Dr}from"./chunk-SIL6HPMK.js";import"./chunk-LQ7ENG4V.js";import"./chunk-UUAKOX7E.js";import{a as En}from"./chunk-UV5GAGAD.js";import{a as fn}from"./chunk-7GUMJ5E4.js";import{a as hn}from"./chunk-Y6J46XYF.js";import{a as gn}from"./chunk-VQA3X7O3.js";import{a as Sn}from"./chunk-VZCMJRYV.js";import{a as yn}from"./chunk-ACZNWIRY.js";import"./chunk-QEKGGTMN.js";import"./chunk-62EOM3Y2.js";import"./chunk-J5ERDFIC.js";import"./chunk-PDZBKVWL.js";import{a as wn}from"./chunk-UY6W2EVZ.js";import{a as kn}from"./chunk-ZBL7XMJ6.js";import{a as Br}from"./chunk-4WYKPIN3.js";import{a as dn}from"./chunk-7NFTSBHQ.js";import{a as Qr}from"./chunk-WCC52MR2.js";import{a as ln}from"./chunk-R4UVIYZP.js";import{a as Mr}from"./chunk-GVI3DWSB.js";import{a as Gr}from"./chunk-HTRJU4R4.js";import{a as Jr}from"./chunk-34MOWGRL.js";import"./chunk-JPWRZ5SL.js";import{a as Vr}from"./chunk-IHMATNOR.js";import{a as Wr}from"./chunk-Q2KWXZQB.js";import"./chunk-V75WUEFU.js";import"./chunk-HB3MJYBK.js";import"./chunk-X5NIAZA4.js";import"./chunk-66TMIQMB.js";import"./chunk-W56ZGEQQ.js";import{a as sn}from"./chunk-LGXI7EGM.js";import{a as Cr,b as Pr,c as en}from"./chunk-B3ZJGYZY.js";import{a as In}from"./chunk-WESTVWWD.js";import{a as un}from"./chunk-ISKQQXLZ.js";import"./chunk-PLSS456F.js";import{a as On}from"./chunk-UPPO3BMT.js";import{a as Tn}from"./chunk-XUHGWIWW.js";import{a as cn}from"./chunk-3MG4MTWQ.js";import{a as pn}from"./chunk-M2CWCOFU.js";import{a as Kr}from"./chunk-74NRFUGQ.js";import"./chunk-67L7FIB6.js";import{a as Zr}from"./chunk-RW6G4ZPU.js";import{a as tn}from"./chunk-EKFPTBXC.js";import{a as xn}from"./chunk-AXL2VIWA.js";import{a as on}from"./chunk-BWN2QG6D.js";import{a as rn}from"./chunk-I7PEEJVH.js";import"./chunk-EAZIQI2D.js";import{a as nn}from"./chunk-ZGBTO46A.js";import{a as an}from"./chunk-5AEZJZNQ.js";import"./chunk-S4LOWCGS.js";import{a as $r}from"./chunk-224UPIYS.js";import{a as zr}from"./chunk-OR4IJ4BQ.js";import{a as Ur}from"./chunk-X2PFXSU4.js";import{a as mn}from"./chunk-QFSENE5T.js";import{a as Hr}from"./chunk-SLY27GDC.js";import"./chunk-QF5WKTPD.js";import{a as ft,b as jr}from"./chunk-L5TSPCSY.js";import"./chunk-UOHNRH6E.js";import{a as Ea}from"./chunk-PF53E2DC.js";import"./chunk-DLVB3237.js";import"./chunk-AQKWPRZE.js";import"./chunk-UBP3LQFY.js";import{h as _a}from"./chunk-SHD4VV5V.js";import"./chunk-UXVXVI6O.js";import"./chunk-OJULL7HT.js";import"./chunk-OMPQ7REW.js";import"./chunk-KNWT7JLL.js";import"./chunk-QDCLL5OI.js";import"./chunk-2ZBXHCQZ.js";import"./chunk-RPCIFYCY.js";import"./chunk-AQ6EVL73.js";import"./chunk-5ED7SOQZ.js";import"./chunk-MXEXP3HT.js";import"./chunk-2WJOTJOD.js";import"./chunk-HF4NDEX3.js";import"./chunk-FEBOZ2XX.js";import"./chunk-J3JPJCWP.js";import"./chunk-MEYVUHQH.js";import"./chunk-MADINS4Z.js";import"./chunk-USXIXANP.js";import"./chunk-JLGA3B7P.js";import"./chunk-TFPW2VGN.js";import"./chunk-IJY3RJPJ.js";import"./chunk-XBMD3FEZ.js";import"./chunk-6PUU6ZNQ.js";import"./chunk-PWAT52M4.js";import"./chunk-QW52RPAU.js";import"./chunk-2A2JSAAA.js";import"./chunk-CGVROSPS.js";import"./chunk-IHXGZW42.js";import"./chunk-YY6TFARF.js";import"./chunk-2L6AN3QA.js";import{b as Ia}from"./chunk-3JSKNXL7.js";import"./chunk-QFWWCZOI.js";import"./chunk-H6GYBLVQ.js";import"./chunk-WBVS5NBV.js";import{a as j,b as mr,c as Y,d as ge,e as Se}from"./chunk-YKMINHYY.js";import"./chunk-Z2WAW6MM.js";import"./chunk-KZRLZWOU.js";import"./chunk-SACNUF4I.js";import"./chunk-PTSCGSQV.js";import"./chunk-W37IFK3P.js";import"./chunk-H6GNKWYM.js";import"./chunk-Q7BOSHWX.js";import"./chunk-P4VZYOKO.js";import"./chunk-C3RFAKWR.js";import"./chunk-ZOOT3GBY.js";import"./chunk-MGHPF7HU.js";import"./chunk-HXZAY5OA.js";import"./chunk-2T4HDR6R.js";import"./chunk-UWHAOGO4.js";import"./chunk-ZI7LK3LW.js";import"./chunk-ACA2BGAD.js";import"./chunk-26PWHH3B.js";import{a as An}from"./chunk-E5COIKGY.js";import{a as Yr}from"./chunk-CYEEGTVZ.js";import"./chunk-FKIVKNOV.js";import"./chunk-XLIJYJ6Q.js";import"./chunk-7GHSE7SG.js";import{a as ur}from"./chunk-WSDKCQH6.js";import{a as pr}from"./chunk-CCUQM4FX.js";import{a as dr}from"./chunk-VAVXDIUX.js";import"./chunk-XWSWXQCC.js";import{a as er}from"./chunk-35XFNKNB.js";import{a as Lr}from"./chunk-P2RMFHQP.js";import"./chunk-VGSH52JM.js";import"./chunk-7CCTPBCT.js";import{a as Rr}from"./chunk-DN6X7SHW.js";import{a as Xr}from"./chunk-4KECSZTL.js";import{a as qr}from"./chunk-DBDTE3EE.js";import"./chunk-CLUUA3HX.js";import"./chunk-AUE7LM32.js";import{a as se,b as lr,c as ye,e as we,f as Pe,g as fr,h as hr,i as gr,j as Sr,k as yr,l as wr,m as dt,n as kr,o as br,p as vr,q as Ar,r as xr,s as ro}from"./chunk-DZKFP6H2.js";import"./chunk-J55GQLP4.js";import"./chunk-VHZ6RL67.js";import"./chunk-3MYDSQHF.js";import"./chunk-NVKJ7ZLP.js";import{a as rr}from"./chunk-B2O3ANRZ.js";import{a as Zo}from"./chunk-QEVTBD33.js";import{a as Qo}from"./chunk-UKWIWCOH.js";import{a as Xo}from"./chunk-3Z3MADXZ.js";import"./chunk-64G5TGFF.js";import{a as Yo}from"./chunk-ER6C5WS3.js";import"./chunk-TAWCKJKP.js";import"./chunk-VUMUCNI7.js";import{a as Ko}from"./chunk-SNH4XZ6E.js";import"./chunk-Y55T4IIQ.js";import{a as sr}from"./chunk-WRZWHT6M.js";import{a as ar}from"./chunk-S5P7KWY4.js";import"./chunk-XDVPIGXE.js";import{a as Mo}from"./chunk-27NXPOAS.js";import"./chunk-K7ZSPQKL.js";import"./chunk-U6YOP562.js";import{a as Ho}from"./chunk-E6RONHMT.js";import{a as Vo}from"./chunk-3XRI3D44.js";import{a as Jo}from"./chunk-2MT3LSMZ.js";import{a as cr}from"./chunk-Q4JYAUVL.js";import{a as Wo}from"./chunk-RPVZ2JON.js";import{a as tr}from"./chunk-ZRI3SSLG.js";import{a as or}from"./chunk-VEUKT5EI.js";import"./chunk-BAHIL37I.js";import{a as bn}from"./chunk-EEY4FKAW.js";import"./chunk-U2T5HPRD.js";import"./chunk-6ES4KRFW.js";import"./chunk-YLQ3LNNY.js";import{a as V,b as K,d as Or,e as Tr,f as mt,g as Ir,h as Er,i as lt,k as no,l as A,m as ce,n as io,o as ao,p as _r,q as Nr,r as Fr}from"./chunk-33ZE3DRQ.js";import"./chunk-YV2TP44L.js";import"./chunk-RLNIOJH3.js";import"./chunk-IWOTLFOY.js";import"./chunk-FFSDGRAN.js";import{e as ae}from"./chunk-SK7EPN6C.js";import"./chunk-VJEKDBGZ.js";import"./chunk-TODZ3TJR.js";import"./chunk-Y5CVX5LJ.js";import"./chunk-T4XJKM6B.js";import{a as vn}from"./chunk-3ODQKAEA.js";import"./chunk-N57Y7THE.js";import{a as Pa}from"./chunk-YSWVYPWR.js";import{d as Ca}from"./chunk-URXM5A2K.js";import{a as nr}from"./chunk-GNCVDN7U.js";import{a as jo}from"./chunk-LUGMXSRI.js";import{a as Go}from"./chunk-SB27UOXX.js";import{a as ir,b as Ta}from"./chunk-I4CEH7AK.js";import"./chunk-Q5IC3IYY.js";import{c as St,d as Fa}from"./chunk-UYELAINQ.js";import{b as Q}from"./chunk-ZJOX5HW4.js";import"./chunk-LFOBYEWG.js";import{C as z,D as re,E as q,O as B,P as it,Q as le,b as Oa,fa as fe,ha as ne,j as Kt,k as Xt,ma as eo,q as Zt,u as _}from"./chunk-GQLNG537.js";import"./chunk-ZDF5N422.js";import"./chunk-QQJNQNKP.js";import"./chunk-MPW2YJWU.js";import{e as Fo}from"./chunk-MHR5OHT5.js";import{a as Jt}from"./chunk-HSKDFEXW.js";import"./chunk-F3CK3EJJ.js";import{a as zo,b as y,c as w,e as Bo,f as pt}from"./chunk-3KM5ZOW2.js";import"./chunk-T7KHS6RF.js";import{A as I,B as ie,C as W,G as Do,H as he,J as H,L as Lo,N as st,O as ct,U as qo,W as ut,_ as $o,a as No,z as T}from"./chunk-D2KIGKBI.js";import"./chunk-7Y7AZRL3.js";import"./chunk-LEHBZKK3.js";import"./chunk-GW7YIJPJ.js";import"./chunk-5HBIIYSK.js";import"./chunk-GB3YC4TI.js";import{b as _o,d as nt}from"./chunk-335BUVBP.js";import"./chunk-YRHFPXC3.js";import{a as x}from"./chunk-BN7ZXAZJ.js";import"./chunk-RJ5VF3QY.js";import"./chunk-7UNQOKZW.js";import{d as Co,e as Po}from"./chunk-CXI3RHPW.js";import{h as c,j as Ro,k as J}from"./chunk-M5VIFG2V.js";import{a as ke,b as Na}from"./chunk-WBJ6ZHYH.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-636CTEW7.js";import"./chunk-5IDJALJH.js";import"./chunk-NXAEBGMO.js";import{Ab as Uo,Bb as f,Cb as to,Db as oo,N as Io,Sa as Ce,V as Eo,Z as oe,ba as Qt,ga as Yt,la as Ne,qb as u,sb as d,ta as Fe,wb as S,yb as P}from"./chunk-JLQRDFR5.js";import{i as at}from"./chunk-B4OMIONW.js";import"./chunk-BOAGJ6P5.js";import"./chunk-5B76DT7X.js";import"./chunk-JJZNUFPD.js";import{b as s,c as Vt,d as Wt}from"./chunk-FZCGRIOM.js";import"./chunk-LHXFTFFM.js";import{b as To}from"./chunk-43R5VGKT.js";import"./chunk-ZDQO6CNY.js";import{b as M}from"./chunk-YTUUU33R.js";import"./chunk-JD5P5RAJ.js";import{e as G}from"./chunk-IWTNUJGY.js";import"./chunk-QFYLJVJW.js";import"./chunk-ZGASBRSQ.js";import"./chunk-I5A6BPCP.js";import"./chunk-CX5CC6P5.js";import"./chunk-IGE4Y5SE.js";import"./chunk-JFBCE4HN.js";import{e as R,g as n}from"./chunk-VKWPEFWQ.js";n();var xa=R(Ta(),1);n();n();n();n();function so(e){return mr(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 Da=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"2-digit",year:"numeric"});function yt(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":Da.format(t)}function wt(e){let t=z(e);if(t)return t.split(".")[0]}function _n(){let e=so().map(t=>({subdomain:wt(t.store)??t.store,connected:yt(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:La()}:{}}}function La(){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 kt=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:kt.optional()}),be=x({name:"StoreAuthResult",schema:ue.omit({associatedUser:!0}).extend({hasRefreshToken:s.boolean(),associatedUser:ue.shape.associatedUser}),definitions:{StoreAuthAssociatedUser:kt}});var Nn=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.")}),bt=x({name:"StoreAuthListResult",schema:s.object({sessions:s.array(Nn),message:s.string().optional()}),definitions:{StoreAuthListSession:Nn,StoreAuthAssociatedUser:kt}});function Fn(e,t){if(t==="json"){S(bt.encode(e));return}Ra(e)}function Ra(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 description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --json"];static flags={...y,...w};static get jsonOutputSchema(){return bt}async run(){let{flags:t}=await this.parse(e),o=_n();Fn(o,t.json?"json":"text")}};n();n();n();var Cn=13387,vt="/auth/callback",co="/auth/handoff";function Pn(e){return`http://127.0.0.1:${e}${vt}`}function Dn(e,t){return`http://127.0.0.1:${e}${co}?nonce=${encodeURIComponent(t)}`}function D(e){return e.length<=10?"***":`${e.slice(0,10)}***`}n();function Ln(e,t=300){return e.slice(0,t)}async function Rn(e){let t=`https://${e.store}/admin/oauth/access_token`;f(d`Exchanging authorization code for token at ${u.raw(t)}`);let o=await Kt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:j,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(Ln(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 qn(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 Kt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:j,grant_type:"refresh_token",refresh_token:e.refreshToken})}),r=await o.text();if(!o.ok)throw f(d`Token refresh failed with HTTP ${u.raw(String(o.status))}: ${u.raw(Ln(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 qa=`#graphql
3
3
  query CurrentAppInstallationAccessScopes {
4
4
  currentAppInstallation {
5
5
  accessScopes {
@@ -7,7 +7,7 @@ import{a as lt}from"./chunk-IILLQOUC.js";import{a as mt,b as Fr}from"./chunk-M7L
7
7
  }
8
8
  }
9
9
  }
10
- `;async function Ln(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:Pa,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 ao="<comma-separated-scopes>";function Rn(e,t){return{command:`shopify store auth --store ${e} --scopes ${t}`}}function Da(e){return[[Rn(e,ao)]]}function qn(e,t,o){return[["Run",Rn(e,t),o]]}function La(e){return e.kind==="preview"?ao:e.scopes.join(",")}function $n(e){throw new c(`No stored app authentication found for ${e}.`,void 0,qn(e,ao,"to authenticate"))}function Le(e,t){throw new c(e,void 0,qn(t.store,La(t),"to re-authenticate"))}function kt(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 Un(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:`,Da(e))}import{timingSafeEqual as Ra}from"crypto";import{createServer as qa}from"http";function $a(e){let t=[e["sec-purpose"],e.purpose,e["x-moz"]].flat().join(" ");return t.includes("prefetch")||t.includes("prerender")}function zn(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 $n(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:qa,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 uo="<comma-separated-scopes>";function Un(e,t){return{command:`shopify store auth --store ${e} --scopes ${t}`}}function $a(e){return[[Un(e,uo)]]}function zn(e,t,o){return[["Run",Un(e,t),o]]}function Ua(e){return e.kind==="preview"?uo:e.scopes.join(",")}function Bn(e){throw new c(`No stored app authentication found for ${e}.`,void 0,zn(e,uo,"to authenticate"))}function Le(e,t){throw new c(e,void 0,zn(t.store,Ua(t),"to re-authenticate"))}function At(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 Hn(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:`,$a(e))}import{timingSafeEqual as za}from"crypto";import{createServer as Ba}from"http";function Ha(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 lt}from"./chunk-IILLQOUC.js";import{a as mt,b as Fr}from"./chunk-M7L
76
76
  </main>
77
77
  </div>
78
78
  </body>
79
- </html>`}async function Hn({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=qa((E,v)=>{let ot=new URL(E.url??"/",`http://127.0.0.1:${o}`),go=()=>{v.statusCode=404,v.setHeader("Cache-Control","no-store"),v.setHeader("Connection","close"),v.end("Not found")};if(ot.pathname===io){let me=ot.searchParams.get("nonce");if(!(a!==void 0&&!h&&E.method==="GET"&&me!==null&&Bn(me,a.nonce))||$a(E.headers)){go();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!==wt){go();return}let{searchParams:rt}=ot,Ee=(me,bo)=>{let vo=typeof me=="string"?new c(me,bo):me;v.statusCode=400,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>C(vo)),v.end(zn("Authentication failed",vo.message))},Bt=rt.get("shop");if(f(d`Received OAuth callback for shop ${u.raw(Bt??"unknown")}`),!Bt){Ee("OAuth callback store does not match the requested store.");return}let yo=_(Bt);if(yo!==p){Ee(Un(yo));return}let wo=rt.get("state");if(!wo||!Bn(wo,t)){Ee("OAuth callback state does not match the original request.");return}let ko=rt.get("error");if(ko){Ee(`Shopify returned an OAuth error: ${ko}`);return}let Ht=rt.get("code");if(!Ht){Ee("OAuth callback did not include an authorization code.");return}f(d`Received authorization code ${u.raw(D(Ht))}`),v.statusCode=200,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>de(()=>m(Ht))),v.end(zn("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(wt)}`),i&&Promise.resolve(i()).catch(E=>{C(E instanceof Error?E:new Error(String(E)))})})})}function Bn(e,t){return e.length!==t.length?!1:Ra(Buffer.from(e,"utf8"),Buffer.from(t,"utf8"))}n();import{createHash as Ua,randomBytes as jn}from"crypto";function za(){return jn(32).toString("base64url")}function Ba(e){return Ua("sha256").update(e).digest("base64url")}function Ha(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 ja(e,t){let o=new URL(e);return o.searchParams.set("signup",t),{nonce:jn(32).toString("base64url"),authorizationUrl:o.toString()}}function Mn(e){let{store:t,scopes:o,signup:r,exchangeCodeForToken:i}=e,a=_n,p=nt(),m=Nn(a),l=za(),S=Ba(l),O=Ha({store:t,scopes:o,state:p,redirectUri:m,codeChallenge:S}),h=r?ja(O,r):void 0,L=h?Fn(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 co(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 xo(t)}function so(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 Gn(e,t){let o=[...t],r=so(t);for(let i of e)if(!r.has(i)){o.push(i);for(let a of so([i]))r.add(a)}return o}function Jn(e,t){if(!e.scope)return f(d`Token response did not include scope; falling back to requested scopes`),t;let o=co(e.scope),r=so(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 Ma=240*1e3;function Ga(e){if(!e.expiresAt)return!1;let t=new Date(e.expiresAt).getTime();return Number.isNaN(t)?!0:t-Ma<Date.now()}function Ja(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){let t=Y(e);if(t||$n(e),f(d`Loaded stored session for ${u.raw(e)}: token=${u.raw(D(t.accessToken))}, expires=${u.raw(t.expiresAt??"unknown")}`),!Ga(t))return t;t.refreshToken||Le(`No refresh token stored for ${t.store}.`,t),f(d`Refreshing expired token for ${u.raw(t.store)} (expired at ${u.raw(t.expiresAt??"unknown")}, refresh_token=${u.raw(D(t.refreshToken))})`);let o=t.accessToken,r={store:t.store,refreshToken:t.refreshToken},i;try{i=await Dn(r)}catch(a){throw ge(t.store,t.userId),a instanceof c&&a.message.startsWith(`Token refresh failed for ${t.store} (HTTP `)&&Le(a.message,t),a instanceof c&&a.message===`Token refresh returned an invalid response for ${t.store}.`&&Le(a.message,t),a instanceof c&&a.message==="Received an invalid refresh response from Shopify.",a}return t=Ja(t,i),f(d`Token refresh succeeded for ${u.raw(t.store)}: ${u.raw(D(o))} → ${u.raw(D(t.accessToken))}, new expiry ${u.raw(t.expiresAt??"unknown")}`),Se(t),t}function Vn(e,t=300){return e.slice(0,t)}function Va(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 Vn(i?`HTTP ${o}: ${i}`:`HTTP ${o}`)}}return Vn(e instanceof Error?e.message:String(e))}async function Wn(e){let t=_(e),o=Y(t);if(!o)return{scopes:[],authoritative:!0};try{let r=await $(t),i=await Ln({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(Va(r))}`),{scopes:o.scopes,authoritative:!1};throw r}}n();function Wa(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 Qa(){P("Shopify CLI will open the app authorization page in your browser."),P("")}function Ya(e){return URL.canParse(e)?new URL(e).searchParams.has("signup"):!0}function Ka(e,t={}){return t.sensitive||Ya(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 Xa(e,t="text"){if(t==="json"){g(be.encode(e));return}let o=Wa(e);o.completed.forEach(r=>qo(r)),o.info.forEach(r=>P(r))}function ve(e="text"){return{openingBrowser:Qa,manualAuthUrl:Ka,success(t){Xa(t,e)}}}n();async function N(e,t,o){await Fo(()=>({store_fqdn:e})),await No(()=>({store_fqdn_hash:To(e),store_fqdn_validated:t,store_domain:e,store_id:Oo(o)}))}var Za={openURL:st,waitForStoreAuthCode:Hn,exchangeStoreAuthCodeForToken:Pn,resolveExistingScopes:Wn,getCurrentStoredStoreAppSession:Y,presenter:ve("text")};async function bt(e,t={}){let o={...Za,...t},r=_(e.store);if(es(r,o),Ao())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=co(e.scopes),a=await o.resolveExistingScopes(r),p=Gn(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=Mn({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:Jn(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 es(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 Gn({store:e,state:t,port:o,timeoutMs:r=300*1e3,onListening:i,authorizationRedirect:a}){let p=_(e);return new Promise((m,l)=>{let g=!1,O=!1,h=!1,L=setTimeout(()=>{C(new c("Timed out waiting for OAuth callback."))},r),U=Ba((E,v)=>{let ot=new URL(E.url??"/",`http://127.0.0.1:${o}`),ko=()=>{v.statusCode=404,v.setHeader("Cache-Control","no-store"),v.setHeader("Connection","close"),v.end("Not found")};if(ot.pathname===co){let me=ot.searchParams.get("nonce");if(!(a!==void 0&&!h&&E.method==="GET"&&me!==null&&Mn(me,a.nonce))||Ha(E.headers)){ko();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!==vt){ko();return}let{searchParams:rt}=ot,_e=(me,xo)=>{let Oo=typeof me=="string"?new c(me,xo):me;v.statusCode=400,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>C(Oo)),v.end(jn("Authentication failed",Oo.message))},Mt=rt.get("shop");if(f(d`Received OAuth callback for shop ${u.raw(Mt??"unknown")}`),!Mt){_e("OAuth callback store does not match the requested store.");return}let bo=_(Mt);if(bo!==p){_e(Hn(bo));return}let vo=rt.get("state");if(!vo||!Mn(vo,t)){_e("OAuth callback state does not match the original request.");return}let Ao=rt.get("error");if(Ao){_e(`Shopify returned an OAuth error: ${Ao}`);return}let Gt=rt.get("code");if(!Gt){_e("OAuth callback did not include an authorization code.");return}f(d`Received authorization code ${u.raw(D(Gt))}`),v.statusCode=200,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>de(()=>m(Gt))),v.end(jn("Authentication succeeded","Close this window and return to the terminal"))}),de=E=>{if(g)return;g=!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(vt)}`),i&&Promise.resolve(i()).catch(E=>{C(E instanceof Error?E:new Error(String(E)))})})})}function Mn(e,t){return e.length!==t.length?!1:za(Buffer.from(e,"utf8"),Buffer.from(t,"utf8"))}n();import{createHash as ja,randomBytes as Jn}from"crypto";function Ma(){return Jn(32).toString("base64url")}function Ga(e){return ja("sha256").update(e).digest("base64url")}function Ja(e){let t=new URLSearchParams;return t.set("client_id",j),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 Va(e,t){let o=new URL(e);return o.searchParams.set("signup",t),{nonce:Jn(32).toString("base64url"),authorizationUrl:o.toString()}}function Vn(e){let{store:t,scopes:o,signup:r,exchangeCodeForToken:i}=e,a=Cn,p=nt(),m=Pn(a),l=Ma(),g=Ga(l),O=Ja({store:t,scopes:o,state:p,redirectUri:m,codeChallenge:g}),h=r?Va(O,r):void 0,L=h?Dn(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 mo(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 Io(t)}function po(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 Wn(e,t){let o=[...t],r=po(t);for(let i of e)if(!r.has(i)){o.push(i);for(let a of po([i]))r.add(a)}return o}function Qn(e,t){if(!e.scope)return f(d`Token response did not include scope; falling back to requested scopes`),t;let o=mo(e.scope),r=po(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 Wa=240*1e3;function Qa(e){if(!e.expiresAt)return!1;let t=new Date(e.expiresAt).getTime();return Number.isNaN(t)?!0:t-Wa<Date.now()}function Ya(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){let t=Y(e);if(t||Bn(e),f(d`Loaded stored session for ${u.raw(e)}: token=${u.raw(D(t.accessToken))}, expires=${u.raw(t.expiresAt??"unknown")}`),!Qa(t))return t;t.refreshToken||Le(`No refresh token stored for ${t.store}.`,t),f(d`Refreshing expired token for ${u.raw(t.store)} (expired at ${u.raw(t.expiresAt??"unknown")}, refresh_token=${u.raw(D(t.refreshToken))})`);let o=t.accessToken,r={store:t.store,refreshToken:t.refreshToken},i;try{i=await qn(r)}catch(a){throw Se(t.store,t.userId),a instanceof c&&a.message.startsWith(`Token refresh failed for ${t.store} (HTTP `)&&Le(a.message,t),a instanceof c&&a.message===`Token refresh returned an invalid response for ${t.store}.`&&Le(a.message,t),a instanceof c&&a.message==="Received an invalid refresh response from Shopify.",a}return t=Ya(t,i),f(d`Token refresh succeeded for ${u.raw(t.store)}: ${u.raw(D(o))} → ${u.raw(D(t.accessToken))}, new expiry ${u.raw(t.expiresAt??"unknown")}`),ge(t),t}function Yn(e,t=300){return e.slice(0,t)}function Ka(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 Yn(i?`HTTP ${o}: ${i}`:`HTTP ${o}`)}}return Yn(e instanceof Error?e.message:String(e))}async function Kn(e){let t=_(e),o=Y(t);if(!o)return{scopes:[],authoritative:!0};try{let r=await $(t),i=await $n({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(Ka(r))}`),{scopes:o.scopes,authoritative:!1};throw r}}n();function Xa(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 Za(){P("Shopify CLI will open the app authorization page in your browser."),P("")}function es(e){return URL.canParse(e)?new URL(e).searchParams.has("signup"):!0}function ts(e,t={}){return t.sensitive||es(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 os(e,t="text"){if(t==="json"){S(be.encode(e));return}let o=Xa(e);o.completed.forEach(r=>Uo(r)),o.info.forEach(r=>P(r))}function ve(e="text"){return{openingBrowser:Za,manualAuthUrl:ts,success(t){os(t,e)}}}n();async function N(e,t,o){await Po(()=>({store_fqdn:e})),await Co(()=>({store_fqdn_hash:_o(e),store_fqdn_validated:t,store_domain:e,store_id:Eo(o)}))}var rs={openURL:ct,waitForStoreAuthCode:Gn,exchangeStoreAuthCodeForToken:Rn,resolveExistingScopes:Kn,getCurrentStoredStoreAppSession:Y,presenter:ve("text")};async function xt(e,t={}){let o={...rs,...t},r=_(e.store);if(ns(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=mo(e.scopes),a=await o.resolveExistingScopes(r),p=Wn(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=Vn({store:r,scopes:p,signup:e.signup,exchangeCodeForToken:o.exchangeStoreAuthCodeForToken}),{authorization:{authorizationUrl:g}}=l;o.presenter.openingBrowser();let O=await o.waitForStoreAuthCode({...l.waitForAuthCodeOptions,onListening:async()=>{if(await o.openURL(g))return;if(!o.presenter.manualAuthUrl(g))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:Qn(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 ge({store:r,clientId:j,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 ns(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(j(),1),ts="Country must be a two-letter country code, for example: US.";function os(e){return/^[A-Z]{2}$/.test(e)}var vt=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(!os(t))throw new c(ts);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"})},Qn={env:"SHOPIFY_FLAG_ID",parse:async e=>dr(e)},Yn=F.Flags.string({...Qn,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."}),Kn=F.Flags.string({...Qn,description:"The bulk operation ID to cancel (numeric ID or full GID).",required:!0}),Xn={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=>M(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=>M(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 Zn=R(j(),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),is="Country must be a two-letter country code, for example: US.";function as(e){return/^[A-Z]{2}$/.test(e)}var Ot=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(!as(t))throw new c(is);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"})},Xn={env:"SHOPIFY_FLAG_ID",parse:async e=>lr(e)},Zn=F.Flags.string({...Xn,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."}),ei=F.Flags.string({...Xn,description:"The bulk operation ID to cancel (numeric ID or full GID).",required:!0}),ti={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 oi=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 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:Zn.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0})};static get jsonOutputSchema(){return be}async run(){let{flags:t}=await this.parse(e);await bt({store:t.store,scopes:t.scopes},{presenter:ve(t.json?"json":"text")})}};n();n();async function ei(e){let t=await gr(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 ii=s.string().regex(/^gid:\/\/shopify\/BulkOperation\/[^/]+$/).describe("The Shopify global ID of a bulk operation."),pe=s.object({gid:ii,type:s.string(),status:s.string(),errorCode:s.string().nullable(),createdAt:Mt,completedAt:Mt.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(),ai=pe.omit({type:!0}),At=s.object({storeDomain:s.string().regex(/^[^.]+\.myshopify\.com$/).nullable(),apiVersion:s.string().nullable().describe("The API version selected for the request.")}).strict(),xt=x({name:"CancelBulkOperationResult",schema:At.extend({status:s.literal("success"),operation:pe}),definitions:{BulkOperation:pe}}),ti=At.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.")}),oi=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([ti,oi]),definitions:{BulkOperation:pe,ExecuteBulkOperationResult:ti,BulkOperationFile:oi}}),ri=At.extend({operationGid:ii,operation:pe.nullable()}),ni=At.extend({operations:s.array(ai),pageInfo:s.object({hasNextPage:s.boolean().nullable().describe("Unknown when the API result reaches the fetch limit.")}).strict()}),Ot=x({name:"BulkOperationStatusResult",schema:s.union([ri,ni]),definitions:{GetBulkOperationStatusResult:ri,ListBulkOperationsResult:ni,BulkOperation:pe,ListedBulkOperation:ai}});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 G("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:Gt(new Date(String(e.createdAt))),completedAt:e.completedAt?Gt(new Date(String(e.completedAt))):null,objectCount:String(e.objectCount),url:e.url??null,partialDataUrl:e.partialDataUrl??null}}function si(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(xt.encode({...X(e),status:"success",operation:Z(e.operation)}));return}if(e.userErrors.length){yr(e.userErrors,"Failed to cancel bulk operation.");return}let r=e.operation;if(r){let i=wr(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":I(p);break;case"warning":ie(p);break;case"info":T(p);break}}else W({headline:"Bulk operation not found or could not be canceled.",body:d`ID: ${u.yellow(t)}`.value})}n();n();function ci(e){let{storeFqdn:t,version:o}=e,r=[`Store: ${t}`];return o&&r.push(`API version: ${o}`),r}function ui(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}`]:[],...ci(t)];T({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 description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];static flags={...y,...w,store:b.store,id:Kn};static get jsonOutputSchema(){return xt}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 ei({adminSession:r,operationId:t.id});si(i,t.id,o)}};n();n();async function rs(e,t){if(e)return e.join(`
85
- `);if(t){if(!await Fe(t))throw new c(d`Variable file not found at ${u.path(t)}. Please check the path and try again.`);return _e(t,{encoding:"utf8"})}else return}async function pi(e){let{store:t,query:o,variables:r,variableFile:i,watch:a=!1,version:p,allowMutations:m=!1}=e;ui(o,m);let{adminSession:l,version:S}=await B({title:d`Authenticating`,task:async()=>{let h=await Ae(t),L=await Ce({adminSession:h,userSpecifiedVersion:p,minimumDefaultVersion:se});return{adminSession:h,version:L}},renderOptions:{stdout:process.stderr}}),O=await rs(r,i);return ns(o,O),{adminSession:l,version:S,query:o,variablesJsonl:O,watch:a}}async function di(e){let{adminSession:t,version:o,query:r,variablesJsonl:i,watch:a}=e,p=we(r)?await fr({adminSession:t,query:r,variablesJsonl:i,version:o}):await lr({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 Io,l=a?await br(t,p.bulkOperation.id,m.signal,()=>m.abort()):await kr(t,p.bulkOperation.id),S=a&&!m.signal.aborted&&l.status==="COMPLETED"&&l.url?await vr(l.url):void 0;return{store:t.storeFqdn,apiVersion:o,operation:l,userErrors:[],watchAborted:m.signal.aborted,results:S}}function ns(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 mi(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 G("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 G("Bulk operation response returned no operation.");let S=l!==void 0&&eo(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=M(i);await Ne(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 Ne(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?T({headline:`Bulk operation ${a.id} is still running in the background.`,body:Tt(a.id)}):r||["FAILED","CANCELED","EXPIRED"].includes(a.status)?is(a,l,i):I({headline:"Bulk operation is running.",body:Tt(a.id),customSections:[{body:[{list:{items:[d`ID: ${u.cyan(a.id)}`.value]}}]}]}))}function is(e,t,o){let r=pt(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":I({headline:"Bulk operation started.",body:Tt(e.id),customSections:a});break;case"RUNNING":I({headline:"Bulk operation is running.",body:Tt(e.id),customSections:a});break;case"COMPLETED":if(t===void 0)I({headline:r,customSections:a});else{let p=eo(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}):I({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 Tt(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 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:oi.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0})};static get jsonOutputSchema(){return be}async run(){let{flags:t}=await this.parse(e);await xt({store:t.store,scopes:t.scopes},{presenter:ve(t.json?"json":"text")})}};n();n();async function ri(e){let t=await wr(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 ci=s.string().regex(/^gid:\/\/shopify\/BulkOperation\/[^/]+$/).describe("The Shopify global ID of a bulk operation."),pe=s.object({gid:ci,type:s.string(),status:s.string(),errorCode:s.string().nullable(),createdAt:Vt,completedAt:Vt.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(),ui=pe.omit({type:!0}),Tt=s.object({storeDomain:s.string().regex(/^[^.]+\.myshopify\.com$/).nullable(),apiVersion:s.string().nullable().describe("The API version selected for the request.")}).strict(),It=x({name:"CancelBulkOperationResult",schema:Tt.extend({status:s.literal("success"),operation:pe}),definitions:{BulkOperation:pe}}),ni=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.")}),ii=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([ni,ii]),definitions:{BulkOperation:pe,ExecuteBulkOperationResult:ni,BulkOperationFile:ii}}),ai=Tt.extend({operationGid:ci,operation:pe.nullable()}),si=Tt.extend({operations:s.array(ui),pageInfo:s.object({hasNextPage:s.boolean().nullable().describe("Unknown when the API result reaches the fetch limit.")}).strict()}),Et=x({name:"BulkOperationStatusResult",schema:s.union([ai,si]),definitions:{GetBulkOperationStatusResult:ai,ListBulkOperationsResult:si,BulkOperation:pe,ListedBulkOperation:ui}});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:Wt(new Date(String(e.createdAt))),completedAt:e.completedAt?Wt(new Date(String(e.completedAt))):null,objectCount:String(e.objectCount),url:e.url??null,partialDataUrl:e.partialDataUrl??null}}function pi(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}S(It.encode({...X(e),status:"success",operation:Z(e.operation)}));return}if(e.userErrors.length){kr(e.userErrors,"Failed to cancel bulk operation.");return}let r=e.operation;if(r){let i=br(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":I(p);break;case"warning":ie(p);break;case"info":T(p);break}}else W({headline:"Bulk operation not found or could not be canceled.",body:d`ID: ${u.yellow(t)}`.value})}n();n();function di(e){let{storeFqdn:t,version:o}=e,r=[`Store: ${t}`];return o&&r.push(`API version: ${o}`),r}function mi(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}`]:[],...di(t)];T({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 description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];static flags={...y,...w,store:b.store,id:ei};static get jsonOutputSchema(){return It}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 ri({adminSession:r,operationId:t.id});pi(i,t.id,o)}};n();n();async function ss(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 li(e){let{store:t,query:o,variables:r,variableFile:i,watch:a=!1,version:p,allowMutations:m=!1}=e;mi(o,m);let{adminSession:l,version:g}=await H({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 ss(r,i);return cs(o,O),{adminSession:l,version:g,query:o,variablesJsonl:O,watch:a}}async function fi(e){let{adminSession:t,version:o,query:r,variablesJsonl:i,watch:a}=e,p=we(r)?await gr({adminSession:t,query:r,variablesJsonl:i,version:o}):await hr({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 No,l=a?await Ar(t,p.bulkOperation.id,m.signal,()=>m.abort()):await vr(t,p.bulkOperation.id),g=a&&!m.signal.aborted&&l.status==="COMPLETED"&&l.url?await xr(l.url):void 0;return{store:t.storeFqdn,apiVersion:o,operation:l,userErrors:[],watchAborted:m.signal.aborted,results:g}}function cs(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 hi(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 g=l!==void 0&&ro(l),O=g?"partial":"success";if(m&&(O="cancelled"),g&&(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),S(qe.encode({path:h,format:"jsonl"}))}else S(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(g=>g.field?`${g.field.join(".")}: ${g.message}`:g.message)}}});return}a&&(m?T({headline:`Bulk operation ${a.id} is still running in the background.`,body:_t(a.id)}):r||["FAILED","CANCELED","EXPIRED"].includes(a.status)?us(a,l,i):I({headline:"Bulk operation is running.",body:_t(a.id),customSections:[{body:[{list:{items:[d`ID: ${u.cyan(a.id)}`.value]}}]}]}))}function us(e,t,o){let r=dt(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":I({headline:"Bulk operation started.",body:_t(e.id),customSections:a});break;case"RUNNING":I({headline:"Bulk operation is running.",body:_t(e.id),customSections:a});break;case"COMPLETED":if(t===void 0)I({headline:r,customSections:a});else{let p=ro(t);o||S(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}):I({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 _t(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 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,...Xn};static get jsonOutputSchema(){return qe}async run(){let{flags:t}=await this.parse(e),o=await mr({query:t.query,queryFile:t["query-file"]}),r=await pi({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 di(r);await mi(a,{format:i,watch:r.watch,outputFile:t["output-file"]})}};n();n();async function li(e){let t=await Ce({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await hr({...e,version:t});return{store:e.adminSession.storeFqdn,apiVersion:t,operationId:e.operationId,operation:o??null}}async function fi(e){let t=await Ce({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await Sr({...e,version:t,first:100});return{store:e.adminSession.storeFqdn,apiVersion:t,operations:o}}n();function hi(e,t){if(t==="json"){g(Ot.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?as(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:cs(r.status),count:us(r.objectCount),dateCreated:Jt(new Date(String(r.createdAt))),dateFinished:r.completedAt?Jt(new Date(String(r.completedAt))):"",results:ps(r.url??r.partialDataUrl)}));Zt(),o.length===0?T({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"}}}),Zt()}function as(e){let{id:t,status:o,createdAt:r,completedAt:i,url:a,partialDataUrl:p}=e,m=pt(e).value,l=ss(r,i),S=d`ID: ${u.yellow(t)}\n${l}`.value;if(o==="COMPLETED"){let O=a?u.link("Download results",a):"";I({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 T({headline:m,body:S})}function ss(e,t){let o=new Date;return t?`Finished ${Vt(new Date(String(t)),o)}`:`Started ${Vt(new Date(String(e)),o)}`}function cs(e){return e==="COMPLETED"?it.green(e):e==="FAILED"?it.red(e):it.dim(e)}function us(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function ps(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 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:Yn};static get jsonOutputSchema(){return Ot}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 li({adminSession:r,operationId:t.id}):await fi({adminSession:r});hi(i,o)}};n();var uo=R(j(),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 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:uo.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0}),signup:uo.Flags.string({description:"Provide JWT for the store. When omitted, the JWT is read from stdin.",env:"SHOPIFY_FLAG_SIGNUP",required:!1})};static get jsonOutputSchema(){return be}async run(){let{flags:t}=await this.parse(e),o=ms(t.signup)??await ls();await bt({store:t.store,scopes:t.scopes,signup:o},{presenter:ve(t.json?"json":"text")})}},ds=8*1024,Si="Missing signup JWT.",gi="Pass --signup <jwt>, set SHOPIFY_FLAG_SIGNUP, or pipe the JWT to stdin.";function ms(e){let t=e?.trim();return t===""?void 0:t}async function ls(e=process.stdin){if(e===process.stdin&&!Ro())throw new c(Si,gi);let t=[],o=0;for await(let i of e){let a=Buffer.isBuffer(i)?i:Buffer.from(i);if(o+=a.length,o>ds)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(Si,gi);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 po=x({name:"CreateDevStoreResult",schema:s.union([oo.schema,Oe]),definitions:{...oo.definitions,StoreCommandError:Oe}});n();var yi={basic:"basic",professional:"grow",grow:"grow",unlimited:"advanced",advanced:"advanced",shopify_plus:"plus",plus:"plus"};n();var wi=Tr,ki=Ir,bi=Er;var He=R(j(),1),je=class e extends Q{static summary="Create a new dev store.";static descriptionWithMarkdown="Creates a new dev store in your organization.";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:ut(He.Flags.string({description:"Name for the new dev store.",env:"SHOPIFY_FLAG_STORE_NAME"})),"organization-id":ut(b["organization-id"]),plan:ut(He.Flags.string({description:"The Shopify plan to use for the new dev store.",options:to,env:"SHOPIFY_FLAG_STORE_PLAN"})),"feature-preview":He.Flags.string({description:"The handle of a feature preview to enable on the new dev store.",env:"SHOPIFY_FLAG_STORE_FEATURE_PREVIEW"}),"demo-data":He.Flags.boolean({description:"Populate the new dev store with demo data.",allowNo:!0,env:"SHOPIFY_FLAG_STORE_DEMO_DATA"}),country:vt};static get jsonOutputSchema(){return po}async run(){let{flags:t}=await this.parse(e),o=await Pe(t["organization-id"]?.toString()),r=t.name??await wi(),i=t.plan??await ki(),a=t["demo-data"]??(ct()?await bi():!1);try{await ro({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(po.encode({error:!0,message:p.message,nextSteps:p.nextSteps??[],exitCode:1})),process.exit(1)),p}}};n();n();n();var fs="X-Shopify-CLI-Instance",hs="X-Shopify-CLI-Version",vi;function Ss(){return vi??=new Eo({projectName:"shopify-cli-store"}),vi}var Me=class extends c{status;constructor(t,o,r){super(o,r??null),this.status=t}};function Ai(e=Ss()){let t=e.get("cliInstanceId");if(typeof t=="string"&&t.length>0)return t;let o=nt();return e.set("cliInstanceId",o),o}function xi(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":`Shopify CLI; v=${jt}`,[fs]:e,[hs]:jt}}function gs(e){return xi(e)}function ys(e,t){return{...xi(e),authorization:t,"X-Shopify-Access-Token":t}}async function Oi(e,t={}){let r=`https://${await Yt()}/services/preview-stores`,i=JSON.stringify({...e.name?{name:e.name}:{},...e.country?{variables:{storeCreatePayload:{country:e.country}}}:{}}),a=await Qt(r,{method:"POST",headers:gs(Ai(t.storage)),body:i}),p=await a.text();if(!a.ok){let l=ws(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): ${It(p).slice(0,500)}`)}return bs(m)}async function Ti(e,t={}){let r=`https://${await Yt()}/services/preview-stores/${e.shopId}`,i=await Qt(r,{method:"GET",headers:ys(Ai(t.storage),e.adminApiToken)}),a=await i.text();if(!i.ok){let m=ks(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): ${It(a).slice(0,500)}`)}return vs(p)}function ws(e,t){let o=Ii(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=It(t);return{message:`Preview store creation failed with HTTP ${e}.`,tryMessage:i??(a.length>0?a.slice(0,1e3):"No response body returned.")}}function Ii(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 ks(e,t){let o=Ii(t),r=It(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 bs(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(As(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},adminApiToken:a,adminApiScopes:l,accessUrl:p,...m?{placeholderAccountUuid:m}:{}}}function vs(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(xs(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},accessUrl:a,...p?{claimUrl:p}:{}}}function As(e){return{...e,...e.admin_api_token?{admin_api_token:"[REDACTED]"}:{},...e.access_url?{access_url:"[REDACTED]"}:{}}}function It(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 xs(e){return{...e,...e.access_url?{access_url:"[REDACTED]"}:{},...e.claim_url?{claim_url:"[REDACTED]"}:{}}}var Os={createPreviewStore:Oi,setStoredStoreAppSession:Se,recordStoreFqdnMetadata:N,setLastSeenUserId:q,now:()=>new Date};async function Ei(e,t={}){let o={...Os,...t},r=await o.createPreviewStore({name:e.name,country:e.country},e.client);return Is(r,e.country,o)}function Ts(e){return e.placeholderAccountUuid??e.shop.id}async function Is(e,t,o){let r=o.now().toISOString(),i=Ts(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:Es(e.shop.domain)}}function Es(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 _i=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.")}),Et=x({name:"CreatePreviewStoreResult",schema:s.object({status:s.literal("success"),message:s.string(),store:_i,next_steps:s.array(s.string())}),definitions:{PreviewStore:_i}});function Ni(e,t){if(t==="json"){g(Et.encode(e));return}Ns(e)}function _s(e){return e.split(/(`[^`]+`)/).map(t=>t.startsWith("`")&&t.endsWith("`")?{command:t.slice(1,-1)}:t)}function Ns(e){I({headline:"Store created",customSections:[{body:e.message},{title:"Next steps",body:{list:{items:e.next_steps.map(_s)}}}]})}var Fi=R(j(),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 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:Fi.Flags.string({description:"The name of the store.",env:"SHOPIFY_FLAG_PREVIEW_STORE_NAME",required:!1}),country:vt};static get jsonOutputSchema(){return Et}async run(){let{flags:t}=await this.parse(e),o=await B({title:d`Creating store`,task:async()=>Ei({name:t.name,country:t.country})});Ni(o,t.json?"json":"text")}};n();n();var Ci=s.object({domain:A.shape.subdomain,deletionRequested:s.literal(!0),deletionConfirmed:s.boolean()}),Je=x({name:"DeleteDevStoreResult",schema:s.union([s.object({store:Ci,organization:ce,message:s.string().optional()}),Oe]),definitions:{DeletedStore:Ci,StoreOrganization:ce,StoreCommandError:Oe}});n();n();n();n();var Pi={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 Di(e){let t=await mo(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 mo(e){let t=e.token??await V([],{noPrompt:e.noPrompt,allowAutomationToken:!0}),o=J({noPrompt:e.noPrompt}),r={id:e.organizationId,businessName:e.organizationName},a=(await K(r,{query:Pi,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 Li={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 Ri={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 Fs="cancelled",Cs=5,Ps=300*1e3;async function $i(e){let{organization:t,store:o}=e,r=await V([],{allowAutomationToken:!0}),i=J(),a=await qi({store:o,organization:t,token:r}),m=(await K(t,{query:Li,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 qi({store:o,organization:t,token:r});let S=a?await Ls({shopifyShopId:a,organization:t,token:r,unauthorizedHandler:i}):!1;e.json?g(qs({store:o,organization:t,deletionConfirmed:S})):S?I({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 qi(e){let{store:t,organization:o,token:r}=e;return(await mo({store:t,organizationId:o.id,organizationName:o.businessName,token:r}))?.shopifyShopId}function Ds(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 Ls(e){let t=Ds(e.shopifyShopId);return B({title:d`Dev store deletion requested. Waiting for deletion confirmation`,task:async o=>{let r=Date.now();for(;;){if(Date.now()-r>Ps)return!1;if((await K(e.organization,{query:Ri,token:e.token,variables:{id:t},unauthorizedHandler:e.unauthorizedHandler})).organization?.accessibleShop?.planName?.toLowerCase()===Fs.toLowerCase())return!0;o(d`${Rs()}`),await Lo(Cs)}},renderOptions:{stdout:process.stderr}})}function Rs(){return"Waiting for deletion confirmation"}function qs(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 Ui={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 zi={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 Ve=class extends c{};async function _t(e){let t=e.token??await V([],{noPrompt:e.noPrompt,allowAutomationToken:!0}),o=J({noPrompt:e.noPrompt}),r=z(e.store)??e.store.toLowerCase(),i=r.split(".")[0]??r,m=((await Kt({query:Ui,token:t,variables:{search:i},unauthorizedHandler:o})).currentUserAccount?.destinations.nodes??[]).find(S=>Us(S,r));if(!m)throw new Ve(`Couldn't find a store with domain ${e.store} for the current account.`,"Verify the domain (must be the canonical `myshopify.com` FQDN) and that you are signed in to an account with access to the store. Inactive shops are not searchable.");let l=await $s(String(m.publicId),t,o);return{...l?{owningOrg:l}:{}}}async function $s(e,t,o){try{let i=(await Kt({query:zi,token:t,variables:{destinationPublicId:e},unauthorizedHandler:o})).currentUserAccount?.organizationForDestination;if(!i){f(`No owning organization returned for destination ${e}.`);return}let a=i.id?Ar(i.id):void 0;return{name:i.name,...a?{id:a}:{}}}catch(r){f(`Failed to resolve owning organization: ${zs(r)}`);return}}function Us(e,t){return[e.primaryDomain,e.webUrl].some(o=>z(o)===t)}function zs(e){return e instanceof Error?e.message:String(e)}async function Bs(e){let{store:t}=e;try{let r=(await _t(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}: ${Hs(o)}`);return}}function Hs(e){return e instanceof Error?e.message:String(e)}async function Bi(e,t){if(t)return Pe(t);let o=ct(),r=await Bs({store:e,noPrompt:!o});if(r)return r;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 T({headline:`Could not determine which organization owns ${e}.`,body:["Select one below, or specify it with",{command:"--organization-id"},{char:"."}]}),Pe()}var Hi=R(j(),1),We=class e extends Q{static summary="Delete a dev store.";static descriptionWithMarkdown="Deletes a dev store from your organization.";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:Hi.Flags.boolean({char:"f",description:"Skip confirmation. Required if non interactive.",env:"SHOPIFY_FLAG_FORCE",default:!1})};static get jsonOutputSchema(){return Je}async run(){let{flags:t}=await this.parse(e);try{if(!t.force&&!at())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 Bi(t.store,t["organization-id"]?.toString());if(!t.force&&!await Po({message:`Delete dev store ${t.store}? This can't be undone.`,confirmation:t.store}))throw new Do;await $i({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 Mi=R(ba(),1);async function js(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 Fe(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 _e(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 G("Query should have been provided via --query or --query-file flags due to exactlyOne constraint. This indicates the oclif flag validation failed.")}function ji(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 Ms(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 ji(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 Fe(t))throw new c(d`Variable file not found at ${u.path(t)}. Please check the path and try again.`);let o=await _e(t,{encoding:"utf8"});try{return ji(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 Gs(e){let t;try{t=(0,Mi.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 Js(e){return e.operationDefinition.operation==="mutation"}function Vs(e,t=!1){if(Js(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 Gi(e){let t=await js({query:e.query,queryFile:e.queryFile}),o=Gs(t);Vs(o,e.allowMutations);let r=await Ms(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 Nt(e){if(!e||typeof e!="object"||!("response"in e))return!1;let t=e.response;return!!t&&typeof t=="object"}function Ji(e){if(!Nt(e))return;let t=e.response.status;return typeof t=="number"?t:void 0}var Vi=["the user aborted a request","the operation was aborted"];function Ws(e){if(!(e instanceof Error))return!1;if(e.name==="AbortError")return!0;let t=e.message.toLowerCase();return Vi.some(o=>t.includes(o))}function Qe(e,t){if(Ji(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(Ws(e))return new c(`Request to ${t} was aborted before it completed.`)}function Ye(e,t){let o=Ji(e);o!==401&&o!==404||(ge(t.store,t.userId),kt(t))}var Qs=`
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 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,...ti};static get jsonOutputSchema(){return qe}async run(){let{flags:t}=await this.parse(e),o=await fr({query:t.query,queryFile:t["query-file"]}),r=await li({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 fi(r);await hi(a,{format:i,watch:r.watch,outputFile:t["output-file"]})}};n();n();async function gi(e){let t=await Pe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await Sr({...e,version:t});return{store:e.adminSession.storeFqdn,apiVersion:t,operationId:e.operationId,operation:o??null}}async function Si(e){let t=await Pe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await yr({...e,version:t,first:100});return{store:e.adminSession.storeFqdn,apiVersion:t,operations:o}}n();function yi(e,t){if(t==="json"){S(Et.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?ps(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:ms(r.status),count:ls(r.objectCount),dateCreated:Qt(new Date(String(r.createdAt))),dateFinished:r.completedAt?Qt(new Date(String(r.completedAt))):"",results:fs(r.url??r.partialDataUrl)}));oo(),o.length===0?T({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"}}}),oo()}function ps(e){let{id:t,status:o,createdAt:r,completedAt:i,url:a,partialDataUrl:p}=e,m=dt(e).value,l=ds(r,i),g=d`ID: ${u.yellow(t)}\n${l}`.value;if(o==="COMPLETED"){let O=a?u.link("Download results",a):"";I({headline:m,body:d`${g}\n${O}`.value})}else if(o==="FAILED"){let O=p?u.link("Download partial results",p):"";W({headline:m,body:d`${g}\n${O}`.value})}else T({headline:m,body:g})}function ds(e,t){let o=new Date;return t?`Finished ${Yt(new Date(String(t)),o)}`:`Started ${Yt(new Date(String(e)),o)}`}function ms(e){return e==="COMPLETED"?at.green(e):e==="FAILED"?at.red(e):at.dim(e)}function ls(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function fs(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 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:Zn};static get jsonOutputSchema(){return Et}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 gi({adminSession:r,operationId:t.id}):await Si({adminSession:r});yi(i,o)}};n();var lo=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 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:lo.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0}),signup:lo.Flags.string({description:"Provide JWT for the store. When omitted, the JWT is read from stdin.",env:"SHOPIFY_FLAG_SIGNUP",required:!1})};static get jsonOutputSchema(){return be}async run(){let{flags:t}=await this.parse(e),o=gs(t.signup)??await Ss();await xt({store:t.store,scopes:t.scopes,signup:o},{presenter:ve(t.json?"json":"text")})}},hs=8*1024,wi="Missing signup JWT.",ki="Pass --signup <jwt>, set SHOPIFY_FLAG_SIGNUP, or pipe the JWT to stdin.";function gs(e){let t=e?.trim();return t===""?void 0:t}async function Ss(e=process.stdin){if(e===process.stdin&&!$o())throw new c(wi,ki);let t=[],o=0;for await(let i of e){let a=Buffer.isBuffer(i)?i:Buffer.from(i);if(o+=a.length,o>hs)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(wi,ki);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 fo=x({name:"CreateDevStoreResult",schema:s.union([io.schema,Oe]),definitions:{...io.definitions,StoreCommandError:Oe}});n();var bi={basic:"basic",professional:"grow",grow:"grow",unlimited:"advanced",advanced:"advanced",shopify_plus:"plus",plus:"plus"};n();var vi=_r,Ai=Nr,xi=Fr;var He=R(M(),1),je=class e extends Q{static summary="Create a new dev store.";static descriptionWithMarkdown="Creates a new dev store in your organization.";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:pt(He.Flags.string({description:"Name for the new dev store.",env:"SHOPIFY_FLAG_STORE_NAME"})),"organization-id":pt(b["organization-id"]),plan:pt(He.Flags.string({description:"The Shopify plan to use for the new dev store.",options:no,env:"SHOPIFY_FLAG_STORE_PLAN"})),"feature-preview":He.Flags.string({description:"The handle of a feature preview to enable on the new dev store.",env:"SHOPIFY_FLAG_STORE_FEATURE_PREVIEW"}),"demo-data":He.Flags.boolean({description:"Populate the new dev store with demo data.",allowNo:!0,env:"SHOPIFY_FLAG_STORE_DEMO_DATA"}),country:Ot};static get jsonOutputSchema(){return fo}async run(){let{flags:t}=await this.parse(e),o=await lt(t["organization-id"]?.toString()),r=t.name??await vi(),i=t.plan??await Ai(),a=t["demo-data"]??(ut()?await xi():!1);try{await ao({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&&(S(fo.encode({error:!0,message:p.message,nextSteps:p.nextSteps??[],exitCode:1})),process.exit(1)),p}}};n();n();n();var ys="X-Shopify-CLI-Instance",ws="X-Shopify-CLI-Version",Oi;function ks(){return Oi??=new Fo({projectName:"shopify-cli-store"}),Oi}var Me=class extends c{status;constructor(t,o,r){super(o,r??null),this.status=t}};function Ti(e=ks()){let t=e.get("cliInstanceId");if(typeof t=="string"&&t.length>0)return t;let o=nt();return e.set("cliInstanceId",o),o}function Ii(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":`Shopify CLI; v=${Jt}`,[ys]:e,[ws]:Jt}}function bs(e){return Ii(e)}function vs(e,t){return{...Ii(e),authorization:t,"X-Shopify-Access-Token":t}}async function Ei(e,t={}){let r=`https://${await Zt()}/services/preview-stores`,i=JSON.stringify({...e.name?{name:e.name}:{},...e.country?{variables:{storeCreatePayload:{country:e.country}}}:{}}),a=await Xt(r,{method:"POST",headers:bs(Ti(t.storage)),body:i}),p=await a.text();if(!a.ok){let l=As(a.status,p);throw new c(l.message,l.tryMessage)}let m;try{m=JSON.parse(p)}catch(l){let g=l instanceof Error?l.message:"Unknown error";throw new c("Preview store creation returned a non-JSON response.",`Parse error: ${g}. Body (truncated): ${Nt(p).slice(0,500)}`)}return Os(m)}async function _i(e,t={}){let r=`https://${await Zt()}/services/preview-stores/${e.shopId}`,i=await Xt(r,{method:"GET",headers:vs(Ti(t.storage),e.adminApiToken)}),a=await i.text();if(!i.ok){let m=xs(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): ${Nt(a).slice(0,500)}`)}return Ts(p)}function As(e,t){let o=Ni(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=Nt(t);return{message:`Preview store creation failed with HTTP ${e}.`,tryMessage:i??(a.length>0?a.slice(0,1e3):"No response body returned.")}}function Ni(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 xs(e,t){let o=Ni(t),r=Nt(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 Os(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(g=>typeof g=="string"):void 0;if(!o||!r||!i||!a||!p||!l)throw new c("Preview store creation response is missing required fields.",`Got: ${JSON.stringify(Is(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},adminApiToken:a,adminApiScopes:l,accessUrl:p,...m?{placeholderAccountUuid:m}:{}}}function Ts(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(Es(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},accessUrl:a,...p?{claimUrl:p}:{}}}function Is(e){return{...e,...e.admin_api_token?{admin_api_token:"[REDACTED]"}:{},...e.access_url?{access_url:"[REDACTED]"}:{}}}function Nt(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 Es(e){return{...e,...e.access_url?{access_url:"[REDACTED]"}:{},...e.claim_url?{claim_url:"[REDACTED]"}:{}}}var _s={createPreviewStore:Ei,setStoredStoreAppSession:ge,recordStoreFqdnMetadata:N,setLastSeenUserId:q,now:()=>new Date};async function Fi(e,t={}){let o={..._s,...t},r=await o.createPreviewStore({name:e.name,country:e.country},e.client);return Fs(r,e.country,o)}function Ns(e){return e.placeholderAccountUuid??e.shop.id}async function Fs(e,t,o){let r=o.now().toISOString(),i=Ns(e);o.setStoredStoreAppSession({store:e.shop.domain,clientId:j,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:Cs(e.shop.domain)}}function Cs(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 Ci=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.")}),Ft=x({name:"CreatePreviewStoreResult",schema:s.object({status:s.literal("success"),message:s.string(),store:Ci,next_steps:s.array(s.string())}),definitions:{PreviewStore:Ci}});function Pi(e,t){if(t==="json"){S(Ft.encode(e));return}Ds(e)}function Ps(e){return e.split(/(`[^`]+`)/).map(t=>t.startsWith("`")&&t.endsWith("`")?{command:t.slice(1,-1)}:t)}function Ds(e){I({headline:"Store created",customSections:[{body:e.message},{title:"Next steps",body:{list:{items:e.next_steps.map(Ps)}}}]})}var Di=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 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:Di.Flags.string({description:"The name of the store.",env:"SHOPIFY_FLAG_PREVIEW_STORE_NAME",required:!1}),country:Ot};static get jsonOutputSchema(){return Ft}async run(){let{flags:t}=await this.parse(e),o=await H({title:d`Creating store`,task:async()=>Fi({name:t.name,country:t.country})});Pi(o,t.json?"json":"text")}};n();n();var Li=s.object({domain:A.shape.subdomain,deletionRequested:s.literal(!0),deletionConfirmed:s.boolean()}),Je=x({name:"DeleteDevStoreResult",schema:s.union([s.object({store:Li,organization:ce,message:s.string().optional()}),Oe]),definitions:{DeletedStore:Li,StoreOrganization:ce,StoreCommandError:Oe}});n();n();n();n();var Ri={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 qi(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:Ri,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 $i={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 Ui={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 Ls="cancelled",Rs=5,qs=300*1e3;async function Bi(e){let{organization:t,store:o}=e,r=await B([],{allowAutomationToken:!0}),i=V(),a=await zi({store:o,organization:t,token:r}),m=(await K(t,{query:$i,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 zi({store:o,organization:t,token:r});let g=a?await Us({shopifyShopId:a,organization:t,token:r,unauthorizedHandler:i}):!1;e.json?S(Bs({store:o,organization:t,deletionConfirmed:g})):g?I({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 zi(e){let{store:t,organization:o,token:r}=e;return(await Ve({store:t,organizationId:o.id,organizationName:o.businessName,token:r}))?.shopifyShopId}function $s(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 Us(e){let t=$s(e.shopifyShopId);return H({title:d`Dev store deletion requested. Waiting for deletion confirmation`,task:async o=>{let r=Date.now();for(;;){if(Date.now()-r>qs)return!1;if((await K(e.organization,{query:Ui,token:e.token,variables:{id:t},unauthorizedHandler:e.unauthorizedHandler})).organization?.accessibleShop?.planName?.toLowerCase()===Ls.toLowerCase())return!0;o(d`${zs()}`),await qo(Rs)}},renderOptions:{stdout:process.stderr}})}function zs(){return"Waiting for deletion confirmation"}function Bs(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 Hi={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 Te=class extends c{};async function Ct(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 eo({query:Hi,token:t,variables:{search:i},unauthorizedHandler:o})).currentUserAccount?.destinations.nodes??[]).find(g=>Ms(g,r));if(!m)throw new Te(`Couldn't find a store with domain ${e.store} for the current account.`,Hs());let l=await js(String(m.publicId),t,o);return{...l?{owningOrg:l}:{}}}function Hs(){let e="Check the domain (it must be the permanent `myshopify.com` domain)";return it()?`${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 eo({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?Or(i.id):void 0;return{name:i.name,...a?{id:a}:{}}}catch(r){f(`Failed to resolve owning organization: ${Gs(r)}`);return}}function Ms(e,t){return[e.primaryDomain,e.webUrl].some(o=>z(o)===t)}function Gs(e){return e instanceof Error?e.message:String(e)}async function Js(e){let{store:t}=e;try{let r=(await Ct(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}: ${Vs(o)}`);return}}function Vs(e){return e instanceof Error?e.message:String(e)}async function Mi(e,t){if(t)return lt(t);let o=ut(),r=await Js({store:e,noPrompt:!o});if(r)return r;let i=await B([],{noPrompt:!o,allowAutomationToken:!0}),{organizations:a}=await mt(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 T({headline:`Could not determine which organization owns ${e}.`,body:["Select one below, or specify it with",{command:"--organization-id"},{char:"."}]}),Er(a)}var Gi=R(M(),1),We=class e extends Q{static summary="Delete a dev store.";static descriptionWithMarkdown="Deletes a dev store from your organization.";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:Gi.Flags.boolean({char:"f",description:"Skip confirmation. Required if non interactive.",env:"SHOPIFY_FLAG_FORCE",default:!1})};static get jsonOutputSchema(){return Je}async run(){let{flags:t}=await this.parse(e);try{if(!t.force&&!st())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 Mi(t.store,t["organization-id"]?.toString());if(!t.force&&!await Lo({message:`Delete dev store ${t.store}? This can't be undone.`,confirmation:t.store}))throw new Ro;await Bi({store:t.store,organization:o,json:t.json})}catch(o){throw t.json&&o instanceof c&&(S(Je.encode({error:!0,message:o.message,nextSteps:o.nextSteps??[],exitCode:1})),process.exit(1)),o}}};n();n();n();var Vi=R(Oa(),1);async function Ws(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 Ji(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 Qs(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 Ji(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 Ji(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 Ys(e){let t;try{t=(0,Vi.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 Ks(e){return e.operationDefinition.operation==="mutation"}function Xs(e,t=!1){if(Ks(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 Wi(e){let t=await Ws({query:e.query,queryFile:e.queryFile}),o=Ys(t);Xs(o,e.allowMutations);let r=await Qs(e.variables,e.variableFile);return{query:t,parsedOperation:o,parsedVariables:r,requestedVersion:e.version}}n();n();n();n();var Ie=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 Pt(e){if(!e||typeof e!="object"||!("response"in e))return!1;let t=e.response;return!!t&&typeof t=="object"}function Qi(e){if(!Pt(e))return;let t=e.response.status;return typeof t=="number"?t:void 0}var Yi=["the user aborted a request","the operation was aborted"];function Zs(e){if(!(e instanceof Error))return!1;if(e.name==="AbortError")return!0;let t=e.message.toLowerCase();return Yi.some(o=>t.includes(o))}function Qe(e,t){if(Qi(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(Zs(e))return new c(`Request to ${t} was aborted before it completed.`)}function Ye(e,t){let o=Qi(e);o!==401&&o!==404||(Se(t.store,t.userId),At(t))}var ec=`
95
95
  query StoreExecutePublicApiVersions {
96
96
  publicApiVersions {
97
97
  handle
98
98
  supported
99
99
  }
100
100
  }
101
- `;async function Wi(e){try{return(await ne({query:Qs,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||(Nt(t)&&typeof t.response.status=="number"&&t.response.status>=500?new c(`Couldn't read the supported API versions for ${e.adminSession.storeFqdn}: the Admin API returned a server error (HTTP ${t.response.status}).`,"This is a problem on the Shopify side, not with your command. Wait a moment and run it again."):t)}}async function Qi(e){try{return await B({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(Nt(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 lo(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 Ys(e){let{session:t,adminSession:o,userSpecifiedVersion:r}=e;if(r==="unstable")return r;let i=await Wi({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 Yi(e){let{adminSession:t,session:o}=await lo(e.store),r=await Ys({session:o,adminSession:t,userSpecifiedVersion:e.userSpecifiedVersion});return{adminSession:t,version:r,session:o}}var Ks={id:"admin",prepareContext:async({store:e,requestedVersion:t})=>Yi({store:e,userSpecifiedVersion:t}),execute:async({context:e,request:t})=>Qi({context:e,request:t})};function Ki(e){if(e==="admin")return Ks;throw new G(`Unsupported store GraphQL API target: ${e}`)}async function Xi(e){await N(e.store,!1);let t=Ki(e.api??"admin"),o=await Gi({query:e.query,queryFile:e.queryFile,variables:e.variables,variableFile:e.variableFile,version:e.version,allowMutations:e.allowMutations}),r=await B({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 Zi(e){if(e){I({headline:"Operation succeeded.",body:`Results written to ${e}`});return}I({headline:"Operation succeeded."})}async function ea(e,t,o="text"){let r=o==="json"?Te.encode(e):JSON.stringify(e.data,null,2);if(t){await Ne(t,r),o==="text"&&Zi(t);return}o==="text"&&Zi(),g(r)}var ee=R(j(),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 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=>M(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=>M(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=>M(t)}),"allow-mutations":ee.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};static get jsonOutputSchema(){return Te}async run(){let{flags:t}=await this.parse(e),o=await Xi({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 ea(o,t["output-file"],t.json?"json":"text")}};n();n();async function ta(e){le();let t=Xs(e.store),o=_r();await Nr({port:e.port,storeFqdn:e.store,tokenProvider:t,key:o,protectMutations:!e.allowMutations,query:e.query,variables:e.variables,apiVersion:e.apiVersion,additionalReadyMessages:[d`Mutations are ${e.allowMutations?u.green("allowed"):u.yellow("blocked")}.`],abortSignal:e.abortSignal})}function Xs(e){return{getToken:async()=>(await $(e)).accessToken,refreshToken:async()=>(await $(e)).accessToken}}var Ft=R(j(),1),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 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,store:b.store,port:Uo({description:"Local port for the GraphiQL server.",env:"SHOPIFY_FLAG_PORT"}),"allow-mutations":Ft.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1}),variables:Ft.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES"}),version:Ft.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);await ta({store:t.store,port:t.port,allowMutations:t["allow-mutations"],variables:t.variables,apiVersion:t.version})}};n();n();n();function Ct(e){if(e)return yi[e.toLowerCase()]}function oa(e){return e?oe(e):""}n();var Zs={APP_DEVELOPMENT:"dev",CLIENT_TRANSFER:"client-transfer",COLLABORATOR:"collaborator",DEVELOPMENT:"dev",DEVELOPMENT_SUPERSET:"dev",PRODUCTION:"production"};function Pt(e){if(e)return Zs[e]}function ra(e){return e?oe(e):""}var na={dev:"development_superset",production:"production","client-transfer":"client_transfer",collaborator:"collaborator"},Dt=Object.keys(na);function ia(e){return na[e]}var ec=`#graphql
101
+ `;async function Ki(e){try{return(await ne({query:ec,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||(Pt(t)&&typeof t.response.status=="number"&&t.response.status>=500?new c(`Couldn't read the supported API versions for ${e.adminSession.storeFqdn}: the Admin API returned a server error (HTTP ${t.response.status}).`,"This is a problem on the Shopify side, not with your command. Wait a moment and run it again."):t)}}async function Xi(e){try{return await H({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 Ie.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(Pt(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 ho(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 tc(e){let{session:t,adminSession:o,userSpecifiedVersion:r}=e;if(r==="unstable")return r;let i=await Ki({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 Zi(e){let{adminSession:t,session:o}=await ho(e.store),r=await tc({session:o,adminSession:t,userSpecifiedVersion:e.userSpecifiedVersion});return{adminSession:t,version:r,session:o}}var oc={id:"admin",prepareContext:async({store:e,requestedVersion:t})=>Zi({store:e,userSpecifiedVersion:t}),execute:async({context:e,request:t})=>Xi({context:e,request:t})};function ea(e){if(e==="admin")return oc;throw new J(`Unsupported store GraphQL API target: ${e}`)}async function ta(e){await N(e.store,!1);let t=ea(e.api??"admin"),o=await Wi({query:e.query,queryFile:e.queryFile,variables:e.variables,variableFile:e.variableFile,version:e.version,allowMutations:e.allowMutations}),r=await H({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 oa(e){if(e){I({headline:"Operation succeeded.",body:`Results written to ${e}`});return}I({headline:"Operation succeeded."})}async function ra(e,t,o="text"){let r=o==="json"?Ie.encode(e):JSON.stringify(e.data,null,2);if(t){await Fe(t,r),o==="text"&&oa(t);return}o==="text"&&oa(),S(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 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})};static get jsonOutputSchema(){return Ie}async run(){let{flags:t}=await this.parse(e),o=await ta({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 ra(o,t["output-file"],t.json?"json":"text")}};n();n();async function na(e){le();let t=rc(e.store),o=Cr();await Pr({port:e.port,storeFqdn:e.store,tokenProvider:t,key:o,protectMutations:!e.allowMutations,query:e.query,variables:e.variables,apiVersion:e.apiVersion,additionalReadyMessages:[d`Mutations are ${e.allowMutations?u.green("allowed"):u.yellow("blocked")}.`],abortSignal:e.abortSignal})}function rc(e){return{getToken:async()=>(await $(e)).accessToken,refreshToken:async()=>(await $(e)).accessToken}}var Dt=R(M(),1),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 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,store:b.store,port:Bo({description:"Local port for the GraphiQL server.",env:"SHOPIFY_FLAG_PORT"}),"allow-mutations":Dt.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1}),variables:Dt.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES"}),version:Dt.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);await na({store:t.store,port:t.port,allowMutations:t["allow-mutations"],variables:t.variables,apiVersion:t.version})}};n();n();n();function Lt(e){if(e)return bi[e.toLowerCase()]}function ia(e){return e?oe(e):""}n();var nc={APP_DEVELOPMENT:"dev",CLIENT_TRANSFER:"client-transfer",COLLABORATOR:"collaborator",DEVELOPMENT:"dev",DEVELOPMENT_SUPERSET:"dev",PRODUCTION:"production"};function Rt(e){if(e)return nc[e]}function aa(e){return e?oe(e):""}var sa={dev:"development_superset",production:"production","client-transfer":"client_transfer",collaborator:"collaborator"},qt=Object.keys(sa);function ca(e){return sa[e]}var ic=`#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 Lt(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=_o()?void 0:Y(t);if(nc(o)){await N(o.store,!0,o.preview.shopId),q(o.userId);let i=await ic(o);return mc({store:t,previewSession:o,previewStoreUrls:i})}let r=!!o;try{return await oc(t,{noPrompt:r})}catch(i){if(!r||!sc(i))throw i;return f(`BP store info lookup failed; falling back to stored store auth: ${uc(i)}`),tc(t)}}async function tc(e){let t=await $(e);await N(t.store,!0),q(t.userId);let o=await rc(t);return{...pc({store:t.store,shop:o}),authScopes:t.scopes}}async function oc(e,t={}){let o=await _t({store:e,noPrompt:t.noPrompt}),r=await ac(o,e,{noPrompt:t.noPrompt});return dc({store:e,destinationsCtx:o,orgShop:r})}async function rc(e){try{let t=await ne({query:ec,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 nc(e){return e?.kind==="preview"&&e.preview!==void 0}async function ic(e){try{let t=await Ti({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),kt(e)),t}}async function ac(e,t,o={}){if(!e.owningOrg?.id){f("Owning organization id is unknown; skipping BP Organizations shop lookup.");return}try{return await Di({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 Ve||cc(e)}function cc(e){return e instanceof c&&e.message.includes("unable to prompt for reauthentication")}function uc(e){return e instanceof Error?e.message:String(e)}function pc(e){let{store:t,shop:o}=e,r=o.myshopifyDomain??t,i={id:o.id,displayName:o.name,storeOwner:lc(o),type:o.plan?.partnerDevelopment?"dev":void 0,plan:o.plan?.publicDisplayName,adminUrl:sa(re(r))};return{...fe(i),subdomain:r}}function dc(e){let{store:t,destinationsCtx:o,orgShop:r}=e,i={id:aa(r?.shopifyShopId),displayName:r?.name,organizationId:o.owningOrg?.id,organizationName:o.owningOrg?.name,storeOwner:fc(r),type:Pt(r?.storeType),plan:Ct(r?.planName),featurePreview:r?.developerPreviewHandle,adminUrl:sa(re(t))};return{...fe(i),subdomain:t}}function mc(e){let{store:t,previewSession:o,previewStoreUrls:r}=e,i={id:aa(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 aa(e){if(e)return`gid://shopify/Shop/${e}`}function lc(e){let t=fe({name:e.shopOwnerName,email:e.email});return Object.keys(t).length>0?t:void 0}function fc(e){if(!e)return;let t=fe({name:e.ownerName,email:e.ownerEmail});return Object.keys(t).length>0?t:void 0}function sa(e){if(e)return`https://admin.shopify.com/store/${encodeURIComponent(e)}`}n();n();var ca=s.object({name:s.string().optional(),email:s.string().optional()}),Rt=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:ca.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:ca}});function ua(e,t){if(t==="json"){g(Rt.encode(e));return}let o=Sc(e);T({customSections:[{title:"Store details",body:{tabularData:hc(e),firstColumnSubdued:!0}},...o.length>0?[{body:{list:{title:{bold:"Next steps"},items:o}}}]:[]]})}function hc(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",gc(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 Sc(e){let t=[];return fo(t,e.adminUrl,"Manage this store in the Shopify admin"),fo(t,e.accessUrl,"View your store"),fo(t,e.saveUrl,"Save your store"),t}function gc(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 fo(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 $t(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=it()?void 0:Y(t);if(pc(o)){await N(o.store,!0,o.preview.shopId),q(o.userId);let i=await dc(o);return gc({store:t,previewSession:o,previewStoreUrls:i})}let r=!!o;try{return await sc(t,{noPrompt:r})}catch(i){if(!r||!lc(i))throw i;return f(`BP store info lookup failed; falling back to stored store auth: ${go(i)}`),ac(t)}}async function ac(e){let t=await $(e);await N(t.store,!0),q(t.userId);let o=await uc(t);return{...hc({store:t.store,shop:o}),authScopes:t.scopes}}async function sc(e,t={}){let o;try{o=await Ct({store:e,noPrompt:t.noPrompt})}catch(i){if(!(i instanceof Te))throw i;let a=await cc(e,t);if(!a)throw i;return a}let r=await mc(o,e,{noPrompt:t.noPrompt});return ua({store:e,destinationsCtx:o,orgShop:r})}async function cc(e,t){let o;try{let i=await Tr();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.`),ua({store:e,destinationsCtx:{owningOrg:{id:o.id,name:o.businessName}},orgShop:r})}async function uc(e){try{let t=await ne({query:ic,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 pc(e){return e?.kind==="preview"&&e.preview!==void 0}async function dc(e){try{let t=await _i({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)&&(Se(e.store,e.userId),At(e)),t}}async function mc(e,t,o={}){if(!e.owningOrg?.id){f("Owning organization id is unknown; skipping BP Organizations shop lookup.");return}try{return await qi({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 lc(e){return e instanceof Te||fc(e)}function fc(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 hc(e){let{store:t,shop:o}=e,r=o.myshopifyDomain??t,i={id:o.id,displayName:o.name,storeOwner:Sc(o),type:o.plan?.partnerDevelopment?"dev":void 0,plan:o.plan?.publicDisplayName,adminUrl:da(re(r))};return{...fe(i),subdomain:r}}function ua(e){let{store:t,destinationsCtx:o,orgShop:r}=e,i={id:pa(r?.shopifyShopId),displayName:r?.name,organizationId:o.owningOrg?.id,organizationName:o.owningOrg?.name,storeOwner:yc(r),type:Rt(r?.storeType),plan:Lt(r?.planName),featurePreview:r?.developerPreviewHandle,adminUrl:da(re(t))};return{...fe(i),subdomain:t}}function gc(e){let{store:t,previewSession:o,previewStoreUrls:r}=e,i={id:pa(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 pa(e){if(e)return`gid://shopify/Shop/${e}`}function Sc(e){let t=fe({name:e.shopOwnerName,email:e.email});return Object.keys(t).length>0?t:void 0}function yc(e){if(!e)return;let t=fe({name:e.ownerName,email:e.ownerEmail});return Object.keys(t).length>0?t:void 0}function da(e){if(e)return`https://admin.shopify.com/store/${encodeURIComponent(e)}`}n();n();var ma=s.object({name:s.string().optional(),email:s.string().optional()}),Ut=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:ma.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:ma}});function la(e,t){if(t==="json"){S(Ut.encode(e));return}let o=kc(e);T({customSections:[{title:"Store details",body:{tabularData:wc(e),firstColumnSubdued:!0}},...o.length>0?[{body:{list:{title:{bold:"Next steps"},items:o}}}]:[]]})}function wc(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",bc(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 kc(e){let t=[];return So(t,e.adminUrl,"Manage this store in the Shopify admin"),So(t,e.accessUrl,"View your store"),So(t,e.saveUrl,"Save your store"),t}function bc(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 So(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 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};static get jsonOutputSchema(){return Rt}async run(){let{flags:t}=await this.parse(e),o=await Lt({store:t.store});ua(o,t.json?"json":"text")}};n();n();n();n();n();var pa={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 da(e){let{entries:t,hasMore:o}=await yc(e.token,e.organization,e.storeType);return{entries:t.sort(bc),hasMore:o}}async function yc(e,t,o){let r=J(),a=(await K(t,{query:pa,token:e,variables:{first:250,filters:wc(o)},unauthorizedHandler:r})).organization?.accessibleShops;if(!a)return{entries:[],hasMore:!1};let p=[];for(let m of a.edges){let l=kc(m.node,t);l&&p.push(l)}return{entries:p,hasMore:a.pageInfo.hasNextPage}}function wc(e){let t=[{field:"STORE_STATUS",operator:"EQUALS",value:"active"}];return e&&t.push({field:"STORE_TYPE",operator:"EQUALS",value:ia(e)}),t}function kc(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:Pt(e.storeType),plan:Ct(e.planName)}}function bc(e,t){return e.createdAt===t.createdAt?e.store.localeCompare(t.store):t.createdAt.localeCompare(e.createdAt)}async function la(e={}){let t=await V([],{allowAutomationToken:!0});if(e.organizationId){let i=await Or(e.organizationId.toString(),t);if(i)return ma(t,i,e.storeType)}let o=await xr(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&&!at())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 vc(o.organizations,e.organizationId);return ma(t,r,e.storeType)}async function ma(e,t,o){let r=await da({token:e,organization:t,storeType:o}),{stores:i,truncated:a}=xc(r.entries,r.hasMore);return{stores:i,organization:Ac(t),...o?{storeType:o}:{},...a?{truncated:!0}:{}}}async function vc(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 Co({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 Ac(e){return{id:e.id,name:e.businessName}}function xc(e,t){return{stores:e.slice(0,250),truncated:t||e.length>250}}n();n();var fa=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}),qt=x({name:"StoreListResult",schema:s.object({stores:s.array(fa),organization:ce.optional(),storeType:s.enum(Dt).optional(),notice:s.string().optional(),truncated:s.boolean().optional()}),definitions:{StoreListEntry:fa,StoreListOrganization:ce}});var Oc=["To list stores authenticated directly with",{command:"shopify store auth"},{char:","},"run",{command:"shopify store auth list"},{char:"."}];function ha(e,t){if(e.notice&&Xt(e.notice),e.truncated&&Xt(Tc(e)),t==="json"){g(qt.encode(e));return}Ic(e)}function Tc(e){let t=e.organization?` in ${e.organization.name}`:" in this organization";return`Showing the ${250} most recent ${Sa(e.storeType)}${t}. More stores exist.`}function Sa(e){return e?`${e.replaceAll("-"," ")} stores`:"stores"}function Ic(e){T({headline:Ec(e),customSections:[..._c(e.organization),{body:Oc}]}),e.stores.length>0&&Nc(e.stores)}function Ec(e){let t=Sa(e.storeType);return e.stores.length>0?`Listing ${t}.`:e.notice?`No ${t} were returned for the current CLI session.`:`No ${t} found.`}function _c(e){return e?[{body:{tabularData:[["Organization",`${e.name} (${e.id})`]],firstColumnSubdued:!0}}]:[]}function Nc(e){he({rows:e.map(t=>({subdomain:Fc(t.store),name:t.name??"",type:ra(t.type),plan:oa(t.plan),created:ht(t.createdAt)})),columns:{subdomain:{header:"Subdomain"},name:{header:"Name"},type:{header:"Type"},plan:{header:"Plan"},created:{header:"Created"}}})}function Fc(e){return St(e)??e}var ho=R(j(),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 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":ho.Flags.integer({description:`${b["organization-id"].description} Required if non interactive when more than one organization is available.`,env:"SHOPIFY_FLAG_ORGANIZATION_ID"}),type:ho.Flags.string({description:"List only stores of this type.",options:Dt,env:"SHOPIFY_FLAG_STORE_TYPE"})};static get jsonOutputSchema(){return qt}async run(){let{flags:t}=await this.parse(e),o=await la({organizationId:t["organization-id"],storeType:t.type});ha(o,t.json?"json":"text")}};n();n();var Cc={getStoreInfo:Lt,openURL:st};async function ga(e,t={}){let{getStoreInfo:o,openURL:r}={...Cc,...t},i=await o({store:e.store}),a=Pc(i),p=await r(a),m=re(i.subdomain);return{storeDomain:m?`${m}.myshopify.com`:null,url:a,opened:p}}function Pc(e){return e.accessUrl??`https://${e.subdomain}`}n();n();var $t=x({name:"OpenStoreResult",schema:s.object({storeDomain:s.string().regex(/^[^.]+\.myshopify\.com$/).nullable(),url:s.string().url(),opened:s.boolean()}).strict()});function ya(e,t){if(t==="json"){g($t.encode(e));return}if(e.opened){T({headline:`Opening the storefront for ${e.storeDomain??e.url} in your browser.`});return}T({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 description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com"];static flags={...y,...w,store:b.store};static get jsonOutputSchema(){return $t}async run(){let{flags:t}=await this.parse(e),o=await ga({store:t.store});ya(o,t.json?"json":"text")}};var Dc={"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":je,"store:create:preview":Ge,"store:delete":We,"store:execute":Ke,"store:graphiql":Xe,"store:info":Ze,"store:list":et,"store:open":tt},Ut=Dc;n();var zt={"app:build":Cr,"app:bulk:cancel":Pr,"app:bulk:status":Dr,"app:deploy":Ur,"app:dev":zr,"app:dev:clean":kn,"app:security:check":Br,"app:security:clean":Hr,"app:security:instructions":jr,"app:security:record":Mr,"app:security:review":Gr,"app:logs":Jr,"app:import:channel-config":vn,"app:import:custom-data-definitions":An,"app:import:dashboard-extensions":nn,"app:import-custom-data-definitions":xn,"app:import-extensions":an,"app:info":sn,"app:init":cn,"app:config:validate":un,"app:release":pn,"app:subscription-migrations:cancel":dn,"app:subscription-migrations:list":mn,"app:subscription-migrations:schedule":ln,"app:subscription-migrations:status":fn,"app:subscription-migrations:unschedule":hn,"app:config:link":Lr,"app:config:use":Rr,"app:config:pull":qr,"app:env:pull":Vr,"app:env:show":Wr,"app:execute":Yr,"app:graphiql":Kr,"app:bulk:execute":Qr,"app:function:build":Xr,"app:function:replay":Zr,"app:function:run":en,"app:function:info":bn,"app:function:schema":tn,"app:function:typegen":on,"app:generate:extension":rn,"app:versions:list":Sn,"app:webhook:trigger":gn,"demo:watcher":$r,"organization:list":On},Lc=wn,Rc=yn;var Mk=Fr.init;(0,ka.createGlobalProxyAgent)({environmentVariableNamespace:"SHOPIFY_",forceGlobalAgent:!0,socketConnectionTimeout:6e4});process.on("uncaughtException",async e=>{await rr(e),process.exit(1)});var qc=process,So=!1,$c=["SIGINT","SIGTERM","SIGQUIT"];$c.forEach(e=>{process.on(e,()=>{So||(So=qc.emit("shopify:signal",e),So||process.exit(1))})});var wa=Number(process.env.SHOPIFY_CLI_COLUMNS);isNaN(wa)||(process.stdout.columns=wa);async function Uc({development:e}){await $o({moduleURL:import.meta.url,development:e})}ke.plugins.hidden=!0;ke["plugins:install"].description="";var zc=Object.keys(zt);zc.forEach(e=>{zt[e].customPluginName="@shopify/app"});var Bc=Object.keys(dt);Bc.forEach(e=>{dt[e].customPluginName="@shopify/theme"});var Hc=Object.keys(mt);Hc.forEach(e=>{mt[e].customPluginName="@shopify/cli-hydrogen"});var jc=Object.keys(Ut);jc.forEach(e=>{Ut[e].customPluginName="@shopify/store"});var Mc=Object.keys(lt);Mc.forEach(e=>{lt[e].customPluginName="@oclif/plugin-commands"});var Gc=Object.keys(ft);Gc.forEach(e=>{ft[e].customPluginName="@shopify/plugin-did-you-mean"});var Jc=Object.keys(ke);Jc.forEach(e=>{ke[e].customPluginName="@oclif/plugin-plugins"});var Gk={...zt,...dt,...ke,...ft,...lt,...mt,...Ut,search:Bo,upgrade:Ho,version:zo,"send-analytics":jo,help:or,"auth:logout":Mo,"auth:login":Go,"debug:command-flags":Jo,"kitchen-sink":Yo,"kitchen-sink:async":Vo,"kitchen-sink:prompts":Wo,"kitchen-sink:static":Qo,"doctor-release":Ko,"doctor-release:theme":Xo,"doc:fetch":Zo,"doc:search":er,"docs:generate":tr,"notifications:list":nr,"notifications:generate":ir,"cache:clear":ar,"config:autoupgrade:off":sr,"config:autoupgrade:on":cr,"config:autoupgrade:status":ur},Jk=Uc;export{Rc as AppPublicMetadataHook,Lc as AppSensitiveMetadataHook,Gk as COMMANDS,Ia as DidYouMeanHook,Mk as HydrogenInitHook,Ta as PluginHook,Ea as TunnelProviderHook,_a as TunnelStartHook,Jk as default,Aa as fetchStoreThemes,xa as pull,Oa as push};
119
+ Use \`--json\` for machine-readable output.`;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};static get jsonOutputSchema(){return Ut}async run(){let{flags:t}=await this.parse(e),o=await $t({store:t.store});la(o,t.json?"json":"text")}};n();n();n();n();n();var fa={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 ha(e){let{entries:t,hasMore:o}=await vc(e.token,e.organization,e.storeType);return{entries:t.sort(Oc),hasMore:o}}async function vc(e,t,o){let r=V(),a=(await K(t,{query:fa,token:e,variables:{first:250,filters:Ac(o)},unauthorizedHandler:r})).organization?.accessibleShops;if(!a)return{entries:[],hasMore:!1};let p=[];for(let m of a.edges){let l=xc(m.node,t);l&&p.push(l)}return{entries:p,hasMore:a.pageInfo.hasNextPage}}function Ac(e){let t=[{field:"STORE_STATUS",operator:"EQUALS",value:"active"}];return e&&t.push({field:"STORE_TYPE",operator:"EQUALS",value:ca(e)}),t}function xc(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:Rt(e.storeType),plan:Lt(e.planName)}}function Oc(e,t){return e.createdAt===t.createdAt?e.store.localeCompare(t.store):t.createdAt.localeCompare(e.createdAt)}async function Sa(e={}){let t=await B([],{allowAutomationToken:!0});if(e.organizationId){let i=await Ir(e.organizationId.toString(),t);if(i)return ga(t,i,e.storeType)}let o=await mt(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&&!st())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 Tc(o.organizations,e.organizationId);return ga(t,r,e.storeType)}async function ga(e,t,o){let r=await ha({token:e,organization:t,storeType:o}),{stores:i,truncated:a}=Ec(r.entries,r.hasMore);return{stores:i,organization:Ic(t),...o?{storeType:o}:{},...a?{truncated:!0}:{}}}async function Tc(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 Do({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 Ic(e){return{id:e.id,name:e.businessName}}function Ec(e,t){return{stores:e.slice(0,250),truncated:t||e.length>250}}n();n();var ya=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}),zt=x({name:"StoreListResult",schema:s.object({stores:s.array(ya),organization:ce.optional(),storeType:s.enum(qt).optional(),notice:s.string().optional(),truncated:s.boolean().optional()}),definitions:{StoreListEntry:ya,StoreListOrganization:ce}});var _c=["To list stores authenticated directly with",{command:"shopify store auth"},{char:","},"run",{command:"shopify store auth list"},{char:"."}];function wa(e,t){if(e.notice&&to(e.notice),e.truncated&&to(Nc(e)),t==="json"){S(zt.encode(e));return}Fc(e)}function Nc(e){let t=e.organization?` in ${e.organization.name}`:" in this organization";return`Showing the ${250} most recent ${ka(e.storeType)}${t}. More stores exist.`}function ka(e){return e?`${e.replaceAll("-"," ")} stores`:"stores"}function Fc(e){T({headline:Cc(e),customSections:[...Pc(e.organization),{body:_c}]}),e.stores.length>0&&Dc(e.stores)}function Cc(e){let t=ka(e.storeType);return e.stores.length>0?`Listing ${t}.`:e.notice?`No ${t} were returned for the current CLI session.`:`No ${t} found.`}function Pc(e){return e?[{body:{tabularData:[["Organization",`${e.name} (${e.id})`]],firstColumnSubdued:!0}}]:[]}function Dc(e){he({rows:e.map(t=>({subdomain:Lc(t.store),name:t.name??"",type:aa(t.type),plan:ia(t.plan),created:yt(t.createdAt)})),columns:{subdomain:{header:"Subdomain"},name:{header:"Name"},type:{header:"Type"},plan:{header:"Plan"},created:{header:"Created"}}})}function Lc(e){return wt(e)??e}var yo=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 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":yo.Flags.integer({description:`${b["organization-id"].description} Required if non interactive when more than one organization is available.`,env:"SHOPIFY_FLAG_ORGANIZATION_ID"}),type:yo.Flags.string({description:"List only stores of this type.",options:qt,env:"SHOPIFY_FLAG_STORE_TYPE"})};static get jsonOutputSchema(){return zt}async run(){let{flags:t}=await this.parse(e),o=await Sa({organizationId:t["organization-id"],storeType:t.type});wa(o,t.json?"json":"text")}};n();n();var Rc={getStoreInfo:$t,openURL:ct};async function ba(e,t={}){let{getStoreInfo:o,openURL:r}={...Rc,...t},i=await o({store:e.store}),a=qc(i),p=await r(a),m=re(i.subdomain);return{storeDomain:m?`${m}.myshopify.com`:null,url:a,opened:p}}function qc(e){return e.accessUrl??`https://${e.subdomain}`}n();n();var Bt=x({name:"OpenStoreResult",schema:s.object({storeDomain:s.string().regex(/^[^.]+\.myshopify\.com$/).nullable(),url:s.string().url(),opened:s.boolean()}).strict()});function va(e,t){if(t==="json"){S(Bt.encode(e));return}if(e.opened){T({headline:`Opening the storefront for ${e.storeDomain??e.url} in your browser.`});return}T({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 description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com"];static flags={...y,...w,store:b.store};static get jsonOutputSchema(){return Bt}async run(){let{flags:t}=await this.parse(e),o=await ba({store:t.store});va(o,t.json?"json":"text")}};var $c={"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":je,"store:create:preview":Ge,"store:delete":We,"store:execute":Ke,"store:graphiql":Xe,"store:info":Ze,"store:list":et,"store:open":tt},Ht=$c;n();var jt={"app:build":Lr,"app:bulk:cancel":Rr,"app:bulk:status":qr,"app:deploy":Hr,"app:dev":jr,"app:dev:clean":An,"app:security:check":Mr,"app:security:clean":Gr,"app:security:instructions":Jr,"app:security:record":Vr,"app:security:review":Wr,"app:logs":Qr,"app:import:channel-config":On,"app:import:custom-data-definitions":Tn,"app:import:dashboard-extensions":cn,"app:import-custom-data-definitions":In,"app:import-extensions":un,"app:info":pn,"app:init":dn,"app:config:validate":mn,"app:release":ln,"app:subscription-migrations:cancel":fn,"app:subscription-migrations:list":hn,"app:subscription-migrations:schedule":gn,"app:subscription-migrations:status":Sn,"app:subscription-migrations:unschedule":yn,"app:config:link":$r,"app:config:use":Ur,"app:config:pull":zr,"app:env:pull":Yr,"app:env:show":Kr,"app:execute":Zr,"app:graphiql":en,"app:bulk:execute":Xr,"app:function:build":tn,"app:function:replay":on,"app:function:run":rn,"app:function:info":xn,"app:function:schema":nn,"app:function:typegen":an,"app:generate:extension":sn,"app:versions:list":wn,"app:webhook:trigger":kn,"demo:watcher":Br,"organization:list":En},Uc=vn,zc=bn;var Yk=Dr.init;(0,xa.createGlobalProxyAgent)({environmentVariableNamespace:"SHOPIFY_",forceGlobalAgent:!0,socketConnectionTimeout:6e4});process.on("uncaughtException",async e=>{await ir(e),process.exit(1)});var Bc=process,wo=!1,Hc=["SIGINT","SIGTERM","SIGQUIT"];Hc.forEach(e=>{process.on(e,()=>{wo||(wo=Bc.emit("shopify:signal",e),wo||process.exit(1))})});var Aa=Number(process.env.SHOPIFY_CLI_COLUMNS);isNaN(Aa)||(process.stdout.columns=Aa);async function jc({development:e}){await zo({moduleURL:import.meta.url,development:e})}ke.plugins.hidden=!0;ke["plugins:install"].description="";var Mc=Object.keys(jt);Mc.forEach(e=>{jt[e].customPluginName="@shopify/app"});var Gc=Object.keys(ft);Gc.forEach(e=>{ft[e].customPluginName="@shopify/theme"});var Jc=Object.keys(ht);Jc.forEach(e=>{ht[e].customPluginName="@shopify/cli-hydrogen"});var Vc=Object.keys(Ht);Vc.forEach(e=>{Ht[e].customPluginName="@shopify/store"});var Wc=Object.keys(gt);Wc.forEach(e=>{gt[e].customPluginName="@oclif/plugin-commands"});var Qc=Object.keys(St);Qc.forEach(e=>{St[e].customPluginName="@shopify/plugin-did-you-mean"});var Yc=Object.keys(ke);Yc.forEach(e=>{ke[e].customPluginName="@oclif/plugin-plugins"});var Kk={...jt,...ft,...ke,...St,...gt,...ht,...Ht,search:jo,upgrade:Mo,version:Ho,"send-analytics":Go,help:nr,"auth:logout":Jo,"auth:login":Vo,"debug:command-flags":Wo,"kitchen-sink":Xo,"kitchen-sink:async":Qo,"kitchen-sink:prompts":Yo,"kitchen-sink:static":Ko,"doctor-release":Zo,"doctor-release:theme":er,"doc:fetch":tr,"doc:search":or,"docs:generate":rr,"notifications:list":ar,"notifications:generate":sr,"cache:clear":cr,"config:autoupgrade:off":ur,"config:autoupgrade:on":pr,"config:autoupgrade:status":dr},Xk=jc;export{zc as AppPublicMetadataHook,Uc as AppSensitiveMetadataHook,Kk as COMMANDS,Fa as DidYouMeanHook,Yk as HydrogenInitHook,Na as PluginHook,Ca as TunnelProviderHook,Pa as TunnelStartHook,Xk as default,Ia as fetchStoreThemes,Ea as pull,_a as push};