@kyro-cms/core 0.1.0 → 0.1.2
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/README.md +556 -130
- package/dist/bootstrap-2WJK6PG7.cjs +29 -0
- package/dist/bootstrap-2WJK6PG7.cjs.map +1 -0
- package/dist/bootstrap-Q2TWUQF3.js +4 -0
- package/dist/bootstrap-Q2TWUQF3.js.map +1 -0
- package/dist/chunk-3QX6KG2S.js +2125 -0
- package/dist/chunk-3QX6KG2S.js.map +1 -0
- package/dist/chunk-5AOILNGY.cjs +212 -0
- package/dist/chunk-5AOILNGY.cjs.map +1 -0
- package/dist/{chunk-DKSMFC3L.js → chunk-EINVJPFM.js} +2 -2
- package/dist/{chunk-DKSMFC3L.js.map → chunk-EINVJPFM.js.map} +1 -1
- package/dist/chunk-F5B64H5S.cjs +2149 -0
- package/dist/chunk-F5B64H5S.cjs.map +1 -0
- package/dist/chunk-I4BORBXT.cjs +914 -0
- package/dist/chunk-I4BORBXT.cjs.map +1 -0
- package/dist/chunk-KA3UOIFC.js +206 -0
- package/dist/chunk-KA3UOIFC.js.map +1 -0
- package/dist/chunk-KWTKEBHM.cjs +176 -0
- package/dist/chunk-KWTKEBHM.cjs.map +1 -0
- package/dist/chunk-M4JFHQ5J.js +170 -0
- package/dist/chunk-M4JFHQ5J.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +9 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/chunk-U4CHJTWX.cjs +94 -0
- package/dist/chunk-U4CHJTWX.cjs.map +1 -0
- package/dist/{chunk-3Q3FS5J4.cjs → chunk-V3B25QOK.cjs} +2 -2
- package/dist/{chunk-3Q3FS5J4.cjs.map → chunk-V3B25QOK.cjs.map} +1 -1
- package/dist/chunk-V67YXRBT.js +899 -0
- package/dist/chunk-V67YXRBT.js.map +1 -0
- package/dist/chunk-XLMVCGXA.js +86 -0
- package/dist/chunk-XLMVCGXA.js.map +1 -0
- package/dist/cli/index.cjs +106 -14
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +106 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/database-37KXWUER.js +5 -0
- package/dist/database-37KXWUER.js.map +1 -0
- package/dist/database-LJKD3HE4.cjs +22 -0
- package/dist/database-LJKD3HE4.cjs.map +1 -0
- package/dist/drizzle/index.cjs +25 -5
- package/dist/drizzle/index.d.cts +5 -49
- package/dist/drizzle/index.d.ts +5 -49
- package/dist/drizzle/index.js +5 -1
- package/dist/graphql/index.cjs +1 -0
- package/dist/graphql/index.js +1 -0
- package/dist/index-BVFlb7uU.d.ts +192 -0
- package/dist/index-CzkEHKqu.d.cts +192 -0
- package/dist/index.cjs +1203 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +382 -68
- package/dist/index.d.ts +382 -68
- package/dist/index.js +1110 -20
- package/dist/index.js.map +1 -1
- package/dist/mongodb/index.cjs +1 -0
- package/dist/mongodb/index.js +1 -0
- package/dist/postgres-auth-adapter-CYZAVPPP.cjs +14 -0
- package/dist/postgres-auth-adapter-CYZAVPPP.cjs.map +1 -0
- package/dist/postgres-auth-adapter-LTDUGBMB.js +5 -0
- package/dist/postgres-auth-adapter-LTDUGBMB.js.map +1 -0
- package/dist/rest/index.cjs +1 -0
- package/dist/rest/index.js +1 -0
- package/dist/templates/index.cjs +101 -0
- package/dist/templates/index.cjs.map +1 -0
- package/dist/templates/index.d.cts +55 -0
- package/dist/templates/index.d.ts +55 -0
- package/dist/templates/index.js +4 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/trpc/index.cjs +1 -0
- package/dist/trpc/index.js +1 -0
- package/dist/ws/index.cjs +1 -0
- package/dist/ws/index.js +1 -0
- package/package.json +40 -6
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { A as AbstractBaseAdapter } from './base-CQkFzqQl.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-BGM5MV_K.js';
|
|
3
|
+
import * as drizzle_orm_postgres_js from 'drizzle-orm/postgres-js';
|
|
4
|
+
import { PostgresJsDatabase, drizzle } from 'drizzle-orm/postgres-js';
|
|
5
|
+
import postgres from 'postgres';
|
|
6
|
+
|
|
7
|
+
declare function fieldToDrizzleType(field: Field, dialect?: 'postgres' | 'mysql' | 'sqlite'): string;
|
|
8
|
+
declare function collectionToDrizzleSchema(collection: CollectionConfig, dialect?: 'postgres' | 'mysql' | 'sqlite'): string;
|
|
9
|
+
declare class DrizzleAdapter extends AbstractBaseAdapter {
|
|
10
|
+
private client;
|
|
11
|
+
private schema;
|
|
12
|
+
private dialect;
|
|
13
|
+
constructor(options: {
|
|
14
|
+
type: 'postgres' | 'mysql' | 'sqlite';
|
|
15
|
+
client: any;
|
|
16
|
+
schema?: any;
|
|
17
|
+
});
|
|
18
|
+
connect(): Promise<void>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
find<T>(args: FindArgs): Promise<FindResult<T>>;
|
|
21
|
+
findByID<T>(args: FindByIDArgs): Promise<T | null>;
|
|
22
|
+
create<T>(args: CreateArgs): Promise<T>;
|
|
23
|
+
update<T>(args: UpdateArgs): Promise<T>;
|
|
24
|
+
delete<T>(args: DeleteArgs): Promise<T>;
|
|
25
|
+
count(args: {
|
|
26
|
+
collection: string;
|
|
27
|
+
where?: Record<string, any>;
|
|
28
|
+
tenantID?: string;
|
|
29
|
+
}): Promise<number>;
|
|
30
|
+
findOne(args: {
|
|
31
|
+
collection: string;
|
|
32
|
+
where: Record<string, any>;
|
|
33
|
+
tenantID?: string;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
findVersions(args: FindArgs): Promise<FindResult<any>>;
|
|
36
|
+
findVersionByID(args: FindByIDArgs): Promise<any>;
|
|
37
|
+
createVersion(args: CreateArgs): Promise<any>;
|
|
38
|
+
deleteVersions(args: {
|
|
39
|
+
collection: string;
|
|
40
|
+
where: Record<string, any>;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
private getTable;
|
|
43
|
+
private buildWhereClause;
|
|
44
|
+
private processResult;
|
|
45
|
+
}
|
|
46
|
+
declare function createDrizzleAdapter(options: {
|
|
47
|
+
type: 'postgres' | 'mysql' | 'sqlite';
|
|
48
|
+
client: any;
|
|
49
|
+
schema?: any;
|
|
50
|
+
}): DrizzleAdapter;
|
|
51
|
+
|
|
52
|
+
interface AuthUser {
|
|
53
|
+
id: string;
|
|
54
|
+
email: string;
|
|
55
|
+
passwordHash?: string;
|
|
56
|
+
role: UserRole;
|
|
57
|
+
tenantId?: string;
|
|
58
|
+
emailVerified?: boolean;
|
|
59
|
+
locked?: boolean;
|
|
60
|
+
lastLogin?: string;
|
|
61
|
+
failedLoginAttempts?: number;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
}
|
|
65
|
+
type UserRole = "super_admin" | "admin" | "editor" | "author" | "customer" | "guest";
|
|
66
|
+
interface Session {
|
|
67
|
+
id: string;
|
|
68
|
+
userId: string;
|
|
69
|
+
token: string;
|
|
70
|
+
refreshToken?: string;
|
|
71
|
+
expiresAt: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
ipAddress?: string;
|
|
74
|
+
userAgent?: string;
|
|
75
|
+
}
|
|
76
|
+
interface JWTPayload {
|
|
77
|
+
sub: string;
|
|
78
|
+
email: string;
|
|
79
|
+
role: UserRole;
|
|
80
|
+
tenantId?: string;
|
|
81
|
+
iat: number;
|
|
82
|
+
exp: number;
|
|
83
|
+
}
|
|
84
|
+
interface AuthTokenConfig {
|
|
85
|
+
secret: string;
|
|
86
|
+
expiresIn?: string | number;
|
|
87
|
+
refreshExpiresIn?: string | number;
|
|
88
|
+
issuer?: string;
|
|
89
|
+
audience?: string[];
|
|
90
|
+
saltRounds?: number;
|
|
91
|
+
}
|
|
92
|
+
interface LoginCredentials {
|
|
93
|
+
email: string;
|
|
94
|
+
password: string;
|
|
95
|
+
}
|
|
96
|
+
interface RegisterData {
|
|
97
|
+
email: string;
|
|
98
|
+
password: string;
|
|
99
|
+
role?: UserRole;
|
|
100
|
+
tenantId?: string;
|
|
101
|
+
}
|
|
102
|
+
interface AuthResult {
|
|
103
|
+
success: boolean;
|
|
104
|
+
user?: AuthUser;
|
|
105
|
+
session?: Session;
|
|
106
|
+
token?: string;
|
|
107
|
+
error?: string;
|
|
108
|
+
}
|
|
109
|
+
interface AuthAdapter {
|
|
110
|
+
createUser(data: {
|
|
111
|
+
email: string;
|
|
112
|
+
passwordHash: string;
|
|
113
|
+
role: UserRole;
|
|
114
|
+
tenantId?: string;
|
|
115
|
+
}): Promise<AuthUser>;
|
|
116
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
117
|
+
findUserById(id: string): Promise<AuthUser | null>;
|
|
118
|
+
updateUser(id: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
119
|
+
deleteUser(id: string): Promise<boolean>;
|
|
120
|
+
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
121
|
+
hashPassword(password: string): Promise<string>;
|
|
122
|
+
createSession(userId: string, data?: {
|
|
123
|
+
ipAddress?: string;
|
|
124
|
+
userAgent?: string;
|
|
125
|
+
}): Promise<Session>;
|
|
126
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
127
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
128
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface PostgresAuthAdapterOptions {
|
|
132
|
+
db: PostgresJsDatabase;
|
|
133
|
+
prefix?: string;
|
|
134
|
+
sessionTTL?: number;
|
|
135
|
+
refreshTokenTTL?: number;
|
|
136
|
+
}
|
|
137
|
+
declare class PostgresAuthAdapter implements AuthAdapter {
|
|
138
|
+
private db;
|
|
139
|
+
private prefix;
|
|
140
|
+
private sessionTTL;
|
|
141
|
+
private refreshTokenTTL;
|
|
142
|
+
constructor(options: PostgresAuthAdapterOptions);
|
|
143
|
+
createUser(data: {
|
|
144
|
+
email: string;
|
|
145
|
+
passwordHash: string;
|
|
146
|
+
role?: UserRole;
|
|
147
|
+
tenantId?: string;
|
|
148
|
+
}): Promise<AuthUser>;
|
|
149
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
150
|
+
findUserById(id: string): Promise<AuthUser | null>;
|
|
151
|
+
updateUser(id: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
152
|
+
deleteUser(id: string): Promise<boolean>;
|
|
153
|
+
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
154
|
+
hashPassword(password: string): Promise<string>;
|
|
155
|
+
createSession(userId: string, data?: {
|
|
156
|
+
ipAddress?: string;
|
|
157
|
+
userAgent?: string;
|
|
158
|
+
}): Promise<Session>;
|
|
159
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
160
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
161
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
162
|
+
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
163
|
+
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
164
|
+
isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
165
|
+
isLocked(userId: string): Promise<boolean>;
|
|
166
|
+
getLockout(userId: string): Promise<{
|
|
167
|
+
lockedUntil: Date;
|
|
168
|
+
} | null>;
|
|
169
|
+
recordFailedAttempt(userId: string, ipAddress?: string): Promise<{
|
|
170
|
+
attempts: number;
|
|
171
|
+
locked: boolean;
|
|
172
|
+
}>;
|
|
173
|
+
resetAttempts(userId: string): Promise<void>;
|
|
174
|
+
private userToAuthUser;
|
|
175
|
+
private sessionToSession;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface DatabaseConfig {
|
|
179
|
+
url: string;
|
|
180
|
+
maxConnections: number;
|
|
181
|
+
ssl: boolean;
|
|
182
|
+
}
|
|
183
|
+
declare function createDatabase(config?: Partial<DatabaseConfig>): Promise<{
|
|
184
|
+
client: postgres.Sql<{}>;
|
|
185
|
+
db: drizzle_orm_postgres_js.PostgresJsDatabase<any> & {
|
|
186
|
+
$client: postgres.Sql<{}>;
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
189
|
+
declare function runMigrations(db: ReturnType<typeof drizzle>): Promise<void>;
|
|
190
|
+
declare function seedDefaultRoles(db: ReturnType<typeof drizzle>): Promise<void>;
|
|
191
|
+
|
|
192
|
+
export { type AuthAdapter as A, DrizzleAdapter 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 AuthTokenConfig as b, type AuthResult as c, collectionToDrizzleSchema as d, createDatabase as e, createDrizzleAdapter as f, fieldToDrizzleType as g, runMigrations as r, seedDefaultRoles as s };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { A as AbstractBaseAdapter } from './base-DlhVlwnN.cjs';
|
|
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-BGM5MV_K.cjs';
|
|
3
|
+
import * as drizzle_orm_postgres_js from 'drizzle-orm/postgres-js';
|
|
4
|
+
import { PostgresJsDatabase, drizzle } from 'drizzle-orm/postgres-js';
|
|
5
|
+
import postgres from 'postgres';
|
|
6
|
+
|
|
7
|
+
declare function fieldToDrizzleType(field: Field, dialect?: 'postgres' | 'mysql' | 'sqlite'): string;
|
|
8
|
+
declare function collectionToDrizzleSchema(collection: CollectionConfig, dialect?: 'postgres' | 'mysql' | 'sqlite'): string;
|
|
9
|
+
declare class DrizzleAdapter extends AbstractBaseAdapter {
|
|
10
|
+
private client;
|
|
11
|
+
private schema;
|
|
12
|
+
private dialect;
|
|
13
|
+
constructor(options: {
|
|
14
|
+
type: 'postgres' | 'mysql' | 'sqlite';
|
|
15
|
+
client: any;
|
|
16
|
+
schema?: any;
|
|
17
|
+
});
|
|
18
|
+
connect(): Promise<void>;
|
|
19
|
+
disconnect(): Promise<void>;
|
|
20
|
+
find<T>(args: FindArgs): Promise<FindResult<T>>;
|
|
21
|
+
findByID<T>(args: FindByIDArgs): Promise<T | null>;
|
|
22
|
+
create<T>(args: CreateArgs): Promise<T>;
|
|
23
|
+
update<T>(args: UpdateArgs): Promise<T>;
|
|
24
|
+
delete<T>(args: DeleteArgs): Promise<T>;
|
|
25
|
+
count(args: {
|
|
26
|
+
collection: string;
|
|
27
|
+
where?: Record<string, any>;
|
|
28
|
+
tenantID?: string;
|
|
29
|
+
}): Promise<number>;
|
|
30
|
+
findOne(args: {
|
|
31
|
+
collection: string;
|
|
32
|
+
where: Record<string, any>;
|
|
33
|
+
tenantID?: string;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
findVersions(args: FindArgs): Promise<FindResult<any>>;
|
|
36
|
+
findVersionByID(args: FindByIDArgs): Promise<any>;
|
|
37
|
+
createVersion(args: CreateArgs): Promise<any>;
|
|
38
|
+
deleteVersions(args: {
|
|
39
|
+
collection: string;
|
|
40
|
+
where: Record<string, any>;
|
|
41
|
+
}): Promise<void>;
|
|
42
|
+
private getTable;
|
|
43
|
+
private buildWhereClause;
|
|
44
|
+
private processResult;
|
|
45
|
+
}
|
|
46
|
+
declare function createDrizzleAdapter(options: {
|
|
47
|
+
type: 'postgres' | 'mysql' | 'sqlite';
|
|
48
|
+
client: any;
|
|
49
|
+
schema?: any;
|
|
50
|
+
}): DrizzleAdapter;
|
|
51
|
+
|
|
52
|
+
interface AuthUser {
|
|
53
|
+
id: string;
|
|
54
|
+
email: string;
|
|
55
|
+
passwordHash?: string;
|
|
56
|
+
role: UserRole;
|
|
57
|
+
tenantId?: string;
|
|
58
|
+
emailVerified?: boolean;
|
|
59
|
+
locked?: boolean;
|
|
60
|
+
lastLogin?: string;
|
|
61
|
+
failedLoginAttempts?: number;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
}
|
|
65
|
+
type UserRole = "super_admin" | "admin" | "editor" | "author" | "customer" | "guest";
|
|
66
|
+
interface Session {
|
|
67
|
+
id: string;
|
|
68
|
+
userId: string;
|
|
69
|
+
token: string;
|
|
70
|
+
refreshToken?: string;
|
|
71
|
+
expiresAt: string;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
ipAddress?: string;
|
|
74
|
+
userAgent?: string;
|
|
75
|
+
}
|
|
76
|
+
interface JWTPayload {
|
|
77
|
+
sub: string;
|
|
78
|
+
email: string;
|
|
79
|
+
role: UserRole;
|
|
80
|
+
tenantId?: string;
|
|
81
|
+
iat: number;
|
|
82
|
+
exp: number;
|
|
83
|
+
}
|
|
84
|
+
interface AuthTokenConfig {
|
|
85
|
+
secret: string;
|
|
86
|
+
expiresIn?: string | number;
|
|
87
|
+
refreshExpiresIn?: string | number;
|
|
88
|
+
issuer?: string;
|
|
89
|
+
audience?: string[];
|
|
90
|
+
saltRounds?: number;
|
|
91
|
+
}
|
|
92
|
+
interface LoginCredentials {
|
|
93
|
+
email: string;
|
|
94
|
+
password: string;
|
|
95
|
+
}
|
|
96
|
+
interface RegisterData {
|
|
97
|
+
email: string;
|
|
98
|
+
password: string;
|
|
99
|
+
role?: UserRole;
|
|
100
|
+
tenantId?: string;
|
|
101
|
+
}
|
|
102
|
+
interface AuthResult {
|
|
103
|
+
success: boolean;
|
|
104
|
+
user?: AuthUser;
|
|
105
|
+
session?: Session;
|
|
106
|
+
token?: string;
|
|
107
|
+
error?: string;
|
|
108
|
+
}
|
|
109
|
+
interface AuthAdapter {
|
|
110
|
+
createUser(data: {
|
|
111
|
+
email: string;
|
|
112
|
+
passwordHash: string;
|
|
113
|
+
role: UserRole;
|
|
114
|
+
tenantId?: string;
|
|
115
|
+
}): Promise<AuthUser>;
|
|
116
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
117
|
+
findUserById(id: string): Promise<AuthUser | null>;
|
|
118
|
+
updateUser(id: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
119
|
+
deleteUser(id: string): Promise<boolean>;
|
|
120
|
+
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
121
|
+
hashPassword(password: string): Promise<string>;
|
|
122
|
+
createSession(userId: string, data?: {
|
|
123
|
+
ipAddress?: string;
|
|
124
|
+
userAgent?: string;
|
|
125
|
+
}): Promise<Session>;
|
|
126
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
127
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
128
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface PostgresAuthAdapterOptions {
|
|
132
|
+
db: PostgresJsDatabase;
|
|
133
|
+
prefix?: string;
|
|
134
|
+
sessionTTL?: number;
|
|
135
|
+
refreshTokenTTL?: number;
|
|
136
|
+
}
|
|
137
|
+
declare class PostgresAuthAdapter implements AuthAdapter {
|
|
138
|
+
private db;
|
|
139
|
+
private prefix;
|
|
140
|
+
private sessionTTL;
|
|
141
|
+
private refreshTokenTTL;
|
|
142
|
+
constructor(options: PostgresAuthAdapterOptions);
|
|
143
|
+
createUser(data: {
|
|
144
|
+
email: string;
|
|
145
|
+
passwordHash: string;
|
|
146
|
+
role?: UserRole;
|
|
147
|
+
tenantId?: string;
|
|
148
|
+
}): Promise<AuthUser>;
|
|
149
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
150
|
+
findUserById(id: string): Promise<AuthUser | null>;
|
|
151
|
+
updateUser(id: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
152
|
+
deleteUser(id: string): Promise<boolean>;
|
|
153
|
+
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
154
|
+
hashPassword(password: string): Promise<string>;
|
|
155
|
+
createSession(userId: string, data?: {
|
|
156
|
+
ipAddress?: string;
|
|
157
|
+
userAgent?: string;
|
|
158
|
+
}): Promise<Session>;
|
|
159
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
160
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
161
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
162
|
+
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
163
|
+
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
164
|
+
isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
165
|
+
isLocked(userId: string): Promise<boolean>;
|
|
166
|
+
getLockout(userId: string): Promise<{
|
|
167
|
+
lockedUntil: Date;
|
|
168
|
+
} | null>;
|
|
169
|
+
recordFailedAttempt(userId: string, ipAddress?: string): Promise<{
|
|
170
|
+
attempts: number;
|
|
171
|
+
locked: boolean;
|
|
172
|
+
}>;
|
|
173
|
+
resetAttempts(userId: string): Promise<void>;
|
|
174
|
+
private userToAuthUser;
|
|
175
|
+
private sessionToSession;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
interface DatabaseConfig {
|
|
179
|
+
url: string;
|
|
180
|
+
maxConnections: number;
|
|
181
|
+
ssl: boolean;
|
|
182
|
+
}
|
|
183
|
+
declare function createDatabase(config?: Partial<DatabaseConfig>): Promise<{
|
|
184
|
+
client: postgres.Sql<{}>;
|
|
185
|
+
db: drizzle_orm_postgres_js.PostgresJsDatabase<any> & {
|
|
186
|
+
$client: postgres.Sql<{}>;
|
|
187
|
+
};
|
|
188
|
+
}>;
|
|
189
|
+
declare function runMigrations(db: ReturnType<typeof drizzle>): Promise<void>;
|
|
190
|
+
declare function seedDefaultRoles(db: ReturnType<typeof drizzle>): Promise<void>;
|
|
191
|
+
|
|
192
|
+
export { type AuthAdapter as A, DrizzleAdapter 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 AuthTokenConfig as b, type AuthResult as c, collectionToDrizzleSchema as d, createDatabase as e, createDrizzleAdapter as f, fieldToDrizzleType as g, runMigrations as r, seedDefaultRoles as s };
|