@holo-js/config 0.1.4 → 0.1.6

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/index.d.ts CHANGED
@@ -1,3 +1,59 @@
1
+ interface HoloConfigRegistry {
2
+ app: NormalizedHoloAppConfig;
3
+ database: NormalizedHoloDatabaseConfig;
4
+ redis: NormalizedHoloRedisConfig;
5
+ cache: NormalizedHoloCacheConfig;
6
+ cors: NormalizedHoloCorsConfig;
7
+ storage: NormalizedHoloStorageConfig;
8
+ queue: NormalizedHoloQueueConfig;
9
+ broadcast: NormalizedHoloBroadcastConfig;
10
+ mail: NormalizedHoloMailConfig;
11
+ notifications: NormalizedHoloNotificationsConfig;
12
+ media: HoloMediaConfig;
13
+ session: NormalizedHoloSessionConfig;
14
+ security: NormalizedHoloSecurityConfig;
15
+ auth: NormalizedHoloAuthConfig;
16
+ }
17
+ type HoloConfigMap = object;
18
+ interface LoadedEnvironment {
19
+ readonly name: HoloAppEnv;
20
+ readonly values: Readonly<Record<string, string>>;
21
+ readonly loadedFiles: readonly string[];
22
+ readonly warnings: readonly string[];
23
+ }
24
+ interface LoadedHoloConfig<TCustom extends HoloConfigMap = HoloConfigMap> {
25
+ readonly app: NormalizedHoloAppConfig;
26
+ readonly database: NormalizedHoloDatabaseConfig;
27
+ readonly redis: NormalizedHoloRedisConfig;
28
+ readonly cache: NormalizedHoloCacheConfig;
29
+ readonly cors: NormalizedHoloCorsConfig;
30
+ readonly storage: NormalizedHoloStorageConfig;
31
+ readonly queue: NormalizedHoloQueueConfig;
32
+ readonly broadcast: NormalizedHoloBroadcastConfig;
33
+ readonly notifications: NormalizedHoloNotificationsConfig;
34
+ readonly mail: NormalizedHoloMailConfig;
35
+ readonly media: HoloMediaConfig;
36
+ readonly session: NormalizedHoloSessionConfig;
37
+ readonly security: NormalizedHoloSecurityConfig;
38
+ readonly auth: NormalizedHoloAuthConfig;
39
+ readonly custom: Readonly<TCustom>;
40
+ readonly all: Readonly<HoloConfigRegistry & TCustom>;
41
+ readonly environment: LoadedEnvironment;
42
+ readonly loadedFiles: readonly string[];
43
+ readonly warnings: readonly string[];
44
+ }
45
+ type ConfigFileName = keyof HoloConfigRegistry | (string & {});
46
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
47
+ type NonTraversable = Primitive | readonly unknown[] | ((...args: never[]) => unknown);
48
+ type KnownPathKey<T> = Extract<{
49
+ [K in keyof T & string]: K extends `${number}` ? never : [T[K]] extends [undefined] ? never : K;
50
+ }[keyof T & string], string>;
51
+ type DotPath<T> = T extends NonTraversable ? never : {
52
+ [K in KnownPathKey<T>]: T[K] extends NonTraversable ? K : K | `${K}.${DotPath<T[K]>}`;
53
+ }[KnownPathKey<T>];
54
+ type ValueAtPath<T, TPath extends string> = TPath extends `${infer THead}.${infer TTail}` ? THead extends keyof T ? ValueAtPath<T[THead], TTail> : never : TPath extends keyof T ? T[TPath] : never;
55
+ type DefineConfigValue<TConfig extends object> = Readonly<TConfig>;
56
+
1
57
  interface HoloProjectPaths {
2
58
  models: string;
3
59
  migrations: string;
@@ -363,6 +419,24 @@ interface NormalizedHoloSessionConfig {
363
419
  readonly absoluteLifetime: number;
364
420
  readonly rememberMeLifetime: number;
365
421
  }
422
+ interface HoloCorsConfig {
423
+ readonly paths?: readonly string[];
424
+ readonly origins?: readonly string[];
425
+ readonly methods?: readonly string[];
426
+ readonly headers?: readonly string[];
427
+ readonly credentials?: boolean;
428
+ readonly maxAge?: number | string;
429
+ readonly statefulDomains?: readonly string[];
430
+ }
431
+ interface NormalizedHoloCorsConfig {
432
+ readonly paths: readonly string[];
433
+ readonly origins: readonly string[];
434
+ readonly methods: readonly string[];
435
+ readonly headers: readonly string[];
436
+ readonly credentials: boolean;
437
+ readonly maxAge: number;
438
+ readonly statefulDomains: readonly string[];
439
+ }
366
440
  type SecurityRateLimitDriver = 'memory' | 'file' | 'redis';
367
441
  interface HoloSecurityCsrfConfig {
368
442
  readonly enabled?: boolean;
@@ -468,9 +542,11 @@ interface AuthPasswordBrokerConfig {
468
542
  readonly table?: string;
469
543
  readonly expire?: number | string;
470
544
  readonly throttle?: number | string;
545
+ readonly route?: string;
471
546
  }
472
547
  interface AuthEmailVerificationConfig {
473
548
  readonly required?: boolean;
549
+ readonly route?: string;
474
550
  }
475
551
  interface AuthPersonalAccessTokenConfig {
476
552
  readonly defaultAbilities?: readonly string[];
@@ -488,23 +564,49 @@ interface AuthSocialProviderConfig {
488
564
  interface AuthWorkosProviderConfig {
489
565
  readonly clientId?: string;
490
566
  readonly apiKey?: string;
491
- readonly cookiePassword?: string;
492
567
  readonly redirectUri?: string;
493
- readonly sessionCookie?: string;
494
568
  readonly guard?: string;
495
569
  readonly mapToProvider?: string;
496
570
  }
571
+ interface AuthHostedIdentityRecord {
572
+ readonly provider: string;
573
+ readonly providerUserId: string;
574
+ readonly guard: string;
575
+ readonly authProvider: string;
576
+ readonly userId: string | number;
577
+ readonly email?: string;
578
+ readonly emailVerified: boolean;
579
+ readonly profile: Readonly<Record<string, unknown>>;
580
+ readonly linkedAt: Date;
581
+ readonly updatedAt: Date;
582
+ }
583
+ interface AuthHostedIdentityStore {
584
+ findByProviderUserId(provider: string, providerUserId: string): Promise<AuthHostedIdentityRecord | null>;
585
+ findByUserId(provider: string, authProvider: string, userId: string | number): Promise<AuthHostedIdentityRecord | null>;
586
+ claim?(record: AuthHostedIdentityRecord): Promise<AuthHostedIdentityRecord>;
587
+ save(record: AuthHostedIdentityRecord): Promise<void>;
588
+ }
589
+ interface HoloAuthWorkosConfig {
590
+ readonly provider?: string;
591
+ readonly identityStore?: AuthHostedIdentityStore;
592
+ readonly [provider: string]: AuthHostedIdentityStore | AuthWorkosProviderConfig | string | undefined;
593
+ }
497
594
  interface AuthClerkProviderConfig {
498
595
  readonly publishableKey?: string;
499
596
  readonly secretKey?: string;
500
- readonly jwtKey?: string;
501
597
  readonly apiUrl?: string;
502
598
  readonly frontendApi?: string;
599
+ readonly redirectUri?: string;
503
600
  readonly sessionCookie?: string;
504
601
  readonly authorizedParties?: readonly string[];
505
602
  readonly guard?: string;
506
603
  readonly mapToProvider?: string;
507
604
  }
605
+ interface HoloAuthClerkConfig {
606
+ readonly provider?: string;
607
+ readonly identityStore?: AuthHostedIdentityStore;
608
+ readonly [provider: string]: AuthHostedIdentityStore | AuthClerkProviderConfig | string | undefined;
609
+ }
508
610
  interface HoloAuthConfig {
509
611
  readonly defaults?: {
510
612
  readonly guard?: string;
@@ -517,8 +619,8 @@ interface HoloAuthConfig {
517
619
  readonly personalAccessTokens?: AuthPersonalAccessTokenConfig;
518
620
  readonly socialEncryptionKey?: string;
519
621
  readonly social?: Readonly<Record<string, AuthSocialProviderConfig>>;
520
- readonly workos?: Readonly<Record<string, AuthWorkosProviderConfig>>;
521
- readonly clerk?: Readonly<Record<string, AuthClerkProviderConfig>>;
622
+ readonly workos?: HoloAuthWorkosConfig;
623
+ readonly clerk?: HoloAuthClerkConfig;
522
624
  }
523
625
  interface NormalizedAuthGuardConfig {
524
626
  readonly name: string;
@@ -536,6 +638,7 @@ interface NormalizedAuthPasswordBrokerConfig {
536
638
  readonly table: string;
537
639
  readonly expire: number;
538
640
  readonly throttle: number;
641
+ readonly route: string;
539
642
  }
540
643
  interface NormalizedAuthSocialProviderConfig {
541
644
  readonly name: string;
@@ -552,24 +655,33 @@ interface NormalizedAuthWorkosProviderConfig {
552
655
  readonly name: string;
553
656
  readonly clientId?: string;
554
657
  readonly apiKey?: string;
555
- readonly cookiePassword?: string;
556
658
  readonly redirectUri?: string;
557
659
  readonly sessionCookie: string;
558
660
  readonly guard?: string;
559
661
  readonly mapToProvider?: string;
560
662
  }
663
+ interface NormalizedHoloAuthWorkosConfig {
664
+ readonly provider?: string;
665
+ readonly identityStore?: AuthHostedIdentityStore;
666
+ readonly [provider: string]: AuthHostedIdentityStore | NormalizedAuthWorkosProviderConfig | string | undefined;
667
+ }
561
668
  interface NormalizedAuthClerkProviderConfig {
562
669
  readonly name: string;
563
670
  readonly publishableKey?: string;
564
671
  readonly secretKey?: string;
565
- readonly jwtKey?: string;
566
672
  readonly apiUrl?: string;
567
673
  readonly frontendApi?: string;
674
+ readonly redirectUri?: string;
568
675
  readonly sessionCookie: string;
569
676
  readonly authorizedParties: readonly string[];
570
677
  readonly guard?: string;
571
678
  readonly mapToProvider?: string;
572
679
  }
680
+ interface NormalizedHoloAuthClerkConfig {
681
+ readonly provider?: string;
682
+ readonly identityStore?: AuthHostedIdentityStore;
683
+ readonly [provider: string]: AuthHostedIdentityStore | NormalizedAuthClerkProviderConfig | string | undefined;
684
+ }
573
685
  interface NormalizedHoloAuthConfig {
574
686
  readonly defaults: {
575
687
  readonly guard: string;
@@ -580,14 +692,15 @@ interface NormalizedHoloAuthConfig {
580
692
  readonly passwords: Readonly<Record<string, NormalizedAuthPasswordBrokerConfig>>;
581
693
  readonly emailVerification: {
582
694
  readonly required: boolean;
695
+ readonly route: string;
583
696
  };
584
697
  readonly personalAccessTokens: {
585
698
  readonly defaultAbilities: readonly string[];
586
699
  };
587
700
  readonly socialEncryptionKey?: string;
588
701
  readonly social: Readonly<Record<string, NormalizedAuthSocialProviderConfig>>;
589
- readonly workos: Readonly<Record<string, NormalizedAuthWorkosProviderConfig>>;
590
- readonly clerk: Readonly<Record<string, NormalizedAuthClerkProviderConfig>>;
702
+ readonly workos: NormalizedHoloAuthWorkosConfig;
703
+ readonly clerk: NormalizedHoloAuthClerkConfig;
591
704
  }
592
705
  interface QueueRedisConnectionConfig {
593
706
  readonly driver: 'redis';
@@ -800,59 +913,6 @@ interface NormalizedHoloMailConfig {
800
913
  readonly markdown: NormalizedHoloMailMarkdownConfig;
801
914
  readonly mailers: Readonly<Record<string, NormalizedHoloMailMailerConfig>>;
802
915
  }
803
- interface HoloConfigRegistry {
804
- app: NormalizedHoloAppConfig;
805
- database: NormalizedHoloDatabaseConfig;
806
- redis: NormalizedHoloRedisConfig;
807
- cache: NormalizedHoloCacheConfig;
808
- storage: NormalizedHoloStorageConfig;
809
- queue: NormalizedHoloQueueConfig;
810
- broadcast: NormalizedHoloBroadcastConfig;
811
- mail: NormalizedHoloMailConfig;
812
- notifications: NormalizedHoloNotificationsConfig;
813
- media: HoloMediaConfig;
814
- session: NormalizedHoloSessionConfig;
815
- security: NormalizedHoloSecurityConfig;
816
- auth: NormalizedHoloAuthConfig;
817
- }
818
- type HoloConfigMap = object;
819
- interface LoadedEnvironment {
820
- readonly name: HoloAppEnv;
821
- readonly values: Readonly<Record<string, string>>;
822
- readonly loadedFiles: readonly string[];
823
- readonly warnings: readonly string[];
824
- }
825
- interface LoadedHoloConfig<TCustom extends HoloConfigMap = HoloConfigMap> {
826
- readonly app: NormalizedHoloAppConfig;
827
- readonly database: NormalizedHoloDatabaseConfig;
828
- readonly redis: NormalizedHoloRedisConfig;
829
- readonly cache: NormalizedHoloCacheConfig;
830
- readonly storage: NormalizedHoloStorageConfig;
831
- readonly queue: NormalizedHoloQueueConfig;
832
- readonly broadcast: NormalizedHoloBroadcastConfig;
833
- readonly mail: NormalizedHoloMailConfig;
834
- readonly notifications: NormalizedHoloNotificationsConfig;
835
- readonly media: HoloMediaConfig;
836
- readonly session: NormalizedHoloSessionConfig;
837
- readonly security: NormalizedHoloSecurityConfig;
838
- readonly auth: NormalizedHoloAuthConfig;
839
- readonly custom: Readonly<TCustom>;
840
- readonly all: Readonly<HoloConfigRegistry & TCustom>;
841
- readonly environment: LoadedEnvironment;
842
- readonly loadedFiles: readonly string[];
843
- readonly warnings: readonly string[];
844
- }
845
- type ConfigFileName = keyof HoloConfigRegistry | (string & {});
846
- type Primitive = string | number | boolean | bigint | symbol | null | undefined;
847
- type NonTraversable = Primitive | readonly unknown[] | ((...args: never[]) => unknown);
848
- type KnownPathKey<T> = Extract<{
849
- [K in keyof T]: K extends string ? string extends K ? never : K : never;
850
- }[keyof T], string>;
851
- type DotPath<T> = T extends NonTraversable ? never : {
852
- [K in KnownPathKey<T>]: T[K] extends NonTraversable ? K : T[K] extends object ? K | `${K}.${DotPath<T[K]>}` : K;
853
- }[KnownPathKey<T>];
854
- type ValueAtPath<T, TPath extends string> = TPath extends `${infer Head}.${infer Tail}` ? Head extends keyof T ? ValueAtPath<T[Head], Tail> : never : TPath extends keyof T ? T[TPath] : never;
855
- type DefineConfigValue<TConfig extends object> = Readonly<TConfig>;
856
916
 
857
917
  declare const DEFAULT_APP_NAME = "Holo";
858
918
  declare const holoAppDefaults: Readonly<NormalizedHoloAppConfig>;
@@ -867,16 +927,21 @@ type CacheNormalizationOptions = {
867
927
  readonly redis?: NormalizedHoloRedisConfig;
868
928
  };
869
929
  declare const holoMailDefaults: Readonly<NormalizedHoloMailConfig>;
930
+ declare const DEFAULT_SESSION_COOKIE_NAME = "holo_session";
870
931
  declare const holoSessionDefaults: Readonly<NormalizedHoloSessionConfig>;
932
+ declare const holoCorsDefaults: Readonly<NormalizedHoloCorsConfig>;
871
933
  declare const holoSecurityDefaults: Readonly<NormalizedHoloSecurityConfig>;
872
934
  declare const holoAuthDefaults: Readonly<NormalizedHoloAuthConfig>;
873
935
  declare function normalizeCacheConfig(config?: HoloCacheConfig, options?: CacheNormalizationOptions): NormalizedHoloCacheConfig;
936
+ declare function normalizeCorsConfig(config?: HoloCorsConfig): NormalizedHoloCorsConfig;
874
937
  declare const holoQueueDefaultsNormalized: Readonly<NormalizedHoloQueueConfig>;
875
938
  declare function normalizeAppEnv(value: string | undefined, fallback?: HoloAppEnv): HoloAppEnv;
876
939
  declare function normalizeAppConfig(config?: HoloAppConfig): NormalizedHoloAppConfig;
877
940
  declare function normalizeSessionConfig(config?: HoloSessionConfig, redisConfig?: NormalizedHoloRedisConfig): NormalizedHoloSessionConfig;
878
941
  declare function normalizeSecurityConfig(config?: HoloSecurityConfig, redisConfig?: NormalizedHoloRedisConfig): NormalizedHoloSecurityConfig;
879
- declare function normalizeAuthConfig(config?: HoloAuthConfig): NormalizedHoloAuthConfig;
942
+ declare function normalizeAuthConfig(config?: HoloAuthConfig, _options?: {
943
+ readonly appKey?: string;
944
+ }): NormalizedHoloAuthConfig;
880
945
  declare function normalizeDatabaseConfig(config?: HoloDatabaseConfig): NormalizedHoloDatabaseConfig;
881
946
  declare function normalizeStorageConfig(config?: HoloStorageConfig): NormalizedHoloStorageConfig;
882
947
  declare function normalizeBroadcastConfig(config?: HoloBroadcastConfig): NormalizedHoloBroadcastConfig;
@@ -973,6 +1038,7 @@ declare function defineNotificationsConfig<const TConfig extends HoloNotificatio
973
1038
  declare function defineMediaConfig<TConfig extends HoloMediaConfig>(config: TConfig): DefineConfigValue<TConfig>;
974
1039
  declare function defineSessionConfig<TConfig extends HoloSessionConfig>(config: TConfig): DefineConfigValue<TConfig>;
975
1040
  declare function defineSecurityConfig<TConfig extends HoloSecurityConfig>(config: TConfig): DefineConfigValue<TConfig>;
1041
+ declare function defineCorsConfig<TConfig extends HoloCorsConfig>(config: TConfig): DefineConfigValue<TConfig>;
976
1042
  declare function defineAuthConfig<TConfig extends HoloAuthConfig>(config: TConfig): DefineConfigValue<TConfig>;
977
1043
  declare const loaderInternals: {
978
1044
  getDeferredConfigNames: typeof getDeferredConfigNames;
@@ -981,4 +1047,4 @@ declare const loaderInternals: {
981
1047
  splitCacheableConfig: typeof splitCacheableConfig;
982
1048
  };
983
1049
 
984
- export { type AuthClerkProviderConfig, type AuthEmailVerificationConfig, type AuthGuardConfig, type AuthPasswordBrokerConfig, type AuthPersonalAccessTokenConfig, type AuthProviderConfig, type AuthSocialProviderConfig, type AuthWorkosProviderConfig, type BroadcastConnectionDriver, type BroadcastConnectionOptionsConfig, type BroadcastConnectionScheme, type BroadcastWorkerConfig, type BroadcastWorkerScalingConfig, type CacheDatabaseDriverConfig, type CacheDriver, type CacheDriverConfig, type CacheFileDriverConfig, type CacheMemoryDriverConfig, type CacheRedisDriverConfig, type ConfigFileName, DEFAULT_APP_NAME, type DefineConfigValue, type DiskConfig, type DotPath, type HoloAppConfig, type HoloAppEnv, type HoloAuthConfig, type HoloBroadcastConfig, type HoloBroadcastConnection, type HoloBroadcastConnectionConfig, type HoloCacheConfig, type HoloConfigMap, type HoloConfigRegistry, type HoloDatabaseConfig, type HoloDatabaseConnectionConfig, type HoloMailAddressConfig, type HoloMailConfig, type HoloMailMailerConfig, type HoloMailPreviewConfig, type HoloMailQueueConfig, type HoloMediaConfig, type HoloNotificationsConfig, type HoloQueueConfig, type HoloRedisClusterNodeConfig, type HoloRedisConfig, type HoloRedisConnectionConfig, type HoloSecurityConfig, type HoloSecurityCsrfConfig, type HoloSecurityRateLimitConfig, type HoloSessionConfig, type HoloSessionCookieConfig, type HoloStorageConfig, type LoadedEnvironment, type LoadedHoloConfig, type NormalizedAuthClerkProviderConfig, type NormalizedAuthGuardConfig, type NormalizedAuthPasswordBrokerConfig, type NormalizedAuthProviderConfig, type NormalizedAuthSocialProviderConfig, type NormalizedAuthWorkosProviderConfig, type NormalizedBroadcastConnectionOptionsConfig, type NormalizedBroadcastWorkerConfig, type NormalizedCacheDatabaseDriverConfig, type NormalizedCacheDriverConfig, type NormalizedCacheFileDriverConfig, type NormalizedCacheMemoryDriverConfig, type NormalizedCacheRedisDriverConfig, type NormalizedHoloAppConfig, type NormalizedHoloAuthConfig, type NormalizedHoloBroadcastConfig, type NormalizedHoloBroadcastConnection, type NormalizedHoloCacheConfig, type NormalizedHoloDatabaseConfig, type NormalizedHoloMailAddressConfig, type NormalizedHoloMailConfig, type NormalizedHoloMailMailerConfig, type NormalizedHoloMailPreviewConfig, type NormalizedHoloMailQueueConfig, type NormalizedHoloNotificationsConfig, type NormalizedHoloQueueConfig, type NormalizedHoloRedisClusterNodeConfig, type NormalizedHoloRedisConfig, type NormalizedHoloRedisConnectionConfig, type NormalizedHoloSecurityConfig, type NormalizedHoloSecurityCsrfConfig, type NormalizedHoloSecurityRateLimitConfig, type NormalizedHoloSessionConfig, type NormalizedHoloSessionCookieConfig, type NormalizedHoloStorageConfig, type NormalizedSecurityLimiterConfig, type NormalizedSecurityRateLimitRedisConfig, type NormalizedSessionDatabaseStoreConfig, type NormalizedSessionFileStoreConfig, type NormalizedSessionRedisStoreConfig, type NormalizedSessionStoreConfig, type SecurityLimiterConfig, type SecurityRateLimitContext, type SecurityRateLimitDriver, type SecurityRateLimitFileConfig, type SecurityRateLimitKeyResolver, type SecurityRateLimitMemoryConfig, type SecurityRateLimitRedisConfig, type SecurityRateLimitRedisConnectionConfig, type SessionCookieSameSite, type SessionDatabaseStoreConfig, type SessionFileStoreConfig, type SessionRedisStoreConfig, type SessionStoreConfig, type SupportedDatabaseDriver, type ValueAtPath, clearConfigCache, config, configureConfigRuntime, configureEnvRuntime, createConfigAccessors, defineAppConfig, defineAuthConfig, defineBroadcastConfig, defineCacheConfig, defineConfig, defineDatabaseConfig, defineMailConfig, defineMediaConfig, defineNotificationsConfig, defineQueueConfig, defineRedisConfig, defineSecurityConfig, defineSessionConfig, defineStorageConfig, env, holoAppDefaults, holoAuthDefaults, holoBroadcastDefaults, holoCacheDefaults, holoDatabaseDefaults, holoMailDefaults, holoNotificationsDefaults, holoQueueDefaultsNormalized, holoRedisDefaults, holoSecurityDefaults, holoSessionDefaults, holoStorageDefaults, isEnvPlaceholder, loadConfigDirectory, loadEnvironment, loaderInternals, normalizeAppConfig, normalizeAppEnv, normalizeAuthConfig, normalizeBroadcastConfig, normalizeCacheConfig, normalizeDatabaseConfig, normalizeMailConfig, normalizeNotificationsConfig, normalizeQueueConfigForHolo, normalizeRedisConfig, normalizeSecurityConfig, normalizeSessionConfig, normalizeStorageConfig, resetConfigRuntime, resolveAppEnvironment, resolveConfigCachePath, resolveEnvPlaceholders, resolveEnvironmentFileOrder, useConfig, writeConfigCache };
1050
+ export { type AuthClerkProviderConfig, type AuthEmailVerificationConfig, type AuthGuardConfig, type AuthHostedIdentityRecord, type AuthHostedIdentityStore, type AuthPasswordBrokerConfig, type AuthPersonalAccessTokenConfig, type AuthProviderConfig, type AuthSocialProviderConfig, type AuthWorkosProviderConfig, type BroadcastConnectionDriver, type BroadcastConnectionOptionsConfig, type BroadcastConnectionScheme, type BroadcastWorkerConfig, type BroadcastWorkerScalingConfig, type CacheDatabaseDriverConfig, type CacheDriver, type CacheDriverConfig, type CacheFileDriverConfig, type CacheMemoryDriverConfig, type CacheRedisDriverConfig, type ConfigFileName, DEFAULT_APP_NAME, DEFAULT_SESSION_COOKIE_NAME, type DefineConfigValue, type DiskConfig, type DotPath, type HoloAppConfig, type HoloAppEnv, type HoloAuthClerkConfig, type HoloAuthConfig, type HoloAuthWorkosConfig, type HoloBroadcastConfig, type HoloBroadcastConnection, type HoloBroadcastConnectionConfig, type HoloCacheConfig, type HoloConfigMap, type HoloConfigRegistry, type HoloCorsConfig, type HoloDatabaseConfig, type HoloDatabaseConnectionConfig, type HoloMailAddressConfig, type HoloMailConfig, type HoloMailMailerConfig, type HoloMailPreviewConfig, type HoloMailQueueConfig, type HoloMediaConfig, type HoloNotificationsConfig, type HoloQueueConfig, type HoloRedisClusterNodeConfig, type HoloRedisConfig, type HoloRedisConnectionConfig, type HoloSecurityConfig, type HoloSecurityCsrfConfig, type HoloSecurityRateLimitConfig, type HoloSessionConfig, type HoloSessionCookieConfig, type HoloStorageConfig, type LoadedEnvironment, type LoadedHoloConfig, type NormalizedAuthClerkProviderConfig, type NormalizedAuthGuardConfig, type NormalizedAuthPasswordBrokerConfig, type NormalizedAuthProviderConfig, type NormalizedAuthSocialProviderConfig, type NormalizedAuthWorkosProviderConfig, type NormalizedBroadcastConnectionOptionsConfig, type NormalizedBroadcastWorkerConfig, type NormalizedCacheDatabaseDriverConfig, type NormalizedCacheDriverConfig, type NormalizedCacheFileDriverConfig, type NormalizedCacheMemoryDriverConfig, type NormalizedCacheRedisDriverConfig, type NormalizedHoloAppConfig, type NormalizedHoloAuthClerkConfig, type NormalizedHoloAuthConfig, type NormalizedHoloAuthWorkosConfig, type NormalizedHoloBroadcastConfig, type NormalizedHoloBroadcastConnection, type NormalizedHoloCacheConfig, type NormalizedHoloCorsConfig, type NormalizedHoloDatabaseConfig, type NormalizedHoloMailAddressConfig, type NormalizedHoloMailConfig, type NormalizedHoloMailMailerConfig, type NormalizedHoloMailPreviewConfig, type NormalizedHoloMailQueueConfig, type NormalizedHoloNotificationsConfig, type NormalizedHoloQueueConfig, type NormalizedHoloRedisClusterNodeConfig, type NormalizedHoloRedisConfig, type NormalizedHoloRedisConnectionConfig, type NormalizedHoloSecurityConfig, type NormalizedHoloSecurityCsrfConfig, type NormalizedHoloSecurityRateLimitConfig, type NormalizedHoloSessionConfig, type NormalizedHoloSessionCookieConfig, type NormalizedHoloStorageConfig, type NormalizedSecurityLimiterConfig, type NormalizedSecurityRateLimitRedisConfig, type NormalizedSessionDatabaseStoreConfig, type NormalizedSessionFileStoreConfig, type NormalizedSessionRedisStoreConfig, type NormalizedSessionStoreConfig, type SecurityLimiterConfig, type SecurityRateLimitContext, type SecurityRateLimitDriver, type SecurityRateLimitFileConfig, type SecurityRateLimitKeyResolver, type SecurityRateLimitMemoryConfig, type SecurityRateLimitRedisConfig, type SecurityRateLimitRedisConnectionConfig, type SessionCookieSameSite, type SessionDatabaseStoreConfig, type SessionFileStoreConfig, type SessionRedisStoreConfig, type SessionStoreConfig, type SupportedDatabaseDriver, type ValueAtPath, clearConfigCache, config, configureConfigRuntime, configureEnvRuntime, createConfigAccessors, defineAppConfig, defineAuthConfig, defineBroadcastConfig, defineCacheConfig, defineConfig, defineCorsConfig, defineDatabaseConfig, defineMailConfig, defineMediaConfig, defineNotificationsConfig, defineQueueConfig, defineRedisConfig, defineSecurityConfig, defineSessionConfig, defineStorageConfig, env, holoAppDefaults, holoAuthDefaults, holoBroadcastDefaults, holoCacheDefaults, holoCorsDefaults, holoDatabaseDefaults, holoMailDefaults, holoNotificationsDefaults, holoQueueDefaultsNormalized, holoRedisDefaults, holoSecurityDefaults, holoSessionDefaults, holoStorageDefaults, isEnvPlaceholder, loadConfigDirectory, loadEnvironment, loaderInternals, normalizeAppConfig, normalizeAppEnv, normalizeAuthConfig, normalizeBroadcastConfig, normalizeCacheConfig, normalizeCorsConfig, normalizeDatabaseConfig, normalizeMailConfig, normalizeNotificationsConfig, normalizeQueueConfigForHolo, normalizeRedisConfig, normalizeSecurityConfig, normalizeSessionConfig, normalizeStorageConfig, resetConfigRuntime, resolveAppEnvironment, resolveConfigCachePath, resolveEnvPlaceholders, resolveEnvironmentFileOrder, useConfig, writeConfigCache };
package/dist/index.mjs CHANGED
@@ -222,6 +222,19 @@ var holoSessionDefaults = Object.freeze({
222
222
  absoluteLifetime: DEFAULT_SESSION_ABSOLUTE_LIFETIME,
223
223
  rememberMeLifetime: DEFAULT_SESSION_REMEMBER_ME_LIFETIME
224
224
  });
225
+ var DEFAULT_CORS_PATHS = Object.freeze(["/api/*"]);
226
+ var DEFAULT_CORS_METHODS = Object.freeze(["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]);
227
+ var DEFAULT_CORS_HEADERS = Object.freeze(["Content-Type", "Authorization", "X-CSRF-TOKEN", "X-Requested-With"]);
228
+ var DEFAULT_CORS_MAX_AGE = 7200;
229
+ var holoCorsDefaults = Object.freeze({
230
+ paths: DEFAULT_CORS_PATHS,
231
+ origins: Object.freeze([]),
232
+ methods: DEFAULT_CORS_METHODS,
233
+ headers: DEFAULT_CORS_HEADERS,
234
+ credentials: false,
235
+ maxAge: DEFAULT_CORS_MAX_AGE,
236
+ statefulDomains: Object.freeze([])
237
+ });
225
238
  var DEFAULT_SECURITY_CSRF_FIELD = "_token";
226
239
  var DEFAULT_SECURITY_CSRF_HEADER = "X-CSRF-TOKEN";
227
240
  var DEFAULT_SECURITY_CSRF_COOKIE = "XSRF-TOKEN";
@@ -266,6 +279,8 @@ var DEFAULT_AUTH_PASSWORD_BROKER = "users";
266
279
  var DEFAULT_AUTH_PASSWORD_RESET_TABLE = "password_reset_tokens";
267
280
  var DEFAULT_AUTH_PASSWORD_EXPIRE = 60;
268
281
  var DEFAULT_AUTH_PASSWORD_THROTTLE = 60;
282
+ var DEFAULT_AUTH_PASSWORD_RESET_ROUTE = "/reset-password";
283
+ var DEFAULT_AUTH_EMAIL_VERIFICATION_ROUTE = "/verify-email";
269
284
  var DEFAULT_WORKOS_SESSION_COOKIE = "wos-session";
270
285
  var DEFAULT_CLERK_SESSION_COOKIE = "__session";
271
286
  var holoAuthDefaults = Object.freeze({
@@ -293,14 +308,16 @@ var holoAuthDefaults = Object.freeze({
293
308
  provider: DEFAULT_AUTH_PROVIDER,
294
309
  table: DEFAULT_AUTH_PASSWORD_RESET_TABLE,
295
310
  expire: DEFAULT_AUTH_PASSWORD_EXPIRE,
296
- throttle: DEFAULT_AUTH_PASSWORD_THROTTLE
311
+ throttle: DEFAULT_AUTH_PASSWORD_THROTTLE,
312
+ route: DEFAULT_AUTH_PASSWORD_RESET_ROUTE
297
313
  })
298
314
  }),
299
315
  emailVerification: Object.freeze({
300
- required: false
316
+ required: false,
317
+ route: DEFAULT_AUTH_EMAIL_VERIFICATION_ROUTE
301
318
  }),
302
319
  personalAccessTokens: Object.freeze({
303
- defaultAbilities: Object.freeze([])
320
+ defaultAbilities: Object.freeze(["*"])
304
321
  }),
305
322
  socialEncryptionKey: void 0,
306
323
  social: Object.freeze({}),
@@ -668,6 +685,37 @@ function normalizeSecurityOptionalString(value) {
668
685
  const normalized = value?.trim();
669
686
  return normalized || void 0;
670
687
  }
688
+ function normalizeCorsStringList(values, defaults, label) {
689
+ if (!values) {
690
+ return defaults;
691
+ }
692
+ return Object.freeze(values.map((value, index) => {
693
+ const normalized = value.trim();
694
+ if (!normalized) {
695
+ throw new Error(`[Holo CORS] ${label} entry at index ${index} must be a non-empty string.`);
696
+ }
697
+ return normalized;
698
+ }));
699
+ }
700
+ function normalizeCorsMethods(values) {
701
+ return Object.freeze(normalizeCorsStringList(values, DEFAULT_CORS_METHODS, "methods").map((value) => value.toUpperCase()));
702
+ }
703
+ function normalizeCorsMaxAge(value) {
704
+ return parseSecurityInteger(value ?? DEFAULT_CORS_MAX_AGE, DEFAULT_CORS_MAX_AGE, "cors maxAge", {
705
+ minimum: 0
706
+ });
707
+ }
708
+ function normalizeCorsConfig(config2 = {}) {
709
+ return Object.freeze({
710
+ paths: normalizeCorsStringList(config2.paths, DEFAULT_CORS_PATHS, "paths"),
711
+ origins: normalizeCorsStringList(config2.origins, holoCorsDefaults.origins, "origins"),
712
+ methods: normalizeCorsMethods(config2.methods),
713
+ headers: normalizeCorsStringList(config2.headers, DEFAULT_CORS_HEADERS, "headers"),
714
+ credentials: config2.credentials ?? holoCorsDefaults.credentials,
715
+ maxAge: normalizeCorsMaxAge(config2.maxAge),
716
+ statefulDomains: normalizeCorsStringList(config2.statefulDomains, holoCorsDefaults.statefulDomains, "statefulDomains")
717
+ });
718
+ }
671
719
  function normalizeSyncConnection(name, config2) {
672
720
  return Object.freeze({
673
721
  name,
@@ -1031,7 +1079,8 @@ function normalizePasswordBroker(name, config2, providers) {
1031
1079
  }),
1032
1080
  throttle: parseInteger(config2.throttle, DEFAULT_AUTH_PASSWORD_THROTTLE, `auth password broker "${name}" throttle`, {
1033
1081
  minimum: 0
1034
- })
1082
+ }),
1083
+ route: config2.route?.trim() || DEFAULT_AUTH_PASSWORD_RESET_ROUTE
1035
1084
  });
1036
1085
  }
1037
1086
  function normalizeSocialProvider(name, config2, guards, providers) {
@@ -1068,13 +1117,73 @@ function normalizeWorkosProvider(name, config2, guards, providers) {
1068
1117
  name,
1069
1118
  clientId: config2.clientId?.trim() || void 0,
1070
1119
  apiKey: config2.apiKey?.trim() || void 0,
1071
- cookiePassword: config2.cookiePassword?.trim() || void 0,
1072
1120
  redirectUri: config2.redirectUri?.trim() || void 0,
1073
- sessionCookie: config2.sessionCookie?.trim() || DEFAULT_WORKOS_SESSION_COOKIE,
1121
+ sessionCookie: DEFAULT_WORKOS_SESSION_COOKIE,
1074
1122
  guard,
1075
1123
  mapToProvider
1076
1124
  });
1077
1125
  }
1126
+ function isHostedIdentityStore(value) {
1127
+ return Boolean(value) && typeof value === "object" && typeof value.findByProviderUserId === "function" && typeof value.findByUserId === "function" && typeof value.save === "function";
1128
+ }
1129
+ function isWorkosProviderConfig(value) {
1130
+ return typeof value === "object" && value !== null && !isHostedIdentityStore(value);
1131
+ }
1132
+ function getWorkosProviderEntries(config2) {
1133
+ if (!config2) {
1134
+ return Object.freeze([]);
1135
+ }
1136
+ const entries = [];
1137
+ for (const [name, value] of Object.entries(config2)) {
1138
+ if (name === "provider") {
1139
+ if (typeof value !== "undefined" && typeof value !== "string") {
1140
+ throw new Error('[Holo Auth] WorkOS provider key "provider" is reserved for the default provider name.');
1141
+ }
1142
+ continue;
1143
+ }
1144
+ if (name === "identityStore") {
1145
+ if (typeof value !== "undefined" && !isHostedIdentityStore(value)) {
1146
+ throw new Error("[Holo Auth] WorkOS identityStore must implement the hosted identity store contract.");
1147
+ }
1148
+ continue;
1149
+ }
1150
+ if (!isWorkosProviderConfig(value)) {
1151
+ throw new Error(`[Holo Auth] WorkOS provider "${name}" must be an object.`);
1152
+ }
1153
+ entries.push([name, value]);
1154
+ }
1155
+ return Object.freeze(entries);
1156
+ }
1157
+ function normalizeWorkosConfig(config2, guards, providers) {
1158
+ const providerEntries = getWorkosProviderEntries(config2);
1159
+ const provider = typeof config2?.provider === "string" ? config2.provider.trim() || void 0 : void 0;
1160
+ if (providerEntries.length === 0) {
1161
+ if (provider) {
1162
+ throw new Error(`[Holo Auth] WorkOS provider "${provider}" is not configured.`);
1163
+ }
1164
+ if (config2?.identityStore) {
1165
+ return Object.freeze({
1166
+ identityStore: config2.identityStore
1167
+ });
1168
+ }
1169
+ return holoAuthDefaults.workos;
1170
+ }
1171
+ const normalizedEntries = providerEntries.map(([name, providerConfig]) => {
1172
+ const normalizedName = normalizeConnectionName(name, "Auth WorkOS provider name");
1173
+ return [normalizedName, providerConfig];
1174
+ });
1175
+ if (provider && !normalizedEntries.some(([name]) => name === provider)) {
1176
+ throw new Error(`[Holo Auth] WorkOS provider "${provider}" is not configured.`);
1177
+ }
1178
+ return Object.freeze({
1179
+ ...typeof provider === "undefined" ? {} : { provider },
1180
+ ...config2?.identityStore ? { identityStore: config2.identityStore } : {},
1181
+ ...Object.fromEntries(normalizedEntries.map(([name, providerConfig]) => [
1182
+ name,
1183
+ normalizeWorkosProvider(name, providerConfig, guards, providers)
1184
+ ]))
1185
+ });
1186
+ }
1078
1187
  function normalizeClerkProvider(name, config2, guards, providers) {
1079
1188
  const guard = config2.guard?.trim();
1080
1189
  if (guard && !(guard in guards)) {
@@ -1084,20 +1193,96 @@ function normalizeClerkProvider(name, config2, guards, providers) {
1084
1193
  if (mapToProvider && !(mapToProvider in providers)) {
1085
1194
  throw new Error(`[Holo Auth] Clerk provider "${name}" references unknown provider "${mapToProvider}".`);
1086
1195
  }
1196
+ const redirectUri = config2.redirectUri?.trim();
1197
+ if (redirectUri) {
1198
+ try {
1199
+ new URL(redirectUri);
1200
+ } catch {
1201
+ throw new Error(`Invalid redirectUri in Clerk provider "${name}": ${redirectUri}`);
1202
+ }
1203
+ }
1087
1204
  return Object.freeze({
1088
1205
  name,
1089
1206
  publishableKey: config2.publishableKey?.trim() || void 0,
1090
1207
  secretKey: config2.secretKey?.trim() || void 0,
1091
- jwtKey: config2.jwtKey?.trim() || void 0,
1092
1208
  apiUrl: config2.apiUrl?.trim() || void 0,
1093
1209
  frontendApi: config2.frontendApi?.trim() || void 0,
1210
+ redirectUri: redirectUri || void 0,
1094
1211
  sessionCookie: config2.sessionCookie?.trim() || DEFAULT_CLERK_SESSION_COOKIE,
1095
1212
  authorizedParties: Object.freeze((config2.authorizedParties ?? []).map((value) => value.trim()).filter(Boolean)),
1096
1213
  guard,
1097
1214
  mapToProvider
1098
1215
  });
1099
1216
  }
1100
- function normalizeAuthConfig(config2 = {}) {
1217
+ function isClerkProviderConfig(value) {
1218
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
1219
+ return false;
1220
+ }
1221
+ const candidate = value;
1222
+ for (const key of ["publishableKey", "secretKey", "apiUrl", "frontendApi", "redirectUri", "sessionCookie", "guard", "mapToProvider"]) {
1223
+ const field = candidate[key];
1224
+ if (typeof field !== "undefined" && typeof field !== "string") {
1225
+ return false;
1226
+ }
1227
+ }
1228
+ return typeof candidate.authorizedParties === "undefined" || Array.isArray(candidate.authorizedParties) && candidate.authorizedParties.every((value2) => typeof value2 === "string");
1229
+ }
1230
+ function getClerkProviderEntries(config2) {
1231
+ if (!config2) {
1232
+ return Object.freeze([]);
1233
+ }
1234
+ const entries = [];
1235
+ for (const [name, value] of Object.entries(config2)) {
1236
+ if (name === "provider") {
1237
+ if (typeof value !== "undefined" && typeof value !== "string") {
1238
+ throw new Error('[Holo Auth] Clerk provider key "provider" is reserved for the default provider name.');
1239
+ }
1240
+ continue;
1241
+ }
1242
+ if (name === "identityStore") {
1243
+ if (typeof value !== "undefined" && !isHostedIdentityStore(value)) {
1244
+ throw new Error("[Holo Auth] Clerk identityStore must implement the hosted identity store contract.");
1245
+ }
1246
+ continue;
1247
+ }
1248
+ if (!isClerkProviderConfig(value)) {
1249
+ throw new Error(`[Holo Auth] Clerk provider "${name}" must be a Clerk provider config object.`);
1250
+ }
1251
+ entries.push([name, value]);
1252
+ }
1253
+ return Object.freeze(entries);
1254
+ }
1255
+ function normalizeClerkConfig(config2, guards, providers) {
1256
+ const providerEntries = getClerkProviderEntries(config2);
1257
+ const provider = typeof config2?.provider === "string" ? config2.provider.trim() || void 0 : void 0;
1258
+ if (providerEntries.length === 0) {
1259
+ if (provider) {
1260
+ throw new Error(`[Holo Auth] Clerk provider "${provider}" is not configured.`);
1261
+ }
1262
+ if (config2?.identityStore) {
1263
+ return Object.freeze({
1264
+ identityStore: config2.identityStore
1265
+ });
1266
+ }
1267
+ return holoAuthDefaults.clerk;
1268
+ }
1269
+ const normalizedEntries = providerEntries.map(([name, providerConfig]) => {
1270
+ const normalizedName = normalizeConnectionName(name, "Auth Clerk provider name");
1271
+ return [normalizedName, providerConfig];
1272
+ });
1273
+ if (provider && !normalizedEntries.some(([name]) => name === provider)) {
1274
+ throw new Error(`[Holo Auth] Clerk provider "${provider}" is not configured.`);
1275
+ }
1276
+ return Object.freeze({
1277
+ ...typeof provider === "undefined" ? {} : { provider },
1278
+ ...config2?.identityStore ? { identityStore: config2.identityStore } : {},
1279
+ ...Object.fromEntries(normalizedEntries.map(([name, providerConfig]) => [
1280
+ name,
1281
+ normalizeClerkProvider(name, providerConfig, guards, providers)
1282
+ ]))
1283
+ });
1284
+ }
1285
+ function normalizeAuthConfig(config2 = {}, _options = {}) {
1101
1286
  const providers = !config2.providers || Object.keys(config2.providers).length === 0 ? holoAuthDefaults.providers : Object.freeze(Object.fromEntries(Object.entries(config2.providers).map(([name, provider]) => {
1102
1287
  const normalizedName = normalizeConnectionName(name, "Auth provider name");
1103
1288
  return [normalizedName, normalizeAuthProvider(normalizedName, provider)];
@@ -1134,14 +1319,8 @@ function normalizeAuthConfig(config2 = {}) {
1134
1319
  const normalizedName = normalizeConnectionName(name, "Auth social provider name");
1135
1320
  return [normalizedName, normalizeSocialProvider(normalizedName, provider, guards, providers)];
1136
1321
  })));
1137
- const workos = !config2.workos || Object.keys(config2.workos).length === 0 ? holoAuthDefaults.workos : Object.freeze(Object.fromEntries(Object.entries(config2.workos).map(([name, provider]) => {
1138
- const normalizedName = normalizeConnectionName(name, "Auth WorkOS provider name");
1139
- return [normalizedName, normalizeWorkosProvider(normalizedName, provider, guards, providers)];
1140
- })));
1141
- const clerk = !config2.clerk || Object.keys(config2.clerk).length === 0 ? holoAuthDefaults.clerk : Object.freeze(Object.fromEntries(Object.entries(config2.clerk).map(([name, provider]) => {
1142
- const normalizedName = normalizeConnectionName(name, "Auth Clerk provider name");
1143
- return [normalizedName, normalizeClerkProvider(normalizedName, provider, guards, providers)];
1144
- })));
1322
+ const workos = normalizeWorkosConfig(config2.workos, guards, providers);
1323
+ const clerk = normalizeClerkConfig(config2.clerk, guards, providers);
1145
1324
  return Object.freeze({
1146
1325
  defaults: Object.freeze({
1147
1326
  guard: defaultGuard,
@@ -1151,12 +1330,13 @@ function normalizeAuthConfig(config2 = {}) {
1151
1330
  providers,
1152
1331
  passwords,
1153
1332
  emailVerification: Object.freeze({
1154
- required: typeof config2.emailVerification === "boolean" ? config2.emailVerification : config2.emailVerification?.required ?? false
1333
+ required: typeof config2.emailVerification === "boolean" ? config2.emailVerification : config2.emailVerification?.required ?? false,
1334
+ route: typeof config2.emailVerification === "boolean" ? DEFAULT_AUTH_EMAIL_VERIFICATION_ROUTE : config2.emailVerification?.route?.trim() || DEFAULT_AUTH_EMAIL_VERIFICATION_ROUTE
1155
1335
  }),
1156
1336
  personalAccessTokens: Object.freeze({
1157
- defaultAbilities: Object.freeze([...config2.personalAccessTokens?.defaultAbilities ?? []])
1337
+ defaultAbilities: Object.freeze([...config2.personalAccessTokens?.defaultAbilities ?? holoAuthDefaults.personalAccessTokens.defaultAbilities])
1158
1338
  }),
1159
- socialEncryptionKey: config2.socialEncryptionKey?.trim() || void 0,
1339
+ socialEncryptionKey: config2.socialEncryptionKey?.trim() || _options.appKey?.trim() || void 0,
1160
1340
  social,
1161
1341
  workos,
1162
1342
  clerk
@@ -1580,10 +1760,10 @@ function requireConfigRuntime() {
1580
1760
  return runtimeConfigMap;
1581
1761
  }
1582
1762
  function useConfig(path) {
1583
- return createConfigAccessors(requireConfigRuntime()).useConfig(path);
1763
+ return getValueAtPath(requireConfigRuntime(), path);
1584
1764
  }
1585
1765
  function config(path) {
1586
- return createConfigAccessors(requireConfigRuntime()).config(path);
1766
+ return getValueAtPath(requireConfigRuntime(), path);
1587
1767
  }
1588
1768
 
1589
1769
  // src/env.ts
@@ -1684,6 +1864,9 @@ function configureEnvRuntime(values, options = {}) {
1684
1864
  state.mode = options.mode ?? "resolve";
1685
1865
  }
1686
1866
  function coerceEnvScalar(runtimeValue, fallback) {
1867
+ if (runtimeValue.trim().length === 0) {
1868
+ return fallback;
1869
+ }
1687
1870
  if (typeof fallback === "boolean") {
1688
1871
  const normalized = runtimeValue.trim().toLowerCase();
1689
1872
  if (normalized === "true" || normalized === "1" || normalized === "yes" || normalized === "on") {
@@ -1909,6 +2092,7 @@ function normalizeLoadedConfig(rawConfig, options) {
1909
2092
  database,
1910
2093
  redis: resolvedRedisConfig
1911
2094
  });
2095
+ const cors = normalizeCorsConfig(resolvedRawConfig.cors);
1912
2096
  const storage = normalizeStorageConfig(resolvedRawConfig.storage);
1913
2097
  const queue = normalizeQueueConfigForHolo(resolvedRawConfig.queue, resolvedRedisConfig);
1914
2098
  const broadcast = normalizeBroadcastConfig(resolvedRawConfig.broadcast);
@@ -1917,16 +2101,15 @@ function normalizeLoadedConfig(rawConfig, options) {
1917
2101
  const media = Object.freeze({ ...resolvedRawConfig.media ?? {} });
1918
2102
  const session = normalizeSessionConfig(resolvedRawConfig.session, resolvedRedisConfig);
1919
2103
  const security = normalizeSecurityConfig(resolvedRawConfig.security, resolvedRedisConfig);
1920
- const auth = normalizeAuthConfig(resolvedRawConfig.auth);
1921
- const customEntries = Object.entries(resolvedRawConfig).filter(([key]) => {
1922
- return key !== "app" && key !== "database" && key !== "redis" && key !== "cache" && key !== "storage" && key !== "queue" && key !== "broadcast" && key !== "mail" && key !== "notifications" && key !== "media" && key !== "session" && key !== "security" && key !== "auth";
2104
+ const auth = normalizeAuthConfig(resolvedRawConfig.auth, {
2105
+ appKey: app.key
1923
2106
  });
1924
- const custom = Object.freeze(Object.fromEntries(customEntries));
1925
- const all = Object.freeze({
2107
+ const firstPartyConfig = {
1926
2108
  app,
1927
2109
  database,
1928
2110
  redis,
1929
2111
  cache,
2112
+ cors,
1930
2113
  storage,
1931
2114
  queue,
1932
2115
  broadcast,
@@ -1935,23 +2118,19 @@ function normalizeLoadedConfig(rawConfig, options) {
1935
2118
  media,
1936
2119
  session,
1937
2120
  security,
1938
- auth,
2121
+ auth
2122
+ };
2123
+ const firstPartyConfigKeys = new Set(Object.keys(firstPartyConfig));
2124
+ const customEntries = Object.entries(resolvedRawConfig).filter(([key]) => {
2125
+ return !firstPartyConfigKeys.has(key);
2126
+ });
2127
+ const custom = Object.freeze(Object.fromEntries(customEntries));
2128
+ const all = Object.freeze({
2129
+ ...firstPartyConfig,
1939
2130
  ...custom
1940
2131
  });
1941
2132
  return {
1942
- app,
1943
- database,
1944
- redis,
1945
- cache,
1946
- storage,
1947
- queue,
1948
- broadcast,
1949
- mail,
1950
- notifications,
1951
- media,
1952
- session,
1953
- security,
1954
- auth,
2133
+ ...firstPartyConfig,
1955
2134
  custom,
1956
2135
  all,
1957
2136
  environment: options.environment,
@@ -2134,6 +2313,9 @@ function defineSessionConfig(config2) {
2134
2313
  function defineSecurityConfig(config2) {
2135
2314
  return defineConfig(config2);
2136
2315
  }
2316
+ function defineCorsConfig(config2) {
2317
+ return defineConfig(config2);
2318
+ }
2137
2319
  function defineAuthConfig(config2) {
2138
2320
  return defineConfig(config2);
2139
2321
  }
@@ -2145,6 +2327,7 @@ var loaderInternals = {
2145
2327
  };
2146
2328
  export {
2147
2329
  DEFAULT_APP_NAME,
2330
+ DEFAULT_SESSION_COOKIE_NAME,
2148
2331
  clearConfigCache,
2149
2332
  config,
2150
2333
  configureConfigRuntime,
@@ -2155,6 +2338,7 @@ export {
2155
2338
  defineBroadcastConfig,
2156
2339
  defineCacheConfig,
2157
2340
  defineConfig,
2341
+ defineCorsConfig,
2158
2342
  defineDatabaseConfig,
2159
2343
  defineMailConfig,
2160
2344
  defineMediaConfig,
@@ -2169,6 +2353,7 @@ export {
2169
2353
  holoAuthDefaults,
2170
2354
  holoBroadcastDefaults,
2171
2355
  holoCacheDefaults,
2356
+ holoCorsDefaults,
2172
2357
  holoDatabaseDefaults,
2173
2358
  holoMailDefaults,
2174
2359
  holoNotificationsDefaults,
@@ -2186,6 +2371,7 @@ export {
2186
2371
  normalizeAuthConfig,
2187
2372
  normalizeBroadcastConfig,
2188
2373
  normalizeCacheConfig,
2374
+ normalizeCorsConfig,
2189
2375
  normalizeDatabaseConfig,
2190
2376
  normalizeMailConfig,
2191
2377
  normalizeNotificationsConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holo-js/config",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Holo-JS Framework - typed config loading, env layering, and runtime access",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,11 +22,11 @@
22
22
  "test": "vitest --run"
23
23
  },
24
24
  "dependencies": {
25
- "@holo-js/db": "^0.1.4"
25
+ "@holo-js/db": "^0.1.6"
26
26
  },
27
27
  "devDependencies": {
28
28
  "tsup": "^8.3.5",
29
29
  "typescript": "^5.7.2",
30
- "vitest": "^2.1.8"
30
+ "vitest": "^4.1.5"
31
31
  }
32
32
  }