shokupan 0.13.0 → 0.14.0
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/{analyzer-BOtveWL-.cjs → analyzer-BZSVGTmP.cjs} +5 -4
- package/dist/analyzer-BZSVGTmP.cjs.map +1 -0
- package/dist/{analyzer-B0fMzeIo.js → analyzer-Faojwm7c.js} +5 -4
- package/dist/analyzer-Faojwm7c.js.map +1 -0
- package/dist/{analyzer.impl-CUDO6vpn.cjs → analyzer.impl-5aCqtook.cjs} +28 -11
- package/dist/analyzer.impl-5aCqtook.cjs.map +1 -0
- package/dist/{analyzer.impl-DmHe92Oi.js → analyzer.impl-COdN69gL.js} +28 -11
- package/dist/analyzer.impl-COdN69gL.js.map +1 -0
- package/dist/ast-analyzer-worker-C3jrQ8VR.js +184 -0
- package/dist/ast-analyzer-worker-C3jrQ8VR.js.map +1 -0
- package/dist/ast-analyzer-worker-D_uYkqmY.cjs +184 -0
- package/dist/ast-analyzer-worker-D_uYkqmY.cjs.map +1 -0
- package/dist/cli.cjs +1 -1
- package/dist/cli.js +1 -1
- package/dist/context.d.ts +39 -4
- package/dist/decorators/di.d.ts +31 -0
- package/dist/decorators/hooks.d.ts +28 -0
- package/dist/decorators/http.d.ts +60 -0
- package/dist/decorators/index.d.ts +8 -0
- package/dist/decorators/mcp.d.ts +48 -0
- package/dist/decorators/util/container.d.ts +36 -0
- package/dist/decorators/websocket.d.ts +172 -0
- package/dist/index-BP7v0Hiv.cjs +12216 -0
- package/dist/index-BP7v0Hiv.cjs.map +1 -0
- package/dist/index-CUNBeZKj.js +12176 -0
- package/dist/index-CUNBeZKj.js.map +1 -0
- package/dist/index.cjs +137 -10518
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +137 -10477
- package/dist/index.js.map +1 -1
- package/dist/{json-parser-COdZ0fqY.cjs → json-parser-BA0mUgMF.cjs} +3 -3
- package/dist/json-parser-BA0mUgMF.cjs.map +1 -0
- package/dist/{json-parser-B3dnQmCC.js → json-parser-BFM-SnBR.js} +3 -3
- package/dist/json-parser-BFM-SnBR.js.map +1 -0
- package/dist/knex-DDPXR-sQ.js +218 -0
- package/dist/knex-DDPXR-sQ.js.map +1 -0
- package/dist/knex-DghF-jjm.cjs +240 -0
- package/dist/knex-DghF-jjm.cjs.map +1 -0
- package/dist/level-BU87Jbus.js +184 -0
- package/dist/level-BU87Jbus.js.map +1 -0
- package/dist/level-DNFl2n-m.cjs +184 -0
- package/dist/level-DNFl2n-m.cjs.map +1 -0
- package/dist/plugins/application/api-explorer/static/explorer-client.mjs +54 -28
- package/dist/plugins/application/asyncapi/plugin.d.ts +1 -0
- package/dist/plugins/application/asyncapi/static/asyncapi-client.mjs +22 -11
- package/dist/plugins/application/dashboard/fetch-interceptor.d.ts +3 -1
- package/dist/plugins/application/dashboard/metrics-collector.d.ts +5 -3
- package/dist/plugins/application/dashboard/plugin.d.ts +36 -3
- package/dist/plugins/application/dashboard/static/requests.js +517 -53
- package/dist/plugins/application/dashboard/static/tabs.js +2 -2
- package/dist/plugins/application/error-view/index.d.ts +25 -0
- package/dist/plugins/application/error-view/reason-phrases.d.ts +1 -0
- package/dist/plugins/application/openapi/analyzer.d.ts +3 -1
- package/dist/plugins/application/openapi/analyzer.impl.d.ts +4 -2
- package/dist/router.d.ts +56 -21
- package/dist/shokupan.d.ts +25 -11
- package/dist/sqlite-CLrcTkti.js +180 -0
- package/dist/sqlite-CLrcTkti.js.map +1 -0
- package/dist/sqlite-n7FQ6Ja6.cjs +180 -0
- package/dist/sqlite-n7FQ6Ja6.cjs.map +1 -0
- package/dist/surreal-6QONU6xa.cjs +210 -0
- package/dist/surreal-6QONU6xa.cjs.map +1 -0
- package/dist/surreal-w7DeGVI-.js +188 -0
- package/dist/surreal-w7DeGVI-.js.map +1 -0
- package/dist/util/adapter/datastore/knex.d.ts +29 -0
- package/dist/util/adapter/datastore/level.d.ts +26 -0
- package/dist/util/adapter/datastore/sqlite.d.ts +24 -0
- package/dist/util/adapter/datastore/surreal.d.ts +29 -0
- package/dist/util/adapter/datastore.d.ts +59 -0
- package/dist/util/adapter/h3.d.ts +8 -0
- package/dist/util/adapter/index.d.ts +1 -0
- package/dist/util/ast-analyzer-worker.d.ts +77 -0
- package/dist/util/ast-worker-thread.d.ts +1 -0
- package/dist/util/cookie-parser.d.ts +6 -0
- package/dist/util/env-loader.d.ts +7 -0
- package/dist/util/html.d.ts +15 -0
- package/dist/util/ide.d.ts +9 -0
- package/dist/util/logger.d.ts +25 -0
- package/dist/util/query-string.d.ts +8 -0
- package/dist/util/response-transformer.d.ts +87 -0
- package/dist/util/symbol.d.ts +1 -0
- package/dist/util/types.d.ts +116 -42
- package/dist/websocket.d.ts +163 -0
- package/package.json +27 -1
- package/dist/analyzer-B0fMzeIo.js.map +0 -1
- package/dist/analyzer-BOtveWL-.cjs.map +0 -1
- package/dist/analyzer.impl-CUDO6vpn.cjs.map +0 -1
- package/dist/analyzer.impl-DmHe92Oi.js.map +0 -1
- package/dist/json-parser-B3dnQmCC.js.map +0 -1
- package/dist/json-parser-COdZ0fqY.cjs.map +0 -1
- package/dist/plugins/application/error-view/views/error.d.ts +0 -2
- package/dist/plugins/application/error-view/views/status.d.ts +0 -2
- package/dist/util/decorators.d.ts +0 -134
- package/dist/util/di.d.ts +0 -13
- /package/dist/{util → decorators/util}/metadata.d.ts +0 -0
- /package/dist/{util → decorators/util}/stack.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surreal-w7DeGVI-.js","sources":["../src/util/adapter/datastore/surreal.ts"],"sourcesContent":["import { RecordId, Surreal } from 'surrealdb';\nimport { createLogger } from '../../logger';\nimport type { DatastoreAdapter, QueryOptions } from '../datastore';\n\nexport interface SurrealAdapterOptions {\n url?: string;\n namespace?: string;\n database?: string;\n auth?: any;\n engines?: any;\n connectOptions?: any;\n}\n\nexport class SurrealAdapter implements DatastoreAdapter {\n name = 'surrealdb';\n private db: Surreal;\n private logger = createLogger('surreal-adapter');\n private options: SurrealAdapterOptions;\n\n constructor(options: SurrealAdapterOptions = {}) {\n this.options = options;\n if (options.engines) {\n this.db = new Surreal({ engines: options.engines });\n } else {\n this.db = new Surreal();\n }\n\n process.on(\"exit\", async () => {\n await this.disconnect();\n });\n }\n\n async connect(): Promise<void> {\n let url = this.options.url;\n if (!url) {\n // Default behavior equivalent to old initDatastore\n if (process.env.NODE_ENV === 'test') {\n url = 'mem://';\n } else {\n url = 'surrealkv://database';\n }\n }\n\n if (!this.options.engines && !url.match(/^(?:wss?|https?):\\/\\//)) {\n try {\n const mod = await import('@surrealdb/node');\n this.db = new Surreal({ engines: mod.createNodeEngines() });\n } catch (e) {\n this.logger.warn('SurrealAdapter', \"Could not load @surrealdb/node engines. Embedded protocols might fail.\", { error: e });\n }\n }\n\n await this.db.connect(url, this.options.connectOptions);\n\n await this.db.use({\n namespace: this.options.namespace ?? \"vendor\",\n database: this.options.database ?? \"shokupan\"\n });\n }\n\n async disconnect(): Promise<void> {\n await this.db.close();\n }\n\n async setupSchema(): Promise<void> {\n // Equivalent to old createSchema but generic tables if dynamic?\n // Old code had hardcoded table defines. We should keep them for now or rely on \"SCHEMALESS\" \n // SurrealDB is schemaless by default but defines help with performance/structure.\n // We'll reimplement the base defines.\n\n await this.db.query(`\n DEFINE TABLE OVERWRITE failed_requests SCHEMALESS COMMENT \"Created by Shokupan\";\n DEFINE TABLE OVERWRITE sessions SCHEMALESS COMMENT \"Created by Shokupan\";\n DEFINE TABLE OVERWRITE users SCHEMALESS COMMENT \"Created by Shokupan\";\n DEFINE TABLE OVERWRITE idempotency_keys SCHEMALESS COMMENT \"Created by Shokupan\";\n DEFINE TABLE OVERWRITE middleware_tracking SCHEMALESS COMMENT \"Created by Shokupan\";\n DEFINE TABLE OVERWRITE requests SCHEMALESS COMMENT \"Created by Shokupan\";\n DEFINE TABLE OVERWRITE metrics SCHEMALESS COMMENT \"Created by Shokupan\";\n `);\n }\n\n private retry<T>(fn: () => Promise<T>): Promise<T> {\n return fn().catch(err => {\n if (err?.message?.includes('This transaction can be retried')) {\n return fn();\n }\n throw err;\n });\n }\n\n async get<T>(table: string, id: string): Promise<T | null> {\n try {\n const result = await this.db.select<T>(new RecordId(table, id));\n // SurrealDB select typically returns the object, or throws if connection fails.\n // If ID not found, it might return undefined or null or error depending on version.\n // Recent JS SDK: select returns T (single) or T[] (if variable).\n // But if it returns undefined/null, we return null.\n if (Array.isArray(result)) return result[0] || null;\n return result as T || null;\n } catch (error) {\n // If it throws because of not found (some older versions), return null.\n // Or log real error? generic get should probably return null if not found.\n return null;\n }\n }\n\n async create<T>(table: string, id: string, data: T): Promise<T> {\n return this.retry(() => this.db.create(new RecordId(table, id)).content(data as any)) as any;\n }\n\n async update<T>(table: string, id: string, data: Partial<T>): Promise<T> {\n return this.retry(() => this.db.update(new RecordId(table, id)).merge(data as any)) as any;\n }\n\n async upsert<T>(table: string, id: string, data: T): Promise<T> {\n // SurrealDB .upsert() replaces content. If we want merge-like upsert behavior we might need logic,\n // but typically upsert means \"insert or replace\".\n return this.retry(() => this.db.upsert(new RecordId(table, id)).content(data as any)) as any;\n }\n\n async delete(table: string, id: string): Promise<void> {\n await this.retry(() => this.db.delete(new RecordId(table, id)));\n }\n\n async count(table: string, query?: QueryOptions): Promise<number> {\n const q = this.buildQuery(table, query, true);\n const res = await this.db.query<[{ count: number; }]>(q.statement, q.vars);\n\n const result = res as any; // Cast to inspect\n this.logger.debug('SurrealAdapter', \"Count Result\", { result });\n\n // Defensive coding:\n if (Array.isArray(result) && result.length > 0) {\n const first = result[0];\n\n // 1. Nested array result (common in query()): [[{ count: N }]]\n if (Array.isArray(first)) {\n if (first[0]?.count !== undefined) return first[0].count;\n }\n\n // 2. Direct result: [{ count: N }]\n if (first?.count !== undefined) return first.count;\n\n // 3. Result wrapper: [{ result: [{ count: N }], status: \"OK\" }]\n if (first?.result && Array.isArray(first.result)) {\n const inner = first.result[0];\n if (inner?.count !== undefined) return inner.count;\n }\n }\n\n return 0;\n }\n\n async deleteMany(table: string, query?: QueryOptions): Promise<void> {\n const q = this.buildQuery(table, query, false, true);\n await this.db.query(q.statement, q.vars);\n }\n\n async findMany<T>(table: string, query?: QueryOptions): Promise<T[]> {\n const q = this.buildQuery(table, query);\n try {\n const res = await this.db.query<T[]>(q.statement, q.vars);\n\n // Robust result extraction\n let result: any = res;\n if (Array.isArray(res) && res.length > 0) {\n if (Array.isArray(res[0])) result = res[0];\n else if ((res[0] as any).result && Array.isArray((res[0] as any).result)) result = (res[0] as any).result;\n else result = res[0] || [];\n }\n\n return (Array.isArray(result) ? result : []) as T[];\n } catch (e) {\n this.logger.error('SurrealAdapter', `findMany ${table} failed`, e);\n throw e;\n }\n }\n\n private buildQuery(table: string, options?: QueryOptions, isCount = false, isDelete = false): { statement: string, vars: any; } {\n // Basic query builder\n let type = isDelete ? 'DELETE' : 'SELECT';\n let fields = isDelete ? '' : (isCount ? 'count()' : '*');\n let from = `FROM type::table($table)`;\n let vars: any = { table };\n let clauses: string[] = [];\n\n if (options?.where) {\n Object.entries(options.where).forEach(([k, v], i) => {\n const varName = `where_${i}`;\n clauses.push(`${k} = $${varName}`);\n vars[varName] = v;\n });\n }\n\n if (options?.gt) {\n Object.entries(options.gt).forEach(([k, v], i) => {\n const varName = `gt_${i}`;\n clauses.push(`${k} > $${varName}`);\n vars[varName] = v;\n });\n }\n\n if (options?.lt) {\n Object.entries(options.lt).forEach(([k, v], i) => {\n const varName = `lt_${i}`;\n clauses.push(`${k} < $${varName}`);\n vars[varName] = v;\n });\n }\n\n let whereStr = clauses.length ? 'WHERE ' + clauses.join(' AND ') : '';\n\n let suffix = '';\n if (!isCount && !isDelete) {\n if (options?.sort) {\n const sorts = Object.entries(options.sort).map(([k, v]) => `${k} ${v.toUpperCase()}`);\n if (sorts.length) suffix += ` ORDER BY ${sorts.join(', ')}`;\n }\n if (options?.limit) {\n suffix += ` LIMIT ${options.limit}`;\n }\n if (options?.offset) {\n suffix += ` START ${options.offset}`;\n }\n }\n\n // Handle Delete LIMIT separately because DELETE statements support LIMIT\n if (isDelete) {\n // Surreal DELETE supports WHERE ... \n // Does it support LIMIT? Yes: DELETE user WHERE ... LIMIT 10\n // Does it support ORDER BY? Yes.\n if (options?.sort) {\n const sorts = Object.entries(options.sort).map(([k, v]) => `${k} ${v.toUpperCase()}`);\n if (sorts.length) suffix += ` ORDER BY ${sorts.join(', ')}`;\n }\n if (options?.limit) {\n suffix += ` LIMIT ${options.limit}`;\n }\n }\n\n // isDelete format: DELETE [FROM] table WHERE ...\n // SurrealQL: DELETE table WHERE ...\n if (isDelete) {\n return {\n statement: `DELETE type::table($table) ${whereStr}${suffix};`,\n vars\n };\n }\n\n const groupAll = isCount ? 'GROUP ALL' : '';\n\n return {\n statement: `SELECT ${fields} ${from} ${whereStr} ${groupAll} ${suffix};`,\n vars\n };\n }\n}\n"],"names":[],"mappings":";;AAaO,MAAM,eAA2C;AAAA,EACpD,OAAO;AAAA,EACC;AAAA,EACA,SAAS,aAAa,iBAAiB;AAAA,EACvC;AAAA,EAER,YAAY,UAAiC,IAAI;AAC7C,SAAK,UAAU;AACf,QAAI,QAAQ,SAAS;AACjB,WAAK,KAAK,IAAI,QAAQ,EAAE,SAAS,QAAQ,SAAS;AAAA,IACtD,OAAO;AACH,WAAK,KAAK,IAAI,QAAA;AAAA,IAClB;AAEA,YAAQ,GAAG,QAAQ,YAAY;AAC3B,YAAM,KAAK,WAAA;AAAA,IACf,CAAC;AAAA,EACL;AAAA,EAEA,MAAM,UAAyB;AAC3B,QAAI,MAAM,KAAK,QAAQ;AACvB,QAAI,CAAC,KAAK;AAEN,UAAI,QAAQ,IAAI,aAAa,QAAQ;AACjC,cAAM;AAAA,MACV,OAAO;AACH,cAAM;AAAA,MACV;AAAA,IACJ;AAEA,QAAI,CAAC,KAAK,QAAQ,WAAW,CAAC,IAAI,MAAM,uBAAuB,GAAG;AAC9D,UAAI;AACA,cAAM,MAAM,MAAM,OAAO,iBA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A,MACH,WAAW,UAAU,MAAM,IAAI,IAAI,IAAI,QAAQ,IAAI,QAAQ,IAAI,MAAM;AAAA,MACrE;AAAA,IAAA;AAAA,EAER;AACJ;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Knex } from 'knex';
|
|
2
|
+
import { DatastoreAdapter, QueryOptions } from '../datastore';
|
|
3
|
+
export interface KnexAdapterOptions extends Knex.Config {
|
|
4
|
+
}
|
|
5
|
+
export declare class KnexAdapter implements DatastoreAdapter {
|
|
6
|
+
private options;
|
|
7
|
+
name: string;
|
|
8
|
+
private db;
|
|
9
|
+
private logger;
|
|
10
|
+
private jsonColumnType;
|
|
11
|
+
constructor(options: KnexAdapterOptions);
|
|
12
|
+
connect(): Promise<void>;
|
|
13
|
+
private detectDialectFeatures;
|
|
14
|
+
disconnect(): Promise<void>;
|
|
15
|
+
setupSchema(): Promise<void>;
|
|
16
|
+
private ensureTable;
|
|
17
|
+
private jsonRef;
|
|
18
|
+
get<T>(table: string, id: string): Promise<T | null>;
|
|
19
|
+
create<T>(table: string, id: string, data: T): Promise<T>;
|
|
20
|
+
update<T>(table: string, id: string, data: Partial<T>): Promise<T>;
|
|
21
|
+
upsert<T>(table: string, id: string, data: T): Promise<T>;
|
|
22
|
+
delete(table: string, id: string): Promise<void>;
|
|
23
|
+
count(table: string, query?: QueryOptions): Promise<number>;
|
|
24
|
+
deleteMany(table: string, query?: QueryOptions): Promise<void>;
|
|
25
|
+
private findManyIDs;
|
|
26
|
+
findMany<T>(table: string, query?: QueryOptions): Promise<T[]>;
|
|
27
|
+
private applyFilters;
|
|
28
|
+
private applyQuery;
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DatastoreAdapter, QueryOptions } from '../datastore';
|
|
2
|
+
export declare class LevelAdapter implements DatastoreAdapter {
|
|
3
|
+
private options;
|
|
4
|
+
name: string;
|
|
5
|
+
private db;
|
|
6
|
+
private logger;
|
|
7
|
+
constructor(options?: {
|
|
8
|
+
location?: string;
|
|
9
|
+
db?: any;
|
|
10
|
+
});
|
|
11
|
+
connect(): Promise<void>;
|
|
12
|
+
disconnect(): Promise<void>;
|
|
13
|
+
setupSchema(): Promise<void>;
|
|
14
|
+
private getKey;
|
|
15
|
+
get<T>(table: string, id: string): Promise<T | null>;
|
|
16
|
+
create<T>(table: string, id: string, data: T): Promise<T>;
|
|
17
|
+
update<T>(table: string, id: string, data: Partial<T>): Promise<T>;
|
|
18
|
+
upsert<T>(table: string, id: string, data: T): Promise<T>;
|
|
19
|
+
delete(table: string, id: string): Promise<void>;
|
|
20
|
+
count(table: string, query?: QueryOptions): Promise<number>;
|
|
21
|
+
deleteMany(table: string, query?: QueryOptions): Promise<void>;
|
|
22
|
+
findMany<T>(table: string, query?: QueryOptions): Promise<T[]>;
|
|
23
|
+
private scan;
|
|
24
|
+
private matches;
|
|
25
|
+
private applySortLimit;
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DatastoreAdapter, QueryOptions } from '../datastore';
|
|
2
|
+
export declare class SqliteAdapter implements DatastoreAdapter {
|
|
3
|
+
private options;
|
|
4
|
+
name: string;
|
|
5
|
+
private db;
|
|
6
|
+
private logger;
|
|
7
|
+
private tables;
|
|
8
|
+
constructor(options?: {
|
|
9
|
+
filename?: string;
|
|
10
|
+
});
|
|
11
|
+
connect(): Promise<void>;
|
|
12
|
+
disconnect(): Promise<void>;
|
|
13
|
+
setupSchema(): Promise<void>;
|
|
14
|
+
private ensureTable;
|
|
15
|
+
get<T>(table: string, id: string): Promise<T | null>;
|
|
16
|
+
create<T>(table: string, id: string, data: T): Promise<T>;
|
|
17
|
+
update<T>(table: string, id: string, data: Partial<T>): Promise<T>;
|
|
18
|
+
upsert<T>(table: string, id: string, data: T): Promise<T>;
|
|
19
|
+
delete(table: string, id: string): Promise<void>;
|
|
20
|
+
count(table: string, query?: QueryOptions): Promise<number>;
|
|
21
|
+
deleteMany(table: string, query?: QueryOptions): Promise<void>;
|
|
22
|
+
findMany<T>(table: string, query?: QueryOptions): Promise<T[]>;
|
|
23
|
+
private buildWhere;
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DatastoreAdapter, QueryOptions } from '../datastore';
|
|
2
|
+
export interface SurrealAdapterOptions {
|
|
3
|
+
url?: string;
|
|
4
|
+
namespace?: string;
|
|
5
|
+
database?: string;
|
|
6
|
+
auth?: any;
|
|
7
|
+
engines?: any;
|
|
8
|
+
connectOptions?: any;
|
|
9
|
+
}
|
|
10
|
+
export declare class SurrealAdapter implements DatastoreAdapter {
|
|
11
|
+
name: string;
|
|
12
|
+
private db;
|
|
13
|
+
private logger;
|
|
14
|
+
private options;
|
|
15
|
+
constructor(options?: SurrealAdapterOptions);
|
|
16
|
+
connect(): Promise<void>;
|
|
17
|
+
disconnect(): Promise<void>;
|
|
18
|
+
setupSchema(): Promise<void>;
|
|
19
|
+
private retry;
|
|
20
|
+
get<T>(table: string, id: string): Promise<T | null>;
|
|
21
|
+
create<T>(table: string, id: string, data: T): Promise<T>;
|
|
22
|
+
update<T>(table: string, id: string, data: Partial<T>): Promise<T>;
|
|
23
|
+
upsert<T>(table: string, id: string, data: T): Promise<T>;
|
|
24
|
+
delete(table: string, id: string): Promise<void>;
|
|
25
|
+
count(table: string, query?: QueryOptions): Promise<number>;
|
|
26
|
+
deleteMany(table: string, query?: QueryOptions): Promise<void>;
|
|
27
|
+
findMany<T>(table: string, query?: QueryOptions): Promise<T[]>;
|
|
28
|
+
private buildQuery;
|
|
29
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export interface QueryOptions {
|
|
2
|
+
/**
|
|
3
|
+
* strict equality matches
|
|
4
|
+
*/
|
|
5
|
+
where?: Record<string, any>;
|
|
6
|
+
/**
|
|
7
|
+
* less than matches
|
|
8
|
+
*/
|
|
9
|
+
lt?: Record<string, number | string>;
|
|
10
|
+
/**
|
|
11
|
+
* greater than matches
|
|
12
|
+
*/
|
|
13
|
+
gt?: Record<string, number | string>;
|
|
14
|
+
/**
|
|
15
|
+
* sort results by field
|
|
16
|
+
*/
|
|
17
|
+
sort?: Record<string, 'asc' | 'desc'>;
|
|
18
|
+
limit?: number;
|
|
19
|
+
offset?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface DatastoreAdapter {
|
|
22
|
+
name: string;
|
|
23
|
+
connect(): Promise<void>;
|
|
24
|
+
disconnect(): Promise<void>;
|
|
25
|
+
setupSchema(): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Get a single record by global ID (table + id)
|
|
28
|
+
*/
|
|
29
|
+
get<T>(table: string, id: string): Promise<T | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Create a new record. Fails if exists.
|
|
32
|
+
*/
|
|
33
|
+
create<T>(table: string, id: string, data: T): Promise<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Update an existing record. Fails if not exists.
|
|
36
|
+
* Merges data.
|
|
37
|
+
*/
|
|
38
|
+
update<T>(table: string, id: string, data: Partial<T>): Promise<T>;
|
|
39
|
+
/**
|
|
40
|
+
* Create or update a record.
|
|
41
|
+
*/
|
|
42
|
+
upsert<T>(table: string, id: string, data: T): Promise<T>;
|
|
43
|
+
/**
|
|
44
|
+
* Delete a single record
|
|
45
|
+
*/
|
|
46
|
+
delete(table: string, id: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Count records matching query
|
|
49
|
+
*/
|
|
50
|
+
count(table: string, query?: QueryOptions): Promise<number>;
|
|
51
|
+
/**
|
|
52
|
+
* Delete multiple records matching query
|
|
53
|
+
*/
|
|
54
|
+
deleteMany(table: string, query?: QueryOptions): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Find multiple records matching query
|
|
57
|
+
*/
|
|
58
|
+
findMany<T>(table: string, query?: QueryOptions): Promise<T[]>;
|
|
59
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Server } from 'bun';
|
|
2
|
+
import { Shokupan } from '../../shokupan';
|
|
3
|
+
import { ServerAdapter } from './interface';
|
|
4
|
+
export declare class H3Adapter implements ServerAdapter {
|
|
5
|
+
private nodeServer?;
|
|
6
|
+
listen(port: number, app: Shokupan): Promise<Server<any>>;
|
|
7
|
+
stop(): Promise<void>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { EventEmitter } from 'events';
|
|
2
|
+
export type ASTAnalyzerState = 'idle' | 'analyzing' | 'completed' | 'failed';
|
|
3
|
+
export interface ASTAnalyzerResult {
|
|
4
|
+
applications: any[];
|
|
5
|
+
}
|
|
6
|
+
export interface ASTAnalyzerEvents {
|
|
7
|
+
'started': () => void;
|
|
8
|
+
'completed': (result: ASTAnalyzerResult) => void;
|
|
9
|
+
'failed': (error: Error) => void;
|
|
10
|
+
'progress': (message: string) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Worker-based AST analyzer that runs TypeScript analysis in a separate thread.
|
|
14
|
+
* This prevents blocking the main event loop during intensive AST parsing.
|
|
15
|
+
*/
|
|
16
|
+
export declare class ASTAnalyzerWorker extends EventEmitter {
|
|
17
|
+
private state;
|
|
18
|
+
private result;
|
|
19
|
+
private error;
|
|
20
|
+
private worker;
|
|
21
|
+
private analysisPromise;
|
|
22
|
+
private rootDir;
|
|
23
|
+
private entrypoint?;
|
|
24
|
+
private timeout;
|
|
25
|
+
private startTime;
|
|
26
|
+
constructor(rootDir: string, entrypoint?: string, timeout?: number);
|
|
27
|
+
/**
|
|
28
|
+
* Get the current state of the analyzer.
|
|
29
|
+
*/
|
|
30
|
+
getState(): ASTAnalyzerState;
|
|
31
|
+
/**
|
|
32
|
+
* Get the cached result if analysis completed successfully.
|
|
33
|
+
*/
|
|
34
|
+
getResult(): ASTAnalyzerResult | null;
|
|
35
|
+
/**
|
|
36
|
+
* Get the error if analysis failed.
|
|
37
|
+
*/
|
|
38
|
+
getError(): Error | null;
|
|
39
|
+
/**
|
|
40
|
+
* Check if analysis is currently running.
|
|
41
|
+
*/
|
|
42
|
+
isAnalyzing(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Check if analysis has completed successfully.
|
|
45
|
+
*/
|
|
46
|
+
isCompleted(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Check if analysis has failed.
|
|
49
|
+
*/
|
|
50
|
+
isFailed(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Get analysis duration in milliseconds (if completed or failed).
|
|
53
|
+
*/
|
|
54
|
+
getDuration(): number | null;
|
|
55
|
+
/**
|
|
56
|
+
* Start AST analysis in a worker thread.
|
|
57
|
+
* Returns immediately and emits events as analysis progresses.
|
|
58
|
+
*/
|
|
59
|
+
analyze(): Promise<ASTAnalyzerResult>;
|
|
60
|
+
/**
|
|
61
|
+
* Wait for analysis to complete (if it's running) or return immediately if already done.
|
|
62
|
+
*/
|
|
63
|
+
waitForCompletion(): Promise<ASTAnalyzerResult>;
|
|
64
|
+
/**
|
|
65
|
+
* Terminate the worker thread if running.
|
|
66
|
+
*/
|
|
67
|
+
terminate(): void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get or create the global AST analyzer instance.
|
|
71
|
+
* This ensures all plugins share the same analysis results.
|
|
72
|
+
*/
|
|
73
|
+
export declare function getGlobalAnalyzer(rootDir?: string, entrypoint?: string, timeout?: number): ASTAnalyzerWorker;
|
|
74
|
+
/**
|
|
75
|
+
* Reset the global analyzer instance (useful for testing).
|
|
76
|
+
*/
|
|
77
|
+
export declare function resetGlobalAnalyzer(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Logger } from './logger';
|
|
1
2
|
export type EnvLoaderOptions = {
|
|
2
3
|
/**
|
|
3
4
|
* If provided, k8s secrets will be loaded from the given paths
|
|
@@ -9,6 +10,10 @@ export type EnvLoaderOptions = {
|
|
|
9
10
|
* @default []
|
|
10
11
|
*/
|
|
11
12
|
k8sConfigMapMountPaths?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Optional logger instance
|
|
15
|
+
*/
|
|
16
|
+
logger?: Logger;
|
|
12
17
|
};
|
|
13
18
|
type Listener<T> = (value: T) => void;
|
|
14
19
|
/**
|
|
@@ -50,6 +55,7 @@ declare const $secretSubjects: unique symbol;
|
|
|
50
55
|
declare const $options: unique symbol;
|
|
51
56
|
declare const $watchers: unique symbol;
|
|
52
57
|
declare const $watchersStarted: unique symbol;
|
|
58
|
+
declare const $logger: unique symbol;
|
|
53
59
|
declare const $getSecretValueInternal: unique symbol;
|
|
54
60
|
declare const $getOrCreateSubject: unique symbol;
|
|
55
61
|
declare const $loadSecrets: unique symbol;
|
|
@@ -65,6 +71,7 @@ export declare abstract class EnvLoader {
|
|
|
65
71
|
private [$options];
|
|
66
72
|
private [$watchers];
|
|
67
73
|
private [$watchersStarted];
|
|
74
|
+
private [$logger];
|
|
68
75
|
constructor(options?: EnvLoaderOptions);
|
|
69
76
|
/**
|
|
70
77
|
* Initialize the loader: read secrets.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Escapes unsafe characters in a string for use in HTML using named character references.
|
|
3
|
+
*
|
|
4
|
+
* @param unsafe - The input value to escape. If not a string, it will be coerced to one.
|
|
5
|
+
* @returns The escaped string.
|
|
6
|
+
*/
|
|
7
|
+
export declare function escapeHtml(unsafe: unknown): string;
|
|
8
|
+
/**
|
|
9
|
+
* Safely serializes data to JSON for embedding in a <script> tag.
|
|
10
|
+
* Prevents Script Injection via </script> tags.
|
|
11
|
+
*
|
|
12
|
+
* @param data - The data to serialize.
|
|
13
|
+
* @returns The JSON string with </script> escaped.
|
|
14
|
+
*/
|
|
15
|
+
export declare function safeScriptJson(data: any): string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility for generating links to open files in various editors.
|
|
3
|
+
* Controlled by the `IDE` environment variable or app-level configuration.
|
|
4
|
+
*/
|
|
5
|
+
export declare function configureIde(config: {
|
|
6
|
+
ide?: string;
|
|
7
|
+
}): void;
|
|
8
|
+
export declare function getEditorLinkPattern(): string;
|
|
9
|
+
export declare function generateEditorLink(filePath: string, line?: number, column?: number): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface Logger {
|
|
2
|
+
debug(module: string, msg: string, props?: Record<string, any>): void;
|
|
3
|
+
info(module: string, msg: string, props?: Record<string, any>): void;
|
|
4
|
+
warn(module: string, msg: string, props?: Record<string, any>): void;
|
|
5
|
+
error(module: string, msg: string, props?: Record<string, any>): void;
|
|
6
|
+
fatal(module: string, msg: string, props?: Record<string, any>): void;
|
|
7
|
+
}
|
|
8
|
+
export declare class JsonLogger implements Logger {
|
|
9
|
+
private write;
|
|
10
|
+
debug(module: string, msg: string, props?: Record<string, any>): void;
|
|
11
|
+
info(module: string, msg: string, props?: Record<string, any>): void;
|
|
12
|
+
warn(module: string, msg: string, props?: Record<string, any>): void;
|
|
13
|
+
error(module: string, msg: string, props?: Record<string, any>): void;
|
|
14
|
+
fatal(module: string, msg: string, props?: Record<string, any>): void;
|
|
15
|
+
}
|
|
16
|
+
export declare class ConsolaLogger implements Logger {
|
|
17
|
+
private consola;
|
|
18
|
+
constructor(level?: number);
|
|
19
|
+
debug(module: string, msg: string, props?: Record<string, any>): void;
|
|
20
|
+
info(module: string, msg: string, props?: Record<string, any>): void;
|
|
21
|
+
warn(module: string, msg: string, props?: Record<string, any>): void;
|
|
22
|
+
error(module: string, msg: string, props?: Record<string, any>): void;
|
|
23
|
+
fatal(module: string, msg: string, props?: Record<string, any>): void;
|
|
24
|
+
}
|
|
25
|
+
export declare function createLogger(env?: string): Logger;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fast Querystring Parser
|
|
3
|
+
*
|
|
4
|
+
* Optimized for speed by minimizing allocations and avoiding regex.
|
|
5
|
+
* Benchmarked faster than 'fast-querystring' and significantly faster than native 'URLSearchParams'.
|
|
6
|
+
*/
|
|
7
|
+
export type QueryParserMode = 'simple' | 'extended' | 'strict';
|
|
8
|
+
export declare function parseQuery(url: string, mode?: QueryParserMode): Record<string, any>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { BodyInit } from 'bun';
|
|
2
|
+
/**
|
|
3
|
+
* Response transformer function
|
|
4
|
+
* Converts data to a specific format and returns response metadata
|
|
5
|
+
*/
|
|
6
|
+
export interface ResponseTransformer {
|
|
7
|
+
/**
|
|
8
|
+
* MIME type(s) this transformer handles
|
|
9
|
+
* Can be a string or array of strings
|
|
10
|
+
*/
|
|
11
|
+
contentType: string | string[];
|
|
12
|
+
/**
|
|
13
|
+
* Serialize the data
|
|
14
|
+
* @param data The data to serialize
|
|
15
|
+
* @returns Serialized body and optional headers
|
|
16
|
+
*/
|
|
17
|
+
serialize: (data: any) => {
|
|
18
|
+
body: BodyInit;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
} | Promise<{
|
|
21
|
+
body: BodyInit;
|
|
22
|
+
headers?: Record<string, string>;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Optional: Quality value for content negotiation (0-1)
|
|
26
|
+
* Higher values = preferred format when multiple matches exist
|
|
27
|
+
*/
|
|
28
|
+
quality?: number;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Response transformer registry
|
|
32
|
+
* Manages registered transformers and performs content negotiation
|
|
33
|
+
*/
|
|
34
|
+
export declare class ResponseTransformerRegistry {
|
|
35
|
+
private transformers;
|
|
36
|
+
private defaultTransformer?;
|
|
37
|
+
/**
|
|
38
|
+
* Register a response transformer
|
|
39
|
+
* @param transformer The transformer to register
|
|
40
|
+
*/
|
|
41
|
+
register(transformer: ResponseTransformer): void;
|
|
42
|
+
/**
|
|
43
|
+
* Get a transformer by exact content type match
|
|
44
|
+
* @param contentType The content type to look up
|
|
45
|
+
* @returns The transformer or undefined
|
|
46
|
+
*/
|
|
47
|
+
getTransformer(contentType: string): ResponseTransformer | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Set the default transformer content type
|
|
50
|
+
* @param contentType The content type to use as default
|
|
51
|
+
*/
|
|
52
|
+
setDefault(contentType: string): void;
|
|
53
|
+
/**
|
|
54
|
+
* Get the default transformer
|
|
55
|
+
* @returns The default transformer or undefined
|
|
56
|
+
*/
|
|
57
|
+
getDefault(): ResponseTransformer | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Perform content negotiation based on Accept header
|
|
60
|
+
* @param acceptHeader The Accept header value
|
|
61
|
+
* @returns The best matching transformer or undefined
|
|
62
|
+
*/
|
|
63
|
+
negotiate(acceptHeader: string): ResponseTransformer | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* Parse Accept header into structured entries
|
|
66
|
+
* @param acceptHeader The Accept header value
|
|
67
|
+
* @returns Array of parsed accept entries
|
|
68
|
+
*/
|
|
69
|
+
private parseAcceptHeader;
|
|
70
|
+
/**
|
|
71
|
+
* Find exact content type match
|
|
72
|
+
* @param accept The accept entry to match
|
|
73
|
+
* @returns The matching transformer or undefined
|
|
74
|
+
*/
|
|
75
|
+
private findExactMatch;
|
|
76
|
+
/**
|
|
77
|
+
* Find wildcard content type match
|
|
78
|
+
* @param accept The accept entry to match
|
|
79
|
+
* @returns The matching transformer or undefined
|
|
80
|
+
*/
|
|
81
|
+
private findWildcardMatch;
|
|
82
|
+
/**
|
|
83
|
+
* Get all registered content types
|
|
84
|
+
* @returns Array of registered content types
|
|
85
|
+
*/
|
|
86
|
+
getRegisteredTypes(): string[];
|
|
87
|
+
}
|
package/dist/util/symbol.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export declare const $mountPath: unique symbol;
|
|
|
14
14
|
export declare const $dispatch: unique symbol;
|
|
15
15
|
export declare const $routes: unique symbol;
|
|
16
16
|
export declare const $routeSpec: unique symbol;
|
|
17
|
+
export declare const $controllerHooks: unique symbol;
|
|
17
18
|
export declare const $url: unique symbol;
|
|
18
19
|
export declare const $requestId: unique symbol;
|
|
19
20
|
export declare const $debug: unique symbol;
|