@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.
Files changed (100) hide show
  1. package/dist/__tests__/e2e.test.d.ts +2 -0
  2. package/dist/__tests__/e2e.test.d.ts.map +1 -0
  3. package/dist/__tests__/rpc-types.test.d.ts +43 -0
  4. package/dist/__tests__/rpc-types.test.d.ts.map +1 -0
  5. package/dist/app.d.ts +117 -0
  6. package/dist/app.d.ts.map +1 -0
  7. package/dist/app.test.d.ts +2 -0
  8. package/dist/app.test.d.ts.map +1 -0
  9. package/dist/audit.d.ts +3 -0
  10. package/dist/audit.d.ts.map +1 -0
  11. package/dist/audit.test.d.ts +2 -0
  12. package/dist/audit.test.d.ts.map +1 -0
  13. package/dist/auth.d.ts +25 -0
  14. package/dist/auth.d.ts.map +1 -0
  15. package/dist/auth.test.d.ts +2 -0
  16. package/dist/auth.test.d.ts.map +1 -0
  17. package/dist/circuit-breaker.d.ts +17 -0
  18. package/dist/circuit-breaker.d.ts.map +1 -0
  19. package/dist/ctx.d.ts +34 -0
  20. package/dist/ctx.d.ts.map +1 -0
  21. package/dist/ctx.test.d.ts +2 -0
  22. package/dist/ctx.test.d.ts.map +1 -0
  23. package/dist/db/auth-schema.d.ts +1337 -0
  24. package/dist/db/auth-schema.d.ts.map +1 -0
  25. package/dist/db/client.d.ts +4 -0
  26. package/dist/db/client.d.ts.map +1 -0
  27. package/dist/db/client.test.d.ts +2 -0
  28. package/dist/db/client.test.d.ts.map +1 -0
  29. package/dist/db/ensure-core-tables.d.ts +12 -0
  30. package/dist/db/ensure-core-tables.d.ts.map +1 -0
  31. package/dist/db/ensure-core-tables.test.d.ts +2 -0
  32. package/dist/db/ensure-core-tables.test.d.ts.map +1 -0
  33. package/dist/db/helpers.d.ts +26 -0
  34. package/dist/db/helpers.d.ts.map +1 -0
  35. package/dist/db/helpers.test.d.ts +2 -0
  36. package/dist/db/helpers.test.d.ts.map +1 -0
  37. package/dist/db/index.d.ts +6 -0
  38. package/dist/db/index.d.ts.map +1 -0
  39. package/dist/db/migrator.d.ts +3 -0
  40. package/dist/db/migrator.d.ts.map +1 -0
  41. package/dist/db/system-schema.d.ts +368 -0
  42. package/dist/db/system-schema.d.ts.map +1 -0
  43. package/dist/db/system-schema.test.d.ts +2 -0
  44. package/dist/db/system-schema.test.d.ts.map +1 -0
  45. package/dist/errors.d.ts +26 -0
  46. package/dist/errors.d.ts.map +1 -0
  47. package/dist/errors.test.d.ts +2 -0
  48. package/dist/errors.test.d.ts.map +1 -0
  49. package/dist/http-client.d.ts +31 -0
  50. package/dist/http-client.d.ts.map +1 -0
  51. package/dist/index.d.ts +22 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +85917 -0
  54. package/dist/job.d.ts +14 -0
  55. package/dist/job.d.ts.map +1 -0
  56. package/dist/job.test.d.ts +2 -0
  57. package/dist/job.test.d.ts.map +1 -0
  58. package/dist/logger.d.ts +7 -0
  59. package/dist/logger.d.ts.map +1 -0
  60. package/dist/logger.test.d.ts +2 -0
  61. package/dist/logger.test.d.ts.map +1 -0
  62. package/dist/mcp.d.ts +10 -0
  63. package/dist/mcp.d.ts.map +1 -0
  64. package/dist/mcp.test.d.ts +2 -0
  65. package/dist/mcp.test.d.ts.map +1 -0
  66. package/dist/middleware/audit.d.ts +6 -0
  67. package/dist/middleware/audit.d.ts.map +1 -0
  68. package/dist/middleware/audit.test.d.ts +2 -0
  69. package/dist/middleware/audit.test.d.ts.map +1 -0
  70. package/dist/middleware/session.d.ts +14 -0
  71. package/dist/middleware/session.d.ts.map +1 -0
  72. package/dist/module-registry.d.ts +3 -0
  73. package/dist/module-registry.d.ts.map +1 -0
  74. package/dist/module.d.ts +20 -0
  75. package/dist/module.d.ts.map +1 -0
  76. package/dist/module.test.d.ts +2 -0
  77. package/dist/module.test.d.ts.map +1 -0
  78. package/dist/queue.d.ts +18 -0
  79. package/dist/queue.d.ts.map +1 -0
  80. package/dist/queue.test.d.ts +2 -0
  81. package/dist/queue.test.d.ts.map +1 -0
  82. package/dist/sequence.d.ts +8 -0
  83. package/dist/sequence.d.ts.map +1 -0
  84. package/dist/sequence.test.d.ts +2 -0
  85. package/dist/sequence.test.d.ts.map +1 -0
  86. package/dist/storage.d.ts +8 -0
  87. package/dist/storage.d.ts.map +1 -0
  88. package/dist/storage.test.d.ts +2 -0
  89. package/dist/storage.test.d.ts.map +1 -0
  90. package/dist/system/handlers.d.ts +90 -0
  91. package/dist/system/handlers.d.ts.map +1 -0
  92. package/dist/system/index.d.ts +8 -0
  93. package/dist/system/index.d.ts.map +1 -0
  94. package/dist/system/schema.d.ts +2 -0
  95. package/dist/system/schema.d.ts.map +1 -0
  96. package/dist/system/system.test.d.ts +2 -0
  97. package/dist/system/system.test.d.ts.map +1 -0
  98. package/dist/webhooks.d.ts +53 -0
  99. package/dist/webhooks.d.ts.map +1 -0
  100. package/package.json +41 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=e2e.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"e2e.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/e2e.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ declare const chainedApp: import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, import("hono/types").BlankSchema | import("hono/types").MergeSchemaPath<{
2
+ "/list": {
3
+ $get: {
4
+ input: {};
5
+ output: {
6
+ invoices: {
7
+ id: string;
8
+ total: number;
9
+ }[];
10
+ };
11
+ outputFormat: "json";
12
+ status: import("hono/utils/http-status").ContentfulStatusCode;
13
+ };
14
+ };
15
+ } & {
16
+ "/create": {
17
+ $post: {
18
+ input: {};
19
+ output: {
20
+ id: string;
21
+ total: number;
22
+ };
23
+ outputFormat: "json";
24
+ status: import("hono/utils/http-status").ContentfulStatusCode;
25
+ };
26
+ };
27
+ }, "/api/invoicing"> | import("hono/types").MergeSchemaPath<{
28
+ "/list": {
29
+ $get: {
30
+ input: {};
31
+ output: {
32
+ orders: {
33
+ id: string;
34
+ }[];
35
+ };
36
+ outputFormat: "json";
37
+ status: import("hono/utils/http-status").ContentfulStatusCode;
38
+ };
39
+ };
40
+ }, "/api/orders">, "/", "/">;
41
+ export type ChainedAppType = typeof chainedApp;
42
+ export {};
43
+ //# sourceMappingURL=rpc-types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-types.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/rpc-types.test.ts"],"names":[],"mappings":"AA2BA,QAAA,MAAM,UAAU;;;;;;wBAVK,MAAM;2BAAS,MAAM;;;;;;;;;;;;oBAArB,MAAM;uBAAS,MAAM;;;;;;;;;;;;wBAOL,MAAM;;;;;;;4BAKN,CAAC;AACtC,MAAM,MAAM,cAAc,GAAG,OAAO,UAAU,CAAC"}
package/dist/app.d.ts ADDED
@@ -0,0 +1,117 @@
1
+ import { type HttpClientOptions } from './http-client';
2
+ import type { VobaseModule } from './module';
3
+ import { type WebhookConfig } from './webhooks';
4
+ export interface CreateAppConfig {
5
+ modules: VobaseModule[];
6
+ database: string;
7
+ storage?: {
8
+ basePath: string;
9
+ };
10
+ http?: HttpClientOptions;
11
+ webhooks?: Record<string, WebhookConfig>;
12
+ mcp?: {
13
+ enabled?: boolean;
14
+ };
15
+ trustedOrigins?: string[];
16
+ }
17
+ export declare function createApp(config: CreateAppConfig): import("hono/hono-base").HonoBase<import("hono/types").BlankEnv, {
18
+ "/health": {
19
+ $get: {
20
+ input: {};
21
+ output: {
22
+ status: string;
23
+ uptime: number;
24
+ };
25
+ outputFormat: "json";
26
+ status: import("hono/utils/http-status").ContentfulStatusCode;
27
+ };
28
+ };
29
+ } | import("hono/types").MergeSchemaPath<{
30
+ "/": {
31
+ $get: {
32
+ input: {};
33
+ output: {
34
+ version: string;
35
+ uptime: number;
36
+ modules: string[];
37
+ };
38
+ outputFormat: "json";
39
+ status: import("hono/utils/http-status").ContentfulStatusCode;
40
+ };
41
+ };
42
+ } & {
43
+ "/health": {
44
+ $get: {
45
+ input: {};
46
+ output: {
47
+ status: string;
48
+ db: string;
49
+ uptime: number;
50
+ };
51
+ outputFormat: "json";
52
+ status: import("hono/utils/http-status").ContentfulStatusCode;
53
+ };
54
+ };
55
+ } & {
56
+ "/audit-log": {
57
+ $get: {
58
+ input: {};
59
+ output: {
60
+ entries: {
61
+ id: string;
62
+ event: string;
63
+ actorId: string | null;
64
+ actorEmail: string | null;
65
+ ip: string | null;
66
+ details: string | null;
67
+ createdAt: string;
68
+ }[];
69
+ nextCursor: string | null;
70
+ };
71
+ outputFormat: "json";
72
+ status: import("hono/utils/http-status").ContentfulStatusCode;
73
+ };
74
+ };
75
+ } & {
76
+ "/sequences": {
77
+ $get: {
78
+ input: {};
79
+ output: {
80
+ sequences: {
81
+ id: string;
82
+ prefix: string;
83
+ currentValue: number;
84
+ updatedAt: string;
85
+ }[];
86
+ };
87
+ outputFormat: "json";
88
+ status: import("hono/utils/http-status").ContentfulStatusCode;
89
+ };
90
+ };
91
+ } & {
92
+ "/record-audits/:table/:id": {
93
+ $get: {
94
+ input: {
95
+ param: {
96
+ table: string;
97
+ } & {
98
+ id: string;
99
+ };
100
+ };
101
+ output: {
102
+ entries: {
103
+ id: string;
104
+ tableName: string;
105
+ recordId: string;
106
+ oldData: string | null;
107
+ newData: string | null;
108
+ changedBy: string | null;
109
+ createdAt: string;
110
+ }[];
111
+ };
112
+ outputFormat: "json";
113
+ status: import("hono/utils/http-status").ContentfulStatusCode;
114
+ };
115
+ };
116
+ }, "/api/system">, "/", "/health">;
117
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AASA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK7C,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AA0CrE,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACzC,GAAG,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCAkEhD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=app.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.test.d.ts","sourceRoot":"","sources":["../src/app.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { type VobaseDb } from './db';
2
+ export declare function trackChanges(db: VobaseDb, tableName: string, recordId: string, oldData: Record<string, unknown> | null, newData: Record<string, unknown> | null, userId?: string): void;
3
+ //# sourceMappingURL=audit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,MAAM,CAAC;AAmBnD,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACvC,MAAM,CAAC,EAAE,MAAM,GACd,IAAI,CAyCN"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=audit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit.test.d.ts","sourceRoot":"","sources":["../src/audit.test.ts"],"names":[],"mappings":""}
package/dist/auth.d.ts ADDED
@@ -0,0 +1,25 @@
1
+ import type { VobaseDb } from './db';
2
+ export interface CreateAuthOptions {
3
+ trustedOrigins?: string[];
4
+ }
5
+ export declare function createAuth(db: VobaseDb, options?: CreateAuthOptions): import("better-auth").Auth<{
6
+ trustedOrigins?: string[] | undefined;
7
+ database: (options: import("better-auth").BetterAuthOptions) => import("better-auth").DBAdapter<import("better-auth").BetterAuthOptions>;
8
+ emailAndPassword: {
9
+ enabled: true;
10
+ };
11
+ user: {
12
+ additionalFields: {
13
+ role: {
14
+ type: "string";
15
+ defaultValue: string;
16
+ input: false;
17
+ };
18
+ };
19
+ };
20
+ hooks: {
21
+ after: (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<void>;
22
+ };
23
+ }>;
24
+ export type Auth = ReturnType<typeof createAuth>;
25
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAIrC,MAAM,WAAW,iBAAiB;IAChC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,iBAAiB;;;;;;;;;;;;;;;;;;GAkBnE;AAED,MAAM,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=auth.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.test.d.ts","sourceRoot":"","sources":["../src/auth.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ export interface CircuitBreakerOptions {
2
+ threshold: number;
3
+ resetTimeout: number;
4
+ }
5
+ export declare class CircuitBreaker {
6
+ private state;
7
+ private failures;
8
+ private openedAt;
9
+ private readonly threshold;
10
+ private readonly resetTimeout;
11
+ constructor(options: CircuitBreakerOptions);
12
+ isOpen(): boolean;
13
+ isHalfOpen(): boolean;
14
+ recordFailure(): void;
15
+ recordSuccess(): void;
16
+ }
17
+ //# sourceMappingURL=circuit-breaker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"circuit-breaker.d.ts","sourceRoot":"","sources":["../src/circuit-breaker.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AAID,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA0B;IACvC,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,EAAE,qBAAqB;IAK1C,MAAM,IAAI,OAAO;IAYjB,UAAU,IAAI,OAAO;IAMrB,aAAa,IAAI,IAAI;IAerB,aAAa,IAAI,IAAI;CAItB"}
package/dist/ctx.d.ts ADDED
@@ -0,0 +1,34 @@
1
+ import type { Context } from 'hono';
2
+ import type { VobaseDb } from './db';
3
+ import type { HttpClient } from './http-client';
4
+ import type { Scheduler } from './queue';
5
+ import type { Storage } from './storage';
6
+ export interface VobaseUser {
7
+ id: string;
8
+ email: string;
9
+ name: string;
10
+ role: string;
11
+ }
12
+ export interface VobaseCtx {
13
+ db: VobaseDb;
14
+ user: VobaseUser | null;
15
+ scheduler: Scheduler;
16
+ storage: Storage;
17
+ http: HttpClient;
18
+ }
19
+ declare module 'hono' {
20
+ interface ContextVariableMap {
21
+ db: VobaseDb;
22
+ scheduler: Scheduler;
23
+ storage: Storage;
24
+ http: HttpClient;
25
+ }
26
+ }
27
+ export declare function contextMiddleware(deps: {
28
+ db: VobaseDb;
29
+ scheduler: Scheduler;
30
+ storage: Storage;
31
+ http: HttpClient;
32
+ }): import("hono").MiddlewareHandler<any, string, {}, Response>;
33
+ export declare function getCtx(c: Context): VobaseCtx;
34
+ //# sourceMappingURL=ctx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctx.d.ts","sourceRoot":"","sources":["../src/ctx.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,QAAQ,CAAC;IACb,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAU,kBAAkB;QAC1B,EAAE,EAAE,QAAQ,CAAC;QACb,SAAS,EAAE,SAAS,CAAC;QACrB,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE,UAAU,CAAC;KAClB;CACF;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,EAAE,EAAE,QAAQ,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;CAClB,+DAQA;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAQ5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ctx.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ctx.test.d.ts","sourceRoot":"","sources":["../src/ctx.test.ts"],"names":[],"mappings":""}