@aigne/afs-sqlite 1.11.0-beta.1 → 1.11.0-beta.10
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 +3 -3
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs +10 -0
- package/dist/_virtual/rolldown_runtime.mjs +7 -0
- package/dist/actions/built-in.cjs +1262 -15
- package/dist/actions/built-in.d.cts.map +1 -1
- package/dist/actions/built-in.d.mts.map +1 -1
- package/dist/actions/built-in.mjs +1262 -15
- package/dist/actions/built-in.mjs.map +1 -1
- package/dist/actions/operators.cjs +156 -0
- package/dist/actions/operators.mjs +157 -0
- package/dist/actions/operators.mjs.map +1 -0
- package/dist/actions/registry.cjs +35 -3
- package/dist/actions/registry.d.cts +36 -17
- package/dist/actions/registry.d.cts.map +1 -1
- package/dist/actions/registry.d.mts +36 -17
- package/dist/actions/registry.d.mts.map +1 -1
- package/dist/actions/registry.mjs +35 -3
- package/dist/actions/registry.mjs.map +1 -1
- package/dist/actions/types.cjs +33 -0
- package/dist/actions/types.d.cts +46 -5
- package/dist/actions/types.d.cts.map +1 -1
- package/dist/actions/types.d.mts +46 -5
- package/dist/actions/types.d.mts.map +1 -1
- package/dist/actions/types.mjs +32 -0
- package/dist/actions/types.mjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +9 -36
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +9 -36
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +3 -2
- package/dist/node/builder.cjs +74 -91
- package/dist/node/builder.d.cts +11 -15
- package/dist/node/builder.d.cts.map +1 -1
- package/dist/node/builder.d.mts +11 -15
- package/dist/node/builder.d.mts.map +1 -1
- package/dist/node/builder.mjs +72 -89
- package/dist/node/builder.mjs.map +1 -1
- package/dist/operations/crud.cjs +24 -68
- package/dist/operations/crud.d.cts +23 -38
- package/dist/operations/crud.d.cts.map +1 -1
- package/dist/operations/crud.d.mts +23 -38
- package/dist/operations/crud.d.mts.map +1 -1
- package/dist/operations/crud.mjs +25 -69
- package/dist/operations/crud.mjs.map +1 -1
- package/dist/operations/query-builder.cjs +2 -2
- package/dist/operations/query-builder.d.cts.map +1 -1
- package/dist/operations/query-builder.d.mts.map +1 -1
- package/dist/operations/query-builder.mjs +2 -2
- package/dist/operations/query-builder.mjs.map +1 -1
- package/dist/operations/search.cjs +5 -11
- package/dist/operations/search.d.cts +19 -23
- package/dist/operations/search.d.cts.map +1 -1
- package/dist/operations/search.d.mts +19 -23
- package/dist/operations/search.d.mts.map +1 -1
- package/dist/operations/search.mjs +5 -11
- package/dist/operations/search.mjs.map +1 -1
- package/dist/router/path-router.cjs +7 -15
- package/dist/router/path-router.d.cts +4 -7
- package/dist/router/path-router.d.cts.map +1 -1
- package/dist/router/path-router.d.mts +4 -7
- package/dist/router/path-router.d.mts.map +1 -1
- package/dist/router/path-router.mjs +7 -15
- package/dist/router/path-router.mjs.map +1 -1
- package/dist/router/types.d.cts.map +1 -1
- package/dist/router/types.d.mts.map +1 -1
- package/dist/schema/introspector.d.cts +19 -19
- package/dist/schema/introspector.d.cts.map +1 -1
- package/dist/schema/introspector.d.mts +19 -19
- package/dist/schema/introspector.d.mts.map +1 -1
- package/dist/schema/service.cjs +86 -0
- package/dist/schema/service.d.cts +52 -0
- package/dist/schema/service.d.cts.map +1 -0
- package/dist/schema/service.d.mts +52 -0
- package/dist/schema/service.d.mts.map +1 -0
- package/dist/schema/service.mjs +87 -0
- package/dist/schema/service.mjs.map +1 -0
- package/dist/schema/types.d.cts.map +1 -1
- package/dist/schema/types.d.mts.map +1 -1
- package/dist/sqlite-afs.cjs +693 -121
- package/dist/sqlite-afs.d.cts +279 -101
- package/dist/sqlite-afs.d.cts.map +1 -1
- package/dist/sqlite-afs.d.mts +279 -101
- package/dist/sqlite-afs.d.mts.map +1 -1
- package/dist/sqlite-afs.mjs +696 -123
- package/dist/sqlite-afs.mjs.map +1 -1
- package/package.json +5 -4
|
@@ -8,26 +8,20 @@ let radix3 = require("radix3");
|
|
|
8
8
|
* - / → listTables
|
|
9
9
|
* - /:table → listTable
|
|
10
10
|
* - /:table/new → createRow
|
|
11
|
-
* - /:table/@schema → getSchema
|
|
12
11
|
* - /:table/:pk → readRow
|
|
13
|
-
* - /:table/:pk/@attr → listAttributes
|
|
14
|
-
* - /:table/:pk/@attr/:column → getAttribute
|
|
15
12
|
* - /:table/:pk/@meta → getMeta
|
|
16
|
-
* - /:table/:pk
|
|
17
|
-
* - /:table/:pk
|
|
13
|
+
* - /:table/:pk/.actions → listActions
|
|
14
|
+
* - /:table/:pk/.actions/:action → executeAction
|
|
18
15
|
*/
|
|
19
16
|
function createPathRouter() {
|
|
20
17
|
return (0, radix3.createRouter)({ routes: {
|
|
21
18
|
"/": { action: "listTables" },
|
|
22
19
|
"/:table": { action: "listTable" },
|
|
23
20
|
"/:table/new": { action: "createRow" },
|
|
24
|
-
"/:table/@schema": { action: "getSchema" },
|
|
25
21
|
"/:table/:pk": { action: "readRow" },
|
|
26
|
-
"/:table/:pk/@attr": { action: "listAttributes" },
|
|
27
|
-
"/:table/:pk/@attr/:column": { action: "getAttribute" },
|
|
28
22
|
"/:table/:pk/@meta": { action: "getMeta" },
|
|
29
|
-
"/:table/:pk
|
|
30
|
-
"/:table/:pk
|
|
23
|
+
"/:table/:pk/.actions": { action: "listActions" },
|
|
24
|
+
"/:table/:pk/.actions/:action": { action: "executeAction" }
|
|
31
25
|
} });
|
|
32
26
|
}
|
|
33
27
|
/**
|
|
@@ -55,19 +49,17 @@ function buildPath(table, pk, suffix) {
|
|
|
55
49
|
return parts.join("/").replace(/\/+/g, "/");
|
|
56
50
|
}
|
|
57
51
|
/**
|
|
58
|
-
* Checks if a path segment is a virtual path (@
|
|
52
|
+
* Checks if a path segment is a virtual path (@meta, .actions, .meta)
|
|
59
53
|
*/
|
|
60
54
|
function isVirtualPath(segment) {
|
|
61
|
-
return segment.startsWith("@");
|
|
55
|
+
return segment.startsWith("@") || segment.startsWith(".");
|
|
62
56
|
}
|
|
63
57
|
/**
|
|
64
58
|
* Gets the type of virtual path
|
|
65
59
|
*/
|
|
66
60
|
function getVirtualPathType(segment) {
|
|
67
|
-
if (segment === "@attr") return "attr";
|
|
68
61
|
if (segment === "@meta") return "meta";
|
|
69
|
-
if (segment === "
|
|
70
|
-
if (segment === "@schema") return "schema";
|
|
62
|
+
if (segment === ".actions") return "actions";
|
|
71
63
|
return null;
|
|
72
64
|
}
|
|
73
65
|
|
|
@@ -9,13 +9,10 @@ import { RadixRouter } from "radix3";
|
|
|
9
9
|
* - / → listTables
|
|
10
10
|
* - /:table → listTable
|
|
11
11
|
* - /:table/new → createRow
|
|
12
|
-
* - /:table/@schema → getSchema
|
|
13
12
|
* - /:table/:pk → readRow
|
|
14
|
-
* - /:table/:pk/@attr → listAttributes
|
|
15
|
-
* - /:table/:pk/@attr/:column → getAttribute
|
|
16
13
|
* - /:table/:pk/@meta → getMeta
|
|
17
|
-
* - /:table/:pk
|
|
18
|
-
* - /:table/:pk
|
|
14
|
+
* - /:table/:pk/.actions → listActions
|
|
15
|
+
* - /:table/:pk/.actions/:action → executeAction
|
|
19
16
|
*/
|
|
20
17
|
declare function createPathRouter(): RadixRouter<RouteData>;
|
|
21
18
|
/**
|
|
@@ -30,13 +27,13 @@ declare function matchPath(router: RadixRouter<RouteData>, path: string): RouteM
|
|
|
30
27
|
*/
|
|
31
28
|
declare function buildPath(table?: string, pk?: string, suffix?: string): string;
|
|
32
29
|
/**
|
|
33
|
-
* Checks if a path segment is a virtual path (@
|
|
30
|
+
* Checks if a path segment is a virtual path (@meta, .actions, .meta)
|
|
34
31
|
*/
|
|
35
32
|
declare function isVirtualPath(segment: string): boolean;
|
|
36
33
|
/**
|
|
37
34
|
* Gets the type of virtual path
|
|
38
35
|
*/
|
|
39
|
-
declare function getVirtualPathType(segment: string): "
|
|
36
|
+
declare function getVirtualPathType(segment: string): "meta" | "actions" | null;
|
|
40
37
|
//#endregion
|
|
41
38
|
export { buildPath, createPathRouter, getVirtualPathType, isVirtualPath, matchPath };
|
|
42
39
|
//# sourceMappingURL=path-router.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-router.d.cts","names":[],"sources":["../../src/router/path-router.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"path-router.d.cts","names":[],"sources":["../../src/router/path-router.ts"],"mappings":";;;;;AAiBA;;;;;AAyBA;;;;;;iBAzBgB,gBAAA,CAAA,GAAoB,WAAA,CAAY,SAAA;;;;;;;iBAyBhC,SAAA,CAAU,MAAA,EAAQ,WAAA,CAAY,SAAA,GAAY,IAAA,WAAe,UAAA;;AAazE;;iBAAgB,SAAA,CAAU,KAAA,WAAgB,EAAA,WAAa,MAAA;;;;iBAWvC,aAAA,CAAc,OAAA;;;AAA9B;iBAOgB,kBAAA,CAAmB,OAAA"}
|
|
@@ -9,13 +9,10 @@ import { RadixRouter } from "radix3";
|
|
|
9
9
|
* - / → listTables
|
|
10
10
|
* - /:table → listTable
|
|
11
11
|
* - /:table/new → createRow
|
|
12
|
-
* - /:table/@schema → getSchema
|
|
13
12
|
* - /:table/:pk → readRow
|
|
14
|
-
* - /:table/:pk/@attr → listAttributes
|
|
15
|
-
* - /:table/:pk/@attr/:column → getAttribute
|
|
16
13
|
* - /:table/:pk/@meta → getMeta
|
|
17
|
-
* - /:table/:pk
|
|
18
|
-
* - /:table/:pk
|
|
14
|
+
* - /:table/:pk/.actions → listActions
|
|
15
|
+
* - /:table/:pk/.actions/:action → executeAction
|
|
19
16
|
*/
|
|
20
17
|
declare function createPathRouter(): RadixRouter<RouteData>;
|
|
21
18
|
/**
|
|
@@ -30,13 +27,13 @@ declare function matchPath(router: RadixRouter<RouteData>, path: string): RouteM
|
|
|
30
27
|
*/
|
|
31
28
|
declare function buildPath(table?: string, pk?: string, suffix?: string): string;
|
|
32
29
|
/**
|
|
33
|
-
* Checks if a path segment is a virtual path (@
|
|
30
|
+
* Checks if a path segment is a virtual path (@meta, .actions, .meta)
|
|
34
31
|
*/
|
|
35
32
|
declare function isVirtualPath(segment: string): boolean;
|
|
36
33
|
/**
|
|
37
34
|
* Gets the type of virtual path
|
|
38
35
|
*/
|
|
39
|
-
declare function getVirtualPathType(segment: string): "
|
|
36
|
+
declare function getVirtualPathType(segment: string): "meta" | "actions" | null;
|
|
40
37
|
//#endregion
|
|
41
38
|
export { buildPath, createPathRouter, getVirtualPathType, isVirtualPath, matchPath };
|
|
42
39
|
//# sourceMappingURL=path-router.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-router.d.mts","names":[],"sources":["../../src/router/path-router.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"path-router.d.mts","names":[],"sources":["../../src/router/path-router.ts"],"mappings":";;;;;AAiBA;;;;;AAyBA;;;;;;iBAzBgB,gBAAA,CAAA,GAAoB,WAAA,CAAY,SAAA;;;;;;;iBAyBhC,SAAA,CAAU,MAAA,EAAQ,WAAA,CAAY,SAAA,GAAY,IAAA,WAAe,UAAA;;AAazE;;iBAAgB,SAAA,CAAU,KAAA,WAAgB,EAAA,WAAa,MAAA;;;;iBAWvC,aAAA,CAAc,OAAA;;;AAA9B;iBAOgB,kBAAA,CAAmB,OAAA"}
|
|
@@ -8,26 +8,20 @@ import { createRouter } from "radix3";
|
|
|
8
8
|
* - / → listTables
|
|
9
9
|
* - /:table → listTable
|
|
10
10
|
* - /:table/new → createRow
|
|
11
|
-
* - /:table/@schema → getSchema
|
|
12
11
|
* - /:table/:pk → readRow
|
|
13
|
-
* - /:table/:pk/@attr → listAttributes
|
|
14
|
-
* - /:table/:pk/@attr/:column → getAttribute
|
|
15
12
|
* - /:table/:pk/@meta → getMeta
|
|
16
|
-
* - /:table/:pk
|
|
17
|
-
* - /:table/:pk
|
|
13
|
+
* - /:table/:pk/.actions → listActions
|
|
14
|
+
* - /:table/:pk/.actions/:action → executeAction
|
|
18
15
|
*/
|
|
19
16
|
function createPathRouter() {
|
|
20
17
|
return createRouter({ routes: {
|
|
21
18
|
"/": { action: "listTables" },
|
|
22
19
|
"/:table": { action: "listTable" },
|
|
23
20
|
"/:table/new": { action: "createRow" },
|
|
24
|
-
"/:table/@schema": { action: "getSchema" },
|
|
25
21
|
"/:table/:pk": { action: "readRow" },
|
|
26
|
-
"/:table/:pk/@attr": { action: "listAttributes" },
|
|
27
|
-
"/:table/:pk/@attr/:column": { action: "getAttribute" },
|
|
28
22
|
"/:table/:pk/@meta": { action: "getMeta" },
|
|
29
|
-
"/:table/:pk
|
|
30
|
-
"/:table/:pk
|
|
23
|
+
"/:table/:pk/.actions": { action: "listActions" },
|
|
24
|
+
"/:table/:pk/.actions/:action": { action: "executeAction" }
|
|
31
25
|
} });
|
|
32
26
|
}
|
|
33
27
|
/**
|
|
@@ -55,19 +49,17 @@ function buildPath(table, pk, suffix) {
|
|
|
55
49
|
return parts.join("/").replace(/\/+/g, "/");
|
|
56
50
|
}
|
|
57
51
|
/**
|
|
58
|
-
* Checks if a path segment is a virtual path (@
|
|
52
|
+
* Checks if a path segment is a virtual path (@meta, .actions, .meta)
|
|
59
53
|
*/
|
|
60
54
|
function isVirtualPath(segment) {
|
|
61
|
-
return segment.startsWith("@");
|
|
55
|
+
return segment.startsWith("@") || segment.startsWith(".");
|
|
62
56
|
}
|
|
63
57
|
/**
|
|
64
58
|
* Gets the type of virtual path
|
|
65
59
|
*/
|
|
66
60
|
function getVirtualPathType(segment) {
|
|
67
|
-
if (segment === "@attr") return "attr";
|
|
68
61
|
if (segment === "@meta") return "meta";
|
|
69
|
-
if (segment === "
|
|
70
|
-
if (segment === "@schema") return "schema";
|
|
62
|
+
if (segment === ".actions") return "actions";
|
|
71
63
|
return null;
|
|
72
64
|
}
|
|
73
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-router.mjs","names":[],"sources":["../../src/router/path-router.ts"],"sourcesContent":["import { createRouter, type RadixRouter } from \"radix3\";\nimport type { RouteData, RouteMatch, RouteParams } from \"./types.js\";\n\nexport type { RouteData };\n\n/**\n * Creates a radix3 router for SQLite AFS path routing\n *\n * Routes:\n * - / → listTables\n * - /:table → listTable\n * - /:table/new → createRow\n * - /:table
|
|
1
|
+
{"version":3,"file":"path-router.mjs","names":[],"sources":["../../src/router/path-router.ts"],"sourcesContent":["import { createRouter, type RadixRouter } from \"radix3\";\nimport type { RouteData, RouteMatch, RouteParams } from \"./types.js\";\n\nexport type { RouteData };\n\n/**\n * Creates a radix3 router for SQLite AFS path routing\n *\n * Routes:\n * - / → listTables\n * - /:table → listTable\n * - /:table/new → createRow\n * - /:table/:pk → readRow\n * - /:table/:pk/@meta → getMeta\n * - /:table/:pk/.actions → listActions\n * - /:table/:pk/.actions/:action → executeAction\n */\nexport function createPathRouter(): RadixRouter<RouteData> {\n return createRouter<RouteData>({\n routes: {\n // Root - list all tables\n \"/\": { action: \"listTables\" },\n\n // Table-level routes\n \"/:table\": { action: \"listTable\" },\n \"/:table/new\": { action: \"createRow\" },\n\n // Row-level routes\n \"/:table/:pk\": { action: \"readRow\" },\n \"/:table/:pk/@meta\": { action: \"getMeta\" },\n \"/:table/:pk/.actions\": { action: \"listActions\" },\n \"/:table/:pk/.actions/:action\": { action: \"executeAction\" },\n },\n });\n}\n\n/**\n * Parses a path and returns the matched route with params\n * @param router - The radix3 router instance\n * @param path - The path to match\n * @returns RouteMatch if matched, undefined otherwise\n */\nexport function matchPath(router: RadixRouter<RouteData>, path: string): RouteMatch | undefined {\n const result = router.lookup(path);\n if (!result) return undefined;\n\n return {\n action: result.action,\n params: (result.params ?? {}) as RouteParams,\n };\n}\n\n/**\n * Builds a path from components\n */\nexport function buildPath(table?: string, pk?: string, suffix?: string): string {\n const parts = [\"/\"];\n if (table) parts.push(table);\n if (pk) parts.push(pk);\n if (suffix) parts.push(suffix);\n return parts.join(\"/\").replace(/\\/+/g, \"/\");\n}\n\n/**\n * Checks if a path segment is a virtual path (@meta, .actions, .meta)\n */\nexport function isVirtualPath(segment: string): boolean {\n return segment.startsWith(\"@\") || segment.startsWith(\".\");\n}\n\n/**\n * Gets the type of virtual path\n */\nexport function getVirtualPathType(segment: string): \"meta\" | \"actions\" | null {\n if (segment === \"@meta\") return \"meta\";\n if (segment === \".actions\") return \"actions\";\n return null;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiBA,SAAgB,mBAA2C;AACzD,QAAO,aAAwB,EAC7B,QAAQ;EAEN,KAAK,EAAE,QAAQ,cAAc;EAG7B,WAAW,EAAE,QAAQ,aAAa;EAClC,eAAe,EAAE,QAAQ,aAAa;EAGtC,eAAe,EAAE,QAAQ,WAAW;EACpC,qBAAqB,EAAE,QAAQ,WAAW;EAC1C,wBAAwB,EAAE,QAAQ,eAAe;EACjD,gCAAgC,EAAE,QAAQ,iBAAiB;EAC5D,EACF,CAAC;;;;;;;;AASJ,SAAgB,UAAU,QAAgC,MAAsC;CAC9F,MAAM,SAAS,OAAO,OAAO,KAAK;AAClC,KAAI,CAAC,OAAQ,QAAO;AAEpB,QAAO;EACL,QAAQ,OAAO;EACf,QAAS,OAAO,UAAU,EAAE;EAC7B;;;;;AAMH,SAAgB,UAAU,OAAgB,IAAa,QAAyB;CAC9E,MAAM,QAAQ,CAAC,IAAI;AACnB,KAAI,MAAO,OAAM,KAAK,MAAM;AAC5B,KAAI,GAAI,OAAM,KAAK,GAAG;AACtB,KAAI,OAAQ,OAAM,KAAK,OAAO;AAC9B,QAAO,MAAM,KAAK,IAAI,CAAC,QAAQ,QAAQ,IAAI;;;;;AAM7C,SAAgB,cAAc,SAA0B;AACtD,QAAO,QAAQ,WAAW,IAAI,IAAI,QAAQ,WAAW,IAAI;;;;;AAM3D,SAAgB,mBAAmB,SAA4C;AAC7E,KAAI,YAAY,QAAS,QAAO;AAChC,KAAI,YAAY,WAAY,QAAO;AACnC,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/router/types.ts"],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/router/types.ts"],"mappings":";;AAGA;;KAAY,WAAA;;;AAeZ;UAAiB,SAAA;;EAEf,MAAA,EAAQ,WAAA;AAAA;AAMV;;;AAAA,UAAiB,UAAA,SAAmB,SAAA;EAClC,MAAA,EAAQ,WAAA;AAAA;;;;UAMO,WAAA;EAAW;EAE1B,KAAA;EAF0B;EAI1B,EAAA;EAAA;EAEA,MAAA;EAEA;EAAA,MAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/router/types.ts"],"mappings":";;AAGA
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/router/types.ts"],"mappings":";;AAGA;;KAAY,WAAA;;;AAeZ;UAAiB,SAAA;;EAEf,MAAA,EAAQ,WAAA;AAAA;AAMV;;;AAAA,UAAiB,UAAA,SAAmB,SAAA;EAClC,MAAA,EAAQ,WAAA;AAAA;;;;UAMO,WAAA;EAAW;EAE1B,KAAA;EAF0B;EAI1B,EAAA;EAAA;EAEA,MAAA;EAEA;EAAA,MAAA;AAAA"}
|
|
@@ -7,41 +7,41 @@ import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
|
7
7
|
*/
|
|
8
8
|
declare class SchemaIntrospector {
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Introspects all tables in the database
|
|
11
|
+
* @param db - Drizzle database instance
|
|
12
|
+
* @param options - Introspection options
|
|
13
|
+
* @returns Map of table name to TableSchema
|
|
14
|
+
*/
|
|
15
15
|
introspect(db: LibSQLDatabase, options?: {
|
|
16
16
|
/** Whitelist of tables to include */tables?: string[]; /** Tables to exclude */
|
|
17
17
|
excludeTables?: string[];
|
|
18
18
|
}): Promise<Map<string, TableSchema>>;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
* Introspects a single table
|
|
21
|
+
* @param db - Drizzle database instance
|
|
22
|
+
* @param tableName - Name of the table to introspect
|
|
23
|
+
* @returns TableSchema for the specified table
|
|
24
|
+
*/
|
|
25
25
|
introspectTable(db: LibSQLDatabase, tableName: string): Promise<TableSchema>;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
* Gets the primary key column name for a table
|
|
28
|
+
* Returns the first PK column, or 'rowid' if no explicit PK
|
|
29
|
+
*/
|
|
30
30
|
getPrimaryKeyColumn(schema: TableSchema): string;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Checks if a table has FTS (Full-Text Search) enabled
|
|
33
|
+
*/
|
|
34
34
|
hasFTS(db: LibSQLDatabase, tableName: string): Promise<boolean>;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* Creates FTS5 table for full-text search on specified columns
|
|
37
|
+
*/
|
|
38
38
|
createFTS(db: LibSQLDatabase, tableName: string, columns: string[], options?: {
|
|
39
39
|
/** Content table (defaults to tableName) */contentTable?: string; /** Content rowid column (defaults to 'rowid') */
|
|
40
40
|
contentRowid?: string;
|
|
41
41
|
}): Promise<void>;
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
* Rebuilds FTS index for a table (useful after bulk inserts)
|
|
44
|
+
*/
|
|
45
45
|
rebuildFTS(db: LibSQLDatabase, tableName: string): Promise<void>;
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"introspector.d.cts","names":[],"sources":["../../src/schema/introspector.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"introspector.d.cts","names":[],"sources":["../../src/schema/introspector.ts"],"mappings":";;;;;;AAwEA;cAAa,kBAAA;;;;;;;EAOL,UAAA,CACJ,EAAA,EAAI,cAAA,EACJ,OAAA;IAkD4D,qCAhD1D,MAAA,aAiGa;IA/Fb,aAAA;EAAA,IAED,OAAA,CAAQ,GAAA,SAAY,WAAA;EAuHpB;;;;;;EA3EG,eAAA,CAAgB,EAAA,EAAI,cAAA,EAAgB,SAAA,WAAoB,OAAA,CAAQ,WAAA;EAnDpE;;;;EAyFF,mBAAA,CAAoB,MAAA,EAAQ,WAAA;EAlFjB;;;EA6FL,MAAA,CAAO,EAAA,EAAI,cAAA,EAAgB,SAAA,WAAoB,OAAA;EAjD/B;;;EAiEhB,SAAA,CACJ,EAAA,EAAI,cAAA,EACJ,SAAA,UACA,OAAA,YACA,OAAA;IA/BF,4CAiCI,YAAA,WAjCgB;IAmChB,YAAA;EAAA,IAED,OAAA;EA1BU;;;EA6EP,UAAA,CAAW,EAAA,EAAI,cAAA,EAAgB,SAAA,WAAoB,OAAA;AAAA"}
|
|
@@ -7,41 +7,41 @@ import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
|
7
7
|
*/
|
|
8
8
|
declare class SchemaIntrospector {
|
|
9
9
|
/**
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
* Introspects all tables in the database
|
|
11
|
+
* @param db - Drizzle database instance
|
|
12
|
+
* @param options - Introspection options
|
|
13
|
+
* @returns Map of table name to TableSchema
|
|
14
|
+
*/
|
|
15
15
|
introspect(db: LibSQLDatabase, options?: {
|
|
16
16
|
/** Whitelist of tables to include */tables?: string[]; /** Tables to exclude */
|
|
17
17
|
excludeTables?: string[];
|
|
18
18
|
}): Promise<Map<string, TableSchema>>;
|
|
19
19
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
* Introspects a single table
|
|
21
|
+
* @param db - Drizzle database instance
|
|
22
|
+
* @param tableName - Name of the table to introspect
|
|
23
|
+
* @returns TableSchema for the specified table
|
|
24
|
+
*/
|
|
25
25
|
introspectTable(db: LibSQLDatabase, tableName: string): Promise<TableSchema>;
|
|
26
26
|
/**
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
* Gets the primary key column name for a table
|
|
28
|
+
* Returns the first PK column, or 'rowid' if no explicit PK
|
|
29
|
+
*/
|
|
30
30
|
getPrimaryKeyColumn(schema: TableSchema): string;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Checks if a table has FTS (Full-Text Search) enabled
|
|
33
|
+
*/
|
|
34
34
|
hasFTS(db: LibSQLDatabase, tableName: string): Promise<boolean>;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* Creates FTS5 table for full-text search on specified columns
|
|
37
|
+
*/
|
|
38
38
|
createFTS(db: LibSQLDatabase, tableName: string, columns: string[], options?: {
|
|
39
39
|
/** Content table (defaults to tableName) */contentTable?: string; /** Content rowid column (defaults to 'rowid') */
|
|
40
40
|
contentRowid?: string;
|
|
41
41
|
}): Promise<void>;
|
|
42
42
|
/**
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
* Rebuilds FTS index for a table (useful after bulk inserts)
|
|
44
|
+
*/
|
|
45
45
|
rebuildFTS(db: LibSQLDatabase, tableName: string): Promise<void>;
|
|
46
46
|
}
|
|
47
47
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"introspector.d.mts","names":[],"sources":["../../src/schema/introspector.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"introspector.d.mts","names":[],"sources":["../../src/schema/introspector.ts"],"mappings":";;;;;;AAwEA;cAAa,kBAAA;;;;;;;EAOL,UAAA,CACJ,EAAA,EAAI,cAAA,EACJ,OAAA;IAkD4D,qCAhD1D,MAAA,aAiGa;IA/Fb,aAAA;EAAA,IAED,OAAA,CAAQ,GAAA,SAAY,WAAA;EAuHpB;;;;;;EA3EG,eAAA,CAAgB,EAAA,EAAI,cAAA,EAAgB,SAAA,WAAoB,OAAA,CAAQ,WAAA;EAnDpE;;;;EAyFF,mBAAA,CAAoB,MAAA,EAAQ,WAAA;EAlFjB;;;EA6FL,MAAA,CAAO,EAAA,EAAI,cAAA,EAAgB,SAAA,WAAoB,OAAA;EAjD/B;;;EAiEhB,SAAA,CACJ,EAAA,EAAI,cAAA,EACJ,SAAA,UACA,OAAA,YACA,OAAA;IA/BF,4CAiCI,YAAA,WAjCgB;IAmChB,YAAA;EAAA,IAED,OAAA;EA1BU;;;EA6EP,UAAA,CAAW,EAAA,EAAI,cAAA,EAAgB,SAAA,WAAoB,OAAA;AAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
const require_types = require('./types.cjs');
|
|
2
|
+
const require_introspector = require('./introspector.cjs');
|
|
3
|
+
let _aigne_sqlite = require("@aigne/sqlite");
|
|
4
|
+
|
|
5
|
+
//#region src/schema/service.ts
|
|
6
|
+
/**
|
|
7
|
+
* Executes a raw SQL query and returns all rows
|
|
8
|
+
*/
|
|
9
|
+
async function execAll(db, query) {
|
|
10
|
+
return db.all(_aigne_sqlite.sql.raw(query)).execute();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Schema service that queries schema on-demand (no caching)
|
|
14
|
+
*
|
|
15
|
+
* SQLite PRAGMA queries are extremely fast, so real-time queries
|
|
16
|
+
* are preferred over caching to avoid staleness issues.
|
|
17
|
+
*/
|
|
18
|
+
var SchemaService = class {
|
|
19
|
+
introspector = new require_introspector.SchemaIntrospector();
|
|
20
|
+
constructor(db, options) {
|
|
21
|
+
this.db = db;
|
|
22
|
+
this.options = options;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets schema for a specific table (real-time query)
|
|
26
|
+
*/
|
|
27
|
+
async getSchema(tableName) {
|
|
28
|
+
if (!tableName) return;
|
|
29
|
+
if (require_types.SYSTEM_TABLES.includes(tableName)) return;
|
|
30
|
+
if (this.options?.tables && !this.options.tables.includes(tableName)) return;
|
|
31
|
+
if (this.options?.excludeTables?.includes(tableName)) return;
|
|
32
|
+
if (!await this.hasTable(tableName)) return;
|
|
33
|
+
return this.introspector.introspectTable(this.db, tableName);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Checks if a table exists (real-time query)
|
|
37
|
+
*/
|
|
38
|
+
async hasTable(tableName) {
|
|
39
|
+
if (!tableName) return false;
|
|
40
|
+
if (require_types.SYSTEM_TABLES.includes(tableName)) return false;
|
|
41
|
+
if (this.options?.tables && !this.options.tables.includes(tableName)) return false;
|
|
42
|
+
if (this.options?.excludeTables?.includes(tableName)) return false;
|
|
43
|
+
return ((await execAll(this.db, `SELECT COUNT(*) as count FROM sqlite_master WHERE type = 'table' AND name = '${tableName.replace(/'/g, "''")}'`))[0]?.count ?? 0) > 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets all table schemas (real-time query)
|
|
47
|
+
*/
|
|
48
|
+
async getAllSchemas() {
|
|
49
|
+
return this.introspector.introspect(this.db, {
|
|
50
|
+
tables: this.options?.tables,
|
|
51
|
+
excludeTables: this.options?.excludeTables
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Lists all table names (real-time query)
|
|
56
|
+
*/
|
|
57
|
+
async listTableNames() {
|
|
58
|
+
return (await execAll(this.db, `
|
|
59
|
+
SELECT name FROM sqlite_master
|
|
60
|
+
WHERE type = 'table'
|
|
61
|
+
AND name NOT LIKE 'sqlite_%'
|
|
62
|
+
AND name NOT LIKE '%_fts%'
|
|
63
|
+
ORDER BY name
|
|
64
|
+
`)).map((r) => r.name).filter((name) => {
|
|
65
|
+
if (require_types.SYSTEM_TABLES.includes(name)) return false;
|
|
66
|
+
if (this.options?.tables && !this.options.tables.includes(name)) return false;
|
|
67
|
+
if (this.options?.excludeTables?.includes(name)) return false;
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the count of tables
|
|
73
|
+
*/
|
|
74
|
+
async getTableCount() {
|
|
75
|
+
return (await this.listTableNames()).length;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets the primary key column name for a table
|
|
79
|
+
*/
|
|
80
|
+
getPrimaryKeyColumn(schema) {
|
|
81
|
+
return this.introspector.getPrimaryKeyColumn(schema);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
exports.SchemaService = SchemaService;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TableSchema } from "./types.cjs";
|
|
2
|
+
import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
+
|
|
4
|
+
//#region src/schema/service.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Options for schema service
|
|
7
|
+
*/
|
|
8
|
+
interface SchemaServiceOptions {
|
|
9
|
+
/** Whitelist of tables to include */
|
|
10
|
+
tables?: string[];
|
|
11
|
+
/** Tables to exclude */
|
|
12
|
+
excludeTables?: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Schema service that queries schema on-demand (no caching)
|
|
16
|
+
*
|
|
17
|
+
* SQLite PRAGMA queries are extremely fast, so real-time queries
|
|
18
|
+
* are preferred over caching to avoid staleness issues.
|
|
19
|
+
*/
|
|
20
|
+
declare class SchemaService {
|
|
21
|
+
private db;
|
|
22
|
+
private options?;
|
|
23
|
+
private introspector;
|
|
24
|
+
constructor(db: LibSQLDatabase, options?: SchemaServiceOptions | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* Gets schema for a specific table (real-time query)
|
|
27
|
+
*/
|
|
28
|
+
getSchema(tableName: string): Promise<TableSchema | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a table exists (real-time query)
|
|
31
|
+
*/
|
|
32
|
+
hasTable(tableName: string): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Gets all table schemas (real-time query)
|
|
35
|
+
*/
|
|
36
|
+
getAllSchemas(): Promise<Map<string, TableSchema>>;
|
|
37
|
+
/**
|
|
38
|
+
* Lists all table names (real-time query)
|
|
39
|
+
*/
|
|
40
|
+
listTableNames(): Promise<string[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the count of tables
|
|
43
|
+
*/
|
|
44
|
+
getTableCount(): Promise<number>;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the primary key column name for a table
|
|
47
|
+
*/
|
|
48
|
+
getPrimaryKeyColumn(schema: TableSchema): string;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { SchemaService, SchemaServiceOptions };
|
|
52
|
+
//# sourceMappingURL=service.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.cts","names":[],"sources":["../../src/schema/service.ts"],"mappings":";;;;;;AAeA;UAAiB,oBAAA;;EAEf,MAAA;EAEa;EAAb,aAAA;AAAA;;;;;;;cASW,aAAA;EAAA,QAID,EAAA;EAAA,QACA,OAAA;EAAA,QAJF,YAAA;cAGE,EAAA,EAAI,cAAA,EACJ,OAAA,GAAU,oBAAA;EA0HQ;;;EApHtB,SAAA,CAAU,SAAA,WAAoB,OAAA,CAAQ,WAAA;EANlC;;;EAuCJ,QAAA,CAAS,SAAA,WAAoB,OAAA;EAxCzB;;;EAuEJ,aAAA,CAAA,GAAiB,OAAA,CAAQ,GAAA,SAAY,WAAA;EAhE3B;;;EA0EV,cAAA,CAAA,GAAkB,OAAA;EAzCT;;;EA2ET,aAAA,CAAA,GAAiB,OAAA;EA5CQ;;;EAoD/B,mBAAA,CAAoB,MAAA,EAAQ,WAAA;AAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { TableSchema } from "./types.mjs";
|
|
2
|
+
import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
3
|
+
|
|
4
|
+
//#region src/schema/service.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Options for schema service
|
|
7
|
+
*/
|
|
8
|
+
interface SchemaServiceOptions {
|
|
9
|
+
/** Whitelist of tables to include */
|
|
10
|
+
tables?: string[];
|
|
11
|
+
/** Tables to exclude */
|
|
12
|
+
excludeTables?: string[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Schema service that queries schema on-demand (no caching)
|
|
16
|
+
*
|
|
17
|
+
* SQLite PRAGMA queries are extremely fast, so real-time queries
|
|
18
|
+
* are preferred over caching to avoid staleness issues.
|
|
19
|
+
*/
|
|
20
|
+
declare class SchemaService {
|
|
21
|
+
private db;
|
|
22
|
+
private options?;
|
|
23
|
+
private introspector;
|
|
24
|
+
constructor(db: LibSQLDatabase, options?: SchemaServiceOptions | undefined);
|
|
25
|
+
/**
|
|
26
|
+
* Gets schema for a specific table (real-time query)
|
|
27
|
+
*/
|
|
28
|
+
getSchema(tableName: string): Promise<TableSchema | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Checks if a table exists (real-time query)
|
|
31
|
+
*/
|
|
32
|
+
hasTable(tableName: string): Promise<boolean>;
|
|
33
|
+
/**
|
|
34
|
+
* Gets all table schemas (real-time query)
|
|
35
|
+
*/
|
|
36
|
+
getAllSchemas(): Promise<Map<string, TableSchema>>;
|
|
37
|
+
/**
|
|
38
|
+
* Lists all table names (real-time query)
|
|
39
|
+
*/
|
|
40
|
+
listTableNames(): Promise<string[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Gets the count of tables
|
|
43
|
+
*/
|
|
44
|
+
getTableCount(): Promise<number>;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the primary key column name for a table
|
|
47
|
+
*/
|
|
48
|
+
getPrimaryKeyColumn(schema: TableSchema): string;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { SchemaService, SchemaServiceOptions };
|
|
52
|
+
//# sourceMappingURL=service.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.mts","names":[],"sources":["../../src/schema/service.ts"],"mappings":";;;;;;AAeA;UAAiB,oBAAA;;EAEf,MAAA;EAEa;EAAb,aAAA;AAAA;;;;;;;cASW,aAAA;EAAA,QAID,EAAA;EAAA,QACA,OAAA;EAAA,QAJF,YAAA;cAGE,EAAA,EAAI,cAAA,EACJ,OAAA,GAAU,oBAAA;EA0HQ;;;EApHtB,SAAA,CAAU,SAAA,WAAoB,OAAA,CAAQ,WAAA;EANlC;;;EAuCJ,QAAA,CAAS,SAAA,WAAoB,OAAA;EAxCzB;;;EAuEJ,aAAA,CAAA,GAAiB,OAAA,CAAQ,GAAA,SAAY,WAAA;EAhE3B;;;EA0EV,cAAA,CAAA,GAAkB,OAAA;EAzCT;;;EA2ET,aAAA,CAAA,GAAiB,OAAA;EA5CQ;;;EAoD/B,mBAAA,CAAoB,MAAA,EAAQ,WAAA;AAAA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { SYSTEM_TABLES } from "./types.mjs";
|
|
2
|
+
import { SchemaIntrospector } from "./introspector.mjs";
|
|
3
|
+
import { sql } from "@aigne/sqlite";
|
|
4
|
+
|
|
5
|
+
//#region src/schema/service.ts
|
|
6
|
+
/**
|
|
7
|
+
* Executes a raw SQL query and returns all rows
|
|
8
|
+
*/
|
|
9
|
+
async function execAll(db, query) {
|
|
10
|
+
return db.all(sql.raw(query)).execute();
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Schema service that queries schema on-demand (no caching)
|
|
14
|
+
*
|
|
15
|
+
* SQLite PRAGMA queries are extremely fast, so real-time queries
|
|
16
|
+
* are preferred over caching to avoid staleness issues.
|
|
17
|
+
*/
|
|
18
|
+
var SchemaService = class {
|
|
19
|
+
introspector = new SchemaIntrospector();
|
|
20
|
+
constructor(db, options) {
|
|
21
|
+
this.db = db;
|
|
22
|
+
this.options = options;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets schema for a specific table (real-time query)
|
|
26
|
+
*/
|
|
27
|
+
async getSchema(tableName) {
|
|
28
|
+
if (!tableName) return;
|
|
29
|
+
if (SYSTEM_TABLES.includes(tableName)) return;
|
|
30
|
+
if (this.options?.tables && !this.options.tables.includes(tableName)) return;
|
|
31
|
+
if (this.options?.excludeTables?.includes(tableName)) return;
|
|
32
|
+
if (!await this.hasTable(tableName)) return;
|
|
33
|
+
return this.introspector.introspectTable(this.db, tableName);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Checks if a table exists (real-time query)
|
|
37
|
+
*/
|
|
38
|
+
async hasTable(tableName) {
|
|
39
|
+
if (!tableName) return false;
|
|
40
|
+
if (SYSTEM_TABLES.includes(tableName)) return false;
|
|
41
|
+
if (this.options?.tables && !this.options.tables.includes(tableName)) return false;
|
|
42
|
+
if (this.options?.excludeTables?.includes(tableName)) return false;
|
|
43
|
+
return ((await execAll(this.db, `SELECT COUNT(*) as count FROM sqlite_master WHERE type = 'table' AND name = '${tableName.replace(/'/g, "''")}'`))[0]?.count ?? 0) > 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets all table schemas (real-time query)
|
|
47
|
+
*/
|
|
48
|
+
async getAllSchemas() {
|
|
49
|
+
return this.introspector.introspect(this.db, {
|
|
50
|
+
tables: this.options?.tables,
|
|
51
|
+
excludeTables: this.options?.excludeTables
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Lists all table names (real-time query)
|
|
56
|
+
*/
|
|
57
|
+
async listTableNames() {
|
|
58
|
+
return (await execAll(this.db, `
|
|
59
|
+
SELECT name FROM sqlite_master
|
|
60
|
+
WHERE type = 'table'
|
|
61
|
+
AND name NOT LIKE 'sqlite_%'
|
|
62
|
+
AND name NOT LIKE '%_fts%'
|
|
63
|
+
ORDER BY name
|
|
64
|
+
`)).map((r) => r.name).filter((name) => {
|
|
65
|
+
if (SYSTEM_TABLES.includes(name)) return false;
|
|
66
|
+
if (this.options?.tables && !this.options.tables.includes(name)) return false;
|
|
67
|
+
if (this.options?.excludeTables?.includes(name)) return false;
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Gets the count of tables
|
|
73
|
+
*/
|
|
74
|
+
async getTableCount() {
|
|
75
|
+
return (await this.listTableNames()).length;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Gets the primary key column name for a table
|
|
79
|
+
*/
|
|
80
|
+
getPrimaryKeyColumn(schema) {
|
|
81
|
+
return this.introspector.getPrimaryKeyColumn(schema);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { SchemaService };
|
|
87
|
+
//# sourceMappingURL=service.mjs.map
|