@aigne/afs-sqlite 1.11.0-beta.5 → 1.11.0-beta.7
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/_@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/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.d.cts.map +1 -1
- package/dist/config.d.mts.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 +672 -121
- package/dist/sqlite-afs.d.cts +257 -56
- package/dist/sqlite-afs.d.cts.map +1 -1
- package/dist/sqlite-afs.d.mts +257 -56
- package/dist/sqlite-afs.d.mts.map +1 -1
- package/dist/sqlite-afs.mjs +674 -123
- package/dist/sqlite-afs.mjs.map +1 -1
- package/package.json +4 -3
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 {\n AFSAccessMode,\n AFSDeleteOptions,\n AFSDeleteResult,\n AFSExecOptions,\n AFSExecResult,\n AFSListOptions,\n AFSListResult,\n AFSModule,\n AFSModuleClass,\n AFSModuleLoadParams,\n AFSReadOptions,\n AFSReadResult,\n AFSRoot,\n AFSSearchOptions,\n AFSSearchResult,\n AFSWriteEntryPayload,\n AFSWriteOptions,\n AFSWriteResult,\n} from \"@aigne/afs\";\nimport { initDatabase } from \"@aigne/sqlite\";\nimport type { LibSQLDatabase } from \"drizzle-orm/libsql\";\nimport type { RadixRouter } from \"radix3\";\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 { buildActionsListEntry } from \"./node/builder.js\";\nimport { CRUDOperations } from \"./operations/crud.js\";\nimport { createFTSConfig, type FTSConfig, FTSSearch } from \"./operations/search.js\";\nimport { createPathRouter, matchPath, type RouteData } from \"./router/path-router.js\";\nimport { SchemaIntrospector } from \"./schema/introspector.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 (@attr, @meta, @actions).\n */\nexport class SQLiteAFS implements AFSModule {\n readonly name: string;\n readonly description: string;\n readonly accessMode: AFSAccessMode;\n\n private db!: Awaited<ReturnType<typeof initDatabase>>;\n private schemas = new Map<string, TableSchema>();\n private router!: RadixRouter<RouteData>;\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 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({ parsed }: AFSModuleLoadParams): Promise<SQLiteAFS> {\n const validated = sqliteAFSConfigSchema.parse(parsed);\n return new SQLiteAFS(validated);\n }\n\n /**\n * Called when the module is mounted to AFS\n */\n async onMount(_afs: AFSRoot): Promise<void> {\n await this.initialize();\n }\n\n /**\n * Initializes the database connection and introspects schema\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 // Introspect database schema\n const introspector = new SchemaIntrospector();\n this.schemas = await introspector.introspect(db, {\n tables: this.options.tables,\n excludeTables: this.options.excludeTables,\n });\n\n // Initialize components\n this.router = createPathRouter();\n this.crud = new CRUDOperations(db, this.schemas, \"\");\n this.ftsSearch = new FTSSearch(db, this.schemas, this.ftsConfig, \"\");\n\n this.initialized = true;\n }\n\n /**\n * Ensures the module is initialized\n */\n private async ensureInitialized(): Promise<void> {\n if (!this.initialized) {\n await this.initialize();\n }\n }\n\n /**\n * Lists entries at a path\n */\n async list(path: string, options?: AFSListOptions): Promise<AFSListResult> {\n await this.ensureInitialized();\n\n const match = matchPath(this.router, path);\n if (!match) {\n return { data: [] };\n }\n\n switch (match.action) {\n case \"listTables\":\n return this.crud.listTables();\n\n case \"listTable\":\n if (!match.params.table) return { data: [] };\n return this.crud.listTable(match.params.table, options);\n\n case \"listAttributes\":\n if (!match.params.table || !match.params.pk) return { data: [] };\n return this.crud.listAttributes(match.params.table, match.params.pk);\n\n case \"listActions\":\n if (!match.params.table || !match.params.pk) return { data: [] };\n return this.listActions(match.params.table, match.params.pk);\n\n default:\n return { data: [] };\n }\n }\n\n /**\n * Reads an entry at a path\n */\n async read(path: string, _options?: AFSReadOptions): Promise<AFSReadResult> {\n await this.ensureInitialized();\n\n const match = matchPath(this.router, path);\n if (!match) {\n return {};\n }\n\n switch (match.action) {\n case \"readRow\":\n if (!match.params.table || !match.params.pk) return {};\n return this.crud.readRow(match.params.table, match.params.pk);\n\n case \"getSchema\":\n if (!match.params.table) return {};\n return this.crud.getSchema(match.params.table);\n\n case \"getAttribute\":\n if (!match.params.table || !match.params.pk || !match.params.column) return {};\n return this.crud.getAttribute(match.params.table, match.params.pk, match.params.column);\n\n case \"getMeta\":\n if (!match.params.table || !match.params.pk) return {};\n return this.crud.getMeta(match.params.table, match.params.pk);\n\n default:\n return {};\n }\n }\n\n /**\n * Writes an entry at a path\n */\n async write(\n path: string,\n content: AFSWriteEntryPayload,\n _options?: AFSWriteOptions,\n ): Promise<AFSWriteResult> {\n await this.ensureInitialized();\n\n if (this.accessMode === \"readonly\") {\n throw new Error(\"Module is in readonly mode\");\n }\n\n const match = matchPath(this.router, path);\n if (!match) {\n throw new Error(`Invalid path: ${path}`);\n }\n\n switch (match.action) {\n case \"createRow\":\n if (!match.params.table) {\n throw new Error(\"Table name required for create\");\n }\n return this.crud.createRow(match.params.table, content.content ?? content);\n\n case \"readRow\":\n if (!match.params.table || !match.params.pk) {\n throw new Error(\"Table and primary key required for update\");\n }\n return this.crud.updateRow(match.params.table, match.params.pk, content.content ?? content);\n\n case \"executeAction\":\n if (!match.params.table || !match.params.action) {\n throw new Error(\"Table and action name required\");\n }\n return this.executeAction(\n match.params.table,\n match.params.pk,\n match.params.action,\n content.content ?? content,\n );\n\n default:\n throw new Error(`Write not supported for path: ${path}`);\n }\n }\n\n /**\n * Deletes an entry at a path\n */\n async delete(path: string, _options?: AFSDeleteOptions): Promise<AFSDeleteResult> {\n await this.ensureInitialized();\n\n if (this.accessMode === \"readonly\") {\n throw new Error(\"Module is in readonly mode\");\n }\n\n const match = matchPath(this.router, path);\n if (!match || match.action !== \"readRow\") {\n throw new Error(`Delete not supported for path: ${path}`);\n }\n\n if (!match.params.table || !match.params.pk) {\n throw new Error(\"Table and primary key required for delete\");\n }\n\n return this.crud.deleteRow(match.params.table, match.params.pk);\n }\n\n /**\n * Searches for entries matching a query\n */\n async search(path: string, query: string, options?: AFSSearchOptions): Promise<AFSSearchResult> {\n await this.ensureInitialized();\n\n // If path specifies a table, search only that table\n const match = matchPath(this.router, path);\n if (match?.params.table) {\n return this.ftsSearch.searchTable(match.params.table, query, options);\n }\n\n // Otherwise search all FTS-enabled tables\n return this.ftsSearch.search(query, options);\n }\n\n /**\n * Executes a module operation\n */\n async exec(\n path: string,\n args: Record<string, unknown>,\n _options: AFSExecOptions,\n ): Promise<AFSExecResult> {\n await this.ensureInitialized();\n\n const match = matchPath(this.router, path);\n if (match?.action === \"executeAction\" && match.params.table && match.params.action) {\n const result = await this.executeAction(\n match.params.table,\n match.params.pk,\n match.params.action,\n args,\n );\n return { data: result.data as unknown as Record<string, unknown> };\n }\n\n throw new Error(`Exec not supported for path: ${path}`);\n }\n\n /**\n * Lists available actions for a row\n */\n private listActions(table: string, pk: string): AFSListResult {\n const actionNames = this.actions.listNames({ rowLevel: true });\n return {\n data: buildActionsListEntry(table, pk, actionNames, { basePath: \"\" }),\n };\n }\n\n /**\n * Executes an action\n */\n private async executeAction(\n table: string,\n pk: string | undefined,\n actionName: string,\n params: Record<string, unknown>,\n ): Promise<AFSWriteResult> {\n const schema = this.schemas.get(table);\n if (!schema) {\n throw new Error(`Table '${table}' not found`);\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 schemas: this.schemas,\n table,\n pk,\n row,\n module: {\n refreshSchema: () => this.refreshSchema(),\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 {\n data: {\n id: `${table}:${pk ?? \"\"}:@actions:${actionName}`,\n path: pk ? `/${table}/${pk}/@actions/${actionName}` : `/${table}/@actions/${actionName}`,\n content: result.data,\n },\n };\n }\n\n /**\n * Refreshes the schema cache\n */\n async refreshSchema(): Promise<void> {\n const db = this.db as unknown as LibSQLDatabase;\n const introspector = new SchemaIntrospector();\n this.schemas = await introspector.introspect(db, {\n tables: this.options.tables,\n excludeTables: this.options.excludeTables,\n });\n this.crud.setSchemas(this.schemas);\n this.ftsSearch.setSchemas(this.schemas);\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 = this.schemas.get(table);\n if (!schema) throw new Error(`Table '${table}' not found`);\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 */\n getSchemas(): Map<string, TableSchema> {\n return this.schemas;\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// Type check to ensure SQLiteAFS implements AFSModuleClass\nconst _typeCheck: AFSModuleClass<SQLiteAFS, SQLiteAFSOptions> = SQLiteAFS;\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,IAAa,YAAb,MAAa,UAA+B;CAC1C,AAAS;CACT,AAAS;CACT,AAAS;CAET,AAAQ;CACR,AAAQ,0BAAU,IAAI,KAA0B;CAChD,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ;CACR,AAAQ,cAAc;CAEtB,YAAY,AAAQ,SAA2B;EAA3B;AAClB,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;;;;;CAMT,aAAa,KAAK,EAAE,UAAmD;AAErE,SAAO,IAAI,UADO,sBAAsB,MAAM,OAAO,CACtB;;;;;CAMjC,MAAM,QAAQ,MAA8B;AAC1C,QAAM,KAAK,YAAY;;;;;CAMzB,MAAc,aAA4B;AACxC,MAAI,KAAK,YAAa;AAGtB,OAAK,KAAK,MAAM,aAAa;GAC3B,KAAK,KAAK,QAAQ;GAClB,KAAK,KAAK,QAAQ,OAAO;GAC1B,CAAC;EAGF,MAAM,KAAK,KAAK;AAIhB,OAAK,UAAU,MADM,IAAI,oBAAoB,CACX,WAAW,IAAI;GAC/C,QAAQ,KAAK,QAAQ;GACrB,eAAe,KAAK,QAAQ;GAC7B,CAAC;AAGF,OAAK,SAAS,kBAAkB;AAChC,OAAK,OAAO,IAAI,eAAe,IAAI,KAAK,S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AAK,KAAK,UAAU;IAC1C,MAAM,UAAU,MAAM;AACtB,WAAO,OAAO,QACX,KAAK,MAAM;KACV,MAAM,MAAM,QAAQ,EAAE;AACtB,SAAI,QAAQ,QAAQ,QAAQ,OAAW,QAAO;AAC9C,SAAI,OAAO,QAAQ,aAAa,IAAI,SAAS,IAAI,IAAI,IAAI,SAAS,KAAI,EACpE,QAAO,IAAI,IAAI,QAAQ,MAAM,OAAK,CAAC;AAErC,YAAO,OAAO,IAAI;MAClB,CACD,KAAK,IAAI;KACZ,CAEyB,KAAK,KAAK;;AAIvC,SAAO,WAAW,KAAK,KAAK,UAAU,MAAM,QAAQ;;;;;CAMtD,eACE,MACA,SACA,SAKM;AACN,OAAK,QAAQ,eACX,MACA,OAAO,KAAK,YAAY;GACtB,SAAS;GACT,MAAM,MAAM,QAAQ,KAAK,OAAO;GACjC,GACD,QACD;;;;;CAMH,aAAuC;AACrC,SAAO,KAAK;;;;;CAMd,cAA8B;AAC5B,SAAO,KAAK"}
|
|
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> = S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,KAAK,uBAAuB;YAiG5B,KAAK,UAAU;YAoBf,KAAK,UAAU;YA2Df,KAAK,cAAc;YAYnB,KAAK,oBAAoB;YAYzB,KAAK,cAAc;YAkDnB,MAAM,cAAc;YAYpB,MAAM,cAAc;YAYpB,MAAM,+BAA+B;YAiBrC,MAAM,2BAA2B;YAiBjC,MAAM,oBAAoB;YAiB1B,OAAO,UAAU;YAejB,OAAO,cAAc;YAarB,OAAO,IAAI;YAaX,OAAO,UAAU;YAejB,KAAK,IAAI;YA8BT,KAAK,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"}
|
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.7",
|
|
4
4
|
"description": "AIGNE AFS module for SQLite database storage with schema introspection",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"drizzle-orm": "^0.44.5",
|
|
38
38
|
"radix3": "^1.1.2",
|
|
39
39
|
"zod": "^3.25.67",
|
|
40
|
-
"@aigne/afs": "^1.11.0-beta.
|
|
40
|
+
"@aigne/afs": "^1.11.0-beta.7"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/bun": "^1.3.6",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"tsdown": "0.20.0-beta.3",
|
|
47
47
|
"typescript": "5.9.2",
|
|
48
48
|
"@aigne/scripts": "0.0.0",
|
|
49
|
-
"@aigne/typescript-config": "0.0.0"
|
|
49
|
+
"@aigne/typescript-config": "0.0.0",
|
|
50
|
+
"@aigne/afs-testing": "1.11.0-beta.7"
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|
|
52
53
|
"build": "tsdown",
|