@aigne/afs-sqlite 1.11.0-beta.7 → 1.11.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.mjs +7 -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/sqlite-afs.cjs +21 -0
- package/dist/sqlite-afs.d.cts +22 -45
- package/dist/sqlite-afs.d.cts.map +1 -1
- package/dist/sqlite-afs.d.mts +22 -45
- package/dist/sqlite-afs.d.mts.map +1 -1
- package/dist/sqlite-afs.mjs +22 -0
- package/dist/sqlite-afs.mjs.map +1 -1
- package/package.json +4 -4
package/dist/config.cjs
CHANGED
|
@@ -7,7 +7,7 @@ let zod = require("zod");
|
|
|
7
7
|
*/
|
|
8
8
|
const ftsConfigSchema = zod.z.object({
|
|
9
9
|
enabled: zod.z.boolean().default(true).describe("Whether FTS is enabled"),
|
|
10
|
-
tables: zod.z.record(zod.z.array(zod.z.string())).optional().describe("Map of table name to columns to index for FTS")
|
|
10
|
+
tables: zod.z.record(zod.z.string(), zod.z.array(zod.z.string())).optional().describe("Map of table name to columns to index for FTS")
|
|
11
11
|
}).optional();
|
|
12
12
|
/**
|
|
13
13
|
* SQLite AFS module configuration schema
|
package/dist/config.d.cts
CHANGED
|
@@ -9,45 +9,18 @@ declare const sqliteAFSConfigSchema: z.ZodObject<{
|
|
|
9
9
|
url: z.ZodString;
|
|
10
10
|
name: z.ZodOptional<z.ZodString>;
|
|
11
11
|
description: z.ZodOptional<z.ZodString>;
|
|
12
|
-
accessMode: z.ZodOptional<z.ZodEnum<
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
accessMode: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
readonly: "readonly";
|
|
14
|
+
readwrite: "readwrite";
|
|
15
|
+
}>>;
|
|
16
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
|
+
excludeTables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
18
|
fts: z.ZodOptional<z.ZodObject<{
|
|
16
19
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString
|
|
18
|
-
},
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
tables?: Record<string, string[]> | undefined;
|
|
21
|
-
}, {
|
|
22
|
-
tables?: Record<string, string[]> | undefined;
|
|
23
|
-
enabled?: boolean | undefined;
|
|
24
|
-
}>>;
|
|
20
|
+
tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
25
22
|
wal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
26
|
-
},
|
|
27
|
-
url: string;
|
|
28
|
-
wal: boolean;
|
|
29
|
-
name?: string | undefined;
|
|
30
|
-
description?: string | undefined;
|
|
31
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
32
|
-
tables?: string[] | undefined;
|
|
33
|
-
excludeTables?: string[] | undefined;
|
|
34
|
-
fts?: {
|
|
35
|
-
enabled: boolean;
|
|
36
|
-
tables?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
}, {
|
|
39
|
-
url: string;
|
|
40
|
-
name?: string | undefined;
|
|
41
|
-
description?: string | undefined;
|
|
42
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
43
|
-
tables?: string[] | undefined;
|
|
44
|
-
excludeTables?: string[] | undefined;
|
|
45
|
-
fts?: {
|
|
46
|
-
tables?: Record<string, string[]> | undefined;
|
|
47
|
-
enabled?: boolean | undefined;
|
|
48
|
-
} | undefined;
|
|
49
|
-
wal?: boolean | undefined;
|
|
50
|
-
}>;
|
|
23
|
+
}, z.core.$strip>;
|
|
51
24
|
/**
|
|
52
25
|
* SQLite AFS module configuration type
|
|
53
26
|
*/
|
package/dist/config.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;cAmBa,qBAAA,EAAqB,CAAA,CAAA,SAAA
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;cAmBa,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;KAiBtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;;;;UAK5B,gBAAA;EAtBiB;EAwBhC,GAAA;EAxBgC;EA0BhC,IAAA;;EAEA,WAAA;;EAEA,UAAA,GAAa,aAAA;;EAEb,MAAA;;EAEA,aAAA;;EAEA,GAAA;IACE,OAAA;IACA,MAAA,GAAS,MAAA;EAAA;;EAGX,GAAA;AAAA"}
|
package/dist/config.d.mts
CHANGED
|
@@ -9,45 +9,18 @@ declare const sqliteAFSConfigSchema: z.ZodObject<{
|
|
|
9
9
|
url: z.ZodString;
|
|
10
10
|
name: z.ZodOptional<z.ZodString>;
|
|
11
11
|
description: z.ZodOptional<z.ZodString>;
|
|
12
|
-
accessMode: z.ZodOptional<z.ZodEnum<
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
accessMode: z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
readonly: "readonly";
|
|
14
|
+
readwrite: "readwrite";
|
|
15
|
+
}>>;
|
|
16
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
17
|
+
excludeTables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
15
18
|
fts: z.ZodOptional<z.ZodObject<{
|
|
16
19
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
-
tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString
|
|
18
|
-
},
|
|
19
|
-
enabled: boolean;
|
|
20
|
-
tables?: Record<string, string[]> | undefined;
|
|
21
|
-
}, {
|
|
22
|
-
tables?: Record<string, string[]> | undefined;
|
|
23
|
-
enabled?: boolean | undefined;
|
|
24
|
-
}>>;
|
|
20
|
+
tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
21
|
+
}, z.core.$strip>>;
|
|
25
22
|
wal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
26
|
-
},
|
|
27
|
-
url: string;
|
|
28
|
-
wal: boolean;
|
|
29
|
-
name?: string | undefined;
|
|
30
|
-
description?: string | undefined;
|
|
31
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
32
|
-
tables?: string[] | undefined;
|
|
33
|
-
excludeTables?: string[] | undefined;
|
|
34
|
-
fts?: {
|
|
35
|
-
enabled: boolean;
|
|
36
|
-
tables?: Record<string, string[]> | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
}, {
|
|
39
|
-
url: string;
|
|
40
|
-
name?: string | undefined;
|
|
41
|
-
description?: string | undefined;
|
|
42
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
43
|
-
tables?: string[] | undefined;
|
|
44
|
-
excludeTables?: string[] | undefined;
|
|
45
|
-
fts?: {
|
|
46
|
-
tables?: Record<string, string[]> | undefined;
|
|
47
|
-
enabled?: boolean | undefined;
|
|
48
|
-
} | undefined;
|
|
49
|
-
wal?: boolean | undefined;
|
|
50
|
-
}>;
|
|
23
|
+
}, z.core.$strip>;
|
|
51
24
|
/**
|
|
52
25
|
* SQLite AFS module configuration type
|
|
53
26
|
*/
|
package/dist/config.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;cAmBa,qBAAA,EAAqB,CAAA,CAAA,SAAA
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;;;cAmBa,qBAAA,EAAqB,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;KAiBtB,eAAA,GAAkB,CAAA,CAAE,KAAA,QAAa,qBAAA;;;;UAK5B,gBAAA;EAtBiB;EAwBhC,GAAA;EAxBgC;EA0BhC,IAAA;;EAEA,WAAA;;EAEA,UAAA,GAAa,aAAA;;EAEb,MAAA;;EAEA,aAAA;;EAEA,GAAA;IACE,OAAA;IACA,MAAA,GAAS,MAAA;EAAA;;EAGX,GAAA;AAAA"}
|
package/dist/config.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { z } from "zod";
|
|
|
7
7
|
*/
|
|
8
8
|
const ftsConfigSchema = z.object({
|
|
9
9
|
enabled: z.boolean().default(true).describe("Whether FTS is enabled"),
|
|
10
|
-
tables: z.record(z.array(z.string())).optional().describe("Map of table name to columns to index for FTS")
|
|
10
|
+
tables: z.record(z.string(), z.array(z.string())).optional().describe("Map of table name to columns to index for FTS")
|
|
11
11
|
}).optional();
|
|
12
12
|
/**
|
|
13
13
|
* SQLite AFS module configuration schema
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import { type AFSAccessMode, accessModeSchema } from \"@aigne/afs\";\nimport { z } from \"zod\";\n\n/**\n * FTS (Full-Text Search) configuration schema\n */\nexport const ftsConfigSchema = z\n .object({\n enabled: z.boolean().default(true).describe(\"Whether FTS is enabled\"),\n tables: z\n .record(z.array(z.string()))\n .optional()\n .describe(\"Map of table name to columns to index for FTS\"),\n })\n .optional();\n\n/**\n * SQLite AFS module configuration schema\n */\nexport const sqliteAFSConfigSchema = z.object({\n url: z.string().describe(\"SQLite database URL (file:./path or :memory:)\"),\n name: z.string().optional().describe(\"Module name, defaults to 'sqlite-afs'\"),\n description: z.string().optional().describe(\"Description of this module\"),\n accessMode: accessModeSchema,\n tables: z\n .array(z.string())\n .optional()\n .describe(\"Whitelist of tables to expose (if not specified, all tables are exposed)\"),\n excludeTables: z.array(z.string()).optional().describe(\"Tables to exclude from exposure\"),\n fts: ftsConfigSchema,\n wal: z.boolean().optional().default(true).describe(\"Enable WAL mode for better concurrency\"),\n});\n\n/**\n * SQLite AFS module configuration type\n */\nexport type SQLiteAFSConfig = z.infer<typeof sqliteAFSConfigSchema>;\n\n/**\n * SQLite AFS module options (after parsing)\n */\nexport interface SQLiteAFSOptions {\n /** SQLite database URL */\n url: string;\n /** Module name */\n name?: string;\n /** Module description */\n description?: string;\n /** Access mode */\n accessMode?: AFSAccessMode;\n /** Tables to expose */\n tables?: string[];\n /** Tables to exclude */\n excludeTables?: string[];\n /** FTS configuration */\n fts?: {\n enabled?: boolean;\n tables?: Record<string, string[]>;\n };\n /** Enable WAL mode */\n wal?: boolean;\n}\n"],"mappings":";;;;;;;AAMA,MAAa,kBAAkB,EAC5B,OAAO;CACN,SAAS,EAAE,SAAS,CAAC,QAAQ,KAAK,CAAC,SAAS,yBAAyB;CACrE,QAAQ,EACL,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import { type AFSAccessMode, accessModeSchema } from \"@aigne/afs\";\nimport { z } from \"zod\";\n\n/**\n * FTS (Full-Text Search) configuration schema\n */\nexport const ftsConfigSchema = z\n .object({\n enabled: z.boolean().default(true).describe(\"Whether FTS is enabled\"),\n tables: z\n .record(z.string(), z.array(z.string()))\n .optional()\n .describe(\"Map of table name to columns to index for FTS\"),\n })\n .optional();\n\n/**\n * SQLite AFS module configuration schema\n */\nexport const sqliteAFSConfigSchema = z.object({\n url: z.string().describe(\"SQLite database URL (file:./path or :memory:)\"),\n name: z.string().optional().describe(\"Module name, defaults to 'sqlite-afs'\"),\n description: z.string().optional().describe(\"Description of this module\"),\n accessMode: accessModeSchema,\n tables: z\n .array(z.string())\n .optional()\n .describe(\"Whitelist of tables to expose (if not specified, all tables are exposed)\"),\n excludeTables: z.array(z.string()).optional().describe(\"Tables to exclude from exposure\"),\n fts: ftsConfigSchema,\n wal: z.boolean().optional().default(true).describe(\"Enable WAL mode for better concurrency\"),\n});\n\n/**\n * SQLite AFS module configuration type\n */\nexport type SQLiteAFSConfig = z.infer<typeof sqliteAFSConfigSchema>;\n\n/**\n * SQLite AFS module options (after parsing)\n */\nexport interface SQLiteAFSOptions {\n /** SQLite database URL */\n url: string;\n /** Module name */\n name?: string;\n /** Module description */\n description?: string;\n /** Access mode */\n accessMode?: AFSAccessMode;\n /** Tables to expose */\n tables?: string[];\n /** Tables to exclude */\n excludeTables?: string[];\n /** FTS configuration */\n fts?: {\n enabled?: boolean;\n tables?: Record<string, string[]>;\n };\n /** Enable WAL mode */\n wal?: boolean;\n}\n"],"mappings":";;;;;;;AAMA,MAAa,kBAAkB,EAC5B,OAAO;CACN,SAAS,EAAE,SAAS,CAAC,QAAQ,KAAK,CAAC,SAAS,yBAAyB;CACrE,QAAQ,EACL,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CACvC,UAAU,CACV,SAAS,gDAAgD;CAC7D,CAAC,CACD,UAAU;;;;AAKb,MAAa,wBAAwB,EAAE,OAAO;CAC5C,KAAK,EAAE,QAAQ,CAAC,SAAS,gDAAgD;CACzE,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,wCAAwC;CAC7E,aAAa,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,6BAA6B;CACzE,YAAY;CACZ,QAAQ,EACL,MAAM,EAAE,QAAQ,CAAC,CACjB,UAAU,CACV,SAAS,2EAA2E;CACvF,eAAe,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU,CAAC,SAAS,kCAAkC;CACzF,KAAK;CACL,KAAK,EAAE,SAAS,CAAC,UAAU,CAAC,QAAQ,KAAK,CAAC,SAAS,yCAAyC;CAC7F,CAAC"}
|
package/dist/sqlite-afs.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const require_service = require('./schema/service.cjs');
|
|
|
8
8
|
const require_decorate = require('./_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs');
|
|
9
9
|
let _aigne_sqlite = require("@aigne/sqlite");
|
|
10
10
|
let _aigne_afs = require("@aigne/afs");
|
|
11
|
+
let zod = require("zod");
|
|
11
12
|
let _aigne_afs_provider = require("@aigne/afs/provider");
|
|
12
13
|
|
|
13
14
|
//#region src/sqlite-afs.ts
|
|
@@ -31,6 +32,16 @@ var SQLiteAFS = class SQLiteAFS extends _aigne_afs_provider.AFSBaseProvider {
|
|
|
31
32
|
constructor(options) {
|
|
32
33
|
super();
|
|
33
34
|
this.options = options;
|
|
35
|
+
if (options.localPath && !options.url) options.url = `file:${options.localPath}`;
|
|
36
|
+
if (options.url.startsWith("file:")) {
|
|
37
|
+
const { existsSync, mkdirSync, writeFileSync } = require("node:fs");
|
|
38
|
+
const { dirname } = require("node:path");
|
|
39
|
+
const dbPath = options.url.slice(5);
|
|
40
|
+
if (!existsSync(dbPath)) {
|
|
41
|
+
mkdirSync(dirname(dbPath), { recursive: true });
|
|
42
|
+
writeFileSync(dbPath, "");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
34
45
|
this.name = options.name ?? "sqlite-afs";
|
|
35
46
|
this.description = options.description ?? `SQLite database: ${options.url}`;
|
|
36
47
|
this.accessMode = options.accessMode ?? "readwrite";
|
|
@@ -44,6 +55,16 @@ var SQLiteAFS = class SQLiteAFS extends _aigne_afs_provider.AFSBaseProvider {
|
|
|
44
55
|
static schema() {
|
|
45
56
|
return require_config.sqliteAFSConfigSchema;
|
|
46
57
|
}
|
|
58
|
+
static manifest() {
|
|
59
|
+
return {
|
|
60
|
+
name: "sqlite",
|
|
61
|
+
description: "Mount a SQLite database as a virtual filesystem",
|
|
62
|
+
uriTemplate: "sqlite://{localPath+}",
|
|
63
|
+
category: "database",
|
|
64
|
+
schema: zod.z.object({ localPath: zod.z.string() }),
|
|
65
|
+
tags: ["sqlite", "database"]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
47
68
|
/**
|
|
48
69
|
* Loads a module instance from configuration
|
|
49
70
|
*/
|
package/dist/sqlite-afs.d.cts
CHANGED
|
@@ -2,8 +2,8 @@ import { TableSchema } from "./schema/types.cjs";
|
|
|
2
2
|
import { ActionContext } from "./actions/types.cjs";
|
|
3
3
|
import { SQLiteAFSOptions } from "./config.cjs";
|
|
4
4
|
import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
5
|
-
import { AFSAccessMode, AFSDeleteResult, AFSEntry, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSSearchOptions, AFSStatResult, AFSWriteEntryPayload } from "@aigne/afs";
|
|
6
|
-
import
|
|
5
|
+
import { AFSAccessMode, AFSDeleteResult, AFSEntry, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSSearchOptions, AFSStatResult, AFSWriteEntryPayload, ProviderManifest } from "@aigne/afs";
|
|
6
|
+
import { z } from "zod";
|
|
7
7
|
import { AFSBaseProvider, RouteContext } from "@aigne/afs/provider";
|
|
8
8
|
|
|
9
9
|
//#region src/sqlite-afs.d.ts
|
|
@@ -25,53 +25,30 @@ declare class SQLiteAFS extends AFSBaseProvider {
|
|
|
25
25
|
private actions;
|
|
26
26
|
private ftsConfig;
|
|
27
27
|
private initialized;
|
|
28
|
-
constructor(options: SQLiteAFSOptions
|
|
28
|
+
constructor(options: SQLiteAFSOptions & {
|
|
29
|
+
localPath?: string;
|
|
30
|
+
uri?: string;
|
|
31
|
+
});
|
|
29
32
|
/**
|
|
30
33
|
* Returns the Zod schema for configuration validation
|
|
31
34
|
*/
|
|
32
|
-
static schema():
|
|
33
|
-
url:
|
|
34
|
-
name:
|
|
35
|
-
description:
|
|
36
|
-
accessMode:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
fts: zod0.ZodOptional<zod0.ZodObject<{
|
|
40
|
-
enabled: zod0.ZodDefault<zod0.ZodBoolean>;
|
|
41
|
-
tables: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString, "many">>>;
|
|
42
|
-
}, "strip", zod0.ZodTypeAny, {
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
tables?: Record<string, string[]> | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
tables?: Record<string, string[]> | undefined;
|
|
47
|
-
enabled?: boolean | undefined;
|
|
35
|
+
static schema(): z.ZodObject<{
|
|
36
|
+
url: z.ZodString;
|
|
37
|
+
name: z.ZodOptional<z.ZodString>;
|
|
38
|
+
description: z.ZodOptional<z.ZodString>;
|
|
39
|
+
accessMode: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
readonly: "readonly";
|
|
41
|
+
readwrite: "readwrite";
|
|
48
42
|
}>>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
fts?: {
|
|
59
|
-
enabled: boolean;
|
|
60
|
-
tables?: Record<string, string[]> | undefined;
|
|
61
|
-
} | undefined;
|
|
62
|
-
}, {
|
|
63
|
-
url: string;
|
|
64
|
-
name?: string | undefined;
|
|
65
|
-
description?: string | undefined;
|
|
66
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
67
|
-
tables?: string[] | undefined;
|
|
68
|
-
excludeTables?: string[] | undefined;
|
|
69
|
-
fts?: {
|
|
70
|
-
tables?: Record<string, string[]> | undefined;
|
|
71
|
-
enabled?: boolean | undefined;
|
|
72
|
-
} | undefined;
|
|
73
|
-
wal?: boolean | undefined;
|
|
74
|
-
}>;
|
|
43
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
+
excludeTables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
fts: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
47
|
+
tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
wal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
static manifest(): ProviderManifest;
|
|
75
52
|
/**
|
|
76
53
|
* Loads a module instance from configuration
|
|
77
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-afs.d.cts","names":[],"sources":["../src/sqlite-afs.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqlite-afs.d.cts","names":[],"sources":["../src/sqlite-afs.ts"],"mappings":";;;;;;;;;;AAsDA;;;;;cAAa,SAAA,SAAkB,eAAA;EAAA,QAaT,OAAA;EAAA,SAZF,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA,EAAY,aAAA;EAAA,QAEtB,EAAA;EAAA,QACA,aAAA;EAAA,QACA,IAAA;EAAA,QACA,SAAA;EAAA,QACA,OAAA;EAAA,QACA,SAAA;EAAA,QACA,WAAA;cAEY,OAAA,EAAS,gBAAA;IAAqB,SAAA;IAAoB,GAAA;EAAA;;;;SA+B/D,MAAA,CAAA,GAAM,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;SAIN,QAAA,CAAA,GAAY,gBAAA;EAiE0B;;;EAAA,OAnDhC,IAAA,CAAA;IAAO;EAAA,IAAU,mBAAA,GAA2B,OAAA,CAAQ,SAAA;EA8EvC;;;EAAA,QAtEZ,UAAA;EAuFH;;;;;EAzDL,iBAAA,CAAA,GAAqB,OAAA;EA2G+B;;;;EA9FpD,iBAAA,CAAkB,IAAA,EAAM,YAAA,GAAe,OAAA,CAAQ,aAAA;EA6HrB;;;;EAlH1B,gBAAA,CAAiB,GAAA,EAAK,YAAA;IAAe,KAAA;EAAA,KAAmB,OAAA,CAAQ,aAAA;EAsPA;;;;EAtOhE,cAAA,CAAe,GAAA,EAAK,YAAA;IAAe,KAAA;IAAe,EA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cAAA;AAAA"}
|
package/dist/sqlite-afs.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TableSchema } from "./schema/types.mjs";
|
|
2
2
|
import { ActionContext } from "./actions/types.mjs";
|
|
3
3
|
import { SQLiteAFSOptions } from "./config.mjs";
|
|
4
|
-
import { AFSAccessMode, AFSDeleteResult, AFSEntry, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSSearchOptions, AFSStatResult, AFSWriteEntryPayload } from "@aigne/afs";
|
|
5
|
-
import
|
|
4
|
+
import { AFSAccessMode, AFSDeleteResult, AFSEntry, AFSExplainResult, AFSListResult, AFSModuleLoadParams, AFSSearchOptions, AFSStatResult, AFSWriteEntryPayload, ProviderManifest } from "@aigne/afs";
|
|
5
|
+
import { z } from "zod";
|
|
6
6
|
import { AFSBaseProvider, RouteContext } from "@aigne/afs/provider";
|
|
7
7
|
import { LibSQLDatabase } from "drizzle-orm/libsql";
|
|
8
8
|
|
|
@@ -25,53 +25,30 @@ declare class SQLiteAFS extends AFSBaseProvider {
|
|
|
25
25
|
private actions;
|
|
26
26
|
private ftsConfig;
|
|
27
27
|
private initialized;
|
|
28
|
-
constructor(options: SQLiteAFSOptions
|
|
28
|
+
constructor(options: SQLiteAFSOptions & {
|
|
29
|
+
localPath?: string;
|
|
30
|
+
uri?: string;
|
|
31
|
+
});
|
|
29
32
|
/**
|
|
30
33
|
* Returns the Zod schema for configuration validation
|
|
31
34
|
*/
|
|
32
|
-
static schema():
|
|
33
|
-
url:
|
|
34
|
-
name:
|
|
35
|
-
description:
|
|
36
|
-
accessMode:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
fts: zod0.ZodOptional<zod0.ZodObject<{
|
|
40
|
-
enabled: zod0.ZodDefault<zod0.ZodBoolean>;
|
|
41
|
-
tables: zod0.ZodOptional<zod0.ZodRecord<zod0.ZodString, zod0.ZodArray<zod0.ZodString, "many">>>;
|
|
42
|
-
}, "strip", zod0.ZodTypeAny, {
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
tables?: Record<string, string[]> | undefined;
|
|
45
|
-
}, {
|
|
46
|
-
tables?: Record<string, string[]> | undefined;
|
|
47
|
-
enabled?: boolean | undefined;
|
|
35
|
+
static schema(): z.ZodObject<{
|
|
36
|
+
url: z.ZodString;
|
|
37
|
+
name: z.ZodOptional<z.ZodString>;
|
|
38
|
+
description: z.ZodOptional<z.ZodString>;
|
|
39
|
+
accessMode: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
readonly: "readonly";
|
|
41
|
+
readwrite: "readwrite";
|
|
48
42
|
}>>;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
fts?: {
|
|
59
|
-
enabled: boolean;
|
|
60
|
-
tables?: Record<string, string[]> | undefined;
|
|
61
|
-
} | undefined;
|
|
62
|
-
}, {
|
|
63
|
-
url: string;
|
|
64
|
-
name?: string | undefined;
|
|
65
|
-
description?: string | undefined;
|
|
66
|
-
accessMode?: "readonly" | "readwrite" | undefined;
|
|
67
|
-
tables?: string[] | undefined;
|
|
68
|
-
excludeTables?: string[] | undefined;
|
|
69
|
-
fts?: {
|
|
70
|
-
tables?: Record<string, string[]> | undefined;
|
|
71
|
-
enabled?: boolean | undefined;
|
|
72
|
-
} | undefined;
|
|
73
|
-
wal?: boolean | undefined;
|
|
74
|
-
}>;
|
|
43
|
+
tables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
+
excludeTables: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
fts: z.ZodOptional<z.ZodObject<{
|
|
46
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
47
|
+
tables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
wal: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
static manifest(): ProviderManifest;
|
|
75
52
|
/**
|
|
76
53
|
* Loads a module instance from configuration
|
|
77
54
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-afs.d.mts","names":[],"sources":["../src/sqlite-afs.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"sqlite-afs.d.mts","names":[],"sources":["../src/sqlite-afs.ts"],"mappings":";;;;;;;;;;AAsDA;;;;;cAAa,SAAA,SAAkB,eAAA;EAAA,QAaT,OAAA;EAAA,SAZF,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA,EAAY,aAAA;EAAA,QAEtB,EAAA;EAAA,QACA,aAAA;EAAA,QACA,IAAA;EAAA,QACA,SAAA;EAAA,QACA,OAAA;EAAA,QACA,SAAA;EAAA,QACA,WAAA;cAEY,OAAA,EAAS,gBAAA;IAAqB,SAAA;IAAoB,GAAA;EAAA;;;;SA+B/D,MAAA,CAAA,GAAM,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;SAIN,QAAA,CAAA,GAAY,gBAAA;EAiE0B;;;EAAA,OAnDhC,IAAA,CAAA;IAAO;EAAA,IAAU,mBAAA,GAA2B,OAAA,CAAQ,SAAA;EA8EvC;;;EAAA,QAtEZ,UAAA;EAuFH;;;;;EAzDL,iBAAA,CAAA,GAAqB,OAAA;EA2G+B;;;;EA9FpD,iBAAA,CAAkB,IAAA,EAAM,YAAA,GAAe,OAAA,CAAQ,aAAA;EA6HrB;;;;EAlH1B,gBAAA,CAAiB,GAAA,EAAK,YAAA;IAAe,KAAA;EAAA,KAAmB,OAAA,CAAQ,aAAA;EAsPA;;;;EAtOhE,cAAA,CAAe,GAAA,EAAK,YAAA;IAAe,KAAA;IAAe,EAAA;EAAA,KAAgB,OAAA,CAAQ,aAAA;EAkUzE;;;EAnTD,kBAAA,CACJ,GAAA,EAAK,YAAA;IAAe,KAAA;IAAe,EAAA;EAAA,KAClC,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
|
import { registerBuiltInActions } from "./actions/built-in.mjs";
|
|
2
3
|
import { ActionsRegistry } from "./actions/registry.mjs";
|
|
3
4
|
import { sqliteAFSConfigSchema } from "./config.mjs";
|
|
@@ -8,6 +9,7 @@ import { SchemaService } from "./schema/service.mjs";
|
|
|
8
9
|
import { __decorate } from "./_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs";
|
|
9
10
|
import { initDatabase, sql } from "@aigne/sqlite";
|
|
10
11
|
import { AFSNotFoundError } from "@aigne/afs";
|
|
12
|
+
import { z } from "zod";
|
|
11
13
|
import { AFSBaseProvider, Actions, Delete, Explain, List, Meta, Read, Search, Stat, Write } from "@aigne/afs/provider";
|
|
12
14
|
|
|
13
15
|
//#region src/sqlite-afs.ts
|
|
@@ -31,6 +33,16 @@ var SQLiteAFS = class SQLiteAFS extends AFSBaseProvider {
|
|
|
31
33
|
constructor(options) {
|
|
32
34
|
super();
|
|
33
35
|
this.options = options;
|
|
36
|
+
if (options.localPath && !options.url) options.url = `file:${options.localPath}`;
|
|
37
|
+
if (options.url.startsWith("file:")) {
|
|
38
|
+
const { existsSync, mkdirSync, writeFileSync } = __require("node:fs");
|
|
39
|
+
const { dirname } = __require("node:path");
|
|
40
|
+
const dbPath = options.url.slice(5);
|
|
41
|
+
if (!existsSync(dbPath)) {
|
|
42
|
+
mkdirSync(dirname(dbPath), { recursive: true });
|
|
43
|
+
writeFileSync(dbPath, "");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
34
46
|
this.name = options.name ?? "sqlite-afs";
|
|
35
47
|
this.description = options.description ?? `SQLite database: ${options.url}`;
|
|
36
48
|
this.accessMode = options.accessMode ?? "readwrite";
|
|
@@ -44,6 +56,16 @@ var SQLiteAFS = class SQLiteAFS extends AFSBaseProvider {
|
|
|
44
56
|
static schema() {
|
|
45
57
|
return sqliteAFSConfigSchema;
|
|
46
58
|
}
|
|
59
|
+
static manifest() {
|
|
60
|
+
return {
|
|
61
|
+
name: "sqlite",
|
|
62
|
+
description: "Mount a SQLite database as a virtual filesystem",
|
|
63
|
+
uriTemplate: "sqlite://{localPath+}",
|
|
64
|
+
category: "database",
|
|
65
|
+
schema: z.object({ localPath: z.string() }),
|
|
66
|
+
tags: ["sqlite", "database"]
|
|
67
|
+
};
|
|
68
|
+
}
|
|
47
69
|
/**
|
|
48
70
|
* Loads a module instance from configuration
|
|
49
71
|
*/
|
package/dist/sqlite-afs.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-afs.mjs","names":[],"sources":["../src/sqlite-afs.ts"],"sourcesContent":["import type { AFSExplainOptions, AFSExplainResult, AFSStatResult } from \"@aigne/afs\";\nimport {\n type ActionCatalog,\n type ActionDefinition,\n type AFSAccessMode,\n type AFSDeleteResult,\n type AFSEntry,\n type AFSListResult,\n type AFSModuleClass,\n type AFSModuleLoadParams,\n AFSNotFoundError,\n type AFSSearchOptions,\n type AFSWriteEntryPayload,\n type CapabilitiesManifest,\n} from \"@aigne/afs\";\nimport {\n Actions,\n AFSBaseProvider,\n Delete,\n Explain,\n List,\n Meta,\n Read,\n type RouteContext,\n Search,\n Stat,\n Write,\n} from \"@aigne/afs/provider\";\nimport { initDatabase, sql } from \"@aigne/sqlite\";\nimport type { LibSQLDatabase } from \"drizzle-orm/libsql\";\nimport { registerBuiltInActions } from \"./actions/built-in.js\";\nimport { ActionsRegistry } from \"./actions/registry.js\";\nimport type { ActionContext } from \"./actions/types.js\";\nimport { type SQLiteAFSOptions, sqliteAFSConfigSchema } from \"./config.js\";\nimport {\n buildActionsListEntry,\n buildRootActionsListEntry,\n buildRootEntry,\n buildTableActionsListEntry,\n buildTableEntry,\n} from \"./node/builder.js\";\nimport { CRUDOperations } from \"./operations/crud.js\";\nimport { createFTSConfig, type FTSConfig, FTSSearch } from \"./operations/search.js\";\nimport { SchemaService } from \"./schema/service.js\";\nimport type { TableSchema } from \"./schema/types.js\";\n\n/**\n * SQLite AFS Module\n *\n * Exposes SQLite databases as AFS nodes with full CRUD support,\n * schema introspection, FTS5 search, and virtual paths (.meta, .actions).\n */\nexport class SQLiteAFS extends AFSBaseProvider {\n override readonly name: string;\n override readonly description?: string;\n override readonly accessMode: AFSAccessMode;\n\n private db!: Awaited<ReturnType<typeof initDatabase>>;\n private schemaService!: SchemaService;\n private crud!: CRUDOperations;\n private ftsSearch!: FTSSearch;\n private actions: ActionsRegistry;\n private ftsConfig: FTSConfig;\n private initialized = false;\n\n constructor(private options: SQLiteAFSOptions) {\n super();\n this.name = options.name ?? \"sqlite-afs\";\n this.description = options.description ?? `SQLite database: ${options.url}`;\n this.accessMode = options.accessMode ?? \"readwrite\";\n this.ftsConfig = createFTSConfig(options.fts);\n this.actions = new ActionsRegistry();\n registerBuiltInActions(this.actions);\n }\n\n /**\n * Returns the Zod schema for configuration validation\n */\n static schema() {\n return sqliteAFSConfigSchema;\n }\n\n /**\n * Loads a module instance from configuration\n */\n static async load({ config }: AFSModuleLoadParams = {}): Promise<SQLiteAFS> {\n const validated = sqliteAFSConfigSchema.parse(config);\n return new SQLiteAFS(validated);\n }\n\n /**\n * Initializes the database connection and schema service\n */\n private async initialize(): Promise<void> {\n if (this.initialized) return;\n\n // Initialize database connection\n this.db = await initDatabase({\n url: this.options.url,\n wal: this.options.wal ?? true,\n });\n\n // Cast db to LibSQLDatabase for operations\n const db = this.db as unknown as LibSQLDatabase;\n\n // Initialize schema service (queries on-demand, no caching)\n this.schemaService = new SchemaService(db, {\n tables: this.options.tables,\n excludeTables: this.options.excludeTables,\n });\n\n // Initialize components\n this.crud = new CRUDOperations(db, this.schemaService, \"\");\n this.ftsSearch = new FTSSearch(db, this.schemaService, this.ftsConfig, \"\");\n\n this.initialized = true;\n }\n\n /**\n * Ensures the module is initialized.\n * This is called automatically by handlers, but can also be called\n * manually to trigger initialization (e.g., in tests).\n */\n async ensureInitialized(): Promise<void> {\n if (!this.initialized) {\n await this.initialize();\n }\n }\n\n // ========== List Handlers ==========\n\n /**\n * List all tables\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/\")\n async listTablesHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureInitialized();\n const result = await this.crud.listTables();\n return { data: result.data };\n }\n\n /**\n * List rows in a table\n * Note: list() returns only children (rows), never the table itself (per new semantics)\n */\n @List(\"/:table\")\n async listTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSListResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n const result = await this.crud.listTable(ctx.params.table, ctx.options);\n return { data: result.data };\n }\n\n /**\n * List a row - rows are leaf nodes with no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/:table/:pk\")\n async listRowHandler(ctx: RouteContext<{ table: string; pk: string }>): Promise<AFSListResult> {\n await this.ensureInitialized();\n // Verify the row exists\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n // Rows are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * List actions for a row\n */\n @Actions(\"/:table/:pk\")\n async listActionsHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSListResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Pass schema context for dynamic input schema generation\n const actions = this.actions.listWithInfo(\n { rowLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n return {\n data: buildActionsListEntry(ctx.params.table, ctx.params.pk, actions, { basePath: \"\" }),\n };\n }\n\n /**\n * List actions for a table (table-level actions)\n */\n @Actions(\"/:table\")\n async listTableActionsHandler(ctx: RouteContext<{ table: string }>): Promise<AFSListResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Pass schema context for dynamic input schema generation\n const actions = this.actions.listWithInfo(\n { tableLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n return {\n data: buildTableActionsListEntry(ctx.params.table, actions, { basePath: \"\" }),\n };\n }\n\n /**\n * List actions at root level (database-level actions)\n */\n @Actions(\"/\")\n async listRootActionsHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureInitialized();\n // Get root-level actions (those that operate on the database itself)\n // Pass schema context for any actions that might need it\n const actions = this.actions.listWithInfo(\n { rootLevel: true },\n {\n schemaService: this.schemaService,\n },\n );\n return {\n data: buildRootActionsListEntry(actions, { basePath: \"\" }),\n };\n }\n\n // ========== Read Handlers ==========\n\n /**\n * Read root (database) entry\n */\n @Read(\"/\")\n async readRootHandler(_ctx: RouteContext): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schemas = await this.schemaService.getAllSchemas();\n return buildRootEntry(schemas, { basePath: \"\" });\n }\n\n /**\n * Read root metadata (database-level schema information)\n */\n @Meta(\"/\")\n async readRootMetaHandler(_ctx: RouteContext): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n\n const schemas = await this.schemaService.getAllSchemas();\n\n // Build comprehensive database metadata (sorted by name for deterministic order)\n const tables = Array.from(schemas.entries())\n .sort((a, b) => a[0].localeCompare(b[0]))\n .map(([name, schema]) => ({\n name,\n description: `Table with ${schema.columns.length} columns`,\n columnCount: schema.columns.length,\n primaryKey: schema.primaryKey,\n }));\n\n return {\n id: \"root:.meta\",\n path: \"/.meta\",\n content: {\n type: \"sqlite\",\n tableCount: schemas.size,\n tables,\n },\n meta: {\n childrenCount: tables.length,\n tables: tables.map((t) => t.name),\n },\n };\n }\n\n /**\n * Read capabilities manifest\n * Returns information about available actions at different levels\n */\n @Read(\"/.meta/.capabilities\")\n async readCapabilitiesHandler(_ctx: RouteContext): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n\n // Build action catalogs for each level\n const actionCatalogs: ActionCatalog[] = [];\n\n // Root-level actions (database operations)\n const rootActions = this.actions.listWithInfo(\n { rootLevel: true },\n { schemaService: this.schemaService },\n );\n if (rootActions.length > 0) {\n actionCatalogs.push({\n kind: \"sqlite:root\",\n description: \"Database-level operations\",\n catalog: rootActions.map(\n (a): ActionDefinition => ({\n name: a.name,\n description: a.description,\n inputSchema: a.inputSchema,\n }),\n ),\n discovery: {\n pathTemplate: \"/.actions\",\n note: \"Available at database root\",\n },\n });\n }\n\n // Table-level actions\n const tableActions = this.actions.listWithInfo(\n { tableLevel: true },\n { schemaService: this.schemaService },\n );\n if (tableActions.length > 0) {\n actionCatalogs.push({\n kind: \"sqlite:table\",\n description: \"Table-level operations\",\n catalog: tableActions.map(\n (a): ActionDefinition => ({\n name: a.name,\n description: a.description,\n inputSchema: a.inputSchema,\n }),\n ),\n discovery: {\n pathTemplate: \"/:table/.actions\",\n note: \"Replace :table with actual table name\",\n },\n });\n }\n\n // Row-level actions\n const rowActions = this.actions.listWithInfo(\n { rowLevel: true },\n { schemaService: this.schemaService },\n );\n if (rowActions.length > 0) {\n actionCatalogs.push({\n kind: \"sqlite:row\",\n description: \"Row-level operations\",\n catalog: rowActions.map(\n (a): ActionDefinition => ({\n name: a.name,\n description: a.description,\n inputSchema: a.inputSchema,\n }),\n ),\n discovery: {\n pathTemplate: \"/:table/:pk/.actions\",\n note: \"Replace :table with table name, :pk with primary key value\",\n },\n });\n }\n\n const manifest: CapabilitiesManifest = {\n schemaVersion: 1,\n provider: this.name,\n version: \"1.0.0\",\n description: this.description,\n tools: [], // SQLite has no global tools, only node-level actions\n actions: actionCatalogs,\n operations: this.getOperationsDeclaration(),\n };\n\n return {\n id: \"/.meta/.capabilities\",\n path: \"/.meta/.capabilities\",\n content: manifest,\n meta: { kind: \"afs:capabilities\" },\n };\n }\n\n /**\n * Read table (directory) entry\n */\n @Read(\"/:table\")\n async readTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n return buildTableEntry(ctx.params.table, schema, { basePath: \"\", rowCount });\n }\n\n /**\n * Read table metadata (table-level schema information)\n */\n @Meta(\"/:table\")\n async readTableMetaHandler(ctx: RouteContext<{ table: string }>): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n // Build column metadata\n const columns = schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n defaultValue: col.dfltValue,\n }));\n\n // Build comprehensive table schema metadata\n return {\n id: `${ctx.params.table}:.meta`,\n path: `/${ctx.params.table}/.meta`,\n content: {\n table: ctx.params.table,\n columns,\n primaryKey: schema.primaryKey,\n foreignKeys: schema.foreignKeys.map((fk) => ({\n column: fk.from,\n referencesTable: fk.table,\n referencesColumn: fk.to,\n onUpdate: fk.onUpdate,\n onDelete: fk.onDelete,\n })),\n indexes: schema.indexes.map((idx) => ({\n name: idx.name,\n unique: idx.unique,\n origin: idx.origin,\n })),\n rowCount,\n },\n meta: {\n table: ctx.params.table,\n description: `Table \"${ctx.params.table}\" with ${columns.length} columns`,\n childrenCount: rowCount,\n columnCount: columns.length,\n columns: columns.map((c) => c.name),\n primaryKey: schema.primaryKey,\n },\n };\n }\n\n /**\n * Read a row\n */\n @Read(\"/:table/:pk\")\n async readRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n return result.data;\n }\n\n /**\n * Get row metadata (@meta suffix - SQLite-specific)\n */\n @Read(\"/:table/:pk/@meta\")\n async getMetaHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const result = await this.crud.getMeta(ctx.params.table, ctx.params.pk);\n return result.data;\n }\n\n /**\n * Get row metadata (.meta suffix - row-level schema information)\n */\n @Meta(\"/:table/:pk\")\n async getRowDotMetaHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n\n const pkColumn = schema.primaryKey[0] ?? \"rowid\";\n\n // Build row-level schema metadata\n return {\n id: `${ctx.params.table}:${ctx.params.pk}:.meta`,\n path: `/${ctx.params.table}/${ctx.params.pk}/.meta`,\n content: {\n table: ctx.params.table,\n primaryKey: pkColumn,\n primaryKeyValue: ctx.params.pk,\n columns: schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n })),\n foreignKeys: schema.foreignKeys.map((fk) => ({\n column: fk.from,\n referencesTable: fk.table,\n referencesColumn: fk.to,\n })),\n },\n meta: {\n table: ctx.params.table,\n primaryKeyValue: ctx.params.pk,\n columns: schema.columns.map((col) => col.name),\n },\n };\n }\n\n // ========== Write Handlers ==========\n\n /**\n * Create a new row\n */\n @Write(\"/:table/new\")\n async createRowHandler(\n ctx: RouteContext<{ table: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.crud.createRow(ctx.params.table, content.content ?? content);\n }\n\n /**\n * Update an existing row\n */\n @Write(\"/:table/:pk\")\n async updateRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.crud.updateRow(ctx.params.table, ctx.params.pk, content.content ?? content);\n }\n\n /**\n * Execute action via write (for triggering row-level actions)\n */\n @Write(\"/:table/:pk/.actions/:action\")\n async executeActionWriteHandler(\n ctx: RouteContext<{ table: string; pk: string; action: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.executeAction(\n ctx.params.table,\n ctx.params.pk,\n ctx.params.action,\n (content.content ?? content) as Record<string, unknown>,\n );\n }\n\n /**\n * Execute action via write (for triggering table-level actions)\n */\n @Write(\"/:table/.actions/:action\")\n async executeTableActionWriteHandler(\n ctx: RouteContext<{ table: string; action: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.executeAction(\n ctx.params.table,\n undefined, // No pk for table-level action\n ctx.params.action,\n (content.content ?? content) as Record<string, unknown>,\n );\n }\n\n /**\n * Execute action via write (for triggering root-level actions)\n */\n @Write(\"/.actions/:action\")\n async executeRootActionWriteHandler(\n ctx: RouteContext<{ action: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.executeRootAction(\n ctx.params.action,\n (content.content ?? content) as Record<string, unknown>,\n );\n }\n\n // ========== Delete Handlers ==========\n\n /**\n * Delete a table entry (not supported - always throws)\n */\n @Delete(\"/:table\")\n async deleteTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSDeleteResult> {\n await this.ensureInitialized();\n // Check if table exists, then throw appropriate error\n const exists = await this.schemaService.hasTable(ctx.params.table);\n if (!exists) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n // Tables can't be deleted through AFS - throw error\n throw new Error(`Cannot delete table '${ctx.params.table}'. Use SQL directly to drop tables.`);\n }\n\n /**\n * Delete a row\n */\n @Delete(\"/:table/:pk\")\n async deleteRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSDeleteResult> {\n await this.ensureInitialized();\n return this.crud.deleteRow(ctx.params.table, ctx.params.pk);\n }\n\n // ========== Search Handlers ==========\n\n /**\n * Search all tables\n */\n @Search(\"/\")\n async searchAllHandler(\n _ctx: RouteContext,\n query: string,\n options?: AFSSearchOptions,\n ): Promise<{ data: AFSEntry[]; message?: string }> {\n await this.ensureInitialized();\n return this.ftsSearch.search(query, options);\n }\n\n /**\n * Search a specific table\n */\n @Search(\"/:table\")\n async searchTableHandler(\n ctx: RouteContext<{ table: string }>,\n query: string,\n options?: AFSSearchOptions,\n ): Promise<{ data: AFSEntry[]; message?: string }> {\n await this.ensureInitialized();\n return this.ftsSearch.searchTable(ctx.params.table, query, options);\n }\n\n // ========== Stat Handlers ==========\n\n /**\n * Get stat for root (database level)\n */\n @Stat(\"/\")\n async statRootHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureInitialized();\n const schemas = await this.schemaService.getAllSchemas();\n const actions = this.actions.listWithInfo(\n { rootLevel: true },\n { schemaService: this.schemaService },\n );\n\n return {\n data: {\n id: \"/\",\n path: \"/\",\n meta: {\n kind: \"sqlite:database\",\n kinds: [\"sqlite:database\", \"afs:node\"],\n tableCount: schemas.size,\n childrenCount: schemas.size,\n },\n actions:\n actions.length > 0\n ? actions.map((a) => ({ name: a.name, description: a.description }))\n : undefined,\n },\n };\n }\n\n /**\n * Get stat for a table\n */\n @Stat(\"/:table\")\n async statTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSStatResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n // Get table-level actions\n const actions = this.actions.listWithInfo(\n { tableLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n\n // Build detailed columns array for metadata display\n const columns = schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n }));\n\n return {\n data: {\n id: ctx.params.table,\n path: `/${ctx.params.table}`,\n meta: {\n kind: \"sqlite:table\",\n kinds: [\"sqlite:table\", \"afs:node\"],\n table: ctx.params.table,\n columnCount: schema.columns.length,\n columns,\n primaryKey: schema.primaryKey[0],\n childrenCount: rowCount,\n },\n actions:\n actions.length > 0\n ? actions.map((a) => ({ name: a.name, description: a.description }))\n : undefined,\n },\n };\n }\n\n /**\n * Get stat for a row\n */\n @Stat(\"/:table/:pk\")\n async statRowHandler(ctx: RouteContext<{ table: string; pk: string }>): Promise<AFSStatResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Verify row exists\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n\n // Get row-level actions\n const actions = this.actions.listWithInfo(\n { rowLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n\n // Build detailed columns array for metadata display\n const columns = schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n }));\n\n return {\n data: {\n id: ctx.params.pk,\n path: `/${ctx.params.table}/${ctx.params.pk}`,\n meta: {\n kind: \"sqlite:row\",\n kinds: [\"sqlite:row\", \"afs:node\"],\n table: ctx.params.table,\n primaryKey: ctx.params.pk,\n columnCount: schema.columns.length,\n columns,\n childrenCount: 0,\n },\n actions:\n actions.length > 0\n ? actions.map((a) => ({ name: a.name, description: a.description }))\n : undefined,\n },\n };\n }\n\n // ========== Explain Handlers ==========\n\n /**\n * Explain root (database level)\n */\n @Explain(\"/\")\n async explainRootHandler(ctx: RouteContext): Promise<AFSExplainResult> {\n await this.ensureInitialized();\n const format = (ctx.options as AFSExplainOptions)?.format || \"markdown\";\n const schemas = await this.schemaService.getAllSchemas();\n const tables = Array.from(schemas.values());\n\n const lines: string[] = [];\n\n if (format === \"markdown\") {\n lines.push(`# ${this.name}`);\n lines.push(\"\");\n lines.push(`**Type:** SQLite Database`);\n lines.push(`**Tables:** ${tables.length}`);\n lines.push(\"\");\n\n if (tables.length > 0) {\n lines.push(\"## Tables\");\n lines.push(\"\");\n lines.push(\"| Table | Columns | Primary Key |\");\n lines.push(\"|-------|---------|-------------|\");\n for (const table of tables) {\n const pk = table.primaryKey.join(\", \") || \"rowid\";\n lines.push(`| ${table.name} | ${table.columns.length} | ${pk} |`);\n }\n }\n } else {\n lines.push(`${this.name} (SQLite Database)`);\n lines.push(`Tables: ${tables.length}`);\n for (const table of tables) {\n lines.push(` - ${table.name} (${table.columns.length} columns)`);\n }\n }\n\n return { content: lines.join(\"\\n\"), format };\n }\n\n /**\n * Explain a table\n */\n @Explain(\"/:table\")\n async explainTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSExplainResult> {\n await this.ensureInitialized();\n const format = (ctx.options as AFSExplainOptions)?.format || \"markdown\";\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n const lines: string[] = [];\n\n if (format === \"markdown\") {\n lines.push(`# ${ctx.params.table}`);\n lines.push(\"\");\n lines.push(`**Type:** SQLite Table`);\n lines.push(`**Rows:** ${rowCount}`);\n lines.push(`**Primary Key:** ${schema.primaryKey.join(\", \") || \"rowid\"}`);\n lines.push(\"\");\n\n // Column table\n lines.push(\"## Columns\");\n lines.push(\"\");\n lines.push(\"| Column | Type | Nullable | Primary Key | Default |\");\n lines.push(\"|--------|------|----------|-------------|---------|\");\n for (const col of schema.columns) {\n const nullable = col.notnull ? \"NO\" : \"YES\";\n const pk = col.pk > 0 ? \"YES\" : \"\";\n const dflt =\n col.dfltValue !== null && col.dfltValue !== undefined ? String(col.dfltValue) : \"\";\n lines.push(`| ${col.name} | ${col.type} | ${nullable} | ${pk} | ${dflt} |`);\n }\n\n // Indexes\n if (schema.indexes.length > 0) {\n lines.push(\"\");\n lines.push(\"## Indexes\");\n lines.push(\"\");\n for (const idx of schema.indexes) {\n const uniqueStr = idx.unique ? \" (UNIQUE)\" : \"\";\n lines.push(`- **${idx.name}**${uniqueStr}`);\n }\n }\n\n // Foreign keys\n if (schema.foreignKeys.length > 0) {\n lines.push(\"\");\n lines.push(\"## Foreign Keys\");\n lines.push(\"\");\n for (const fk of schema.foreignKeys) {\n lines.push(`- \\`${fk.from}\\` → \\`${fk.table}\\`(\\`${fk.to}\\`) ON DELETE ${fk.onDelete}`);\n }\n }\n } else {\n lines.push(`${ctx.params.table} (SQLite Table)`);\n lines.push(`Rows: ${rowCount}`);\n lines.push(`Primary Key: ${schema.primaryKey.join(\", \") || \"rowid\"}`);\n lines.push(`Columns: ${schema.columns.map((c) => `${c.name} (${c.type})`).join(\", \")}`);\n if (schema.indexes.length > 0) {\n lines.push(`Indexes: ${schema.indexes.map((i) => i.name).join(\", \")}`);\n }\n if (schema.foreignKeys.length > 0) {\n lines.push(\n `Foreign Keys: ${schema.foreignKeys.map((fk) => `${fk.from} → ${fk.table}(${fk.to})`).join(\", \")}`,\n );\n }\n }\n\n return { content: lines.join(\"\\n\"), format };\n }\n\n /**\n * Explain a row\n */\n @Explain(\"/:table/:pk\")\n async explainRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSExplainResult> {\n await this.ensureInitialized();\n const format = (ctx.options as AFSExplainOptions)?.format || \"markdown\";\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Read the row\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n\n const rowContent = result.data.content as Record<string, unknown> | undefined;\n const pkColumn = schema.primaryKey[0] ?? \"rowid\";\n\n const lines: string[] = [];\n\n if (format === \"markdown\") {\n lines.push(`# ${ctx.params.table}/${ctx.params.pk}`);\n lines.push(\"\");\n lines.push(`**Table:** ${ctx.params.table}`);\n lines.push(`**Primary Key:** ${pkColumn} = ${ctx.params.pk}`);\n lines.push(\"\");\n\n if (rowContent) {\n lines.push(\"## Values\");\n lines.push(\"\");\n lines.push(\"| Column | Value |\");\n lines.push(\"|--------|-------|\");\n for (const col of schema.columns) {\n const val = rowContent[col.name];\n const displayVal =\n val === null || val === undefined ? \"*null*\" : truncateValue(String(val), 100);\n lines.push(`| ${col.name} | ${displayVal} |`);\n }\n }\n } else {\n lines.push(`${ctx.params.table}/${ctx.params.pk} (SQLite Row)`);\n lines.push(`Table: ${ctx.params.table}, ${pkColumn} = ${ctx.params.pk}`);\n if (rowContent) {\n for (const col of schema.columns) {\n const val = rowContent[col.name];\n lines.push(\n ` ${col.name}: ${val === null || val === undefined ? \"null\" : truncateValue(String(val), 100)}`,\n );\n }\n }\n }\n\n return { content: lines.join(\"\\n\"), format };\n }\n\n // ========== Exec Handlers ==========\n\n /**\n * Execute action via exec (row-level)\n */\n @Actions.Exec(\"/:table/:pk\")\n async handleRowActionExec(\n ctx: RouteContext<{ table: string; pk: string; action: string }>,\n args: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n await this.ensureInitialized();\n return this.executeActionRaw(ctx.params.table, ctx.params.pk, ctx.params.action, args);\n }\n\n /**\n * Execute action via exec (table-level)\n */\n @Actions.Exec(\"/:table\")\n async handleTableActionExec(\n ctx: RouteContext<{ table: string; action: string }>,\n args: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n await this.ensureInitialized();\n return this.executeActionRaw(\n ctx.params.table,\n undefined, // No pk for table-level action\n ctx.params.action,\n args,\n );\n }\n\n /**\n * Execute action via exec (root-level)\n */\n @Actions.Exec(\"/\")\n async handleRootActionExec(\n ctx: RouteContext<{ action: string }>,\n args: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n await this.ensureInitialized();\n return this.executeRootActionRaw(ctx.params.action, args);\n }\n\n // ========== Helper Methods ==========\n\n /**\n * Executes an action and returns raw result (for exec handlers)\n * Returns AFSExecResult structure: { success: boolean, data?: Record<string, unknown> }\n */\n private async executeActionRaw(\n table: string,\n pk: string | undefined,\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n const schema = await this.schemaService.getSchema(table);\n if (!schema) {\n throw new AFSNotFoundError(`/${table}`);\n }\n\n // Get row data if pk is provided\n let row: Record<string, unknown> | undefined;\n if (pk) {\n const readResult = await this.crud.readRow(table, pk);\n row = readResult.data?.content as Record<string, unknown> | undefined;\n }\n\n const ctx: ActionContext = {\n db: this.db as unknown as LibSQLDatabase,\n schemaService: this.schemaService,\n table,\n pk,\n row,\n module: {\n exportTable: (t, f) => this.exportTable(t, f),\n },\n };\n\n const result = await this.actions.execute(actionName, ctx, params);\n\n if (!result.success) {\n throw new Error(result.message ?? \"Action failed\");\n }\n\n // Return AFSExecResult structure\n // Handle arrays specially - wrap in data property\n if (Array.isArray(result.data)) {\n return {\n success: true,\n data: { data: result.data },\n };\n }\n\n return {\n success: true,\n data: result.data as Record<string, unknown>,\n };\n }\n\n /**\n * Executes a root-level action and returns raw result (for exec handlers)\n * Returns AFSExecResult structure: { success: boolean, data?: Record<string, unknown> }\n */\n private async executeRootActionRaw(\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n const ctx: ActionContext = {\n db: this.db as unknown as LibSQLDatabase,\n schemaService: this.schemaService,\n table: \"\", // No specific table for root-level actions\n module: {\n exportTable: (t, f) => this.exportTable(t, f),\n },\n };\n\n const result = await this.actions.execute(actionName, ctx, params);\n\n if (!result.success) {\n throw new Error(result.message ?? \"Action failed\");\n }\n\n // Return AFSExecResult structure\n // Handle arrays specially - wrap in data property\n if (Array.isArray(result.data)) {\n return {\n success: true,\n data: { data: result.data },\n };\n }\n\n return {\n success: true,\n data: result.data as Record<string, unknown>,\n };\n }\n\n /**\n * Executes an action (for write handlers - wraps in AFSEntry)\n */\n private async executeAction(\n table: string,\n pk: string | undefined,\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ data: AFSEntry }> {\n const result = await this.executeActionRaw(table, pk, actionName, params);\n\n return {\n data: {\n id: `${table}:${pk ?? \"\"}:.actions:${actionName}`,\n path: pk ? `/${table}/${pk}/.actions/${actionName}` : `/${table}/.actions/${actionName}`,\n content: result,\n },\n };\n }\n\n /**\n * Executes a root-level action (for write handlers - wraps in AFSEntry)\n */\n private async executeRootAction(\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ data: AFSEntry }> {\n const result = await this.executeRootActionRaw(actionName, params);\n\n return {\n data: {\n id: `:.actions:${actionName}`,\n path: `/.actions/${actionName}`,\n content: result,\n },\n };\n }\n\n /**\n * Exports table data in specified format\n */\n async exportTable(table: string, format: string): Promise<unknown> {\n const listResult = await this.crud.listTable(table, { limit: 10000 });\n\n if (format === \"csv\") {\n const schema = await this.schemaService.getSchema(table);\n if (!schema) throw new AFSNotFoundError(`/${table}`);\n\n const headers = schema.columns.map((c) => c.name).join(\",\");\n const rows = listResult.data.map((entry) => {\n const content = entry.content as Record<string, unknown>;\n return schema.columns\n .map((c) => {\n const val = content[c.name];\n if (val === null || val === undefined) return \"\";\n if (typeof val === \"string\" && (val.includes(\",\") || val.includes('\"'))) {\n return `\"${val.replace(/\"/g, '\"\"')}\"`;\n }\n return String(val);\n })\n .join(\",\");\n });\n\n return `${headers}\\n${rows.join(\"\\n\")}`;\n }\n\n // Default: JSON\n return listResult.data.map((entry) => entry.content);\n }\n\n /**\n * Registers a custom action\n */\n registerAction(\n name: string,\n handler: (ctx: ActionContext, params: Record<string, unknown>) => Promise<unknown>,\n options?: {\n description?: string;\n tableLevel?: boolean;\n rowLevel?: boolean;\n },\n ): void {\n this.actions.registerSimple(\n name,\n async (ctx, params) => ({\n success: true,\n data: await handler(ctx, params),\n }),\n options,\n );\n }\n\n /**\n * Gets table schemas (for external access)\n * Note: This queries the database on-demand\n */\n async getSchemas(): Promise<Map<string, TableSchema>> {\n await this.ensureInitialized();\n return this.schemaService.getAllSchemas();\n }\n\n /**\n * Gets the database instance (for advanced operations)\n */\n getDatabase(): LibSQLDatabase {\n return this.db as unknown as LibSQLDatabase;\n }\n}\n\n/**\n * Truncate a string value for display purposes.\n */\nfunction truncateValue(value: string, maxLength: number): string {\n if (value.length <= maxLength) return value;\n return `${value.slice(0, maxLength)}...`;\n}\n\n// Type check to ensure SQLiteAFS implements AFSModuleClass\nconst _typeCheck: AFSModuleClass<SQLiteAFS, SQLiteAFSOptions> = SQLiteAFS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,IAAa,YAAb,MAAa,kBAAkB,gBAAgB;CAC7C,AAAkB;CAClB,AAAkB;CAClB,AAAkB;CAElB,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ,cAAc;CAEtB,YAAY,AAAQ,SAA2B;AAC7C,SAAO;EADW;AAElB,OAAK,OAAO,QAAQ,QAAQ;AAC5B,OAAK,cAAc,QAAQ,eAAe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,UAAU;YAwDf,KAAK,cAAc;YA0DnB,QAAQ,IAAI;YAwCZ,QAAQ,UAAU;YA+ElB,QAAQ,cAAc;YA8DtB,QAAQ,KAAK,cAAc;YAY3B,QAAQ,KAAK,UAAU;YAiBvB,QAAQ,KAAK,IAAI;;;;AAuNpB,SAAS,cAAc,OAAe,WAA2B;AAC/D,KAAI,MAAM,UAAU,UAAW,QAAO;AACtC,QAAO,GAAG,MAAM,MAAM,GAAG,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"sqlite-afs.mjs","names":[],"sources":["../src/sqlite-afs.ts"],"sourcesContent":["import type { AFSExplainOptions, AFSExplainResult, AFSStatResult } from \"@aigne/afs\";\nimport {\n type ActionCatalog,\n type ActionDefinition,\n type AFSAccessMode,\n type AFSDeleteResult,\n type AFSEntry,\n type AFSListResult,\n type AFSModuleClass,\n type AFSModuleLoadParams,\n AFSNotFoundError,\n type AFSSearchOptions,\n type AFSWriteEntryPayload,\n type CapabilitiesManifest,\n type ProviderManifest,\n} from \"@aigne/afs\";\nimport {\n Actions,\n AFSBaseProvider,\n Delete,\n Explain,\n List,\n Meta,\n Read,\n type RouteContext,\n Search,\n Stat,\n Write,\n} from \"@aigne/afs/provider\";\nimport { initDatabase, sql } from \"@aigne/sqlite\";\nimport type { LibSQLDatabase } from \"drizzle-orm/libsql\";\nimport { z } from \"zod\";\nimport { registerBuiltInActions } from \"./actions/built-in.js\";\nimport { ActionsRegistry } from \"./actions/registry.js\";\nimport type { ActionContext } from \"./actions/types.js\";\nimport { type SQLiteAFSOptions, sqliteAFSConfigSchema } from \"./config.js\";\nimport {\n buildActionsListEntry,\n buildRootActionsListEntry,\n buildRootEntry,\n buildTableActionsListEntry,\n buildTableEntry,\n} from \"./node/builder.js\";\nimport { CRUDOperations } from \"./operations/crud.js\";\nimport { createFTSConfig, type FTSConfig, FTSSearch } from \"./operations/search.js\";\nimport { SchemaService } from \"./schema/service.js\";\nimport type { TableSchema } from \"./schema/types.js\";\n\n/**\n * SQLite AFS Module\n *\n * Exposes SQLite databases as AFS nodes with full CRUD support,\n * schema introspection, FTS5 search, and virtual paths (.meta, .actions).\n */\nexport class SQLiteAFS extends AFSBaseProvider {\n override readonly name: string;\n override readonly description?: string;\n override readonly accessMode: AFSAccessMode;\n\n private db!: Awaited<ReturnType<typeof initDatabase>>;\n private schemaService!: SchemaService;\n private crud!: CRUDOperations;\n private ftsSearch!: FTSSearch;\n private actions: ActionsRegistry;\n private ftsConfig: FTSConfig;\n private initialized = false;\n\n constructor(private options: SQLiteAFSOptions & { localPath?: string; uri?: string }) {\n super();\n\n // Normalize registry-passed template vars: localPath → url\n if ((options as any).localPath && !options.url) {\n options.url = `file:${(options as any).localPath}`;\n }\n\n // Auto-create the database file if it doesn't exist\n if (options.url.startsWith(\"file:\")) {\n const { existsSync, mkdirSync, writeFileSync } =\n require(\"node:fs\") as typeof import(\"node:fs\");\n const { dirname } = require(\"node:path\") as typeof import(\"node:path\");\n const dbPath = options.url.slice(5); // strip \"file:\"\n if (!existsSync(dbPath)) {\n mkdirSync(dirname(dbPath), { recursive: true });\n writeFileSync(dbPath, \"\");\n }\n }\n\n this.name = options.name ?? \"sqlite-afs\";\n this.description = options.description ?? `SQLite database: ${options.url}`;\n this.accessMode = options.accessMode ?? \"readwrite\";\n this.ftsConfig = createFTSConfig(options.fts);\n this.actions = new ActionsRegistry();\n registerBuiltInActions(this.actions);\n }\n\n /**\n * Returns the Zod schema for configuration validation\n */\n static schema() {\n return sqliteAFSConfigSchema;\n }\n\n static manifest(): ProviderManifest {\n return {\n name: \"sqlite\",\n description: \"Mount a SQLite database as a virtual filesystem\",\n uriTemplate: \"sqlite://{localPath+}\",\n category: \"database\",\n schema: z.object({ localPath: z.string() }),\n tags: [\"sqlite\", \"database\"],\n };\n }\n\n /**\n * Loads a module instance from configuration\n */\n static async load({ config }: AFSModuleLoadParams = {}): Promise<SQLiteAFS> {\n const validated = sqliteAFSConfigSchema.parse(config);\n return new SQLiteAFS(validated);\n }\n\n /**\n * Initializes the database connection and schema service\n */\n private async initialize(): Promise<void> {\n if (this.initialized) return;\n\n // Initialize database connection\n this.db = await initDatabase({\n url: this.options.url,\n wal: this.options.wal ?? true,\n });\n\n // Cast db to LibSQLDatabase for operations\n const db = this.db as unknown as LibSQLDatabase;\n\n // Initialize schema service (queries on-demand, no caching)\n this.schemaService = new SchemaService(db, {\n tables: this.options.tables,\n excludeTables: this.options.excludeTables,\n });\n\n // Initialize components\n this.crud = new CRUDOperations(db, this.schemaService, \"\");\n this.ftsSearch = new FTSSearch(db, this.schemaService, this.ftsConfig, \"\");\n\n this.initialized = true;\n }\n\n /**\n * Ensures the module is initialized.\n * This is called automatically by handlers, but can also be called\n * manually to trigger initialization (e.g., in tests).\n */\n async ensureInitialized(): Promise<void> {\n if (!this.initialized) {\n await this.initialize();\n }\n }\n\n // ========== List Handlers ==========\n\n /**\n * List all tables\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/\")\n async listTablesHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureInitialized();\n const result = await this.crud.listTables();\n return { data: result.data };\n }\n\n /**\n * List rows in a table\n * Note: list() returns only children (rows), never the table itself (per new semantics)\n */\n @List(\"/:table\")\n async listTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSListResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n const result = await this.crud.listTable(ctx.params.table, ctx.options);\n return { data: result.data };\n }\n\n /**\n * List a row - rows are leaf nodes with no children\n * Note: list() returns only children, never the path itself (per new semantics)\n */\n @List(\"/:table/:pk\")\n async listRowHandler(ctx: RouteContext<{ table: string; pk: string }>): Promise<AFSListResult> {\n await this.ensureInitialized();\n // Verify the row exists\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n // Rows are leaf nodes - they have no children\n return { data: [] };\n }\n\n /**\n * List actions for a row\n */\n @Actions(\"/:table/:pk\")\n async listActionsHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSListResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Pass schema context for dynamic input schema generation\n const actions = this.actions.listWithInfo(\n { rowLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n return {\n data: buildActionsListEntry(ctx.params.table, ctx.params.pk, actions, { basePath: \"\" }),\n };\n }\n\n /**\n * List actions for a table (table-level actions)\n */\n @Actions(\"/:table\")\n async listTableActionsHandler(ctx: RouteContext<{ table: string }>): Promise<AFSListResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Pass schema context for dynamic input schema generation\n const actions = this.actions.listWithInfo(\n { tableLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n return {\n data: buildTableActionsListEntry(ctx.params.table, actions, { basePath: \"\" }),\n };\n }\n\n /**\n * List actions at root level (database-level actions)\n */\n @Actions(\"/\")\n async listRootActionsHandler(_ctx: RouteContext): Promise<AFSListResult> {\n await this.ensureInitialized();\n // Get root-level actions (those that operate on the database itself)\n // Pass schema context for any actions that might need it\n const actions = this.actions.listWithInfo(\n { rootLevel: true },\n {\n schemaService: this.schemaService,\n },\n );\n return {\n data: buildRootActionsListEntry(actions, { basePath: \"\" }),\n };\n }\n\n // ========== Read Handlers ==========\n\n /**\n * Read root (database) entry\n */\n @Read(\"/\")\n async readRootHandler(_ctx: RouteContext): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schemas = await this.schemaService.getAllSchemas();\n return buildRootEntry(schemas, { basePath: \"\" });\n }\n\n /**\n * Read root metadata (database-level schema information)\n */\n @Meta(\"/\")\n async readRootMetaHandler(_ctx: RouteContext): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n\n const schemas = await this.schemaService.getAllSchemas();\n\n // Build comprehensive database metadata (sorted by name for deterministic order)\n const tables = Array.from(schemas.entries())\n .sort((a, b) => a[0].localeCompare(b[0]))\n .map(([name, schema]) => ({\n name,\n description: `Table with ${schema.columns.length} columns`,\n columnCount: schema.columns.length,\n primaryKey: schema.primaryKey,\n }));\n\n return {\n id: \"root:.meta\",\n path: \"/.meta\",\n content: {\n type: \"sqlite\",\n tableCount: schemas.size,\n tables,\n },\n meta: {\n childrenCount: tables.length,\n tables: tables.map((t) => t.name),\n },\n };\n }\n\n /**\n * Read capabilities manifest\n * Returns information about available actions at different levels\n */\n @Read(\"/.meta/.capabilities\")\n async readCapabilitiesHandler(_ctx: RouteContext): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n\n // Build action catalogs for each level\n const actionCatalogs: ActionCatalog[] = [];\n\n // Root-level actions (database operations)\n const rootActions = this.actions.listWithInfo(\n { rootLevel: true },\n { schemaService: this.schemaService },\n );\n if (rootActions.length > 0) {\n actionCatalogs.push({\n kind: \"sqlite:root\",\n description: \"Database-level operations\",\n catalog: rootActions.map(\n (a): ActionDefinition => ({\n name: a.name,\n description: a.description,\n inputSchema: a.inputSchema,\n }),\n ),\n discovery: {\n pathTemplate: \"/.actions\",\n note: \"Available at database root\",\n },\n });\n }\n\n // Table-level actions\n const tableActions = this.actions.listWithInfo(\n { tableLevel: true },\n { schemaService: this.schemaService },\n );\n if (tableActions.length > 0) {\n actionCatalogs.push({\n kind: \"sqlite:table\",\n description: \"Table-level operations\",\n catalog: tableActions.map(\n (a): ActionDefinition => ({\n name: a.name,\n description: a.description,\n inputSchema: a.inputSchema,\n }),\n ),\n discovery: {\n pathTemplate: \"/:table/.actions\",\n note: \"Replace :table with actual table name\",\n },\n });\n }\n\n // Row-level actions\n const rowActions = this.actions.listWithInfo(\n { rowLevel: true },\n { schemaService: this.schemaService },\n );\n if (rowActions.length > 0) {\n actionCatalogs.push({\n kind: \"sqlite:row\",\n description: \"Row-level operations\",\n catalog: rowActions.map(\n (a): ActionDefinition => ({\n name: a.name,\n description: a.description,\n inputSchema: a.inputSchema,\n }),\n ),\n discovery: {\n pathTemplate: \"/:table/:pk/.actions\",\n note: \"Replace :table with table name, :pk with primary key value\",\n },\n });\n }\n\n const manifest: CapabilitiesManifest = {\n schemaVersion: 1,\n provider: this.name,\n version: \"1.0.0\",\n description: this.description,\n tools: [], // SQLite has no global tools, only node-level actions\n actions: actionCatalogs,\n operations: this.getOperationsDeclaration(),\n };\n\n return {\n id: \"/.meta/.capabilities\",\n path: \"/.meta/.capabilities\",\n content: manifest,\n meta: { kind: \"afs:capabilities\" },\n };\n }\n\n /**\n * Read table (directory) entry\n */\n @Read(\"/:table\")\n async readTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n return buildTableEntry(ctx.params.table, schema, { basePath: \"\", rowCount });\n }\n\n /**\n * Read table metadata (table-level schema information)\n */\n @Meta(\"/:table\")\n async readTableMetaHandler(ctx: RouteContext<{ table: string }>): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n // Build column metadata\n const columns = schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n defaultValue: col.dfltValue,\n }));\n\n // Build comprehensive table schema metadata\n return {\n id: `${ctx.params.table}:.meta`,\n path: `/${ctx.params.table}/.meta`,\n content: {\n table: ctx.params.table,\n columns,\n primaryKey: schema.primaryKey,\n foreignKeys: schema.foreignKeys.map((fk) => ({\n column: fk.from,\n referencesTable: fk.table,\n referencesColumn: fk.to,\n onUpdate: fk.onUpdate,\n onDelete: fk.onDelete,\n })),\n indexes: schema.indexes.map((idx) => ({\n name: idx.name,\n unique: idx.unique,\n origin: idx.origin,\n })),\n rowCount,\n },\n meta: {\n table: ctx.params.table,\n description: `Table \"${ctx.params.table}\" with ${columns.length} columns`,\n childrenCount: rowCount,\n columnCount: columns.length,\n columns: columns.map((c) => c.name),\n primaryKey: schema.primaryKey,\n },\n };\n }\n\n /**\n * Read a row\n */\n @Read(\"/:table/:pk\")\n async readRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n return result.data;\n }\n\n /**\n * Get row metadata (@meta suffix - SQLite-specific)\n */\n @Read(\"/:table/:pk/@meta\")\n async getMetaHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const result = await this.crud.getMeta(ctx.params.table, ctx.params.pk);\n return result.data;\n }\n\n /**\n * Get row metadata (.meta suffix - row-level schema information)\n */\n @Meta(\"/:table/:pk\")\n async getRowDotMetaHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSEntry | undefined> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n\n const pkColumn = schema.primaryKey[0] ?? \"rowid\";\n\n // Build row-level schema metadata\n return {\n id: `${ctx.params.table}:${ctx.params.pk}:.meta`,\n path: `/${ctx.params.table}/${ctx.params.pk}/.meta`,\n content: {\n table: ctx.params.table,\n primaryKey: pkColumn,\n primaryKeyValue: ctx.params.pk,\n columns: schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n })),\n foreignKeys: schema.foreignKeys.map((fk) => ({\n column: fk.from,\n referencesTable: fk.table,\n referencesColumn: fk.to,\n })),\n },\n meta: {\n table: ctx.params.table,\n primaryKeyValue: ctx.params.pk,\n columns: schema.columns.map((col) => col.name),\n },\n };\n }\n\n // ========== Write Handlers ==========\n\n /**\n * Create a new row\n */\n @Write(\"/:table/new\")\n async createRowHandler(\n ctx: RouteContext<{ table: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.crud.createRow(ctx.params.table, content.content ?? content);\n }\n\n /**\n * Update an existing row\n */\n @Write(\"/:table/:pk\")\n async updateRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.crud.updateRow(ctx.params.table, ctx.params.pk, content.content ?? content);\n }\n\n /**\n * Execute action via write (for triggering row-level actions)\n */\n @Write(\"/:table/:pk/.actions/:action\")\n async executeActionWriteHandler(\n ctx: RouteContext<{ table: string; pk: string; action: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.executeAction(\n ctx.params.table,\n ctx.params.pk,\n ctx.params.action,\n (content.content ?? content) as Record<string, unknown>,\n );\n }\n\n /**\n * Execute action via write (for triggering table-level actions)\n */\n @Write(\"/:table/.actions/:action\")\n async executeTableActionWriteHandler(\n ctx: RouteContext<{ table: string; action: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.executeAction(\n ctx.params.table,\n undefined, // No pk for table-level action\n ctx.params.action,\n (content.content ?? content) as Record<string, unknown>,\n );\n }\n\n /**\n * Execute action via write (for triggering root-level actions)\n */\n @Write(\"/.actions/:action\")\n async executeRootActionWriteHandler(\n ctx: RouteContext<{ action: string }>,\n content: AFSWriteEntryPayload,\n ): Promise<{ data: AFSEntry }> {\n await this.ensureInitialized();\n return this.executeRootAction(\n ctx.params.action,\n (content.content ?? content) as Record<string, unknown>,\n );\n }\n\n // ========== Delete Handlers ==========\n\n /**\n * Delete a table entry (not supported - always throws)\n */\n @Delete(\"/:table\")\n async deleteTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSDeleteResult> {\n await this.ensureInitialized();\n // Check if table exists, then throw appropriate error\n const exists = await this.schemaService.hasTable(ctx.params.table);\n if (!exists) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n // Tables can't be deleted through AFS - throw error\n throw new Error(`Cannot delete table '${ctx.params.table}'. Use SQL directly to drop tables.`);\n }\n\n /**\n * Delete a row\n */\n @Delete(\"/:table/:pk\")\n async deleteRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSDeleteResult> {\n await this.ensureInitialized();\n return this.crud.deleteRow(ctx.params.table, ctx.params.pk);\n }\n\n // ========== Search Handlers ==========\n\n /**\n * Search all tables\n */\n @Search(\"/\")\n async searchAllHandler(\n _ctx: RouteContext,\n query: string,\n options?: AFSSearchOptions,\n ): Promise<{ data: AFSEntry[]; message?: string }> {\n await this.ensureInitialized();\n return this.ftsSearch.search(query, options);\n }\n\n /**\n * Search a specific table\n */\n @Search(\"/:table\")\n async searchTableHandler(\n ctx: RouteContext<{ table: string }>,\n query: string,\n options?: AFSSearchOptions,\n ): Promise<{ data: AFSEntry[]; message?: string }> {\n await this.ensureInitialized();\n return this.ftsSearch.searchTable(ctx.params.table, query, options);\n }\n\n // ========== Stat Handlers ==========\n\n /**\n * Get stat for root (database level)\n */\n @Stat(\"/\")\n async statRootHandler(_ctx: RouteContext): Promise<AFSStatResult> {\n await this.ensureInitialized();\n const schemas = await this.schemaService.getAllSchemas();\n const actions = this.actions.listWithInfo(\n { rootLevel: true },\n { schemaService: this.schemaService },\n );\n\n return {\n data: {\n id: \"/\",\n path: \"/\",\n meta: {\n kind: \"sqlite:database\",\n kinds: [\"sqlite:database\", \"afs:node\"],\n tableCount: schemas.size,\n childrenCount: schemas.size,\n },\n actions:\n actions.length > 0\n ? actions.map((a) => ({ name: a.name, description: a.description }))\n : undefined,\n },\n };\n }\n\n /**\n * Get stat for a table\n */\n @Stat(\"/:table\")\n async statTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSStatResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n // Get table-level actions\n const actions = this.actions.listWithInfo(\n { tableLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n\n // Build detailed columns array for metadata display\n const columns = schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n }));\n\n return {\n data: {\n id: ctx.params.table,\n path: `/${ctx.params.table}`,\n meta: {\n kind: \"sqlite:table\",\n kinds: [\"sqlite:table\", \"afs:node\"],\n table: ctx.params.table,\n columnCount: schema.columns.length,\n columns,\n primaryKey: schema.primaryKey[0],\n childrenCount: rowCount,\n },\n actions:\n actions.length > 0\n ? actions.map((a) => ({ name: a.name, description: a.description }))\n : undefined,\n },\n };\n }\n\n /**\n * Get stat for a row\n */\n @Stat(\"/:table/:pk\")\n async statRowHandler(ctx: RouteContext<{ table: string; pk: string }>): Promise<AFSStatResult> {\n await this.ensureInitialized();\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Verify row exists\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n\n // Get row-level actions\n const actions = this.actions.listWithInfo(\n { rowLevel: true },\n {\n tableSchema: schema,\n tableName: ctx.params.table,\n schemaService: this.schemaService,\n },\n );\n\n // Build detailed columns array for metadata display\n const columns = schema.columns.map((col) => ({\n name: col.name,\n type: col.type,\n nullable: !col.notnull,\n primaryKey: col.pk > 0,\n }));\n\n return {\n data: {\n id: ctx.params.pk,\n path: `/${ctx.params.table}/${ctx.params.pk}`,\n meta: {\n kind: \"sqlite:row\",\n kinds: [\"sqlite:row\", \"afs:node\"],\n table: ctx.params.table,\n primaryKey: ctx.params.pk,\n columnCount: schema.columns.length,\n columns,\n childrenCount: 0,\n },\n actions:\n actions.length > 0\n ? actions.map((a) => ({ name: a.name, description: a.description }))\n : undefined,\n },\n };\n }\n\n // ========== Explain Handlers ==========\n\n /**\n * Explain root (database level)\n */\n @Explain(\"/\")\n async explainRootHandler(ctx: RouteContext): Promise<AFSExplainResult> {\n await this.ensureInitialized();\n const format = (ctx.options as AFSExplainOptions)?.format || \"markdown\";\n const schemas = await this.schemaService.getAllSchemas();\n const tables = Array.from(schemas.values());\n\n const lines: string[] = [];\n\n if (format === \"markdown\") {\n lines.push(`# ${this.name}`);\n lines.push(\"\");\n lines.push(`**Type:** SQLite Database`);\n lines.push(`**Tables:** ${tables.length}`);\n lines.push(\"\");\n\n if (tables.length > 0) {\n lines.push(\"## Tables\");\n lines.push(\"\");\n lines.push(\"| Table | Columns | Primary Key |\");\n lines.push(\"|-------|---------|-------------|\");\n for (const table of tables) {\n const pk = table.primaryKey.join(\", \") || \"rowid\";\n lines.push(`| ${table.name} | ${table.columns.length} | ${pk} |`);\n }\n }\n } else {\n lines.push(`${this.name} (SQLite Database)`);\n lines.push(`Tables: ${tables.length}`);\n for (const table of tables) {\n lines.push(` - ${table.name} (${table.columns.length} columns)`);\n }\n }\n\n return { content: lines.join(\"\\n\"), format };\n }\n\n /**\n * Explain a table\n */\n @Explain(\"/:table\")\n async explainTableHandler(ctx: RouteContext<{ table: string }>): Promise<AFSExplainResult> {\n await this.ensureInitialized();\n const format = (ctx.options as AFSExplainOptions)?.format || \"markdown\";\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Get row count\n const countResult = await (this.db as unknown as LibSQLDatabase).all<{ count: number }>(\n sql.raw(`SELECT COUNT(*) as count FROM \"${ctx.params.table}\"`),\n );\n const rowCount = countResult[0]?.count ?? 0;\n\n const lines: string[] = [];\n\n if (format === \"markdown\") {\n lines.push(`# ${ctx.params.table}`);\n lines.push(\"\");\n lines.push(`**Type:** SQLite Table`);\n lines.push(`**Rows:** ${rowCount}`);\n lines.push(`**Primary Key:** ${schema.primaryKey.join(\", \") || \"rowid\"}`);\n lines.push(\"\");\n\n // Column table\n lines.push(\"## Columns\");\n lines.push(\"\");\n lines.push(\"| Column | Type | Nullable | Primary Key | Default |\");\n lines.push(\"|--------|------|----------|-------------|---------|\");\n for (const col of schema.columns) {\n const nullable = col.notnull ? \"NO\" : \"YES\";\n const pk = col.pk > 0 ? \"YES\" : \"\";\n const dflt =\n col.dfltValue !== null && col.dfltValue !== undefined ? String(col.dfltValue) : \"\";\n lines.push(`| ${col.name} | ${col.type} | ${nullable} | ${pk} | ${dflt} |`);\n }\n\n // Indexes\n if (schema.indexes.length > 0) {\n lines.push(\"\");\n lines.push(\"## Indexes\");\n lines.push(\"\");\n for (const idx of schema.indexes) {\n const uniqueStr = idx.unique ? \" (UNIQUE)\" : \"\";\n lines.push(`- **${idx.name}**${uniqueStr}`);\n }\n }\n\n // Foreign keys\n if (schema.foreignKeys.length > 0) {\n lines.push(\"\");\n lines.push(\"## Foreign Keys\");\n lines.push(\"\");\n for (const fk of schema.foreignKeys) {\n lines.push(`- \\`${fk.from}\\` → \\`${fk.table}\\`(\\`${fk.to}\\`) ON DELETE ${fk.onDelete}`);\n }\n }\n } else {\n lines.push(`${ctx.params.table} (SQLite Table)`);\n lines.push(`Rows: ${rowCount}`);\n lines.push(`Primary Key: ${schema.primaryKey.join(\", \") || \"rowid\"}`);\n lines.push(`Columns: ${schema.columns.map((c) => `${c.name} (${c.type})`).join(\", \")}`);\n if (schema.indexes.length > 0) {\n lines.push(`Indexes: ${schema.indexes.map((i) => i.name).join(\", \")}`);\n }\n if (schema.foreignKeys.length > 0) {\n lines.push(\n `Foreign Keys: ${schema.foreignKeys.map((fk) => `${fk.from} → ${fk.table}(${fk.to})`).join(\", \")}`,\n );\n }\n }\n\n return { content: lines.join(\"\\n\"), format };\n }\n\n /**\n * Explain a row\n */\n @Explain(\"/:table/:pk\")\n async explainRowHandler(\n ctx: RouteContext<{ table: string; pk: string }>,\n ): Promise<AFSExplainResult> {\n await this.ensureInitialized();\n const format = (ctx.options as AFSExplainOptions)?.format || \"markdown\";\n const schema = await this.schemaService.getSchema(ctx.params.table);\n if (!schema) {\n throw new AFSNotFoundError(`/${ctx.params.table}`);\n }\n\n // Read the row\n const result = await this.crud.readRow(ctx.params.table, ctx.params.pk);\n if (!result.data) {\n throw new AFSNotFoundError(`/${ctx.params.table}/${ctx.params.pk}`);\n }\n\n const rowContent = result.data.content as Record<string, unknown> | undefined;\n const pkColumn = schema.primaryKey[0] ?? \"rowid\";\n\n const lines: string[] = [];\n\n if (format === \"markdown\") {\n lines.push(`# ${ctx.params.table}/${ctx.params.pk}`);\n lines.push(\"\");\n lines.push(`**Table:** ${ctx.params.table}`);\n lines.push(`**Primary Key:** ${pkColumn} = ${ctx.params.pk}`);\n lines.push(\"\");\n\n if (rowContent) {\n lines.push(\"## Values\");\n lines.push(\"\");\n lines.push(\"| Column | Value |\");\n lines.push(\"|--------|-------|\");\n for (const col of schema.columns) {\n const val = rowContent[col.name];\n const displayVal =\n val === null || val === undefined ? \"*null*\" : truncateValue(String(val), 100);\n lines.push(`| ${col.name} | ${displayVal} |`);\n }\n }\n } else {\n lines.push(`${ctx.params.table}/${ctx.params.pk} (SQLite Row)`);\n lines.push(`Table: ${ctx.params.table}, ${pkColumn} = ${ctx.params.pk}`);\n if (rowContent) {\n for (const col of schema.columns) {\n const val = rowContent[col.name];\n lines.push(\n ` ${col.name}: ${val === null || val === undefined ? \"null\" : truncateValue(String(val), 100)}`,\n );\n }\n }\n }\n\n return { content: lines.join(\"\\n\"), format };\n }\n\n // ========== Exec Handlers ==========\n\n /**\n * Execute action via exec (row-level)\n */\n @Actions.Exec(\"/:table/:pk\")\n async handleRowActionExec(\n ctx: RouteContext<{ table: string; pk: string; action: string }>,\n args: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n await this.ensureInitialized();\n return this.executeActionRaw(ctx.params.table, ctx.params.pk, ctx.params.action, args);\n }\n\n /**\n * Execute action via exec (table-level)\n */\n @Actions.Exec(\"/:table\")\n async handleTableActionExec(\n ctx: RouteContext<{ table: string; action: string }>,\n args: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n await this.ensureInitialized();\n return this.executeActionRaw(\n ctx.params.table,\n undefined, // No pk for table-level action\n ctx.params.action,\n args,\n );\n }\n\n /**\n * Execute action via exec (root-level)\n */\n @Actions.Exec(\"/\")\n async handleRootActionExec(\n ctx: RouteContext<{ action: string }>,\n args: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n await this.ensureInitialized();\n return this.executeRootActionRaw(ctx.params.action, args);\n }\n\n // ========== Helper Methods ==========\n\n /**\n * Executes an action and returns raw result (for exec handlers)\n * Returns AFSExecResult structure: { success: boolean, data?: Record<string, unknown> }\n */\n private async executeActionRaw(\n table: string,\n pk: string | undefined,\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n const schema = await this.schemaService.getSchema(table);\n if (!schema) {\n throw new AFSNotFoundError(`/${table}`);\n }\n\n // Get row data if pk is provided\n let row: Record<string, unknown> | undefined;\n if (pk) {\n const readResult = await this.crud.readRow(table, pk);\n row = readResult.data?.content as Record<string, unknown> | undefined;\n }\n\n const ctx: ActionContext = {\n db: this.db as unknown as LibSQLDatabase,\n schemaService: this.schemaService,\n table,\n pk,\n row,\n module: {\n exportTable: (t, f) => this.exportTable(t, f),\n },\n };\n\n const result = await this.actions.execute(actionName, ctx, params);\n\n if (!result.success) {\n throw new Error(result.message ?? \"Action failed\");\n }\n\n // Return AFSExecResult structure\n // Handle arrays specially - wrap in data property\n if (Array.isArray(result.data)) {\n return {\n success: true,\n data: { data: result.data },\n };\n }\n\n return {\n success: true,\n data: result.data as Record<string, unknown>,\n };\n }\n\n /**\n * Executes a root-level action and returns raw result (for exec handlers)\n * Returns AFSExecResult structure: { success: boolean, data?: Record<string, unknown> }\n */\n private async executeRootActionRaw(\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ success: boolean; data?: Record<string, unknown> }> {\n const ctx: ActionContext = {\n db: this.db as unknown as LibSQLDatabase,\n schemaService: this.schemaService,\n table: \"\", // No specific table for root-level actions\n module: {\n exportTable: (t, f) => this.exportTable(t, f),\n },\n };\n\n const result = await this.actions.execute(actionName, ctx, params);\n\n if (!result.success) {\n throw new Error(result.message ?? \"Action failed\");\n }\n\n // Return AFSExecResult structure\n // Handle arrays specially - wrap in data property\n if (Array.isArray(result.data)) {\n return {\n success: true,\n data: { data: result.data },\n };\n }\n\n return {\n success: true,\n data: result.data as Record<string, unknown>,\n };\n }\n\n /**\n * Executes an action (for write handlers - wraps in AFSEntry)\n */\n private async executeAction(\n table: string,\n pk: string | undefined,\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ data: AFSEntry }> {\n const result = await this.executeActionRaw(table, pk, actionName, params);\n\n return {\n data: {\n id: `${table}:${pk ?? \"\"}:.actions:${actionName}`,\n path: pk ? `/${table}/${pk}/.actions/${actionName}` : `/${table}/.actions/${actionName}`,\n content: result,\n },\n };\n }\n\n /**\n * Executes a root-level action (for write handlers - wraps in AFSEntry)\n */\n private async executeRootAction(\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<{ data: AFSEntry }> {\n const result = await this.executeRootActionRaw(actionName, params);\n\n return {\n data: {\n id: `:.actions:${actionName}`,\n path: `/.actions/${actionName}`,\n content: result,\n },\n };\n }\n\n /**\n * Exports table data in specified format\n */\n async exportTable(table: string, format: string): Promise<unknown> {\n const listResult = await this.crud.listTable(table, { limit: 10000 });\n\n if (format === \"csv\") {\n const schema = await this.schemaService.getSchema(table);\n if (!schema) throw new AFSNotFoundError(`/${table}`);\n\n const headers = schema.columns.map((c) => c.name).join(\",\");\n const rows = listResult.data.map((entry) => {\n const content = entry.content as Record<string, unknown>;\n return schema.columns\n .map((c) => {\n const val = content[c.name];\n if (val === null || val === undefined) return \"\";\n if (typeof val === \"string\" && (val.includes(\",\") || val.includes('\"'))) {\n return `\"${val.replace(/\"/g, '\"\"')}\"`;\n }\n return String(val);\n })\n .join(\",\");\n });\n\n return `${headers}\\n${rows.join(\"\\n\")}`;\n }\n\n // Default: JSON\n return listResult.data.map((entry) => entry.content);\n }\n\n /**\n * Registers a custom action\n */\n registerAction(\n name: string,\n handler: (ctx: ActionContext, params: Record<string, unknown>) => Promise<unknown>,\n options?: {\n description?: string;\n tableLevel?: boolean;\n rowLevel?: boolean;\n },\n ): void {\n this.actions.registerSimple(\n name,\n async (ctx, params) => ({\n success: true,\n data: await handler(ctx, params),\n }),\n options,\n );\n }\n\n /**\n * Gets table schemas (for external access)\n * Note: This queries the database on-demand\n */\n async getSchemas(): Promise<Map<string, TableSchema>> {\n await this.ensureInitialized();\n return this.schemaService.getAllSchemas();\n }\n\n /**\n * Gets the database instance (for advanced operations)\n */\n getDatabase(): LibSQLDatabase {\n return this.db as unknown as LibSQLDatabase;\n }\n}\n\n/**\n * Truncate a string value for display purposes.\n */\nfunction truncateValue(value: string, maxLength: number): string {\n if (value.length <= maxLength) return value;\n return `${value.slice(0, maxLength)}...`;\n}\n\n// Type check to ensure SQLiteAFS implements AFSModuleClass\nconst _typeCheck: AFSModuleClass<SQLiteAFS, SQLiteAFSOptions> = SQLiteAFS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsDA,IAAa,YAAb,MAAa,kBAAkB,gBAAgB;CAC7C,AAAkB;CAClB,AAAkB;CAClB,AAAkB;CAElB,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ,cAAc;CAEtB,YAAY,AAAQ,SAAkE;AACpF,SAAO;EADW;AAIlB,MAAK,QAAgB,aAAa,CAAC,QAAQ,IACzC,SAAQ,MAAM,QAAS,QAAgB;AAIzC,MAAI,QAAQ,IAAI,WAAW,QAAQ,EAAE;GACnC,MAAM,EAAE,YAAY,WAAW,4BACrB,UAAU;GACpB,MAAM,EAAE,sBAAoB,YAAY;GACxC,MAAM,SAAS,QAAQ,IAAI,MAAM,EAAE;AACnC,OAAI,CAAC,WAAW,OAAO,EAAE;AACvB,cAAU,QAAQ,OAAO,EAAE,EAAE,WAAW,MAAM,CAAC;AAC/C,kBAAc,QAAQ,GAAG;;;AAI7B,OAAK,OAAO,QAAQ,QAAQ;AAC5B,OAAK,cAAc,QAAQ,eAAe,oBAAoB,QAAQ;AACtE,OAAK,aAAa,QAAQ,cAAc;AACxC,OAAK,YAAY,gBAAgB,QAAQ,IAAI;AAC7C,OAAK,UAAU,IAAI,iBAAiB;AACpC,yBAAuB,KAAK,QAAQ;;;;;CAMtC,OAAO,SAAS;AACd,SAAO;;CAGT,OAAO,WAA6B;AAClC,SAAO;GACL,MAAM;GACN,aAAa;GACb,aAAa;GACb,UAAU;GACV,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ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,KAAK,UAAU;YAiBvB,QAAQ,KAAK,IAAI;;;;AAuNpB,SAAS,cAAc,OAAe,WAA2B;AAC/D,KAAI,MAAM,UAAU,UAAW,QAAO;AACtC,QAAO,GAAG,MAAM,MAAM,GAAG,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/afs-sqlite",
|
|
3
|
-
"version": "1.11.0-beta.
|
|
3
|
+
"version": "1.11.0-beta.9",
|
|
4
4
|
"description": "AIGNE AFS module for SQLite database storage with schema introspection",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@aigne/sqlite": "^0.4.9",
|
|
37
37
|
"drizzle-orm": "^0.44.5",
|
|
38
38
|
"radix3": "^1.1.2",
|
|
39
|
-
"zod": "^
|
|
40
|
-
"@aigne/afs": "^1.11.0-beta.
|
|
39
|
+
"zod": "^4.0.0",
|
|
40
|
+
"@aigne/afs": "^1.11.0-beta.9"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/bun": "^1.3.6",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"typescript": "5.9.2",
|
|
48
48
|
"@aigne/scripts": "0.0.0",
|
|
49
49
|
"@aigne/typescript-config": "0.0.0",
|
|
50
|
-
"@aigne/afs-testing": "1.11.0-beta.
|
|
50
|
+
"@aigne/afs-testing": "1.11.0-beta.9"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsdown",
|