@spfn/core 0.3.0-beta.3 → 0.3.0-beta.30

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 (104) hide show
  1. package/README.md +301 -10
  2. package/dist/app-config/index.d.ts +39 -1
  3. package/dist/app-config/index.js.map +1 -1
  4. package/dist/authz/index.js +47 -391
  5. package/dist/authz/index.js.map +1 -1
  6. package/dist/{boss-D16fO2oG.d.ts → boss-BiDCbbAQ.d.ts} +60 -7
  7. package/dist/codegen/index.d.ts +157 -16
  8. package/dist/codegen/index.js +772 -166
  9. package/dist/codegen/index.js.map +1 -1
  10. package/dist/config/index.js +4 -4
  11. package/dist/config/index.js.map +1 -1
  12. package/dist/contract/index.d.ts +39 -16
  13. package/dist/contract/index.js +147 -23
  14. package/dist/contract/index.js.map +1 -1
  15. package/dist/db/index.d.ts +230 -35
  16. package/dist/db/index.js +316 -160
  17. package/dist/db/index.js.map +1 -1
  18. package/dist/env/index.d.ts +6 -442
  19. package/dist/env/index.js +13 -16
  20. package/dist/env/index.js.map +1 -1
  21. package/dist/env/loader.js +24 -1
  22. package/dist/env/loader.js.map +1 -1
  23. package/dist/error-CIZlYJlL.d.ts +157 -0
  24. package/dist/errors/index.d.ts +18 -1
  25. package/dist/errors/index.js +47 -391
  26. package/dist/errors/index.js.map +1 -1
  27. package/dist/event/index.d.ts +5 -5
  28. package/dist/event/index.js +202 -3
  29. package/dist/event/index.js.map +1 -1
  30. package/dist/event/sse/client.d.ts +18 -4
  31. package/dist/event/sse/client.js +94 -18
  32. package/dist/event/sse/client.js.map +1 -1
  33. package/dist/event/sse/index.d.ts +18 -5
  34. package/dist/event/sse/index.js +452 -114
  35. package/dist/event/sse/index.js.map +1 -1
  36. package/dist/event/ws/client.d.ts +3 -2
  37. package/dist/event/ws/index.d.ts +4 -3
  38. package/dist/job/index.d.ts +48 -3
  39. package/dist/job/index.js +131 -52
  40. package/dist/job/index.js.map +1 -1
  41. package/dist/logger/index.js +0 -12
  42. package/dist/logger/index.js.map +1 -1
  43. package/dist/middleware/index.js +52 -397
  44. package/dist/middleware/index.js.map +1 -1
  45. package/dist/nextjs/index.d.ts +75 -14
  46. package/dist/nextjs/index.js +200 -84
  47. package/dist/nextjs/index.js.map +1 -1
  48. package/dist/nextjs/server.d.ts +46 -8
  49. package/dist/nextjs/server.js +15 -1
  50. package/dist/nextjs/server.js.map +1 -1
  51. package/dist/ops/index.d.ts +61 -42
  52. package/dist/ops/index.js +648 -97
  53. package/dist/ops/index.js.map +1 -1
  54. package/dist/registry-C2KQCh0m.d.ts +473 -0
  55. package/dist/route/index.d.ts +5 -2
  56. package/dist/route/index.js +107 -28
  57. package/dist/route/index.js.map +1 -1
  58. package/dist/route/types.d.ts +7 -1
  59. package/dist/{router-Cy7rAfmj.d.ts → route-builder-DRW-MSCJ.d.ts} +51 -126
  60. package/dist/router-C57y-vz1.d.ts +184 -0
  61. package/dist/router-CX5uVjmU.d.ts +406 -0
  62. package/dist/server/index.d.ts +130 -7
  63. package/dist/server/index.js +1174 -164
  64. package/dist/server/index.js.map +1 -1
  65. package/dist/state/client.d.ts +206 -0
  66. package/dist/state/client.js +678 -0
  67. package/dist/state/client.js.map +1 -0
  68. package/dist/state/index.d.ts +443 -0
  69. package/dist/state/index.js +644 -0
  70. package/dist/state/index.js.map +1 -0
  71. package/dist/state/react.d.ts +49 -0
  72. package/dist/state/react.js +50 -0
  73. package/dist/state/react.js.map +1 -0
  74. package/dist/surface/index.d.ts +115 -0
  75. package/dist/surface/index.js +1013 -0
  76. package/dist/surface/index.js.map +1 -0
  77. package/dist/token-manager-Ckjt2-qq.d.ts +122 -0
  78. package/dist/{types-CfYVhIQ9.d.ts → types-5Rl11_Nb.d.ts} +43 -4
  79. package/dist/types-CKH0D3Dy.d.ts +441 -0
  80. package/dist/{types-ZQODsBft.d.ts → types-CurMab2Q.d.ts} +52 -2
  81. package/dist/{types-2AbaW4Ie.d.ts → types-DncqXfWN.d.ts} +4 -3
  82. package/docs/file-upload.md +195 -333
  83. package/package.json +39 -9
  84. package/src/cache/README.md +330 -0
  85. package/src/codegen/README.md +721 -0
  86. package/src/config/README.md +333 -0
  87. package/src/contract/README.md +442 -0
  88. package/src/db/README.md +589 -0
  89. package/src/db/manager/README.md +500 -0
  90. package/src/db/schema/README.md +354 -0
  91. package/src/db/transaction/README.md +845 -0
  92. package/src/env/README.md +787 -0
  93. package/src/errors/README.md +445 -0
  94. package/src/event/README.md +994 -0
  95. package/src/job/README.md +613 -0
  96. package/src/logger/README.md +321 -0
  97. package/src/middleware/README.md +634 -0
  98. package/src/nextjs/README.md +756 -0
  99. package/src/route/README.md +763 -0
  100. package/src/security/README.md +100 -0
  101. package/src/server/README.md +704 -0
  102. package/src/state/README.md +806 -0
  103. package/dist/token-manager-BT5EnUAR.d.ts +0 -278
  104. package/dist/types-9oszaJqp.d.ts +0 -250
@@ -1,3 +1,4 @@
1
+ export { E as EnvLayer, a as EnvRegistry, b as EnvSchemaCollection, c as EnvValidationResult, d as EnvVarSchema, I as InferEnvType, e as createEnvRegistry, f as defineEnvSchema, g as envBoolean, h as envEnum, i as envJson, j as envNumber, k as envSecret, l as envString, m as envUrl, n as isClientAccessible, o as isNextjsAccessible, p as isServerOnly, q as isSpfnServerOnly, v as validateAllEnv } from '../registry-C2KQCh0m.js';
1
2
  export { L as LogLevel } from '../types-BGl4QL1w.js';
2
3
 
3
4
  /**
@@ -5,6 +6,10 @@ export { L as LogLevel } from '../types-BGl4QL1w.js';
5
6
  *
6
7
  * Parser functions that transform and validate environment variable strings.
7
8
  * All parsers follow the pattern: (value: string) => T or throw Error
9
+ *
10
+ * An error message never contains the input. Messages are logged — by the
11
+ * registry and by the server's boot check — and the input may be a secret or a
12
+ * URL carrying credentials. Describe the expected shape instead.
8
13
  */
9
14
  /**
10
15
  * Parser function that transforms and validates a string value
@@ -430,447 +435,6 @@ declare function withFallback<T>(parser: Parser<T>, fallback: T): Parser<T>;
430
435
  */
431
436
  declare function optional<T>(parser: Parser<T>): Parser<T | undefined>;
432
437
 
433
- /**
434
- * Environment Variable Schema Definition System
435
- *
436
- * 환경변수에 메타데이터를 정의하여 중앙 관리, 문서화, 검증을 지원합니다.
437
- *
438
- * @example
439
- * ```typescript
440
- * const schema = defineEnvSchema({
441
- * DATABASE_URL: envUrl({
442
- * description: 'Database connection',
443
- * required: true,
444
- * validator: parsePostgresUrl,
445
- * sensitive: true,
446
- * })
447
- * });
448
- * ```
449
- *
450
- * @module env/schema
451
- */
452
- /**
453
- * 환경변수 스키마 정의
454
- */
455
- interface EnvVarSchema<T = string> {
456
- /** 환경변수 키 */
457
- key: string;
458
- /** 설명 (목적, 사용처) */
459
- description: string;
460
- /** 타입 */
461
- type: 'string' | 'number' | 'boolean' | 'url' | 'enum' | 'json';
462
- /** 필수 여부 */
463
- required?: boolean;
464
- /** 기본값 */
465
- default?: T;
466
- /** 검증/변환 함수 */
467
- validator?: (value: string) => T;
468
- /** Fallback 환경변수 키들 (backward compatibility) */
469
- fallbackKeys?: string[];
470
- /** 최소 길이 (문자열 타입) */
471
- minLength?: number;
472
- /** 민감정보 여부 (로깅 시 마스킹) */
473
- sensitive?: boolean;
474
- /**
475
- * 자동 생성 방식 — 값이 미지정이면 프로비저닝(secrets 관리 CLI)이 이 방식으로 생성한다.
476
- * 외부에서 받아야 하는 시크릿(API 키 등)은 generate를 비워 사용자 입력으로 둔다.
477
- */
478
- generate?: 'hex32' | 'hex64' | 'uuid' | 'base64url32';
479
- /** 예시 값들 (타입과 일치해야 함) */
480
- examples?: T[];
481
- /**
482
- * Next.js 프로세스에서 사용 여부
483
- *
484
- * - true: .env.local에 존재해야 함 (Next.js 서버 컴포넌트에서 접근 가능)
485
- * - false: .env.server에만 존재해야 함 (SPFN 서버에서만 접근)
486
- *
487
- * @default NEXT_PUBLIC_* 이면 true, 아니면 false
488
- */
489
- nextjs?: boolean;
490
- }
491
- /**
492
- * 스키마 컬렉션 타입
493
- */
494
- type EnvSchemaCollection = Record<string, EnvVarSchema<any>>;
495
- /**
496
- * Helper type: Check if field has default value
497
- */
498
- type HasDefault<T> = T extends {
499
- default: any;
500
- } ? true : false;
501
- /**
502
- * Helper type: Check if field is explicitly required
503
- */
504
- type IsRequired<T> = T extends {
505
- required: true;
506
- } ? true : false;
507
- /**
508
- * Helper type: Check if field should be required (has default OR required: true)
509
- */
510
- type ShouldBeRequired<T> = HasDefault<T> extends true ? true : IsRequired<T>;
511
- /**
512
- * 스키마로부터 타입 추출
513
- *
514
- * required: true 또는 default가 있는 필드 → 필수
515
- * required: false 또는 미지정 → optional (| undefined)
516
- */
517
- type InferEnvType<T extends EnvSchemaCollection> = {
518
- [K in keyof T as ShouldBeRequired<T[K]> extends true ? K : never]: T[K] extends EnvVarSchema<infer U> ? U : string;
519
- } & {
520
- [K in keyof T as ShouldBeRequired<T[K]> extends true ? never : K]?: T[K] extends EnvVarSchema<infer U> ? U | undefined : string | undefined;
521
- };
522
- /**
523
- * 스키마 정의 헬퍼 (타입 추론 지원)
524
- *
525
- * Automatically fills in the `key` property from object keys.
526
- *
527
- * @example
528
- * ```typescript
529
- * const schema = defineEnvSchema({
530
- * DATABASE_URL: envString({ description: 'Database URL', required: true })
531
- * });
532
- * // Automatically adds key: 'DATABASE_URL'
533
- * ```
534
- */
535
- declare function defineEnvSchema<T extends Record<string, any>>(schema: T): {
536
- [K in keyof T]: T[K] & {
537
- key: K;
538
- };
539
- };
540
- /**
541
- * 문자열 스키마 헬퍼
542
- *
543
- * @example
544
- * ```typescript
545
- * const schema = {
546
- * API_KEY: {
547
- * ...envString({
548
- * description: 'API authentication key',
549
- * required: true,
550
- * sensitive: true,
551
- * }),
552
- * key: 'API_KEY',
553
- * }
554
- * };
555
- * ```
556
- */
557
- declare function envString<T extends Omit<EnvVarSchema, 'key' | 'type'>>(options: T): T & {
558
- type: 'string';
559
- validator: (value: string) => string;
560
- };
561
- /**
562
- * 시크릿 스키마 헬퍼 — sensitive:true 자동.
563
- *
564
- * generate 지정 시 프로비저닝(secrets CLI)이 값을 자동 생성, 미지정이면 외부 입력(사용자가 붙여넣음).
565
- * 이로써 env.config.ts가 "설정(envString) vs 외부 시크릿(envSecret) vs 자동 시크릿(envSecret+generate)"을
566
- * 선언적으로 가른다 — CLI·프레임워크·프로비저닝이 한 원천을 읽는다.
567
- *
568
- * @example
569
- * ```typescript
570
- * SPFN_AUTH_SESSION_SECRET: envSecret({ description: '세션 서명 키', generate: 'base64url32' }),
571
- * OPENAI_API_KEY: envSecret({ description: 'OpenAI API 키' }), // generate 없음 → 외부 입력
572
- * ```
573
- */
574
- declare function envSecret<T extends Omit<EnvVarSchema, 'key' | 'type' | 'sensitive'>>(options: T): T & {
575
- type: 'string';
576
- sensitive: true;
577
- validator: (value: string) => string;
578
- };
579
- /**
580
- * 숫자 스키마 헬퍼
581
- *
582
- * @example
583
- * ```typescript
584
- * const schema = {
585
- * PORT: {
586
- * ...envNumber({
587
- * description: 'Server port',
588
- * default: 3000,
589
- * validator: createNumberParser({ min: 1, max: 65535 }),
590
- * }),
591
- * key: 'PORT',
592
- * }
593
- * };
594
- * ```
595
- */
596
- declare function envNumber<T extends Omit<EnvVarSchema<number>, 'key' | 'type'>>(options: T): T & {
597
- type: 'number';
598
- validator: (value: string) => number;
599
- };
600
- /**
601
- * Boolean 스키마 헬퍼
602
- *
603
- * @example
604
- * ```typescript
605
- * const schema = {
606
- * DEBUG: {
607
- * ...envBoolean({
608
- * description: 'Enable debug mode',
609
- * default: false,
610
- * }),
611
- * key: 'DEBUG',
612
- * }
613
- * };
614
- * ```
615
- */
616
- declare function envBoolean<T extends Omit<EnvVarSchema<boolean>, 'key' | 'type'>>(options: T): T & {
617
- type: 'boolean';
618
- validator: (value: string) => boolean;
619
- };
620
- /**
621
- * URL 스키마 헬퍼
622
- *
623
- * @example
624
- * ```typescript
625
- * const schema = {
626
- * DATABASE_URL: {
627
- * ...envUrl({
628
- * description: 'Database connection URL',
629
- * required: true,
630
- * validator: parsePostgresUrl,
631
- * }),
632
- * key: 'DATABASE_URL',
633
- * }
634
- * };
635
- * ```
636
- */
637
- declare function envUrl<T extends Omit<EnvVarSchema, 'key' | 'type'>>(options: T): T & {
638
- type: 'url';
639
- };
640
- /**
641
- * Enum 스키마 헬퍼
642
- *
643
- * @example
644
- * ```typescript
645
- * const schema = {
646
- * LOG_LEVEL: {
647
- * ...envEnum(['debug', 'info', 'warn', 'error'] as const, {
648
- * description: 'Logging level',
649
- * default: 'info',
650
- * }),
651
- * key: 'LOG_LEVEL',
652
- * }
653
- * };
654
- * ```
655
- */
656
- declare function envEnum<T extends string, O extends Omit<EnvVarSchema<T>, 'key' | 'type' | 'validator'>>(allowed: readonly T[], options: O): O & {
657
- type: 'enum';
658
- validator: (val: string) => T;
659
- };
660
- /**
661
- * JSON 스키마 헬퍼
662
- *
663
- * @example
664
- * ```typescript
665
- * const schema = {
666
- * CONFIG_JSON: {
667
- * ...envJson<{ host: string; port: number }>({
668
- * description: 'JSON configuration object',
669
- * required: true,
670
- * }),
671
- * key: 'CONFIG_JSON',
672
- * }
673
- * };
674
- * ```
675
- */
676
- declare function envJson<T = any, O extends Omit<EnvVarSchema<T>, 'key' | 'type' | 'validator'> = Omit<EnvVarSchema<T>, 'key' | 'type' | 'validator'>>(options: O): O & {
677
- type: 'json';
678
- validator: (val: string) => T;
679
- };
680
- /**
681
- * 환경변수가 클라이언트에서 접근 가능한지 확인
682
- * (NEXT_PUBLIC_ 접두사로 판단)
683
- *
684
- * @param key - 환경변수 키
685
- * @returns 클라이언트에서 접근 가능하면 true
686
- *
687
- * @example
688
- * ```typescript
689
- * isClientAccessible('NEXT_PUBLIC_API_URL'); // true
690
- * isClientAccessible('DATABASE_URL'); // false
691
- * ```
692
- */
693
- declare function isClientAccessible(key: string): boolean;
694
- /**
695
- * 환경변수가 서버 전용인지 확인
696
- * (NEXT_PUBLIC_ 접두사가 없으면 서버 전용)
697
- *
698
- * @param key - 환경변수 키
699
- * @returns 서버 전용이면 true
700
- *
701
- * @example
702
- * ```typescript
703
- * isServerOnly('DATABASE_URL'); // true
704
- * isServerOnly('NEXT_PUBLIC_API_URL'); // false
705
- * ```
706
- */
707
- declare function isServerOnly(key: string): boolean;
708
- /**
709
- * 스키마의 nextjs 옵션 값 결정
710
- *
711
- * 명시적으로 지정되지 않은 경우:
712
- * - NEXT_PUBLIC_* → true
713
- * - 그 외 → false
714
- *
715
- * @param schema - 환경변수 스키마
716
- * @returns Next.js 프로세스에서 사용 가능 여부
717
- */
718
- declare function isNextjsAccessible(schema: EnvVarSchema): boolean;
719
- /**
720
- * 스키마가 SPFN 서버 전용인지 확인
721
- *
722
- * @param schema - 환경변수 스키마
723
- * @returns SPFN 서버에서만 사용되면 true
724
- */
725
- declare function isSpfnServerOnly(schema: EnvVarSchema): boolean;
726
-
727
- /**
728
- * Environment Variable Registry
729
- *
730
- * 환경변수 스키마를 등록하고 타입 안전하게 접근할 수 있는 레지스트리
731
- *
732
- * @example
733
- * ```typescript
734
- * const schema = defineEnvSchema({
735
- * DATABASE_URL: envString({ description: 'Database URL', required: true })
736
- * });
737
- *
738
- * const registry = createEnvRegistry(schema);
739
- * const env = registry.validate(); // 검증 + env 반환
740
- * console.log(env.DATABASE_URL);
741
- * ```
742
- *
743
- * @module env/registry
744
- */
745
-
746
- /**
747
- * 환경변수 레지스트리
748
- *
749
- * 스키마 기반 환경변수 관리 및 검증
750
- */
751
- declare class EnvRegistry<T extends EnvSchemaCollection = EnvSchemaCollection> {
752
- private schemas;
753
- private hasValidated;
754
- constructor(schemas?: T);
755
- /**
756
- * 스키마 등록
757
- */
758
- register(schema: EnvVarSchema): void;
759
- /**
760
- * 여러 스키마 등록
761
- */
762
- registerMultiple(schemas: EnvSchemaCollection): void;
763
- /**
764
- * 검증 상태 리셋 (테스트용)
765
- */
766
- reset(): void;
767
- /**
768
- * 환경변수 원시값 가져오기 (fallback 지원)
769
- */
770
- private getRawValue;
771
- /**
772
- * 값에 validator 적용
773
- */
774
- private applyValidator;
775
- /**
776
- * 스키마 검증 수행 (값 읽기 없이)
777
- *
778
- * @internal
779
- */
780
- private validateSchemas;
781
- /**
782
- * SKIP_ENV_VALIDATION 환경변수 확인
783
- */
784
- private shouldSkipValidation;
785
- /**
786
- * 실제 접근 시점에 환경변수 값 가져오기 및 검증
787
- *
788
- * @internal
789
- */
790
- private getAndValidate;
791
- /**
792
- * 모든 환경변수를 명시적으로 검증 (SKIP_ENV_VALIDATION 무시)
793
- *
794
- * CLI에서 사용하기 위한 메서드로, 모든 required 환경변수를 강제 검증합니다.
795
- *
796
- * @returns 검증 결과 (errors, warnings)
797
- */
798
- validateAll(): {
799
- errors: Array<{
800
- key: string;
801
- message: string;
802
- }>;
803
- warnings: Array<{
804
- key: string;
805
- message: string;
806
- }>;
807
- };
808
- /**
809
- * 환경변수 검증 및 타입 안전한 env 객체 반환
810
- *
811
- * Proxy 기반으로 구현되어 실제 환경변수 접근 시점에 값을 읽고 검증합니다.
812
- * 이를 통해 dotenv 로딩 타이밍과 무관하게 최신 환경변수 값을 가져올 수 있습니다.
813
- *
814
- * @returns 검증된 환경변수 객체 (Proxy)
815
- * @throws {Error} 필수 변수 누락 또는 검증 실패 시
816
- *
817
- * @example
818
- * ```typescript
819
- * const registry = createEnvRegistry(schema);
820
- * const env = registry.validate(); // 스키마만 검증
821
- * // ... dotenv 로딩 ...
822
- * console.log(env.DATABASE_URL); // 이 시점에 실제 값 읽기
823
- * ```
824
- */
825
- validate(): InferEnvType<T>;
826
- }
827
- /**
828
- * 환경변수 검증 결과
829
- */
830
- interface EnvValidationResult {
831
- valid: boolean;
832
- errors: Array<{
833
- key: string;
834
- message: string;
835
- }>;
836
- warnings: Array<{
837
- key: string;
838
- message: string;
839
- }>;
840
- }
841
- /**
842
- * 레지스트리 생성 헬퍼
843
- *
844
- * @example
845
- * ```typescript
846
- * const schema = defineEnvSchema({
847
- * DATABASE_URL: envString({ description: 'Database URL', required: true })
848
- * });
849
- *
850
- * const registry = createEnvRegistry(schema);
851
- * const env = registry.validate();
852
- * ```
853
- */
854
- declare function createEnvRegistry<T extends EnvSchemaCollection>(schemas: T): EnvRegistry<T>;
855
- /**
856
- * 모든 환경변수를 명시적으로 검증 (SKIP_ENV_VALIDATION 무시)
857
- *
858
- * CLI `spfn env validate` 명령어에서 사용
859
- *
860
- * @param registries - 검증할 레지스트리 배열
861
- * @returns 검증 결과
862
- *
863
- * @example
864
- * ```typescript
865
- * const result = validateAllEnv([coreRegistry, authRegistry]);
866
- * if (!result.valid) {
867
- * console.error('Missing env vars:', result.errors);
868
- * process.exit(1);
869
- * }
870
- * ```
871
- */
872
- declare function validateAllEnv(registries: EnvRegistry<any>[]): EnvValidationResult;
873
-
874
438
  /**
875
439
  * Environment Types
876
440
  */
@@ -879,4 +443,4 @@ declare function validateAllEnv(registries: EnvRegistry<any>[]): EnvValidationRe
879
443
  */
880
444
  type NodeEnv = 'local' | 'development' | 'staging' | 'production' | 'test';
881
445
 
882
- export { EnvRegistry, type EnvSchemaCollection, type EnvValidationResult, type EnvVarSchema, type InferEnvType, type NodeEnv, type Parser, chain, createArrayParser, createEnumParser, createEnvRegistry, createJsonParser, createNumberParser, createPasswordParser, createSecureSecretParser, createStringParser, createUrlParser, defineEnvSchema, envBoolean, envEnum, envJson, envNumber, envSecret, envString, envUrl, isClientAccessible, isNextjsAccessible, isServerOnly, isSpfnServerOnly, optional, parseArray, parseBoolean, parseDecimal, parseEnum, parseInteger, parseJson, parseNumber, parsePostgresUrl, parseRedisUrl, parseString, parseUrl, validateAllEnv, withFallback };
446
+ export { type NodeEnv, type Parser, chain, createArrayParser, createEnumParser, createJsonParser, createNumberParser, createPasswordParser, createSecureSecretParser, createStringParser, createUrlParser, optional, parseArray, parseBoolean, parseDecimal, parseEnum, parseInteger, parseJson, parseNumber, parsePostgresUrl, parseRedisUrl, parseString, parseUrl, withFallback };
package/dist/env/index.js CHANGED
@@ -35,9 +35,7 @@ function parseBoolean(value) {
35
35
  if (["false", "0", "no"].includes(normalized)) {
36
36
  return false;
37
37
  }
38
- throw new Error(
39
- `Must be a boolean value (true/false, 1/0, yes/no), got: ${value}`
40
- );
38
+ throw new Error("Must be a boolean value (true/false, 1/0, yes/no)");
41
39
  }
42
40
  function parseNumber(value, options = {}) {
43
41
  const { min, max, integer = false } = options;
@@ -46,16 +44,16 @@ function parseNumber(value, options = {}) {
46
44
  }
47
45
  const num = Number(value);
48
46
  if (isNaN(num)) {
49
- throw new Error(`Must be a valid number, got: ${value}`);
47
+ throw new Error("Must be a valid number");
50
48
  }
51
49
  if (integer && !Number.isInteger(num)) {
52
- throw new Error(`Must be an integer, got: ${value}`);
50
+ throw new Error("Must be an integer");
53
51
  }
54
52
  if (min !== void 0 && num < min) {
55
- throw new Error(`Must be at least ${min}, got: ${num}`);
53
+ throw new Error(`Must be at least ${min}`);
56
54
  }
57
55
  if (max !== void 0 && num > max) {
58
- throw new Error(`Must be at most ${max}, got: ${num}`);
56
+ throw new Error(`Must be at most ${max}`);
59
57
  }
60
58
  return num;
61
59
  }
@@ -75,7 +73,7 @@ function parseUrl(value, options = {}) {
75
73
  url = new URL(value);
76
74
  } catch (error) {
77
75
  if (error instanceof TypeError) {
78
- throw new Error(`Invalid URL: ${value}`);
76
+ throw new Error("Invalid URL");
79
77
  }
80
78
  throw error;
81
79
  }
@@ -131,14 +129,14 @@ function parseEnum(value, allowed, caseInsensitive = false) {
131
129
  const index = normalizedAllowed.indexOf(normalizedValue);
132
130
  if (index === -1) {
133
131
  throw new Error(
134
- `Must be one of [${allowed.join(", ")}], got: ${value}`
132
+ `Must be one of [${allowed.join(", ")}]`
135
133
  );
136
134
  }
137
135
  return allowed[index];
138
136
  }
139
137
  if (!allowed.includes(value)) {
140
138
  throw new Error(
141
- `Must be one of [${allowed.join(", ")}], got: ${value}`
139
+ `Must be one of [${allowed.join(", ")}]`
142
140
  );
143
141
  }
144
142
  return value;
@@ -149,10 +147,8 @@ function createEnumParser(allowed, caseInsensitive = false) {
149
147
  function parseJson(value) {
150
148
  try {
151
149
  return JSON.parse(value);
152
- } catch (error) {
153
- throw new Error(
154
- `Invalid JSON: ${error instanceof Error ? error.message : "Unknown error"}`
155
- );
150
+ } catch {
151
+ throw new Error("Invalid JSON");
156
152
  }
157
153
  }
158
154
  function createJsonParser() {
@@ -336,7 +332,7 @@ function envEnum(allowed, options) {
336
332
  type: "enum",
337
333
  validator: (val) => {
338
334
  if (!allowed.includes(val)) {
339
- throw new Error(`Must be one of: ${allowed.join(", ")}, got: ${val}`);
335
+ throw new Error(`Must be one of: ${allowed.join(", ")}`);
340
336
  }
341
337
  return val;
342
338
  }
@@ -521,9 +517,10 @@ var EnvRegistry = class {
521
517
  try {
522
518
  schema.validator(value);
523
519
  } catch (error) {
520
+ const detail = schema.sensitive ? "(value hidden \u2014 sensitive key)" : error instanceof Error ? error.message : String(error);
524
521
  errors.push({
525
522
  key,
526
- message: `${key} validation failed: ${error instanceof Error ? error.message : String(error)}`
523
+ message: `${key} validation failed: ${detail}`
527
524
  });
528
525
  }
529
526
  }