@poe-platform/safe-bash 0.1.800 → 0.1.802
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 +16 -5
- package/dist/image-ast/index.browser.js +122 -76
- package/dist/image-ast/index.js +122 -76
- package/dist/pdf-ast/index.js +4 -3
- package/dist/safe-bash/chunks/chunk-3HQU4OJO.js +13 -0
- package/dist/safe-bash/chunks/{chunk-LUOFIVNI.js → chunk-3NDIFSNM.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-4SEW2Q6H.js → chunk-3R3AANOR.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-K4YMYFRJ.js → chunk-44ALJ4QG.js} +5809 -7424
- package/dist/safe-bash/chunks/{chunk-KHMGTPD6.js → chunk-46Z5E5EV.js} +2 -2
- package/dist/safe-bash/chunks/chunk-4BSJLKNM.js +14 -0
- package/dist/safe-bash/chunks/chunk-4D4N7IU2.js +47 -0
- package/dist/safe-bash/chunks/chunk-55YJASTN.js +14 -0
- 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-7ZBU7KYV.js +14 -0
- 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-QVSRRNZT.js → chunk-BJA5XNP6.js} +6 -6
- 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-BHJE5LPZ.js → chunk-D3ANYGMC.js} +1 -1
- package/dist/safe-bash/chunks/chunk-DQP3VHSB.js +15 -0
- package/dist/safe-bash/chunks/{chunk-NLAW7KDI.js → chunk-E7OYNDGL.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-SOZK5JVX.js → chunk-FBUCWVTE.js} +1 -1
- package/dist/safe-bash/chunks/chunk-FZE4HW6G.js +11 -0
- package/dist/safe-bash/chunks/chunk-GEG3BWGE.js +14 -0
- package/dist/safe-bash/chunks/{chunk-HHW7MGS2.js → chunk-GETUOD5D.js} +4 -4
- package/dist/safe-bash/chunks/chunk-HBCN24ZA.js +50 -0
- package/dist/safe-bash/chunks/chunk-HZ7BWKQ3.js +13 -0
- package/dist/safe-bash/chunks/{chunk-JJSTTIEZ.js → chunk-HZAMGT5I.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-KCVSVD65.js → chunk-I5HZ4FGE.js} +1 -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-K2VCOJ2B.js → chunk-K6VCD7IY.js} +7 -12
- package/dist/safe-bash/chunks/chunk-KDNSPLII.js +83 -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-KW24TAIU.js → chunk-NQCM3TYR.js} +922 -658
- package/dist/safe-bash/chunks/{chunk-VYZTG3GV.js → chunk-NZQXYWA3.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-TFGRKY43.js → chunk-OQRVVGR6.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-PPYM75Z3.js → chunk-OV6IHKO6.js} +2 -2
- package/dist/safe-bash/chunks/{chunk-TYD7EVUJ.js → chunk-PH63PLPZ.js} +8 -8
- package/dist/safe-bash/chunks/chunk-QGUV42T5.js +44 -0
- package/dist/safe-bash/chunks/chunk-R3NAKOED.js +51 -0
- package/dist/safe-bash/chunks/chunk-RRR7AQ24.js +38 -0
- package/dist/safe-bash/chunks/{chunk-RKKRJ54E.js → chunk-RSTHLAF3.js} +30 -23
- package/dist/safe-bash/chunks/{chunk-RMWLWH7Q.js → chunk-SHEMU2Z7.js} +378 -1148
- package/dist/safe-bash/chunks/{chunk-7YSRXFEG.js → chunk-TFIBK2GI.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-I7L3G3NX.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-6HZYFL3H.js → chunk-VKNVHEX3.js} +2 -7
- package/dist/safe-bash/chunks/chunk-VSAJ4OTM.js +962 -0
- package/dist/safe-bash/chunks/{chunk-46UISJCK.js → chunk-VTH3MLDU.js} +1 -1
- package/dist/safe-bash/chunks/{chunk-JTLSUJ7V.js → chunk-WDLGKIHD.js} +56 -39
- package/dist/safe-bash/chunks/chunk-XAQMU6OY.js +14 -0
- package/dist/safe-bash/chunks/{chunk-LLZCZ24K.js → chunk-XVOSKJE2.js} +1 -1
- package/dist/safe-bash/chunks/chunk-ZVD5IS4V.js +49 -0
- package/dist/safe-bash/chunks/{csvkit-QGP3GAOB.js → csvkit-TACDU7FC.js} +3 -3
- package/dist/safe-bash/chunks/{ffmpeg-JTVH26MK.js → ffmpeg-WTC3TEFI.js} +2 -2
- package/dist/safe-bash/chunks/{gh-I7QX7N5C.js → gh-6WU6PXL4.js} +2 -2
- package/dist/safe-bash/chunks/{git-MA7NKYVP.js → git-EFZIGJW4.js} +2 -2
- package/dist/safe-bash/chunks/{imagemagick-Y4NPWX2Q.js → imagemagick-EIEYGWPF.js} +2 -2
- package/dist/safe-bash/chunks/{implementation-BWDKOVQJ.js → implementation-MLFHUQ5M.js} +2 -2
- package/dist/safe-bash/chunks/{mmdc-44PELHDG.js → mmdc-ROQJT5HQ.js} +2 -2
- package/dist/safe-bash/chunks/{pdfimages-635TRW4Q.js → pdfimages-DW7LWXFI.js} +2 -2
- package/dist/safe-bash/chunks/{pdfinfo-FSDAA2KY.js → pdfinfo-TIP6XLUQ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftk-GQ5UH3VG.js → pdftk-DMG22ITZ.js} +2 -2
- package/dist/safe-bash/chunks/{pdftoppm-YTXQCAYT.js → pdftoppm-WNDYR72T.js} +2 -2
- package/dist/safe-bash/chunks/{pdftotext-CVA2G7FY.js → pdftotext-5IPZ4NI7.js} +2 -2
- package/dist/safe-bash/chunks/{qpdf-HZMIFG4A.js → qpdf-TTX2DIUA.js} +2 -2
- package/dist/safe-bash/chunks/{sips-E7UBDP33.js → sips-XYS46JPJ.js} +2 -2
- package/dist/safe-bash/chunks/{soffice-ELASUWUK.js → soffice-TU73E5KL.js} +2 -2
- package/dist/safe-bash/chunks/{wkhtmltopdf-EPO6YCMG.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-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-5LSGEIZY.js → chunk-3HHCU5YU.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-TF6OA2GK.js → chunk-3NV3HYT2.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-2QHG43WJ.js → chunk-4BB2SWJ5.js} +1 -1
- 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-YMONDXET.js → chunk-4ZQWGOZB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-L6DVEBW3.js → chunk-5BSTFCXG.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-Q3DII3Q7.js → chunk-5PWJG2UK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-JMPP4TCW.js → chunk-5UBXNSFZ.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-3NG75MOB.js → chunk-67GQA75T.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-L6SU4S26.js → chunk-6B7WQIKB.js} +0 -7
- package/dist/safe-bash/command-chunks/{chunk-V6MSPQLA.js → chunk-6BNTBWIK.js} +4 -39
- package/dist/safe-bash/command-chunks/{chunk-SAMH7SQE.js → chunk-6GWJUQAV.js} +237 -145
- package/dist/safe-bash/command-chunks/{chunk-JN7WIP6S.js → chunk-6KJ3LPI2.js} +2 -2
- 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-MRW5HD2D.js → chunk-7O3E4LPT.js} +4 -22
- package/dist/safe-bash/command-chunks/{chunk-TEVJJPTC.js → chunk-7U7EXOXX.js} +1 -1
- 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/{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-CKXV2CLD.js → chunk-ARBYOQUZ.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-44AHAB5O.js → chunk-BDSMROQZ.js} +1 -4
- package/dist/safe-bash/command-chunks/{chunk-53P53XFM.js → chunk-BPE5INLI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-OT4LZMLB.js → chunk-BR73BIOW.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WB5SVIG7.js → chunk-C5YYCQHW.js} +498 -88
- package/dist/safe-bash/command-chunks/{chunk-EUSPTFAX.js → chunk-CAP7ZJSY.js} +7 -7
- package/dist/safe-bash/command-chunks/{chunk-DWFLVJC6.js → chunk-CCRHMAU5.js} +2 -1
- package/dist/safe-bash/command-chunks/{chunk-GI4CJED2.js → chunk-CQTRW45K.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-KKG4BAFZ.js → chunk-DIEPXUM4.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-QJAFJP2G.js → chunk-DZCY63VJ.js} +12 -10
- package/dist/safe-bash/command-chunks/{chunk-QUENU6GM.js → chunk-E55UKBIE.js} +3 -3
- 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-E2LB7FRT.js → chunk-FXOA7RBK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QWIDNAAK.js → chunk-FZTK4MFI.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-K543PB3I.js → chunk-G66QUHIZ.js} +6 -35
- package/dist/safe-bash/command-chunks/{chunk-YJDV76GL.js → chunk-GFQZCKO6.js} +29 -19
- package/dist/safe-bash/command-chunks/{chunk-FKKB5X5V.js → chunk-GOB777HR.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-IYPAQ7PH.js → chunk-GRBWW4SG.js} +6 -0
- package/dist/safe-bash/command-chunks/{chunk-EFANWIHL.js → chunk-GY3BWK7K.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-PPNBNFAU.js → chunk-GYQ2HAKQ.js} +8 -8
- package/dist/safe-bash/command-chunks/{chunk-PJJUYO3R.js → chunk-II77KPZN.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-VL67NWNS.js → chunk-JDYXY44P.js} +2 -2
- 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-BKCNF5U3.js → chunk-KQLD3AED.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-UMDIOL3O.js → chunk-KXU3IRUO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QZF3SINC.js → chunk-LAOM65EE.js} +2 -2
- 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-U6G67N23.js → chunk-MIXBO6U7.js} +18 -5
- package/dist/safe-bash/command-chunks/{chunk-JQ74HC37.js → chunk-MQFIPHIQ.js} +23 -50
- 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-RVLO4DYT.js → chunk-N4PFUSRM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-WBNZ4PRE.js → chunk-NGG2XL56.js} +7 -4
- package/dist/safe-bash/command-chunks/{chunk-D4OP2BR3.js → chunk-NKFYQSES.js} +1 -2
- package/dist/safe-bash/command-chunks/{chunk-NGWB2YBL.js → chunk-O4JQSB7O.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-GLOZX57Y.js → chunk-OQKC5ZU2.js} +23 -114
- package/dist/safe-bash/command-chunks/{chunk-7L24L4UO.js → chunk-OQU6UT6X.js} +2 -20
- package/dist/safe-bash/command-chunks/{chunk-TYCGMRLM.js → chunk-OYYV7ZAF.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-SVULUDOP.js → chunk-P2N33UMN.js} +20 -81
- package/dist/safe-bash/command-chunks/{chunk-Q7Q5GM5S.js → chunk-P5APDEFB.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-3HXDA5PT.js → chunk-PMBFZXTK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-4Y3WVMK4.js → chunk-PV66YWHB.js} +1 -0
- package/dist/safe-bash/command-chunks/{chunk-AXK3H4PX.js → chunk-QJ33BHI4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-3LSOYLNV.js → chunk-QKFSRZGQ.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-JZSNU2MY.js → chunk-QKJLP53H.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-LC2MFKT4.js → chunk-RMWQAAO5.js} +24 -25
- package/dist/safe-bash/command-chunks/{chunk-QDTBMSBE.js → chunk-RO62EWX6.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-4C6QI5BQ.js → chunk-RZZI24ZE.js} +4 -4
- package/dist/safe-bash/command-chunks/{chunk-PFAADCB5.js → chunk-SDNBCQ3X.js} +10 -24
- package/dist/safe-bash/command-chunks/{chunk-36O5OT7E.js → chunk-T35Y7YQD.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-6HMX4CQS.js → chunk-TGSNCQSR.js} +44 -16
- package/dist/safe-bash/command-chunks/{chunk-5T7CRJHW.js → chunk-TIOCQVUQ.js} +4 -7
- package/dist/safe-bash/command-chunks/{chunk-GN2TKLE7.js → chunk-TS65BJHG.js} +5 -5
- package/dist/safe-bash/command-chunks/{chunk-7RGB363W.js → chunk-TSCGT46G.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-KBEURXFF.js → chunk-UN6WS55J.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-SX2X3IH4.js → chunk-V2V5OCL3.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-ERYJLO6G.js → chunk-V7A7DRTU.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-5SHGJ7NO.js → chunk-VA5ZHYYA.js} +73 -33
- package/dist/safe-bash/command-chunks/{chunk-XETLEHZP.js → chunk-VPR5LQYX.js} +3 -2
- package/dist/safe-bash/command-chunks/{chunk-3DT2YOGW.js → chunk-VSRGNQCP.js} +3 -3
- package/dist/safe-bash/command-chunks/{chunk-N2F74VRO.js → chunk-VT6MJBEI.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-J5SN3PZ3.js → chunk-VXSLJH7G.js} +53 -3
- package/dist/safe-bash/command-chunks/{chunk-PXYOWWMV.js → chunk-W7RAD4EW.js} +4 -3
- package/dist/safe-bash/command-chunks/{chunk-YGC6OS5O.js → chunk-WECIOOQB.js} +5 -8
- 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-Z7RVSD5K.js → chunk-WVHONVZ4.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-HLGKIZ25.js → chunk-X54L3DBL.js} +6 -9
- package/dist/safe-bash/command-chunks/{chunk-QNIMV57G.js → chunk-XNLFHHOC.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-XAFSZDY2.js → chunk-XS72HTMA.js} +11 -0
- package/dist/safe-bash/command-chunks/{chunk-KYSPGS33.js → chunk-YIQACGEW.js} +2 -0
- package/dist/safe-bash/command-chunks/{chunk-NAY27PXB.js → chunk-YOFC45RK.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-T5H5UJQ3.js → chunk-YVNGTIJO.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-QI7LGHJJ.js → chunk-Z45N42QC.js} +21 -6
- package/dist/safe-bash/command-chunks/{chunk-67IQF5GC.js → chunk-ZYHTWNAE.js} +23 -9
- package/dist/safe-bash/command-chunks/{chunk-STC3LEWJ.js → chunk-ZYXH3B66.js} +5 -3
- package/dist/safe-bash/commands/apply-patch/index.browser.js +14 -0
- package/dist/safe-bash/commands/archive/index.browser.js +36 -0
- package/dist/safe-bash/commands/bytes/compression/index.js +3 -2
- package/dist/safe-bash/commands/column/index.browser.js +12 -0
- 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/docx/index.browser.js +1 -1
- package/dist/safe-bash/commands/du/index.browser.js +14 -0
- package/dist/safe-bash/commands/execution.js +19 -13
- package/dist/safe-bash/commands/expr/index.browser.js +12 -0
- package/dist/safe-bash/commands/factor/index.browser.js +2 -2
- package/dist/safe-bash/commands/file/index.browser.js +14 -0
- package/dist/safe-bash/commands/filesystem.d.ts +1 -1
- package/dist/safe-bash/commands/filesystem.js +26 -15
- package/dist/safe-bash/commands/getopt/index.browser.js +2 -2
- package/dist/safe-bash/commands/grep-aliases/index.browser.js +14 -0
- package/dist/safe-bash/commands/hexdump/index.browser.js +2 -2
- package/dist/safe-bash/commands/html-to-markdown/index.browser.js +16 -0
- 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/llm/index.browser.js +2 -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/index.browser.js +21 -0
- package/dist/safe-bash/commands/network/curl.d.ts +1 -1
- package/dist/safe-bash/commands/network/curl.js +1 -3
- package/dist/safe-bash/commands/network/index.browser.js +4 -4
- 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/public.d.ts +2 -2
- package/dist/safe-bash/commands/network/public.js +2 -2
- package/dist/safe-bash/commands/network/transport.js +2 -2
- package/dist/safe-bash/commands/network/wget.d.ts +1 -1
- package/dist/safe-bash/commands/network/wget.js +1 -3
- package/dist/safe-bash/commands/node/filesystem.js +3 -2
- package/dist/safe-bash/commands/node/index.browser.js +8 -8
- package/dist/safe-bash/commands/node/types.js +1 -1
- package/dist/safe-bash/commands/op/index.browser.js +3 -3
- package/dist/safe-bash/commands/pr/index.browser.js +2 -2
- 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/manifest.d.ts +1 -0
- package/dist/safe-bash/commands/python/manifest.js +6 -3
- 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/public.browser.js +8 -6
- package/dist/safe-bash/commands/safejs/runtime.js +16 -7
- package/dist/safe-bash/commands/split/index.browser.js +14 -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/stream-format/index.browser.js +11 -0
- package/dist/safe-bash/commands/stream-inspection/index.browser.js +11 -0
- package/dist/safe-bash/commands/streams.js +11 -29
- package/dist/safe-bash/commands/table-text/index.browser.js +11 -0
- package/dist/safe-bash/commands/text.js +269 -496
- package/dist/safe-bash/commands/time-env/index.browser.js +15 -0
- package/dist/safe-bash/commands/tree/index.browser.js +14 -0
- package/dist/safe-bash/commands/tsort/index.browser.js +2 -2
- package/dist/safe-bash/commands/xml/index.browser.js +2 -2
- package/dist/safe-bash/commands/yq/index.browser.js +2 -2
- package/dist/safe-bash/core.browser.js +1 -1
- package/dist/safe-bash/core.d.ts +6 -1
- package/dist/safe-bash/core.js +1 -1
- package/dist/safe-bash/full-core.browser.js +308 -295
- package/dist/safe-bash/jobs.browser.js +5 -5
- package/dist/safe-bash/opt-in/commands/dd/index.js +2 -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 -15
- 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 +41 -27
- package/dist/safe-bash/registry-entry.browser.js +42 -28
- package/dist/safe-bash/search.browser.js +48 -0
- package/dist/safe-bash/shell/arrays/bindings.js +1 -1
- 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/parser.js +8 -1
- package/dist/safe-bash/shell/runtime.d.ts +4 -13
- package/dist/safe-bash/shell/runtime.js +334 -1049
- package/dist/safe-bash/shell/shell.js +2 -54
- package/dist/safe-bash/shell-entry.browser.js +35 -26
- package/dist/safe-bash/trap.browser.js +4 -4
- 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 +3 -3
- 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/awk-inspection.js +2 -2
- package/dist/safe-bash-command-awk/awk-runtime.js +3 -3
- package/dist/safe-bash-command-awk/awk-syntax.d.ts +1 -1
- package/dist/safe-bash-command-awk/awk-syntax.js +2 -2
- package/dist/safe-bash-command-awk/awk-values.js +1 -1
- package/dist/safe-bash-command-awk/awk.js +5 -5
- package/dist/safe-bash-command-awk/index.js +5 -5
- package/dist/safe-bash-command-bc/index.d.ts +2 -0
- package/dist/safe-bash-command-bc/index.js +123 -92
- 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-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/index.js +9 -9
- package/dist/safe-bash-command-csvkit/sync-support.js +1 -1
- package/dist/safe-bash-command-curl/curl.js +1 -1
- package/dist/safe-bash-command-curl/index.js +1 -1
- package/dist/safe-bash-command-dd/index.js +2 -0
- package/dist/safe-bash-command-diff/diff.js +1 -1
- package/dist/safe-bash-command-diff/index.js +1 -1
- package/dist/safe-bash-command-exiftool/index.d.ts +1 -0
- package/dist/safe-bash-command-fd/index.js +9 -9
- package/dist/safe-bash-command-ffmpeg/index.js +31 -8
- package/dist/safe-bash-command-file/index.js +1 -1
- package/dist/safe-bash-command-file/shared.js +1 -1
- package/dist/safe-bash-command-find/find.js +1 -1
- package/dist/safe-bash-command-find/index.js +1 -1
- package/dist/safe-bash-command-gzip/index.js +3 -2
- 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 +6 -6
- 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 +27 -9
- 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 +24 -6
- 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-mmdc/index.d.ts +1 -0
- package/dist/safe-bash-command-nl/index.js +1 -1
- package/dist/safe-bash-command-nl/nl.js +1 -1
- 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 +1 -1
- package/dist/safe-bash-command-pandoc/index.js +1 -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-pathchk/index.js +3 -13
- package/dist/safe-bash-command-pdfimages/index.js +27 -11
- package/dist/safe-bash-command-pdfinfo/index.js +19 -10
- package/dist/safe-bash-command-pdftk/index.js +3 -3
- package/dist/safe-bash-command-pdftoppm/index.js +26 -10
- package/dist/safe-bash-command-pdftotext/index.js +27 -13
- package/dist/safe-bash-command-qpdf/index.js +5 -5
- package/dist/safe-bash-command-rg/index.js +1 -1
- package/dist/safe-bash-command-rg/rg-command.d.ts +0 -1
- package/dist/safe-bash-command-rg/rg-command.js +3 -5
- package/dist/safe-bash-command-sed/index.js +1 -1
- package/dist/safe-bash-command-sed/sed.js +1 -1
- 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-soffice/index.js +20 -16
- 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 +6 -0
- package/dist/safe-bash-command-sqlite3/index.js +284 -85
- 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 +8 -8
- 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 +8 -8
- package/dist/safe-bash-command-ssconvert/index.js +20 -20
- package/dist/safe-bash-command-tar/extract.js +1 -1
- package/dist/safe-bash-command-tar/index.js +5 -4
- package/dist/safe-bash-command-tar/modes.js +2 -2
- 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-unexpand/index.js +1 -1
- package/dist/safe-bash-command-unexpand/unexpand.js +1 -1
- package/dist/safe-bash-command-unrtf/index.js +14 -7
- package/dist/safe-bash-command-unzip/index.js +1 -1
- package/dist/safe-bash-command-unzip/unzip.js +1 -1
- package/dist/safe-bash-command-wget/index.js +1 -1
- package/dist/safe-bash-command-wget/wget.js +1 -1
- package/dist/safe-bash-command-xan/argv.d.ts +1 -1
- package/dist/safe-bash-command-xan/argv.js +1 -1
- package/dist/safe-bash-command-xan/commands.js +5 -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 +7 -7
- package/dist/safe-bash-command-xan/io.js +3 -3
- package/dist/safe-bash-command-xmllint/index.js +1 -1
- 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 +8 -0
- package/dist/safe-bash-command-yq/query.js +1 -1
- package/dist/safe-bash-command-zip/index.js +1 -1
- package/dist/safe-bash-command-zip/zip.js +1 -1
- package/dist/safe-bash-contracts/escaping.js +3 -3
- package/dist/safe-bash-contracts/filesystem-output.js +2 -2
- package/dist/safe-bash-contracts/index.d.ts +1 -0
- package/dist/safe-bash-contracts/index.js +7 -3
- package/dist/safe-bash-contracts/io.d.ts +4 -1
- package/dist/safe-bash-contracts/io.js +3 -1
- package/dist/safe-bash-contracts/managed-abort.d.ts +10 -0
- package/dist/safe-bash-contracts/output.js +2 -2
- package/dist/safe-bash-diff-engine/index.js +1 -1
- package/dist/safe-bash-diff-engine/shared.d.ts +3 -2
- package/dist/safe-bash-diff-engine/shared.js +1 -1
- package/dist/safe-bash-io-engine/commands/archive/internal.js +5 -23
- package/dist/safe-bash-io-engine/commands/search/requirements.js +2 -2
- package/dist/safe-bash-io-engine/commands/text-programs/shared.js +33 -44
- package/dist/safe-bash-io-engine/internal.js +1 -1
- package/dist/safe-bash-io-engine/shell/pattern.js +1 -1
- package/dist/safe-bash-io-engine/shell/string-operations.js +1 -1
- package/dist/safe-bash-mcp/index.browser.d.ts +155 -35
- package/dist/safe-bash-mcp/index.browser.js +416 -0
- package/dist/safe-bash-mcp/index.d.ts +54 -2
- package/dist/safe-bash-mcp/index.js +286 -90
- package/dist/safe-bash-network-engine/aggregate.js +2 -2
- package/dist/safe-bash-network-engine/args.js +4 -4
- package/dist/safe-bash-network-engine/authorizer.js +1 -1
- package/dist/safe-bash-network-engine/body.js +6 -6
- package/dist/safe-bash-network-engine/decode.d.ts +1 -1
- package/dist/safe-bash-network-engine/decode.js +3 -4
- package/dist/safe-bash-network-engine/fetch-transport.js +3 -3
- package/dist/safe-bash-network-engine/form-content-type.js +2 -2
- package/dist/safe-bash-network-engine/form-headers.js +2 -2
- package/dist/safe-bash-network-engine/glob.js +1 -1
- package/dist/safe-bash-network-engine/index.js +4 -4
- package/dist/safe-bash-network-engine/input.js +6 -6
- package/dist/safe-bash-network-engine/output.js +2 -2
- package/dist/safe-bash-network-engine/platform-portable.js +3 -3
- package/dist/safe-bash-network-engine/shared.js +2 -2
- package/dist/safe-bash-network-engine/types.d.ts +7 -2
- package/dist/safe-bash-network-engine/types.js +1 -1
- package/dist/safe-bash-network-engine/url.js +2 -2
- package/dist/safe-bash-query-engine/capture.js +3 -3
- package/dist/safe-bash-query-engine/delpaths.js +3 -3
- package/dist/safe-bash-query-engine/formats.js +2 -2
- package/dist/safe-bash-query-engine/index.js +11 -11
- package/dist/safe-bash-query-engine/indices.js +3 -3
- package/dist/safe-bash-query-engine/input.js +1 -1
- package/dist/safe-bash-query-engine/interpreter.js +9 -9
- package/dist/safe-bash-query-engine/parser.js +1 -1
- package/dist/safe-bash-query-engine/query-core.js +11 -11
- package/dist/safe-bash-query-engine/regex.js +4 -4
- package/dist/safe-bash-query-engine/splits.js +5 -5
- package/dist/safe-bash-query-engine/values.js +2 -2
- package/dist/safe-bash-regex-engine/ere/matcher.js +102 -30
- 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 -1
- package/dist/safe-bash-regex-engine/text/budget.js +1 -1
- package/dist/safe-bash-regex-engine/text/regex.d.ts +14 -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/grep.js +189 -227
- 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-playwright-cloudflare/browser-trace-budget.js +6 -2
- 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-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 +68 -12
- package/dist/safe-bash/command-chunks/chunk-KAGBORIC.js +0 -88
- /package/dist/safe-bash/command-chunks/{chunk-BWNXWI33.js → chunk-2LMZVE3I.js} +0 -0
|
@@ -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
|
}
|
|
@@ -2240,11 +2287,12 @@ var SqliteDatabase = class {
|
|
|
2240
2287
|
}
|
|
2241
2288
|
tbl.rows = [];
|
|
2242
2289
|
let maxRowid = 0;
|
|
2290
|
+
const storageColumns = tableStorageColumns(tbl);
|
|
2243
2291
|
for (const r of rawRows) {
|
|
2244
2292
|
yield;
|
|
2245
2293
|
const data = {};
|
|
2246
2294
|
let valIdx = 0;
|
|
2247
|
-
for (const col of
|
|
2295
|
+
for (const col of storageColumns) {
|
|
2248
2296
|
yield;
|
|
2249
2297
|
if (col.primaryKey && col.type.toUpperCase() === "INTEGER" && !tbl.withoutRowId && tbl.primaryKeyCols.length === 1) {
|
|
2250
2298
|
const cellVal = r.values[valIdx];
|
|
@@ -2313,7 +2361,8 @@ var SqliteDatabase = class {
|
|
|
2313
2361
|
name: tbl.name,
|
|
2314
2362
|
tbl_name: tbl.name,
|
|
2315
2363
|
rootpage: rootPageCounter++,
|
|
2316
|
-
sql: tbl.sql
|
|
2364
|
+
sql: tbl.sql,
|
|
2365
|
+
withoutRowId: tbl.withoutRowId
|
|
2317
2366
|
});
|
|
2318
2367
|
if (tbl.columns.some((c) => {
|
|
2319
2368
|
return c.autoIncrement;
|
|
@@ -2330,11 +2379,26 @@ var SqliteDatabase = class {
|
|
|
2330
2379
|
});
|
|
2331
2380
|
}
|
|
2332
2381
|
}
|
|
2333
|
-
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) {
|
|
2334
2398
|
yield;
|
|
2335
2399
|
return {
|
|
2336
2400
|
rowid: r.rowid,
|
|
2337
|
-
values:
|
|
2401
|
+
values: storageColumns.map((c) => {
|
|
2338
2402
|
const isRowidAlias = c.primaryKey && c.type.toUpperCase() === "INTEGER" && !tbl.withoutRowId && tbl.primaryKeyCols.length === 1;
|
|
2339
2403
|
return isRowidAlias ? null : r.data[c.name] ?? null;
|
|
2340
2404
|
})
|
|
@@ -2805,6 +2869,7 @@ var SqliteDatabase = class {
|
|
|
2805
2869
|
const strict = trailingTokens.includes("STRICT");
|
|
2806
2870
|
const columns = [];
|
|
2807
2871
|
const primaryKeyCols = [];
|
|
2872
|
+
const primaryKeyOrder = [];
|
|
2808
2873
|
const uniqueColSets = [];
|
|
2809
2874
|
for (const part of bodyParts) {
|
|
2810
2875
|
yield;
|
|
@@ -2822,11 +2887,19 @@ var SqliteDatabase = class {
|
|
|
2822
2887
|
pIdx += 1;
|
|
2823
2888
|
while (pIdx < part.length && part[pIdx]?.value !== ")") {
|
|
2824
2889
|
yield;
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2890
|
+
if (part[pIdx].value === ",") {
|
|
2891
|
+
pIdx++;
|
|
2892
|
+
continue;
|
|
2828
2893
|
}
|
|
2829
|
-
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++;
|
|
2830
2903
|
}
|
|
2831
2904
|
}
|
|
2832
2905
|
continue;
|
|
@@ -2857,6 +2930,8 @@ var SqliteDatabase = class {
|
|
|
2857
2930
|
columns.push(colDef);
|
|
2858
2931
|
if (colDef.primaryKey && !primaryKeyCols.includes(colDef.name)) {
|
|
2859
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 });
|
|
2860
2935
|
}
|
|
2861
2936
|
if (colDef.unique) {
|
|
2862
2937
|
uniqueColSets.push([colDef.name]);
|
|
@@ -2880,6 +2955,7 @@ var SqliteDatabase = class {
|
|
|
2880
2955
|
withoutRowId,
|
|
2881
2956
|
strict,
|
|
2882
2957
|
primaryKeyCols,
|
|
2958
|
+
primaryKeyOrder,
|
|
2883
2959
|
uniqueColSets
|
|
2884
2960
|
});
|
|
2885
2961
|
return;
|
|
@@ -2895,32 +2971,55 @@ var SqliteDatabase = class {
|
|
|
2895
2971
|
return i >= idx && t.value.toUpperCase() === "ON";
|
|
2896
2972
|
});
|
|
2897
2973
|
const tableName = tokens[onIdx + 1]?.value ?? "";
|
|
2974
|
+
const tbl = this.findTable(tableName);
|
|
2975
|
+
if (!tbl) throw new Error(`no such table: ${tableName}`);
|
|
2898
2976
|
const cols = [];
|
|
2977
|
+
const collations = [];
|
|
2899
2978
|
let p = onIdx + 2;
|
|
2900
|
-
if (tokens[p]?.value
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
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");
|
|
2910
2996
|
}
|
|
2911
|
-
this.indexes.set(objName, {
|
|
2912
|
-
name: objName,
|
|
2913
|
-
tableName,
|
|
2914
|
-
unique,
|
|
2915
|
-
columns: cols,
|
|
2916
|
-
sql
|
|
2917
|
-
});
|
|
2918
2997
|
if (unique) {
|
|
2919
|
-
const
|
|
2920
|
-
|
|
2921
|
-
|
|
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}`);
|
|
2922
3020
|
}
|
|
2923
3021
|
}
|
|
3022
|
+
this.indexes.set(objName, { name: objName, tableName: tbl.name, unique, columns: cols, collations, sql });
|
|
2924
3023
|
return;
|
|
2925
3024
|
}
|
|
2926
3025
|
if (kind === "VIEW") {
|
|
@@ -3389,21 +3488,25 @@ var SqliteDatabase = class {
|
|
|
3389
3488
|
}
|
|
3390
3489
|
return `X'${hex}'`;
|
|
3391
3490
|
}
|
|
3392
|
-
*checkConstraintsAndConflicts(tbl, candidate, excludeRowid) {
|
|
3491
|
+
*checkConstraintsAndConflicts(tbl, candidate, excludeRowid, replaceNotNull = false) {
|
|
3393
3492
|
for (const col of tbl.columns) {
|
|
3394
3493
|
yield;
|
|
3395
|
-
|
|
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
|
+
}
|
|
3396
3499
|
if (col.notNull && val === null) {
|
|
3397
3500
|
if (col.primaryKey && col.type.toUpperCase() === "INTEGER" && !tbl.withoutRowId) {
|
|
3398
3501
|
candidate.data[col.name] = candidate.rowid;
|
|
3399
3502
|
} else {
|
|
3400
|
-
throw new
|
|
3503
|
+
throw new SqliteConstraintError(`NOT NULL constraint failed: ${tbl.name}.${col.name}`);
|
|
3401
3504
|
}
|
|
3402
3505
|
}
|
|
3403
3506
|
if (col.checkExpr && val !== null) {
|
|
3404
3507
|
const ok = yield* this.evalExprSteps(parseExprSql(col.checkExpr), candidate.data, []);
|
|
3405
3508
|
if (ok !== null && !isTruthy(ok)) {
|
|
3406
|
-
throw new
|
|
3509
|
+
throw new SqliteConstraintError(`CHECK constraint failed: ${col.checkExpr}`);
|
|
3407
3510
|
}
|
|
3408
3511
|
}
|
|
3409
3512
|
}
|
|
@@ -3415,9 +3518,6 @@ var SqliteDatabase = class {
|
|
|
3415
3518
|
yield;
|
|
3416
3519
|
keySets.push(u);
|
|
3417
3520
|
}
|
|
3418
|
-
if (keySets.length === 0 && candidate.rowid >= tbl.nextRowId) {
|
|
3419
|
-
return null;
|
|
3420
|
-
}
|
|
3421
3521
|
const resolvedKeySets = yield* stepMap(keySets, function* (kSet) {
|
|
3422
3522
|
yield;
|
|
3423
3523
|
return kSet.map((colName) => {
|
|
@@ -3427,6 +3527,12 @@ var SqliteDatabase = class {
|
|
|
3427
3527
|
return { cKey: realCol ? realCol.name : colName, collate: realCol?.collate ?? "BINARY" };
|
|
3428
3528
|
});
|
|
3429
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
|
+
}
|
|
3430
3536
|
for (const existing of tbl.rows) {
|
|
3431
3537
|
yield;
|
|
3432
3538
|
if (excludeRowid !== void 0 && existing.rowid === excludeRowid) {
|
|
@@ -3454,6 +3560,23 @@ var SqliteDatabase = class {
|
|
|
3454
3560
|
}
|
|
3455
3561
|
return null;
|
|
3456
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
|
+
}
|
|
3457
3580
|
*executeInsert(_sql, tokens, positionalParams, cteScope) {
|
|
3458
3581
|
let idx = 0;
|
|
3459
3582
|
let conflictAction = "ABORT";
|
|
@@ -3678,6 +3801,8 @@ var SqliteDatabase = class {
|
|
|
3678
3801
|
}
|
|
3679
3802
|
}
|
|
3680
3803
|
const candidate = { rowid, data };
|
|
3804
|
+
this.synchronizeRowid(tbl, candidate, targetCols);
|
|
3805
|
+
rowid = candidate.rowid;
|
|
3681
3806
|
yield* this.fireTriggers(tbl.name, "BEFORE", "INSERT", void 0, candidate.data);
|
|
3682
3807
|
const conflictRow = yield* this.checkConstraintsAndConflicts(tbl, candidate);
|
|
3683
3808
|
if (conflictRow) {
|
|
@@ -3839,7 +3964,9 @@ var SqliteDatabase = class {
|
|
|
3839
3964
|
}
|
|
3840
3965
|
*executeUpdate(tokens, positionalParams, _cteScope) {
|
|
3841
3966
|
let idx = 1;
|
|
3967
|
+
let conflictAction = "ABORT";
|
|
3842
3968
|
if (tokens[idx]?.value.toUpperCase() === "OR") {
|
|
3969
|
+
conflictAction = tokens[idx + 1]?.value.toUpperCase() ?? "ABORT";
|
|
3843
3970
|
idx += 2;
|
|
3844
3971
|
}
|
|
3845
3972
|
if (tokens[idx + 1]?.value === ".") {
|
|
@@ -3929,8 +4056,10 @@ var SqliteDatabase = class {
|
|
|
3929
4056
|
}
|
|
3930
4057
|
return [];
|
|
3931
4058
|
}, this);
|
|
4059
|
+
const replacedRows = /* @__PURE__ */ new Set();
|
|
3932
4060
|
for (const { row, ctx } of matches) {
|
|
3933
4061
|
yield;
|
|
4062
|
+
if (replacedRows.has(row)) continue;
|
|
3934
4063
|
const oldData = { ...row.data };
|
|
3935
4064
|
const newData = { ...row.data };
|
|
3936
4065
|
for (const assign of assignments) {
|
|
@@ -3955,11 +4084,25 @@ var SqliteDatabase = class {
|
|
|
3955
4084
|
}
|
|
3956
4085
|
yield* this.fireTriggers(tbl.name, "BEFORE", "UPDATE", oldData, newData);
|
|
3957
4086
|
const candidate = { rowid: row.rowid, data: newData };
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
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);
|
|
3961
4101
|
}
|
|
3962
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);
|
|
3963
4106
|
updated += 1;
|
|
3964
4107
|
affectedRows.push(row);
|
|
3965
4108
|
yield* this.fireTriggers(tbl.name, "AFTER", "UPDATE", oldData, newData);
|
|
@@ -4512,8 +4655,9 @@ var SqliteDatabase = class {
|
|
|
4512
4655
|
yield;
|
|
4513
4656
|
for (const col of src.columns) {
|
|
4514
4657
|
yield;
|
|
4658
|
+
if (src.hidden?.has(col.toLowerCase())) continue;
|
|
4515
4659
|
selectTargets.push({
|
|
4516
|
-
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 },
|
|
4517
4661
|
alias: col
|
|
4518
4662
|
});
|
|
4519
4663
|
}
|
|
@@ -4679,7 +4823,7 @@ var SqliteDatabase = class {
|
|
|
4679
4823
|
windowResults
|
|
4680
4824
|
);
|
|
4681
4825
|
}
|
|
4682
|
-
|
|
4826
|
+
let projected = yield* stepMap(groupedRows, function* (g, rowIdx) {
|
|
4683
4827
|
const repCtx = { ...g.representative };
|
|
4684
4828
|
const values = yield* stepMap(selectTargets, function* (st) {
|
|
4685
4829
|
const val = yield* this.evalExprSteps(
|
|
@@ -4696,6 +4840,33 @@ var SqliteDatabase = class {
|
|
|
4696
4840
|
}, this);
|
|
4697
4841
|
return { values, ctx: repCtx, group: g.group };
|
|
4698
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
|
+
}
|
|
4699
4870
|
let finalProjected = projected;
|
|
4700
4871
|
if (distinct) {
|
|
4701
4872
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -5007,6 +5178,13 @@ var SqliteDatabase = class {
|
|
|
5007
5178
|
yield;
|
|
5008
5179
|
return prevCols.has(c.toLowerCase());
|
|
5009
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
|
+
}
|
|
5010
5188
|
const rightMatched = /* @__PURE__ */ new Set();
|
|
5011
5189
|
for (const leftRow of currentRows) {
|
|
5012
5190
|
yield;
|
|
@@ -7254,6 +7432,26 @@ function splitDotCommandArgs(line) {
|
|
|
7254
7432
|
}
|
|
7255
7433
|
return args;
|
|
7256
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
|
+
}
|
|
7257
7455
|
var settings = {
|
|
7258
7456
|
commandName: "sqlite3",
|
|
7259
7457
|
limits: {
|
|
@@ -7430,7 +7628,7 @@ Options:
|
|
|
7430
7628
|
} else if (arg === "-init" || arg === "--init") {
|
|
7431
7629
|
initFile = args[i + 1] ?? null;
|
|
7432
7630
|
i += 1;
|
|
7433
|
-
} else if (arg.startsWith("-")) {
|
|
7631
|
+
} else if (arg.startsWith("-") && positional.length === 0) {
|
|
7434
7632
|
await writeText(context.stderr, `sqlite3: Error: unknown option: ${arg}
|
|
7435
7633
|
`);
|
|
7436
7634
|
return { exitCode: 1 };
|
|
@@ -7830,6 +8028,7 @@ Options:
|
|
|
7830
8028
|
return;
|
|
7831
8029
|
}
|
|
7832
8030
|
if (cmd === ".import") {
|
|
8031
|
+
if (state.readonly) throw new Error("attempt to write a readonly database");
|
|
7833
8032
|
let pIdx = 1;
|
|
7834
8033
|
let csvOverride = false;
|
|
7835
8034
|
let skipRows = 0;
|
|
@@ -7926,6 +8125,7 @@ Options:
|
|
|
7926
8125
|
return;
|
|
7927
8126
|
}
|
|
7928
8127
|
if (cmd === ".restore") {
|
|
8128
|
+
if (state.readonly) throw new Error("attempt to write a readonly database");
|
|
7929
8129
|
const srcArg = parts.length >= 3 ? parts[2] : parts[1];
|
|
7930
8130
|
const srcPath = resolveVfsPath(context.cwd, srcArg);
|
|
7931
8131
|
db.tables?.clear();
|
|
@@ -7973,8 +8173,7 @@ Options:
|
|
|
7973
8173
|
await emitOutput(`${stmt}
|
|
7974
8174
|
`);
|
|
7975
8175
|
}
|
|
7976
|
-
const
|
|
7977
|
-
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);
|
|
7978
8177
|
if (state.readonly && isMutating) {
|
|
7979
8178
|
throw new Error("attempt to write a readonly database");
|
|
7980
8179
|
}
|
|
@@ -8251,7 +8450,7 @@ Options:
|
|
|
8251
8450
|
} else if (arg === "-init" || arg === "--init") {
|
|
8252
8451
|
initFile = opArgs[i + 1] ?? null;
|
|
8253
8452
|
i += 1;
|
|
8254
|
-
} else if (arg.startsWith("-")) {
|
|
8453
|
+
} else if (arg.startsWith("-") && positional.length === 0) {
|
|
8255
8454
|
return void 0;
|
|
8256
8455
|
} else {
|
|
8257
8456
|
positional.push(arg);
|
|
@@ -8494,7 +8693,7 @@ Options:
|
|
|
8494
8693
|
const runSqlStatementSync = (stmt) => {
|
|
8495
8694
|
const trimmed = stmt.trim();
|
|
8496
8695
|
if (!trimmed) return true;
|
|
8497
|
-
const isMutating =
|
|
8696
|
+
const isMutating = isMutatingStatement(trimmed);
|
|
8498
8697
|
if (isMutating) {
|
|
8499
8698
|
if (state.readonly || state.dbPath !== ":memory:" && !writeFileSync) return false;
|
|
8500
8699
|
}
|