@shopify/cli 4.9.4 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (501) hide show
  1. package/dist/analytics-Q6QDIDYT.js +1 -0
  2. package/dist/analytics-VKKJNJ62.js +1 -0
  3. package/dist/assets/hydrogen/starter/CHANGELOG.md +7 -0
  4. package/dist/assets/hydrogen/starter/package.json +2 -2
  5. package/dist/assets/hydrogen/vite/package.json +3 -4
  6. package/dist/assets/hydrogen/vite/vite.config.js +3 -3
  7. package/dist/bootstrap.js +1 -1
  8. package/dist/{chunk-LKXFHYLI.js → chunk-24NUJTIH.js} +1 -1
  9. package/dist/chunk-2CMEKSI7.js +1 -0
  10. package/dist/chunk-2DID73ML.js +1 -0
  11. package/dist/chunk-2ORRV7GH.js +1 -0
  12. package/dist/chunk-2VSNFOKD.js +1 -0
  13. package/dist/chunk-335BUVBP.js +1 -0
  14. package/dist/{chunk-UEBUGSBT.js → chunk-3A3DZVEJ.js} +1 -1
  15. package/dist/chunk-3C6VLJ5D.js +319 -0
  16. package/dist/{chunk-PB5ZZET5.js → chunk-3G4HJO72.js} +30 -30
  17. package/dist/chunk-3LVCG4JB.js +1 -0
  18. package/dist/chunk-43KLFFP7.js +1 -0
  19. package/dist/chunk-43R5VGKT.js +1 -0
  20. package/dist/chunk-46MSIQ6Z.js +1 -0
  21. package/dist/chunk-4ARCB6DT.js +1 -0
  22. package/dist/chunk-4C2DAX5T.js +1 -0
  23. package/dist/chunk-4CRBTSVP.js +2 -0
  24. package/dist/chunk-4GCI2YCZ.js +8 -0
  25. package/dist/chunk-4GOJQKY5.js +1 -0
  26. package/dist/chunk-4RDFMBRG.js +9 -0
  27. package/dist/chunk-4SS6DXC7.js +5 -0
  28. package/dist/{chunk-J4J2YXH3.js → chunk-4TI7U2PN.js} +1 -1
  29. package/dist/{chunk-67EBF76X.js → chunk-52FDK2LC.js} +1 -1
  30. package/dist/chunk-53BG3NLH.js +3 -0
  31. package/dist/{chunk-LD6ZCTZ3.js → chunk-5B76DT7X.js} +1 -1
  32. package/dist/{chunk-A2VCTDKH.js → chunk-5NEGOQT6.js} +1 -1
  33. package/dist/{chunk-MW3JKGJH.js → chunk-5OMJFPQW.js} +1 -1
  34. package/dist/chunk-5TB52UUV.js +2 -0
  35. package/dist/chunk-5UWMXOHM.js +7 -0
  36. package/dist/chunk-6BNKBCCU.js +1 -0
  37. package/dist/chunk-6DXP7PQ7.js +1 -0
  38. package/dist/chunk-6PUU6ZNQ.js +1 -0
  39. package/dist/chunk-7GHSE7SG.js +1 -0
  40. package/dist/{chunk-7556AIVG.js → chunk-7IFE4UQY.js} +1 -1
  41. package/dist/chunk-7LAKWAKX.js +25 -0
  42. package/dist/chunk-7MVWDCI3.js +1 -0
  43. package/dist/chunk-7NSK77WG.js +3 -0
  44. package/dist/chunk-7QUZWCJZ.js +3 -0
  45. package/dist/chunk-7RPFJZLP.js +1 -0
  46. package/dist/{chunk-LJIJEGND.js → chunk-7UOA4DI7.js} +2 -2
  47. package/dist/chunk-7WPUV7GY.js +6 -0
  48. package/dist/chunk-7Y7AZRL3.js +10 -0
  49. package/dist/{chunk-NGSEF3UX.js → chunk-ACA2BGAD.js} +1 -1
  50. package/dist/chunk-AJMDF3QC.js +1 -0
  51. package/dist/{chunk-R7YJNDXW.js → chunk-AXC2MHHO.js} +1 -1
  52. package/dist/{chunk-DEF2G7S4.js → chunk-AYL6KBPE.js} +1 -1
  53. package/dist/chunk-BAHIL37I.js +1 -0
  54. package/dist/{chunk-RSC5NQAT.js → chunk-BCYTZ7LM.js} +1 -1
  55. package/dist/{chunk-AVMNIZAJ.js → chunk-BJPDJIS4.js} +1 -1
  56. package/dist/{chunk-7VAKNVFD.js → chunk-BN7ZXAZJ.js} +1 -1
  57. package/dist/chunk-BVSKBX7T.js +16 -0
  58. package/dist/chunk-BWRNXCVN.js +4 -0
  59. package/dist/{chunk-XNPUZRWP.js → chunk-C3KEDG33.js} +1 -1
  60. package/dist/{chunk-WEXOA4C4.js → chunk-C7V755IT.js} +1 -1
  61. package/dist/chunk-CCMDZX35.js +7 -0
  62. package/dist/chunk-CCQNP5YR.js +1 -0
  63. package/dist/chunk-CEIJKJOF.js +11 -0
  64. package/dist/chunk-CIK5BF7V.js +1 -0
  65. package/dist/{chunk-6YDLNP4G.js → chunk-CVVQQLCF.js} +1 -1
  66. package/dist/chunk-CW2T7EOQ.js +1 -0
  67. package/dist/chunk-CZ22VZDA.js +376 -0
  68. package/dist/{chunk-3G2ZQ2EF.js → chunk-D7NB7YR6.js} +1 -1
  69. package/dist/{chunk-DYPZX7MW.js → chunk-DFQ4WTET.js} +2 -2
  70. package/dist/chunk-DJAZBPYA.js +3 -0
  71. package/dist/chunk-DNMXVMJM.js +47 -0
  72. package/dist/{chunk-CLD3NZYD.js → chunk-EGCWR5AS.js} +1 -1
  73. package/dist/{chunk-BOE2ST6J.js → chunk-EITIW5OX.js} +1 -1
  74. package/dist/chunk-EMSF57ZB.js +1 -0
  75. package/dist/{chunk-ZEBMW5KS.js → chunk-EXFBZPZS.js} +1 -1
  76. package/dist/chunk-FDXHQZTO.js +26 -0
  77. package/dist/{chunk-Q2XLIWG4.js → chunk-FFHH5LOR.js} +1 -1
  78. package/dist/{chunk-MMQZO2W2.js → chunk-FNLECT7B.js} +1 -1
  79. package/dist/{chunk-PO5T44H3.js → chunk-FWB3GLMW.js} +1 -1
  80. package/dist/chunk-FZCGRIOM.js +1 -0
  81. package/dist/{chunk-G7JW4UIM.js → chunk-G6ZMSWEU.js} +1 -1
  82. package/dist/chunk-GAMC2BNY.js +7 -0
  83. package/dist/chunk-GB6E3ATN.js +4 -0
  84. package/dist/chunk-GCNA3HXH.js +8 -0
  85. package/dist/{chunk-IGDVKRB4.js → chunk-GFVKTWFT.js} +1 -1
  86. package/dist/chunk-GQNOVEKP.js +2 -0
  87. package/dist/{chunk-5BTLE67Z.js → chunk-GRGFA26K.js} +1 -1
  88. package/dist/chunk-GXORLBVN.js +2 -0
  89. package/dist/{chunk-3V4VL3SD.js → chunk-H4V55Y3Z.js} +118 -118
  90. package/dist/chunk-HCZG7YJ6.js +16 -0
  91. package/dist/chunk-HF4NDEX3.js +1 -0
  92. package/dist/chunk-HIRTL45Q.js +1 -0
  93. package/dist/chunk-I4OVLRQR.js +1 -0
  94. package/dist/{chunk-ENQXB532.js → chunk-I6FRVYGE.js} +1 -1
  95. package/dist/chunk-IEQ4UOH3.js +4 -0
  96. package/dist/{chunk-PIZDYS7T.js → chunk-IILLQOUC.js} +60 -60
  97. package/dist/{chunk-45SZ5PSE.js → chunk-IQVRP7CT.js} +1 -1
  98. package/dist/chunk-IUP7POIE.js +6 -0
  99. package/dist/chunk-IUTZIN2T.js +10 -0
  100. package/dist/chunk-IWEKM5Y3.js +1 -0
  101. package/dist/chunk-IWTNUJGY.js +2 -0
  102. package/dist/chunk-J6TW43TG.js +1 -0
  103. package/dist/chunk-JDR6UVZA.js +8 -0
  104. package/dist/{chunk-CVFPY2SH.js → chunk-JEA3C7ON.js} +1 -1
  105. package/dist/chunk-JOJV5E2K.js +1 -0
  106. package/dist/chunk-JYMDWR25.js +1 -0
  107. package/dist/{chunk-TPHHQAUD.js → chunk-KDPQXURV.js} +1 -1
  108. package/dist/{chunk-MW3IMZJ5.js → chunk-KGRIYAMA.js} +1 -1
  109. package/dist/chunk-KJQDS5HI.js +1 -0
  110. package/dist/chunk-KKPOOIE4.js +2 -0
  111. package/dist/{chunk-VS7QVU3Z.js → chunk-KSDU4YOB.js} +1 -1
  112. package/dist/chunk-L7MSPGDS.js +5 -0
  113. package/dist/{chunk-43URS56H.js → chunk-LDU5T3DN.js} +1 -1
  114. package/dist/chunk-LHKVXJPX.js +1 -0
  115. package/dist/{chunk-EO4YJFMY.js → chunk-LMQGNECW.js} +86 -200
  116. package/dist/{chunk-TQ7URMGS.js → chunk-LQ7ENG4V.js} +1 -1
  117. package/dist/chunk-LVLAOBJM.js +103 -0
  118. package/dist/chunk-LWCTKI4Z.js +18 -0
  119. package/dist/chunk-M3ACZWMR.js +1 -0
  120. package/dist/chunk-M4BVLMPH.js +31 -0
  121. package/dist/{chunk-NCRWOW6F.js → chunk-M5TGCSUK.js} +1 -1
  122. package/dist/chunk-M7LPHCP2.js +274 -0
  123. package/dist/{chunk-IDKRJ2F4.js → chunk-MDRVCBDO.js} +1 -1
  124. package/dist/chunk-MR2AUT7Q.js +1 -0
  125. package/dist/chunk-MXJAH2GW.js +5 -0
  126. package/dist/{chunk-UU6BRRYS.js → chunk-MYAIWSOO.js} +1 -1
  127. package/dist/{chunk-NT4A37HG.js → chunk-N2RFDHRY.js} +1 -1
  128. package/dist/{chunk-GSE6FXZU.js → chunk-NB4BRW3H.js} +1 -1
  129. package/dist/chunk-NDKSG4CC.js +97 -0
  130. package/dist/chunk-NK2MGR6A.js +1 -0
  131. package/dist/chunk-NOH63WC6.js +12 -0
  132. package/dist/{chunk-BVB3DTNE.js → chunk-OGWPS55W.js} +1 -1
  133. package/dist/chunk-OQ5CLM2H.js +4 -0
  134. package/dist/{chunk-PVAZCZSY.js → chunk-OQU3HLAE.js} +1 -1
  135. package/dist/chunk-OVWUGAEU.js +11 -0
  136. package/dist/chunk-OX7UVDSU.js +6 -0
  137. package/dist/chunk-P33TONYG.js +1 -0
  138. package/dist/chunk-PEVIRAMR.js +6 -0
  139. package/dist/{chunk-YPCXVZ2N.js → chunk-PGLWZMJU.js} +4 -4
  140. package/dist/chunk-PIAD3F6M.js +16 -0
  141. package/dist/chunk-PMHP57MH.js +20 -0
  142. package/dist/{chunk-F3PZGSOY.js → chunk-POKY4RWR.js} +1 -1
  143. package/dist/chunk-PSSYLJG4.js +2 -0
  144. package/dist/chunk-PYIICTLX.js +1 -0
  145. package/dist/chunk-PZUGDE7N.js +2 -0
  146. package/dist/{chunk-NU5WLZ6Y.js → chunk-Q2SZCZE7.js} +1 -1
  147. package/dist/{chunk-MUM34KUM.js → chunk-Q2XRITUG.js} +1 -1
  148. package/dist/chunk-Q5MEFIMV.js +4 -0
  149. package/dist/chunk-Q66CI37F.js +7 -0
  150. package/dist/chunk-QFWWCZOI.js +1 -0
  151. package/dist/{chunk-TR4OWSEX.js → chunk-QFYLJVJW.js} +1 -1
  152. package/dist/chunk-QKVVJXWS.js +3 -0
  153. package/dist/chunk-QN3774QI.js +1 -0
  154. package/dist/chunk-R2BDABJD.js +213 -0
  155. package/dist/{chunk-7HWMURCW.js → chunk-R7EMV77H.js} +1 -1
  156. package/dist/chunk-RFGEM5JC.js +3 -0
  157. package/dist/{chunk-7A3RW2VM.js → chunk-RVQV6G5M.js} +1 -1
  158. package/dist/chunk-S67I4E7M.js +5 -0
  159. package/dist/chunk-SFPXYHHL.js +1 -0
  160. package/dist/{chunk-4OCVXE5Y.js → chunk-SFQEHDJY.js} +1 -1
  161. package/dist/chunk-SL3VBI62.js +3 -0
  162. package/dist/{chunk-LOWSU4BB.js → chunk-SNNZ4U2W.js} +1 -1
  163. package/dist/chunk-T2IUXXCT.js +1 -0
  164. package/dist/chunk-TPSA4JN5.js +1 -0
  165. package/dist/chunk-TTEF7GTX.js +1 -0
  166. package/dist/{chunk-FQL2WEKX.js → chunk-U25W35TX.js} +1 -1
  167. package/dist/chunk-UIQL5ZF3.js +1 -0
  168. package/dist/chunk-UK6576EO.js +1 -0
  169. package/dist/chunk-ULD7CIOY.js +4 -0
  170. package/dist/{chunk-D3KFKT4D.js → chunk-UOS2XLGG.js} +1 -1
  171. package/dist/{chunk-EMH7OHCW.js → chunk-UVRKTMF7.js} +1 -1
  172. package/dist/{chunk-ZTICX3AO.js → chunk-UWMZ5CSB.js} +1 -1
  173. package/dist/chunk-UZROQRLX.js +2 -0
  174. package/dist/{chunk-5BGUKF7L.js → chunk-V75WUEFU.js} +1 -1
  175. package/dist/chunk-VB7YQMAM.js +5 -0
  176. package/dist/chunk-VHUD3CBC.js +3 -0
  177. package/dist/chunk-VMMUJN4T.js +17 -0
  178. package/dist/{chunk-S36VGP37.js → chunk-VW6QS7DO.js} +1 -1
  179. package/dist/chunk-VWH3VPYI.js +1 -0
  180. package/dist/{chunk-4TF7ER72.js → chunk-WBJ6ZHYH.js} +1 -1
  181. package/dist/chunk-WDFCOZAY.js +16 -0
  182. package/dist/chunk-WFWISGLS.js +1 -0
  183. package/dist/chunk-WGUOLSMG.js +1 -0
  184. package/dist/{chunk-PFXNBHQQ.js → chunk-WJSUIUBW.js} +2 -2
  185. package/dist/{chunk-TFXUDHCP.js → chunk-WMAFG2JD.js} +1 -1
  186. package/dist/chunk-X2H6I2WW.js +5 -0
  187. package/dist/{chunk-DSS4ECIH.js → chunk-X7HVAVSZ.js} +1 -1
  188. package/dist/{chunk-NYYXH2SX.js → chunk-XBQDMGUN.js} +1 -1
  189. package/dist/chunk-XITZIDCL.js +18 -0
  190. package/dist/chunk-XKRJKUA7.js +1 -0
  191. package/dist/{chunk-FEQHCE2E.js → chunk-XM7YUXTF.js} +2 -2
  192. package/dist/chunk-XMODGI45.js +1 -0
  193. package/dist/{chunk-B3M3KIOU.js → chunk-XNNKLUTN.js} +1 -1
  194. package/dist/chunk-XTREQ4A2.js +1 -0
  195. package/dist/chunk-YGYEM6QO.js +1 -0
  196. package/dist/{chunk-LWU5TKNA.js → chunk-YKS7MH3F.js} +9 -6
  197. package/dist/chunk-YTUDXZLN.js +1 -0
  198. package/dist/{chunk-I3J63RFV.js → chunk-YTUUU33R.js} +1 -1
  199. package/dist/chunk-YVVU4J5O.js +3 -0
  200. package/dist/{chunk-4TZCRMBJ.js → chunk-YVY32DNA.js} +1 -1
  201. package/dist/chunk-Z5SILNH2.js +7 -0
  202. package/dist/chunk-ZAA2DXK5.js +5 -0
  203. package/dist/chunk-ZDQO6CNY.js +1 -0
  204. package/dist/chunk-ZGV3HNEV.js +1 -0
  205. package/dist/chunk-ZQDDRIBA.js +22 -0
  206. package/dist/{chunk-QTLGMJDW.js → chunk-ZT5WFUKJ.js} +4 -4
  207. package/dist/chunk-ZYQ2XWC5.js +5 -0
  208. package/dist/cli/commands/app/build.js +1 -1
  209. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  210. package/dist/cli/commands/app/bulk/execute.js +1 -1
  211. package/dist/cli/commands/app/bulk/status.js +1 -1
  212. package/dist/cli/commands/app/config/link.js +1 -1
  213. package/dist/cli/commands/app/config/pull.js +1 -1
  214. package/dist/cli/commands/app/config/use.js +1 -1
  215. package/dist/cli/commands/app/config/validate.js +1 -1
  216. package/dist/cli/commands/app/demo/watcher.js +1 -1
  217. package/dist/cli/commands/app/deploy.js +1 -1
  218. package/dist/cli/commands/app/dev/clean.js +1 -1
  219. package/dist/cli/commands/app/dev.js +1 -1
  220. package/dist/cli/commands/app/env/pull.js +1 -1
  221. package/dist/cli/commands/app/env/show.js +1 -1
  222. package/dist/cli/commands/app/execute.js +1 -1
  223. package/dist/cli/commands/app/function/build.js +1 -1
  224. package/dist/cli/commands/app/function/info.js +1 -1
  225. package/dist/cli/commands/app/function/replay.js +1 -1
  226. package/dist/cli/commands/app/function/run.js +1 -1
  227. package/dist/cli/commands/app/function/schema.js +1 -1
  228. package/dist/cli/commands/app/function/typegen.js +1 -1
  229. package/dist/cli/commands/app/generate/extension.js +1 -1
  230. package/dist/cli/commands/app/graphiql.js +1 -1
  231. package/dist/cli/commands/app/import/channel-config.js +1 -1
  232. package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
  233. package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
  234. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  235. package/dist/cli/commands/app/import-extensions.js +1 -1
  236. package/dist/cli/commands/app/info.js +1 -1
  237. package/dist/cli/commands/app/init.js +1 -1
  238. package/dist/cli/commands/app/logs.js +1 -1
  239. package/dist/cli/commands/app/release.js +1 -1
  240. package/dist/cli/commands/app/security/check.js +1 -1
  241. package/dist/cli/commands/app/security/clean.js +1 -1
  242. package/dist/cli/commands/app/security/instructions.js +1 -1
  243. package/dist/cli/commands/app/security/record.js +1 -1
  244. package/dist/cli/commands/app/security/review.js +1 -1
  245. package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
  246. package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
  247. package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
  248. package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
  249. package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
  250. package/dist/cli/commands/app/versions/list.js +1 -1
  251. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  252. package/dist/cli/commands/auth/login.js +1 -1
  253. package/dist/cli/commands/auth/logout.js +1 -1
  254. package/dist/cli/commands/cache/clear.js +1 -1
  255. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  256. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  257. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  258. package/dist/cli/commands/debug/command-flags.js +1 -1
  259. package/dist/cli/commands/doc/fetch.d.ts +34 -1
  260. package/dist/cli/commands/doc/fetch.js +1 -1
  261. package/dist/cli/commands/doc/search.d.ts +53 -1
  262. package/dist/cli/commands/doc/search.js +1 -1
  263. package/dist/cli/commands/docs/generate.js +1 -1
  264. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  265. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  266. package/dist/cli/commands/help.d.ts +6 -6
  267. package/dist/cli/commands/help.js +1 -1
  268. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  269. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  270. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  271. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  272. package/dist/cli/commands/notifications/generate.js +1 -1
  273. package/dist/cli/commands/notifications/list.js +1 -1
  274. package/dist/cli/commands/organization/list.js +1 -1
  275. package/dist/cli/commands/search.js +1 -1
  276. package/dist/cli/commands/send-analytics.js +1 -1
  277. package/dist/cli/commands/theme/check.js +1 -1
  278. package/dist/cli/commands/theme/console.js +1 -1
  279. package/dist/cli/commands/theme/delete.js +1 -1
  280. package/dist/cli/commands/theme/dev.js +1 -1
  281. package/dist/cli/commands/theme/duplicate.js +1 -1
  282. package/dist/cli/commands/theme/info.js +1 -1
  283. package/dist/cli/commands/theme/init.js +1 -1
  284. package/dist/cli/commands/theme/language-server.js +1 -1
  285. package/dist/cli/commands/theme/list.js +1 -1
  286. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  287. package/dist/cli/commands/theme/open.js +1 -1
  288. package/dist/cli/commands/theme/package.js +1 -1
  289. package/dist/cli/commands/theme/preview.js +1 -1
  290. package/dist/cli/commands/theme/profile.js +1 -1
  291. package/dist/cli/commands/theme/publish.js +1 -1
  292. package/dist/cli/commands/theme/pull.js +1 -1
  293. package/dist/cli/commands/theme/push.js +1 -1
  294. package/dist/cli/commands/theme/rename.js +1 -1
  295. package/dist/cli/commands/theme/share.js +1 -1
  296. package/dist/cli/commands/upgrade.d.ts +64 -0
  297. package/dist/cli/commands/upgrade.js +1 -1
  298. package/dist/cli/commands/version.js +1 -1
  299. package/dist/cli/help.js +1 -1
  300. package/dist/cli/services/commands/doc/fetch-result.d.ts +2 -0
  301. package/dist/cli/services/commands/doc/fetch-result.js +22 -0
  302. package/dist/cli/services/commands/doc/fetch.d.ts +2 -1
  303. package/dist/cli/services/commands/doc/fetch.js +2 -15
  304. package/dist/cli/services/commands/doc/search-result.d.ts +2 -0
  305. package/dist/cli/services/commands/doc/search-result.js +14 -0
  306. package/dist/cli/services/commands/doc/search.d.ts +9 -1
  307. package/dist/cli/services/commands/doc/search.js +27 -2
  308. package/dist/cli/services/commands/doc/types.d.ts +107 -0
  309. package/dist/cli/services/commands/doc/types.js +47 -0
  310. package/dist/cli/services/commands/help/types.d.ts +6 -6
  311. package/dist/command-event-context-LFUZ7UCA.js +1 -0
  312. package/dist/command-json-schema-2UMKY7MY.js +1 -0
  313. package/dist/command-registry.js +1 -1
  314. package/dist/conf-store-RI3TL6I4.js +1 -0
  315. package/dist/custom-oclif-loader-IZCKN67O.js +1 -0
  316. package/dist/deprecations-IFVUXXDB.js +1 -0
  317. package/dist/dist-4H2B7BMN.js +1 -0
  318. package/dist/dist-QNWOGQN3.js +1 -0
  319. package/dist/{environment-RSUK27TA.js → environment-O7ECODHU.js} +1 -1
  320. package/dist/environments-CYMEN7NV.js +1 -0
  321. package/dist/error-IL6WQMSW.js +1 -0
  322. package/dist/error-handler-74HKA23T.js +1 -0
  323. package/dist/fs-AINFLJ2E.js +1 -0
  324. package/dist/hooks/did-you-mean.js +1 -1
  325. package/dist/hooks/hydrogen-init.js +1 -1
  326. package/dist/hooks/plugin-plugins.js +1 -1
  327. package/dist/hooks/postrun.js +1 -1
  328. package/dist/hooks/prerun.js +1 -1
  329. package/dist/hooks/public-metadata.js +1 -1
  330. package/dist/hooks/sensitive-metadata.js +1 -1
  331. package/dist/hooks/tunnel-provider.js +1 -1
  332. package/dist/hooks/tunnel-start.js +1 -1
  333. package/dist/index.js +13 -13
  334. package/dist/is-global-2VLKV46Q.js +1 -0
  335. package/dist/json-error-HZB5YIHV.js +1 -0
  336. package/dist/{lib-TYM5B75S.js → lib-PJHT4MKY.js} +1 -1
  337. package/dist/{lib-55QUD4AJ.js → lib-VKSQ65BQ.js} +1 -1
  338. package/dist/{lib-PH52G55H.js → lib-YEZOHXF3.js} +1 -1
  339. package/dist/{local-R3UAQN7T.js → local-KOZETREJ.js} +1 -1
  340. package/dist/{metadata-JWJG4JV4.js → metadata-IBPHZB7N.js} +1 -1
  341. package/dist/{morph-BABFBRSW.js → morph-CRY35DIK.js} +1 -1
  342. package/dist/node-package-manager-DXSRNEDC.js +1 -0
  343. package/dist/notifications-system-XA3EBOGJ.js +1 -0
  344. package/dist/os-X73O7BAB.js +1 -0
  345. package/dist/out-B2GISN65.js +1 -0
  346. package/dist/output-3OYXK3Z5.js +1 -0
  347. package/dist/{path-CPAYTWQW.js → path-3L2QRACZ.js} +1 -1
  348. package/dist/system-JWYYT4PM.js +1 -0
  349. package/dist/tsconfig.tsbuildinfo +1 -1
  350. package/dist/ui-PCG5D6RZ.js +1 -0
  351. package/dist/upgrade-7U2TUNC4.js +1 -0
  352. package/dist/version-7DGU2KYH.js +1 -0
  353. package/dist/version-SXQTRBXB.js +1 -0
  354. package/dist/workerd-MQZ3NKJI.js +18 -0
  355. package/oclif.manifest.json +1664 -427
  356. package/package.json +8 -8
  357. package/dist/analytics-APDNTBDE.js +0 -1
  358. package/dist/analytics-LX52KYSE.js +0 -1
  359. package/dist/chunk-2PDVBGQH.js +0 -7
  360. package/dist/chunk-2YVSZFXJ.js +0 -4
  361. package/dist/chunk-35WQTGN3.js +0 -5
  362. package/dist/chunk-37BGAWAW.js +0 -2
  363. package/dist/chunk-3C4WVKSO.js +0 -6
  364. package/dist/chunk-3LHE4GIX.js +0 -1
  365. package/dist/chunk-47IQIIFX.js +0 -383
  366. package/dist/chunk-4ES7BJEK.js +0 -1
  367. package/dist/chunk-4IFY7V7W.js +0 -1
  368. package/dist/chunk-4JGWKUJN.js +0 -2
  369. package/dist/chunk-4O5GQ3DS.js +0 -7
  370. package/dist/chunk-4O7LK5RG.js +0 -26
  371. package/dist/chunk-4TFJ5RW7.js +0 -8
  372. package/dist/chunk-4ZNBEMRT.js +0 -20
  373. package/dist/chunk-5JIJDUXX.js +0 -20
  374. package/dist/chunk-66YRAUWX.js +0 -3
  375. package/dist/chunk-6A4H3HPY.js +0 -7
  376. package/dist/chunk-6HPUOCFF.js +0 -1
  377. package/dist/chunk-6IDEDOXW.js +0 -2
  378. package/dist/chunk-6IMHGT7F.js +0 -8
  379. package/dist/chunk-6MC2BEW4.js +0 -1
  380. package/dist/chunk-73D5O7A3.js +0 -1
  381. package/dist/chunk-7E4MJCVE.js +0 -10
  382. package/dist/chunk-7HNRK2CR.js +0 -1
  383. package/dist/chunk-7SJHVJ3W.js +0 -5
  384. package/dist/chunk-ALK66U3O.js +0 -3
  385. package/dist/chunk-AMLCWRHU.js +0 -4
  386. package/dist/chunk-AYIU6Z4C.js +0 -1
  387. package/dist/chunk-BIWG3FQQ.js +0 -5
  388. package/dist/chunk-BQ3U3CQV.js +0 -1
  389. package/dist/chunk-C6IBY7NW.js +0 -16
  390. package/dist/chunk-CQF5NDTJ.js +0 -4
  391. package/dist/chunk-DMDLJRLW.js +0 -1
  392. package/dist/chunk-DMNWSUKV.js +0 -5
  393. package/dist/chunk-FK7GA4QQ.js +0 -1
  394. package/dist/chunk-FO2R6KHG.js +0 -1
  395. package/dist/chunk-FOAV642V.js +0 -1
  396. package/dist/chunk-GE4MLO3C.js +0 -5
  397. package/dist/chunk-GM4EFJJF.js +0 -7
  398. package/dist/chunk-GN66BRYF.js +0 -1
  399. package/dist/chunk-GPRZYFDE.js +0 -1
  400. package/dist/chunk-GZ7VGCVW.js +0 -3
  401. package/dist/chunk-HASIOUH2.js +0 -3
  402. package/dist/chunk-HILYTMVA.js +0 -1
  403. package/dist/chunk-HJHS23Q3.js +0 -1
  404. package/dist/chunk-HLPAVELJ.js +0 -1
  405. package/dist/chunk-HPM3HF7A.js +0 -1
  406. package/dist/chunk-HQJ62PII.js +0 -3
  407. package/dist/chunk-HQY6JM6G.js +0 -6
  408. package/dist/chunk-HSYMUYEZ.js +0 -359
  409. package/dist/chunk-I5PQZRYM.js +0 -32
  410. package/dist/chunk-IPZ6LUJV.js +0 -4
  411. package/dist/chunk-J4NBPC57.js +0 -1
  412. package/dist/chunk-J6LQR2F6.js +0 -7
  413. package/dist/chunk-JYGZD4HM.js +0 -1
  414. package/dist/chunk-K3HUQLIC.js +0 -6
  415. package/dist/chunk-K7D53KSJ.js +0 -1
  416. package/dist/chunk-KQFA5YTT.js +0 -97
  417. package/dist/chunk-KTD7VLHL.js +0 -2
  418. package/dist/chunk-L4DFMMOI.js +0 -1
  419. package/dist/chunk-LJZTSQRD.js +0 -11
  420. package/dist/chunk-LLPB6JN5.js +0 -9
  421. package/dist/chunk-LYIXRMQJ.js +0 -46
  422. package/dist/chunk-MCNK5SJ6.js +0 -2
  423. package/dist/chunk-MJZSSCGD.js +0 -5
  424. package/dist/chunk-N55MSO3X.js +0 -12
  425. package/dist/chunk-N5AZZYQA.js +0 -4
  426. package/dist/chunk-NCVGCVQ5.js +0 -6
  427. package/dist/chunk-O5FFMTJE.js +0 -25
  428. package/dist/chunk-OE3HSNSE.js +0 -16
  429. package/dist/chunk-ONF7XXEL.js +0 -1
  430. package/dist/chunk-PG4S5HJJ.js +0 -5
  431. package/dist/chunk-PHG4DASY.js +0 -18
  432. package/dist/chunk-PP4VCR4Y.js +0 -1
  433. package/dist/chunk-PWS4VFSD.js +0 -1
  434. package/dist/chunk-Q37WAD6F.js +0 -1
  435. package/dist/chunk-Q43LBSPT.js +0 -1
  436. package/dist/chunk-QAJZUJR5.js +0 -1
  437. package/dist/chunk-QO5RNGWA.js +0 -1
  438. package/dist/chunk-QPQS2YU3.js +0 -1
  439. package/dist/chunk-QUXQM3S3.js +0 -1
  440. package/dist/chunk-R3KSOCMB.js +0 -6
  441. package/dist/chunk-R74WHKHH.js +0 -15
  442. package/dist/chunk-RJSQMKKS.js +0 -1
  443. package/dist/chunk-RK2V6OIJ.js +0 -2
  444. package/dist/chunk-RUHQNF2W.js +0 -1
  445. package/dist/chunk-RXTLNUPF.js +0 -1
  446. package/dist/chunk-SNE4RHM4.js +0 -1
  447. package/dist/chunk-SQAS5RVZ.js +0 -10
  448. package/dist/chunk-SZI6G247.js +0 -103
  449. package/dist/chunk-TVCWDEVS.js +0 -1
  450. package/dist/chunk-TYMYIUIQ.js +0 -1
  451. package/dist/chunk-UIC7K2HX.js +0 -7
  452. package/dist/chunk-UNHT4ZFP.js +0 -317
  453. package/dist/chunk-UQ6ALA3Y.js +0 -3
  454. package/dist/chunk-UWI76E2L.js +0 -18
  455. package/dist/chunk-VE35YELD.js +0 -1
  456. package/dist/chunk-VGBUN3CZ.js +0 -17
  457. package/dist/chunk-VMNOSVPT.js +0 -8
  458. package/dist/chunk-VNFUCH6T.js +0 -1
  459. package/dist/chunk-W4KE7AO6.js +0 -1
  460. package/dist/chunk-WEPO4J2F.js +0 -19
  461. package/dist/chunk-WLWHCUPZ.js +0 -1
  462. package/dist/chunk-XGKCPD6W.js +0 -1
  463. package/dist/chunk-XNVOKAF2.js +0 -1
  464. package/dist/chunk-XSMCQLJW.js +0 -1
  465. package/dist/chunk-XUUIBSLW.js +0 -1
  466. package/dist/chunk-XWQM2NZ2.js +0 -2
  467. package/dist/chunk-Y3PY5LP7.js +0 -3
  468. package/dist/chunk-Y62EMOQA.js +0 -1
  469. package/dist/chunk-Y743UVBS.js +0 -16
  470. package/dist/chunk-YBSX53QP.js +0 -1
  471. package/dist/chunk-YHCP326A.js +0 -16
  472. package/dist/chunk-YHESTFMZ.js +0 -4
  473. package/dist/chunk-YT27FIQN.js +0 -275
  474. package/dist/chunk-YTR5JHNJ.js +0 -2
  475. package/dist/chunk-YYA5VGDW.js +0 -1
  476. package/dist/chunk-Z6X2GT6Q.js +0 -1
  477. package/dist/chunk-ZEE32UH6.js +0 -1
  478. package/dist/cli/commands/app/app-logs/sources.js +0 -1
  479. package/dist/command-json-schema-SS4GDJTQ.js +0 -1
  480. package/dist/conf-store-54YJCIDK.js +0 -1
  481. package/dist/custom-oclif-loader-3UBH7Q7R.js +0 -1
  482. package/dist/deprecations-ZX7ZKF6L.js +0 -1
  483. package/dist/dist-JMNE7MP6.js +0 -1
  484. package/dist/dist-M2AXGBOL.js +0 -1
  485. package/dist/environments-KD2IDYPG.js +0 -1
  486. package/dist/error-AA6LW3PN.js +0 -1
  487. package/dist/error-handler-4VW3AV2G.js +0 -1
  488. package/dist/fs-4QZCAEP7.js +0 -1
  489. package/dist/is-global-FKG327CG.js +0 -1
  490. package/dist/json-error-32ETFU3V.js +0 -1
  491. package/dist/node-package-manager-M4XHUTQR.js +0 -1
  492. package/dist/notifications-system-QVM2JWKB.js +0 -1
  493. package/dist/os-FEHBQQKP.js +0 -1
  494. package/dist/out-53ABAVL7.js +0 -1
  495. package/dist/output-2LS5AOAH.js +0 -1
  496. package/dist/system-TMD2LYZM.js +0 -1
  497. package/dist/ui-FNPICAAH.js +0 -1
  498. package/dist/upgrade-YYPP5VZY.js +0 -1
  499. package/dist/version-OX3MORI6.js +0 -1
  500. package/dist/version-P7D5ME4Z.js +0 -1
  501. package/dist/workerd-TKVRZK2F.js +0 -18
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import{a as mt}from"./chunk-PIZDYS7T.js";import{a as pt,b as Er}from"./chunk-YT27FIQN.js";import"./chunk-TQ7URMGS.js";import"./chunk-HSYMUYEZ.js";import{a as Lr}from"./chunk-G7JW4UIM.js";import{a as An}from"./chunk-FK7GA4QQ.js";import{a as Hr}from"./chunk-N55MSO3X.js";import{a as un}from"./chunk-PP4VCR4Y.js";import{a as pn}from"./chunk-66YRAUWX.js";import{a as mn}from"./chunk-SNE4RHM4.js";import{a as dn}from"./chunk-K7D53KSJ.js";import{a as ln}from"./chunk-QAJZUJR5.js";import"./chunk-7SJHVJ3W.js";import"./chunk-Y62EMOQA.js";import"./chunk-7HNRK2CR.js";import"./chunk-KQFA5YTT.js";import{a as fn}from"./chunk-VNFUCH6T.js";import{a as hn}from"./chunk-O5FFMTJE.js";import{a as H,b as ie,c as an}from"./chunk-SQAS5RVZ.js";import{a as jr}from"./chunk-37BGAWAW.js";import{a as Mr}from"./chunk-XWQM2NZ2.js";import{a as cn}from"./chunk-2YVSZFXJ.js";import{a as $r}from"./chunk-IPZ6LUJV.js";import"./chunk-5BGUKF7L.js";import{a as Ur}from"./chunk-Q43LBSPT.js";import{a as zr}from"./chunk-GPRZYFDE.js";import"./chunk-C6IBY7NW.js";import{a as Br}from"./chunk-QPQS2YU3.js";import"./chunk-HB3MJYBK.js";import"./chunk-GSE6FXZU.js";import"./chunk-HJHS23Q3.js";import"./chunk-EO4YJFMY.js";import{a as tn}from"./chunk-6IMHGT7F.js";import{a as Ir,b as Tr,c as Qr}from"./chunk-CVFPY2SH.js";import{a as vn}from"./chunk-43URS56H.js";import{a as rn}from"./chunk-67EBF76X.js";import"./chunk-B3M3KIOU.js";import{a as kn}from"./chunk-GM4EFJJF.js";import{a as bn}from"./chunk-CQF5NDTJ.js";import{a as on}from"./chunk-ONF7XXEL.js";import{a as nn}from"./chunk-R74WHKHH.js";import{a as Jr}from"./chunk-BIWG3FQQ.js";import{a as Wr}from"./chunk-FO2R6KHG.js";import{a as Yr}from"./chunk-Z6X2GT6Q.js";import{a as wn}from"./chunk-YHCP326A.js";import{a as Kr}from"./chunk-MJZSSCGD.js";import{a as Xr}from"./chunk-6MC2BEW4.js";import"./chunk-YBSX53QP.js";import{a as Zr}from"./chunk-4IFY7V7W.js";import{a as en}from"./chunk-ZEE32UH6.js";import"./chunk-YYA5VGDW.js";import{a as Cr}from"./chunk-N5AZZYQA.js";import{a as Dr}from"./chunk-JYGZD4HM.js";import{a as Pr}from"./chunk-HLPAVELJ.js";import{a as sn}from"./chunk-ALK66U3O.js";import{a as Rr}from"./chunk-PHG4DASY.js";import"./chunk-RK2V6OIJ.js";import{a as ut,b as qr}from"./chunk-5JIJDUXX.js";import"./chunk-UOHNRH6E.js";import"./chunk-6A4H3HPY.js";import{a as va}from"./chunk-HQJ62PII.js";import"./chunk-LWU5TKNA.js";import"./chunk-HQY6JM6G.js";import"./chunk-HASIOUH2.js";import{a as Aa}from"./chunk-35WQTGN3.js";import"./chunk-VMNOSVPT.js";import"./chunk-DEF2G7S4.js";import"./chunk-HPM3HF7A.js";import"./chunk-UQ6ALA3Y.js";import"./chunk-4TFJ5RW7.js";import"./chunk-J6LQR2F6.js";import"./chunk-4ES7BJEK.js";import"./chunk-GZ7VGCVW.js";import"./chunk-WEPO4J2F.js";import"./chunk-A2VCTDKH.js";import"./chunk-UIC7K2HX.js";import"./chunk-4O7LK5RG.js";import"./chunk-RJSQMKKS.js";import"./chunk-R3KSOCMB.js";import"./chunk-J3JPJCWP.js";import"./chunk-VGBUN3CZ.js";import"./chunk-SZI6G247.js";import"./chunk-JLGA3B7P.js";import"./chunk-RSC5NQAT.js";import"./chunk-LYIXRMQJ.js";import"./chunk-I5PQZRYM.js";import"./chunk-VS7QVU3Z.js";import"./chunk-QO5RNGWA.js";import"./chunk-6HPUOCFF.js";import"./chunk-BOE2ST6J.js";import"./chunk-NT4A37HG.js";import"./chunk-YY6TFARF.js";import"./chunk-QUXQM3S3.js";import{b as ba}from"./chunk-XGKCPD6W.js";import"./chunk-3LHE4GIX.js";import{a as B,b as sr,c as Y,d as he,e as Se}from"./chunk-Y3PY5LP7.js";import"./chunk-7556AIVG.js";import"./chunk-FQL2WEKX.js";import"./chunk-ZTICX3AO.js";import"./chunk-FEQHCE2E.js";import"./chunk-PB5ZZET5.js";import"./chunk-4OCVXE5Y.js";import"./chunk-Q7BOSHWX.js";import"./chunk-7HWMURCW.js";import"./chunk-VE35YELD.js";import"./chunk-NCVGCVQ5.js";import"./chunk-GE4MLO3C.js";import"./chunk-TYMYIUIQ.js";import"./chunk-XSMCQLJW.js";import"./chunk-YPCXVZ2N.js";import"./chunk-UWHAOGO4.js";import"./chunk-ZI7LK3LW.js";import"./chunk-NYYXH2SX.js";import{a as yn}from"./chunk-PG4S5HJJ.js";import{a as Gr}from"./chunk-LJZTSQRD.js";import"./chunk-FKIVKNOV.js";import{a as nr}from"./chunk-J4J2YXH3.js";import{a as ir}from"./chunk-LOWSU4BB.js";import{a as ar}from"./chunk-TPHHQAUD.js";import"./chunk-AYIU6Z4C.js";import{a as Qo}from"./chunk-R7YJNDXW.js";import{a as _r}from"./chunk-TVCWDEVS.js";import"./chunk-GN66BRYF.js";import"./chunk-4TZCRMBJ.js";import{a as Fr}from"./chunk-YTR5JHNJ.js";import{a as Vr}from"./chunk-4O5GQ3DS.js";import{a as Nr}from"./chunk-DMNWSUKV.js";import"./chunk-7A3RW2VM.js";import{a as se,b as cr,c as ge,e as ye,f as Fe,g as ur,h as pr,i as mr,j as dr,k as lr,l as fr,m as ct,n as hr,o as Sr,p as gr,q as yr,r as wr,s as Zt}from"./chunk-BVB3DTNE.js";import"./chunk-EMH7OHCW.js";import"./chunk-PWS4VFSD.js";import"./chunk-IDKRJ2F4.js";import"./chunk-PO5T44H3.js";import{a as Xo}from"./chunk-6YDLNP4G.js";import{a as Wo}from"./chunk-AVMNIZAJ.js";import{a as Mo}from"./chunk-IGDVKRB4.js";import{a as Vo}from"./chunk-MW3IMZJ5.js";import"./chunk-ZEBMW5KS.js";import{a as Go}from"./chunk-S36VGP37.js";import"./chunk-RUHQNF2W.js";import"./chunk-VUMUCNI7.js";import{a as Jo}from"./chunk-WEXOA4C4.js";import"./chunk-2PDVBGQH.js";import{a as or}from"./chunk-LKXFHYLI.js";import{a as tr}from"./chunk-PVAZCZSY.js";import"./chunk-ENQXB532.js";import{a as Uo}from"./chunk-RXTLNUPF.js";import"./chunk-AMLCWRHU.js";import{a as qo}from"./chunk-J4NBPC57.js";import{a as Ho}from"./chunk-W4KE7AO6.js";import{a as Bo}from"./chunk-XNVOKAF2.js";import{a as rr}from"./chunk-CLD3NZYD.js";import{a as jo}from"./chunk-XNPUZRWP.js";import{a as Yo}from"./chunk-YHESTFMZ.js";import{a as Ko}from"./chunk-K3HUQLIC.js";import{a as Sn}from"./chunk-MMQZO2W2.js";import"./chunk-UNHT4ZFP.js";import"./chunk-LJIJEGND.js";import"./chunk-YLQ3LNNY.js";import"./chunk-VJEKDBGZ.js";import{a as J,b as kr,c as br,d as vr,f as Ne,h as eo,i as A,j as ce,k as to,l as oo,m as Ar,n as xr,o as Or}from"./chunk-Y743UVBS.js";import"./chunk-3G2ZQ2EF.js";import"./chunk-NCRWOW6F.js";import"./chunk-IWOTLFOY.js";import"./chunk-FFSDGRAN.js";import{e as ae}from"./chunk-WLWHCUPZ.js";import"./chunk-D3KFKT4D.js";import"./chunk-TFXUDHCP.js";import"./chunk-F3PZGSOY.js";import{a as gn}from"./chunk-UU6BRRYS.js";import"./chunk-45SZ5PSE.js";import{a as Ta}from"./chunk-KTD7VLHL.js";import{d as Ia}from"./chunk-MUM34KUM.js";import{a as Zo}from"./chunk-MW3JKGJH.js";import{a as $o}from"./chunk-LLPB6JN5.js";import{a as zo}from"./chunk-BQ3U3CQV.js";import{a as er,b as ka}from"./chunk-PFXNBHQQ.js";import{a as Lo,b as y,c as w,e as Ro,f as st}from"./chunk-NU5WLZ6Y.js";import"./chunk-MCNK5SJ6.js";import{c as dt,d as Oa}from"./chunk-OE3HSNSE.js";import{b as Q}from"./chunk-4ZNBEMRT.js";import"./chunk-LFOBYEWG.js";import{B as q,L as V,aa as le,b as wa,ba as oe,ga as Yt,ia as re,j as Vt,k as Wt,q as Qt,u as _}from"./chunk-3V4VL3SD.js";import"./chunk-ZDF5N422.js";import"./chunk-3C4WVKSO.js";import"./chunk-MPW2YJWU.js";import{e as Io}from"./chunk-QTLGMJDW.js";import{a as Ht}from"./chunk-XUUIBSLW.js";import"./chunk-5BTLE67Z.js";import"./chunk-T7KHS6RF.js";import{A as ne,B as W,F as _o,G as fe,I as z,K as Fo,M as nt,N as it,T as Co,V as at,Z as Po,a as Oo,y as I,z as T}from"./chunk-47IQIIFX.js";import"./chunk-7E4MJCVE.js";import"./chunk-73D5O7A3.js";import"./chunk-DYPZX7MW.js";import"./chunk-5HBIIYSK.js";import"./chunk-GB3YC4TI.js";import{b as xo,d as ot}from"./chunk-HILYTMVA.js";import"./chunk-YRHFPXC3.js";import{a as x}from"./chunk-7VAKNVFD.js";import"./chunk-RJ5VF3QY.js";import"./chunk-7UNQOKZW.js";import{d as To,e as Eo}from"./chunk-DSS4ECIH.js";import{i as c,k as No,l as G}from"./chunk-Q37WAD6F.js";import{a as we,b as xa}from"./chunk-4TF7ER72.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-636CTEW7.js";import"./chunk-Q2XLIWG4.js";import"./chunk-4JGWKUJN.js";import{Cb as u,Eb as m,Ib as g,Kb as P,Mb as Do,Nb as f,Ob as Kt,Pb as Xt,R as vo,Xa as _e,Z as Ao,b as s,ba as te,c as jt,d as Mt,fa as Gt,ka as Jt,qa as Te,ya as Ee}from"./chunk-UWI76E2L.js";import{i as rt}from"./chunk-B4OMIONW.js";import"./chunk-BOAGJ6P5.js";import"./chunk-LD6ZCTZ3.js";import"./chunk-JJZNUFPD.js";import"./chunk-UEBUGSBT.js";import{b as bo}from"./chunk-L4DFMMOI.js";import"./chunk-FOAV642V.js";import{b as j}from"./chunk-I3J63RFV.js";import"./chunk-JD5P5RAJ.js";import{e as M}from"./chunk-6IDEDOXW.js";import"./chunk-TR4OWSEX.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 ya=R(ka(),1);n();n();n();n();function ro(e){return sr(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 Ea=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"2-digit",year:"numeric"});function lt(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":Ea.format(t)}function ft(e){let t=H(e);if(t)return t.split(".")[0]}function xn(){let e=ro().map(t=>({subdomain:ft(t.store)??t.store,connected:lt(t.acquiredAt),store:t.store,userId:t.userId,scopes:t.scopes,acquiredAt:t.acquiredAt,...t.expiresAt?{expiresAt:t.expiresAt}:{},...t.refreshTokenExpiresAt?{refreshTokenExpiresAt:t.refreshTokenExpiresAt}:{},...t.associatedUser?{associatedUser:t.associatedUser}:{}}));return{sessions:e,...e.length===0?{message:_a()}:{}}}function _a(){return["No stores are authenticated directly with `shopify store auth`.","","Run `shopify store auth --store <domain> --scopes <scopes>` to authenticate a store.","Run `shopify store list` to list stores in a Shopify organization."].join(`
2
- `)}n();n();n();var ht=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:ht.optional()}),ke=x({name:"StoreAuthResult",schema:ue.omit({associatedUser:!0}).extend({hasRefreshToken:s.boolean(),associatedUser:ue.shape.associatedUser}),definitions:{StoreAuthAssociatedUser:ht}});var On=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.")}),St=x({name:"StoreAuthListResult",schema:s.object({sessions:s.array(On),message:s.string().optional()}),definitions:{StoreAuthListSession:On,StoreAuthAssociatedUser:ht}});function In(e,t){if(t==="json"){g(St.encode(e));return}Fa(e)}function Fa(e){if(e.sessions.length===0){P(e.message??"");return}fe({rows:e.sessions.map(({subdomain:t,connected:o})=>({subdomain:t,connected:o})),columns:{subdomain:{header:"Subdomain"},connected:{header:"Connected"}}})}var Ce=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 St}async run(){let{flags:t}=await this.parse(e),o=xn();In(o,t.json?"json":"text")}};n();n();n();var Tn=13387,gt="/auth/callback",no="/auth/handoff";function En(e){return`http://127.0.0.1:${e}${gt}`}function _n(e,t){return`http://127.0.0.1:${e}${no}?nonce=${encodeURIComponent(t)}`}function D(e){return e.length<=10?"***":`${e.slice(0,10)}***`}n();function Fn(e,t=300){return e.slice(0,t)}async function Nn(e){let t=`https://${e.store}/admin/oauth/access_token`;f(m`Exchanging authorization code for token at ${u.raw(t)}`);let o=await Vt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:B,code:e.code,code_verifier:e.codeVerifier,redirect_uri:e.redirectUri})}),r=await o.text();if(!o.ok)throw f(m`Token exchange failed with HTTP ${u.raw(String(o.status))}: ${u.raw(Fn(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(m`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 Cn(e){let t=`https://${e.store}/admin/oauth/access_token`;f(m`Refreshing access token for ${u.raw(e.store)} using refresh_token=${u.raw(D(e.refreshToken))}`);let o=await Vt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:B,grant_type:"refresh_token",refresh_token:e.refreshToken})}),r=await o.text();if(!o.ok)throw f(m`Token refresh failed with HTTP ${u.raw(String(o.status))}: ${u.raw(Fn(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 Na=`#graphql
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
3
3
  query CurrentAppInstallationAccessScopes {
4
4
  currentAppInstallation {
5
5
  accessScopes {
@@ -7,7 +7,7 @@ import{a as mt}from"./chunk-PIZDYS7T.js";import{a as pt,b as Er}from"./chunk-YT2
7
7
  }
8
8
  }
9
9
  }
10
- `;async function Pn(e){f(m`Fetching current app installation scopes for ${u.raw(e.store)} using token ${u.raw(D(e.accessToken))}`);let t=await oe({query:Na,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 io="<comma-separated-scopes>";function Dn(e,t){return{command:`shopify store auth --store ${e} --scopes ${t}`}}function Ca(e){return[[Dn(e,io)]]}function Ln(e,t,o){return[["Run",Dn(e,t),o]]}function Pa(e){return e.kind==="preview"?io:e.scopes.join(",")}function Rn(e){throw new c(`No stored app authentication found for ${e}.`,void 0,Ln(e,io,"to authenticate"))}function Pe(e,t){throw new c(e,void 0,Ln(t.store,Pa(t),"to re-authenticate"))}function yt(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.`;Pe(t,e)}function qn(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:`,Ca(e))}import{timingSafeEqual as Da}from"crypto";import{createServer as La}from"http";function Ra(e){let t=[e["sec-purpose"],e.purpose,e["x-moz"]].flat().join(" ");return t.includes("prefetch")||t.includes("prerender")}function $n(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 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>
11
11
  <html lang="en">
12
12
  <head>
13
13
  <meta charset="utf-8" />
@@ -76,14 +76,14 @@ import{a as mt}from"./chunk-PIZDYS7T.js";import{a as pt,b as Er}from"./chunk-YT2
76
76
  </main>
77
77
  </div>
78
78
  </body>
79
- </html>`}async function zn({store:e,state:t,port:o,timeoutMs:r=300*1e3,onListening:i,authorizationRedirect:a}){let p=_(e);return new Promise((d,l)=>{let S=!1,O=!1,h=!1,L=setTimeout(()=>{C(new c("Timed out waiting for OAuth callback."))},r),U=La((E,v)=>{let et=new URL(E.url??"/",`http://127.0.0.1:${o}`),ho=()=>{v.statusCode=404,v.setHeader("Cache-Control","no-store"),v.setHeader("Connection","close"),v.end("Not found")};if(et.pathname===no){let de=et.searchParams.get("nonce");if(!(a!==void 0&&!h&&E.method==="GET"&&de!==null&&Un(de,a.nonce))||Ra(E.headers)){ho();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(et.pathname!==gt){ho();return}let{searchParams:tt}=et,Ie=(de,wo)=>{let ko=typeof de=="string"?new c(de,wo):de;v.statusCode=400,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>C(ko)),v.end($n("Authentication failed",ko.message))},zt=tt.get("shop");if(f(m`Received OAuth callback for shop ${u.raw(zt??"unknown")}`),!zt){Ie("OAuth callback store does not match the requested store.");return}let So=_(zt);if(So!==p){Ie(qn(So));return}let go=tt.get("state");if(!go||!Un(go,t)){Ie("OAuth callback state does not match the original request.");return}let yo=tt.get("error");if(yo){Ie(`Shopify returned an OAuth error: ${yo}`);return}let Bt=tt.get("code");if(!Bt){Ie("OAuth callback did not include an authorization code.");return}f(m`Received authorization code ${u.raw(D(Bt))}`),v.statusCode=200,v.setHeader("Content-Type","text/html"),v.setHeader("Connection","close"),v.once("finish",()=>me(()=>d(Bt))),v.end($n("Authentication succeeded","Close this window and return to the terminal"))}),me=E=>{if(S)return;S=!0,clearTimeout(L);let v=()=>{E()};if(!O){v();return}U.close(()=>{O=!1,v()}),U.closeIdleConnections?.()},C=E=>{me(()=>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(m`PKCE callback server listening on http://127.0.0.1:${u.raw(String(o))}${u.raw(gt)}`),i&&Promise.resolve(i()).catch(E=>{C(E instanceof Error?E:new Error(String(E)))})})})}function Un(e,t){return e.length!==t.length?!1:Da(Buffer.from(e,"utf8"),Buffer.from(t,"utf8"))}n();import{createHash as qa,randomBytes as Bn}from"crypto";function $a(){return Bn(32).toString("base64url")}function Ua(e){return qa("sha256").update(e).digest("base64url")}function za(e){let t=new URLSearchParams;return t.set("client_id",B),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 Ba(e,t){let o=new URL(e);return o.searchParams.set("signup",t),{nonce:Bn(32).toString("base64url"),authorizationUrl:o.toString()}}function Hn(e){let{store:t,scopes:o,signup:r,exchangeCodeForToken:i}=e,a=Tn,p=ot(),d=En(a),l=$a(),S=Ua(l),O=za({store:t,scopes:o,state:p,redirectUri:d,codeChallenge:S}),h=r?Ba(O,r):void 0,L=h?_n(a,h.nonce):O;return f(m`Starting PKCE auth for ${u.raw(t)} with scopes ${u.raw(o.join(","))} (redirect_uri=${u.raw(d)})`),{authorization:{store:t,scopes:o,state:p,port:a,redirectUri:d,authorizationUrl:L,codeVerifier:l},waitForAuthCodeOptions:{store:t,state:p,port:a,authorizationRedirect:h},exchangeCodeForToken:U=>i({store:t,code:U,codeVerifier:l,redirectUri:d})}}n();function so(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 vo(t)}function ao(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 jn(e,t){let o=[...t],r=ao(t);for(let i of e)if(!r.has(i)){o.push(i);for(let a of ao([i]))r.add(a)}return o}function Mn(e,t){if(!e.scope)return f(m`Token response did not include scope; falling back to requested scopes`),t;let o=so(e.scope),r=ao(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 Ha=240*1e3;function ja(e){if(!e.expiresAt)return!1;let t=new Date(e.expiresAt).getTime();return Number.isNaN(t)?!0:t-Ha<Date.now()}function Ma(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||Rn(e),f(m`Loaded stored session for ${u.raw(e)}: token=${u.raw(D(t.accessToken))}, expires=${u.raw(t.expiresAt??"unknown")}`),!ja(t))return t;t.refreshToken||Pe(`No refresh token stored for ${t.store}.`,t),f(m`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 Cn(r)}catch(a){throw Se(t.store,t.userId),a instanceof c&&a.message.startsWith(`Token refresh failed for ${t.store} (HTTP `)&&Pe(a.message,t),a instanceof c&&a.message===`Token refresh returned an invalid response for ${t.store}.`&&Pe(a.message,t),a instanceof c&&a.message==="Received an invalid refresh response from Shopify.",a}return t=Ma(t,i),f(m`Token refresh succeeded for ${u.raw(t.store)}: ${u.raw(D(o))} → ${u.raw(D(t.accessToken))}, new expiry ${u.raw(t.expiresAt??"unknown")}`),he(t),t}function Gn(e,t=300){return e.slice(0,t)}function Ga(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 Gn(i?`HTTP ${o}: ${i}`:`HTTP ${o}`)}}return Gn(e instanceof Error?e.message:String(e))}async function Jn(e){let t=_(e),o=Y(t);if(!o)return{scopes:[],authoritative:!0};try{let r=await $(t),i=await Pn({store:r.store,accessToken:r.accessToken});return f(m`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(m`Falling back to locally stored scopes for ${u.raw(t)} after remote scope lookup failed: ${u.raw(Ga(r))}`),{scopes:o.scopes,authoritative:!1};throw r}}n();function Ja(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 Va(){P("Shopify CLI will open the app authorization page in your browser."),P("")}function Wa(e){return URL.canParse(e)?new URL(e).searchParams.has("signup"):!0}function Qa(e,t={}){return t.sensitive||Wa(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(m`${u.link(e)}`),P(""),!0)}function Ya(e,t="text"){if(t==="json"){g(ke.encode(e));return}let o=Ja(e);o.completed.forEach(r=>Do(r)),o.info.forEach(r=>P(r))}function be(e="text"){return{openingBrowser:Va,manualAuthUrl:Qa,success(t){Ya(t,e)}}}n();async function F(e,t,o){await Eo(()=>({store_fqdn:e})),await To(()=>({store_fqdn_hash:xo(e),store_fqdn_validated:t,store_domain:e,store_id:Ao(o)}))}var Ka={openURL:it,waitForStoreAuthCode:zn,exchangeStoreAuthCodeForToken:Nn,resolveExistingScopes:Jn,getCurrentStoredStoreAppSession:Y,presenter:be("text")};async function wt(e,t={}){let o={...Ka,...t},r=_(e.store);if(Xa(r,o),bo())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 F(r,!1);let i=so(e.scopes),a=await o.resolveExistingScopes(r),p=jn(i,a.scopes),d=a.authoritative?p:i;a.scopes.length>0&&f(m`Merged requested scopes ${u.raw(i.join(","))} with existing scopes ${u.raw(a.scopes.join(","))} for ${u.raw(r)}`);let l=Hn({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 F(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(),me=h.expires_in?new Date(U+h.expires_in*1e3).toISOString():void 0,C={store:r,userId:L,scopes:Mn(h,d),acquiredAt:new Date(U).toISOString(),expiresAt:me,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 he({store:r,clientId:B,userId:L,accessToken:h.access_token,refreshToken:h.refresh_token,scopes:C.scopes,acquiredAt:C.acquiredAt,expiresAt:me,refreshTokenExpiresAt:C.refreshTokenExpiresAt,associatedUser:C.associatedUser}),f(m`Session persisted for ${u.raw(r)} (user ${u.raw(L)}, expires ${u.raw(me??"unknown")})`),o.presenter.success(C),C}function Xa(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 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}.
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 N=R(j(),1),Za="Country must be a two-letter country code, for example: US.";function es(e){return/^[A-Z]{2}$/.test(e)}var kt=N.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(!es(t))throw new c(Za);return t}}),b={store:N.Flags.string({char:"s",description:"The myshopify.com domain of the store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>_(e),required:!0}),"organization-id":N.Flags.integer({description:"The numeric organization ID. Auto-selects if you belong to a single organization.",env:"SHOPIFY_FLAG_ORGANIZATION_ID"})},Vn={env:"SHOPIFY_FLAG_ID",parse:async e=>cr(e)},Wn=N.Flags.string({...Vn,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."}),Qn=N.Flags.string({...Vn,description:"The bulk operation ID to cancel (numeric ID or full GID).",required:!0}),Yn={query:N.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":N.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:N.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":N.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:N.Flags.boolean({description:"Wait for bulk operation results before exiting. Defaults to false.",env:"SHOPIFY_FLAG_WATCH"}),"output-file":N.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:N.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":N.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};var Kn=R(j(),1),De=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(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.
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:Kn.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0})};static get jsonOutputSchema(){return ke}async run(){let{flags:t}=await this.parse(e);await wt({store:t.store,scopes:t.scopes},{presenter:be(t.json?"json":"text")})}};n();n();async function Xn(e){let t=await fr(e);return{store:e.adminSession.storeFqdn,apiVersion:e.version??se,operation:t?.bulkOperation??null,userErrors:t?.userErrors??[]}}n();async function ve(e){let t=await $(e);return await F(t.store,!0),q(t.userId),{token:t.accessToken,storeFqdn:t.store}}n();n();var ri=s.string().regex(/^gid:\/\/shopify\/BulkOperation\/[^/]+$/).describe("The Shopify global ID of a bulk operation."),pe=s.object({gid:ri,type:s.string(),status:s.string(),errorCode:s.string().nullable(),createdAt:jt,completedAt:jt.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(),ni=pe.omit({type:!0}),bt=s.object({storeDomain:s.string().regex(/^[^.]+\.myshopify\.com$/).nullable(),apiVersion:s.string().nullable().describe("The API version selected for the request.")}).strict(),vt=x({name:"CancelBulkOperationResult",schema:bt.extend({status:s.literal("success"),operation:pe}),definitions:{BulkOperation:pe}}),Zn=bt.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.")}),ei=s.object({path:s.string().describe("The absolute path of the downloaded results file."),format:s.literal("jsonl")}).strict(),Le=x({name:"ExecuteBulkOperationResult",schema:s.union([Zn,ei]),definitions:{BulkOperation:pe,ExecuteBulkOperationResult:Zn,BulkOperationFile:ei}}),ti=bt.extend({operationGid:ri,operation:pe.nullable()}),oi=bt.extend({operations:s.array(ni),pageInfo:s.object({hasNextPage:s.boolean().nullable().describe("Unknown when the API result reaches the fetch limit.")}).strict()}),At=x({name:"BulkOperationStatusResult",schema:s.union([ti,oi]),definitions:{GetBulkOperationStatusResult:ti,ListBulkOperationsResult:oi,BulkOperation:pe,ListedBulkOperation:ni}});n();function K(e){let t=ie(e.store);return{storeDomain:t?`${t}.myshopify.com`:null,apiVersion:e.apiVersion??null}}function X(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:Mt(new Date(String(e.createdAt))),completedAt:e.completedAt?Mt(new Date(String(e.completedAt))):null,objectCount:String(e.objectCount),url:e.url??null,partialDataUrl:e.partialDataUrl??null}}function ii(e,t,o){if(o==="json"){if(e.userErrors.length||!e.operation){let i=new c("Failed to cancel bulk operation.");throw i.details={...K(e),operationGid:t,userErrors:e.userErrors},i}g(vt.encode({...K(e),status:"success",operation:X(e.operation)}));return}if(e.userErrors.length){hr(e.userErrors,"Failed to cancel bulk operation.");return}let r=e.operation;if(r){let i=Sr(r),a=r.status==="CANCELING"?[`This may take a few moments. Check the status with:
84
- `,{command:`shopify store bulk status --id=${ge(r.id)}`}]:i.body,p={headline:i.headline,...a&&{body:a},...i.customSections&&{customSections:i.customSections}};switch(i.renderType){case"success":T(p);break;case"warning":ne(p);break;case"info":I(p);break}}else W({headline:"Bulk operation not found or could not be canceled.",body:m`ID: ${u.yellow(t)}`.value})}n();n();function ai(e){let{storeFqdn:t,version:o}=e,r=[`Store: ${t}`];return o&&r.push(`API version: ${o}`),r}function si(e,t=!1){if(ye(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 Ae(e,t){let o=[...t.operationId?[`ID: ${t.operationId}`]:[],...ai(t)];I({headline:e,body:[{list:{items:o}}]})}var Re=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:Qn};static get jsonOutputSchema(){return vt}async run(){let{flags:t}=await this.parse(e),o=t.json?"json":"text",r=await ve(t.store);Ae("Canceling bulk operation.",{storeFqdn:r.storeFqdn,operationId:t.id});let i=await Xn({adminSession:r,operationId:t.id});ii(i,t.id,o)}};n();n();async function ts(e,t){if(e)return e.join(`
85
- `);if(t){if(!await _e(t))throw new c(m`Variable file not found at ${u.path(t)}. Please check the path and try again.`);return Te(t,{encoding:"utf8"})}else return}async function ci(e){let{store:t,query:o,variables:r,variableFile:i,watch:a=!1,version:p,allowMutations:d=!1}=e;si(o,d);let{adminSession:l,version:S}=await z({title:m`Authenticating`,task:async()=>{let h=await ve(t),L=await Fe({adminSession:h,userSpecifiedVersion:p,minimumDefaultVersion:se});return{adminSession:h,version:L}},renderOptions:{stdout:process.stderr}}),O=await ts(r,i);return os(o,O),{adminSession:l,version:S,query:o,variablesJsonl:O,watch:a}}async function ui(e){let{adminSession:t,version:o,query:r,variablesJsonl:i,watch:a}=e,p=ye(r)?await mr({adminSession:t,query:r,variablesJsonl:i,version:o}):await pr({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 d=new Oo,l=a?await yr(t,p.bulkOperation.id,d.signal,()=>d.abort()):await gr(t,p.bulkOperation.id),S=a&&!d.signal.aborted&&l.status==="COMPLETED"&&l.url?await wr(l.url):void 0;return{store:t.storeFqdn,apiVersion:o,operation:l,userErrors:[],watchAborted:d.signal.aborted,results:S}}function os(e,t){if(ye(e)&&!t)throw new c(m`Bulk mutations require variables. Provide a JSONL file with ${u.yellow("--variable-file")} or individual JSON objects with ${u.yellow("--variables")}.`);if(!ye(e)&&t)throw new c(m`The ${u.yellow("--variables")} and ${u.yellow("--variable-file")} flags can only be used with mutations, not queries.`)}n();async function pi(e,t){let{format:o,watch:r,outputFile:i}=t,{operation:a,userErrors:p,watchAborted:d,results:l}=e;if(!a&&p.length===0)throw ne({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={...K(e),operation:a?X(a):null,userErrors:p},h}if(!a)throw new G("Bulk operation response returned no operation.");let S=l!==void 0&&Zt(l),O=S?"partial":"success";if(d&&(O="cancelled"),S&&(process.exitCode=1),i&&l===void 0&&!d)throw new c("No results are available to write to the output file.");if(i&&l!==void 0){let h=M(i);await Ee(h,l),g(Le.encode({path:h,format:"jsonl"}))}else g(Le.encode({...K(e),status:O,...d?{reason:"watch-aborted"}:{},operation:X(a),...l===void 0?{}:{resultsJsonl:l}}));return}if(i&&l!==void 0&&await Ee(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&&(d?I({headline:`Bulk operation ${a.id} is still running in the background.`,body:xt(a.id)}):r||["FAILED","CANCELED","EXPIRED"].includes(a.status)?rs(a,l,i):T({headline:"Bulk operation is running.",body:xt(a.id),customSections:[{body:[{list:{items:[m`ID: ${u.cyan(a.id)}`.value]}}]}]}))}function rs(e,t,o){let r=ct(e).value,a=[{body:[{list:{items:[m`ID: ${u.cyan(e.id)}`.value,m`Status: ${u.yellow(e.status)}`.value,m`Created at: ${u.gray(String(e.createdAt))}`.value,...e.completedAt?[m`Completed at: ${u.gray(String(e.completedAt))}`.value]:[]]}}]}];switch(e.status){case"CREATED":T({headline:"Bulk operation started.",body:xt(e.id),customSections:a});break;case"RUNNING":T({headline:"Bulk operation is running.",body:xt(e.id),customSections:a});break;case"COMPLETED":if(t===void 0)T({headline:r,customSections:a});else{let p=Zt(t);o||g(t),p?ne({headline:"Bulk operation completed with errors.",body:o?`Results written to ${o}. Check file for error details.`:"Check results for error details.",customSections:a}):T({headline:r,body:o?[`Results written to ${o}`]:void 0,customSections:a})}break;case"CANCELED":case"CANCELING":case"EXPIRED":case"FAILED":W({headline:r,customSections:a});break}}function xt(e){return[`Monitor its progress with:
86
- `,{command:`shopify store bulk status --id=${ge(e)}`}]}var qe=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.
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:
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.
89
89
 
@@ -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,...Yn};static get jsonOutputSchema(){return Le}async run(){let{flags:t}=await this.parse(e),o=await ur({query:t.query,queryFile:t["query-file"]}),r=await ci({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";Ae("Starting bulk operation.",{storeFqdn:r.adminSession.storeFqdn,version:r.version});let a=await ui(r);await pi(a,{format:i,watch:r.watch,outputFile:t["output-file"]})}};n();n();async function mi(e){let t=await Fe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await dr({...e,version:t});return{store:e.adminSession.storeFqdn,apiVersion:t,operationId:e.operationId,operation:o??null}}async function di(e){let t=await Fe({adminSession:e.adminSession,minimumDefaultVersion:se}),o=await lr({...e,version:t,first:100});return{store:e.adminSession.storeFqdn,apiVersion:t,operations:o}}n();function li(e,t){if(t==="json"){g(At.encode({...K(e),..."operation"in e?{operationGid:e.operationId,operation:e.operation?X(e.operation):null}:{operations:e.operations.map(X),pageInfo:{hasNextPage:e.operations.length<100?!1:null}}}));return}if("operation"in e){e.operation?ns(e.operation):W({headline:"Bulk operation not found.",body:m`ID: ${u.yellow(e.operationId)}`.value});return}let o=e.operations.map(r=>({id:ge(r.id),status:as(r.status),count:ss(r.objectCount),dateCreated:Gt(new Date(String(r.createdAt))),dateFinished:r.completedAt?Gt(new Date(String(r.completedAt))):"",results:cs(r.url??r.partialDataUrl)}));Xt(),o.length===0?I({body:"No bulk operations found in the last 7 days."}):fe({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"}}}),Xt()}function ns(e){let{id:t,status:o,createdAt:r,completedAt:i,url:a,partialDataUrl:p}=e,d=ct(e).value,l=is(r,i),S=m`ID: ${u.yellow(t)}\n${l}`.value;if(o==="COMPLETED"){let O=a?u.link("Download results",a):"";T({headline:d,body:m`${S}\n${O}`.value})}else if(o==="FAILED"){let O=p?u.link("Download partial results",p):"";W({headline:d,body:m`${S}\n${O}`.value})}else I({headline:d,body:S})}function is(e,t){let o=new Date;return t?`Finished ${Jt(new Date(String(t)),o)}`:`Started ${Jt(new Date(String(e)),o)}`}function as(e){return e==="COMPLETED"?rt.green(e):e==="FAILED"?rt.red(e):rt.dim(e)}function ss(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function cs(e){return e?m`${u.link("download",e)}`.value:""}var $e=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:Wn};static get jsonOutputSchema(){return At}async run(){let{flags:t}=await this.parse(e),o=t.json?"json":"text",r=await ve(t.store);Ae(t.id?"Checking bulk operation status.":"Listing bulk operations.",{storeFqdn:r.storeFqdn});let i=t.id?await mi({adminSession:r,operationId:t.id}):await di({adminSession:r});li(i,o)}};n();var co=R(j(),1),Ue=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:co.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0}),signup:co.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 ke}async run(){let{flags:t}=await this.parse(e),o=ps(t.signup)??await ms();await wt({store:t.store,scopes:t.scopes,signup:o},{presenter:be(t.json?"json":"text")})}},us=8*1024,fi="Missing signup JWT.",hi="Pass --signup <jwt>, set SHOPIFY_FLAG_SIGNUP, or pipe the JWT to stdin.";function ps(e){let t=e?.trim();return t===""?void 0:t}async function ms(e=process.stdin){if(e===process.stdin&&!Po())throw new c(fi,hi);let t=[],o=0;for await(let i of e){let a=Buffer.isBuffer(i)?i:Buffer.from(i);if(o+=a.length,o>us)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(fi,hi);return r}n();n();n();var xe=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 uo=x({name:"CreateDevStoreResult",schema:s.union([to.schema,xe]),definitions:{...to.definitions,StoreCommandError:xe}});n();var Si={basic:"basic",professional:"grow",grow:"grow",unlimited:"advanced",advanced:"advanced",shopify_plus:"plus",plus:"plus"};n();var gi=Ar,yi=xr,wi=Or;var ze=R(j(),1),Be=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:st(ze.Flags.string({description:"Name for the new dev store.",env:"SHOPIFY_FLAG_STORE_NAME"})),"organization-id":st(b["organization-id"]),plan:st(ze.Flags.string({description:"The Shopify plan to use for the new dev store.",options:eo,env:"SHOPIFY_FLAG_STORE_PLAN"})),"feature-preview":ze.Flags.string({description:"The handle of a feature preview to enable on the new dev store.",env:"SHOPIFY_FLAG_STORE_FEATURE_PREVIEW"}),"demo-data":ze.Flags.boolean({description:"Populate the new dev store with demo data.",allowNo:!0,env:"SHOPIFY_FLAG_STORE_DEMO_DATA"}),country:kt};static get jsonOutputSchema(){return uo}async run(){let{flags:t}=await this.parse(e),o=await Ne(t["organization-id"]?.toString()),r=t.name??await gi(),i=t.plan??await yi(),a=t["demo-data"]??(at()?await wi():!1);try{await oo({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(uo.encode({error:!0,message:p.message,nextSteps:p.nextSteps??[],exitCode:1})),process.exit(1)),p}}};n();n();n();var ds="X-Shopify-CLI-Instance",ls="X-Shopify-CLI-Version",ki;function fs(){return ki??=new Io({projectName:"shopify-cli-store"}),ki}var He=class extends c{status;constructor(t,o,r){super(o,r??null),this.status=t}};function bi(e=fs()){let t=e.get("cliInstanceId");if(typeof t=="string"&&t.length>0)return t;let o=ot();return e.set("cliInstanceId",o),o}function vi(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":`Shopify CLI; v=${Ht}`,[ds]:e,[ls]:Ht}}function hs(e){return vi(e)}function Ss(e,t){return{...vi(e),authorization:t,"X-Shopify-Access-Token":t}}async function Ai(e,t={}){let r=`https://${await Qt()}/services/preview-stores`,i=JSON.stringify({...e.name?{name:e.name}:{},...e.country?{variables:{storeCreatePayload:{country:e.country}}}:{}}),a=await Wt(r,{method:"POST",headers:hs(bi(t.storage)),body:i}),p=await a.text();if(!a.ok){let l=gs(a.status,p);throw new c(l.message,l.tryMessage)}let d;try{d=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): ${Ot(p).slice(0,500)}`)}return ws(d)}async function xi(e,t={}){let r=`https://${await Qt()}/services/preview-stores/${e.shopId}`,i=await Wt(r,{method:"GET",headers:Ss(bi(t.storage),e.adminApiToken)}),a=await i.text();if(!i.ok){let d=ys(i.status,a);throw new He(i.status,d.message,d.tryMessage)}let p;try{p=JSON.parse(a)}catch(d){let l=d instanceof Error?d.message:"Unknown error";throw new c("Preview store lookup returned a non-JSON response.",`Parse error: ${l}. Body (truncated): ${Ot(a).slice(0,500)}`)}return ks(p)}function gs(e,t){let o=Oi(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=Ot(t);return{message:`Preview store creation failed with HTTP ${e}.`,tryMessage:i??(a.length>0?a.slice(0,1e3):"No response body returned.")}}function Oi(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 ys(e,t){let o=Oi(t),r=Ot(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 ws(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,d=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(bs(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},adminApiToken:a,adminApiScopes:l,accessUrl:p,...d?{placeholderAccountUuid:d}:{}}}function ks(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(vs(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},accessUrl:a,...p?{claimUrl:p}:{}}}function bs(e){return{...e,...e.admin_api_token?{admin_api_token:"[REDACTED]"}:{},...e.access_url?{access_url:"[REDACTED]"}:{}}}function Ot(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 vs(e){return{...e,...e.access_url?{access_url:"[REDACTED]"}:{},...e.claim_url?{claim_url:"[REDACTED]"}:{}}}var As={createPreviewStore:Ai,setStoredStoreAppSession:he,recordStoreFqdnMetadata:F,setLastSeenUserId:q,now:()=>new Date};async function Ii(e,t={}){let o={...As,...t},r=await o.createPreviewStore({name:e.name,country:e.country},e.client);return Os(r,e.country,o)}function xs(e){return e.placeholderAccountUuid??e.shop.id}async function Os(e,t,o){let r=o.now().toISOString(),i=xs(e);o.setStoredStoreAppSession({store:e.shop.domain,clientId:B,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:Is(e.shop.domain)}}function Is(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 Ti=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.")}),It=x({name:"CreatePreviewStoreResult",schema:s.object({status:s.literal("success"),message:s.string(),store:Ti,next_steps:s.array(s.string())}),definitions:{PreviewStore:Ti}});function Ei(e,t){if(t==="json"){g(It.encode(e));return}Es(e)}function Ts(e){return e.split(/(`[^`]+`)/).map(t=>t.startsWith("`")&&t.endsWith("`")?{command:t.slice(1,-1)}:t)}function Es(e){T({headline:"Store created",customSections:[{body:e.message},{title:"Next steps",body:{list:{items:e.next_steps.map(Ts)}}}]})}var _i=R(j(),1),je=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:_i.Flags.string({description:"The name of the store.",env:"SHOPIFY_FLAG_PREVIEW_STORE_NAME",required:!1}),country:kt};static get jsonOutputSchema(){return It}async run(){let{flags:t}=await this.parse(e),o=await z({title:m`Creating store`,task:async()=>Ii({name:t.name,country:t.country})});Ei(o,t.json?"json":"text")}};n();n();var Fi=s.object({domain:A.shape.subdomain,deletionRequested:s.literal(!0),deletionConfirmed:s.boolean()}),Me=x({name:"DeleteDevStoreResult",schema:s.union([s.object({store:Fi,organization:ce,message:s.string().optional()}),xe]),definitions:{DeletedStore:Fi,StoreOrganization:ce,StoreCommandError:xe}});n();n();n();n();var Ni={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 Ci(e){let t=await po(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 po(e){let t=e.token??await V([],{noPrompt:e.noPrompt}),o=J({noPrompt:e.noPrompt}),i=(await re({query:Ni,token:t,organizationId:e.organizationId,variables:{search:e.store},unauthorizedHandler:o})).organization?.accessibleShops?.edges??[],a=e.store.toLowerCase(),p=i.find(d=>H(d.node.primaryDomain)===a)?.node;if(p)return{shopifyShopId:p.shopifyShopId??void 0,name:p.name,primaryDomain:p.primaryDomain??void 0,storeType:p.storeType??void 0,developerPreviewHandle:p.developerPreviewHandle??void 0,planName:p.planName??void 0,ownerName:p.ownerDetails?.fullName??void 0,ownerEmail:p.ownerDetails?.email??void 0}}n();var Pi={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 Di={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"OrganizationAccessibleShop"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"id"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"ShopifyShopID"}}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"organization"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"accessibleShop"},arguments:[{kind:"Argument",name:{kind:"Name",value:"id"},value:{kind:"Variable",name:{kind:"Name",value:"id"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shopifyShopId"}},{kind:"Field",name:{kind:"Name",value:"planName"}},{kind:"Field",name:{kind:"Name",value:"storeType"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var _s="cancelled",Fs=5,Ns=300*1e3;async function Ri(e){let{organization:t,store:o}=e,r=await V(),i=J(),a=await Li({store:o,organizationId:t.id,token:r}),d=(await re({query:Pi,token:r,organizationId:t.id,variables:{storeFqdn:o},unauthorizedHandler:i})).deleteAppDevelopmentStore;if(!d)throw new c("Store deletion failed: unexpected empty response.");let l=d.userErrors;if(l&&l.length>0){let O=l.map(h=>h.message).join(", ");throw new c(`Failed to delete dev store: ${O}`)}if(d.success===!1)throw new c("Store deletion failed.");a??=await Li({store:o,organizationId:t.id,token:r});let S=a?await Ps({shopifyShopId:a,organizationId:t.id,token:r,unauthorizedHandler:i}):!1;e.json?g(Ls({store:o,organization:t,deletionConfirmed:S})):S?T({headline:`Dev store "${o}" deleted successfully.`,body:["The store was deleted."]}):ne({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 Li(e){return(await po(e))?.shopifyShopId}function Cs(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 Ps(e){let t=Cs(e.shopifyShopId);return z({title:m`Dev store deletion requested. Waiting for deletion confirmation`,task:async o=>{let r=Date.now();for(;;){if(Date.now()-r>Ns)return!1;if((await re({query:Di,token:e.token,organizationId:e.organizationId,variables:{id:t},unauthorizedHandler:e.unauthorizedHandler})).organization?.accessibleShop?.planName?.toLowerCase()===_s.toLowerCase())return!0;o(m`${Ds()}`),await Co(Fs)}},renderOptions:{stdout:process.stderr}})}function Ds(){return"Waiting for deletion confirmation"}function Ls(e){let{store:t,organization:o,deletionConfirmed:r}=e;return Me.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 qi={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 $i={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 Ge=class extends c{};async function Tt(e){let t=e.token??await V([],{noPrompt:e.noPrompt}),o=J({noPrompt:e.noPrompt}),r=H(e.store)??e.store.toLowerCase(),i=r.split(".")[0]??r,d=((await Yt({query:qi,token:t,variables:{search:i},unauthorizedHandler:o})).currentUserAccount?.destinations.nodes??[]).find(S=>qs(S,r));if(!d)throw new Ge(`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 Rs(String(d.publicId),t,o);return{...l?{owningOrg:l}:{}}}async function Rs(e,t,o){try{let i=(await Yt({query:$i,token:t,variables:{destinationPublicId:e},unauthorizedHandler:o})).currentUserAccount?.organizationForDestination;if(!i){f(`No owning organization returned for destination ${e}.`);return}let a=i.id?kr(i.id):void 0;return{name:i.name,...a?{id:a}:{}}}catch(r){f(`Failed to resolve owning organization: ${$s(r)}`);return}}function qs(e,t){return[e.primaryDomain,e.webUrl].some(o=>H(o)===t)}function $s(e){return e instanceof Error?e.message:String(e)}async function Us(e){let{store:t}=e;try{let r=(await Tt(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}: ${zs(o)}`);return}}function zs(e){return e instanceof Error?e.message:String(e)}async function Ui(e,t){if(t)return Ne(t);let o=at(),r=await Us({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 I({headline:`Could not determine which organization owns ${e}.`,body:["Select one below, or specify it with",{command:"--organization-id"},{char:"."}]}),Ne()}var zi=R(j(),1),Je=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:zi.Flags.boolean({char:"f",description:"Skip confirmation. Required if non interactive.",env:"SHOPIFY_FLAG_FORCE",default:!1})};static get jsonOutputSchema(){return Me}async run(){let{flags:t}=await this.parse(e);try{if(!t.force&&!nt())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 Ui(t.store,t["organization-id"]?.toString());if(!t.force&&!await Fo({message:`Delete dev store ${t.store}? This can't be undone.`,confirmation:t.store}))throw new No;await Ri({store:t.store,organization:o,json:t.json})}catch(o){throw t.json&&o instanceof c&&(g(Me.encode({error:!0,message:o.message,nextSteps:o.nextSteps??[],exitCode:1})),process.exit(1)),o}}};n();n();n();var Hi=R(wa(),1);async function Bs(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 _e(e.queryFile))throw new c(m`Query file not found at ${u.path(e.queryFile)}. Please check the path and try again.`);let t=await Te(e.queryFile,{encoding:"utf8"});if(!t.trim())throw new c(m`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 Bi(e,t){if(e===null||typeof e!="object"||Array.isArray(e))throw new c(m`Invalid variables in ${t}: expected a non-null JSON object.`,"Please provide a JSON object for variables.");return e}async function Hs(e,t){if(e!==void 0){if(!e.trim())throw new c(m`The ${u.yellow("--variables")} flag value is empty.`,"Please provide a non-null JSON object for variables.");try{return Bi(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(m`Invalid JSON in ${u.yellow("--variables")} flag: ${r}`,"Please provide valid JSON format.")}}else if(t){if(!await _e(t))throw new c(m`Variable file not found at ${u.path(t)}. Please check the path and try again.`);let o=await Te(t,{encoding:"utf8"});try{return Bi(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(m`Invalid JSON in variable file ${u.path(t)}: ${i}`,"Please provide valid JSON format.")}}}function js(e){let t;try{t=(0,Hi.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 Ms(e){return e.operationDefinition.operation==="mutation"}function Gs(e,t=!1){if(Ms(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 ji(e){let t=await Bs({query:e.query,queryFile:e.queryFile}),o=js(t);Gs(o,e.allowMutations);let r=await Hs(e.variables,e.variableFile);return{query:t,parsedOperation:o,parsedVariables:r,requestedVersion:e.version}}n();n();n();n();function Et(e){if(!e||typeof e!="object"||!("response"in e))return!1;let t=e.response;return!!t&&typeof t=="object"}function Mi(e){if(!Et(e))return;let t=e.response.status;return typeof t=="number"?t:void 0}var Gi=["the user aborted a request","the operation was aborted"];function Js(e){if(!(e instanceof Error))return!1;if(e.name==="AbortError")return!0;let t=e.message.toLowerCase();return Gi.some(o=>t.includes(o))}function Ve(e,t){if(Mi(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(Js(e))return new c(`Request to ${t} was aborted before it completed.`)}function We(e,t){let o=Mi(e);o!==401&&o!==404||(Se(t.store,t.userId),yt(t))}var Vs=`
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=`
95
95
  query StoreExecutePublicApiVersions {
96
96
  publicApiVersions {
97
97
  handle
98
98
  supported
99
99
  }
100
100
  }
101
- `;async function Ji(e){try{return(await oe({query:Vs,api:"Admin",url:ae(e.adminSession.storeFqdn,"unstable",e.adminSession),token:e.adminSession.token,responseOptions:{handleErrors:!1}})).publicApiVersions}catch(t){We(t,e.session);let o=Ve(t,e.adminSession.storeFqdn);throw o||(Et(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 Vi(e){try{return await z({title:m`Executing GraphQL operation`,task:async()=>oe({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}}),renderOptions:{stdout:process.stderr}})}catch(t){We(t,e.context.session);let o=Ve(t,e.context.adminSession.storeFqdn);if(o)throw o;if(Et(t)&&t.response.errors){let r={errors:t.response.errors},i=new c("GraphQL operation failed.",JSON.stringify(r,null,2));throw i.details=r,i}throw t}}n();async function mo(e){let t=await $(_(e));return await F(t.store,!0),q(t.userId),{adminSession:{token:t.accessToken,storeFqdn:t.store},session:t}}async function Ws(e){let{session:t,adminSession:o,userSpecifiedVersion:r}=e;if(r==="unstable")return r;let i=await Ji({adminSession:o,session:t});if(!r)return i.filter(d=>d.supported).map(d=>d.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 Wi(e){let{adminSession:t,session:o}=await mo(e.store),r=await Ws({session:o,adminSession:t,userSpecifiedVersion:e.userSpecifiedVersion});return{adminSession:t,version:r,session:o}}var Qs={id:"admin",prepareContext:async({store:e,requestedVersion:t})=>Wi({store:e,userSpecifiedVersion:t}),execute:async({context:e,request:t})=>Vi({context:e,request:t})};function Qi(e){if(e==="admin")return Qs;throw new G(`Unsupported store GraphQL API target: ${e}`)}async function Yi(e){await F(e.store,!1);let t=Qi(e.api??"admin"),o=await ji({query:e.query,queryFile:e.queryFile,variables:e.variables,variableFile:e.variableFile,version:e.version,allowMutations:e.allowMutations}),r=await z({title:m`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();n();var _t=x({name:"StoreExecuteResult",schema:s.record(s.unknown()).nullable()});function Ki(e){if(e){T({headline:"Operation succeeded.",body:`Results written to ${e}`});return}T({headline:"Operation succeeded."})}async function Xi(e,t,o="text"){let r=_t.encode(e);if(t){await Ee(t,r),o==="text"&&Ki(t);return}o==="text"&&Ki(),g(r)}var Z=R(j(),1),Qe=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:Z.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":Z.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:Z.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":Z.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:Z.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":Z.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":Z.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};static get jsonOutputSchema(){return _t}async run(){let{flags:t}=await this.parse(e),o=await Yi({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 Xi(o,t["output-file"],t.json?"json":"text")}};n();n();async function Zi(e){let t=Ys(e.store),o=Ir();await Tr({port:e.port,storeFqdn:e.store,tokenProvider:t,key:o,protectMutations:!e.allowMutations,query:e.query,variables:e.variables,apiVersion:e.apiVersion,additionalReadyMessages:[m`Mutations are ${e.allowMutations?u.green("allowed"):u.yellow("blocked")}.`],abortSignal:e.abortSignal})}function Ys(e){return{getToken:async()=>(await $(e)).accessToken,refreshToken:async()=>(await $(e)).accessToken}}var Ft=R(j(),1),Ye=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:Ro({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 Zi({store:t.store,port:t.port,allowMutations:t["allow-mutations"],variables:t.variables,apiVersion:t.version})}};n();n();n();function Nt(e){if(e)return Si[e.toLowerCase()]}function ea(e){return e?te(e):""}n();var Ks={APP_DEVELOPMENT:"dev",CLIENT_TRANSFER:"client-transfer",COLLABORATOR:"collaborator",DEVELOPMENT:"dev",DEVELOPMENT_SUPERSET:"dev",PRODUCTION:"production"};function Ct(e){if(e)return Ks[e]}function ta(e){return e?te(e):""}var oa={dev:"development_superset",production:"production","client-transfer":"client_transfer",collaborator:"collaborator"},Pt=Object.keys(oa);function ra(e){return oa[e]}var Xs=`#graphql
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
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 Dt(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=Y(t);if(oc(o)){await F(o.store,!0,o.preview.shopId),q(o.userId);let i=await rc(o);return pc({store:t,previewSession:o,previewStoreUrls:i})}let r=!!o;try{return await ec(t,{noPrompt:r})}catch(i){if(!r||!ic(i))throw i;return f(`BP store info lookup failed; falling back to stored store auth: ${sc(i)}`),Zs(t)}}async function Zs(e){let t=await $(e);await F(t.store,!0),q(t.userId);let o=await tc(t);return{...cc({store:t.store,shop:o}),authScopes:t.scopes}}async function ec(e,t={}){let o=await Tt({store:e,noPrompt:t.noPrompt}),r=await nc(o,e,{noPrompt:t.noPrompt});return uc({store:e,destinationsCtx:o,orgShop:r})}async function tc(e){try{let t=await oe({query:Xs,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){We(t,e);let o=Ve(t,e.store);throw o||t}}function oc(e){return e?.kind==="preview"&&e.preview!==void 0}async function rc(e){try{let t=await xi({shopId:e.preview.shopId,adminApiToken:e.accessToken});return{accessUrl:t.accessUrl,...t.claimUrl?{saveUrl:t.claimUrl}:{}}}catch(t){throw t instanceof He&&(t.status===401||t.status===404)&&(Se(e.store,e.userId),yt(e)),t}}async function nc(e,t,o={}){if(!e.owningOrg?.id){f("Owning organization id is unknown; skipping BP Organizations shop lookup.");return}try{return await Ci({store:t,organizationId:e.owningOrg.id,noPrompt:o.noPrompt})}catch(r){f(`BP Organizations shop lookup failed: ${r instanceof Error?r.message:String(r)}`);return}}function ic(e){return e instanceof Ge||ac(e)}function ac(e){return e instanceof c&&e.message.includes("unable to prompt for reauthentication")}function sc(e){return e instanceof Error?e.message:String(e)}function cc(e){let{store:t,shop:o}=e,r=o.myshopifyDomain??t,i={id:o.id,displayName:o.name,storeOwner:mc(o),type:o.plan?.partnerDevelopment?"dev":void 0,plan:o.plan?.publicDisplayName,adminUrl:ia(ie(r))};return{...le(i),subdomain:r}}function uc(e){let{store:t,destinationsCtx:o,orgShop:r}=e,i={id:na(r?.shopifyShopId),displayName:r?.name,organizationId:o.owningOrg?.id,organizationName:o.owningOrg?.name,storeOwner:dc(r),type:Ct(r?.storeType),plan:Nt(r?.planName),featurePreview:r?.developerPreviewHandle,adminUrl:ia(ie(t))};return{...le(i),subdomain:t}}function pc(e){let{store:t,previewSession:o,previewStoreUrls:r}=e,i={id:na(o.preview.shopId),displayName:o.preview.name,type:"preview",country:o.preview.country,accessUrl:r.accessUrl,saveUrl:r.saveUrl};return{...le(i),subdomain:t,authScopes:o.scopes}}function na(e){if(e)return`gid://shopify/Shop/${e}`}function mc(e){let t=le({name:e.shopOwnerName,email:e.email});return Object.keys(t).length>0?t:void 0}function dc(e){if(!e)return;let t=le({name:e.ownerName,email:e.ownerEmail});return Object.keys(t).length>0?t:void 0}function ia(e){if(e)return`https://admin.shopify.com/store/${encodeURIComponent(e)}`}n();n();var aa=s.object({name:s.string().optional(),email:s.string().optional()}),Lt=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:aa.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:aa}});function sa(e,t){if(t==="json"){g(Lt.encode(e));return}let o=fc(e);I({customSections:[{title:"Store details",body:{tabularData:lc(e),firstColumnSubdued:!0}},...o.length>0?[{body:{list:{title:{bold:"Next steps"},items:o}}}]:[]]})}function lc(e){let t=[];return ee(t,"ID",e.id),ee(t,"Display Name",e.displayName),ee(t,"Subdomain",e.subdomain),ee(t,"Organization",e.organizationName),ee(t,"Store owner",hc(e.storeOwner)),ee(t,"Type",e.type?te(e.type):void 0),ee(t,"Plan",e.plan?te(e.plan):void 0),ee(t,"Feature Preview",e.featurePreview),t}function fc(e){let t=[];return lo(t,e.adminUrl,"Manage this store in the Shopify admin"),lo(t,e.accessUrl,"View your store"),lo(t,e.saveUrl,"Save your store"),t}function hc(e){if(e)return e.name&&e.email?`${e.name} (${e.email})`:e.name??e.email}function ee(e,t,o){o&&e.push([t,o])}function lo(e,t,o){t&&e.push({link:{label:o,url:t}})}var Ke=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 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.
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 Lt}async run(){let{flags:t}=await this.parse(e),o=await Dt({store:t.store});sa(o,t.json?"json":"text")}};n();n();n();n();n();var ca={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 ua(e){let{entries:t,hasMore:o}=await Sc(e.token,e.organization,e.storeType);return{entries:t.sort(wc),hasMore:o}}async function Sc(e,t,o){let r=J(),a=(await re({query:ca,token:e,organizationId:t.id,variables:{first:250,filters:gc(o)},unauthorizedHandler:r})).organization?.accessibleShops;if(!a)return{entries:[],hasMore:!1};let p=[];for(let d of a.edges){let l=yc(d.node,t);l&&p.push(l)}return{entries:p,hasMore:a.pageInfo.hasNextPage}}function gc(e){let t=[{field:"STORE_STATUS",operator:"EQUALS",value:"active"}];return e&&t.push({field:"STORE_TYPE",operator:"EQUALS",value:ra(e)}),t}function yc(e,t){let o=e.url??e.primaryDomain;if(o)return{...e.shopifyShopId?{id:`gid://shopify/Shop/${e.shopifyShopId}`}:{},store:H(o)??o,...e.primaryDomain?{primaryDomain:H(e.primaryDomain)??e.primaryDomain}:{},createdAt:typeof e.createdAt=="string"?e.createdAt:String(e.createdAt),organizationId:t.id,organizationName:t.businessName,name:e.name,type:Ct(e.storeType),plan:Nt(e.planName)}}function wc(e,t){return e.createdAt===t.createdAt?e.store.localeCompare(t.store):t.createdAt.localeCompare(e.createdAt)}async function ma(e={}){let t=await V();if(e.organizationId){let i=await vr(e.organizationId.toString(),t);if(i)return pa(t,i,e.storeType)}let o=await br(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&&!nt())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 kc(o.organizations,e.organizationId);return pa(t,r,e.storeType)}async function pa(e,t,o){let r=await ua({token:e,organization:t,storeType:o}),{stores:i,truncated:a}=vc(r.entries,r.hasMore);return{stores:i,organization:bc(t),...o?{storeType:o}:{},...a?{truncated:!0}:{}}}async function kc(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 _o({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 bc(e){return{id:e.id,name:e.businessName}}function vc(e,t){return{stores:e.slice(0,250),truncated:t||e.length>250}}n();n();var da=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}),Rt=x({name:"StoreListResult",schema:s.object({stores:s.array(da),organization:ce.optional(),storeType:s.enum(Pt).optional(),notice:s.string().optional(),truncated:s.boolean().optional()}),definitions:{StoreListEntry:da,StoreListOrganization:ce}});var Ac=["To list stores authenticated directly with",{command:"shopify store auth"},{char:","},"run",{command:"shopify store auth list"},{char:"."}];function la(e,t){if(e.notice&&Kt(e.notice),e.truncated&&Kt(xc(e)),t==="json"){g(Rt.encode(e));return}Oc(e)}function xc(e){let t=e.organization?` in ${e.organization.name}`:" in this organization";return`Showing the ${250} most recent ${fa(e.storeType)}${t}. More stores exist.`}function fa(e){return e?`${e.replaceAll("-"," ")} stores`:"stores"}function Oc(e){I({headline:Ic(e),customSections:[...Tc(e.organization),{body:Ac}]}),e.stores.length>0&&Ec(e.stores)}function Ic(e){let t=fa(e.storeType);return e.stores.length>0?`Listing ${t}.`:e.notice?`No ${t} were returned for the current CLI session.`:`No ${t} found.`}function Tc(e){return e?[{body:{tabularData:[["Organization",`${e.name} (${e.id})`]],firstColumnSubdued:!0}}]:[]}function Ec(e){fe({rows:e.map(t=>({subdomain:_c(t.store),name:t.name??"",type:ta(t.type),plan:ea(t.plan),created:lt(t.createdAt)})),columns:{subdomain:{header:"Subdomain"},name:{header:"Name"},type:{header:"Type"},plan:{header:"Plan"},created:{header:"Created"}}})}function _c(e){return ft(e)??e}var fo=R(j(),1),Xe=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":fo.Flags.integer({description:`${b["organization-id"].description} Required if non interactive when more than one organization is available.`,env:"SHOPIFY_FLAG_ORGANIZATION_ID"}),type:fo.Flags.string({description:"List only stores of this type.",options:Pt,env:"SHOPIFY_FLAG_STORE_TYPE"})};static get jsonOutputSchema(){return Rt}async run(){let{flags:t}=await this.parse(e),o=await ma({organizationId:t["organization-id"],storeType:t.type});la(o,t.json?"json":"text")}};n();n();var Fc={getStoreInfo:Dt,openURL:it};async function ha(e,t={}){let{getStoreInfo:o,openURL:r}={...Fc,...t},i=await o({store:e.store}),a=Nc(i),p=await r(a),d=ie(i.subdomain);return{storeDomain:d?`${d}.myshopify.com`:null,url:a,opened:p}}function Nc(e){return e.accessUrl??`https://${e.subdomain}`}n();n();var qt=x({name:"OpenStoreResult",schema:s.object({storeDomain:s.string().regex(/^[^.]+\.myshopify\.com$/).nullable(),url:s.string().url(),opened:s.boolean()}).strict()});function Sa(e,t){if(t==="json"){g(qt.encode(e));return}if(e.opened){I({headline:`Opening the storefront for ${e.storeDomain??e.url} in your browser.`});return}I({headline:"Browser didn't open automatically. Open the storefront manually:",body:[m`${u.link(e.url,e.url)}`.value]})}var Ze=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 qt}async run(){let{flags:t}=await this.parse(e),o=await ha({store:t.store});Sa(o,t.json?"json":"text")}};var Cc={"store:auth:list":Ce,"store:auth":De,"store:bulk:cancel":Re,"store:bulk:execute":qe,"store:bulk:status":$e,"store:stripe-auth":Ue,"store:create:dev":Be,"store:create:preview":je,"store:delete":Je,"store:execute":Qe,"store:graphiql":Ye,"store:info":Ke,"store:list":Xe,"store:open":Ze},$t=Cc;n();var Ut={"app:build":_r,"app:bulk:cancel":Fr,"app:bulk:status":Nr,"app:deploy":Rr,"app:dev":qr,"app:dev:clean":yn,"app:security:check":$r,"app:security:clean":Ur,"app:security:instructions":zr,"app:security:record":Br,"app:security:review":Hr,"app:logs":jr,"app:logs:sources":Mr,"app:import:channel-config":kn,"app:import:custom-data-definitions":bn,"app:import:dashboard-extensions":on,"app:import-custom-data-definitions":vn,"app:import-extensions":rn,"app:info":nn,"app:init":an,"app:config:validate":sn,"app:release":cn,"app:subscription-migrations:cancel":un,"app:subscription-migrations:list":pn,"app:subscription-migrations:schedule":mn,"app:subscription-migrations:status":dn,"app:subscription-migrations:unschedule":ln,"app:config:link":Cr,"app:config:use":Pr,"app:config:pull":Dr,"app:env:pull":Gr,"app:env:show":Jr,"app:execute":Wr,"app:graphiql":Qr,"app:bulk:execute":Vr,"app:function:build":Yr,"app:function:replay":Kr,"app:function:run":Xr,"app:function:info":wn,"app:function:schema":Zr,"app:function:typegen":en,"app:generate:extension":tn,"app:versions:list":fn,"app:webhook:trigger":hn,"demo:watcher":Lr,"organization:list":An},Pc=gn,Dc=Sn;var jk=Er.init;(0,ya.createGlobalProxyAgent)({environmentVariableNamespace:"SHOPIFY_",forceGlobalAgent:!0,socketConnectionTimeout:6e4});process.on("uncaughtException",async e=>{await er(e),process.exit(1)});var Lc=["SIGINT","SIGTERM","SIGQUIT"];Lc.forEach(e=>{process.on(e,()=>{process.exit(1)})});var ga=Number(process.env.SHOPIFY_CLI_COLUMNS);isNaN(ga)||(process.stdout.columns=ga);async function Rc({development:e}){await Lo({moduleURL:import.meta.url,development:e})}we.plugins.hidden=!0;we["plugins:install"].description="";var qc=Object.keys(Ut);qc.forEach(e=>{Ut[e].customPluginName="@shopify/app"});var $c=Object.keys(ut);$c.forEach(e=>{ut[e].customPluginName="@shopify/theme"});var Uc=Object.keys(pt);Uc.forEach(e=>{pt[e].customPluginName="@shopify/cli-hydrogen"});var zc=Object.keys($t);zc.forEach(e=>{$t[e].customPluginName="@shopify/store"});var Bc=Object.keys(mt);Bc.forEach(e=>{mt[e].customPluginName="@oclif/plugin-commands"});var Hc=Object.keys(dt);Hc.forEach(e=>{dt[e].customPluginName="@shopify/plugin-did-you-mean"});var jc=Object.keys(we);jc.forEach(e=>{we[e].customPluginName="@oclif/plugin-plugins"});var Mk={...Ut,...ut,...we,...dt,...mt,...pt,...$t,search:$o,upgrade:Uo,version:qo,"send-analytics":zo,help:Zo,"auth:logout":Bo,"auth:login":Ho,"debug:command-flags":jo,"kitchen-sink":Vo,"kitchen-sink:async":Mo,"kitchen-sink:prompts":Go,"kitchen-sink:static":Jo,"doctor-release":Wo,"doctor-release:theme":Qo,"doc:fetch":Yo,"doc:search":Ko,"docs:generate":Xo,"notifications:list":tr,"notifications:generate":or,"cache:clear":rr,"config:autoupgrade:off":nr,"config:autoupgrade:on":ir,"config:autoupgrade:status":ar},Gk=Rc;export{Dc as AppPublicMetadataHook,Pc as AppSensitiveMetadataHook,Mk as COMMANDS,Oa as DidYouMeanHook,jk as HydrogenInitHook,xa as PluginHook,Ia as TunnelProviderHook,Ta as TunnelStartHook,Gk as default,ba as fetchStoreThemes,va as pull,Aa 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 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};