@vobase/core 0.1.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/__tests__/e2e.test.d.ts +2 -0
- package/dist/__tests__/e2e.test.d.ts.map +1 -0
- package/dist/__tests__/rpc-types.test.d.ts +43 -0
- package/dist/__tests__/rpc-types.test.d.ts.map +1 -0
- package/dist/app.d.ts +117 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.test.d.ts +2 -0
- package/dist/app.test.d.ts.map +1 -0
- package/dist/audit.d.ts +3 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.test.d.ts +2 -0
- package/dist/audit.test.d.ts.map +1 -0
- package/dist/auth.d.ts +25 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.test.d.ts +2 -0
- package/dist/auth.test.d.ts.map +1 -0
- package/dist/circuit-breaker.d.ts +17 -0
- package/dist/circuit-breaker.d.ts.map +1 -0
- package/dist/ctx.d.ts +34 -0
- package/dist/ctx.d.ts.map +1 -0
- package/dist/ctx.test.d.ts +2 -0
- package/dist/ctx.test.d.ts.map +1 -0
- package/dist/db/auth-schema.d.ts +1337 -0
- package/dist/db/auth-schema.d.ts.map +1 -0
- package/dist/db/client.d.ts +4 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.test.d.ts +2 -0
- package/dist/db/client.test.d.ts.map +1 -0
- package/dist/db/ensure-core-tables.d.ts +12 -0
- package/dist/db/ensure-core-tables.d.ts.map +1 -0
- package/dist/db/ensure-core-tables.test.d.ts +2 -0
- package/dist/db/ensure-core-tables.test.d.ts.map +1 -0
- package/dist/db/helpers.d.ts +26 -0
- package/dist/db/helpers.d.ts.map +1 -0
- package/dist/db/helpers.test.d.ts +2 -0
- package/dist/db/helpers.test.d.ts.map +1 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/migrator.d.ts +3 -0
- package/dist/db/migrator.d.ts.map +1 -0
- package/dist/db/system-schema.d.ts +368 -0
- package/dist/db/system-schema.d.ts.map +1 -0
- package/dist/db/system-schema.test.d.ts +2 -0
- package/dist/db/system-schema.test.d.ts.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.test.d.ts +2 -0
- package/dist/errors.test.d.ts.map +1 -0
- package/dist/http-client.d.ts +31 -0
- package/dist/http-client.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85917 -0
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.test.d.ts +2 -0
- package/dist/job.test.d.ts.map +1 -0
- package/dist/logger.d.ts +7 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.test.d.ts +2 -0
- package/dist/logger.test.d.ts.map +1 -0
- package/dist/mcp.d.ts +10 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.test.d.ts +2 -0
- package/dist/mcp.test.d.ts.map +1 -0
- package/dist/middleware/audit.d.ts +6 -0
- package/dist/middleware/audit.d.ts.map +1 -0
- package/dist/middleware/audit.test.d.ts +2 -0
- package/dist/middleware/audit.test.d.ts.map +1 -0
- package/dist/middleware/session.d.ts +14 -0
- package/dist/middleware/session.d.ts.map +1 -0
- package/dist/module-registry.d.ts +3 -0
- package/dist/module-registry.d.ts.map +1 -0
- package/dist/module.d.ts +20 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.test.d.ts +2 -0
- package/dist/module.test.d.ts.map +1 -0
- package/dist/queue.d.ts +18 -0
- package/dist/queue.d.ts.map +1 -0
- package/dist/queue.test.d.ts +2 -0
- package/dist/queue.test.d.ts.map +1 -0
- package/dist/sequence.d.ts +8 -0
- package/dist/sequence.d.ts.map +1 -0
- package/dist/sequence.test.d.ts +2 -0
- package/dist/sequence.test.d.ts.map +1 -0
- package/dist/storage.d.ts +8 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.test.d.ts +2 -0
- package/dist/storage.test.d.ts.map +1 -0
- package/dist/system/handlers.d.ts +90 -0
- package/dist/system/handlers.d.ts.map +1 -0
- package/dist/system/index.d.ts +8 -0
- package/dist/system/index.d.ts.map +1 -0
- package/dist/system/schema.d.ts +2 -0
- package/dist/system/schema.d.ts.map +1 -0
- package/dist/system/system.test.d.ts +2 -0
- package/dist/system/system.test.d.ts.map +1 -0
- package/dist/webhooks.d.ts +53 -0
- package/dist/webhooks.d.ts.map +1 -0
- package/package.json +41 -0
package/dist/job.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Worker } from 'bunqueue/client';
|
|
2
|
+
import { type SchedulerOptions } from './queue';
|
|
3
|
+
export type JobHandler = (data: unknown) => Promise<void>;
|
|
4
|
+
export interface JobDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
handler: JobHandler;
|
|
7
|
+
}
|
|
8
|
+
export interface WorkerOptions extends Pick<SchedulerOptions, 'dbPath' | 'queueName'> {
|
|
9
|
+
concurrency?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const jobRegistry: Map<string, JobHandler>;
|
|
12
|
+
export declare function defineJob(name: string, handler: JobHandler): JobDefinition;
|
|
13
|
+
export declare function createWorker(jobs: JobDefinition[], options?: WorkerOptions): Worker;
|
|
14
|
+
//# sourceMappingURL=job.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,MAAM,EACP,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,WAAW,CAAC;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,WAAW,yBAAgC,CAAC;AAkCzD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,aAAa,CAM1E;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EAAE,EACrB,OAAO,CAAC,EAAE,aAAa,GACtB,MAAM,CAoBR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.test.d.ts","sourceRoot":"","sources":["../src/job.test.ts"],"names":[],"mappings":""}
|
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,MAAM;gBACL,MAAM,SAAS,OAAO;gBACtB,MAAM,SAAS,OAAO;iBACrB,MAAM,SAAS,OAAO;iBACtB,MAAM,SAAS,OAAO;CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.test.d.ts","sourceRoot":"","sources":["../src/logger.test.ts"],"names":[],"mappings":""}
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { type VobaseDb } from './db';
|
|
3
|
+
import type { VobaseModule } from './module';
|
|
4
|
+
export interface McpDeps {
|
|
5
|
+
db: VobaseDb;
|
|
6
|
+
modules: VobaseModule[];
|
|
7
|
+
}
|
|
8
|
+
export declare function createMcpServer(deps: McpDeps): McpServer;
|
|
9
|
+
export declare function createMcpHandler(deps: McpDeps): (req: Request) => Promise<Response>;
|
|
10
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK7C,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,QAAQ,CAAC;IACb,OAAO,EAAE,YAAY,EAAE,CAAC;CACzB;AAmBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,CAmFxD;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,OAAO,GACZ,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAgBrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.test.d.ts","sourceRoot":"","sources":["../src/mcp.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type VobaseDb } from '../db';
|
|
2
|
+
export declare function requestAuditMiddleware(db: VobaseDb): import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
3
|
+
export declare function createAuthAuditHooks(db: VobaseDb): {
|
|
4
|
+
after: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/middleware/audit.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAkChD,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,+DAkBlD;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ;;EAoBhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.test.d.ts","sourceRoot":"","sources":["../../src/middleware/audit.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Auth } from '../auth';
|
|
2
|
+
declare module 'hono' {
|
|
3
|
+
interface ContextVariableMap {
|
|
4
|
+
user: {
|
|
5
|
+
id: string;
|
|
6
|
+
email: string;
|
|
7
|
+
name: string;
|
|
8
|
+
role: string;
|
|
9
|
+
} | null;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export declare function sessionMiddleware(auth: Auth): import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
13
|
+
export declare function optionalSessionMiddleware(auth: Auth): import("hono").MiddlewareHandler<any, string, {}, Response>;
|
|
14
|
+
//# sourceMappingURL=session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/middleware/session.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAUpC,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,kBAAkB;QAC1B,IAAI,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;KACxE;CACF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,+DAiB3C;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,+DAkBnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-registry.d.ts","sourceRoot":"","sources":["../src/module-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,wBAAgB,eAAe,CAC7B,OAAO,EAAE,YAAY,EAAE,GACtB,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAY3B"}
|
package/dist/module.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import type { JobDefinition } from './job';
|
|
3
|
+
export interface VobaseModule {
|
|
4
|
+
name: string;
|
|
5
|
+
schema: Record<string, unknown>;
|
|
6
|
+
routes: Hono;
|
|
7
|
+
jobs?: JobDefinition[];
|
|
8
|
+
pages?: Record<string, string>;
|
|
9
|
+
seed?: () => Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export interface DefineModuleConfig {
|
|
12
|
+
name: string;
|
|
13
|
+
schema: Record<string, unknown>;
|
|
14
|
+
routes: Hono;
|
|
15
|
+
jobs?: JobDefinition[];
|
|
16
|
+
pages?: Record<string, string>;
|
|
17
|
+
seed?: () => Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export declare function defineModule(config: DefineModuleConfig): VobaseModule;
|
|
20
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,CAAC,EAAE,aAAa,EAAE,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY,CA8CrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.test.d.ts","sourceRoot":"","sources":["../src/module.test.ts"],"names":[],"mappings":""}
|
package/dist/queue.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const DEFAULT_QUEUE_DB_PATH = "/data/bunqueue.db";
|
|
2
|
+
export declare const DEFAULT_QUEUE_NAME = "vobase-jobs";
|
|
3
|
+
export interface JobOptions {
|
|
4
|
+
delay?: number | string;
|
|
5
|
+
priority?: number;
|
|
6
|
+
retry?: number;
|
|
7
|
+
retries?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface SchedulerOptions {
|
|
10
|
+
dbPath?: string;
|
|
11
|
+
queueName?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Scheduler {
|
|
14
|
+
add(jobName: string, data: unknown, options?: JobOptions): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function configureQueueDataPath(dbPath: string): string;
|
|
17
|
+
export declare function createScheduler(options?: SchedulerOptions): Scheduler;
|
|
18
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../src/queue.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AACzD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E;AAsFD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAa7D;AAED,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAmBrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.test.d.ts","sourceRoot":"","sources":["../src/queue.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type VobaseDb } from './db';
|
|
2
|
+
export interface SequenceOptions {
|
|
3
|
+
padLength?: number;
|
|
4
|
+
separator?: string;
|
|
5
|
+
yearPrefix?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function nextSequence(db: VobaseDb, prefix: string, options?: SequenceOptions): string;
|
|
8
|
+
//# sourceMappingURL=sequence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../src/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEnD,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAQD,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,eAAe,GACxB,MAAM,CA4BR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequence.test.d.ts","sourceRoot":"","sources":["../src/sequence.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface Storage {
|
|
2
|
+
upload(path: string, buffer: Buffer | Uint8Array): Promise<void>;
|
|
3
|
+
download(path: string): Promise<Uint8Array>;
|
|
4
|
+
getUrl(path: string): string;
|
|
5
|
+
delete(path: string): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
export declare function createStorage(basePath: string, db?: unknown): Storage;
|
|
8
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,OAAO;IACtB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAwCrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.test.d.ts","sourceRoot":"","sources":["../src/storage.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Auth } from '../auth';
|
|
2
|
+
export declare function createSystemRoutes(auth: Auth): import("hono/hono-base").HonoBase<{}, {
|
|
3
|
+
"/": {
|
|
4
|
+
$get: {
|
|
5
|
+
input: {};
|
|
6
|
+
output: {
|
|
7
|
+
version: string;
|
|
8
|
+
uptime: number;
|
|
9
|
+
modules: string[];
|
|
10
|
+
};
|
|
11
|
+
outputFormat: "json";
|
|
12
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} & {
|
|
16
|
+
"/health": {
|
|
17
|
+
$get: {
|
|
18
|
+
input: {};
|
|
19
|
+
output: {
|
|
20
|
+
status: string;
|
|
21
|
+
db: string;
|
|
22
|
+
uptime: number;
|
|
23
|
+
};
|
|
24
|
+
outputFormat: "json";
|
|
25
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
} & {
|
|
29
|
+
"/audit-log": {
|
|
30
|
+
$get: {
|
|
31
|
+
input: {};
|
|
32
|
+
output: {
|
|
33
|
+
entries: {
|
|
34
|
+
id: string;
|
|
35
|
+
event: string;
|
|
36
|
+
actorId: string | null;
|
|
37
|
+
actorEmail: string | null;
|
|
38
|
+
ip: string | null;
|
|
39
|
+
details: string | null;
|
|
40
|
+
createdAt: string;
|
|
41
|
+
}[];
|
|
42
|
+
nextCursor: string | null;
|
|
43
|
+
};
|
|
44
|
+
outputFormat: "json";
|
|
45
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
} & {
|
|
49
|
+
"/sequences": {
|
|
50
|
+
$get: {
|
|
51
|
+
input: {};
|
|
52
|
+
output: {
|
|
53
|
+
sequences: {
|
|
54
|
+
id: string;
|
|
55
|
+
prefix: string;
|
|
56
|
+
currentValue: number;
|
|
57
|
+
updatedAt: string;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
outputFormat: "json";
|
|
61
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
} & {
|
|
65
|
+
"/record-audits/:table/:id": {
|
|
66
|
+
$get: {
|
|
67
|
+
input: {
|
|
68
|
+
param: {
|
|
69
|
+
table: string;
|
|
70
|
+
} & {
|
|
71
|
+
id: string;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
output: {
|
|
75
|
+
entries: {
|
|
76
|
+
id: string;
|
|
77
|
+
tableName: string;
|
|
78
|
+
recordId: string;
|
|
79
|
+
oldData: string | null;
|
|
80
|
+
newData: string | null;
|
|
81
|
+
changedBy: string | null;
|
|
82
|
+
createdAt: string;
|
|
83
|
+
}[];
|
|
84
|
+
};
|
|
85
|
+
outputFormat: "json";
|
|
86
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}, "/", "/record-audits/:table/:id">;
|
|
90
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../src/system/handlers.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAgCpC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAuE5C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Auth } from '../auth';
|
|
2
|
+
import { type VobaseModule } from '../module';
|
|
3
|
+
import { createSystemRoutes } from './handlers';
|
|
4
|
+
export * from './schema';
|
|
5
|
+
export { createSystemRoutes } from './handlers';
|
|
6
|
+
export type SystemRoutes = ReturnType<typeof createSystemRoutes>;
|
|
7
|
+
export declare function createSystemModule(auth: Auth): VobaseModule;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/system/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGhD,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEjE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,YAAY,CAM3D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/system/schema.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.test.d.ts","sourceRoot":"","sources":["../../src/system/system.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Database } from 'bun:sqlite';
|
|
2
|
+
import { Hono } from 'hono';
|
|
3
|
+
import type { Scheduler } from './queue';
|
|
4
|
+
export interface WebhookConfig {
|
|
5
|
+
/** Route path, e.g. '/webhooks/stripe' */
|
|
6
|
+
path: string;
|
|
7
|
+
/** HMAC secret for signature verification */
|
|
8
|
+
secret: string;
|
|
9
|
+
/** Job name to enqueue, e.g. 'system:processWebhook' */
|
|
10
|
+
handler: string;
|
|
11
|
+
/** Header containing the signature (default: 'x-webhook-signature') */
|
|
12
|
+
signatureHeader?: string;
|
|
13
|
+
/** Whether to deduplicate webhooks (default: true) */
|
|
14
|
+
dedup?: boolean;
|
|
15
|
+
/** Header containing the webhook delivery ID (default: 'x-webhook-id') */
|
|
16
|
+
idHeader?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Verify an HMAC-SHA256 signature against a payload and secret.
|
|
20
|
+
*
|
|
21
|
+
* Uses timing-safe comparison to prevent timing attacks.
|
|
22
|
+
* Returns false for any malformed or invalid signature (never throws).
|
|
23
|
+
*/
|
|
24
|
+
export declare function verifyHmacSignature(payload: string, signature: string, secret: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Creates the `_webhook_dedup` table if it doesn't exist.
|
|
27
|
+
*
|
|
28
|
+
* Uses raw SQL via the bun:sqlite Database handle, matching the pattern
|
|
29
|
+
* used by `ensureCoreTables`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function ensureWebhookDedupTable(db: Database): void;
|
|
32
|
+
/**
|
|
33
|
+
* Check whether a webhook has already been processed and record it if not.
|
|
34
|
+
*
|
|
35
|
+
* Uses INSERT OR IGNORE and inspects changes to determine whether the
|
|
36
|
+
* row was newly inserted (not a duplicate) or already existed (duplicate).
|
|
37
|
+
*
|
|
38
|
+
* @returns `true` if the webhook is a duplicate, `false` if it's new.
|
|
39
|
+
*/
|
|
40
|
+
export declare function checkAndRecordWebhook(db: Database, webhookId: string, source: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Create a Hono router that handles incoming webhook POST requests.
|
|
43
|
+
*
|
|
44
|
+
* For each webhook config, registers a POST handler that:
|
|
45
|
+
* 1. Verifies HMAC signature
|
|
46
|
+
* 2. Optionally deduplicates by webhook ID
|
|
47
|
+
* 3. Enqueues the payload to the configured job
|
|
48
|
+
*/
|
|
49
|
+
export declare function createWebhookRoutes(configs: Record<string, WebhookConfig>, deps: {
|
|
50
|
+
db: Database;
|
|
51
|
+
scheduler: Scheduler;
|
|
52
|
+
}): Hono;
|
|
53
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../src/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAoBT;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAS1D;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAOT;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACtC,IAAI,EAAE;IAAE,EAAE,EAAE,QAAQ,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GAC3C,IAAI,CA8CN"}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vobase/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "bun build ./src/index.ts --outdir ./dist --target=bun --sourcemap=inline && tsc -p tsconfig.build.json --emitDeclarationOnly --outDir ./dist",
|
|
22
|
+
"dev": "bun run build --watch",
|
|
23
|
+
"test": "bun test src/",
|
|
24
|
+
"lint": "biome lint src/",
|
|
25
|
+
"typecheck": "tsc --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"hono": "^4.6.0",
|
|
29
|
+
"drizzle-orm": "^0.42.0",
|
|
30
|
+
"better-auth": "^1.5.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
34
|
+
"bunqueue": "^2.6.5",
|
|
35
|
+
"nanoid": "^5.1.6",
|
|
36
|
+
"zod": "^4.3.6"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"drizzle-kit": "^0.31.9"
|
|
40
|
+
}
|
|
41
|
+
}
|