shopify 4.3.0 → 4.5.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 (337) hide show
  1. package/dist/analytics-DMUNCDGT.js +1 -0
  2. package/dist/analytics-GAPN4I6R.js +1 -0
  3. package/dist/assets/hydrogen/routes/locale-check.ts +3 -3
  4. package/dist/assets/hydrogen/starter/CHANGELOG.md +106 -0
  5. package/dist/assets/hydrogen/starter/app/components/Aside.tsx +4 -2
  6. package/dist/assets/hydrogen/starter/app/components/CartMain.tsx +8 -5
  7. package/dist/assets/hydrogen/starter/app/components/CartSummary.tsx +117 -23
  8. package/dist/assets/hydrogen/starter/app/components/Header.tsx +3 -3
  9. package/dist/assets/hydrogen/starter/app/components/PaginatedResourceSection.tsx +24 -4
  10. package/dist/assets/hydrogen/starter/app/components/ProductPrice.tsx +1 -1
  11. package/dist/assets/hydrogen/starter/app/lib/context.ts +5 -0
  12. package/dist/assets/hydrogen/starter/app/routes/[robots.txt].tsx +14 -53
  13. package/dist/assets/hydrogen/starter/app/routes/_index.tsx +11 -4
  14. package/dist/assets/hydrogen/starter/app/routes/account.$.tsx +1 -1
  15. package/dist/assets/hydrogen/starter/app/routes/account.addresses.tsx +2 -2
  16. package/dist/assets/hydrogen/starter/app/routes/account.profile.tsx +1 -1
  17. package/dist/assets/hydrogen/starter/package.json +9 -10
  18. package/dist/assets/hydrogen/starter/storefrontapi.generated.d.ts +0 -11
  19. package/dist/assets/hydrogen/starter/vite.config.ts +10 -4
  20. package/dist/assets/hydrogen/vite/package.json +1 -2
  21. package/dist/assets/hydrogen/vite/vite.config.js +4 -3
  22. package/dist/bootstrap.js +1 -1
  23. package/dist/{chunk-3YDYZ232.js → chunk-235JVI2J.js} +8 -8
  24. package/dist/{chunk-2K7FGAT6.js → chunk-24RF5KN3.js} +1 -1
  25. package/dist/{chunk-GWHV62YT.js → chunk-2IPVQRMI.js} +1 -1
  26. package/dist/{chunk-QDVJJKLB.js → chunk-2MDFREEW.js} +1 -1
  27. package/dist/{chunk-JSOGPMWB.js → chunk-2MZACB7V.js} +1 -1
  28. package/dist/{chunk-LCZDC6EE.js → chunk-2ROG5NK3.js} +1 -1
  29. package/dist/{chunk-WVRGCNBZ.js → chunk-2VUG6LRN.js} +1 -1
  30. package/dist/{chunk-S22NCNAJ.js → chunk-32KQKGSY.js} +1 -1
  31. package/dist/chunk-3EQY5B4S.js +836 -0
  32. package/dist/{chunk-VRJTLVG3.js → chunk-3JAC5SI7.js} +1 -1
  33. package/dist/{chunk-G3JJLXPH.js → chunk-3JZKWK2V.js} +1 -1
  34. package/dist/chunk-3NMVMCOM.js +3 -0
  35. package/dist/chunk-3OE5HXHO.js +1 -0
  36. package/dist/{chunk-2RBIR3NM.js → chunk-4EYTWWYF.js} +1 -1
  37. package/dist/{chunk-G2OHWAY2.js → chunk-4LML2QWN.js} +1 -1
  38. package/dist/{chunk-UYSF234H.js → chunk-4Q54UDO3.js} +1 -1
  39. package/dist/{chunk-7572RLUP.js → chunk-4U3NC3UU.js} +1 -1
  40. package/dist/chunk-52H2R2FU.js +1 -0
  41. package/dist/{chunk-PMS4MNHB.js → chunk-57IRHKV3.js} +1 -1
  42. package/dist/{chunk-3AOQKI4B.js → chunk-5A7EMVAP.js} +1 -1
  43. package/dist/{chunk-T3ERXB7F.js → chunk-5EVFLUUA.js} +1 -1
  44. package/dist/{chunk-DYNH5SKT.js → chunk-5O7PY44R.js} +1 -1
  45. package/dist/chunk-63NFEXJR.js +275 -0
  46. package/dist/{chunk-PXHY753L.js → chunk-663TS34D.js} +1 -1
  47. package/dist/{chunk-JAWKLBOB.js → chunk-6I3FNLT3.js} +1 -1
  48. package/dist/{chunk-WA3YC5W4.js → chunk-6LTJMYUD.js} +2 -2
  49. package/dist/{chunk-5BKCIDMS.js → chunk-6V37CHBZ.js} +1 -1
  50. package/dist/{chunk-HOSFU6UP.js → chunk-74IG3ZE3.js} +3 -3
  51. package/dist/{chunk-4J32OHLY.js → chunk-7BVXGS44.js} +1 -1
  52. package/dist/{chunk-MRS6LAY7.js → chunk-7DYZVU7H.js} +1 -1
  53. package/dist/{chunk-YSIBRY6C.js → chunk-7EOQVQND.js} +1 -1
  54. package/dist/{chunk-3SPDFV5D.js → chunk-7HZG7FBK.js} +1 -1
  55. package/dist/{chunk-MIDYZPO4.js → chunk-7KHYEIA7.js} +1 -1
  56. package/dist/{chunk-5XDQ76DQ.js → chunk-7ZIO3X22.js} +1 -1
  57. package/dist/{chunk-6JKGUQRD.js → chunk-A2O3MBPH.js} +1 -1
  58. package/dist/{chunk-Q77MM2N2.js → chunk-ABCU552E.js} +1 -1
  59. package/dist/{chunk-N3CNWCC2.js → chunk-AP6FNGTA.js} +1 -1
  60. package/dist/chunk-AUZCENYI.js +1 -0
  61. package/dist/chunk-AYKRKE6O.js +2 -0
  62. package/dist/{chunk-PFGYC53K.js → chunk-AYSS2ERL.js} +1 -1
  63. package/dist/chunk-B367FOQA.js +7 -0
  64. package/dist/{chunk-PCCK4YTE.js → chunk-BBATKR3B.js} +1 -1
  65. package/dist/chunk-BCEWCYZD.js +1 -0
  66. package/dist/{chunk-2GU7OY3H.js → chunk-BH34ZLZ4.js} +1 -1
  67. package/dist/{chunk-ZM75DSIW.js → chunk-BLI7DUNV.js} +1 -1
  68. package/dist/{chunk-E7DHELFH.js → chunk-BNX4MZMV.js} +1 -1
  69. package/dist/{chunk-N5LVGFDS.js → chunk-BU7R7NFL.js} +1 -1
  70. package/dist/{chunk-NILXAUUT.js → chunk-BVHBMOIB.js} +1 -1
  71. package/dist/{chunk-7FQFEB33.js → chunk-BXDZX3BS.js} +34 -34
  72. package/dist/{chunk-MMIHHCMW.js → chunk-CVRAATZ5.js} +1 -1
  73. package/dist/{chunk-G3RWLAOG.js → chunk-DBBU6OVN.js} +1 -1
  74. package/dist/{chunk-G2LVUM7N.js → chunk-DKVU7LYY.js} +1 -1
  75. package/dist/{chunk-L2PC4MUV.js → chunk-DLZPP33V.js} +1 -1
  76. package/dist/{chunk-JEZ3PGVC.js → chunk-DQOS54HN.js} +1 -1
  77. package/dist/{chunk-OZBY45KT.js → chunk-E4GW6OXT.js} +1 -1
  78. package/dist/chunk-E64BQS4D.js +1 -0
  79. package/dist/chunk-F447QKVX.js +1 -0
  80. package/dist/{chunk-57PPQKJT.js → chunk-FA25RL4G.js} +1 -1
  81. package/dist/{chunk-TRYWVIVJ.js → chunk-FJOEHMXM.js} +1 -1
  82. package/dist/{chunk-NWXDOCL5.js → chunk-G6YOP2SJ.js} +1 -1
  83. package/dist/{chunk-YIRFEW5M.js → chunk-GOAKZ2IL.js} +1 -1
  84. package/dist/{chunk-AU5EZQW7.js → chunk-H2JU5BGK.js} +1 -1
  85. package/dist/{chunk-VJ6KDRZI.js → chunk-H3V6Y5JO.js} +1 -1
  86. package/dist/{chunk-GJXINXSU.js → chunk-HHA322FT.js} +46 -46
  87. package/dist/{chunk-HCTZN7L4.js → chunk-HP3NDE7S.js} +1 -1
  88. package/dist/{chunk-ANBOLDON.js → chunk-HX3TALXV.js} +1 -1
  89. package/dist/{chunk-OU3M32A2.js → chunk-I3Y6XTKN.js} +1 -1
  90. package/dist/{chunk-DCLUZFT7.js → chunk-ICHNVDFU.js} +1 -1
  91. package/dist/{chunk-RSRYC5ZF.js → chunk-ICXHUPP5.js} +1 -1
  92. package/dist/chunk-IE4SSSXU.js +593 -0
  93. package/dist/{chunk-5FVB7JHP.js → chunk-IFVYCKX5.js} +1 -1
  94. package/dist/{chunk-JUYJZUYU.js → chunk-J2ZES5K5.js} +1 -1
  95. package/dist/{chunk-JCIN73BE.js → chunk-J5U2FUIX.js} +1 -1
  96. package/dist/chunk-JC3PRJJS.js +1 -0
  97. package/dist/chunk-JGN7YG5X.js +3 -0
  98. package/dist/{chunk-ZGJ3DFTQ.js → chunk-JZVNNQWE.js} +1 -1
  99. package/dist/{chunk-CV5EQGES.js → chunk-K2CIMJJW.js} +1 -1
  100. package/dist/{chunk-T4NS63K4.js → chunk-K7I5BGFC.js} +1 -1
  101. package/dist/{chunk-33OHQUHZ.js → chunk-KESQOMEW.js} +1 -1
  102. package/dist/{chunk-4QTEPWEJ.js → chunk-KJQAJUDU.js} +4 -4
  103. package/dist/{chunk-TP7E54WN.js → chunk-KNEF6NAG.js} +1 -1
  104. package/dist/{chunk-S6B2ADVR.js → chunk-KUKYAIOR.js} +1 -1
  105. package/dist/{chunk-MEIEEENL.js → chunk-KZDI2BXR.js} +1 -1
  106. package/dist/chunk-LKZ7ARYS.js +18 -0
  107. package/dist/{chunk-W7DDV2EY.js → chunk-LMPD55L6.js} +1 -1
  108. package/dist/{chunk-YVQXEPHY.js → chunk-LXZM6Z4F.js} +1 -1
  109. package/dist/{chunk-S5IFJ737.js → chunk-MGPLKG23.js} +1 -1
  110. package/dist/chunk-MSJDZLZT.js +1 -0
  111. package/dist/{chunk-N3NE4MVN.js → chunk-N4LCWB56.js} +1 -1
  112. package/dist/{chunk-VI34CKV6.js → chunk-N5U5Q2MG.js} +1 -1
  113. package/dist/{chunk-JK3NIHTX.js → chunk-N5YIZJ4S.js} +1 -1
  114. package/dist/{chunk-CEHXOWA6.js → chunk-N625VE5T.js} +1 -1
  115. package/dist/{chunk-A5HKAMAC.js → chunk-NJLSZS27.js} +1 -1
  116. package/dist/{chunk-WHNWE7P2.js → chunk-O7OQK2OC.js} +1 -1
  117. package/dist/{chunk-5O43334U.js → chunk-P375IGKT.js} +1 -1
  118. package/dist/chunk-P3RGC53U.js +5 -0
  119. package/dist/{chunk-4FFPTEKD.js → chunk-P4243GCY.js} +1 -1
  120. package/dist/{chunk-FIYAECXH.js → chunk-PFEC2NUB.js} +1 -1
  121. package/dist/{chunk-JJ6RM54S.js → chunk-PH7F4BMG.js} +1 -1
  122. package/dist/chunk-PK6NOLT5.js +2 -0
  123. package/dist/chunk-PLHJQQVZ.js +1 -0
  124. package/dist/{chunk-AO3RFGNV.js → chunk-PVD544NN.js} +1 -1
  125. package/dist/chunk-Q3WOWDUU.js +1 -0
  126. package/dist/chunk-Q7BOSHWX.js +7 -0
  127. package/dist/{chunk-2XZBQZ5R.js → chunk-QAM7VCLV.js} +1 -1
  128. package/dist/{chunk-FOFJBRSL.js → chunk-QCBAFI6Z.js} +1 -1
  129. package/dist/{chunk-SSCYLDSX.js → chunk-QHWF3S7U.js} +1 -1
  130. package/dist/{chunk-EVZA2TCI.js → chunk-QJL3SXYA.js} +1 -1
  131. package/dist/{chunk-UB26DGTR.js → chunk-QRETBFXI.js} +1 -1
  132. package/dist/chunk-RBOYWA2D.js +1 -0
  133. package/dist/{chunk-N3YTDGFY.js → chunk-ROQXPIEZ.js} +1 -1
  134. package/dist/{chunk-ATSMK66C.js → chunk-RUKK4KXX.js} +1 -1
  135. package/dist/{chunk-PNP5OKNZ.js → chunk-RY2ESY3P.js} +1 -1
  136. package/dist/{chunk-HIQHYPLU.js → chunk-RY5CY3ZW.js} +1 -1
  137. package/dist/{chunk-Q73GEVSJ.js → chunk-S442LGHR.js} +1 -1
  138. package/dist/{chunk-OXJBYKMX.js → chunk-S5JJL3BP.js} +1 -1
  139. package/dist/{chunk-UU5P2IYU.js → chunk-SF53RKMO.js} +1 -1
  140. package/dist/{chunk-JAWOP4HJ.js → chunk-SY2AH7C2.js} +1 -1
  141. package/dist/{chunk-J5BRKYGE.js → chunk-TC3JOEMA.js} +1 -1
  142. package/dist/{chunk-M7YFD4EV.js → chunk-TEXYUUTD.js} +5 -5
  143. package/dist/chunk-TGM7L6RV.js +1 -0
  144. package/dist/{chunk-5H3VTG77.js → chunk-TKW3Z7XL.js} +1 -1
  145. package/dist/{chunk-HDC5V7RY.js → chunk-TM534QSE.js} +1 -1
  146. package/dist/{chunk-5FFHQTRC.js → chunk-U44HRKSU.js} +1 -1
  147. package/dist/{chunk-UTO4Z6P6.js → chunk-UEC23KAO.js} +1 -1
  148. package/dist/{chunk-RKDZGK5K.js → chunk-UFGDNIYX.js} +1 -1
  149. package/dist/{chunk-Q7C44DX5.js → chunk-UGGFSV7N.js} +1 -1
  150. package/dist/{chunk-USLYL5AC.js → chunk-UJVYIWUI.js} +1 -1
  151. package/dist/{chunk-OU4SKQTC.js → chunk-UP7H24B3.js} +2 -2
  152. package/dist/{chunk-YPBCSDFQ.js → chunk-UQZ7HZ47.js} +1 -1
  153. package/dist/{chunk-2EHBJWC6.js → chunk-UTLRP527.js} +1 -1
  154. package/dist/chunk-UTPJAU5S.js +1 -0
  155. package/dist/{chunk-DNXYKGV2.js → chunk-V66IHWQO.js} +1 -1
  156. package/dist/{chunk-YL3TYQGT.js → chunk-V774I3FW.js} +1 -1
  157. package/dist/{chunk-6KETAPWL.js → chunk-VKFDDZD3.js} +1 -1
  158. package/dist/{chunk-ZUKLGZOU.js → chunk-VNYKNAT5.js} +1 -1
  159. package/dist/{chunk-AERKD4TO.js → chunk-VUACOGOX.js} +1 -1
  160. package/dist/{chunk-KRQGLK2Q.js → chunk-WFB3FHKV.js} +1 -1
  161. package/dist/chunk-WPITBIL5.js +21 -0
  162. package/dist/{chunk-J3HX6ZGD.js → chunk-WTYH2O47.js} +1 -1
  163. package/dist/chunk-WU6GIY22.js +4 -0
  164. package/dist/{chunk-UC7KMA6W.js → chunk-XA5JA7DK.js} +1 -1
  165. package/dist/{chunk-2TMQG2UT.js → chunk-XSXX75VV.js} +1 -1
  166. package/dist/{chunk-7D45IAMQ.js → chunk-XXUWTD7A.js} +1 -1
  167. package/dist/chunk-XZWAX4FI.js +46 -0
  168. package/dist/{chunk-FQ5ZZX2G.js → chunk-YF4HKJB5.js} +1 -1
  169. package/dist/chunk-YJAX22JK.js +7 -0
  170. package/dist/{chunk-BL46CZ2M.js → chunk-YT3NPMWK.js} +1 -1
  171. package/dist/{chunk-NTRAWIEJ.js → chunk-YYLEWVO6.js} +3 -3
  172. package/dist/chunk-Z2Y6G2QF.js +1 -0
  173. package/dist/{chunk-M2YINBHF.js → chunk-Z66NZ2HC.js} +1 -1
  174. package/dist/{chunk-6LWOWDF4.js → chunk-ZFOWAMFK.js} +1 -1
  175. package/dist/{chunk-25HJX3L2.js → chunk-ZKBWEHIY.js} +1 -1
  176. package/dist/{chunk-2GAFKG64.js → chunk-ZZ3SMI2A.js} +1 -1
  177. package/dist/{chunk-TY6BZTG3.js → chunk-ZZWSMRKT.js} +1 -1
  178. package/dist/cli/commands/app/app-logs/sources.js +1 -1
  179. package/dist/cli/commands/app/build.js +1 -1
  180. package/dist/cli/commands/app/bulk/cancel.js +1 -1
  181. package/dist/cli/commands/app/bulk/execute.js +1 -1
  182. package/dist/cli/commands/app/bulk/status.js +1 -1
  183. package/dist/cli/commands/app/config/link.js +1 -1
  184. package/dist/cli/commands/app/config/pull.js +1 -1
  185. package/dist/cli/commands/app/config/use.js +1 -1
  186. package/dist/cli/commands/app/config/validate.js +1 -1
  187. package/dist/cli/commands/app/demo/watcher.js +1 -1
  188. package/dist/cli/commands/app/deploy.js +1 -1
  189. package/dist/cli/commands/app/dev/clean.js +1 -1
  190. package/dist/cli/commands/app/dev.js +1 -1
  191. package/dist/cli/commands/app/env/pull.js +1 -1
  192. package/dist/cli/commands/app/env/show.js +1 -1
  193. package/dist/cli/commands/app/execute.js +1 -1
  194. package/dist/cli/commands/app/function/build.js +1 -1
  195. package/dist/cli/commands/app/function/info.js +1 -1
  196. package/dist/cli/commands/app/function/replay.js +1 -1
  197. package/dist/cli/commands/app/function/run.js +1 -1
  198. package/dist/cli/commands/app/function/schema.js +1 -1
  199. package/dist/cli/commands/app/function/typegen.js +1 -1
  200. package/dist/cli/commands/app/generate/extension.js +1 -1
  201. package/dist/cli/commands/app/graphiql.js +1 -0
  202. package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
  203. package/dist/cli/commands/app/import-extensions.js +1 -1
  204. package/dist/cli/commands/app/info.js +1 -1
  205. package/dist/cli/commands/app/init.js +1 -1
  206. package/dist/cli/commands/app/logs.js +1 -1
  207. package/dist/cli/commands/app/release.js +1 -1
  208. package/dist/cli/commands/app/versions/list.js +1 -1
  209. package/dist/cli/commands/app/webhook/trigger.js +1 -1
  210. package/dist/cli/commands/auth/login.js +1 -1
  211. package/dist/cli/commands/auth/logout.js +1 -1
  212. package/dist/cli/commands/cache/clear.js +1 -1
  213. package/dist/cli/commands/config/autoupgrade/off.js +1 -1
  214. package/dist/cli/commands/config/autoupgrade/on.js +1 -1
  215. package/dist/cli/commands/config/autoupgrade/status.js +1 -1
  216. package/dist/cli/commands/debug/command-flags.js +1 -1
  217. package/dist/cli/commands/doc/fetch.js +1 -1
  218. package/dist/cli/commands/doc/search.js +1 -1
  219. package/dist/cli/commands/docs/generate.js +1 -1
  220. package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
  221. package/dist/cli/commands/doctor-release/theme/index.js +1 -1
  222. package/dist/cli/commands/help.js +1 -1
  223. package/dist/cli/commands/kitchen-sink/async.js +1 -1
  224. package/dist/cli/commands/kitchen-sink/index.js +1 -1
  225. package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
  226. package/dist/cli/commands/kitchen-sink/static.js +1 -1
  227. package/dist/cli/commands/notifications/generate.js +1 -1
  228. package/dist/cli/commands/notifications/list.js +1 -1
  229. package/dist/cli/commands/organization/list.js +1 -1
  230. package/dist/cli/commands/search.js +1 -1
  231. package/dist/cli/commands/theme/check.js +1 -1
  232. package/dist/cli/commands/theme/console.js +1 -1
  233. package/dist/cli/commands/theme/delete.js +1 -1
  234. package/dist/cli/commands/theme/dev.js +1 -1
  235. package/dist/cli/commands/theme/duplicate.js +1 -1
  236. package/dist/cli/commands/theme/info.js +1 -1
  237. package/dist/cli/commands/theme/init.js +1 -1
  238. package/dist/cli/commands/theme/language-server.js +1 -1
  239. package/dist/cli/commands/theme/list.js +1 -1
  240. package/dist/cli/commands/theme/metafields/pull.js +1 -1
  241. package/dist/cli/commands/theme/open.js +1 -1
  242. package/dist/cli/commands/theme/package.js +1 -1
  243. package/dist/cli/commands/theme/preview.js +1 -1
  244. package/dist/cli/commands/theme/profile.js +1 -1
  245. package/dist/cli/commands/theme/publish.js +1 -1
  246. package/dist/cli/commands/theme/pull.js +1 -1
  247. package/dist/cli/commands/theme/push.js +1 -1
  248. package/dist/cli/commands/theme/rename.js +1 -1
  249. package/dist/cli/commands/theme/share.js +1 -1
  250. package/dist/cli/commands/upgrade.js +1 -1
  251. package/dist/cli/commands/version.js +1 -1
  252. package/dist/cli/help.d.ts +38 -0
  253. package/dist/cli/help.js +2 -0
  254. package/dist/command-registry.js +1 -1
  255. package/dist/{conf-store-UY3MDGGA.js → conf-store-V6ILVUUO.js} +1 -1
  256. package/dist/{deprecations-KNUMDRIU.js → deprecations-MOEFN6OW.js} +1 -1
  257. package/dist/dist-2BL5GGMG.js +1 -0
  258. package/dist/dist-E6QKEULH.js +1 -0
  259. package/dist/environments-5KA3OBIZ.js +1 -0
  260. package/dist/error-NYYI6HVX.js +1 -0
  261. package/dist/error-handler-BOESDKZA.js +1 -0
  262. package/dist/{fs-LJWVNO4H.js → fs-XE6SBVBF.js} +1 -1
  263. package/dist/hooks/app-init.js +1 -1
  264. package/dist/hooks/did-you-mean.js +1 -1
  265. package/dist/hooks/hydrogen-init.js +1 -1
  266. package/dist/hooks/plugin-plugins.js +1 -1
  267. package/dist/hooks/postrun.js +1 -1
  268. package/dist/hooks/prerun.js +1 -1
  269. package/dist/hooks/public-metadata.js +1 -1
  270. package/dist/hooks/sensitive-metadata.js +1 -1
  271. package/dist/hooks/tunnel-provider.js +1 -1
  272. package/dist/hooks/tunnel-start.js +1 -1
  273. package/dist/index.js +23 -10
  274. package/dist/{is-global-W6ALVC5L.js → is-global-JOHCPSKZ.js} +1 -1
  275. package/dist/lib-NOROGV6N.js +1 -0
  276. package/dist/lib-UCG2DNMS.js +1 -0
  277. package/dist/{local-GKEWZAIV.js → local-BTQDUX72.js} +1 -1
  278. package/dist/local-storage-WUSIVDTQ.js +1 -0
  279. package/dist/{metadata-UEUN64TK.js → metadata-APVOKTBV.js} +1 -1
  280. package/dist/{morph-CGOZEPPZ.js → morph-CG6HEMCQ.js} +4 -4
  281. package/dist/{node-package-manager-4ASQQIIF.js → node-package-manager-AC34ZJZD.js} +1 -1
  282. package/dist/notifications-system-4ODOESG2.js +1 -0
  283. package/dist/{output-S6E37GJQ.js → output-EAPQ7OWD.js} +1 -1
  284. package/dist/{prettier-EGVCP5CY.js → prettier-6ZMB2MMO.js} +1 -1
  285. package/dist/system-D7CH26HU.js +1 -0
  286. package/dist/tsconfig.tsbuildinfo +1 -1
  287. package/dist/ui-AXZBGWIQ.js +1 -0
  288. package/dist/upgrade-SLPJF6LD.js +1 -0
  289. package/dist/version-3IYH4V5U.js +1 -0
  290. package/dist/version-FAU37PQN.js +1 -0
  291. package/dist/{workerd-QOTT6UCO.js → workerd-XXPWKQOM.js} +1 -1
  292. package/oclif.manifest.json +712 -124
  293. package/package.json +15 -8
  294. package/dist/analytics-JH64XI2J.js +0 -1
  295. package/dist/analytics-MEGKKFGF.js +0 -1
  296. package/dist/assets/hydrogen/starter/app/routes/api.$version.[graphql.json].tsx +0 -14
  297. package/dist/chunk-762JWOWJ.js +0 -5
  298. package/dist/chunk-7LV55VWE.js +0 -1
  299. package/dist/chunk-A27NZMWB.js +0 -1
  300. package/dist/chunk-AVD3INWF.js +0 -1
  301. package/dist/chunk-AWEB5AQM.js +0 -1
  302. package/dist/chunk-AXNAGI32.js +0 -1
  303. package/dist/chunk-BQWK3C47.js +0 -278
  304. package/dist/chunk-CFOXXOO2.js +0 -1
  305. package/dist/chunk-DTIWUT2T.js +0 -18
  306. package/dist/chunk-DZQYG32N.js +0 -2
  307. package/dist/chunk-EH7ZTFS4.js +0 -613
  308. package/dist/chunk-EKVTNWHM.js +0 -1
  309. package/dist/chunk-G4OQABDT.js +0 -836
  310. package/dist/chunk-I22ZTRKK.js +0 -3
  311. package/dist/chunk-I4R7TML2.js +0 -7
  312. package/dist/chunk-J3H4LPN6.js +0 -18
  313. package/dist/chunk-JLE4NBMT.js +0 -1
  314. package/dist/chunk-LXVORHCQ.js +0 -1
  315. package/dist/chunk-MINZGZ4N.js +0 -1
  316. package/dist/chunk-S7F5KFQP.js +0 -1
  317. package/dist/chunk-T4IV643Z.js +0 -9
  318. package/dist/chunk-TPCG6DCA.js +0 -1
  319. package/dist/chunk-TUNUEOHO.js +0 -3
  320. package/dist/chunk-VPPWSKOY.js +0 -1
  321. package/dist/chunk-XVUHUA36.js +0 -1
  322. package/dist/chunk-YMAWEIUR.js +0 -1
  323. package/dist/dist-C5IV2YDQ.js +0 -1
  324. package/dist/dist-VL4KZWV2.js +0 -1
  325. package/dist/environments-YPRVO2CF.js +0 -1
  326. package/dist/error-XRBQTNFM.js +0 -1
  327. package/dist/error-handler-NI7D6GSY.js +0 -1
  328. package/dist/lib-AIKYSHWL.js +0 -1
  329. package/dist/lib-Q4PWEMFD.js +0 -1
  330. package/dist/local-storage-ZOZMA22B.js +0 -1
  331. package/dist/notifications-system-HLXJCAMG.js +0 -1
  332. package/dist/system-YQZNGSWB.js +0 -1
  333. package/dist/ui-D2FFWRK7.js +0 -1
  334. package/dist/upgrade-TVTCFMXM.js +0 -1
  335. package/dist/version-J6MDN7BZ.js +0 -1
  336. package/dist/version-RIRW5EXQ.js +0 -1
  337. /package/dist/{chunk-YLQ3LNNY.js → chunk-VDN6MEYI.js} +0 -0
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import{a as Ae}from"./chunk-J5BRKYGE.js";import{a as ve,b as Zt}from"./chunk-BQWK3C47.js";import"./chunk-XWPPBOGF.js";import"./chunk-GJXINXSU.js";import{a as Io}from"./chunk-2GU7OY3H.js";import{a as Eo}from"./chunk-FQ5ZZX2G.js";import{a as so}from"./chunk-USLYL5AC.js";import{a as Ro}from"./chunk-UYSF234H.js";import{a as Ao}from"./chunk-OU4SKQTC.js";import{a as Do}from"./chunk-2GAFKG64.js";import{a as bo}from"./chunk-S22NCNAJ.js";import{a as xo}from"./chunk-FOFJBRSL.js";import{a as L,b as Ge,c as To}from"./chunk-M7YFD4EV.js";import{a as mo}from"./chunk-DCLUZFT7.js";import{a as po}from"./chunk-HCTZN7L4.js";import{a as _o}from"./chunk-Q7C44DX5.js";import{a as fo}from"./chunk-ZM75DSIW.js";import"./chunk-MMIHHCMW.js";import{a as go}from"./chunk-JLE4NBMT.js";import{a as So}from"./chunk-VRJTLVG3.js";import{a as Fo}from"./chunk-T4NS63K4.js";import{a as yo}from"./chunk-JSOGPMWB.js";import{a as ko}from"./chunk-YPBCSDFQ.js";import"./chunk-NWXDOCL5.js";import{a as wo}from"./chunk-G3RWLAOG.js";import{a as vo}from"./chunk-2TMQG2UT.js";import"./chunk-7572RLUP.js";import{a as no}from"./chunk-5FFHQTRC.js";import{a as ao}from"./chunk-PNP5OKNZ.js";import{a as io}from"./chunk-4FFPTEKD.js";import{a as No}from"./chunk-CEHXOWA6.js";import{a as co}from"./chunk-CV5EQGES.js";import"./chunk-5O43334U.js";import{a as we,b as uo}from"./chunk-EH7ZTFS4.js";import"./chunk-UOHNRH6E.js";import"./chunk-MINZGZ4N.js";import"./chunk-SSCYLDSX.js";import"./chunk-G2OHWAY2.js";import{a as an}from"./chunk-EVZA2TCI.js";import"./chunk-FIYAECXH.js";import"./chunk-G2LVUM7N.js";import"./chunk-AERKD4TO.js";import{a as sn}from"./chunk-AU5EZQW7.js";import"./chunk-M2YINBHF.js";import"./chunk-7LV55VWE.js";import"./chunk-UC7KMA6W.js";import"./chunk-ZUKLGZOU.js";import"./chunk-GWHV62YT.js";import"./chunk-JAWKLBOB.js";import"./chunk-T3ERXB7F.js";import"./chunk-I4R7TML2.js";import"./chunk-JEZ3PGVC.js";import"./chunk-N3CNWCC2.js";import"./chunk-57PPQKJT.js";import"./chunk-2XZBQZ5R.js";import"./chunk-2EHBJWC6.js";import"./chunk-DZQYG32N.js";import"./chunk-J3JPJCWP.js";import"./chunk-JK3NIHTX.js";import"./chunk-WHNWE7P2.js";import"./chunk-3YDYZ232.js";import"./chunk-KRZABRYT.js";import"./chunk-W7DDV2EY.js";import"./chunk-YMAWEIUR.js";import"./chunk-DTIWUT2T.js";import"./chunk-STJ3LWFL.js";import"./chunk-AVD3INWF.js";import"./chunk-MIDYZPO4.js";import{b as nn}from"./chunk-JUYJZUYU.js";import"./chunk-VJ6KDRZI.js";import"./chunk-TRYWVIVJ.js";import"./chunk-5XDQ76DQ.js";import"./chunk-TUNUEOHO.js";import"./chunk-AO3RFGNV.js";import"./chunk-N3YTDGFY.js";import"./chunk-RKDZGK5K.js";import"./chunk-WA3YC5W4.js";import"./chunk-RSRYC5ZF.js";import"./chunk-VE35YELD.js";import"./chunk-PMS4MNHB.js";import"./chunk-TU47HMTL.js";import"./chunk-25HJX3L2.js";import"./chunk-TYMYIUIQ.js";import"./chunk-LXVORHCQ.js";import"./chunk-6LWOWDF4.js";import"./chunk-YVQXEPHY.js";import"./chunk-ZI7LK3LW.js";import{a as Co}from"./chunk-LCZDC6EE.js";import{a as lo}from"./chunk-Q73GEVSJ.js";import"./chunk-FKIVKNOV.js";import{a as Qt}from"./chunk-UU5P2IYU.js";import{a as Wt}from"./chunk-PFGYC53K.js";import{a as Jt}from"./chunk-HIQHYPLU.js";import{a as qt}from"./chunk-WVRGCNBZ.js";import{a as to}from"./chunk-MRS6LAY7.js";import"./chunk-S7F5KFQP.js";import"./chunk-MEIEEENL.js";import{a as oo}from"./chunk-AXNAGI32.js";import{a as ho}from"./chunk-T4IV643Z.js";import{a as ro}from"./chunk-762JWOWJ.js";import"./chunk-I22ZTRKK.js";import"./chunk-A27NZMWB.js";import"./chunk-OZBY45KT.js";import"./chunk-EKVTNWHM.js";import"./chunk-5BKCIDMS.js";import"./chunk-AWEB5AQM.js";import{a as $t}from"./chunk-PXHY753L.js";import{a as Dt}from"./chunk-7D45IAMQ.js";import{a as Lt}from"./chunk-6KETAPWL.js";import"./chunk-N3NE4MVN.js";import{a as Rt}from"./chunk-5FVB7JHP.js";import"./chunk-ATSMK66C.js";import"./chunk-VUMUCNI7.js";import{a as Ut}from"./chunk-JAWOP4HJ.js";import"./chunk-OU3M32A2.js";import{a as Bt}from"./chunk-YSIBRY6C.js";import{a as Vt}from"./chunk-JJ6RM54S.js";import"./chunk-2RBIR3NM.js";import"./chunk-GCN4O7HM.js";import{a as _t}from"./chunk-YIRFEW5M.js";import{a as Ct}from"./chunk-2K7FGAT6.js";import{a as Pt}from"./chunk-G3JJLXPH.js";import{a as Gt}from"./chunk-TP7E54WN.js";import{a as Ft}from"./chunk-TY6BZTG3.js";import{a as zt}from"./chunk-KRQGLK2Q.js";import{a as Mt}from"./chunk-UB26DGTR.js";import{a as Ht}from"./chunk-33OHQUHZ.js";import{a as Oo}from"./chunk-3AOQKI4B.js";import{t as eo}from"./chunk-4QTEPWEJ.js";import"./chunk-S6B2ADVR.js";import"./chunk-YLQ3LNNY.js";import"./chunk-VJEKDBGZ.js";import{a as Yt,b as Kt,d as Xt}from"./chunk-UTO4Z6P6.js";import"./chunk-YL3TYQGT.js";import"./chunk-4J32OHLY.js";import"./chunk-IWOTLFOY.js";import"./chunk-F3TMLDLC.js";import{e as K}from"./chunk-CFOXXOO2.js";import"./chunk-A5HKAMAC.js";import{a as Po}from"./chunk-6JKGUQRD.js";import"./chunk-QDVJJKLB.js";import{a as mn}from"./chunk-BL46CZ2M.js";import{d as un}from"./chunk-5H3VTG77.js";import{a as jt}from"./chunk-Q77MM2N2.js";import{a as Et}from"./chunk-ZGJ3DFTQ.js";import{a as Ot}from"./chunk-DNXYKGV2.js";import"./chunk-JCIN73BE.js";import"./chunk-NILXAUUT.js";import"./chunk-E7DHELFH.js";import{G as H,P,ea as Z,fa as W,g as on,n as je,na as Ve,o as ge,pa as J,v as Se,z as N}from"./chunk-G4OQABDT.js";import"./chunk-ZDF5N422.js";import"./chunk-ANBOLDON.js";import"./chunk-HDC5V7RY.js";import"./chunk-MPW2YJWU.js";import{a as ze}from"./chunk-VPPWSKOY.js";import"./chunk-J3HX6ZGD.js";import{a as rn}from"./chunk-GDHD3TGC.js";import{a as It,b as v,c as A}from"./chunk-OXJBYKMX.js";import"./chunk-T7KHS6RF.js";import{c as be,d as dn}from"./chunk-L2PC4MUV.js";import{b as ye}from"./chunk-N5LVGFDS.js";import{b as te}from"./chunk-HOSFU6UP.js";import"./chunk-WW7TENNA.js";import{a as gt,c as X}from"./chunk-5C7HDTHJ.js";import{B as vt,C as ke,E as j,I as At,J as xt,P as Tt,u as kt,v as Y,y as wt}from"./chunk-NTRAWIEJ.js";import"./chunk-EJDWYASP.js";import"./chunk-7UNQOKZW.js";import"./chunk-GB3YC4TI.js";import"./chunk-RJ5VF3QY.js";import{d as St,e as yt}from"./chunk-VI34CKV6.js";import{c as bt,d as s,g as ee}from"./chunk-TPCG6DCA.js";import{a as oe,b as cn}from"./chunk-J3H4LPN6.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-XVUHUA36.js";import"./chunk-636CTEW7.js";import{r as me}from"./chunk-T6CC5WUU.js";import"./chunk-UQWFDL3F.js";import"./chunk-I5A6BPCP.js";import"./chunk-CX5CC6P5.js";import"./chunk-ET2CGROE.js";import"./chunk-TOLPNBZK.js";import"./chunk-PCCK4YTE.js";import"./chunk-3SPDFV5D.js";import{Fb as d,Hb as m,Lb as w,Mb as b,N as lt,Ob as Nt,Pb as l,Qb as Be,Ta as He,W as ft,_ as ue,ma as Me,ua as ht}from"./chunk-7FQFEB33.js";import"./chunk-A4SBXDZB.js";import"./chunk-NJOO5XJV.js";import"./chunk-ZG7BVVT2.js";import"./chunk-2O22LZKV.js";import"./chunk-S5IFJ737.js";import"./chunk-NNOSZ447.js";import{f as he}from"./chunk-773TIA5M.js";import"./chunk-CRALWNNO.js";import{e as Q,g as i}from"./chunk-VKWPEFWQ.js";i();var en=Q(rn(),1);i();i();i();i();i();i();var _="7e9cb568cfd431c538f36d1ad3f2b4f6";var xe="/auth/callback";function Uo(e){return`http://127.0.0.1:${e}${xe}`}function re(e){return`${_}::${pn(e)}`}function pn(e){return e.replace(/\./g,"\\.")}function I(e){return e.length<=10?"***":`${e.slice(0,10)}***`}var Qe;function Te(){return Qe??(Qe=new ye({projectName:"shopify-cli-store"})),Qe}function S(e){return typeof e=="string"}function ln(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.id=="number")return{id:t.id,...S(t.email)?{email:t.email}:{},...S(t.firstName)?{firstName:t.firstName}:{},...S(t.lastName)?{lastName:t.lastName}:{},...typeof t.accountOwner=="boolean"?{accountOwner:t.accountOwner}:{}}}function fn(e){if(!e||typeof e!="object")return;let t=e;if(!(!S(t.shopId)||!S(t.name)||!S(t.createdAt)))return{shopId:t.shopId,name:t.name,createdAt:t.createdAt,...S(t.placeholderAccountUuid)?{placeholderAccountUuid:t.placeholderAccountUuid}:{},...S(t.country)?{country:t.country}:{},...S(t.accessUrl)?{accessUrl:t.accessUrl}:{}}}function hn(e){if(!e||typeof e!="object")return;let t=e;if(!S(t.store)||!S(t.clientId)||!S(t.userId)||!S(t.accessToken)||!Array.isArray(t.scopes)||!t.scopes.every(S)||!S(t.acquiredAt))return;let o=ln(t.associatedUser),r=t.kind==="preview"?"preview":"standard",n=r==="preview"?fn(t.preview):void 0;if(!(r==="preview"&&!n))return{store:t.store,clientId:t.clientId,userId:t.userId,accessToken:t.accessToken,scopes:t.scopes,acquiredAt:t.acquiredAt,...S(t.refreshToken)?{refreshToken:t.refreshToken}:{},...S(t.expiresAt)?{expiresAt:t.expiresAt}:{},...S(t.refreshTokenExpiresAt)?{refreshTokenExpiresAt:t.refreshTokenExpiresAt}:{},...o?{associatedUser:o}:{},...r==="preview"?{kind:r}:{},...n?{preview:n}:{}}}function Lo(e,t,o){if(!t||typeof t!="object")return;let{sessionsByUserId:r,currentUserId:n}=t;if(!(r!==void 0||n!==void 0))return;let c=re(e);if(!r||typeof r!="object"||Array.isArray(r)||typeof n!="string"){o.delete(c);return}let u=Object.fromEntries(Object.entries(r).flatMap(([p,f])=>{let T=hn(f);return T?[[p,T]]:[]}));if(Object.keys(u).length!==Object.keys(r).length)if(u[n])o.set(c,{currentUserId:n,sessionsByUserId:u});else{o.delete(c);return}return{currentUserId:n,sessionsByUserId:u}}function We(e,t){return Lo(e,t.get(re(e)),t)}function gn(e){return e.config?.store??{}}function $o(e=Te()){let t=[],o=`${_}::`;for(let[r,n]of Object.entries(gn(e))){if(!r.startsWith(o))continue;let a=Lo(r.slice(o.length),n,e),c=a?.sessionsByUserId[a.currentUserId];c&&t.push(c)}return t}function ne(e,t=Te()){let o=We(e,t);if(!o)return;let r=o.sessionsByUserId[o.currentUserId];if(!r){t.delete(re(e));return}return r}function ie(e,t=Te()){let o=re(e.store),r=We(e.store,t),n={currentUserId:e.userId,sessionsByUserId:{...r?.sessionsByUserId??{},[e.userId]:e}};t.set(o,n)}function ae(e,t,o){let r=typeof t=="string"?t:void 0,n=(typeof t=="string"?o:t)??Te(),a=re(e);if(!r){n.delete(a);return}let c=We(e,n);if(!c)return;let{[r]:u,...p}=c.sessionsByUserId,f=Object.keys(p);if(f.length===0){n.delete(a);return}n.set(a,{currentUserId:c.currentUserId===r?f[0]:c.currentUserId,sessionsByUserId:p})}function Je(e){return $o(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))}function qo(){return{sessions:Je().map(e=>({kind:"store",store:e.store,userId:e.userId,scopes:e.scopes,connectedAt:e.acquiredAt,...e.expiresAt?{expiresAt:e.expiresAt}:{},...e.refreshTokenExpiresAt?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...e.associatedUser?{associatedUser:e.associatedUser}:{}}))}}i();i();var Sn=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"2-digit",year:"numeric"});function Ne(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":Sn.format(t)}function _e(e){let t=L(e);if(t)return t.split(".")[0]}function zo(e,t){if(t==="json"){w(JSON.stringify(yn(e),null,2));return}kn(e)}function yn(e){return{sessions:e.sessions.map(Mo),...e.sessions.length===0?{message:Ho()}:{}}}function kn(e){if(e.sessions.length===0){b(Ho());return}ke({rows:e.sessions.map(Mo),columns:{subdomain:{header:"Subdomain"},connected:{header:"Connected"}}})}function Mo(e){return{subdomain:_e(e.store)??e.store,connected:Ne(e.connectedAt)}}function Ho(){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
- `)}var Ye,C=class extends te{async run(){let{flags:t}=await this.parse(Ye),o=qo();zo(o,t.json?"json":"text")}};Ye=C;C.hidden=!0;C.summary="List stores authenticated directly with store auth.";C.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`.";C.description=Ye.descriptionWithoutMarkdown();C.examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --json"];C.flags={...v,...A};var jo=C;i();i();i();function Vo(e,t=300){return e.slice(0,t)}async function Bo(e){let t=`https://${e.store}/admin/oauth/access_token`;l(m`Exchanging authorization code for token at ${d.raw(t)}`);let o=await je(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:_,code:e.code,code_verifier:e.codeVerifier,redirect_uri:e.redirectUri})}),r=await o.text();if(!o.ok)throw l(m`Token exchange failed with HTTP ${d.raw(String(o.status))}: ${d.raw(Vo(r||o.statusText))}`),new s(`Failed to exchange OAuth code for an access token (HTTP ${o.status}).`,r||o.statusText);let n;try{n=JSON.parse(r)}catch{throw new s("Received an invalid token response from Shopify.")}return l(m`Token exchange succeeded: access_token=${d.raw(I(n.access_token))}, refresh_token=${d.raw(n.refresh_token?I(n.refresh_token):"none")}, expires_in=${d.raw(String(n.expires_in??"unknown"))}s, user=${d.raw(String(n.associated_user?.id??"unknown"))} (${d.raw(n.associated_user?.email??"no email")})`),n}async function Go(e){let t=`https://${e.store}/admin/oauth/access_token`;l(m`Refreshing access token for ${d.raw(e.store)} using refresh_token=${d.raw(I(e.refreshToken))}`);let o=await je(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:_,grant_type:"refresh_token",refresh_token:e.refreshToken})}),r=await o.text();if(!o.ok)throw l(m`Token refresh failed with HTTP ${d.raw(String(o.status))}: ${d.raw(Vo(r||o.statusText))}`),new s(`Token refresh failed for ${e.store} (HTTP ${o.status}).`);let n;try{n=JSON.parse(r)}catch{throw new s("Received an invalid refresh response from Shopify.")}if(!n.access_token)throw new s(`Token refresh returned an invalid response for ${e.store}.`);return{accessToken:n.access_token,refreshToken:n.refresh_token,expiresIn:n.expires_in,refreshTokenExpiresIn:n.refresh_token_expires_in}}var wn=`#graphql
1
+ import{a as He,b as Jo}from"./chunk-63NFEXJR.js";import"./chunk-HHA322FT.js";import{a as Be}from"./chunk-TC3JOEMA.js";import"./chunk-XWPPBOGF.js";import{a as dr}from"./chunk-HP3NDE7S.js";import{a as xr}from"./chunk-UGGFSV7N.js";import{a as Tr}from"./chunk-BH34ZLZ4.js";import{a as _r}from"./chunk-YF4HKJB5.js";import{a as nr}from"./chunk-UJVYIWUI.js";import{a as Fr}from"./chunk-4Q54UDO3.js";import{a as yr}from"./chunk-XSXX75VV.js";import{a as kr}from"./chunk-UP7H24B3.js";import{a as Qo,b as Yo,c as lr}from"./chunk-3NMVMCOM.js";import{a as Pr}from"./chunk-ZZ3SMI2A.js";import{a as wr}from"./chunk-32KQKGSY.js";import{a as vr}from"./chunk-QCBAFI6Z.js";import{a as M,b as St,c as br}from"./chunk-TEXYUUTD.js";import{a as sr}from"./chunk-ICHNVDFU.js";import{a as cr}from"./chunk-S442LGHR.js";import"./chunk-FKIVKNOV.js";import{a as ur}from"./chunk-BLI7DUNV.js";import"./chunk-CVRAATZ5.js";import{a as pr}from"./chunk-MSJDZLZT.js";import{a as fr}from"./chunk-3JAC5SI7.js";import{a as Or}from"./chunk-K7I5BGFC.js";import{a as hr}from"./chunk-2MZACB7V.js";import{a as gr}from"./chunk-UQZ7HZ47.js";import"./chunk-G6YOP2SJ.js";import{a as Sr}from"./chunk-DBBU6OVN.js";import"./chunk-4U3NC3UU.js";import{a as er}from"./chunk-P3RGC53U.js";import{a as tr}from"./chunk-U44HRKSU.js";import{a as rr}from"./chunk-RY2ESY3P.js";import{a as or}from"./chunk-P4243GCY.js";import{a as Ar}from"./chunk-N625VE5T.js";import{a as ir}from"./chunk-K2CIMJJW.js";import"./chunk-P375IGKT.js";import{a as ze,b as ar}from"./chunk-WPITBIL5.js";import"./chunk-VUACOGOX.js";import"./chunk-UOHNRH6E.js";import"./chunk-5EVFLUUA.js";import"./chunk-B367FOQA.js";import"./chunk-RBOYWA2D.js";import"./chunk-QHWF3S7U.js";import"./chunk-4LML2QWN.js";import{a as bi}from"./chunk-QJL3SXYA.js";import"./chunk-PFEC2NUB.js";import{a as Ai}from"./chunk-H2JU5BGK.js";import"./chunk-DKVU7LYY.js";import"./chunk-QAM7VCLV.js";import"./chunk-UTLRP527.js";import"./chunk-PK6NOLT5.js";import"./chunk-J3JPJCWP.js";import"./chunk-N5YIZJ4S.js";import"./chunk-Z66NZ2HC.js";import"./chunk-JC3PRJJS.js";import"./chunk-F447QKVX.js";import"./chunk-7KHYEIA7.js";import"./chunk-XA5JA7DK.js";import"./chunk-VNYKNAT5.js";import"./chunk-2IPVQRMI.js";import{b as vi}from"./chunk-J2ZES5K5.js";import"./chunk-6I3FNLT3.js";import"./chunk-O7OQK2OC.js";import"./chunk-235JVI2J.js";import"./chunk-KRZABRYT.js";import"./chunk-LMPD55L6.js";import"./chunk-H3V6Y5JO.js";import"./chunk-DQOS54HN.js";import"./chunk-AP6FNGTA.js";import"./chunk-FA25RL4G.js";import"./chunk-52H2R2FU.js";import"./chunk-FJOEHMXM.js";import"./chunk-STJ3LWFL.js";import"./chunk-XZWAX4FI.js";import"./chunk-7ZIO3X22.js";import{a as q,b as Po,c as te,d as ge,e as Ue}from"./chunk-JGN7YG5X.js";import"./chunk-PVD544NN.js";import"./chunk-ROQXPIEZ.js";import"./chunk-IE4SSSXU.js";import"./chunk-BCEWCYZD.js";import"./chunk-Q7BOSHWX.js";import"./chunk-UFGDNIYX.js";import"./chunk-ICXHUPP5.js";import"./chunk-6LTJMYUD.js";import"./chunk-VE35YELD.js";import"./chunk-57IRHKV3.js";import"./chunk-TU47HMTL.js";import"./chunk-ZKBWEHIY.js";import"./chunk-TYMYIUIQ.js";import"./chunk-UTPJAU5S.js";import"./chunk-ZFOWAMFK.js";import"./chunk-LXZM6Z4F.js";import"./chunk-ZI7LK3LW.js";import{a as Nr}from"./chunk-2ROG5NK3.js";import{a as Eo}from"./chunk-SF53RKMO.js";import{a as No}from"./chunk-AYSS2ERL.js";import{a as Oo}from"./chunk-RY5CY3ZW.js";import"./chunk-GCN4O7HM.js";import{a as wo}from"./chunk-2VUG6LRN.js";import{a as Xo}from"./chunk-7DYZVU7H.js";import"./chunk-Z2Y6G2QF.js";import"./chunk-KZDI2BXR.js";import{a as Zo}from"./chunk-AYKRKE6O.js";import{a as mr}from"./chunk-YJAX22JK.js";import"./chunk-3OE5HXHO.js";import{a as Ie,b as Fo,c as Se,e as ye,f as Ee,g as Co,h as Do,i as Lo,j as Ro,k as qo,l as $o,m as Me,n as Uo,o as Mo,p as zo,q as Ho,r as Bo,s as Go}from"./chunk-WU6GIY22.js";import"./chunk-E4GW6OXT.js";import"./chunk-PLHJQQVZ.js";import"./chunk-6V37CHBZ.js";import"./chunk-E64BQS4D.js";import{a as Ao}from"./chunk-KESQOMEW.js";import{a as ko}from"./chunk-663TS34D.js";import{a as ho}from"./chunk-XXUWTD7A.js";import{a as yo}from"./chunk-VKFDDZD3.js";import"./chunk-N4LCWB56.js";import{a as go}from"./chunk-IFVYCKX5.js";import"./chunk-RUKK4KXX.js";import"./chunk-VUMUCNI7.js";import{a as So}from"./chunk-SY2AH7C2.js";import"./chunk-I3Y6XTKN.js";import{a as _o}from"./chunk-7EOQVQND.js";import{a as To}from"./chunk-PH7F4BMG.js";import"./chunk-4EYTWWYF.js";import{a as mo}from"./chunk-V66IHWQO.js";import"./chunk-J5U2FUIX.js";import{a as ao}from"./chunk-GOAKZ2IL.js";import{a as lo}from"./chunk-24RF5KN3.js";import{a as po}from"./chunk-3JZKWK2V.js";import{a as Io}from"./chunk-KNEF6NAG.js";import{a as fo}from"./chunk-ZZWSMRKT.js";import{a as vo}from"./chunk-WFB3FHKV.js";import{a as bo}from"./chunk-QRETBFXI.js";import"./chunk-BBATKR3B.js";import{a as Ir}from"./chunk-5A7EMVAP.js";import{t as Ko}from"./chunk-KJQAJUDU.js";import"./chunk-KUKYAIOR.js";import"./chunk-VDN6MEYI.js";import"./chunk-VJEKDBGZ.js";import"./chunk-V774I3FW.js";import{a as Vo,b as jo,d as Wo}from"./chunk-UEC23KAO.js";import"./chunk-7BVXGS44.js";import"./chunk-F3TMLDLC.js";import"./chunk-IWOTLFOY.js";import{e as ce}from"./chunk-TGM7L6RV.js";import"./chunk-NJLSZS27.js";import"./chunk-BVHBMOIB.js";import"./chunk-BNX4MZMV.js";import{a as Er}from"./chunk-A2O3MBPH.js";import"./chunk-2MDFREEW.js";import{a as Ii}from"./chunk-YT3NPMWK.js";import{G as C,P as L,ea as le,fa as se,g as ki,n as mt,na as ft,o as pt,pa as de,v as lt,z as E}from"./chunk-3EQY5B4S.js";import"./chunk-ZDF5N422.js";import"./chunk-MPW2YJWU.js";import"./chunk-HX3TALXV.js";import"./chunk-TM534QSE.js";import{a as dt}from"./chunk-Q3WOWDUU.js";import{d as _i}from"./chunk-TKW3Z7XL.js";import"./chunk-WTYH2O47.js";import{a as xo}from"./chunk-ABCU552E.js";import{a as uo}from"./chunk-JZVNNQWE.js";import{a as wi}from"./chunk-GDHD3TGC.js";import"./chunk-T7KHS6RF.js";import{a as so,b as y,c as _,d as co}from"./chunk-S5JJL3BP.js";import{c as Ge,d as Ti}from"./chunk-DLZPP33V.js";import{b as Yt}from"./chunk-BU7R7NFL.js";import{b as he}from"./chunk-74IG3ZE3.js";import"./chunk-WW7TENNA.js";import{a as Qt,c as pe}from"./chunk-5C7HDTHJ.js";import{B as eo,C as fe,E as R,F as to,I as oo,J as $e,P as no,a as Wt,u as T,v as b,w as _e,x as Z,y as Xt,z as Zt}from"./chunk-YYLEWVO6.js";import"./chunk-EJDWYASP.js";import"./chunk-RJ5VF3QY.js";import"./chunk-7UNQOKZW.js";import"./chunk-GB3YC4TI.js";import"./chunk-7HZG7FBK.js";import{d as Jt,e as Kt}from"./chunk-N5U5Q2MG.js";import{c as ro,d,g as ee}from"./chunk-AUZCENYI.js";import{Fb as s,Hb as c,Lb as v,Mb as P,N as Vt,Ob as io,Pb as f,Qb as ht,Rb as gt,Ta as Te,W as jt,_ as Ae,ca as ct,ha as ut,ma as xe,ua as Re}from"./chunk-BXDZX3BS.js";import{u as qe}from"./chunk-A4SBXDZB.js";import"./chunk-NJOO5XJV.js";import"./chunk-ZG7BVVT2.js";import"./chunk-2O22LZKV.js";import"./chunk-MGPLKG23.js";import"./chunk-NNOSZ447.js";import{f as ie}from"./chunk-773TIA5M.js";import{a as ke,b as xi}from"./chunk-LKZ7ARYS.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-636CTEW7.js";import{r as ae}from"./chunk-T6CC5WUU.js";import"./chunk-UQWFDL3F.js";import"./chunk-I5A6BPCP.js";import"./chunk-CX5CC6P5.js";import"./chunk-ET2CGROE.js";import"./chunk-TOLPNBZK.js";import"./chunk-CRALWNNO.js";import{e as U,g as n}from"./chunk-VKWPEFWQ.js";n();var Si=U(wi(),1);n();n();n();n();function yt(e){return Po(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))}function Cr(){return{sessions:yt().map(e=>({kind:"store",store:e.store,userId:e.userId,scopes:e.scopes,connectedAt:e.acquiredAt,...e.expiresAt?{expiresAt:e.expiresAt}:{},...e.refreshTokenExpiresAt?{refreshTokenExpiresAt:e.refreshTokenExpiresAt}:{},...e.associatedUser?{associatedUser:e.associatedUser}:{}}))}}n();n();var Ei=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",month:"short",day:"2-digit",year:"numeric"});function Ve(e){let t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":Ei.format(t)}function je(e){let t=M(e);if(t)return t.split(".")[0]}function Dr(e,t){if(t==="json"){v(JSON.stringify(Ni(e),null,2));return}Oi(e)}function Ni(e){return{sessions:e.sessions.map(Lr),...e.sessions.length===0?{message:Rr()}:{}}}function Oi(e){if(e.sessions.length===0){P(Rr());return}fe({rows:e.sessions.map(Lr),columns:{subdomain:{header:"Subdomain"},connected:{header:"Connected"}}})}function Lr(e){return{subdomain:je(e.store)??e.store,connected:Ve(e.connectedAt)}}function Rr(){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
+ `)}var kt,z=class extends he{async run(){let{flags:t}=await this.parse(kt),o=Cr();Dr(o,t.json?"json":"text")}};kt=z;z.summary="List stores authenticated directly with store auth.";z.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`.";z.description=kt.descriptionWithoutMarkdown();z.examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --json"];z.flags={...y,..._};var qr=z;n();n();n();var $r=13387,We="/auth/callback";function Ur(e){return`http://127.0.0.1:${e}${We}`}function F(e){return e.length<=10?"***":`${e.slice(0,10)}***`}n();function Mr(e,t=300){return e.slice(0,t)}async function zr(e){let t=`https://${e.store}/admin/oauth/access_token`;f(c`Exchanging authorization code for token at ${s.raw(t)}`);let o=await mt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:q,code:e.code,code_verifier:e.codeVerifier,redirect_uri:e.redirectUri})}),r=await o.text();if(!o.ok)throw f(c`Token exchange failed with HTTP ${s.raw(String(o.status))}: ${s.raw(Mr(r||o.statusText))}`),new d(`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 d("Received an invalid token response from Shopify.")}return f(c`Token exchange succeeded: access_token=${s.raw(F(i.access_token))}, refresh_token=${s.raw(i.refresh_token?F(i.refresh_token):"none")}, expires_in=${s.raw(String(i.expires_in??"unknown"))}s, user=${s.raw(String(i.associated_user?.id??"unknown"))} (${s.raw(i.associated_user?.email??"no email")})`),i}async function Hr(e){let t=`https://${e.store}/admin/oauth/access_token`;f(c`Refreshing access token for ${s.raw(e.store)} using refresh_token=${s.raw(F(e.refreshToken))}`);let o=await mt(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:q,grant_type:"refresh_token",refresh_token:e.refreshToken})}),r=await o.text();if(!o.ok)throw f(c`Token refresh failed with HTTP ${s.raw(String(o.status))}: ${s.raw(Mr(r||o.statusText))}`),new d(`Token refresh failed for ${e.store} (HTTP ${o.status}).`);let i;try{i=JSON.parse(r)}catch{throw new d("Received an invalid refresh response from Shopify.")}if(!i.access_token)throw new d(`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 Pi=`#graphql
3
3
  query CurrentAppInstallationAccessScopes {
4
4
  currentAppInstallation {
5
5
  accessScopes {
@@ -7,7 +7,7 @@ import{a as Ae}from"./chunk-J5BRKYGE.js";import{a as ve,b as Zt}from"./chunk-BQW
7
7
  }
8
8
  }
9
9
  }
10
- `;async function Qo(e){l(m`Fetching current app installation scopes for ${d.raw(e.store)} using token ${d.raw(I(e.accessToken))}`);let t=await W({query:wn,api:"Admin",url:K(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]:[])}i();i();function vn(e,t){return{command:`shopify store auth --store ${e} --scopes ${t}`}}function Ke(e,t){return[[vn(e,t)]]}function Wo(e){throw new s(`No stored app authentication found for ${e}.`,"To create stored auth for this store, run:",Ke(e,"<comma-separated-scopes>"))}function V(e,t,o){throw new s(e,"To re-authenticate, run:",Ke(t,o))}function Jo(e){return new s("OAuth callback store does not match the requested store.",`Shopify returned ${e} during authentication. Re-run using the permanent store domain:`,Ke(e,"<comma-separated-scopes>"))}import{timingSafeEqual as An}from"crypto";import{createServer as bn}from"http";function Yo(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 Br(e){f(c`Fetching current app installation scopes for ${s.raw(e.store)} using token ${s.raw(F(e.accessToken))}`);let t=await se({query:Pi,api:"Admin",url:ce(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 wt="<comma-separated-scopes>";function Gr(e,t){return{command:`shopify store auth --store ${e} --scopes ${t}`}}function Fi(e){return[[Gr(e,wt)]]}function Vr(e,t,o){return[["Run",Gr(e,t),o]]}function Ci(e){return e.kind==="preview"?wt:e.scopes.join(",")}function jr(e){throw new d(`No stored app authentication found for ${e}.`,void 0,Vr(e,wt,"to authenticate"))}function Ne(e,t){throw new d(e,void 0,Vr(t.store,Ci(t),"to re-authenticate"))}function Qe(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.`;Ne(t,e)}function Wr(e){return new d("OAuth callback store does not match the requested store.",`Shopify returned ${e} during authentication. Re-run using the permanent store domain:`,Fi(e))}import{timingSafeEqual as Di}from"crypto";import{createServer as Li}from"http";function Qr(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,16 +76,29 @@ import{a as Ae}from"./chunk-J5BRKYGE.js";import{a as ve,b as Zt}from"./chunk-BQW
76
76
  </main>
77
77
  </div>
78
78
  </body>
79
- </html>`}async function Ko({store:e,state:t,port:o,timeoutMs:r=300*1e3,onListening:n}){let a=N(e);return new Promise((c,u)=>{let p=!1,f=!1,T=setTimeout(()=>{U(new s("Timed out waiting for OAuth callback."))},r),g=bn((k,h)=>{let Ue=new URL(k.url??"/",`http://127.0.0.1:${o}`);if(Ue.pathname!==xe){h.statusCode=404,h.end("Not found");return}let{searchParams:fe}=Ue,de=(qe,tn)=>{let pt=typeof qe=="string"?new s(qe,tn):qe;h.statusCode=400,h.setHeader("Content-Type","text/html"),h.setHeader("Connection","close"),h.once("finish",()=>U(pt)),h.end(Yo("Authentication failed",pt.message))},Le=fe.get("shop");if(l(m`Received OAuth callback for shop ${d.raw(Le??"unknown")}`),!Le){de("OAuth callback store does not match the requested store.");return}let dt=N(Le);if(dt!==a){de(Jo(dt));return}let ut=fe.get("state");if(!ut||!xn(ut,t)){de("OAuth callback state does not match the original request.");return}let mt=fe.get("error");if(mt){de(`Shopify returned an OAuth error: ${mt}`);return}let $e=fe.get("code");if(!$e){de("OAuth callback did not include an authorization code.");return}l(m`Received authorization code ${d.raw(I($e))}`),h.statusCode=200,h.setHeader("Content-Type","text/html"),h.setHeader("Connection","close"),h.once("finish",()=>y(()=>c($e))),h.end(Yo("Authentication succeeded","Close this window and return to the terminal"))}),y=k=>{if(p)return;p=!0,clearTimeout(T);let h=()=>{k()};if(!f){h();return}g.close(()=>{f=!1,h()}),g.closeIdleConnections?.()},U=k=>{y(()=>u(k))};g.on("error",k=>{if(k.code==="EADDRINUSE"){U(new s(`Port ${o} is already in use.`,`Free port ${o} and re-run ${d.genericShellCommand(`shopify store auth --store ${e} --scopes <comma-separated-scopes>`).value}. Ensure that redirect URI is allowed in the app configuration.`));return}U(k)}),g.listen(o,"127.0.0.1",()=>{f=!0,l(m`PKCE callback server listening on http://127.0.0.1:${d.raw(String(o))}${d.raw(xe)}`),n&&Promise.resolve(n()).catch(k=>{U(k instanceof Error?k:new Error(String(k)))})})})}function xn(e,t){return e.length!==t.length?!1:An(Buffer.from(e,"utf8"),Buffer.from(t,"utf8"))}i();import{createHash as Nn,randomBytes as _n}from"crypto";function In(){return _n(32).toString("base64url")}function En(e){return Nn("sha256").update(e).digest("base64url")}function On(e){let t=new URLSearchParams;return t.set("client_id",_),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 Xo(e){let{store:t,scopes:o,exchangeCodeForToken:r}=e,n=13387,a=X(),c=Uo(n),u=In(),p=En(u),f=On({store:t,scopes:o,state:a,redirectUri:c,codeChallenge:p});return l(m`Starting PKCE auth for ${d.raw(t)} with scopes ${d.raw(o.join(","))} (redirect_uri=${d.raw(c)})`),{authorization:{store:t,scopes:o,state:a,port:n,redirectUri:c,authorizationUrl:f,codeVerifier:u},waitForAuthCodeOptions:{store:t,state:a,port:n},exchangeCodeForToken:T=>r({store:t,code:T,codeVerifier:u,redirectUri:c})}}i();function Ze(e){let t=e.split(/[ ,]+/).filter(Boolean);if(t.length===0)throw new s("At least one scope is required.","Pass --scopes as a comma-separated list.");return lt(t)}function Xe(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 Zo(e,t){let o=[...t],r=Xe(t);for(let n of e)if(!r.has(n)){o.push(n);for(let a of Xe([n]))r.add(a)}return o}function er(e,t){if(!e.scope)return l(m`Token response did not include scope; falling back to requested scopes`),t;let o=Ze(e.scope),r=Xe(o),n=t.filter(a=>!r.has(a));if(n.length>0)throw new s("Shopify granted fewer scopes than were requested.",`Missing scopes: ${n.join(", ")}.`,["Update the app or store installation scopes.","See https://shopify.dev/app/scopes","Re-run shopify store auth."]);return o}i();i();var Pn=240*1e3;function Cn(e){if(!e.expiresAt)return!1;let t=new Date(e.expiresAt).getTime();return Number.isNaN(t)?!0:t-Pn<Date.now()}function Fn(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 se(e){let t=ne(e);if(t||Wo(e),l(m`Loaded stored session for ${d.raw(e)}: token=${d.raw(I(t.accessToken))}, expires=${d.raw(t.expiresAt??"unknown")}`),!Cn(t))return t;t.refreshToken||V(`No refresh token stored for ${t.store}.`,t.store,t.scopes.join(",")),l(m`Refreshing expired token for ${d.raw(t.store)} (expired at ${d.raw(t.expiresAt??"unknown")}, refresh_token=${d.raw(I(t.refreshToken))})`);let o=t.accessToken,r;try{r=await Go({store:t.store,refreshToken:t.refreshToken})}catch(n){throw ae(t.store,t.userId),n instanceof s&&n.message.startsWith(`Token refresh failed for ${t.store} (HTTP `)&&V(n.message,t.store,t.scopes.join(",")),n instanceof s&&n.message===`Token refresh returned an invalid response for ${t.store}.`&&V(n.message,t.store,t.scopes.join(",")),n instanceof s&&n.message==="Received an invalid refresh response from Shopify.",n}return t=Fn(t,r),l(m`Token refresh succeeded for ${d.raw(t.store)}: ${d.raw(I(o))} → ${d.raw(I(t.accessToken))}, new expiry ${d.raw(t.expiresAt??"unknown")}`),ie(t),t}function tr(e,t=300){return e.slice(0,t)}function Dn(e){if(e&&typeof e=="object"&&"response"in e){let t=e.response,o=t?.status,r=t?.errors;if(typeof o=="number"){let n=typeof r=="string"?r:JSON.stringify(r);return tr(n?`HTTP ${o}: ${n}`:`HTTP ${o}`)}}return tr(e instanceof Error?e.message:String(e))}async function or(e){let t=N(e),o=ne(t);if(!o)return{scopes:[],authoritative:!0};try{let r=await se(t),n=await Qo({store:r.store,accessToken:r.accessToken});return l(m`Resolved current remote scopes for ${d.raw(t)}: ${d.raw(n.join(",")||"none")}`),{scopes:n,authoritative:!0}}catch(r){if(r instanceof Error)return l(m`Falling back to locally stored scopes for ${d.raw(t)} after remote scope lookup failed: ${d.raw(Dn(r))}`),{scopes:o.scopes,authoritative:!1};throw r}}i();function Rn(e){return JSON.stringify(e,null,2)}function Un(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 Ln(){b("Shopify CLI will open the app authorization page in your browser."),b("")}function $n(e){b("Browser did not open automatically. Open this URL manually:"),b(m`${d.link(e)}`),b("")}function qn(e,t="text"){if(t==="json"){w(Rn(e));return}let o=Un(e);o.completed.forEach(r=>Nt(r)),o.info.forEach(r=>b(r))}function Ie(e="text"){return{openingBrowser:Ln,manualAuthUrl:$n,success(t){qn(t,e)}}}i();async function E(e,t,o){await yt(()=>({store_fqdn:e})),await St(()=>({store_fqdn_hash:gt(e),store_fqdn_validated:t,store_domain:e,store_id:ft(o)}))}var zn={openURL:xt,waitForStoreAuthCode:Ko,exchangeStoreAuthCodeForToken:Bo,resolveExistingScopes:or,presenter:Ie("text")};async function rr(e,t={}){let o={...zn,...t},r=N(e.store);await E(r,!1);let n=Ze(e.scopes),a=await o.resolveExistingScopes(r),c=Zo(n,a.scopes),u=a.authoritative?c:n;a.scopes.length>0&&l(m`Merged requested scopes ${d.raw(n.join(","))} with existing scopes ${d.raw(a.scopes.join(","))} for ${d.raw(r)}`);let p=Xo({store:r,scopes:c,exchangeCodeForToken:o.exchangeStoreAuthCodeForToken}),{authorization:{authorizationUrl:f}}=p;o.presenter.openingBrowser();let T=await o.waitForStoreAuthCode({...p.waitForAuthCodeOptions,onListening:async()=>{await o.openURL(f)||o.presenter.manualAuthUrl(f)}}),g=await p.exchangeCodeForToken(T);await E(r,!0);let y=g.associated_user?.id?.toString();if(!y)throw new s("Shopify did not return associated user information for the online access token.");H(y);let U=Date.now(),k=g.expires_in?new Date(U+g.expires_in*1e3).toISOString():void 0,h={store:r,userId:y,scopes:er(g,u),acquiredAt:new Date(U).toISOString(),expiresAt:k,refreshTokenExpiresAt:g.refresh_token_expires_in?new Date(U+g.refresh_token_expires_in*1e3).toISOString():void 0,hasRefreshToken:!!g.refresh_token,associatedUser:g.associated_user?{id:g.associated_user.id,email:g.associated_user.email,firstName:g.associated_user.first_name,lastName:g.associated_user.last_name,accountOwner:g.associated_user.account_owner}:void 0};return ie({store:r,clientId:_,userId:y,accessToken:g.access_token,refreshToken:g.refresh_token,scopes:h.scopes,acquiredAt:h.acquiredAt,expiresAt:k,refreshTokenExpiresAt:h.refreshTokenExpiresAt,associatedUser:h.associatedUser}),l(m`Session persisted for ${d.raw(r)} (user ${d.raw(y)}, expires ${d.raw(k??"unknown")})`),o.presenter.success(h),h}i();var x=class extends te{};i();var Ee=Q(me(),1);function Mn(e){return Ee.Flags.string({description:"Two-letter country code for the store, such as US, CA, or GB.",env:e,required:!1,parse:async t=>t.trim().toUpperCase()})}function nr(e){return/^[A-Z]{2}$/.test(e)}var ir={country:Mn("SHOPIFY_FLAG_PREVIEW_STORE_COUNTRY")},F={store:Ee.Flags.string({char:"s",description:"The myshopify.com domain of the store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>N(e),required:!0}),"organization-id":Ee.Flags.integer({description:"The numeric organization ID. Auto-selects if you belong to a single organization.",env:"SHOPIFY_FLAG_ORGANIZATION_ID"})};var ar=Q(me(),1),et,$=class extends x{async run(){let{flags:t}=await this.parse(et);await rr({store:t.store,scopes:t.scopes},{presenter:Ie(t.json?"json":"text")})}};et=$;$.summary="Authenticate an app against a store for store commands.";$.descriptionWithMarkdown=`Authenticates the app against the specified store for store commands and stores an online access token for later reuse.
79
+ </html>`}async function Yr({store:e,state:t,port:o,timeoutMs:r=300*1e3,onListening:i}){let a=E(e);return new Promise((u,m)=>{let l=!1,h=!1,A=setTimeout(()=>{I(new d("Timed out waiting for OAuth callback."))},r),g=Li((p,S)=>{let nt=new URL(p.url??"/",`http://127.0.0.1:${o}`);if(nt.pathname!==We){S.statusCode=404,S.end("Not found");return}let{searchParams:Le}=nt,be=(st,yi)=>{let Gt=typeof st=="string"?new d(st,yi):st;S.statusCode=400,S.setHeader("Content-Type","text/html"),S.setHeader("Connection","close"),S.once("finish",()=>I(Gt)),S.end(Qr("Authentication failed",Gt.message))},it=Le.get("shop");if(f(c`Received OAuth callback for shop ${s.raw(it??"unknown")}`),!it){be("OAuth callback store does not match the requested store.");return}let zt=E(it);if(zt!==a){be(Wr(zt));return}let Ht=Le.get("state");if(!Ht||!Ri(Ht,t)){be("OAuth callback state does not match the original request.");return}let Bt=Le.get("error");if(Bt){be(`Shopify returned an OAuth error: ${Bt}`);return}let at=Le.get("code");if(!at){be("OAuth callback did not include an authorization code.");return}f(c`Received authorization code ${s.raw(F(at))}`),S.statusCode=200,S.setHeader("Content-Type","text/html"),S.setHeader("Connection","close"),S.once("finish",()=>x(()=>u(at))),S.end(Qr("Authentication succeeded","Close this window and return to the terminal"))}),x=p=>{if(l)return;l=!0,clearTimeout(A);let S=()=>{p()};if(!h){S();return}g.close(()=>{h=!1,S()}),g.closeIdleConnections?.()},I=p=>{x(()=>m(p))};g.on("error",p=>{if(p.code==="EADDRINUSE"){I(new d(`Port ${o} is already in use.`,`Free port ${o} and re-run ${s.genericShellCommand(`shopify store auth --store ${e} --scopes <comma-separated-scopes>`).value}. Ensure that redirect URI is allowed in the app configuration.`));return}I(p)}),g.listen(o,"127.0.0.1",()=>{h=!0,f(c`PKCE callback server listening on http://127.0.0.1:${s.raw(String(o))}${s.raw(We)}`),i&&Promise.resolve(i()).catch(p=>{I(p instanceof Error?p:new Error(String(p)))})})})}function Ri(e,t){return e.length!==t.length?!1:Di(Buffer.from(e,"utf8"),Buffer.from(t,"utf8"))}n();import{createHash as qi,randomBytes as $i}from"crypto";function Ui(){return $i(32).toString("base64url")}function Mi(e){return qi("sha256").update(e).digest("base64url")}function zi(e){let t=new URLSearchParams;return t.set("client_id",q),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"),e.signup&&t.set("signup",e.signup),`https://${e.store}/admin/oauth/authorize?${t.toString()}`}function Jr(e){let{store:t,scopes:o,signup:r,exchangeCodeForToken:i}=e,a=$r,u=pe(),m=Ur(a),l=Ui(),h=Mi(l),A=zi({store:t,scopes:o,state:u,redirectUri:m,codeChallenge:h,signup:r});return f(c`Starting PKCE auth for ${s.raw(t)} with scopes ${s.raw(o.join(","))} (redirect_uri=${s.raw(m)})`),{authorization:{store:t,scopes:o,state:u,port:a,redirectUri:m,authorizationUrl:A,codeVerifier:l,signup:r},waitForAuthCodeOptions:{store:t,state:u,port:a},exchangeCodeForToken:g=>i({store:t,code:g,codeVerifier:l,redirectUri:m})}}n();function bt(e){let t=e.split(/[ ,]+/).filter(Boolean);if(t.length===0)throw new d("At least one scope is required.","Pass --scopes as a comma-separated list.");return Vt(t)}function vt(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 Kr(e,t){let o=[...t],r=vt(t);for(let i of e)if(!r.has(i)){o.push(i);for(let a of vt([i]))r.add(a)}return o}function Xr(e,t){if(!e.scope)return f(c`Token response did not include scope; falling back to requested scopes`),t;let o=bt(e.scope),r=vt(o),i=t.filter(a=>!r.has(a));if(i.length>0)throw new d("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 Hi=240*1e3;function Bi(e){if(!e.expiresAt)return!1;let t=new Date(e.expiresAt).getTime();return Number.isNaN(t)?!0:t-Hi<Date.now()}function Gi(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 D(e){let t=te(e);if(t||jr(e),f(c`Loaded stored session for ${s.raw(e)}: token=${s.raw(F(t.accessToken))}, expires=${s.raw(t.expiresAt??"unknown")}`),!Bi(t))return t;t.refreshToken||Ne(`No refresh token stored for ${t.store}.`,t),f(c`Refreshing expired token for ${s.raw(t.store)} (expired at ${s.raw(t.expiresAt??"unknown")}, refresh_token=${s.raw(F(t.refreshToken))})`);let o=t.accessToken,r;try{r=await Hr({store:t.store,refreshToken:t.refreshToken})}catch(i){throw Ue(t.store,t.userId),i instanceof d&&i.message.startsWith(`Token refresh failed for ${t.store} (HTTP `)&&Ne(i.message,t),i instanceof d&&i.message===`Token refresh returned an invalid response for ${t.store}.`&&Ne(i.message,t),i instanceof d&&i.message==="Received an invalid refresh response from Shopify.",i}return t=Gi(t,r),f(c`Token refresh succeeded for ${s.raw(t.store)}: ${s.raw(F(o))} → ${s.raw(F(t.accessToken))}, new expiry ${s.raw(t.expiresAt??"unknown")}`),ge(t),t}function Zr(e,t=300){return e.slice(0,t)}function Vi(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 Zr(i?`HTTP ${o}: ${i}`:`HTTP ${o}`)}}return Zr(e instanceof Error?e.message:String(e))}async function en(e){let t=E(e),o=te(t);if(!o)return{scopes:[],authoritative:!0};try{let r=await D(t),i=await Br({store:r.store,accessToken:r.accessToken});return f(c`Resolved current remote scopes for ${s.raw(t)}: ${s.raw(i.join(",")||"none")}`),{scopes:i,authoritative:!0}}catch(r){if(r instanceof Error)return f(c`Falling back to locally stored scopes for ${s.raw(t)} after remote scope lookup failed: ${s.raw(Vi(r))}`),{scopes:o.scopes,authoritative:!1};throw r}}n();function ji(e){return JSON.stringify(e,null,2)}function Wi(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 Qi(){P("Shopify CLI will open the app authorization page in your browser."),P("")}function Yi(e){P("Browser did not open automatically. Open this URL manually:"),P(c`${s.link(e)}`),P("")}function Ji(e,t="text"){if(t==="json"){v(ji(e));return}let o=Wi(e);o.completed.forEach(r=>io(r)),o.info.forEach(r=>P(r))}function we(e="text"){return{openingBrowser:Qi,manualAuthUrl:Yi,success(t){Ji(t,e)}}}n();async function N(e,t,o){await Kt(()=>({store_fqdn:e})),await Jt(()=>({store_fqdn_hash:Qt(e),store_fqdn_validated:t,store_domain:e,store_id:jt(o)}))}var Ki={openURL:$e,waitForStoreAuthCode:Yr,exchangeStoreAuthCodeForToken:zr,resolveExistingScopes:en,getCurrentStoredStoreAppSession:te,presenter:we("text")};async function Ye(e,t={}){let o={...Ki,...t},r=E(e.store);Xi(r,o),await N(r,!1);let i=bt(e.scopes),a=await o.resolveExistingScopes(r),u=Kr(i,a.scopes),m=a.authoritative?u:i;a.scopes.length>0&&f(c`Merged requested scopes ${s.raw(i.join(","))} with existing scopes ${s.raw(a.scopes.join(","))} for ${s.raw(r)}`);let l=Jr({store:r,scopes:u,signup:e.signup,exchangeCodeForToken:o.exchangeStoreAuthCodeForToken}),{authorization:{authorizationUrl:h}}=l;o.presenter.openingBrowser();let A=await o.waitForStoreAuthCode({...l.waitForAuthCodeOptions,onListening:async()=>{await o.openURL(h)||o.presenter.manualAuthUrl(h)}}),g=await l.exchangeCodeForToken(A);await N(r,!0);let x=g.associated_user?.id?.toString();if(!x)throw new d("Shopify did not return associated user information for the online access token.");C(x);let I=Date.now(),p=g.expires_in?new Date(I+g.expires_in*1e3).toISOString():void 0,S={store:r,userId:x,scopes:Xr(g,m),acquiredAt:new Date(I).toISOString(),expiresAt:p,refreshTokenExpiresAt:g.refresh_token_expires_in?new Date(I+g.refresh_token_expires_in*1e3).toISOString():void 0,hasRefreshToken:!!g.refresh_token,associatedUser:g.associated_user?{id:g.associated_user.id,email:g.associated_user.email,firstName:g.associated_user.first_name,lastName:g.associated_user.last_name,accountOwner:g.associated_user.account_owner}:void 0};return ge({store:r,clientId:q,userId:x,accessToken:g.access_token,refreshToken:g.refresh_token,scopes:S.scopes,acquiredAt:S.acquiredAt,expiresAt:p,refreshTokenExpiresAt:S.refreshTokenExpiresAt,associatedUser:S.associatedUser}),f(c`Session persisted for ${s.raw(r)} (user ${s.raw(x)}, expires ${s.raw(p??"unknown")})`),o.presenter.success(S),S}function Xi(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 d("`store auth` is unavailable for preview stores. Additional Admin API scopes can't be granted.",`The following scopes are available: ${i}.
80
80
 
81
- Re-run this command if the stored token is missing, expires, or no longer has the scopes you need.`;$.description=et.descriptionWithoutMarkdown();$.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"];$.flags={...v,...A,store:F.store,scopes:ar.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0})};var sr=$;i();i();i();function B(e={}){return{type:"token_refresh",handler:async()=>({token:await Hn(e)})}}async function Hn(e){return P([],{noPrompt:e.noPrompt})}i();var cr={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateAppDevelopmentStore"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"shopName"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"priceLookupKey"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"prepopulateTestData"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createAppDevelopmentStore"},arguments:[{kind:"Argument",name:{kind:"Name",value:"shopName"},value:{kind:"Variable",name:{kind:"Name",value:"shopName"}}},{kind:"Argument",name:{kind:"Name",value:"priceLookupKey"},value:{kind:"Variable",name:{kind:"Name",value:"priceLookupKey"}}},{kind:"Argument",name:{kind:"Name",value:"prepopulateTestData"},value:{kind:"Variable",name:{kind:"Name",value:"prepopulateTestData"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shopAdminUrl"}},{kind:"Field",name:{kind:"Name",value:"shopDomain"}},{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"}}]}}]}}]};i();var dr={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"PollStoreCreation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"shopDomain"}},type:{kind:"NonNullType",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:"id"}},{kind:"Field",name:{kind:"Name",value:"storeCreation"},arguments:[{kind:"Argument",name:{kind:"Name",value:"shopDomain"},value:{kind:"Variable",name:{kind:"Name",value:"shopDomain"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var jn=2,Vn=300*1e3;function Bn(e){switch(e){case"CALLING_CORE":return"Initiating store creation...";case"AWAITING_CORE_STORE_READY":return"Waiting for store to be ready...";case"FINALIZING":return"Finalizing store setup...";case"COMPLETE":return"Store creation complete!";case"FAILED":return"Store creation failed.";case"TIMED_OUT":return"Store creation timed out.";case"USER_ERROR":return"Store creation encountered a user error.";default:return`Store creation status: ${e}`}}async function ur(e){let t=await Xt(e.organizationId?.toString()),o=await P(),r=B(),a=(await J({query:cr,token:o,organizationId:t.id,variables:{shopName:e.name,priceLookupKey:"SHOPIFY_PLUS_APP_DEVELOPMENT",prepopulateTestData:!1},unauthorizedHandler:r})).createAppDevelopmentStore;if(!a)throw new s("Store creation failed: unexpected empty response.");let c=a.userErrors;if(c&&c.length>0){let f=c.map(T=>T.message).join(", ");throw new s(`Failed to create development store: ${f}`)}let{shopDomain:u,shopAdminUrl:p}=a;if(!u)throw new s("Store creation succeeded but no shop domain was returned.");await j({title:m`Waiting for store to be ready...`,task:async f=>{let T=Date.now();for(;;){if(Date.now()-T>Vn)throw new s("Store creation timed out after 5 minutes.");let y=(await J({query:dr,token:o,organizationId:t.id,variables:{shopDomain:u},unauthorizedHandler:r})).organization?.storeCreation?.status;if(!y)throw new s("Unable to determine store creation status.");if(y==="COMPLETE")return;if(y==="FAILED"||y==="TIMED_OUT"||y==="USER_ERROR")throw new s(`Store creation failed with status: ${y}`);f(m`${Bn(y)}`),await Tt(jn)}},renderOptions:{stdout:process.stderr}}),e.json?w(JSON.stringify({store:{name:e.name,domain:u,adminUrl:p},organization:{id:t.id,name:t.businessName}},null,2)):Y({headline:`Development store "${e.name}" created successfully.`,body:[`Domain: ${u}`,`Admin: ${p??"N/A"}`]})}var mr=Q(me(),1),tt,q=class extends te{async run(){let{flags:t}=await this.parse(tt);try{await ur({name:t.name,organizationId:t["organization-id"],json:t.json})}catch(o){throw t.json&&o instanceof s&&(w(JSON.stringify({error:!0,message:o.message,nextSteps:o.nextSteps??[],exitCode:1},null,2)),process.exit(1)),o}}};tt=q;q.hidden=!0;q.summary="Create a new development store.";q.descriptionWithMarkdown="Creates a new app development store in your organization.";q.description=tt.descriptionWithoutMarkdown();q.flags={...v,...A,name:mr.Flags.string({description:"Name for the new development store.",required:!0,env:"SHOPIFY_FLAG_STORE_NAME"}),"organization-id":F["organization-id"]};var pr=q;i();i();i();var Gn="X-Shopify-CLI-Instance",Qn="X-Shopify-CLI-Version",ot;function Wn(){return ot??(ot=new ye({projectName:"shopify-cli-store"})),ot}function rt(e=Wn()){let t=e.get("cliInstanceId");if(typeof t=="string"&&t.length>0)return t;let o=X();return e.set("cliInstanceId",o),o}function lr(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":`Shopify CLI; v=${ze}`,[Gn]:e,[Qn]:ze}}function Jn(e){return lr(e)}function fr(e,t){return{...lr(e),authorization:t,"X-Shopify-Access-Token":t}}async function hr(e,t={}){let r=`https://${await Se()}/services/preview-stores`,n=JSON.stringify({...e.name?{name:e.name}:{},...e.country?{variables:{storeCreatePayload:{country:e.country}}}:{}}),a=await ge(r,{method:"POST",headers:Jn(rt(t.storage)),body:n}),c=await a.text();if(!a.ok){let p=Yn(a.status,c);throw new s(p.message,p.tryMessage)}let u;try{u=JSON.parse(c)}catch(p){let f=p instanceof Error?p.message:"Unknown error";throw new s("Preview store creation returned a non-JSON response.",`Parse error: ${f}. Body (truncated): ${Oe(c).slice(0,500)}`)}return Zn(u)}async function gr(e,t={}){let r=`https://${await Se()}/services/preview-stores/${encodeURIComponent(e.shopId)}/claim`,n=JSON.stringify({...e.email?{email:e.email}:{}}),a=await ge(r,{method:"POST",headers:fr(rt(t.storage),e.adminApiToken),body:n}),c=await a.text();if(!a.ok){let p=Kn(a.status,c);throw new s(p.message,p.tryMessage)}let u;try{u=JSON.parse(c)}catch(p){let f=p instanceof Error?p.message:"Unknown error";throw new s("Preview store claim URL request returned a non-JSON response.",`Parse error: ${f}. Body (truncated): ${Oe(c).slice(0,500)}`)}return ei(u)}async function Sr(e,t={}){let r=`https://${await Se()}/services/preview-stores/${e.shopId}`,n=await ge(r,{method:"GET",headers:fr(rt(t.storage),e.adminApiToken)}),a=await n.text();if(!n.ok){let u=Xn(n.status,a);throw new s(u.message,u.tryMessage)}let c;try{c=JSON.parse(a)}catch(u){let p=u instanceof Error?u.message:"Unknown error";throw new s("Preview store lookup returned a non-JSON response.",`Parse error: ${p}. Body (truncated): ${a.slice(0,500)}`)}return ti(c)}function Yn(e,t){let o=nt(t),r=o.error_code,n=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=Oe(t);return{message:`Preview store creation failed with HTTP ${e}.`,tryMessage:n??(a.length>0?a.slice(0,1e3):"No response body returned.")}}function nt(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 Kn(e,t){let o=nt(t),r=Oe(t);return{message:`Preview store claim URL request failed with HTTP ${e}.`,tryMessage:o.message??(r.length>0?r.slice(0,1e3):"No response body returned.")}}function Xn(e,t){let o=nt(t);return{message:`Preview store lookup failed with HTTP ${e}.`,tryMessage:o.message??(t.length>0?t.slice(0,1e3):"No response body returned.")}}function Zn(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,n=typeof t?.domain=="string"?N(t.domain):void 0,a=typeof e.admin_api_token=="string"?e.admin_api_token:void 0,c=typeof e.access_url=="string"?e.access_url:void 0,u=typeof e.placeholder_account_uuid=="string"?e.placeholder_account_uuid:void 0;if(!o||!r||!n||!a||!c)throw new s("Preview store creation response is missing required fields.",`Got: ${JSON.stringify(oi(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:n},adminApiToken:a,accessUrl:c,...u?{placeholderAccountUuid:u}:{}}}function ei(e){let t=typeof e.claim_url=="string"?e.claim_url:void 0;if(!t)throw new s("Preview store claim URL response is missing required fields.",`Got: ${JSON.stringify(ri(e)).slice(0,500)}`);return{claimUrl:t}}function ti(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,n=typeof t?.domain=="string"?N(t.domain):void 0,a=typeof e.access_url=="string"?e.access_url:void 0;if(!o||!r||!n||!a)throw new s("Preview store lookup response is missing required fields.",`Got: ${JSON.stringify(ni(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:n},accessUrl:a}}function oi(e){return{...e,...e.admin_api_token?{admin_api_token:"[REDACTED]"}:{},...e.access_url?{access_url:"[REDACTED]"}:{}}}function ri(e){return{...e,...e.claim_url?{claim_url:"[REDACTED]"}:{}}}function Oe(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 ni(e){return{...e,...e.access_url?{access_url:"[REDACTED]"}:{}}}var ii="preview:",ai={createPreviewStore:hr,setStoredStoreAppSession:ie,recordStoreFqdnMetadata:E,setLastSeenUserId:H,now:()=>new Date};async function yr(e,t={}){let o={...ai,...t},r=await o.createPreviewStore({name:e.name,country:e.country},e.client);return ci(r,e.country,o)}function si(e){return`${ii}${e.placeholderAccountUuid??e.shop.id}`}async function ci(e,t,o){let r=o.now().toISOString(),n=si(e);o.setStoredStoreAppSession({store:e.shop.domain,clientId:_,userId:n,accessToken:e.adminApiToken,scopes:[],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(n);try{await o.recordStoreFqdnMetadata(e.shop.domain,!0,e.shop.id)}catch{}return{status:"success",message:"Your Shopify store 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}}}i();function kr(e,t){if(t==="json"){w(JSON.stringify(di(e),null,2));return}ui(e)}function di(e){return{status:e.status,message:e.message,store:e.store,next_steps:wr(e).map(t=>t.json)}}function wr(e){return[{json:`Open your store (${e.store.storefrontUrl}) to preview the storefront.`,text:["Open ",{link:{label:"your store",url:e.store.storefrontUrl}}," to preview the storefront."]},{json:`Use \`shopify store execute --store ${e.store.subdomain}\` to add products, collections, pages, and more.`,text:["Use ",{command:`shopify store execute --store ${e.store.subdomain}`}," to add products, collections, pages, and more."]},{json:`Use \`shopify theme pull --store ${e.store.subdomain}\` and \`shopify theme push --store ${e.store.subdomain}\` to edit your store design.`,text:["Use ",{command:`shopify theme pull --store ${e.store.subdomain}`}," and ",{command:`shopify theme push --store ${e.store.subdomain}`}," to edit your store design."]}]}function ui(e){Y({headline:"Store created",customSections:[{body:{tabularData:[["Name",e.store.name]],firstColumnSubdued:!0}},{body:e.message},{title:"Next steps",body:{list:{items:wr(e).map(t=>t.text)}}}]})}var vr=Q(me(),1),it,D=class extends x{async run(){let{flags:t}=await this.parse(it);t.country!==void 0&&!nr(t.country)&&this.error("Country must be a two-letter country code, for example: US.");let o=await j({title:m`Creating store…`,task:async()=>yr({name:t.name,country:t.country})});kr(o,t.json?"json":"text")}};it=D;D.hidden=!0;D.summary="Create a preview Shopify store.";D.descriptionWithMarkdown="Creates a new Shopify store, with no need for an existing account.";D.description=it.descriptionWithoutMarkdown();D.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'];D.flags={...v,...A,name:vr.Flags.string({description:"The name of the store.",env:"SHOPIFY_FLAG_PREVIEW_STORE_NAME",required:!1}),country:ir.country};var Ar=D;i();i();i();var br=Q(on(),1);async function mi(e){if(e.query!==void 0){if(!e.query.trim())throw new s("The --query flag value is empty. Please provide a valid GraphQL query or mutation.");return e.query}if(e.queryFile){if(!await He(e.queryFile))throw new s(m`Query file not found at ${d.path(e.queryFile)}. Please check the path and try again.`);let t=await Me(e.queryFile,{encoding:"utf8"});if(!t.trim())throw new s(m`Query file at ${d.path(e.queryFile)} is empty. Please provide a valid GraphQL query or mutation.`);return t}throw new ee("Query should have been provided via --query or --query-file flags due to exactlyOne constraint. This indicates the oclif flag validation failed.")}async function pi(e,t){if(e)try{return JSON.parse(e)}catch(o){let r=o instanceof Error?o.message:"Unknown error";throw new s(m`Invalid JSON in ${d.yellow("--variables")} flag: ${r}`,"Please provide valid JSON format.")}else if(t){if(!await He(t))throw new s(m`Variable file not found at ${d.path(t)}. Please check the path and try again.`);let o=await Me(t,{encoding:"utf8"});try{return JSON.parse(o)}catch(r){let n=r instanceof Error?r.message:"Unknown error";throw new s(m`Invalid JSON in variable file ${d.path(t)}: ${n}`,"Please provide valid JSON format.")}}}function li(e){let t;try{t=(0,br.parse)(e)}catch(r){throw r instanceof Error?new s(`Invalid GraphQL syntax: ${r.message}`):r}let o=t.definitions.filter(r=>r.kind==="OperationDefinition");if(o.length!==1)throw new s("GraphQL document must contain exactly one operation definition. Multiple operations are not supported.");return{operationDefinition:o[0]}}function fi(e){return e.operationDefinition.operation==="mutation"}function hi(e,t=!1){if(fi(e)&&!t)throw new s("Mutations are disabled by default for shopify store execute.","Re-run with --allow-mutations if you intend to modify store data.")}async function xr(e){let t=await mi({query:e.query,queryFile:e.queryFile}),o=li(t);hi(o,e.allowMutations);let r=await pi(e.variables,e.variableFile);return{query:t,parsedOperation:o,parsedVariables:r,requestedVersion:e.version}}i();i();i();i();function Pe(e){if(!e||typeof e!="object"||!("response"in e))return!1;let t=e.response;return!!t&&typeof t=="object"}function Tr(e){if(!Pe(e))return;let t=e.response.status;return typeof t=="number"?t:void 0}var Nr=["the user aborted a request","the operation was aborted"];function gi(e){if(!(e instanceof Error))return!1;if(e.name==="AbortError")return!0;let t=e.message.toLowerCase();return Nr.some(o=>t.includes(o))}function pe(e,t){if(Tr(e)===402)return new s(`The store ${t} is currently unavailable.`,"Check the store in the Shopify admin and try again once it is reactivated.");if(gi(e))return new s(`Request to ${t} was aborted before it completed.`)}function Ce(e,t){let o=Tr(e);o!==401&&o!==404||(ae(t.store,t.userId),V(`Stored app authentication for ${t.store} is no longer valid.`,t.store,t.scopes.join(",")))}var Si=`
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 he{};n();var O=U(ae(),1);function Zi(e){return O.Flags.string({description:"Two-letter country code for the store, such as US, CA, or GB.",env:e,required:!1,parse:async t=>t.trim().toUpperCase()})}function tn(e){return/^[A-Z]{2}$/.test(e)}var on={country:Zi("SHOPIFY_FLAG_STORE_COUNTRY")},w={store:O.Flags.string({char:"s",description:"The myshopify.com domain of the store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>E(e),required:!0}),"organization-id":O.Flags.integer({description:"The numeric organization ID. Auto-selects if you belong to a single organization.",env:"SHOPIFY_FLAG_ORGANIZATION_ID"})},rn={env:"SHOPIFY_FLAG_ID",parse:async e=>Fo(e)},nn=O.Flags.string({...rn,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."}),an=O.Flags.string({...rn,description:"The bulk operation ID to cancel (numeric ID or full GID).",required:!0}),sn={query:O.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":O.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=>ie(e),exactlyOne:["query","query-file"]}),variables:O.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":O.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=>ie(e),exclusive:["variables"]}),watch:O.Flags.boolean({description:"Wait for bulk operation results before exiting. Defaults to false.",env:"SHOPIFY_FLAG_WATCH"}),"output-file":O.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:O.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":O.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};var dn=U(ae(),1),At,H=class extends k{async run(){let{flags:t}=await this.parse(At);await Ye({store:t.store,scopes:t.scopes},{presenter:we(t.json?"json":"text")})}};At=H;H.summary="Authenticate an app against a store for store commands.";H.descriptionWithMarkdown=`Authenticates the app against the specified store for store commands and stores an online access token for later reuse.
82
+
83
+ Re-run this command if the stored token is missing, expires, or no longer has the scopes you need.`;H.description=At.descriptionWithoutMarkdown();H.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"];H.flags={...y,..._,store:w.store,scopes:dn.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0})};var cn=H;n();n();n();function ue(e){let{storeFqdn:t,version:o}=e,r=[`Store: ${t}`];return o&&r.push(`API version: ${o}`),r}function un(e,t=!1){if(ye(e)&&!t)throw new d("Mutations are disabled by default for shopify store bulk execute.","Re-run with --allow-mutations if you intend to modify store data.")}n();async function me(e){let t=await D(e);return await N(t.store,!0),C(t.userId),{token:t.accessToken,storeFqdn:t.store}}async function mn(e){let{store:t,operationId:o}=e,r=await me(t);T({headline:"Canceling bulk operation.",body:[{list:{items:[`ID: ${o}`,...ue({storeFqdn:r.storeFqdn})]}}]});let i=await $o({adminSession:r,operationId:o});if(i?.userErrors?.length){Uo(i.userErrors,"Failed to cancel bulk operation.");return}let a=i?.bulkOperation;if(a){let u=Mo(a),m=a.status==="CANCELING"?[`This may take a few moments. Check the status with:
84
+ `,{command:`shopify store bulk status --id=${Se(a.id)}`}]:u.body,l={headline:u.headline,...m&&{body:m},...u.customSections&&{customSections:u.customSections}};switch(u.renderType){case"success":b(l);break;case"warning":_e(l);break;case"info":T(l);break}}else Z({headline:"Bulk operation not found or could not be canceled.",body:c`ID: ${s.yellow(o)}`.value})}var xt,B=class extends k{async run(){let{flags:t}=await this.parse(xt);await mn({store:t.store,operationId:t.id})}};xt=B;B.summary="Cancel a bulk operation on a store.";B.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.";B.description=xt.descriptionWithoutMarkdown();B.examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];B.flags={...y,store:w.store,id:an};var pn=B;n();n();async function ea(e,t){if(e)return e.join(`
85
+ `);if(t){if(!await Te(t))throw new d(c`Variable file not found at ${s.path(t)}. Please check the path and try again.`);return xe(t,{encoding:"utf8"})}else return}async function fn(e){let{store:t,query:o,variables:r,variableFile:i,outputFile:a,watch:u=!1,version:m,allowMutations:l=!1}=e;un(o,l);let{adminSession:h,version:A}=await R({title:c`Authenticating`,task:async()=>{let p=await me(t),S=await Ee({adminSession:p,userSpecifiedVersion:m,minimumDefaultVersion:Ie});return{adminSession:p,version:S}},renderOptions:{stdout:process.stderr}}),g=await ea(r,i);ta(o,g),T({headline:"Starting bulk operation.",body:[{list:{items:ue({storeFqdn:h.storeFqdn,version:A})}}]});let x=ye(o)?await Lo({adminSession:h,query:o,variablesJsonl:g,version:A}):await Do({adminSession:h,query:o,version:A});if(x?.userErrors?.length){Z({headline:"Error creating bulk operation.",body:{list:{items:x.userErrors.map(p=>p.field?`${p.field.join(".")}: ${p.message}`:p.message)}}});return}let I=x?.bulkOperation;if(I)if(u){let p=new Wt,S=await Ho(h,I.id,p.signal,()=>p.abort());p.signal.aborted?T({headline:`Bulk operation ${S.id} is still running in the background.`,body:Je(S.id)}):await ln(S,a)}else{let p=await zo(h,I.id);["FAILED","CANCELED","EXPIRED"].includes(p.status)?await ln(p,a):b({headline:"Bulk operation is running.",body:Je(p.id),customSections:[{body:[{list:{items:[c`ID: ${s.cyan(p.id)}`.value]}}]}]})}else throw _e({headline:"Bulk operation not created successfully.",body:"This is an unexpected error. Please try again later."}),new ee("Bulk operation response returned null with no error message.")}async function ln(e,t){let o=Me(e).value,i=[{body:[{list:{items:[c`ID: ${s.cyan(e.id)}`.value,c`Status: ${s.yellow(e.status)}`.value,c`Created at: ${s.gray(String(e.createdAt))}`.value,...e.completedAt?[c`Completed at: ${s.gray(String(e.completedAt))}`.value]:[]]}}]}];switch(e.status){case"CREATED":b({headline:"Bulk operation started.",body:Je(e.id),customSections:i});break;case"RUNNING":b({headline:"Bulk operation is running.",body:Je(e.id),customSections:i});break;case"COMPLETED":if(e.url){let a=await Bo(e.url),u=Go(a);t?await Re(t,a):v(a),u?_e({headline:"Bulk operation completed with errors.",body:t?`Results written to ${t}. Check file for error details.`:"Check results for error details.",customSections:i}):b({headline:o,body:t?[`Results written to ${t}`]:void 0,customSections:i})}else b({headline:o,customSections:i});break;case"CANCELED":case"CANCELING":case"EXPIRED":case"FAILED":Z({headline:o,customSections:i});break}}function ta(e,t){if(ye(e)&&!t)throw new d(c`Bulk mutations require variables. Provide a JSONL file with ${s.yellow("--variable-file")} or individual JSON objects with ${s.yellow("--variables")}.`);if(!ye(e)&&t)throw new d(c`The ${s.yellow("--variables")} and ${s.yellow("--variable-file")} flags can only be used with mutations, not queries.`)}function Je(e){return[`Monitor its progress with:
86
+ `,{command:`shopify store bulk status --id=${Se(e)}`}]}var Tt,G=class extends k{async run(){let{flags:t}=await this.parse(Tt),o=await Co({query:t.query,queryFile:t["query-file"]});await fn({store:t.store,query:o,variables:t.variables,variableFile:t["variable-file"],watch:t.watch??!1,outputFile:t["output-file"],allowMutations:t["allow-mutations"],...t.version&&{version:t.version}})}};Tt=G;G.summary="Execute bulk operations on a store.";G.descriptionWithMarkdown=`Executes an Admin API GraphQL query or mutation on the specified store as a bulk operation, using previously stored app authentication.
87
+
88
+ Run \`shopify store auth\` first to create stored auth for the store.
89
+
90
+ Bulk operations allow you to process large amounts of data asynchronously. Learn more about [bulk query operations](https://shopify.dev/docs/api/usage/bulk-operations/queries) and [bulk mutation operations](https://shopify.dev/docs/api/usage/bulk-operations/imports).
91
+
92
+ Mutations are disabled by default. Re-run with \`--allow-mutations\` if you intend to modify store data.
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.`;G.description=Tt.descriptionWithoutMarkdown();G.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"];G.flags={...y,store:w.store,...sn};var hn=G;n();n();async function gn(e){let{store:t,operationId:o}=e,r=await me(t);T({headline:"Checking bulk operation status.",body:[{list:{items:ue({storeFqdn:r.storeFqdn})}}]});let i=await Ro({adminSession:r,operationId:o,version:await Ee({adminSession:r,minimumDefaultVersion:Ie})});i?oa(i):Z({headline:"Bulk operation not found.",body:c`ID: ${s.yellow(o)}`.value})}async function Sn(e){let{store:t}=e,o=await me(t);T({headline:"Listing bulk operations.",body:[{list:{items:ue({storeFqdn:o.storeFqdn})}}]});let i=(await qo({adminSession:o,version:await Ee({adminSession:o,minimumDefaultVersion:Ie})})).map(a=>({id:Se(a.id),status:na(a.status),count:ia(a.objectCount),dateCreated:ct(new Date(String(a.createdAt))),dateFinished:a.completedAt?ct(new Date(String(a.completedAt))):"",results:aa(a.url??a.partialDataUrl)}));gt(),i.length===0?T({body:"No bulk operations found in the last 7 days."}):fe({rows:i,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"}}}),gt()}function oa(e){let{id:t,status:o,createdAt:r,completedAt:i,url:a,partialDataUrl:u}=e,m=Me(e).value,l=ra(r,i),h=c`ID: ${s.yellow(t)}\n${l}`.value;if(o==="COMPLETED"){let A=a?s.link("Download results",a):"";b({headline:m,body:c`${h}\n${A}`.value})}else if(o==="FAILED"){let A=u?s.link("Download partial results",u):"";Z({headline:m,body:c`${h}\n${A}`.value})}else T({headline:m,body:h})}function ra(e,t){let o=new Date;return t?`Finished ${ut(new Date(String(t)),o)}`:`Started ${ut(new Date(String(e)),o)}`}function na(e){return e==="COMPLETED"?qe.green(e):e==="FAILED"?qe.red(e):qe.dim(e)}function ia(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function aa(e){return e?c`${s.link("download",e)}`.value:""}var _t,V=class extends k{async run(){let{flags:t}=await this.parse(_t);t.id?await gn({store:t.store,operationId:t.id}):await Sn({store:t.store})}};_t=V;V.summary="Check the status of bulk operations on a store.";V.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.";V.description=_t.descriptionWithoutMarkdown();V.examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --id 123456789"];V.flags={...y,store:w.store,id:nn};var yn=V;n();var It=U(ae(),1),Et,$=class extends k{async run(){let{flags:t}=await this.parse(Et);await Ye({store:t.store,scopes:t.scopes,signup:t.signup},{presenter:we(t.json?"json":"text")})}};Et=$;$.hidden=!0;$.summary="Authenticate for store commands.";$.descriptionWithMarkdown="Authenticates to a store then stores an online access token for later reuse. Pass the provided JWT to --signup.";$.description=Et.descriptionWithoutMarkdown();$.examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --signup <signup-jwt>","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --scopes read_products,write_products --signup <signup-jwt> --json"];$.flags={...y,..._,store:w.store,scopes:It.Flags.string({description:"Comma-separated Admin API scopes to request for the app.",env:"SHOPIFY_FLAG_SCOPES",required:!0}),signup:It.Flags.string({description:"Provide JWT for the store.",env:"SHOPIFY_FLAG_SIGNUP",required:!0})};var kn=$;n();n();n();function oe(e={}){return{type:"token_refresh",handler:async()=>({token:await sa(e)})}}async function sa(e){return L([],{noPrompt:e.noPrompt})}n();var Nt={basic:"BASIC_APP_DEVELOPMENT",grow:"PROFESSIONAL_APP_DEVELOPMENT",advanced:"UNLIMITED_APP_DEVELOPMENT",plus:"SHOPIFY_PLUS_APP_DEVELOPMENT"},Ke=Object.keys(Nt),wn={basic:"basic",professional:"grow",grow:"grow",unlimited:"advanced",advanced:"advanced",shopify_plus:"plus",plus:"plus"};n();var vn={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"CreateAppDevelopmentStore"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"shopName"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"priceLookupKey"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"prepopulateTestData"}},type:{kind:"NamedType",name:{kind:"Name",value:"Boolean"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"developerPreviewHandle"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"createAppDevelopmentStore"},arguments:[{kind:"Argument",name:{kind:"Name",value:"shopName"},value:{kind:"Variable",name:{kind:"Name",value:"shopName"}}},{kind:"Argument",name:{kind:"Name",value:"priceLookupKey"},value:{kind:"Variable",name:{kind:"Name",value:"priceLookupKey"}}},{kind:"Argument",name:{kind:"Name",value:"prepopulateTestData"},value:{kind:"Variable",name:{kind:"Name",value:"prepopulateTestData"}}},{kind:"Argument",name:{kind:"Name",value:"developerPreviewHandle"},value:{kind:"Variable",name:{kind:"Name",value:"developerPreviewHandle"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"shopAdminUrl"}},{kind:"Field",name:{kind:"Name",value:"shopDomain"}},{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 bn={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"PollStoreCreation"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"shopDomain"}},type:{kind:"NonNullType",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:"id"}},{kind:"Field",name:{kind:"Name",value:"storeCreation"},arguments:[{kind:"Argument",name:{kind:"Name",value:"shopDomain"},value:{kind:"Variable",name:{kind:"Name",value:"shopDomain"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"status"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}}]};var da=2,ca=300*1e3;function ua(e){switch(e){case"CALLING_CORE":return"Initiating store creation...";case"AWAITING_CORE_STORE_READY":return"Waiting for store to be ready...";case"FINALIZING":return"Finalizing store setup...";case"COMPLETE":return"Store creation complete!";case"FAILED":return"Store creation failed.";case"TIMED_OUT":return"Store creation timed out.";case"USER_ERROR":return"Store creation encountered a user error.";default:return`Store creation status: ${e}`}}async function An(e){let{organization:t,name:o,plan:r}=e,i=await L(),a=oe(),m=(await de({query:vn,token:i,organizationId:t.id,variables:{shopName:o,priceLookupKey:Nt[r],prepopulateTestData:e.withDemoData??!1,developerPreviewHandle:e.featurePreview},unauthorizedHandler:a})).createAppDevelopmentStore;if(!m)throw new d("Store creation failed: unexpected empty response.");let l=m.userErrors;if(l&&l.length>0){let g=l.map(x=>x.message).join(", ");throw new d(`Failed to create development store: ${g}`)}let{shopDomain:h,shopAdminUrl:A}=m;if(!h)throw new d("Store creation succeeded but no shop domain was returned.");await R({title:c`Waiting for store to be ready...`,task:async g=>{let x=Date.now();for(;;){if(Date.now()-x>ca)throw new d("Store creation timed out after 5 minutes.");let p=(await de({query:bn,token:i,organizationId:t.id,variables:{shopDomain:h},unauthorizedHandler:a})).organization?.storeCreation?.status;if(!p)throw new d("Unable to determine store creation status.");if(p==="COMPLETE")return;if(p==="FAILED"||p==="TIMED_OUT"||p==="USER_ERROR")throw new d(`Store creation failed with status: ${p}`);g(c`${ua(p)}`),await no(da)}},renderOptions:{stdout:process.stderr}}),e.json?v(JSON.stringify({store:{name:o,domain:h,adminUrl:A,plan:r,...e.featurePreview?{featurePreview:e.featurePreview}:{},demoData:e.withDemoData??!1},organization:{id:t.id,name:t.businessName}},null,2)):b({headline:`Development store "${o}" created successfully.`,body:[`Domain: ${h}`,`Admin: ${A??"N/A"}`,`Plan: ${r}`,...e.featurePreview?[`Feature preview: ${e.featurePreview}`]:[],`Demo data: ${e.withDemoData?"enabled":"disabled"}`]})}n();var ma={basic:"Basic",grow:"Grow",advanced:"Advanced",plus:"Plus"};async function xn(){return to({message:"Name for the new development store"})}async function Tn(){return Zt({message:"Which Shopify plan do you want to use?",choices:Ke.map(e=>({label:ma[e],value:e}))})}var Oe=U(ae(),1),Ot,j=class extends he{async run(){let{flags:t}=await this.parse(Ot);this.failMissingNonTTYFlags(t,["name","organization-id","plan"]);let o=await Wo(t["organization-id"]?.toString()),r=t.name??await xn(),i=t.plan??await Tn();try{await An({name:r,organization:o,plan:i,featurePreview:t["feature-preview"],withDemoData:t["with-demo-data"],json:t.json})}catch(a){throw t.json&&a instanceof d&&(v(JSON.stringify({error:!0,message:a.message,nextSteps:a.nextSteps??[],exitCode:1},null,2)),process.exit(1)),a}}};Ot=j;j.hidden=!0;j.summary="Create a new development store.";j.descriptionWithMarkdown="Creates a new app development store in your organization.";j.description=Ot.descriptionWithoutMarkdown();j.flags={...y,..._,name:Oe.Flags.string({description:"Name for the new development store.",env:"SHOPIFY_FLAG_STORE_NAME"}),"organization-id":w["organization-id"],plan:Oe.Flags.string({description:"The Shopify plan to use for the new development store.",options:Ke,env:"SHOPIFY_FLAG_STORE_PLAN"}),"feature-preview":Oe.Flags.string({description:"The handle of a feature preview to enable on the new development store.",env:"SHOPIFY_FLAG_STORE_FEATURE_PREVIEW"}),"with-demo-data":Oe.Flags.boolean({description:"Populate the new development store with demo data.",default:!1,env:"SHOPIFY_FLAG_STORE_WITH_DEMO_DATA"})};var _n=j;n();n();n();var pa="X-Shopify-CLI-Instance",la="X-Shopify-CLI-Version",Pt;function fa(){return Pt??(Pt=new Yt({projectName:"shopify-cli-store"})),Pt}var Pe=class extends d{constructor(t,o,r){super(o,r??null),this.status=t}};function In(e=fa()){let t=e.get("cliInstanceId");if(typeof t=="string"&&t.length>0)return t;let o=pe();return e.set("cliInstanceId",o),o}function En(e){return{Accept:"application/json","Content-Type":"application/json","User-Agent":`Shopify CLI; v=${dt}`,[pa]:e,[la]:dt}}function ha(e){return En(e)}function ga(e,t){return{...En(e),authorization:t,"X-Shopify-Access-Token":t}}async function Nn(e,t={}){let r=`https://${await lt()}/services/preview-stores`,i=JSON.stringify({...e.name?{name:e.name}:{},...e.country?{variables:{storeCreatePayload:{country:e.country}}}:{}}),a=await pt(r,{method:"POST",headers:ha(In(t.storage)),body:i}),u=await a.text();if(!a.ok){let l=Sa(a.status,u);throw new d(l.message,l.tryMessage)}let m;try{m=JSON.parse(u)}catch(l){let h=l instanceof Error?l.message:"Unknown error";throw new d("Preview store creation returned a non-JSON response.",`Parse error: ${h}. Body (truncated): ${Xe(u).slice(0,500)}`)}return ka(m)}async function On(e,t={}){let r=`https://${await lt()}/services/preview-stores/${e.shopId}`,i=await pt(r,{method:"GET",headers:ga(In(t.storage),e.adminApiToken)}),a=await i.text();if(!i.ok){let m=ya(i.status,a);throw new Pe(i.status,m.message,m.tryMessage)}let u;try{u=JSON.parse(a)}catch(m){let l=m instanceof Error?m.message:"Unknown error";throw new d("Preview store lookup returned a non-JSON response.",`Parse error: ${l}. Body (truncated): ${Xe(a).slice(0,500)}`)}return wa(u)}function Sa(e,t){let o=Pn(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=Xe(t);return{message:`Preview store creation failed with HTTP ${e}.`,tryMessage:i??(a.length>0?a.slice(0,1e3):"No response body returned.")}}function Pn(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 ya(e,t){let o=Pn(t),r=Xe(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 ka(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"?E(t.domain):void 0,a=typeof e.admin_api_token=="string"?e.admin_api_token:void 0,u=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(h=>typeof h=="string"):void 0;if(!o||!r||!i||!a||!u||!l)throw new d("Preview store creation response is missing required fields.",`Got: ${JSON.stringify(va(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},adminApiToken:a,adminApiScopes:l,accessUrl:u,...m?{placeholderAccountUuid:m}:{}}}function wa(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"?E(t.domain):void 0,a=typeof e.access_url=="string"?e.access_url:void 0,u=typeof e.claim_url=="string"?e.claim_url:void 0;if(!o||!r||!i||!a)throw new d("Preview store lookup response is missing required fields.",`Got: ${JSON.stringify(ba(e)).slice(0,500)}`);return{shop:{id:o,name:r,domain:i},accessUrl:a,...u?{claimUrl:u}:{}}}function va(e){return{...e,...e.admin_api_token?{admin_api_token:"[REDACTED]"}:{},...e.access_url?{access_url:"[REDACTED]"}:{}}}function Xe(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 ba(e){return{...e,...e.access_url?{access_url:"[REDACTED]"}:{},...e.claim_url?{claim_url:"[REDACTED]"}:{}}}var Aa={createPreviewStore:Nn,setStoredStoreAppSession:ge,recordStoreFqdnMetadata:N,setLastSeenUserId:C,now:()=>new Date};async function Fn(e,t={}){let o={...Aa,...t},r=await o.createPreviewStore({name:e.name,country:e.country},e.client);return Ta(r,e.country,o)}function xa(e){return e.placeholderAccountUuid??e.shop.id}async function Ta(e,t,o){let r=o.now().toISOString(),i=xa(e);o.setStoredStoreAppSession({store:e.shop.domain,clientId:q,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}}}n();function Cn(e,t){if(t==="json"){v(JSON.stringify(_a(e),null,2));return}Ia(e)}function _a(e){return{status:e.status,message:e.message,store:e.store,next_steps:Dn(e).map(t=>t.json)}}function Dn(e){return[{json:`Use \`shopify store open --store ${e.store.subdomain}\` to preview the storefront.`,text:["Use ",{command:`shopify store open --store ${e.store.subdomain}`}," to preview the storefront."]},{json:`Use \`shopify store execute --store ${e.store.subdomain}\` to add products, collections, pages, and more.`,text:["Use ",{command:`shopify store execute --store ${e.store.subdomain}`}," to add products, collections, pages, and more."]},{json:`Use \`shopify theme pull --store ${e.store.subdomain}\` and \`shopify theme push --store ${e.store.subdomain}\` to edit your store design.`,text:["Use ",{command:`shopify theme pull --store ${e.store.subdomain}`}," and ",{command:`shopify theme push --store ${e.store.subdomain}`}," to edit your store design."]}]}function Ia(e){b({headline:"Store created",customSections:[{body:e.message},{title:"Next steps",body:{list:{items:Dn(e).map(t=>t.text)}}}]})}var Ln=U(ae(),1),Ft,W=class extends k{async run(){let{flags:t}=await this.parse(Ft);t.country!==void 0&&!tn(t.country)&&this.error("Country must be a two-letter country code, for example: US.");let o=await R({title:c`Creating store`,task:async()=>Fn({name:t.name,country:t.country})});Cn(o,t.json?"json":"text")}};Ft=W;W.summary="Create a preview Shopify store.";W.descriptionWithMarkdown="Creates a new Shopify store, with no need for an existing account.";W.description=Ft.descriptionWithoutMarkdown();W.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'];W.flags={...y,..._,name:Ln.Flags.string({description:"The name of the store.",env:"SHOPIFY_FLAG_PREVIEW_STORE_NAME",required:!1}),country:on.country};var Rn=W;n();n();n();var qn=U(ki(),1);async function Ea(e){if(e.query!==void 0){if(!e.query.trim())throw new d("The --query flag value is empty. Please provide a valid GraphQL query or mutation.");return e.query}if(e.queryFile){if(!await Te(e.queryFile))throw new d(c`Query file not found at ${s.path(e.queryFile)}. Please check the path and try again.`);let t=await xe(e.queryFile,{encoding:"utf8"});if(!t.trim())throw new d(c`Query file at ${s.path(e.queryFile)} is empty. Please provide a valid GraphQL query or mutation.`);return t}throw new ee("Query should have been provided via --query or --query-file flags due to exactlyOne constraint. This indicates the oclif flag validation failed.")}async function Na(e,t){if(e)try{return JSON.parse(e)}catch(o){let r=o instanceof Error?o.message:"Unknown error";throw new d(c`Invalid JSON in ${s.yellow("--variables")} flag: ${r}`,"Please provide valid JSON format.")}else if(t){if(!await Te(t))throw new d(c`Variable file not found at ${s.path(t)}. Please check the path and try again.`);let o=await xe(t,{encoding:"utf8"});try{return JSON.parse(o)}catch(r){let i=r instanceof Error?r.message:"Unknown error";throw new d(c`Invalid JSON in variable file ${s.path(t)}: ${i}`,"Please provide valid JSON format.")}}}function Oa(e){let t;try{t=(0,qn.parse)(e)}catch(r){throw r instanceof Error?new d(`Invalid GraphQL syntax: ${r.message}`):r}let o=t.definitions.filter(r=>r.kind==="OperationDefinition");if(o.length!==1)throw new d("GraphQL document must contain exactly one operation definition. Multiple operations are not supported.");return{operationDefinition:o[0]}}function Pa(e){return e.operationDefinition.operation==="mutation"}function Fa(e,t=!1){if(Pa(e)&&!t)throw new d("Mutations are disabled by default for shopify store execute.","Re-run with --allow-mutations if you intend to modify store data.")}async function $n(e){let t=await Ea({query:e.query,queryFile:e.queryFile}),o=Oa(t);Fa(o,e.allowMutations);let r=await Na(e.variables,e.variableFile);return{query:t,parsedOperation:o,parsedVariables:r,requestedVersion:e.version}}n();n();n();n();function Ct(e){if(!e||typeof e!="object"||!("response"in e))return!1;let t=e.response;return!!t&&typeof t=="object"}function Un(e){if(!Ct(e))return;let t=e.response.status;return typeof t=="number"?t:void 0}var Mn=["the user aborted a request","the operation was aborted"];function Ca(e){if(!(e instanceof Error))return!1;if(e.name==="AbortError")return!0;let t=e.message.toLowerCase();return Mn.some(o=>t.includes(o))}function Fe(e,t){if(Un(e)===402)return new d(`The store ${t} is currently unavailable.`,"Check the store in the Shopify admin and try again once it is reactivated.");if(Ca(e))return new d(`Request to ${t} was aborted before it completed.`)}function Ce(e,t){let o=Un(e);o!==401&&o!==404||(t.kind!=="preview"&&Ue(t.store,t.userId),Qe(t))}var Da=`
82
95
  query StoreExecutePublicApiVersions {
83
96
  publicApiVersions {
84
97
  handle
85
98
  supported
86
99
  }
87
100
  }
88
- `;async function _r(e){try{return(await W({query:Si,api:"Admin",url:K(e.adminSession.storeFqdn,"unstable",e.adminSession),token:e.adminSession.token,responseOptions:{handleErrors:!1}})).publicApiVersions}catch(t){Ce(t,e.session);let o=pe(t,e.adminSession.storeFqdn);throw o||t}}async function Ir(e){try{return await j({title:m`Executing GraphQL operation`,task:async()=>W({query:e.request.query,api:"Admin",url:K(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){Pe(t)&&t.response.status===401&&(ae(e.context.session.store,e.context.session.userId),V(`Stored app authentication for ${e.context.session.store} is no longer valid.`,e.context.session.store,e.context.session.scopes.join(",")));let o=pe(t,e.context.adminSession.storeFqdn);throw o||(Pe(t)&&t.response.errors?new s("GraphQL operation failed.",JSON.stringify({errors:t.response.errors},null,2)):t)}}async function yi(e){let{session:t,adminSession:o,userSpecifiedVersion:r}=e;if(r==="unstable")return r;let n=await _r({adminSession:o,session:t});if(!r)return n.filter(u=>u.supported).map(u=>u.handle).sort().reverse()[0];let a=n.map(c=>c.handle);if(a.includes(r))return r;throw new s(`Invalid API version: ${r}`,`Allowed versions: ${a.join(", ")}`)}async function Er(e){let t=await se(e.store);await E(t.store,!0),H(t.userId);let o={token:t.accessToken,storeFqdn:t.store},r=await yi({session:t,adminSession:o,userSpecifiedVersion:e.userSpecifiedVersion});return{adminSession:o,version:r,session:t}}var ki={id:"admin",prepareContext:async({store:e,requestedVersion:t})=>Er({store:e,userSpecifiedVersion:t}),execute:async({context:e,request:t})=>Ir({context:e,request:t})};function Or(e){if(e==="admin")return ki;throw new ee(`Unsupported store GraphQL API target: ${e}`)}async function Pr(e){await E(e.store,!1);let t=Or(e.api??"admin"),o=await xr({query:e.query,queryFile:e.queryFile,variables:e.variables,variableFile:e.variableFile,version:e.version,allowMutations:e.allowMutations}),r=await j({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})}i();function wi(e){return JSON.stringify(e,null,2)}function Cr(e){if(e){Y({headline:"Operation succeeded.",body:`Results written to ${e}`});return}Y({headline:"Operation succeeded."})}async function Fr(e,t,o="text"){let r=wi(e);if(t){await ht(t,r),o==="text"&&Cr(t);return}o==="text"&&Cr(),w(r)}var G=Q(me(),1),at,z=class extends x{async run(){let{flags:t}=await this.parse(at),o=await Pr({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 Fr(o,t["output-file"],t.json?"json":"text")}};at=z;z.summary="Execute GraphQL queries and mutations on a store.";z.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.";z.description=at.descriptionWithoutMarkdown();z.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'];z.flags={...v,...A,query:G.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":G.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=>he(e),exactlyOne:["query","query-file"]}),variables:G.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":G.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 e=>he(e),exclusive:["variables"]}),store:F.store,version:G.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":G.Flags.string({description:"The file name where results should be written, instead of STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",parse:async e=>he(e)}),"allow-mutations":G.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};var Dr=z;i();i();i();i();var Rr={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"}}]}}]}}]};i();var Ur={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 le=class extends s{};async function Lr(e){let t=e.token??await P([],{noPrompt:e.noPrompt}),o=B({noPrompt:e.noPrompt}),r=L(e.store)??e.store.toLowerCase(),n=r.split(".")[0]??r,u=((await Ve({query:Rr,token:t,variables:{search:n},unauthorizedHandler:o})).currentUserAccount?.destinations.nodes??[]).find(f=>Ai(f,r));if(!u)throw new le(`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 p=await vi(String(u.publicId),t,o);return{...p?{owningOrg:p}:{}}}async function vi(e,t,o){try{let n=(await Ve({query:Ur,token:t,variables:{destinationPublicId:e},unauthorizedHandler:o})).currentUserAccount?.organizationForDestination;if(!n){l(`No owning organization returned for destination ${e}.`);return}let a=n.id?Yt(n.id):void 0;return{name:n.name,...a?{id:a}:{}}}catch(r){l(`Failed to resolve owning organization: ${bi(r)}`);return}}function Ai(e,t){return[e.primaryDomain,e.webUrl].some(o=>L(o)===t)}function bi(e){return e instanceof Error?e.message:String(e)}i();i();var $r={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 qr(e){let t=e.token??await P([],{noPrompt:e.noPrompt}),o=B({noPrompt:e.noPrompt}),n=(await J({query:$r,token:t,organizationId:e.organizationId,variables:{search:e.store},unauthorizedHandler:o})).organization?.accessibleShops?.edges??[],a=e.store.toLowerCase(),c=n.map(u=>u.node).find(u=>L(u.primaryDomain)===a);if(!c)throw new ee(`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{shopifyShopId:c.shopifyShopId??void 0,name:c.name,primaryDomain:c.primaryDomain??void 0,storeType:c.storeType??void 0,developerPreviewHandle:c.developerPreviewHandle??void 0,planName:c.planName??void 0,ownerName:c.ownerDetails?.fullName??void 0,ownerEmail:c.ownerDetails?.email??void 0}}i();var xi={basic:"basic",professional:"grow",grow:"grow",unlimited:"advanced",advanced:"advanced",shopify_plus:"plus",plus:"plus"};function zr(e){if(e)return xi[e.toLowerCase()]}i();var Ti={APP_DEVELOPMENT:"dev",CLIENT_TRANSFER:"client_transfer",COLLABORATOR:"collaborator",DEVELOPMENT:"dev",DEVELOPMENT_SUPERSET:"dev",PRODUCTION:"production"};function Fe(e){if(e)return Ti[e]}function Mr(e){return e?ue(e):""}var Ni=`#graphql
101
+ `;async function zn(e){try{return(await se({query:Da,api:"Admin",url:ce(e.adminSession.storeFqdn,"unstable",e.adminSession),token:e.adminSession.token,responseOptions:{handleErrors:!1}})).publicApiVersions}catch(t){Ce(t,e.session);let o=Fe(t,e.adminSession.storeFqdn);throw o||t}}async function Hn(e){try{return await R({title:c`Executing GraphQL operation`,task:async()=>se({query:e.request.query,api:"Admin",url:ce(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){Ce(t,e.context.session);let o=Fe(t,e.context.adminSession.storeFqdn);throw o||(Ct(t)&&t.response.errors?new d("GraphQL operation failed.",JSON.stringify({errors:t.response.errors},null,2)):t)}}n();async function Dt(e){let t=await D(E(e));return await N(t.store,!0),C(t.userId),{adminSession:{token:t.accessToken,storeFqdn:t.store},session:t}}async function La(e){let{session:t,adminSession:o,userSpecifiedVersion:r}=e;if(r==="unstable")return r;let i=await zn({adminSession:o,session:t});if(!r)return i.filter(m=>m.supported).map(m=>m.handle).sort().reverse()[0];let a=i.map(u=>u.handle);if(a.includes(r))return r;throw new d(`Invalid API version: ${r}`,`Allowed versions: ${a.join(", ")}`)}async function Bn(e){let{adminSession:t,session:o}=await Dt(e.store),r=await La({session:o,adminSession:t,userSpecifiedVersion:e.userSpecifiedVersion});return{adminSession:t,version:r,session:o}}var Ra={id:"admin",prepareContext:async({store:e,requestedVersion:t})=>Bn({store:e,userSpecifiedVersion:t}),execute:async({context:e,request:t})=>Hn({context:e,request:t})};function Gn(e){if(e==="admin")return Ra;throw new ee(`Unsupported store GraphQL API target: ${e}`)}async function Vn(e){await N(e.store,!1);let t=Gn(e.api??"admin"),o=await $n({query:e.query,queryFile:e.queryFile,variables:e.variables,variableFile:e.variableFile,version:e.version,allowMutations:e.allowMutations}),r=await R({title:c`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 qa(e){return JSON.stringify(e,null,2)}function jn(e){if(e){b({headline:"Operation succeeded.",body:`Results written to ${e}`});return}b({headline:"Operation succeeded."})}async function Wn(e,t,o="text"){let r=qa(e);if(t){await Re(t,r),o==="text"&&jn(t);return}o==="text"&&jn(),v(r)}var re=U(ae(),1),Lt,Q=class extends k{async run(){let{flags:t}=await this.parse(Lt),o=await Vn({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 Wn(o,t["output-file"],t.json?"json":"text")}};Lt=Q;Q.summary="Execute GraphQL queries and mutations on a store.";Q.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.";Q.description=Lt.descriptionWithoutMarkdown();Q.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'];Q.flags={...y,..._,query:re.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":re.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=>ie(e),exactlyOne:["query","query-file"]}),variables:re.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":re.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 e=>ie(e),exclusive:["variables"]}),store:w.store,version:re.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":re.Flags.string({description:"The file name where results should be written, instead of STDOUT.",env:"SHOPIFY_FLAG_OUTPUT_FILE",parse:async e=>ie(e)}),"allow-mutations":re.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1})};var Qn=Q;n();n();async function Yn(e){let t=$a(e.store),o=Qo();await Yo({port:e.port,storeFqdn:e.store,tokenProvider:t,key:o,protectMutations:!e.allowMutations,query:e.query,variables:e.variables,apiVersion:e.apiVersion,additionalReadyMessages:[c`Mutations are ${e.allowMutations?s.green("allowed"):s.yellow("blocked")}.`],abortSignal:e.abortSignal})}function $a(e){return{getToken:async()=>(await D(e)).accessToken,refreshToken:async()=>(await D(e)).accessToken}}var Ze=U(ae(),1),Rt,Y=class extends k{async run(){let{flags:t}=await this.parse(Rt);await Yn({store:t.store,port:t.port,allowMutations:t["allow-mutations"],variables:t.variables,apiVersion:t.version})}};Rt=Y;Y.summary="Open a local GraphiQL UI for a store.";Y.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.";Y.description=Rt.descriptionWithoutMarkdown();Y.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"];Y.flags={...y,store:w.store,port:co({description:"Local port for the GraphiQL server.",env:"SHOPIFY_FLAG_PORT"}),"allow-mutations":Ze.Flags.boolean({description:"Allow GraphQL mutations to run against the target store.",env:"SHOPIFY_FLAG_ALLOW_MUTATIONS",default:!1}),variables:Ze.Flags.string({char:"v",description:"The values for any GraphQL variables in your query or mutation, in JSON format.",env:"SHOPIFY_FLAG_VARIABLES"}),version:Ze.Flags.string({description:"The API version to use in GraphiQL. Defaults to the latest stable version.",env:"SHOPIFY_FLAG_VERSION"})};var Jn=Y;n();n();n();n();var Kn={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 Xn={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 De=class extends d{};async function Zn(e){let t=e.token??await L([],{noPrompt:e.noPrompt}),o=oe({noPrompt:e.noPrompt}),r=M(e.store)??e.store.toLowerCase(),i=r.split(".")[0]??r,m=((await ft({query:Kn,token:t,variables:{search:i},unauthorizedHandler:o})).currentUserAccount?.destinations.nodes??[]).find(h=>Ma(h,r));if(!m)throw new De(`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 Ua(String(m.publicId),t,o);return{...l?{owningOrg:l}:{}}}async function Ua(e,t,o){try{let i=(await ft({query:Xn,token:t,variables:{destinationPublicId:e},unauthorizedHandler:o})).currentUserAccount?.organizationForDestination;if(!i){f(`No owning organization returned for destination ${e}.`);return}let a=i.id?Vo(i.id):void 0;return{name:i.name,...a?{id:a}:{}}}catch(r){f(`Failed to resolve owning organization: ${za(r)}`);return}}function Ma(e,t){return[e.primaryDomain,e.webUrl].some(o=>M(o)===t)}function za(e){return e instanceof Error?e.message:String(e)}n();n();var ei={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 ti(e){let t=e.token??await L([],{noPrompt:e.noPrompt}),o=oe({noPrompt:e.noPrompt}),i=(await de({query:ei,token:t,organizationId:e.organizationId,variables:{search:e.store},unauthorizedHandler:o})).organization?.accessibleShops?.edges??[],a=e.store.toLowerCase(),u=i.map(m=>m.node).find(m=>M(m.primaryDomain)===a);if(!u)throw new ee(`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{shopifyShopId:u.shopifyShopId??void 0,name:u.name,primaryDomain:u.primaryDomain??void 0,storeType:u.storeType??void 0,developerPreviewHandle:u.developerPreviewHandle??void 0,planName:u.planName??void 0,ownerName:u.ownerDetails?.fullName??void 0,ownerEmail:u.ownerDetails?.email??void 0}}n();function oi(e){if(e)return wn[e.toLowerCase()]}n();var Ha={APP_DEVELOPMENT:"dev",CLIENT_TRANSFER:"client_transfer",COLLABORATOR:"collaborator",DEVELOPMENT:"dev",DEVELOPMENT_SUPERSET:"dev",PRODUCTION:"production"};function et(e){if(e)return Ha[e]}function ri(e){return e?Ae(e):""}var Ba=`#graphql
89
102
  query StoreInfoAdminShop {
90
103
  shop {
91
104
  id
@@ -99,11 +112,11 @@ Re-run this command if the stored token is missing, expires, or no longer has th
99
112
  }
100
113
  }
101
114
  }
102
- `;async function Hr(e){let t=e.store;if(!t)throw new s("No store specified.","Pass the `myshopify.com` domain via the `--store` flag, e.g. `shopify store info --store shop.myshopify.com`.");let o=ne(t);if(Oi(o)){await E(o.store,!0,o.preview.shopId);let n=await Pi(o);return $i({store:t,previewSession:o,previewStoreUrls:n})}let r=!!o;try{return await Ii(t,{noPrompt:r})}catch(n){if(!r||!Fi(n))throw n;return l(`BP store info lookup failed; falling back to stored store auth: ${Ri(n)}`),_i(t)}}async function _i(e){let t=await se(e);await E(t.store,!0),H(t.userId);let o=await Ei(t);return Ui({store:t.store,shop:o})}async function Ii(e,t={}){let o=await Lr({store:e,noPrompt:t.noPrompt}),r=await Ci(o,e,{noPrompt:t.noPrompt});return Li({store:e,destinationsCtx:o,orgShop:r})}async function Ei(e){try{let t=await W({query:Ni,api:"Admin",url:K(e.store,"unstable"),token:e.accessToken,responseOptions:{handleErrors:!1}});if(!t.shop)throw new s(`Shopify did not return store information for ${e.store}.`);return t.shop}catch(t){Ce(t,e);let o=pe(t,e.store);throw o||t}}function Oi(e){return e?.kind==="preview"&&e.preview!==void 0}async function Pi(e){let t={shopId:e.preview.shopId,adminApiToken:e.accessToken},[o,r]=await Promise.all([gr(t),Sr(t)]);return{accessUrl:r.accessUrl,saveUrl:o.claimUrl}}async function Ci(e,t,o={}){if(!e.owningOrg?.id){l("Owning organization id is unknown; skipping BP Organizations shop lookup.");return}try{return await qr({store:t,organizationId:e.owningOrg.id,noPrompt:o.noPrompt})}catch(r){l(`BP Organizations shop lookup failed: ${r instanceof Error?r.message:String(r)}`);return}}function Fi(e){return e instanceof le||Di(e)}function Di(e){return e instanceof s&&e.message.includes("unable to prompt for reauthentication")}function Ri(e){return e instanceof Error?e.message:String(e)}function Ui(e){let{store:t,shop:o}=e,r=o.myshopifyDomain??t,n={id:o.id,displayName:o.name,storeOwner:qi(o),type:o.plan?.partnerDevelopment?"dev":void 0,plan:o.plan?.publicDisplayName,adminUrl:Vr(Ge(r))};return{...Z(n),subdomain:r}}function Li(e){let{store:t,destinationsCtx:o,orgShop:r}=e,n={id:jr(r?.shopifyShopId),displayName:r?.name,organizationId:o.owningOrg?.id,organizationName:o.owningOrg?.name,storeOwner:zi(r),type:Fe(r?.storeType),plan:zr(r?.planName),featurePreview:r?.developerPreviewHandle,adminUrl:Vr(Ge(t))};return{...Z(n),subdomain:t}}function $i(e){let{store:t,previewSession:o,previewStoreUrls:r}=e,n={id:jr(o.preview.shopId),displayName:o.preview.name,accessUrl:r.accessUrl,saveUrl:r.saveUrl};return{...Z(n),subdomain:t}}function jr(e){if(e)return`gid://shopify/Shop/${e}`}function qi(e){let t=Z({name:e.shopOwnerName,email:e.email});return Object.keys(t).length>0?t:void 0}function zi(e){if(!e)return;let t=Z({name:e.ownerName,email:e.ownerEmail});return Object.keys(t).length>0?t:void 0}function Vr(e){if(e)return`https://admin.shopify.com/store/${encodeURIComponent(e)}`}i();function Br(e,t){if(t==="json"){w(JSON.stringify(e,null,2));return}kt({customSections:[{title:"Store details",body:{list:{items:Mi(e)}}}]})}function Mi(e){let t=[];return O(t,"ID",e.id),O(t,"Display Name",e.displayName),O(t,"Subdomain",e.subdomain),O(t,"Organization",e.organizationName),O(t,"Store owner",Hi(e.storeOwner)),O(t,"Type",e.type?ue(e.type):void 0),O(t,"Plan",e.plan?ue(e.plan):void 0),O(t,"Feature Preview",e.featurePreview),O(t,"Admin URL",e.adminUrl),O(t,"Access URL",e.accessUrl),O(t,"Save URL",e.saveUrl),t}function Hi(e){if(e)return e.name&&e.email?`${e.name} (${e.email})`:e.name??e.email}function O(e,t,o){o&&e.push(`${t}: ${o}`)}var st,M=class extends x{async run(){let{flags:t}=await this.parse(st),o=await Hr({store:t.store});Br(o,t.json?"json":"text")}};st=M;M.summary="Surface metadata about a Shopify store.";M.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 tt(e){let t=e.store;if(!t)throw new d("No store specified.","Pass the `myshopify.com` domain via the `--store` flag, e.g. `shopify store info --store shop.myshopify.com`.");let o=te(t);if(Wa(o)){await N(o.store,!0,o.preview.shopId),C(o.userId);let i=await Qa(o);return ts({store:t,previewSession:o,previewStoreUrls:i})}let r=!!o;try{return await Va(t,{noPrompt:r})}catch(i){if(!r||!Ja(i))throw i;return f(`BP store info lookup failed; falling back to stored store auth: ${Xa(i)}`),Ga(t)}}async function Ga(e){let t=await D(e);await N(t.store,!0),C(t.userId);let o=await ja(t);return Za({store:t.store,shop:o})}async function Va(e,t={}){let o=await Zn({store:e,noPrompt:t.noPrompt}),r=await Ya(o,e,{noPrompt:t.noPrompt});return es({store:e,destinationsCtx:o,orgShop:r})}async function ja(e){try{let t=await se({query:Ba,api:"Admin",url:ce(e.store,"unstable"),token:e.accessToken,responseOptions:{handleErrors:!1}});if(!t.shop)throw new d(`Shopify did not return store information for ${e.store}.`);return t.shop}catch(t){Ce(t,e);let o=Fe(t,e.store);throw o||t}}function Wa(e){return e?.kind==="preview"&&e.preview!==void 0}async function Qa(e){try{let t=await On({shopId:e.preview.shopId,adminApiToken:e.accessToken});return{accessUrl:t.accessUrl,...t.claimUrl?{saveUrl:t.claimUrl}:{}}}catch(t){throw t instanceof Pe&&(t.status===401||t.status===404)&&Qe(e),t}}async function Ya(e,t,o={}){if(!e.owningOrg?.id){f("Owning organization id is unknown; skipping BP Organizations shop lookup.");return}try{return await ti({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 Ja(e){return e instanceof De||Ka(e)}function Ka(e){return e instanceof d&&e.message.includes("unable to prompt for reauthentication")}function Xa(e){return e instanceof Error?e.message:String(e)}function Za(e){let{store:t,shop:o}=e,r=o.myshopifyDomain??t,i={id:o.id,displayName:o.name,storeOwner:os(o),type:o.plan?.partnerDevelopment?"dev":void 0,plan:o.plan?.publicDisplayName,adminUrl:ii(St(r))};return{...le(i),subdomain:r}}function es(e){let{store:t,destinationsCtx:o,orgShop:r}=e,i={id:ni(r?.shopifyShopId),displayName:r?.name,organizationId:o.owningOrg?.id,organizationName:o.owningOrg?.name,storeOwner:rs(r),type:et(r?.storeType),plan:oi(r?.planName),featurePreview:r?.developerPreviewHandle,adminUrl:ii(St(t))};return{...le(i),subdomain:t}}function ts(e){let{store:t,previewSession:o,previewStoreUrls:r}=e,i={id:ni(o.preview.shopId),displayName:o.preview.name,accessUrl:r.accessUrl,saveUrl:r.saveUrl};return{...le(i),subdomain:t,authScopes:o.scopes}}function ni(e){if(e)return`gid://shopify/Shop/${e}`}function os(e){let t=le({name:e.shopOwnerName,email:e.email});return Object.keys(t).length>0?t:void 0}function rs(e){if(!e)return;let t=le({name:e.ownerName,email:e.ownerEmail});return Object.keys(t).length>0?t:void 0}function ii(e){if(e)return`https://admin.shopify.com/store/${encodeURIComponent(e)}`}n();function ai(e,t){if(t==="json"){v(JSON.stringify(e,null,2));return}let o=is(e);T({customSections:[{title:"Store details",body:{tabularData:ns(e),firstColumnSubdued:!0}},...o.length>0?[{body:{list:{title:{bold:"Next steps"},items:o}}}]:[]]})}function ns(e){let t=[];return ne(t,"ID",e.id),ne(t,"Display Name",e.displayName),ne(t,"Subdomain",e.subdomain),ne(t,"Organization",e.organizationName),ne(t,"Store owner",as(e.storeOwner)),ne(t,"Type",e.type?Ae(e.type):void 0),ne(t,"Plan",e.plan?Ae(e.plan):void 0),ne(t,"Feature Preview",e.featurePreview),t}function is(e){let t=[];return qt(t,e.adminUrl,"Manage this store in the Shopify admin"),qt(t,e.accessUrl,"View your store"),qt(t,e.saveUrl,"Save your store"),t}function as(e){if(e)return e.name&&e.email?`${e.name} (${e.email})`:e.name??e.email}function ne(e,t,o){o&&e.push([t,o])}function qt(e,t,o){t&&e.push({link:{label:o,url:t}})}var $t,J=class extends k{async run(){let{flags:t}=await this.parse($t),o=await tt({store:t.store});ai(o,t.json?"json":"text")}};$t=J;J.summary="Surface metadata about a Shopify store.";J.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.
103
116
 
104
117
  Some details may be omitted when they are not available for the store.
105
118
 
106
- Use \`--json\` for machine-readable output.`;M.description=st.descriptionWithoutMarkdown();M.examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --json"];M.flags={...v,...A,store:F.store};var Gr=M;i();i();i();i();i();var Qr={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"}}}}],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:"ListValue",values:[{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"field"},value:{kind:"EnumValue",value:"STORE_STATUS"}},{kind:"ObjectField",name:{kind:"Name",value:"operator"},value:{kind:"EnumValue",value:"EQUALS"}},{kind:"ObjectField",name:{kind:"Name",value:"value"},value:{kind:"StringValue",value:"active",block:!1}}]}]}}],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:"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 Wr(e){let{entries:t,hasMore:o}=await ji(e.token,e.organization);return{entries:t.sort(Bi),hasMore:o}}async function ji(e,t){let o=B(),n=(await J({query:Qr,token:e,organizationId:t.id,variables:{first:250},unauthorizedHandler:o})).organization?.accessibleShops;if(!n)return{entries:[],hasMore:!1};let a=[];for(let c of n.edges){let u=Vi(c.node,t);u&&a.push(u)}return{entries:a,hasMore:n.pageInfo.hasNextPage}}function Vi(e,t){let o=e.url??e.primaryDomain;if(o)return{...e.shopifyShopId?{id:`gid://shopify/Shop/${e.shopifyShopId}`}:{},store:L(o)??o,createdAt:typeof e.createdAt=="string"?e.createdAt:String(e.createdAt),organizationId:t.id,organizationName:t.businessName,name:e.name,type:Fe(e.storeType)}}function Bi(e,t){return e.createdAt===t.createdAt?e.store.localeCompare(t.store):t.createdAt.localeCompare(e.createdAt)}async function Jr(e={}){let t=await P(),o=await Kt(t);if(!o.currentUserResolved)return{stores:[],source:"organization",notice:"Couldn't resolve a Shopify account for the current CLI session."};if(o.organizations.length===0)return{stores:[],source:"organization"};if(!e.organizationId&&o.organizations.length>1&&!At())throw new s("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 Gi(o.organizations,e.organizationId),n=await Wr({token:t,organization:r}),{stores:a,truncated:c}=Wi(n.entries,n.hasMore);return{stores:a,source:"organization",organization:Qi(r),...c?{truncated:!0}:{}}}async function Gi(e,t){if(t){let a=e.find(c=>c.id===t.toString());if(!a)throw new s(`Organization with ID ${t} not found.`,`Available organizations: ${e.map(c=>`${c.businessName} (${c.id})`).join(", ")}`);return a}if(e.length===1)return e[0];let r=new Set(e.map(a=>a.businessName)).size<e.length,n=await vt({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===n)}function Qi(e){return{id:e.id,name:e.businessName}}function Wi(e,t){return{stores:e.slice(0,250),truncated:t||e.length>250}}i();function Yr(e,t){if(e.notice&&Be(e.notice),e.truncated&&Be(Ji(e)),t==="json"){w(JSON.stringify({stores:e.stores,...e.organization?{organization:e.organization}:{},...e.notice?{notice:e.notice}:{},...e.truncated?{truncated:!0}:{}},null,2));return}Yi(e)}function Ji(e){let t=e.organization?` in ${e.organization.name}`:" in this organization";return`Showing the ${250} most recent stores${t}. More stores exist.`}function Yi(e){if(e.stores.length===0){b(Xi(e));return}e.organization&&b(`Organization: ${e.organization.name} (${e.organization.id})`),Ki(e.stores),b("To list stores authenticated directly with `shopify store auth`, run `shopify store auth list`.")}function Ki(e){ke({rows:e.map(t=>({subdomain:Zi(t.store),name:t.name??"",type:Mr(t.type),created:Ne(t.createdAt)})),columns:{subdomain:{header:"Subdomain"},name:{header:"Name"},type:{header:"Type"},created:{header:"Created"}}})}function Xi(e){return e.notice?["No stores were returned for the current CLI session.","","Run `shopify store auth list` to list stores authenticated directly with `shopify store auth`."].join(`
119
+ Use \`--json\` for machine-readable output.`;J.description=$t.descriptionWithoutMarkdown();J.examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com","<%= config.bin %> <%= command.id %> --store shop.myshopify.com --json"];J.flags={...y,..._,store:w.store};var si=J;n();n();n();n();n();var di={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"}}}}],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:"ListValue",values:[{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"field"},value:{kind:"EnumValue",value:"STORE_STATUS"}},{kind:"ObjectField",name:{kind:"Name",value:"operator"},value:{kind:"EnumValue",value:"EQUALS"}},{kind:"ObjectField",name:{kind:"Name",value:"value"},value:{kind:"StringValue",value:"active",block:!1}}]}]}}],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:"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 ci(e){let{entries:t,hasMore:o}=await ss(e.token,e.organization);return{entries:t.sort(cs),hasMore:o}}async function ss(e,t){let o=oe(),i=(await de({query:di,token:e,organizationId:t.id,variables:{first:250},unauthorizedHandler:o})).organization?.accessibleShops;if(!i)return{entries:[],hasMore:!1};let a=[];for(let u of i.edges){let m=ds(u.node,t);m&&a.push(m)}return{entries:a,hasMore:i.pageInfo.hasNextPage}}function ds(e,t){let o=e.url??e.primaryDomain;if(o)return{...e.shopifyShopId?{id:`gid://shopify/Shop/${e.shopifyShopId}`}:{},store:M(o)??o,createdAt:typeof e.createdAt=="string"?e.createdAt:String(e.createdAt),organizationId:t.id,organizationName:t.businessName,name:e.name,type:et(e.storeType)}}function cs(e,t){return e.createdAt===t.createdAt?e.store.localeCompare(t.store):t.createdAt.localeCompare(e.createdAt)}async function ui(e={}){let t=await L(),o=await jo(t);if(!o.currentUserResolved)return{stores:[],source:"organization",notice:"Couldn't resolve a Shopify account for the current CLI session."};if(o.organizations.length===0)return{stores:[],source:"organization"};if(!e.organizationId&&o.organizations.length>1&&!oo())throw new d("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 us(o.organizations,e.organizationId),i=await ci({token:t,organization:r}),{stores:a,truncated:u}=ps(i.entries,i.hasMore);return{stores:a,source:"organization",organization:ms(r),...u?{truncated:!0}:{}}}async function us(e,t){if(t){let a=e.find(u=>u.id===t.toString());if(!a)throw new d(`Organization with ID ${t} not found.`,`Available organizations: ${e.map(u=>`${u.businessName} (${u.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 eo({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 ms(e){return{id:e.id,name:e.businessName}}function ps(e,t){return{stores:e.slice(0,250),truncated:t||e.length>250}}n();function mi(e,t){if(e.notice&&ht(e.notice),e.truncated&&ht(ls(e)),t==="json"){v(JSON.stringify({stores:e.stores,...e.organization?{organization:e.organization}:{},...e.notice?{notice:e.notice}:{},...e.truncated?{truncated:!0}:{}},null,2));return}fs(e)}function ls(e){let t=e.organization?` in ${e.organization.name}`:" in this organization";return`Showing the ${250} most recent stores${t}. More stores exist.`}function fs(e){if(e.stores.length===0){P(gs(e));return}e.organization&&P(`Organization: ${e.organization.name} (${e.organization.id})`),hs(e.stores),P("To list stores authenticated directly with `shopify store auth`, run `shopify store auth list`.")}function hs(e){fe({rows:e.map(t=>({subdomain:Ss(t.store),name:t.name??"",type:ri(t.type),created:Ve(t.createdAt)})),columns:{subdomain:{header:"Subdomain"},name:{header:"Name"},type:{header:"Type"},created:{header:"Created"}}})}function gs(e){return e.notice?["No stores were returned for the current CLI session.","","Run `shopify store auth list` to list stores authenticated directly with `shopify store auth`."].join(`
107
120
  `):e.organization?`No stores found in ${e.organization.name}.`:["No stores found in your Shopify organization.","","Run `shopify store auth list` to list stores authenticated directly with `shopify store auth`."].join(`
108
- `)}function Zi(e){return _e(e)??e}var ct,R=class extends x{async run(){let{flags:t}=await this.parse(ct),o=await Jr({organizationId:t["organization-id"]});Yr(o,t.json?"json":"text")}};ct=R;R.hidden=!0;R.summary="List stores in a Shopify organization.";R.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`.\nIn non-interactive environments, `--organization-id` is required.\n\nRun `<%= config.bin %> organization list` to find organization IDs.";R.description=ct.descriptionWithoutMarkdown();R.examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --organization-id 1234567","<%= config.bin %> <%= command.id %> --json"];R.flags={...v,...A,"organization-id":F["organization-id"]};var Kr=R;var ea={"store:auth:list":jo,"store:auth":sr,"store:create:dev":pr,"store:create:preview":Ar,"store:execute":Dr,"store:info":Gr,"store:list":Kr},De=ea;i();i();var ta=async e=>{eo(),process.env.COMMAND_RUN_ID=X()},Xr=ta;var Re={"app:build":to,"app:bulk:cancel":oo,"app:bulk:status":ro,"app:deploy":co,"app:dev":uo,"app:dev:clean":Co,"app:logs":mo,"app:logs:sources":po,"app:import-custom-data-definitions":Do,"app:import-extensions":bo,"app:info":xo,"app:init":To,"app:config:validate":No,"app:release":_o,"app:config:link":no,"app:config:use":io,"app:config:pull":ao,"app:env:pull":lo,"app:env:show":fo,"app:execute":go,"app:bulk:execute":ho,"app:function:build":So,"app:function:replay":yo,"app:function:run":ko,"app:function:info":Fo,"app:function:schema":wo,"app:function:typegen":vo,"app:generate:extension":Ao,"app:versions:list":Io,"app:webhook:trigger":Eo,"demo:watcher":so,"organization:list":Ro},oa=Po,ra=Xr,na=Oo;import ia from"fs";var Pl=Zt.init;(0,en.createGlobalProxyAgent)({environmentVariableNamespace:"SHOPIFY_",forceGlobalAgent:!0,socketConnectionTimeout:6e4});process.on("uncaughtException",e=>{e instanceof bt?wt(e):ia.writeSync(process.stderr.fd,`${e.stack??e.message??e}
109
- `),process.exit(1)});var aa=["SIGINT","SIGTERM","SIGQUIT"];aa.forEach(e=>{process.on(e,()=>{process.exit(1)})});var Zr=Number(process.env.SHOPIFY_CLI_COLUMNS);isNaN(Zr)||(process.stdout.columns=Zr);async function sa({development:e}){await It({moduleURL:import.meta.url,development:e})}oe.plugins.hidden=!0;oe["plugins:install"].description="";var ca=Object.keys(Re);ca.forEach(e=>{Re[e].customPluginName="@shopify/app"});var da=Object.keys(we);da.forEach(e=>{we[e].customPluginName="@shopify/theme"});var ua=Object.keys(ve);ua.forEach(e=>{ve[e].customPluginName="@shopify/cli-hydrogen"});var ma=Object.keys(De);ma.forEach(e=>{De[e].customPluginName="@shopify/store"});var pa=Object.keys(Ae);pa.forEach(e=>{Ae[e].customPluginName="@oclif/plugin-commands"});var la=Object.keys(be);la.forEach(e=>{be[e].customPluginName="@shopify/plugin-did-you-mean"});var fa=Object.keys(oe);fa.forEach(e=>{oe[e].customPluginName="@oclif/plugin-plugins"});var Cl={...Re,...we,...oe,...be,...Ae,...ve,...De,search:Et,upgrade:Ot,version:_t,help:jt,"auth:logout":Pt,"auth:login":Ct,"debug:command-flags":Ft,"kitchen-sink":Lt,"kitchen-sink:async":Dt,"kitchen-sink:prompts":Rt,"kitchen-sink:static":Ut,"doctor-release":$t,"doctor-release:theme":qt,"doc:fetch":zt,"doc:search":Mt,"docs:generate":Ht,"notifications:list":Vt,"notifications:generate":Bt,"cache:clear":Gt,"config:autoupgrade:off":Qt,"config:autoupgrade:on":Wt,"config:autoupgrade:status":Jt},Fl=sa;export{ra as AppInitHook,na as AppPublicMetadataHook,oa as AppSensitiveMetadataHook,Cl as COMMANDS,dn as DidYouMeanHook,Pl as HydrogenInitHook,cn as PluginHook,un as TunnelProviderHook,mn as TunnelStartHook,Fl as default,nn as fetchStoreThemes,an as pull,sn as push};
121
+ `)}function Ss(e){return je(e)??e}var Ut,K=class extends k{async run(){let{flags:t}=await this.parse(Ut),o=await ui({organizationId:t["organization-id"]});mi(o,t.json?"json":"text")}};Ut=K;K.summary="List stores in a Shopify organization.";K.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`.\nIn non-interactive environments, `--organization-id` is required.\n\nRun `<%= config.bin %> organization list` to find organization IDs.";K.description=Ut.descriptionWithoutMarkdown();K.examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --organization-id 1234567","<%= config.bin %> <%= command.id %> --json"];K.flags={...y,..._,"organization-id":w["organization-id"]};var pi=K;n();n();var ys={getStoreInfo:tt,openURL:$e};async function li(e,t={}){let{getStoreInfo:o,openURL:r}={...ys,...t},i=await o({store:e.store}),a=ks(i);if(await r(a)){T({headline:`Opening the storefront for ${e.store} in your browser.`});return}T({headline:"Browser didn't open automatically. Open the storefront manually:",body:[c`${s.link(a,a)}`.value]})}function ks(e){return e.accessUrl??`https://${e.subdomain}`}var Mt,X=class extends k{async run(){let{flags:t}=await this.parse(Mt);await li({store:t.store})}};Mt=X;X.summary="Open your Shopify store in the default web browser.";X.descriptionWithMarkdown="Opens the storefront for a store you have access to in your default web browser.";X.description=Mt.descriptionWithoutMarkdown();X.examples=["<%= config.bin %> <%= command.id %> --store shop.myshopify.com"];X.flags={...y,store:w.store};var fi=X;var ws={"store:auth:list":qr,"store:auth":cn,"store:bulk:cancel":pn,"store:bulk:execute":hn,"store:bulk:status":yn,"store:stripe-auth":kn,"store:create:dev":_n,"store:create:preview":Rn,"store:execute":Qn,"store:graphiql":Jn,"store:info":si,"store:list":pi,"store:open":fi},ot=ws;n();n();var vs=async e=>{Ko(),process.env.COMMAND_RUN_ID=pe()},hi=vs;var rt={"app:build":Xo,"app:bulk:cancel":Zo,"app:bulk:status":er,"app:deploy":ir,"app:dev":ar,"app:dev:clean":Nr,"app:logs":sr,"app:logs:sources":dr,"app:import-custom-data-definitions":Pr,"app:import-extensions":wr,"app:info":vr,"app:init":br,"app:config:validate":Ar,"app:release":xr,"app:config:link":tr,"app:config:use":or,"app:config:pull":rr,"app:env:pull":cr,"app:env:show":ur,"app:execute":pr,"app:graphiql":lr,"app:bulk:execute":mr,"app:function:build":fr,"app:function:replay":hr,"app:function:run":gr,"app:function:info":Or,"app:function:schema":Sr,"app:function:typegen":yr,"app:generate:extension":kr,"app:versions:list":Tr,"app:webhook:trigger":_r,"demo:watcher":nr,"organization:list":Fr},bs=Er,As=hi,xs=Ir;import Ts from"fs";var Jg=Jo.init;(0,Si.createGlobalProxyAgent)({environmentVariableNamespace:"SHOPIFY_",forceGlobalAgent:!0,socketConnectionTimeout:6e4});process.on("uncaughtException",e=>{e instanceof ro?Xt(e):Ts.writeSync(process.stderr.fd,`${e.stack??e.message??e}
122
+ `),process.exit(1)});var _s=["SIGINT","SIGTERM","SIGQUIT"];_s.forEach(e=>{process.on(e,()=>{process.exit(1)})});var gi=Number(process.env.SHOPIFY_CLI_COLUMNS);isNaN(gi)||(process.stdout.columns=gi);async function Is({development:e}){await so({moduleURL:import.meta.url,development:e})}ke.plugins.hidden=!0;ke["plugins:install"].description="";var Es=Object.keys(rt);Es.forEach(e=>{rt[e].customPluginName="@shopify/app"});var Ns=Object.keys(ze);Ns.forEach(e=>{ze[e].customPluginName="@shopify/theme"});var Os=Object.keys(He);Os.forEach(e=>{He[e].customPluginName="@shopify/cli-hydrogen"});var Ps=Object.keys(ot);Ps.forEach(e=>{ot[e].customPluginName="@shopify/store"});var Fs=Object.keys(Be);Fs.forEach(e=>{Be[e].customPluginName="@oclif/plugin-commands"});var Cs=Object.keys(Ge);Cs.forEach(e=>{Ge[e].customPluginName="@shopify/plugin-did-you-mean"});var Ds=Object.keys(ke);Ds.forEach(e=>{ke[e].customPluginName="@oclif/plugin-plugins"});var Kg={...rt,...ze,...ke,...Ge,...Be,...He,...ot,search:uo,upgrade:mo,version:ao,help:xo,"auth:logout":po,"auth:login":lo,"debug:command-flags":fo,"kitchen-sink":yo,"kitchen-sink:async":ho,"kitchen-sink:prompts":go,"kitchen-sink:static":So,"doctor-release":ko,"doctor-release:theme":wo,"doc:fetch":vo,"doc:search":bo,"docs:generate":Ao,"notifications:list":To,"notifications:generate":_o,"cache:clear":Io,"config:autoupgrade:off":Eo,"config:autoupgrade:on":No,"config:autoupgrade:status":Oo},Xg=Is;export{As as AppInitHook,xs as AppPublicMetadataHook,bs as AppSensitiveMetadataHook,Kg as COMMANDS,Ti as DidYouMeanHook,Jg as HydrogenInitHook,xi as PluginHook,_i as TunnelProviderHook,Ii as TunnelStartHook,Xg as default,vi as fetchStoreThemes,bi as pull,Ai as push};
@@ -1 +1 @@
1
- import{Ab as c,Bb as d,Cb as e,yb as a,zb as b}from"./chunk-7FQFEB33.js";import"./chunk-A4SBXDZB.js";import"./chunk-NJOO5XJV.js";import"./chunk-ZG7BVVT2.js";import"./chunk-2O22LZKV.js";import"./chunk-S5IFJ737.js";import"./chunk-NNOSZ447.js";import"./chunk-773TIA5M.js";import"./chunk-CRALWNNO.js";import"./chunk-VKWPEFWQ.js";export{a as currentProcessIsGlobal,e as getProjectDir,d as inferPackageManagerForGlobalCLI,c as installGlobalCLIPrompt,b as installGlobalShopifyCLI};
1
+ import{Ab as c,Bb as d,Cb as e,yb as a,zb as b}from"./chunk-BXDZX3BS.js";import"./chunk-A4SBXDZB.js";import"./chunk-NJOO5XJV.js";import"./chunk-ZG7BVVT2.js";import"./chunk-2O22LZKV.js";import"./chunk-MGPLKG23.js";import"./chunk-NNOSZ447.js";import"./chunk-773TIA5M.js";import"./chunk-CRALWNNO.js";import"./chunk-VKWPEFWQ.js";export{a as currentProcessIsGlobal,e as getProjectDir,d as inferPackageManagerForGlobalCLI,c as installGlobalCLIPrompt,b as installGlobalShopifyCLI};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-LKZ7ARYS.js";import"./chunk-AAK376RT.js";import"./chunk-P2OI2P2M.js";import"./chunk-636CTEW7.js";import"./chunk-T6CC5WUU.js";import"./chunk-UQWFDL3F.js";import"./chunk-I5A6BPCP.js";import"./chunk-CX5CC6P5.js";import"./chunk-ET2CGROE.js";import"./chunk-TOLPNBZK.js";import"./chunk-CRALWNNO.js";import"./chunk-VKWPEFWQ.js";export{a as commands,b as hooks};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-TC3JOEMA.js";import"./chunk-XWPPBOGF.js";import"./chunk-IWOTLFOY.js";import"./chunk-EJDWYASP.js";import"./chunk-A4SBXDZB.js";import"./chunk-AAK376RT.js";import"./chunk-T6CC5WUU.js";import"./chunk-UQWFDL3F.js";import"./chunk-I5A6BPCP.js";import"./chunk-CX5CC6P5.js";import"./chunk-ET2CGROE.js";import"./chunk-TOLPNBZK.js";import"./chunk-CRALWNNO.js";import"./chunk-VKWPEFWQ.js";export{a as commands};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v}from"./chunk-S5IFJ737.js";import"./chunk-NNOSZ447.js";import"./chunk-773TIA5M.js";import"./chunk-VKWPEFWQ.js";export{h as alwaysLogAnalytics,i as alwaysLogMetrics,g as analyticsDisabled,k as canRunDoctorRelease,s as ciPlatform,q as cloudEnvironment,n as codespacePortForwardingDomain,m as codespaceURL,j as firstPartyDev,u as getThemeKitAccessDomain,l as gitpodURL,r as hasGit,b as homeDirectory,o as isCloudEnvironment,c as isDevelopment,e as isShopify,a as isTerminalInteractive,f as isUnitTest,d as isVerbose,t as macAddress,v as opentelemetryDomain,p as themeToken};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v}from"./chunk-MGPLKG23.js";import"./chunk-NNOSZ447.js";import"./chunk-773TIA5M.js";import"./chunk-VKWPEFWQ.js";export{h as alwaysLogAnalytics,i as alwaysLogMetrics,g as analyticsDisabled,k as canRunDoctorRelease,s as ciPlatform,q as cloudEnvironment,n as codespacePortForwardingDomain,m as codespaceURL,j as firstPartyDev,u as getThemeKitAccessDomain,l as gitpodURL,r as hasGit,b as homeDirectory,o as isCloudEnvironment,c as isDevelopment,e as isShopify,a as isTerminalInteractive,f as isUnitTest,d as isVerbose,t as macAddress,v as opentelemetryDomain,p as themeToken};
@@ -0,0 +1 @@
1
+ import{b as a}from"./chunk-BU7R7NFL.js";import"./chunk-RJ5VF3QY.js";import"./chunk-AUZCENYI.js";import"./chunk-BXDZX3BS.js";import"./chunk-A4SBXDZB.js";import"./chunk-NJOO5XJV.js";import"./chunk-ZG7BVVT2.js";import"./chunk-2O22LZKV.js";import"./chunk-MGPLKG23.js";import"./chunk-NNOSZ447.js";import"./chunk-773TIA5M.js";import"./chunk-T6CC5WUU.js";import"./chunk-UQWFDL3F.js";import"./chunk-I5A6BPCP.js";import"./chunk-CX5CC6P5.js";import"./chunk-ET2CGROE.js";import"./chunk-TOLPNBZK.js";import"./chunk-CRALWNNO.js";import"./chunk-VKWPEFWQ.js";export{a as LocalStorage};
@@ -1 +1 @@
1
- import{a,b,c,d,e,f}from"./chunk-VI34CKV6.js";import"./chunk-S5IFJ737.js";import"./chunk-NNOSZ447.js";import"./chunk-773TIA5M.js";import"./chunk-VKWPEFWQ.js";export{d as addPublicMetadata,e as addSensitiveMetadata,a as createRuntimeMetadataContainer,b as getAllPublicMetadata,c as getAllSensitiveMetadata,f as runWithTimer};
1
+ import{a,b,c,d,e,f}from"./chunk-N5U5Q2MG.js";import"./chunk-MGPLKG23.js";import"./chunk-NNOSZ447.js";import"./chunk-773TIA5M.js";import"./chunk-VKWPEFWQ.js";export{d as addPublicMetadata,e as addSensitiveMetadata,a as createRuntimeMetadataContainer,b as getAllPublicMetadata,c as getAllSensitiveMetadata,f as runWithTimer};