@poe-platform/safe-bash 0.1.799 → 0.1.801
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/README.md +48 -22
- package/dist/image-ast/index.browser.js +1503 -98
- package/dist/image-ast/index.js +1503 -98
- package/dist/mp4-ast/types.d.ts +1 -0
- package/dist/office-package/zip.d.ts +2 -0
- package/dist/office-package/zip.js +1 -1
- package/dist/pdf-ast/index.js +5 -4
- package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
- package/dist/safe-bash/chunks/chunk-3R3AANOR.js +26 -0
- package/dist/safe-bash/chunks/{chunk-TRVGCN3U.js → chunk-45PK3NWI.js} +4 -4
- package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-XB3B7KMM.js → chunk-6O77NL2S.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-T3JTVIEP.js → chunk-6PAVEFT3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PYVEAFJM.js → chunk-74GHTNJA.js} +3 -2
- package/dist/safe-bash/chunks/{chunk-LQHGH25W.js → chunk-7R5BDCG7.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-WUNK5NXJ.js → chunk-7VNF5BFF.js} +1140 -1660
- package/dist/safe-bash/chunks/{chunk-NHOXKQNE.js → chunk-A7XEHALN.js} +6 -6
- package/dist/safe-bash/chunks/{chunk-MHZ24KEI.js → chunk-AM5ESLPH.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-3L3T6LYV.js → chunk-AUSNDQTJ.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-YG5WAHK7.js → chunk-B7TAL7S5.js} +1 -3
- package/dist/safe-bash/chunks/{chunk-K7IQZE7D.js → chunk-C5OWC2TL.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-F3RV2F72.js → chunk-CHYGPFVM.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-M4CFCXHN.js → chunk-CS4MNM6I.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-H6JW3E4F.js → chunk-CTVWDACF.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-KTGR4U57.js → chunk-D3ANYGMC.js} +2 -3
- package/dist/safe-bash/chunks/{chunk-ENR3HB2B.js → chunk-E7OYNDGL.js} +1 -2
- package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-NX2SQVON.js → chunk-FNDNHAGE.js} +46 -27
- package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-KMH2DF3I.js → chunk-ICFDYV64.js} +7 -2
- package/dist/safe-bash/chunks/{chunk-T5KKDMYB.js → chunk-IVRQ4BXL.js} +7 -1
- package/dist/safe-bash/chunks/{chunk-KV7PKOHV.js → chunk-IWDICZVK.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-I4OAEOP6.js → chunk-J42RIHHJ.js} +1 -1
- package/dist/safe-bash/chunks/chunk-K6VCD7IY.js +106 -0
- package/dist/safe-bash/chunks/{chunk-63FXVDGF.js → chunk-LVOBFF4D.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-U5NUZPCC.js → chunk-MHMMRCYC.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-6HZYFL3H.js → chunk-NR3EM4LS.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JSVX4VIA.js → chunk-OQRVVGR6.js} +3 -2
- package/dist/safe-bash/chunks/{chunk-B3DDEDH2.js → chunk-OV6IHKO6.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-SPYL72GN.js → chunk-PQRAK7HU.js} +1196 -5781
- package/dist/safe-bash/chunks/chunk-SZH7EJLD.js +9221 -0
- package/dist/safe-bash/chunks/{chunk-AKC46AF6.js → chunk-TFIBK2GI.js} +8 -41
- package/dist/safe-bash/chunks/{chunk-ZNAFMYIA.js → chunk-UE5KZDEK.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-QU3BVQ53.js → chunk-UTBUUFDM.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-6IBTC4YL.js → chunk-VQDD3G76.js} +93 -39
- package/dist/safe-bash/chunks/{chunk-IUTD5FH5.js → chunk-VTH3MLDU.js} +2 -7
- package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
- package/dist/safe-bash/chunks/{csvkit-W2UEKH6P.js → csvkit-TACDU7FC.js} +3 -3
- package/dist/safe-bash/chunks/{ffmpeg-42CGASMV.js → ffmpeg-WTC3TEFI.js} +2 -2
- package/dist/safe-bash/chunks/{gh-26GYLH6D.js → gh-6WU6PXL4.js} +2 -2
- package/dist/safe-bash/chunks/{git-YREKMUVD.js → git-EFZIGJW4.js} +2 -2
- package/dist/safe-bash/chunks/{imagemagick-3YIX4XO2.js → imagemagick-EIEYGWPF.js} +2 -2
- package/dist/safe-bash/chunks/{implementation-E3YMKU3Z.js → implementation-MLFHUQ5M.js} +2 -2
- package/dist/safe-bash/chunks/mmdc-ROQJT5HQ.js +118 -0
- package/dist/safe-bash/chunks/{pdfimages-UE2UISP2.js → pdfimages-DW7LWXFI.js} +2 -2
- package/dist/safe-bash/chunks/{pdfinfo-RGARKLI5.js → pdfinfo-TIP6XLUQ.js} +4 -12
- package/dist/safe-bash/chunks/{pdftk-JY3WVCCC.js → pdftk-DMG22ITZ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftoppm-GPD3BMPY.js → pdftoppm-WNDYR72T.js} +2 -2
- package/dist/safe-bash/chunks/{pdftotext-K7GQ2QJZ.js → pdftotext-5IPZ4NI7.js} +2 -2
- package/dist/safe-bash/chunks/{qpdf-F4U7WUSU.js → qpdf-TTX2DIUA.js} +2 -2
- package/dist/safe-bash/chunks/{sips-RWENS7X5.js → sips-XYS46JPJ.js} +2 -2
- package/dist/safe-bash/chunks/{soffice-IT6W2C5F.js → soffice-TU73E5KL.js} +2 -2
- package/dist/safe-bash/chunks/{wkhtmltopdf-JYNDAHIZ.js → wkhtmltopdf-FSZ2CHGE.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-QBGA56UH.js → chunk-2ELYGJDD.js} +7 -7
- package/dist/safe-bash/command-chunks/chunk-2FGJYFWZ.js +44 -0
- package/dist/safe-bash/command-chunks/chunk-2H4JTFIL.js +53 -0
- package/dist/safe-bash/command-chunks/{chunk-52PCQXD2.js → chunk-2NHI5F5S.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-HDKVO47G.js → chunk-2SQEIUGJ.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-364TMWBT.js +946 -0
- package/dist/safe-bash/command-chunks/chunk-3E2OIS2J.js +7037 -0
- package/dist/safe-bash/command-chunks/chunk-3HHCU5YU.js +380 -0
- package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-4B7Y7S6E.js +61 -0
- package/dist/safe-bash/command-chunks/{chunk-LLCXZKZ6.js → chunk-4BB2SWJ5.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-IEXHHNOF.js → chunk-4J5CZ2DP.js} +2 -7
- package/dist/safe-bash/command-chunks/{chunk-WDHI3S6Y.js → chunk-4OOUQTQO.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-4ZHMW6F5.js +104 -0
- package/dist/safe-bash/command-chunks/{chunk-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-5BSTFCXG.js +553 -0
- package/dist/safe-bash/command-chunks/{chunk-MKQVQMXO.js → chunk-5LU4UCBR.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-5PWJG2UK.js +174 -0
- package/dist/safe-bash/command-chunks/chunk-5TBUOBDE.js +346 -0
- package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
- package/dist/safe-bash/command-chunks/chunk-5XY4DTNG.js +34 -0
- package/dist/safe-bash/command-chunks/chunk-5ZMZ573Q.js +140 -0
- package/dist/safe-bash/command-chunks/{chunk-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-67QKREJK.js +347 -0
- package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
- package/dist/safe-bash/command-chunks/chunk-6BNTBWIK.js +327 -0
- package/dist/safe-bash/command-chunks/chunk-6EPHJGGF.js +23 -0
- package/dist/safe-bash/command-chunks/chunk-6F4XCVON.js +266 -0
- package/dist/safe-bash/command-chunks/chunk-6KJ3LPI2.js +94 -0
- package/dist/safe-bash/command-chunks/{chunk-HLDTOR7M.js → chunk-6ZVI7LUY.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-X6NJC3IC.js → chunk-75OFBY5R.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-7K6JYKPJ.js +422 -0
- package/dist/safe-bash/command-chunks/chunk-7N2LI2KO.js +206 -0
- package/dist/safe-bash/command-chunks/{chunk-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
- package/dist/safe-bash/command-chunks/chunk-7U7EXOXX.js +1392 -0
- package/dist/safe-bash/command-chunks/{chunk-6CYTRQ24.js → chunk-7VTKQUA5.js} +20 -17
- package/dist/safe-bash/command-chunks/{chunk-BZPAWTUL.js → chunk-AEF5BA3D.js} +1 -1
- package/dist/safe-bash/command-chunks/{pptx-GBPNWNEP-7EQEVXV5.js → chunk-AI5JAXQF.js} +34820 -18029
- package/dist/safe-bash/command-chunks/{chunk-63R3FEZJ.js → chunk-AIV5BF5W.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AYUTO323.js → chunk-AKJG2XD3.js} +2 -18
- package/dist/safe-bash/command-chunks/{chunk-J34TZVMW.js → chunk-ALDC4XP4.js} +0 -5
- package/dist/safe-bash/command-chunks/chunk-AMO3THU4.js +105 -0
- package/dist/safe-bash/command-chunks/chunk-ARBYOQUZ.js +65 -0
- package/dist/safe-bash/command-chunks/chunk-BAGCY35S.js +231 -0
- package/dist/safe-bash/command-chunks/chunk-BAXU7B5Z.js +101 -0
- package/dist/safe-bash/command-chunks/{chunk-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
- package/dist/safe-bash/command-chunks/chunk-BNOU5YQS.js +182 -0
- package/dist/safe-bash/command-chunks/{chunk-4ZALPDBV.js → chunk-BPE5INLI.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-C5YYCQHW.js +1444 -0
- package/dist/safe-bash/command-chunks/chunk-C7I25AAL.js +25 -0
- package/dist/safe-bash/command-chunks/{chunk-4ONEXMD3.js → chunk-CAP7ZJSY.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
- package/dist/safe-bash/command-chunks/chunk-CQ5YGOGB.js +150 -0
- package/dist/safe-bash/command-chunks/{chunk-JCNNOMBV.js → chunk-CQTRW45K.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-CZ7EN3JG.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-DB453IE6.js +122 -0
- package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -0
- package/dist/safe-bash/command-chunks/chunk-DOKKNRRM.js +87 -0
- package/dist/safe-bash/command-chunks/{chunk-2PX5B7T5.js → chunk-DQAVUDDX.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-DT7BCTWY.js +249 -0
- package/dist/safe-bash/command-chunks/{chunk-6BETHLXZ.js → chunk-DZCY63VJ.js} +13 -11
- package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-EK6YNAXT.js +343 -0
- package/dist/safe-bash/command-chunks/chunk-EQ4HV54N.js +22 -0
- package/dist/safe-bash/command-chunks/{chunk-HLGKIZ25.js → chunk-F6OYH562.js} +2 -0
- package/dist/safe-bash/command-chunks/{chunk-MC3VWLIZ.js → chunk-FDBUV4HJ.js} +28 -19
- package/dist/safe-bash/command-chunks/{chunk-7FKUC34S.js → chunk-FPVUD6TH.js} +6 -3
- package/dist/safe-bash/command-chunks/chunk-FXELCPFX.js +195 -0
- package/dist/safe-bash/command-chunks/chunk-FXOA7RBK.js +42 -0
- package/dist/safe-bash/command-chunks/{chunk-LPORMIZS.js → chunk-FZTK4MFI.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
- package/dist/safe-bash/command-chunks/chunk-GFQZCKO6.js +272 -0
- package/dist/safe-bash/command-chunks/{chunk-CU5RLO62.js → chunk-GLOZX57Y.js} +92 -18
- package/dist/safe-bash/command-chunks/chunk-GMIHJYDG.js +331 -0
- package/dist/safe-bash/command-chunks/chunk-GOB777HR.js +97 -0
- package/dist/safe-bash/command-chunks/chunk-GRBWW4SG.js +48 -0
- package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
- package/dist/safe-bash/command-chunks/chunk-H622NS6Z.js +11 -0
- package/dist/safe-bash/command-chunks/{chunk-UI32HWGS.js → chunk-HMOZ6XVJ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AVSPNLWV.js → chunk-I237SNW5.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-43GSSUAY.js → chunk-II77KPZN.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-ZS3QPNUL.js → chunk-IR2BY7EL.js} +21 -6
- package/dist/safe-bash/command-chunks/{chunk-SG424QWS.js → chunk-JDYXY44P.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-JNZ3CVAE.js +147 -0
- package/dist/safe-bash/command-chunks/{chunk-4QJOYXVB.js → chunk-JV7LBUTP.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IKS2YXZQ.js → chunk-K67MWWWH.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-KFVV7ZJO.js +216 -0
- package/dist/safe-bash/command-chunks/{chunk-G4PNVO6Z.js → chunk-KP7AO66M.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KMCZ6P4O.js → chunk-KQLD3AED.js} +68 -7
- package/dist/safe-bash/command-chunks/chunk-KWESKQHR.js +25 -0
- package/dist/safe-bash/command-chunks/{chunk-YZ5SVZFD.js → chunk-KXU3IRUO.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-C7IHMJEW.js → chunk-KZC5UWFF.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-2WRTLCGK.js → chunk-LAOM65EE.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-LE5LZNHE.js +204 -0
- package/dist/safe-bash/command-chunks/{chunk-HFII3QYO.js → chunk-LWS62ISU.js} +46 -32
- package/dist/safe-bash/command-chunks/{chunk-BZDDAPSV.js → chunk-LWSBAWLT.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-MDH5T4OS.js +41 -0
- package/dist/safe-bash/command-chunks/{chunk-X7TM3AKW.js → chunk-MIXBO6U7.js} +20 -7
- package/dist/safe-bash/command-chunks/chunk-MM6HU6CX.js +20 -0
- package/dist/safe-bash/command-chunks/{chunk-MYJAZ3U2.js → chunk-MPL2466A.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HLBX5IRS.js → chunk-MQFIPHIQ.js} +46 -81
- package/dist/safe-bash/command-chunks/{chunk-ZJBR5Q5I.js → chunk-MSFXC3OC.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-NI7MKJPN.js → chunk-MTQH74CF.js} +3 -55
- package/dist/safe-bash/command-chunks/chunk-MWUZZWXK.js +354 -0
- package/dist/safe-bash/command-chunks/chunk-N4PFUSRM.js +35 -0
- package/dist/safe-bash/command-chunks/chunk-NCD7PEWH.js +298 -0
- package/dist/safe-bash/command-chunks/chunk-NFGI5IGF.js +266 -0
- package/dist/safe-bash/command-chunks/{chunk-I3K5RYU4.js → chunk-NKFYQSES.js} +73 -26
- package/dist/safe-bash/command-chunks/{chunk-KVFCSLKK.js → chunk-NXEQ3ESQ.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
- package/dist/safe-bash/command-chunks/{chunk-3VGGYEDH.js → chunk-ORYGZYKW.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-ZXKW7SJ2.js → chunk-OYYV7ZAF.js} +2 -2
- package/dist/safe-bash/command-chunks/chunk-P2N33UMN.js +270 -0
- package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-X2YQLGKS.js → chunk-PCEFOYA3.js} +240 -148
- package/dist/safe-bash/command-chunks/{chunk-OLQG7ZCN.js → chunk-PEF7K3UQ.js} +136 -75
- package/dist/safe-bash/command-chunks/chunk-PII4YEZW.js +123 -0
- package/dist/safe-bash/command-chunks/{chunk-AIRGA2SU.js → chunk-PMBFZXTK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ZT4KSS2V.js → chunk-PTT3I223.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
- package/dist/safe-bash/command-chunks/chunk-Q3EWDEUQ.js +185 -0
- package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-QKFSRZGQ.js +1091 -0
- package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-VVI4Z73I.js → chunk-QP4R6GLA.js} +5 -1
- package/dist/safe-bash/command-chunks/chunk-RMWQAAO5.js +2488 -0
- package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-HRLIAMXC.js → chunk-RZZI24ZE.js} +7 -6
- package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
- package/dist/safe-bash/command-chunks/chunk-SEM36PG5.js +11 -0
- package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ESMCX3YV.js → chunk-TGSNCQSR.js} +710 -143
- package/dist/safe-bash/command-chunks/chunk-TIOCQVUQ.js +557 -0
- package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-TNOA7FCQ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
- package/dist/safe-bash/command-chunks/chunk-TSCGT46G.js +363 -0
- package/dist/safe-bash/command-chunks/chunk-UG7SMZFF.js +178 -0
- package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
- package/dist/safe-bash/command-chunks/chunk-UXSR5BZH.js +136 -0
- package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
- package/dist/safe-bash/command-chunks/chunk-V6BEDRMQ.js +112 -0
- package/dist/safe-bash/command-chunks/chunk-V7A7DRTU.js +293 -0
- package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
- package/dist/safe-bash/command-chunks/{chunk-J4PEQWSF.js → chunk-VGG2DL5Q.js} +0 -1
- package/dist/safe-bash/command-chunks/chunk-VPR5LQYX.js +1228 -0
- package/dist/safe-bash/command-chunks/{chunk-EIVW3X3N.js → chunk-VSRGNQCP.js} +11 -6
- package/dist/safe-bash/command-chunks/{chunk-TYVCKQDH.js → chunk-VXSLJH7G.js} +56 -6
- package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
- package/dist/safe-bash/command-chunks/{src-UJOWAS2S.js → chunk-WD3ERGRY.js} +77 -277
- package/dist/safe-bash/command-chunks/{chunk-5ZSM4UFN.js → chunk-WECIOOQB.js} +8 -64
- package/dist/safe-bash/command-chunks/{chunk-YFSDDFGV.js → chunk-WH627NJL.js} +446 -53
- package/dist/safe-bash/command-chunks/chunk-WNE7FPVR.js +236 -0
- package/dist/safe-bash/command-chunks/{chunk-UKS2XJZI.js → chunk-WPYIOKE3.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-HHP343KT.js → chunk-WTECBRU4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-AO6Z5EQ7.js → chunk-WVE64WM2.js} +6 -5
- package/dist/safe-bash/command-chunks/chunk-WVHONVZ4.js +594 -0
- package/dist/safe-bash/command-chunks/chunk-XIIBTGC5.js +580 -0
- package/dist/safe-bash/command-chunks/chunk-XJXU3VVH.js +737 -0
- package/dist/safe-bash/command-chunks/chunk-XNLFHHOC.js +63 -0
- package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
- package/dist/safe-bash/command-chunks/chunk-Y5INTD6S.js +220 -0
- package/dist/safe-bash/command-chunks/chunk-YIQACGEW.js +43 -0
- package/dist/safe-bash/command-chunks/chunk-YOF7R4OY.js +80 -0
- package/dist/safe-bash/command-chunks/{chunk-VZHRZMS7.js → chunk-YOFC45RK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2FUAW6GO.js → chunk-Z45N42QC.js} +75 -11
- package/dist/safe-bash/command-chunks/chunk-ZHUWOUWB.js +618 -0
- package/dist/safe-bash/command-chunks/{chunk-OPUJSTHS.js → chunk-ZYHTWNAE.js} +215 -67
- package/dist/safe-bash/command-chunks/chunk-ZYXH3B66.js +636 -0
- package/dist/safe-bash/command-chunks/{model-store-L35QTZMJ.js → model-store-WPKMRPV4.js} +2 -2
- package/dist/safe-bash/command-chunks/pptx-7G52EJ6L-4JACH5FB.js +625 -0
- package/dist/safe-bash/command-chunks/python-worker-source-TYOFJMCW.js +4 -0
- package/dist/safe-bash/command-chunks/src-ICMQISAA.js +501 -0
- package/dist/safe-bash/commands/archive/create.d.ts +1 -17
- package/dist/safe-bash/commands/archive/create.js +1 -252
- package/dist/safe-bash/commands/archive/extract.d.ts +1 -11
- package/dist/safe-bash/commands/archive/extract.js +1 -640
- package/dist/safe-bash/commands/archive/format.d.ts +1 -32
- package/dist/safe-bash/commands/archive/format.js +1 -225
- package/dist/safe-bash/commands/archive/index.d.ts +5 -10
- package/dist/safe-bash/commands/archive/index.js +6 -931
- package/dist/safe-bash/commands/archive/listing.d.ts +1 -2
- package/dist/safe-bash/commands/archive/listing.js +1 -21
- package/dist/safe-bash/commands/archive/modes.d.ts +1 -5
- package/dist/safe-bash/commands/archive/modes.js +1 -182
- package/dist/safe-bash/commands/archive/options.d.ts +1 -53
- package/dist/safe-bash/commands/archive/options.js +1 -462
- package/dist/safe-bash/commands/archive/stream.d.ts +1 -22
- package/dist/safe-bash/commands/archive/stream.js +1 -188
- package/dist/safe-bash/commands/archive/transform.d.ts +1 -16
- package/dist/safe-bash/commands/archive/transform.js +1 -85
- package/dist/safe-bash/commands/archive/unzip/arguments.d.ts +1 -53
- package/dist/safe-bash/commands/archive/unzip/arguments.js +1 -322
- package/dist/safe-bash/commands/archive/unzip/safety.d.ts +1 -32
- package/dist/safe-bash/commands/archive/unzip/safety.js +1 -295
- package/dist/safe-bash/commands/archive/unzip.d.ts +1 -3
- package/dist/safe-bash/commands/archive/unzip.js +1 -398
- package/dist/safe-bash/commands/archive/zip/aes.d.ts +1 -17
- package/dist/safe-bash/commands/archive/zip/aes.js +1 -156
- package/dist/safe-bash/commands/archive/zip/comments.d.ts +1 -17
- package/dist/safe-bash/commands/archive/zip/comments.js +1 -83
- package/dist/safe-bash/commands/archive/zip/crc.d.ts +1 -1
- package/dist/safe-bash/commands/archive/zip/crc.js +1 -1
- package/dist/safe-bash/commands/archive/zip/crypto.d.ts +1 -19
- package/dist/safe-bash/commands/archive/zip/crypto.js +1 -118
- package/dist/safe-bash/commands/archive/zip/dates.d.ts +1 -4
- package/dist/safe-bash/commands/archive/zip/dates.js +1 -66
- package/dist/safe-bash/commands/archive/zip/environment.d.ts +1 -2
- package/dist/safe-bash/commands/archive/zip/environment.js +1 -62
- package/dist/safe-bash/commands/archive/zip/grow.d.ts +1 -3
- package/dist/safe-bash/commands/archive/zip/grow.js +1 -2
- package/dist/safe-bash/commands/archive/zip/help.d.ts +1 -4
- package/dist/safe-bash/commands/archive/zip/help.js +1 -182
- package/dist/safe-bash/commands/archive/zip/line-endings.d.ts +1 -2
- package/dist/safe-bash/commands/archive/zip/line-endings.js +1 -194
- package/dist/safe-bash/commands/archive/zip/log.d.ts +1 -22
- package/dist/safe-bash/commands/archive/zip/log.js +1 -159
- package/dist/safe-bash/commands/archive/zip/lzma.d.ts +1 -9
- package/dist/safe-bash/commands/archive/zip/lzma.js +1 -40
- package/dist/safe-bash/commands/archive/zip/move.d.ts +1 -11
- package/dist/safe-bash/commands/archive/zip/move.js +1 -59
- package/dist/safe-bash/commands/archive/zip/names.d.ts +1 -2
- package/dist/safe-bash/commands/archive/zip/names.js +1 -33
- package/dist/safe-bash/commands/archive/zip/options.d.ts +1 -13
- package/dist/safe-bash/commands/archive/zip/options.js +1 -124
- package/dist/safe-bash/commands/archive/zip/repair.d.ts +1 -10
- package/dist/safe-bash/commands/archive/zip/repair.js +1 -392
- package/dist/safe-bash/commands/archive/zip/safety.d.ts +1 -54
- package/dist/safe-bash/commands/archive/zip/safety.js +1 -360
- package/dist/safe-bash/commands/archive/zip/sfx.d.ts +1 -4
- package/dist/safe-bash/commands/archive/zip/sfx.js +1 -52
- package/dist/safe-bash/commands/archive/zip/test-command.d.ts +1 -5
- package/dist/safe-bash/commands/archive/zip/test-command.js +1 -101
- package/dist/safe-bash/commands/archive/zip/volumes.d.ts +1 -21
- package/dist/safe-bash/commands/archive/zip/volumes.js +1 -281
- package/dist/safe-bash/commands/archive/zip/zip64.d.ts +1 -30
- package/dist/safe-bash/commands/archive/zip/zip64.js +1 -227
- package/dist/safe-bash/commands/archive/zip-format.d.ts +1 -68
- package/dist/safe-bash/commands/archive/zip-format.js +1 -1075
- package/dist/safe-bash/commands/archive/zip.d.ts +1 -3
- package/dist/safe-bash/commands/archive/zip.js +1 -1523
- package/dist/safe-bash/commands/awk/index.d.ts +2 -0
- package/dist/safe-bash/commands/awk/index.js +2 -0
- package/dist/safe-bash/commands/bytes/compression/index.js +4 -2
- package/dist/safe-bash/commands/copy-preserve.d.ts +1 -0
- package/dist/safe-bash/commands/csplit/index.browser.js +2 -2
- package/dist/safe-bash/commands/curl/index.d.ts +2 -0
- package/dist/safe-bash/commands/curl/index.js +2 -0
- package/dist/safe-bash/commands/diff/index.d.ts +2 -0
- package/dist/safe-bash/commands/diff/index.js +2 -0
- package/dist/safe-bash/commands/diff-patch/diff-format.d.ts +1 -10
- package/dist/safe-bash/commands/diff-patch/diff-format.js +1 -237
- package/dist/safe-bash/commands/diff-patch/diff-options.d.ts +1 -38
- package/dist/safe-bash/commands/diff-patch/diff-options.js +1 -261
- package/dist/safe-bash/commands/diff-patch/diff-output.d.ts +1 -20
- package/dist/safe-bash/commands/diff-patch/diff-output.js +1 -290
- package/dist/safe-bash/commands/diff-patch/diff.d.ts +1 -2
- package/dist/safe-bash/commands/diff-patch/diff.js +1 -656
- package/dist/safe-bash/commands/diff-patch/index.d.ts +4 -5
- package/dist/safe-bash/commands/diff-patch/index.js +8 -333
- package/dist/safe-bash/commands/diff-patch/patch-envelope.d.ts +1 -2
- package/dist/safe-bash/commands/diff-patch/patch-envelope.js +1 -63
- package/dist/safe-bash/commands/diff-patch/patch-formats.d.ts +1 -7
- package/dist/safe-bash/commands/diff-patch/patch-formats.js +1 -264
- package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.d.ts +1 -41
- package/dist/safe-bash/commands/diff-patch/patch-gnu-paths.js +1 -263
- package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.d.ts +1 -3
- package/dist/safe-bash/commands/diff-patch/patch-gnu-reject.js +1 -100
- package/dist/safe-bash/commands/diff-patch/patch-path.d.ts +1 -3
- package/dist/safe-bash/commands/diff-patch/patch-path.js +1 -91
- package/dist/safe-bash/commands/diff-patch/patch-publication.d.ts +1 -13
- package/dist/safe-bash/commands/diff-patch/patch-publication.js +1 -107
- package/dist/safe-bash/commands/diff-patch/patch.d.ts +1 -2
- package/dist/safe-bash/commands/diff-patch/patch.js +1 -653
- package/dist/safe-bash/commands/diff-patch/shared.d.ts +1 -53
- package/dist/safe-bash/commands/diff-patch/shared.js +1 -267
- package/dist/safe-bash/commands/diff-patch/unified.d.ts +1 -52
- package/dist/safe-bash/commands/diff-patch/unified.js +1 -385
- package/dist/safe-bash/commands/directory-admission.d.ts +1 -3
- package/dist/safe-bash/commands/directory-admission.js +1 -26
- package/dist/safe-bash/commands/docx/index.browser.js +1 -1
- package/dist/safe-bash/commands/execution.js +19 -13
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/filesystem.d.ts +1 -1
- package/dist/safe-bash/commands/filesystem.js +17 -13
- package/dist/safe-bash/commands/find/index.d.ts +2 -0
- package/dist/safe-bash/commands/find/index.js +2 -0
- package/dist/safe-bash/commands/find-format.d.ts +1 -20
- package/dist/safe-bash/commands/find-format.js +1 -161
- package/dist/safe-bash/commands/find.d.ts +2 -18
- package/dist/safe-bash/commands/find.js +2 -1236
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/gzip/index.d.ts +2 -0
- package/dist/safe-bash/commands/gzip/index.js +2 -0
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/htmlq/index.d.ts +1 -1
- package/dist/safe-bash/commands/iconv/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.browser.js +2 -2
- package/dist/safe-bash/commands/line-endings/index.d.ts +1 -1
- package/dist/safe-bash/commands/line-endings/index.js +1 -262
- package/dist/safe-bash/commands/llm/index.browser.js +4 -2
- package/dist/safe-bash/commands/llm/providers/index.browser.js +1 -1
- package/dist/safe-bash/commands/mdq/index.browser.js +3 -3
- package/dist/safe-bash/commands/media/index.browser.js +1 -1
- package/dist/safe-bash/commands/metadata/chmod.d.ts +1 -4
- package/dist/safe-bash/commands/metadata/chmod.js +2 -63
- package/dist/safe-bash/commands/network/aggregate.d.ts +1 -4
- package/dist/safe-bash/commands/network/aggregate.js +1 -23
- package/dist/safe-bash/commands/network/args.d.ts +1 -68
- package/dist/safe-bash/commands/network/args.js +1 -321
- package/dist/safe-bash/commands/network/authorizer.d.ts +1 -6
- package/dist/safe-bash/commands/network/authorizer.js +1 -33
- package/dist/safe-bash/commands/network/body.d.ts +1 -9
- package/dist/safe-bash/commands/network/body.js +1 -393
- package/dist/safe-bash/commands/network/curl.d.ts +3 -13
- package/dist/safe-bash/commands/network/curl.js +6 -695
- package/dist/safe-bash/commands/network/deadline.d.ts +1 -2
- package/dist/safe-bash/commands/network/deadline.js +1 -14
- package/dist/safe-bash/commands/network/decode.d.ts +1 -2
- package/dist/safe-bash/commands/network/decode.js +1 -79
- package/dist/safe-bash/commands/network/fetch-transport.d.ts +1 -7
- package/dist/safe-bash/commands/network/fetch-transport.js +1 -94
- package/dist/safe-bash/commands/network/form-content-type.d.ts +1 -5
- package/dist/safe-bash/commands/network/form-content-type.js +1 -63
- package/dist/safe-bash/commands/network/form-headers.d.ts +1 -2
- package/dist/safe-bash/commands/network/form-headers.js +1 -35
- package/dist/safe-bash/commands/network/glob.d.ts +1 -7
- package/dist/safe-bash/commands/network/glob.js +1 -134
- package/dist/safe-bash/commands/network/index.browser.js +4 -12
- package/dist/safe-bash/commands/network/input.d.ts +1 -5
- package/dist/safe-bash/commands/network/input.js +1 -276
- package/dist/safe-bash/commands/network/output.d.ts +1 -6
- package/dist/safe-bash/commands/network/output.js +1 -131
- package/dist/safe-bash/commands/network/platform-portable.d.ts +1 -5
- package/dist/safe-bash/commands/network/platform-portable.js +1 -26
- package/dist/safe-bash/commands/network/private-address.d.ts +1 -1
- package/dist/safe-bash/commands/network/private-address.js +1 -44
- package/dist/safe-bash/commands/network/public.d.ts +2 -2
- package/dist/safe-bash/commands/network/public.js +2 -2
- package/dist/safe-bash/commands/network/shared.d.ts +1 -14
- package/dist/safe-bash/commands/network/shared.js +1 -71
- package/dist/safe-bash/commands/network/transport.js +2 -2
- package/dist/safe-bash/commands/network/types.d.ts +1 -37
- package/dist/safe-bash/commands/network/types.js +1 -31
- package/dist/safe-bash/commands/network/url.d.ts +1 -2
- package/dist/safe-bash/commands/network/url.js +1 -30
- package/dist/safe-bash/commands/network/wget.d.ts +3 -3
- package/dist/safe-bash/commands/network/wget.js +9 -332
- package/dist/safe-bash/commands/node/filesystem.js +3 -2
- package/dist/safe-bash/commands/node/index.browser.js +8 -9
- package/dist/safe-bash/commands/node/index.d.ts +3 -3
- package/dist/safe-bash/commands/node/index.js +5 -0
- package/dist/safe-bash/commands/node/safejs.d.ts +3 -3
- package/dist/safe-bash/commands/node/safejs.js +6 -1
- package/dist/safe-bash/commands/node/types.d.ts +1 -1
- package/dist/safe-bash/commands/node/types.js +1 -1
- package/dist/safe-bash/commands/node/unconfigured.d.ts +3 -0
- package/dist/safe-bash/commands/node/unconfigured.js +10 -0
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/patch/index.d.ts +2 -0
- package/dist/safe-bash/commands/patch/index.js +2 -0
- package/dist/safe-bash/commands/pdfinfo/index.js +2 -1
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- package/dist/safe-bash/commands/predicates.js +3 -4
- package/dist/safe-bash/commands/python/host-capabilities.js +31 -14
- package/dist/safe-bash/commands/python/index.browser.js +11 -11
- package/dist/safe-bash/commands/python/llm-capability.d.ts +1 -0
- package/dist/safe-bash/commands/python/llm-capability.js +27 -7
- package/dist/safe-bash/commands/python/llm-module.js +11 -0
- package/dist/safe-bash/commands/python/manifest.d.ts +2 -0
- package/dist/safe-bash/commands/python/manifest.js +13 -6
- package/dist/safe-bash/commands/python/provisioning.js +1 -1
- package/dist/safe-bash/commands/python/shell-capability.d.ts +1 -0
- package/dist/safe-bash/commands/python/shell-capability.js +3 -2
- package/dist/safe-bash/commands/python/worker.browser.js +3 -3
- package/dist/safe-bash/commands/regex-execution/matching.js +1 -2
- package/dist/safe-bash/commands/regex-execution/public.browser.js +8 -8
- package/dist/safe-bash/commands/safejs/runtime.js +16 -7
- package/dist/safe-bash/commands/search/index.d.ts +1 -1
- package/dist/safe-bash/commands/search/index.js +1 -347
- package/dist/safe-bash/commands/search/portable.d.ts +2 -2
- package/dist/safe-bash/commands/search/portable.js +3 -2
- package/dist/safe-bash/commands/sed/index.d.ts +2 -0
- package/dist/safe-bash/commands/sed/index.js +2 -0
- package/dist/safe-bash/commands/standard.d.ts +1 -0
- package/dist/safe-bash/commands/standard.js +2 -1
- package/dist/safe-bash/commands/streams.js +6 -24
- package/dist/safe-bash/commands/tar/index.d.ts +2 -0
- package/dist/safe-bash/commands/tar/index.js +2 -0
- package/dist/safe-bash/commands/text-programs/awk-inspection.d.ts +1 -19
- package/dist/safe-bash/commands/text-programs/awk-inspection.js +1 -50
- package/dist/safe-bash/commands/text-programs/awk-pipes.d.ts +2 -0
- package/dist/safe-bash/commands/text-programs/awk-pipes.js +2 -0
- package/dist/safe-bash/commands/text-programs/awk-pretty.d.ts +1 -3
- package/dist/safe-bash/commands/text-programs/awk-pretty.js +1 -197
- package/dist/safe-bash/commands/text-programs/awk-quote.d.ts +1 -2
- package/dist/safe-bash/commands/text-programs/awk-quote.js +1 -15
- package/dist/safe-bash/commands/text-programs/awk-reader.d.ts +1 -42
- package/dist/safe-bash/commands/text-programs/awk-reader.js +1 -449
- package/dist/safe-bash/commands/text-programs/awk-retention.d.ts +1 -13
- package/dist/safe-bash/commands/text-programs/awk-retention.js +1 -51
- package/dist/safe-bash/commands/text-programs/awk-runtime.d.ts +1 -150
- package/dist/safe-bash/commands/text-programs/awk-runtime.js +1 -2627
- package/dist/safe-bash/commands/text-programs/awk-syntax.d.ts +1 -142
- package/dist/safe-bash/commands/text-programs/awk-syntax.js +1 -509
- package/dist/safe-bash/commands/text-programs/awk-values.d.ts +1 -32
- package/dist/safe-bash/commands/text-programs/awk-values.js +1 -386
- package/dist/safe-bash/commands/text-programs/awk.d.ts +1 -3
- package/dist/safe-bash/commands/text-programs/awk.js +1 -361
- package/dist/safe-bash/commands/text-programs/inplace.d.ts +1 -16
- package/dist/safe-bash/commands/text-programs/inplace.js +1 -155
- package/dist/safe-bash/commands/text-programs/sed.d.ts +1 -3
- package/dist/safe-bash/commands/text-programs/sed.js +1 -1647
- package/dist/safe-bash/commands/text.js +268 -364
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/unzip/index.d.ts +2 -0
- package/dist/safe-bash/commands/unzip/index.js +2 -0
- package/dist/safe-bash/commands/wget/index.d.ts +2 -0
- package/dist/safe-bash/commands/wget/index.js +2 -0
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +8 -3
- package/dist/safe-bash/commands/yq/index.d.ts +1 -6
- package/dist/safe-bash/commands/yq/index.js +1 -36
- package/dist/safe-bash/commands/zip/index.d.ts +2 -0
- package/dist/safe-bash/commands/zip/index.js +2 -0
- package/dist/safe-bash/core.browser.js +2 -2
- package/dist/safe-bash/core.d.ts +14 -2
- package/dist/safe-bash/core.js +8 -2
- package/dist/safe-bash/fs/s3/index.d.ts +2 -2
- package/dist/safe-bash/fs/s3/index.js +1 -1
- package/dist/safe-bash/full-core.browser.js +321 -286
- package/dist/safe-bash/jobs.browser.js +5 -5
- package/dist/safe-bash/lazy-mmdc.d.ts +6 -0
- package/dist/safe-bash/lazy-mmdc.js +23 -0
- package/dist/safe-bash/opt-in/commands/dd/index.js +2 -0
- package/dist/safe-bash/opt-in/commands/yq/mike.js +6 -13
- package/dist/safe-bash/opt-in/commands/yq/native-work.d.ts +1 -0
- package/dist/safe-bash/opt-in/commands/yq/native-work.js +17 -0
- package/dist/safe-bash/opt-in/optional/commands/shuf/options.d.ts +1 -0
- package/dist/safe-bash/opt-in/optional/commands/shuf/options.js +2 -4
- package/dist/safe-bash/opt-in/optional/commands/shuf/shuf.js +2 -1
- package/dist/safe-bash/optional-host.browser.js +15 -11
- package/dist/safe-bash/optional-host.d.ts +1 -1
- package/dist/safe-bash/optional-host.js +1 -1
- package/dist/safe-bash/playwright/ability-execution.js +3 -2
- package/dist/safe-bash/playwright/adapter.js +1 -1
- package/dist/safe-bash/playwright/controller.js +9 -8
- package/dist/safe-bash/playwright/modal-capabilities.js +2 -1
- package/dist/safe-bash/playwright/native-json-snapshot.js +4 -3
- package/dist/safe-bash/playwright/native-snapshot.js +5 -4
- package/dist/safe-bash/playwright/open-options.js +3 -3
- package/dist/safe-bash/playwright/resource-limit.d.ts +2 -0
- package/dist/safe-bash/playwright/resource-limit.js +4 -0
- package/dist/safe-bash/playwright/session-configuration.js +8 -3
- package/dist/safe-bash/playwright/snapshot.js +8 -7
- package/dist/safe-bash/playwright/standard-capabilities.js +5 -4
- package/dist/safe-bash/plugins/composition.d.ts +1 -0
- package/dist/safe-bash/plugins/composition.js +3 -8
- package/dist/safe-bash/plugins/index.browser.js +27 -29
- package/dist/safe-bash/registry-entry.browser.js +28 -30
- package/dist/safe-bash/shell/arrays/bindings.d.ts +3 -5
- package/dist/safe-bash/shell/arrays/bindings.js +7 -3
- package/dist/safe-bash/shell/arrays/state.js +4 -0
- package/dist/safe-bash/shell/brace-expansion.js +1 -1
- package/dist/safe-bash/shell/dynamic-variables.d.ts +10 -0
- package/dist/safe-bash/shell/dynamic-variables.js +25 -0
- package/dist/safe-bash/shell/input.js +16 -14
- package/dist/safe-bash/shell/parser.js +8 -1
- package/dist/safe-bash/shell/runtime.d.ts +7 -4
- package/dist/safe-bash/shell/runtime.js +604 -802
- package/dist/safe-bash/shell/shell.js +2 -31
- package/dist/safe-bash/shell/types.d.ts +2 -0
- package/dist/safe-bash/shell/value-state.js +17 -2
- package/dist/safe-bash/shell/worker-limits.js +1 -0
- package/dist/safe-bash/shell-entry.browser.js +25 -27
- package/dist/safe-bash/trap.browser.d.ts +3 -0
- package/dist/safe-bash/trap.browser.js +14 -0
- package/dist/safe-bash/worker/host.js +1 -1
- package/dist/safe-bash/yq-browser/index.js +1 -1
- package/dist/safe-bash-base-encoding-engine/base.js +2 -2
- package/dist/safe-bash-base-encoding-engine/shared.js +1 -1
- package/dist/safe-bash-byte-input-engine/index.d.ts +3 -2
- package/dist/safe-bash-byte-input-engine/index.js +4 -1
- package/dist/safe-bash-checksum-engine/index.js +13 -6
- package/dist/safe-bash-command-apply-patch/apply.d.ts +1 -1
- package/dist/safe-bash-command-apply-patch/apply.js +4 -3
- package/dist/safe-bash-command-apply-patch/index.js +4 -4
- package/dist/safe-bash-command-apply-patch/matcher.js +1 -1
- package/dist/safe-bash-command-apply-patch/parser.js +1 -1
- package/dist/safe-bash-command-awk/LICENSE +21 -0
- package/dist/safe-bash-command-awk/awk-inspection.d.ts +19 -0
- package/dist/safe-bash-command-awk/awk-inspection.js +9 -0
- package/dist/safe-bash-command-awk/awk-pipes.d.ts +19 -0
- package/dist/safe-bash-command-awk/awk-pipes.js +8 -0
- package/dist/safe-bash-command-awk/awk-pretty.d.ts +3 -0
- package/dist/safe-bash-command-awk/awk-pretty.js +8 -0
- package/dist/safe-bash-command-awk/awk-quote.d.ts +2 -0
- package/dist/safe-bash-command-awk/awk-quote.js +7 -0
- package/dist/safe-bash-command-awk/awk-reader.d.ts +42 -0
- package/dist/safe-bash-command-awk/awk-reader.js +9 -0
- package/dist/safe-bash-command-awk/awk-retention.d.ts +13 -0
- package/dist/safe-bash-command-awk/awk-retention.js +7 -0
- package/dist/safe-bash-command-awk/awk-runtime.d.ts +151 -0
- package/dist/safe-bash-command-awk/awk-runtime.js +11 -0
- package/dist/safe-bash-command-awk/awk-syntax.d.ts +144 -0
- package/dist/safe-bash-command-awk/awk-syntax.js +14 -0
- package/dist/safe-bash-command-awk/awk-values.d.ts +32 -0
- package/dist/safe-bash-command-awk/awk-values.js +35 -0
- package/dist/safe-bash-command-awk/awk.d.ts +3 -0
- package/dist/safe-bash-command-awk/awk.js +16 -0
- package/dist/safe-bash-command-awk/index.d.ts +7 -0
- package/dist/safe-bash-command-awk/index.js +36 -0
- package/dist/safe-bash-command-bc/index.d.ts +6 -0
- package/dist/safe-bash-command-bc/index.js +136 -266
- package/dist/safe-bash-command-column/column.js +5 -5
- package/dist/safe-bash-command-column/display.d.ts +1 -1
- package/dist/safe-bash-command-column/display.js +1 -1
- package/dist/safe-bash-command-column/index.js +5 -5
- package/dist/safe-bash-command-column/internal.d.ts +0 -2
- package/dist/safe-bash-command-column/internal.js +1 -1
- package/dist/safe-bash-command-column/layout.js +4 -4
- package/dist/safe-bash-command-column/table.js +2 -2
- package/dist/safe-bash-command-comm/comm.js +1 -1
- package/dist/safe-bash-command-comm/index.js +1 -1
- package/dist/safe-bash-command-csplit/command.js +2 -2
- package/dist/safe-bash-command-csplit/index.js +2 -2
- package/dist/safe-bash-command-csvcut/index.d.ts +1 -0
- package/dist/safe-bash-command-csvcut/index.js +1 -0
- package/dist/safe-bash-command-csvgrep/index.d.ts +1 -0
- package/dist/safe-bash-command-csvgrep/index.js +2 -2
- package/dist/safe-bash-command-csvkit/contracts.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/csvpy-interpreter.d.ts +2 -1
- package/dist/safe-bash-command-csvkit/default-csvpy.d.ts +11 -0
- package/dist/safe-bash-command-csvkit/errors.js +22 -0
- package/dist/safe-bash-command-csvkit/index.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/index.js +180 -12
- package/dist/safe-bash-command-csvkit/python-worker-browser.d.ts +3 -0
- package/dist/safe-bash-command-csvkit/python-worker-browser.js +16 -0
- package/dist/safe-bash-command-csvkit/python-worker-contract.d.ts +20 -0
- package/dist/safe-bash-command-csvkit/python-worker-node.d.ts +3 -0
- package/dist/safe-bash-command-csvkit/python-worker-node.js +9 -0
- package/dist/safe-bash-command-csvkit/runtime.d.ts +1 -0
- package/dist/safe-bash-command-csvkit/sync-support.js +1 -1
- package/dist/safe-bash-command-curl/LICENSE +21 -0
- package/dist/safe-bash-command-curl/curl.d.ts +13 -0
- package/dist/safe-bash-command-curl/curl.js +9 -0
- package/dist/safe-bash-command-curl/index.d.ts +6 -0
- package/dist/safe-bash-command-curl/index.js +26 -0
- package/dist/safe-bash-command-dd/index.js +2 -0
- package/dist/safe-bash-command-diff/LICENSE +21 -0
- package/dist/safe-bash-command-diff/diff-format.d.ts +10 -0
- package/dist/safe-bash-command-diff/diff-format.js +10 -0
- package/dist/safe-bash-command-diff/diff-options.d.ts +38 -0
- package/dist/safe-bash-command-diff/diff-options.js +7 -0
- package/dist/safe-bash-command-diff/diff-output.d.ts +20 -0
- package/dist/safe-bash-command-diff/diff-output.js +19 -0
- package/dist/safe-bash-command-diff/diff.d.ts +2 -0
- package/dist/safe-bash-command-diff/diff.js +10 -0
- package/dist/safe-bash-command-diff/index.d.ts +8 -0
- package/dist/safe-bash-command-diff/index.js +34 -0
- package/dist/safe-bash-command-diff/sync.d.ts +2 -0
- package/dist/safe-bash-command-diff/sync.js +9 -0
- package/dist/safe-bash-command-diff3/index.js +5 -5
- package/dist/safe-bash-command-docx/index.d.ts +4 -4
- package/dist/safe-bash-command-docx/index.js +12 -5
- package/dist/safe-bash-command-dos2unix/index.d.ts +1 -0
- package/dist/safe-bash-command-dos2unix/index.js +225 -1
- package/dist/safe-bash-command-dos2unix/sync.d.ts +1 -0
- package/dist/safe-bash-command-exiftool/index.d.ts +1 -0
- package/dist/safe-bash-command-exiftool/index.js +2 -2
- package/dist/safe-bash-command-factor/command.js +2 -2
- package/dist/safe-bash-command-factor/index.js +2 -2
- package/dist/safe-bash-command-fd/index.js +9 -9
- package/dist/safe-bash-command-ffmpeg/index.js +117 -102
- package/dist/safe-bash-command-file/index.js +4 -4
- package/dist/safe-bash-command-file/shared.js +1 -1
- package/dist/safe-bash-command-find/LICENSE +21 -0
- package/dist/safe-bash-command-find/find-format.d.ts +20 -0
- package/dist/safe-bash-command-find/find-format.js +9 -0
- package/dist/safe-bash-command-find/find.d.ts +18 -0
- package/dist/safe-bash-command-find/find.js +10 -0
- package/dist/safe-bash-command-find/index.d.ts +13 -0
- package/dist/safe-bash-command-find/index.js +45 -0
- package/dist/safe-bash-command-fmt/index.js +7 -4
- package/dist/safe-bash-command-git/git_rust.wasm +0 -0
- package/dist/safe-bash-command-git/index.js +5 -7
- package/dist/safe-bash-command-git/wasm.generated.js +1 -1
- package/dist/safe-bash-command-gzip/LICENSE +21 -0
- package/dist/safe-bash-command-gzip/index.d.ts +11 -0
- package/dist/safe-bash-command-gzip/index.js +95 -0
- package/dist/safe-bash-command-hexdump/command.js +4 -4
- package/dist/safe-bash-command-hexdump/custom.d.ts +24 -0
- package/dist/safe-bash-command-hexdump/index.js +4 -4
- package/dist/safe-bash-command-hexdump/internal.d.ts +2 -0
- package/dist/safe-bash-command-hexdump/internal.js +1 -1
- package/dist/safe-bash-command-hexdump/io.js +2 -2
- package/dist/safe-bash-command-hexdump/options.d.ts +3 -0
- package/dist/safe-bash-command-hexdump/options.js +2 -2
- package/dist/safe-bash-command-hostname/index.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/budget.js +1 -1
- package/dist/safe-bash-command-html-to-markdown/entities.js +3 -3
- package/dist/safe-bash-command-html-to-markdown/index.js +11 -11
- package/dist/safe-bash-command-html-to-markdown/input.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/parser.d.ts +1 -0
- package/dist/safe-bash-command-html-to-markdown/parser.js +4 -4
- package/dist/safe-bash-command-html-to-markdown/render.js +5 -5
- package/dist/safe-bash-command-html-to-markdown/text.js +2 -2
- package/dist/safe-bash-command-htmlq/index.d.ts +1 -0
- package/dist/safe-bash-command-htmlq/index.js +39 -17
- package/dist/safe-bash-command-iconv/codec.js +1 -1
- package/dist/safe-bash-command-iconv/command.js +2 -2
- package/dist/safe-bash-command-iconv/index.js +2 -2
- package/dist/safe-bash-command-imagemagick/index.js +45 -35
- package/dist/safe-bash-command-join/index.js +1 -1
- package/dist/safe-bash-command-join/join.js +1 -1
- package/dist/safe-bash-command-jq/index.js +1 -1
- package/dist/safe-bash-command-jq/jq.js +1 -1
- package/dist/safe-bash-command-less/index.js +43 -28
- package/dist/safe-bash-command-llm/command.js +1 -1
- package/dist/safe-bash-command-llm/index.d.ts +1 -0
- package/dist/safe-bash-command-llm/index.js +16 -14
- package/dist/safe-bash-command-llm/openai.js +3 -3
- package/dist/safe-bash-command-llm/providers/index.js +3 -3
- package/dist/safe-bash-command-llm/providers/openai.js +3 -3
- package/dist/safe-bash-command-llm/stored-schema.d.ts +10 -0
- package/dist/safe-bash-command-mmdc/index.d.ts +1 -0
- package/dist/safe-bash-command-mmdc/index.js +13 -604
- package/dist/safe-bash-command-mmdc/settings.d.ts +2 -0
- package/dist/safe-bash-command-mmdc/settings.js +7 -0
- package/dist/safe-bash-command-numfmt/index.js +0 -11
- package/dist/safe-bash-command-od/index.js +101 -68
- package/dist/safe-bash-command-pandoc/command.js +4 -3
- package/dist/safe-bash-command-pandoc/defaults.d.ts +1 -0
- package/dist/safe-bash-command-pandoc/index.js +4 -3
- package/dist/safe-bash-command-pandoc/lua-filters.js +1 -1
- package/dist/safe-bash-command-pandoc/types.d.ts +3 -1
- package/dist/safe-bash-command-paste/index.js +1 -1
- package/dist/safe-bash-command-paste/paste.js +1 -1
- package/dist/safe-bash-command-patch/LICENSE +21 -0
- package/dist/safe-bash-command-patch/index.d.ts +8 -0
- package/dist/safe-bash-command-patch/index.js +38 -0
- package/dist/safe-bash-command-patch/patch-envelope.d.ts +2 -0
- package/dist/safe-bash-command-patch/patch-envelope.js +7 -0
- package/dist/safe-bash-command-patch/patch-formats.d.ts +7 -0
- package/dist/safe-bash-command-patch/patch-formats.js +9 -0
- package/dist/safe-bash-command-patch/patch-gnu-paths.d.ts +41 -0
- package/dist/safe-bash-command-patch/patch-gnu-paths.js +26 -0
- package/dist/safe-bash-command-patch/patch-gnu-reject.d.ts +3 -0
- package/dist/safe-bash-command-patch/patch-gnu-reject.js +7 -0
- package/dist/safe-bash-command-patch/patch-path.d.ts +3 -0
- package/dist/safe-bash-command-patch/patch-path.js +11 -0
- package/dist/safe-bash-command-patch/patch-publication.d.ts +13 -0
- package/dist/safe-bash-command-patch/patch-publication.js +7 -0
- package/dist/safe-bash-command-patch/patch.d.ts +2 -0
- package/dist/safe-bash-command-patch/patch.js +14 -0
- package/dist/safe-bash-command-patch/sync.d.ts +2 -0
- package/dist/safe-bash-command-patch/sync.js +7 -0
- package/dist/safe-bash-command-patch/unified.d.ts +52 -0
- package/dist/safe-bash-command-patch/unified.js +16 -0
- package/dist/safe-bash-command-pathchk/index.js +3 -13
- package/dist/safe-bash-command-pdfimages/index.js +62 -25
- package/dist/safe-bash-command-pdfinfo/index.d.ts +0 -23
- package/dist/safe-bash-command-pdfinfo/index.js +39 -782
- package/dist/safe-bash-command-pdftk/index.js +40 -12
- package/dist/safe-bash-command-pdftoppm/index.js +76 -30
- package/dist/safe-bash-command-pdftotext/index.js +37 -15
- package/dist/safe-bash-command-pptx/index.d.ts +4 -4
- package/dist/safe-bash-command-pptx/index.js +11 -5
- package/dist/safe-bash-command-pr/command.js +2 -2
- package/dist/safe-bash-command-pr/index.js +4 -4
- package/dist/safe-bash-command-qpdf/index.js +31 -18
- package/dist/safe-bash-command-rg/index.d.ts +1 -0
- package/dist/safe-bash-command-rg/index.js +222 -1
- package/dist/safe-bash-command-rg/rg-command.js +1 -1
- package/dist/safe-bash-command-rg/sync.d.ts +1 -0
- package/dist/safe-bash-command-sed/LICENSE +21 -0
- package/dist/safe-bash-command-sed/index.d.ts +7 -0
- package/dist/safe-bash-command-sed/index.js +28 -0
- package/dist/safe-bash-command-sed/inplace.d.ts +16 -0
- package/dist/safe-bash-command-sed/inplace.js +9 -0
- package/dist/safe-bash-command-sed/sed.d.ts +3 -0
- package/dist/safe-bash-command-sed/sed.js +8 -0
- package/dist/safe-bash-command-shuf/options.d.ts +1 -0
- package/dist/safe-bash-command-shuf/options.js +2 -4
- package/dist/safe-bash-command-shuf/shuf.js +2 -1
- package/dist/safe-bash-command-sips/index.js +111 -35
- package/dist/safe-bash-command-soffice/index.js +21 -17
- package/dist/safe-bash-command-split/index.js +3 -3
- package/dist/safe-bash-command-split/io.js +1 -1
- package/dist/safe-bash-command-split/outputs.js +2 -2
- package/dist/safe-bash-command-split/split.js +3 -3
- package/dist/safe-bash-command-sqlite3/btree.d.ts +1 -0
- package/dist/safe-bash-command-sqlite3/engine.d.ts +7 -2
- package/dist/safe-bash-command-sqlite3/index.js +436 -537
- package/dist/safe-bash-command-ssconvert/commands.js +9 -9
- package/dist/safe-bash-command-ssconvert/core.js +8 -8
- package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/ods.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +2 -2
- package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -9
- package/dist/safe-bash-command-ssconvert/formats/xlsx.js +9 -9
- package/dist/safe-bash-command-ssconvert/index.js +21 -21
- package/dist/safe-bash-command-tar/LICENSE +21 -0
- package/dist/safe-bash-command-tar/create.d.ts +17 -0
- package/dist/safe-bash-command-tar/create.js +14 -0
- package/dist/safe-bash-command-tar/extract.d.ts +11 -0
- package/dist/safe-bash-command-tar/extract.js +14 -0
- package/dist/safe-bash-command-tar/format.d.ts +32 -0
- package/dist/safe-bash-command-tar/format.js +19 -0
- package/dist/safe-bash-command-tar/index.d.ts +8 -0
- package/dist/safe-bash-command-tar/index.js +551 -0
- package/dist/safe-bash-command-tar/listing.d.ts +2 -0
- package/dist/safe-bash-command-tar/listing.js +7 -0
- package/dist/safe-bash-command-tar/modes.d.ts +5 -0
- package/dist/safe-bash-command-tar/modes.js +16 -0
- package/dist/safe-bash-command-tar/options.d.ts +53 -0
- package/dist/safe-bash-command-tar/options.js +10 -0
- package/dist/safe-bash-command-tar/stream.d.ts +22 -0
- package/dist/safe-bash-command-tar/stream.js +15 -0
- package/dist/safe-bash-command-tar/transform.d.ts +16 -0
- package/dist/safe-bash-command-tar/transform.js +9 -0
- package/dist/safe-bash-command-tree/arguments.js +3 -3
- package/dist/safe-bash-command-tree/charset.js +1 -1
- package/dist/safe-bash-command-tree/index.js +4 -4
- package/dist/safe-bash-command-tree/io.js +1 -1
- package/dist/safe-bash-command-tree/pattern.js +2 -2
- package/dist/safe-bash-command-tree/tree.js +4 -4
- package/dist/safe-bash-command-unrtf/index.js +14 -7
- package/dist/safe-bash-command-unzip/LICENSE +21 -0
- package/dist/safe-bash-command-unzip/index.d.ts +7 -0
- package/dist/safe-bash-command-unzip/index.js +39 -0
- package/dist/safe-bash-command-unzip/sync.d.ts +3 -0
- package/dist/safe-bash-command-unzip/sync.js +9 -0
- package/dist/safe-bash-command-unzip/unzip/safety.d.ts +32 -0
- package/dist/safe-bash-command-unzip/unzip/safety.js +7 -0
- package/dist/safe-bash-command-unzip/unzip.d.ts +3 -0
- package/dist/safe-bash-command-unzip/unzip.js +8 -0
- package/dist/safe-bash-command-wget/LICENSE +21 -0
- package/dist/safe-bash-command-wget/index.d.ts +6 -0
- package/dist/safe-bash-command-wget/index.js +26 -0
- package/dist/safe-bash-command-wget/wget.d.ts +3 -0
- package/dist/safe-bash-command-wget/wget.js +7 -0
- package/dist/safe-bash-command-xan/argv.d.ts +4 -1
- package/dist/safe-bash-command-xan/argv.js +1 -1
- package/dist/safe-bash-command-xan/commands.js +6 -3
- package/dist/safe-bash-command-xan/csv.d.ts +1 -1
- package/dist/safe-bash-command-xan/csv.js +1 -1
- package/dist/safe-bash-command-xan/index.js +18 -17
- package/dist/safe-bash-command-xan/io.js +3 -3
- package/dist/safe-bash-command-xmllint/index.js +190 -50
- package/dist/safe-bash-command-xxd/index.js +105 -91
- package/dist/safe-bash-command-xz/command.d.ts +2 -0
- package/dist/safe-bash-command-xz/index.d.ts +1 -1
- package/dist/safe-bash-command-xz/index.js +11 -2
- package/dist/safe-bash-command-xz/options.d.ts +9 -1
- package/dist/safe-bash-command-xz/options.js +3 -1
- package/dist/safe-bash-command-yq/index.d.ts +4 -11
- package/dist/safe-bash-command-yq/index.js +3367 -670
- package/dist/safe-bash-command-yq/mike.js +6 -13
- package/dist/safe-bash-command-yq/native-work.d.ts +1 -0
- package/dist/safe-bash-command-yq/native-work.js +17 -0
- package/dist/safe-bash-command-yq/query.d.ts +11 -0
- package/dist/safe-bash-command-yq/query.js +735 -0
- package/dist/safe-bash-command-zip/LICENSE +21 -0
- package/dist/safe-bash-command-zip/index.d.ts +7 -0
- package/dist/safe-bash-command-zip/index.js +38 -0
- package/dist/safe-bash-command-zip/sync.d.ts +3 -0
- package/dist/safe-bash-command-zip/sync.js +9 -0
- package/dist/safe-bash-command-zip/zip.d.ts +3 -0
- package/dist/safe-bash-command-zip/zip.js +7 -0
- package/dist/safe-bash-compression-engine/files.js +4 -4
- package/dist/safe-bash-compression-engine/index.js +2 -2
- package/dist/safe-bash-compression-engine/operand.js +6 -6
- package/dist/safe-bash-compression-engine/stream.js +2 -2
- package/dist/safe-bash-compression-engine/zstd-decode.js +1 -1
- package/dist/safe-bash-contracts/command.js +1 -1
- package/dist/safe-bash-contracts/diagnostics.js +4 -4
- package/dist/safe-bash-contracts/escaping.js +12 -12
- package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
- package/dist/safe-bash-contracts/filesystem-output.js +8 -8
- package/dist/safe-bash-contracts/index.d.ts +1 -0
- package/dist/safe-bash-contracts/index.js +39 -35
- package/dist/safe-bash-contracts/io.d.ts +4 -1
- package/dist/safe-bash-contracts/io.js +4 -2
- package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
- package/dist/safe-bash-contracts/output.js +3 -3
- package/dist/safe-bash-diff-engine/LICENSE +21 -0
- package/dist/safe-bash-diff-engine/index.d.ts +1 -0
- package/dist/safe-bash-diff-engine/index.js +24 -0
- package/dist/safe-bash-diff-engine/shared.d.ts +54 -0
- package/dist/safe-bash-diff-engine/shared.js +19 -0
- package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
- package/dist/safe-bash-io-engine/commands/directory-admission.d.ts +3 -0
- package/dist/safe-bash-io-engine/commands/directory-admission.js +34 -0
- package/dist/safe-bash-io-engine/commands/mode-change.d.ts +4 -0
- package/dist/safe-bash-io-engine/commands/mode-change.js +60 -0
- package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +44 -66
- package/dist/safe-bash-io-engine/internal.js +1 -1
- package/dist/safe-bash-io-engine/shell/pattern.js +8 -13
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
- package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
- package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
- package/dist/safe-bash-markdown-engine/index.js +7 -7
- package/dist/safe-bash-mcp/index.browser.d.ts +161 -35
- package/dist/safe-bash-mcp/index.browser.js +417 -0
- package/dist/safe-bash-mcp/index.d.ts +66 -2
- package/dist/safe-bash-mcp/index.js +1838 -122
- package/dist/safe-bash-network-engine/LICENSE +21 -0
- package/dist/safe-bash-network-engine/aggregate.d.ts +4 -0
- package/dist/safe-bash-network-engine/aggregate.js +37 -0
- package/dist/safe-bash-network-engine/args.d.ts +68 -0
- package/dist/safe-bash-network-engine/args.js +19 -0
- package/dist/safe-bash-network-engine/authorizer.d.ts +6 -0
- package/dist/safe-bash-network-engine/authorizer.js +8 -0
- package/dist/safe-bash-network-engine/body.d.ts +9 -0
- package/dist/safe-bash-network-engine/body.js +374 -0
- package/dist/safe-bash-network-engine/deadline.d.ts +2 -0
- package/dist/safe-bash-network-engine/deadline.js +7 -0
- package/dist/safe-bash-network-engine/decode.d.ts +2 -0
- package/dist/safe-bash-network-engine/decode.js +80 -0
- package/dist/safe-bash-network-engine/fetch-transport.d.ts +7 -0
- package/dist/safe-bash-network-engine/fetch-transport.js +9 -0
- package/dist/safe-bash-network-engine/form-content-type.d.ts +5 -0
- package/dist/safe-bash-network-engine/form-content-type.js +8 -0
- package/dist/safe-bash-network-engine/form-headers.d.ts +2 -0
- package/dist/safe-bash-network-engine/form-headers.js +10 -0
- package/dist/safe-bash-network-engine/glob.d.ts +7 -0
- package/dist/safe-bash-network-engine/glob.js +124 -0
- package/dist/safe-bash-network-engine/index.d.ts +3 -0
- package/dist/safe-bash-network-engine/index.js +26 -0
- package/dist/safe-bash-network-engine/input.d.ts +5 -0
- package/dist/safe-bash-network-engine/input.js +255 -0
- package/dist/safe-bash-network-engine/output.d.ts +6 -0
- package/dist/safe-bash-network-engine/output.js +132 -0
- package/dist/safe-bash-network-engine/platform-portable.d.ts +5 -0
- package/dist/safe-bash-network-engine/platform-portable.js +19 -0
- package/dist/safe-bash-network-engine/private-address.d.ts +1 -0
- package/dist/safe-bash-network-engine/private-address.js +7 -0
- package/dist/safe-bash-network-engine/shared.d.ts +14 -0
- package/dist/safe-bash-network-engine/shared.js +23 -0
- package/dist/safe-bash-network-engine/types.d.ts +42 -0
- package/dist/safe-bash-network-engine/types.js +11 -0
- package/dist/safe-bash-network-engine/url.d.ts +2 -0
- package/dist/safe-bash-network-engine/url.js +8 -0
- package/dist/safe-bash-query-engine/capture.d.ts +1 -0
- package/dist/safe-bash-query-engine/capture.js +9 -7
- package/dist/safe-bash-query-engine/dates.d.ts +5 -1
- package/dist/safe-bash-query-engine/dates.js +10 -2
- package/dist/safe-bash-query-engine/delpaths.js +5 -5
- package/dist/safe-bash-query-engine/formats.js +3 -3
- package/dist/safe-bash-query-engine/index.js +15 -15
- package/dist/safe-bash-query-engine/indices.js +5 -5
- package/dist/safe-bash-query-engine/input.d.ts +1 -2
- package/dist/safe-bash-query-engine/input.js +2 -4
- package/dist/safe-bash-query-engine/interpreter.d.ts +5 -0
- package/dist/safe-bash-query-engine/interpreter.js +13 -13
- package/dist/safe-bash-query-engine/limits.js +1 -1
- package/dist/safe-bash-query-engine/parser.d.ts +8 -1
- package/dist/safe-bash-query-engine/parser.js +2 -2
- package/dist/safe-bash-query-engine/query-core.js +15 -15
- package/dist/safe-bash-query-engine/recurse.js +2 -2
- package/dist/safe-bash-query-engine/regex.d.ts +4 -2
- package/dist/safe-bash-query-engine/regex.js +10 -5
- package/dist/safe-bash-query-engine/split.js +2 -2
- package/dist/safe-bash-query-engine/splits.d.ts +1 -1
- package/dist/safe-bash-query-engine/splits.js +7 -6
- package/dist/safe-bash-query-engine/values.js +4 -4
- package/dist/safe-bash-regex-engine/ere/matcher.js +106 -34
- package/dist/safe-bash-regex-engine/execution/bounded-provider.js +55 -67
- package/dist/safe-bash-regex-engine/execution/portable.d.ts +0 -1
- package/dist/safe-bash-regex-engine/execution/portable.js +6 -10
- package/dist/safe-bash-regex-engine/execution/protocol.d.ts +0 -5
- package/dist/safe-bash-regex-engine/execution/protocol.js +1 -3
- package/dist/safe-bash-regex-engine/index.js +6 -4
- package/dist/safe-bash-regex-engine/text/budget.d.ts +1 -0
- package/dist/safe-bash-regex-engine/text/budget.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.d.ts +15 -0
- package/dist/safe-bash-regex-engine/text/regex.js +6 -4
- package/dist/safe-bash-regex-engine/text/replacement-buffer.js +2 -2
- package/dist/safe-bash-regex-engine/text/rust-syntax.js +2 -2
- package/dist/safe-bash-search-engine/ergonomic-regex.d.ts +12 -2
- package/dist/safe-bash-search-engine/ergonomic-regex.js +2 -2
- package/dist/safe-bash-search-engine/glob.js +2 -2
- package/dist/safe-bash-search-engine/grep.js +191 -229
- package/dist/safe-bash-search-engine/matcher.d.ts +6 -2
- package/dist/safe-bash-search-engine/matcher.js +30 -8
- package/dist/safe-bash-search-engine/options.js +1 -1
- package/dist/safe-bash-search-engine/output.d.ts +3 -2
- package/dist/safe-bash-search-engine/output.js +111 -30
- package/dist/safe-bash-search-engine/shared.d.ts +2 -0
- package/dist/safe-bash-search-engine/shared.js +2 -2
- package/dist/safe-bash-search-engine/walk.js +11 -10
- package/dist/safe-bash-table-text-engine/table-text/internal.d.ts +7 -5
- package/dist/safe-bash-table-text-engine/table-text/internal.js +39 -21
- package/dist/safe-bash-xml-engine/document.d.ts +1 -1
- package/dist/safe-bash-xml-engine/document.js +3 -3
- package/dist/safe-bash-xml-engine/evaluate.d.ts +1 -0
- package/dist/safe-bash-xml-engine/evaluate.js +4 -1
- package/dist/safe-bash-xml-engine/index.js +8 -6
- package/dist/safe-bash-xml-engine/io.js +1 -1
- package/dist/safe-bash-xml-engine/limits.d.ts +2 -0
- package/dist/safe-bash-xml-engine/limits.js +1 -1
- package/dist/safe-bash-xml-engine/predicate.d.ts +57 -0
- package/dist/safe-bash-xml-engine/query.d.ts +3 -15
- package/dist/safe-bash-xml-engine/query.js +3 -2
- package/dist/safe-bash-zip-engine/LICENSE +21 -0
- package/dist/safe-bash-zip-engine/index.d.ts +1 -0
- package/dist/safe-bash-zip-engine/index.js +32 -0
- package/dist/safe-bash-zip-engine/unzip/arguments.d.ts +53 -0
- package/dist/safe-bash-zip-engine/unzip/arguments.js +270 -0
- package/dist/safe-bash-zip-engine/zip/aes.d.ts +17 -0
- package/dist/safe-bash-zip-engine/zip/aes.js +15 -0
- package/dist/safe-bash-zip-engine/zip/comments.d.ts +17 -0
- package/dist/safe-bash-zip-engine/zip/comments.js +77 -0
- package/dist/safe-bash-zip-engine/zip/crc.d.ts +1 -0
- package/dist/safe-bash-zip-engine/zip/crc.js +7 -0
- package/dist/safe-bash-zip-engine/zip/crypto.d.ts +19 -0
- package/dist/safe-bash-zip-engine/zip/crypto.js +16 -0
- package/dist/safe-bash-zip-engine/zip/dates.d.ts +4 -0
- package/dist/safe-bash-zip-engine/zip/dates.js +68 -0
- package/dist/safe-bash-zip-engine/zip/environment.d.ts +2 -0
- package/dist/safe-bash-zip-engine/zip/environment.js +60 -0
- package/dist/safe-bash-zip-engine/zip/grow.d.ts +3 -0
- package/dist/safe-bash-zip-engine/zip/grow.js +7 -0
- package/dist/safe-bash-zip-engine/zip/help.d.ts +4 -0
- package/dist/safe-bash-zip-engine/zip/help.js +194 -0
- package/dist/safe-bash-zip-engine/zip/line-endings.d.ts +2 -0
- package/dist/safe-bash-zip-engine/zip/line-endings.js +165 -0
- package/dist/safe-bash-zip-engine/zip/log.d.ts +22 -0
- package/dist/safe-bash-zip-engine/zip/log.js +153 -0
- package/dist/safe-bash-zip-engine/zip/lzma.d.ts +9 -0
- package/dist/safe-bash-zip-engine/zip/lzma.js +7 -0
- package/dist/safe-bash-zip-engine/zip/move.d.ts +11 -0
- package/dist/safe-bash-zip-engine/zip/move.js +57 -0
- package/dist/safe-bash-zip-engine/zip/names.d.ts +2 -0
- package/dist/safe-bash-zip-engine/zip/names.js +37 -0
- package/dist/safe-bash-zip-engine/zip/options.d.ts +13 -0
- package/dist/safe-bash-zip-engine/zip/options.js +23 -0
- package/dist/safe-bash-zip-engine/zip/repair.d.ts +10 -0
- package/dist/safe-bash-zip-engine/zip/repair.js +348 -0
- package/dist/safe-bash-zip-engine/zip/safety.d.ts +54 -0
- package/dist/safe-bash-zip-engine/zip/safety.js +19 -0
- package/dist/safe-bash-zip-engine/zip/sfx.d.ts +4 -0
- package/dist/safe-bash-zip-engine/zip/sfx.js +58 -0
- package/dist/safe-bash-zip-engine/zip/test-command.d.ts +5 -0
- package/dist/safe-bash-zip-engine/zip/test-command.js +98 -0
- package/dist/safe-bash-zip-engine/zip/volumes.d.ts +21 -0
- package/dist/safe-bash-zip-engine/zip/volumes.js +255 -0
- package/dist/safe-bash-zip-engine/zip/zip64.d.ts +30 -0
- package/dist/safe-bash-zip-engine/zip/zip64.js +25 -0
- package/dist/safe-bash-zip-engine/zip-format.d.ts +68 -0
- package/dist/safe-bash-zip-engine/zip-format.js +27 -0
- package/dist/safe-playwright-cloudflare/browser-codegen.generated.d.ts +7 -7
- package/dist/safe-playwright-cloudflare/browser-codegen.generated.js +866 -8069
- package/dist/safe-playwright-cloudflare/browser-run-code-budget.d.ts +0 -1
- package/dist/safe-playwright-cloudflare/browser-run-code-budget.js +0 -2
- package/dist/safe-playwright-cloudflare/browser-trace-archive.d.ts +5 -1
- package/dist/safe-playwright-cloudflare/browser-trace-archive.js +2 -1
- package/dist/safe-playwright-cloudflare/browser-trace-budget.js +8 -4
- package/dist/safe-playwright-cloudflare/shell-browser-resource.d.ts +2 -0
- package/dist/safe-playwright-cloudflare/shell-browser-resource.js +3 -11
- package/dist/safe-playwright-cloudflare/shell-playwright.d.ts +2 -0
- package/dist/safe-playwright-cloudflare/shell-playwright.js +1 -1
- package/dist/spreadsheet-engine/codecs/odf-hyperlinks.js +8 -2
- package/dist/spreadsheet-engine/formulas/functions/captured-bessel-phase.js +2 -2
- package/dist/spreadsheet-engine/formulas/label-references.js +54 -33
- package/dist/spreadsheet-engine/formulas/parser.js +3 -1
- package/dist/spreadsheet-engine/formulas/rewriting.js +13 -3
- package/dist/spreadsheet-engine/io/publication.d.ts +1 -0
- package/dist/spreadsheet-format-xls/biff-data-tables.js +4 -6
- package/dist/spreadsheet-format-xls/biff-formulas.js +3 -0
- package/dist/spreadsheet-format-xls/biff-label-ranges.js +9 -6
- package/dist/spreadsheet-format-xls/biff.js +1 -1
- package/dist/xlsx-ast/xlsx.js +8 -5
- package/package.json +165 -15
- package/dist/safe-bash/chunks/chunk-AZAJJVFX.js +0 -23017
- package/dist/safe-bash/chunks/chunk-O4ZUCRGN.js +0 -13
- package/dist/safe-bash/chunks/chunk-S264DZO2.js +0 -243
- package/dist/safe-bash/chunks/chunk-WVG5SHHQ.js +0 -12
- package/dist/safe-bash/chunks/chunk-ZW6K2J7P.js +0 -2652
- package/dist/safe-bash/command-chunks/chunk-5MPOQ6V3.js +0 -181
- package/dist/safe-bash/command-chunks/chunk-BIXLZ3OG.js +0 -14342
- package/dist/safe-bash/command-chunks/chunk-DUYJE2HY.js +0 -14
- package/dist/safe-bash/command-chunks/chunk-KAGBORIC.js +0 -88
- package/dist/safe-bash/command-chunks/chunk-NETECMOF.js +0 -40
- package/dist/safe-bash/command-chunks/chunk-XS3PGJU2.js +0 -343
- package/dist/safe-bash/command-chunks/chunk-XTZALMLR.js +0 -488
- package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.d.ts +0 -2
- package/dist/safe-bash/commands/archive/zip/aes-primitives-unavailable.js +0 -3
- package/dist/safe-bash/commands/archive/zip/aes-primitives.d.ts +0 -2
- package/dist/safe-bash/commands/archive/zip/aes-primitives.js +0 -3
- package/dist/safe-bash/commands/xml/document.d.ts +0 -2
- package/dist/safe-bash/commands/xml/document.js +0 -2
- package/dist/safe-bash/commands/xml/evaluate.d.ts +0 -2
- package/dist/safe-bash/commands/xml/evaluate.js +0 -2
- package/dist/safe-bash/commands/xml/json.d.ts +0 -2
- package/dist/safe-bash/commands/xml/json.js +0 -2
- package/dist/safe-bash/commands/xml/limits.d.ts +0 -2
- package/dist/safe-bash/commands/xml/limits.js +0 -2
- package/dist/safe-bash/commands/xml/query.d.ts +0 -2
- package/dist/safe-bash/commands/xml/query.js +0 -2
- package/dist/safe-bash/command-chunks/{chunk-FIUFIDAO.js → chunk-2JRBIDAD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
- package/dist/safe-bash/command-chunks/{chunk-B5BKA5WH.js → chunk-B5TAOCKD.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-2ENZ6JGA.js → chunk-KEV7C3KH.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-S62HELHU.js → chunk-PL6O4K6W.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-DDLQ5YDB.js → chunk-YHFXOX6U.js} +9 -9
- package/dist/safe-bash/command-chunks/{chunk-DQMOM72Z.js → chunk-ZRRBXU3M.js} +4 -4
|
@@ -340,10 +340,10 @@ function decodeRecord(payload) {
|
|
|
340
340
|
}
|
|
341
341
|
return values;
|
|
342
342
|
}
|
|
343
|
-
function extractLeafCellPayload(dbBytes, pageSize, cellBytes, payloadSize) {
|
|
343
|
+
function extractLeafCellPayload(dbBytes, pageSize, cellBytes, payloadSize, index = false) {
|
|
344
344
|
const reservedSpace = dbBytes[20] ?? 0;
|
|
345
345
|
const usableSize = Math.max(480, pageSize - reservedSpace);
|
|
346
|
-
const maxLocal = usableSize - 35;
|
|
346
|
+
const maxLocal = index ? Math.floor((usableSize - 12) * 64 / 255) - 23 : usableSize - 35;
|
|
347
347
|
const minLocal = Math.floor((usableSize - 12) * 32 / 255) - 23;
|
|
348
348
|
if (payloadSize <= maxLocal) {
|
|
349
349
|
return cellBytes.subarray(0, payloadSize);
|
|
@@ -380,7 +380,32 @@ function parseTableBTreeRows(dbBytes, pageSize, pageNumber, visited = /* @__PURE
|
|
|
380
380
|
const pageType = dbBytes[pageStart + headerOffset] ?? 0;
|
|
381
381
|
const cellCount = readU16BE(dbBytes, pageStart + headerOffset + 3);
|
|
382
382
|
const rows = [];
|
|
383
|
-
if (pageType ===
|
|
383
|
+
if (pageType === 10 || pageType === 2) {
|
|
384
|
+
const interior = pageType === 2;
|
|
385
|
+
const ptrArrayOffset = pageStart + headerOffset + (interior ? 12 : 8);
|
|
386
|
+
for (let i = 0; i < cellCount; i++) {
|
|
387
|
+
let offset = pageStart + readU16BE(dbBytes, ptrArrayOffset + i * 2);
|
|
388
|
+
if (interior) {
|
|
389
|
+
rows.push(...parseTableBTreeRows(dbBytes, pageSize, readU32BE(dbBytes, offset), visited));
|
|
390
|
+
offset += 4;
|
|
391
|
+
}
|
|
392
|
+
const size = readVarint(dbBytes, offset);
|
|
393
|
+
const payload = extractLeafCellPayload(
|
|
394
|
+
dbBytes,
|
|
395
|
+
pageSize,
|
|
396
|
+
dbBytes.subarray(offset + size.length, pageStart + pageSize),
|
|
397
|
+
size.value,
|
|
398
|
+
true
|
|
399
|
+
);
|
|
400
|
+
rows.push({ rowid: rows.length + 1, values: decodeRecord(payload) });
|
|
401
|
+
}
|
|
402
|
+
if (interior) rows.push(...parseTableBTreeRows(
|
|
403
|
+
dbBytes,
|
|
404
|
+
pageSize,
|
|
405
|
+
readU32BE(dbBytes, pageStart + headerOffset + 8),
|
|
406
|
+
visited
|
|
407
|
+
));
|
|
408
|
+
} else if (pageType === 13) {
|
|
384
409
|
const ptrArrayOffset = pageStart + headerOffset + 8;
|
|
385
410
|
for (let i = 0; i < cellCount; i += 1) {
|
|
386
411
|
const cellOffsetInPage = readU16BE(dbBytes, ptrArrayOffset + i * 2);
|
|
@@ -395,7 +420,7 @@ function parseTableBTreeRows(dbBytes, pageSize, pageNumber, visited = /* @__PURE
|
|
|
395
420
|
pSize.value
|
|
396
421
|
);
|
|
397
422
|
rows.push({
|
|
398
|
-
rowid: rId.value,
|
|
423
|
+
rowid: rId.length === 9 ? Number(BigInt.asIntN(64, Array.from(dbBytes.subarray(absOffset + pSize.length, absOffset + pSize.length + 9)).reduce((value, byte, i2) => value << BigInt(i2 === 8 ? 8 : 7) | BigInt(i2 === 8 ? byte : byte & 127), 0n))) : rId.value,
|
|
399
424
|
values: decodeRecord(payload)
|
|
400
425
|
});
|
|
401
426
|
}
|
|
@@ -503,7 +528,7 @@ function buildTablePages(rows, startPageNumber, isPageOne) {
|
|
|
503
528
|
writeU32BE(cell, pSizeVar.byteLength + rIdVar.byteLength + localSize, firstOverflowPageNum);
|
|
504
529
|
return cell;
|
|
505
530
|
};
|
|
506
|
-
const encodedCells = rows.map((r) => ({
|
|
531
|
+
const encodedCells = [...rows].sort((a, b) => a.rowid - b.rowid).map((r) => ({
|
|
507
532
|
rowid: r.rowid,
|
|
508
533
|
cell: encodeCellWithOverflow(r.rowid, r.values)
|
|
509
534
|
}));
|
|
@@ -595,7 +620,7 @@ function compareSqlValuesForBTree(a, b) {
|
|
|
595
620
|
}
|
|
596
621
|
return ba.byteLength - bb.byteLength;
|
|
597
622
|
}
|
|
598
|
-
function buildIndexPages(entries, startPageNumber) {
|
|
623
|
+
function buildIndexPages(entries, startPageNumber, presorted = false) {
|
|
599
624
|
const pageSize = DEFAULT_PAGE_SIZE;
|
|
600
625
|
const pages = [];
|
|
601
626
|
const rootPageNum = startPageNumber;
|
|
@@ -605,7 +630,7 @@ function buildIndexPages(entries, startPageNumber) {
|
|
|
605
630
|
pages.push(buf);
|
|
606
631
|
return { pageNum: startPageNumber + pages.length - 1, buf };
|
|
607
632
|
};
|
|
608
|
-
const sorted = [...entries].sort((r1, r2) => {
|
|
633
|
+
const sorted = presorted ? entries : [...entries].sort((r1, r2) => {
|
|
609
634
|
const len = Math.min(r1.length, r2.length);
|
|
610
635
|
for (let i = 0; i < len; i += 1) {
|
|
611
636
|
const c = compareSqlValuesForBTree(r1[i] ?? null, r2[i] ?? null);
|
|
@@ -650,40 +675,51 @@ function buildIndexPages(entries, startPageNumber) {
|
|
|
650
675
|
return cell;
|
|
651
676
|
};
|
|
652
677
|
const encodedCells = sorted.map((vals) => encodeIndexCell(vals));
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
let
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
writeU16BE(
|
|
666
|
-
}
|
|
667
|
-
writeU16BE(
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
const c = encodedCells[i];
|
|
677
|
-
if (contentOffset - (c.byteLength + 2) < 8 + (count + 1) * 2) {
|
|
678
|
+
const writeNode = (buf, cells2, children2) => {
|
|
679
|
+
const interior = children2.length > 0;
|
|
680
|
+
const header = interior ? 12 : 8;
|
|
681
|
+
buf[0] = interior ? 2 : 10;
|
|
682
|
+
writeU16BE(buf, 3, cells2.length);
|
|
683
|
+
if (interior) writeU32BE(buf, 8, children2[children2.length - 1]);
|
|
684
|
+
let offset = pageSize;
|
|
685
|
+
for (let i = 0; i < cells2.length; i++) {
|
|
686
|
+
const cell = cells2[i];
|
|
687
|
+
offset -= cell.length + (interior ? 4 : 0);
|
|
688
|
+
if (interior) writeU32BE(buf, offset, children2[i]);
|
|
689
|
+
buf.set(cell, offset + (interior ? 4 : 0));
|
|
690
|
+
writeU16BE(buf, header + i * 2, offset);
|
|
691
|
+
}
|
|
692
|
+
writeU16BE(buf, 5, offset);
|
|
693
|
+
};
|
|
694
|
+
let cells = encodedCells;
|
|
695
|
+
let children = [];
|
|
696
|
+
while (true) {
|
|
697
|
+
const overhead = children.length ? 6 : 2;
|
|
698
|
+
const header = children.length ? 12 : 8;
|
|
699
|
+
if (cells.reduce((size, cell) => size + cell.length + overhead, header) <= pageSize) {
|
|
700
|
+
writeNode(pages[0], cells, children);
|
|
678
701
|
break;
|
|
679
702
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
703
|
+
const separators = [];
|
|
704
|
+
const nextChildren = [];
|
|
705
|
+
let start = 0;
|
|
706
|
+
while (start <= cells.length) {
|
|
707
|
+
let end = start;
|
|
708
|
+
let size = header;
|
|
709
|
+
while (end < cells.length && size + cells[end].length + overhead <= pageSize) {
|
|
710
|
+
size += cells[end].length + overhead;
|
|
711
|
+
end++;
|
|
712
|
+
}
|
|
713
|
+
const { pageNum, buf } = allocatePage();
|
|
714
|
+
writeNode(buf, cells.slice(start, end), children.length ? children.slice(start, end + 1) : []);
|
|
715
|
+
nextChildren.push(pageNum);
|
|
716
|
+
if (end === cells.length) break;
|
|
717
|
+
separators.push(cells[end]);
|
|
718
|
+
start = end + 1;
|
|
719
|
+
}
|
|
720
|
+
cells = separators;
|
|
721
|
+
children = nextChildren;
|
|
684
722
|
}
|
|
685
|
-
writeU16BE(rootBuf, 3, count);
|
|
686
|
-
writeU16BE(rootBuf, 5, contentOffset === pageSize ? 0 : contentOffset);
|
|
687
723
|
return { rootPage: rootPageNum, pages };
|
|
688
724
|
}
|
|
689
725
|
function writeSqliteDatabaseBytes(image) {
|
|
@@ -694,7 +730,7 @@ function writeSqliteDatabaseBytes(image) {
|
|
|
694
730
|
for (const item of image.master) {
|
|
695
731
|
if (item.type === "table") {
|
|
696
732
|
const rows = image.tableRows.get(item.name) ?? [];
|
|
697
|
-
const built = buildTablePages(rows, nextPageNumber, false);
|
|
733
|
+
const built = item.withoutRowId ? buildIndexPages(rows.map((row) => row.values), nextPageNumber, true) : buildTablePages(rows, nextPageNumber, false);
|
|
698
734
|
extraPageChunks.push(...built.pages);
|
|
699
735
|
nextPageNumber += built.pages.length;
|
|
700
736
|
masterEntries.push({
|
|
@@ -735,7 +771,7 @@ function writeSqliteDatabaseBytes(image) {
|
|
|
735
771
|
for (const item of image.master) {
|
|
736
772
|
if (item.type === "table") {
|
|
737
773
|
const rows = image.tableRows.get(item.name) ?? [];
|
|
738
|
-
const built = buildTablePages(rows, pNum, false);
|
|
774
|
+
const built = item.withoutRowId ? buildIndexPages(rows.map((row) => row.values), pNum, true) : buildTablePages(rows, pNum, false);
|
|
739
775
|
reExtraChunks.push(...built.pages);
|
|
740
776
|
pNum += built.pages.length;
|
|
741
777
|
reMasterEntries.push({ ...item, rootpage: built.rootPage });
|
|
@@ -803,8 +839,18 @@ function serializeSqlJson(value, preserveRealType = true) {
|
|
|
803
839
|
}
|
|
804
840
|
var JsonText = class extends String {
|
|
805
841
|
};
|
|
842
|
+
function tableStorageColumns(table) {
|
|
843
|
+
if (!table.withoutRowId) return table.columns;
|
|
844
|
+
const keys = table.primaryKeyCols.map((name) => name.toLowerCase());
|
|
845
|
+
return [
|
|
846
|
+
...keys.map((name) => table.columns.find((column) => column.name.toLowerCase() === name)),
|
|
847
|
+
...table.columns.filter((column) => !keys.includes(column.name.toLowerCase()))
|
|
848
|
+
];
|
|
849
|
+
}
|
|
806
850
|
var textEncoder2 = new TextEncoder();
|
|
807
851
|
var textDecoder2 = new TextDecoder("utf-8", { fatal: false });
|
|
852
|
+
var SqliteConstraintError = class extends Error {
|
|
853
|
+
};
|
|
808
854
|
function cloneSqlValue(v) {
|
|
809
855
|
if (v instanceof Uint8Array) {
|
|
810
856
|
return new Uint8Array(v);
|
|
@@ -831,6 +877,7 @@ function cloneTableDef(t) {
|
|
|
831
877
|
withoutRowId: t.withoutRowId,
|
|
832
878
|
strict: t.strict,
|
|
833
879
|
primaryKeyCols: [...t.primaryKeyCols],
|
|
880
|
+
primaryKeyOrder: t.primaryKeyOrder?.map((key) => ({ ...key })),
|
|
834
881
|
uniqueColSets: t.uniqueColSets.map((u) => [...u])
|
|
835
882
|
};
|
|
836
883
|
}
|
|
@@ -1073,6 +1120,37 @@ function tokenizeSql(sql) {
|
|
|
1073
1120
|
}
|
|
1074
1121
|
return tokens;
|
|
1075
1122
|
}
|
|
1123
|
+
function isAggregateFunction(expr) {
|
|
1124
|
+
if (expr.kind !== "func" || expr.over) return false;
|
|
1125
|
+
const name = expr.name.toUpperCase();
|
|
1126
|
+
return ["COUNT", "SUM", "TOTAL", "AVG", "MIN", "MAX", "GROUP_CONCAT", "STRING_AGG", "JSON_GROUP_ARRAY", "JSON_GROUP_OBJECT"].includes(name) && !((name === "MIN" || name === "MAX") && expr.args.length > 1);
|
|
1127
|
+
}
|
|
1128
|
+
function expressionChildren(expr) {
|
|
1129
|
+
switch (expr.kind) {
|
|
1130
|
+
case "unary":
|
|
1131
|
+
case "collate":
|
|
1132
|
+
case "is_null":
|
|
1133
|
+
case "cast":
|
|
1134
|
+
case "in_subquery":
|
|
1135
|
+
return [expr.expr];
|
|
1136
|
+
case "binary":
|
|
1137
|
+
return [expr.left, expr.right];
|
|
1138
|
+
case "between":
|
|
1139
|
+
return [expr.expr, expr.low, expr.high];
|
|
1140
|
+
case "in_list":
|
|
1141
|
+
return [expr.expr, ...expr.list];
|
|
1142
|
+
case "func":
|
|
1143
|
+
return expr.args;
|
|
1144
|
+
case "case":
|
|
1145
|
+
return [
|
|
1146
|
+
...expr.base ? [expr.base] : [],
|
|
1147
|
+
...expr.branches.flatMap((branch) => [branch.when, branch.then]),
|
|
1148
|
+
...expr.elseExpr ? [expr.elseExpr] : []
|
|
1149
|
+
];
|
|
1150
|
+
default:
|
|
1151
|
+
return [];
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1076
1154
|
function reconstructTokensSql(tokens) {
|
|
1077
1155
|
let out = "";
|
|
1078
1156
|
for (let i = 0; i < tokens.length; i += 1) {
|
|
@@ -2209,11 +2287,12 @@ var SqliteDatabase = class {
|
|
|
2209
2287
|
}
|
|
2210
2288
|
tbl.rows = [];
|
|
2211
2289
|
let maxRowid = 0;
|
|
2290
|
+
const storageColumns = tableStorageColumns(tbl);
|
|
2212
2291
|
for (const r of rawRows) {
|
|
2213
2292
|
yield;
|
|
2214
2293
|
const data = {};
|
|
2215
2294
|
let valIdx = 0;
|
|
2216
|
-
for (const col of
|
|
2295
|
+
for (const col of storageColumns) {
|
|
2217
2296
|
yield;
|
|
2218
2297
|
if (col.primaryKey && col.type.toUpperCase() === "INTEGER" && !tbl.withoutRowId && tbl.primaryKeyCols.length === 1) {
|
|
2219
2298
|
const cellVal = r.values[valIdx];
|
|
@@ -2282,7 +2361,8 @@ var SqliteDatabase = class {
|
|
|
2282
2361
|
name: tbl.name,
|
|
2283
2362
|
tbl_name: tbl.name,
|
|
2284
2363
|
rootpage: rootPageCounter++,
|
|
2285
|
-
sql: tbl.sql
|
|
2364
|
+
sql: tbl.sql,
|
|
2365
|
+
withoutRowId: tbl.withoutRowId
|
|
2286
2366
|
});
|
|
2287
2367
|
if (tbl.columns.some((c) => {
|
|
2288
2368
|
return c.autoIncrement;
|
|
@@ -2299,11 +2379,26 @@ var SqliteDatabase = class {
|
|
|
2299
2379
|
});
|
|
2300
2380
|
}
|
|
2301
2381
|
}
|
|
2302
|
-
const
|
|
2382
|
+
const storageColumns = tableStorageColumns(tbl);
|
|
2383
|
+
const orderedRows = tbl.withoutRowId ? yield* stepSort([...tbl.rows], function* (left, right) {
|
|
2384
|
+
for (let i = 0; i < tbl.primaryKeyCols.length; i++) {
|
|
2385
|
+
yield;
|
|
2386
|
+
const column = storageColumns[i];
|
|
2387
|
+
const order = tbl.primaryKeyOrder?.[i];
|
|
2388
|
+
const comparison = compareSqlValues(
|
|
2389
|
+
left.data[column.name] ?? null,
|
|
2390
|
+
right.data[column.name] ?? null,
|
|
2391
|
+
order?.collation ?? column.collate ?? "BINARY"
|
|
2392
|
+
);
|
|
2393
|
+
if (comparison) return order?.desc ? -comparison : comparison;
|
|
2394
|
+
}
|
|
2395
|
+
return 0;
|
|
2396
|
+
}, this) : tbl.rows;
|
|
2397
|
+
const rows = yield* stepMap(orderedRows, function* (r) {
|
|
2303
2398
|
yield;
|
|
2304
2399
|
return {
|
|
2305
2400
|
rowid: r.rowid,
|
|
2306
|
-
values:
|
|
2401
|
+
values: storageColumns.map((c) => {
|
|
2307
2402
|
const isRowidAlias = c.primaryKey && c.type.toUpperCase() === "INTEGER" && !tbl.withoutRowId && tbl.primaryKeyCols.length === 1;
|
|
2308
2403
|
return isRowidAlias ? null : r.data[c.name] ?? null;
|
|
2309
2404
|
})
|
|
@@ -2774,6 +2869,7 @@ var SqliteDatabase = class {
|
|
|
2774
2869
|
const strict = trailingTokens.includes("STRICT");
|
|
2775
2870
|
const columns = [];
|
|
2776
2871
|
const primaryKeyCols = [];
|
|
2872
|
+
const primaryKeyOrder = [];
|
|
2777
2873
|
const uniqueColSets = [];
|
|
2778
2874
|
for (const part of bodyParts) {
|
|
2779
2875
|
yield;
|
|
@@ -2791,11 +2887,19 @@ var SqliteDatabase = class {
|
|
|
2791
2887
|
pIdx += 1;
|
|
2792
2888
|
while (pIdx < part.length && part[pIdx]?.value !== ")") {
|
|
2793
2889
|
yield;
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2890
|
+
if (part[pIdx].value === ",") {
|
|
2891
|
+
pIdx++;
|
|
2892
|
+
continue;
|
|
2797
2893
|
}
|
|
2798
|
-
pIdx
|
|
2894
|
+
primaryKeyCols.push(part[pIdx++].value);
|
|
2895
|
+
let collation;
|
|
2896
|
+
if (part[pIdx]?.value.toUpperCase() === "COLLATE") {
|
|
2897
|
+
collation = part[pIdx + 1]?.value;
|
|
2898
|
+
pIdx += 2;
|
|
2899
|
+
}
|
|
2900
|
+
const direction = part[pIdx]?.value.toUpperCase();
|
|
2901
|
+
primaryKeyOrder.push({ desc: direction === "DESC", collation });
|
|
2902
|
+
if (direction === "ASC" || direction === "DESC") pIdx++;
|
|
2799
2903
|
}
|
|
2800
2904
|
}
|
|
2801
2905
|
continue;
|
|
@@ -2826,6 +2930,8 @@ var SqliteDatabase = class {
|
|
|
2826
2930
|
columns.push(colDef);
|
|
2827
2931
|
if (colDef.primaryKey && !primaryKeyCols.includes(colDef.name)) {
|
|
2828
2932
|
primaryKeyCols.push(colDef.name);
|
|
2933
|
+
const primaryIndex = part.findIndex((token) => token.type === "word" && token.value.toUpperCase() === "PRIMARY");
|
|
2934
|
+
primaryKeyOrder.push({ desc: part[primaryIndex + 2]?.value.toUpperCase() === "DESC", collation: colDef.collate });
|
|
2829
2935
|
}
|
|
2830
2936
|
if (colDef.unique) {
|
|
2831
2937
|
uniqueColSets.push([colDef.name]);
|
|
@@ -2849,6 +2955,7 @@ var SqliteDatabase = class {
|
|
|
2849
2955
|
withoutRowId,
|
|
2850
2956
|
strict,
|
|
2851
2957
|
primaryKeyCols,
|
|
2958
|
+
primaryKeyOrder,
|
|
2852
2959
|
uniqueColSets
|
|
2853
2960
|
});
|
|
2854
2961
|
return;
|
|
@@ -2864,32 +2971,55 @@ var SqliteDatabase = class {
|
|
|
2864
2971
|
return i >= idx && t.value.toUpperCase() === "ON";
|
|
2865
2972
|
});
|
|
2866
2973
|
const tableName = tokens[onIdx + 1]?.value ?? "";
|
|
2974
|
+
const tbl = this.findTable(tableName);
|
|
2975
|
+
if (!tbl) throw new Error(`no such table: ${tableName}`);
|
|
2867
2976
|
const cols = [];
|
|
2977
|
+
const collations = [];
|
|
2868
2978
|
let p = onIdx + 2;
|
|
2869
|
-
if (tokens[p]?.value
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2979
|
+
if (tokens[p++]?.value !== "(") throw new Error("expected index columns");
|
|
2980
|
+
while (p < tokens.length && tokens[p]?.value !== ")") {
|
|
2981
|
+
yield;
|
|
2982
|
+
const name = tokens[p++].value;
|
|
2983
|
+
const column = tbl.columns.find((col) => col.name.toLowerCase() === name.toLowerCase());
|
|
2984
|
+
if (!column) throw new Error(`no such column: ${name}`);
|
|
2985
|
+
cols.push(column.name);
|
|
2986
|
+
let collation = column.collate ?? "BINARY";
|
|
2987
|
+
if (tokens[p]?.value.toUpperCase() === "COLLATE") {
|
|
2988
|
+
p++;
|
|
2989
|
+
collation = tokens[p++]?.value.toUpperCase() ?? "";
|
|
2990
|
+
if (!["BINARY", "NOCASE", "RTRIM"].includes(collation)) throw new Error(`no such collation sequence: ${collation}`);
|
|
2991
|
+
}
|
|
2992
|
+
collations.push(collation);
|
|
2993
|
+
if (["ASC", "DESC"].includes(tokens[p]?.value.toUpperCase() ?? "")) p++;
|
|
2994
|
+
if (tokens[p]?.value === ",") p++;
|
|
2995
|
+
else if (tokens[p]?.value !== ")") throw new Error("expected index column separator");
|
|
2879
2996
|
}
|
|
2880
|
-
this.indexes.set(objName, {
|
|
2881
|
-
name: objName,
|
|
2882
|
-
tableName,
|
|
2883
|
-
unique,
|
|
2884
|
-
columns: cols,
|
|
2885
|
-
sql
|
|
2886
|
-
});
|
|
2887
2997
|
if (unique) {
|
|
2888
|
-
const
|
|
2889
|
-
|
|
2890
|
-
|
|
2998
|
+
const keys = [];
|
|
2999
|
+
for (const row of tbl.rows) {
|
|
3000
|
+
const key = [];
|
|
3001
|
+
for (const col of cols) {
|
|
3002
|
+
yield;
|
|
3003
|
+
const value = row.data[col] ?? null;
|
|
3004
|
+
if (value === null) break;
|
|
3005
|
+
key.push(value);
|
|
3006
|
+
}
|
|
3007
|
+
if (key.length === cols.length) keys.push(key);
|
|
3008
|
+
}
|
|
3009
|
+
function* compareKeys(left, right) {
|
|
3010
|
+
for (let c = 0; c < cols.length; c++) {
|
|
3011
|
+
yield;
|
|
3012
|
+
const order = compareSqlValues(left[c], right[c], collations[c]);
|
|
3013
|
+
if (order !== 0) return order;
|
|
3014
|
+
}
|
|
3015
|
+
return 0;
|
|
3016
|
+
}
|
|
3017
|
+
yield* stepSort(keys, compareKeys, this);
|
|
3018
|
+
for (let i = 1; i < keys.length; i++) {
|
|
3019
|
+
if ((yield* compareKeys(keys[i - 1], keys[i])) === 0) throw new SqliteConstraintError(`UNIQUE constraint failed: ${tbl.name}`);
|
|
2891
3020
|
}
|
|
2892
3021
|
}
|
|
3022
|
+
this.indexes.set(objName, { name: objName, tableName: tbl.name, unique, columns: cols, collations, sql });
|
|
2893
3023
|
return;
|
|
2894
3024
|
}
|
|
2895
3025
|
if (kind === "VIEW") {
|
|
@@ -3358,21 +3488,25 @@ var SqliteDatabase = class {
|
|
|
3358
3488
|
}
|
|
3359
3489
|
return `X'${hex}'`;
|
|
3360
3490
|
}
|
|
3361
|
-
*checkConstraintsAndConflicts(tbl, candidate, excludeRowid) {
|
|
3491
|
+
*checkConstraintsAndConflicts(tbl, candidate, excludeRowid, replaceNotNull = false) {
|
|
3362
3492
|
for (const col of tbl.columns) {
|
|
3363
3493
|
yield;
|
|
3364
|
-
|
|
3494
|
+
let val = candidate.data[col.name] ?? null;
|
|
3495
|
+
if (replaceNotNull && col.notNull && val === null && col.defaultExpr) {
|
|
3496
|
+
val = applyColumnAffinity(yield* this.evalScalarSql(col.defaultExpr, {}, []), col.type);
|
|
3497
|
+
candidate.data[col.name] = val;
|
|
3498
|
+
}
|
|
3365
3499
|
if (col.notNull && val === null) {
|
|
3366
3500
|
if (col.primaryKey && col.type.toUpperCase() === "INTEGER" && !tbl.withoutRowId) {
|
|
3367
3501
|
candidate.data[col.name] = candidate.rowid;
|
|
3368
3502
|
} else {
|
|
3369
|
-
throw new
|
|
3503
|
+
throw new SqliteConstraintError(`NOT NULL constraint failed: ${tbl.name}.${col.name}`);
|
|
3370
3504
|
}
|
|
3371
3505
|
}
|
|
3372
3506
|
if (col.checkExpr && val !== null) {
|
|
3373
3507
|
const ok = yield* this.evalExprSteps(parseExprSql(col.checkExpr), candidate.data, []);
|
|
3374
3508
|
if (ok !== null && !isTruthy(ok)) {
|
|
3375
|
-
throw new
|
|
3509
|
+
throw new SqliteConstraintError(`CHECK constraint failed: ${col.checkExpr}`);
|
|
3376
3510
|
}
|
|
3377
3511
|
}
|
|
3378
3512
|
}
|
|
@@ -3384,9 +3518,6 @@ var SqliteDatabase = class {
|
|
|
3384
3518
|
yield;
|
|
3385
3519
|
keySets.push(u);
|
|
3386
3520
|
}
|
|
3387
|
-
if (keySets.length === 0 && candidate.rowid >= tbl.nextRowId) {
|
|
3388
|
-
return null;
|
|
3389
|
-
}
|
|
3390
3521
|
const resolvedKeySets = yield* stepMap(keySets, function* (kSet) {
|
|
3391
3522
|
yield;
|
|
3392
3523
|
return kSet.map((colName) => {
|
|
@@ -3396,6 +3527,12 @@ var SqliteDatabase = class {
|
|
|
3396
3527
|
return { cKey: realCol ? realCol.name : colName, collate: realCol?.collate ?? "BINARY" };
|
|
3397
3528
|
});
|
|
3398
3529
|
}, this);
|
|
3530
|
+
for (const index of this.indexes.values()) {
|
|
3531
|
+
yield;
|
|
3532
|
+
if (index.unique && index.tableName.toLowerCase() === tbl.name.toLowerCase()) {
|
|
3533
|
+
resolvedKeySets.push(index.columns.map((cKey, i) => ({ cKey, collate: index.collations?.[i] ?? tbl.columns.find((col) => col.name === cKey)?.collate ?? "BINARY" })));
|
|
3534
|
+
}
|
|
3535
|
+
}
|
|
3399
3536
|
for (const existing of tbl.rows) {
|
|
3400
3537
|
yield;
|
|
3401
3538
|
if (excludeRowid !== void 0 && existing.rowid === excludeRowid) {
|
|
@@ -3423,6 +3560,23 @@ var SqliteDatabase = class {
|
|
|
3423
3560
|
}
|
|
3424
3561
|
return null;
|
|
3425
3562
|
}
|
|
3563
|
+
synchronizeRowid(tbl, candidate, assigned) {
|
|
3564
|
+
if (tbl.withoutRowId) return;
|
|
3565
|
+
const primary = tbl.columns.find((col) => col.primaryKey && col.type.toUpperCase() === "INTEGER" && tbl.primaryKeyCols.length === 1);
|
|
3566
|
+
for (const name of assigned) {
|
|
3567
|
+
const column = tbl.columns.find((col) => col.name.toLowerCase() === name.toLowerCase());
|
|
3568
|
+
if (column ? column !== primary : !["rowid", "_rowid_", "oid"].includes(name.toLowerCase())) continue;
|
|
3569
|
+
const key = column?.name ?? name;
|
|
3570
|
+
const value = candidate.data[key];
|
|
3571
|
+
if (value !== null && value !== void 0) {
|
|
3572
|
+
const number = typeof value === "string" && value.trim() !== "" ? Number(value) : value;
|
|
3573
|
+
if (typeof number !== "number" || !Number.isSafeInteger(number)) throw new Error("datatype mismatch");
|
|
3574
|
+
candidate.rowid = number;
|
|
3575
|
+
}
|
|
3576
|
+
if (!column) delete candidate.data[key];
|
|
3577
|
+
}
|
|
3578
|
+
if (primary) candidate.data[primary.name] = candidate.rowid;
|
|
3579
|
+
}
|
|
3426
3580
|
*executeInsert(_sql, tokens, positionalParams, cteScope) {
|
|
3427
3581
|
let idx = 0;
|
|
3428
3582
|
let conflictAction = "ABORT";
|
|
@@ -3647,6 +3801,8 @@ var SqliteDatabase = class {
|
|
|
3647
3801
|
}
|
|
3648
3802
|
}
|
|
3649
3803
|
const candidate = { rowid, data };
|
|
3804
|
+
this.synchronizeRowid(tbl, candidate, targetCols);
|
|
3805
|
+
rowid = candidate.rowid;
|
|
3650
3806
|
yield* this.fireTriggers(tbl.name, "BEFORE", "INSERT", void 0, candidate.data);
|
|
3651
3807
|
const conflictRow = yield* this.checkConstraintsAndConflicts(tbl, candidate);
|
|
3652
3808
|
if (conflictRow) {
|
|
@@ -3808,7 +3964,9 @@ var SqliteDatabase = class {
|
|
|
3808
3964
|
}
|
|
3809
3965
|
*executeUpdate(tokens, positionalParams, _cteScope) {
|
|
3810
3966
|
let idx = 1;
|
|
3967
|
+
let conflictAction = "ABORT";
|
|
3811
3968
|
if (tokens[idx]?.value.toUpperCase() === "OR") {
|
|
3969
|
+
conflictAction = tokens[idx + 1]?.value.toUpperCase() ?? "ABORT";
|
|
3812
3970
|
idx += 2;
|
|
3813
3971
|
}
|
|
3814
3972
|
if (tokens[idx + 1]?.value === ".") {
|
|
@@ -3898,8 +4056,10 @@ var SqliteDatabase = class {
|
|
|
3898
4056
|
}
|
|
3899
4057
|
return [];
|
|
3900
4058
|
}, this);
|
|
4059
|
+
const replacedRows = /* @__PURE__ */ new Set();
|
|
3901
4060
|
for (const { row, ctx } of matches) {
|
|
3902
4061
|
yield;
|
|
4062
|
+
if (replacedRows.has(row)) continue;
|
|
3903
4063
|
const oldData = { ...row.data };
|
|
3904
4064
|
const newData = { ...row.data };
|
|
3905
4065
|
for (const assign of assignments) {
|
|
@@ -3924,11 +4084,25 @@ var SqliteDatabase = class {
|
|
|
3924
4084
|
}
|
|
3925
4085
|
yield* this.fireTriggers(tbl.name, "BEFORE", "UPDATE", oldData, newData);
|
|
3926
4086
|
const candidate = { rowid: row.rowid, data: newData };
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
4087
|
+
this.synchronizeRowid(tbl, candidate, assignments.map((assignment) => assignment.col));
|
|
4088
|
+
let conflict;
|
|
4089
|
+
try {
|
|
4090
|
+
conflict = yield* this.checkConstraintsAndConflicts(tbl, candidate, row.rowid, conflictAction === "REPLACE");
|
|
4091
|
+
} catch (error) {
|
|
4092
|
+
if (conflictAction === "IGNORE" && error instanceof SqliteConstraintError) continue;
|
|
4093
|
+
throw error;
|
|
4094
|
+
}
|
|
4095
|
+
if (conflict && conflictAction === "IGNORE") continue;
|
|
4096
|
+
while (conflict) {
|
|
4097
|
+
if (conflictAction !== "REPLACE") throw new Error(`UNIQUE constraint failed: ${tbl.name}`);
|
|
4098
|
+
replacedRows.add(conflict);
|
|
4099
|
+
tbl.rows.splice(tbl.rows.indexOf(conflict), 1);
|
|
4100
|
+
conflict = yield* this.checkConstraintsAndConflicts(tbl, candidate, row.rowid);
|
|
3930
4101
|
}
|
|
3931
4102
|
row.data = newData;
|
|
4103
|
+
row.rowid = candidate.rowid;
|
|
4104
|
+
tbl.nextRowId = Math.max(tbl.nextRowId, row.rowid + 1);
|
|
4105
|
+
tbl.maxAutoInc = Math.max(tbl.maxAutoInc, row.rowid);
|
|
3932
4106
|
updated += 1;
|
|
3933
4107
|
affectedRows.push(row);
|
|
3934
4108
|
yield* this.fireTriggers(tbl.name, "AFTER", "UPDATE", oldData, newData);
|
|
@@ -4481,8 +4655,9 @@ var SqliteDatabase = class {
|
|
|
4481
4655
|
yield;
|
|
4482
4656
|
for (const col of src.columns) {
|
|
4483
4657
|
yield;
|
|
4658
|
+
if (src.hidden?.has(col.toLowerCase())) continue;
|
|
4484
4659
|
selectTargets.push({
|
|
4485
|
-
expr: { kind: "column", table: src.tableAlias || void 0, name: col },
|
|
4660
|
+
expr: { kind: "column", table: src.shared?.has(col.toLowerCase()) ? void 0 : src.tableAlias || void 0, name: col },
|
|
4486
4661
|
alias: col
|
|
4487
4662
|
});
|
|
4488
4663
|
}
|
|
@@ -4623,17 +4798,11 @@ var SqliteDatabase = class {
|
|
|
4623
4798
|
for (const st of selectTargets) {
|
|
4624
4799
|
yield;
|
|
4625
4800
|
if (!(st.alias in repCtx)) {
|
|
4626
|
-
repCtx[st.alias] = yield* this.
|
|
4627
|
-
st.expr,
|
|
4628
|
-
g.representative,
|
|
4629
|
-
g.group,
|
|
4630
|
-
positionalParams,
|
|
4631
|
-
cteScope
|
|
4632
|
-
);
|
|
4801
|
+
repCtx[st.alias] = yield* this.evalExprSteps(st.expr, g.representative, positionalParams, cteScope, { group: g.group });
|
|
4633
4802
|
}
|
|
4634
4803
|
}
|
|
4635
4804
|
return isTruthy(
|
|
4636
|
-
yield* this.
|
|
4805
|
+
yield* this.evalExprSteps(havingExpr, repCtx, positionalParams, cteScope, { group: g.group })
|
|
4637
4806
|
);
|
|
4638
4807
|
}, this);
|
|
4639
4808
|
}
|
|
@@ -4654,17 +4823,15 @@ var SqliteDatabase = class {
|
|
|
4654
4823
|
windowResults
|
|
4655
4824
|
);
|
|
4656
4825
|
}
|
|
4657
|
-
|
|
4826
|
+
let projected = yield* stepMap(groupedRows, function* (g, rowIdx) {
|
|
4658
4827
|
const repCtx = { ...g.representative };
|
|
4659
4828
|
const values = yield* stepMap(selectTargets, function* (st) {
|
|
4660
|
-
const val = yield* this.
|
|
4829
|
+
const val = yield* this.evalExprSteps(
|
|
4661
4830
|
st.expr,
|
|
4662
4831
|
repCtx,
|
|
4663
|
-
g.group,
|
|
4664
|
-
rowIdx,
|
|
4665
|
-
windowResults,
|
|
4666
4832
|
positionalParams,
|
|
4667
|
-
cteScope
|
|
4833
|
+
cteScope,
|
|
4834
|
+
{ group: g.group, window: { rowIdx, results: windowResults } }
|
|
4668
4835
|
);
|
|
4669
4836
|
if (!(st.alias in repCtx)) {
|
|
4670
4837
|
repCtx[st.alias] = val;
|
|
@@ -4673,6 +4840,33 @@ var SqliteDatabase = class {
|
|
|
4673
4840
|
}, this);
|
|
4674
4841
|
return { values, ctx: repCtx, group: g.group };
|
|
4675
4842
|
}, this);
|
|
4843
|
+
const firstWindow = windowResults.keys().next().value;
|
|
4844
|
+
if (!orderByTokens?.length && firstWindow?.kind === "func" && firstWindow.over) {
|
|
4845
|
+
const sortSpecs = [
|
|
4846
|
+
...firstWindow.over.partitionBy.map((expr) => ({ expr, desc: false })),
|
|
4847
|
+
...firstWindow.over.orderBy
|
|
4848
|
+
];
|
|
4849
|
+
if (sortSpecs.length > 0) {
|
|
4850
|
+
const keyed = yield* stepMap(projected, function* (row) {
|
|
4851
|
+
const keys = yield* stepMap(sortSpecs, function* (spec) {
|
|
4852
|
+
return yield* this.evalExprSteps(spec.expr, row.ctx, positionalParams, cteScope, { group: row.group });
|
|
4853
|
+
}, this);
|
|
4854
|
+
return { row, keys };
|
|
4855
|
+
}, this);
|
|
4856
|
+
yield* stepSort(keyed, function* (a, b) {
|
|
4857
|
+
for (let i = 0; i < sortSpecs.length; i++) {
|
|
4858
|
+
yield;
|
|
4859
|
+
const cmp = compareSqlValues(a.keys[i], b.keys[i]);
|
|
4860
|
+
if (cmp !== 0) return sortSpecs[i].desc ? -cmp : cmp;
|
|
4861
|
+
}
|
|
4862
|
+
return 0;
|
|
4863
|
+
}, this);
|
|
4864
|
+
projected = yield* stepMap(keyed, function* (entry) {
|
|
4865
|
+
yield;
|
|
4866
|
+
return entry.row;
|
|
4867
|
+
}, this);
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4676
4870
|
let finalProjected = projected;
|
|
4677
4871
|
if (distinct) {
|
|
4678
4872
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -4720,20 +4914,8 @@ var SqliteDatabase = class {
|
|
|
4720
4914
|
vA = a.values[colIdx] ?? null;
|
|
4721
4915
|
vB = b.values[colIdx] ?? null;
|
|
4722
4916
|
} else {
|
|
4723
|
-
vA = yield* this.
|
|
4724
|
-
|
|
4725
|
-
a.ctx,
|
|
4726
|
-
a.group,
|
|
4727
|
-
positionalParams,
|
|
4728
|
-
cteScope
|
|
4729
|
-
);
|
|
4730
|
-
vB = yield* this.evalExprWithAgg(
|
|
4731
|
-
spec.expr,
|
|
4732
|
-
b.ctx,
|
|
4733
|
-
b.group,
|
|
4734
|
-
positionalParams,
|
|
4735
|
-
cteScope
|
|
4736
|
-
);
|
|
4917
|
+
vA = yield* this.evalExprSteps(spec.expr, a.ctx, positionalParams, cteScope, { group: a.group });
|
|
4918
|
+
vB = yield* this.evalExprSteps(spec.expr, b.ctx, positionalParams, cteScope, { group: b.group });
|
|
4737
4919
|
}
|
|
4738
4920
|
if (vA === null && vB === null) {
|
|
4739
4921
|
continue;
|
|
@@ -4996,6 +5178,13 @@ var SqliteDatabase = class {
|
|
|
4996
5178
|
yield;
|
|
4997
5179
|
return prevCols.has(c.toLowerCase());
|
|
4998
5180
|
}, this) : item.usingCols;
|
|
5181
|
+
if (usingList) {
|
|
5182
|
+
const shared = new Set(usingList.map((column) => column.toLowerCase()));
|
|
5183
|
+
schema[schema.length - 1].hidden = shared;
|
|
5184
|
+
for (const source of schema) {
|
|
5185
|
+
source.shared = /* @__PURE__ */ new Set([...source.shared ?? [], ...shared]);
|
|
5186
|
+
}
|
|
5187
|
+
}
|
|
4999
5188
|
const rightMatched = /* @__PURE__ */ new Set();
|
|
5000
5189
|
for (const leftRow of currentRows) {
|
|
5001
5190
|
yield;
|
|
@@ -5509,85 +5698,17 @@ var SqliteDatabase = class {
|
|
|
5509
5698
|
return { expr, alias };
|
|
5510
5699
|
}
|
|
5511
5700
|
containsAggregate(expr) {
|
|
5512
|
-
if (expr.kind === "func")
|
|
5513
|
-
|
|
5514
|
-
return false;
|
|
5515
|
-
}
|
|
5516
|
-
const u = expr.name.toUpperCase();
|
|
5517
|
-
if ([
|
|
5518
|
-
"COUNT",
|
|
5519
|
-
"SUM",
|
|
5520
|
-
"TOTAL",
|
|
5521
|
-
"AVG",
|
|
5522
|
-
"MIN",
|
|
5523
|
-
"MAX",
|
|
5524
|
-
"GROUP_CONCAT",
|
|
5525
|
-
"STRING_AGG",
|
|
5526
|
-
"JSON_GROUP_ARRAY",
|
|
5527
|
-
"JSON_GROUP_OBJECT"
|
|
5528
|
-
].includes(u)) {
|
|
5529
|
-
if ((u === "MIN" || u === "MAX") && expr.args.length > 1) {
|
|
5530
|
-
return expr.args.some((a) => this.containsAggregate(a));
|
|
5531
|
-
}
|
|
5532
|
-
return true;
|
|
5533
|
-
}
|
|
5534
|
-
return expr.args.some((a) => this.containsAggregate(a));
|
|
5535
|
-
}
|
|
5536
|
-
if (expr.kind === "unary") {
|
|
5537
|
-
return this.containsAggregate(expr.expr);
|
|
5538
|
-
}
|
|
5539
|
-
if (expr.kind === "binary") {
|
|
5540
|
-
return this.containsAggregate(expr.left) || this.containsAggregate(expr.right);
|
|
5541
|
-
}
|
|
5542
|
-
if (expr.kind === "case") {
|
|
5543
|
-
return (expr.base ? this.containsAggregate(expr.base) : false) || expr.branches.some((b) => this.containsAggregate(b.when) || this.containsAggregate(b.then)) || (expr.elseExpr ? this.containsAggregate(expr.elseExpr) : false);
|
|
5544
|
-
}
|
|
5545
|
-
if (expr.kind === "cast") {
|
|
5546
|
-
return this.containsAggregate(expr.expr);
|
|
5547
|
-
}
|
|
5548
|
-
return false;
|
|
5701
|
+
if (expr.kind === "func" && expr.over) return false;
|
|
5702
|
+
return isAggregateFunction(expr) || expressionChildren(expr).some((child) => this.containsAggregate(child));
|
|
5549
5703
|
}
|
|
5550
5704
|
*collectWindowExprs(expr, groupedRows, positionalParams, cteScope, out) {
|
|
5551
5705
|
if (expr.kind === "func" && expr.over) {
|
|
5552
|
-
|
|
5553
|
-
expr,
|
|
5554
|
-
groupedRows,
|
|
5555
|
-
positionalParams,
|
|
5556
|
-
cteScope
|
|
5557
|
-
);
|
|
5558
|
-
out.set(expr, values);
|
|
5706
|
+
out.set(expr, yield* this.evaluateWindowFunc(expr, groupedRows, positionalParams, cteScope));
|
|
5559
5707
|
return;
|
|
5560
5708
|
}
|
|
5561
|
-
|
|
5562
|
-
yield
|
|
5563
|
-
|
|
5564
|
-
yield* this.collectWindowExprs(expr.left, groupedRows, positionalParams, cteScope, out);
|
|
5565
|
-
yield* this.collectWindowExprs(expr.right, groupedRows, positionalParams, cteScope, out);
|
|
5566
|
-
} else if (expr.kind === "func") {
|
|
5567
|
-
for (const a of expr.args) {
|
|
5568
|
-
yield;
|
|
5569
|
-
yield* this.collectWindowExprs(a, groupedRows, positionalParams, cteScope, out);
|
|
5570
|
-
}
|
|
5571
|
-
} else if (expr.kind === "case") {
|
|
5572
|
-
if (expr.base) {
|
|
5573
|
-
yield* this.collectWindowExprs(expr.base, groupedRows, positionalParams, cteScope, out);
|
|
5574
|
-
}
|
|
5575
|
-
for (const b of expr.branches) {
|
|
5576
|
-
yield;
|
|
5577
|
-
yield* this.collectWindowExprs(b.when, groupedRows, positionalParams, cteScope, out);
|
|
5578
|
-
yield* this.collectWindowExprs(b.then, groupedRows, positionalParams, cteScope, out);
|
|
5579
|
-
}
|
|
5580
|
-
if (expr.elseExpr) {
|
|
5581
|
-
yield* this.collectWindowExprs(
|
|
5582
|
-
expr.elseExpr,
|
|
5583
|
-
groupedRows,
|
|
5584
|
-
positionalParams,
|
|
5585
|
-
cteScope,
|
|
5586
|
-
out
|
|
5587
|
-
);
|
|
5588
|
-
}
|
|
5589
|
-
} else if (expr.kind === "cast") {
|
|
5590
|
-
yield* this.collectWindowExprs(expr.expr, groupedRows, positionalParams, cteScope, out);
|
|
5709
|
+
for (const child of expressionChildren(expr)) {
|
|
5710
|
+
yield;
|
|
5711
|
+
yield* this.collectWindowExprs(child, groupedRows, positionalParams, cteScope, out);
|
|
5591
5712
|
}
|
|
5592
5713
|
}
|
|
5593
5714
|
*evaluateWindowFunc(fnExpr, groupedRows, positionalParams, cteScope) {
|
|
@@ -5599,13 +5720,7 @@ var SqliteDatabase = class {
|
|
|
5599
5720
|
const g = groupedRows[i];
|
|
5600
5721
|
const pKey = serializeSqlJson(
|
|
5601
5722
|
yield* stepMap(over.partitionBy, function* (pe) {
|
|
5602
|
-
return yield* this.
|
|
5603
|
-
pe,
|
|
5604
|
-
g.representative,
|
|
5605
|
-
g.group,
|
|
5606
|
-
positionalParams,
|
|
5607
|
-
cteScope
|
|
5608
|
-
);
|
|
5723
|
+
return yield* this.evalExprSteps(pe, g.representative, positionalParams, cteScope, { group: g.group });
|
|
5609
5724
|
}, this),
|
|
5610
5725
|
false
|
|
5611
5726
|
);
|
|
@@ -5625,20 +5740,8 @@ var SqliteDatabase = class {
|
|
|
5625
5740
|
const gB = groupedRows[iB];
|
|
5626
5741
|
for (const ob of over.orderBy) {
|
|
5627
5742
|
yield;
|
|
5628
|
-
const vA = yield* this.
|
|
5629
|
-
|
|
5630
|
-
gA.representative,
|
|
5631
|
-
gA.group,
|
|
5632
|
-
positionalParams,
|
|
5633
|
-
cteScope
|
|
5634
|
-
);
|
|
5635
|
-
const vB = yield* this.evalExprWithAgg(
|
|
5636
|
-
ob.expr,
|
|
5637
|
-
gB.representative,
|
|
5638
|
-
gB.group,
|
|
5639
|
-
positionalParams,
|
|
5640
|
-
cteScope
|
|
5641
|
-
);
|
|
5743
|
+
const vA = yield* this.evalExprSteps(ob.expr, gA.representative, positionalParams, cteScope, { group: gA.group });
|
|
5744
|
+
const vB = yield* this.evalExprSteps(ob.expr, gB.representative, positionalParams, cteScope, { group: gB.group });
|
|
5642
5745
|
const cmp = compareSqlValues(vA, vB);
|
|
5643
5746
|
if (cmp !== 0) {
|
|
5644
5747
|
return ob.desc ? -cmp : cmp;
|
|
@@ -5651,13 +5754,7 @@ var SqliteDatabase = class {
|
|
|
5651
5754
|
const g = groupedRows[idx];
|
|
5652
5755
|
return serializeSqlJson(
|
|
5653
5756
|
yield* stepMap(over.orderBy, function* (ob) {
|
|
5654
|
-
return yield* this.
|
|
5655
|
-
ob.expr,
|
|
5656
|
-
g.representative,
|
|
5657
|
-
g.group,
|
|
5658
|
-
positionalParams,
|
|
5659
|
-
cteScope
|
|
5660
|
-
);
|
|
5757
|
+
return yield* this.evalExprSteps(ob.expr, g.representative, positionalParams, cteScope, { group: g.group });
|
|
5661
5758
|
}, this),
|
|
5662
5759
|
false
|
|
5663
5760
|
);
|
|
@@ -5683,13 +5780,7 @@ var SqliteDatabase = class {
|
|
|
5683
5780
|
1,
|
|
5684
5781
|
Math.trunc(
|
|
5685
5782
|
toSqlNumber(
|
|
5686
|
-
yield* this.
|
|
5687
|
-
fnExpr.args[0],
|
|
5688
|
-
g.representative,
|
|
5689
|
-
g.group,
|
|
5690
|
-
positionalParams,
|
|
5691
|
-
cteScope
|
|
5692
|
-
)
|
|
5783
|
+
yield* this.evalExprSteps(fnExpr.args[0], g.representative, positionalParams, cteScope, { group: g.group })
|
|
5693
5784
|
)
|
|
5694
5785
|
)
|
|
5695
5786
|
);
|
|
@@ -5706,44 +5797,20 @@ var SqliteDatabase = class {
|
|
|
5706
5797
|
} else if (fnUpper === "LAG" || fnUpper === "LEAD") {
|
|
5707
5798
|
const offset = fnExpr.args[1] ? Math.trunc(
|
|
5708
5799
|
toSqlNumber(
|
|
5709
|
-
yield* this.
|
|
5710
|
-
fnExpr.args[1],
|
|
5711
|
-
g.representative,
|
|
5712
|
-
g.group,
|
|
5713
|
-
positionalParams,
|
|
5714
|
-
cteScope
|
|
5715
|
-
)
|
|
5800
|
+
yield* this.evalExprSteps(fnExpr.args[1], g.representative, positionalParams, cteScope, { group: g.group })
|
|
5716
5801
|
)
|
|
5717
5802
|
) : 1;
|
|
5718
|
-
const defVal = fnExpr.args[2] ? yield* this.
|
|
5719
|
-
fnExpr.args[2],
|
|
5720
|
-
g.representative,
|
|
5721
|
-
g.group,
|
|
5722
|
-
positionalParams,
|
|
5723
|
-
cteScope
|
|
5724
|
-
) : null;
|
|
5803
|
+
const defVal = fnExpr.args[2] ? yield* this.evalExprSteps(fnExpr.args[2], g.representative, positionalParams, cteScope, { group: g.group }) : null;
|
|
5725
5804
|
const targetPos = fnUpper === "LAG" ? pPos - offset : pPos + offset;
|
|
5726
5805
|
if (targetPos < 0 || targetPos >= indices.length) {
|
|
5727
5806
|
result[rowIdx] = defVal;
|
|
5728
5807
|
} else {
|
|
5729
5808
|
const targetG = groupedRows[indices[targetPos]];
|
|
5730
|
-
result[rowIdx] = yield* this.
|
|
5731
|
-
fnExpr.args[0],
|
|
5732
|
-
targetG.representative,
|
|
5733
|
-
targetG.group,
|
|
5734
|
-
positionalParams,
|
|
5735
|
-
cteScope
|
|
5736
|
-
);
|
|
5809
|
+
result[rowIdx] = yield* this.evalExprSteps(fnExpr.args[0], targetG.representative, positionalParams, cteScope, { group: targetG.group });
|
|
5737
5810
|
}
|
|
5738
5811
|
} else if (fnUpper === "FIRST_VALUE") {
|
|
5739
5812
|
const firstG = groupedRows[indices[0]];
|
|
5740
|
-
result[rowIdx] = yield* this.
|
|
5741
|
-
fnExpr.args[0],
|
|
5742
|
-
firstG.representative,
|
|
5743
|
-
firstG.group,
|
|
5744
|
-
positionalParams,
|
|
5745
|
-
cteScope
|
|
5746
|
-
);
|
|
5813
|
+
result[rowIdx] = yield* this.evalExprSteps(fnExpr.args[0], firstG.representative, positionalParams, cteScope, { group: firstG.group });
|
|
5747
5814
|
} else if (fnUpper === "LAST_VALUE") {
|
|
5748
5815
|
let peerEnd = over.orderBy.length > 0 ? pPos : indices.length - 1;
|
|
5749
5816
|
while (over.orderBy.length > 0 && peerEnd + 1 < indices.length && orderPeerKeys[peerEnd + 1] === orderPeerKeys[pPos]) {
|
|
@@ -5751,34 +5818,16 @@ var SqliteDatabase = class {
|
|
|
5751
5818
|
peerEnd += 1;
|
|
5752
5819
|
}
|
|
5753
5820
|
const lastG = groupedRows[indices[peerEnd]];
|
|
5754
|
-
result[rowIdx] = yield* this.
|
|
5755
|
-
fnExpr.args[0],
|
|
5756
|
-
lastG.representative,
|
|
5757
|
-
lastG.group,
|
|
5758
|
-
positionalParams,
|
|
5759
|
-
cteScope
|
|
5760
|
-
);
|
|
5821
|
+
result[rowIdx] = yield* this.evalExprSteps(fnExpr.args[0], lastG.representative, positionalParams, cteScope, { group: lastG.group });
|
|
5761
5822
|
} else if (fnUpper === "NTH_VALUE") {
|
|
5762
5823
|
const n = Math.trunc(
|
|
5763
5824
|
toSqlNumber(
|
|
5764
|
-
yield* this.
|
|
5765
|
-
fnExpr.args[1],
|
|
5766
|
-
g.representative,
|
|
5767
|
-
g.group,
|
|
5768
|
-
positionalParams,
|
|
5769
|
-
cteScope
|
|
5770
|
-
)
|
|
5825
|
+
yield* this.evalExprSteps(fnExpr.args[1], g.representative, positionalParams, cteScope, { group: g.group })
|
|
5771
5826
|
)
|
|
5772
5827
|
);
|
|
5773
5828
|
if (n >= 1 && n <= indices.length) {
|
|
5774
5829
|
const nthG = groupedRows[indices[n - 1]];
|
|
5775
|
-
result[rowIdx] = yield* this.
|
|
5776
|
-
fnExpr.args[0],
|
|
5777
|
-
nthG.representative,
|
|
5778
|
-
nthG.group,
|
|
5779
|
-
positionalParams,
|
|
5780
|
-
cteScope
|
|
5781
|
-
);
|
|
5830
|
+
result[rowIdx] = yield* this.evalExprSteps(fnExpr.args[0], nthG.representative, positionalParams, cteScope, { group: nthG.group });
|
|
5782
5831
|
} else {
|
|
5783
5832
|
result[rowIdx] = null;
|
|
5784
5833
|
}
|
|
@@ -5804,150 +5853,6 @@ var SqliteDatabase = class {
|
|
|
5804
5853
|
}
|
|
5805
5854
|
return result;
|
|
5806
5855
|
}
|
|
5807
|
-
*evalExprWithAggAndWindow(expr, rep, group, rowIdx, windowResults, positionalParams, cteScope) {
|
|
5808
|
-
if (windowResults.has(expr)) {
|
|
5809
|
-
return windowResults.get(expr)[rowIdx] ?? null;
|
|
5810
|
-
}
|
|
5811
|
-
if (expr.kind === "unary") {
|
|
5812
|
-
const v = yield* this.evalExprWithAggAndWindow(
|
|
5813
|
-
expr.expr,
|
|
5814
|
-
rep,
|
|
5815
|
-
group,
|
|
5816
|
-
rowIdx,
|
|
5817
|
-
windowResults,
|
|
5818
|
-
positionalParams,
|
|
5819
|
-
cteScope
|
|
5820
|
-
);
|
|
5821
|
-
return this.applyUnary(expr.op, v);
|
|
5822
|
-
}
|
|
5823
|
-
if (expr.kind === "binary") {
|
|
5824
|
-
const l = yield* this.evalExprWithAggAndWindow(
|
|
5825
|
-
expr.left,
|
|
5826
|
-
rep,
|
|
5827
|
-
group,
|
|
5828
|
-
rowIdx,
|
|
5829
|
-
windowResults,
|
|
5830
|
-
positionalParams,
|
|
5831
|
-
cteScope
|
|
5832
|
-
);
|
|
5833
|
-
const r = yield* this.evalExprWithAggAndWindow(
|
|
5834
|
-
expr.right,
|
|
5835
|
-
rep,
|
|
5836
|
-
group,
|
|
5837
|
-
rowIdx,
|
|
5838
|
-
windowResults,
|
|
5839
|
-
positionalParams,
|
|
5840
|
-
cteScope
|
|
5841
|
-
);
|
|
5842
|
-
return this.applyBinary(expr.op, l, r);
|
|
5843
|
-
}
|
|
5844
|
-
if (expr.kind === "func" && !this.containsAggregate(expr) && !expr.over) {
|
|
5845
|
-
const args = yield* stepMap(expr.args, function* (a) {
|
|
5846
|
-
return yield* this.evalExprWithAggAndWindow(
|
|
5847
|
-
a,
|
|
5848
|
-
rep,
|
|
5849
|
-
group,
|
|
5850
|
-
rowIdx,
|
|
5851
|
-
windowResults,
|
|
5852
|
-
positionalParams,
|
|
5853
|
-
cteScope
|
|
5854
|
-
);
|
|
5855
|
-
}, this);
|
|
5856
|
-
return yield* this.evalScalarFunction(expr.name, args);
|
|
5857
|
-
}
|
|
5858
|
-
return yield* this.evalExprWithAgg(expr, rep, group, positionalParams, cteScope);
|
|
5859
|
-
}
|
|
5860
|
-
*evalExprWithAgg(expr, rep, group, positionalParams, cteScope) {
|
|
5861
|
-
if (expr.kind === "func") {
|
|
5862
|
-
const u = expr.name.toUpperCase();
|
|
5863
|
-
if ([
|
|
5864
|
-
"COUNT",
|
|
5865
|
-
"SUM",
|
|
5866
|
-
"TOTAL",
|
|
5867
|
-
"AVG",
|
|
5868
|
-
"MIN",
|
|
5869
|
-
"MAX",
|
|
5870
|
-
"GROUP_CONCAT",
|
|
5871
|
-
"STRING_AGG",
|
|
5872
|
-
"JSON_GROUP_ARRAY",
|
|
5873
|
-
"JSON_GROUP_OBJECT"
|
|
5874
|
-
].includes(u) && !((u === "MIN" || u === "MAX") && expr.args.length > 1)) {
|
|
5875
|
-
return yield* this.evalAggregateFunction(expr, group, positionalParams, cteScope);
|
|
5876
|
-
}
|
|
5877
|
-
if (u === "COALESCE" || u === "IFNULL") {
|
|
5878
|
-
for (const a of expr.args) {
|
|
5879
|
-
yield;
|
|
5880
|
-
const v = yield* this.evalExprWithAgg(a, rep, group, positionalParams, cteScope);
|
|
5881
|
-
if (v !== null && v !== void 0) {
|
|
5882
|
-
return v;
|
|
5883
|
-
}
|
|
5884
|
-
}
|
|
5885
|
-
return null;
|
|
5886
|
-
}
|
|
5887
|
-
if (u === "IIF") {
|
|
5888
|
-
const cond = yield* this.evalExprWithAgg(
|
|
5889
|
-
expr.args[0],
|
|
5890
|
-
rep,
|
|
5891
|
-
group,
|
|
5892
|
-
positionalParams,
|
|
5893
|
-
cteScope
|
|
5894
|
-
);
|
|
5895
|
-
return isTruthy(cond) ? yield* this.evalExprWithAgg(expr.args[1], rep, group, positionalParams, cteScope) : expr.args[2] ? yield* this.evalExprWithAgg(expr.args[2], rep, group, positionalParams, cteScope) : null;
|
|
5896
|
-
}
|
|
5897
|
-
const args = yield* stepMap(expr.args, function* (a) {
|
|
5898
|
-
return yield* this.evalExprWithAgg(a, rep, group, positionalParams, cteScope);
|
|
5899
|
-
}, this);
|
|
5900
|
-
return yield* this.evalScalarFunction(expr.name, args);
|
|
5901
|
-
}
|
|
5902
|
-
if (expr.kind === "unary") {
|
|
5903
|
-
return this.applyUnary(
|
|
5904
|
-
expr.op,
|
|
5905
|
-
yield* this.evalExprWithAgg(expr.expr, rep, group, positionalParams, cteScope)
|
|
5906
|
-
);
|
|
5907
|
-
}
|
|
5908
|
-
if (expr.kind === "binary") {
|
|
5909
|
-
const l = yield* this.evalExprWithAgg(expr.left, rep, group, positionalParams, cteScope);
|
|
5910
|
-
const r = yield* this.evalExprWithAgg(expr.right, rep, group, positionalParams, cteScope);
|
|
5911
|
-
return this.applyBinary(expr.op, l, r);
|
|
5912
|
-
}
|
|
5913
|
-
if (expr.kind === "is_null") {
|
|
5914
|
-
const v = yield* this.evalExprWithAgg(expr.expr, rep, group, positionalParams, cteScope);
|
|
5915
|
-
return (expr.not ? v !== null : v === null) ? 1 : 0;
|
|
5916
|
-
}
|
|
5917
|
-
if (expr.kind === "between") {
|
|
5918
|
-
const v = yield* this.evalExprWithAgg(expr.expr, rep, group, positionalParams, cteScope);
|
|
5919
|
-
const lo = yield* this.evalExprWithAgg(expr.low, rep, group, positionalParams, cteScope);
|
|
5920
|
-
const hi = yield* this.evalExprWithAgg(expr.high, rep, group, positionalParams, cteScope);
|
|
5921
|
-
if (v === null || lo === null || hi === null) {
|
|
5922
|
-
return null;
|
|
5923
|
-
}
|
|
5924
|
-
const inside = compareSqlValues(v, lo) >= 0 && compareSqlValues(v, hi) <= 0;
|
|
5925
|
-
return (expr.not ? !inside : inside) ? 1 : 0;
|
|
5926
|
-
}
|
|
5927
|
-
if (expr.kind === "case") {
|
|
5928
|
-
const baseVal = expr.base ? yield* this.evalExprWithAgg(expr.base, rep, group, positionalParams, cteScope) : void 0;
|
|
5929
|
-
for (const b of expr.branches) {
|
|
5930
|
-
yield;
|
|
5931
|
-
const wVal = yield* this.evalExprWithAgg(
|
|
5932
|
-
b.when,
|
|
5933
|
-
rep,
|
|
5934
|
-
group,
|
|
5935
|
-
positionalParams,
|
|
5936
|
-
cteScope
|
|
5937
|
-
);
|
|
5938
|
-
const matched = expr.base ? sqlEquals(baseVal ?? null, wVal) === true : isTruthy(wVal);
|
|
5939
|
-
if (matched) {
|
|
5940
|
-
return yield* this.evalExprWithAgg(b.then, rep, group, positionalParams, cteScope);
|
|
5941
|
-
}
|
|
5942
|
-
}
|
|
5943
|
-
return expr.elseExpr ? yield* this.evalExprWithAgg(expr.elseExpr, rep, group, positionalParams, cteScope) : null;
|
|
5944
|
-
}
|
|
5945
|
-
if (expr.kind === "cast") {
|
|
5946
|
-
const v = yield* this.evalExprWithAgg(expr.expr, rep, group, positionalParams, cteScope);
|
|
5947
|
-
return this.applyCast(v, expr.targetType);
|
|
5948
|
-
}
|
|
5949
|
-
return yield* this.evalExprSteps(expr, rep, positionalParams, cteScope);
|
|
5950
|
-
}
|
|
5951
5856
|
*evalAggregateFunction(expr, group, positionalParams, cteScope) {
|
|
5952
5857
|
const u = expr.name.toUpperCase();
|
|
5953
5858
|
let filteredGroup = group;
|
|
@@ -6188,7 +6093,10 @@ var SqliteDatabase = class {
|
|
|
6188
6093
|
evalExpr(expr, row, positionalParams, cteScope = /* @__PURE__ */ new Map()) {
|
|
6189
6094
|
return runSynchronously(this.evalExprSteps(expr, row, positionalParams, cteScope));
|
|
6190
6095
|
}
|
|
6191
|
-
*evalExprSteps(expr, row, positionalParams, cteScope = /* @__PURE__ */ new Map()) {
|
|
6096
|
+
*evalExprSteps(expr, row, positionalParams, cteScope = /* @__PURE__ */ new Map(), evaluation) {
|
|
6097
|
+
if (evaluation?.window?.results.has(expr)) {
|
|
6098
|
+
return evaluation.window.results.get(expr)[evaluation.window.rowIdx] ?? null;
|
|
6099
|
+
}
|
|
6192
6100
|
switch (expr.kind) {
|
|
6193
6101
|
case "literal":
|
|
6194
6102
|
return expr.value;
|
|
@@ -6207,19 +6115,19 @@ var SqliteDatabase = class {
|
|
|
6207
6115
|
return this.parameters.get(expr.name) ?? this.parameters.get(expr.name.slice(1)) ?? positionalParams[expr.index - 1] ?? null;
|
|
6208
6116
|
}
|
|
6209
6117
|
case "collate":
|
|
6210
|
-
return yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope);
|
|
6118
|
+
return yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope, evaluation);
|
|
6211
6119
|
case "unary":
|
|
6212
6120
|
return this.applyUnary(
|
|
6213
6121
|
expr.op,
|
|
6214
|
-
yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope)
|
|
6122
|
+
yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope, evaluation)
|
|
6215
6123
|
);
|
|
6216
6124
|
case "binary": {
|
|
6217
6125
|
if (expr.op === "AND") {
|
|
6218
|
-
const l2 = yield* this.evalExprSteps(expr.left, row, positionalParams, cteScope);
|
|
6126
|
+
const l2 = yield* this.evalExprSteps(expr.left, row, positionalParams, cteScope, evaluation);
|
|
6219
6127
|
if (l2 !== null && !isTruthy(l2)) {
|
|
6220
6128
|
return 0;
|
|
6221
6129
|
}
|
|
6222
|
-
const r2 = yield* this.evalExprSteps(expr.right, row, positionalParams, cteScope);
|
|
6130
|
+
const r2 = yield* this.evalExprSteps(expr.right, row, positionalParams, cteScope, evaluation);
|
|
6223
6131
|
if (r2 !== null && !isTruthy(r2)) {
|
|
6224
6132
|
return 0;
|
|
6225
6133
|
}
|
|
@@ -6229,11 +6137,11 @@ var SqliteDatabase = class {
|
|
|
6229
6137
|
return 1;
|
|
6230
6138
|
}
|
|
6231
6139
|
if (expr.op === "OR") {
|
|
6232
|
-
const l2 = yield* this.evalExprSteps(expr.left, row, positionalParams, cteScope);
|
|
6140
|
+
const l2 = yield* this.evalExprSteps(expr.left, row, positionalParams, cteScope, evaluation);
|
|
6233
6141
|
if (l2 !== null && isTruthy(l2)) {
|
|
6234
6142
|
return 1;
|
|
6235
6143
|
}
|
|
6236
|
-
const r2 = yield* this.evalExprSteps(expr.right, row, positionalParams, cteScope);
|
|
6144
|
+
const r2 = yield* this.evalExprSteps(expr.right, row, positionalParams, cteScope, evaluation);
|
|
6237
6145
|
if (r2 !== null && isTruthy(r2)) {
|
|
6238
6146
|
return 1;
|
|
6239
6147
|
}
|
|
@@ -6243,47 +6151,48 @@ var SqliteDatabase = class {
|
|
|
6243
6151
|
return 0;
|
|
6244
6152
|
}
|
|
6245
6153
|
const collation = expr.left.kind === "collate" ? expr.left.collation : expr.right.kind === "collate" ? expr.right.collation : "BINARY";
|
|
6246
|
-
const l = yield* this.evalExprSteps(expr.left, row, positionalParams, cteScope);
|
|
6154
|
+
const l = yield* this.evalExprSteps(expr.left, row, positionalParams, cteScope, evaluation);
|
|
6247
6155
|
if ((expr.op === "LIKE" || expr.op === "GLOB") && expr.right.kind === "func" && expr.right.name === "__like_escape__") {
|
|
6248
6156
|
const pat = yield* this.evalExprSteps(
|
|
6249
6157
|
expr.right.args[0],
|
|
6250
6158
|
row,
|
|
6251
6159
|
positionalParams,
|
|
6252
|
-
cteScope
|
|
6160
|
+
cteScope,
|
|
6161
|
+
evaluation
|
|
6253
6162
|
);
|
|
6254
6163
|
const esc = yield* this.evalExprSteps(
|
|
6255
6164
|
expr.right.args[1],
|
|
6256
6165
|
row,
|
|
6257
6166
|
positionalParams,
|
|
6258
|
-
cteScope
|
|
6167
|
+
cteScope,
|
|
6168
|
+
evaluation
|
|
6259
6169
|
);
|
|
6260
6170
|
if (l === null || pat === null || esc === null) {
|
|
6261
6171
|
return null;
|
|
6262
6172
|
}
|
|
6263
6173
|
return matchLike(toSqlString(l), toSqlString(pat), expr.op === "LIKE", toSqlString(esc)) ? 1 : 0;
|
|
6264
6174
|
}
|
|
6265
|
-
const r = yield* this.evalExprSteps(expr.right, row, positionalParams, cteScope);
|
|
6175
|
+
const r = yield* this.evalExprSteps(expr.right, row, positionalParams, cteScope, evaluation);
|
|
6266
6176
|
return this.applyBinary(expr.op, l, r, collation);
|
|
6267
6177
|
}
|
|
6268
6178
|
case "between": {
|
|
6269
|
-
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope);
|
|
6270
|
-
const lo = yield* this.evalExprSteps(expr.low, row, positionalParams, cteScope);
|
|
6271
|
-
const hi = yield* this.evalExprSteps(expr.high, row, positionalParams, cteScope);
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
return (expr.not ? !inside : inside) ? 1 : 0;
|
|
6179
|
+
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope, evaluation);
|
|
6180
|
+
const lo = yield* this.evalExprSteps(expr.low, row, positionalParams, cteScope, evaluation);
|
|
6181
|
+
const hi = yield* this.evalExprSteps(expr.high, row, positionalParams, cteScope, evaluation);
|
|
6182
|
+
const lower = v === null || lo === null ? null : compareSqlValues(v, lo) >= 0;
|
|
6183
|
+
const upper = v === null || hi === null ? null : compareSqlValues(v, hi) <= 0;
|
|
6184
|
+
const inside = lower === false || upper === false ? false : lower === null || upper === null ? null : true;
|
|
6185
|
+
return inside === null ? null : (expr.not ? !inside : inside) ? 1 : 0;
|
|
6277
6186
|
}
|
|
6278
6187
|
case "in_list": {
|
|
6279
|
-
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope);
|
|
6188
|
+
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope, evaluation);
|
|
6280
6189
|
if (v === null) {
|
|
6281
6190
|
return expr.list.length === 0 ? expr.not ? 1 : 0 : null;
|
|
6282
6191
|
}
|
|
6283
6192
|
let sawNull = false;
|
|
6284
6193
|
for (const item of expr.list) {
|
|
6285
6194
|
yield;
|
|
6286
|
-
const iv = yield* this.evalExprSteps(item, row, positionalParams, cteScope);
|
|
6195
|
+
const iv = yield* this.evalExprSteps(item, row, positionalParams, cteScope, evaluation);
|
|
6287
6196
|
if (iv === null) {
|
|
6288
6197
|
sawNull = true;
|
|
6289
6198
|
} else if (sqlEquals(v, iv) === true) {
|
|
@@ -6296,7 +6205,7 @@ var SqliteDatabase = class {
|
|
|
6296
6205
|
return expr.not ? 1 : 0;
|
|
6297
6206
|
}
|
|
6298
6207
|
case "in_subquery": {
|
|
6299
|
-
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope);
|
|
6208
|
+
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope, evaluation);
|
|
6300
6209
|
this.outerRows.push(row);
|
|
6301
6210
|
let res;
|
|
6302
6211
|
try {
|
|
@@ -6329,23 +6238,23 @@ var SqliteDatabase = class {
|
|
|
6329
6238
|
return expr.not ? 1 : 0;
|
|
6330
6239
|
}
|
|
6331
6240
|
case "is_null": {
|
|
6332
|
-
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope);
|
|
6241
|
+
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope, evaluation);
|
|
6333
6242
|
return (expr.not ? v !== null : v === null) ? 1 : 0;
|
|
6334
6243
|
}
|
|
6335
6244
|
case "case": {
|
|
6336
|
-
const baseVal = expr.base ? yield* this.evalExprSteps(expr.base, row, positionalParams, cteScope) : void 0;
|
|
6245
|
+
const baseVal = expr.base ? yield* this.evalExprSteps(expr.base, row, positionalParams, cteScope, evaluation) : void 0;
|
|
6337
6246
|
for (const b of expr.branches) {
|
|
6338
6247
|
yield;
|
|
6339
|
-
const wVal = yield* this.evalExprSteps(b.when, row, positionalParams, cteScope);
|
|
6248
|
+
const wVal = yield* this.evalExprSteps(b.when, row, positionalParams, cteScope, evaluation);
|
|
6340
6249
|
const matched = expr.base ? sqlEquals(baseVal ?? null, wVal) === true : isTruthy(wVal);
|
|
6341
6250
|
if (matched) {
|
|
6342
|
-
return yield* this.evalExprSteps(b.then, row, positionalParams, cteScope);
|
|
6251
|
+
return yield* this.evalExprSteps(b.then, row, positionalParams, cteScope, evaluation);
|
|
6343
6252
|
}
|
|
6344
6253
|
}
|
|
6345
|
-
return expr.elseExpr ? yield* this.evalExprSteps(expr.elseExpr, row, positionalParams, cteScope) : null;
|
|
6254
|
+
return expr.elseExpr ? yield* this.evalExprSteps(expr.elseExpr, row, positionalParams, cteScope, evaluation) : null;
|
|
6346
6255
|
}
|
|
6347
6256
|
case "cast": {
|
|
6348
|
-
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope);
|
|
6257
|
+
const v = yield* this.evalExprSteps(expr.expr, row, positionalParams, cteScope, evaluation);
|
|
6349
6258
|
return this.applyCast(v, expr.targetType);
|
|
6350
6259
|
}
|
|
6351
6260
|
case "subquery": {
|
|
@@ -6368,11 +6277,14 @@ var SqliteDatabase = class {
|
|
|
6368
6277
|
return res.rows[0]?.[0] ?? null;
|
|
6369
6278
|
}
|
|
6370
6279
|
case "func": {
|
|
6280
|
+
if (evaluation && isAggregateFunction(expr)) {
|
|
6281
|
+
return yield* this.evalAggregateFunction(expr, evaluation.group, positionalParams, cteScope);
|
|
6282
|
+
}
|
|
6371
6283
|
const u = expr.name.toUpperCase();
|
|
6372
6284
|
if (u === "COALESCE" || u === "IFNULL") {
|
|
6373
6285
|
for (const a of expr.args) {
|
|
6374
6286
|
yield;
|
|
6375
|
-
const v = yield* this.evalExprSteps(a, row, positionalParams, cteScope);
|
|
6287
|
+
const v = yield* this.evalExprSteps(a, row, positionalParams, cteScope, evaluation);
|
|
6376
6288
|
if (v !== null && v !== void 0) {
|
|
6377
6289
|
return v;
|
|
6378
6290
|
}
|
|
@@ -6384,12 +6296,13 @@ var SqliteDatabase = class {
|
|
|
6384
6296
|
expr.args[0],
|
|
6385
6297
|
row,
|
|
6386
6298
|
positionalParams,
|
|
6387
|
-
cteScope
|
|
6299
|
+
cteScope,
|
|
6300
|
+
evaluation
|
|
6388
6301
|
);
|
|
6389
|
-
return isTruthy(cond) ? yield* this.evalExprSteps(expr.args[1], row, positionalParams, cteScope) : expr.args[2] ? yield* this.evalExprSteps(expr.args[2], row, positionalParams, cteScope) : null;
|
|
6302
|
+
return isTruthy(cond) ? yield* this.evalExprSteps(expr.args[1], row, positionalParams, cteScope, evaluation) : expr.args[2] ? yield* this.evalExprSteps(expr.args[2], row, positionalParams, cteScope, evaluation) : null;
|
|
6390
6303
|
}
|
|
6391
6304
|
const args = yield* stepMap(expr.args, function* (a) {
|
|
6392
|
-
return yield* this.evalExprSteps(a, row, positionalParams, cteScope);
|
|
6305
|
+
return yield* this.evalExprSteps(a, row, positionalParams, cteScope, evaluation);
|
|
6393
6306
|
}, this);
|
|
6394
6307
|
return yield* this.evalScalarFunction(expr.name, args);
|
|
6395
6308
|
}
|
|
@@ -6541,18 +6454,6 @@ var SqliteDatabase = class {
|
|
|
6541
6454
|
switch (u) {
|
|
6542
6455
|
case "NULLIF":
|
|
6543
6456
|
return sqlEquals(a0, a1) === true ? null : a0;
|
|
6544
|
-
case "COALESCE":
|
|
6545
|
-
case "IFNULL": {
|
|
6546
|
-
for (const a of args) {
|
|
6547
|
-
yield;
|
|
6548
|
-
if (a !== null && a !== void 0) {
|
|
6549
|
-
return a;
|
|
6550
|
-
}
|
|
6551
|
-
}
|
|
6552
|
-
return null;
|
|
6553
|
-
}
|
|
6554
|
-
case "IIF":
|
|
6555
|
-
return isTruthy(a0) ? a1 ?? null : args[2] ?? null;
|
|
6556
6457
|
case "TYPEOF":
|
|
6557
6458
|
if (a0 === null || a0 === void 0) {
|
|
6558
6459
|
return "null";
|
|
@@ -6623,7 +6524,7 @@ var SqliteDatabase = class {
|
|
|
6623
6524
|
const s = toSqlString(a0);
|
|
6624
6525
|
const chars = Array.from(s);
|
|
6625
6526
|
const pos = Math.trunc(toSqlNumber(a1));
|
|
6626
|
-
|
|
6527
|
+
let len = args[2] !== void 0 && args[2] !== null ? Math.trunc(toSqlNumber(args[2])) : chars.length;
|
|
6627
6528
|
let startIdx;
|
|
6628
6529
|
if (pos > 0) {
|
|
6629
6530
|
startIdx = pos - 1;
|
|
@@ -6631,6 +6532,7 @@ var SqliteDatabase = class {
|
|
|
6631
6532
|
startIdx = chars.length + pos;
|
|
6632
6533
|
} else {
|
|
6633
6534
|
startIdx = 0;
|
|
6535
|
+
if (args[2] !== void 0 && args[2] !== null && len > 0) len -= 1;
|
|
6634
6536
|
}
|
|
6635
6537
|
if (len < 0) {
|
|
6636
6538
|
const endIdx = Math.max(0, startIdx);
|
|
@@ -7059,6 +6961,45 @@ var SqliteDatabase = class {
|
|
|
7059
6961
|
};
|
|
7060
6962
|
|
|
7061
6963
|
// packages/safe-bash-command-sqlite3/src/index.ts
|
|
6964
|
+
function setOutputMode(state, mode, argument) {
|
|
6965
|
+
if (!["list", "csv", "column", "line", "json", "tabs", "html", "markdown", "box", "table", "quote", "ascii", "insert"].includes(mode)) {
|
|
6966
|
+
return;
|
|
6967
|
+
}
|
|
6968
|
+
state.mode = mode;
|
|
6969
|
+
switch (mode) {
|
|
6970
|
+
case "list":
|
|
6971
|
+
state.colSeparator = "|";
|
|
6972
|
+
state.rowSeparator = "\n";
|
|
6973
|
+
break;
|
|
6974
|
+
case "csv":
|
|
6975
|
+
state.colSeparator = ",";
|
|
6976
|
+
state.rowSeparator = "\r\n";
|
|
6977
|
+
break;
|
|
6978
|
+
case "tabs":
|
|
6979
|
+
state.colSeparator = " ";
|
|
6980
|
+
break;
|
|
6981
|
+
case "ascii":
|
|
6982
|
+
state.colSeparator = "";
|
|
6983
|
+
state.rowSeparator = "";
|
|
6984
|
+
break;
|
|
6985
|
+
case "quote":
|
|
6986
|
+
state.colSeparator = ",";
|
|
6987
|
+
state.rowSeparator = "\n";
|
|
6988
|
+
break;
|
|
6989
|
+
case "line":
|
|
6990
|
+
case "column":
|
|
6991
|
+
state.rowSeparator = "\n";
|
|
6992
|
+
break;
|
|
6993
|
+
case "insert":
|
|
6994
|
+
if (argument) state.insertTable = argument;
|
|
6995
|
+
break;
|
|
6996
|
+
case "table":
|
|
6997
|
+
case "box":
|
|
6998
|
+
case "markdown":
|
|
6999
|
+
if (argument === void 0) state.showHeaders = true;
|
|
7000
|
+
break;
|
|
7001
|
+
}
|
|
7002
|
+
}
|
|
7062
7003
|
var textEncoder3 = new TextEncoder();
|
|
7063
7004
|
var textDecoder3 = new TextDecoder("utf-8", { fatal: false });
|
|
7064
7005
|
async function vfsExists(fs, path) {
|
|
@@ -7223,6 +7164,8 @@ function formatQueryResult(res, state) {
|
|
|
7223
7164
|
return "";
|
|
7224
7165
|
}
|
|
7225
7166
|
switch (state.mode) {
|
|
7167
|
+
case "tabs":
|
|
7168
|
+
case "ascii":
|
|
7226
7169
|
case "list": {
|
|
7227
7170
|
if (!state.showHeaders && rows.length === 0) {
|
|
7228
7171
|
return "";
|
|
@@ -7236,40 +7179,11 @@ function formatQueryResult(res, state) {
|
|
|
7236
7179
|
}
|
|
7237
7180
|
return lines.map((l) => `${l}${state.rowSeparator}`).join("");
|
|
7238
7181
|
}
|
|
7239
|
-
case "tabs": {
|
|
7240
|
-
if (!state.showHeaders && rows.length === 0) {
|
|
7241
|
-
return "";
|
|
7242
|
-
}
|
|
7243
|
-
const lines = [];
|
|
7244
|
-
if (state.showHeaders) {
|
|
7245
|
-
lines.push(columns.join(" "));
|
|
7246
|
-
}
|
|
7247
|
-
for (const r of rows) {
|
|
7248
|
-
lines.push(r.map((v) => formatCellValue(v, state.nullValue)).join(" "));
|
|
7249
|
-
}
|
|
7250
|
-
return `${lines.join("\n")}
|
|
7251
|
-
`;
|
|
7252
|
-
}
|
|
7253
|
-
case "ascii": {
|
|
7254
|
-
if (!state.showHeaders && rows.length === 0) {
|
|
7255
|
-
return "";
|
|
7256
|
-
}
|
|
7257
|
-
const cSep = "";
|
|
7258
|
-
const rSep = "";
|
|
7259
|
-
let out = "";
|
|
7260
|
-
if (state.showHeaders) {
|
|
7261
|
-
out += columns.join(cSep) + rSep;
|
|
7262
|
-
}
|
|
7263
|
-
for (const r of rows) {
|
|
7264
|
-
out += r.map((v) => formatCellValue(v, state.nullValue)).join(cSep) + rSep;
|
|
7265
|
-
}
|
|
7266
|
-
return out;
|
|
7267
|
-
}
|
|
7268
7182
|
case "csv": {
|
|
7269
7183
|
if (!state.showHeaders && rows.length === 0) {
|
|
7270
7184
|
return "";
|
|
7271
7185
|
}
|
|
7272
|
-
const sep = state.colSeparator
|
|
7186
|
+
const sep = state.colSeparator;
|
|
7273
7187
|
const lines = [];
|
|
7274
7188
|
if (state.showHeaders) {
|
|
7275
7189
|
lines.push(columns.map((c) => formatCsvCell(c, sep)).join(sep));
|
|
@@ -7518,6 +7432,26 @@ function splitDotCommandArgs(line) {
|
|
|
7518
7432
|
}
|
|
7519
7433
|
return args;
|
|
7520
7434
|
}
|
|
7435
|
+
function isMutatingStatement(sql) {
|
|
7436
|
+
const tokens = tokenizeSql(sql);
|
|
7437
|
+
let depth = 0;
|
|
7438
|
+
for (const token of tokens) {
|
|
7439
|
+
if (token.type === "punct" && token.value === "(") {
|
|
7440
|
+
depth++;
|
|
7441
|
+
continue;
|
|
7442
|
+
}
|
|
7443
|
+
if (token.type === "punct" && token.value === ")") {
|
|
7444
|
+
depth--;
|
|
7445
|
+
continue;
|
|
7446
|
+
}
|
|
7447
|
+
if (depth !== 0 || token.type !== "word") continue;
|
|
7448
|
+
const word = token.value.toUpperCase();
|
|
7449
|
+
if (["CREATE", "DROP", "ALTER", "INSERT", "REPLACE", "UPDATE", "DELETE", "VACUUM", "REINDEX", "ANALYZE"].includes(word)) return true;
|
|
7450
|
+
if (word === "PRAGMA") return tokens.some((item) => item.value === "=" || item.value === "(");
|
|
7451
|
+
if (["SELECT", "VALUES", "EXPLAIN"].includes(word)) return false;
|
|
7452
|
+
}
|
|
7453
|
+
return false;
|
|
7454
|
+
}
|
|
7521
7455
|
var settings = {
|
|
7522
7456
|
commandName: "sqlite3",
|
|
7523
7457
|
limits: {
|
|
@@ -7662,10 +7596,13 @@ Options:
|
|
|
7662
7596
|
state.mode = "quote";
|
|
7663
7597
|
} else if (arg === "-tabs" || arg === "--tabs") {
|
|
7664
7598
|
state.mode = "tabs";
|
|
7599
|
+
state.colSeparator = " ";
|
|
7665
7600
|
} else if (arg === "-html" || arg === "--html") {
|
|
7666
7601
|
state.mode = "html";
|
|
7667
7602
|
} else if (arg === "-ascii" || arg === "--ascii") {
|
|
7668
7603
|
state.mode = "ascii";
|
|
7604
|
+
state.colSeparator = "";
|
|
7605
|
+
state.rowSeparator = "";
|
|
7669
7606
|
} else if (arg === "-header" || arg === "--header") {
|
|
7670
7607
|
state.showHeaders = true;
|
|
7671
7608
|
} else if (arg === "-noheader" || arg === "--noheader") {
|
|
@@ -7691,7 +7628,7 @@ Options:
|
|
|
7691
7628
|
} else if (arg === "-init" || arg === "--init") {
|
|
7692
7629
|
initFile = args[i + 1] ?? null;
|
|
7693
7630
|
i += 1;
|
|
7694
|
-
} else if (arg.startsWith("-")) {
|
|
7631
|
+
} else if (arg.startsWith("-") && positional.length === 0) {
|
|
7695
7632
|
await writeText(context.stderr, `sqlite3: Error: unknown option: ${arg}
|
|
7696
7633
|
`);
|
|
7697
7634
|
return { exitCode: 1 };
|
|
@@ -7864,37 +7801,7 @@ Options:
|
|
|
7864
7801
|
return;
|
|
7865
7802
|
}
|
|
7866
7803
|
if (cmd === ".mode") {
|
|
7867
|
-
|
|
7868
|
-
if ([
|
|
7869
|
-
"list",
|
|
7870
|
-
"csv",
|
|
7871
|
-
"column",
|
|
7872
|
-
"line",
|
|
7873
|
-
"json",
|
|
7874
|
-
"tabs",
|
|
7875
|
-
"html",
|
|
7876
|
-
"markdown",
|
|
7877
|
-
"box",
|
|
7878
|
-
"table",
|
|
7879
|
-
"quote",
|
|
7880
|
-
"ascii",
|
|
7881
|
-
"insert"
|
|
7882
|
-
].includes(newMode)) {
|
|
7883
|
-
state.mode = newMode;
|
|
7884
|
-
if (newMode === "list") {
|
|
7885
|
-
state.colSeparator = "|";
|
|
7886
|
-
state.rowSeparator = "\n";
|
|
7887
|
-
} else if (newMode === "csv") {
|
|
7888
|
-
state.colSeparator = ",";
|
|
7889
|
-
state.rowSeparator = "\r\n";
|
|
7890
|
-
} else if (newMode === "tabs") {
|
|
7891
|
-
state.colSeparator = " ";
|
|
7892
|
-
} else if (newMode === "insert" && parts[2]) {
|
|
7893
|
-
state.insertTable = parts[2];
|
|
7894
|
-
} else if (["table", "box", "markdown"].includes(newMode) && parts[2] === void 0) {
|
|
7895
|
-
state.showHeaders = true;
|
|
7896
|
-
}
|
|
7897
|
-
}
|
|
7804
|
+
setOutputMode(state, (parts[1] ?? "list").toLowerCase(), parts[2]);
|
|
7898
7805
|
return;
|
|
7899
7806
|
}
|
|
7900
7807
|
if (cmd === ".headers" || cmd === ".header") {
|
|
@@ -7975,9 +7882,7 @@ Options:
|
|
|
7975
7882
|
const res = await execSingleStmt("SELECT name FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' ORDER BY name;");
|
|
7976
7883
|
names = (res?.rows ?? []).map((r) => String(r[0] ?? ""));
|
|
7977
7884
|
}
|
|
7978
|
-
const filtered = pattern ? names.filter(
|
|
7979
|
-
(n) => pattern.includes("%") || pattern.includes("_") ? new RegExp(`^${pattern.replace(/%/g, ".*").replace(/_/g, ".")}$`, "i").test(n) : matchGlob(n.toLowerCase(), pattern.toLowerCase()) || n.toLowerCase().includes(pattern.toLowerCase())
|
|
7980
|
-
) : names;
|
|
7885
|
+
const filtered = pattern ? names.filter((n) => matchLike(n, pattern, true)) : names;
|
|
7981
7886
|
if (filtered.length > 0) {
|
|
7982
7887
|
const maxLen = Math.max(...filtered.map((s) => s.length));
|
|
7983
7888
|
const nCol = Math.max(1, Math.floor(79 / (maxLen + 2)));
|
|
@@ -8123,6 +8028,7 @@ Options:
|
|
|
8123
8028
|
return;
|
|
8124
8029
|
}
|
|
8125
8030
|
if (cmd === ".import") {
|
|
8031
|
+
if (state.readonly) throw new Error("attempt to write a readonly database");
|
|
8126
8032
|
let pIdx = 1;
|
|
8127
8033
|
let csvOverride = false;
|
|
8128
8034
|
let skipRows = 0;
|
|
@@ -8142,7 +8048,7 @@ Options:
|
|
|
8142
8048
|
const tableArg = parts[pIdx + 1] ?? "";
|
|
8143
8049
|
const filePath = resolveVfsPath(context.cwd, fileArg);
|
|
8144
8050
|
const content = textDecoder3.decode(await readInputFile(filePath));
|
|
8145
|
-
const sep = csvOverride
|
|
8051
|
+
const sep = csvOverride ? "," : state.colSeparator;
|
|
8146
8052
|
const parsedRows = parseCsvContent(content, sep).slice(skipRows);
|
|
8147
8053
|
if (parsedRows.length === 0) {
|
|
8148
8054
|
return;
|
|
@@ -8219,6 +8125,7 @@ Options:
|
|
|
8219
8125
|
return;
|
|
8220
8126
|
}
|
|
8221
8127
|
if (cmd === ".restore") {
|
|
8128
|
+
if (state.readonly) throw new Error("attempt to write a readonly database");
|
|
8222
8129
|
const srcArg = parts.length >= 3 ? parts[2] : parts[1];
|
|
8223
8130
|
const srcPath = resolveVfsPath(context.cwd, srcArg);
|
|
8224
8131
|
db.tables?.clear();
|
|
@@ -8266,8 +8173,7 @@ Options:
|
|
|
8266
8173
|
await emitOutput(`${stmt}
|
|
8267
8174
|
`);
|
|
8268
8175
|
}
|
|
8269
|
-
const
|
|
8270
|
-
const isMutating = upper.startsWith("CREATE") || upper.startsWith("DROP") || upper.startsWith("ALTER") || upper.startsWith("INSERT") || upper.startsWith("REPLACE") || upper.startsWith("UPDATE") || upper.startsWith("DELETE") || upper.startsWith("VACUUM") || upper.startsWith("PRAGMA") && stmt.includes("=");
|
|
8176
|
+
const isMutating = isMutatingStatement(stmt);
|
|
8271
8177
|
if (state.readonly && isMutating) {
|
|
8272
8178
|
throw new Error("attempt to write a readonly database");
|
|
8273
8179
|
}
|
|
@@ -8512,10 +8418,13 @@ Options:
|
|
|
8512
8418
|
state.mode = "quote";
|
|
8513
8419
|
} else if (arg === "-tabs" || arg === "--tabs") {
|
|
8514
8420
|
state.mode = "tabs";
|
|
8421
|
+
state.colSeparator = " ";
|
|
8515
8422
|
} else if (arg === "-html" || arg === "--html") {
|
|
8516
8423
|
state.mode = "html";
|
|
8517
8424
|
} else if (arg === "-ascii" || arg === "--ascii") {
|
|
8518
8425
|
state.mode = "ascii";
|
|
8426
|
+
state.colSeparator = "";
|
|
8427
|
+
state.rowSeparator = "";
|
|
8519
8428
|
} else if (arg === "-header" || arg === "--header") {
|
|
8520
8429
|
state.showHeaders = true;
|
|
8521
8430
|
} else if (arg === "-noheader" || arg === "--noheader") {
|
|
@@ -8541,7 +8450,7 @@ Options:
|
|
|
8541
8450
|
} else if (arg === "-init" || arg === "--init") {
|
|
8542
8451
|
initFile = opArgs[i + 1] ?? null;
|
|
8543
8452
|
i += 1;
|
|
8544
|
-
} else if (arg.startsWith("-")) {
|
|
8453
|
+
} else if (arg.startsWith("-") && positional.length === 0) {
|
|
8545
8454
|
return void 0;
|
|
8546
8455
|
} else {
|
|
8547
8456
|
positional.push(arg);
|
|
@@ -8582,15 +8491,7 @@ Options:
|
|
|
8582
8491
|
return state.exitCode === 0;
|
|
8583
8492
|
}
|
|
8584
8493
|
if (cmd === ".mode") {
|
|
8585
|
-
|
|
8586
|
-
if (["list", "csv", "column", "line", "json", "tabs", "html", "markdown", "box", "table", "quote", "ascii", "insert"].includes(newMode)) {
|
|
8587
|
-
state.mode = newMode;
|
|
8588
|
-
if (newMode === "list") state.colSeparator = "|";
|
|
8589
|
-
else if (newMode === "csv") state.colSeparator = ",";
|
|
8590
|
-
else if (newMode === "tabs") state.colSeparator = " ";
|
|
8591
|
-
else if (newMode === "insert" && parts[2]) state.insertTable = parts[2];
|
|
8592
|
-
else if (["table", "box", "markdown"].includes(newMode) && parts[2] === void 0) state.showHeaders = true;
|
|
8593
|
-
}
|
|
8494
|
+
setOutputMode(state, (parts[1] ?? "list").toLowerCase(), parts[2]);
|
|
8594
8495
|
return true;
|
|
8595
8496
|
}
|
|
8596
8497
|
if (cmd === ".headers" || cmd === ".header") {
|
|
@@ -8648,9 +8549,7 @@ Options:
|
|
|
8648
8549
|
if (cmd === ".tables") {
|
|
8649
8550
|
const pattern = parts[1];
|
|
8650
8551
|
const names = [...db.tables.keys(), ...db.views.keys()].filter((n) => !n.toLowerCase().startsWith("sqlite_")).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
8651
|
-
const filtered = pattern ? names.filter(
|
|
8652
|
-
(n) => pattern.includes("%") || pattern.includes("_") ? new RegExp(`^${pattern.replace(/%/g, ".*").replace(/_/g, ".")}$`, "i").test(n) : matchGlob(n.toLowerCase(), pattern.toLowerCase()) || n.toLowerCase().includes(pattern.toLowerCase())
|
|
8653
|
-
) : names;
|
|
8552
|
+
const filtered = pattern ? names.filter((n) => matchLike(n, pattern, true)) : names;
|
|
8654
8553
|
if (filtered.length > 0) {
|
|
8655
8554
|
const maxLen = Math.max(...filtered.map((s) => s.length));
|
|
8656
8555
|
const nCol = Math.max(1, Math.floor(79 / (maxLen + 2)));
|
|
@@ -8767,7 +8666,7 @@ Options:
|
|
|
8767
8666
|
const fileBytes = readFileSync(fileArg);
|
|
8768
8667
|
if (!fileBytes || fileBytes.byteLength > 65536) return false;
|
|
8769
8668
|
const content = textDecoder3.decode(fileBytes);
|
|
8770
|
-
const sep = csvOverride
|
|
8669
|
+
const sep = csvOverride ? "," : state.colSeparator;
|
|
8771
8670
|
const parsedRows = parseCsvContent(content, sep).slice(skipRows);
|
|
8772
8671
|
if (parsedRows.length === 0) return true;
|
|
8773
8672
|
let tbl = db.findTable(tableArg);
|
|
@@ -8794,7 +8693,7 @@ Options:
|
|
|
8794
8693
|
const runSqlStatementSync = (stmt) => {
|
|
8795
8694
|
const trimmed = stmt.trim();
|
|
8796
8695
|
if (!trimmed) return true;
|
|
8797
|
-
const isMutating =
|
|
8696
|
+
const isMutating = isMutatingStatement(trimmed);
|
|
8798
8697
|
if (isMutating) {
|
|
8799
8698
|
if (state.readonly || state.dbPath !== ":memory:" && !writeFileSync) return false;
|
|
8800
8699
|
}
|