@kyro-cms/core 0.1.7 → 0.1.8

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 (42) hide show
  1. package/README.md +25 -2
  2. package/dist/{WebhookService-BPVJUgTl.d.ts → WebhookService-CXJ5oz6L.d.ts} +1 -1
  3. package/dist/{WebhookService-BCgL1bLF.d.cts → WebhookService-Dqx9Is7m.d.cts} +1 -1
  4. package/dist/{base-DaP-5PPG.d.ts → base-CciYzoDF.d.ts} +1 -1
  5. package/dist/{base-B0Y6isUJ.d.cts → base-Cfek4fp3.d.cts} +1 -1
  6. package/dist/chunk-EWP5AT6A.cjs +268 -0
  7. package/dist/chunk-EWP5AT6A.cjs.map +1 -0
  8. package/dist/chunk-QKOFKITP.js +258 -0
  9. package/dist/chunk-QKOFKITP.js.map +1 -0
  10. package/dist/client.cjs +45 -0
  11. package/dist/client.cjs.map +1 -0
  12. package/dist/client.d.cts +11 -0
  13. package/dist/client.d.ts +11 -0
  14. package/dist/client.js +4 -0
  15. package/dist/client.js.map +1 -0
  16. package/dist/drizzle/index.d.cts +114 -4
  17. package/dist/drizzle/index.d.ts +114 -4
  18. package/dist/graphql/index.d.cts +2 -2
  19. package/dist/graphql/index.d.ts +2 -2
  20. package/dist/{index-DupWTmW6.d.ts → index-BvZ1iWm2.d.ts} +1 -1
  21. package/dist/{index-BwE4NueJ.d.cts → index-CTLPjpMH.d.cts} +1 -1
  22. package/dist/index.cjs +45 -268
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +15 -230
  25. package/dist/index.d.ts +15 -230
  26. package/dist/index.js +13 -260
  27. package/dist/index.js.map +1 -1
  28. package/dist/mongodb/index.d.cts +2 -2
  29. package/dist/mongodb/index.d.ts +2 -2
  30. package/dist/rate-limit-BvUAVCzw.d.cts +223 -0
  31. package/dist/rate-limit-CJnqG1mG.d.ts +223 -0
  32. package/dist/rest/index.d.cts +3 -3
  33. package/dist/rest/index.d.ts +3 -3
  34. package/dist/templates/index.d.cts +1 -1
  35. package/dist/templates/index.d.ts +1 -1
  36. package/dist/trpc/index.d.cts +2 -2
  37. package/dist/trpc/index.d.ts +2 -2
  38. package/dist/{index-DtBi3zP0.d.ts → types-BSR91JFN.d.cts} +1 -112
  39. package/dist/{index-DUKmDSeC.d.cts → types-BSR91JFN.d.ts} +1 -112
  40. package/dist/{types-BM0s_YOy.d.cts → types-Bt1OEk0S.d.cts} +12 -4
  41. package/dist/{types-BM0s_YOy.d.ts → types-Bt1OEk0S.d.ts} +12 -4
  42. package/package.json +9 -2
@@ -1,5 +1,5 @@
1
- import { A as AbstractBaseAdapter } from '../base-B0Y6isUJ.cjs';
2
- import { a as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs } from '../types-BM0s_YOy.cjs';
1
+ import { A as AbstractBaseAdapter } from '../base-Cfek4fp3.cjs';
2
+ import { x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs } from '../types-Bt1OEk0S.cjs';
3
3
 
4
4
  declare class MongoDBAdapter extends AbstractBaseAdapter {
5
5
  private client;
@@ -1,5 +1,5 @@
1
- import { A as AbstractBaseAdapter } from '../base-DaP-5PPG.js';
2
- import { a as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs } from '../types-BM0s_YOy.js';
1
+ import { A as AbstractBaseAdapter } from '../base-CciYzoDF.js';
2
+ import { x as FindArgs, y as FindResult, z as FindByIDArgs, H as CreateArgs, L as UpdateArgs, O as DeleteArgs } from '../types-Bt1OEk0S.js';
3
3
 
4
4
  declare class MongoDBAdapter extends AbstractBaseAdapter {
5
5
  private client;
@@ -0,0 +1,223 @@
1
+ import { c as AuthAdapter, U as UserRole, f as AuthUser, S as Session } from './types-BSR91JFN.cjs';
2
+ import Redis from 'ioredis';
3
+
4
+ type StylingMode = 'css' | 'tailwind' | 'css-in-js' | 'styled-components' | 'vanilla-extract';
5
+ interface StylingConfig {
6
+ mode: StylingMode;
7
+ theme?: ThemeConfig;
8
+ customProperties?: Record<string, string>;
9
+ }
10
+ interface ThemeConfig {
11
+ colors?: ThemeColors;
12
+ fonts?: ThemeFonts;
13
+ spacing?: ThemeSpacing;
14
+ borderRadius?: ThemeBorderRadius;
15
+ shadows?: ThemeShadows;
16
+ breakpoints?: Record<string, string>;
17
+ }
18
+ interface ThemeColors {
19
+ primary?: string;
20
+ secondary?: string;
21
+ accent?: string;
22
+ background?: string;
23
+ surface?: string;
24
+ text?: string;
25
+ textMuted?: string;
26
+ border?: string;
27
+ error?: string;
28
+ warning?: string;
29
+ success?: string;
30
+ info?: string;
31
+ }
32
+ interface ThemeFonts {
33
+ sans?: string;
34
+ serif?: string;
35
+ mono?: string;
36
+ }
37
+ interface ThemeSpacing {
38
+ xs?: string;
39
+ sm?: string;
40
+ md?: string;
41
+ lg?: string;
42
+ xl?: string;
43
+ '2xl'?: string;
44
+ '3xl'?: string;
45
+ '4xl'?: string;
46
+ }
47
+ interface ThemeBorderRadius {
48
+ sm?: string;
49
+ md?: string;
50
+ lg?: string;
51
+ xl?: string;
52
+ full?: string;
53
+ }
54
+ interface ThemeShadows {
55
+ sm?: string;
56
+ md?: string;
57
+ lg?: string;
58
+ xl?: string;
59
+ }
60
+ declare class CSSGenerator {
61
+ private config;
62
+ private css;
63
+ constructor(config: StylingConfig);
64
+ addRule(selector: string, properties: Record<string, string>): this;
65
+ addMediaQuery(breakpoint: string, rules: string[]): this;
66
+ generate(): string;
67
+ }
68
+ declare function generateTailwindConfig(theme: ThemeConfig): Record<string, any>;
69
+ declare const defaultLightTheme: ThemeConfig;
70
+ declare const defaultDarkTheme: ThemeConfig;
71
+ declare const ecommerce2026Theme: ThemeConfig;
72
+ declare function generateCSSVariables(theme: ThemeConfig): string;
73
+ interface AdminStylingConfig {
74
+ mode: StylingMode;
75
+ theme?: ThemeConfig;
76
+ customStyles?: string;
77
+ componentOverrides?: Record<string, Record<string, string>>;
78
+ }
79
+ declare function createAdminStyling(config: AdminStylingConfig): string;
80
+ interface FieldStyling {
81
+ wrapper?: Record<string, string>;
82
+ label?: Record<string, string>;
83
+ input?: Record<string, string>;
84
+ error?: Record<string, string>;
85
+ description?: Record<string, string>;
86
+ }
87
+ declare const defaultFieldStyling: Record<string, FieldStyling>;
88
+
89
+ interface RedisAuthAdapterOptions {
90
+ url?: string;
91
+ host?: string;
92
+ port?: number;
93
+ password?: string;
94
+ db?: number;
95
+ keyPrefix?: string;
96
+ tokenExpiration?: number;
97
+ refreshTokenExpiration?: number;
98
+ tls?: boolean;
99
+ }
100
+ declare class RedisAuthAdapter implements AuthAdapter {
101
+ private redis;
102
+ private prefix;
103
+ private tokenExpiration;
104
+ private refreshExpiration;
105
+ constructor(options?: RedisAuthAdapterOptions);
106
+ connect(): Promise<void>;
107
+ disconnect(): Promise<void>;
108
+ private userKey;
109
+ private sessionKey;
110
+ private refreshKey;
111
+ private userByEmailKey;
112
+ private passwordHistoryKey;
113
+ createUser(data: {
114
+ email: string;
115
+ password: string;
116
+ role?: UserRole;
117
+ tenantId?: string;
118
+ }): Promise<AuthUser>;
119
+ findUserByEmail(email: string): Promise<AuthUser | null>;
120
+ findUserById(userId: string): Promise<AuthUser | null>;
121
+ updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
122
+ deleteUser(userId: string): Promise<boolean>;
123
+ hashPassword(password: string): Promise<string>;
124
+ verifyPassword(email: string, password: string): Promise<AuthUser | null>;
125
+ createSession(userId: string, data?: {
126
+ ipAddress?: string;
127
+ userAgent?: string;
128
+ }): Promise<Session>;
129
+ findSessionByToken(token: string): Promise<Session | null>;
130
+ deleteSession(sessionId: string): Promise<boolean>;
131
+ deleteUserSessions(userId: string): Promise<number>;
132
+ addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
133
+ getPasswordHistory(userId: string, count?: number): Promise<string[]>;
134
+ isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
135
+ private userToHash;
136
+ private hashToUser;
137
+ private sessionToHash;
138
+ private hashToSession;
139
+ private auditLogKey;
140
+ private auditLogIndexKey;
141
+ findAuditLogs(filter: {
142
+ userId?: string;
143
+ action?: string | string[];
144
+ resource?: string;
145
+ success?: boolean;
146
+ limit?: number;
147
+ offset?: number;
148
+ }): Promise<{
149
+ logs: any[];
150
+ total: number;
151
+ }>;
152
+ createAuditLog(data: any): Promise<any>;
153
+ }
154
+
155
+ interface LockoutConfig {
156
+ maxAttempts: number;
157
+ lockDuration: number;
158
+ notifyUser: boolean;
159
+ notifyAdmin: boolean;
160
+ adminNotifyAfter: number;
161
+ }
162
+ interface LockoutStatus {
163
+ locked: boolean;
164
+ attemptsRemaining: number;
165
+ lockedUntil?: Date;
166
+ totalAttempts: number;
167
+ }
168
+ declare class AccountLockout {
169
+ private redis;
170
+ private prefix;
171
+ private config;
172
+ constructor(redis: Redis, config?: Partial<LockoutConfig>, prefix?: string);
173
+ private lockKey;
174
+ private historyKey;
175
+ checkLockout(userId: string): Promise<LockoutStatus>;
176
+ recordFailedAttempt(userId: string): Promise<LockoutStatus>;
177
+ lockAccount(userId: string, duration?: number): Promise<void>;
178
+ unlockAccount(userId: string): Promise<void>;
179
+ resetAttempts(userId: string): Promise<void>;
180
+ getLockoutHistory(userId: string, limit?: number): Promise<Date[]>;
181
+ getLockoutStats(userId: string): Promise<{
182
+ totalFailedAttempts: number;
183
+ lockoutCount: number;
184
+ lastLockout: Date | null;
185
+ averageAttemptsBeforeLockout: number;
186
+ }>;
187
+ shouldNotifyAdmin(currentAttempts: number): boolean;
188
+ getConfig(): LockoutConfig;
189
+ setConfig(config: Partial<LockoutConfig>): void;
190
+ }
191
+
192
+ interface RateLimitConfig {
193
+ window: number;
194
+ max: number;
195
+ }
196
+ interface RateLimitResult {
197
+ allowed: boolean;
198
+ remaining: number;
199
+ resetAt: number;
200
+ retryAfter?: number;
201
+ }
202
+ declare class RateLimiter {
203
+ private redis;
204
+ private prefix;
205
+ private limits;
206
+ private userLimits;
207
+ constructor(redis: Redis, limits?: Record<string, RateLimitConfig>, userLimits?: Record<string, RateLimitConfig>, prefix?: string);
208
+ private getKey;
209
+ check(type: string, identifier: string): Promise<RateLimitResult>;
210
+ checkUser(type: string, userId: string, identifier: string): Promise<RateLimitResult>;
211
+ reset(type: string, identifier: string): Promise<void>;
212
+ resetUser(type: string, userId: string, identifier: string): Promise<void>;
213
+ getStatus(type: string, identifier: string): Promise<{
214
+ count: number;
215
+ limit: number;
216
+ remaining: number;
217
+ resetAt: number;
218
+ }>;
219
+ setLimit(type: string, config: RateLimitConfig): void;
220
+ setUserLimit(type: string, config: RateLimitConfig): void;
221
+ }
222
+
223
+ export { type AdminStylingConfig as A, CSSGenerator as C, type FieldStyling as F, type LockoutConfig as L, type RateLimitConfig as R, type StylingConfig as S, type ThemeBorderRadius as T, type LockoutStatus as a, type RateLimitResult as b, type RedisAuthAdapterOptions as c, type StylingMode as d, type ThemeColors as e, type ThemeConfig as f, type ThemeFonts as g, type ThemeShadows as h, type ThemeSpacing as i, createAdminStyling as j, defaultDarkTheme as k, defaultFieldStyling as l, defaultLightTheme as m, ecommerce2026Theme as n, generateCSSVariables as o, generateTailwindConfig as p, AccountLockout as q, RateLimiter as r, RedisAuthAdapter as s };
@@ -0,0 +1,223 @@
1
+ import { c as AuthAdapter, U as UserRole, f as AuthUser, S as Session } from './types-BSR91JFN.js';
2
+ import Redis from 'ioredis';
3
+
4
+ type StylingMode = 'css' | 'tailwind' | 'css-in-js' | 'styled-components' | 'vanilla-extract';
5
+ interface StylingConfig {
6
+ mode: StylingMode;
7
+ theme?: ThemeConfig;
8
+ customProperties?: Record<string, string>;
9
+ }
10
+ interface ThemeConfig {
11
+ colors?: ThemeColors;
12
+ fonts?: ThemeFonts;
13
+ spacing?: ThemeSpacing;
14
+ borderRadius?: ThemeBorderRadius;
15
+ shadows?: ThemeShadows;
16
+ breakpoints?: Record<string, string>;
17
+ }
18
+ interface ThemeColors {
19
+ primary?: string;
20
+ secondary?: string;
21
+ accent?: string;
22
+ background?: string;
23
+ surface?: string;
24
+ text?: string;
25
+ textMuted?: string;
26
+ border?: string;
27
+ error?: string;
28
+ warning?: string;
29
+ success?: string;
30
+ info?: string;
31
+ }
32
+ interface ThemeFonts {
33
+ sans?: string;
34
+ serif?: string;
35
+ mono?: string;
36
+ }
37
+ interface ThemeSpacing {
38
+ xs?: string;
39
+ sm?: string;
40
+ md?: string;
41
+ lg?: string;
42
+ xl?: string;
43
+ '2xl'?: string;
44
+ '3xl'?: string;
45
+ '4xl'?: string;
46
+ }
47
+ interface ThemeBorderRadius {
48
+ sm?: string;
49
+ md?: string;
50
+ lg?: string;
51
+ xl?: string;
52
+ full?: string;
53
+ }
54
+ interface ThemeShadows {
55
+ sm?: string;
56
+ md?: string;
57
+ lg?: string;
58
+ xl?: string;
59
+ }
60
+ declare class CSSGenerator {
61
+ private config;
62
+ private css;
63
+ constructor(config: StylingConfig);
64
+ addRule(selector: string, properties: Record<string, string>): this;
65
+ addMediaQuery(breakpoint: string, rules: string[]): this;
66
+ generate(): string;
67
+ }
68
+ declare function generateTailwindConfig(theme: ThemeConfig): Record<string, any>;
69
+ declare const defaultLightTheme: ThemeConfig;
70
+ declare const defaultDarkTheme: ThemeConfig;
71
+ declare const ecommerce2026Theme: ThemeConfig;
72
+ declare function generateCSSVariables(theme: ThemeConfig): string;
73
+ interface AdminStylingConfig {
74
+ mode: StylingMode;
75
+ theme?: ThemeConfig;
76
+ customStyles?: string;
77
+ componentOverrides?: Record<string, Record<string, string>>;
78
+ }
79
+ declare function createAdminStyling(config: AdminStylingConfig): string;
80
+ interface FieldStyling {
81
+ wrapper?: Record<string, string>;
82
+ label?: Record<string, string>;
83
+ input?: Record<string, string>;
84
+ error?: Record<string, string>;
85
+ description?: Record<string, string>;
86
+ }
87
+ declare const defaultFieldStyling: Record<string, FieldStyling>;
88
+
89
+ interface RedisAuthAdapterOptions {
90
+ url?: string;
91
+ host?: string;
92
+ port?: number;
93
+ password?: string;
94
+ db?: number;
95
+ keyPrefix?: string;
96
+ tokenExpiration?: number;
97
+ refreshTokenExpiration?: number;
98
+ tls?: boolean;
99
+ }
100
+ declare class RedisAuthAdapter implements AuthAdapter {
101
+ private redis;
102
+ private prefix;
103
+ private tokenExpiration;
104
+ private refreshExpiration;
105
+ constructor(options?: RedisAuthAdapterOptions);
106
+ connect(): Promise<void>;
107
+ disconnect(): Promise<void>;
108
+ private userKey;
109
+ private sessionKey;
110
+ private refreshKey;
111
+ private userByEmailKey;
112
+ private passwordHistoryKey;
113
+ createUser(data: {
114
+ email: string;
115
+ password: string;
116
+ role?: UserRole;
117
+ tenantId?: string;
118
+ }): Promise<AuthUser>;
119
+ findUserByEmail(email: string): Promise<AuthUser | null>;
120
+ findUserById(userId: string): Promise<AuthUser | null>;
121
+ updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
122
+ deleteUser(userId: string): Promise<boolean>;
123
+ hashPassword(password: string): Promise<string>;
124
+ verifyPassword(email: string, password: string): Promise<AuthUser | null>;
125
+ createSession(userId: string, data?: {
126
+ ipAddress?: string;
127
+ userAgent?: string;
128
+ }): Promise<Session>;
129
+ findSessionByToken(token: string): Promise<Session | null>;
130
+ deleteSession(sessionId: string): Promise<boolean>;
131
+ deleteUserSessions(userId: string): Promise<number>;
132
+ addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
133
+ getPasswordHistory(userId: string, count?: number): Promise<string[]>;
134
+ isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
135
+ private userToHash;
136
+ private hashToUser;
137
+ private sessionToHash;
138
+ private hashToSession;
139
+ private auditLogKey;
140
+ private auditLogIndexKey;
141
+ findAuditLogs(filter: {
142
+ userId?: string;
143
+ action?: string | string[];
144
+ resource?: string;
145
+ success?: boolean;
146
+ limit?: number;
147
+ offset?: number;
148
+ }): Promise<{
149
+ logs: any[];
150
+ total: number;
151
+ }>;
152
+ createAuditLog(data: any): Promise<any>;
153
+ }
154
+
155
+ interface LockoutConfig {
156
+ maxAttempts: number;
157
+ lockDuration: number;
158
+ notifyUser: boolean;
159
+ notifyAdmin: boolean;
160
+ adminNotifyAfter: number;
161
+ }
162
+ interface LockoutStatus {
163
+ locked: boolean;
164
+ attemptsRemaining: number;
165
+ lockedUntil?: Date;
166
+ totalAttempts: number;
167
+ }
168
+ declare class AccountLockout {
169
+ private redis;
170
+ private prefix;
171
+ private config;
172
+ constructor(redis: Redis, config?: Partial<LockoutConfig>, prefix?: string);
173
+ private lockKey;
174
+ private historyKey;
175
+ checkLockout(userId: string): Promise<LockoutStatus>;
176
+ recordFailedAttempt(userId: string): Promise<LockoutStatus>;
177
+ lockAccount(userId: string, duration?: number): Promise<void>;
178
+ unlockAccount(userId: string): Promise<void>;
179
+ resetAttempts(userId: string): Promise<void>;
180
+ getLockoutHistory(userId: string, limit?: number): Promise<Date[]>;
181
+ getLockoutStats(userId: string): Promise<{
182
+ totalFailedAttempts: number;
183
+ lockoutCount: number;
184
+ lastLockout: Date | null;
185
+ averageAttemptsBeforeLockout: number;
186
+ }>;
187
+ shouldNotifyAdmin(currentAttempts: number): boolean;
188
+ getConfig(): LockoutConfig;
189
+ setConfig(config: Partial<LockoutConfig>): void;
190
+ }
191
+
192
+ interface RateLimitConfig {
193
+ window: number;
194
+ max: number;
195
+ }
196
+ interface RateLimitResult {
197
+ allowed: boolean;
198
+ remaining: number;
199
+ resetAt: number;
200
+ retryAfter?: number;
201
+ }
202
+ declare class RateLimiter {
203
+ private redis;
204
+ private prefix;
205
+ private limits;
206
+ private userLimits;
207
+ constructor(redis: Redis, limits?: Record<string, RateLimitConfig>, userLimits?: Record<string, RateLimitConfig>, prefix?: string);
208
+ private getKey;
209
+ check(type: string, identifier: string): Promise<RateLimitResult>;
210
+ checkUser(type: string, userId: string, identifier: string): Promise<RateLimitResult>;
211
+ reset(type: string, identifier: string): Promise<void>;
212
+ resetUser(type: string, userId: string, identifier: string): Promise<void>;
213
+ getStatus(type: string, identifier: string): Promise<{
214
+ count: number;
215
+ limit: number;
216
+ remaining: number;
217
+ resetAt: number;
218
+ }>;
219
+ setLimit(type: string, config: RateLimitConfig): void;
220
+ setUserLimit(type: string, config: RateLimitConfig): void;
221
+ }
222
+
223
+ export { type AdminStylingConfig as A, CSSGenerator as C, type FieldStyling as F, type LockoutConfig as L, type RateLimitConfig as R, type StylingConfig as S, type ThemeBorderRadius as T, type LockoutStatus as a, type RateLimitResult as b, type RedisAuthAdapterOptions as c, type StylingMode as d, type ThemeColors as e, type ThemeConfig as f, type ThemeFonts as g, type ThemeShadows as h, type ThemeSpacing as i, createAdminStyling as j, defaultDarkTheme as k, defaultFieldStyling as l, defaultLightTheme as m, ecommerce2026Theme as n, generateCSSVariables as o, generateTailwindConfig as p, AccountLockout as q, RateLimiter as r, RedisAuthAdapter as s };
@@ -1,7 +1,7 @@
1
1
  import { Hono } from 'hono';
2
- import { B as BaseAdapter, f as User } from '../types-BM0s_YOy.cjs';
3
- import { R as Registry } from '../index-BwE4NueJ.cjs';
4
- import { i as createWebhookService } from '../WebhookService-BCgL1bLF.cjs';
2
+ import { w as BaseAdapter, Q as User } from '../types-Bt1OEk0S.cjs';
3
+ import { R as Registry } from '../index-CTLPjpMH.cjs';
4
+ import { i as createWebhookService } from '../WebhookService-Dqx9Is7m.cjs';
5
5
  import 'zod';
6
6
 
7
7
  interface HonoAppOptions {
@@ -1,7 +1,7 @@
1
1
  import { Hono } from 'hono';
2
- import { B as BaseAdapter, f as User } from '../types-BM0s_YOy.js';
3
- import { R as Registry } from '../index-DupWTmW6.js';
4
- import { i as createWebhookService } from '../WebhookService-BPVJUgTl.js';
2
+ import { w as BaseAdapter, Q as User } from '../types-Bt1OEk0S.js';
3
+ import { R as Registry } from '../index-BvZ1iWm2.js';
4
+ import { i as createWebhookService } from '../WebhookService-CXJ5oz6L.js';
5
5
  import 'zod';
6
6
 
7
7
  interface HonoAppOptions {
@@ -1,4 +1,4 @@
1
- import { C as CollectionConfig, G as GlobalConfig } from '../types-BM0s_YOy.cjs';
1
+ import { i as CollectionConfig, G as GlobalConfig } from '../types-Bt1OEk0S.cjs';
2
2
 
3
3
  declare const minimalCollections: Record<string, CollectionConfig>;
4
4
 
@@ -1,4 +1,4 @@
1
- import { C as CollectionConfig, G as GlobalConfig } from '../types-BM0s_YOy.js';
1
+ import { i as CollectionConfig, G as GlobalConfig } from '../types-Bt1OEk0S.js';
2
2
 
3
3
  declare const minimalCollections: Record<string, CollectionConfig>;
4
4
 
@@ -1,5 +1,5 @@
1
- import { B as BaseAdapter, g as Request, f as User, b as FindResult } from '../types-BM0s_YOy.cjs';
2
- import { i as createWebhookService } from '../WebhookService-BCgL1bLF.cjs';
1
+ import { w as BaseAdapter, W as Request, Q as User, y as FindResult } from '../types-Bt1OEk0S.cjs';
2
+ import { i as createWebhookService } from '../WebhookService-Dqx9Is7m.cjs';
3
3
 
4
4
  interface ApiKeyContext {
5
5
  userId: string;
@@ -1,5 +1,5 @@
1
- import { B as BaseAdapter, g as Request, f as User, b as FindResult } from '../types-BM0s_YOy.js';
2
- import { i as createWebhookService } from '../WebhookService-BPVJUgTl.js';
1
+ import { w as BaseAdapter, W as Request, Q as User, y as FindResult } from '../types-Bt1OEk0S.js';
2
+ import { i as createWebhookService } from '../WebhookService-CXJ5oz6L.js';
3
3
 
4
4
  interface ApiKeyContext {
5
5
  userId: string;
@@ -1,53 +1,5 @@
1
- import { A as AbstractBaseAdapter } from './base-DaP-5PPG.js';
2
- import { a as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs, C as CollectionConfig, F as Field } from './types-BM0s_YOy.js';
3
- import { PostgresJsDatabase } from 'drizzle-orm/postgres-js';
4
1
  import Redis from 'ioredis';
5
2
 
6
- declare function fieldToDrizzleType(field: Field, dialect?: 'postgres' | 'mysql' | 'sqlite'): string;
7
- declare function collectionToDrizzleSchema(collection: CollectionConfig, dialect?: 'postgres' | 'mysql' | 'sqlite'): string;
8
- declare class DrizzleAdapter extends AbstractBaseAdapter {
9
- private client;
10
- private schema;
11
- private dialect;
12
- constructor(options: {
13
- type: 'postgres' | 'mysql' | 'sqlite';
14
- client: any;
15
- schema?: any;
16
- });
17
- connect(): Promise<void>;
18
- disconnect(): Promise<void>;
19
- find<T>(args: FindArgs): Promise<FindResult<T>>;
20
- findByID<T>(args: FindByIDArgs): Promise<T | null>;
21
- create<T>(args: CreateArgs): Promise<T>;
22
- update<T>(args: UpdateArgs): Promise<T>;
23
- delete<T>(args: DeleteArgs): Promise<T>;
24
- count(args: {
25
- collection: string;
26
- where?: Record<string, any>;
27
- tenantID?: string;
28
- }): Promise<number>;
29
- findOne(args: {
30
- collection: string;
31
- where: Record<string, any>;
32
- tenantID?: string;
33
- }): Promise<any>;
34
- findVersions(args: FindArgs): Promise<FindResult<any>>;
35
- findVersionByID(args: FindByIDArgs): Promise<any>;
36
- createVersion(args: CreateArgs): Promise<any>;
37
- deleteVersions(args: {
38
- collection: string;
39
- where: Record<string, any>;
40
- }): Promise<void>;
41
- private getTable;
42
- private buildWhereClause;
43
- private processResult;
44
- }
45
- declare function createDrizzleAdapter(options: {
46
- type: 'postgres' | 'mysql' | 'sqlite';
47
- client: any;
48
- schema?: any;
49
- }): DrizzleAdapter;
50
-
51
3
  type AuditAction = "login" | "logout" | "login_failed" | "register" | "verify_email" | "password_change" | "password_reset" | "password_reset_request" | "role_change" | "permission_change" | "document_create" | "document_update" | "document_delete" | "settings_change" | "user_lockout" | "user_unlock" | "user_create" | "user_update" | "user_delete" | "api_request" | "api_key_create" | "api_key_delete" | "tenant_create" | "tenant_delete";
52
4
  interface AuditLog {
53
5
  id: string;
@@ -204,67 +156,4 @@ interface AuthAdapter {
204
156
  createAuditLog(data: Omit<AuditLog, "id" | "timestamp">): Promise<AuditLog>;
205
157
  }
206
158
 
207
- interface PostgresAuthAdapterOptions {
208
- db: PostgresJsDatabase;
209
- prefix?: string;
210
- sessionTTL?: number;
211
- refreshTokenTTL?: number;
212
- }
213
- declare class PostgresAuthAdapter implements AuthAdapter {
214
- private db;
215
- private prefix;
216
- private sessionTTL;
217
- private refreshTokenTTL;
218
- constructor(options: PostgresAuthAdapterOptions);
219
- createUser(data: {
220
- email: string;
221
- password: string;
222
- role?: UserRole;
223
- tenantId?: string;
224
- }): Promise<AuthUser>;
225
- findUserByEmail(email: string): Promise<AuthUser | null>;
226
- findUserById(id: string): Promise<AuthUser | null>;
227
- updateUser(id: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
228
- deleteUser(id: string): Promise<boolean>;
229
- verifyPassword(email: string, password: string): Promise<AuthUser | null>;
230
- hashPassword(password: string): Promise<string>;
231
- createSession(userId: string, data?: {
232
- ipAddress?: string;
233
- userAgent?: string;
234
- }): Promise<Session>;
235
- findSessionByToken(token: string): Promise<Session | null>;
236
- deleteSession(sessionId: string): Promise<boolean>;
237
- deleteUserSessions(userId: string): Promise<number>;
238
- addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
239
- getPasswordHistory(userId: string, count?: number): Promise<string[]>;
240
- isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
241
- isLocked(userId: string): Promise<boolean>;
242
- getLockout(userId: string): Promise<{
243
- lockedUntil: Date;
244
- } | null>;
245
- recordFailedAttempt(userId: string, ipAddress?: string): Promise<{
246
- attempts: number;
247
- locked: boolean;
248
- }>;
249
- resetAttempts(userId: string): Promise<void>;
250
- findAuditLogs(filter: AuditLogFilter): Promise<{
251
- logs: AuditLog[];
252
- total: number;
253
- }>;
254
- createAuditLog(data: Omit<AuditLog, "id" | "timestamp">): Promise<AuditLog>;
255
- private userToAuthUser;
256
- private sessionToSession;
257
- }
258
-
259
- type Dialect = "sqlite" | "postgres" | "mysql";
260
- declare function genId(): string;
261
- interface DatabaseResult {
262
- db: any;
263
- dialect: Dialect;
264
- genId: () => string;
265
- }
266
- declare function createDatabase(): Promise<DatabaseResult>;
267
- declare function runMigrations(_db: any, _dialect?: Dialect): Promise<void>;
268
- declare function seedDefaultRoles(db: any): Promise<void>;
269
-
270
- export { type AuthAdapter as A, type Dialect as D, type JWTPayload as J, type LoginCredentials as L, PostgresAuthAdapter as P, type RegisterData as R, type Session as S, type UserRole as U, type AuthUser as a, type AuditLog as b, type AuditLogFilter as c, type AuthTokenConfig as d, type AuthResult as e, type AuditAction as f, AuditLogger as g, DrizzleAdapter as h, collectionToDrizzleSchema as i, createAuditContext as j, createDatabase as k, createDrizzleAdapter as l, fieldToDrizzleType as m, genId as n, runMigrations as r, seedDefaultRoles as s };
159
+ export { type AuditAction as A, type JWTPayload as J, type LoginCredentials as L, type RegisterData as R, type Session as S, type UserRole as U, type AuditLog as a, type AuditLogFilter as b, type AuthAdapter as c, type AuthResult as d, type AuthTokenConfig as e, type AuthUser as f, AuditLogger as g, createAuditContext as h };