token-goat 2.9.29 → 2.9.31
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 +53 -42
- package/SECURITY.md +37 -11
- package/THIRD_PARTY_NOTICES.md +41 -4
- package/dist/native/linux-arm64/tg-hook +0 -0
- package/dist/native/linux-x64/tg-hook +0 -0
- package/dist/native/win32-arm64/tg-hook.exe +0 -0
- package/dist/native/win32-x64/tg-hook.exe +0 -0
- package/dist/ort-wasm-simd-threaded.mjs +59 -0
- package/dist/{token-goat-chunk-SE6E4BKJ.mjs → token-goat-chunk-25TRAWET.mjs} +23 -6
- package/dist/token-goat-chunk-2KXO6V2B.mjs +203 -0
- package/dist/{token-goat-chunk-UXSXQQIY.mjs → token-goat-chunk-2M7E4PF7.mjs} +43 -14
- package/dist/token-goat-chunk-2UPZGKKY.mjs +188 -0
- package/dist/token-goat-chunk-2WLPWKHV.mjs +135 -0
- package/dist/token-goat-chunk-2XBMMDBD.mjs +126 -0
- package/dist/token-goat-chunk-32ZOY4N5.mjs +23 -0
- package/dist/token-goat-chunk-3EZRNKTK.mjs +188 -0
- package/dist/token-goat-chunk-4ADZHI7J.mjs +63 -0
- package/dist/token-goat-chunk-4GBVPH3D.mjs +242 -0
- package/dist/{token-goat-chunk-2WOUYWLM.mjs → token-goat-chunk-4GILLLWY.mjs} +34 -7
- package/dist/token-goat-chunk-4NAPX7BA.mjs +90 -0
- package/dist/{token-goat-chunk-NMBWLRHW.mjs → token-goat-chunk-4SC7UJYV.mjs} +9981 -11563
- package/dist/token-goat-chunk-4SMRO4TO.mjs +366 -0
- package/dist/{token-goat-chunk-O6I2XU4P.mjs → token-goat-chunk-4ZBFWLXF.mjs} +310 -441
- package/dist/token-goat-chunk-57BIAXJL.mjs +286 -0
- package/dist/token-goat-chunk-5AC66HNP.mjs +115 -0
- package/dist/token-goat-chunk-5IMLKSOP.mjs +145 -0
- package/dist/token-goat-chunk-5RG5SBL6.mjs +221 -0
- package/dist/{token-goat-chunk-RRNZMM3A.mjs → token-goat-chunk-5Y6ZYL6U.mjs} +21 -2
- package/dist/token-goat-chunk-646E6U44.mjs +398 -0
- package/dist/token-goat-chunk-65N4RHP4.mjs +33 -0
- package/dist/{token-goat-chunk-6AK46ZT7.mjs → token-goat-chunk-6DG6HWP3.mjs} +13 -3
- package/dist/token-goat-chunk-6ENQSNRZ.mjs +573 -0
- package/dist/token-goat-chunk-6ZY4GNF2.mjs +91 -0
- package/dist/{token-goat-chunk-E5TK5DNO.mjs → token-goat-chunk-76FGDLRO.mjs} +574 -340
- package/dist/{token-goat-chunk-TGOXNAHW.mjs → token-goat-chunk-7EZTZOMC.mjs} +780 -767
- package/dist/token-goat-chunk-7MAOA6X4.mjs +3647 -0
- package/dist/token-goat-chunk-7R2ZVVAX.mjs +218 -0
- package/dist/{token-goat-chunk-TCQANXYC.mjs → token-goat-chunk-AM5V6GSX.mjs} +18 -2
- package/dist/token-goat-chunk-AUNGYYQX.mjs +184 -0
- package/dist/token-goat-chunk-AUQYRMMH.mjs +2985 -0
- package/dist/token-goat-chunk-B3PEKBYG.mjs +128 -0
- package/dist/{token-goat-chunk-KOPIR3KZ.mjs → token-goat-chunk-BA4HI6BW.mjs} +1910 -165
- package/dist/{token-goat-chunk-52NSDWYY.mjs → token-goat-chunk-BFCWY73P.mjs} +58 -20
- package/dist/token-goat-chunk-BPGCUMR7.mjs +30 -0
- package/dist/token-goat-chunk-BWGFUZZE.mjs +25 -0
- package/dist/token-goat-chunk-C75NA7PL.mjs +322 -0
- package/dist/token-goat-chunk-CBIQ7WTD.mjs +87 -0
- package/dist/token-goat-chunk-CETM74KC.mjs +307 -0
- package/dist/token-goat-chunk-CIMQ2BB3.mjs +233 -0
- package/dist/{token-goat-chunk-DNSPXQXQ.mjs → token-goat-chunk-CJLS3CDL.mjs} +70 -18
- package/dist/{token-goat-chunk-MELOKFDJ.mjs → token-goat-chunk-CO3UYX6G.mjs} +7 -1
- package/dist/token-goat-chunk-COPNXRJM.mjs +154 -0
- package/dist/token-goat-chunk-CSJ5L3NL.mjs +479 -0
- package/dist/token-goat-chunk-CVCEVUGK.mjs +315 -0
- package/dist/token-goat-chunk-CXHOFN7R.mjs +371 -0
- package/dist/token-goat-chunk-D735C4QM.mjs +603 -0
- package/dist/{token-goat-chunk-E4ZOJIZK.mjs → token-goat-chunk-DGS2LVNA.mjs} +70 -160
- package/dist/{token-goat-chunk-L7H3U27L.mjs → token-goat-chunk-DOWRSMWO.mjs} +1 -1
- package/dist/token-goat-chunk-E45INMY3.mjs +71 -0
- package/dist/token-goat-chunk-EC5F37F4.mjs +244 -0
- package/dist/{token-goat-chunk-XTQAOTSO.mjs → token-goat-chunk-EDBDRVH5.mjs} +4 -1
- package/dist/token-goat-chunk-EELTBKDM.mjs +613 -0
- package/dist/token-goat-chunk-EVMZJ27Z.mjs +147 -0
- package/dist/token-goat-chunk-EXKGNHEG.mjs +2096 -0
- package/dist/{token-goat-chunk-YOOVFPTP.mjs → token-goat-chunk-F4HYL64R.mjs} +12 -2
- package/dist/token-goat-chunk-F6PAUIEK.mjs +624 -0
- package/dist/token-goat-chunk-FDSREWLX.mjs +692 -0
- package/dist/{token-goat-chunk-NMTKNYGF.mjs → token-goat-chunk-FNFBKLRD.mjs} +74 -9
- package/dist/token-goat-chunk-G5PJ7AGM.mjs +36 -0
- package/dist/token-goat-chunk-GGGG7RWB.mjs +236 -0
- package/dist/{token-goat-chunk-TDUT2CL6.mjs → token-goat-chunk-GL3ETKSC.mjs} +276 -19
- package/dist/{token-goat-chunk-7CPMDFGB.mjs → token-goat-chunk-GVB2MUST.mjs} +265 -1567
- package/dist/token-goat-chunk-GWFLAUMQ.mjs +307 -0
- package/dist/token-goat-chunk-HAVAOB3S.mjs +87 -0
- package/dist/token-goat-chunk-HLPW63A7.mjs +48 -0
- package/dist/token-goat-chunk-HU4TORC5.mjs +1377 -0
- package/dist/token-goat-chunk-I7VKZZAW.mjs +35 -0
- package/dist/token-goat-chunk-IA6XSPE3.mjs +218 -0
- package/dist/token-goat-chunk-IAGXMHIK.mjs +863 -0
- package/dist/{token-goat-chunk-435UQTKD.mjs → token-goat-chunk-IK2DRMFX.mjs} +129 -74
- package/dist/{token-goat-chunk-ZER6EAXZ.mjs → token-goat-chunk-INNPTRUX.mjs} +2954 -2783
- package/dist/token-goat-chunk-JJ5BX4F4.mjs +129 -0
- package/dist/token-goat-chunk-JVFSHVFJ.mjs +129 -0
- package/dist/token-goat-chunk-KGEFFSHD.mjs +50 -0
- package/dist/token-goat-chunk-KKUFXAPD.mjs +25 -0
- package/dist/token-goat-chunk-KQBLRPBN.mjs +433 -0
- package/dist/token-goat-chunk-LCNQ2CNN.mjs +497 -0
- package/dist/token-goat-chunk-M3LFJDPU.mjs +58 -0
- package/dist/token-goat-chunk-M52KPT3C.mjs +87 -0
- package/dist/token-goat-chunk-MBEG42H7.mjs +150 -0
- package/dist/{token-goat-chunk-EVC4TOLE.mjs → token-goat-chunk-METECDOH.mjs} +3 -12
- package/dist/{token-goat-chunk-2AWQ2R5X.mjs → token-goat-chunk-MHX7XCC3.mjs} +3 -2
- package/dist/token-goat-chunk-MNWKPRAL.mjs +13 -0
- package/dist/token-goat-chunk-N5LSOVSU.mjs +137 -0
- package/dist/{token-goat-chunk-DPNLUJWB.mjs → token-goat-chunk-N5MMR2IW.mjs} +30 -8
- package/dist/token-goat-chunk-N7B3JQ2C.mjs +160 -0
- package/dist/{token-goat-chunk-VMFWNHGR.mjs → token-goat-chunk-NISNMD7T.mjs} +2545 -2953
- package/dist/token-goat-chunk-NMD42SFQ.mjs +434 -0
- package/dist/token-goat-chunk-NOSS5VWY.mjs +174 -0
- package/dist/token-goat-chunk-NSNSPPBG.mjs +69 -0
- package/dist/token-goat-chunk-OBOFIHKN.mjs +38 -0
- package/dist/token-goat-chunk-OBRFJ5O5.mjs +76 -0
- package/dist/token-goat-chunk-ODBT2USM.mjs +800 -0
- package/dist/token-goat-chunk-OS5EM5PP.mjs +107 -0
- package/dist/token-goat-chunk-OUKDTVNU.mjs +1178 -0
- package/dist/token-goat-chunk-OXFMP75N.mjs +566 -0
- package/dist/{token-goat-chunk-ASLWOQ3I.mjs → token-goat-chunk-OYIYKDDT.mjs} +2 -1
- package/dist/{token-goat-chunk-67BNIKKO.mjs → token-goat-chunk-P6HQSWQ3.mjs} +55 -47
- package/dist/token-goat-chunk-P6VGNTQT.mjs +71 -0
- package/dist/token-goat-chunk-PFWIMH2E.mjs +261 -0
- package/dist/token-goat-chunk-PJZXIS3G.mjs +39 -0
- package/dist/token-goat-chunk-PUO5INXP.mjs +606 -0
- package/dist/token-goat-chunk-PX5PQWTY.mjs +462 -0
- package/dist/token-goat-chunk-Q5QDBC6O.mjs +111 -0
- package/dist/token-goat-chunk-QFNQXSDT.mjs +40 -0
- package/dist/token-goat-chunk-QH7YVYOY.mjs +3957 -0
- package/dist/token-goat-chunk-QLMUHEPB.mjs +43 -0
- package/dist/{token-goat-chunk-PYSUADX4.mjs → token-goat-chunk-QQOJIHL3.mjs} +50 -14
- package/dist/token-goat-chunk-QQTWJY2O.mjs +85 -0
- package/dist/token-goat-chunk-QYHO5CPH.mjs +93 -0
- package/dist/token-goat-chunk-RELAVWAD.mjs +27 -0
- package/dist/token-goat-chunk-RSLPOBKQ.mjs +339 -0
- package/dist/token-goat-chunk-SAMFDIS2.mjs +712 -0
- package/dist/token-goat-chunk-SDELXLDM.mjs +48 -0
- package/dist/{token-goat-chunk-PGTH2U4C.mjs → token-goat-chunk-SOAFZNNZ.mjs} +164 -40
- package/dist/{token-goat-chunk-G23DWHV4.mjs → token-goat-chunk-SRTHT7KV.mjs} +33 -15
- package/dist/token-goat-chunk-T5P5ACNQ.mjs +212 -0
- package/dist/token-goat-chunk-T5YGG4V3.mjs +45 -0
- package/dist/token-goat-chunk-TAUZ4OFS.mjs +110 -0
- package/dist/token-goat-chunk-TM6MC754.mjs +40 -0
- package/dist/token-goat-chunk-TWUKBOMP.mjs +72 -0
- package/dist/token-goat-chunk-U2KSB4SG.mjs +56 -0
- package/dist/token-goat-chunk-U4WHMG6Y.mjs +898 -0
- package/dist/token-goat-chunk-UA5V6P3P.mjs +122 -0
- package/dist/token-goat-chunk-UGJHGR5A.mjs +52 -0
- package/dist/{token-goat-chunk-RQGGMPCR.mjs → token-goat-chunk-UOUDVA5U.mjs} +76 -16
- package/dist/{token-goat-chunk-HNFZZHFW.mjs → token-goat-chunk-URRJ33GR.mjs} +22 -4
- package/dist/token-goat-chunk-UZOROKIS.mjs +165 -0
- package/dist/token-goat-chunk-VIHGGGEI.mjs +4234 -0
- package/dist/token-goat-chunk-VTJLAA7P.mjs +21 -0
- package/dist/token-goat-chunk-VWDXLT4F.mjs +678 -0
- package/dist/token-goat-chunk-VWZA2H4P.mjs +368 -0
- package/dist/{token-goat-chunk-QO3LXVVR.mjs → token-goat-chunk-VXEXMJDL.mjs} +2964 -3153
- package/dist/token-goat-chunk-WBA5SKT4.mjs +547 -0
- package/dist/{token-goat-chunk-ONXH6NZ5.mjs → token-goat-chunk-WDH44VAU.mjs} +19 -22
- package/dist/token-goat-chunk-X2SUP3EI.mjs +107 -0
- package/dist/token-goat-chunk-X3BELZSJ.mjs +125 -0
- package/dist/{token-goat-chunk-RLP6J7WR.mjs → token-goat-chunk-XLRBNZCC.mjs} +40 -21
- package/dist/{token-goat-chunk-S4VSXURL.mjs → token-goat-chunk-XRKUX6CM.mjs} +4 -0
- package/dist/token-goat-chunk-XX6O25RN.mjs +82 -0
- package/dist/token-goat-chunk-XZSUHBVS.mjs +65 -0
- package/dist/token-goat-chunk-Y2ZTQOCL.mjs +35 -0
- package/dist/{token-goat-chunk-UA5BKWWQ.mjs → token-goat-chunk-YB4VMGK2.mjs} +15 -4
- package/dist/token-goat-chunk-YBIIY3HR.mjs +51 -0
- package/dist/{token-goat-chunk-PKRWMHVP.mjs → token-goat-chunk-YHVDKQBR.mjs} +389 -221
- package/dist/token-goat-chunk-YJB5XLWI.mjs +26 -0
- package/dist/{token-goat-chunk-PQ53BSCF.mjs → token-goat-chunk-YKB6AQG3.mjs} +53 -31
- package/dist/token-goat-chunk-YMTG2YA5.mjs +35 -0
- package/dist/token-goat-chunk-YPBZYQRV.mjs +40 -0
- package/dist/{token-goat-chunk-HUYUHODZ.mjs → token-goat-chunk-YY6AVUFL.mjs} +13246 -12247
- package/dist/token-goat-chunk-Z7N5OMMP.mjs +98 -0
- package/dist/{token-goat-chunk-BGHSSJUA.mjs → token-goat-chunk-ZFOBKUWH.mjs} +1 -1
- package/dist/token-goat-chunk-ZMBL6UVV.mjs +110 -0
- package/dist/token-goat-chunk-ZNMNUPAZ.mjs +938 -0
- package/dist/token-goat-hook-client.cjs +87 -23
- package/dist/token-goat-hook-client.mjs +3 -3
- package/dist/token-goat-hook.mjs +76 -31
- package/dist/token-goat.core.mjs +6 -6
- package/docs/C4_RUNTIME_ARCHITECTURE.md +2 -2
- package/docs/cli.md +113 -60
- package/docs/install.md +63 -20
- package/docs/security.md +10 -8
- package/package.json +18 -7
- package/scripts/verify-native-dist.mjs +386 -0
- package/dist/token-goat-chunk-2NNUA2LR.mjs +0 -143
- package/dist/token-goat-chunk-44BM7DDQ.mjs +0 -294
- package/dist/token-goat-chunk-BGYOZ6DO.mjs +0 -24
- package/dist/token-goat-chunk-C5YPNZKQ.mjs +0 -318
- package/dist/token-goat-chunk-CIQ2FTY3.mjs +0 -1990
- package/dist/token-goat-chunk-D4ETHJD6.mjs +0 -246
- package/dist/token-goat-chunk-DNRPXHYH.mjs +0 -1062
- package/dist/token-goat-chunk-EUSDXRXU.mjs +0 -1429
- package/dist/token-goat-chunk-FTP4U4QA.mjs +0 -64
- package/dist/token-goat-chunk-G7IWXCFF.mjs +0 -456
- package/dist/token-goat-chunk-GLXRTTLE.mjs +0 -36
- package/dist/token-goat-chunk-H5J3C56Q.mjs +0 -1511
- package/dist/token-goat-chunk-IVWI2OCK.mjs +0 -368
- package/dist/token-goat-chunk-JTKCQMQA.mjs +0 -418
- package/dist/token-goat-chunk-LZNBQTDK.mjs +0 -26
- package/dist/token-goat-chunk-ORNFMIER.mjs +0 -295
- package/dist/token-goat-chunk-RTMVLHWX.mjs +0 -7113
- package/dist/token-goat-chunk-VQ6F6T7X.mjs +0 -36
- package/dist/token-goat-chunk-VZQEWRVH.mjs +0 -312
- package/dist/token-goat-chunk-XYWPOSCN.mjs +0 -807
- package/dist/token-goat-chunk-YAGLESS3.mjs +0 -23
- package/dist/token-goat-chunk-YKSRAWUU.mjs +0 -33
- package/dist/token-goat-chunk-Z6KBMOBI.mjs +0 -53
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
copyFromSharedCache,
|
|
5
|
+
downloadPinned,
|
|
6
|
+
setPinnedRetryDelayForTesting,
|
|
7
|
+
sha256Of
|
|
8
|
+
} from "./token-goat-chunk-AUNGYYQX.mjs";
|
|
9
|
+
import "./token-goat-chunk-2UPZGKKY.mjs";
|
|
10
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
11
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
12
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
13
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
14
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
15
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
16
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
17
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
18
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
19
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
20
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
21
|
+
export {
|
|
22
|
+
copyFromSharedCache,
|
|
23
|
+
downloadPinned,
|
|
24
|
+
setPinnedRetryDelayForTesting,
|
|
25
|
+
sha256Of
|
|
26
|
+
};
|
|
@@ -3,9 +3,12 @@ const require = __cjsRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
Database
|
|
5
5
|
} from "./token-goat-chunk-XB5KKOCG.mjs";
|
|
6
|
+
import {
|
|
7
|
+
echoedValue
|
|
8
|
+
} from "./token-goat-chunk-GGGG7RWB.mjs";
|
|
6
9
|
import {
|
|
7
10
|
displaySafeText
|
|
8
|
-
} from "./token-goat-chunk-
|
|
11
|
+
} from "./token-goat-chunk-FNFBKLRD.mjs";
|
|
9
12
|
import {
|
|
10
13
|
init_define_import_meta_env
|
|
11
14
|
} from "./token-goat-chunk-A37V4PBF.mjs";
|
|
@@ -53,45 +56,62 @@ function openReadonlySqlite(filePath) {
|
|
|
53
56
|
function quoteIdent(name) {
|
|
54
57
|
return `"${name.replace(/"/g, '""')}"`;
|
|
55
58
|
}
|
|
59
|
+
function virtualTableModule(createSql) {
|
|
60
|
+
if (typeof createSql !== "string") return null;
|
|
61
|
+
const m = /^\s*CREATE\s+VIRTUAL\s+TABLE\b[\s\S]*?\bUSING\s+["'`[]?(\w+)/i.exec(createSql);
|
|
62
|
+
return m === null ? null : m[1] ?? null;
|
|
63
|
+
}
|
|
56
64
|
function getSqliteSchema(filePath) {
|
|
57
65
|
const db = openReadonlySqlite(filePath);
|
|
58
66
|
try {
|
|
59
|
-
const objects = db.prepare("SELECT name, type FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite\\_%' ESCAPE '\\' ORDER BY name").all();
|
|
67
|
+
const objects = db.prepare("SELECT name, type, sql FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite\\_%' ESCAPE '\\' ORDER BY name").all();
|
|
60
68
|
const tables = objects.map((o) => {
|
|
61
|
-
const
|
|
62
|
-
(c) => ({
|
|
63
|
-
name: c.name,
|
|
64
|
-
type: c.type || "",
|
|
65
|
-
notNull: c.notnull === 1,
|
|
66
|
-
primaryKey: c.pk > 0,
|
|
67
|
-
defaultValue: c.dflt_value === null || c.dflt_value === void 0 ? null : String(c.dflt_value)
|
|
68
|
-
})
|
|
69
|
-
);
|
|
70
|
-
const indexes = db.prepare(`PRAGMA index_list(${quoteIdent(o.name)})`).all().map(
|
|
71
|
-
(idx) => {
|
|
72
|
-
const idxColumns = db.prepare(`PRAGMA index_info(${quoteIdent(idx.name)})`).all().map((c) => c.name);
|
|
73
|
-
return { name: idx.name, unique: idx.unique === 1, columns: idxColumns };
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
const foreignKeys = db.prepare(`PRAGMA foreign_key_list(${quoteIdent(o.name)})`).all().map((fk) => ({ table: fk.table, from: fk.from, to: fk.to }));
|
|
77
|
-
let rowCount;
|
|
69
|
+
const module = virtualTableModule(o.sql);
|
|
78
70
|
try {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
rowCount
|
|
71
|
+
return describeOne(db, o, module);
|
|
72
|
+
} catch (e) {
|
|
73
|
+
if (module === null) throw e;
|
|
74
|
+
return { name: o.name, kind: "virtual", module, ...o.sql !== null ? { createSql: o.sql } : {}, moduleNotLoaded: true, columns: [], indexes: [], foreignKeys: [], rowCount: null };
|
|
83
75
|
}
|
|
84
|
-
return { name: o.name, kind: o.type === "view" ? "view" : "table", columns, indexes, foreignKeys, rowCount };
|
|
85
76
|
});
|
|
86
77
|
return { tables };
|
|
87
78
|
} finally {
|
|
88
79
|
db.close();
|
|
89
80
|
}
|
|
90
81
|
}
|
|
82
|
+
function describeOne(db, o, module) {
|
|
83
|
+
const columns = db.prepare(`PRAGMA table_info(${quoteIdent(o.name)})`).all().map(
|
|
84
|
+
(c) => ({
|
|
85
|
+
name: c.name,
|
|
86
|
+
type: c.type || "",
|
|
87
|
+
notNull: c.notnull === 1,
|
|
88
|
+
primaryKey: c.pk > 0,
|
|
89
|
+
defaultValue: c.dflt_value === null || c.dflt_value === void 0 ? null : String(c.dflt_value)
|
|
90
|
+
})
|
|
91
|
+
);
|
|
92
|
+
const indexes = db.prepare(`PRAGMA index_list(${quoteIdent(o.name)})`).all().map(
|
|
93
|
+
(idx) => {
|
|
94
|
+
const idxColumns = db.prepare(`PRAGMA index_info(${quoteIdent(idx.name)})`).all().map((c) => c.name);
|
|
95
|
+
return { name: idx.name, unique: idx.unique === 1, columns: idxColumns };
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
const foreignKeys = db.prepare(`PRAGMA foreign_key_list(${quoteIdent(o.name)})`).all().map((fk) => ({ table: fk.table, from: fk.from, to: fk.to }));
|
|
99
|
+
let rowCount;
|
|
100
|
+
try {
|
|
101
|
+
const row = db.prepare(`SELECT COUNT(*) AS c FROM ${quoteIdent(o.name)}`).get();
|
|
102
|
+
rowCount = row.c;
|
|
103
|
+
} catch {
|
|
104
|
+
rowCount = null;
|
|
105
|
+
}
|
|
106
|
+
if (module !== null) return { name: o.name, kind: "virtual", module, columns, indexes, foreignKeys, rowCount };
|
|
107
|
+
return { name: o.name, kind: o.type === "view" ? "view" : "table", columns, indexes, foreignKeys, rowCount };
|
|
108
|
+
}
|
|
91
109
|
function formatSqliteSchema(result) {
|
|
92
110
|
if (result.tables.length === 0) return "(no tables or views found)";
|
|
93
111
|
return result.tables.map((t) => {
|
|
94
|
-
const
|
|
112
|
+
const kind = t.kind === "virtual" ? `virtual table: ${displaySafeText(t.module ?? "?")}${t.moduleNotLoaded === true ? "; module not loaded" : ""}` : t.kind;
|
|
113
|
+
const lines = [`${displaySafeText(t.name)} (${kind}${t.rowCount !== null ? `, ${t.rowCount} row${t.rowCount === 1 ? "" : "s"}` : ""})`];
|
|
114
|
+
if (t.createSql !== void 0) lines.push(` ${displaySafeText(t.createSql.replace(/\s+/g, " ").trim())}`);
|
|
95
115
|
for (const c of t.columns) {
|
|
96
116
|
const flags = [c.primaryKey ? "PK" : null, c.notNull ? "NOT NULL" : null, c.defaultValue !== null ? `DEFAULT ${c.defaultValue}` : null].filter((f) => f !== null).join(" ");
|
|
97
117
|
lines.push(` ${displaySafeText(c.name)} ${displaySafeText(c.type || "(untyped)")}${flags ? ` ${flags}` : ""}`);
|
|
@@ -116,9 +136,10 @@ function getSqliteTables(filePath) {
|
|
|
116
136
|
try {
|
|
117
137
|
const objects = db.prepare(
|
|
118
138
|
// ESCAPE makes every `_` literal; see getSqliteSchema above. Here it costs three tables rather than one, since `%_fts_%` and `%_vec0_%` exist to hide the shadow tables FTS5 and sqlite-vec create beside a virtual table, and unescaped they also hide anything of the shape `my_ftsx_cache`.
|
|
119
|
-
"SELECT name, type FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite\\_%' ESCAPE '\\' AND name NOT LIKE '%\\_fts\\_%' ESCAPE '\\' AND name NOT LIKE '%\\_vec0\\_%' ESCAPE '\\' ORDER BY name"
|
|
139
|
+
"SELECT name, type, sql FROM sqlite_master WHERE type IN ('table','view') AND name NOT LIKE 'sqlite\\_%' ESCAPE '\\' AND name NOT LIKE '%\\_fts\\_%' ESCAPE '\\' AND name NOT LIKE '%\\_vec0\\_%' ESCAPE '\\' ORDER BY name"
|
|
120
140
|
).all();
|
|
121
141
|
return objects.map((o) => {
|
|
142
|
+
const module = virtualTableModule(o.sql);
|
|
122
143
|
let columnCount;
|
|
123
144
|
try {
|
|
124
145
|
const cols = db.prepare(`PRAGMA table_info(${quoteIdent(o.name)})`).all();
|
|
@@ -135,7 +156,8 @@ function getSqliteTables(filePath) {
|
|
|
135
156
|
}
|
|
136
157
|
return {
|
|
137
158
|
name: o.name,
|
|
138
|
-
kind: o.type === "view" ? "view" : "table",
|
|
159
|
+
kind: module !== null ? "virtual" : o.type === "view" ? "view" : "table",
|
|
160
|
+
...module !== null ? { module } : {},
|
|
139
161
|
rowCount,
|
|
140
162
|
columnCount
|
|
141
163
|
};
|
|
@@ -147,11 +169,11 @@ function getSqliteTables(filePath) {
|
|
|
147
169
|
function formatSqliteTables(tables) {
|
|
148
170
|
if (tables.length === 0) return "(no tables or views found)";
|
|
149
171
|
return tables.map((t) => {
|
|
150
|
-
const parts = [t.kind];
|
|
172
|
+
const parts = [t.kind === "virtual" ? `virtual table: ${displaySafeText(t.module ?? "?")}` : t.kind];
|
|
151
173
|
if (t.rowCount !== null) {
|
|
152
174
|
parts.push(`${t.rowCount.toLocaleString()} row${t.rowCount === 1 ? "" : "s"}`);
|
|
153
175
|
}
|
|
154
|
-
parts.push(`${t.columnCount} col${t.columnCount === 1 ? "" : "s"}`);
|
|
176
|
+
if (t.kind !== "virtual" || t.columnCount > 0) parts.push(`${t.columnCount} col${t.columnCount === 1 ? "" : "s"}`);
|
|
155
177
|
return `${displaySafeText(t.name)} (${parts.join(", ")})`;
|
|
156
178
|
}).join("\n");
|
|
157
179
|
}
|
|
@@ -237,11 +259,11 @@ function validateReadOnlySelect(sql) {
|
|
|
237
259
|
}
|
|
238
260
|
for (const kw of FORBIDDEN_KEYWORDS) {
|
|
239
261
|
if (new RegExp(`\\b${kw}\\b`).test(upper)) {
|
|
240
|
-
throw new Error(`statement contains forbidden keyword
|
|
262
|
+
throw new Error(`statement contains forbidden keyword ${echoedValue(kw)} (sqlite-query only allows read-only SELECT queries)`);
|
|
241
263
|
}
|
|
242
264
|
}
|
|
243
265
|
if (/\bREPLACE\b(?!\s*\()/.test(upper)) {
|
|
244
|
-
throw new Error(
|
|
266
|
+
throw new Error('statement contains forbidden keyword "REPLACE" (sqlite-query only allows read-only SELECT queries)');
|
|
245
267
|
}
|
|
246
268
|
}
|
|
247
269
|
function normalizeSqliteScalar(value) {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
capListField,
|
|
5
|
+
guardAndFenceFileText,
|
|
6
|
+
guardRedactAndFence,
|
|
7
|
+
guardThenFence
|
|
8
|
+
} from "./token-goat-chunk-M52KPT3C.mjs";
|
|
9
|
+
import "./token-goat-chunk-4NAPX7BA.mjs";
|
|
10
|
+
import "./token-goat-chunk-U4WHMG6Y.mjs";
|
|
11
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
12
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
13
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
14
|
+
import "./token-goat-chunk-BFCWY73P.mjs";
|
|
15
|
+
import "./token-goat-chunk-KGEFFSHD.mjs";
|
|
16
|
+
import "./token-goat-chunk-XX6O25RN.mjs";
|
|
17
|
+
import "./token-goat-chunk-HAVAOB3S.mjs";
|
|
18
|
+
import "./token-goat-chunk-T5P5ACNQ.mjs";
|
|
19
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
20
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
21
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
22
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
23
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
24
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
25
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
26
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
27
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
28
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
29
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
30
|
+
export {
|
|
31
|
+
capListField,
|
|
32
|
+
guardAndFenceFileText,
|
|
33
|
+
guardRedactAndFence,
|
|
34
|
+
guardThenFence
|
|
35
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire as __cjsRequire } from 'node:module';
|
|
2
|
+
const require = __cjsRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
extractSection,
|
|
5
|
+
extractShellBannerHeading,
|
|
6
|
+
findContainingSection,
|
|
7
|
+
findMarkdownHeaders,
|
|
8
|
+
findShellBannerHeaders,
|
|
9
|
+
listSections,
|
|
10
|
+
normalizeHeading,
|
|
11
|
+
readSection
|
|
12
|
+
} from "./token-goat-chunk-OXFMP75N.mjs";
|
|
13
|
+
import "./token-goat-chunk-NISNMD7T.mjs";
|
|
14
|
+
import "./token-goat-chunk-EVMZJ27Z.mjs";
|
|
15
|
+
import "./token-goat-chunk-IK2DRMFX.mjs";
|
|
16
|
+
import "./token-goat-chunk-GVB2MUST.mjs";
|
|
17
|
+
import "./token-goat-chunk-XB5KKOCG.mjs";
|
|
18
|
+
import "./token-goat-chunk-OUKDTVNU.mjs";
|
|
19
|
+
import "./token-goat-chunk-7EZTZOMC.mjs";
|
|
20
|
+
import "./token-goat-chunk-QYHO5CPH.mjs";
|
|
21
|
+
import "./token-goat-chunk-4GBVPH3D.mjs";
|
|
22
|
+
import "./token-goat-chunk-YZAAZU2S.mjs";
|
|
23
|
+
import "./token-goat-chunk-IVE6U7KV.mjs";
|
|
24
|
+
import "./token-goat-chunk-Y4AFKTHK.mjs";
|
|
25
|
+
import "./token-goat-chunk-HU4TORC5.mjs";
|
|
26
|
+
import "./token-goat-chunk-GGGG7RWB.mjs";
|
|
27
|
+
import "./token-goat-chunk-AM5V6GSX.mjs";
|
|
28
|
+
import "./token-goat-chunk-FNFBKLRD.mjs";
|
|
29
|
+
import "./token-goat-chunk-CO3UYX6G.mjs";
|
|
30
|
+
import "./token-goat-chunk-A37V4PBF.mjs";
|
|
31
|
+
export {
|
|
32
|
+
extractSection,
|
|
33
|
+
extractShellBannerHeading,
|
|
34
|
+
findContainingSection,
|
|
35
|
+
findMarkdownHeaders,
|
|
36
|
+
findShellBannerHeaders,
|
|
37
|
+
listSections,
|
|
38
|
+
normalizeHeading,
|
|
39
|
+
readSection
|
|
40
|
+
};
|