shopify 3.94.2 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.js +5 -1
- package/dist/analytics-6IHHYAV6.js +1 -0
- package/dist/analytics-KKVP5DT3.js +1 -0
- package/dist/bootstrap.d.ts +5 -0
- package/dist/bootstrap.js +3 -0
- package/dist/chunk-22PCRFG4.js +1 -0
- package/dist/chunk-26D72ZNV.js +1 -0
- package/dist/chunk-2APPXD5Z.js +2 -0
- package/dist/chunk-2I4PRX2I.js +1 -0
- package/dist/chunk-2VQJQ36C.js +103 -0
- package/dist/chunk-323UTVMM.js +1 -0
- package/dist/chunk-3DQIVE24.js +9 -0
- package/dist/chunk-3F6NZK7S.js +2 -0
- package/dist/chunk-3LVGAQB4.js +1 -0
- package/dist/chunk-3TNEIDOD.js +1 -0
- package/dist/chunk-3VZEETAV.js +1 -0
- package/dist/chunk-4G7J6HIV.js +1 -0
- package/dist/chunk-4HHXSMD7.js +10 -0
- package/dist/chunk-4LNCYIS3.js +1 -0
- package/dist/chunk-4ZGSSQC6.js +1 -0
- package/dist/chunk-52GC6XUT.js +1 -0
- package/dist/chunk-5CH3B62S.js +2 -0
- package/dist/chunk-5Y7GIF2W.js +1 -0
- package/dist/chunk-66RJ5T7A.js +102 -0
- package/dist/chunk-6B53BWJW.js +1 -0
- package/dist/chunk-6BMMB2UO.js +1 -0
- package/dist/chunk-6HBRBQAN.js +6 -0
- package/dist/chunk-6M3ZYNGO.js +451 -0
- package/dist/chunk-6TZAAS5H.js +1 -0
- package/dist/chunk-72F3YBNA.js +1 -0
- package/dist/chunk-74HYYXXE.js +17 -0
- package/dist/chunk-75VPUOC5.js +1 -0
- package/dist/chunk-7BGM2GAH.js +1 -0
- package/dist/chunk-7UYZQN4V.js +18 -0
- package/dist/chunk-A74GETYC.js +1 -0
- package/dist/chunk-AIV5RI3X.js +1 -0
- package/dist/chunk-ALKTLKQ6.js +5 -0
- package/dist/chunk-B2EHO7ZC.js +847 -0
- package/dist/chunk-B2IVY4V5.js +1 -0
- package/dist/chunk-BDVAE5MS.js +28 -0
- package/dist/chunk-CERXUPGC.js +14 -0
- package/dist/chunk-D3TSJA5S.js +1 -0
- package/dist/chunk-D6JARNEH.js +1 -0
- package/dist/chunk-DFMQWJQ3.js +3 -0
- package/dist/chunk-DJONKJSZ.js +1 -0
- package/dist/chunk-DJQVNH7P.js +567 -0
- package/dist/chunk-DU4WR4OP.js +1 -0
- package/dist/chunk-ELVFJ7BR.js +4 -0
- package/dist/chunk-ELYP4KFP.js +8 -0
- package/dist/chunk-FFQ5EWII.js +294 -0
- package/dist/chunk-FUOIGXI4.js +1 -0
- package/dist/chunk-GD7FWXJ5.js +2 -0
- package/dist/chunk-GFEAKSGV.js +374 -0
- package/dist/chunk-GFJ7UV74.js +1 -0
- package/dist/chunk-GNPS5SBU.js +1 -0
- package/dist/chunk-GOJ2QHSR.js +1 -0
- package/dist/chunk-HSK7YMRE.js +359 -0
- package/dist/chunk-HUZUORYM.js +19 -0
- package/dist/chunk-HZA6IAA4.js +1 -0
- package/dist/chunk-IASVAERO.js +1 -0
- package/dist/chunk-IIIVWD4R.js +1 -0
- package/dist/chunk-INEU4XKS.js +6 -0
- package/dist/chunk-IOLVEXM6.js +1 -0
- package/dist/chunk-IU2ZQ6TE.js +2 -0
- package/dist/chunk-IX5ICOBV.js +7 -0
- package/dist/chunk-J3KVONB3.js +6 -0
- package/dist/chunk-JGXWQULI.js +1 -0
- package/dist/chunk-JHPRFW5B.js +19 -0
- package/dist/chunk-JLBH7RCF.js +4 -0
- package/dist/chunk-JPGO36XP.js +1 -0
- package/dist/chunk-JUVAGMIH.js +1 -0
- package/dist/chunk-JVIKCGDY.js +1 -0
- package/dist/chunk-K2WUCOQJ.js +32 -0
- package/dist/chunk-K5YV6UVF.js +4 -0
- package/dist/chunk-KBQ4LGFB.js +1 -0
- package/dist/chunk-KGXQS7LS.js +1 -0
- package/dist/chunk-KL5Z3T6L.js +1 -0
- package/dist/chunk-KLMDWDT2.js +1 -0
- package/dist/chunk-KNVM7N3U.js +1 -0
- package/dist/chunk-KWJ562F2.js +12 -0
- package/dist/chunk-LALIKZPS.js +5 -0
- package/dist/chunk-LAZJ47DZ.js +6 -0
- package/dist/chunk-LDGAHMS7.js +159 -0
- package/dist/chunk-LNHLDRC5.js +1 -0
- package/dist/chunk-LW7U753G.js +1 -0
- package/dist/chunk-LX3ZOW52.js +12 -0
- package/dist/chunk-LXFJDCNG.js +1 -0
- package/dist/chunk-MBAFWQSZ.js +7 -0
- package/dist/chunk-MOA33ZFO.js +1 -0
- package/dist/chunk-MQNYGGAM.js +1 -0
- package/dist/chunk-N5YIPQ6J.js +1 -0
- package/dist/chunk-N7RBSKYT.js +1 -0
- package/dist/chunk-NF2ABOOU.js +1 -0
- package/dist/chunk-NRAFVIU3.js +1 -0
- package/dist/chunk-OCOY5MV2.js +1 -0
- package/dist/chunk-ODNGDO4H.js +50 -0
- package/dist/chunk-OHY4ZL3U.js +2 -0
- package/dist/chunk-OLZHWPZP.js +1 -0
- package/dist/chunk-OUOYKNMY.js +1 -0
- package/dist/chunk-OXPWCC7I.js +64 -0
- package/dist/chunk-P5VVOLGV.js +1 -0
- package/dist/chunk-P6XE4MH5.js +1 -0
- package/dist/chunk-P7R7FBY2.js +3 -0
- package/dist/chunk-PD5ZHJWI.js +1 -0
- package/dist/chunk-PIBY5DDZ.js +1 -0
- package/dist/chunk-Q7ING5F5.js +1 -0
- package/dist/chunk-QFWIDATO.js +1 -0
- package/dist/chunk-QRRNOVJ3.js +1 -0
- package/dist/chunk-QSTEVZFQ.js +1 -0
- package/dist/chunk-R466TU3N.js +2 -0
- package/dist/chunk-RF2DPBA6.js +1 -0
- package/dist/chunk-RFG5RMPL.js +1 -0
- package/dist/chunk-RM5SJJN6.js +559 -0
- package/dist/chunk-RVNMVBPM.js +1 -0
- package/dist/chunk-SBEZBZM7.js +144 -0
- package/dist/chunk-SGQ6D3LU.js +15 -0
- package/dist/chunk-SRCQVUMC.js +1 -0
- package/dist/chunk-TFSBQ4RY.js +5 -0
- package/dist/chunk-TQYMC7TH.js +1 -0
- package/dist/chunk-UGDBJTLP.js +6 -0
- package/dist/chunk-UGXYQ23Y.js +1411 -0
- package/dist/chunk-UWJ73J4B.js +1 -0
- package/dist/chunk-V2CNCPIE.js +2 -0
- package/dist/chunk-VBUZWRUL.js +1 -0
- package/dist/chunk-VS3T5YOG.js +264 -0
- package/dist/chunk-VWYM4OWK.js +1 -0
- package/dist/chunk-VY6SNDKW.js +3 -0
- package/dist/chunk-WDC3KIZT.js +2 -0
- package/dist/chunk-WFXRSKRK.js +1 -0
- package/dist/chunk-WXVZJJOR.js +16 -0
- package/dist/chunk-WZBSLU4Q.js +6 -0
- package/dist/chunk-XBXMPFXM.js +1 -0
- package/dist/chunk-XEFQQPL4.js +1 -0
- package/dist/chunk-XLELNRFF.js +3 -0
- package/dist/chunk-XNO6DZYP.js +1 -0
- package/dist/chunk-Y5JKV2AI.js +1 -0
- package/dist/chunk-YC6G4MHD.js +3 -0
- package/dist/chunk-YI232QLS.js +1 -0
- package/dist/chunk-YMWHHINU.js +1 -0
- package/dist/chunk-YOZNRLFC.js +1 -0
- package/dist/chunk-YZDDTYTU.js +11 -0
- package/dist/chunk-Z35BTAM6.js +2 -0
- package/dist/chunk-ZR76GGZ6.js +5 -0
- package/dist/chunk-ZTMSBSYD.js +1 -0
- package/dist/chunk-ZV6NCNI4.js +586 -0
- package/dist/chunk-ZVJVDCIM.js +1 -0
- package/dist/cli/commands/app/app-logs/sources.js +2 -0
- package/dist/cli/commands/app/build.js +1 -0
- package/dist/cli/commands/app/bulk/cancel.js +1 -0
- package/dist/cli/commands/app/bulk/execute.js +9 -0
- package/dist/cli/commands/app/bulk/status.js +5 -0
- package/dist/cli/commands/app/config/link.js +4 -0
- package/dist/cli/commands/app/config/pull.js +1 -0
- package/dist/cli/commands/app/config/use.js +1 -0
- package/dist/cli/commands/app/config/validate.js +3 -0
- package/dist/cli/commands/app/demo/watcher.js +1 -0
- package/dist/cli/commands/app/deploy.js +22 -0
- package/dist/cli/commands/app/dev/clean.js +5 -0
- package/dist/cli/commands/app/dev.js +320 -0
- package/dist/cli/commands/app/env/pull.js +11 -0
- package/dist/cli/commands/app/env/show.js +1 -0
- package/dist/cli/commands/app/execute.js +1 -0
- package/dist/cli/commands/app/function/build.js +1 -0
- package/dist/cli/commands/app/function/info.js +16 -0
- package/dist/cli/commands/app/function/replay.js +5 -0
- package/dist/cli/commands/app/function/run.js +1 -0
- package/dist/cli/commands/app/function/schema.js +1 -0
- package/dist/cli/commands/app/function/typegen.js +1 -0
- package/dist/cli/commands/app/generate/extension.js +5 -0
- package/dist/cli/commands/app/import-custom-data-definitions.js +4 -0
- package/dist/cli/commands/app/import-extensions.js +1 -0
- package/dist/cli/commands/app/info.js +11 -0
- package/dist/cli/commands/app/init.js +10 -0
- package/dist/cli/commands/app/logs.js +2 -0
- package/dist/cli/commands/app/release.js +4 -0
- package/dist/cli/commands/app/versions/list.js +1 -0
- package/dist/cli/commands/app/webhook/trigger.js +25 -0
- package/dist/cli/commands/auth/login.js +1 -20
- package/dist/cli/commands/auth/logout.js +1 -12
- package/dist/cli/commands/cache/clear.js +1 -11
- package/dist/cli/commands/config/autoupgrade/constants.d.ts +0 -1
- package/dist/cli/commands/config/autoupgrade/constants.js +1 -6
- package/dist/cli/commands/config/autoupgrade/off.js +1 -22
- package/dist/cli/commands/config/autoupgrade/on.js +1 -22
- package/dist/cli/commands/config/autoupgrade/status.js +1 -30
- package/dist/cli/commands/debug/command-flags.js +1 -79
- package/dist/cli/commands/docs/generate.js +1 -157
- package/dist/cli/commands/doctor-release/doctor-release.js +1 -25
- package/dist/cli/commands/doctor-release/theme/index.js +1 -56
- package/dist/cli/commands/help.js +1 -26
- package/dist/cli/commands/kitchen-sink/async.js +1 -16
- package/dist/cli/commands/kitchen-sink/index.js +1 -21
- package/dist/cli/commands/kitchen-sink/prompts.js +1 -16
- package/dist/cli/commands/kitchen-sink/static.js +1 -16
- package/dist/cli/commands/notifications/generate.js +1 -11
- package/dist/cli/commands/notifications/list.js +1 -33
- package/dist/cli/commands/organization/list.js +1 -0
- package/dist/cli/commands/search.js +1 -27
- package/dist/cli/commands/theme/check.js +1 -0
- package/dist/cli/commands/theme/console.js +15 -0
- package/dist/cli/commands/theme/delete.js +7 -0
- package/dist/cli/commands/theme/dev.js +26 -0
- package/dist/cli/commands/theme/duplicate.js +32 -0
- package/dist/cli/commands/theme/info.js +1 -0
- package/dist/cli/commands/theme/init.js +8 -0
- package/dist/cli/commands/theme/language-server.js +1 -0
- package/dist/cli/commands/theme/list.js +1 -0
- package/dist/cli/commands/theme/metafields/pull.js +3 -0
- package/dist/cli/commands/theme/open.js +8 -0
- package/dist/cli/commands/theme/package.js +7 -0
- package/dist/cli/commands/theme/preview.js +1 -0
- package/dist/cli/commands/theme/profile.js +3 -0
- package/dist/cli/commands/theme/publish.js +7 -0
- package/dist/cli/commands/theme/pull.js +3 -0
- package/dist/cli/commands/theme/push.js +28 -0
- package/dist/cli/commands/theme/rename.js +6 -0
- package/dist/cli/commands/theme/share.js +3 -0
- package/dist/cli/commands/upgrade.js +1 -17
- package/dist/cli/commands/version.js +1 -10
- package/dist/command-registry.d.ts +8 -0
- package/dist/command-registry.js +1 -0
- package/dist/conf-store-U5ZITKJN.js +1 -0
- package/dist/custom-oclif-loader-DVFFWCBV.js +1 -0
- package/dist/deprecations-TU5UQJVV.js +1 -0
- package/dist/dist-2Z5TND4U.js +1 -0
- package/dist/dist-GYHFDHKP.js +1 -0
- package/dist/environments-Z5PR7DSI.js +1 -0
- package/dist/error-IJGNYKZ3.js +1 -0
- package/dist/error-handler-WSCGNS2P.js +1 -0
- package/dist/fs-5BDEA2KD.js +1 -0
- package/dist/hooks/app-init.d.ts +9 -0
- package/dist/hooks/app-init.js +1 -0
- package/dist/hooks/did-you-mean.d.ts +1 -0
- package/dist/hooks/did-you-mean.js +1 -0
- package/dist/hooks/hydrogen-init.d.ts +7 -0
- package/dist/hooks/hydrogen-init.js +1 -0
- package/dist/hooks/plugin-plugins.d.ts +1 -0
- package/dist/hooks/plugin-plugins.js +1 -0
- package/dist/hooks/postrun.js +1 -1
- package/dist/hooks/prerun.js +1 -1
- package/dist/hooks/public-metadata.d.ts +1 -0
- package/dist/hooks/public-metadata.js +1 -0
- package/dist/hooks/sensitive-metadata.d.ts +1 -0
- package/dist/hooks/sensitive-metadata.js +1 -0
- package/dist/hooks/tunnel-provider.d.ts +1 -0
- package/dist/hooks/tunnel-provider.js +1 -0
- package/dist/hooks/tunnel-start.d.ts +1 -0
- package/dist/hooks/tunnel-start.js +1 -0
- package/dist/http-proxy-node16-Q5DZMBHC.js +38 -0
- package/dist/index.js +254 -3668
- package/dist/is-global-V4ZRHQG2.js +1 -0
- package/dist/latest-version-EFWBOTWM.js +49 -0
- package/dist/lib-5L7UKDEK.js +1 -0
- package/dist/lib-C3VO2BQW.js +1 -0
- package/dist/lib-QB6I6CTC.js +1 -0
- package/dist/local-6QPX4GCJ.js +1 -0
- package/dist/local-storage-JLXBZVWO.js +1 -0
- package/dist/metadata-UDMOTRS7.js +1 -0
- package/dist/{morph-DQREIZD2.js → morph-EMYAITFM.js} +1 -1
- package/dist/node-package-manager-HAFRYGUM.js +1 -0
- package/dist/notifications-system-MP7WDOCS.js +1 -0
- package/dist/npa-ICFSA3NL.js +1 -0
- package/dist/output-YGMHXEIS.js +1 -0
- package/dist/{path-HUAU3YBW.js → path-CWUNINMX.js} +1 -1
- package/dist/{prettier-PGDJ5B7I.js → prettier-NVRHEAFO.js} +1 -1
- package/dist/system-KLXD4FXF.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/typescript-K5CWIA4V.js +1 -0
- package/dist/ui-GHG3UGB3.js +1 -0
- package/dist/upgrade-OPZGPM5J.js +1 -0
- package/dist/version-D5PJZIRW.js +1 -0
- package/dist/version-KRQBMYCH.js +1 -0
- package/dist/workerd-L2EJKIAQ.js +18 -0
- package/oclif.manifest.json +5247 -6056
- package/package.json +17 -41
- package/dist/chunk-2E6Y4J4T.js +0 -3
- package/dist/chunk-45T5XUIM.js +0 -1
- package/dist/chunk-52KHWFYF.js +0 -1
- package/dist/chunk-FU2Y2M3M.js +0 -5
- package/dist/chunk-JBSYWYIP.js +0 -2
- package/dist/chunk-KVWHPGOA.js +0 -415
- package/dist/chunk-LH4VO6EV.js +0 -63
- package/dist/chunk-PRNHS74J.js +0 -847
- package/dist/chunk-RXF32AET.js +0 -396
- package/dist/chunk-SVA22NZQ.js +0 -607
- package/dist/chunk-YPE4BWWD.js +0 -3
- package/dist/error-handler-CRWXGODM.js +0 -1
- package/dist/http-proxy-node16-TTURN6MD.js +0 -38
- package/dist/lib-3WHF5XD3.js +0 -1
- package/dist/local-7MUCLBBI.js +0 -1
- package/dist/node-package-manager-GFIGZZ24.js +0 -1
- package/dist/npa-OKDXXRCU.js +0 -1
- package/dist/ui-AOFJCTTO.js +0 -1
- package/dist/workerd-VBG5LYNX.js +0 -18
- /package/dist/{chunk-KADPE3PY.js → chunk-7MUKLZOL.js} +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{b as A,c as S,d as I}from"../../../../chunk-IIIVWD4R.js";import{a as b}from"../../../../chunk-ZVJVDCIM.js";import{a as y}from"../../../../chunk-RF2DPBA6.js";import{Ca as C,a as P,b as x}from"../../../../chunk-SBEZBZM7.js";import"../../../../chunk-DJQVNH7P.js";import"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import{b as h,c as d}from"../../../../chunk-323UTVMM.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import{u as f}from"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import{Gb as l,Ib as m,Mb as g}from"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import{d as p}from"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{g as s}from"../../../../chunk-VPRTJUIN.js";s();s();function k(n,t){let r={};return n.targeting?.forEach(i=>{i.target&&(r[i.target]={...i.input_query&&{inputQueryPath:`${t}/${i.input_query}`},...i.export&&{export:i.export}})}),r}function F(n,t,r,i,e,o){return JSON.stringify({handle:t.handle,name:n.name,apiVersion:t.api_version,targeting:r,schemaPath:o,wasmPath:e,functionRunnerPath:i},null,2)}function N(n,t){return{title:`CONFIGURATION
|
|
2
|
+
`,body:{tabularData:[["Handle",n.handle??"N/A"],["Name",t??"N/A"],["API Version",n.api_version??"N/A"]],firstColumnSubdued:!0}}}function O(n){if(Object.keys(n).length===0)return null;let t=[];return Object.entries(n).forEach(([r,i])=>{t.push([m`${l.cyan(r)}`.value,""]),i.inputQueryPath&&t.push([{subdued:" Input Query Path"},{filePath:i.inputQueryPath}]),i.export&&t.push([{subdued:" Export"},i.export])}),{title:`
|
|
3
|
+
TARGETING
|
|
4
|
+
`,body:{tabularData:t}}}function R(n,t){return{title:`
|
|
5
|
+
BUILD
|
|
6
|
+
`,body:{tabularData:[["Schema Path",{filePath:t??"N/A"}],["Wasm Path",{filePath:n}]],firstColumnSubdued:!0}}}function w(n){return{title:`
|
|
7
|
+
FUNCTION RUNNER
|
|
8
|
+
`,body:{tabularData:[["Path",{filePath:n}]],firstColumnSubdued:!0}}}function j(n,t,r,i,e,o){let a=[N(t,n.name)],u=O(r);return u&&a.push(u),a.push(R(e,o),w(i)),a}function T(n,t){let{format:r,functionRunnerPath:i,schemaPath:e}=t,o=n.configuration,a=k(o,n.directory),u=p(n.directory,o.build?.path??n.outputRelativePath);return r==="json"?F(n,o,a,i,u,e):j(n,o,a,i,u,e)}var c=class n extends b{static{this.summary="Print basic information about your function."}static{this.descriptionWithMarkdown=`The information returned includes the following:
|
|
9
|
+
|
|
10
|
+
- The function handle
|
|
11
|
+
- The function name
|
|
12
|
+
- The function API version
|
|
13
|
+
- The targeting configuration
|
|
14
|
+
- The schema path
|
|
15
|
+
- The WASM path
|
|
16
|
+
- The function runner path`}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...h,...y,...A,...d}}async run(){let{flags:t}=await this.parse(n),{app:r}=await C({directory:t.path,userProvidedConfigName:t.config}),i=await S(r,t.path),e=P();await x(e);let o=await I(i,t.path,t["client-id"],t.reset,t.config),a=T(i,{format:t.json?"json":"text",functionRunnerPath:e.path,schemaPath:o});return t.json?g(a):f({customSections:a}),{app:r}}};export{c as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as S}from"../../../../chunk-YI232QLS.js";import{b as nn,c as tn}from"../../../../chunk-IIIVWD4R.js";import{a as Z}from"../../../../chunk-J3KVONB3.js";import{z as O}from"../../../../chunk-ALKTLKQ6.js";import{a as X}from"../../../../chunk-D3TSJA5S.js";import{a as V}from"../../../../chunk-RF2DPBA6.js";import{Ba as Q}from"../../../../chunk-SBEZBZM7.js";import"../../../../chunk-DJQVNH7P.js";import"../../../../chunk-UWJ73J4B.js";import"../../../../chunk-WFXRSKRK.js";import"../../../../chunk-YOZNRLFC.js";import"../../../../chunk-XEFQQPL4.js";import"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-4ZGSSQC6.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import{b as z,c as Y}from"../../../../chunk-323UTVMM.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import{B as U,a as C,i as J,j as K,k as b,p as T}from"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import{d as B}from"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import{r as yn}from"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import{a as G}from"../../../../chunk-V2CNCPIE.js";import{eb as P,fb as c,gb as u,ib as $,jb as j,kb as H,ma as E}from"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import{f as q}from"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import{d as A}from"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{e as R,g as a}from"../../../../chunk-VPRTJUIN.js";a();a();a();a();a();var y=R(P(),1);import{Writable as on}from"stream";function en({selectedRun:n,abortController:t,app:r,extension:e,appWatcher:i}){let s={type:"functionRun",input:n.payload.input,output:n.payload.output,logs:n.payload.logs,name:n.source,size:0,memory_usage:0,instructions:n.payload.fuelConsumed},[p,f]=(0,y.useState)([]),[m,l]=(0,y.useState)([s,s]),[h,g]=(0,y.useState)(void 0),{input:F,export:M}=n.payload,[mn,L]=(0,y.useState)(`Watching for changes to ${n.source}...`);return(0,y.useEffect)(()=>{let I=new C;t.signal.addEventListener("abort",()=>{I.abort()});let _=async()=>{let x=await hn(e,JSON.stringify(F),M);l(d=>[x,d[0]]),L(`Watching for changes to ${n.source}...`),f(d=>[...d,x])},fn=async()=>{L("Replaying log with local function..."),await _()},gn=async()=>{i.onEvent(async d=>{let w=d.extensionEvents.find(k=>k.extension.handle===e.handle);if(!(!w||w.type!=="changed")){if(w.buildResult?.status==="error"){g(`Error while reloading and building extension: ${w.buildResult?.error}`);return}g(void 0),L("Re-running with latest changes..."),await _()}});let x=new on({write(d,w,k){f(dn=>[...dn,{type:"systemMessage",message:d.toString()}]),k()}});await i.start({stdout:x,stderr:x,signal:I.signal},!1)};return fn().then(()=>{gn()}),()=>{I.abort()}},[F,M,r,e]),T(t.signal,async()=>{setTimeout(()=>{q()||G(process.pid,"SIGINT",!1,()=>{process.exit(0)})},2e3)}),{logs:p,statusMessage:mn,recentFunctionRuns:m,error:h}}async function hn(n,t,r){let e="",i=new on({write(p,f,m){e+=p,m()}});return await S({functionExtension:n,input:t,export:r,stdout:i,json:!0}),{...JSON.parse(e),type:"functionRun"}}var o=R(P(),1);var rn=({selectedRun:n,abortController:t,app:r,extension:e})=>{let{isAborted:i}=T(t.signal),{isRawModeSupported:s}=j(),p=new Z(r),{logs:f,statusMessage:m,recentFunctionRuns:l,error:h}=en({selectedRun:n,abortController:t,app:r,extension:e,appWatcher:p});return H((g,F)=>{K(g,F,()=>t.abort()),g==="q"&&t.abort()},{isActive:!!s}),o.default.createElement(o.default.Fragment,null,o.default.createElement($,{items:f},(g,F)=>o.default.createElement(c,{key:`replayOutputScrollerLog${F}`,flexDirection:"column"},o.default.createElement(Cn,{log:g}))),i?null:o.default.createElement(c,{marginY:1,paddingTop:1,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},s?o.default.createElement(c,{flexDirection:"column"},o.default.createElement(c,{flexDirection:"row"},o.default.createElement(u,null,b.pointerSmall," ",m)),o.default.createElement(Rn,{recentFunctionRuns:l}),o.default.createElement(u,null,b.pointerSmall," Press ",o.default.createElement(u,{bold:!0},"q")," ",b.lineVertical," quit")):null,h?o.default.createElement(u,{color:"red"},h):null))};function D({title:n,backgroundColor:t}){let r=Math.max(Math.round((28-n.length)/2),0),e=" ".repeat(r);return o.default.createElement(u,{backgroundColor:t,color:"black"},`
|
|
2
|
+
|
|
3
|
+
`,e,n,e,`
|
|
4
|
+
`)}function Fn({input:n}){return o.default.createElement(c,{flexDirection:"column"},o.default.createElement(D,{title:"Input",backgroundColor:"yellow"}),o.default.createElement(u,null,O(n)))}function xn({logs:n}){return o.default.createElement(c,{flexDirection:"column"},o.default.createElement(D,{title:"Logs",backgroundColor:"blueBright"}),o.default.createElement(u,null,n))}function wn({output:n}){return o.default.createElement(c,{flexDirection:"column"},o.default.createElement(D,{title:"Output",backgroundColor:"greenBright"}),o.default.createElement(u,null,O(n)))}function bn({functionRun:n}){return o.default.createElement(c,{flexDirection:"column"},o.default.createElement(D,{title:"Benchmark Results",backgroundColor:"green"}),o.default.createElement(u,null,"Name: ",n.name),o.default.createElement(u,null,"Linear Memory Usage: ",n.memory_usage,"KB"),o.default.createElement(u,null,"Instructions: ",n.instructions/1e3,"K"),o.default.createElement(u,null,"Size: ",n.size,"KB"))}function Rn({recentFunctionRuns:n}){let t=n[0].instructions-n[1].instructions;return o.default.createElement(c,{flexDirection:"column"},o.default.createElement(u,null,b.pointerSmall," Instruction count change: ",t>0?"+":"",t))}function Cn({log:n}){switch(n.type){case"functionRun":return o.default.createElement(c,{flexDirection:"column"},o.default.createElement(Fn,{input:n.input}),o.default.createElement(xn,{logs:n.logs}),o.default.createElement(wn,{output:n.output}),o.default.createElement(bn,{functionRun:n}),o.default.createElement(u,null,"\xA0"));case"systemMessage":return o.default.createElement(u,null,n.message);default:return null}}var sn=R(P(),1);async function un({selectedRun:n,abortController:t,app:r,extension:e}){return J(sn.default.createElement(rn,{selectedRun:n,abortController:t,app:r,extension:e}),{exitOnCtrlC:!1})}a();async function an(n){if(n.length===0)return;let t=i=>({label:`${i.logTimestamp} (${i.status}) - ${i.identifier}`,value:i}),r=n.map(t);return await U({message:"Which function run would you like to replay locally?",choices:r})}import{existsSync as Tn,readdirSync as Sn}from"fs";var v=100;async function cn(n){let{watch:t,extension:r,app:e}=n,i=new C;try{let s=e.getLogsDir(),p=n.log?await Dn(s,r.handle,n.log):await In(s,r.handle),{input:f,export:m}=p.payload;t?await un({selectedRun:p,abortController:i,app:e,extension:r}):await S({functionExtension:r,json:n.json,input:JSON.stringify(f),export:m})}catch(s){throw i.abort(),s}}async function Dn(n,t,r){let e=await Ln(n,t,r);if(e===void 0)throw new B(`No log found for '${r}'.
|
|
5
|
+
Searched ${n} for function ${t}.`);let i=await E(e);return JSON.parse(i)}function pn(n){let t=n.split(/[_.]/);if(!(t.length<6))return{namespace:t[3],functionHandle:t[4],identifier:t[5]}}async function Ln(n,t,r){let e=ln(n).find(i=>{let s=pn(i);return s?.namespace==="extensions"&&s?.functionHandle===t&&s?.identifier===r});return e?A(n,e):void 0}async function In(n,t){let r=await kn(n,t),e=await an(r);if(e===void 0)throw new B(`No logs found in ${n}`);return e}async function kn(n,t){let r=ln(n).filter(i=>{let s=pn(i);return s?.namespace==="extensions"&&s?.functionHandle===t}).reverse(),e=[];for(let i=0;i<r.length&&e.length<v;i+=v){let p=r.slice(i,i+v).map(l=>A(n,l)),m=(await Promise.all(p.map(async l=>{let h=await E(l);return{...JSON.parse(h),identifier:An(l)}}))).filter(l=>l.payload.input!=null);e=e.concat(m)}return e}function An(n){return n.split("_").pop().substring(0,6)}function ln(n){return Tn(n)?Sn(n):[]}var N=R(yn(),1),W=class n extends X{static{this.summary="Replays a function run from an app log."}static{this.descriptionWithMarkdown="Runs the function from your current directory for [testing purposes](https://shopify.dev/docs/apps/functions/testing-and-debugging). To learn how you can monitor and debug functions when errors occur, refer to [Shopify Functions error handling](https://shopify.dev/docs/api/functions/errors)."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...z,...V,...nn,...Y,log:N.Flags.string({char:"l",description:"Specifies a log identifier to replay instead of selecting from a list. The identifier is provided in the output of `shopify app dev` and is the suffix of the log file name.",env:"SHOPIFY_FLAG_LOG"}),watch:N.Flags.boolean({char:"w",hidden:!1,allowNo:!0,default:!0,description:"Re-run the function when the source code changes.",env:"SHOPIFY_FLAG_WATCH"})}}async run(){let{flags:t}=await this.parse(n),{app:r}=await Q({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),e=await tn(r,t.path);return await cn({app:r,extension:e,path:t.path,log:t.log,json:t.json,watch:t.watch}),{app:r}}};export{W as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as U}from"../../../../chunk-YI232QLS.js";import{b as F,c as P,d as w}from"../../../../chunk-IIIVWD4R.js";import{a as y}from"../../../../chunk-ZVJVDCIM.js";import{a as h}from"../../../../chunk-RF2DPBA6.js";import{Ca as x}from"../../../../chunk-SBEZBZM7.js";import"../../../../chunk-DJQVNH7P.js";import"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import{b as l,c as m}from"../../../../chunk-323UTVMM.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import{B as g,I as d}from"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import{r as k}from"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import{Qb as n}from"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{e as b,g as f}from"../../../../chunk-VPRTJUIN.js";f();var a=b(k(),1);var r="_start",s=class v extends y{static{this.summary="Run a function locally for testing."}static{this.descriptionWithMarkdown="Runs the function from your current directory for [testing purposes](https://shopify.dev/docs/apps/functions/testing-and-debugging). To learn how you can monitor and debug functions when errors occur, refer to [Shopify Functions error handling](https://shopify.dev/docs/api/functions/errors)."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...l,...h,...F,...m,input:a.Flags.string({char:"i",description:"The input JSON to pass to the function. If omitted, standard input is used.",env:"SHOPIFY_FLAG_INPUT"}),export:a.Flags.string({char:"e",hidden:!1,description:"Name of the WebAssembly export to invoke.",env:"SHOPIFY_FLAG_EXPORT"})}}async run(){let{flags:t}=await this.parse(v),o=r,{app:p}=await x({directory:t.path,userProvidedConfigName:t.config}),e=await P(p,t.path);if(t.export!==void 0)n(`Using export ${t.export} from the --export flag.`),o=t.export;else if(e.configuration.targeting!==void 0&&e.configuration.targeting.length>0){let i=e.configuration.targeting;if(i.length>1&&d({})){let T=i.map(u=>({label:u.target,value:u.export||r}));o=await g({message:"Which target would you like to execute?",choices:T})}else o=i?.[0]?.export||r,n(`Using export '${o}'. Use the --export flag or an interactive terminal to select a different export.`)}else n(`No targeting information found. Using the default export '${o}'. Use the --export flag or an interactive terminal to select a different export.`);let c=e?.configuration.targeting?.[0]?.input_query,A=c&&`${e?.directory}/${c}`,O=await w(e,t.path,t["client-id"],t.reset,t.config);return await U({functionExtension:e,json:t.json,inputPath:t.input,export:o,stdin:"inherit",schemaPath:O,queryPath:A}),{app:p}}};export{s as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as p,b as c,c as d}from"../../../../chunk-IIIVWD4R.js";import{a as r}from"../../../../chunk-D3TSJA5S.js";import{a as n}from"../../../../chunk-RF2DPBA6.js";import{Ba as s}from"../../../../chunk-SBEZBZM7.js";import"../../../../chunk-DJQVNH7P.js";import"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import{b as a}from"../../../../chunk-323UTVMM.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import{r as y}from"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{e as g,g as i}from"../../../../chunk-VPRTJUIN.js";i();var m=g(y(),1);var o=class u extends r{static{this.summary="Fetch the latest GraphQL schema for a function."}static{this.descriptionWithMarkdown="Generates the latest [GraphQL schema](https://shopify.dev/docs/apps/functions/input-output#graphql-schema) for a function in your app. Run this command from the function directory.\n\n This command uses the API type and version of your function, as defined in your extension TOML file, to generate the latest GraphQL schema. The schema is written to the `schema.graphql` file."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...a,...n,...c,stdout:m.Flags.boolean({description:"Output the schema to stdout instead of writing to a file.",required:!1,default:!1,env:"SHOPIFY_FLAG_STDOUT"})}}async run(){let{flags:t}=await this.parse(u),{app:e,developerPlatformClient:f,organization:h}=await s({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),l=await d(e,t.path);return await p({app:e,extension:l,stdout:t.stdout,developerPlatformClient:f,orgId:h.id}),{app:e}}};export{o as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as c,c as d}from"../../../../chunk-IIIVWD4R.js";import{a as u}from"../../../../chunk-ZVJVDCIM.js";import{a as p}from"../../../../chunk-RF2DPBA6.js";import{Ca as e,d as n}from"../../../../chunk-SBEZBZM7.js";import"../../../../chunk-DJQVNH7P.js";import"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import{b as i}from"../../../../chunk-323UTVMM.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import{v as s}from"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{g as r}from"../../../../chunk-VPRTJUIN.js";r();var a=class m extends u{static{this.summary="Generate GraphQL types for a function."}static{this.descriptionWithMarkdown="Creates GraphQL types based on your [input query](https://shopify.dev/docs/apps/functions/input-output#input) for a function. Supports JavaScript functions out of the box, or any language via the `build.typegen_command` configuration."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...i,...p,...c}}async run(){let{flags:t}=await this.parse(m),{app:o}=await e({directory:t.path,userProvidedConfigName:t.config}),f=await d(o,t.path);return await n(f,{stdout:process.stdout,stderr:process.stderr,app:o}),s({headline:"GraphQL types generated successfully."}),{app:o}}};export{a as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as ee,b as te}from"../../../../chunk-K5YV6UVF.js";import{a as Z}from"../../../../chunk-D3TSJA5S.js";import{a as W}from"../../../../chunk-RF2DPBA6.js";import{Ba as Q,D as B,F as K,c as J,d as X,l as w}from"../../../../chunk-SBEZBZM7.js";import{b as z,d as H}from"../../../../chunk-DJQVNH7P.js";import{b as v}from"../../../../chunk-SGQ6D3LU.js";import{c as q}from"../../../../chunk-P7R7FBY2.js";import{j as Y}from"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import{C as L,p as T,x as j,y as P}from"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import{b as $}from"../../../../chunk-323UTVMM.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import{d as h}from"../../../../chunk-JUVAGMIH.js";import{B as D,D as F,F as V,v as M,z as R}from"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import{d as f}from"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import{r as ue}from"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import{Hb as U,Oa as C,Ta as S,Ua as b,Wa as _,Y as u,ka as g,wa as G,ya as E}from"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import{e as N}from"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import{d,n as I}from"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{e as de,g as c}from"../../../../chunk-VPRTJUIN.js";c();c();c();async function ne(e,t,r){let{templates:i,groupOrder:n}=await e.templateSpecifications(t);return{templates:i.filter(a=>r.includes(a.identifier)||r.includes(a.type)),groupOrder:n}}c();function O(e){switch(e){case"vanilla-js":case"preact":case"react":case"typescript":case"typescript-react":return"javascript";case"rust":case"wasm":return e;case void 0:case"liquid":case"config-only":return}}async function ie(e){let t=e.extensionChoices.name,r=e.extensionChoices.flavor,i=e.extensionTemplate.supportedFlavors.find(s=>s.value===r),n=await te({app:e.app,name:t}),o=e.cloneUrl??e.extensionTemplate.url,a={directory:n,url:o,app:e.app,project:e.project,type:e.extensionTemplate.type,name:t,extensionFlavor:i,onGetTemplateRepository:e.onGetTemplateRepository??(async(s,p)=>{await q({repoUrl:s,destination:p,shallow:!0})})};return await fe(a),{directory:I(n),extensionTemplate:e.extensionTemplate}}async function fe(e){try{switch(e.type){case"theme":await xe(e);break;case"function":await ye(e);break;default:await ge(e);break}let t=d(e.directory,z.lockFile);await E(t)}catch(t){throw await E(e.directory),t}}async function xe({directory:e,url:t,type:r,name:i,extensionFlavor:n,onGetTemplateRepository:o}){return g(async a=>{let s=await A(t,n,a,o);await v(s,e,{name:i,type:r,uid:h(u(i))})})}async function ye({directory:e,url:t,app:r,project:i,name:n,extensionFlavor:o,onGetTemplateRepository:a}){let s=O(o?.value),p=[];p.push({title:"Generating function extension",task:async()=>{if(await g(async l=>{let m=await A(t,o,l,a);await v(m,e,{name:n,handle:u(n),flavor:o?.value,uid:h(u(n))})}),s==="javascript"){let l=re(o?.value??"rust");await oe(e,l,"!(*.graphql)")}}}),s==="javascript"&&p.push({title:"Installing additional dependencies",task:async()=>{i.usesWorkspaces&&await T({packageManager:i.packageManager,directory:i.directory});let l=Ee(s);await P(l,{packageManager:i.packageManager,type:"prod",directory:i.usesWorkspaces?e:i.directory})}}),s==="javascript"&&p.push({title:"Building GraphQL types",task:async()=>{await X({directory:e,isJavaScript:!0},{stdout:process.stdout,stderr:process.stderr,app:r})}}),await F(p)}async function ge({directory:e,url:t,app:r,project:i,name:n,extensionFlavor:o,onGetTemplateRepository:a}){let s=O(o?.value),p=[{title:"Generating extension",task:async()=>{let l=re(o?.value??"vanilla-js");await g(async m=>{let x=await A(t,o,m,a);await v(x,e,{srcFileExtension:l,name:n,handle:u(n),flavor:o?.value??"",uid:h(u(n))})}),s==="javascript"&&await oe(e,l)}},{title:"Installing dependencies",task:async()=>{let l=i.packageManager;if(i.usesWorkspaces)O(o?.value)==="javascript"&&await T({packageManager:l,directory:i.directory});else{await he(i.directory,o?.value);let m=d(e,"package.json"),x=await ve(m);await P(x,{packageManager:l,type:"prod",directory:i.directory}),await E(m)}}}];p.push({title:"Update shared type definition",task:async()=>{await K(r)}}),await F(p)}function re(e){return{"vanilla-js":"js",preact:"jsx",react:"jsx",typescript:"ts","typescript-react":"tsx",rust:"rs",wasm:"wasm",liquid:"liquid","config-only":""}[e]??"js"}function Ee(e){let t=[];return e==="javascript"&&t.push({name:"@shopify/shopify_function",version:`~${J}.0.0`}),t}async function oe(e,t,r="*"){let i=await _(d(e,"src",r)),n=[];for(let o of i)n.push(C(o,`${o}.${t}`));await Promise.all(n)}async function he(e,t){t==="typescript-react"&&await L(e,{"@types/react":H.reactTypes})}async function ve(e){if(!await S(e))return[];let t=await j(e);return Object.entries(t?.dependencies??{}).map(([r,i])=>({name:r,version:i}))}async function A(e,t,r,i){let n=d(r,"download");return await G(n),await i(e,n),ee(t,n)}c();function we(e,t=[]){let r=[...e.map(n=>({label:n.name,value:n.identifier,group:n.group||"Other",sortPriority:n.sortPriority??Number.MAX_SAFE_INTEGER})),...t.map(n=>({label:`${n.name} (limit reached)`,value:n.identifier,group:n.group||"Other",disabled:!0,sortPriority:n.sortPriority??Number.MAX_SAFE_INTEGER}))],i=(n,o)=>n.sortPriority===o.sortPriority?n.label.localeCompare(o.label):n.sortPriority-o.sortPriority;return r.sort(i)}var Te=async e=>{let t=e.extensionTemplates,r=e.templateType,i=e.extensionFlavor;if(!r){if(i&&(t=t.filter(p=>p.supportedFlavors.map(l=>l.value).includes(i))),t.length===0)throw new f("You have reached the limit for the number of extensions you can create.");r=await D({message:"Type of extension?",choices:we(t,e.unavailableExtensions),groupOrder:e.groupOrder})}let n=t.find(p=>p.identifier===r),o=e.name||await ae(e.directory,n.defaultName),a=e.extensionFlavor??await Pe(n);return{extensionTemplate:n,extensionContent:{name:o,flavor:a}}};async function ae(e,t,r=1){let i=t.includes(" ")?" ":"-",n=r<=1?t:`${t}${i}${r}`,o=d(e,u(n));return b(o)?ae(e,t,r+1):V({message:"Name your extension:",defaultValue:n})}async function Pe(e){if(e.supportedFlavors.length!==0)return e.supportedFlavors.length===1&&e.supportedFlavors[0]?e.supportedFlavors[0].value:R({message:"What would you like to work in?",choices:e.supportedFlavors.map(t=>({label:t.name,value:t.value})),defaultValue:"react"})}var se=Te;async function Fe(e){let{app:t,developerPlatformClient:r,remoteApp:i,specifications:n,template:o}=e,a=n.map(me=>me.identifier),{templates:s,groupOrder:p}=await ne(r,i,a),l=await Oe(s,p,n,t,e),m=await se(l);await ke(m,o);let x=Ie(m,t,e,r),ce=await ie(x);Ge(ce,e.project.packageManager)}async function Oe(e,t,r,i,n){let o=await be(n.template,i,e,r);Ce(o,n.flavor);let{validTemplates:a,templatesOverlimit:s}=Ae(e,r,i);return{templateType:o?.identifier,name:n.name,extensionFlavor:n.flavor,directory:d(n.directory,"extensions"),app:i,extensionTemplates:a??[],unavailableExtensions:s??[],reset:n.reset,groupOrder:t}}function Ae(e,t,r){return Y(e,n=>!pe(r,t,n)?"validTemplates":"templatesOverlimit")}function pe(e,t,r){let i=r.type,n=t.find(a=>a.identifier===i||a.externalIdentifier===i);return e.extensionsForType({identifier:i,externalIdentifier:i}).length>=(n?.registrationLimit??1)}async function ke(e,t){let{extensionContent:r}=e;return w.addPublicMetadata(()=>({cmd_scaffold_template_flavor:r.flavor,cmd_scaffold_type:e.extensionTemplate.identifier,cmd_scaffold_used_prompts_for_type:!t}))}function Ie(e,t,r,i){return{app:t,project:r.project,cloneUrl:r.cloneUrl,extensionChoices:e.extensionContent,extensionTemplate:e.extensionTemplate,developerPlatformClient:i}}function Ge(e,t){let r=Se(e.extensionTemplate,e.directory,t);M(r)}function Ce(e,t){if(!t||!e)return;let r=e.supportedFlavors.map(i=>i.value);if(!r.includes(t))throw new f("Invalid template for extension type",`Expected template to be one of the following: ${r.join(", ")}.`)}function Se(e,t,r){let i={headline:["Your extension was created in",{filePath:t},{char:"."}],nextSteps:[],reference:[]};return e.type!=="function"&&i.nextSteps.push(["To preview this extension along with the rest of the project, run",{command:U(r,"shopify app dev")}]),e.supportLinks[0]&&i.reference.push(["For more details, see the",{link:{label:"docs",url:e.supportLinks[0]}}]),i}async function be(e,t,r,i){if(!e)return;let n=r.find(o=>o.identifier===e);if(!n){let o=await N(),a=r.map(p=>p.identifier),s=o?"You might need to enable some flags on your Organization or App":void 0;throw new f(`Unknown extension type: ${e}.
|
|
2
|
+
The following extension types are supported: ${a.join(", ")}`,s)}if(pe(t,i,n))throw new f(`Invalid extension type: ${e}`,`You have reached the limit of extension(s) of type ${n.type} per app`);return n}var le=Fe;var y=de(ue(),1);var k=class e extends Z{static{this.summary="Generate a new app Extension."}static{this.descriptionWithMarkdown=`Generates a new [app extension](https://shopify.dev/docs/apps/build/app-extensions). For a list of app extensions that you can generate using this command, refer to [Supported extensions](https://shopify.dev/docs/apps/build/app-extensions/list-of-app-extensions).
|
|
3
|
+
|
|
4
|
+
Each new app extension is created in a folder under \`extensions/\`. To learn more about the extensions file structure, refer to [App structure](https://shopify.dev/docs/apps/build/cli-for-apps/app-structure) and the documentation for your extension.
|
|
5
|
+
`}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...$,...W,template:y.Flags.string({char:"t",hidden:!1,description:"Extension template",env:"SHOPIFY_FLAG_EXTENSION_TEMPLATE"}),name:y.Flags.string({char:"n",hidden:!1,description:"name of your Extension",env:"SHOPIFY_FLAG_NAME"}),"clone-url":y.Flags.string({hidden:!0,char:"u",description:"The Git URL to clone the function extensions templates from. Defaults to: https://github.com/Shopify/function-examples",env:"SHOPIFY_FLAG_CLONE_URL"}),flavor:y.Flags.string({hidden:!1,description:"Choose a starting template for your extension, where applicable",options:["vanilla-js","react","typescript","typescript-react","wasm","rust"],env:"SHOPIFY_FLAG_FLAVOR"})}}async run(){let{flags:t}=await this.parse(e);await w.addPublicMetadata(()=>({cmd_scaffold_required_auth:!0,cmd_scaffold_template_custom:t["clone-url"]!==void 0,cmd_scaffold_type_owner:"@shopify/app"})),await B(t.path);let{app:r,project:i,specifications:n,remoteApp:o,developerPlatformClient:a}=await Q({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config});return await le({directory:t.path,reset:t.reset,name:t.name,cloneUrl:t["clone-url"],template:t.template,flavor:t.flavor,app:r,project:i,specifications:n,remoteApp:o,developerPlatformClient:a}),{app:r}}};export{k as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as P}from"../../../chunk-QRRNOVJ3.js";import{a as C}from"../../../chunk-D3TSJA5S.js";import{a as O}from"../../../chunk-RF2DPBA6.js";import{Ba as j,D as R}from"../../../chunk-SBEZBZM7.js";import"../../../chunk-DJQVNH7P.js";import"../../../chunk-66RJ5T7A.js";import"../../../chunk-K2WUCOQJ.js";import"../../../chunk-ELYP4KFP.js";import"../../../chunk-7MUKLZOL.js";import"../../../chunk-VBUZWRUL.js";import"../../../chunk-XBXMPFXM.js";import"../../../chunk-R466TU3N.js";import"../../../chunk-UGXYQ23Y.js";import"../../../chunk-QSTEVZFQ.js";import"../../../chunk-5Y7GIF2W.js";import{e as I}from"../../../chunk-TQYMC7TH.js";import{a as z}from"../../../chunk-HUZUORYM.js";import"../../../chunk-52GC6XUT.js";import"../../../chunk-XLELNRFF.js";import{R as S,da as T,ga as _,z as F}from"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import{b as D}from"../../../chunk-323UTVMM.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import{D as h,E as f,u as A}from"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-IASVAERO.js";import{g as M}from"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import{r as Y}from"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import{Gb as p,Ib as m,Nb as k}from"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import{e as v,g as r}from"../../../chunk-VPRTJUIN.js";r();r();r();var w={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"metafieldDefinitions"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"ownerType"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"MetafieldOwnerType"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metafieldDefinitions"},arguments:[{kind:"Argument",name:{kind:"Name",value:"ownerType"},value:{kind:"Variable",name:{kind:"Name",value:"ownerType"}}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"30"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"MetafieldForImport"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"MetafieldForImport"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"MetafieldDefinition"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"namespace"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"type"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"category"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}},{kind:"Field",name:{kind:"Name",value:"access"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin"}},{kind:"Field",name:{kind:"Name",value:"storefront"}},{kind:"Field",name:{kind:"Name",value:"customerAccount"}}]}},{kind:"Field",name:{kind:"Name",value:"capabilities"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"adminFilterable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}}]}}]}},{kind:"Field",name:{kind:"Name",value:"validations"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"value"}}]}}]}}]};r();async function H(e){let i="Admin",n=I(e.storeFqdn,"unstable");return{token:e.token,api:i,url:n}}async function E(e){return _({query:e.query,...await H(e.session),variables:e.variables,autoRateLimitRestore:e.autoRateLimitRestore})}r();var V={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"metaobjectDefinitions"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"after"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metaobjectDefinitions"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"IntValue",value:"10"}},{kind:"Argument",name:{kind:"Name",value:"after"},value:{kind:"Variable",name:{kind:"Name",value:"after"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"pageInfo"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hasNextPage"}},{kind:"Field",name:{kind:"Name",value:"endCursor"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"nodes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"MetaobjectForImport"}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}},{kind:"Field",name:{kind:"Name",value:"__typename"}}]}}]}},{kind:"FragmentDefinition",name:{kind:"Name",value:"MetaobjectForImport"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"MetaobjectDefinition"}},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"type"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"access"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"admin"}},{kind:"Field",name:{kind:"Name",value:"storefront"}}]}},{kind:"Field",name:{kind:"Name",value:"displayNameKey"}},{kind:"Field",name:{kind:"Name",value:"capabilities"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"publishable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}}]}},{kind:"Field",name:{kind:"Name",value:"translatable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}}]}},{kind:"Field",name:{kind:"Name",value:"renderable"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"enabled"}},{kind:"Field",name:{kind:"Name",value:"data"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"metaTitleKey"}},{kind:"Field",name:{kind:"Name",value:"metaDescriptionKey"}}]}}]}}]}},{kind:"Field",name:{kind:"Name",value:"fieldDefinitions"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"type"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"category"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"required"}},{kind:"Field",name:{kind:"Name",value:"validations"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"value"}}]}}]}}]}}]};var x=v(z(),1);var J={article:"ARTICLE",blog:"BLOG",collection:"COLLECTION",company:"COMPANY",company_location:"COMPANY_LOCATION",location:"LOCATION",market:"MARKET",order:"ORDER",page:"PAGE",product:"PRODUCT",customer:"CUSTOMER",delivery_customization:"DELIVERY_CUSTOMIZATION",delivery_method:"DELIVERY_METHOD",delivery_option_generator:"DELIVERY_OPTION_GENERATOR",discount:"DISCOUNT",draft_order:"DRAFTORDER",fulfillment_constraint_rule:"FULFILLMENT_CONSTRAINT_RULE",gift_card_transaction:"GIFT_CARD_TRANSACTION",order_routing_location_rule:"ORDER_ROUTING_LOCATION_RULE",payment_customization:"PAYMENT_CUSTOMIZATION",selling_plan:"SELLING_PLAN",shop:"SHOP",validation:"VALIDATION",variant:"PRODUCTVARIANT",cart_transform:"CARTTRANSFORM"};async function q({query:e,session:i,toNodes:n,toVariables:t,performQuery:s=a=>E({query:e,session:i,variables:a,autoRateLimitRestore:!0})}){let a;try{let o=n(await s(t(a))),d=[];for(d.push(...o.nodes);o.pageInfo.hasNextPage;)a=o.pageInfo.endCursor,o=n(await s(t(a))),d.push(...o.nodes);return{status:"ok",items:d}}catch(o){if(o instanceof Error&&o.message.includes("ACCESS_DENIED"))return{status:"scope_error"};throw o}}function L(e,i){let n="";for(let t of e)n=(0,x.updateTomlValues)(n,t);return`# ${i}
|
|
2
|
+
${n}`}function Z(e,i){let n=i.map(oe).map(a=>{switch(a.status){case"ok":{let{typeName:o,patches:d}=a;return L(d,`type: $app:${o}`)}case"not_app_reserved":return null}}).filter(a=>a!==null),t=e.flatMap(({items:a,ownerType:o,graphQLOwner:d})=>a.map(l=>({result:se(l,o),graphQLOwner:d}))).map(({result:a,graphQLOwner:o})=>{switch(a.status){case"ok":{let{namespace:d,key:l,patches:y}=a;return L(y,`namespace: ${d==="app"?"$app":`$app:${d}`} key: ${l} owner_type: ${o}`)}case"not_app_reserved":return null}}).filter(a=>a!==null);return{tomlContent:[...n,...t].join(`
|
|
3
|
+
`),metafieldCount:t.length,metaobjectCount:n.length}}async function $(e){let i=await ae(e),n=i.storeFqdn,t=await ee(i),s=await ne(i);e.includeExistingDeclaredDefinitions||(t=ie(t,e.appConfiguration),s=te(s,e.appConfiguration));let{tomlContent:a,metafieldCount:o,metaobjectCount:d}=Z(t,s);X(o,d,n,a)}function X(e,i,n,t){A({headline:"Conversion to TOML complete.",body:["Converted",{warn:`${e} metafields`},"and",{warn:`${i} metaobjects`},"from",{warn:n},"into TOML, ready for you to copy."],orderedNextSteps:!0,nextSteps:["Review the suggested TOML carefully before applying.",["Missing sections? Make sure your app has the required access scopes to load metafields and metaobjects (e.g.",{command:"read_customers"},"to load customer metafields,",{command:"read_metaobject_definitions"},"to load metaobjects.)"],["Missing definitions? Only metafields and metaobjects that are app-reserved (using",{command:"$app"},") will be converted."],["When you're ready, add the generated TOML to your app's configuration file and test out changes with the",{command:"shopify app dev"},"command."]]}),ce(t)}async function ee(e){let i=[];return await h(Object.entries(J).map(([n,t])=>({title:m`Loading ${p.green(n)} metafields`,task:async()=>{let s=await q({query:w,session:e,toNodes:a=>a.metafieldDefinitions,toVariables:a=>({ownerType:t,after:a})});i.push({metafields:s,ownerType:n,graphQLOwner:t})}}))),i.map(({metafields:n,ownerType:t,graphQLOwner:s})=>n.status==="ok"?{ownerType:t,items:n.items,graphQLOwner:s}:null).filter(n=>n!==null)}async function ne(e){let i=await f({title:m`Loading ${p.green("metaobjects")}`,task:async()=>q({query:V,session:e,toNodes:n=>n.metaobjectDefinitions,toVariables:n=>({after:n})})});return i.status==="ok"?i.items:[]}function ie(e,i){return e.map(n=>{let t=n.items.filter(s=>!K(i,[n.ownerType,"metafields",u(s.namespace)??"",s.key]));return t.length>0?{...n,items:t}:null}).filter(n=>n!==null)}function te(e,i){return e.filter(n=>!K(i,["metaobjects","app",u(n.type)??""]))}function K(e,i){let n=e;for(let t of i){if(!n[t])return!1;n=n[t]}return!0}async function ae(e){let{remoteApp:i,store:n}=e,t=i.apiSecretKeys[0]?.secret;if(!t)throw new M("No API secret keys found for app");return await S(n.shopDomain,i.apiKey,t)}function u(e){if(!e.match(/^app--\d+/))return null;let i="app";return e.match(/^app--\d+--/)&&(i=e.replace(/^app--\d+--/,"")),i}function se(e,i){let n=u(e.namespace);if(!n)return{status:"not_app_reserved"};let t=e.key,s=de(e),a=le(s,i,n,t);return{status:"ok",key:t,namespace:n,patches:a}}function oe(e){let i=u(e.type);if(!i)return{status:"not_app_reserved"};let n=re(e,i),t=me(n,i);return{status:"ok",typeName:i,patches:t}}function de(e){let i={name:e.name===e.key?void 0:e.name,type:e.type.name,description:e.description??void 0,capabilities:c({admin_filterable:e.capabilities.adminFilterable.enabled||void 0}),access:c({admin:W(e.access.admin),storefront:B(e.access.storefront),customer_account:ue(e.access.customerAccount)}),validations:U(e.validations)},{type:n,validations:t}=Q(i.type,i.validations);return i.type=n,i.validations=t,i}function re(e,i){return{name:e.name===i?void 0:e.name,description:e.description??void 0,display_name_field:e.displayNameKey??void 0,access:c({admin:W(e.access.admin),storefront:B(e.access.storefront)}),capabilities:c({translatable:e.capabilities.translatable.enabled||void 0,publishable:e.capabilities.publishable.enabled||void 0,renderable:e.capabilities.renderable?.enabled||void 0,renderable_meta_title_field:e.capabilities.renderable?.data?.metaTitleKey??void 0,renderable_meta_description_field:e.capabilities.renderable?.data?.metaDescriptionKey??void 0}),fields:Object.fromEntries(e.fieldDefinitions.map(n=>{let t={type:n.type.name,description:n.description??void 0,name:n.name===n.key?void 0:n.name,required:n.required||void 0,validations:U(n.validations)},{type:s,validations:a}=Q(t.type,t.validations);return t.type=s,t.validations=a,[n.key,t]}))}}function Q(e,i){if(!i)return{type:e,validations:void 0};if(i.metaobject_definition_type&&typeof i.metaobject_definition_type=="string"){let n=u(i.metaobject_definition_type);return{type:`${e}<$app:${n}>`,validations:c({...i,metaobject_definition_type:void 0})}}if(i.metaobject_definition_types&&Array.isArray(i.metaobject_definition_types)&&i.metaobject_definition_types.every(n=>typeof n=="string")){let n=i.metaobject_definition_types.map(t=>u(t));return{type:`${e}<${n.map(t=>`$app:${t}`).join(",")}>`,validations:c({...i,metaobject_definition_types:void 0})}}return{type:e,validations:i}}function U(e){let i=n=>{try{return JSON.parse(n)}catch{return n}};return c(Object.fromEntries(e.filter(n=>n.value!==void 0&&n.name!=="metaobject_definition_id"&&n.name!=="metaobject_definition_ids").map(n=>[n.name,n.value?i(n.value):void 0])))}function le(e,i,n,t){let s=[[[i,"metafields",n,t,"name"],e.name],[[i,"metafields",n,t,"type"],e.type],[[i,"metafields",n,t,"description"],e.description]],a=[[[i,"metafields",n,t,"access","admin"],e.access?.admin],[[i,"metafields",n,t,"access","storefront"],e.access?.storefront],[[i,"metafields",n,t,"access","customer_account"],e.access?.customer_account],[[i,"metafields",n,t,"capabilities","admin_filterable"],e.capabilities?.admin_filterable||void 0]];return e.validations&&G(e.validations).forEach(({validationKey:d,actualValue:l})=>{s.push([[i,"metafields",n,t,"validations",d],l])}),[b(s),b(a)]}function me(e,i){let n=[[["metaobjects","app",i,"name"],e.name===i?void 0:e.name],[["metaobjects","app",i,"description"],e.description],[["metaobjects","app",i,"display_name_field"],e.display_name_field]],t=[[["metaobjects","app",i,"access","admin"],e.access?.admin],[["metaobjects","app",i,"access","storefront"],e.access?.storefront]];return e.capabilities?.translatable&&t.push([["metaobjects","app",i,"capabilities","translatable"],!0]),e.capabilities?.publishable&&t.push([["metaobjects","app",i,"capabilities","publishable"],!0]),e.capabilities?.renderable&&(t.push([["metaobjects","app",i,"capabilities","renderable"],!0]),e.capabilities?.renderable_meta_title_field&&t.push([["metaobjects","app",i,"capabilities","renderable_meta_title_field"],e.capabilities.renderable_meta_title_field]),e.capabilities?.renderable_meta_description_field&&t.push([["metaobjects","app",i,"capabilities","renderable_meta_description_field"],e.capabilities.renderable_meta_description_field])),Object.entries(e.fields).forEach(([s,a])=>{if(typeof a=="string")n.push([["metaobjects","app",i,"fields",s],a]);else{let o=Object.fromEntries(Object.entries(a).filter(([d,l])=>l!==void 0));Object.keys(o).length===1?n.push([["metaobjects","app",i,"fields",s],a.type]):(n.push([["metaobjects","app",i,"fields",s,"type"],a.type]),n.push([["metaobjects","app",i,"fields",s,"description"],a.description]),n.push([["metaobjects","app",i,"fields",s,"name"],a.name]),n.push([["metaobjects","app",i,"fields",s,"required"],a.required||void 0]),a.validations&&G(a.validations).forEach(({validationKey:l,actualValue:y})=>{n.push([["metaobjects","app",i,"fields",s,"validations",l],y])}))}}),[b(n),b(t)]}function G(e){return Object.entries(e).map(([i,n])=>{let t;return typeof n=="string"||typeof n=="number"||typeof n=="boolean"||Array.isArray(n)&&n.every(s=>typeof s=="string")?t=n:t=JSON.stringify(n),{validationKey:i,actualValue:t}})}function ce(e){let i=e.split(`
|
|
4
|
+
`);for(let n of i)n.match(/^\s*\[/)?k(m`${p.green(n)}`):n.match(/^\s*#/)?k(m`${p.gray(n)}`):k(m`${n}`)}function W(e){switch(e){case"MERCHANT_READ_WRITE":return"merchant_read_write";case"MERCHANT_READ":case"PRIVATE":case"PUBLIC_READ":case"PUBLIC_READ_WRITE":case null:case void 0:return}}function B(e){switch(e){case"PUBLIC_READ":return"public_read";case"NONE":case null:case void 0:return}}function ue(e){switch(e){case"READ":return"read";case"READ_WRITE":return"read_write";case"NONE":case null:case void 0:return}}function c(e){if(e&&!T(e)&&!(typeof e=="object"&&Object.values(e).every(i=>i===void 0)))return e}function b(e){return e.filter(([i,n])=>n!==void 0)}var N=v(Y(),1);var g=class e extends C{static{this.summary="Import metafield and metaobject definitions."}static{this.descriptionWithMarkdown="Import metafield and metaobject definitions from your development store. [Read more about declarative custom data definitions](https://shopify.dev/docs/apps/build/custom-data/declarative-custom-data-definitions)."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...D,...O,store:N.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async i=>F(i)}),"include-existing":N.Flags.boolean({description:"Include existing declared definitions in the output.",default:!1,env:"SHOPIFY_FLAG_INCLUDE_EXISTING"})}}async run(){let{appContextResult:i,...n}=await f({title:m`Loading application`,task:async()=>{let{flags:t}=await this.parse(e);await R(t.path);let s=await j({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),a=await P({appContextResult:s,storeFqdn:t.store,forceReselectStore:t.reset});return{appContextResult:s,appConfiguration:s.app.configuration,remoteApp:s.remoteApp,store:a,includeExistingDeclaredDefinitions:t["include-existing"]}}});return await $(n),{app:i.app}}};export{g as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c,b as f,c as g,d as C,g as x}from"../../../chunk-3F6NZK7S.js";import{a as d}from"../../../chunk-D3TSJA5S.js";import{a as m}from"../../../chunk-RF2DPBA6.js";import{Ba as l}from"../../../chunk-SBEZBZM7.js";import"../../../chunk-DJQVNH7P.js";import"../../../chunk-66RJ5T7A.js";import"../../../chunk-K2WUCOQJ.js";import"../../../chunk-ELYP4KFP.js";import"../../../chunk-7MUKLZOL.js";import"../../../chunk-VBUZWRUL.js";import"../../../chunk-XBXMPFXM.js";import"../../../chunk-R466TU3N.js";import"../../../chunk-UGXYQ23Y.js";import"../../../chunk-QSTEVZFQ.js";import"../../../chunk-5Y7GIF2W.js";import"../../../chunk-TQYMC7TH.js";import"../../../chunk-HUZUORYM.js";import"../../../chunk-52GC6XUT.js";import"../../../chunk-XLELNRFF.js";import"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import{b as p}from"../../../chunk-323UTVMM.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import{v as s}from"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-IASVAERO.js";import"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import{r as A}from"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import{e as y,g as r}from"../../../chunk-VPRTJUIN.js";r();var u=y(A(),1);var o=class h extends d{static{this.description="Import dashboard-managed extensions into your app."}static{this.flags={...p,...m,"client-id":u.Flags.string({hidden:!1,description:"The Client ID of your app.",env:"SHOPIFY_FLAG_CLIENT_ID",exclusive:["config"]})}}async run(){let{flags:i}=await this.parse(h),e=await l({directory:i.path,clientId:i["client-id"],forceRelink:i.reset,userProvidedConfigName:i.config}),t=await x({developerPlatformClient:e.developerPlatformClient,apiKey:e.remoteApp.apiKey,organizationId:e.remoteApp.organizationId,extensionTypes:g}),n=c(t);if(n.length===0)s({headline:["No extensions to migrate."]});else{let a=await f(n);await C({...e,extensions:t,extensionTypes:a.extensionTypes,buildExtensionConfig:a.buildExtensionConfig})}return{app:e.app}}};export{o as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{b as j}from"../../../chunk-LALIKZPS.js";import{a as w}from"../../../chunk-D3TSJA5S.js";import{a as P}from"../../../chunk-RF2DPBA6.js";import{Ba as T,h as k}from"../../../chunk-SBEZBZM7.js";import{b as f}from"../../../chunk-DJQVNH7P.js";import"../../../chunk-66RJ5T7A.js";import"../../../chunk-K2WUCOQJ.js";import"../../../chunk-ELYP4KFP.js";import"../../../chunk-7MUKLZOL.js";import"../../../chunk-VBUZWRUL.js";import"../../../chunk-XBXMPFXM.js";import"../../../chunk-R466TU3N.js";import"../../../chunk-UGXYQ23Y.js";import"../../../chunk-QSTEVZFQ.js";import"../../../chunk-5Y7GIF2W.js";import"../../../chunk-TQYMC7TH.js";import"../../../chunk-HUZUORYM.js";import"../../../chunk-52GC6XUT.js";import"../../../chunk-XLELNRFF.js";import{H as g,I as y}from"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import{a as d}from"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import{b as E,c as O}from"../../../chunk-323UTVMM.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import{g as S,u as A}from"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-IASVAERO.js";import"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import{r as F}from"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import{Hb as b,Ib as v,Mb as C,Xb as I}from"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import{g as a,j as h}from"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import{e as D,g as c}from"../../../chunk-VPRTJUIN.js";c();c();async function x(r,e,t,o,n){return n.webEnv?$(r,e,t,n):M(r,e,o,n)}async function $(r,e,t,{format:o}){return j(r,e,t,o)}async function M(r,e,t,o){if(o.format==="json"){let n=_(r.allExtensions.filter(s=>s.isReturnedAsInfo())),i={...r,packageManager:t.packageManager,nodeDependencies:t.nodeDependencies,usesWorkspaces:t.usesWorkspaces,allExtensions:n};return"realExtensions"in i&&(i.realExtensions=_(i.realExtensions)),"specifications"in i&&(i={...i,specifications:i.specifications?.map(s=>L(s))}),v`${JSON.stringify(Object.fromEntries(Object.entries(i).filter(([s])=>s!=="configSchema")),null,2)}`}else return new l(r,e,t,o).output()}function L(r){if("schema"in r){let{schema:e,...t}=r;return t}return r}function _(r){return r.map(e=>{if("specification"in e&&e.specification){let t=e.specification,o=L(t);return{...e,specification:o}}else return e})}var U="unknown",u={subdued:"Not yet configured"},W="NOT LOADED",l=class{constructor(e,t,o,n){this.app=e,this.remoteApp=t,this.project=o,this.options=n}async output(){return[...await this.devConfigsSection(),this.projectSettingsSection(),...await this.appComponentsSection(),await this.systemInfoSection()]}async devConfigsSection(){let e=u;this.app.configuration.build?.automatically_update_urls_on_dev!==void 0&&(e=this.app.configuration.build.automatically_update_urls_on_dev?"Yes":"No");let t=["User","unknown"],o=await this.options.developerPlatformClient.accountInfo();return y(o)?t=["Service account",o.orgName]:g(o)&&(t[1]=o.email),[this.tableSection("Current app configuration",[["Configuration file",{filePath:h(this.app.configPath)||f.app}],["App name",this.remoteApp.title?{userInput:this.remoteApp.title}:u],["Client ID",this.remoteApp.apiKey||u],["Access scopes",k(this.app.configuration)],["Dev store",this.app.configuration.build?.dev_store_url??this.app.hiddenConfig.dev_store_url??u],["Update URLs",e],t],{isFirstItem:!0}),{body:["\u{1F4A1} To change these, run",{command:b(this.project.packageManager,"shopify app config link")}]}]}projectSettingsSection(){return this.tableSection("Your Project",[["Root location",{filePath:this.app.directory}]])}async appComponentsSection(){let e=this.webComponentsSection();return[{title:`
|
|
2
|
+
Directory components`.toUpperCase(),body:""},...e?[e]:[],...this.extensionsSections()]}webComponentsSection(){let e=[],t=[];if(this.app.webs[0])return this.app.webs.forEach(o=>{if(o.configuration)if(o.configuration.name){let{name:n,roles:i}=o.configuration,s=a(this.app.directory,o.directory);t.push([` \u{1F4C2} ${n}`,{filePath:s||"/"}]),i.length>0&&t.push([" roles",i.join(", ")])}else o.configuration.roles.forEach(n=>{t.push([` \u{1F4C2} ${n}`,{filePath:a(this.app.directory,o.directory)}])});else t.push([{subdued:` \u{1F4C2} ${U}`},{filePath:a(this.app.directory,o.directory)}]);if(!this.app.errors.isEmpty()){let n=this.app.errors.getErrors(`${o.directory}/${f.web}`);e.push(...n.map(i=>i.message))}}),this.subtableSection("web",[["\u{1F4C2} web",""],...t,...e.map(o=>[{error:"error"},{error:this.formattedError(o)}])])}extensionsSections(){let e=this.app.allExtensions.filter(o=>o.isReturnedAsInfo());return Array.from(new Set(e.map(o=>o.type))).map(o=>{let n=e.filter(i=>i.type===o);if(n[0])return this.subtableSection(n[0].externalType,n.map(i=>this.extensionSubSection(i)).flat())}).filter(o=>o!==void 0)}extensionSubSection(e){let t=e.configuration,o=[[`\u{1F4C2} ${e.handle||W}`,{filePath:a(this.app.directory,e.directory)}],[" config file",{filePath:a(e.directory,e.configurationPath)}]];t&&"metafields"in t&&Array.isArray(t.metafields)&&t.metafields.length>0&&o.push([" metafields",`${t.metafields.length}`]);let n=this.app.errors.getErrors(e.configurationPath);for(let i of n)o.push([{error:" error"},{error:this.formattedError(i.message)}]);return o}formattedError(e){let t=e.trim();if(I())return t;let[o,...n]=t.split(`
|
|
3
|
+
`);return[`! ${o}`,...n.map(i=>` ${i}`)].join(`
|
|
4
|
+
`)}async systemInfoSection(){let{platform:e,arch:t}=S();return this.tableSection("Tooling and System",[["Shopify CLI",d],["Package manager",this.project.packageManager],["OS",`${e}-${t}`],["Shell",process.env.SHELL??"unknown"],["Node version",process.version]])}tableSection(e,t,{isFirstItem:o=!1}={}){return{title:`${o?"":`
|
|
5
|
+
`}${e.toUpperCase()}
|
|
6
|
+
`,body:{tabularData:t,firstColumnSubdued:!0}}}subtableSection(e,t){return{title:e,body:{tabularData:t,firstColumnSubdued:!0}}}};var N=D(F(),1);var m=class r extends w{static{this.summary="Print basic information about your app and extensions."}static{this.descriptionWithMarkdown=`The information returned includes the following:
|
|
7
|
+
|
|
8
|
+
- The app and dev store that's used when you run the [dev](https://shopify.dev/docs/api/shopify-cli/app/app-dev) command. You can reset these configurations using [\`dev --reset\`](https://shopify.dev/docs/api/shopify-cli/app/app-dev#flags-propertydetail-reset).
|
|
9
|
+
- The [structure](https://shopify.dev/docs/apps/tools/cli/structure) of your app project.
|
|
10
|
+
- The [access scopes](https://shopify.dev/docs/api/usage) your app has requested.
|
|
11
|
+
- System information, including the package manager and version of Shopify CLI used in the project.`}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...E,...P,...O,"web-env":N.Flags.boolean({hidden:!1,description:"Outputs environment variables necessary for running and deploying web/.",env:"SHOPIFY_FLAG_OUTPUT_WEB_ENV",default:!1})}}async run(){let{flags:e}=await this.parse(r),{app:t,project:o,remoteApp:n,organization:i,developerPlatformClient:s}=await T({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config,unsafeTolerateErrors:!0}),p=await x(t,n,i,o,{format:e.json?"json":"text",webEnv:e["web-env"],configName:e.config,developerPlatformClient:s});return typeof p=="string"||"value"in p?C(p):A({customSections:p}),t.errors.isEmpty()||process.exit(2),{app:t}}};export{m as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{a as xe}from"../../../chunk-D3TSJA5S.js";import{Ba as Le,E as Pe,J as ve,M as Ae,O as ke,_ as Ce,aa as Te,g as we,ya as Re}from"../../../chunk-SBEZBZM7.js";import{T as S,X as Ie,k as be}from"../../../chunk-DJQVNH7P.js";import{a as ye}from"../../../chunk-ZTMSBSYD.js";import{b as ge}from"../../../chunk-DJONKJSZ.js";import{b as he}from"../../../chunk-SGQ6D3LU.js";import{a as de,c as ue}from"../../../chunk-P7R7FBY2.js";import"../../../chunk-66RJ5T7A.js";import"../../../chunk-K2WUCOQJ.js";import"../../../chunk-ELYP4KFP.js";import"../../../chunk-7MUKLZOL.js";import"../../../chunk-VBUZWRUL.js";import"../../../chunk-XBXMPFXM.js";import"../../../chunk-R466TU3N.js";import"../../../chunk-UGXYQ23Y.js";import"../../../chunk-QSTEVZFQ.js";import"../../../chunk-5Y7GIF2W.js";import"../../../chunk-TQYMC7TH.js";import"../../../chunk-HUZUORYM.js";import"../../../chunk-52GC6XUT.js";import"../../../chunk-XLELNRFF.js";import"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import{B as ae,D as ie,E as oe,f as C,g as J,i as ee,p as te}from"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import{a as M}from"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import{b as fe}from"../../../chunk-323UTVMM.js";import"../../../chunk-3TNEIDOD.js";import{b as Z}from"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import{D as le,f as re,u as pe,v as se,z as O}from"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import{d as ne}from"../../../chunk-IASVAERO.js";import{d as c}from"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import{r as Ee}from"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import{$ as E,$a as q,Ab as Q,Bb as X,Ca as Y,Gb as g,Hb as T,Ib as y,Ja as V,Oa as B,Ta as k,Ua as I,Va as K,Wa as W,ka as j,ma as U,sa as x,ua as F,wa as H}from"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import{e as me,g as ce}from"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import{d as s,e as A,f as $,p as z,q as D}from"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import{e as De,g as u}from"../../../chunk-VPRTJUIN.js";u();u();function je(){return{url:ce()?"https://github.com/Shopify/shopify-app-template-extension-only":"https://github.com/Shopify/shopify-app-template-none",label:"Build an extension-only app",visible:!0}}var w={reactRouter:{url:"https://github.com/Shopify/shopify-app-template-react-router",label:"Build a React Router app (recommended)",visible:!0,branches:{prompt:"For your React Router template, which language do you want?",options:{javascript:{branch:"javascript-cli",label:"JavaScript"},typescript:{branch:"main-cli",label:"TypeScript"}}}},remix:{url:"https://github.com/Shopify/shopify-app-template-remix",label:"Build a Remix app",visible:!1,branches:{prompt:"For your Remix template, which language do you want?",options:{javascript:{branch:"javascript",label:"JavaScript"},typescript:{branch:"main",label:"TypeScript"}}}},none:je(),node:{url:"https://github.com/Shopify/shopify-app-template-node",visible:!1},ruby:{url:"https://github.com/Shopify/shopify-app-template-ruby",visible:!1}},N=Object.keys(w),R=N.filter(e=>w[e].visible),Ue=["reactRouter","none"],He=async e=>{let t=e.template,a=e.flavor,r={template:w.reactRouter.url};t??=await O({choices:Ue.map(o=>({label:w[o].label||o,value:o})),message:"Get started building your app:",defaultValue:N.find(o=>w[o].url===r.template)});let i={...e,template:t,templateType:L(t)?t:"custom",globalCLIResult:{install:!1,alreadyInstalled:!1}},n,p;if(i.templateType!=="custom"){let o=w[i.templateType];n=o.url,o.branches&&(a?p=o.branches.options[a]?.branch:p=await O({message:o.branches.prompt||"Choose a flavor:",choices:Object.entries(o.branches.options).map(([f,m])=>({value:m.branch,label:m.label}))}))}return p&&(n=`${n}#${p}`),i.template=n||i.template||r.template,i.globalCLIResult=await X(),i},Fe=He;function L(e){return N.includes(e)}u();u();import{platform as Ye}from"os";async function Oe({packageJSON:e,local:t,useGlobalCLI:a}){if(e.dependencies=e.dependencies??{},a?delete e.dependencies["@shopify/cli"]:e.dependencies["@shopify/cli"]=M,delete e.dependencies["@shopify/app"],t){let r=await Ve("cli");e.dependencies["@shopify/cli"]=r;let i={"@shopify/cli":r};e.overrides=e.overrides?{...e.overrides,...i}:i,e.resolutions=e.resolutions?{...e.resolutions,...i}:i}return e}async function Ve(e){return`file:${await q(`packages/${e}`,{type:"directory",cwd:z(import.meta.url)})}`}async function Se({from:e,packageManager:t}){let a=Ye()==="win32"&&t==="yarn"?["--network-concurrency","1"]:[];return te({directory:A(e),packageManager:t,args:a})}u();async function _(e,t){let r=(await W([s(e,"**",".git"),s(e,"**",".github"),s(e,"**",".gitmodules"),s(e,"**",".cli-liquid-bypass"),s(e,"LICENSE*"),s(e,"**","frontend/LICENSE*"),s(e,"package.json.cli2")],{dot:!0,onlyFiles:!1,onlyDirectories:!1,ignore:["**/node_modules/**"]})).map(p=>Y(p,{force:!0})),i=new Set(J[t]),n=C.filter(p=>!i.has(p)).map(p=>{let o=s(e,p);if(I(o))return V(o)});return Promise.all([...r,...n])}async function Be(e){let t=e.packageManager,a=E(e.name),r=s(e.directory,a),i=ge(e.template);await Ne(r,a),await Ke(r),pe({body:["Initializing project with",{command:t},`
|
|
2
|
+
Use the`,{command:"--package-manager"},"flag to select a different package manager."]}),await j(async o=>{let f=s(o,"download"),m=i.filePath?s(f,i.filePath):f,l=s(o,"app"),v=i.branch?`${i.baseURL}#${i.branch}`:i.baseURL;await H(f);let b=[{title:`Downloading template from ${v}`,task:async()=>{await ue({repoUrl:v,destination:f,shallow:!0})}}];b.push({title:"Parsing liquid",task:async()=>{await he(m,l,{dependency_manager:t,app_name:e.name})}},{title:"Updating package.json",task:async()=>{let d=(await ae(l)).content;d.name=a,d.author=await re()??"",d.private=!0;let P=["extensions/*"].concat(We(l));switch(t){case"npm":case"yarn":case"bun":d.workspaces=P;break;case"pnpm":{await qe(l,P),await x(s(l,".npmrc"),`auto-install-peers=true
|
|
3
|
+
`);break}case"homebrew":case"unknown":throw new ee}await Oe({packageJSON:d,local:e.local,directory:l,useGlobalCLI:e.useGlobalCLI}),await ie(l,d)}}),e.postCloneActions.removeLockfilesFromGitignore&&b.push({title:"Removing lockfiles from .gitignore",task:async()=>{let d=s(l,".gitignore");if(await k(d)){let P=await U(d);C.forEach($e=>{let ze=new RegExp(`^${$e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}$`,"gm");P=P.replace(ze,"")}),await F(d,P.trim())}}}),await me()&&b.push({title:"[Shopifolks-only] Configuring the project's NPM registry",task:async()=>{let d=s(l,".npmrc");await x(d,`@shopify:registry=https://registry.npmjs.org
|
|
4
|
+
`)}}),b.push({title:`Installing dependencies with ${t}`,task:async()=>{await Se({from:l,packageManager:t})}},{title:"Cleaning up",task:async()=>{await _(l,t)}},{title:"Initializing a Git repository...",task:async()=>{await de(l)}}),await le(b),await Ne(r,a),await B(l,r)});let n;if(e.selectedAppOrNameResult.result==="new"){let o=await Pe(r,e.name),f=e.selectedAppOrNameResult.org;n=await e.developerPlatformClient.createApp(f,o)}else n=e.selectedAppOrNameResult.app;await Re({directory:r,apiKey:n.apiKey,appId:n.id,organizationId:n.organizationId,configName:"shopify.app.toml",developerPlatformClient:e.developerPlatformClient,isNewApp:!0},!1);let p=await Le({directory:r,clientId:void 0,forceRelink:!1,userProvidedConfigName:void 0});return se({headline:[{userInput:a},"is ready for you to build!"],nextSteps:[["Run",{command:`cd ${a}`}],["For extensions, run",{command:T(t,"shopify app generate extension")}],["To see your app, run",{command:T(t,"shopify app dev")}]],reference:[{link:{label:"Shopify docs",url:"https://shopify.dev"}},[{link:{label:"Shopify Dev MCP,",url:"https://shopify.dev/docs/apps/build/devmcp"}},"connect your AI assistant to development resources"],["For an overview of commands, run",{command:T(t,"shopify app","--help")}]]}),{app:p.app}}async function Ne(e,t){if(await k(e))throw new c(`
|
|
5
|
+
A directory with this name (${t}) already exists.
|
|
6
|
+
Choose a new name for your app.`)}async function Ke(e){let t=new Z({projectName:"shopify-cli-app"}),a=A(e);t.delete(a)}function We(e){return["web","web/frontend"].filter(t=>I(s(e,t)))}async function qe(e,t){let a=s(e,"pnpm-workspace.yaml");if(await k(a))return;let r=t.map(i=>` - '${i}'`).join(`
|
|
7
|
+
`);await F(a,`packages:
|
|
8
|
+
${r}`)}var _e=Be;u();function Ge(e){if(!e)return;let t=ye(e);if(t&&t.origin!=="https://github.com")throw new c("Only GitHub repository references are supported, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]");if(!t&&!L(e))throw new c(y`Only ${R.map(a=>y`${g.yellow(a)}`.value).join(", ")} template aliases are supported, please provide a valid URL`)}function Me(e,t){if(!e){if(t)throw new c(y`The ${g.yellow("--flavor")} flag requires the ${g.yellow("--template")} flag to be set`);return}if(!t)return;if(!L(e))throw new c(y`The ${g.yellow("--flavor")} flag is not supported for custom templates`);let a=w[e];if(!a.branches)throw new c(y`The ${g.yellow(e)} template does not support flavors`);if(!a.branches.options[t])throw new c(y`Invalid option for ${g.yellow("--flavor")}\nThe ${g.yellow("--flavor")} flag for ${g.yellow(e)} accepts only ${Object.keys(a.branches.options).map(r=>y`${g.yellow(r)}`.value).join(", ")}`)}var h=De(Ee(),1);var G=class e extends xe{static{this.summary="Create a new app project"}static{this.flags={...fe,name:h.Flags.string({char:"n",env:"SHOPIFY_FLAG_NAME",hidden:!1,description:"The name for the new app. When provided, skips the app selection prompt and creates a new app with this name."}),path:h.Flags.string({char:"p",env:"SHOPIFY_FLAG_PATH",parse:async t=>$(t),default:async()=>D(),hidden:!1}),template:h.Flags.string({description:`The app template. Accepts one of the following:
|
|
9
|
+
- <${R.join("|")}>
|
|
10
|
+
- Any GitHub repo with optional branch and subpath, e.g., https://github.com/Shopify/<repository>/[subpath]#[branch]`,env:"SHOPIFY_FLAG_TEMPLATE"}),flavor:h.Flags.string({description:"Which flavor of the given template to use.",env:"SHOPIFY_FLAG_TEMPLATE_FLAVOR"}),"package-manager":h.Flags.string({char:"d",env:"SHOPIFY_FLAG_PACKAGE_MANAGER",hidden:!1,options:["npm","yarn","pnpm","bun"]}),local:h.Flags.boolean({char:"l",env:"SHOPIFY_FLAG_LOCAL",default:!1,hidden:!0}),"client-id":h.Flags.string({hidden:!1,description:"The Client ID of your app. Use this to automatically link your new project to an existing app. Using this flag avoids the app selection prompt.",env:"SHOPIFY_FLAG_CLIENT_ID",exclusive:["config"]}),"organization-id":h.Flags.string({hidden:!1,description:"The organization ID. Your organization ID can be found in your Dev Dashboard URL: https://dev.shopify.com/dashboard/<organization-id>",env:"SHOPIFY_FLAG_ORGANIZATION_ID",exclusive:["client-id"]})}}async run(){let{flags:t}=await this.parse(e);if(Ge(t.template),Me(t.template,t.flavor),t.name!==void 0&&t.name.trim()==="")throw new c("The --name flag can't be empty","Provide a valid app name, for example: --name my-app");let a=oe(t["package-manager"]),r=t.name??await Ze(t.path),i=S();await i.session();let n=await Fe({template:t.template,flavor:t.flavor}),p,o;if(t["client-id"]){let m=await Ce({apiKey:t["client-id"]});o=m.title,i=m.developerPlatformClient??i,p={result:"existing",app:m}}else{let m;t["organization-id"]?m=await Ie(t["organization-id"],i):m=await Te(),i=S({organization:m});let{organization:l,apps:v,hasMorePages:b}=await i.orgAndApps(m.id);p=await Qe(t.name!==void 0,r,v,b,l,i),o=p.result==="new"?p.name:p.app.title}n.globalCLIResult.install&&await Q(a),await ne(()=>({cmd_create_app_template:n.templateType,cmd_create_app_template_url:n.template}));let{app:f}=await _e({name:o,selectedAppOrNameResult:p,packageManager:a,template:n.template,local:t.local,directory:t.path,useGlobalCLI:n.globalCLIResult.alreadyInstalled||n.globalCLIResult.install,developerPlatformClient:i,postCloneActions:{removeLockfilesFromGitignore:n.templateType!=="custom"}});return{app:f}}};async function Ze(e){for(let t=0;t<3;t++){let a=await K({suffix:"app",directory:e});if(be(a))return a}return""}async function Qe(e,t,a,r,i,n){let p=a.length===0||e;if(p||(p=await ke()),p)return{result:"new",name:e?t:await Ae(t),org:i};{let o=await ve(we(n,i.id),a,r);if(!o)throw new c("Unable to select an app: the selection prompt was interrupted.");let f=await n.appFromIdentifiers(o.apiKey);if(!f)throw new c(`App with id ${o.id} not found`);return{result:"existing",app:f}}}export{G as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as re,b as se,c as ne,d as ie,f as F,h as v,i as ae,j as pe,l as le,m as ue,n as ce,q as me,r as fe,s as ge,t as de,u as B,v as xe,w as Te,x as he,y as I,z as w}from"../../../chunk-ALKTLKQ6.js";import{a as oe}from"../../../chunk-QRRNOVJ3.js";import{a as te}from"../../../chunk-D3TSJA5S.js";import{a as Q}from"../../../chunk-RF2DPBA6.js";import{Ba as ee,D as K,W as X,Z,k as Y}from"../../../chunk-SBEZBZM7.js";import{Y as W}from"../../../chunk-DJQVNH7P.js";import"../../../chunk-YOZNRLFC.js";import"../../../chunk-XEFQQPL4.js";import"../../../chunk-66RJ5T7A.js";import"../../../chunk-K2WUCOQJ.js";import"../../../chunk-ELYP4KFP.js";import"../../../chunk-7MUKLZOL.js";import"../../../chunk-VBUZWRUL.js";import"../../../chunk-XBXMPFXM.js";import"../../../chunk-R466TU3N.js";import"../../../chunk-UGXYQ23Y.js";import"../../../chunk-QSTEVZFQ.js";import"../../../chunk-5Y7GIF2W.js";import"../../../chunk-TQYMC7TH.js";import"../../../chunk-HUZUORYM.js";import"../../../chunk-52GC6XUT.js";import"../../../chunk-XLELNRFF.js";import{z as j}from"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import{b as G,c as H}from"../../../chunk-323UTVMM.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import{i as V,u as $}from"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-IASVAERO.js";import{d as E}from"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import{r as Le}from"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import{Mb as N,Nb as S,da as z,eb as O,fb as f,gb as s}from"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import{j as R}from"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import{e as L,g as x}from"../../../chunk-VPRTJUIN.js";x();x();x();x();x();x();var k=L(O(),1);function ye(t){let r=(0,k.useRef)(t);(0,k.useEffect)(()=>{r.current=t},[t]),(0,k.useEffect)(()=>{let n;function i(){r.current().then(({retryIntervalMs:p})=>{p&&(n=setTimeout(i,p))}).catch(()=>{})}return n=setTimeout(i,0),()=>n&&clearTimeout(n)},[])}x();var M=async({pollOptions:{jwtToken:t,cursor:r,filters:n},developerPlatformClient:i,organizationId:a})=>{let p=await i.appLogs({jwtToken:t,cursor:r},a),{errors:c,status:u}=p;if(u!==200){if(u===401||u===429||u>=500)return{errors:c.map(y=>({status:u,message:y}))};throw new E(`${c.join(", ")} while fetching app logs`)}let{cursor:o,app_logs:l}=p,g=Ee(l,n);return{cursor:o,appLogs:g}};function Ee(t,r){let n=t;return(r.status!==void 0||r.sources!==void 0)&&(n=n.filter(i=>{let a=r.status===void 0?!0:i.status===r.status,p=r.sources===void 0?!0:r.sources.includes(`${i.source_namespace}.${i.source}`);return a&&p})),n}var P=L(O(),1);async function ke({jwtToken:t,cursor:r,filters:n,storeNameById:i,organizationId:a,setErrors:p,setAppLogOutputs:c,resubscribeCallback:u,developerPlatformClient:o}){let l=t,g=F,y=r,A=await M({pollOptions:{jwtToken:t,cursor:r,filters:n},developerPlatformClient:o,organizationId:a}),m="not_attempted",b=A;if(b.errors){let T=await B({response:b,onThrottle:d=>{p(["Request throttled while polling app logs.",`Retrying in ${d/1e3}s`])},onUnknownError:d=>{p(["Error while polling app logs",`Retrying in ${d/1e3}s`])},onResubscribe:()=>u()});m=T.resubscribeResult,T.nextJwtToken&&(l=T.nextJwtToken),g=T.retryIntervalMs}else{p(d=>d.length?[]:d);let{appLogs:T}=A;if(y=A.cursor,T)for(let d of T){let h,C,D,J=i.get(d.shop_id.toString());if(J===void 0)continue;switch(d.log_type){case pe:h=me(d.payload),C=`export "${h.export}" executed in ${(h.fuelConsumed/ae).toFixed(4)}M instructions`;break;case le:h=fe(d.payload),C="network access response retrieved from cache";break;case ue:h=ge(d.payload),C="network access request executing in background";break;case ce:h=de(d.payload),D=h.connectTimeMs&&h.writeReadTimeMs?h.connectTimeMs+h.writeReadTimeMs:null,C=`network access request executed${D?` in ${D} ms`:""}`;break;default:continue}let Ie={status:d.status==="success"?"Success":"Failure",source:d.source,storeName:J,description:C,logTimestamp:z(d.log_timestamp)};h&&c(Ce=>[...Ce,{appLog:h,prefix:Ie}])}}return{nextJwtToken:l,retryIntervalMs:g,cursor:y??r,resubscribeResult:m}}function be({initialJwt:t,filters:r,resubscribeCallback:n,storeNameById:i,developerPlatformClient:a,organizationId:p}){let[c,u]=(0,P.useState)([]),[o,l]=(0,P.useState)([]),g=(0,P.useRef)(t),y=(0,P.useRef)(0),A=(0,P.useRef)(""),m=(0,P.useRef)(0),b=(0,P.useCallback)(async()=>{let T=await ke({jwtToken:g.current,cursor:A.current,filters:r,storeNameById:i,setErrors:u,setAppLogOutputs:l,resubscribeCallback:n,developerPlatformClient:a,organizationId:p});if(T.resubscribeResult==="failed"){if(m.current+=1,m.current>=v)return u(["App log streaming session has expired. Please restart your dev session."]),{retryIntervalMs:0}}else T.resubscribeResult==="succeeded"&&(m.current=0);return g.current=T.nextJwtToken,A.current=T.cursor,y.current=T.retryIntervalMs,{retryIntervalMs:y.current}},[]);return ye(b),{appLogOutputs:o,errors:c}}var e=L(O(),1);var Oe=t=>{switch(t){case 0:return"No cached response available";case 1:return"Cache is about to expire";case 2:return"Unknown reason"}},Pe=({pollOptions:{jwtToken:t,filters:r},resubscribeCallback:n,storeNameById:i,developerPlatformClient:a,organizationId:p})=>{let{appLogOutputs:c,errors:u}=be({filters:r,initialJwt:t,resubscribeCallback:n,storeNameById:i,developerPlatformClient:a,organizationId:p});return e.default.createElement(e.default.Fragment,null,c.map(({appLog:o,prefix:l},g)=>e.default.createElement(f,{flexDirection:"column",key:g},e.default.createElement(f,{flexDirection:"row",gap:1},e.default.createElement(s,null,e.default.createElement(s,{color:"green"},l.logTimestamp," "),e.default.createElement(s,{color:"blueBright"},`${l.storeName.split(".")[0]}`," "),e.default.createElement(s,{color:"blueBright"},l.source," "),e.default.createElement(s,{color:l.status==="Success"?"green":"red"},l.status," "),e.default.createElement(s,null,l.description))),e.default.createElement(f,{flexDirection:"column",marginLeft:4},o instanceof re&&e.default.createElement(f,{flexDirection:"column"},e.default.createElement(s,null,o.logs),o.inputQueryVariablesMetafieldKey&&o.inputQueryVariablesMetafieldNamespace?e.default.createElement(f,{flexDirection:"column",marginTop:1},e.default.createElement(s,{bold:!0},"Input Query Variables:"),e.default.createElement(f,{flexDirection:"row",marginLeft:1,marginTop:1},e.default.createElement(s,{dimColor:!0},"Namespace:"),e.default.createElement(s,null," ",o.inputQueryVariablesMetafieldNamespace)),e.default.createElement(f,{flexDirection:"row",marginLeft:1},e.default.createElement(s,{dimColor:!0},"Key:"),e.default.createElement(s,null," ",o.inputQueryVariablesMetafieldKey)),e.default.createElement(f,{marginLeft:1,marginTop:1},e.default.createElement(s,null,w(o.inputQueryVariablesMetafieldValue)??e.default.createElement(s,{color:"red"},"Metafield is not set")))):null,o.input?e.default.createElement(f,{flexDirection:"column",marginTop:1},e.default.createElement(s,{bold:!0},"Input ",e.default.createElement(s,{dimColor:!0},"(",o.inputBytes," bytes):")),e.default.createElement(f,{marginLeft:1,marginTop:1},e.default.createElement(s,null,w(o.input)))):null,o.output?e.default.createElement(f,{flexDirection:"column",marginTop:1},e.default.createElement(s,{bold:!0},"Output ",e.default.createElement(s,{dimColor:!0},"(",o.outputBytes," bytes):")),e.default.createElement(f,{marginLeft:1,marginTop:1},e.default.createElement(s,null,w(o.output)))):null),o instanceof se&&e.default.createElement(f,{flexDirection:"column"},e.default.createElement(s,null,"Cache write time: ",new Date(o.cacheEntryEpochMs).toISOString()),e.default.createElement(s,null,"Cache TTL: ",o.cacheTtlMs/1e3," s"),e.default.createElement(s,null,"HTTP request:"),e.default.createElement(s,null,w(o.httpRequest)),e.default.createElement(s,null,"HTTP response:"),e.default.createElement(s,null,w(o.httpResponse))),o instanceof ne&&e.default.createElement(f,{flexDirection:"column"},e.default.createElement(s,null,"Reason: ",Oe(o.reason)),e.default.createElement(s,null,"HTTP request:"),e.default.createElement(s,null,w(o.httpRequest))),o instanceof ie&&e.default.createElement(f,{flexDirection:"column"},e.default.createElement(s,null,"Attempt: ",o.attempt),o.connectTimeMs?e.default.createElement(s,null,"Connect time: ",o.connectTimeMs," ms"):null,o.writeReadTimeMs?e.default.createElement(s,null,"Write read time: ",o.writeReadTimeMs," ms"):null,e.default.createElement(s,null,"HTTP request:"),e.default.createElement(s,null,w(o.httpRequest)),o.httpResponse?e.default.createElement(f,{flexDirection:"column"},e.default.createElement(s,null,"HTTP response:"),e.default.createElement(s,null,w(o.httpResponse))):null,o.error?e.default.createElement(s,null,"Error: ",o.error):null)))),u.length>0&&e.default.createElement(f,{flexDirection:"column"},u.map((o,l)=>e.default.createElement(f,{key:l},e.default.createElement(s,{color:"red"},o)))))};var Ae=L(O(),1);async function we({pollOptions:t,options:{variables:r,developerPlatformClient:n},storeNameById:i,organizationId:a}){return V(Ae.default.createElement(Pe,{pollOptions:t,resubscribeCallback:async()=>I(n,r,a),storeNameById:i,developerPlatformClient:n,organizationId:a}))}x();async function U({pollOptions:t,options:{variables:r,developerPlatformClient:n},storeNameById:i,organizationId:a,consecutiveResubscribeFailures:p=0}){let c=await M({pollOptions:t,developerPlatformClient:n,organizationId:a}),u=F,o=t.jwtToken,l=p,g=c;if(g.errors){let m=await B({response:g,onThrottle:b=>{S(JSON.stringify({message:"Request throttled while polling app logs.",retry_in_ms:b}))},onUnknownError:b=>{S(JSON.stringify({message:"Error while polling app logs.",retry_in_ms:b}))},onResubscribe:()=>I(n,r,a)});if(m.resubscribeResult==="failed"){if(l+=1,l>=v){S(JSON.stringify({message:"App log streaming session has expired. Please restart your dev session."}));return}}else m.resubscribeResult==="succeeded"&&(l=0);m.nextJwtToken&&(o=m.nextJwtToken),u=m.retryIntervalMs}else l=0;let{cursor:y,appLogs:A}=c;A&&A.forEach(m=>{let b=i.get(m.shop_id?.toString());b!==void 0&&N(Te({appLog:m,appLogPayload:he(m.payload,m.log_type),storeName:b,prettyPrint:!1}))}),setTimeout(()=>{U({options:{variables:r,developerPlatformClient:n},pollOptions:{jwtToken:o||t.jwtToken,cursor:y??t.cursor,filters:t.filters},storeNameById:i,organizationId:a,consecutiveResubscribeFailures:l}).catch(m=>{throw m})},u)}async function Se(t){let{app:r,remoteApp:n,developerPlatformClient:i}=t,a=await Ne(t),p=xe(r);if(p.length===0)throw new E("This app has no log sources. Learn more about app logs at https://shopify.dev/docs/api/shopify-cli/app/app-logs");if(t.sources){let g=t.sources.filter(y=>!p.includes(y));if(g.length)throw new E(`Invalid sources: ${g.join(", ")}. Valid sources are: ${p.join(", ")}`)}let c={shopIds:a.storeIds.map(Number),apiKey:n.apiKey},u=await I(i,c,t.organization.id),o={status:t.status,sources:t.sources},l={jwtToken:u,filters:o};t.format==="json"?(N(JSON.stringify({subscribedToStores:t.storeFqdns})),S(JSON.stringify({message:"Waiting for app logs..."})),await U({options:{variables:c,developerPlatformClient:i},pollOptions:l,storeNameById:a.storeNameById,organizationId:t.organization.id})):(S(`Waiting for app logs...
|
|
2
|
+
`),await we({options:{variables:c,developerPlatformClient:i},pollOptions:l,storeNameById:a.storeNameById,organizationId:t.organization.id}))}async function Ne(t){let{app:r,remoteApp:n,developerPlatformClient:i,primaryStore:a,organization:p}=t,c=R(r.configPath);t.format==="text"&&Fe(n.title,a.shopDomain,t.storeFqdns,c,p.businessName);let u=new Map;return u.set(a.shopId,a.shopDomain),t.storeFqdns&&t.storeFqdns.length>1&&await Promise.all(t.storeFqdns?.slice(1).map(async l=>{let g=await W(p,l,i);u.set(g.shopId,l)})),{storeIds:Array.from(u.keys()),storeNameById:u}}function Fe(t,r,n,i,a){let p=[];n&&n.length>0?n.forEach(u=>p.push(u)):p.push(r);let c=i?Y(i):void 0;$({headline:i?`Using ${c} for default values:`:"Using these settings:",body:X({appName:t,org:a,devStores:p,messages:[Z]})})}var _=L(Le(),1);var q=class t extends te{static{this.summary="Stream detailed logs for your Shopify app."}static{this.descriptionWithMarkdown="\n Opens a real-time stream of detailed app logs from the selected app and store.\n Use the `--source` argument to limit output to a particular log source, such as a specific Shopify Function handle. Use the `shopify app logs sources` command to view a list of sources.\n Use the `--status` argument to filter on status, either `success` or `failure`.\n ```\n shopify app logs --status=success --source=extension.discount-function\n ```\n "}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...G,...Q,...H,store:_.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",multiple:!0,parse:async r=>j(r)}),source:_.Flags.string({description:"Filters output to the specified log source.",env:"SHOPIFY_FLAG_SOURCE",multiple:!0}),status:_.Flags.string({description:"Filters output to the specified status (success or failure).",options:["success","failure"],env:"SHOPIFY_FLAG_STATUS"})}}async run(){let{flags:r}=await this.parse(t);await K(r.path);let n=await ee({directory:r.path,clientId:r["client-id"],forceRelink:r.reset,userProvidedConfigName:r.config}),i=await oe({appContextResult:n,storeFqdn:r.store?.[0],forceReselectStore:r.reset}),a={...n,primaryStore:i,storeFqdns:r.store,sources:r.source,status:r.status,format:r.json?"json":"text"};return await Se(a),{app:n.app}}};export{q as default};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as L}from"../../../chunk-D3TSJA5S.js";import{a as C}from"../../../chunk-RF2DPBA6.js";import{Ba as P,S as I,T as R,U as x}from"../../../chunk-SBEZBZM7.js";import"../../../chunk-DJQVNH7P.js";import"../../../chunk-66RJ5T7A.js";import"../../../chunk-K2WUCOQJ.js";import"../../../chunk-ELYP4KFP.js";import"../../../chunk-7MUKLZOL.js";import"../../../chunk-VBUZWRUL.js";import"../../../chunk-XBXMPFXM.js";import"../../../chunk-R466TU3N.js";import"../../../chunk-UGXYQ23Y.js";import"../../../chunk-QSTEVZFQ.js";import"../../../chunk-5Y7GIF2W.js";import"../../../chunk-TQYMC7TH.js";import"../../../chunk-HUZUORYM.js";import"../../../chunk-52GC6XUT.js";import"../../../chunk-XLELNRFF.js";import"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import{b as k}from"../../../chunk-323UTVMM.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import{D as h,v as w,x as v}from"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import{d as g}from"../../../chunk-IASVAERO.js";import{f as A}from"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import{r as F}from"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import{e as E,g as l}from"../../../chunk-VPRTJUIN.js";l();l();async function O(r){let{developerPlatformClient:e,app:d,remoteApp:o}=r,{extensionIdentifiersBreakdown:a,versionDetails:n}=await I(e,o,r.version),i=await R({developerPlatformClient:e,apiKey:o.apiKey,localApp:d,remoteApp:o,versionAppModules:n.appModuleVersions.map(s=>({...s})),release:!0});if(!await x({configExtensionIdentifiersBreakdown:i,extensionIdentifiersBreakdown:a,appTitle:o.title,release:!0,force:r.force,allowUpdates:r.allowUpdates,allowDeletes:r.allowDeletes}))throw new A;let c=[{title:"Releasing version",task:async s=>{s.appRelease=await e.release({app:o,version:{versionId:n.uuid,appVersionId:n.id}})}}],{appRelease:{appRelease:t}}=await h(c),f=[{link:{label:n.versionTag??void 0,url:n.location}},n.message?`
|
|
2
|
+
${n.message}`:""];if(t.userErrors&&t.userErrors.length>0){let s=t.userErrors?.map(b=>b.message).join(", ");v({headline:"Version couldn't be released.",body:[...f,`${f.length>0?`
|
|
3
|
+
|
|
4
|
+
`:""}${s}`]})}else w({headline:"Version released to users.",body:f})}var p=E(F(),1);var u=class r extends L{static{this.summary="Release an app version."}static{this.usage="app release --version <version>"}static{this.descriptionWithMarkdown="Releases an existing app version. Pass the name of the version that you want to release using the `--version` flag."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...k,...C,"allow-updates":p.Flags.boolean({hidden:!1,description:"Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.",env:"SHOPIFY_FLAG_ALLOW_UPDATES"}),"allow-deletes":p.Flags.boolean({hidden:!1,description:"Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.",env:"SHOPIFY_FLAG_ALLOW_DELETES"}),version:p.Flags.string({hidden:!1,description:"The name of the app version to release.",env:"SHOPIFY_FLAG_VERSION",required:!0})}}async run(){let{flags:e}=await this.parse(r),d=e["client-id"];await g(()=>({cmd_app_reset_used:e.reset}));let o=e["allow-updates"],a=e["allow-deletes"],n=!!(o&&a),i=[];!o&&!a&&i.push("allow-updates"),this.failMissingNonTTYFlags(e,i);let{app:m,remoteApp:c,developerPlatformClient:t}=await P({directory:e.path,clientId:d,forceRelink:e.reset,userProvidedConfigName:e.config});return await O({app:m,remoteApp:c,developerPlatformClient:t,force:n,allowUpdates:o,allowDeletes:a,version:e.version}),{app:m}}};export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as P}from"../../../../chunk-D3TSJA5S.js";import{a as b}from"../../../../chunk-RF2DPBA6.js";import{Ba as O,ca as E}from"../../../../chunk-SBEZBZM7.js";import"../../../../chunk-DJQVNH7P.js";import"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import{b as k,c as T}from"../../../../chunk-323UTVMM.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import{C as A}from"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import{d as y}from"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import{Gb as v,Ib as L,Mb as C,Nb as m,Wb as w,ca as u,tb as h}from"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import{j as d}from"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{g as p}from"../../../../chunk-VPRTJUIN.js";p();p();var S=12;async function I(a,t,n){let r=await a.appVersions(t);if(!r.app)throw new y(`Invalid API Key: ${t.apiKey}`);let s=r.app.appVersions.nodes.map(e=>{let i=e.message??"";return{...e,status:e.status==="active"&&!n?h.green(`\u2605 ${e.status}`):e.status,createdBy:e.createdBy?.displayName??"",createdAt:u(new Date(e.createdAt)),message:i}});if(!n){let e=(process.stdout.columns??75)-S,i=e;s.forEach(o=>{let f=o.message.length+(o.versionTag?.length??0)+w(o.status).length+o.createdAt.length+o.createdBy.length;if(f>e){let R=f-o.message.length,g=Math.max(e-R,10);g<i&&(i=g)}}),s.forEach(o=>{o.message.length>i&&(o.message=`${o.message.slice(0,i-3)}...`)})}return{appVersions:s,totalResults:r.app.appVersions.pageInfo.totalResults,app:r.app}}async function l(a){let{remoteApp:t,developerPlatformClient:n,organization:r}=a,{appVersions:s,totalResults:e}=await I(n,t,a.json);if(a.json)return C(JSON.stringify(s,null,2));if(E({org:r.businessName,appName:t.title,configFile:d(a.app.configPath)}),s.length===0){m("No app versions found for this app");return}A({rows:s,columns:{versionTag:{header:"VERSION"},status:{header:"STATUS"},message:{header:"MESSAGE"},createdAt:{header:"DATE CREATED"},createdBy:{header:"CREATED BY"}}});let i=v.link(n.webUiName,[await n.appDeepLink(t),"versions"].join("/"));m(L`\nView all ${String(e)} app versions in the ${i}`)}var c=class a extends P{static{this.summary="List deployed versions of your app."}static{this.descriptionWithMarkdown="Lists the deployed app versions. An app version is a snapshot of your app extensions."}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...k,...b,...T}}async run(){let{flags:t}=await this.parse(a),{app:n,remoteApp:r,developerPlatformClient:s,organization:e}=await O({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config});return await l({app:n,remoteApp:r,organization:e,developerPlatformClient:s,json:t.json}),{app:n}}};export{c as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{a as k,b as i,c as E,d as C,e as L,f as F,g as M}from"../../../../chunk-AIV5RI3X.js";import{a as S}from"../../../../chunk-D3TSJA5S.js";import{a as P}from"../../../../chunk-RF2DPBA6.js";import{Ba as w,ca as A}from"../../../../chunk-SBEZBZM7.js";import{H as b,I as T,J as I}from"../../../../chunk-DJQVNH7P.js";import"../../../../chunk-66RJ5T7A.js";import"../../../../chunk-K2WUCOQJ.js";import"../../../../chunk-ELYP4KFP.js";import"../../../../chunk-7MUKLZOL.js";import"../../../../chunk-VBUZWRUL.js";import"../../../../chunk-XBXMPFXM.js";import"../../../../chunk-R466TU3N.js";import"../../../../chunk-UGXYQ23Y.js";import"../../../../chunk-QSTEVZFQ.js";import"../../../../chunk-5Y7GIF2W.js";import"../../../../chunk-TQYMC7TH.js";import"../../../../chunk-HUZUORYM.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import{B as f,F as y,z as l}from"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import{r as z}from"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import{Ob as c,Rb as m,Tb as v}from"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import{j as u}from"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import{e as Y,g as s}from"../../../../chunk-VPRTJUIN.js";s();s();s();s();async function O(e){let t=e.map(o=>({label:o,value:o}));return await f({message:"Webhook Topic",choices:t})}async function V(e){return l({message:"Webhook ApiVersion",choices:e.map(t=>({label:t,value:t}))})}async function D(){return l({message:"Delivery method",choices:[{label:"HTTP",value:i.HTTP},{label:"Google Pub/Sub",value:i.PUBSUB},{label:"Amazon EventBridge",value:i.EVENTBRIDGE}]})}async function W(e){return(await y({message:"Address for delivery",validate:r=>{let o=r.trim();if(o.length===0)return"Address can't be empty";if(!E(o,e))return`Invalid address.
|
|
2
|
+
${d(e)}`}})).trim()}function N(e){return e===i.HTTP?["For remote HTTP testing, use a URL that starts with https://","For local HTTP testing, use http://localhost:{port}/{url-path}"]:e===i.PUBSUB?["For Google Pub/Sub, use pubsub://{project-id}:{topic-id}"]:e===i.EVENTBRIDGE?["For Amazon EventBridge, use an Amazon Resource Name (ARN) starting with arn:aws:events:"]:[]}function d(e){return N(e).map(t=>` \xB7 ${v(t)}`).join(`
|
|
3
|
+
`)}async function H(e,t){let{clientSecret:r,clientId:o,remoteApp:n,app:p}=e;return r&&(o||t!==i.EVENTBRIDGE)?{clientSecret:r,apiKey:o}:(A({appName:n.title,configFile:u(p.configPath)}),{clientSecret:n.apiSecretKeys.find(h=>h.secret).secret,apiKey:n.apiKey})}async function _(e,t,r){let o=await T(e,r);return t?L(t,o):V(o)}async function R(e,t,r,o){let n=await I(e,t,o);return r?F(r,t,n):O(n)}async function x(e,t){let r=e??M(t)??await D(),o=t??await W(r);return C(o,r)}async function B(e){let t=await G(e);await U(t)}async function G(e){let t=await _(e.developerPlatformClient,e.apiVersion,e.organizationId),r=await R(e.developerPlatformClient,t,e.topic,e.organizationId),[o,n]=await x(e.deliveryMethod,e.address),p=await H(e,n);return{topic:r,apiVersion:t,deliveryMethod:n,address:o,apiKey:p.apiKey,clientSecret:p.clientSecret,developerPlatformClient:e.developerPlatformClient,organizationId:e.organizationId}}async function U(e){let t={topic:e.topic,api_version:e.apiVersion,address:e.address,delivery_method:e.deliveryMethod,shared_secret:e.clientSecret,api_key:e.apiKey},r=await b(e.developerPlatformClient,t,e.organizationId);if(!r.success){m(`Request errors:
|
|
4
|
+
${q(r.userErrors)}`);return}if(e.deliveryMethod===i.LOCALHOST){if(await k(e.address,r.samplePayload,r.headers)){c("Localhost delivery sucessful");return}m("Localhost delivery failed");return}r.samplePayload===JSON.stringify({})&&c("Webhook has been enqueued for delivery")}function q(e){try{return e.map(t=>JSON.parse(t.message).map(r=>` \xB7 ${r}`).join(`
|
|
5
|
+
`)).join(`
|
|
6
|
+
`)}catch{return JSON.stringify(e)}}var a=Y(z(),1),g=class e extends S{static{this.summary="Trigger delivery of a sample webhook topic payload to a designated address."}static{this.descriptionWithMarkdown=`
|
|
7
|
+
Triggers the delivery of a sample Admin API event topic payload to a designated address.
|
|
8
|
+
|
|
9
|
+
You should use this command to experiment with webhooks, to initially test your webhook configuration, or for unit testing. However, to test your webhook configuration from end to end, you should always trigger webhooks by performing the related action in Shopify.
|
|
10
|
+
|
|
11
|
+
Because most webhook deliveries use remote endpoints, you can trigger the command from any directory where you can use Shopify CLI, and send the webhook to any of the supported endpoint types. For example, you can run the command from your app's local directory, but send the webhook to a staging environment endpoint.
|
|
12
|
+
|
|
13
|
+
To learn more about using webhooks in a Shopify app, refer to [Webhooks overview](https://shopify.dev/docs/apps/webhooks).
|
|
14
|
+
|
|
15
|
+
### Limitations
|
|
16
|
+
|
|
17
|
+
- Webhooks triggered using this method always have the same payload, so they can't be used to test scenarios that differ based on the payload contents.
|
|
18
|
+
- Webhooks triggered using this method aren't retried when they fail.
|
|
19
|
+
- Trigger requests are rate-limited using the [Partner API rate limit](https://shopify.dev/docs/api/partner#rate_limits).
|
|
20
|
+
- You can't use this method to validate your API webhook subscriptions.
|
|
21
|
+
`}static{this.description=this.descriptionWithoutMarkdown()}static{this.flags={...P,help:a.Flags.help({required:!1,hidden:!1,env:"SHOPIFY_FLAG_HELP",description:"This help. When you run the trigger command the CLI will prompt you for any information that isn't passed using flags."}),topic:a.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_TOPIC",description:"The requested webhook topic."}),"api-version":a.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_API_VERSION",description:"The API Version of the webhook topic."}),"delivery-method":a.Flags.string({required:!1,hidden:!1,options:[i.HTTP,i.PUBSUB,i.EVENTBRIDGE],env:"SHOPIFY_FLAG_DELIVERY_METHOD",description:"Method chosen to deliver the topic payload. If not passed, it's inferred from the address."}),"client-secret":a.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_CLIENT_SECRET",description:"Your app's client secret. This secret allows us to return the X-Shopify-Hmac-SHA256 header that lets you validate the origin of the response that you receive."}),address:a.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_ADDRESS",description:`The URL where the webhook payload should be sent.
|
|
22
|
+
You will need a different address type for each delivery-method:
|
|
23
|
+
${d(i.HTTP)}
|
|
24
|
+
${d(i.PUBSUB)}
|
|
25
|
+
${d(i.EVENTBRIDGE)}`})}}async run(){let{flags:t}=await this.parse(e),r=await w({directory:t.path,clientId:t["client-id"],forceRelink:t.reset,userProvidedConfigName:t.config}),o={...r,topic:t.topic,apiVersion:t["api-version"],deliveryMethod:t["delivery-method"],address:t.address,clientId:t["client-id"],clientSecret:t["client-secret"],path:t.path,config:t.config,organizationId:r.organization.id};return await B(o),{app:r.app}}};export{g as default};
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { promptSessionSelect } from '@shopify/cli-kit/node/session-prompt';
|
|
3
|
-
import { Flags } from '@oclif/core';
|
|
4
|
-
import { outputCompleted } from '@shopify/cli-kit/node/output';
|
|
5
|
-
class Login extends Command {
|
|
6
|
-
async run() {
|
|
7
|
-
const { flags } = await this.parse(Login);
|
|
8
|
-
const result = await promptSessionSelect(flags.alias);
|
|
9
|
-
outputCompleted(`Current account: ${result}.`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
Login.description = 'Logs you in to your Shopify account.';
|
|
13
|
-
Login.flags = {
|
|
14
|
-
alias: Flags.string({
|
|
15
|
-
description: 'Alias of the session you want to login to.',
|
|
16
|
-
env: 'SHOPIFY_FLAG_AUTH_ALIAS',
|
|
17
|
-
}),
|
|
18
|
-
};
|
|
19
|
-
export default Login;
|
|
20
|
-
//# sourceMappingURL=login.js.map
|
|
1
|
+
import{a}from"../../../chunk-6TZAAS5H.js";import"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-IASVAERO.js";import"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import"../../../chunk-VPRTJUIN.js";export{a as default};
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { outputSuccess } from '@shopify/cli-kit/node/output';
|
|
3
|
-
import { logout } from '@shopify/cli-kit/node/session';
|
|
4
|
-
class Logout extends Command {
|
|
5
|
-
async run() {
|
|
6
|
-
await logout();
|
|
7
|
-
outputSuccess('Logged out from all the accounts');
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
Logout.description = 'Logs you out of the Shopify account or Partner account and store.';
|
|
11
|
-
export default Logout;
|
|
12
|
-
//# sourceMappingURL=logout.js.map
|
|
1
|
+
import{a}from"../../../chunk-6B53BWJW.js";import"../../../chunk-B2EHO7ZC.js";import"../../../chunk-4LNCYIS3.js";import"../../../chunk-LAZJ47DZ.js";import"../../../chunk-PRKBO42R.js";import"../../../chunk-GOJ2QHSR.js";import"../../../chunk-7BGM2GAH.js";import"../../../chunk-XNO6DZYP.js";import"../../../chunk-3TNEIDOD.js";import"../../../chunk-4HHXSMD7.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-IASVAERO.js";import"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import"../../../chunk-VPRTJUIN.js";export{a as default};
|
|
@@ -1,11 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { clearCache } from '@shopify/cli-kit/node/cli';
|
|
3
|
-
class ClearCache extends Command {
|
|
4
|
-
async run() {
|
|
5
|
-
clearCache();
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
ClearCache.description = 'Clear the CLI cache, used to store some API responses and handle notifications status';
|
|
9
|
-
ClearCache.hidden = true;
|
|
10
|
-
export default ClearCache;
|
|
11
|
-
//# sourceMappingURL=clear.js.map
|
|
1
|
+
import{a}from"../../../chunk-Q7ING5F5.js";import"../../../chunk-323UTVMM.js";import"../../../chunk-YZDDTYTU.js";import"../../../chunk-MOA33ZFO.js";import"../../../chunk-JUVAGMIH.js";import"../../../chunk-BDVAE5MS.js";import"../../../chunk-P6XE4MH5.js";import"../../../chunk-KLMDWDT2.js";import"../../../chunk-5CH3B62S.js";import"../../../chunk-QUTQDXSL.js";import"../../../chunk-IASVAERO.js";import"../../../chunk-JPGO36XP.js";import"../../../chunk-PD5ZHJWI.js";import"../../../chunk-LDGAHMS7.js";import"../../../chunk-ZR76GGZ6.js";import"../../../chunk-EENHXSWU.js";import"../../../chunk-FUOIGXI4.js";import"../../../chunk-6M3ZYNGO.js";import"../../../chunk-QYR5VPQA.js";import"../../../chunk-V2CNCPIE.js";import"../../../chunk-GFEAKSGV.js";import"../../../chunk-CERXUPGC.js";import"../../../chunk-T4M5CWAO.js";import"../../../chunk-PRVQAHWI.js";import"../../../chunk-YC6G4MHD.js";import"../../../chunk-N7RBSKYT.js";import"../../../chunk-IU2ZQ6TE.js";import"../../../chunk-PIBY5DDZ.js";import"../../../chunk-VPRTJUIN.js";export{a as default};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const autoUpgradeStatus: {
|
|
2
2
|
readonly on: "Auto-upgrade on. Shopify CLI will update automatically after each command.";
|
|
3
3
|
readonly off: "Auto-upgrade off. You'll need to run `shopify upgrade` to update manually.";
|
|
4
|
-
readonly notConfigured: "Auto-upgrade not configured. Run `shopify config autoupgrade on` to enable it.";
|
|
5
4
|
};
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
on: 'Auto-upgrade on. Shopify CLI will update automatically after each command.',
|
|
3
|
-
off: "Auto-upgrade off. You'll need to run `shopify upgrade` to update manually.",
|
|
4
|
-
notConfigured: 'Auto-upgrade not configured. Run `shopify config autoupgrade on` to enable it.',
|
|
5
|
-
};
|
|
6
|
-
//# sourceMappingURL=constants.js.map
|
|
1
|
+
import{a}from"../../../../chunk-OCOY5MV2.js";import"../../../../chunk-VPRTJUIN.js";export{a as autoUpgradeStatus};
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { autoUpgradeStatus } from './constants.js';
|
|
3
|
-
import { setAutoUpgradeEnabled } from '@shopify/cli-kit/node/upgrade';
|
|
4
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
5
|
-
import { renderInfo } from '@shopify/cli-kit/node/ui';
|
|
6
|
-
class AutoupgradeOff extends Command {
|
|
7
|
-
async run() {
|
|
8
|
-
setAutoUpgradeEnabled(false);
|
|
9
|
-
renderInfo({ body: autoUpgradeStatus.off });
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
_a = AutoupgradeOff;
|
|
13
|
-
AutoupgradeOff.summary = 'Disable automatic upgrades for Shopify CLI.';
|
|
14
|
-
AutoupgradeOff.descriptionWithMarkdown = `Disable automatic upgrades for Shopify CLI.
|
|
15
|
-
|
|
16
|
-
When auto-upgrade is disabled, Shopify CLI won't automatically update. Run \`shopify upgrade\` to update manually.
|
|
17
|
-
|
|
18
|
-
To enable auto-upgrade, run \`shopify config autoupgrade on\`.
|
|
19
|
-
`;
|
|
20
|
-
AutoupgradeOff.description = _a.descriptionWithoutMarkdown();
|
|
21
|
-
export default AutoupgradeOff;
|
|
22
|
-
//# sourceMappingURL=off.js.map
|
|
1
|
+
import{a}from"../../../../chunk-INEU4XKS.js";import"../../../../chunk-OCOY5MV2.js";import"../../../../chunk-ELVFJ7BR.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import"../../../../chunk-VPRTJUIN.js";export{a as default};
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { autoUpgradeStatus } from './constants.js';
|
|
3
|
-
import { setAutoUpgradeEnabled } from '@shopify/cli-kit/node/upgrade';
|
|
4
|
-
import Command from '@shopify/cli-kit/node/base-command';
|
|
5
|
-
import { renderInfo } from '@shopify/cli-kit/node/ui';
|
|
6
|
-
class AutoupgradeOn extends Command {
|
|
7
|
-
async run() {
|
|
8
|
-
setAutoUpgradeEnabled(true);
|
|
9
|
-
renderInfo({ body: autoUpgradeStatus.on });
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
_a = AutoupgradeOn;
|
|
13
|
-
AutoupgradeOn.summary = 'Enable automatic upgrades for Shopify CLI.';
|
|
14
|
-
AutoupgradeOn.descriptionWithMarkdown = `Enable automatic upgrades for Shopify CLI.
|
|
15
|
-
|
|
16
|
-
When auto-upgrade is enabled, Shopify CLI automatically updates to the latest version once per day. Major version upgrades are skipped and must be done manually.
|
|
17
|
-
|
|
18
|
-
To disable auto-upgrade, run \`shopify config autoupgrade off\`.
|
|
19
|
-
`;
|
|
20
|
-
AutoupgradeOn.description = _a.descriptionWithoutMarkdown();
|
|
21
|
-
export default AutoupgradeOn;
|
|
22
|
-
//# sourceMappingURL=on.js.map
|
|
1
|
+
import{a}from"../../../../chunk-WZBSLU4Q.js";import"../../../../chunk-OCOY5MV2.js";import"../../../../chunk-ELVFJ7BR.js";import"../../../../chunk-52GC6XUT.js";import"../../../../chunk-XLELNRFF.js";import"../../../../chunk-B2EHO7ZC.js";import"../../../../chunk-4LNCYIS3.js";import"../../../../chunk-LAZJ47DZ.js";import"../../../../chunk-PRKBO42R.js";import"../../../../chunk-GOJ2QHSR.js";import"../../../../chunk-7BGM2GAH.js";import"../../../../chunk-XNO6DZYP.js";import"../../../../chunk-3TNEIDOD.js";import"../../../../chunk-4HHXSMD7.js";import"../../../../chunk-YZDDTYTU.js";import"../../../../chunk-MOA33ZFO.js";import"../../../../chunk-JUVAGMIH.js";import"../../../../chunk-BDVAE5MS.js";import"../../../../chunk-P6XE4MH5.js";import"../../../../chunk-KLMDWDT2.js";import"../../../../chunk-5CH3B62S.js";import"../../../../chunk-QUTQDXSL.js";import"../../../../chunk-IASVAERO.js";import"../../../../chunk-JPGO36XP.js";import"../../../../chunk-PD5ZHJWI.js";import"../../../../chunk-LDGAHMS7.js";import"../../../../chunk-ZR76GGZ6.js";import"../../../../chunk-EENHXSWU.js";import"../../../../chunk-FUOIGXI4.js";import"../../../../chunk-6M3ZYNGO.js";import"../../../../chunk-QYR5VPQA.js";import"../../../../chunk-V2CNCPIE.js";import"../../../../chunk-GFEAKSGV.js";import"../../../../chunk-CERXUPGC.js";import"../../../../chunk-T4M5CWAO.js";import"../../../../chunk-PRVQAHWI.js";import"../../../../chunk-YC6G4MHD.js";import"../../../../chunk-N7RBSKYT.js";import"../../../../chunk-IU2ZQ6TE.js";import"../../../../chunk-PIBY5DDZ.js";import"../../../../chunk-VPRTJUIN.js";export{a as default};
|