@aigne/afs-sqlite 1.11.0-beta.1 → 1.11.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.cjs +11 -0
- package/dist/_virtual/_@oxc-project_runtime@0.108.0/helpers/decorate.mjs +10 -0
- package/dist/_virtual/rolldown_runtime.mjs +7 -0
- package/dist/actions/built-in.cjs +1262 -15
- package/dist/actions/built-in.d.cts.map +1 -1
- package/dist/actions/built-in.d.mts.map +1 -1
- package/dist/actions/built-in.mjs +1262 -15
- package/dist/actions/built-in.mjs.map +1 -1
- package/dist/actions/operators.cjs +156 -0
- package/dist/actions/operators.mjs +157 -0
- package/dist/actions/operators.mjs.map +1 -0
- package/dist/actions/registry.cjs +35 -3
- package/dist/actions/registry.d.cts +36 -17
- package/dist/actions/registry.d.cts.map +1 -1
- package/dist/actions/registry.d.mts +36 -17
- package/dist/actions/registry.d.mts.map +1 -1
- package/dist/actions/registry.mjs +35 -3
- package/dist/actions/registry.mjs.map +1 -1
- package/dist/actions/types.cjs +33 -0
- package/dist/actions/types.d.cts +46 -5
- package/dist/actions/types.d.cts.map +1 -1
- package/dist/actions/types.d.mts +46 -5
- package/dist/actions/types.d.mts.map +1 -1
- package/dist/actions/types.mjs +32 -0
- package/dist/actions/types.mjs.map +1 -0
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +9 -36
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +9 -36
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +3 -2
- package/dist/node/builder.cjs +74 -91
- package/dist/node/builder.d.cts +11 -15
- package/dist/node/builder.d.cts.map +1 -1
- package/dist/node/builder.d.mts +11 -15
- package/dist/node/builder.d.mts.map +1 -1
- package/dist/node/builder.mjs +72 -89
- package/dist/node/builder.mjs.map +1 -1
- package/dist/operations/crud.cjs +24 -68
- package/dist/operations/crud.d.cts +23 -38
- package/dist/operations/crud.d.cts.map +1 -1
- package/dist/operations/crud.d.mts +23 -38
- package/dist/operations/crud.d.mts.map +1 -1
- package/dist/operations/crud.mjs +25 -69
- package/dist/operations/crud.mjs.map +1 -1
- package/dist/operations/query-builder.cjs +2 -2
- package/dist/operations/query-builder.d.cts.map +1 -1
- package/dist/operations/query-builder.d.mts.map +1 -1
- package/dist/operations/query-builder.mjs +2 -2
- package/dist/operations/query-builder.mjs.map +1 -1
- package/dist/operations/search.cjs +5 -11
- package/dist/operations/search.d.cts +19 -23
- package/dist/operations/search.d.cts.map +1 -1
- package/dist/operations/search.d.mts +19 -23
- package/dist/operations/search.d.mts.map +1 -1
- package/dist/operations/search.mjs +5 -11
- package/dist/operations/search.mjs.map +1 -1
- package/dist/router/path-router.cjs +7 -15
- package/dist/router/path-router.d.cts +4 -7
- package/dist/router/path-router.d.cts.map +1 -1
- package/dist/router/path-router.d.mts +4 -7
- package/dist/router/path-router.d.mts.map +1 -1
- package/dist/router/path-router.mjs +7 -15
- package/dist/router/path-router.mjs.map +1 -1
- package/dist/router/types.d.cts.map +1 -1
- package/dist/router/types.d.mts.map +1 -1
- package/dist/schema/introspector.d.cts +19 -19
- package/dist/schema/introspector.d.cts.map +1 -1
- package/dist/schema/introspector.d.mts +19 -19
- package/dist/schema/introspector.d.mts.map +1 -1
- package/dist/schema/service.cjs +86 -0
- package/dist/schema/service.d.cts +52 -0
- package/dist/schema/service.d.cts.map +1 -0
- package/dist/schema/service.d.mts +52 -0
- package/dist/schema/service.d.mts.map +1 -0
- package/dist/schema/service.mjs +87 -0
- package/dist/schema/service.mjs.map +1 -0
- package/dist/schema/types.d.cts.map +1 -1
- package/dist/schema/types.d.mts.map +1 -1
- package/dist/sqlite-afs.cjs +693 -121
- package/dist/sqlite-afs.d.cts +279 -101
- package/dist/sqlite-afs.d.cts.map +1 -1
- package/dist/sqlite-afs.d.mts +279 -101
- package/dist/sqlite-afs.d.mts.map +1 -1
- package/dist/sqlite-afs.mjs +696 -123
- package/dist/sqlite-afs.mjs.map +1 -1
- package/package.json +5 -4
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":"
|
|
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/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1
2
|
const require_built_in = require('./actions/built-in.cjs');
|
|
2
3
|
const require_registry = require('./actions/registry.cjs');
|
|
3
4
|
const require_config = require('./config.cjs');
|
|
@@ -7,6 +8,7 @@ const require_crud = require('./operations/crud.cjs');
|
|
|
7
8
|
const require_search = require('./operations/search.cjs');
|
|
8
9
|
const require_path_router = require('./router/path-router.cjs');
|
|
9
10
|
const require_introspector = require('./schema/introspector.cjs');
|
|
11
|
+
const require_service = require('./schema/service.cjs');
|
|
10
12
|
const require_sqlite_afs = require('./sqlite-afs.cjs');
|
|
11
13
|
|
|
12
14
|
exports.ActionsRegistry = require_registry.ActionsRegistry;
|
|
@@ -14,16 +16,14 @@ exports.CRUDOperations = require_crud.CRUDOperations;
|
|
|
14
16
|
exports.FTSSearch = require_search.FTSSearch;
|
|
15
17
|
exports.SQLiteAFS = require_sqlite_afs.SQLiteAFS;
|
|
16
18
|
exports.SchemaIntrospector = require_introspector.SchemaIntrospector;
|
|
19
|
+
exports.SchemaService = require_service.SchemaService;
|
|
17
20
|
exports.buildActionsListEntry = require_builder.buildActionsListEntry;
|
|
18
|
-
exports.buildAttributeEntry = require_builder.buildAttributeEntry;
|
|
19
|
-
exports.buildAttributeListEntry = require_builder.buildAttributeListEntry;
|
|
20
21
|
exports.buildDelete = require_query_builder.buildDelete;
|
|
21
22
|
exports.buildGetLastRowId = require_query_builder.buildGetLastRowId;
|
|
22
23
|
exports.buildInsert = require_query_builder.buildInsert;
|
|
23
24
|
exports.buildMetaEntry = require_builder.buildMetaEntry;
|
|
24
25
|
exports.buildPath = require_path_router.buildPath;
|
|
25
26
|
exports.buildRowEntry = require_builder.buildRowEntry;
|
|
26
|
-
exports.buildSchemaEntry = require_builder.buildSchemaEntry;
|
|
27
27
|
exports.buildSearchEntry = require_builder.buildSearchEntry;
|
|
28
28
|
exports.buildSelectAll = require_query_builder.buildSelectAll;
|
|
29
29
|
exports.buildSelectByPK = require_query_builder.buildSelectByPK;
|
|
@@ -31,6 +31,7 @@ exports.buildTableEntry = require_builder.buildTableEntry;
|
|
|
31
31
|
exports.buildUpdate = require_query_builder.buildUpdate;
|
|
32
32
|
exports.createFTSConfig = require_search.createFTSConfig;
|
|
33
33
|
exports.createPathRouter = require_path_router.createPathRouter;
|
|
34
|
+
exports.default = require_sqlite_afs.SQLiteAFS;
|
|
34
35
|
exports.getVirtualPathType = require_path_router.getVirtualPathType;
|
|
35
36
|
exports.isVirtualPath = require_path_router.isVirtualPath;
|
|
36
37
|
exports.matchPath = require_path_router.matchPath;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ColumnInfo, ForeignKeyInfo, IndexInfo, PragmaForeignKeyRow, PragmaIndexListRow, PragmaTableInfoRow, TableSchema } from "./schema/types.cjs";
|
|
2
|
-
import {
|
|
2
|
+
import { SchemaService, SchemaServiceOptions } from "./schema/service.cjs";
|
|
3
|
+
import { ActionContext, ActionDefinition, ActionHandler, ActionResult, SchemaGeneratorContext } from "./actions/types.cjs";
|
|
3
4
|
import { ActionsRegistry } from "./actions/registry.cjs";
|
|
4
5
|
import { registerBuiltInActions } from "./actions/built-in.cjs";
|
|
5
6
|
import { SQLiteAFSConfig, SQLiteAFSOptions, sqliteAFSConfigSchema } from "./config.cjs";
|
|
6
|
-
import { BuildEntryOptions, buildActionsListEntry,
|
|
7
|
+
import { BuildEntryOptions, buildActionsListEntry, buildMetaEntry, buildRowEntry, buildSearchEntry, buildTableEntry } from "./node/builder.cjs";
|
|
7
8
|
import { CRUDOperations } from "./operations/crud.cjs";
|
|
8
9
|
import { buildDelete, buildGetLastRowId, buildInsert, buildSelectAll, buildSelectByPK, buildUpdate } from "./operations/query-builder.cjs";
|
|
9
10
|
import { FTSConfig, FTSSearch, FTSTableConfig, createFTSConfig } from "./operations/search.cjs";
|
|
@@ -11,4 +12,4 @@ import { RouteAction, RouteData, RouteMatch, RouteParams } from "./router/types.
|
|
|
11
12
|
import { buildPath, createPathRouter, getVirtualPathType, isVirtualPath, matchPath } from "./router/path-router.cjs";
|
|
12
13
|
import { SchemaIntrospector } from "./schema/introspector.cjs";
|
|
13
14
|
import { SQLiteAFS } from "./sqlite-afs.cjs";
|
|
14
|
-
export { type ActionContext, type ActionDefinition, type ActionHandler, type ActionResult, ActionsRegistry, type BuildEntryOptions, CRUDOperations, type ColumnInfo, type FTSConfig, FTSSearch, type FTSTableConfig, type ForeignKeyInfo, type IndexInfo, type PragmaForeignKeyRow, type PragmaIndexListRow, type PragmaTableInfoRow, type RouteAction, type RouteData, type RouteMatch, type RouteParams, SQLiteAFS, type SQLiteAFSConfig, type SQLiteAFSOptions, SchemaIntrospector, type
|
|
15
|
+
export { type ActionContext, type ActionDefinition, type ActionHandler, type ActionResult, ActionsRegistry, type BuildEntryOptions, CRUDOperations, type ColumnInfo, type FTSConfig, FTSSearch, type FTSTableConfig, type ForeignKeyInfo, type IndexInfo, type PragmaForeignKeyRow, type PragmaIndexListRow, type PragmaTableInfoRow, type RouteAction, type RouteData, type RouteMatch, type RouteParams, SQLiteAFS, type SQLiteAFSConfig, type SQLiteAFSOptions, type SchemaGeneratorContext, SchemaIntrospector, SchemaService, type SchemaServiceOptions, type TableSchema, buildActionsListEntry, buildDelete, buildGetLastRowId, buildInsert, buildMetaEntry, buildPath, buildRowEntry, buildSearchEntry, buildSelectAll, buildSelectByPK, buildTableEntry, buildUpdate, createFTSConfig, createPathRouter, SQLiteAFS as default, getVirtualPathType, isVirtualPath, matchPath, registerBuiltInActions, sqliteAFSConfigSchema };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ColumnInfo, ForeignKeyInfo, IndexInfo, PragmaForeignKeyRow, PragmaIndexListRow, PragmaTableInfoRow, TableSchema } from "./schema/types.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { SchemaService, SchemaServiceOptions } from "./schema/service.mjs";
|
|
3
|
+
import { ActionContext, ActionDefinition, ActionHandler, ActionResult, SchemaGeneratorContext } from "./actions/types.mjs";
|
|
3
4
|
import { ActionsRegistry } from "./actions/registry.mjs";
|
|
4
5
|
import { registerBuiltInActions } from "./actions/built-in.mjs";
|
|
5
6
|
import { SQLiteAFSConfig, SQLiteAFSOptions, sqliteAFSConfigSchema } from "./config.mjs";
|
|
6
|
-
import { BuildEntryOptions, buildActionsListEntry,
|
|
7
|
+
import { BuildEntryOptions, buildActionsListEntry, buildMetaEntry, buildRowEntry, buildSearchEntry, buildTableEntry } from "./node/builder.mjs";
|
|
7
8
|
import { CRUDOperations } from "./operations/crud.mjs";
|
|
8
9
|
import { buildDelete, buildGetLastRowId, buildInsert, buildSelectAll, buildSelectByPK, buildUpdate } from "./operations/query-builder.mjs";
|
|
9
10
|
import { FTSConfig, FTSSearch, FTSTableConfig, createFTSConfig } from "./operations/search.mjs";
|
|
@@ -11,4 +12,4 @@ import { RouteAction, RouteData, RouteMatch, RouteParams } from "./router/types.
|
|
|
11
12
|
import { buildPath, createPathRouter, getVirtualPathType, isVirtualPath, matchPath } from "./router/path-router.mjs";
|
|
12
13
|
import { SchemaIntrospector } from "./schema/introspector.mjs";
|
|
13
14
|
import { SQLiteAFS } from "./sqlite-afs.mjs";
|
|
14
|
-
export { type ActionContext, type ActionDefinition, type ActionHandler, type ActionResult, ActionsRegistry, type BuildEntryOptions, CRUDOperations, type ColumnInfo, type FTSConfig, FTSSearch, type FTSTableConfig, type ForeignKeyInfo, type IndexInfo, type PragmaForeignKeyRow, type PragmaIndexListRow, type PragmaTableInfoRow, type RouteAction, type RouteData, type RouteMatch, type RouteParams, SQLiteAFS, type SQLiteAFSConfig, type SQLiteAFSOptions, SchemaIntrospector, type
|
|
15
|
+
export { type ActionContext, type ActionDefinition, type ActionHandler, type ActionResult, ActionsRegistry, type BuildEntryOptions, CRUDOperations, type ColumnInfo, type FTSConfig, FTSSearch, type FTSTableConfig, type ForeignKeyInfo, type IndexInfo, type PragmaForeignKeyRow, type PragmaIndexListRow, type PragmaTableInfoRow, type RouteAction, type RouteData, type RouteMatch, type RouteParams, SQLiteAFS, type SQLiteAFSConfig, type SQLiteAFSOptions, type SchemaGeneratorContext, SchemaIntrospector, SchemaService, type SchemaServiceOptions, type TableSchema, buildActionsListEntry, buildDelete, buildGetLastRowId, buildInsert, buildMetaEntry, buildPath, buildRowEntry, buildSearchEntry, buildSelectAll, buildSelectByPK, buildTableEntry, buildUpdate, createFTSConfig, createPathRouter, SQLiteAFS as default, getVirtualPathType, isVirtualPath, matchPath, registerBuiltInActions, sqliteAFSConfigSchema };
|
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { registerBuiltInActions } from "./actions/built-in.mjs";
|
|
2
2
|
import { ActionsRegistry } from "./actions/registry.mjs";
|
|
3
3
|
import { sqliteAFSConfigSchema } from "./config.mjs";
|
|
4
|
-
import { buildActionsListEntry,
|
|
4
|
+
import { buildActionsListEntry, buildMetaEntry, buildRowEntry, buildSearchEntry, buildTableEntry } from "./node/builder.mjs";
|
|
5
5
|
import { buildDelete, buildGetLastRowId, buildInsert, buildSelectAll, buildSelectByPK, buildUpdate } from "./operations/query-builder.mjs";
|
|
6
6
|
import { CRUDOperations } from "./operations/crud.mjs";
|
|
7
7
|
import { FTSSearch, createFTSConfig } from "./operations/search.mjs";
|
|
8
8
|
import { buildPath, createPathRouter, getVirtualPathType, isVirtualPath, matchPath } from "./router/path-router.mjs";
|
|
9
9
|
import { SchemaIntrospector } from "./schema/introspector.mjs";
|
|
10
|
+
import { SchemaService } from "./schema/service.mjs";
|
|
10
11
|
import { SQLiteAFS } from "./sqlite-afs.mjs";
|
|
11
12
|
|
|
12
|
-
export { ActionsRegistry, CRUDOperations, FTSSearch, SQLiteAFS, SchemaIntrospector,
|
|
13
|
+
export { ActionsRegistry, CRUDOperations, FTSSearch, SQLiteAFS, SchemaIntrospector, SchemaService, buildActionsListEntry, buildDelete, buildGetLastRowId, buildInsert, buildMetaEntry, buildPath, buildRowEntry, buildSearchEntry, buildSelectAll, buildSelectByPK, buildTableEntry, buildUpdate, createFTSConfig, createPathRouter, SQLiteAFS as default, getVirtualPathType, isVirtualPath, matchPath, registerBuiltInActions, sqliteAFSConfigSchema };
|
package/dist/node/builder.cjs
CHANGED
|
@@ -11,7 +11,8 @@ function buildRowEntry(table, schema, row, options) {
|
|
|
11
11
|
id: `${table}:${pk}`,
|
|
12
12
|
path: `${basePath}/${table}/${pk}`,
|
|
13
13
|
content: row,
|
|
14
|
-
|
|
14
|
+
meta: {
|
|
15
|
+
kind: "sqlite:row",
|
|
15
16
|
table,
|
|
16
17
|
primaryKey: pkColumn,
|
|
17
18
|
primaryKeyValue: pk
|
|
@@ -27,91 +28,18 @@ function buildTableEntry(table, schema, options) {
|
|
|
27
28
|
return {
|
|
28
29
|
id: table,
|
|
29
30
|
path: `${options?.basePath ?? ""}/${table}`,
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
meta: {
|
|
32
|
+
kind: "sqlite:table",
|
|
33
|
+
description: `Table: ${table} (${schema.columns.length} columns)`,
|
|
32
34
|
table,
|
|
33
35
|
columnCount: schema.columns.length,
|
|
34
36
|
primaryKey: schema.primaryKey,
|
|
35
|
-
childrenCount: options?.rowCount
|
|
37
|
+
childrenCount: options?.rowCount || -1
|
|
36
38
|
}
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
/**
|
|
40
|
-
* Builds an AFSEntry for
|
|
41
|
-
*/
|
|
42
|
-
function buildSchemaEntry(table, schema, options) {
|
|
43
|
-
const basePath = options?.basePath ?? "";
|
|
44
|
-
return {
|
|
45
|
-
id: `${table}:@schema`,
|
|
46
|
-
path: `${basePath}/${table}/@schema`,
|
|
47
|
-
description: `Schema for table: ${table}`,
|
|
48
|
-
content: {
|
|
49
|
-
name: schema.name,
|
|
50
|
-
columns: schema.columns.map((col) => ({
|
|
51
|
-
name: col.name,
|
|
52
|
-
type: col.type,
|
|
53
|
-
nullable: !col.notnull,
|
|
54
|
-
primaryKey: col.pk > 0,
|
|
55
|
-
defaultValue: col.dfltValue
|
|
56
|
-
})),
|
|
57
|
-
primaryKey: schema.primaryKey,
|
|
58
|
-
foreignKeys: schema.foreignKeys.map((fk) => ({
|
|
59
|
-
column: fk.from,
|
|
60
|
-
references: {
|
|
61
|
-
table: fk.table,
|
|
62
|
-
column: fk.to
|
|
63
|
-
},
|
|
64
|
-
onUpdate: fk.onUpdate,
|
|
65
|
-
onDelete: fk.onDelete
|
|
66
|
-
})),
|
|
67
|
-
indexes: schema.indexes.map((idx) => ({
|
|
68
|
-
name: idx.name,
|
|
69
|
-
unique: idx.unique,
|
|
70
|
-
origin: idx.origin
|
|
71
|
-
}))
|
|
72
|
-
},
|
|
73
|
-
metadata: {
|
|
74
|
-
table,
|
|
75
|
-
type: "schema"
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Builds an AFSEntry for an attribute (single column value)
|
|
81
|
-
*/
|
|
82
|
-
function buildAttributeEntry(table, pk, column, value, options) {
|
|
83
|
-
const basePath = options?.basePath ?? "";
|
|
84
|
-
return {
|
|
85
|
-
id: `${table}:${pk}:@attr:${column}`,
|
|
86
|
-
path: `${basePath}/${table}/${pk}/@attr/${column}`,
|
|
87
|
-
content: value,
|
|
88
|
-
metadata: {
|
|
89
|
-
table,
|
|
90
|
-
primaryKeyValue: pk,
|
|
91
|
-
column,
|
|
92
|
-
type: "attribute"
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Builds an AFSEntry listing all attributes for a row
|
|
98
|
-
*/
|
|
99
|
-
function buildAttributeListEntry(table, schema, pk, row, options) {
|
|
100
|
-
const basePath = options?.basePath ?? "";
|
|
101
|
-
return schema.columns.map((col) => ({
|
|
102
|
-
id: `${table}:${pk}:@attr:${col.name}`,
|
|
103
|
-
path: `${basePath}/${table}/${pk}/@attr/${col.name}`,
|
|
104
|
-
summary: col.name,
|
|
105
|
-
description: `${col.type}${col.notnull ? " NOT NULL" : ""}`,
|
|
106
|
-
content: row[col.name],
|
|
107
|
-
metadata: {
|
|
108
|
-
column: col.name,
|
|
109
|
-
type: col.type
|
|
110
|
-
}
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Builds an AFSEntry for row metadata
|
|
42
|
+
* Builds an AFSEntry for row metadata (using @meta suffix)
|
|
115
43
|
*/
|
|
116
44
|
function buildMetaEntry(table, schema, pk, row, options) {
|
|
117
45
|
const basePath = options?.basePath ?? "";
|
|
@@ -129,25 +57,64 @@ function buildMetaEntry(table, schema, pk, row, options) {
|
|
|
129
57
|
foreignKeys: schema.foreignKeys.filter((fk) => Object.keys(row).includes(fk.from)),
|
|
130
58
|
rowid: row.rowid
|
|
131
59
|
},
|
|
132
|
-
|
|
60
|
+
meta: {
|
|
133
61
|
table,
|
|
134
62
|
type: "meta"
|
|
135
63
|
}
|
|
136
64
|
};
|
|
137
65
|
}
|
|
138
66
|
/**
|
|
139
|
-
* Builds AFSEntry for actions list
|
|
67
|
+
* Builds AFSEntry for row-level actions list
|
|
140
68
|
*/
|
|
141
69
|
function buildActionsListEntry(table, pk, actions, options) {
|
|
142
70
|
const basePath = options?.basePath ?? "";
|
|
143
71
|
return actions.map((action) => ({
|
|
144
|
-
id: `${table}:${pk}
|
|
145
|
-
path: `${basePath}/${table}/${pk}
|
|
146
|
-
summary: action,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
72
|
+
id: `${table}:${pk}:.actions:${action.name}`,
|
|
73
|
+
path: `${basePath}/${table}/${pk}/.actions/${action.name}`,
|
|
74
|
+
summary: action.name,
|
|
75
|
+
meta: {
|
|
76
|
+
kind: "afs:executable",
|
|
77
|
+
kinds: ["afs:executable", "afs:node"],
|
|
78
|
+
name: action.name,
|
|
79
|
+
description: action.description ?? `Execute ${action.name} action on ${table}:${pk}`,
|
|
80
|
+
inputSchema: action.inputSchema
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Builds AFSEntry for table-level actions list
|
|
86
|
+
*/
|
|
87
|
+
function buildTableActionsListEntry(table, actions, options) {
|
|
88
|
+
const basePath = options?.basePath ?? "";
|
|
89
|
+
return actions.map((action) => ({
|
|
90
|
+
id: `${table}:.actions:${action.name}`,
|
|
91
|
+
path: `${basePath}/${table}/.actions/${action.name}`,
|
|
92
|
+
summary: action.name,
|
|
93
|
+
meta: {
|
|
94
|
+
kind: "afs:executable",
|
|
95
|
+
kinds: ["afs:executable", "afs:node"],
|
|
96
|
+
name: action.name,
|
|
97
|
+
description: action.description ?? `Execute ${action.name} action on table ${table}`,
|
|
98
|
+
inputSchema: action.inputSchema
|
|
99
|
+
}
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Builds AFSEntry for root-level actions list
|
|
104
|
+
*/
|
|
105
|
+
function buildRootActionsListEntry(actions, options) {
|
|
106
|
+
const basePath = options?.basePath ?? "";
|
|
107
|
+
return actions.map((action) => ({
|
|
108
|
+
id: `:actions:${action.name}`,
|
|
109
|
+
path: `${basePath}/.actions/${action.name}`,
|
|
110
|
+
summary: action.name,
|
|
111
|
+
meta: {
|
|
112
|
+
kind: "afs:executable",
|
|
113
|
+
kinds: ["afs:executable", "afs:node"],
|
|
114
|
+
name: action.name,
|
|
115
|
+
description: action.description ?? `Execute ${action.name} action`,
|
|
116
|
+
inputSchema: action.inputSchema
|
|
117
|
+
}
|
|
151
118
|
}));
|
|
152
119
|
}
|
|
153
120
|
/**
|
|
@@ -159,6 +126,22 @@ function buildSearchEntry(table, schema, row, snippet, options) {
|
|
|
159
126
|
return entry;
|
|
160
127
|
}
|
|
161
128
|
/**
|
|
129
|
+
* Builds an AFSEntry for the root (database)
|
|
130
|
+
*/
|
|
131
|
+
function buildRootEntry(schemas, options) {
|
|
132
|
+
const basePath = options?.basePath ?? "";
|
|
133
|
+
return {
|
|
134
|
+
id: "root",
|
|
135
|
+
path: basePath === "" ? "/" : basePath,
|
|
136
|
+
meta: {
|
|
137
|
+
kind: "sqlite:database",
|
|
138
|
+
description: "SQLite database root",
|
|
139
|
+
childrenCount: schemas.size,
|
|
140
|
+
tableCount: schemas.size
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
162
145
|
* Parses a date from various formats
|
|
163
146
|
*/
|
|
164
147
|
function parseDate(value) {
|
|
@@ -170,10 +153,10 @@ function parseDate(value) {
|
|
|
170
153
|
|
|
171
154
|
//#endregion
|
|
172
155
|
exports.buildActionsListEntry = buildActionsListEntry;
|
|
173
|
-
exports.buildAttributeEntry = buildAttributeEntry;
|
|
174
|
-
exports.buildAttributeListEntry = buildAttributeListEntry;
|
|
175
156
|
exports.buildMetaEntry = buildMetaEntry;
|
|
157
|
+
exports.buildRootActionsListEntry = buildRootActionsListEntry;
|
|
158
|
+
exports.buildRootEntry = buildRootEntry;
|
|
176
159
|
exports.buildRowEntry = buildRowEntry;
|
|
177
|
-
exports.buildSchemaEntry = buildSchemaEntry;
|
|
178
160
|
exports.buildSearchEntry = buildSearchEntry;
|
|
161
|
+
exports.buildTableActionsListEntry = buildTableActionsListEntry;
|
|
179
162
|
exports.buildTableEntry = buildTableEntry;
|
package/dist/node/builder.d.cts
CHANGED
|
@@ -20,29 +20,25 @@ declare function buildTableEntry(table: string, schema: TableSchema, options?: B
|
|
|
20
20
|
rowCount?: number;
|
|
21
21
|
}): AFSEntry;
|
|
22
22
|
/**
|
|
23
|
-
* Builds an AFSEntry for
|
|
23
|
+
* Builds an AFSEntry for row metadata (using @meta suffix)
|
|
24
24
|
*/
|
|
25
|
-
declare function
|
|
26
|
-
/**
|
|
27
|
-
* Builds an AFSEntry for an attribute (single column value)
|
|
28
|
-
*/
|
|
29
|
-
declare function buildAttributeEntry(table: string, pk: string, column: string, value: unknown, options?: BuildEntryOptions): AFSEntry;
|
|
30
|
-
/**
|
|
31
|
-
* Builds an AFSEntry listing all attributes for a row
|
|
32
|
-
*/
|
|
33
|
-
declare function buildAttributeListEntry(table: string, schema: TableSchema, pk: string, row: Record<string, unknown>, options?: BuildEntryOptions): AFSEntry[];
|
|
25
|
+
declare function buildMetaEntry(table: string, schema: TableSchema, pk: string, row: Record<string, unknown>, options?: BuildEntryOptions): AFSEntry;
|
|
34
26
|
/**
|
|
35
|
-
*
|
|
27
|
+
* Action definition with optional schema
|
|
36
28
|
*/
|
|
37
|
-
|
|
29
|
+
interface ActionDefinitionInfo {
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
inputSchema?: Record<string, unknown>;
|
|
33
|
+
}
|
|
38
34
|
/**
|
|
39
|
-
* Builds AFSEntry for actions list
|
|
35
|
+
* Builds AFSEntry for row-level actions list
|
|
40
36
|
*/
|
|
41
|
-
declare function buildActionsListEntry(table: string, pk: string, actions:
|
|
37
|
+
declare function buildActionsListEntry(table: string, pk: string, actions: ActionDefinitionInfo[], options?: BuildEntryOptions): AFSEntry[];
|
|
42
38
|
/**
|
|
43
39
|
* Builds a search result entry with highlights
|
|
44
40
|
*/
|
|
45
41
|
declare function buildSearchEntry(table: string, schema: TableSchema, row: Record<string, unknown>, snippet?: string, options?: BuildEntryOptions): AFSEntry;
|
|
46
42
|
//#endregion
|
|
47
|
-
export { BuildEntryOptions, buildActionsListEntry,
|
|
43
|
+
export { BuildEntryOptions, buildActionsListEntry, buildMetaEntry, buildRowEntry, buildSearchEntry, buildTableEntry };
|
|
48
44
|
//# sourceMappingURL=builder.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.cts","names":[],"sources":["../../src/node/builder.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"builder.d.cts","names":[],"sources":["../../src/node/builder.ts"],"mappings":";;;;;;AAMA;UAAiB,iBAAA;;EAEf,QAAA;AAAA;AAMF;;;AAAA,iBAAgB,aAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,GAAA,EAAK,MAAA,mBACL,OAAA,GAAU,iBAAA,GACT,QAAA;;;;iBAuBa,eAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,OAAA,GAAU,iBAAA;EAAsB,QAAA;AAAA,IAC/B,QAAA;;;;iBAoBa,cAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,EAAA,UACA,GAAA,EAAK,MAAA,mBACL,OAAA,GAAU,iBAAA,GACT,QAAA;;AA9BH;;UAkFiB,oBAAA;EACf,IAAA;EACA,WAAA;EACA,WAAA,GAAc,MAAA;AAAA;;;;iBAMA,qBAAA,CACd,KAAA,UACA,EAAA,UACA,OAAA,EAAS,oBAAA,IACT,OAAA,GAAU,iBAAA,GACT,QAAA;;;;iBAmEa,gBAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,GAAA,EAAK,MAAA,mBACL,OAAA,WACA,OAAA,GAAU,iBAAA,GACT,QAAA"}
|
package/dist/node/builder.d.mts
CHANGED
|
@@ -20,29 +20,25 @@ declare function buildTableEntry(table: string, schema: TableSchema, options?: B
|
|
|
20
20
|
rowCount?: number;
|
|
21
21
|
}): AFSEntry;
|
|
22
22
|
/**
|
|
23
|
-
* Builds an AFSEntry for
|
|
23
|
+
* Builds an AFSEntry for row metadata (using @meta suffix)
|
|
24
24
|
*/
|
|
25
|
-
declare function
|
|
26
|
-
/**
|
|
27
|
-
* Builds an AFSEntry for an attribute (single column value)
|
|
28
|
-
*/
|
|
29
|
-
declare function buildAttributeEntry(table: string, pk: string, column: string, value: unknown, options?: BuildEntryOptions): AFSEntry;
|
|
30
|
-
/**
|
|
31
|
-
* Builds an AFSEntry listing all attributes for a row
|
|
32
|
-
*/
|
|
33
|
-
declare function buildAttributeListEntry(table: string, schema: TableSchema, pk: string, row: Record<string, unknown>, options?: BuildEntryOptions): AFSEntry[];
|
|
25
|
+
declare function buildMetaEntry(table: string, schema: TableSchema, pk: string, row: Record<string, unknown>, options?: BuildEntryOptions): AFSEntry;
|
|
34
26
|
/**
|
|
35
|
-
*
|
|
27
|
+
* Action definition with optional schema
|
|
36
28
|
*/
|
|
37
|
-
|
|
29
|
+
interface ActionDefinitionInfo {
|
|
30
|
+
name: string;
|
|
31
|
+
description?: string;
|
|
32
|
+
inputSchema?: Record<string, unknown>;
|
|
33
|
+
}
|
|
38
34
|
/**
|
|
39
|
-
* Builds AFSEntry for actions list
|
|
35
|
+
* Builds AFSEntry for row-level actions list
|
|
40
36
|
*/
|
|
41
|
-
declare function buildActionsListEntry(table: string, pk: string, actions:
|
|
37
|
+
declare function buildActionsListEntry(table: string, pk: string, actions: ActionDefinitionInfo[], options?: BuildEntryOptions): AFSEntry[];
|
|
42
38
|
/**
|
|
43
39
|
* Builds a search result entry with highlights
|
|
44
40
|
*/
|
|
45
41
|
declare function buildSearchEntry(table: string, schema: TableSchema, row: Record<string, unknown>, snippet?: string, options?: BuildEntryOptions): AFSEntry;
|
|
46
42
|
//#endregion
|
|
47
|
-
export { BuildEntryOptions, buildActionsListEntry,
|
|
43
|
+
export { BuildEntryOptions, buildActionsListEntry, buildMetaEntry, buildRowEntry, buildSearchEntry, buildTableEntry };
|
|
48
44
|
//# sourceMappingURL=builder.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.mts","names":[],"sources":["../../src/node/builder.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"builder.d.mts","names":[],"sources":["../../src/node/builder.ts"],"mappings":";;;;;;AAMA;UAAiB,iBAAA;;EAEf,QAAA;AAAA;AAMF;;;AAAA,iBAAgB,aAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,GAAA,EAAK,MAAA,mBACL,OAAA,GAAU,iBAAA,GACT,QAAA;;;;iBAuBa,eAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,OAAA,GAAU,iBAAA;EAAsB,QAAA;AAAA,IAC/B,QAAA;;;;iBAoBa,cAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,EAAA,UACA,GAAA,EAAK,MAAA,mBACL,OAAA,GAAU,iBAAA,GACT,QAAA;;AA9BH;;UAkFiB,oBAAA;EACf,IAAA;EACA,WAAA;EACA,WAAA,GAAc,MAAA;AAAA;;;;iBAMA,qBAAA,CACd,KAAA,UACA,EAAA,UACA,OAAA,EAAS,oBAAA,IACT,OAAA,GAAU,iBAAA,GACT,QAAA;;;;iBAmEa,gBAAA,CACd,KAAA,UACA,MAAA,EAAQ,WAAA,EACR,GAAA,EAAK,MAAA,mBACL,OAAA,WACA,OAAA,GAAU,iBAAA,GACT,QAAA"}
|