@kyro-cms/core 0.1.1 → 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.
Files changed (74) hide show
  1. package/README.md +196 -109
  2. package/dist/bootstrap-2WJK6PG7.cjs +29 -0
  3. package/dist/bootstrap-2WJK6PG7.cjs.map +1 -0
  4. package/dist/bootstrap-Q2TWUQF3.js +4 -0
  5. package/dist/bootstrap-Q2TWUQF3.js.map +1 -0
  6. package/dist/chunk-3QX6KG2S.js +2125 -0
  7. package/dist/chunk-3QX6KG2S.js.map +1 -0
  8. package/dist/chunk-5AOILNGY.cjs +212 -0
  9. package/dist/chunk-5AOILNGY.cjs.map +1 -0
  10. package/dist/{chunk-DKSMFC3L.js → chunk-EINVJPFM.js} +2 -2
  11. package/dist/{chunk-DKSMFC3L.js.map → chunk-EINVJPFM.js.map} +1 -1
  12. package/dist/chunk-F5B64H5S.cjs +2149 -0
  13. package/dist/chunk-F5B64H5S.cjs.map +1 -0
  14. package/dist/chunk-I4BORBXT.cjs +914 -0
  15. package/dist/chunk-I4BORBXT.cjs.map +1 -0
  16. package/dist/chunk-KA3UOIFC.js +206 -0
  17. package/dist/chunk-KA3UOIFC.js.map +1 -0
  18. package/dist/chunk-KWTKEBHM.cjs +176 -0
  19. package/dist/chunk-KWTKEBHM.cjs.map +1 -0
  20. package/dist/chunk-M4JFHQ5J.js +170 -0
  21. package/dist/chunk-M4JFHQ5J.js.map +1 -0
  22. package/dist/chunk-PZ5AY32C.js +9 -0
  23. package/dist/chunk-PZ5AY32C.js.map +1 -0
  24. package/dist/chunk-Q7SFCCGT.cjs +11 -0
  25. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  26. package/dist/chunk-U4CHJTWX.cjs +94 -0
  27. package/dist/chunk-U4CHJTWX.cjs.map +1 -0
  28. package/dist/{chunk-3Q3FS5J4.cjs → chunk-V3B25QOK.cjs} +2 -2
  29. package/dist/{chunk-3Q3FS5J4.cjs.map → chunk-V3B25QOK.cjs.map} +1 -1
  30. package/dist/chunk-V67YXRBT.js +899 -0
  31. package/dist/chunk-V67YXRBT.js.map +1 -0
  32. package/dist/chunk-XLMVCGXA.js +86 -0
  33. package/dist/chunk-XLMVCGXA.js.map +1 -0
  34. package/dist/cli/index.cjs +106 -14
  35. package/dist/cli/index.cjs.map +1 -1
  36. package/dist/cli/index.js +106 -14
  37. package/dist/cli/index.js.map +1 -1
  38. package/dist/database-37KXWUER.js +5 -0
  39. package/dist/database-37KXWUER.js.map +1 -0
  40. package/dist/database-LJKD3HE4.cjs +22 -0
  41. package/dist/database-LJKD3HE4.cjs.map +1 -0
  42. package/dist/drizzle/index.cjs +25 -5
  43. package/dist/drizzle/index.d.cts +5 -49
  44. package/dist/drizzle/index.d.ts +5 -49
  45. package/dist/drizzle/index.js +5 -1
  46. package/dist/graphql/index.cjs +1 -0
  47. package/dist/graphql/index.js +1 -0
  48. package/dist/index-BVFlb7uU.d.ts +192 -0
  49. package/dist/index-CzkEHKqu.d.cts +192 -0
  50. package/dist/index.cjs +1203 -23
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +382 -68
  53. package/dist/index.d.ts +382 -68
  54. package/dist/index.js +1110 -20
  55. package/dist/index.js.map +1 -1
  56. package/dist/mongodb/index.cjs +1 -0
  57. package/dist/mongodb/index.js +1 -0
  58. package/dist/postgres-auth-adapter-CYZAVPPP.cjs +14 -0
  59. package/dist/postgres-auth-adapter-CYZAVPPP.cjs.map +1 -0
  60. package/dist/postgres-auth-adapter-LTDUGBMB.js +5 -0
  61. package/dist/postgres-auth-adapter-LTDUGBMB.js.map +1 -0
  62. package/dist/rest/index.cjs +1 -0
  63. package/dist/rest/index.js +1 -0
  64. package/dist/templates/index.cjs +94 -536
  65. package/dist/templates/index.cjs.map +1 -1
  66. package/dist/templates/index.d.cts +45 -1
  67. package/dist/templates/index.d.ts +45 -1
  68. package/dist/templates/index.js +2 -535
  69. package/dist/templates/index.js.map +1 -1
  70. package/dist/trpc/index.cjs +1 -0
  71. package/dist/trpc/index.js +1 -0
  72. package/dist/ws/index.cjs +1 -0
  73. package/dist/ws/index.js +1 -0
  74. package/package.json +23 -8
package/dist/index.d.cts CHANGED
@@ -5,18 +5,24 @@ import * as hono from 'hono';
5
5
  import * as hono_types from 'hono/types';
6
6
  import { R as Registry } from './index-DI0DRPNv.cjs';
7
7
  export { c as createRegistry, g as getRegistry, r as resetRegistry } from './index-DI0DRPNv.cjs';
8
- import { B as BaseAdapter, K as KyroConfig, f as User, g as Request, C as CollectionConfig, G as GlobalConfig, F as Field, a as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs, H as Hook } from './types-BGM5MV_K.cjs';
8
+ import { B as BaseAdapter, K as KyroConfig, f as User, g as Request$1, C as CollectionConfig, G as GlobalConfig, F as Field, a as FindArgs, b as FindResult, c as FindByIDArgs, d as CreateArgs, U as UpdateArgs, D as DeleteArgs, H as Hook } from './types-BGM5MV_K.cjs';
9
9
  export { A as ALL_FIELD_TYPES, h as AccessArgs, i as AccessControl, j as AdapterConfig, k as AdminConfig, l as ArrayField, m as AuthConfig, n as BaseField, o as Block, p as BlocksField, q as COMPLEX_FIELD_TYPES, r as CheckboxField, s as CodeField, t as CollapsibleField, u as CollectionAccess, v as CollectionHooks, w as ColorField, x as CreateResult, y as DateField, E as EmailField, z as FieldAccess, I as FieldAdmin, J as FieldHooks, L as FieldType, M as GlobalAccess, N as GlobalHooks, O as GroupField, Q as HookArgs, S as ImageSize, T as JSONField, V as LAYOUT_FIELD_TYPES, W as MarkdownField, X as NumberField, Y as PRIMITIVE_FIELD_TYPES, Z as PasswordField, P as PluginConfig, _ as RELATIONAL_FIELD_TYPES, $ as RadioField, R as RelationshipField, a0 as RichTextBlock, a1 as RichTextField, a2 as RowField, a3 as SelectField, a4 as TabsField, a5 as TextField, a6 as TextareaField, a7 as UploadConfig, e as UploadField, a8 as ValidateOptions, a9 as VersionConfig, aa as WhereClause, ab as evaluateAccess, ac as getWhereClause, ad as isArrayField, ae as isBlocksField, af as isGroupField, ag as isLayoutField, ah as isNumberField, ai as isRelationshipField, aj as isRichTextField, ak as isSelectField, al as isTextField, am as isUploadField, an as mergeWhereClauses, ao as runFieldHooks, ap as runHooks } from './types-BGM5MV_K.cjs';
10
10
  import { KyroPubSub, KyroWSServer } from './ws/index.cjs';
11
11
  export { PubSub, createWSServer } from './ws/index.cjs';
12
12
  import { ZodTypeAny } from 'zod';
13
13
  export { z } from 'zod';
14
14
  import { A as AbstractBaseAdapter } from './base-DlhVlwnN.cjs';
15
- export { DrizzleAdapter, collectionToDrizzleSchema, createDrizzleAdapter, fieldToDrizzleType } from './drizzle/index.cjs';
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-CzkEHKqu.cjs';
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-CzkEHKqu.cjs';
16
17
  export { MongoDBAdapter, createMongoDBAdapter } from './mongodb/index.cjs';
17
18
  export { buildGraphQLSchema, createGraphQLSchema } from './graphql/index.cjs';
18
19
  export { createHonoApp, createRESTAPI } from './rest/index.cjs';
20
+ export { TemplateConfig, allSettingsGlobals, blogCollections, blogGlobals, coreSettingsGlobals, createTemplateConfig, ecommerceCollections, ecommerceGlobals, ecommerceSettingsGlobals, kitchenSinkCollections, mediaCollections, minimalCollections } from './templates/index.cjs';
21
+ import Redis from 'ioredis';
22
+ import { SentMessageInfo } from 'nodemailer';
19
23
  import 'ws';
24
+ import 'drizzle-orm/postgres-js';
25
+ import 'postgres';
20
26
 
21
27
  declare class Kyro {
22
28
  registry: Registry;
@@ -28,17 +34,17 @@ declare class Kyro {
28
34
  init(): Promise<void>;
29
35
  getREST(options?: {
30
36
  user?: User;
31
- req?: Request;
37
+ req?: Request$1;
32
38
  tenantID?: string;
33
39
  }): hono.Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
34
40
  getGraphQL(options?: {
35
41
  user?: User;
36
- req?: Request;
42
+ req?: Request$1;
37
43
  tenantID?: string;
38
44
  }): graphql.GraphQLSchema;
39
45
  getTRPC(options?: {
40
46
  user?: User;
41
- req?: Request;
47
+ req?: Request$1;
42
48
  tenantID?: string;
43
49
  }): KyroRouter;
44
50
  startWebSocket(options?: {
@@ -95,6 +101,7 @@ type AdapterOptions = DrizzleAdapterOptions | MongoDBAdapterOptions;
95
101
 
96
102
  declare class LocalAdapter extends AbstractBaseAdapter {
97
103
  private db;
104
+ private path?;
98
105
  private migrations;
99
106
  constructor(options: {
100
107
  db?: any;
@@ -332,77 +339,368 @@ interface FieldStyling {
332
339
  }
333
340
  declare const defaultFieldStyling: Record<string, FieldStyling>;
334
341
 
335
- interface AuthUser {
336
- id: string;
337
- email: string;
338
- passwordHash?: string;
339
- role: UserRole;
340
- tenant?: string;
341
- createdAt: Date;
342
- updatedAt: Date;
343
- }
344
- type UserRole = 'admin' | 'editor' | 'author' | 'customer' | 'vendor';
345
- interface Session {
346
- id: string;
347
- userId: string;
348
- token: string;
349
- expiresAt: Date;
350
- createdAt: Date;
351
- ipAddress?: string;
352
- userAgent?: string;
353
- }
354
- interface JWTPayload {
355
- sub: string;
356
- email: string;
357
- role: UserRole;
358
- tenant?: string;
359
- iat: number;
360
- exp: number;
361
- }
362
- interface AuthTokenConfig {
363
- secret: string;
364
- expiresIn?: string | number;
365
- refreshExpiresIn?: string | number;
366
- issuer?: string;
367
- audience?: string[];
368
- saltRounds?: number;
369
- }
370
- interface LoginCredentials {
371
- email: string;
372
- password: string;
373
- }
374
- interface RegisterData {
375
- email: string;
376
- password: string;
377
- role?: UserRole;
378
- tenant?: string;
379
- }
380
- interface AuthResult {
381
- success: boolean;
382
- user?: AuthUser;
383
- session?: Session;
384
- token?: string;
385
- error?: string;
386
- }
387
- interface AuthAdapter {
342
+ interface RedisAuthAdapterOptions {
343
+ url?: string;
344
+ host?: string;
345
+ port?: number;
346
+ password?: string;
347
+ db?: number;
348
+ keyPrefix?: string;
349
+ tokenExpiration?: number;
350
+ refreshTokenExpiration?: number;
351
+ tls?: boolean;
352
+ }
353
+ declare class RedisAuthAdapter implements AuthAdapter {
354
+ private redis;
355
+ private prefix;
356
+ private tokenExpiration;
357
+ private refreshExpiration;
358
+ constructor(options?: RedisAuthAdapterOptions);
359
+ connect(): Promise<void>;
360
+ disconnect(): Promise<void>;
361
+ private userKey;
362
+ private sessionKey;
363
+ private refreshKey;
364
+ private userByEmailKey;
365
+ private passwordHistoryKey;
388
366
  createUser(data: {
389
367
  email: string;
390
368
  passwordHash: string;
391
- role: UserRole;
392
- tenant?: string;
369
+ role?: UserRole;
370
+ tenantId?: string;
393
371
  }): Promise<AuthUser>;
394
372
  findUserByEmail(email: string): Promise<AuthUser | null>;
395
- findUserById(id: string): Promise<AuthUser | null>;
396
- updateUser(id: string, data: Partial<AuthUser>): Promise<AuthUser>;
397
- deleteUser(id: string): Promise<void>;
398
- verifyPassword(password: string, hash: string): Promise<boolean>;
373
+ findUserById(userId: string): Promise<AuthUser | null>;
374
+ updateUser(userId: string, data: Partial<AuthUser>): Promise<AuthUser | null>;
375
+ deleteUser(userId: string): Promise<boolean>;
399
376
  hashPassword(password: string): Promise<string>;
400
- createSession(userId: string, token: string, expiresAt: Date): Promise<Session>;
377
+ verifyPassword(password: string, hash: string): Promise<boolean>;
378
+ createSession(userId: string, data?: {
379
+ ipAddress?: string;
380
+ userAgent?: string;
381
+ }): Promise<Session>;
401
382
  findSessionByToken(token: string): Promise<Session | null>;
402
- deleteSession(token: string): Promise<void>;
403
- deleteUserSessions(userId: string): Promise<void>;
383
+ deleteSession(sessionId: string): Promise<boolean>;
384
+ deleteUserSessions(userId: string): Promise<number>;
385
+ addPasswordToHistory(userId: string, passwordHash: string): Promise<void>;
386
+ getPasswordHistory(userId: string, count?: number): Promise<string[]>;
387
+ isPasswordInHistory(password: string, userId: string, historyCount?: number): Promise<boolean>;
388
+ private userToHash;
389
+ private hashToUser;
390
+ private sessionToHash;
391
+ private hashToSession;
392
+ }
393
+
394
+ interface EmailConfig {
395
+ host: string;
396
+ port: number;
397
+ secure: boolean;
398
+ auth: {
399
+ user: string;
400
+ pass: string;
401
+ };
402
+ from: string;
403
+ fromName?: string;
404
+ }
405
+ interface EmailOptions {
406
+ to: string | string[];
407
+ subject: string;
408
+ html: string;
409
+ text?: string;
410
+ }
411
+ interface EmailTemplates {
412
+ verifyEmail: (link: string, userName?: string) => {
413
+ subject: string;
414
+ html: string;
415
+ text: string;
416
+ };
417
+ resetPassword: (link: string, userName?: string) => {
418
+ subject: string;
419
+ html: string;
420
+ text: string;
421
+ };
422
+ welcome: (userName?: string) => {
423
+ subject: string;
424
+ html: string;
425
+ text: string;
426
+ };
427
+ accountLocked: (attempts: number, duration: number, userName?: string) => {
428
+ subject: string;
429
+ html: string;
430
+ text: string;
431
+ };
432
+ passwordChanged: (userName?: string) => {
433
+ subject: string;
434
+ html: string;
435
+ text: string;
436
+ };
437
+ newLogin: (location: string, time: string, userName?: string) => {
438
+ subject: string;
439
+ html: string;
440
+ text: string;
441
+ };
442
+ }
443
+ declare class EmailTransport {
444
+ private transporter;
445
+ private from;
446
+ private fromName;
447
+ private templates;
448
+ constructor(config: EmailConfig, templates?: Partial<EmailTemplates>);
449
+ send(options: EmailOptions): Promise<SentMessageInfo>;
450
+ getTemplates(): EmailTemplates;
451
+ verifyConnection(): Promise<boolean>;
452
+ static fromEnv(): EmailTransport | null;
404
453
  }
405
454
 
455
+ interface BootstrapConfig {
456
+ redisUrl?: string;
457
+ redisHost?: string;
458
+ redisPort?: number;
459
+ redisPassword?: string;
460
+ authAdapter?: AuthAdapter;
461
+ adminEmail: string;
462
+ adminPassword: string;
463
+ adminRole?: string;
464
+ tenantId?: string;
465
+ emailConfig?: {
466
+ host: string;
467
+ port: number;
468
+ secure: boolean;
469
+ auth: {
470
+ user: string;
471
+ pass: string;
472
+ };
473
+ from: string;
474
+ fromName?: string;
475
+ };
476
+ sendWelcomeEmail?: boolean;
477
+ }
478
+ interface BootstrapResult {
479
+ success: boolean;
480
+ user?: AuthUser;
481
+ error?: string;
482
+ }
483
+ declare function bootstrapAdmin(config: BootstrapConfig): Promise<BootstrapResult>;
484
+ declare function getBootstrapFromEnv(): BootstrapConfig | null;
485
+ declare function autoBootstrap(): Promise<BootstrapResult | null>;
486
+
487
+ interface PasswordPolicyConfig {
488
+ minLength: number;
489
+ requireUppercase: boolean;
490
+ requireLowercase: boolean;
491
+ requireNumbers: boolean;
492
+ requireSpecialChars: boolean;
493
+ preventReuse: number;
494
+ maxLength?: number;
495
+ }
496
+ interface ValidationResult {
497
+ valid: boolean;
498
+ errors: string[];
499
+ }
500
+ declare class PasswordPolicy {
501
+ private config;
502
+ constructor(config?: Partial<PasswordPolicyConfig>);
503
+ validate(password: string): ValidationResult;
504
+ checkReuse(passwordHash: string, history: string[], verifyFn: (password: string, hash: string) => Promise<boolean>): Promise<ValidationResult>;
505
+ isInHistory(password: string, history: string[], verifyFn: (password: string, hash: string) => Promise<boolean>): Promise<boolean>;
506
+ generatePassword(length?: number): string;
507
+ getStrength(password: string): {
508
+ score: number;
509
+ label: string;
510
+ feedback: string[];
511
+ };
512
+ setConfig(config: Partial<PasswordPolicyConfig>): void;
513
+ getConfig(): PasswordPolicyConfig;
514
+ }
515
+
516
+ interface LockoutConfig {
517
+ maxAttempts: number;
518
+ lockDuration: number;
519
+ notifyUser: boolean;
520
+ notifyAdmin: boolean;
521
+ adminNotifyAfter: number;
522
+ }
523
+ interface LockoutStatus {
524
+ locked: boolean;
525
+ attemptsRemaining: number;
526
+ lockedUntil?: Date;
527
+ totalAttempts: number;
528
+ }
529
+ declare class AccountLockout {
530
+ private redis;
531
+ private prefix;
532
+ private config;
533
+ constructor(redis: Redis, config?: Partial<LockoutConfig>, prefix?: string);
534
+ private lockKey;
535
+ private historyKey;
536
+ checkLockout(userId: string): Promise<LockoutStatus>;
537
+ recordFailedAttempt(userId: string): Promise<LockoutStatus>;
538
+ lockAccount(userId: string, duration?: number): Promise<void>;
539
+ unlockAccount(userId: string): Promise<void>;
540
+ resetAttempts(userId: string): Promise<void>;
541
+ getLockoutHistory(userId: string, limit?: number): Promise<Date[]>;
542
+ getLockoutStats(userId: string): Promise<{
543
+ totalFailedAttempts: number;
544
+ lockoutCount: number;
545
+ lastLockout: Date | null;
546
+ averageAttemptsBeforeLockout: number;
547
+ }>;
548
+ shouldNotifyAdmin(currentAttempts: number): boolean;
549
+ getConfig(): LockoutConfig;
550
+ setConfig(config: Partial<LockoutConfig>): void;
551
+ }
552
+
553
+ interface RateLimitConfig {
554
+ window: number;
555
+ max: number;
556
+ }
557
+ interface RateLimitResult {
558
+ allowed: boolean;
559
+ remaining: number;
560
+ resetAt: number;
561
+ retryAfter?: number;
562
+ }
563
+ declare class RateLimiter {
564
+ private redis;
565
+ private prefix;
566
+ private limits;
567
+ private userLimits;
568
+ constructor(redis: Redis, limits?: Record<string, RateLimitConfig>, userLimits?: Record<string, RateLimitConfig>, prefix?: string);
569
+ private getKey;
570
+ check(type: string, identifier: string): Promise<RateLimitResult>;
571
+ checkUser(type: string, userId: string, identifier: string): Promise<RateLimitResult>;
572
+ reset(type: string, identifier: string): Promise<void>;
573
+ resetUser(type: string, userId: string, identifier: string): Promise<void>;
574
+ getStatus(type: string, identifier: string): Promise<{
575
+ count: number;
576
+ limit: number;
577
+ remaining: number;
578
+ resetAt: number;
579
+ }>;
580
+ setLimit(type: string, config: RateLimitConfig): void;
581
+ setUserLimit(type: string, config: RateLimitConfig): void;
582
+ }
583
+
584
+ 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";
585
+ interface AuditLog {
586
+ id: string;
587
+ timestamp: Date;
588
+ action: AuditAction;
589
+ userId?: string;
590
+ userEmail?: string;
591
+ role?: string;
592
+ resource: string;
593
+ resourceId?: string;
594
+ changes?: {
595
+ field: string;
596
+ old: any;
597
+ new: any;
598
+ }[];
599
+ ipAddress?: string;
600
+ userAgent?: string;
601
+ success: boolean;
602
+ error?: string;
603
+ metadata?: Record<string, any>;
604
+ }
605
+ interface AuditLogFilter {
606
+ userId?: string;
607
+ action?: AuditAction | AuditAction[];
608
+ resource?: string;
609
+ resourceId?: string;
610
+ success?: boolean;
611
+ startDate?: Date;
612
+ endDate?: Date;
613
+ limit?: number;
614
+ offset?: number;
615
+ }
616
+ declare class AuditLogger {
617
+ private redis;
618
+ private prefix;
619
+ private retentionDays;
620
+ constructor(redis: Redis, retentionDays?: number, prefix?: string);
621
+ log(data: Omit<AuditLog, "id" | "timestamp">): Promise<string>;
622
+ get(id: string): Promise<AuditLog | null>;
623
+ query(filter?: AuditLogFilter): Promise<{
624
+ logs: AuditLog[];
625
+ total: number;
626
+ }>;
627
+ getRecent(limit?: number): Promise<AuditLog[]>;
628
+ getUserActivity(userId: string, limit?: number): Promise<AuditLog[]>;
629
+ getStats(startDate?: Date, endDate?: Date): Promise<{
630
+ totalEvents: number;
631
+ byAction: Record<string, number>;
632
+ successRate: number;
633
+ failedLogins: number;
634
+ uniqueUsers: Set<string>;
635
+ }>;
636
+ cleanup(): Promise<number>;
637
+ private getKeyForDate;
638
+ private getKeysForDateRange;
639
+ private matchesFilter;
640
+ private serializeLog;
641
+ private deserializeLog;
642
+ }
643
+ declare function createAuditContext(req: Request): {
644
+ ipAddress: string;
645
+ userAgent: string;
646
+ };
647
+
648
+ interface AuthRoutesConfig {
649
+ redis: RedisAuthAdapter;
650
+ email?: EmailTransport;
651
+ jwtSecret: string;
652
+ jwtExpiresIn?: string;
653
+ jwtIssuer?: string;
654
+ jwtAudience?: string;
655
+ passwordPolicy?: PasswordPolicy;
656
+ lockout?: AccountLockout;
657
+ rateLimiter?: RateLimiter;
658
+ auditLogger?: AuditLogger;
659
+ baseUrl?: string;
660
+ emailVerificationRequired?: boolean;
661
+ }
662
+ declare class AuthRoutes {
663
+ private redis;
664
+ private email?;
665
+ private jwtSecret;
666
+ private jwtExpiresIn;
667
+ private jwtIssuer?;
668
+ private jwtAudience?;
669
+ private passwordPolicy;
670
+ private lockout?;
671
+ private rateLimiter?;
672
+ private auditLogger?;
673
+ private baseUrl;
674
+ private emailVerificationRequired;
675
+ constructor(config: AuthRoutesConfig);
676
+ register(req: Request): Promise<Response>;
677
+ login(req: Request): Promise<Response>;
678
+ logout(req: Request): Promise<Response>;
679
+ refresh(req: Request): Promise<Response>;
680
+ me(req: Request): Promise<Response>;
681
+ changePassword(req: Request): Promise<Response>;
682
+ forgotPassword(req: Request): Promise<Response>;
683
+ verifyEmail(req: Request): Promise<Response>;
684
+ private recordFailedLogin;
685
+ private sanitizeUser;
686
+ private jsonResponse;
687
+ private errorResponse;
688
+ private rateLimitResponse;
689
+ }
690
+
691
+ interface KyroAuthConfig {
692
+ redis: RedisAuthAdapter;
693
+ redisClient: Redis;
694
+ email?: EmailTransport;
695
+ passwordPolicy: PasswordPolicy;
696
+ lockout?: AccountLockout;
697
+ rateLimiter?: RateLimiter;
698
+ auditLogger?: AuditLogger;
699
+ routes: AuthRoutes;
700
+ }
701
+ declare function createAuthConfig(): Promise<KyroAuthConfig>;
702
+ declare const authConfig: Promise<KyroAuthConfig>;
703
+
406
704
  declare class Auth {
407
705
  private adapter;
408
706
  private config;
@@ -522,4 +820,20 @@ declare function isPublished(status: VersionStatus): boolean;
522
820
  declare function isDraft(status: VersionStatus): boolean;
523
821
  declare function isArchived(status: VersionStatus): boolean;
524
822
 
525
- export { AbstractBaseAdapter, type AdapterOptions, type AdminStylingConfig, AnalyticsPlugin, Auth, type AuthAdapter, type AuthResult, type Session as AuthSession, type AuthTokenConfig, type AuthUser, BaseAdapter, CSSGenerator, CollectionConfig, CommentsPlugin, type CompareVersionsOptions, ConfigValidationError, CreateArgs, type CreateVersionOptions, type DatabaseConnectionOptions, type DatabaseType, DeleteArgs, type DraftPublishConfig, type DrizzleAdapterOptions, Field, type FieldStyling, FindArgs, FindByIDArgs, FindResult, GlobalConfig, Hook, type JWTPayload, Kyro, KyroConfig, KyroPlugin, KyroPubSub, KyroWSServer, LocalAdapter, type LoginCredentials, type MongoDBAdapterOptions, type PluginAPI, type PluginHooks, PluginManager, type PublishVersionOptions, type RegisterData, Registry, Request, ReviewsPlugin, SEOPLugin, type StylingConfig, type StylingMode, type ThemeBorderRadius, type ThemeColors, type ThemeConfig, type ThemeFonts, type ThemeShadows, type ThemeSpacing, UpdateArgs, User, type UserRole, type Version, type VersionAdapter, type VersionDiff, type VersionHistoryOptions, VersionManager, type VersionPublishSchedule, type VersionStatus, WishlistPlugin, collectionToCreateZod, collectionToUpdateZod, collectionToWhereZod, collectionToZod, createAdminStyling, createAuth, createKyro, createLocalAdapter, createVersionManager, defaultDarkTheme, defaultFieldStyling, defaultLightTheme, ecommerce2026Theme, fieldToZod, generateCSSVariables, generateTailwindConfig, getDefaultDraftPublishConfig, globalToZod, isArchived, isDraft, isPublished, presetPlugins, validateCollection, validateConfig, validateFields, validateGlobal };
823
+ declare function defineConfig(config: {
824
+ collections?: CollectionConfig[] | Record<string, CollectionConfig>;
825
+ globals?: GlobalConfig[] | Record<string, GlobalConfig>;
826
+ adapter: KyroConfig["adapter"];
827
+ plugins?: KyroConfig["plugins"];
828
+ auth?: KyroConfig["auth"];
829
+ cors?: KyroConfig["cors"];
830
+ admin?: KyroConfig["admin"];
831
+ upload?: KyroConfig["upload"];
832
+ graphQL?: KyroConfig["graphQL"];
833
+ typescript?: KyroConfig["typescript"];
834
+ localization?: KyroConfig["localization"];
835
+ rateLimit?: KyroConfig["rateLimit"];
836
+ debug?: KyroConfig["debug"];
837
+ }): KyroConfig;
838
+
839
+ 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, 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 };