@oakbun/auth 0.1.0 → 0.1.1

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 (128) hide show
  1. package/dist/index.d.ts +69 -0
  2. package/package.json +5 -5
  3. package/dist/auth/src/adapter.d.ts +0 -3
  4. package/dist/auth/src/adapter.d.ts.map +0 -1
  5. package/dist/auth/src/auth-adapter.d.ts +0 -30
  6. package/dist/auth/src/auth-adapter.d.ts.map +0 -1
  7. package/dist/auth/src/index.d.ts +0 -7
  8. package/dist/auth/src/index.d.ts.map +0 -1
  9. package/dist/auth/src/migrate.d.ts +0 -3
  10. package/dist/auth/src/migrate.d.ts.map +0 -1
  11. package/dist/auth/src/plugin.d.ts +0 -28
  12. package/dist/auth/src/plugin.d.ts.map +0 -1
  13. package/dist/auth/src/where.d.ts +0 -7
  14. package/dist/auth/src/where.d.ts.map +0 -1
  15. package/dist/core/src/adapter/mysql.d.ts +0 -21
  16. package/dist/core/src/adapter/mysql.d.ts.map +0 -1
  17. package/dist/core/src/adapter/postgres.d.ts +0 -16
  18. package/dist/core/src/adapter/postgres.d.ts.map +0 -1
  19. package/dist/core/src/adapter/resolve.d.ts +0 -16
  20. package/dist/core/src/adapter/resolve.d.ts.map +0 -1
  21. package/dist/core/src/adapter/sqlite.d.ts +0 -17
  22. package/dist/core/src/adapter/sqlite.d.ts.map +0 -1
  23. package/dist/core/src/adapter/types.d.ts +0 -29
  24. package/dist/core/src/adapter/types.d.ts.map +0 -1
  25. package/dist/core/src/app/audit-wiring.d.ts +0 -6
  26. package/dist/core/src/app/audit-wiring.d.ts.map +0 -1
  27. package/dist/core/src/app/body-size-limit.d.ts +0 -29
  28. package/dist/core/src/app/body-size-limit.d.ts.map +0 -1
  29. package/dist/core/src/app/compression.d.ts +0 -25
  30. package/dist/core/src/app/compression.d.ts.map +0 -1
  31. package/dist/core/src/app/cookies.d.ts +0 -17
  32. package/dist/core/src/app/cookies.d.ts.map +0 -1
  33. package/dist/core/src/app/cors.d.ts +0 -65
  34. package/dist/core/src/app/cors.d.ts.map +0 -1
  35. package/dist/core/src/app/csrf.d.ts +0 -52
  36. package/dist/core/src/app/csrf.d.ts.map +0 -1
  37. package/dist/core/src/app/health.d.ts +0 -36
  38. package/dist/core/src/app/health.d.ts.map +0 -1
  39. package/dist/core/src/app/index.d.ts +0 -282
  40. package/dist/core/src/app/index.d.ts.map +0 -1
  41. package/dist/core/src/app/logger.d.ts +0 -4
  42. package/dist/core/src/app/logger.d.ts.map +0 -1
  43. package/dist/core/src/app/middleware.d.ts +0 -20
  44. package/dist/core/src/app/middleware.d.ts.map +0 -1
  45. package/dist/core/src/app/module.d.ts +0 -273
  46. package/dist/core/src/app/module.d.ts.map +0 -1
  47. package/dist/core/src/app/plugin.d.ts +0 -112
  48. package/dist/core/src/app/plugin.d.ts.map +0 -1
  49. package/dist/core/src/app/rate-limit.d.ts +0 -76
  50. package/dist/core/src/app/rate-limit.d.ts.map +0 -1
  51. package/dist/core/src/app/request-id.d.ts +0 -52
  52. package/dist/core/src/app/request-id.d.ts.map +0 -1
  53. package/dist/core/src/app/router.d.ts +0 -6
  54. package/dist/core/src/app/router.d.ts.map +0 -1
  55. package/dist/core/src/app/scalar.d.ts +0 -40
  56. package/dist/core/src/app/scalar.d.ts.map +0 -1
  57. package/dist/core/src/app/secure-headers.d.ts +0 -48
  58. package/dist/core/src/app/secure-headers.d.ts.map +0 -1
  59. package/dist/core/src/app/system-ctx.d.ts +0 -3
  60. package/dist/core/src/app/system-ctx.d.ts.map +0 -1
  61. package/dist/core/src/app/types.d.ts +0 -277
  62. package/dist/core/src/app/types.d.ts.map +0 -1
  63. package/dist/core/src/cli/config/types.d.ts +0 -31
  64. package/dist/core/src/cli/config/types.d.ts.map +0 -1
  65. package/dist/core/src/cli/index.d.ts +0 -3
  66. package/dist/core/src/cli/index.d.ts.map +0 -1
  67. package/dist/core/src/client/error.d.ts +0 -8
  68. package/dist/core/src/client/error.d.ts.map +0 -1
  69. package/dist/core/src/client/index.d.ts +0 -33
  70. package/dist/core/src/client/index.d.ts.map +0 -1
  71. package/dist/core/src/client/proxy.d.ts +0 -88
  72. package/dist/core/src/client/proxy.d.ts.map +0 -1
  73. package/dist/core/src/client/test-client.d.ts +0 -30
  74. package/dist/core/src/client/test-client.d.ts.map +0 -1
  75. package/dist/core/src/cron/index.d.ts +0 -73
  76. package/dist/core/src/cron/index.d.ts.map +0 -1
  77. package/dist/core/src/db/index.d.ts +0 -281
  78. package/dist/core/src/db/index.d.ts.map +0 -1
  79. package/dist/core/src/db/migrations/diff.d.ts +0 -5
  80. package/dist/core/src/db/migrations/diff.d.ts.map +0 -1
  81. package/dist/core/src/db/migrations/generator.d.ts +0 -26
  82. package/dist/core/src/db/migrations/generator.d.ts.map +0 -1
  83. package/dist/core/src/db/migrations/index.d.ts +0 -9
  84. package/dist/core/src/db/migrations/index.d.ts.map +0 -1
  85. package/dist/core/src/db/migrations/introspect.d.ts +0 -8
  86. package/dist/core/src/db/migrations/introspect.d.ts.map +0 -1
  87. package/dist/core/src/db/migrations/migrator.d.ts +0 -10
  88. package/dist/core/src/db/migrations/migrator.d.ts.map +0 -1
  89. package/dist/core/src/db/migrations/runner.d.ts +0 -7
  90. package/dist/core/src/db/migrations/runner.d.ts.map +0 -1
  91. package/dist/core/src/db/migrations/tracker.d.ts +0 -7
  92. package/dist/core/src/db/migrations/tracker.d.ts.map +0 -1
  93. package/dist/core/src/db/migrations/types.d.ts +0 -70
  94. package/dist/core/src/db/migrations/types.d.ts.map +0 -1
  95. package/dist/core/src/db/sql.d.ts +0 -148
  96. package/dist/core/src/db/sql.d.ts.map +0 -1
  97. package/dist/core/src/errors/index.d.ts +0 -30
  98. package/dist/core/src/errors/index.d.ts.map +0 -1
  99. package/dist/core/src/events/handler.d.ts +0 -42
  100. package/dist/core/src/events/handler.d.ts.map +0 -1
  101. package/dist/core/src/events/index.d.ts +0 -48
  102. package/dist/core/src/events/index.d.ts.map +0 -1
  103. package/dist/core/src/hooks/executor.d.ts +0 -20
  104. package/dist/core/src/hooks/executor.d.ts.map +0 -1
  105. package/dist/core/src/hooks/types.d.ts +0 -10
  106. package/dist/core/src/hooks/types.d.ts.map +0 -1
  107. package/dist/core/src/index.d.ts +0 -83
  108. package/dist/core/src/index.d.ts.map +0 -1
  109. package/dist/core/src/model/index.d.ts +0 -24
  110. package/dist/core/src/model/index.d.ts.map +0 -1
  111. package/dist/core/src/openapi/generator.d.ts +0 -58
  112. package/dist/core/src/openapi/generator.d.ts.map +0 -1
  113. package/dist/core/src/openapi/zod-to-schema.d.ts +0 -4
  114. package/dist/core/src/openapi/zod-to-schema.d.ts.map +0 -1
  115. package/dist/core/src/resource/errors.d.ts +0 -2
  116. package/dist/core/src/resource/errors.d.ts.map +0 -1
  117. package/dist/core/src/resource/index.d.ts +0 -98
  118. package/dist/core/src/resource/index.d.ts.map +0 -1
  119. package/dist/core/src/resource/zod-table.d.ts +0 -6
  120. package/dist/core/src/resource/zod-table.d.ts.map +0 -1
  121. package/dist/core/src/schema/audit.d.ts +0 -25
  122. package/dist/core/src/schema/audit.d.ts.map +0 -1
  123. package/dist/core/src/schema/column.d.ts +0 -31
  124. package/dist/core/src/schema/column.d.ts.map +0 -1
  125. package/dist/core/src/schema/table.d.ts +0 -68
  126. package/dist/core/src/schema/table.d.ts.map +0 -1
  127. package/dist/core/src/service/index.d.ts +0 -27
  128. package/dist/core/src/service/index.d.ts.map +0 -1
@@ -0,0 +1,69 @@
1
+ import * as better_auth from 'better-auth';
2
+ import { betterAuth, Where } from 'better-auth';
3
+ import { VelnAdapter, Plugin, BaseCtx, AuthAdapter, BindingValue } from 'oakbun';
4
+ import * as better_auth_adapters from 'better-auth/adapters';
5
+
6
+ interface BetterAuthPluginOptions {
7
+ secret: string;
8
+ baseUrl?: string;
9
+ trustedOrigins?: string[];
10
+ }
11
+ type BetterAuthInstance = ReturnType<typeof betterAuth>;
12
+ type BetterAuthUser = BetterAuthInstance['$Infer']['Session']['user'];
13
+ type BetterAuthSession = BetterAuthInstance['$Infer']['Session']['session'];
14
+ interface AuthCtxAdd {
15
+ betterUser: BetterAuthUser | null;
16
+ session: BetterAuthSession | null;
17
+ auth: BetterAuthInstance;
18
+ }
19
+ declare function betterAuthPlugin(options: BetterAuthPluginOptions, velnAdapter: VelnAdapter): Plugin<BaseCtx, AuthCtxAdd>;
20
+ /**
21
+ * Create an onRequest hook that intercepts requests to the auth base path
22
+ * and delegates them to better-auth's handler.
23
+ *
24
+ * Usage:
25
+ * ```ts
26
+ * const auth = betterAuth({ ... })
27
+ * app.onRequest(createOnRequest(createAuthRequestHook(auth)))
28
+ * ```
29
+ */
30
+ declare function createAuthRequestHook(auth: BetterAuthInstance, basePath?: string): (ctx: BaseCtx) => Promise<Response | void>;
31
+
32
+ /**
33
+ * betterAuthAdapter — wraps a Better Auth instance as an OakBun AuthAdapter.
34
+ *
35
+ * Usage:
36
+ * import { betterAuth } from 'better-auth'
37
+ * import { betterAuthAdapter } from '@oakbun/auth'
38
+ *
39
+ * const auth = betterAuth({ ... })
40
+ *
41
+ * createApp({
42
+ * auth: betterAuthAdapter(auth),
43
+ * })
44
+ *
45
+ * Permissions:
46
+ * Better Auth does not ship a built-in permissions array on the session user.
47
+ * This adapter maps `user.role` (if present) to a single permission string
48
+ * using the pattern "role:<value>" — e.g. role "admin" → ["role:admin"].
49
+ *
50
+ * For fine-grained permissions, extend the Better Auth session schema with a
51
+ * `permissions` field and this adapter will pick it up automatically.
52
+ *
53
+ * Priority:
54
+ * 1. user.permissions (string[]) — if Better Auth session has this field
55
+ * 2. user.role (string) — mapped to ["role:<value>"]
56
+ * 3. [] — no permissions
57
+ */
58
+ declare function betterAuthAdapter(auth: BetterAuthInstance): AuthAdapter;
59
+
60
+ declare function createVelnDbAdapter(velnAdapter: VelnAdapter): better_auth_adapters.AdapterFactory<better_auth.BetterAuthOptions>;
61
+
62
+ declare function createAuthTables(adapter: VelnAdapter): Promise<void>;
63
+
64
+ declare function convertWhere(where: Where[]): {
65
+ sql: string;
66
+ params: BindingValue[];
67
+ };
68
+
69
+ export { type AuthCtxAdd, type BetterAuthInstance, type BetterAuthPluginOptions, type BetterAuthSession, type BetterAuthUser, betterAuthAdapter, betterAuthPlugin, convertWhere, createAuthRequestHook, createAuthTables, createVelnDbAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oakbun/auth",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Better Auth integration plugin for the OakBun framework.",
5
5
  "author": "René (SchildW3rk)",
6
6
  "license": "MIT",
@@ -35,16 +35,16 @@
35
35
  "LICENSE"
36
36
  ],
37
37
  "scripts": {
38
- "build": "tsup && tsc -p tsconfig.build.json",
38
+ "build": "tsup",
39
39
  "build:watch": "tsup --watch",
40
- "typecheck": "tsc --noEmit",
41
- "prepublishOnly": "bun run build && bun run typecheck"
40
+ "typecheck": "bunx tsc --noEmit",
41
+ "prepublishOnly": "bun run build && bunx tsc --noEmit"
42
42
  },
43
43
  "dependencies": {
44
44
  "better-auth": "^1.5.5"
45
45
  },
46
46
  "peerDependencies": {
47
- "oakbun": ">=0.1.0"
47
+ "oakbun": ">=0.1.1"
48
48
  },
49
49
  "devDependencies": {
50
50
  "oakbun": "workspace:*"
@@ -1,3 +0,0 @@
1
- import type { VelnAdapter } from 'oakbun';
2
- export declare function createVelnDbAdapter(velnAdapter: VelnAdapter): import("better-auth/adapters").AdapterFactory<import("better-auth").BetterAuthOptions>;
3
- //# sourceMappingURL=adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/adapter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,QAAQ,CAAA;AAcvD,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,WAAW,0FAwL3D"}
@@ -1,30 +0,0 @@
1
- import type { AuthAdapter } from 'oakbun';
2
- import type { BetterAuthInstance } from './plugin.js';
3
- /**
4
- * betterAuthAdapter — wraps a Better Auth instance as an OakBun AuthAdapter.
5
- *
6
- * Usage:
7
- * import { betterAuth } from 'better-auth'
8
- * import { betterAuthAdapter } from '@oakbun/auth'
9
- *
10
- * const auth = betterAuth({ ... })
11
- *
12
- * createApp({
13
- * auth: betterAuthAdapter(auth),
14
- * })
15
- *
16
- * Permissions:
17
- * Better Auth does not ship a built-in permissions array on the session user.
18
- * This adapter maps `user.role` (if present) to a single permission string
19
- * using the pattern "role:<value>" — e.g. role "admin" → ["role:admin"].
20
- *
21
- * For fine-grained permissions, extend the Better Auth session schema with a
22
- * `permissions` field and this adapter will pick it up automatically.
23
- *
24
- * Priority:
25
- * 1. user.permissions (string[]) — if Better Auth session has this field
26
- * 2. user.role (string) — mapped to ["role:<value>"]
27
- * 3. [] — no permissions
28
- */
29
- export declare function betterAuthAdapter(auth: BetterAuthInstance): AuthAdapter;
30
- //# sourceMappingURL=auth-adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-adapter.d.ts","sourceRoot":"","sources":["../../../src/auth-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAqB,MAAM,QAAQ,CAAA;AAC5D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,WAAW,CA+BvE"}
@@ -1,7 +0,0 @@
1
- export { betterAuthPlugin, createAuthRequestHook } from './plugin.js';
2
- export { betterAuthAdapter } from './auth-adapter.js';
3
- export { createVelnDbAdapter } from './adapter.js';
4
- export { createAuthTables } from './migrate.js';
5
- export { convertWhere } from './where.js';
6
- export type { BetterAuthPluginOptions, AuthCtxAdd, BetterAuthInstance, BetterAuthUser, BetterAuthSession } from './plugin.js';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,YAAY,EAAE,uBAAuB,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { VelnAdapter } from 'oakbun';
2
- export declare function createAuthTables(adapter: VelnAdapter): Promise<void>;
3
- //# sourceMappingURL=migrate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../../src/migrate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAEzC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAsD1E"}
@@ -1,28 +0,0 @@
1
- import { betterAuth } from 'better-auth';
2
- import type { VelnAdapter, BaseCtx, Plugin } from 'oakbun';
3
- export interface BetterAuthPluginOptions {
4
- secret: string;
5
- baseUrl?: string;
6
- trustedOrigins?: string[];
7
- }
8
- export type BetterAuthInstance = ReturnType<typeof betterAuth>;
9
- export type BetterAuthUser = BetterAuthInstance['$Infer']['Session']['user'];
10
- export type BetterAuthSession = BetterAuthInstance['$Infer']['Session']['session'];
11
- export interface AuthCtxAdd {
12
- betterUser: BetterAuthUser | null;
13
- session: BetterAuthSession | null;
14
- auth: BetterAuthInstance;
15
- }
16
- export declare function betterAuthPlugin(options: BetterAuthPluginOptions, velnAdapter: VelnAdapter): Plugin<BaseCtx, AuthCtxAdd>;
17
- /**
18
- * Create an onRequest hook that intercepts requests to the auth base path
19
- * and delegates them to better-auth's handler.
20
- *
21
- * Usage:
22
- * ```ts
23
- * const auth = betterAuth({ ... })
24
- * app.onRequest(createOnRequest(createAuthRequestHook(auth)))
25
- * ```
26
- */
27
- export declare function createAuthRequestHook(auth: BetterAuthInstance, basePath?: string): (ctx: BaseCtx) => Promise<Response | void>;
28
- //# sourceMappingURL=plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG1D,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAA;AAE9D,MAAM,MAAM,cAAc,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAA;AAC5E,MAAM,MAAM,iBAAiB,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAA;AAElF,MAAM,WAAW,UAAU;IAGzB,UAAU,EAAE,cAAc,GAAG,IAAI,CAAA;IACjC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAAA;IACjC,IAAI,EAAE,kBAAkB,CAAA;CACzB;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,uBAAuB,EAChC,WAAW,EAAE,WAAW,GACvB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,CA+B7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,kBAAkB,EACxB,QAAQ,SAAc,IAER,KAAK,OAAO,KAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAMtD"}
@@ -1,7 +0,0 @@
1
- import type { BindingValue } from 'oakbun';
2
- import type { Where } from 'better-auth';
3
- export declare function convertWhere(where: Where[]): {
4
- sql: string;
5
- params: BindingValue[];
6
- };
7
- //# sourceMappingURL=where.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"where.d.ts","sourceRoot":"","sources":["../../../src/where.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAExC,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,EAAE,CAAA;CAAE,CA4EpF"}
@@ -1,21 +0,0 @@
1
- import type { VelnAdapter, BindingValue, ExecuteResult, QueryLogEntry } from './types';
2
- export interface MySQLConfig {
3
- url?: string;
4
- hostname?: string;
5
- port?: number;
6
- database?: string;
7
- username?: string;
8
- password?: string;
9
- max?: number;
10
- idleTimeout?: number;
11
- }
12
- export declare class MySQLAdapter implements VelnAdapter {
13
- private readonly sql;
14
- onQuery?: (entry: QueryLogEntry) => void;
15
- constructor(config: MySQLConfig);
16
- query<T>(sql: string, params?: BindingValue[]): Promise<T[]>;
17
- execute(sql: string, params?: BindingValue[]): Promise<ExecuteResult>;
18
- transaction<T>(fn: (tx: VelnAdapter) => Promise<T>): Promise<T>;
19
- close(): Promise<void>;
20
- }
21
- //# sourceMappingURL=mysql.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mysql.d.ts","sourceRoot":"","sources":["../../../../../core/src/adapter/mysql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtF,MAAM,WAAW,WAAW;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,YAAa,YAAW,WAAW;IAI9C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAK;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;gBAE5B,MAAM,EAAE,WAAW;IAiBzB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,YAAY,EAAO,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAQhE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,YAAY,EAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAQzE,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAgB/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -1,16 +0,0 @@
1
- import type { VelnAdapter, BindingValue, ExecuteResult, QueryLogEntry } from './types';
2
- export interface PostgresConfig {
3
- url: string;
4
- max?: number;
5
- idleTimeout?: number;
6
- }
7
- export declare class PostgresAdapter implements VelnAdapter {
8
- private readonly sql;
9
- onQuery?: (entry: QueryLogEntry) => void;
10
- constructor(config: PostgresConfig);
11
- query<T>(sql: string, params?: BindingValue[]): Promise<T[]>;
12
- execute(sql: string, params?: BindingValue[]): Promise<ExecuteResult>;
13
- transaction<T>(fn: (tx: VelnAdapter) => Promise<T>): Promise<T>;
14
- close(): Promise<void>;
15
- }
16
- //# sourceMappingURL=postgres.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../../../../../core/src/adapter/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtF,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,qBAAa,eAAgB,YAAW,WAAW;IAIjD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAK;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;gBAE5B,MAAM,EAAE,cAAc;IAe5B,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,YAAY,EAAO,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAQhE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,YAAY,EAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IASzE,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAgB/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -1,16 +0,0 @@
1
- import type { VelnAdapter } from './types';
2
- export type AdapterConfig = {
3
- adapter: 'sqlite';
4
- path?: string;
5
- } | {
6
- adapter: 'postgres';
7
- connectionString: string;
8
- maxConnections?: number;
9
- } | {
10
- adapter: 'mysql';
11
- connectionString: string;
12
- maxConnections?: number;
13
- };
14
- export declare function isVelnAdapter(value: unknown): value is VelnAdapter;
15
- export declare function resolveAdapter(config: AdapterConfig | VelnAdapter): VelnAdapter;
16
- //# sourceMappingURL=resolve.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../../../core/src/adapter/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,MAAM,MAAM,aAAa,GACrB;IAAE,OAAO,EAAE,QAAQ,CAAC;IAAG,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1E;IAAE,OAAO,EAAE,OAAO,CAAC;IAAI,gBAAgB,EAAE,MAAM,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE9E,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAOlE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,WAAW,CAwB/E"}
@@ -1,17 +0,0 @@
1
- import type { VelnAdapter, BindingValue, ExecuteResult, QueryLogEntry } from './types';
2
- export interface SQLiteConfig {
3
- path?: string;
4
- wal?: boolean;
5
- }
6
- export declare class SQLiteAdapter implements VelnAdapter {
7
- private readonly db;
8
- private readonly _stmtCache;
9
- onQuery?: (entry: QueryLogEntry) => void;
10
- constructor(config?: SQLiteConfig | string);
11
- private _prepare;
12
- query<T>(sql: string, params?: BindingValue[]): Promise<T[]>;
13
- execute(sql: string, params?: BindingValue[]): Promise<ExecuteResult>;
14
- transaction<T>(fn: (tx: VelnAdapter) => Promise<T>): Promise<T>;
15
- close(): Promise<void>;
16
- }
17
- //# sourceMappingURL=sqlite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../../../../core/src/adapter/sqlite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAEtF,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,OAAO,CAAA;CACd;AAMD,qBAAa,aAAc,YAAW,WAAW;IAC/C,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAU;IAI7B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqD;IAChF,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;gBAE5B,MAAM,GAAE,YAAY,GAAG,MAAW;IAS9C,OAAO,CAAC,QAAQ;IAkBV,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,YAAY,EAAO,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAQhE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,YAAY,EAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAezE,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAc/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
@@ -1,29 +0,0 @@
1
- export type BindingValue = string | number | bigint | boolean | null | Uint8Array;
2
- export interface ExecuteResult {
3
- rowsAffected: number;
4
- lastInsertId?: number | bigint;
5
- }
6
- /** Emitted by the adapter after every query() or execute() call. */
7
- export interface QueryLogEntry {
8
- /** The SQL string that was executed. */
9
- sql: string;
10
- /** The bound parameter values. */
11
- params: BindingValue[];
12
- /** Wall-clock duration in milliseconds (performance.now() resolution). */
13
- durationMs: number;
14
- /** Whether the call was query() (returns rows) or execute() (DML/DDL). */
15
- type: 'query' | 'execute';
16
- }
17
- export interface VelnAdapter {
18
- query<T = Record<string, unknown>>(sql: string, params?: BindingValue[]): Promise<T[]>;
19
- execute(sql: string, params?: BindingValue[]): Promise<ExecuteResult>;
20
- transaction<T>(fn: (tx: VelnAdapter) => Promise<T>): Promise<T>;
21
- close(): Promise<void>;
22
- /**
23
- * Optional query observer. When set, the adapter calls this after every
24
- * query() and execute() with timing and SQL details.
25
- * Set by dbPlugin when query logging is enabled — do not call directly.
26
- */
27
- onQuery?: (entry: QueryLogEntry) => void;
28
- }
29
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../core/src/adapter/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GACpB,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,UAAU,CAAA;AAEd,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAA;IAGpB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC/B;AAED,oEAAoE;AACpE,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,GAAG,EAAS,MAAM,CAAA;IAClB,kCAAkC;IAClC,MAAM,EAAM,YAAY,EAAE,CAAA;IAC1B,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAA;IAClB,0EAA0E;IAC1E,IAAI,EAAQ,OAAO,GAAG,SAAS,CAAA;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAAA;IACtF,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;IACrE,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAA;CACzC"}
@@ -1,6 +0,0 @@
1
- import type { VelnAdapter } from '../adapter/types';
2
- import type { SchemaMap } from '../schema/table';
3
- import type { ModuleHookHandlers } from '../hooks/types';
4
- import type { AuditDeclaration } from './module';
5
- export declare function buildAuditHooks<T extends Record<string, unknown>, TCtx, S extends SchemaMap>(decl: AuditDeclaration<T, TCtx, S>, adapter: VelnAdapter): ModuleHookHandlers<T, unknown>;
6
- //# sourceMappingURL=audit-wiring.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit-wiring.d.ts","sourceRoot":"","sources":["../../../../../core/src/app/audit-wiring.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAkBhD,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC,SAAS,SAAS,EAC1F,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAClC,OAAO,EAAE,WAAW,GACnB,kBAAkB,CAAC,CAAC,EAAE,OAAO,CAAC,CAoEhC"}
@@ -1,29 +0,0 @@
1
- import type { OnRequestHook } from './types';
2
- export interface BodySizeLimitOptions {
3
- /**
4
- * Maximum allowed body size in bytes.
5
- * Default: 1_048_576 (1 MB)
6
- */
7
- maxSize?: number;
8
- /** Response message when limit is exceeded. Default: 'Payload too large' */
9
- message?: string;
10
- }
11
- /**
12
- * bodySizeLimitPlugin — rejects requests whose Content-Length exceeds maxSize.
13
- *
14
- * Returns an OnRequestHook — pass it to app.onRequest():
15
- * app.onRequest(bodySizeLimitPlugin()) // 1MB default
16
- * app.onRequest(bodySizeLimitPlugin({ maxSize: 512_000 })) // 512KB
17
- *
18
- * Checks the Content-Length header only — does not buffer or read the body.
19
- * Requests without Content-Length are passed through (streaming / chunked).
20
- * Returns 413 Payload Too Large on violation.
21
- *
22
- * @remarks
23
- * This plugin enforces limits based on the Content-Length header only.
24
- * Chunked transfer-encoding bypasses this check entirely.
25
- * For production deployments, configure body size limits at the reverse proxy level:
26
- * nginx: `client_max_body_size`, Caddy: `request_body { max_size }`.
27
- */
28
- export declare function bodySizeLimitPlugin(options?: BodySizeLimitOptions): OnRequestHook;
29
- //# sourceMappingURL=body-size-limit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"body-size-limit.d.ts","sourceRoot":"","sources":["../../../../../core/src/app/body-size-limit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAqBrF"}
@@ -1,25 +0,0 @@
1
- import type { OnResponseHook } from './types';
2
- export interface CompressionOptions {
3
- /**
4
- * Compression algorithms to offer, in preference order.
5
- * Default: `['gzip', 'deflate']`
6
- *
7
- * Bun 1.x provides `Bun.gzipSync` and `Bun.deflateSync` natively.
8
- */
9
- encodings?: Array<'gzip' | 'deflate'>;
10
- /**
11
- * Minimum response body size in bytes before compression is applied.
12
- * Responses smaller than this are sent uncompressed.
13
- * Default: `1024` (1 KB)
14
- */
15
- threshold?: number;
16
- /**
17
- * Maximum response body size in bytes to attempt compression.
18
- * Responses larger than this are passed through uncompressed to avoid
19
- * excessive memory usage when buffering very large responses.
20
- * Default: `10485760` (10 MB)
21
- */
22
- maxSize?: number;
23
- }
24
- export declare function compressionPlugin(options?: CompressionOptions): OnResponseHook;
25
- //# sourceMappingURL=compression.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../../../../../core/src/app/compression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAErC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAmDD,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,GAAG,cAAc,CA4ClF"}
@@ -1,17 +0,0 @@
1
- export interface CookieOptions {
2
- httpOnly?: boolean;
3
- secure?: boolean;
4
- sameSite?: 'Strict' | 'Lax' | 'None';
5
- maxAge?: number;
6
- path?: string;
7
- domain?: string;
8
- }
9
- export interface CookieJar {
10
- get(name: string): string | undefined;
11
- set(name: string, value: string, options?: CookieOptions): void;
12
- delete(name: string): void;
13
- /** Framework-internal: returns all pending Set-Cookie header values */
14
- _pending(): string[];
15
- }
16
- export declare function createCookieJar(req: Request): CookieJar;
17
- //# sourceMappingURL=cookies.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../../../core/src/app/cookies.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAI,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,MAAM,CAAA;IACpC,MAAM,CAAC,EAAI,MAAM,CAAA;IACjB,IAAI,CAAC,EAAM,MAAM,CAAA;IACjB,MAAM,CAAC,EAAI,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;IACrC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAA;IAC/D,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,uEAAuE;IACvE,QAAQ,IAAI,MAAM,EAAE,CAAA;CACrB;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,CAqDvD"}
@@ -1,65 +0,0 @@
1
- import type { OnRequestHook, OnResponseHook } from './types';
2
- export interface CorsOptions {
3
- /**
4
- * Allowed origins. Can be:
5
- * - `'*'` → any origin (not usable with credentials)
6
- * - `string` → single allowed origin
7
- * - `string[]` → list of allowed origins (matched against request Origin header)
8
- * - `(origin: string) => boolean` → custom predicate
9
- *
10
- * Default: `'*'`
11
- */
12
- origin?: '*' | string | string[] | ((origin: string) => boolean);
13
- /**
14
- * HTTP methods allowed in CORS requests.
15
- * Default: `['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']`
16
- */
17
- methods?: string[];
18
- /**
19
- * Request headers the client is allowed to send.
20
- * Default: `['Content-Type', 'Authorization', 'x-csrf-token']`
21
- */
22
- allowHeaders?: string[];
23
- /**
24
- * Response headers that the browser may expose to the client-side script.
25
- * Default: `[]` (none exposed beyond the CORS-safelisted headers)
26
- */
27
- exposeHeaders?: string[];
28
- /**
29
- * Whether cross-origin requests may include credentials (cookies, auth headers).
30
- * When true, `origin` must not be `'*'`.
31
- * Default: `false`
32
- */
33
- credentials?: boolean;
34
- /**
35
- * How long (in seconds) the preflight result may be cached.
36
- * Default: `86400` (24h)
37
- */
38
- maxAge?: number;
39
- }
40
- export interface CorsPlugin {
41
- /**
42
- * Register on `app.onRequest()`.
43
- * Handles OPTIONS preflight requests — returns a 204 with CORS headers directly,
44
- * short-circuiting the pipeline (no route handler runs for OPTIONS).
45
- */
46
- onRequest: OnRequestHook;
47
- /**
48
- * Register on `app.onResponse()`.
49
- * Appends CORS headers to every response.
50
- */
51
- onResponse: OnResponseHook;
52
- }
53
- /**
54
- * corsPlugin — adds CORS headers to responses and handles preflight OPTIONS requests.
55
- *
56
- * Usage:
57
- * const cors = corsPlugin({ origin: 'https://app.example.com', credentials: true })
58
- * app.onRequest(cors.onRequest)
59
- * app.onResponse(cors.onResponse)
60
- *
61
- * Preflight (OPTIONS) requests are short-circuited with a 204 — no route handler
62
- * runs. All other requests receive CORS headers in onResponse.
63
- */
64
- export declare function corsPlugin(options?: CorsOptions): CorsPlugin;
65
- //# sourceMappingURL=cors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../../../../../core/src/app/cors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK5D,MAAM,WAAW,WAAW;IAC1B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,GAAG,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,CAAA;IAEhE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAElB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IAEvB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IAExB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAID,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,SAAS,EAAE,aAAa,CAAA;IACxB;;;OAGG;IACH,UAAU,EAAE,cAAc,CAAA;CAC3B;AAyBD;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,UAAU,CAsEhE"}
@@ -1,52 +0,0 @@
1
- import type { OnRequestHook, OnResponseHook } from './types';
2
- /**
3
- * Constant-time string comparison to prevent timing attacks.
4
- * Returns false immediately on length mismatch (length is not secret).
5
- * XORs all character codes and accumulates into a single result so the
6
- * comparison time is proportional to the string length, not the first mismatch.
7
- */
8
- export declare function timingSafeEqual(a: string, b: string): boolean;
9
- export interface CsrfOptions {
10
- /** Cookie name that holds the CSRF token. Default: 'csrf_token' */
11
- cookieName?: string;
12
- /** Request header that must carry the token on state-changing requests. Default: 'x-csrf-token' */
13
- headerName?: string;
14
- /** Cookie Max-Age in seconds. Default: 86400 (24h) */
15
- maxAge?: number;
16
- /** Restrict cookie to HTTPS. Default: true (set false for local development) */
17
- secure?: boolean;
18
- }
19
- export interface CsrfPlugin {
20
- /**
21
- * Register on app.onRequest() or module.onRequest().
22
- * Validates the CSRF token on state-changing methods (POST/PUT/PATCH/DELETE).
23
- * Returns a 403 response on mismatch — short-circuits the request lifecycle.
24
- */
25
- onRequest: OnRequestHook;
26
- /**
27
- * Register on app.onResponse() or module.onResponse().
28
- * Sets a new CSRF token cookie on responses to safe methods (GET/HEAD/OPTIONS)
29
- * when no valid token cookie exists yet.
30
- */
31
- onResponse: OnResponseHook;
32
- }
33
- /**
34
- * csrfPlugin — Double-Submit Cookie pattern. Stateless, no store required.
35
- *
36
- * Usage:
37
- * const csrf = csrfPlugin()
38
- * app.onRequest(csrf.onRequest)
39
- * app.onResponse(csrf.onResponse)
40
- *
41
- * How it works:
42
- * 1. On GET/HEAD/OPTIONS — onResponse sets a readable cookie (httpOnly: false)
43
- * so the client-side JS can read the token.
44
- * 2. On POST/PUT/PATCH/DELETE — onRequest reads the cookie value and compares
45
- * it to the x-csrf-token request header. Mismatch or missing → 403.
46
- *
47
- * The Double-Submit Cookie pattern is stateless: the server never stores tokens.
48
- * Security relies on the same-origin policy: a cross-origin attacker can read
49
- * neither the cookie nor the custom header value.
50
- */
51
- export declare function csrfPlugin(options?: CsrfOptions): CsrfPlugin;
52
- //# sourceMappingURL=csrf.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"csrf.d.ts","sourceRoot":"","sources":["../../../../../core/src/app/csrf.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAUrE;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAO7D;AAaD,MAAM,WAAW,WAAW;IAC1B,mEAAmE;IACnE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,mGAAmG;IACnG,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAID,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,SAAS,EAAE,aAAa,CAAA;IACxB;;;;OAIG;IACH,UAAU,EAAE,cAAc,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,UAAU,CAiDhE"}
@@ -1,36 +0,0 @@
1
- import type { OnRequestHook } from './types';
2
- export interface HealthCheck {
3
- (): Promise<{
4
- ok: boolean;
5
- details?: Record<string, unknown>;
6
- }>;
7
- }
8
- export interface HealthPluginOptions {
9
- /** Path for the liveness endpoint. Default: '/health' */
10
- path?: string;
11
- /** Path for the readiness endpoint. Default: '/ready' */
12
- readyPath?: string;
13
- /** Named checks to run for the readiness endpoint. */
14
- checks?: Record<string, HealthCheck>;
15
- }
16
- /**
17
- * healthPlugin — adds /health and /ready endpoints for Kubernetes/load balancers.
18
- *
19
- * Usage:
20
- * const health = healthPlugin({ checks: { db: async () => ({ ok: true }) } })
21
- * app.onRequest(health.onRequest)
22
- *
23
- * GET /health → 200 { status: 'ok', uptime: number }
24
- * Always returns 200. Use for liveness probes (is the process alive?).
25
- *
26
- * GET /ready → 200 { status: 'ready', checks: { db: { ok: true } } }
27
- * → 503 { status: 'not_ready', checks: { db: { ok: false, error: '...' } } }
28
- * Runs all checks. Use for readiness probes (is the service ready to serve traffic?).
29
- *
30
- * The health endpoints are intercepted in the onRequest phase — before auth plugins run.
31
- */
32
- export interface HealthPlugin {
33
- onRequest: OnRequestHook;
34
- }
35
- export declare function healthPlugin(options?: HealthPluginOptions): HealthPlugin;
36
- //# sourceMappingURL=health.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../../../core/src/app/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAK5C,MAAM,WAAW,WAAW;IAC1B,IAAI,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC,CAAA;CAChE;AAED,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;CACrC;AAID;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,aAAa,CAAA;CACzB;AAED,wBAAgB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,YAAY,CA4C5E"}