shopify 5.0.2 → 5.1.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/dist/analytics-QFDTQYPM.js +1 -0
- package/dist/analytics-XADBBHOH.js +1 -0
- package/dist/bootstrap.js +1 -1
- package/dist/chunk-24Q6X53V.js +1 -0
- package/dist/{chunk-LEHBZKK3.js → chunk-25MYHE4W.js} +1 -1
- package/dist/{chunk-TODZ3TJR.js → chunk-27JT4NA4.js} +1 -1
- package/dist/chunk-2BYW3BYX.js +1 -0
- package/dist/chunk-2KFYIYLI.js +1 -0
- package/dist/{chunk-D2KIGKBI.js → chunk-2KUM2RU4.js} +60 -60
- package/dist/chunk-2PD7TNFS.js +275 -0
- package/dist/{chunk-64G5TGFF.js → chunk-3C72S6LO.js} +1 -1
- package/dist/chunk-3FZ4LE6A.js +10 -0
- package/dist/{chunk-3MYDSQHF.js → chunk-3GD5ESWN.js} +1 -1
- package/dist/chunk-3KGN6N7E.js +1 -0
- package/dist/{chunk-KNWT7JLL.js → chunk-3MZ7ELHS.js} +2 -2
- package/dist/{chunk-PF53E2DC.js → chunk-3PS52ZT4.js} +1 -1
- package/dist/chunk-3PYDIBTX.js +1 -0
- package/dist/chunk-3Z75BVGJ.js +1 -0
- package/dist/chunk-4FWPOGPQ.js +1 -0
- package/dist/chunk-4IP37MBX.js +1 -0
- package/dist/chunk-4NFX7YCT.js +1 -0
- package/dist/chunk-4TCXPHKN.js +1 -0
- package/dist/chunk-4WBWZIN5.js +6 -0
- package/dist/chunk-5534MHZW.js +97 -0
- package/dist/{chunk-UKWIWCOH.js → chunk-5C6CXU74.js} +1 -1
- package/dist/{chunk-QEKGGTMN.js → chunk-5HOZDOJ7.js} +1 -1
- package/dist/{chunk-ER6C5WS3.js → chunk-5PSQFQL6.js} +1 -1
- package/dist/chunk-5T3ZT6CC.js +1 -0
- package/dist/chunk-62NW4EPI.js +17 -0
- package/dist/chunk-65NCQJYR.js +1 -0
- package/dist/{chunk-IHXGZW42.js → chunk-6BYHL3DS.js} +1 -1
- package/dist/chunk-6I7DT7QR.js +3 -0
- package/dist/chunk-6IMTMS2S.js +3 -0
- package/dist/chunk-7A77JCED.js +11 -0
- package/dist/chunk-7ART2IKU.js +1 -0
- package/dist/{chunk-I4CEH7AK.js → chunk-7BPT5V24.js} +2 -2
- package/dist/{chunk-Z2WAW6MM.js → chunk-7CT3NIXI.js} +1 -1
- package/dist/chunk-7DBKSSDK.js +1 -0
- package/dist/chunk-7HECBXSP.js +1 -0
- package/dist/chunk-7KID5BIR.js +4 -0
- package/dist/{chunk-2L6AN3QA.js → chunk-7N7KRZOM.js} +1 -1
- package/dist/{chunk-W37IFK3P.js → chunk-7NRHZG5Y.js} +102 -102
- package/dist/chunk-7PHDEILV.js +1 -0
- package/dist/chunk-A2NSORBM.js +2296 -0
- package/dist/chunk-A54TADAZ.js +1 -0
- package/dist/{chunk-YTUUU33R.js → chunk-AE3IQG7S.js} +1 -1
- package/dist/chunk-AGTUAQHX.js +4 -0
- package/dist/chunk-AHYI27QL.js +11 -0
- package/dist/chunk-ALINJ6J2.js +1 -0
- package/dist/chunk-AMVWKHNY.js +1 -0
- package/dist/{chunk-NVKJ7ZLP.js → chunk-ASKBYEO7.js} +1 -1
- package/dist/{chunk-62EOM3Y2.js → chunk-AVJJGQOP.js} +1 -1
- package/dist/{chunk-NXAEBGMO.js → chunk-AY3AAV77.js} +1 -1
- package/dist/{chunk-F3CK3EJJ.js → chunk-BFAOTQGH.js} +1 -1
- package/dist/{chunk-H6GNKWYM.js → chunk-BPKQA2EO.js} +1 -1
- package/dist/{chunk-WESTVWWD.js → chunk-C2HJEGTS.js} +1 -1
- package/dist/chunk-C72QNK6O.js +4 -0
- package/dist/chunk-CDSDQTNB.js +16 -0
- package/dist/chunk-CEQGOCKX.js +1 -0
- package/dist/{chunk-WCC52MR2.js → chunk-CIGWIKOW.js} +1 -1
- package/dist/chunk-CQAD5WML.js +1 -0
- package/dist/chunk-CRQQCT7F.js +1 -0
- package/dist/chunk-CZNUBAAG.js +3 -0
- package/dist/{chunk-ISKQQXLZ.js → chunk-D7IMC2G4.js} +1 -1
- package/dist/{chunk-6ES4KRFW.js → chunk-DC7ITY6T.js} +1 -1
- package/dist/{chunk-7GHSE7SG.js → chunk-DDRP6QTC.js} +1 -1
- package/dist/{chunk-SLY27GDC.js → chunk-DDZYIC76.js} +2 -2
- package/dist/chunk-DGIIUQH3.js +1 -0
- package/dist/{chunk-3KM5ZOW2.js → chunk-DMOLPSXF.js} +1 -1
- package/dist/{chunk-LHXFTFFM.js → chunk-DOLVBTCB.js} +1 -1
- package/dist/{chunk-WBVS5NBV.js → chunk-DTKGI43P.js} +2 -2
- package/dist/{chunk-2WJOTJOD.js → chunk-DVD7I2TX.js} +2 -2
- package/dist/chunk-DVFVO6ZE.js +2 -0
- package/dist/{chunk-3XRI3D44.js → chunk-DXEMSLI6.js} +1 -1
- package/dist/chunk-EDWIWZWM.js +15 -0
- package/dist/chunk-ELR6AZT4.js +9 -0
- package/dist/chunk-EVQPYZ7F.js +5 -0
- package/dist/chunk-F5QKMDP3.js +1 -0
- package/dist/{chunk-URXM5A2K.js → chunk-F6IQWX2F.js} +1 -1
- package/dist/{chunk-SACNUF4I.js → chunk-FAVPTYIR.js} +1 -1
- package/dist/{chunk-Q7BOSHWX.js → chunk-FDSNRKGQ.js} +1 -1
- package/dist/{chunk-Q4JYAUVL.js → chunk-FHKK3QU7.js} +1 -1
- package/dist/chunk-FKKJQGYX.js +7 -0
- package/dist/chunk-FQLXQ7WN.js +16 -0
- package/dist/{chunk-6PUU6ZNQ.js → chunk-FRWQJAW2.js} +1 -1
- package/dist/{chunk-J5ERDFIC.js → chunk-FU7PYW7H.js} +1 -1
- package/dist/{chunk-ESFCYB46.js → chunk-FYQE5E6U.js} +1 -1
- package/dist/chunk-G3EWGBXR.js +1 -0
- package/dist/chunk-G3RNO2TC.js +1 -0
- package/dist/{chunk-35XFNKNB.js → chunk-GGCP2TIK.js} +1 -1
- package/dist/chunk-GSFWBFFH.js +1 -0
- package/dist/{chunk-ZRI3SSLG.js → chunk-H2KGP2FM.js} +2 -2
- package/dist/{chunk-GW7YIJPJ.js → chunk-H4K3F7PP.js} +1 -1
- package/dist/chunk-HGZ2HRPO.js +13 -0
- package/dist/chunk-HMPRWNGG.js +203 -0
- package/dist/chunk-HP4QYSBQ.js +1 -0
- package/dist/{chunk-RPCIFYCY.js → chunk-HSTZV6H7.js} +2 -2
- package/dist/{chunk-N57Y7THE.js → chunk-HVUMVDUG.js} +1 -1
- package/dist/{chunk-XWSWXQCC.js → chunk-HYCNYUHW.js} +1 -1
- package/dist/{chunk-CXI3RHPW.js → chunk-I3WRA2LH.js} +1 -1
- package/dist/{chunk-UUAKOX7E.js → chunk-IRLYC626.js} +2 -2
- package/dist/chunk-IWNFPBH2.js +33 -0
- package/dist/{chunk-C3RFAKWR.js → chunk-JALDNBTU.js} +1 -1
- package/dist/{chunk-QDCLL5OI.js → chunk-JC37YZ4I.js} +1 -1
- package/dist/{chunk-QF5WKTPD.js → chunk-JG4FAT2T.js} +1 -1
- package/dist/chunk-JGLLABZR.js +8 -0
- package/dist/chunk-JIY6XWSC.js +1 -0
- package/dist/{chunk-3ODQKAEA.js → chunk-JIYCZXK5.js} +1 -1
- package/dist/chunk-JMSAHCBU.js +35 -0
- package/dist/{chunk-KZRLZWOU.js → chunk-JNSVKDBY.js} +1 -1
- package/dist/chunk-JQU2BJDH.js +3 -0
- package/dist/chunk-JVY6CCLE.js +3 -0
- package/dist/{chunk-BAHIL37I.js → chunk-K4QJEQI4.js} +1 -1
- package/dist/chunk-KCAWHJGF.js +1 -0
- package/dist/{chunk-YV2TP44L.js → chunk-KFO2JNF5.js} +1 -1
- package/dist/chunk-KFR7HWCG.js +9 -0
- package/dist/{chunk-MEYVUHQH.js → chunk-KHZF73BL.js} +1 -1
- package/dist/{chunk-LGXI7EGM.js → chunk-KM4LE7K4.js} +2 -2
- package/dist/{chunk-IILLQOUC.js → chunk-L2PUDV7Y.js} +1 -1
- package/dist/chunk-LFBFPK22.js +1 -0
- package/dist/{chunk-BN7ZXAZJ.js → chunk-LG3KEHGD.js} +2 -2
- package/dist/chunk-LGDWE3H3.js +1 -0
- package/dist/chunk-LPPEAMI6.js +1 -0
- package/dist/chunk-LXIWMYM4.js +1 -0
- package/dist/chunk-MGWCXTGD.js +1 -0
- package/dist/chunk-MGX7UG44.js +1 -0
- package/dist/chunk-MKFRKNHF.js +3 -0
- package/dist/chunk-MTT6EAQO.js +1 -0
- package/dist/{chunk-SIL6HPMK.js → chunk-MU7IVBGI.js} +2 -2
- package/dist/{chunk-QEVTBD33.js → chunk-MYMBHVC4.js} +1 -1
- package/dist/chunk-MZDBH4XV.js +4 -0
- package/dist/{chunk-Q5IC3IYY.js → chunk-NUBJ2HK7.js} +1 -1
- package/dist/{chunk-3Z3MADXZ.js → chunk-NY5N4ANL.js} +1 -1
- package/dist/{chunk-WRZWHT6M.js → chunk-NYMKGE3J.js} +1 -1
- package/dist/{chunk-CX5CC6P5.js → chunk-O472FAYX.js} +1 -1
- package/dist/chunk-O7HZ3EIP.js +1 -0
- package/dist/chunk-OJOF6IYG.js +9 -0
- package/dist/{chunk-UXVXVI6O.js → chunk-ONZULPQH.js} +68 -66
- package/dist/chunk-ORMXPSJM.js +1 -0
- package/dist/chunk-ORYEDUKM.js +5 -0
- package/dist/{chunk-T4XJKM6B.js → chunk-OTMYJWIP.js} +1 -1
- package/dist/chunk-OVJVFB5E.js +20 -0
- package/dist/chunk-OWQEFORZ.js +1 -0
- package/dist/{chunk-UBP3LQFY.js → chunk-OXPEBT4I.js} +2 -2
- package/dist/chunk-OXZR2MB4.js +6 -0
- package/dist/chunk-OY5M52EF.js +6 -0
- package/dist/{chunk-2A2JSAAA.js → chunk-PJZZZNWR.js} +1 -1
- package/dist/chunk-Q2LQJYRK.js +16 -0
- package/dist/chunk-QBRRFFMZ.js +1 -0
- package/dist/{chunk-AQKWPRZE.js → chunk-QCLE5REL.js} +2 -2
- package/dist/{chunk-43R5VGKT.js → chunk-QGQWVA7N.js} +1 -1
- package/dist/chunk-QKPAB245.js +1 -0
- package/dist/chunk-QUPZOBTB.js +1 -0
- package/dist/chunk-R4E2E4NN.js +1 -0
- package/dist/{chunk-CGVROSPS.js → chunk-R6US7F33.js} +1 -1
- package/dist/chunk-RKNVTEO3.js +5 -0
- package/dist/{chunk-7CCTPBCT.js → chunk-RLOEI6VE.js} +1 -1
- package/dist/chunk-RSZAAN37.js +1 -0
- package/dist/{chunk-WBJ6ZHYH.js → chunk-S3RROJGG.js} +37 -37
- package/dist/chunk-S4KNPCW3.js +81 -0
- package/dist/{chunk-26PWHH3B.js → chunk-SBN3ILXO.js} +1 -1
- package/dist/chunk-SCDGLREP.js +1 -0
- package/dist/chunk-SHOMIS6Q.js +2 -0
- package/dist/chunk-SN3PMWUF.js +6 -0
- package/dist/chunk-SODCXZ5U.js +1 -0
- package/dist/chunk-SPJM7RTD.js +1 -0
- package/dist/chunk-SQL67BKI.js +5 -0
- package/dist/{chunk-AQ6EVL73.js → chunk-SURFUFAZ.js} +1 -1
- package/dist/{chunk-SNH4XZ6E.js → chunk-SVQDMZJO.js} +1 -1
- package/dist/chunk-T4ZOTYOY.js +1 -0
- package/dist/chunk-T6C4WC3Z.js +2 -0
- package/dist/chunk-TD6JBHUS.js +1 -0
- package/dist/chunk-TIM4CIXZ.js +22 -0
- package/dist/{chunk-B2O3ANRZ.js → chunk-TP7CTMMT.js} +1 -1
- package/dist/chunk-TSPJAMYB.js +1 -0
- package/dist/chunk-TSVEV2UD.js +26 -0
- package/dist/{chunk-ZBL7XMJ6.js → chunk-TTAT62N3.js} +2 -2
- package/dist/{chunk-S5P7KWY4.js → chunk-TUSS6PXB.js} +1 -1
- package/dist/chunk-TXP6KFWO.js +5 -0
- package/dist/chunk-TZHVCMZN.js +6 -0
- package/dist/chunk-UC4TOM36.js +3 -0
- package/dist/{chunk-RPVZ2JON.js → chunk-UFY4L5KQ.js} +1 -1
- package/dist/chunk-UU6UQ2QY.js +1 -0
- package/dist/chunk-V4FC72R6.js +1 -0
- package/dist/chunk-VA2S7W7H.js +10 -0
- package/dist/chunk-VE3IIC7H.js +1 -0
- package/dist/{chunk-PTSCGSQV.js → chunk-VJG7VXFU.js} +2 -2
- package/dist/chunk-VQSRU5XL.js +4 -0
- package/dist/chunk-VRIFLMA3.js +70 -0
- package/dist/chunk-WBJFTCEJ.js +1 -0
- package/dist/chunk-WBPP6PO7.js +31 -0
- package/dist/chunk-WE5KY6T6.js +1 -0
- package/dist/chunk-WFPVT2IY.js +1 -0
- package/dist/{chunk-PLSS456F.js → chunk-WLYXBQ2M.js} +1 -1
- package/dist/chunk-WNVOEE6T.js +7 -0
- package/dist/chunk-WPDJVUTY.js +47 -0
- package/dist/chunk-WWCYEZUU.js +1 -0
- package/dist/chunk-WWVDZ3GC.js +3 -0
- package/dist/{chunk-4KECSZTL.js → chunk-WZBZ7FWP.js} +2 -2
- package/dist/chunk-XEZPN5TR.js +22 -0
- package/dist/{chunk-QW52RPAU.js → chunk-XLMKHTJ5.js} +1 -1
- package/dist/chunk-XRNBCV2B.js +1 -0
- package/dist/{chunk-67L7FIB6.js → chunk-XWLNCBAG.js} +1 -1
- package/dist/chunk-YF4AXKM4.js +1 -0
- package/dist/chunk-YKDRUAY3.js +857 -0
- package/dist/{chunk-YSWVYPWR.js → chunk-YNFQBYSL.js} +1 -1
- package/dist/{chunk-TFPW2VGN.js → chunk-YNZLLZU2.js} +1 -1
- package/dist/chunk-YOYPYB4H.js +1 -0
- package/dist/{chunk-HF4NDEX3.js → chunk-YR4J46US.js} +1 -1
- package/dist/chunk-YTL45RXR.js +103 -0
- package/dist/chunk-YVPB7OT6.js +6 -0
- package/dist/chunk-YYWSHRO2.js +89 -0
- package/dist/{chunk-DZKFP6H2.js → chunk-Z5QEXS6F.js} +1 -1
- package/dist/chunk-Z5WFRYVQ.js +6 -0
- package/dist/{chunk-PWAT52M4.js → chunk-Z6ZRS256.js} +1 -1
- package/dist/chunk-ZMOW2YZ4.js +18 -0
- package/dist/chunk-ZMU4EYXT.js +1 -0
- package/dist/{chunk-ACA2BGAD.js → chunk-ZNEPRGFY.js} +1 -1
- package/dist/chunk-ZXZWMXXK.js +7 -0
- package/dist/cli/commands/app/build.js +1 -1
- package/dist/cli/commands/app/bulk/cancel.js +1 -1
- package/dist/cli/commands/app/bulk/execute.js +1 -1
- package/dist/cli/commands/app/bulk/status.js +1 -1
- package/dist/cli/commands/app/config/link.js +1 -1
- package/dist/cli/commands/app/config/pull.js +1 -1
- package/dist/cli/commands/app/config/use.js +1 -1
- package/dist/cli/commands/app/config/validate.js +1 -1
- package/dist/cli/commands/app/demo/watcher.js +1 -1
- package/dist/cli/commands/app/deploy.js +1 -1
- package/dist/cli/commands/app/dev/clean.js +1 -1
- package/dist/cli/commands/app/dev.js +1 -1
- package/dist/cli/commands/app/env/pull.js +1 -1
- package/dist/cli/commands/app/env/show.js +1 -1
- package/dist/cli/commands/app/execute.js +1 -1
- package/dist/cli/commands/app/function/build.js +1 -1
- package/dist/cli/commands/app/function/info.js +1 -1
- package/dist/cli/commands/app/function/replay.js +1 -1
- package/dist/cli/commands/app/function/run.js +1 -1
- package/dist/cli/commands/app/function/schema.js +1 -1
- package/dist/cli/commands/app/function/typegen.js +1 -1
- package/dist/cli/commands/app/generate/extension.js +1 -1
- package/dist/cli/commands/app/graphiql.js +1 -1
- package/dist/cli/commands/app/import/channel-config.js +1 -1
- package/dist/cli/commands/app/import/custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import/dashboard-extensions.js +1 -1
- package/dist/cli/commands/app/import-custom-data-definitions.js +1 -1
- package/dist/cli/commands/app/import-extensions.js +1 -1
- package/dist/cli/commands/app/info.js +1 -1
- package/dist/cli/commands/app/init.js +1 -1
- package/dist/cli/commands/app/logs-next.js +1 -0
- package/dist/cli/commands/app/logs.js +1 -1
- package/dist/cli/commands/app/release.js +1 -1
- package/dist/cli/commands/app/security/check.js +1 -1
- package/dist/cli/commands/app/security/clean.js +1 -1
- package/dist/cli/commands/app/security/instructions.js +1 -1
- package/dist/cli/commands/app/security/record.js +1 -1
- package/dist/cli/commands/app/security/review.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/cancel.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/list.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/schedule.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/status.js +1 -1
- package/dist/cli/commands/app/subscription-migrations/unschedule.js +1 -1
- package/dist/cli/commands/app/versions/list.js +1 -1
- package/dist/cli/commands/app/webhook/trigger.js +1 -1
- package/dist/cli/commands/auth/login.d.ts +10 -10
- package/dist/cli/commands/auth/login.js +1 -1
- package/dist/cli/commands/auth/logout.d.ts +7 -7
- package/dist/cli/commands/auth/logout.js +1 -1
- package/dist/cli/commands/cache/clear.js +1 -1
- package/dist/cli/commands/config/autoupgrade/off.d.ts +7 -7
- package/dist/cli/commands/config/autoupgrade/off.js +1 -1
- package/dist/cli/commands/config/autoupgrade/on.d.ts +7 -7
- package/dist/cli/commands/config/autoupgrade/on.js +1 -1
- package/dist/cli/commands/config/autoupgrade/status.d.ts +7 -7
- package/dist/cli/commands/config/autoupgrade/status.js +1 -1
- package/dist/cli/commands/debug/command-flags.js +1 -1
- package/dist/cli/commands/doc/fetch.d.ts +21 -21
- package/dist/cli/commands/doc/fetch.js +1 -1
- package/dist/cli/commands/doc/search.d.ts +23 -23
- package/dist/cli/commands/doc/search.js +1 -1
- package/dist/cli/commands/docs/generate.js +1 -1
- package/dist/cli/commands/doctor-release/doctor-release.js +1 -1
- package/dist/cli/commands/doctor-release/theme/index.js +1 -1
- package/dist/cli/commands/help.d.ts +90 -90
- package/dist/cli/commands/help.js +1 -1
- package/dist/cli/commands/kitchen-sink/async.js +1 -1
- package/dist/cli/commands/kitchen-sink/index.js +1 -1
- package/dist/cli/commands/kitchen-sink/prompts.js +1 -1
- package/dist/cli/commands/kitchen-sink/static.js +1 -1
- package/dist/cli/commands/notifications/generate.js +1 -1
- package/dist/cli/commands/notifications/list.js +1 -1
- package/dist/cli/commands/organization/list.js +1 -1
- package/dist/cli/commands/search.d.ts +7 -7
- package/dist/cli/commands/search.js +1 -1
- package/dist/cli/commands/send-analytics.js +1 -1
- package/dist/cli/commands/theme/check.js +1 -1
- package/dist/cli/commands/theme/console.js +1 -1
- package/dist/cli/commands/theme/delete.js +1 -1
- package/dist/cli/commands/theme/dev.js +1 -1
- package/dist/cli/commands/theme/duplicate.js +1 -1
- package/dist/cli/commands/theme/info.js +1 -1
- package/dist/cli/commands/theme/init.js +1 -1
- package/dist/cli/commands/theme/language-server.js +1 -1
- package/dist/cli/commands/theme/list.js +1 -1
- package/dist/cli/commands/theme/metafields/pull.js +1 -1
- package/dist/cli/commands/theme/open.js +1 -1
- package/dist/cli/commands/theme/package.js +1 -1
- package/dist/cli/commands/theme/preview.js +1 -1
- package/dist/cli/commands/theme/profile.js +1 -1
- package/dist/cli/commands/theme/publish.js +1 -1
- package/dist/cli/commands/theme/pull.js +1 -1
- package/dist/cli/commands/theme/push.js +1 -1
- package/dist/cli/commands/theme/rename.js +1 -1
- package/dist/cli/commands/theme/share.js +1 -1
- package/dist/cli/commands/upgrade.d.ts +24 -24
- package/dist/cli/commands/upgrade.js +1 -1
- package/dist/cli/commands/version.d.ts +7 -7
- package/dist/cli/commands/version.js +1 -1
- package/dist/cli/help.js +1 -1
- package/dist/cli-version-check-V25AVSZ6.js +1 -0
- package/dist/{command-event-context-LFUZ7UCA.js → command-event-context-ILIANB5Q.js} +1 -1
- package/dist/command-json-schema-C5UZXP2W.js +1 -0
- package/dist/command-registry.js +1 -1
- package/dist/conf-store-OCGEEV4U.js +1 -0
- package/dist/custom-oclif-loader-ZVUKMRGH.js +1 -0
- package/dist/data/filters.json +41 -2
- package/dist/data/local_block_entry.json +1 -1
- package/dist/data/manifest_theme.json +1 -0
- package/dist/data/objects.json +78 -36
- package/dist/data/section.json +1 -1
- package/dist/data/shopify_system_translations.json +240 -23
- package/dist/data/strict_settings.json +24 -0
- package/dist/data/tags.json +57 -24
- package/dist/data/theme_block.json +1 -1
- package/dist/deprecations-A5AXXKIK.js +1 -0
- package/dist/dist-NORLLIHQ.js +1 -0
- package/dist/dist-XBM4XZS4.js +1 -0
- package/dist/environment-5P7JJ3GI.js +1 -0
- package/dist/environments-Y5JEI3U3.js +1 -0
- package/dist/error-GI4DXVDU.js +1 -0
- package/dist/error-handler-BS2ZENQV.js +1 -0
- package/dist/fs-UOOLPOHJ.js +1 -0
- package/dist/hooks/did-you-mean.js +1 -1
- package/dist/hooks/hydrogen-init.js +1 -1
- package/dist/hooks/plugin-plugins.js +1 -1
- package/dist/hooks/postrun.js +1 -1
- package/dist/hooks/prerun.js +2 -2
- package/dist/hooks/public-metadata.js +1 -1
- package/dist/hooks/sensitive-metadata.js +1 -1
- package/dist/hooks/tunnel-provider.js +1 -1
- package/dist/hooks/tunnel-start.js +1 -1
- package/dist/http-2OXOS2AW.js +1 -0
- package/dist/http-proxy-node16-NZZ674YW.js +38 -0
- package/dist/index.js +12 -12
- package/dist/is-global-CI77T7NE.js +1 -0
- package/dist/json-error-6PBUR4LQ.js +1 -0
- package/dist/latest-version-75YEFEMK.js +9 -0
- package/dist/lib-4JVADMNT.js +1 -0
- package/dist/lib-L4STV5B2.js +1 -0
- package/dist/lib-LEEN55OD.js +1 -0
- package/dist/{local-OKPVB4NH.js → local-5NIWPWDS.js} +1 -1
- package/dist/metadata-IXPNNPNJ.js +1 -0
- package/dist/{morph-CRY35DIK.js → morph-H7XQP55V.js} +3 -3
- package/dist/node-package-manager-ALFEGGD6.js +1 -0
- package/dist/notifications-system-FQW3GKH2.js +1 -0
- package/dist/{npa-A4YSCQ5Q.js → npa-LVYMN7GE.js} +1 -1
- package/dist/os-6TNQTEUN.js +1 -0
- package/dist/output-LEOB5LAM.js +1 -0
- package/dist/{prettier-EGVCP5CY.js → prettier-VLTY4MIE.js} +1 -1
- package/dist/registry-auth-token-EDH77OOW.js +1 -0
- package/dist/registry-url-JMNV3LLX.js +1 -0
- package/dist/semver-HHZRKD6Y.js +1 -0
- package/dist/system-J4CTESP5.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ui-YDUI56E3.js +1 -0
- package/dist/upgrade-LBCZORG2.js +1 -0
- package/dist/version-2YL4YEQ2.js +1 -0
- package/dist/version-X2CPQVWQ.js +1 -0
- package/dist/workerd-5UPTEWNI.js +18 -0
- package/oclif.manifest.json +25622 -1132
- package/package.json +7 -7
- package/dist/analytics-NMMVOF4B.js +0 -1
- package/dist/analytics-UK77WNLG.js +0 -1
- package/dist/chunk-224UPIYS.js +0 -4
- package/dist/chunk-27NXPOAS.js +0 -1
- package/dist/chunk-2MT3LSMZ.js +0 -1
- package/dist/chunk-2T4HDR6R.js +0 -70
- package/dist/chunk-2ZBXHCQZ.js +0 -1
- package/dist/chunk-335BUVBP.js +0 -1
- package/dist/chunk-33ZE3DRQ.js +0 -16
- package/dist/chunk-34MOWGRL.js +0 -1
- package/dist/chunk-3JSKNXL7.js +0 -1
- package/dist/chunk-3MG4MTWQ.js +0 -1
- package/dist/chunk-4WYKPIN3.js +0 -1
- package/dist/chunk-5AEZJZNQ.js +0 -1
- package/dist/chunk-5ED7SOQZ.js +0 -20
- package/dist/chunk-5IDJALJH.js +0 -1
- package/dist/chunk-66TMIQMB.js +0 -1
- package/dist/chunk-74NRFUGQ.js +0 -1
- package/dist/chunk-7GUMJ5E4.js +0 -1
- package/dist/chunk-7NFTSBHQ.js +0 -10
- package/dist/chunk-ACZNWIRY.js +0 -1
- package/dist/chunk-AUE7LM32.js +0 -1
- package/dist/chunk-AXL2VIWA.js +0 -16
- package/dist/chunk-B3ZJGYZY.js +0 -3
- package/dist/chunk-BOAGJ6P5.js +0 -1
- package/dist/chunk-BWN2QG6D.js +0 -5
- package/dist/chunk-CCUQM4FX.js +0 -6
- package/dist/chunk-CLUUA3HX.js +0 -3
- package/dist/chunk-CYEEGTVZ.js +0 -11
- package/dist/chunk-DBDTE3EE.js +0 -5
- package/dist/chunk-DLVB3237.js +0 -31
- package/dist/chunk-DN6X7SHW.js +0 -2
- package/dist/chunk-E5COIKGY.js +0 -5
- package/dist/chunk-E6RONHMT.js +0 -1
- package/dist/chunk-EAZIQI2D.js +0 -1
- package/dist/chunk-EEY4FKAW.js +0 -1
- package/dist/chunk-EKFPTBXC.js +0 -1
- package/dist/chunk-FEBOZ2XX.js +0 -31
- package/dist/chunk-FFSDGRAN.js +0 -1
- package/dist/chunk-FZCGRIOM.js +0 -1
- package/dist/chunk-GNCVDN7U.js +0 -1
- package/dist/chunk-GQLNG537.js +0 -836
- package/dist/chunk-GVI3DWSB.js +0 -4
- package/dist/chunk-H6GYBLVQ.js +0 -2
- package/dist/chunk-HB3MJYBK.js +0 -1
- package/dist/chunk-HSKDFEXW.js +0 -1
- package/dist/chunk-HTRJU4R4.js +0 -1
- package/dist/chunk-HXZAY5OA.js +0 -1
- package/dist/chunk-I7PEEJVH.js +0 -1
- package/dist/chunk-IHMATNOR.js +0 -1
- package/dist/chunk-IJY3RJPJ.js +0 -47
- package/dist/chunk-J3JPJCWP.js +0 -1
- package/dist/chunk-J55GQLP4.js +0 -1
- package/dist/chunk-JLQRDFR5.js +0 -18
- package/dist/chunk-JPWRZ5SL.js +0 -16
- package/dist/chunk-K7ZSPQKL.js +0 -4
- package/dist/chunk-L5TSPCSY.js +0 -26
- package/dist/chunk-LUGMXSRI.js +0 -9
- package/dist/chunk-M2CWCOFU.js +0 -11
- package/dist/chunk-M5VIFG2V.js +0 -1
- package/dist/chunk-MADINS4Z.js +0 -1
- package/dist/chunk-MGHPF7HU.js +0 -6
- package/dist/chunk-MHR5OHT5.js +0 -10
- package/dist/chunk-MXEXP3HT.js +0 -15
- package/dist/chunk-OJULL7HT.js +0 -1
- package/dist/chunk-OMPQ7REW.js +0 -3
- package/dist/chunk-OR4IJ4BQ.js +0 -1
- package/dist/chunk-P2RMFHQP.js +0 -1
- package/dist/chunk-P4VZYOKO.js +0 -15
- package/dist/chunk-PDZBKVWL.js +0 -97
- package/dist/chunk-Q2KWXZQB.js +0 -12
- package/dist/chunk-QFSENE5T.js +0 -3
- package/dist/chunk-QFWWCZOI.js +0 -1
- package/dist/chunk-QFYLJVJW.js +0 -77
- package/dist/chunk-QQJNQNKP.js +0 -6
- package/dist/chunk-R4UVIYZP.js +0 -4
- package/dist/chunk-RLNIOJH3.js +0 -272
- package/dist/chunk-RW6G4ZPU.js +0 -1
- package/dist/chunk-S4LOWCGS.js +0 -1
- package/dist/chunk-SB27UOXX.js +0 -1
- package/dist/chunk-SHD4VV5V.js +0 -3
- package/dist/chunk-SK7EPN6C.js +0 -1
- package/dist/chunk-TAWCKJKP.js +0 -1
- package/dist/chunk-U2T5HPRD.js +0 -319
- package/dist/chunk-U6YOP562.js +0 -1
- package/dist/chunk-UPPO3BMT.js +0 -7
- package/dist/chunk-USXIXANP.js +0 -103
- package/dist/chunk-UV5GAGAD.js +0 -1
- package/dist/chunk-UY6W2EVZ.js +0 -1
- package/dist/chunk-UYELAINQ.js +0 -16
- package/dist/chunk-V75WUEFU.js +0 -1
- package/dist/chunk-VAVXDIUX.js +0 -6
- package/dist/chunk-VEUKT5EI.js +0 -6
- package/dist/chunk-VGSH52JM.js +0 -1
- package/dist/chunk-VHZ6RL67.js +0 -1
- package/dist/chunk-VQA3X7O3.js +0 -1
- package/dist/chunk-VZCMJRYV.js +0 -1
- package/dist/chunk-W56ZGEQQ.js +0 -2265
- package/dist/chunk-WSDKCQH6.js +0 -6
- package/dist/chunk-X2PFXSU4.js +0 -1
- package/dist/chunk-X5NIAZA4.js +0 -1
- package/dist/chunk-XBMD3FEZ.js +0 -3
- package/dist/chunk-XDVPIGXE.js +0 -2
- package/dist/chunk-XLIJYJ6Q.js +0 -1
- package/dist/chunk-XUHGWIWW.js +0 -4
- package/dist/chunk-Y55T4IIQ.js +0 -7
- package/dist/chunk-Y5CVX5LJ.js +0 -1
- package/dist/chunk-Y6J46XYF.js +0 -3
- package/dist/chunk-YKMINHYY.js +0 -3
- package/dist/chunk-ZDQO6CNY.js +0 -1
- package/dist/chunk-ZGASBRSQ.js +0 -5
- package/dist/chunk-ZGBTO46A.js +0 -1
- package/dist/chunk-ZJOX5HW4.js +0 -22
- package/dist/chunk-ZOOT3GBY.js +0 -5
- package/dist/command-json-schema-F5XF7XHL.js +0 -1
- package/dist/conf-store-5CBLWTOC.js +0 -1
- package/dist/custom-oclif-loader-UDVUFKMD.js +0 -1
- package/dist/deprecations-EOHPSTCS.js +0 -1
- package/dist/dist-RNV3GFZ7.js +0 -1
- package/dist/dist-ZFKWJVNB.js +0 -1
- package/dist/environment-O7ECODHU.js +0 -1
- package/dist/environments-4FLRZW4P.js +0 -1
- package/dist/error-JY2ADS6S.js +0 -1
- package/dist/error-handler-4GCXKC6I.js +0 -1
- package/dist/fs-XS5YF34R.js +0 -1
- package/dist/http-proxy-node16-D3JUYA5D.js +0 -38
- package/dist/is-global-27MUENOK.js +0 -1
- package/dist/json-error-S5XFS3UX.js +0 -1
- package/dist/latest-version-LDWU5F7A.js +0 -49
- package/dist/lib-PJHT4MKY.js +0 -1
- package/dist/lib-VKSQ65BQ.js +0 -1
- package/dist/lib-YEZOHXF3.js +0 -1
- package/dist/metadata-2YJBAKR7.js +0 -1
- package/dist/node-package-manager-B3OW3PFQ.js +0 -1
- package/dist/notifications-system-BWTDYBG2.js +0 -1
- package/dist/os-F6QKJCFW.js +0 -1
- package/dist/output-BRIPK7UC.js +0 -1
- package/dist/system-466QKFDI.js +0 -1
- package/dist/ui-VJTNGCS6.js +0 -1
- package/dist/upgrade-VHVJLXKX.js +0 -1
- package/dist/version-FETZRLZO.js +0 -1
- package/dist/version-T4XXTJMB.js +0 -1
- package/dist/workerd-32DMKLMN.js +0 -18
- /package/dist/{chunk-YLQ3LNNY.js → chunk-2S3FHQFS.js} +0 -0
- /package/dist/{chunk-YRHFPXC3.js → chunk-Z2AV4BWZ.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as F,b as c,c as P}from"./chunk-
|
|
1
|
+
import{a as F,b as c,c as P}from"./chunk-YR4J46US.js";import{a as I}from"./chunk-FRWQJAW2.js";import{a as S}from"./chunk-XLMKHTJ5.js";import{a as w}from"./chunk-YY6TFARF.js";import{a as j}from"./chunk-7N7KRZOM.js";import{p as v}from"./chunk-DVFVO6ZE.js";import{e as g}from"./chunk-7HECBXSP.js";import{p as T,v as y}from"./chunk-CZNUBAAG.js";import{b as d,c as b,f as n}from"./chunk-DMOLPSXF.js";import{D as f,y as p}from"./chunk-2KUM2RU4.js";import{zb as a}from"./chunk-ZMOW2YZ4.js";import{b as h}from"./chunk-3PYDIBTX.js";import{b as k}from"./chunk-AE3IQG7S.js";import{e as R,g as r}from"./chunk-VKWPEFWQ.js";r();r();var x=I.extend({changed:h.boolean(),theme:F}),s=g({name:"ThemePublishResult",schema:h.object({status:h.literal("success"),changed:h.boolean(),theme:c}).strict(),definitions:{Theme:c},project(t){let e=x.parse(t);return{status:e.status,changed:e.changed,theme:P(e.theme)}}});r();function O(t,e,m){if(e==="json"){a(s.encode(t.data));return}p({headline:m?`Environment: ${m}`:void 0,body:["The theme",...S(t.originalTheme),t.data.changed?"is now live at":"is already live at",{link:{label:t.previewUrl,url:t.previewUrl}},{char:"."}]})}r();async function M(t,e,m){let o=await j(t,{header:"Select a theme to publish",filter:{development:!1,live:!1,theme:e.theme}}),i=w({...o,role:"live"},t);return o.role==="live"?{data:{status:"success",changed:!1,theme:{...o,shop:t.storeFqdn}},originalTheme:o,previewUrl:i}:!e.force&&!m&&!await f({message:`Do you want to make '${o.name}' the new live theme on ${t.storeFqdn}?`,confirmationMessage:`Yes, make '${o.name}' the new live theme`,cancellationMessage:"No, cancel publish"})?void 0:{data:{status:"success",changed:!0,theme:{...await v(o.id,t),shop:t.storeFqdn}},originalTheme:o,previewUrl:i}}var u=R(k(),1);var l=class extends y{static jsonOutputSchema=s;static summary="Set a remote theme as the live theme.";static descriptionWithMarkdown=`Publishes an unpublished theme from your theme library.
|
|
2
2
|
|
|
3
3
|
If no theme ID is specified, then you're prompted to select the theme that you want to publish from the list of themes in your store.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-WNVOEE6T.js";import{b as e}from"./chunk-XEZPN5TR.js";import{g as i}from"./chunk-VKWPEFWQ.js";i();var t=class extends e{static description="View the UI kit components that display static output";static hidden=!0;async run(){await o()}};export{t as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as o}from"./chunk-3FZ4LE6A.js";import{b as c}from"./chunk-QBRRFFMZ.js";import{a as u}from"./chunk-O472FAYX.js";import{e as h,g as a}from"./chunk-VKWPEFWQ.js";a();var i=h(u(),1),f=1440*60*1e3,n;async function d(){try{let{default:t}=await import("./registry-url-JMNV3LLX.js"),e=new URL(t("@shopify"));return e.username="",e.password="",e.search="",e.hash="",e.pathname.endsWith("/")||(e.pathname+="/"),n=e.href,n}catch(t){throw n=void 0,t}}function s(t,e){return`npm-package-@shopify/cli${e?`@${e}`:""}:registry:${c(t)}`}function y(t,e){let r=s(t);return e?`${r}:range:${e}`:r}function l(t,e=n){if(!e)return;let r=o(s(e,t));if(r&&(0,i.valid)(r.value)&&(!t||(0,i.satisfies)(r.value,t))&&Date.now()-r.timestamp<f)return r.value}export{d as a,s as b,y as c,l as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as p,d as c,e as _,f as q}from"./chunk-6IMTMS2S.js";import{a as T}from"./chunk-4NFX7YCT.js";import{a as F,b as B,c as E,l as w,n as C,o as y,t as D}from"./chunk-Z5QEXS6F.js";import{a as R}from"./chunk-RSZAAN37.js";import{a as x}from"./chunk-ASKBYEO7.js";import{B as m}from"./chunk-YKDRUAY3.js";import{b as S,c as A}from"./chunk-DMOLPSXF.js";import{A as O,x as d,y as f,z as k}from"./chunk-2KUM2RU4.js";import{i as h}from"./chunk-TD6JBHUS.js";import{tb as b,vb as g,zb as I}from"./chunk-ZMOW2YZ4.js";import{b as N}from"./chunk-AE3IQG7S.js";import{e as L,g as i}from"./chunk-VKWPEFWQ.js";i();i();async function j(o){let{storeFqdn:e,operationId:a,remoteApp:t}=o,r=await T(t,e),n=await w({adminSession:r,operationId:a});return{store:e,apiVersion:F,operation:n?.bulkOperation??null,userErrors:n?.userErrors??[]}}i();function G(o,e,a){if(a==="json"){if(o.userErrors.length||!o.operation){let r=new h("Failed to cancel bulk operation.");throw r.details={...c(o),operationGid:e,userErrors:o.userErrors},r}I(p.encode({...c(o),status:"success",operation:_(o.operation)}));return}if(o.userErrors.length){C(o.userErrors,"Failed to cancel bulk operation.");return}let t=o.operation;if(t){let r=y(t),n=t.status==="CANCELING"?[`This may take a few moments. Check the status with:
|
|
2
|
+
`,{command:`shopify app bulk status --id=${E(t.id)}`}]:r.body,s={headline:r.headline,...n&&{body:n},...r.customSections&&{customSections:r.customSections}};switch(r.renderType){case"success":f(s);break;case"warning":k(s);break;case"info":d(s);break}}else O({headline:"Bulk operation not found or could not be canceled.",body:g`ID: ${b.yellow(e)}`.value})}var u=L(N(),1);var l=class o extends R{static summary="Cancel a bulk operation.";static descriptionWithMarkdown="Cancels a running bulk operation by ID.";static jsonOutputSchema=p;static description=this.descriptionForHelp();static flags={...S,...A,...x,id:u.Flags.string({description:"The bulk operation ID to cancel (numeric ID or full GID).",env:"SHOPIFY_FLAG_ID",required:!0}),store:u.Flags.string({char:"s",description:"The store domain. Must be an existing dev store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>m(e)})};async run(){let{flags:e}=await this.parse(o),{appContextResult:a,store:t}=await D(e),r=e.json?"json":"text",n=B(e.id);q("Canceling bulk operation.",{organization:a.organization,remoteApp:a.remoteApp,storeFqdn:t.shopDomain,operationId:n},r);let s=await j({storeFqdn:t.shopDomain,operationId:n,remoteApp:a.remoteApp});return G(s,n,r),{app:a.app}}};export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ab as h,Hb as f,db as E,sb as S}from"./chunk-ZMOW2YZ4.js";import{b as O}from"./chunk-AE3IQG7S.js";import{d as m}from"./chunk-IWTNUJGY.js";import{e as T,g as i}from"./chunk-VKWPEFWQ.js";i();i();i();var C=new Set(["THROTTLED","429"]),I=new Set(["ACCESS_DENIED","access_denied"]),P=new Set(["INTERNAL_SERVER_ERROR"]);function g(e){return Array.isArray(e)?e.flatMap(t=>{let s=[],n=t,r=n?.extensions?.code;typeof r=="string"&&s.push(r);let o=n?.extensions?.app_errors?.errors;if(Array.isArray(o))for(let p of o){let l=p?.category;typeof l=="string"&&s.push(l)}return s}):[]}function b(e){return e!==void 0&&C.has(e)}function D(e){return e!==void 0&&I.has(e)}function v(e){return e!==void 0&&P.has(e)}function x(e){return g(e).some(b)}function U(e){return g(e).some(v)}i();var _=new Set([502,503,504,520,521,522,523,524]);function y(e){return e!==void 0&&_.has(e)}var M=T(O(),1),a;(function(e){e[e.Abort=0]="Abort",e[e.AbortSilent=1]="AbortSilent",e[e.Bug=2]="Bug"})(a||(a={}));var R=class extends Error{},c=class extends Error{tryMessage;type;nextSteps;formattedMessage;customSections;code;details;skipOclifErrorHandling;constructor(t,s,n=null,r,o){let p=typeof t=="string"||"value"in t;super(p?f(t):E(t)),n?n instanceof S?this.tryMessage=f(n):this.tryMessage=n:this.tryMessage=null,this.type=s,this.nextSteps=r,this.customSections=o,this.skipOclifErrorHandling=!0,p||(this.formattedMessage=t)}},d=class extends c{constructor(t,s=null,n,r){super(t,a.Abort,s,n,r)}},w=class extends c{command;args;constructor(t,s,n,r=null){super(t,a.Abort,r),this.command=s,this.args=n}},A=class extends c{constructor(){super("",a.AbortSilent)}},u=class extends c{constructor(t,s=null){super(t,a.Bug,s)}};async function Q(e){let t;if(k(e))t=e;else if(typeof e=="string")t=new u(e);else if(e instanceof Error)t=new u(e.message),t.stack=e.stack;else{let o=e;t=new u(o?.message??"Unknown error"),o?.stack&&(t.stack=o?.stack)}let{jsonOutputEnabled:s}=await import("./environment-5P7JJ3GI.js"),{commandEventOutputMode:n}=await import("./command-event-context-ILIANB5Q.js");if((n()??(s()?"json":"text"))==="json"){let{renderFatalErrorAsJson:o}=await import("./json-error-6PBUR4LQ.js");return o(t),await h(),e}let{renderFatalError:r}=await import("./ui-YDUI56E3.js");return r(t),Promise.resolve(e)}function W(e){if(e instanceof M.Errors.CLIError){let t=new d(e.message);return t.stack=e.stack,Promise.resolve(t)}else return Promise.resolve(e)}function k(e){try{return Object.prototype.hasOwnProperty.call(e,"type")}catch{return!1}}function Z(e){if(!k(e)){if(e instanceof Error){if(L(e))return!1;let t=e.message;return!N(t)}return!0}return e.type===a.Bug}function L(e){let t=e;if(typeof t.response!="object"||t.response===null||t.request===void 0)return!1;let s=t.response.status;return s===401||s===429||y(s)?!0:x(t.response.errors)}function K(e){return m(e).replace("file:/","/").replace(/^\/?[A-Z]:/,"")}function N(e){return["EPERM: operation not permitted, scandir","EPERM: operation not permitted, rename","EACCES: permission denied","EPERM: operation not permitted, symlink","This version of npm supports the following node versions","EBUSY: resource busy or locked","ENOTEMPTY: directory not empty","getaddrinfo ENOTFOUND","Client network socket disconnected before secure TLS connection was established","spawn EPERM","socket hang up","The user aborted a request.","write EPIPE","Unsupported platform"].some(n=>e.includes(n))}export{g as a,b,D as c,U as d,y as e,a as f,R as g,c as h,d as i,w as j,A as k,u as l,Q as m,W as n,Z as o,K as p};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import{a as Gt}from"./chunk-UOHNRH6E.js";import{a as Or}from"./chunk-SURFUFAZ.js";import{b as qr}from"./chunk-3PS52ZT4.js";import{a as Hr}from"./chunk-WBPP6PO7.js";import{a as Gr}from"./chunk-QCLE5REL.js";import{a as jr}from"./chunk-OXPEBT4I.js";import{a as _r}from"./chunk-DTKGI43P.js";import{a as Ir}from"./chunk-ONZULPQH.js";import{a as Cr,b as kr,c as Lr,d as $r}from"./chunk-OWQEFORZ.js";import{a as Nr}from"./chunk-6I7DT7QR.js";import{a as Mr}from"./chunk-3MZ7ELHS.js";import{a as Dr}from"./chunk-JC37YZ4I.js";import{a as Wr}from"./chunk-VE3IIC7H.js";import{a as Fr}from"./chunk-HSTZV6H7.js";import{a as wr}from"./chunk-OVJVFB5E.js";import{a as xr}from"./chunk-HGZ2HRPO.js";import{a as Er}from"./chunk-DVD7I2TX.js";import{a as ct,b as Sr,c as Ur}from"./chunk-JMSAHCBU.js";import{g as br}from"./chunk-YTL45RXR.js";import{a as at}from"./chunk-YNZLLZU2.js";import{d as st,p as it}from"./chunk-WPDJVUTY.js";import{a as Rr}from"./chunk-JVY6CCLE.js";import{a as Ar}from"./chunk-PJZZZNWR.js";import{a as Pr}from"./chunk-6BYHL3DS.js";import{b as yr,g as Le,j as nt,u as vr}from"./chunk-DVFVO6ZE.js";import{a as Uo,b as Ro,c as Ao,d as To}from"./chunk-JNSVKDBY.js";import{d as Tr}from"./chunk-FAVPTYIR.js";import{a as hr,b as gr,c as Eo,d as bo,e as ut,f as So,g as _o}from"./chunk-7NRHZG5Y.js";import{a as M,b as ot}from"./chunk-BPKQA2EO.js";import{a as lr,b as pr,e as Ce,g as ur,n as ke,o as V,t as H,v as dr,w as mr,x as fr}from"./chunk-FDSNRKGQ.js";import{a as cr}from"./chunk-EDWIWZWM.js";import{a as Io,b as Co,c as ko,d as dt,e as Lo,f as $o,g as Mo,h as Do,i as Fo,j as Oo,k as No,l as Wo,m as qo,n as Ho,o as Go,p as mt}from"./chunk-TXP6KFWO.js";import{a as ho,b as pt,d as ne,e as go}from"./chunk-Z5WFRYVQ.js";import{a as wo,b as yo,c as vo,d as Po,e as xo}from"./chunk-MGX7UG44.js";import{a as Kr}from"./chunk-RLOEI6VE.js";import{a as fo}from"./chunk-LXIWMYM4.js";import{a as mo}from"./chunk-RSZAAN37.js";import{a as Br}from"./chunk-ASKBYEO7.js";import{C as Me,D as oe,P as uo,b as lo,l as po}from"./chunk-HMPRWNGG.js";import{c as ao,d as $e,e as io,r as co}from"./chunk-JGLLABZR.js";import{A as Zr,B as eo,C as to,D as ro,Q as oo,V as no,Y as re,ga as so,j as Yr,k as G,l as zr,q as Qr,x as lt,y as Jr,z as Xr}from"./chunk-YYWSHRO2.js";import{I as Vr,t as te,y as pe}from"./chunk-OJOF6IYG.js";import{d as sr}from"./chunk-27JT4NA4.js";import{a as Q}from"./chunk-HVUMVDUG.js";import{B as be,Ca as qt,T as Nt,W as K,d as $t,fa as Z,ha as Wt,j as Mt,p as Dt,t as Ft,v as Ot,w as Ee}from"./chunk-YKDRUAY3.js";import{b as ar,c as ir,e as Ie}from"./chunk-DMOLPSXF.js";import{G as Ae,K as Zt,M as Te,R as _e,S as le,T as rt,U as tr,W as rr,a as Lt,d as Ze,e as L,f as F,h as Se,i as Ue,j as jt,k as Bt,l as Kt,m as Vt,n as Yt,o as zt,p as et,q as tt,r as Qt,s as Jt,u as Xt,x as Re,z as ce}from"./chunk-2KUM2RU4.js";import{a as Yn}from"./chunk-7UNQOKZW.js";import{e as xe,h as kt}from"./chunk-2KFYIYLI.js";import{b as Je,d as Ct}from"./chunk-QBRRFFMZ.js";import{a as St}from"./chunk-LG3KEHGD.js";import{d as Ht}from"./chunk-I3WRA2LH.js";import{i as _,k as er,l as ee}from"./chunk-TD6JBHUS.js";import{a as De}from"./chunk-WFPVT2IY.js";import{Bb as z,Da as Tt,Eb as y,Fb as T,Ma as ve,P as Qe,Sa as O,Va as Pe,_a as _t,bb as It,gb as D,la as $,ta as we,tb as b,va as ye,vb as U}from"./chunk-ZMOW2YZ4.js";import{b as h,d as Ye,k as Xe}from"./chunk-3PYDIBTX.js";import{e as or,g as nr}from"./chunk-DOLVBTCB.js";import{b as Vn}from"./chunk-AE3IQG7S.js";import{a as me}from"./chunk-JD5P5RAJ.js";import{c as A,e as ze,f as Ut,h as fe,i as he,j as ge,n as Rt,o as At}from"./chunk-IWTNUJGY.js";import{e as ie,g as p}from"./chunk-VKWPEFWQ.js";p();p();p();p();p();p();var zn=300*1e3,Qn='The host theme could not be created to host your theme app extension. Please try again or use the "--theme" flag to use an existing theme as the host theme.';async function jo(t,e,r=Date.now()){for(;await Jn(t,e,r););}async function Jn(t,e,r){let o=await Le(t,e);if(!o||Xn(o,r))throw new _(Qn);return await le(3),o.processing}function Xn(t,e){return t.processing&&Date.now()-e>=zn}var Zn="https://codeload.github.com/Shopify/dawn/zip/refs/tags/v15.0.0",es="https://cdn.shopify.com/theme-store/uhrdefhlndzaoyrgylhto59sx2i7.jpg",ft=3,Fe=class extends Pr{context="App Ext. Host";devPreview;constructor(e,r={devPreview:!1}){super(e),this.themeId=Cr(e.storeFqdn),this.devPreview=r.devPreview}async findOrCreate(){let e=await this.fetch();return e??=this.devPreview?await this.createHostTheme():await this.create(),e}setTheme(e){kr(this.adminSession.storeFqdn,e)}removeTheme(){Lr(this.adminSession.storeFqdn)}async createHostTheme(){let e={role:yr,name:this.generateThemeName(this.context),src:Zn};for(let o=0;o<ft;o++){y(`Attempt ${o}/${ft}: Creating theme with name "${e.name}" and role "${e.role}"`);try{let n=await nt(e,this.adminSession);if(n)return this.setTheme(n.id.toString()),y(`Waiting for theme with id "${n.id}" to be processed`),await jo(n.id,this.adminSession),n;throw new Error}catch(n){if(n instanceof er||vr(n))throw n;y(`Failed to create theme with name "${e.name}" and role "${e.role}". Retrying...`)}}y(`Theme creation failed after ${ft} retries. Creating theme using fallback theme zip`);let r=await nt({...e,src:es},this.adminSession);if(!r)throw y("Theme creation failed. Exiting process."),new ee(`Could not create theme with name "${e.name}" and role "${e.role}"`);return r}};p();var ts={"theme:init":_r,"theme:check":wr,"theme:console":xr,"theme:delete":Er,"theme:dev":Ur,"theme:duplicate":Rr,"theme:info":Ar,"theme:language-server":Ir,"theme:list":$r,"theme:metafields:pull":Nr,"theme:open":Mr,"theme:package":Dr,"theme:profile":Fr,"theme:publish":Or,"theme:preview":Wr,"theme:pull":qr,"theme:push":Hr,"theme:rename":Gr,"theme:share":jr},ei=ts;async function Bo(t){let{remoteApp:e,localApp:r}=t,n=r.allExtensions.filter(S=>S.isThemeExtension);if(n.length===0)return;if(K()){T("The theme app extension preview isn't available with SHOPIFY_SERVICE_ACCOUNT_TOKEN. Dev runs without it.");return}let a=n[0].directory,i=t.themeExtensionPort??9293,[l,m]=await Promise.all([Nt(t.storeFqdn),ns(e)]),c=l.storeFqdn,[u,g]=await Promise.all([it(l),st(l)]),w=g?await at(t.storePassword,c,u):void 0,d=await os(l,t.theme),f=d.id.toString();return Re({headline:"The theme app extension development server is ready.",orderedNextSteps:!0,nextSteps:[[{link:{label:"Install your app in your development store",url:m}}],[{link:{label:"Setup your theme app extension in the host theme",url:`https://${c}/admin/themes/${f}/editor`}}],["Preview your theme app extension at",{link:{label:`http://127.0.0.1:${i}`,url:`http://127.0.0.1:${i}`}}]]}),{type:"theme-app-extensions",prefix:"theme-extensions",function:rs,options:{theme:d,adminSession:l,storefrontPassword:w,crawlerSignatureHeaders:u,themeExtensionDirectory:a,themeExtensionPort:i}}}var rs=async(t,{theme:e,adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})=>{await(await br(e,{adminSession:r,storefrontPassword:o,crawlerSignatureHeaders:n,themeExtensionDirectory:s,themeExtensionPort:a})).start()};async function os(t,e){let r;if(e)y(`Fetching theme with provided id ${e}`),r=await Le(parseInt(e,10),t);else{let o=new Fe(t,{devPreview:!0});await Ae([{title:"Configuring host theme for theme app extension",task:async()=>{y("Finding or creating host theme for theme app extensions"),r=await o.findOrCreate()}}])}if(!r)throw new _("Could not find or create a host theme for theme app extensions");return r}async function ns(t){return t.developerPlatformClient?.clientName===co.AppManagement?`https://${await Ee()}/?organization_id=${t.organizationId}&no_redirect=true&redirect=/oauth/redirect_from_developer_dashboard?client_id%3D${t.apiKey}`:`https://${await Ot()}/${t.organizationId}/apps/${t.id}/test`}p();p();p();p();p();p();async function ss(t){let e=A(t.directory,"locales");return Pe([A(e,"*.json")])}async function Ko(t,e){let r=await ss(t);if(!r.length)return{localization:void 0,status:""};let o=e.currentLocalizationPayload??{defaultLocale:"en",translations:{},lastUpdated:0},n="success";try{await Promise.all(r.map(async s=>{let[a,...i]=s.split("/").pop().split(".");if(a)return i[0]==="default"&&(o.defaultLocale=a),as(a,s,o,t,e)})),o.lastUpdated=Date.now(),y(`Parsed locales for extension ${t.handle} at ${t.directory}`,e.stdout)}catch{n="error"}return{localization:o,status:n}}async function as(t,e,r,o,n){let s;try{s=await $(e),r.translations[t]=JSON.parse(s)}catch(a){let i=`Error parsing ${t} locale for ${o.handle} at ${e}: ${a.message}`;throw T(i,n.stderr),new Error(i)}}p();function Oe(t,e){switch(t){case"checkout_ui_extension":return{url:e.checkoutCartUrl};case"checkout_post_purchase":return{url:e.checkoutCartUrl};case"product_subscription":return{url:e.subscriptionProductUrl??""};default:return{url:""}}}var ht=".js.map";async function se(t,e,r,o){return D({outputPrefix:t.outputPrefix},async()=>{o?.clear();let n=t.getOutputPathForDirectory(e),s=`${r.url}/extensions/${t.devUUID}`,{localization:a,status:i}=await Ko(t,r),l=await zr(t),m=t.outputRelativePath?fe(n):n,c=await is(t,s,m,o),u=null;return"metafields"in t.configuration&&Array.isArray(t.configuration.metafields)&&t.configuration.metafields.length>0&&(u=Vo(t.configuration.metafields)),{assets:{main:ue(c)&&c[0]?.assets?.main?c[0].assets.main:{name:"main",url:`${s}/assets/${t.outputFileName}`,lastUpdated:await ve(n)??0}},supportedFeatures:{runsOffline:t.configuration.supported_features?.runs_offline??!1},capabilities:{blockProgress:t.configuration.capabilities?.block_progress??!1,networkAccess:t.configuration.capabilities?.network_access??!1,apiAccess:t.configuration.capabilities?.api_access??!1,collectBuyerConsent:{smsMarketing:t.configuration.capabilities?.collect_buyer_consent?.sms_marketing??!1,customerPrivacy:t.configuration.capabilities?.collect_buyer_consent?.customer_privacy??!1},iframe:{sources:t.configuration.capabilities?.iframe?.sources??[]}},development:{...r.currentDevelopmentPayload,resource:Oe(t.type,r),root:{url:s},hidden:r.currentDevelopmentPayload?.hidden??!1,localizationStatus:i,status:r.currentDevelopmentPayload?.status??"success",...r.currentDevelopmentPayload??{status:"success"}},extensionPoints:c,localization:a??null,metafields:u,type:t.type,externalType:t.externalType,uuid:t.devUUID,surface:t.surface,version:l?.version,title:t.name,handle:t.handle,name:t.name,description:t.configuration.description,apiVersion:t.configuration.api_version,approvalScopes:r.grantedScopes,settings:t.configuration.settings}})}async function is(t,e,r,o){let n=t.configuration,s=n.extension_points??n.targeting;if(t.type==="checkout_post_purchase"&&(s=[{target:"purchase.post.render"}]),ue(s)){let a=await cs(r);return Promise.all(s.map(async i=>{let{target:l,resource:m}=i,c="metafields"in i?Vo(i.metafields??[]):void 0,u={...i,...c?{metafields:c}:{},surface:oe(l),root:{url:`${e}/${l}`},resource:m||{url:""}},g=a?.[l];if(!g)return u;let d=await fs(g,{target:l,extensionPoint:i,url:e,extension:t,buildDirectory:r,resolver:o});return{...u,...d}}))}return s}async function cs(t){try{let e=A(t,"manifest.json"),r=await $(e);return JSON.parse(r)}catch(e){if(e instanceof SyntaxError)throw new Error(`Invalid manifest.json in ${t}: ${e.message}`);return null}}async function ls({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s,a){let i=`${t}/${s}`,l=e[s];if(typeof l=="string"){let w=await Ne(s,i,typeof a=="string"?a:l,r,o,n,typeof a=="string"?l:void 0);return{assets:{[w.name]:w}}}let c=e.build_manifest?.assets?.[s];if(c?.filepath){let u=await Ne(s,i,c.filepath,r,o,n,c.module);return{assets:{[u.name]:u}}}return{}}async function ps({target:t,url:e,buildDirectory:r,resolver:o},n,s){if(s.length===0)return{};for(let i of s)o?.set(`${t}/${i}`,i);let a=await Promise.all(s.map(async i=>await ve(A(r,i))??0));return{assets:{[n]:{name:n,url:`${e}/assets/${t}/`,lastUpdated:Math.max(...a)}}}}async function us({target:t,extensionPoint:e,url:r,extension:o,resolver:n},s){return e.intents?{intents:await Promise.all(e.intents.map(async(i,l)=>{let m=i.schema,c=s[l]?.schema,u=typeof c=="string"?c:m,g=typeof c=="string"?m:void 0;return{...i,schema:await Ne("schema",`${t}/intents/${l}/schema`,u,r,o,n,g)}}))}:{}}async function ds({target:t,url:e,extension:r,resolver:o},n,s){let a=await Ne(n,`${t}/${n}`,s,e,r,o);return await ms(t,s,r,o),{assets:{[a.name]:a}}}async function ms(t,e,r,o){if(!o)return;let n=`${e}.map`;n.endsWith(ht)&&await O(A(r.directory,n))&&o.set(`${t}/${he(n)}`,n)}async function fs(t,e){return(await Promise.all(Object.keys(t).map(async o=>{let n=t[o];return hs(o,n)?us(e,n):gs(o,n)?ds(e,o,n):ws(o,n)?ps(e,o,n):ls(e,o,n)}))).reduce((o,n)=>({...o,...n,assets:{...o.assets,...n.assets}}),{})}function Vo(t){return t.map(e=>({namespace:e.namespace,key:e.key,...e.owner_type===void 0?{}:{ownerType:e.owner_type.replaceAll("_","")}}))}function ue(t){return Array.isArray(t)&&t.every(e=>typeof e=="object")}async function Ne(t,e,r,o,n,s,a){let i=`${e}${ge(r)}`;return s?.set(i,r),{name:t,url:`${o}/assets/${i}`,lastUpdated:await ve(A(n.directory,a??r))??0}}function hs(t,e){return t==="intents"&&Array.isArray(e)}function gs(t,e){return(t==="main"||t==="should_render")&&typeof e=="string"}function ws(t,e){return t==="assets"&&Array.isArray(e)&&e.every(r=>typeof r=="string")}import{EventEmitter as ys}from"events";var de;(function(t){t.Update="PayloadUpdatedEvent:UPDATE"})(de||(de={}));async function Yo(t,e,r){return{app:{title:t.appName,apiKey:t.apiKey,url:Eo(t.storeFqdn,t.apiKey),mobileUrl:So(t.storeFqdn,t.apiKey)},appId:t.id,version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:t.websocketURL},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extensions:await Promise.all(t.extensions.filter(n=>n.isPreviewable).map(n=>se(n,e,t,r&>(r,n.devUUID))))}}function gt(t,e){let r=t.get(e);return r||(r=new Map,t.set(e,r)),r}var We=class extends ys{options;rawPayload;assetResolvers;constructor(e,r,o=new Map){super(),this.rawPayload=e,this.options=r,this.assetResolvers=o}getAssetResolver(e){return this.assetResolvers.get(e)}getConnectedPayload(){let e=this.getRawPayload();return{app:e.app,appId:e.appId,store:e.store,extensions:e.extensions}}getRawPayloadFilteredByExtensionIds(e){return{...this.rawPayload,extensions:this.rawPayload.extensions.filter(r=>e.includes(r.uuid))}}getRawPayload(){return this.rawPayload}updateApp(e){this.rawPayload=Z(this.rawPayload,{app:e}),this.emitUpdate([])}updateExtensions(e){let r=this.rawPayload.extensions.map(o=>{let n=e.find(s=>s.uuid===o.uuid);if(n){if(ue(n.extensionPoints)&&ue(o.extensionPoints)){let s=n.extensionPoints.reduce((l,m)=>({...l,[m.target]:m}),{});o.extensionPoints=Z(o.extensionPoints,n.extensionPoints,l=>l.map(m=>{let c=s[m.target];return c?Z(m,c,(u,g)=>g):m}));let{extensionPoints:a,...i}=n;return Z(o,i)}return Z(o,n)}return o});this.rawPayload={...this.rawPayload,extensions:r},this.emitUpdate(e.map(o=>o.uuid))}async updateExtension(e,r,o,n){let s=this.rawPayload.extensions,a=s.findIndex(i=>i.uuid===e.devUUID);if(a===-1){y(U`Could not updateExtension() for extension with uuid: ${e.devUUID}`,r.stderr);return}s[a]=await se(e,o,{...this.options,currentDevelopmentPayload:n??{status:s[a]?.development.status},currentLocalizationPayload:s[a]?.localization},gt(this.assetResolvers,e.devUUID)),this.rawPayload.extensions=s,this.emitUpdate([e.devUUID])}deleteExtension(e){let r=this.rawPayload.extensions.findIndex(o=>o.uuid===e.devUUID);r!==-1&&(this.rawPayload.extensions.splice(r,1),this.assetResolvers.delete(e.devUUID),this.emitUpdate([e.devUUID]))}async addExtension(e,r){this.rawPayload.extensions.push(await se(e,r,this.options,gt(this.assetResolvers,e.devUUID))),this.emitUpdate([e.devUUID])}emitUpdate(e){this.emit(de.Update,e)}};p();p();var N;(function(t){t.Update="update",t.Dispatch="dispatch",t.Log="log"})(N||(N={}));var vs=h.discriminatedUnion("event",[h.object({event:h.literal(N.Update),data:h.object({app:h.object({apiKey:h.string()}).passthrough().optional(),extensions:h.array(h.object({uuid:h.string(),extensionPoints:h.union([h.array(h.string()),h.array(h.object({target:h.string()})),h.null()]).optional()})).optional()})}),h.object({event:h.literal(N.Dispatch),data:h.object({type:h.enum(["focus","unfocus"]),payload:h.array(h.object({uuid:h.string()})).optional()})}),h.object({event:h.literal(N.Log),data:h.object({type:h.string(),message:h.string(),extensionName:h.string()})})]);function zo(t,e){return(r,o,n)=>{r.url==="/extensions"&&(y("Upgrading HTTP request to a websocket connection",e.stdout),t.handleUpgrade(r,o,n,Ps(t,e)))}}function Ps(t,e){return r=>{y("Websocket connection successfully established",e.stdout);let o={event:"connected",data:e.payloadStore.getConnectedPayload(),version:e.manifestVersion};y(U`Sending connected payload: ${b.json(o)}`,e.stdout),r.send(JSON.stringify(o)),r.on("message",Us(t,e)),r.on("error",n=>{y(`Websocket connection error: ${n.message}`,e.stdout)})}}function xs(t){try{let e=JSON.parse(t);if(!Array.isArray(e))return t;let r=e.map(o=>typeof o=="object"&&o!==null?b.json(o).output():String(o)).join(" ");return U`${r}`.value}catch(e){if(e instanceof SyntaxError)return t;throw e}}var Es={debug:t=>b.gray(t),warn:t=>b.yellow(t),error:t=>b.errorText(t)};function bs({type:t,message:e}){let r=xs(e);switch(t){case"debug":case"warn":case"error":return U`${Es[t](t.toUpperCase())}: ${r}`.value;case"log":case"info":return r;default:return`${t.toUpperCase()}: ${r}`}}function Ss(t,e){D({outputPrefix:t.extensionName,stripAnsi:!1},()=>{e.stdout.write(bs(t))})}function Us(t,e){return r=>{let o;try{o=JSON.parse(r.toString())}catch(a){if(a instanceof SyntaxError){y(`Ignoring websocket message that is not valid JSON: ${a.message}`,e.stdout);return}throw a}if(!vs.safeParse(o).success){y("Ignoring websocket message with an invalid shape",e.stdout);return}let{event:n,data:s}=o;if(y(U`Received websocket message with event type ${n} and data:
|
|
2
|
+
${b.json(s)}
|
|
3
|
+
`,e.stdout),n===N.Update){let a=e.payloadStore.getRawPayload().app.apiKey,i=s.app?.apiKey;if(s.app){if(a!==i)return;e.payloadStore.updateApp(s.app)}s.extensions&&e.payloadStore.updateExtensions(s.extensions)}else if(n===N.Dispatch){let a=Rs(o,e);Jo(t,a,e)}else n===N.Log&&Ss(s,e)}}function Qo(t,e){return r=>{let o={event:N.Update,version:e.manifestVersion,data:{...e.payloadStore.getRawPayloadFilteredByExtensionIds(r)}};y(U`Sending websocket update event to the websocket clients:
|
|
4
|
+
${b.json(o)}
|
|
5
|
+
`,e.stdout),Jo(t,o,e)}}function Jo(t,e,r){y(U`Sending websocket with event type ${e.event} and data:
|
|
6
|
+
${b.json(e.data)}
|
|
7
|
+
`,r.stdout);let o=JSON.stringify(e);t.clients.forEach(n=>n.send(o))}function Rs(t,e){let r=e.payloadStore.getRawPayload();return{...t,version:e.manifestVersion,data:{...t.data,extensions:[],store:r.store,app:r.app}}}var As=10;function Xo(t){let e=new Gt.default({noServer:!0,clientTracking:!0}),r=Ts(e);return t.httpServer.on("upgrade",zo(e,t)),t.payloadStore.on(de.Update,Qo(e,t)),{close:()=>{e.close(),clearInterval(r)}}}function Ts(t){return setInterval(()=>{t.clients.forEach(e=>{e.readyState<2&&e.ping()})},As*1e3)}p();p();p();function Zo(t,e){let{url:r}=Oe(t.type,e);if(t.surface==="checkout"&&r){let o=new URL(`https://${e.storeFqdn}/`);return o.pathname=r,o.searchParams.append("dev",`${e.url}/extensions`),o.toString()}else{let o=new URL(`https://${e.storeFqdn}/`);return o.pathname="admin/extensions-dev",o.searchParams.append("url",qe(t,e)),o.toString()}}function en(t,e,r){let o=oe(t),n=new URL(`https://${r.storeFqdn}/`);switch(o){case"checkout":if(!r.checkoutCartUrl)return;n.pathname=r.checkoutCartUrl,n.searchParams.append("dev",`${r.url}/extensions`);break;case"post_purchase":if(!r.checkoutCartUrl)return;if(n.pathname=r.checkoutCartUrl,n.searchParams.set("script_url",`${r.url}/extensions/${e.devUUID}/assets/${e.localIdentifier}.js`),n.searchParams.set("post_purchase_dev_api_key",r.apiKey),e.devUUID&&r.websocketURL&&(n.searchParams.set("uuid",e.devUUID),n.searchParams.set("socket_url",r.websocketURL)),"metafields"in e.configuration){let s={config:{metafields:e.configuration.metafields}};n.searchParams.set("config",JSON.stringify(s))}break;case"admin":n.pathname="admin/extensions-dev",n.searchParams.append("url",qe(e,r)),n.searchParams.append("target",t);break;case"customer-accounts":if(!r.storeId)return;n=_s(e,r,t);break;default:return}return n.toString()}function _s(t,e,r=""){let o=`${e.url}/extensions`,n=e.storeId,s="shopify.com",a=new URL(`https://${s}/${n}/account/extensions-development`);return a.searchParams.append("origin",o),a.searchParams.append("extensionId",t.devUUID),a.searchParams.append("source","CUSTOMER_ACCOUNT_EXTENSION"),a.searchParams.append("appId",e.id??""),r!==""&&a.searchParams.append("target",r),a}function qe(t,e){let r=new URL(e.url);return r.pathname=`/extensions/${t.devUUID}`,r.toString()}function W(t,e){pr(t,lr(e))}p();var wt=class extends ee{constructor(e){super(`Couldn't find template ${e.template} for extension surface ${e.extensionSurface}`)}};async function tn(t){let e=await Is(t),r=await $(e);return cr(r,t.data)}async function Is(t){let e=await Cs(),r=[];t.extensionSurface&&r.push(A(e,`${t.extensionSurface}/${t.template}.html.liquid`)),r.push(A(e,`${t.template}.html.liquid`));let o=await Pe(r);if(o.length===0)throw new wt(t);return o[0]}async function Cs(){return await _t("templates/ui-extensions/html",{type:"directory",cwd:At(import.meta.url)})}var rn=H(t=>{V(t,"Access-Control-Allow-Origin","*"),V(t,"Access-Control-Allow-Methods","GET, OPTIONS"),V(t,"Access-Control-Allow-Headers","Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, ngrok-skip-browser-warning")}),on=H(t=>{V(t,"Cache-Control","no-cache")}),yt=H(async t=>ke(t,"/extensions",307));async function ks(t,e){let{filePath:r}=e;if(!await O(r))return W(t,{statusCode:404,statusMessage:`Not Found: ${r}`});if(await Tt(r)&&(r+=r.endsWith("/")?"index.html":"/index.html",!await O(r)))return W(t,{statusCode:404,statusMessage:`Not Found: ${r}`});let o=await $(r,{}),n={".ico":"image/x-icon",".html":"text/html",".js":"text/javascript",".json":"application/json",".map":"application/json",".wasm":"application/wasm",".css":"text/css",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".wav":"audio/wav",".mp3":"audio/mpeg",".svg":"image/svg+xml",".pdf":"application/pdf",".doc":"application/msword"},s=ge(r),a=n[s]||"text/plain";return V(t,"Content-Type",a),o}function nn({getExtensions:t,payloadStore:e}){return H(async r=>{let{extensionId:o,assetPath:n=""}=Ce(r),s=t().find(g=>g.devUUID===o);if(!s)return W(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});let i=e.getAssetResolver(s.devUUID)?.get(n),l=i??n,m=l.endsWith(ht);if(m&&i===void 0)return W(r,{statusCode:404,statusMessage:"Not Found"});let c=ze(m?s.directory:Qr(s.outputPath)),u=ze(A(c,l));return Rt(c,u)?ks(r,{filePath:u}):W(r,{statusCode:404,statusMessage:"Not Found"})})}function vt({payloadStore:t}){return H(e=>(V(e,"content-type","application/json"),t.getRawPayload()))}function sn({devOptions:t}){return H(e=>{y(`UI extensions server received a ${e.method} request to URL ${e.path}`,t.stdout)})}function Pt({devOptions:t,getExtensions:e}){return H(async r=>{let{extensionId:o}=Ce(r),n=e().find(i=>i.devUUID===o);if(!n)return W(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(ur(r,"accept")?.startsWith("text/html")){if(n.type==="checkout_post_purchase")return tn({data:{url:qe(n,t)},template:"index",extensionSurface:"post_purchase"});{let i=Zo(n,t);return ke(r,i,307)}}let a=t.appWatcher.buildOutputPath;return V(r,"content-type","application/json"),{app:{apiKey:t.apiKey},version:t.manifestVersion,root:{url:new URL("/extensions",t.url).toString()},socket:{url:ae(t.url)},devConsole:{url:new URL("/extensions/dev-console",t.url).toString()},store:t.storeFqdn,extension:await se(n,a,t)}})}function an({devOptions:t,getExtensions:e}){return H(async r=>{let{extensionId:o,extensionPointTarget:n=""}=Ce(r),s=e().find(i=>i.devUUID===o);if(!s)return W(r,{statusCode:404,statusMessage:`Extension with id ${o} not found`});if(s.configuration.type!=="checkout_post_purchase"&&!s.hasExtensionPointTarget(n))return W(r,{statusCode:404,statusMessage:`Extension with id ${o} has not configured the "${n}" extension target`});let a=en(n,s,t);return a?ke(r,a,307):W(r,{statusCode:404,statusMessage:Ls(o,n,t)})})}function Ls(t,e,r){let o=`extension with id ${t} and extension target "${e}"`,n=oe(e);if((n==="checkout"||n==="post_purchase")&&!r.checkoutCartUrl)return`Can't preview ${o} without a cart. Restart dev with --checkout-cart-url, in the format "/cart/{productVariantID}:{productQuantity}"`;if(n==="customer-accounts"&&!r.storeId){let s=K()?", which dev can't look up with SHOPIFY_SERVICE_ACCOUNT_TOKEN":", which dev could not find";return`Can't preview ${o}: customer account previews need the store's ID${s}`}return`Redirect url can't be constructed for ${o}`}import{createServer as $s}from"http";function cn(t){let e=dr(),r=mr();e.use(sn(t)),e.use(rn),e.use(on),r.use("/extensions/dev-console",yt),r.use("/extensions/:extensionId",Pt(t)),r.use("/extensions/:extensionId/",Pt(t)),r.use("/extensions/:extensionId/:extensionPointTarget",an(t)),r.use("/extensions/:extensionId/assets/**:assetPath",nn(t)),r.use("/extensions",vt(t)),r.use("/extensions/",vt(t)),r.use("/",yt),e.use(r);let o=$s(fr(e));return o.listen(t.devOptions.port,"localhost"),o}async function ln(t){let e={...t,websocketURL:ae(t.url)},r=e.appWatcher.buildOutputPath,o=new Map,n=await Yo(e,r,o),s=new We(n,e,o),a=e.extensions.filter(u=>u.isPreviewable),i=()=>a;y("Setting up the UI extensions HTTP server...",e.stdout);let l=cn({devOptions:e,payloadStore:s,getExtensions:i});y("Setting up the UI extensions Websocket server...",e.stdout);let m=Xo({...e,httpServer:l,payloadStore:s});y("Setting up the UI extensions bundler and file watching...",e.stdout);let c=async({appWasReloaded:u,app:g,extensionEvents:w})=>{u&&(a=g.allExtensions.filter(d=>d.isPreviewable));for(let d of w){if(!d.extension.isPreviewable)continue;let f=d.buildResult?.status==="ok"?"success":"error",S=d.buildResult?.status==="error"?{message:d.buildResult.error,file:d.buildResult.file}:void 0;switch(d.type){case ne.Created:if(e.extensions.push(d.extension),!e.checkoutCartUrl&&K())d.extension.shouldFetchCartUrl()&&T(`${d.extension.localIdentifier} can't be previewed without a cart. Restart dev with --checkout-cart-url, in the format "/cart/{productVariantID}:{productQuantity}".`,e.stderr);else if(!e.checkoutCartUrl){let E=await Me(e.extensions,e.storeFqdn);e.checkoutCartUrl=E}await s.addExtension(d.extension,r);break;case ne.Updated:await s.updateExtension(d.extension,e,r,{status:f,error:S});break;case ne.Deleted:e.extensions=e.extensions.filter(E=>E.devUUID!==d.extension.devUUID),await s.deleteExtension(d.extension);break}}};e.appWatcher.onEvent(c).onStart(c),e.signal.addEventListener("abort",()=>{y("Closing the UI extensions dev server..."),m.close(),l.close()})}function ae(t){let e=new URL("/extensions",t);return e.protocol="wss:",e.toString()}var Ms="3",Ds=async({stderr:t,stdout:e,abortSignal:r},{apiKey:o,storeFqdn:n,storeId:s,subscriptionProductUrl:a,port:i,cartUrl:l,proxyUrl:m,appName:c,appDotEnvFile:u,appId:g,grantedScopes:w,allExtensions:d,appDirectory:f,appWatcher:S})=>{await ln({appName:c,appDotEnvFile:u,appDirectory:f,id:g,extensions:d,stdout:e,stderr:t,signal:r,url:m,port:i,storeFqdn:be(n),storeId:s,apiKey:o,grantedScopes:w,checkoutCartUrl:l,subscriptionProductUrl:a,manifestVersion:Ms,appWatcher:S})};async function pn({allExtensions:t,storeFqdn:e,checkoutCartUrl:r,...o}){let n=t.filter(a=>a.isPreviewable),s=await Me(n,e,r);return{prefix:"extensions",type:"previewable-extension",function:Ds,options:{pathPrefix:"/extensions",port:-1,storeFqdn:e,allExtensions:t,cartUrl:s,...o}}}p();p();function J(t){let e=t.find(o=>re(o,G.Frontend)),r=t.find(o=>re(o,G.Backend));return{frontendConfig:e,backendConfig:r}}p();async function un(t){let r={topic:"app/uninstalled",api_version:(await Uo(t.developerPlatformClient,t.organizationId))[1],address:t.address,delivery_method:To.LOCALHOST,shared_secret:t.sharedSecret},o=await Ro(t.developerPlatformClient,r,t.organizationId);t.stdout.write("Sending APP_UNINSTALLED webhook to app server"),await le(3);let n=await Fs(t,o);return t.stdout.write(n?"APP_UNINSTALLED webhook delivered":"APP_UNINSTALLED webhook delivery failed"),n}async function Fs(t,e){let r=0;for(;r<3;){try{return await Ao(t.address,e.samplePayload,JSON.stringify({...JSON.parse(e.headers),"X-Shopify-Shop-Domain":t.storeFqdn}))}catch(o){if(o instanceof Mt&&o.code==="ECONNREFUSED")r<3&&(t.stdout.write("App isn't responding yet, retrying in 5 seconds"),await le(5));else throw o}r++}return t.stdout.write("App hasn't started in time, giving up"),!1}var Os=async({stdout:t},e)=>{await un({stdout:t,developerPlatformClient:e.developerPlatformClient,address:`http://localhost:${e.deliveryPort}${e.webhooksPath}`,sharedSecret:e.apiSecret,storeFqdn:e.storeFqdn,organizationId:e.organizationId})};function dn({webs:t,remoteAppUpdated:e,backendPort:r,frontendPort:o,organizationId:n,...s}){let{backendConfig:a,frontendConfig:i}=J(t),l=t.map(({configuration:c})=>c.webhooks_path).find(c=>c)??"/api/webhooks";if(l&&e&&(i??a))return{type:"send-webhook",prefix:"webhooks",function:Os,options:{deliveryPort:a?r:o,webhooksPath:l,organizationId:n,...s}}}p();async function mn(t){return{type:"graphiql",prefix:"graphiql",options:t,function:Ns}}var Ns=async({stdout:t,abortSignal:e},r)=>{let o=_o({apiKey:r.apiKey,apiSecret:r.apiSecret,storeFqdn:r.storeFqdn}),n=gr({stdout:t,port:r.port,storeFqdn:r.storeFqdn,key:r.key,tokenProvider:o,appContext:{appName:r.appName,appUrl:r.appUrl,apiSecret:r.apiSecret}});e.addEventListener("abort",()=>{n.close(),n.closeAllConnections()})};p();async function hn({webs:t,proxyUrl:e,frontendPort:r,backendPort:o,apiKey:n,apiSecret:s,scopes:a}){let{frontendConfig:i}=J(t),l=i?.configuration.hmr_server?await M():void 0,m=void 0,c=t.map(async u=>{let g=await Ws({web:u,frontendPort:r,backendPort:o}),w=l&&u.configuration.roles.includes(G.Frontend)?{port:l,httpPaths:u.configuration.hmr_server.http_paths}:void 0;return{type:"web",prefix:u.configuration.name??["web",...u.configuration.roles].join("-"),function:qs,options:{port:g,portFromConfig:u.configuration.port,apiKey:n,apiSecret:s,hostname:e,backendPort:o,frontendServerPort:r,directory:u.directory,devCommand:u.configuration.commands.dev,preDevCommand:u.configuration.commands.predev,scopes:a,shopCustomDomain:m,hmrServerOptions:w,roles:u.configuration.roles}}});return Promise.all(c)}async function Ws({web:t,frontendPort:e,backendPort:r}){return re(t,G.Frontend)?e:re(t,G.Backend)?r:M()}async function qs({stdout:t,stderr:e,abortSignal:r},{port:o,apiKey:n,apiSecret:s,hostname:a,backendPort:i,frontendServerPort:l,directory:m,devCommand:c,preDevCommand:u,scopes:g,shopCustomDomain:w,hmrServerOptions:d}){let f=d?.port,S={SHOPIFY_API_KEY:n,SHOPIFY_API_SECRET:s,HOST:a,SCOPES:g,NODE_ENV:"development",...w&&{SHOP_CUSTOM_DOMAIN:w},BACKEND_PORT:`${i}`,FRONTEND_PORT:`${l}`,...f&&{HMR_SERVER_PORT:`${f}`},APP_URL:a,APP_ENV:"development",REMIX_DEV_ORIGIN:a},E={signal:r,directory:m,port:o,env:S,stdout:t,stderr:e};u&&(t.write(`Running pre-dev command: "${u}"`),await fn({...E,command:u,showOutput:or()})),await fn({...E,command:c,showOutput:!0})}async function fn({command:t,signal:e,directory:r,port:o,env:n,showOutput:s,stdout:a,stderr:i}){let l=t.split("&&").map(m=>m.trim())??[];for(let m of l){let[c,...u]=m.split(" ");c?.length!==0&&await _e(c,u,{cwd:r,stdout:s?a:void 0,stderr:i,signal:e,env:{...n,PORT:`${o}`,SERVER_PORT:`${o}`}})}}p();p();p();var He=class{stdout;constructor(e){this.stdout=e}async info(e){await this.log(e)}async warning(e){await this.log(U`${b.yellow(e)}`.value)}async success(e){await this.log(U`${b.green(e)}`.value)}async debug(e){y(e,this.stdout)}async error(e,r){let o=b.errorText("\u274C Error"),n=b.errorText(`\u2514 ${e}`);await this.log(U`${o}`.value,r),await this.log(U`${n}`.value,r)}async logUserErrors(e,r){if(typeof e=="string")await this.error(e);else if(e instanceof Error)await this.error(e.message);else{let o=e.map(n=>{let s=n.on?n.on[0]:void 0,a=r.find(i=>i.uid===s?.user_identifier);return{error:n.message,prefix:a?.handle??"app-preview"}});await this.logMultipleErrors(o)}}async logExtensionEvents(e){let r=e.extensionEvents.filter(n=>n.extension.isAppConfigExtension),o=e.extensionEvents.filter(n=>!n.extension.isAppConfigExtension);r.length&&await this.log("App config updated","app-config"),o.forEach(async n=>{let s=n.extension.handle,a=`Extension ${n.type}`;await this.log(a,s)})}async logExtensionUpdateMessages(e,r){if(!e||r.status==="remote-error"||r.status==="unknown-error")return;let o={status:r.status},n=e.extensionEvents??[],a=(await Promise.all(n.map(async l=>l.type===ne.Deleted?[]:(await l.extension.getDevSessionUpdateMessages(o))?.map(c=>({message:c,prefix:l.extension.handle}))??[]))).flat(),i=a.map((l,m)=>{let c=U`${b.gray(m===a.length-1?"\u2514 ":"\u2502 ")}${l.message}`.value;return this.log(c,l.prefix)});await Promise.all(i)}async logMultipleErrors(e){let r=b.errorText("\u274C Error");await this.log(U`${r}`.value,"app-preview");let o=e.map(n=>{let s=b.errorText(`\u2514 ${n.error}`);return this.log(U`${s}`.value,n.prefix)});await Promise.all(o)}async log(e,r){await D({outputPrefix:r??"app-preview",stripAnsi:!1},()=>{this.stdout.write(`${e}
|
|
8
|
+
`)})}};p();var Ge=class{processBatch;queue=[];processingPromise=void 0;constructor(e){this.processBatch=e}enqueue(e){this.queue.push(e),this.processingPromise??=this.startProcessing()}async waitForCompletion(){if(this.processingPromise)return this.processingPromise}async startProcessing(){try{for(;this.queue.length>0;){let e=[...this.queue];this.queue=[],await this.processBatch(e)}}finally{this.processingPromise=void 0}}};var je=class t{static async start(e,r){let o=new t(e,r);return await o.start(),o}statusManager;logger;options;appWatcher;bundlePath;appEventsProcessor;failedEvents=[];currentSessionState=null;constructor(e,r){this.statusManager=e.devSessionStatusManager,this.logger=new He(r),this.options=e,this.appWatcher=e.appWatcher,this.bundlePath=e.appWatcher.buildOutputPath,this.appEventsProcessor=new Ge(o=>this.processEvents(o))}async start(){await this.logger.info(`Preparing dev preview on ${this.options.storeFqdn}`),this.statusManager.setMessage("LOADING"),this.appWatcher.onEvent(async e=>this.onEvent(e)).onStart(async e=>this.onStart(e)).onError(async e=>this.handleDevSessionResult({status:"unknown-error",error:e}))}async onEvent(e){await this.validateAppEvent(e)&&this.appEventsProcessor.enqueue(e)}async processEvents(e){let r=[...this.failedEvents,...e],o=this.consolidateAppEvents(r);if(this.failedEvents=[],!o)return;this.statusManager.setMessage("CHANGE_DETECTED"),this.updatePreviewURL(o),await this.logger.logExtensionEvents(o);let n=ho(),s=await this.bundleExtensionsAndUpload(o);await this.handleDevSessionResult(s,o),await this.logger.debug(`\u2705 Event handled [Network: ${pt(n)}ms - Total: ${pt(o.startTime)}ms]`)}consolidateAppEvents(e){if(e.length===0)return;if(e.length===1)return e[0];let r=e[0],o=e[e.length-1];if(!r||!o)return;let n=new Map;for(let a of e)for(let i of a.extensionEvents)n.set(i.extension.uid,i);return{app:o.app,path:o.path,extensionEvents:Array.from(n.values()),startTime:r.startTime,appWasReloaded:e.some(a=>a.appWasReloaded)}}async onStart(e){let r=this.parseBuildErrors(e);if(r.length)this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),await this.logger.logMultipleErrors(r),await setImmediate(()=>{let o=r.map(n=>n.prefix);throw new _(`Dev preview aborted, build errors detected in extensions: ${o}`)});else{let o=await this.bundleExtensionsAndUpload(e);await this.handleDevSessionResult(o,e)}}async validateAppEvent(e){if(!this.statusManager.status.isReady)return await this.logger.warning("Change detected, but dev preview is not ready yet."),!1;let r=this.parseBuildErrors(e);return r.length?(await this.logger.logMultipleErrors(r),this.statusManager.setMessage("BUILD_ERROR",r.map(({prefix:o,error:n})=>`${o}: ${n}`)),!1):e.extensionEvents.length===0?(this.statusManager.setMessage("READY"),!1):!0}parseBuildErrors(e){return e.extensionEvents.filter(o=>o.buildResult?.status==="error").map(o=>({error:o.buildResult?.status==="error"&&o.buildResult.error||"Build error. Please review your code and try again.",prefix:o.extension.handle}))}async handleDevSessionResult(e,r){if(e.status==="updated")await this.logger.success(`\u2705 Updated dev preview on ${this.options.storeFqdn}`),await this.logger.logExtensionUpdateMessages(r,e),await this.setUpdatedStatusMessage();else if(e.status==="created")this.statusManager.updateStatus({isReady:!0}),await this.logger.success("\u2705 Ready, watching for changes in your app "),await this.logger.logExtensionUpdateMessages(r,e),this.statusManager.setMessage("READY");else if(e.status==="remote-error"||e.status==="unknown-error"){let o=e.error instanceof Error?[e.error.message]:e.error.map(n=>n.message);await this.logger.logUserErrors(e.error,r?.app.allExtensions??[]),e.error instanceof Error&&e.error.cause==="validation-error"?this.statusManager.setMessage("VALIDATION_ERROR",o):(r&&this.failedEvents.push(r),this.statusManager.setMessage("REMOTE_ERROR",o))}!this.statusManager.status.isReady&&!nr()&&setImmediate(()=>{throw new _("Failed to start dev preview.")})}updatePreviewURL(e){let r=e.app.nonConfigExtensions.length>0;this.statusManager.updateStatus({previewURL:this.options.appPreviewURL,appEmbedded:e.app.configuration.embedded,hasExtensions:r})}async setUpdatedStatusMessage(){this.statusManager.setMessage("UPDATED"),setTimeout(async()=>{this.statusManager.status.statusMessage?.message==="Updated"&&this.statusManager.setMessage("READY")},2e3)}async bundleExtensionsAndUpload(e){try{let{manifest:r,inheritedModuleUids:o,assets:n}=await this.createManifest(e),s=await this.uploadAssetsIfNeeded(n,!this.statusManager.status.isReady),a=ae(this.options.url);if(this.statusManager.status.isReady){let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,manifest:r,inheritedModuleUids:o,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionUpdateWithRetry(i)}else{let i={shopFqdn:this.options.storeFqdn,appId:this.options.appId,assetsUrl:s,websocketUrl:a,unsafeValidation:this.options.unsafeValidation??!1};return this.devSessionCreateWithRetry(i)}}catch(r){if(r.statusCode===401)throw new _("Auth session expired. Please run `shopify app dev` again.");if(r instanceof $t)throw r.response.status===401||r.response.status===403?new _("Auth session expired. Please run `shopify app dev` again."):(await this.logger.debug(JSON.stringify(r.response,null,2)),new _("Unknown error"));return r.code==="ETIMEDOUT"?{status:"unknown-error",error:new Error("Request timed out, please check your internet connection and try again.")}:{status:"unknown-error",error:r}}}async createManifest(e){let r=e.extensionEvents.filter(i=>i.type!=="deleted").map(i=>i.extension.uid);e.app.allExtensions.some(i=>i.type==="admin")&&!r.includes("admin")&&r.push("admin");let o=e.app.allExtensions.filter(i=>!r.includes(i.uid)).map(i=>i.uid),n=await e.app.manifest(void 0);await wo(n,this.bundlePath),this.statusManager.status.isReady&&(n.modules=n.modules.filter(i=>r.includes(i.uid)));let s=await It(this.bundlePath),a=n.modules.map(i=>i.assets).filter(i=>s.includes(i));return{manifest:n,inheritedModuleUids:o,assets:a}}async uploadAssetsIfNeeded(e,r){if(!e.length&&!r)return;let o=A(fe(this.bundlePath),`dev-bundle.${this.options.developerPlatformClient.bundleFormat}`),n=[...e.map(a=>`${a}/**`),...yo];r&&n.push("manifest.json"),await vo(this.bundlePath,o,n);let s=await this.getSignedURLWithRetry();return await Po(s,o),s}async getSignedURLWithRetry(){return xo(this.options.developerPlatformClient,{apiKey:this.options.appId,organizationId:this.options.organizationId,id:this.options.appId})}async devSessionUpdateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionUpdate(e),o=r.devSessionUpdate?.userErrors??[],n=r.devSessionUpdate?.warnings??[],s=r.devSessionUpdate?.devSession;if(s&&this.currentSessionState){let a=ae(this.options.url),i=this.currentSessionState?.userId;if(s.websocketUrl!==a||s.user?.id!==i){let l=s.user?.email;await this.logger.error(`Another developer ${l?`(${l}) `:""}has taken ownership of this dev preview.`);let m=`Another user${l?` (${l})`:""} has taken ownership of this dev preview. Your preview is no longer active.`,c=["You can restart by running",{command:"shopify app dev"},"again."];throw new _(m,c)}this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}}return n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"updated"}}async devSessionCreateWithRetry(e){let r=await this.options.developerPlatformClient.devSessionCreate(e),o=r.devSessionCreate?.userErrors??[],n=r.devSessionCreate?.warnings??[],s=r.devSessionCreate?.devSession;return s&&(this.currentSessionState={websocketUrl:s.websocketUrl,userId:s.user?.id??null,userEmail:s.user?.email??null}),n.length>0&&await this.logWarnings(n),o.length?{status:"remote-error",error:o}:{status:"created"}}async logWarnings(e){await Promise.all(e.map(r=>{let o=r.code==="SESSION_TAKEOVER"?`\u26A0\uFE0F ${r.message}`:r.message;return this.logger.warning(o)}))}};async function gn({app:t,apiKey:e,developerPlatformClient:r,...o}){return{type:"dev-session",prefix:"app-preview",function:Hs,options:{app:t,apiKey:e,developerPlatformClient:r,...o}}}var Hs=async({stdout:t},e)=>{await je.start(e,t)};p();p();p();var wn=async({appLog:t,appLogPayload:e,stdout:r,storeName:o,logsDir:n})=>{let s=Ct().substring(0,6),i=`${Gs(t.log_timestamp)}_${t.source_namespace}_${t.source}_${s}.json`,l=Go({appLog:t,appLogPayload:e,prettyPrint:!0,storeName:o}),m=A(n,i);try{return await ye(n),await we(m,l),{fullOutputPath:m,identifier:s}}catch(c){throw r.write(`Error while writing log to file: ${c}
|
|
9
|
+
`),c}};function Gs(t){let e=new Date(t),r=e.getUTCFullYear(),o=(e.getUTCMonth()+1).toString().padStart(2,"0"),n=e.getUTCDate().toString().padStart(2,"0"),s=e.getUTCHours().toString().padStart(2,"0"),a=e.getUTCMinutes().toString().padStart(2,"0"),i=e.getUTCSeconds().toString().padStart(2,"0"),l=e.getUTCMilliseconds().toString().padStart(3,"0");return`${r}${o}${n}_${s}${a}${i}_${l}Z`}var Be=async({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:m=0})=>{if(!i?.aborted)try{let c=e,u=ko,g=m,w=await o.appLogs({jwtToken:e,cursor:r},a),{errors:d,status:f}=w;if(f===200){g=0;let{app_logs:E}=w;for(let R of E){let x=JSON.parse(R.payload);await D({outputPrefix:R.source,stripAnsi:!1},async()=>{R.log_type===Mo?(js(R,x,t),x=new Io(Co(x))):R.log_type.startsWith(Do)?Bs(R,x,t):t.write(JSON.stringify(x));let C=await wn({appLog:R,appLogPayload:x,stdout:t,storeName:s,logsDir:l});t.write(U`${b.gray("\u2514 ")}${b.link("Open log file",`file://${C.fullOutputPath}`,`Log: ${C.fullOutputPath}`)} ${b.gray(`(${C.identifier})`)}\n`.value)})}}else{let E={errors:d.map(x=>({message:x,status:f}))},R=await Ho({response:E,onThrottle:x=>{T("Request throttled while polling app logs.",t),T(`Retrying in ${x/1e3} seconds.`,t)},onUnknownError:x=>{T("Error while polling app logs.",t),T(`Retrying in ${x/1e3} seconds.`,t)},onResubscribe:()=>n()});if(R.resubscribeResult==="failed"){if(g+=1,g>=Lo){T("App log streaming session has expired. Please restart your dev session.",t);return}}else R.resubscribeResult==="succeeded"&&(g=0);R.nextJwtToken&&(c=R.nextJwtToken),u=R.retryIntervalMs}let{cursor:S}=w;setTimeout(()=>{Be({stdout:t,appLogsFetchInput:{jwtToken:c,cursor:S??r},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l,consecutiveResubscribeFailures:g}).catch(E=>{y(`Unexpected error during polling: ${E}}
|
|
10
|
+
`)})},u)}catch(c){T("Error while polling app logs.",t),T(`Retrying in ${dt/1e3} seconds.`,t),y(`${c}}
|
|
11
|
+
`),setTimeout(()=>{Be({stdout:t,appLogsFetchInput:{jwtToken:e,cursor:void 0},developerPlatformClient:o,resubscribeCallback:n,storeName:s,organizationId:a,abortSignal:i,logsDir:l}).catch(u=>{y(`Unexpected error during polling: ${u}}
|
|
12
|
+
`)})},dt)}};function js(t,e,r){let o=(e.fuel_consumed/$o).toFixed(4);t.status==="success"?r.write(`Function export "${e.export}" executed successfully using ${o}M instructions.`):t.status==="failure"&&r.write(`\u274C Function export "${e.export}" failed to execute with error: ${e.error_type}`);let n=e.logs;n.length>0&&r.write(n.split(`
|
|
13
|
+
`).filter(Boolean).map(s=>U`${b.gray("\u2502 ")}${s}`.value).join(`
|
|
14
|
+
`))}function Bs(t,e,r){t.log_type===Fo?r.write("Function network access response retrieved from cache."):t.log_type===Oo?e.reason===Wo?r.write("Function network access request executing in background because there is no cached response."):e.reason===qo&&r.write("Function network access request executing in background because the cached response is about to expire."):t.log_type===No&&(t.status==="success"?r.write("Function network access request executed successfully."):t.status==="failure"&&r.write(`\u274C Function network access request failed to execute with error: ${e.error}.`))}function Ks(t){return t.allExtensions.some(e=>e.isFunctionExtension)}async function yn({developerPlatformClient:t,subscription:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}){return{type:"app-logs-subscribe",prefix:"app-logs",function:Vs,options:{developerPlatformClient:t,appLogsSubscribeVariables:{shopIds:e,apiKey:r},storeName:o,organizationId:n,appWatcher:s,localApp:a}}}var Vs=async({stdout:t,stderr:e,abortSignal:r},{developerPlatformClient:o,appLogsSubscribeVariables:n,storeName:s,organizationId:a,appWatcher:i,localApp:l})=>{async function m(c){let u=await mt(o,n,a,t),g=l.getLogsDir();await ye(g),await Be({stdout:t,appLogsFetchInput:{jwtToken:u},resubscribeCallback:()=>mt(o,n,a),developerPlatformClient:o,storeName:s,organizationId:a,abortSignal:c,logsDir:g})}try{let c=!1,u,g=async w=>{let d=Ks(w.app);if(d&&!c){y("Function extensions detected, starting logs polling"),c=!0,u=new AbortController;try{await m(u.signal)}catch(f){y(`Failed to start function logs: ${f}`,e)}}else!d&&c&&(y("No function extensions detected, stopping logs polling"),c=!1,u?.abort(),u=void 0)};i.onStart(g).onEvent(g)}catch{}};p();async function vn(t){return{type:"app-watcher",prefix:"app-preview",options:t,function:Ys}}var Ys=async({stdout:t,stderr:e,abortSignal:r},o)=>{let{appWatcher:n}=o;await n.start({stdout:t,stderr:e,signal:r})};p();import{EventEmitter as zs}from"events";var Qs={BUILD_ERROR:{message:"Build error. Please review your code and try again",type:"error"},READY:{message:"Ready, watching for changes in your app",type:"success"},LOADING:{message:"Preparing dev preview",type:"loading"},UPDATED:{message:"Updated",type:"success"},VALIDATION_ERROR:{message:"Validation error in your app configuration",type:"error"},REMOTE_ERROR:{message:"Error updating dev preview",type:"error"},CHANGE_DETECTED:{message:"Change detected, updating dev preview",type:"loading"}},Ke=class extends zs{currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0};constructor(e){super(),e&&(this.currentStatus=e)}updateStatus(e){let r={...this.currentStatus,...e};Wt(this.currentStatus,r)||(this.currentStatus=r,this.emit("dev-session-update",r))}setMessage(e,r){let o=Qs[e],n=o.type==="success"?[]:r;this.updateStatus({statusMessage:o,...n?{errors:n}:{}})}get status(){return this.currentStatus}reset(){this.currentStatus={isReady:!1,previewURL:void 0,graphiqlURL:void 0,statusMessage:void 0}}};p();import*as Pn from"http";import*as xn from"https";function En(t){return"errors"in t&&Array.isArray(t.errors)}async function bn(t,e,r,o){let s=(await import("./http-proxy-node16-NZZ674YW.js")).default.createProxyServer(),a=Xs(t,s,o),i=r?xn.createServer(r,a):Pn.createServer(a);return i.on("upgrade",Js(t,s,o)),e.addEventListener("abort",()=>{y("Closing reverse HTTP proxy"),i.close()}),{server:i}}function Js(t,e,r){return function(o,n,s){let a=Sn(t,o,!0);if(a)return e.ws(o,n,s,{target:a},i=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let m=(En(i)?i.errors[i.errors.length-1]:void 0)??i;T(`Error forwarding websocket request: ${m.message}`,r),T(`\u2514 Unreachable target "${a}" for path: "${o.url}"`,r)})});n.destroy()}}function Xs(t,e,r){return function(o,n){let s=Sn(t,o);if(s)return o.method==="OPTIONS"?(n.writeHead(204,{"Access-Control-Allow-Origin":o.headers.origin??"*","Access-Control-Allow-Methods":o.headers["access-control-request-method"]??"GET, POST, PUT, DELETE, PATCH, OPTIONS","Access-Control-Allow-Headers":o.headers["access-control-request-headers"]??"Content-Type, Authorization","Access-Control-Max-Age":"86400"}),n.end()):e.web(o,n,{target:s},a=>{D({outputPrefix:"proxy",stripAnsi:!1},()=>{let l=(En(a)?a.errors[a.errors.length-1]:void 0)??a;T(`Error forwarding web request: ${l.message}`,r),T(`\u2514 Unreachable target "${s}" for path: "${o.url}"`,r)})});y(U`
|
|
15
|
+
Reverse HTTP proxy error - Invalid path: ${o.url??""}
|
|
16
|
+
These are the allowed paths:
|
|
17
|
+
${b.json(JSON.stringify(t))}
|
|
18
|
+
`),n.statusCode=500,n.end(`Invalid path ${o.url}`)}}function Sn(t,e,r=!1){let o=e.url??"/";for(let n in t)if(o.startsWith(n))return t[n];return r&&t.websocket?t.websocket:t.default}function Zs(t){t.allExtensions.some(e=>e.isFunctionExtension)&&T("Function logs aren't streamed, because dev doesn't know the store's ID.")}async function Un({localApp:t,remoteAppUpdated:e,developerPlatformClient:r,remoteApp:o,storeFqdn:n,storeId:s,commandOptions:a,network:i,graphiqlPort:l,graphiqlKey:m,apiSecret:c}){let u=o.apiKey,g=xe(),w=!me(g[te.disableGraphiQLExplorer]),d=await no(t),f=c??(d.webs.length>0?await $e(o):void 0),S=w&&f!==void 0,E=new go(d,i.proxyUrl),R=await Ee(),x=bo(n,u,R),C=x,j=f===void 0?void 0:hr(m,f,n),B=S&&j?`http://localhost:${l}/graphiql?key=${encodeURIComponent(j)}`:void 0,Y=d.configuration.embedded,P=d.nonConfigExtensions.length>0,q=new Ke({isReady:!1,previewURL:C,graphiqlURL:B,appEmbedded:Y,hasExtensions:P}),Ve=[...f===void 0?[]:await hn({webs:d.webs,proxyUrl:i.proxyUrl,frontendPort:i.frontendPort,backendPort:i.backendPort,apiKey:u,apiSecret:f,scopes:Yr(d.configuration)}),S&&f!==void 0?await mn({appName:o.title,appUrl:x,port:l,apiKey:u,apiSecret:f,key:j,storeFqdn:n}):void 0,await pn({allExtensions:d.realExtensions,storeFqdn:n,storeId:s,apiKey:u,subscriptionProductUrl:a.subscriptionProductUrl,checkoutCartUrl:a.checkoutCartUrl,proxyUrl:i.proxyUrl,appName:d.name,appDotEnvFile:d.dotenv,grantedScopes:o.grantedScopes,appId:o.id,appDirectory:d.directory,appWatcher:E}),await gn({app:d,apiKey:u,developerPlatformClient:r,url:i.proxyUrl,appId:o.id,organizationId:o.organizationId,storeFqdn:n,appWatcher:E,appPreviewURL:x,devSessionStatusManager:q,unsafeValidation:a.unsafeValidation}),await Bo({remoteApp:o,localApp:d,storeFqdn:n,theme:a.theme,themeExtensionPort:a.themeExtensionPort,storePassword:a.storePassword}),f===void 0?void 0:dn({webs:d.webs,backendPort:i.backendPort,frontendPort:i.frontendPort,organizationId:o.organizationId,developerPlatformClient:r,storeFqdn:n,apiSecret:f,remoteAppUpdated:e}),s===void 0?Zs(d):await yn({developerPlatformClient:r,subscription:{shopIds:[Number(s)],apiKey:u},storeName:n,organizationId:o.organizationId,localApp:t,appWatcher:E}),await vn({appWatcher:E})].filter(ea);return{processes:await ta(Ve,i.proxyPort,i.reverseProxyCert),previewUrl:C,graphiqlUrl:B,devSessionStatusManager:q}}var ea=t=>t!==void 0&&t!==!1;async function ta(t,e,r){let o=await Promise.all(t.map(async a=>{let i={};if(a.type==="web"&&a.options.roles.includes(G.Frontend)){let l=a.options.portFromConfig??a.options.port;i.default=`http://localhost:${l}`;let m=a.options.hmrServerOptions;m&&(i.websocket=`http://localhost:${m.port}`,m.httpPaths.forEach(c=>i[c]=`http://localhost:${m.port}`)),a.options.port=l}else if(a.type==="previewable-extension"){let l=await M();i[a.options.pathPrefix]=`http://localhost:${l}`,a.options.port=l}return{process:a,rules:i}})),n=o.map(({process:a})=>a),s=o.map(({rules:a})=>a).reduce((a,i)=>({...a,...i}),{});return Object.keys(s).length>0&&n.push({type:"proxy-server",prefix:"proxy",function:ra,options:{port:e,rules:s,localhostCert:r}}),n}var ra=async({abortSignal:t,stdout:e},{port:r,rules:o,localhostCert:n})=>{let{server:s}=await bn(o,t,n,e);z(`Proxy server started on port ${r} ${n?`with certificate ${n.certPath}`:""}`,e),await s.listen(r,"localhost")};p();async function Rn({remoteApp:t,hasWebs:e,graphiqlEnabled:r}){if(e)return $e(t);if(!r)return;let o=await ao(t);return o||T(`GraphiQL isn't available because the App Management API didn't return the app's client secret for your credentials. ${io()}`),o}p();p();p();var I=ie(Ze(),1);var An=.9,Tn=({tabs:t,initialActiveTab:e})=>{let{stdout:r}=jt(),{isRawModeSupported:o}=Se(),[n,s]=(0,I.useState)(e),[a,i]=(0,I.useState)(Math.floor(r.columns*An)),[l,m]=(0,I.useState)(!0),c=(0,I.useRef)(null);if(!n)throw new Error("No tabs provided");Ue((d,f)=>{(async()=>{if(f?.leftArrow||f?.rightArrow||f?.tab){let x=Object.entries(t).filter(([P,q])=>q.content),C=x.findIndex(([P])=>P===n);if(C===-1)return;let j=f?.leftArrow?-1:1,B=(C+j+x.length)%x.length,Y=x[B];Y&&s(Y[0])}let E=t[d];if(E){E.action?await E.action():s(d);return}let R=t[n];if(R?.shortcuts){let x=R.shortcuts.find(C=>C.key===d);x&&(!x.condition||x.condition())&&await x.action()}})()},{isActive:!!o}),(0,I.useLayoutEffect)(()=>{let d=()=>{if(i(Math.floor(r.columns*An)),!c.current)return;let f=Bt(c.current);m(f.width<r.columns)};return r.on("resize",d),()=>{r.off("resize",d)}},[r]);let u=Object.entries(t).map(([d,f])=>({...f,inputKey:d,header:` (${d}) ${f.label} `})),g=u.filter(d=>!d.action),w=u.filter(d=>d.action);return I.default.createElement(I.default.Fragment,null,I.default.createElement(L,{paddingTop:0,width:a,flexDirection:"row",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},I.default.createElement(L,{ref:c,flexDirection:"row",flexWrap:"nowrap",flexShrink:0,marginRight:3},I.default.createElement(F,{wrap:"truncate-end"},"\u2502",g.map(d=>I.default.createElement(I.default.Fragment,{key:d.inputKey},I.default.createElement(F,{bold:n===d.inputKey,inverse:n===d.inputKey,wrap:"truncate"},d.header),"\u2502")))),l&&I.default.createElement(L,{flexGrow:1,justifyContent:"flex-end"},w.map((d,f)=>I.default.createElement(F,{wrap:"truncate",key:d.inputKey},"(",d.inputKey,") ",d.label,f<w.length-1&&" \u2502 ")))),I.default.createElement(L,{flexDirection:"column",marginLeft:1,marginRight:1,marginTop:1},t[n]?.content))};var v=ie(Ze(),1);var oa=({message:t,type:e})=>e==="loading"?v.default.createElement(Xt,{title:t}):v.default.createElement(F,null,e==="success"?"\u2705":"\u274C"," ",t),_n=({abortController:t,processes:e,devSessionStatusManager:r,shopFqdn:o,appURL:n,appName:s,organizationName:a,configPath:i,localURL:l,onAbort:m})=>{let{isRawModeSupported:c}=Se(),[u,g]=(0,v.useState)(void 0),[w,d]=(0,v.useState)(void 0),[f,S]=(0,v.useState)(r.status),[E,R]=(0,v.useState)(!1),{isAborted:x}=Jt(t.signal,async P=>{P&&d(typeof P=="string"?P:P.message),r.status.isReady?R(!0):(g("Shutting down dev ..."),await m()),De()}),C=(0,v.useMemo)(()=>e.map(P=>({...P,action:async(q,Ve,bt)=>{try{return await P.action(q,Ve,bt)}catch(Kn){t.abort(Kn)}}})),[e,t]);(0,v.useEffect)(()=>(r.on("dev-session-update",S),()=>{r.off("dev-session-update",S)}),[]),Ue((P,q)=>{Vt(P,q,()=>t.abort())},{isActive:!!c});let j=[{key:"p",shortcutLabel:"Open app preview",linkLabel:"Preview",url:f.previewURL,condition:()=>!!(f.isReady&&f.previewURL),action:async()=>{await Q.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),f.previewURL&&await Te(f.previewURL)}},{key:"c",shortcutLabel:"Open Dev Console for extension previews",linkLabel:"Dev Console",url:ut(o),condition:()=>!!(f.isReady&&f.appEmbedded===!1&&f.hasExtensions),action:async()=>{await Q.addPublicMetadata(()=>({cmd_dev_preview_url_opened:!0})),await Te(ut(o))}},{key:"g",shortcutLabel:"Open GraphiQL (Admin API)",linkLabel:"GraphiQL",url:f.graphiqlURL,condition:()=>!!(f.isReady&&f.graphiqlURL),action:async()=>{await Q.addPublicMetadata(()=>({cmd_dev_graphiql_opened:!0})),f.graphiqlURL&&await Te(f.graphiqlURL)}}],B=j.filter(P=>P.condition?.()??!0),Y={d:{label:"Dev status",shortcuts:j,content:v.default.createElement(v.default.Fragment,null,f.statusMessage&&v.default.createElement(oa,{message:f.statusMessage.message,type:f.statusMessage.type}),c&&B.length>0&&v.default.createElement(L,{marginTop:1,flexDirection:"column"},B.map(P=>v.default.createElement(F,{key:P.key},Yt.pointerSmall," ",v.default.createElement(F,{bold:!0},"(",P.key,")")," ",rt()&&P.url?v.default.createElement(et,{url:P.url,label:P.shortcutLabel}):P.shortcutLabel))),v.default.createElement(L,{marginTop:c?1:0,flexDirection:"column"},u?v.default.createElement(F,null,u):v.default.createElement(v.default.Fragment,null,f.isReady&&!(c&&rt())&&v.default.createElement(v.default.Fragment,null,B.filter(P=>P.url).map(P=>v.default.createElement(F,{key:P.key},P.linkLabel," URL: ",v.default.createElement(et,{url:P.url})))))))},a:{label:"App info",content:v.default.createElement(L,{flexDirection:"column"},v.default.createElement(tt,{tabularData:[["App:",s??""],["App URL:",n??""],["Local URL:",n?"":l??""],["Config:",i?.split("/").pop()??""],["Org:",a??""]].filter(([,P])=>P)}))},s:{label:"Store info",content:v.default.createElement(L,{flexDirection:"column"},v.default.createElement(tt,{tabularData:[["Dev store:",{link:{url:`https://${o}`}}],["Dev store admin:",{link:{url:`https://${o}/admin`}}],["Org:",a??""]].filter(([,P])=>P)}))},q:{label:"Quit",action:async()=>{t.abort()}}};return v.default.createElement(v.default.Fragment,null,v.default.createElement(zt,{processes:C,prefixColumnSize:Vr,abortSignal:t.signal,keepRunningAfterProcessesResolve:!0,useAlternativeColorPalette:!0}),E&&v.default.createElement(L,{marginTop:1,flexDirection:"column"},v.default.createElement(Qt,{type:"info",headline:`A preview of your development changes is still available on ${o}.`,body:["Run",{command:"shopify app dev clean"},"to restore the latest released version of your app."],link:{label:"Learn more about dev previews",url:"https://shopify.dev/beta/developer-dashboard/shopify-app-dev"}})),x?null:v.default.createElement(L,{paddingTop:1,flexDirection:"column",flexGrow:1},c?v.default.createElement(Tn,{tabs:Y,initialActiveTab:"d"}):v.default.createElement(L,{marginY:1,paddingTop:0,flexDirection:"column",flexGrow:1,borderStyle:"single",borderBottom:!1,borderLeft:!1,borderRight:!1,borderTop:!0},Y.d?.content)),w?v.default.createElement(L,{marginTop:1,flexDirection:"column"},v.default.createElement(F,{color:"red"},w)):null)};var Cn=ie(Ze(),1);import{Writable as kn}from"stream";async function Ln({processes:t,previewUrl:e,app:r,abortController:o,graphiqlUrl:n,shopFqdn:s,devSessionStatusManager:a,appURL:i,appName:l,organizationName:m,configPath:c,localURL:u}){let g=()=>o.abort();process.on("shopify:signal",g);try{if(Xe()!=="json"&&tr())return await Kt(Cn.default.createElement(_n,{processes:t,abortController:o,devSessionStatusManager:a,shopFqdn:s,appURL:i,appName:l,organizationName:m,configPath:c,localURL:u,onAbort:async()=>{await r.developerPlatformClient.devSessionDelete({appId:r.id,shopFqdn:s})}}),{exitOnCtrlC:!1});await na({processes:t,previewUrl:e,graphiqlUrl:n,abortController:o}),De()}finally{process.removeListener("shopify:signal",g)}}async function na({processes:t,previewUrl:e,graphiqlUrl:r,abortController:o}){let n=Xe()==="json";n||(process.stdout.write(`
|
|
19
|
+
Preview URL: ${e}
|
|
20
|
+
`),r&&process.stdout.write(`GraphiQL URL (Admin API): ${r}
|
|
21
|
+
`));let{signal:s}=o,a=()=>o.abort();process.once("SIGINT",a),process.once("SIGTERM",a);let i=()=>{},l=new Promise(c=>{i=c,s.addEventListener("abort",i,{once:!0}),s.aborted&&c()}),m=t.map(async c=>{let u=new kn({write:(g,w,d)=>d()});return c.action(n?u:In(process.stdout),n?u:In(process.stderr),s)});try{await Promise.all([...m,l])}catch(c){if(!s.aborted)throw c}finally{o.abort(),await Promise.allSettled(m),s.removeEventListener("abort",i),process.removeListener("SIGINT",a),process.removeListener("SIGTERM",a)}}function In(t){return new kn({decodeStrings:!1,write(e,r,o){let n=typeof e=="string"?Buffer.from(e,r):e,s=typeof e=="string"&&n.length>0&&n[n.length-1]!==10;t.write(s?Buffer.concat([n,Buffer.from(`
|
|
22
|
+
`)]):n,o)}})}p();function $n(t){if(!t.length)return;let e=t.filter(n=>n.requested!==n.actual);if(e.length===0)return;if(e.length===1&&e[0]){let n=e[0];ce({headline:[`A random port will be used for ${n.for} because ${n?.requested} is not available.`],body:["If you want to use a specific port, you can choose a different one by setting the ",{command:n?.flagToRemedy}," flag."]});return}let r=Qe(e.map(n=>n.for)).join(" "),o=Qe(e.map(n=>({command:n.flagToRemedy})));ce({headline:[`Random ports will be used for ${r} because the requested ports are not available.`],body:["If you want to use specific ports, you can choose different ports using the",...o,"flags."]})}p();async function Mn(t,e){return e?e.includes("localhost")?"localhost":(await Ft(t)).plugins.find(o=>e?.includes(o))??"custom":void 0}p();var Dn=ie(Yn(),1);var X="v1.4.4",Fn="FiloSottile/mkcert",xt=b.genericShellCommand("mkcert");async function sa(t,e,r,o){let n=e[te.mkcertBinaryPath];if(n)return n;let a=A(t,r==="win32"?"mkcert.exe":"mkcert");if(await O(a))return a;let i=await(0,Dn.default)("mkcert",{nothrow:!0});return i?(y(U`Found ${xt} at ${b.path(i)}`),i):(await aa(a,r,o),a)}async function aa(t,e,r){let o;switch(e){case"darwin":o=r==="arm64"?`mkcert-${X}-darwin-arm64`:`mkcert-${X}-darwin-amd64`;break;case"linux":o=r==="arm64"?`mkcert-${X}-linux-arm64`:`mkcert-${X}-linux-amd64`;break;case"win32":o=`mkcert-${X}-windows-amd64.exe`;break;default:throw new ee(`Unsupported platform: ${e}`)}await Tr(Fn,X,o,t),y(U`${xt} saved to ${b.path(t)}`)}async function ia(t){let e=A(t,"mkcert-LICENSE");if(await O(e))return;let r=`https://raw.githubusercontent.com/${Fn}/refs/tags/${X}/LICENSE`,o={headline:"Failed to download mkcert license.",body:["We tried to download the license for mkcert, but the request failed. You can ",{link:{url:r,label:"view the license here"}}]},n;try{if(n=await Dt(r),!n.ok)return o}catch{return o}let s=await n.text();await we(e,s)}async function On({appDirectory:t,forceInstall:e,env:r=process.env,platform:o=process.platform,arch:n=process.arch}){let s=A(".shopify","localhost-key.pem"),a=A(".shopify","localhost.pem"),i=A(t,s),l=A(t,a);if(await O(i)&&await O(l))return{keyContent:await $(i),certContent:await $(l),certPath:a};if(!(e??await so()))throw new _(`Localhost certificate and key are required at ${a} and ${s}`);let c="",u;return await Ae([{title:"Finding or downloading mkcert binary",task:async()=>{let w=A(t,".shopify");c=await sa(w,r,o,n),u=await ia(w),y(U`${xt} found at: ${b.path(c)}`)}}]),u&&Re(u),z(U`Generating self-signed certificate for localhost. You may be prompted for your password.`),await _e(c,["-install","-key-file",i,"-cert-file",l,"localhost"]),z(U`${b.successIcon()} Certificate generated at ${a}\n`),await rr()&&(ce({headline:"It looks like you're using WSL.",body:["Additional steps are required to configure certificate trust in Windows."],link:{label:"See Shopify CLI documentation",url:"https://shopify.dev/docs/apps/build/cli-for-apps/networking-options#localhost-based-development-with-windows-subsystem-for-linux-wsl"}}),z("\u{1F449} Press any key to continue"),await Zt(),z("")),{keyContent:await $(i),certContent:await $(l),certPath:Ut(t,l)}}p();function Nn(){let t=["Your app has extensions which need to be assigned",{command:"uid"},"identifiers."],e=["You must first map IDs to your existing extensions by running",{command:"shopify app deploy"},"interactively, without",{command:"--allow-updates"},"or",{command:"--allow-deletes"},", to finish the migration."],r={title:"Reference",body:{list:{items:[{link:{label:"Migrating from the Partner Dashboard",url:"https://shopify.dev/docs/apps/build/dev-dashboard/migrate-from-partners"}}]}}};throw new _(t,void 0,[e],[r])}function qn({app:t,remoteApp:e,json:r=!1},o){return Sr({command:"app dev",directory:t.directory,key:he(t.configPath),details:{configPath:t.configPath,appName:e.title,clientId:e.apiKey},logOutput:r?process.stdout:void 0},o)}async function Hn(t){let e=new Lt,r;try{if(t.tunnel.mode==="auto"){let l=await M();r=await ro(t.commandConfig,l,"cloudflare"),e.signal.addEventListener("abort",()=>r?.stopTunnel(),{once:!0})}let o=await ca(t,r);await la(o);let{processes:n,graphiqlUrl:s,previewUrl:a,devSessionStatusManager:i}=await Un(o);await ua(o),await fa({processes:n,previewUrl:a,graphiqlUrl:s,config:o,devSessionStatusManager:i,abortController:e})}finally{e.abort()}}async function ca(t,e){let{app:r,remoteApp:o,developerPlatformClient:n,store:s,specifications:a,tunnel:i}=t,l=await lo(o,n,a,o.flags);o.configuration=l;let m=await Rn({remoteApp:o,hasWebs:r.webs.length>0,graphiqlEnabled:!me(xe()[te.disableGraphiQLExplorer])});po({app:r,remoteApp:o,selectedStore:s,cachedInfo:lt(t.directory),organization:t.organization,tunnelMode:i.mode}),r.configuration.build?.dev_store_url&&!K()&&(r.configuration.build={...r.configuration.build,dev_store_url:s.shopDomain},await(await sr.read(r.configPath)).patch({build:{dev_store_url:s.shopDomain}})),!t.skipDependenciesInstallation&&!t.project.usesWorkspaces&&await Kr(t.project);let c=t.graphiqlPort??await M(pe.graphiql),u=[{for:"GraphiQL",flagToRemedy:"--graphiql-port",requested:t.graphiqlPort??pe.graphiql,actual:c}];i.mode==="use-localhost"&&u.push({for:"localhost",flagToRemedy:"--localhost-port",requested:i.requestedPort,actual:i.actualPort}),$n(u);let{webs:g,...w}=await ma(r.directory,r.webs,c,i,e,o.configuration,t.installMkcert);r.webs=g;let d=r.configuration.build?.automatically_update_urls_on_dev,f=lt(t.directory)?.previousAppId,S=o.apiKey,E=await da(g,t.update,w,r,d,o,S);return{storeFqdn:s.shopDomain,storeId:s.shopId||void 0,remoteApp:o,remoteAppUpdated:o.apiKey!==f,localApp:r,developerPlatformClient:n,commandOptions:t,network:w,partnerUrlsUpdated:E,graphiqlPort:c,graphiqlKey:t.graphiqlKey,apiSecret:m}}async function la(t){await pa(t)}async function pa(t){let{developerPlatformClient:e,remoteApp:r}=t;(await e.appExtensionRegistrations(r)).app.extensionRegistrations.filter(n=>n.type.toLowerCase()!=="webhook_subscription").every(n=>n.id)||Nn()}async function ua(t){Jr({directory:t.commandOptions.directory,previousAppId:t.remoteApp.apiKey}),await ha({devOptions:t.commandOptions,tunnelUrl:t.network.proxyUrl,shouldUpdateURLs:t.partnerUrlsUpdated,storeFqdn:t.storeFqdn}),await qt({config:t.commandOptions.commandConfig,exitMode:"ok"})}async function da(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:l}=J(t),m=!1;if((l??i)&&e){let c=Zr(r.proxyUrl,t.map(({configuration:u})=>u.auth_callback_path).find(u=>u),o.configuration.app_proxy);m=await to({currentURLs:r.currentUrls,appDirectory:o.directory,cachedUpdateURLs:n,newApp:s.newApp,localApp:o,apiKey:a,newURLs:c}),m&&o.setDevApplicationURLs(c)}return m}async function ma(t,e,r,o,n,s,a){let{backendConfig:i,frontendConfig:l}=J(e);await ga(e,r);let m=o.mode==="use-localhost"?{noTunnelUseLocalhost:!0,port:o.actualPort}:{noTunnelUseLocalhost:!1,tunnelUrl:o.mode==="custom"?o.url:void 0,tunnelClient:n},[{frontendUrl:c,frontendPort:u,usingLocalhost:g},w,d]=await Promise.all([Xr(m),kt()??i?.configuration.port??M(),eo(s)]),f=g?`${c}:${u}`:c,S=l?.configuration.port;l&&(S??=l===i?w:await M(),l.configuration.port=S),S=S??await M();let E;if(o.mode==="use-localhost"){let{keyContent:R,certContent:x,certPath:C}=await On({appDirectory:t,forceInstall:a});E={key:R,cert:x,certPath:C,port:o.actualPort}}return{proxyUrl:f,proxyPort:u,frontendPort:S,backendPort:w,currentUrls:d,webs:e,reverseProxyCert:E}}async function fa({processes:t,previewUrl:e,graphiqlUrl:r,config:o,devSessionStatusManager:n,abortController:s}){let a=o.commandOptions.devInstance,i=t.map(w=>({prefix:w.prefix,action:async(f,S,E)=>{let R=w.function,x=a?a.tee(f,{source:w.prefix,stringWritesAreMessages:!0}):f,C=a?a.tee(S,{source:w.prefix,stringWritesAreMessages:!0}):S;return R({stdout:x,stderr:C,abortSignal:E},w.options)}}));if(a){let w={storeFqdn:o.storeFqdn,previewUrl:e,graphiqlUrl:r,appUrl:o.localApp.devApplicationURLs?.applicationUrl,localUrl:o.network.proxyUrl};await a.update({status:"running",details:{...w,preview:Wn(n.status)}}),await a.log({source:"app dev",level:"info",message:`Preview URL: ${e}`}),r&&await a.log({source:"app dev",level:"info",message:`GraphiQL URL (Admin API): ${r}`})}let l=o.developerPlatformClient,m={id:o.remoteApp.id,developerPlatformClient:l},c,u=w=>{let d=[a?.update({details:{preview:Wn(w)}})],f=w.statusMessage;f&&(f.message!==c?.message||f.type!==c?.type)&&d.push(a?.log({source:"app dev",level:f.type==="error"?"error":"info",message:f.message})),c=f,Promise.all(d).catch(S=>{y(`Failed to save dev status: ${S.message}`)})};a&&(n.on("dev-session-update",u),u(n.status));let g=()=>s.abort(a?.abortSignal.reason);try{a?.abortSignal.throwIfAborted(),a?.abortSignal.addEventListener("abort",g,{once:!0}),await Ln({processes:i,previewUrl:e,graphiqlUrl:r,app:m,abortController:s,shopFqdn:o.storeFqdn,devSessionStatusManager:n,appURL:o.localApp.devApplicationURLs?.applicationUrl,appName:o.remoteApp.title,organizationName:o.commandOptions.organization.businessName,configPath:o.localApp.configPath,localURL:o.network.proxyUrl}),a?.abortSignal.throwIfAborted()}finally{a?.abortSignal.removeEventListener("abort",g),a&&n.off("dev-session-update",u)}}function Wn({isReady:t,statusMessage:e,errors:r}){let o=t?"ready":"starting";return t&&e?.type==="loading"&&(o="updating"),e?.type==="error"&&(o="error"),{state:o,message:e?.message??null,errors:r??[]}}async function ha(t){let e=await Mn(t.devOptions.commandConfig,t.tunnelUrl);await Q.addPublicMetadata(()=>({cmd_dev_tunnel_type:e,cmd_dev_tunnel_custom_hash:e==="custom"?Je(t.tunnelUrl):void 0,cmd_dev_urls_updated:t.shouldUpdateURLs,store_fqdn_hash:Je(t.storeFqdn),store_domain:t.storeFqdn,cmd_app_dependency_installation_skipped:t.devOptions.skipDependenciesInstallation})),await Q.addSensitiveMetadata(()=>({store_fqdn:t.storeFqdn,cmd_dev_tunnel_custom:e==="custom"?t.tunnelUrl:void 0}))}async function ga(t,e){let r=t.map(n=>n.configuration.port).filter(n=>n),o=r.find((n,s)=>r.indexOf(n)!==s);if(o)throw new _(`Found port ${o} for multiple webs.`,"Please define a unique port for each web.");await Promise.all([...r.map(async n=>{if(!await ot(n))throw new _(`Hard-coded port ${n} is not available, please choose a different one.`)}),(async()=>{if(!await ot(e)){let s=`Port ${e} is not available for serving GraphiQL.`,a=["Choose a different port for the",{command:"--graphiql-port"},"flag."];throw new _(s,a)}})()])}p();var Gn=h.object({state:h.enum(["starting","updating","ready","error"]),message:h.string().nullable(),errors:h.array(h.string())}).strict().describe("The CLI-reported preview state in the instance file; this is not a health check."),wa=h.object({schemaVersion:h.literal(1),sessionId:h.string(),command:h.literal("app dev"),key:h.string().optional(),pid:h.number().int().positive(),status:h.enum(["starting","running"]),startedAt:Ye,updatedAt:Ye,directory:h.string(),logFile:h.string(),details:h.object({configPath:h.string(),appName:h.string(),clientId:h.string(),storeFqdn:h.string().optional(),previewUrl:h.string().optional(),graphiqlUrl:h.string().optional(),appUrl:h.string().optional(),localUrl:h.string().optional(),preview:Gn.optional()}).strict()}).strict().describe("The instance JSON file under .shopify/dev/. This object is not emitted to stdout."),jn=St({name:ct.name,schema:ct.schema,definitions:{DevInstance:wa,DevPreview:Gn}});p();async function Bn({useLocalhost:t,localhostPort:e,tunnelUrl:r}){if(r)return{mode:"custom",url:r};if(!t&&!e)return{mode:"auto"};let o=e??pe.localhost,n=await M(o);if(e&&n!==o){let s=`Port ${e} is not available.`,a=["Choose a different port for the",{command:"--localhost-port"},"flag."];throw new _(s,a)}return{mode:"use-localhost",requestedPort:o,actualPort:n}}var k=ie(Vn(),1);var Et=class t extends mo{static get requiresSyncAnalytics(){return!0}static summary="Run the app.";static descriptionWithMarkdown="Builds and previews your app on a dev store, and watches for changes. [Read more about testing apps locally](https://shopify.dev/docs/apps/build/cli-for-apps/test-apps-locally).";static jsonOutputSchema=jn;static description=this.descriptionForHelp();static flags={...ar,...Br,...ir,"client-id":k.Flags.string({hidden:!1,description:"The Client ID of your app. Use with --config to run dev with that configuration for a different app than the one it is linked to.",env:"SHOPIFY_FLAG_CLIENT_ID"}),store:k.Flags.string({char:"s",description:"Store URL. Must be an existing development or Shopify Plus sandbox store.",env:"SHOPIFY_FLAG_STORE",parse:async e=>be(e)}),"skip-dependencies-installation":k.Flags.boolean({description:"Skips the installation of dependencies. Deprecated, use workspaces instead.",env:"SHOPIFY_FLAG_SKIP_DEPENDENCIES_INSTALLATION",default:!1}),"no-update":k.Flags.boolean({description:"Uses the app URL from the toml file instead an autogenerated URL for dev.",env:"SHOPIFY_FLAG_NO_UPDATE",default:!1}),"unsafe-validation":k.Flags.boolean({description:"Allow app dev to continue with warnings for eligible app version validation failures.",env:"SHOPIFY_FLAG_UNSAFE_VALIDATION",default:!1}),"subscription-product-url":k.Flags.string({description:'Resource URL for subscription UI extension. Format: "/products/{productId}"',env:"SHOPIFY_FLAG_SUBSCRIPTION_PRODUCT_URL"}),"checkout-cart-url":k.Flags.string({description:'Resource URL for checkout UI extension. Format: "/cart/{productVariantID}:{productQuantity}"',env:"SHOPIFY_FLAG_CHECKOUT_CART_URL"}),"tunnel-url":k.Flags.string({description:'Use a custom tunnel, it must be running before executing dev. Format: "https://my-tunnel-url:port".',env:"SHOPIFY_FLAG_TUNNEL_URL",exclusive:["tunnel"]}),"use-localhost":k.Flags.boolean({description:"Service entry point will listen to localhost. A tunnel won't be used. Will work for testing many app features, but not those that directly invoke your app (E.g: Webhooks)",env:"SHOPIFY_FLAG_USE_LOCALHOST",exclusive:["tunnel-url"]}),"install-mkcert":k.Flags.boolean({description:"Install and use mkcert to generate localhost certificates when --use-localhost is enabled without prompting.",env:"SHOPIFY_FLAG_INSTALL_MKCERT",dependsOn:["use-localhost"]}),"localhost-port":Ie({description:"Port to use for localhost.",env:"SHOPIFY_FLAG_LOCALHOST_PORT"}),theme:k.Flags.string({char:"t",description:"Theme ID or name of the theme app extension host theme.",env:"SHOPIFY_FLAG_THEME"}),"theme-app-extension-port":Ie({description:"Local port of the theme app extension development server.",env:"SHOPIFY_FLAG_THEME_APP_EXTENSION_PORT"}),"store-password":k.Flags.string({description:"The password for storefronts with password protection.",env:"SHOPIFY_FLAG_STORE_PASSWORD"}),notify:k.Flags.string({description:"The file path or URL. The file path is to a file that you want updated on idle. The URL path is where you want a webhook posted to report on file changes.",env:"SHOPIFY_FLAG_NOTIFY"}),"graphiql-port":Ie({hidden:!0,description:"Local port of the GraphiQL development server.",env:"SHOPIFY_FLAG_GRAPHIQL_PORT"}),"graphiql-key":k.Flags.string({hidden:!0,description:"Key used to authenticate GraphiQL requests. By default, a key is automatically derived from the app secret. Use this flag to override with a custom key.",env:"SHOPIFY_FLAG_GRAPHIQL_KEY"})};static analyticsStopCommand(){return"app dev stop"}async run(){let{flags:e}=await this.parse(t),r=await Bn({useLocalhost:e["use-localhost"]??!1,tunnelUrl:e["tunnel-url"],localhostPort:e["localhost-port"]});await Ht(()=>({cmd_app_dependency_installation_skipped:e["skip-dependencies-installation"],cmd_app_reset_used:e.reset,cmd_dev_tunnel_type:r.mode})),await oo(e.path);let o=await uo({directory:e.path,clientId:e["client-id"],forceRelink:e.reset,userProvidedConfigName:e.config});return qn({...o,json:e.json},async n=>{let s=await fo({appContextResult:o,storeFqdn:e.store,forceReselectStore:e.reset,storeCreationMode:"selection-option",devSession:!0}),a={...o,store:s,directory:e.path,update:!e["no-update"],unsafeValidation:e["unsafe-validation"],skipDependenciesInstallation:e["skip-dependencies-installation"],commandConfig:this.config,subscriptionProductUrl:e["subscription-product-url"],checkoutCartUrl:e["checkout-cart-url"],theme:e.theme,themeExtensionPort:e["theme-app-extension-port"],storePassword:e["store-password"],notify:e.notify,graphiqlPort:e["graphiql-port"],graphiqlKey:e["graphiql-key"],installMkcert:e["install-mkcert"],tunnel:r,devInstance:n};return await Hn(a),{app:o.app}})}};export{ei as a,Et as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as h}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-XEZPN5TR.js";import{Ba as g,ta as u,va as c}from"./chunk-ZMOW2YZ4.js";import{c as f,p}from"./chunk-IWTNUJGY.js";import{g as l}from"./chunk-VKWPEFWQ.js";l();var d=f(p(),"/docs-shopify.dev/commands"),m=class extends h{static description="Generate CLI commands documentation";static hidden=!0;async run(){let a=this.config.commands;await g(d),await c(d);let o=a.sort((e,i)=>e.id.length-i.id.length).filter(e=>!b(e)).map(e=>{let i=k(e);return N(e,i)});await Promise.all(o)}},C=["commands","help","plugins"];function b(t){return t.hidden?(C.push(t.id),!0):t.pluginType==="user"?!0:C.some(a=>t.id.startsWith(`${a}:`))}function k(t){let a=t.id.replace(/[:]/g," "),s=t.id.replace(/[:]/g,"-"),o=t.id.replace(/[:-]/g,"");return{commandName:a,fileName:s,interfaceName:o}}async function N(t,{commandName:a,fileName:s,interfaceName:o}){let e=Object.keys(t.flags).map(r=>{let n=t.flags[r];if(!n||n.hidden)return;let $=n.description??"",w=n.char?`-${n.char}, `:"",y=n.type==="option"?"string":"''",v=n.type==="option"?" <value>":"",x=n.required?"":"?",D=n.env!==void 0?` @environment ${n.env}`:"";return` /**
|
|
2
2
|
* ${$}
|
|
3
3
|
*${D}
|
|
4
4
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./chunk-5HOZDOJ7.js";import{a as p,b as m}from"./chunk-AVJJGQOP.js";import{d as r,j as c}from"./chunk-5534MHZW.js";import{a as s}from"./chunk-RSZAAN37.js";import{P as a}from"./chunk-HMPRWNGG.js";import{c as n}from"./chunk-DMOLPSXF.js";import{g as o}from"./chunk-VKWPEFWQ.js";o();var t=class u extends s{static summary="Schedules manual-billing subscriptions to migrate to Shopify-managed app pricing.";static descriptionWithMarkdown="Schedules manual-billing subscriptions to migrate to Shopify-managed app pricing.\n\nWhen `--input` is omitted, the command reads CSV data from stdin. Use `--input <path>` to read from a file. `--input -` is also supported as an explicit stdin path.\n\n- Required CSV columns: `shop_id`, `target_plan_handle`, and `price_behavior`.\n- Optional CSV column: `notification`.\n- Example header: `shop_id,target_plan_handle,price_behavior,notification`.\n- Example row: `123456789,pro,HONOR_BILLING_PRICE,WHEN_REQUIRED`.\n\n`price_behavior` must be `HONOR_BILLING_PRICE` or `PLAN_PRICE`. `notification` can be `OPT_OUT` or `WHEN_REQUIRED` and defaults to `WHEN_REQUIRED` when omitted or blank.\n\nValidation is atomic: the command submits no operations unless the entire CSV is valid. Valid rows are submitted in batches of 250 shops. Preserve every operation GID printed by the command so you can check or cancel the submitted operations.\n\nRun the command from an app project. By default, it uses the Client ID from the active app configuration. Use `--path` to select an app directory or `--config` to select a configuration. Pass `--client-id` to select a different app within the project. Use `--reset` to relink the app.\n\nUse `--force` to skip confirmation and immediately submit every valid row. With `--watch`, human-readable output shows accepted identifiers before polling begins, then displays operation progress and the final outcome. With `--json --watch`, the command outputs one structured JSON document after every operation reaches a terminal status.";static jsonOutputSchema=c;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %> --input migrations.csv --force","cat migrations.csv | <%= config.bin %> <%= command.id %> --force","<%= config.bin %> <%= command.id %> --input migrations.csv --path ../my-app --config staging --force --json","<%= config.bin %> <%= command.id %> --input migrations.csv --client-id <client-id> --force","<%= config.bin %> <%= command.id %> --input - --force --watch"];static flags={...r,...n};async run(){let{flags:i}=await this.parse(u),{app:l,remoteApp:h}=await a({directory:i.path,clientId:i["client-id"],forceRelink:i.reset,userProvidedConfigName:i.config}),f=await d({action:"schedule",input:i.input??"-",clientId:h.apiKey,skipConfirmation:i.force,watch:i.watch,...i.watch&&!i.json?{onSubmissionAccepted:p}:{}}),e=m(f,{json:i.json,watch:i.watch});return e!==0&&(process.exitCode=e),{app:l}}};export{t as a};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import{a as Be,b as Ke,e as P,f as gn,g as mn}from"./chunk-FKKJQGYX.js";import{a as Xe,b as l,c as C,d as hn,e as fn}from"./chunk-4FWPOGPQ.js";import{b as bn}from"./chunk-ZMU4EYXT.js";import{a as rn,d as on,e as an,f as cn,g as ne,h as dn}from"./chunk-G3RNO2TC.js";import{$ as D,B as m,E as Ve,Q as ze,S as Je,W as Qe,Z as N,a as Ge,aa as j,ba as Ze,da as ee,ea as en,fa as nn,ga as tn,ha as sn,ia as k,ja as te,la as M,ma as se,n as He,na as ie,o as Ye,oa as un,pa as ln,qa as re,ra as pn,u as v,v as X,w as x,x as Z,z as qe}from"./chunk-A2NSORBM.js";import{b as Ue}from"./chunk-XEZPN5TR.js";import{a as _e}from"./chunk-JIY6XWSC.js";import{b as Me,c as We}from"./chunk-DMOLPSXF.js";import{A as De,C as J,D as je,I as Pe,U as Le,x as xe,y as Ne,z}from"./chunk-2KUM2RU4.js";import{a as Fe}from"./chunk-QBRRFFMZ.js";import{a as Re}from"./chunk-LG3KEHGD.js";import{i as R}from"./chunk-TD6JBHUS.js";import{Xa as Te,ga as Ee,zb as Q}from"./chunk-ZMOW2YZ4.js";import{b as a,d as F,e as Ie}from"./chunk-3PYDIBTX.js";import{a as Oe}from"./chunk-DOLVBTCB.js";import{b as kt}from"./chunk-AE3IQG7S.js";import{d as I,f as Ce}from"./chunk-IWTNUJGY.js";import{e as St,g as b}from"./chunk-VKWPEFWQ.js";b();b();import{isDeepStrictEqual as ae}from"node:util";var At=12,$t={resolveSelection:Je,loadResults:bn,recordMetadata:Xe};function _t(e,n){let t=n.checkIds.length>0?{checkIds:n.checkIds}:null,s=n.failOnUnresolved??!1,i=e.sources.deterministic!==null||e.sources.agent!==null,r=It(e.checks);if(t&&(i||s)){let d=e.checks.map(u=>u.id);Tt(t.checkIds,s?[...d,...r]:d)}let o=t?e.checks.filter(d=>t.checkIds.includes(d.id)):e.checks,c=W(e.checks);return{resultsDirectory:n.resultsDirectory,sources:e.sources,allChecks:e.checks,checks:o,filter:t,scopeDiffers:Et(e.sources),suppressions:e.suppressions,findingNumbers:new Map(c.map(({finding:d,number:u})=>[d,u])),likelyFindingNumbers:Rt(e,c),resultsDigest:i?Ct(c):null,blocking:{level:n.blocking,blockedChecks:Ke(o,n.blocking)},failOnUnresolved:s,unresolvedChecks:o.filter(d=>d.status==="unresolved").length,missingCheckIds:t?r.filter(d=>t.checkIds.includes(d)):r}}function E(e){return e.blocking.blockedChecks>0||e.failOnUnresolved&&(e.unresolvedChecks>0||e.missingCheckIds.length>0)}function It(e){let n=new Set(e.map(t=>t.id));return Ye().filter(t=>!n.has(t))}function W(e){return e.flatMap(n=>n.findings.map(t=>({check:n,finding:t}))).map((n,t)=>({...n,number:t+1}))}function Rt(e,n){return new Map(e.suppressions.flatMap(({index:t,entry:s,likely_finding:i})=>{if(i===void 0)return[];let o=e.sources[s.source]?.document.checks.find(({id:d})=>d===s.check)?.findings[i.index],c=n.find(({check:d,finding:u})=>d.id===s.check&&u.source===s.source&&ae(Rn(u),o));return c?[[t,c.number]]:[]}))}function Ct(e){let n=e.map(({check:t,finding:{disposition:s,suppressed_by:i,...r}})=>[t.id,r]);return Fe(JSON.stringify(n)).toString("hex").slice(0,At)}function Et({deterministic:e,agent:n}){return!e||!n?!1:JSON.stringify(e.document.coverage.scope)!==JSON.stringify(n.document.scope)}function Tt(e,n){let t=e.filter(r=>!n.includes(r));if(t.length===0)return;let s=t.length===1?"check ID":"check IDs",i=new R(`Unknown ${s}: ${t.join(", ")}.`,"Pass --check-id with one of the available check IDs.",[],[{title:"Available check IDs",body:{list:{items:n}}}]);throw i.code="unknown-check-id",i.details={checkIds:t},i}async function ce(e,n=$t){let t=e.suppress?Dt(e.suppress):void 0,s=await n.resolveSelection({path:e.directory,config:e.configName,clientId:e.clientId,withoutAppConfig:e.withoutAppConfig,allowPrompts:!1,validateClientIdFlag:!0}),i=async()=>{let g=await n.loadResults(s,e.directory),p=_t(g,{resultsDirectory:Ve(s.appDirectory,ze(s)).resultsDirectory,checkIds:e.checkIds,blocking:e.blocking,failOnUnresolved:e.failOnUnresolved});return{results:g,result:p}},r=await i(),o=e.suppress&&t?Nt(await oe(s,r.results,r.result,e.suppress,t)):void 0,c=e.interactive?Lt(r.results,r.result):new Map,d=e.interactive?await e.interactive({result:r.result,findings:yn(r.result,Ft),supersededFindings:yn(r.result,xt),suppress:async({findingNumber:g,decision:p,includeSuperseded:S})=>{let _=await i(),U={findingNumber:g,resultsDigest:r.result.resultsDigest??void 0,includeSuperseded:S};return oe(s,_.results,_.result,U,{decision:p,missing:[]})},reattachments:c,reattach:async g=>{let p=c.get(g);if(!p)return A(Cn(g));let S=await i(),_={findingNumber:g,resultsDigest:r.result.resultsDigest??void 0,includeSuperseded:!1,reattachment:p};return oe(s,S.results,S.result,_,{decision:{},missing:[]})}}):void 0,{results:u,result:f}=o!==void 0||d!==void 0?await i():r;if(f.sources.deterministic!==null||f.sources.agent!==null){let g=f.allChecks.reduce((p,S)=>p+v(S).length,0);await n.recordMetadata({num_security_findings:g})}return{selection:s,result:f,commands:Qe(s,e.directory,u.sources.deterministic?.document.coverage.scope),...o?{savedSuppressions:o}:{},...d?{interactiveReview:d}:{}}}function yn(e,n){let t=new Set(e.checks.map(s=>s.id));return W(e.allChecks).filter(({check:s,finding:i})=>t.has(s.id)&&n(i))}function Ft(e){return e.disposition==="active"}function xt(e){return e.disposition==="superseded"&&e.suppressed_by===void 0}function Nt(e){if(e.status==="saved")return e.savedSuppressions;let{code:n,message:t,tryMessage:s,details:i,errors:r}=e.refusal;if(r!==void 0)throw An(r);let o=new R(t,s);throw o.code=n,o.details=i,o}function Dt(e){let n=on(e);if(n.ok)return n;throw An(n.errors)}var Sn="The suppression could not be saved because a flag is invalid.",kn="Pass --kind false-positive or --kind accepted-risk, and a --reason that explains the decision.";function An(e){let n=new R(Sn,kn,[],[{title:"Errors",body:{list:{items:e}}}]);return n.code="suppression-flags-invalid",n.details={errors:e},n}function jt(e){return{code:"suppression-flags-invalid",message:Sn,tryMessage:kn,details:{errors:e},errors:e}}function Pt({kind:e,reason:n}){return e===void 0||n===void 0?void 0:{kind:e,reason:n}}function $n(e,n){return{kind:n.kind??e.kind,reason:n.reason??e.reason}}function vn(e,n,t){let[s]=[...n.likelyFindingNumbers].find(([,r])=>r===t)??[],i=s===void 0?void 0:e.suppressions[s]?.entry;return s===void 0||i===void 0?void 0:{index:s,entry:i}}function _n(e){return{deterministic:e.sources.deterministic?.document??null,agent:e.sources.agent?.document??null}}function Lt(e,n){let t=W(n.allChecks),s=e.suppressions.map(({entry:i})=>i);return new Map([...n.likelyFindingNumbers].flatMap(([i,r])=>{let o=t.find(({number:u})=>u===r),c=s[i];if(!o||!c)return[];let d=ne(In(e,o),i,$n(c,{}),_n(e),s);return d.status!=="change"||d.change.type!=="replace-code"?[]:[[r,{entryIndex:i,entry:c,code:d.change.code}]]}))}async function oe(e,n,t,s,{decision:i,missing:r}){if(s.resultsDigest!==void 0&&s.resultsDigest!==t.resultsDigest)return A(Ut(s.resultsDigest,t.resultsDigest));let o=W(t.allChecks),c=o.find(({number:h})=>h===s.findingNumber),d=c?vn(n,t,c.number):void 0;if(s.reattachment){if(!d)return A(Cn(s.findingNumber));let{entryIndex:h,entry:y}=s.reattachment;if(d.index!==h||!ae(d.entry,y))return A({code:"finding-not-suppressible",message:`The stale suppression for finding ${s.findingNumber} changed during the review. Nothing was saved.`,tryMessage:"Run the review again to see the current entry before re-attaching it.",details:{findingNumber:s.findingNumber}})}let u=c?.finding.suppressed_by?.origin==="file"?c.finding.suppressed_by:void 0,f=d?.entry??(s.includeSuperseded?u:void 0),g=f?$n(f,i):Pt(i);if(!g)return A(jt(r));if(!c)return A(Mt(s.findingNumber,o.length));let p=Ot(c,o),S=c.finding.suppressed_by!==void 0,_=s.includeSuperseded&&u!==void 0;if(S&&!_)return A(wn(c));let U=[...S?[]:[c],...s.includeSuperseded?p:[]];if(U.length===0)return A(wn(c));let ke=_n(n),q=n.suppressions.map(({entry:h})=>h),Ae=U.map(h=>{let y=In(n,h),$e=vn(n,t,h.number);return{numberedFinding:h,plan:$e?ne(y,$e.index,g,ke,q):cn(y,g,ke,q)}}),K=Ae.find(({plan:h})=>h.status==="refused");if(K?.plan.status==="refused")return A(Wt(K.numberedFinding,K.plan,o));let V=Ae.flatMap(({numberedFinding:h,plan:y})=>y.status==="change"?[{findingNumber:h.number,findingSuperseded:h.finding.disposition==="superseded",change:y.change}]:[]),{path:vt,saved:wt}=await dn(e.appDirectory,V.map(({change:h})=>h),q);return{status:"saved",savedSuppressions:{path:vt,saved:wt.map((h,y)=>({...h,findingNumber:V[y].findingNumber,findingSuperseded:V[y].findingSuperseded})),companionNumbers:s.includeSuperseded?[]:p.map(({number:h})=>h)}}}function A(e){return{status:"refused",refusal:e}}function Ot(e,n){if(e.finding.source!=="agent")return[];let t=I(e.finding.location.file),s=n.filter(({check:o,finding:c})=>o.id===e.check.id&&c.source==="deterministic"&&c.disposition==="superseded"&&I(c.location.file)===t),i=s.filter(({finding:o})=>o.location.line===e.finding.location.line);return(i.length>0?i:s).filter(({finding:o})=>o.suppressed_by?.origin!=="file")}function In(e,{check:n,finding:t}){let{source:s}=t,i=Rn(t),o=e.sources[s]?.document.checks.find(({id:c})=>c===n.id)?.findings.findIndex(c=>ae(c,i))??-1;return{source:s,checkId:n.id,findingIndex:o,finding:i}}function Rn(e){let{source:n,disposition:t,suppressed_by:s,...i}=e;return i}function Cn(e){return{code:"finding-not-suppressible",message:`Finding ${e} is no longer the likely finding of a stale entry. Nothing was saved.`,tryMessage:`Choose Suppress to save a new entry for it, or run the review again to see the stale entries of ${m}.`,details:{findingNumber:e}}}function Ut(e,n){return{code:"results-digest-mismatch",message:`The results changed since digest ${e}, so the finding numbers may name other findings. Nothing was saved.`,tryMessage:"Run the review again, check the number of the finding, and pass the new digest with --results-digest.",details:{resultsDigest:n}}}function Mt(e,n){return{code:"finding-not-found",message:`No finding has number ${e}. Nothing was saved.`,tryMessage:n===0?"The results have no findings.":`The findings are numbered from 1 to ${n}. Run the review to see their numbers.`,details:{findingNumber:e,findingCount:n}}}function wn({number:e,finding:n}){let t=n.suppressed_by?.origin==="file",s=n.suppressed_by?.origin==="file"?`suppressions[${n.suppressed_by.entry_index}] in ${m}`:"the agent";return{code:"finding-not-suppressible",message:`Finding ${e} is already suppressed by ${s}. Nothing was saved.`,tryMessage:t?`To change the suppression, edit ${m}.`:`The agent's suppression applies to these results only. To save one in ${m}, record the agent findings again without it, then suppress the finding.`,details:{findingNumber:e,disposition:n.disposition}}}function Wt(e,n,t){return{code:"finding-not-suppressible",message:`Finding ${e.number} can't be suppressed: ${n.problem}. Nothing was saved.`,tryMessage:Bt(e,n,t),details:{findingNumber:e.number}}}function Bt(e,{withoutCode:n,invalidFields:t},s){return t?Gt(e,t):n?Ht(e,s):`Add an entry for it to ${m} by hand, with a code that names it alone.`}function Gt({check:e,finding:n},t){if(t.includes("check")){let s=n.source==="agent"?"have your coding agent run check and record its findings again":"run check again";return[`This version of the CLI has no ${n.source} check ${e.id}, so an entry for it by hand would make ${m} invalid too.`,`The results may be from another version of the CLI. To update them, ${s}.`].join(" ")}return t.includes("path")?[`${m} can't name the path ${I(n.location.file)}, so no entry can suppress this finding.`,"An entry for it by hand would make the file invalid too."].join(" "):`An entry for it by hand with the same values would make ${m} invalid too.`}function Ht({check:e,finding:n},t){let s=I(n.location.file),i=t.filter(o=>o.check.id===e.id&&o.finding.source===n.source&&I(o.finding.location.file)===s).map(o=>o.number);return["The automatic code selectors did not select this finding alone. You can try a manual entry with a code that names it alone.",`${n.source==="agent"?"An agent entry":"A deterministic entry"} for ${e.id} in ${s} without code suppresses all ${l(i.length,`${n.source} finding`)} of that check in that file: ${C(i)}.`,`Add either entry to ${m} by hand. Omit code only if you intend to suppress all of these findings.`].join(" ")}b();b();var de={high:"High",medium:"Medium",low:"Low"},En={executed:"passed",not_applicable:"not applicable",unresolved:"unresolved"},Yt="no deterministic findings",qt={executed:"executed",not_applicable:"not applicable",unresolved:"unresolved"},B=["deterministic","agent"],Kt={deterministic:"deterministic-findings.json",agent:"agent-findings.json"},Tn=3,Vt="Agent findings were recorded for a different scope than the latest scan.",Nn="agent result stale",zt="The agent result is older than the deterministic result, so both are shown.",Jt={info:xe,success:Ne,warning:z,error:De};function Dn(e){for(let n of Qt(e))$(n)}function $(e){Jt[e.type](e.options)}function Qt(e){let{checks:n,filter:t,suppressions:s}=e.result,i=Mn(e).ids,r=p=>e.result.findingNumbers.get(p),o=n.filter(p=>p.status==="unresolved"&&v(p).length===0),c=n.filter(p=>p.status!=="unresolved"&&v(p).length===0),d=n.filter(p=>v(p).length>0),u=Cs(e.result),f=gn(n,s),g=mn(t?s.filter(p=>t.checkIds.includes(p.entry.check)):s,Xt(e));return[...o.length>0?[Ts(o,e.verbose,r)]:[],...u.length>0?[Es(u)]:[],...c.length>0?[Fs(c,i,e.verbose,r)]:[],...d.map(p=>Ds(p,e.verbose,e.now,r)),...f?[as(f)]:[],...g?[cs(g)]:[],Is(ds(e)),...e.savedSuppressions?[ss(e.savedSuppressions)]:[],...e.interactiveReview?[rs(e.interactiveReview)]:[]]}function Xt({result:e,commands:n}){let t=e.resultsDigest===null?[]:["--results-digest",e.resultsDigest];return{review:N(n.review),reattach:{findingNumbers:e.likelyFindingNumbers,command:s=>N({...n.review,args:[...n.review.args,"--suppress",String(s),...t]})}}}var Zt={added:"added","code-replaced":"re-attached"};function ue({index:e,change:n,entry:t,previous:s,findingNumber:i,findingSuperseded:r}){return{title:`suppressions[${e}] \xB7 finding ${i} \xB7 ${Zt[n]}`,body:[`${t.source} ${t.check} in`,{filePath:t.path},...s?ns(t,s):es(t),...r?[`
|
|
2
|
+
${ts(i)}`]:[]]}}function es(e){return[{subdued:`
|
|
3
|
+
Kind: ${P[e.kind]}`},...e.code===void 0?[]:[{subdued:`
|
|
4
|
+
Code: ${e.code}`}],{subdued:`
|
|
5
|
+
Reason: ${e.reason}`}]}function ns(e,n){let t=e.kind===n.kind?"kept":`replaced, it was ${P[n.kind]}`,s=e.reason===n.reason;return[{subdued:`
|
|
6
|
+
Kind: ${P[e.kind]} (${t})`},...n.code===void 0?[]:[{subdued:`
|
|
7
|
+
Old code: ${n.code}`}],...e.code===void 0?[]:[{subdued:`
|
|
8
|
+
New code: ${e.code}`}],{subdued:`
|
|
9
|
+
Reason (${s?"kept":"replaced"}): ${e.reason}`},...s?[]:[{subdued:`
|
|
10
|
+
Old reason: ${n.reason}`}]]}function ts(e){return`The agent result supersedes finding ${e} in the review, but check --blocking, which reads no agent results, counts it. This entry suppresses it for check --blocking.`}var jn={title:"Next steps",body:{list:{items:[`Review and commit ${m}.`]}}};function le(e){return`Saved ${l(e.length,"suppression")} to ${m}.`}function ss({saved:e,companionNumbers:n}){let t=e.map(ue),s=n.length===0?[]:[{title:"Not suppressed",body:`${Ln(n)} the same check in the same file, so check --blocking, which reads no agent results, still counts ${n.length===1?"it":"them"}. To suppress ${n.length===1?"it":"them"} with the same kind and reason, run the command again with --include-superseded.`}];return{type:"success",options:{headline:le(e),customSections:[...t,...s,jn]}}}function Pn({number:e,check:n,finding:t},s,i){return{type:n.severity==="high"?"error":"warning",options:{headline:`${de[n.severity]} \xB7 ${n.id} \xB7 ${n.title}`,body:{subdued:s},...n.docs_url?{link:{label:`${n.id} on shopify.dev`,url:n.docs_url}}:{},customSections:[H(t,e,!0),...i?[is(i)]:[]]}}}function is({entryIndex:e,entry:n,code:t}){return{title:`Stale entry suppressions[${e}] \xB7 ${P[n.kind]}`,body:["Its code matches no finding, and the code of this finding is similar. Re-attach gives the entry this finding's code, and keeps its kind and reason.",{subdued:`
|
|
11
|
+
Reason: ${n.reason}`},...n.code===void 0?[]:[{subdued:`
|
|
12
|
+
Old code: ${n.code}`}],{subdued:`
|
|
13
|
+
New code: ${t}`}]}}function pe(e){return{type:"success",options:{headline:le(e),customSections:e.map(ue)}}}function rs({saved:e,declinedCompanions:n,ending:t,resultsDigest:s}){let r={finished:void 0,quit:"You quit the review. The suppressions you saved are kept.","results-changed":"The review stopped because the results changed. The suppressions you saved are kept."}[t],o=r===void 0?{}:{body:r};if(e.length===0)return{type:"info",options:{headline:`No suppressions saved to ${m}.`,...o}};let c=n.length===0?[]:[{title:"Not suppressed",body:{list:{items:n.map(d=>os(d,s))}}}];return{type:"success",options:{headline:le(e),...o,customSections:[...e.map(ue),...c,jn]}}}function os({findingNumber:e,companionNumbers:n},t){let s=n.length===1?"it":"them",i=t===null?"":` --results-digest ${t}`;return`${Ln(n)} the same check in the same file as finding ${e}, so check --blocking, which reads no agent results, still counts ${s}. To suppress ${s}, run the review with --suppress ${e} --include-superseded${i} and the same --kind and --reason.`}function Ln(e){return e.length===1?`Finding ${e[0]} is a superseded deterministic finding of`:`Findings ${C(e)} are superseded deterministic findings of`}function as({headline:e,counts:n,sections:t}){return{type:"info",options:{headline:e,customSections:[{body:n},...t]}}}function cs({headline:e,needsChange:n,sections:t}){return{type:n?"warning":"info",options:{headline:e,customSections:t}}}function ds(e){let{result:n}=e,t=n.sources.deterministic!==null||n.sources.agent!==null,s=Z(n.checks),i=n.sources.deterministic?.document,r=n.checks.filter(x).length,o=Mn(e),c=E(n);return{type:bs(n.checks,s,t,o.total,c),headline:ys(n.checks,s,t),...n.filter&&t?{filterLine:`Showing ${n.checks.length} of ${n.allChecks.length} checks (--check-id).`}:{},checksWithFindings:n.checks.filter(d=>v(d).length>0).map(vs),otherChecks:Ss(n.checks,o.ids,s),...t&&o.total>0?{agentResultsPending:ms(o)}:{},...r>0?{staleAgentResults:fs(r)}:{},...i?{coverage:ks(i)}:{},scopeLines:As(n.sources),...n.scopeDiffers?{scopeNote:Vt}:{},resultsFiles:{directory:n.resultsDirectory,rows:B.map(d=>$s(d,n.sources[d]?.document,e.now))},...n.resultsDigest===null?{}:{resultsDigest:n.resultsDigest},...c?{blocking:Un(n)}:{nextSteps:_s(n,s,t,r,o.total,e.commands)}}}function us({blockedChecks:e,level:n}){return`${l(e,"check")} at or above ${n} (--blocking ${n}).`}function ls(e){let n=ps(e),t=E(e)?Un(e):void 0;if(!(n===void 0&&t===void 0))return{...n===void 0?{}:{headline:n},...t===void 0?{}:{customSections:[{title:"Blocking",body:t}]}}}function On(e){let n=ls(e);n&&z(n)}function ps(e){let n=hs(e);return n===void 0||e.failOnUnresolved?n:`${n} Pass --fail-on-unresolved to exit with code 1 while a check is unresolved or has no result.`}function hs(e){if(e.sources.deterministic===null&&e.sources.agent===null)return"The SARIF log has no results, so code scanning would close every open alert as fixed.";let n=e.checks.filter(r=>r.status==="unresolved").length,t=e.missingCheckIds.length;if(n+t===0)return;let s=[n>0?l(n,"unresolved check"):"",t>0?`${l(t,"check")} without results`:""].filter(Boolean).join(" and "),i=n+t===1?"its":"their";return`The SARIF log has ${s}, so code scanning could close ${i} open alerts as fixed. Have your coding agent record its findings before you upload it.`}function Un(e){let n=[e.unresolvedChecks>0?`${l(e.unresolvedChecks,"check")} unresolved`:"",e.missingCheckIds.length>0?`${l(e.missingCheckIds.length,"check")} without results`:""].filter(Boolean);return[e.blocking.blockedChecks>0?us(e.blocking):"",e.failOnUnresolved&&n.length>0?`${n.join(" and ")} (--fail-on-unresolved).`:""].filter(Boolean).join(" ")}function fs(e){let n=e===1?"shows":"show";return`${l(e,"check")} ${n} both sources because the agent results are older than the deterministic results.`}function Mn({result:e,agentChecks:n}){let t=new Map(e.allChecks.map(r=>[r.id,r])),s=e.filter?new Set(e.filter.checkIds):null,i={ids:new Set,withoutResults:0,unresolved:0,deterministicResultOnly:0};for(let{id:r,precedence:o}of n){if(s&&!s.has(r))continue;let c=gs(t.get(r),o);c!==void 0&&(i[c]+=1,i.ids.add(r))}return{...i,total:i.ids.size}}function gs(e,n){if(e===void 0)return"withoutResults";let{deterministic:t,agent:s}=e.by_source;if(!(s!==null||t===null)){if(t.status==="unresolved")return"unresolved";if(t.status==="executed"&&n==="prefer-agent")return"deterministicResultOnly"}}function ms({withoutResults:e,unresolved:n,deterministicResultOnly:t,total:s}){let i=[e>0?`${e} without results`:void 0,n>0?`${n} unresolved`:void 0,t>0?`${t} where an agent result takes precedence over the deterministic one`:void 0].filter(o=>o!==void 0),r=i.map((o,c)=>c>0&&c===i.length-1?`and ${o}`:o).join(", ");return`${l(s,"check")} ${s===1?"needs":"need"} your coding agent: ${r}.`}function bs(e,n,t,s,i){return e.some(r=>r.severity==="high"&&v(r).length>0)?"error":i||n.withFindings>0||n.unresolved>0?"warning":!t||s>0?"info":"success"}function ys(e,n,t){if(!t)return"No app security check results to review.";if(n.withFindings===0)return`No ${n.suppressed>0?"active findings":"findings"} in ${l(e.length,"check")}.`;let s=n.unresolved>0?` ${l(n.unresolved,"check")} unresolved.`:"";return`${hn(n)}.${s}`}function vs(e){return{severity:de[e.severity],id:e.id,counts:ws(e)}}function ws(e){let n=v(e);return B.map(t=>[t,n.filter(s=>s.source===t).length]).filter(([,t])=>t>0).map(([t,s])=>`${s} ${t}`).join(", ")}function Ss(e,n,t){let s=e.filter(i=>X(i)&&n.has(i.id)).length;return[G(fn(t,s)),Wn(t)].filter(i=>i!=="")}function Wn(e){return G([e.suppressed>0?`${l(e.suppressed,"finding")} suppressed`:void 0,e.superseded>0?`${l(e.superseded,"finding")} superseded`:void 0])}function he(e){return Wn(Z([e]))}function G(e){return e.filter(n=>n!==void 0).join(" \xB7 ")}function ks(e){let n=e.coverage.files_skipped,{too_large:t,unreadable:s}=qe(n),i=[t>0?`${t} too large`:void 0,s>0?`${s} unreadable`:void 0].filter(d=>d!==void 0),r=n.length===0?"none skipped":`${n.length} skipped (${i.join(", ")})`,o=e.detection.languages.filter(d=>d.support==="unsupported"),c=o.length===0?"":` Unsupported ${o.length===1?"language":"languages"}: ${o.map(d=>`${d.name} (${l(d.files.length,"file")})`).join(", ")}.`;return`Deterministic coverage: ${l(e.coverage.files_scanned,"file")} scanned, ${r}.${c}`}function Fn(e){let n=[...e.include_dirs.map(t=>`--include-dir ${t}`),...e.excludes.map(t=>`--exclude ${t}`),...e.no_git_ignore?["--no-git-ignore"]:[]];return n.length===0?"none":n.join(" ")}function As({deterministic:e,agent:n}){return[...e?[`Scan directories: ${e.document.coverage.scan_directories.map(({directory:t})=>t).join(", ")}`,`Scan scope: ${Fn(e.document.coverage.scope)}`]:[],...n?[`Scope reported by the agent: ${Fn(n.document.scope)}`]:[]]}function $s(e,n,t){let s=Kt[e];return n?{name:s,updated:Bn(n.generated_at,t),engine:n.engine.version}:{name:s,updated:"not found"}}function Bn(e,n){let t=Date.parse(e);return Number.isNaN(t)?"unknown":Ee(new Date(t),n)}function _s(e,n,t,s,i,r){let o={command:N(r.scan)};if(!t)return[["Run",o,"or have your coding agent run it."]];let c=[];if(n.withFindings>0){let d=["Fix the issues, then run",o,"again."];e.sources.agent===null||s>0?c.push(d):c.push([...d,"To refresh agent findings, have your agent run the command and record its findings."])}return s>0?c.push(["Agent results are older than the deterministic results. Have your coding agent run",o,"and record its findings again to refresh them."]):i>0&&c.push([`To run ${l(i,"check")} with no agent result yet, have your coding agent follow`,{command:N(r.instructions)},{char:"."}]),c}function Is(e){let n=[];return e.filterLine&&n.push({body:{subdued:e.filterLine}}),e.checksWithFindings.length>0&&n.push({title:"Checks with findings",body:{tabularData:e.checksWithFindings.map(t=>[t.severity,t.id,t.counts]),firstColumnSubdued:!0}}),e.otherChecks.length>0&&n.push({title:"Other checks",body:e.otherChecks.join(`
|
|
14
|
+
`)}),e.agentResultsPending&&n.push({body:e.agentResultsPending}),e.staleAgentResults&&n.push({body:e.staleAgentResults}),e.coverage&&n.push({body:{subdued:e.coverage}}),e.scopeLines.length>0&&n.push({body:{subdued:e.scopeLines.join(`
|
|
15
|
+
`)}}),e.scopeNote&&n.push({body:e.scopeNote}),n.push({title:`Results files in ${e.resultsFiles.directory}`,body:{tabularData:[["",{subdued:"Updated"},{subdued:"Engine"}],...e.resultsFiles.rows.map(Rs)]}}),e.resultsDigest&&n.push({body:{subdued:`Results digest: ${e.resultsDigest} (pass it to --results-digest with --suppress)`}}),e.blocking===void 0?e.nextSteps.length>0&&n.push({title:"Next steps",body:{list:{items:e.nextSteps}}}):n.push({title:"Blocking",body:e.blocking}),{type:e.type,options:{headline:e.headline,customSections:n}}}function Rs(e){return e.engine===void 0?[e.name,{subdued:e.updated}]:[e.name,e.updated,e.engine]}function Cs(e){let n=e.sources.deterministic!==null||e.sources.agent!==null;return e.failOnUnresolved&&n?e.missingCheckIds:[]}function Es(e){return{type:"warning",options:{headline:`${l(e.length,"check")} without results.`,body:"Neither results file has these checks.",customSections:[{body:{list:{items:e}}}]}}}function Ts(e,n,t){return{type:"warning",options:{headline:`${l(e.length,"check")} unresolved.`,customSections:e.flatMap(s=>[{title:`${s.id} \xB7 ${s.title}`,body:{tabularData:Gn(s,{withDispositions:!0}),firstColumnSubdued:!0}},...n?s.findings.map(i=>H(i,t(i),n,`${s.id} \xB7 `)):[]])}}}function Fs(e,n,t,s){let i=e.filter(X),r=i.filter(u=>n.has(u.id)).length,o=i.length-r,c=e.length-i.length;return{type:"info",options:{headline:[o>0?`${l(o,"check")} passed.`:void 0,r>0?`${l(r,"check")} with no deterministic findings.`:void 0,c>0?`${l(c,"check")} not applicable.`:void 0].filter(u=>u!==void 0).join(" "),customSections:[{body:{tabularData:e.map(u=>xs(u,n))}},...t?e.flatMap(u=>u.findings.map(f=>H(f,s(f),t,`${u.id} \xB7 `))):[]]}}}function xs(e,n){let t=he(e);return[e.id,G([Ns(e,n),t===""?void 0:t,x(e)?Nn:void 0])]}function Ns(e,n){return e.status!=="executed"?En[e.status]:n.has(e.id)?Yt:En.executed}function Ds(e,n,t,s){let i=he(e),r=n?e.findings:v(e);return{type:e.severity==="high"?"error":"warning",options:{headline:`${de[e.severity]} \xB7 ${e.id} \xB7 ${e.title}`,...i===""?{}:{body:{subdued:i}},...e.docs_url?{link:{label:`${e.id} on shopify.dev`,url:e.docs_url}}:{},customSections:[...js(e,t),...r.map(o=>H(o,s(o),n))]}}}function js(e,n){if(x(e))return[{body:{tabularData:B.flatMap(o=>{let c=e.by_source[o];return c?[[o,Hn(c),Bn(c.generated_at,n)]]:[]}),firstColumnSubdued:!0}},{body:{subdued:zt}}];let{deterministic:t,agent:s}=e.by_source;return t!==null&&s!==null&&t.status!==s.status?[{body:{tabularData:Gn(e,{withDispositions:!1}),firstColumnSubdued:!0}}]:[]}function Gn(e,n){let t=x(e),s=B.flatMap(r=>{let o=e.by_source[r];if(!o)return[];let c=t&&r==="agent"?Nn:void 0;return[[r,G([Hn(o),c])]]}),i=n.withDispositions?he(e):"";return i===""?s:[...s,["findings",i]]}function Hn(e){let n=qt[e.status];return e.reason?`${n} \u2014 ${e.reason.message}`:n}function H(e,n,t,s=""){let i=e.disposition==="active"?"":` (${e.disposition})`,r=[e.message];if(e.snippet&&r.push({subdued:`
|
|
16
|
+
Code: ${e.snippet}`}),e.source==="deterministic"){e.fix&&r.push({subdued:`
|
|
17
|
+
Fix: ${e.fix.description}`});let o=e.fix?.guide;o&&r.push({subdued:`
|
|
18
|
+
Guide: ${o}`})}else e.confidence&&r.push({subdued:`
|
|
19
|
+
Confidence: ${e.confidence}`}),e.reasoning&&r.push({subdued:`
|
|
20
|
+
Reasoning: ${t?e.reasoning:Ps(e.reasoning)}`});return t&&(r.push(...e.evidence.map(o=>({subdued:`
|
|
21
|
+
Evidence: ${xn(o.location)}${o.quote?` \u2014 ${o.quote}`:""}`}))),e.disposition==="suppressed"&&e.suppressed_by&&r.push({subdued:`
|
|
22
|
+
Suppressed: ${e.suppressed_by.reason}`})),{title:`${s}#${n} \xB7 ${e.source} \xB7 ${xn(e.location)}${i}`,body:r}}function Ps(e){let n=e.split(`
|
|
23
|
+
`);return n.length<=Tn?e:`${n.slice(0,Tn).join(`
|
|
24
|
+
`)}\u2026`}function xn(e){return e.line===void 0?e.file:`${e.file}:${e.line}`}function Ls(){return Le()&&Oe()}var Os={canPrompt:Ls,selectAction:e=>J(e),selectKind:e=>J(e),enterReason:e=>Pe(e),confirmCompanions:e=>je(e)};function Kn(e=Os){if(!e.canPrompt()){let n=new R("The interactive review needs an interactive terminal.","Run it in a terminal, outside CI and without --no-input. To suppress a finding from a script or an agent, pass its number to --suppress with --kind and --reason.");throw n.code="interactive-review-unavailable",n}return async n=>{$(Bs(n));let t=await Yn(n,e,{findings:n.findings,label:"Active"},{saved:[],declinedCompanions:[],ending:"finished",resultsDigest:n.result.resultsDigest});if(t.ending!=="finished")return t;let s=Us(n.supersededFindings,t);return s.length===0?t:($(Gs(s)),Yn(n,e,{findings:s,label:"Superseded"},t))}}function Us(e,n){let t=new Set([...n.saved.map(({findingNumber:s})=>s),...n.declinedCompanions.flatMap(({companionNumbers:s})=>s)]);return e.filter(({number:s})=>!t.has(s))}var L={saved:[],declinedCompanionNumbers:[],resultsChanged:!1};async function Yn(e,n,t,s){let i={saved:[...s.saved],declinedCompanions:[...s.declinedCompanions],ending:"finished",resultsDigest:s.resultsDigest};for(let[r,o]of t.findings.entries()){let c=`${t.label} finding ${r+1} of ${t.findings.length}`,d=e.reattachments.get(o.number);$(Pn(o,c,d));let u=await n.selectAction(Hs(o,d));if(u==="quit")return fe(i,"quit");if(u==="continue")continue;let f=await Ms(e,n,o,u,d);if(i.saved.push(...f.saved),f.declinedCompanionNumbers.length>0&&i.declinedCompanions.push({findingNumber:o.number,companionNumbers:f.declinedCompanionNumbers}),f.resultsChanged)return fe(i,"results-changed")}return fe(i,"finished")}function fe(e,n){let t=new Set(e.saved.map(({findingNumber:i})=>i)),s=e.declinedCompanions.flatMap(({findingNumber:i,companionNumbers:r})=>{let o=r.filter(c=>!t.has(c));return o.length===0?[]:[{findingNumber:i,companionNumbers:o}]});return{...e,declinedCompanions:s,ending:n}}async function Ms(e,n,t,s,i){if(s==="suppress")return Ws(e,n,t);if(s==="reattach"&&i){let r=await e.reattach(t.number);return Vn(e,n,t,r,{kind:i.entry.kind,reason:i.entry.reason})}return L}async function Ws(e,n,t){let s=await n.selectKind(Ys(t)),i=await n.enterReason(qs(t)),r={kind:s,reason:i},o=await e.suppress({findingNumber:t.number,decision:r,includeSuperseded:!1});return Vn(e,n,t,o,r)}async function Vn(e,n,t,s,i){if(s.status==="refused")return qn(s.refusal);let{saved:r,companionNumbers:o}=s.savedSuppressions;if($(pe(r)),o.length===0)return{...L,saved:r};if(!await n.confirmCompanions(Ks(t,o)))return{...L,saved:r,declinedCompanionNumbers:o};let d=await e.suppress({findingNumber:t.number,decision:i,includeSuperseded:!0});return d.status==="refused"?{...qn(d.refusal),saved:r}:($(pe(d.savedSuppressions.saved)),{...L,saved:[...r,...d.savedSuppressions.saved]})}function qn(e){let n=e.code==="results-digest-mismatch";return $({type:n?"error":"warning",options:{headline:e.message,body:n?"The review stops here, and the suppressions you saved before are kept. Run the review again to see the current findings.":e.tryMessage}}),{...L,resultsChanged:n}}function Bs({findings:e,reattachments:n}){if(e.length===0)return{type:"info",options:{headline:"No active findings to review."}};let t=n.size===0?"":` When a stale entry of ${m} likely names a finding because its code was edited, you can also choose Re-attach: the entry gets the finding's code, and keeps its kind and reason.`;return{type:"info",options:{headline:`Reviewing ${l(e.length,"active finding")}, most severe first.`,body:`For each finding, choose Suppress to save an entry for it to ${m} at once, Continue to leave it active, or Quit to stop.${t} The suppressions you save apply to all app configurations and are kept when you quit.`}}}function Gs(e){let n=e.length===1,t=n?"it":"them";return{type:"info",options:{headline:`Reviewing ${l(e.length,"superseded finding")} that check --blocking still counts.`,body:`An agent result supersedes ${n?"this deterministic finding":"these deterministic findings"}, so the review doesn't count ${t}. But check --blocking, which reads no agent results, still counts ${t}, so a CI gate that runs it can fail. Choose Suppress, Continue or Quit for each finding, as before.`}}}function Hs({number:e},n){let t=n?[{label:`Re-attach suppressions[${n.entryIndex}]`,value:"reattach",key:"r"}]:[];return{message:`What do you want to do with finding #${e}?`,choices:[...t,{label:"Suppress",value:"suppress",key:"s"},{label:"Continue",value:"continue",key:"c"},{label:"Quit",value:"quit",key:"q"}],defaultValue:"continue"}}function Ys({number:e}){return{message:`Is finding #${e} a false positive or an accepted risk?`,choices:[{label:"False positive: the finding is wrong",value:"false-positive"},{label:"Accepted risk: the finding is real, and you accept the risk",value:"accepted-risk"}]}}function qs({number:e}){return{message:`Why should finding #${e} be suppressed?`,validate:n=>{let t=an(n);return t===void 0?void 0:`The reason ${t}.`}}}function Ks({check:e,finding:n},t){let s=t.length===1?"it":"them";return{message:`${t.length===1?`Finding #${t[0]} is a superseded deterministic finding`:`Findings ${C(t.map(r=>`#${r}`))} are superseded deterministic findings`} of ${e.id} in ${n.location.file}, and check --blocking, which reads no agent results, still counts ${s}. Suppress ${s} too, with the same kind and reason?`,confirmationMessage:`Yes, suppress ${s} too`,cancellationMessage:"No",defaultValue:!1}}b();b();var me=()=>F.describe(`${F.description}`),tt=()=>a.enum(["executed","not-applicable","unresolved"]),zn=()=>a.enum(["union","prefer-agent"]),be=a.object({filePath:k().describe("The absolute path of the file."),line:a.number().int().positive().nullable().describe("The one-based line, or null for the whole file."),column:a.number().int().positive().nullable().describe("The one-based column, or null when none is recorded.")}).strict().describe("A place in a file."),st=a.object({location:be,quote:a.string().min(1).nullable().describe("The quoted source, redacted, or null when none is recorded.")}).strict().describe("Source that supports a finding."),ye=a.discriminatedUnion("origin",[a.object({justification:a.string().describe("The entry's reason."),origin:a.literal("file").describe("An entry of shopify.app-security.json suppresses the finding."),entryIndex:a.number().int().nonnegative().describe("The entry's index in the file, from 0, as in suppressions.entries."),kind:un()}).strict(),a.object({justification:a.string().describe("The agent's justification."),origin:a.literal("agent").describe("The agent suppressed the finding when it recorded it.")}).strict()]).describe("What suppresses a finding, and why."),it=()=>({number:a.number().int().positive().describe("The finding's number, from 1, which --suppress takes. Every finding of every check has one, whatever --check-id and --verbose, in the order of checks then findings. It names the same finding for the same results files, which resultsDigest identifies."),disposition:a.enum(["active","suppressed","superseded"]).describe("Whether the finding counts: active; suppressed, by an entry of shopify.app-security.json or by the agent, so it doesn't count for valid or blocking; or superseded, a deterministic finding that a check's prefer-agent agent result replaces."),location:be,message:a.string().describe("What the finding is, redacted."),snippet:a.string().min(1).nullable().describe("The flagged code, redacted, or null when none is recorded."),evidence:a.array(st)}),rt=a.object({source:a.literal("deterministic"),...it(),fix:a.object({description:a.string(),guide:a.string().min(1).nullable().describe("A guide to the fix, or null when none is recorded."),automated:a.boolean().describe("Whether the fix can be applied automatically.")}).strict().nullable().describe("How to fix the finding, or null when none is recorded."),suppression:ye.nullable().describe("The entry of shopify.app-security.json that suppresses the finding. Also set on a superseded finding that an entry matched. Null otherwise.")}).strict().describe("A finding from deterministic-findings.json."),ot=a.object({source:a.literal("agent"),...it(),confidence:a.enum(["high","medium","low"]).nullable().describe("The agent's confidence, or null when it didn't report one."),reasoning:a.string().min(1).nullable().describe("The agent's reasoning, redacted, or null when none is recorded."),suppression:ye.nullable().describe("What suppresses the finding: an entry of shopify.app-security.json, which comes first, or the agent's own suppression. Null when the finding is not suppressed.")}).strict().describe("A finding from agent-findings.json."),at=a.discriminatedUnion("source",[rt,ot]),ge=a.object({version:a.number().int().positive().describe("The check version: the catalog version for deterministic results, the one the agent claimed for agent results."),status:tt().describe("The source's own status for the check."),reason:a.object({code:a.string().describe("A short code. Agent codes are free-form. Deterministic codes: capability_absent, no_relevant_files, unsupported_framework, unsupported_language, parser_unavailable, agent_investigation_required, input_rejected."),message:a.string()}).strict().nullable().describe("Why the check is unresolved or not applicable, or null when none is recorded."),analysisMode:a.enum(["regex","structured-config","ast"]).nullable().describe("How the deterministic check analyzed the files. Null for agent results."),generatedAt:me().nullable().describe("When the source recorded the check, or null when the recorded time is not a valid instant.")}).strict().describe("One source's own result for a check."),Jn=a.object({id:a.string().describe("The check ID, such as CREDENTIAL_LOG_LEAKAGE."),title:a.string(),severity:a.enum(["high","medium","low"]),description:a.string(),guide:a.string().min(1).nullable().describe("A guide to the check, or null when none is recorded."),docsUrl:a.string().url().nullable().describe("The check's page on shopify.dev, or null when the results files predate it."),precedence:zn().describe("How the sources combine: union keeps both sources' findings; prefer-agent lets the agent result replace the deterministic one."),appliedPrecedence:zn().describe("The precedence that applied: union when a prefer-agent agent result is older than the deterministic one."),status:tt().describe("The combined status. Under union, executed when either source executed the check."),bySource:a.object({deterministic:ge.nullable(),agent:ge.nullable()}).strict().describe("Each source's own result, or null when that source didn't record the check."),findings:a.array(at).describe("Every finding of both sources, including suppressed and superseded ones, whatever --verbose. Sorted by file, line, then source.")}).strict().describe("One check, combined from both results files."),Qn=a.object({framework:a.enum(["react-router","none","unknown","mixed"]),surface:a.enum(["react-router","theme-app-extension","config-only","unknown","mixed"]),languages:a.array(a.object({name:a.string().describe("The language, such as typescript."),support:a.enum(["supported","unsupported"]).describe("Whether the deterministic checks analyze it."),files:a.array(a.object({path:k()}).strict())}).strict())}).strict().describe("What the latest check detected in the app."),Xn=a.object({filesScanned:a.number().int().nonnegative().describe("The number of files scanned."),filesSkipped:a.array(a.object({path:k(),reason:a.enum(["too-large","unreadable"]),sizeBytes:a.number().int().nonnegative().nullable().describe("The file size, or null when unknown."),detail:a.string().min(1).nullable().describe("Why the file was unreadable, or null when none is recorded.")}).strict()),gaps:a.array(a.object({code:a.enum(["skipped-file","unsupported-framework","unsupported-language","unresolved-check"]),message:a.string(),checkId:a.string().nullable().describe("The check that the gap concerns, or null."),filePath:k().nullable().describe("The file that the gap concerns, or null.")}).strict()),scanDirectories:a.array(se)}).strict().describe("What the latest check covered."),ct=pn.extend({findingNumber:a.number().int().positive().describe("The number of the finding that the entry was saved for.")}).describe("An entry of shopify.app-security.json that --suppress saved, as the file now holds it."),Zn=a.object({filePath:k().describe("The absolute path of shopify.app-security.json."),entries:a.array(ct).describe("The entries that were added or extended: the one for the --suppress finding, then one for each companion with --include-superseded."),companionFindingNumbers:a.array(a.number().int().positive()).describe("The numbers of the finding's companions that weren't suppressed because --include-superseded wasn't passed: superseded deterministic findings of the same check in the same file, which check --blocking still counts because it reads no agent results.")}).strict().describe("What --suppress saved to shopify.app-security.json."),et=a.object({path:k().describe("The absolute path of deterministic-findings.json."),generatedAt:me().nullable().describe("When check wrote the file, or null when the recorded time is not a valid instant."),engine:a.object({name:a.string(),version:a.string(),ruleset:a.string()}).strict(),scope:M}).strict().describe("deterministic-findings.json, which check writes, with the scope of the scan."),nt=a.object({path:k().describe("The absolute path of agent-findings.json."),generatedAt:me().nullable().describe("When record wrote the file, or null when the recorded time is not a valid instant."),engine:a.object({name:a.string(),version:a.string()}).strict(),scope:M}).strict().describe("agent-findings.json, which record writes, with the scope that the agent reported."),Y=Re({name:"AppSecurityReviewResult",schema:a.object({status:a.literal("success"),valid:a.boolean().describe("Whether the review passed: no check in checks has an active finding at or above the blocking level and, with failOnUnresolved, no check is unresolved and missingCheckIds is empty. Suppressed and superseded findings don't count."),app:te,resultsDirectory:k().describe("The absolute path of the results directory."),resultsFiles:a.object({deterministic:et.nullable(),agent:nt.nullable()}).strict().describe("The results files that the review combines. Null when a file does not exist."),detection:Qn.nullable().describe("What the latest check detected in the app, or null without deterministic-findings.json."),coverage:Xn.nullable().describe("What the latest check covered, or null without deterministic-findings.json."),scopeDiffers:a.boolean().describe("Whether the agent reported another scope than the latest scan used. False unless both results files exist."),checks:a.array(Jn).describe("The checks after --check-id, most severe first, then by ID. Empty when no results file exists."),resultsDigest:a.string().min(1).nullable().describe("A digest of the findings that the numbers name. Pass it to --results-digest with --suppress, so the suppression is refused if the results changed. Null when no results file exists."),blocking:ie,failOnUnresolved:a.boolean().describe("Whether --fail-on-unresolved was passed."),missingCheckIds:a.array(a.string()).describe("The IDs of the checks after --check-id that have no result in either results file, sorted."),suppressions:re,savedSuppressions:Zn.nullable().describe("What --suppress saved to shopify.app-security.json, or null without --suppress. With --suppress, the rest of the result is the review after the save.")}).strict().describe("The combined results of the app security check."),definitions:{AppSecurityApp:te,AppSecurityScope:M,AppSecurityScanDirectory:se,AppSecurityBlocking:ie,AppSecuritySuppressions:re,AppSecuritySuppressionEntry:ln,AppSecurityDeterministicResultsFile:et,AppSecurityAgentResultsFile:nt,AppSecurityDetection:Qn,AppSecurityCoverage:Xn,AppSecurityCheck:Jn,AppSecuritySourceResult:ge,AppSecurityFinding:at,AppSecurityDeterministicFinding:rt,AppSecurityAgentFinding:ot,AppSecurityLocation:be,AppSecurityEvidence:st,AppSecurityFindingSuppression:ye,AppSecuritySavedSuppressions:Zn,AppSecuritySavedSuppression:ct}});b();var Vs="https://json.schemastore.org/sarif-2.1.0.json",ut={high:"error",medium:"warning",low:"note"},zs={high:"8.0",medium:"5.0",low:"2.0"};function Js(e,n){let t=n===null?"":`client-id/${n}/`;return`shopify-app-security/check-id/${[...new Set(e)].sort().join(",")}/${t}`}function lt(e,{checkIds:n}){let t=e.resultsFiles.deterministic===null&&e.resultsFiles.agent===null,s=e.checks.some(r=>r.status==="unresolved"),i=t?[]:e.missingCheckIds;return{$schema:Vs,version:"2.1.0",runs:[{tool:{driver:{name:"Shopify app security check",semanticVersion:_e,informationUri:"https://shopify.dev/docs/api/shopify-cli",rules:e.checks.map(ti)}},invocations:[{executionSuccessful:!t&&!s&&i.length===0,toolExecutionNotifications:[...t?[Qs]:[],...e.checks.flatMap((r,o)=>Zs(r,o)),...i.map(ei),...(e.coverage?.gaps??[]).flatMap(r=>ni(r,e.checks))]}],...n.length>0?{automationDetails:{id:Js(n,e.app.clientId)}}:{},columnKind:"utf16CodeUnits",results:e.checks.flatMap((r,o)=>r.findings.filter(c=>c.disposition==="active").map(c=>si(r,o,c,e.app.directory)))}]}}function O(e){return{text:ve(e)}}function ve(e){return e.replace(/[\\[\]]/g,"\\$&")}var Qs={level:"error",message:O("No results file to review: run shopify app security check first."),descriptor:{id:"no-results-file"}},Xs={unresolved:"is unresolved","not-applicable":"is not applicable"};function Zs(e,n){if(e.status==="executed")return[];let t=[e.bySource.deterministic,e.bySource.agent].find(i=>i?.status===e.status&&i.reason!==null)?.reason,s=t?`: ${t.message} (${t.code})`:".";return[{level:e.status==="unresolved"?"warning":"note",message:O(`${e.id} ${Xs[e.status]}${s}`),descriptor:{id:e.status},associatedRule:{id:e.id,index:n}}]}function ei(e){return{level:"warning",message:O(`${e} has no result: neither results file has this check.`),descriptor:{id:"no-result"}}}function ni(e,n){if(e.code==="unresolved-check")return[];let t=e.checkId===null?-1:n.findIndex(s=>s.id===e.checkId);return e.checkId!==null&&n[t]?.status!=="executed"?[]:[{level:"warning",message:O(e.message),descriptor:{id:e.code},...e.checkId===null?{}:{associatedRule:{id:e.checkId,index:t}},...e.filePath===null?{}:{locations:[{physicalLocation:{artifactLocation:pt(e.filePath)}}]}}]}function ti(e){return{id:e.id,shortDescription:{text:e.title},fullDescription:{text:e.description},help:{text:e.guide===null?e.description:`${e.description}
|
|
25
|
+
|
|
26
|
+
Guide: ${e.guide}`},...e.docsUrl===null?{}:{helpUri:e.docsUrl},defaultConfiguration:{level:ut[e.severity]},properties:{tags:["security"],"security-severity":zs[e.severity]}}}function si(e,n,t,s){let i=t.evidence.map((c,d)=>({id:d,physicalLocation:dt(c.location),...c.quote===null?{}:{message:O(c.quote)}})),r=ve(t.message===""?e.title:t.message),o=t.evidence.map((c,d)=>`[${ve(ii(c.location,s))}](${d})`);return{ruleId:e.id,ruleIndex:n,level:ut[e.severity],message:{text:o.length===0?r:`${r} Evidence: ${o.join(", ")}.`},locations:[{physicalLocation:dt(t.location,t.snippet)}],...i.length>0?{relatedLocations:i}:{},properties:{source:t.source,...t.source==="agent"&&t.confidence!==null?{confidence:t.confidence}:{}}}}function ii(e,n){let t=Ce(n,e.filePath);return e.line===null?t:`${t}:${e.line}`}function dt(e,n=null){let t=pt(e.filePath);return e.line===null?{artifactLocation:t}:{artifactLocation:t,region:{startLine:e.line,...e.column===null?{}:{startColumn:e.column},...n===null?{}:{snippet:{text:n}}}}}function pt(e){return{uri:Te(e).href}}var mt={executed:"executed",not_applicable:"not-applicable",unresolved:"unresolved"},ri={regex:"regex",structured_config:"structured-config",ast:"ast"},oi={react_router:"react-router",none:"none",unknown:"unknown",mixed:"mixed"},ai={react_router:"react-router",theme_app_extension:"theme-app-extension",config_only:"config-only",unknown:"unknown",mixed:"mixed"},ci={too_large:"too-large",unreadable:"unreadable"},di={skipped_file:"skipped-file",unsupported_framework:"unsupported-framework",unsupported_language:"unsupported-language",unresolved_check:"unresolved-check"};function bt(e,n,t){if(t==="json")Q(Y.encode(ht(e)));else if(t==="sarif"){let s=lt(ht(e),{checkIds:e.result.filter?.checkIds??[]});Q(JSON.stringify(s,null,2)),On(e.result)}else Dn({result:e.result,verbose:n.verbose,now:new Date,commands:e.commands,agentChecks:He(),...e.savedSuppressions?{savedSuppressions:e.savedSuppressions}:{},...e.interactiveReview?{interactiveReview:e.interactiveReview}:{}});E(e.result)&&(process.exitCode=1)}function ht({selection:e,result:n,savedSuppressions:t}){let{appDirectory:s}=e,i=n.sources.deterministic?.document;return{status:"success",valid:!E(n),app:Ze(e),resultsDirectory:D(n.resultsDirectory),resultsFiles:li(n.sources),detection:i?pi(i.detection,s):null,coverage:i?hi(i.coverage,s):null,scopeDiffers:n.scopeDiffers,checks:n.checks.map(r=>fi(r,s,n.findingNumbers)),resultsDigest:n.resultsDigest,blocking:nn(n.blocking),failOnUnresolved:n.failOnUnresolved,missingCheckIds:n.missingCheckIds,suppressions:tn(s,n.suppressions,n.allChecks,n.likelyFindingNumbers),savedSuppressions:t?ui(t,s):null}}function ui({path:e,saved:n,companionNumbers:t},s){return{filePath:D(e),entries:n.map(i=>({...sn(s,i),findingNumber:i.findingNumber})),companionFindingNumbers:t}}function li({deterministic:e,agent:n}){return{deterministic:e?{path:D(e.path),generatedAt:we(e.document.generated_at),engine:{name:e.document.engine.name,version:e.document.engine.version,ruleset:e.document.engine.ruleset},scope:ee(e.document.coverage.scope)}:null,agent:n?{path:D(n.path),generatedAt:we(n.document.generated_at),engine:{name:n.document.engine.name,version:n.document.engine.version},scope:ee(n.document.scope)}:null}}function we(e){let n=Date.parse(e);if(Number.isNaN(n))return null;let t=Ie(new Date(n));return F.safeParse(t).success?t:null}function T(e){return e===void 0||e===""?null:e}function ft(e){return e??null}function yt(e,n){return{filePath:j(n,e.file),line:ft(e.line),column:ft(e.column)}}function pi(e,n){return{framework:oi[e.framework],surface:ai[e.surface],languages:e.languages.map(t=>({name:t.name,support:t.support,files:t.files.map(s=>({path:j(n,s)}))}))}}function hi(e,n){return{filesScanned:e.files_scanned,filesSkipped:e.files_skipped.map(t=>({path:j(n,t.path),reason:ci[t.reason],sizeBytes:t.size_bytes??null,detail:T(t.detail)})),gaps:e.gaps.map(t=>({code:di[t.code],message:t.message,checkId:t.check_id??null,filePath:t.file===void 0?null:j(n,t.file)})),scanDirectories:e.scan_directories.map(t=>en(n,t))}}function fi(e,n,t){return{id:e.id,title:e.title,severity:e.severity,description:e.description,guide:T(e.guide),docsUrl:e.docs_url??null,precedence:e.precedence,appliedPrecedence:e.applied_precedence,status:mt[e.status],bySource:{deterministic:e.by_source.deterministic?gt(e.by_source.deterministic):null,agent:e.by_source.agent?gt(e.by_source.agent):null},findings:e.findings.map(s=>gi(s,t.get(s),n))}}function gt(e){return{version:e.version,status:mt[e.status],reason:e.reason?{code:e.reason.code,message:e.reason.message}:null,analysisMode:e.analysis_mode?ri[e.analysis_mode]:null,generatedAt:we(e.generated_at)}}function gi(e,n,t){let s={number:n,disposition:e.disposition,location:yt(e.location,t),message:e.message,snippet:T(e.snippet),evidence:e.evidence.map(i=>bi(i,t)),suppression:mi(e.suppressed_by)};return e.source==="deterministic"?{source:"deterministic",...s,fix:e.fix?{description:e.fix.description,guide:T(e.fix.guide),automated:e.fix.automated}:null}:{source:"agent",...s,confidence:e.confidence??null,reasoning:T(e.reasoning)}}function mi(e){return e===void 0?null:e.origin==="agent"?{justification:e.reason,origin:"agent"}:{justification:e.reason,origin:"file",entryIndex:e.entry_index,kind:e.kind}}function bi(e,n){return{location:yt(e.location,n),quote:T(e.quote)}}var w=St(kt(),1);var Se=class e extends Ue{static summary="Show the combined app security check results.";static descriptionWithMarkdown="Combines the deterministic results (`deterministic-findings.json`, written by `shopify app security check`) with the recorded agent results (`agent-findings.json`, written by `shopify app security record`) and shows one view of every check: its findings, status and source. Both files are in the results directory, `.shopify/app-security/<results key>/`. `--client-id` is checked against your Shopify account before any results are read, so it needs you to be logged in.\n\nThe summary shows the scan directories and the scope of the latest scan, and the scope the agent reported. It notes when the agent findings were recorded for a different scope than the latest scan; that doesn't change the exit code.\n\nThe agent results are optional. Use `--check-id` to narrow the review to specific checks, `--verbose` for full reasoning and evidence, and for suppressed and superseded findings in full, and `--blocking` to exit with code 1 when a check with active findings is at or above a severity. Add `--fail-on-unresolved` to also exit with code 1 when a check is unresolved or has no result. With `--json`, the result always includes every finding in full, and how the entries of `shopify.app-security.json` applied.\n\n`shopify.app-security.json`, in the app directory, holds the findings that your team decided not to fix. Commit it, so that your team and CI use the same decisions. Each entry names a finding's source, check ID and file, and can name a `code` text of the finding. It has a kind, `false-positive` or `accepted-risk`, a reason, which is required. Suppressions apply to all app configurations and client-ID runs. A finding that an entry matches is suppressed: it doesn't count for `--blocking`, and it's always listed with its kind and reason. Findings that the agent suppressed, and superseded deterministic findings, which a check's prefer-agent agent result replaces, don't count either. An entry's `code` matches the code excerpt that the results file saved with the finding. A results file that would be larger than 5 MB with excerpts is saved without them, and results written before excerpts existed have none; then an entry with `code` matches only the finding's message. An entry that matches no finding is stale, and an entry whose code matches more than one finding is ambiguous. Neither suppresses anything, and the review lists both, so you can remove or update them. When an edit to the flagged code, such as a rename, makes an entry stale, the review names the entry's likely finding: the one finding of its source and check in its file that nothing suppresses and whose flagged line holds at least two thirds of the words of the entry's code. It names none when the entry's code or that line holds a redacted secret, such as `shpa[REDACTED:38:a5e9444f]`: redaction hides the only text that tells two credentials apart, so suppress that finding again with `--kind` and `--reason`. It names none either when the entry's code holds a secret that the CLI would redact, because the output of a re-attach shows the old code. Entries for checks without an executed result aren't evaluated. An invalid file makes the command fail with every problem.\n\nEvery finding has a number, shown before its source, and the summary shows a digest of the results. The numbers count every finding of every check, so `--check-id` and `--verbose` change which findings are shown, never their numbers, and a number names the same finding until the results files change. To suppress a finding, pass its number to `--suppress` with `--kind` and `--reason`, and the digest to `--results-digest` to refuse the suppression if the results changed since you read the number. The command saves an entry to `shopify.app-security.json` that matches only that finding, then shows the review with the finding suppressed. Review and commit the file. When the finding is the likely finding of a stale entry, `--suppress` re-attaches that entry instead of adding one: the entry gets the code that names the finding alone, and keeps its kind and reason, so `--kind` and `--reason` are optional, and replace the entry's kind and reason when you pass them. The output shows the old and the new code. Nothing re-attaches an entry on its own: only `--suppress` and the Re-attach choice of `--interactive` change the file. When the finding is an agent finding that supersedes a deterministic finding of the same check in the same file, `check --blocking` still counts the deterministic finding, because it reads no agent results: the output names it, and `--include-superseded` suppresses it too, with the same kind and reason. Once an entry suppresses the agent finding, `--suppress` with `--include-superseded` saves only the deterministic finding, with the kind and reason of that entry unless you pass `--kind` and `--reason`. A superseded deterministic finding can also be suppressed by its own number, for example when the agent result has no finding in its file: the review doesn't count it, but `check --blocking` does, and the output says so.\n\nUse `--interactive` in a terminal to go through the active findings one at a time, most severe first, each shown in full with its number. For each finding, choose Suppress, Continue or Quit, or Re-attach when the finding is the likely finding of a stale entry: it shows the entry's old code and the new one, and re-attaches the entry with its kind and reason. Suppress asks whether the finding is a false positive or an accepted risk, and for a reason, which is required. Then it saves the entry at once, as `--suppress` does. When the finding has superseded deterministic findings that `check --blocking` still counts, it asks separately whether to suppress them too. Continue leaves the finding active. Quit stops the review and keeps what you saved. After the active findings, the review offers in the same way each superseded deterministic finding that `check --blocking` still counts, when there are any, apart from the ones it already asked about. At the end, the command shows the review with the findings you suppressed, and lists the entries it saved. `--interactive` never prompts in CI, without a terminal, or with `--no-input`: it fails before it reads anything. It can't be combined with `--json`, `--sarif` or `--suppress`.\n\nUse `--sarif` to print the reviewed checks as a [SARIF 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html) log instead of the review, for GitHub code scanning and other tools that read SARIF. Only the log goes to stdout, so redirect it to save it to a file: `shopify app security review --sarif > app-security.sarif`. Warnings go to stderr. Each check is a rule and each active finding a result, with an error, warning, or note level for a high, medium, or low severity. Suppressed and superseded findings are left out: GitHub code scanning ignores SARIF suppressions and would open alerts for them, so instead an open alert closes as fixed once its finding is suppressed. Unresolved and not applicable checks, checks with no result in either results file, and coverage gaps are listed as tool execution notifications, and the execution is marked unsuccessful when a check is unresolved or has no result, or there's no results file. A check with no result has no rule. File locations are absolute `file:` URIs, which GitHub's `upload-sarif` action makes relative to the repository.\n\nCode scanning replaces the previous analysis of the same category on each upload, and closes the alerts that are missing from it as fixed. A check without results reads as passing, so an upload with unresolved checks, checks with no result, or no results file closes alerts that may still be open; a warning says when that's the case. Have your coding agent record its findings before you upload the log. With `--fail-on-unresolved`, the review exits with code 1 when a check is unresolved or has no result, so the pipeline can stop before the upload. The log holds the same checks as the review, so `--check-id` narrows it too, and gives it a category of its own: `automationDetails.id` is `shopify-app-security/check-id/<IDs>/client-id/<client ID>/`, with the sorted check IDs separated by commas, and without the client ID part when the app has none, so a narrowed upload leaves the alerts of a full one, and of other apps, open. That ID takes precedence over the `category` input of `upload-sarif`. A full run has no `automationDetails`, so `category` sets it.\n\nReports the number of findings to Shopify as usage telemetry, but not finding details. See [usage reporting](https://shopify.dev/docs/api/shopify-cli#usage-reporting) for details.";static jsonOutputSchema=Y;static description=this.descriptionForHelp();static examples=["<%= config.bin %> <%= command.id %>","<%= config.bin %> <%= command.id %> --interactive","<%= config.bin %> <%= command.id %> --check-id COMMITTED_SECRET --verbose",'<%= config.bin %> <%= command.id %> --suppress 3 --kind false-positive --reason="A fake token in a test fixture." --results-digest 1a2b3c4d5e6f','<%= config.bin %> <%= command.id %> --suppress 2 --kind accepted-risk --reason="Kept until the migration ships." --include-superseded',"<%= config.bin %> <%= command.id %> --blocking high"];static flags={...Me,...Ge,"check-id":w.Flags.string({description:"Show only this check. Repeat the flag to show several checks.",env:"SHOPIFY_FLAG_CHECK_ID",multiple:!0}),...Be,"fail-on-unresolved":w.Flags.boolean({description:"Exit with code 1 when a reviewed check is unresolved or has no result, whatever --blocking is.",env:"SHOPIFY_FLAG_APP_SECURITY_FAIL_ON_UNRESOLVED",default:!1}),sarif:w.Flags.boolean({description:"Print the reviewed checks as SARIF 2.1.0 instead of the review, for code scanning tools. Redirect the output to save it to a file.",default:!1,exclusive:["json"],env:"SHOPIFY_FLAG_APP_SECURITY_SARIF"}),suppress:w.Flags.integer({description:"Suppress the finding with this number: save an entry for it to shopify.app-security.json. Requires --kind and --reason, unless the finding is the likely finding of a stale entry: then the command re-attaches that entry to it. They are optional too with --include-superseded on a finding that an entry already suppresses: its superseded findings get the kind and reason of that entry.",env:"SHOPIFY_FLAG_APP_SECURITY_SUPPRESS",min:1,exclusive:["sarif"]}),kind:w.Flags.string({description:`Why the finding is suppressed, with --suppress: ${rn.join(" or ")}. Optional when --suppress re-attaches a stale entry, or saves only the superseded findings of a finding that an entry already suppresses: the entry's kind is kept unless you pass this flag.`,env:"SHOPIFY_FLAG_APP_SECURITY_SUPPRESSION_KIND",dependsOn:["suppress"]}),reason:w.Flags.string({description:"The reason for the suppression, with --suppress. It is saved in shopify.app-security.json. Optional when --suppress re-attaches a stale entry, or saves only the superseded findings of a finding that an entry already suppresses: the entry's reason is kept unless you pass this flag.",env:"SHOPIFY_FLAG_APP_SECURITY_SUPPRESSION_REASON",dependsOn:["suppress"]}),"results-digest":w.Flags.string({description:"With --suppress, the results digest that the finding number was read with. The suppression is refused if the results changed since.",env:"SHOPIFY_FLAG_APP_SECURITY_RESULTS_DIGEST",dependsOn:["suppress"]}),"include-superseded":w.Flags.boolean({description:"With --suppress, also suppress the superseded deterministic findings of the agent finding's check in the same file, which check --blocking still counts.",env:"SHOPIFY_FLAG_APP_SECURITY_INCLUDE_SUPERSEDED",dependsOn:["suppress"]}),interactive:w.Flags.boolean({description:"Go through the active findings one at a time, most severe first, then the superseded findings that check --blocking still counts, and choose Suppress, Continue or Quit for each, or Re-attach for the likely finding of a stale entry. Needs an interactive terminal.",env:"SHOPIFY_FLAG_APP_SECURITY_INTERACTIVE",exclusive:["json","sarif","suppress"]}),...We};async run(){let{flags:n}=await this.parse(e),t=n.interactive?Kn():void 0,s=await ce({directory:n.path,configName:n.config,clientId:n["client-id"],withoutAppConfig:!!n["without-app-config"],checkIds:n["check-id"]??[],blocking:n.blocking,failOnUnresolved:!!n["fail-on-unresolved"],...n.suppress===void 0?{}:{suppress:{findingNumber:n.suppress,kind:n.kind,reason:n.reason,resultsDigest:n["results-digest"],includeSuperseded:!!n["include-superseded"]}},...t?{interactive:t}:{}});bt(s,{verbose:!!n.verbose},yi(n))}};function yi(e){return e.json?"json":e.sarif?"sarif":"text"}export{Se as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R,b as V,c as H,d as i,e as O,f as _,g as q,h as C,i as x}from"./chunk-
|
|
1
|
+
import{a as R,b as V,c as H,d as i,e as O,f as _,g as q,h as C,i as x}from"./chunk-JNSVKDBY.js";import{a as M}from"./chunk-RSZAAN37.js";import{a as A}from"./chunk-ASKBYEO7.js";import{P as L,m as F}from"./chunk-HMPRWNGG.js";import{d as k}from"./chunk-JGLLABZR.js";import{b as E,c as I,f as p}from"./chunk-DMOLPSXF.js";import{C as m,E as v,I as b}from"./chunk-2KUM2RU4.js";import{a as y}from"./chunk-LG3KEHGD.js";import{i as w}from"./chunk-TD6JBHUS.js";import{Cb as h,Fb as T,Hb as S,zb as P}from"./chunk-ZMOW2YZ4.js";import{b as n}from"./chunk-3PYDIBTX.js";import{b as Q}from"./chunk-AE3IQG7S.js";import{i as g}from"./chunk-IWTNUJGY.js";import{e as X,g as a}from"./chunk-VKWPEFWQ.js";a();a();a();a();async function D(e,t,r){let o={api_version:t},{webhookTopics:s}=await e.topics(o,r);return s}a();async function W(e){let t=e.map(o=>({label:o,value:o}));return await v({message:"Webhook Topic",choices:t})}async function B(e){return m({message:"Webhook ApiVersion",choices:e.map(t=>({label:t,value:t}))})}async function N(){return m({message:"Delivery method",choices:[{label:"HTTP",value:i.HTTP},{label:"Google Pub/Sub",value:i.PUBSUB},{label:"Amazon EventBridge",value:i.EVENTBRIDGE}]})}async function Y(e){return(await b({message:"Address for delivery",validate:r=>{let o=r.trim();if(o.length===0)return"Address can't be empty";if(!O(o,e))return`Invalid address.
|
|
2
2
|
${l(e)}`}})).trim()}function Z(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 l(e){return Z(e).map(t=>` \xB7 ${S(t)}`).join(`
|
|
3
3
|
`)}async function G(e,t){let{clientSecret:r,clientId:o,remoteApp:s,app:c}=e;return r&&(o||t!==i.EVENTBRIDGE)?{clientSecret:r,apiKey:o}:(F({appName:s.title,configFile:g(c.configPath)}),r?{clientSecret:r,apiKey:s.apiKey}:{clientSecret:await k(s,"Pass the secret with the --client-secret flag."),apiKey:s.apiKey})}async function j(e,t,r){let o=await R(e,r);return t?q(t,o):B(o)}async function z(e,t,r,o){let s=await D(e,t,o);return r?C(r,t,s):W(s)}async function U(e,t){let r=e??x(t)??await N(),o=t??await Y(r);return _(o,r)}async function J(e){let t=await ee(e);return te(t)}async function ee(e){let t=await j(e.developerPlatformClient,e.apiVersion,e.organizationId),r=await z(e.developerPlatformClient,t,e.topic,e.organizationId),[o,s]=await U(e.deliveryMethod,e.address),c=await G(e,s);return{topic:r,apiVersion:t,deliveryMethod:s,address:o,apiKey:c.apiKey,clientSecret:c.clientSecret,developerPlatformClient:e.developerPlatformClient,organizationId:e.organizationId}}async function te(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 V(e.developerPlatformClient,t,e.organizationId);if(!r.success)return{status:"failed",reason:"sample-request",userErrors:r.userErrors};let o={topic:e.topic,apiVersion:e.apiVersion,deliveryMethod:e.deliveryMethod,address:e.address,status:"enqueued"};return e.deliveryMethod===i.LOCALHOST?await H(e.address,r.samplePayload,r.headers)?{status:"success",delivery:{...o,status:"delivered"},samplePayloadIsEmpty:r.samplePayload===JSON.stringify({})}:{status:"failed",reason:"localhost-delivery"}:{status:"success",delivery:o,samplePayloadIsEmpty:r.samplePayload===JSON.stringify({})}}a();var K=n.object({topic:n.string(),apiVersion:n.string(),deliveryMethod:n.enum(["localhost","http","google-pub-sub","event-bridge"]),address:n.string(),status:n.enum(["delivered","enqueued"]).describe("Remote delivery is enqueued, not confirmed received.")}).strict(),u=y({name:"AppWebhookTriggerResult",schema:n.object({status:n.literal("success"),delivery:K}).strict(),definitions:{AppWebhookDelivery:K}});a();function $(e,t){if(e.status==="failed"){if(t==="json"){let r=new w(e.reason==="sample-request"?"Webhook sample request failed.":"Localhost delivery failed");throw e.reason==="sample-request"&&(r.details={userErrors:e.userErrors.map(({message:o,fields:s})=>({message:o,fieldPath:s}))}),r}T(e.reason==="sample-request"?`Request errors:
|
|
4
4
|
${re(e.userErrors)}`:"Localhost delivery failed");return}t==="json"?P(u.encode({status:e.status,delivery:e.delivery})):e.delivery.status==="delivered"?h("Localhost delivery sucessful"):e.samplePayloadIsEmpty&&h("Webhook has been enqueued for delivery")}function re(e){try{return e.map(t=>JSON.parse(t.message).map(r=>` \xB7 ${r}`).join(`
|
|
@@ -18,7 +18,7 @@ ${re(e.userErrors)}`:"Localhost delivery failed");return}t==="json"?P(u.encode({
|
|
|
18
18
|
- Webhooks triggered using this method aren't retried when they fail.
|
|
19
19
|
- Trigger requests are rate-limited using the [Partner API rate limit](https://shopify.dev/docs/api/partner#rate_limits).
|
|
20
20
|
- You can't use this method to validate your API webhook subscriptions.
|
|
21
|
-
`;static
|
|
21
|
+
`;static jsonOutputSchema=u;static description=this.descriptionForHelp();static flags={...E,...A,...I,help:d.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:p(d.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_TOPIC",description:"The requested webhook topic."})),"api-version":p(d.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_API_VERSION",description:"The API Version of the webhook topic."})),"delivery-method":d.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":d.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:p(d.Flags.string({required:!1,hidden:!1,env:"SHOPIFY_FLAG_ADDRESS",description:`The URL where the webhook payload should be sent.
|
|
22
22
|
You will need a different address type for each delivery-method:
|
|
23
23
|
${l(i.HTTP)}
|
|
24
24
|
${l(i.PUBSUB)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as a}from"./chunk-
|
|
1
|
+
import{b as a}from"./chunk-SHOMIS6Q.js";import{b as s}from"./chunk-XEZPN5TR.js";import{Na as i}from"./chunk-YKDRUAY3.js";import{b as m}from"./chunk-AE3IQG7S.js";import{e as d,g as e}from"./chunk-VKWPEFWQ.js";e();var n=d(m(),1);var t=class c extends s{static description="List current notifications configured for the CLI.";static hidden=!0;static flags={"ignore-errors":n.Flags.boolean({hidden:!1,description:"Don't fail if an error occurs.",env:"SHOPIFY_FLAG_IGNORE_ERRORS"})};async run(){let{flags:f}=await this.parse(c);try{await a()}catch(r){let o="Error fetching notifications";if(r instanceof Error&&(o=o.concat(`: ${r.message}`)),await i(o,"expected_error"),!f["ignore-errors"])throw r}}};export{t as a};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as _}from"./chunk-TD6JBHUS.js";import{Eb as u,Fb as E,Y as y,ca as O,gb as d}from"./chunk-ZMOW2YZ4.js";import{g as a}from"./chunk-VKWPEFWQ.js";a();a();var f=class{export;input;inputBytes;output;outputBytes;logs;functionId;fuelConsumed;target;errorMessage;errorType;inputQueryVariablesMetafieldValue;inputQueryVariablesMetafieldNamespace;inputQueryVariablesMetafieldKey;constructor({export:t,input:r,inputBytes:s,output:n,outputBytes:o,logs:i,functionId:l,fuelConsumed:c,target:m,errorMessage:T,errorType:h,inputQueryVariablesMetafieldValue:S,inputQueryVariablesMetafieldNamespace:A,inputQueryVariablesMetafieldKey:g}){this.export=t,this.input=r,this.inputBytes=s,this.output=n,this.outputBytes=o,this.logs=i,this.functionId=l,this.fuelConsumed=c,this.target=m,this.errorMessage=T,this.errorType=h,this.inputQueryVariablesMetafieldValue=S,this.inputQueryVariablesMetafieldNamespace=A,this.inputQueryVariablesMetafieldKey=g}};a();function b(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&Object.getPrototypeOf(e)===Object.prototype}function I(e,t){return t?.deep&&b(e)||t?.deep&&Array.isArray(e)?p(e,t):e}function p(e,t){if(Array.isArray(e))return e.map(r=>t?.deep?p(r,t):r);if(b(e)){let r={};for(let[s,n]of Object.entries(e))r[y(s)]=I(n,t);return r}return e}var R=450,x=5*1e3,N=60*1e3,K=5,F=1e6,D="function_run",$="function_network_access",j="function_network_access.response_from_cache",Y="function_network_access.request_execution_in_background",X="function_network_access.request_execution",H="no_cached_response",W="cached_response_about_to_expire",q=async e=>{let{errors:t}=e.response,r=R,s=null,n="not_attempted";if(t.length>0)if(u(`Errors: ${t.map(o=>o.message).join(", ")}`),t.some(o=>o.status===401))try{s=await e.onResubscribe(),n="succeeded"}catch(o){u(`Failed to resubscribe to app logs: ${o}`),r=N,n="failed",e.onThrottle(r)}else t.some(o=>o.status===429)?(r=N,e.onThrottle(r)):(r=x,e.onUnknownError(r));return{retryIntervalMs:r,nextJwtToken:s,resubscribeResult:n}},z=({appLog:e,appLogPayload:t,storeName:r,prettyPrint:s=!0})=>{let{cursor:n,...o}=e,i=p({...o,payload:t,localTime:O(e.log_timestamp),storeName:r});return t instanceof f&&(i.payload.logs=t.logs.split(`
|
|
2
|
+
`).filter(Boolean),i.payload.inputQueryVariablesMetafieldValue&&(i.payload.inputQueryVariablesMetafieldValue=C(i.payload.inputQueryVariablesMetafieldValue))),s?JSON.stringify(i,null,2):JSON.stringify(i)},Z=async(e,t,r,s)=>{let n=await e.subscribeToAppLogs(t,r);if(!n.appLogsSubscribe)throw new _("Failed to subscribe to app logs: No response received");let{jwtToken:o,success:i,errors:l}=n.appLogsSubscribe;if(u(`Token: ${o}
|
|
3
|
+
`),u(`API Key: ${t.apiKey}
|
|
4
|
+
`),l&&l.length>0){let c=l.join(", ");throw await d({stripAnsi:!1},()=>{E(`Errors subscribing to app logs: ${c}`,s),E("App log streaming is not available in this session.",s)}),new _(c)}else{if(!o)throw new _("Failed to subscribe to app logs: No response received");let c=Array.isArray(t.shopIds)?t.shopIds:[t.shopIds];u(`Subscribed to App Events for shop ID(s) ${c.join(", ")}`),i!==void 0&&u(`Success: ${i}
|
|
5
|
+
`)}return o};function v(e){try{if(typeof e=="string"){let t=JSON.parse(e);return JSON.stringify(t,null,2)}else return typeof e=="object"&&e!==null?JSON.stringify(e,null,2):void 0}catch(t){throw new Error(`Error parsing JSON: ${t}`)}}var C=e=>{try{return JSON.parse(e)}catch{return e}};a();a();export{f as a,p as b,R as c,x as d,K as e,F as f,D as g,$ as h,j as i,Y as j,X as k,H as l,W as m,q as n,z as o,Z as p,v as q};
|