@kyro-cms/core 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap-BDTTUGY2.js +4 -0
- package/dist/{bootstrap-Q2TWUQF3.js.map → bootstrap-BDTTUGY2.js.map} +1 -1
- package/dist/bootstrap-X6TP3NKX.cjs +29 -0
- package/dist/{bootstrap-2WJK6PG7.cjs.map → bootstrap-X6TP3NKX.cjs.map} +1 -1
- package/dist/chunk-5BLDMQED.cjs +18 -0
- package/dist/{chunk-Q7SFCCGT.cjs.map → chunk-5BLDMQED.cjs.map} +1 -1
- package/dist/{chunk-U4CHJTWX.cjs → chunk-7G6EVYCU.cjs} +5 -5
- package/dist/{chunk-U4CHJTWX.cjs.map → chunk-7G6EVYCU.cjs.map} +1 -1
- package/dist/chunk-A3RQWHKD.cjs +263 -0
- package/dist/chunk-A3RQWHKD.cjs.map +1 -0
- package/dist/{chunk-V67YXRBT.js → chunk-C74MQIRL.js} +517 -203
- package/dist/chunk-C74MQIRL.js.map +1 -0
- package/dist/{chunk-XLMVCGXA.js → chunk-LRTZJJPD.js} +3 -3
- package/dist/{chunk-XLMVCGXA.js.map → chunk-LRTZJJPD.js.map} +1 -1
- package/dist/{chunk-I4BORBXT.cjs → chunk-MHS6CPO5.cjs} +517 -204
- package/dist/chunk-MHS6CPO5.cjs.map +1 -0
- package/dist/chunk-NSBPE2FW.js +15 -0
- package/dist/{chunk-PZ5AY32C.js.map → chunk-NSBPE2FW.js.map} +1 -1
- package/dist/{chunk-M4JFHQ5J.js → chunk-QUJ4OLSC.js} +3 -3
- package/dist/{chunk-M4JFHQ5J.js.map → chunk-QUJ4OLSC.js.map} +1 -1
- package/dist/{chunk-5AOILNGY.cjs → chunk-TZFJMPCH.cjs} +4 -4
- package/dist/{chunk-5AOILNGY.cjs.map → chunk-TZFJMPCH.cjs.map} +1 -1
- package/dist/chunk-VMSRTAH7.js +256 -0
- package/dist/chunk-VMSRTAH7.js.map +1 -0
- package/dist/{chunk-KA3UOIFC.js → chunk-XTZSUDSI.js} +3 -3
- package/dist/{chunk-KA3UOIFC.js.map → chunk-XTZSUDSI.js.map} +1 -1
- package/dist/{chunk-KWTKEBHM.cjs → chunk-YD7Y25W7.cjs} +19 -19
- package/dist/{chunk-KWTKEBHM.cjs.map → chunk-YD7Y25W7.cjs.map} +1 -1
- package/dist/cli/index.cjs +5 -5
- package/dist/cli/index.js +5 -5
- package/dist/database-7CJOXEZR.js +5 -0
- package/dist/{database-37KXWUER.js.map → database-7CJOXEZR.js.map} +1 -1
- package/dist/database-QOIV44GT.cjs +22 -0
- package/dist/{database-LJKD3HE4.cjs.map → database-QOIV44GT.cjs.map} +1 -1
- package/dist/drizzle/index.cjs +8 -8
- package/dist/drizzle/index.d.cts +1 -1
- package/dist/drizzle/index.d.ts +1 -1
- package/dist/drizzle/index.js +4 -4
- package/dist/graphql/index.cjs +1 -1
- package/dist/graphql/index.js +1 -1
- package/dist/{index-CzkEHKqu.d.cts → index-BMySjW6o.d.cts} +6 -0
- package/dist/{index-BVFlb7uU.d.ts → index-CMUNCIWQ.d.ts} +6 -0
- package/dist/index.cjs +727 -346
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +229 -62
- package/dist/index.d.ts +229 -62
- package/dist/index.js +706 -331
- package/dist/index.js.map +1 -1
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.js +1 -1
- package/dist/postgres-auth-adapter-REJFUMP7.js +5 -0
- package/dist/{postgres-auth-adapter-LTDUGBMB.js.map → postgres-auth-adapter-REJFUMP7.js.map} +1 -1
- package/dist/postgres-auth-adapter-VK6GY7LX.cjs +14 -0
- package/dist/{postgres-auth-adapter-CYZAVPPP.cjs.map → postgres-auth-adapter-VK6GY7LX.cjs.map} +1 -1
- package/dist/redis-adapter-4YDY4LWE.js +4 -0
- package/dist/redis-adapter-4YDY4LWE.js.map +1 -0
- package/dist/redis-adapter-LBLNKGNS.cjs +13 -0
- package/dist/redis-adapter-LBLNKGNS.cjs.map +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.js +1 -1
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.js +1 -1
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +2 -2
- package/dist/bootstrap-2WJK6PG7.cjs +0 -29
- package/dist/bootstrap-Q2TWUQF3.js +0 -4
- package/dist/chunk-I4BORBXT.cjs.map +0 -1
- package/dist/chunk-PZ5AY32C.js +0 -9
- package/dist/chunk-Q7SFCCGT.cjs +0 -11
- package/dist/chunk-V67YXRBT.js.map +0 -1
- package/dist/database-37KXWUER.js +0 -5
- package/dist/database-LJKD3HE4.cjs +0 -22
- package/dist/postgres-auth-adapter-CYZAVPPP.cjs +0 -14
- package/dist/postgres-auth-adapter-LTDUGBMB.js +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -12,15 +12,15 @@ export { PubSub, createWSServer } from './ws/index.js';
|
|
|
12
12
|
import { ZodTypeAny } from 'zod';
|
|
13
13
|
export { z } from 'zod';
|
|
14
14
|
import { A as AbstractBaseAdapter } from './base-CQkFzqQl.js';
|
|
15
|
-
import { A as AuthAdapter, U as UserRole, a as AuthUser, S as Session, b as AuthTokenConfig, R as RegisterData, c as AuthResult, L as LoginCredentials, J as JWTPayload } from './index-
|
|
16
|
-
export { D as DrizzleAdapter, P as PostgresAuthAdapter, d as collectionToDrizzleSchema, e as createDatabase, f as createDrizzleAdapter, g as fieldToDrizzleType, r as runMigrations, s as seedDefaultRoles } from './index-
|
|
15
|
+
import { A as AuthAdapter, U as UserRole, a as AuthUser, S as Session, b as AuthTokenConfig, R as RegisterData, c as AuthResult, L as LoginCredentials, J as JWTPayload } from './index-CMUNCIWQ.js';
|
|
16
|
+
export { D as DrizzleAdapter, P as PostgresAuthAdapter, d as collectionToDrizzleSchema, e as createDatabase, f as createDrizzleAdapter, g as fieldToDrizzleType, r as runMigrations, s as seedDefaultRoles } from './index-CMUNCIWQ.js';
|
|
17
17
|
export { MongoDBAdapter, createMongoDBAdapter } from './mongodb/index.js';
|
|
18
18
|
export { buildGraphQLSchema, createGraphQLSchema } from './graphql/index.js';
|
|
19
19
|
export { createHonoApp, createRESTAPI } from './rest/index.js';
|
|
20
|
+
import Database from 'better-sqlite3';
|
|
20
21
|
export { TemplateConfig, allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals, createTemplateConfig, ecommerceCollections, ecommerceGlobals, ecommerceSettingsGlobals, kitchenSinkCollections, mediaCollections, minimalCollections } from './templates/index.js';
|
|
21
22
|
import Redis from 'ioredis';
|
|
22
23
|
import { SentMessageInfo } from 'nodemailer';
|
|
23
|
-
import Database from 'better-sqlite3';
|
|
24
24
|
import 'ws';
|
|
25
25
|
import 'drizzle-orm/postgres-js';
|
|
26
26
|
import 'postgres';
|
|
@@ -73,9 +73,9 @@ declare function collectionToUpdateZod(collection: CollectionConfig): ZodTypeAny
|
|
|
73
73
|
declare function collectionToWhereZod(collection: CollectionConfig): ZodTypeAny;
|
|
74
74
|
declare function globalToZod(global: GlobalConfig): ZodTypeAny;
|
|
75
75
|
|
|
76
|
-
type DatabaseType = 'postgres' | 'mysql' | 'sqlite' | 'mongodb';
|
|
76
|
+
type DatabaseType$1 = 'postgres' | 'mysql' | 'sqlite' | 'mongodb';
|
|
77
77
|
interface DatabaseConnectionOptions {
|
|
78
|
-
type: DatabaseType;
|
|
78
|
+
type: DatabaseType$1;
|
|
79
79
|
host?: string;
|
|
80
80
|
port?: number;
|
|
81
81
|
database?: string;
|
|
@@ -392,47 +392,6 @@ declare class RedisAuthAdapter implements AuthAdapter {
|
|
|
392
392
|
private hashToSession;
|
|
393
393
|
}
|
|
394
394
|
|
|
395
|
-
interface SQLiteAuthAdapterOptions {
|
|
396
|
-
path?: string;
|
|
397
|
-
db?: Database.Database;
|
|
398
|
-
saltRounds?: number;
|
|
399
|
-
}
|
|
400
|
-
declare class SQLiteAuthAdapter implements AuthAdapter {
|
|
401
|
-
private db;
|
|
402
|
-
private path;
|
|
403
|
-
private saltRounds;
|
|
404
|
-
private externalDb;
|
|
405
|
-
constructor(options?: SQLiteAuthAdapterOptions);
|
|
406
|
-
connect(): Promise<void>;
|
|
407
|
-
disconnect(): Promise<void>;
|
|
408
|
-
private ensureTables;
|
|
409
|
-
createUser(data: {
|
|
410
|
-
email: string;
|
|
411
|
-
passwordHash: string;
|
|
412
|
-
role?: UserRole;
|
|
413
|
-
tenantId?: string;
|
|
414
|
-
}): Promise<AuthUser>;
|
|
415
|
-
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
416
|
-
findUserById(userId: string): Promise<AuthUser | null>;
|
|
417
|
-
updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
418
|
-
deleteUser(userId: string): Promise<boolean>;
|
|
419
|
-
hashPassword(password: string): Promise<string>;
|
|
420
|
-
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
421
|
-
createSession(userId: string, data?: {
|
|
422
|
-
ipAddress?: string;
|
|
423
|
-
userAgent?: string;
|
|
424
|
-
}): Promise<Session>;
|
|
425
|
-
findSessionByToken(token: string): Promise<Session | null>;
|
|
426
|
-
findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
|
|
427
|
-
deleteSession(sessionId: string): Promise<boolean>;
|
|
428
|
-
deleteUserSessions(userId: string): Promise<number>;
|
|
429
|
-
hasAnyUsers(): Promise<boolean>;
|
|
430
|
-
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
431
|
-
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
432
|
-
private rowToUser;
|
|
433
|
-
private rowToSession;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
395
|
interface EmailConfig {
|
|
437
396
|
host: string;
|
|
438
397
|
port: number;
|
|
@@ -495,11 +454,8 @@ declare class EmailTransport {
|
|
|
495
454
|
}
|
|
496
455
|
|
|
497
456
|
interface BootstrapConfig {
|
|
498
|
-
redisUrl?: string;
|
|
499
|
-
redisHost?: string;
|
|
500
|
-
redisPort?: number;
|
|
501
|
-
redisPassword?: string;
|
|
502
457
|
authAdapter?: AuthAdapter;
|
|
458
|
+
authDbPath?: string;
|
|
503
459
|
adminEmail: string;
|
|
504
460
|
adminPassword: string;
|
|
505
461
|
adminRole?: string;
|
|
@@ -687,22 +643,90 @@ declare function createAuditContext(req: Request): {
|
|
|
687
643
|
userAgent: string;
|
|
688
644
|
};
|
|
689
645
|
|
|
646
|
+
declare class InMemoryRateLimiter {
|
|
647
|
+
private storage;
|
|
648
|
+
private userStorage;
|
|
649
|
+
private limits;
|
|
650
|
+
private userLimits;
|
|
651
|
+
constructor(limits?: Record<string, RateLimitConfig>, userLimits?: Record<string, RateLimitConfig>);
|
|
652
|
+
private getKey;
|
|
653
|
+
private getUserKey;
|
|
654
|
+
private cleanupOldEntries;
|
|
655
|
+
check(type: string, identifier: string): Promise<RateLimitResult>;
|
|
656
|
+
checkUser(type: string, userId: string, identifier: string): Promise<RateLimitResult>;
|
|
657
|
+
reset(type: string, identifier: string): Promise<void>;
|
|
658
|
+
resetUser(type: string, userId: string, identifier: string): Promise<void>;
|
|
659
|
+
getStatus(type: string, identifier: string): Promise<{
|
|
660
|
+
count: number;
|
|
661
|
+
limit: number;
|
|
662
|
+
remaining: number;
|
|
663
|
+
resetAt: number;
|
|
664
|
+
}>;
|
|
665
|
+
setLimit(type: string, config: RateLimitConfig): void;
|
|
666
|
+
setUserLimit(type: string, config: RateLimitConfig): void;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
declare class InMemoryAccountLockout {
|
|
670
|
+
private storage;
|
|
671
|
+
private history;
|
|
672
|
+
private config;
|
|
673
|
+
constructor(config?: Partial<LockoutConfig>);
|
|
674
|
+
checkLockout(userId: string): Promise<LockoutStatus>;
|
|
675
|
+
recordFailedAttempt(userId: string): Promise<LockoutStatus>;
|
|
676
|
+
lockAccount(userId: string, duration?: number): Promise<void>;
|
|
677
|
+
unlockAccount(userId: string): Promise<void>;
|
|
678
|
+
resetAttempts(userId: string): Promise<void>;
|
|
679
|
+
getLockoutHistory(userId: string, limit?: number): Promise<Date[]>;
|
|
680
|
+
getLockoutStats(userId: string): Promise<{
|
|
681
|
+
totalFailedAttempts: number;
|
|
682
|
+
lockoutCount: number;
|
|
683
|
+
lastLockout: Date | null;
|
|
684
|
+
averageAttemptsBeforeLockout: number;
|
|
685
|
+
}>;
|
|
686
|
+
shouldNotifyAdmin(currentAttempts: number): boolean;
|
|
687
|
+
getConfig(): LockoutConfig;
|
|
688
|
+
setConfig(config: Partial<LockoutConfig>): void;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
declare class InMemoryAuditLogger {
|
|
692
|
+
private logs;
|
|
693
|
+
private retentionDays;
|
|
694
|
+
constructor(retentionDays?: number);
|
|
695
|
+
log(data: Omit<AuditLog, "id" | "timestamp">): Promise<string>;
|
|
696
|
+
get(id: string): Promise<AuditLog | null>;
|
|
697
|
+
query(filter?: AuditLogFilter): Promise<{
|
|
698
|
+
logs: AuditLog[];
|
|
699
|
+
total: number;
|
|
700
|
+
}>;
|
|
701
|
+
getRecent(limit?: number): Promise<AuditLog[]>;
|
|
702
|
+
getUserActivity(userId: string, limit?: number): Promise<AuditLog[]>;
|
|
703
|
+
getStats(startDate?: Date, endDate?: Date): Promise<{
|
|
704
|
+
totalEvents: number;
|
|
705
|
+
byAction: Record<string, number>;
|
|
706
|
+
successRate: number;
|
|
707
|
+
failedLogins: number;
|
|
708
|
+
uniqueUsers: Set<string>;
|
|
709
|
+
}>;
|
|
710
|
+
cleanup(): Promise<number>;
|
|
711
|
+
private cleanupOldLogs;
|
|
712
|
+
}
|
|
713
|
+
|
|
690
714
|
interface AuthRoutesConfig {
|
|
691
|
-
redis:
|
|
715
|
+
redis: AuthAdapter;
|
|
692
716
|
email?: EmailTransport;
|
|
693
717
|
jwtSecret: string;
|
|
694
718
|
jwtExpiresIn?: string;
|
|
695
719
|
jwtIssuer?: string;
|
|
696
720
|
jwtAudience?: string;
|
|
697
721
|
passwordPolicy?: PasswordPolicy;
|
|
698
|
-
lockout?:
|
|
699
|
-
rateLimiter?:
|
|
700
|
-
auditLogger?:
|
|
722
|
+
lockout?: InMemoryAccountLockout;
|
|
723
|
+
rateLimiter?: InMemoryRateLimiter;
|
|
724
|
+
auditLogger?: InMemoryAuditLogger;
|
|
701
725
|
baseUrl?: string;
|
|
702
726
|
emailVerificationRequired?: boolean;
|
|
703
727
|
}
|
|
704
728
|
declare class AuthRoutes {
|
|
705
|
-
private
|
|
729
|
+
private authAdapter;
|
|
706
730
|
private email?;
|
|
707
731
|
private jwtSecret;
|
|
708
732
|
private jwtExpiresIn;
|
|
@@ -730,19 +754,55 @@ declare class AuthRoutes {
|
|
|
730
754
|
private rateLimitResponse;
|
|
731
755
|
}
|
|
732
756
|
|
|
757
|
+
type DatabaseType = "sqlite" | "postgres" | "mysql" | "mongodb" | "memory";
|
|
733
758
|
interface KyroAuthConfig {
|
|
734
|
-
|
|
735
|
-
|
|
759
|
+
authAdapter: AuthAdapter;
|
|
760
|
+
databaseType?: string;
|
|
736
761
|
email?: EmailTransport;
|
|
737
762
|
passwordPolicy: PasswordPolicy;
|
|
738
|
-
lockout?:
|
|
739
|
-
rateLimiter?:
|
|
740
|
-
auditLogger?:
|
|
763
|
+
lockout?: InMemoryAccountLockout;
|
|
764
|
+
rateLimiter?: InMemoryRateLimiter;
|
|
765
|
+
auditLogger?: InMemoryAuditLogger;
|
|
741
766
|
routes: AuthRoutes;
|
|
742
767
|
}
|
|
743
|
-
declare function createAuthConfig(): Promise<KyroAuthConfig>;
|
|
768
|
+
declare function createAuthConfig(databaseType?: string): Promise<KyroAuthConfig>;
|
|
744
769
|
declare const authConfig: Promise<KyroAuthConfig>;
|
|
745
770
|
|
|
771
|
+
declare class InMemoryAuthAdapter implements AuthAdapter {
|
|
772
|
+
private users;
|
|
773
|
+
private sessions;
|
|
774
|
+
private refreshTokens;
|
|
775
|
+
private emailToUserId;
|
|
776
|
+
private passwordHistory;
|
|
777
|
+
private externalDb;
|
|
778
|
+
constructor();
|
|
779
|
+
connect(): Promise<void>;
|
|
780
|
+
disconnect(): Promise<void>;
|
|
781
|
+
createUser(data: {
|
|
782
|
+
email: string;
|
|
783
|
+
passwordHash: string;
|
|
784
|
+
role?: UserRole;
|
|
785
|
+
tenantId?: string;
|
|
786
|
+
}): Promise<AuthUser>;
|
|
787
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
788
|
+
findUserById(userId: string): Promise<AuthUser | null>;
|
|
789
|
+
updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
790
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
791
|
+
hashPassword(password: string): Promise<string>;
|
|
792
|
+
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
793
|
+
createSession(userId: string, data?: {
|
|
794
|
+
ipAddress?: string;
|
|
795
|
+
userAgent?: string;
|
|
796
|
+
}): Promise<Session>;
|
|
797
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
798
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
799
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
800
|
+
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
801
|
+
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
802
|
+
isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
803
|
+
hasAnyUsers(): Promise<boolean>;
|
|
804
|
+
}
|
|
805
|
+
|
|
746
806
|
declare class Auth {
|
|
747
807
|
private adapter;
|
|
748
808
|
private config;
|
|
@@ -763,6 +823,113 @@ declare class Auth {
|
|
|
763
823
|
}
|
|
764
824
|
declare function createAuth(adapter: AuthAdapter, config: AuthTokenConfig): Auth;
|
|
765
825
|
|
|
826
|
+
interface SQLiteAuthAdapterOptions {
|
|
827
|
+
path?: string;
|
|
828
|
+
db?: Database.Database;
|
|
829
|
+
saltRounds?: number;
|
|
830
|
+
busyTimeout?: number;
|
|
831
|
+
walAutoCheckpoint?: number;
|
|
832
|
+
cacheSize?: number;
|
|
833
|
+
mmapSize?: number;
|
|
834
|
+
}
|
|
835
|
+
declare class SQLiteAuthAdapter implements AuthAdapter {
|
|
836
|
+
private db;
|
|
837
|
+
private path;
|
|
838
|
+
private saltRounds;
|
|
839
|
+
private externalDb;
|
|
840
|
+
private busyTimeout;
|
|
841
|
+
private walAutoCheckpoint;
|
|
842
|
+
private cacheSize;
|
|
843
|
+
private mmapSize;
|
|
844
|
+
private preparedStatements;
|
|
845
|
+
constructor(options?: SQLiteAuthAdapterOptions);
|
|
846
|
+
connect(): Promise<void>;
|
|
847
|
+
disconnect(): Promise<void>;
|
|
848
|
+
private ensureTables;
|
|
849
|
+
private prepareStatements;
|
|
850
|
+
private stmt;
|
|
851
|
+
cleanupExpiredSessions(): Promise<number>;
|
|
852
|
+
cleanupOldAuditLogs(retentionDays?: number): Promise<number>;
|
|
853
|
+
getStats(): Promise<{
|
|
854
|
+
userCount: number;
|
|
855
|
+
activeSessionCount: number;
|
|
856
|
+
auditLogCount: number;
|
|
857
|
+
}>;
|
|
858
|
+
createUser(data: {
|
|
859
|
+
email: string;
|
|
860
|
+
passwordHash: string;
|
|
861
|
+
role?: UserRole;
|
|
862
|
+
tenantId?: string;
|
|
863
|
+
}): Promise<AuthUser>;
|
|
864
|
+
findUserByEmail(email: string): Promise<AuthUser | null>;
|
|
865
|
+
findUserById(userId: string): Promise<AuthUser | null>;
|
|
866
|
+
updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
|
|
867
|
+
deleteUser(userId: string): Promise<boolean>;
|
|
868
|
+
hashPassword(password: string): Promise<string>;
|
|
869
|
+
verifyPassword(password: string, hash: string): Promise<boolean>;
|
|
870
|
+
createSession(userId: string, data?: {
|
|
871
|
+
ipAddress?: string;
|
|
872
|
+
userAgent?: string;
|
|
873
|
+
}): Promise<Session>;
|
|
874
|
+
findSessionByToken(token: string): Promise<Session | null>;
|
|
875
|
+
findSessionByRefreshToken(refreshToken: string): Promise<Session | null>;
|
|
876
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
877
|
+
deleteUserSessions(userId: string): Promise<number>;
|
|
878
|
+
hasAnyUsers(): Promise<boolean>;
|
|
879
|
+
addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
|
|
880
|
+
getPasswordHistory(userId: string, count?: number): Promise<string[]>;
|
|
881
|
+
isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
|
|
882
|
+
recordFailedAttempt(userId: string): Promise<void>;
|
|
883
|
+
resetAttempts(userId: string): Promise<void>;
|
|
884
|
+
checkLockout(userId: string): Promise<{
|
|
885
|
+
locked: boolean;
|
|
886
|
+
attemptsRemaining: number;
|
|
887
|
+
lockedUntil?: Date;
|
|
888
|
+
totalAttempts: number;
|
|
889
|
+
}>;
|
|
890
|
+
logAudit(data: {
|
|
891
|
+
action: string;
|
|
892
|
+
userId?: string;
|
|
893
|
+
userEmail?: string;
|
|
894
|
+
role?: string;
|
|
895
|
+
resource: string;
|
|
896
|
+
resourceId?: string;
|
|
897
|
+
ipAddress?: string;
|
|
898
|
+
userAgent?: string;
|
|
899
|
+
success: boolean;
|
|
900
|
+
error?: string;
|
|
901
|
+
metadata?: Record<string, unknown>;
|
|
902
|
+
}): Promise<string>;
|
|
903
|
+
queryAuditLogs(options?: {
|
|
904
|
+
action?: string;
|
|
905
|
+
userId?: string;
|
|
906
|
+
resource?: string;
|
|
907
|
+
success?: boolean;
|
|
908
|
+
startDate?: Date;
|
|
909
|
+
endDate?: Date;
|
|
910
|
+
limit?: number;
|
|
911
|
+
offset?: number;
|
|
912
|
+
}): Promise<{
|
|
913
|
+
logs: Array<{
|
|
914
|
+
id: string;
|
|
915
|
+
timestamp: Date;
|
|
916
|
+
action: string;
|
|
917
|
+
userId?: string;
|
|
918
|
+
userEmail?: string;
|
|
919
|
+
resource: string;
|
|
920
|
+
resourceId?: string;
|
|
921
|
+
ipAddress?: string;
|
|
922
|
+
userAgent?: string;
|
|
923
|
+
success: boolean;
|
|
924
|
+
error?: string;
|
|
925
|
+
metadata?: Record<string, unknown>;
|
|
926
|
+
}>;
|
|
927
|
+
total: number;
|
|
928
|
+
}>;
|
|
929
|
+
private rowToUser;
|
|
930
|
+
private rowToSession;
|
|
931
|
+
}
|
|
932
|
+
|
|
766
933
|
type VersionStatus = 'draft' | 'published' | 'archived';
|
|
767
934
|
interface Version<T = Record<string, unknown>> {
|
|
768
935
|
id: string;
|
|
@@ -878,4 +1045,4 @@ declare function defineConfig(config: {
|
|
|
878
1045
|
debug?: KyroConfig["debug"];
|
|
879
1046
|
}): KyroConfig;
|
|
880
1047
|
|
|
881
|
-
export { AbstractBaseAdapter, AccountLockout, type AdapterOptions, type AdminStylingConfig, AnalyticsPlugin, type AuditAction, type AuditLog, type AuditLogFilter, AuditLogger, Auth, AuthAdapter, AuthResult, Session as AuthSession, AuthTokenConfig, AuthUser, BaseAdapter, CSSGenerator, CollectionConfig, CommentsPlugin, type CompareVersionsOptions, ConfigValidationError, CreateArgs, type CreateVersionOptions, type DatabaseConnectionOptions, type DatabaseType, DeleteArgs, type DraftPublishConfig, type DrizzleAdapterOptions, EmailTransport, Field, type FieldStyling, FindArgs, FindByIDArgs, FindResult, GlobalConfig, Hook, JWTPayload, Kyro, type KyroAuthConfig, KyroConfig, KyroPlugin, KyroPubSub, KyroWSServer, LocalAdapter, LoginCredentials, type MongoDBAdapterOptions, PasswordPolicy, type PluginAPI, type PluginHooks, PluginManager, type PublishVersionOptions, RateLimiter, RedisAuthAdapter, RegisterData, Registry, Request$1 as Request, ReviewsPlugin, SEOPLugin, SQLiteAuthAdapter, type StylingConfig, type StylingMode, type ThemeBorderRadius, type ThemeColors, type ThemeConfig, type ThemeFonts, type ThemeShadows, type ThemeSpacing, UpdateArgs, User, UserRole, type Version, type VersionAdapter, type VersionDiff, type VersionHistoryOptions, VersionManager, type VersionPublishSchedule, type VersionStatus, WishlistPlugin, authConfig, autoBootstrap, bootstrapAdmin, collectionToCreateZod, collectionToUpdateZod, collectionToWhereZod, collectionToZod, createAdminStyling, createAuditContext, createAuth, createAuthConfig, createKyro, createLocalAdapter, createVersionManager, defaultDarkTheme, defaultFieldStyling, defaultLightTheme, defineConfig, ecommerce2026Theme, fieldToZod, generateCSSVariables, generateTailwindConfig, getBootstrapFromEnv, getDefaultDraftPublishConfig, globalToZod, isArchived, isDraft, isPublished, presetPlugins, validateCollection, validateConfig, validateFields, validateGlobal };
|
|
1048
|
+
export { AbstractBaseAdapter, AccountLockout, type AdapterOptions, type AdminStylingConfig, AnalyticsPlugin, type AuditAction, type AuditLog, type AuditLogFilter, AuditLogger, Auth, AuthAdapter, AuthResult, Session as AuthSession, AuthTokenConfig, AuthUser, BaseAdapter, CSSGenerator, CollectionConfig, CommentsPlugin, type CompareVersionsOptions, ConfigValidationError, CreateArgs, type CreateVersionOptions, type DatabaseConnectionOptions, type DatabaseType, type DatabaseType$1 as DbAdapterType, DeleteArgs, type DraftPublishConfig, type DrizzleAdapterOptions, EmailTransport, Field, type FieldStyling, FindArgs, FindByIDArgs, FindResult, GlobalConfig, Hook, InMemoryAccountLockout, InMemoryAuditLogger, InMemoryAuthAdapter, InMemoryRateLimiter, JWTPayload, Kyro, type KyroAuthConfig, KyroConfig, KyroPlugin, KyroPubSub, KyroWSServer, LocalAdapter, LoginCredentials, type MongoDBAdapterOptions, PasswordPolicy, type PluginAPI, type PluginHooks, PluginManager, type PublishVersionOptions, RateLimiter, RedisAuthAdapter, RegisterData, Registry, Request$1 as Request, ReviewsPlugin, SEOPLugin, SQLiteAuthAdapter, type StylingConfig, type StylingMode, type ThemeBorderRadius, type ThemeColors, type ThemeConfig, type ThemeFonts, type ThemeShadows, type ThemeSpacing, UpdateArgs, User, UserRole, type Version, type VersionAdapter, type VersionDiff, type VersionHistoryOptions, VersionManager, type VersionPublishSchedule, type VersionStatus, WishlistPlugin, authConfig, autoBootstrap, bootstrapAdmin, collectionToCreateZod, collectionToUpdateZod, collectionToWhereZod, collectionToZod, createAdminStyling, createAuditContext, createAuth, createAuthConfig, createKyro, createLocalAdapter, createVersionManager, defaultDarkTheme, defaultFieldStyling, defaultLightTheme, defineConfig, ecommerce2026Theme, fieldToZod, generateCSSVariables, generateTailwindConfig, getBootstrapFromEnv, getDefaultDraftPublishConfig, globalToZod, isArchived, isDraft, isPublished, presetPlugins, validateCollection, validateConfig, validateFields, validateGlobal };
|