envapt 8.1.1 → 8.2.1

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 (125) hide show
  1. package/CHANGELOG.md +18 -15
  2. package/README.md +5 -6
  3. package/dist/node/config.cjs.map +1 -1
  4. package/dist/node/config.mjs.map +1 -1
  5. package/dist/node/converters/BuiltInConverters.cjs.map +1 -1
  6. package/dist/node/converters/BuiltInConverters.mjs.map +1 -1
  7. package/dist/node/converters/Converters.cjs.map +1 -1
  8. package/dist/node/converters/Converters.mjs.map +1 -1
  9. package/dist/node/converters/ListOfBuiltInConverters.cjs.map +1 -1
  10. package/dist/node/converters/ListOfBuiltInConverters.mjs.map +1 -1
  11. package/dist/node/converters/ValueConverter.cjs.map +1 -1
  12. package/dist/node/converters/ValueConverter.mjs.map +1 -1
  13. package/dist/node/core/AdvancedMethods.cjs.map +1 -1
  14. package/dist/node/core/AdvancedMethods.mjs.map +1 -1
  15. package/dist/node/core/EnvapterBase.cjs.map +1 -1
  16. package/dist/node/core/EnvapterBase.mjs.map +1 -1
  17. package/dist/node/core/EnvironmentMethods.cjs.map +1 -1
  18. package/dist/node/core/EnvironmentMethods.mjs.map +1 -1
  19. package/dist/node/core/PrimitiveMethods.cjs.map +1 -1
  20. package/dist/node/core/PrimitiveMethods.mjs.map +1 -1
  21. package/dist/node/core/engine.cjs.map +1 -1
  22. package/dist/node/core/engine.mjs.map +1 -1
  23. package/dist/node/core/missing.cjs.map +1 -1
  24. package/dist/node/core/missing.mjs.map +1 -1
  25. package/dist/node/core/paths.cjs.map +1 -1
  26. package/dist/node/core/paths.mjs.map +1 -1
  27. package/dist/node/core/state.cjs.map +1 -1
  28. package/dist/node/core/state.mjs.map +1 -1
  29. package/dist/node/decorators/legacy/Envapt.cjs.map +1 -1
  30. package/dist/node/decorators/legacy/Envapt.mjs.map +1 -1
  31. package/dist/node/decorators/legacy/SugarDecorators.cjs.map +1 -1
  32. package/dist/node/decorators/legacy/SugarDecorators.mjs.map +1 -1
  33. package/dist/node/decorators/modern/Envapt.cjs.map +1 -1
  34. package/dist/node/decorators/modern/Envapt.mjs.map +1 -1
  35. package/dist/node/decorators/modern/SugarDecorators.cjs.map +1 -1
  36. package/dist/node/decorators/modern/SugarDecorators.mjs.map +1 -1
  37. package/dist/node/decorators/modern/createAccessorDecorator.cjs.map +1 -1
  38. package/dist/node/decorators/modern/createAccessorDecorator.mjs.map +1 -1
  39. package/dist/node/decorators/resolveDecoratorValue.cjs.map +1 -1
  40. package/dist/node/decorators/resolveDecoratorValue.mjs.map +1 -1
  41. package/dist/node/engine/Envapter.cjs.map +1 -1
  42. package/dist/node/engine/Envapter.mjs.map +1 -1
  43. package/dist/node/engine/NodeEnvapter.cjs.map +1 -1
  44. package/dist/node/engine/NodeEnvapter.mjs.map +1 -1
  45. package/dist/node/engine/TemplateResolver.cjs.map +1 -1
  46. package/dist/node/engine/TemplateResolver.mjs.map +1 -1
  47. package/dist/node/engine/Validators.cjs.map +1 -1
  48. package/dist/node/engine/Validators.mjs.map +1 -1
  49. package/dist/node/infra/Debug.cjs.map +1 -1
  50. package/dist/node/infra/Debug.mjs.map +1 -1
  51. package/dist/node/infra/Dotenv.cjs.map +1 -1
  52. package/dist/node/infra/Dotenv.mjs.map +1 -1
  53. package/dist/node/infra/Error.cjs.map +1 -1
  54. package/dist/node/infra/Error.mjs.map +1 -1
  55. package/dist/node/infra/recase.cjs.map +1 -1
  56. package/dist/node/infra/recase.mjs.map +1 -1
  57. package/dist/node/infra/runtime.cjs.map +1 -1
  58. package/dist/node/infra/runtime.mjs.map +1 -1
  59. package/dist/node/sources/FileSource.cjs.map +1 -1
  60. package/dist/node/sources/FileSource.mjs.map +1 -1
  61. package/dist/node/sources/PortableSource.cjs.map +1 -1
  62. package/dist/node/sources/PortableSource.mjs.map +1 -1
  63. package/dist/node/sources/UnboundSource.cjs.map +1 -1
  64. package/dist/node/sources/UnboundSource.mjs.map +1 -1
  65. package/dist/node/sources/coerce.cjs.map +1 -1
  66. package/dist/node/sources/coerce.mjs.map +1 -1
  67. package/dist/node/sources/merge.cjs.map +1 -1
  68. package/dist/node/sources/merge.mjs.map +1 -1
  69. package/dist/portable/converters/BuiltInConverters.mjs.map +1 -1
  70. package/dist/portable/converters/Converters.mjs.map +1 -1
  71. package/dist/portable/converters/ListOfBuiltInConverters.mjs.map +1 -1
  72. package/dist/portable/converters/ValueConverter.mjs.map +1 -1
  73. package/dist/portable/core/AdvancedMethods.mjs.map +1 -1
  74. package/dist/portable/core/EnvapterBase.mjs.map +1 -1
  75. package/dist/portable/core/EnvironmentMethods.mjs.map +1 -1
  76. package/dist/portable/core/PrimitiveMethods.mjs.map +1 -1
  77. package/dist/portable/core/engine.mjs.map +1 -1
  78. package/dist/portable/core/missing.mjs.map +1 -1
  79. package/dist/portable/core/paths.mjs.map +1 -1
  80. package/dist/portable/core/state.mjs.map +1 -1
  81. package/dist/portable/decorators/legacy/Envapt.mjs.map +1 -1
  82. package/dist/portable/decorators/legacy/SugarDecorators.mjs.map +1 -1
  83. package/dist/portable/decorators/modern/Envapt.mjs.map +1 -1
  84. package/dist/portable/decorators/modern/SugarDecorators.mjs.map +1 -1
  85. package/dist/portable/decorators/modern/createAccessorDecorator.mjs.map +1 -1
  86. package/dist/portable/decorators/resolveDecoratorValue.mjs.map +1 -1
  87. package/dist/portable/engine/Envapter.mjs.map +1 -1
  88. package/dist/portable/engine/PortableEnvapter.mjs.map +1 -1
  89. package/dist/portable/engine/TemplateResolver.mjs.map +1 -1
  90. package/dist/portable/engine/Validators.mjs.map +1 -1
  91. package/dist/portable/engine/fileApiStub.mjs.map +1 -1
  92. package/dist/portable/infra/Debug.mjs.map +1 -1
  93. package/dist/portable/infra/Dotenv.mjs.map +1 -1
  94. package/dist/portable/infra/Error.mjs.map +1 -1
  95. package/dist/portable/infra/recase.mjs.map +1 -1
  96. package/dist/portable/infra/runtime.mjs.map +1 -1
  97. package/dist/portable/sources/PortableSource.mjs.map +1 -1
  98. package/dist/portable/sources/UnboundSource.mjs.map +1 -1
  99. package/dist/portable/sources/coerce.mjs.map +1 -1
  100. package/dist/portable/sources/merge.mjs.map +1 -1
  101. package/dist/types/converters/Converters.d.mts +4 -5
  102. package/dist/types/core/AdvancedMethods.d.mts +6 -12
  103. package/dist/types/core/EnvapterBase.d.mts +9 -12
  104. package/dist/types/core/Environment.d.mts +1 -2
  105. package/dist/types/core/EnvironmentMethods.d.mts +1 -6
  106. package/dist/types/core/PrimitiveMethods.d.mts +1 -5
  107. package/dist/types/decorators/legacy/Envapt.d.mts +17 -19
  108. package/dist/types/decorators/legacy/SugarDecorators.d.mts +12 -13
  109. package/dist/types/decorators/modern/Envapt.d.mts +17 -19
  110. package/dist/types/decorators/modern/SugarDecorators.d.mts +12 -13
  111. package/dist/types/engine/Envapter.d.mts +2 -2
  112. package/dist/types/engine/NodeEnvapter.d.mts +5 -6
  113. package/dist/types/engine/PortableEnvapter.d.mts +5 -7
  114. package/dist/types/infra/Debug.d.mts +3 -5
  115. package/dist/types/infra/Dotenv.d.mts +2 -4
  116. package/dist/types/infra/Error.d.mts +4 -5
  117. package/dist/types/infra/StandardSchema.d.mts +5 -7
  118. package/dist/types/sources/FileSource.d.mts +1 -2
  119. package/dist/types/sources/PortableSource.d.mts +7 -8
  120. package/dist/types/sources/merge.d.mts +1 -2
  121. package/dist/types/types/Conversion.d.mts +0 -4
  122. package/dist/types/types/Decorator.d.mts +2 -3
  123. package/dist/types/types/Options.d.mts +7 -7
  124. package/dist/types/types/Schema.d.mts +1 -1
  125. package/package.json +11 -13
@@ -31,11 +31,11 @@ import { EnvaptFieldDecorator } from "../../types/Decorator.mjs";
31
31
  * }
32
32
  * ```
33
33
  */
34
- declare function Envapt(key: EnvKeyInput, options?: {
34
+ export declare function Envapt(key: EnvKeyInput, options?: {
35
35
  fallback: undefined;
36
36
  converter?: undefined;
37
37
  }): EnvaptFieldDecorator<string | undefined>;
38
- declare function Envapt<TFallback>(key: EnvKeyInput, options: {
38
+ export declare function Envapt<TFallback>(key: EnvKeyInput, options: {
39
39
  converter: (raw: string | undefined, fallback: TFallback) => TFallback;
40
40
  fallback: TFallback;
41
41
  } | {
@@ -66,7 +66,7 @@ declare function Envapt<TFallback>(key: EnvKeyInput, options: {
66
66
  * }
67
67
  * ```
68
68
  */
69
- declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
69
+ export declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
70
70
  converter: ConverterFunction<TReturnType>;
71
71
  required?: false;
72
72
  } | {
@@ -89,11 +89,11 @@ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
89
89
  * \@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })
90
90
  * static readonly port: number;
91
91
  *
92
- * // the Url fallback is a URL instance, not a string
92
+ * // the Url fallback is a URL instance
93
93
  * \@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })
94
94
  * static readonly url: URL;
95
95
  *
96
- * // prefers CANARY_URL when present, otherwise APP_URL
96
+ * // reads CANARY_URL when present, otherwise APP_URL
97
97
  * \@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })
98
98
  * static readonly canaryUrl: URL | undefined;
99
99
  *
@@ -112,7 +112,7 @@ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
112
112
  * }
113
113
  * ```
114
114
  */
115
- declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
115
+ export declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
116
116
  converter: TConverter;
117
117
  fallback: InferConverterFallbackType<TConverter>;
118
118
  required?: false;
@@ -120,7 +120,7 @@ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvK
120
120
  converter: TConverter;
121
121
  required: true;
122
122
  }): EnvaptFieldDecorator<InferConverterReturnType<TConverter>>;
123
- declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
123
+ export declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
124
124
  converter: TConverter;
125
125
  fallback?: undefined;
126
126
  required?: false;
@@ -142,7 +142,7 @@ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvK
142
142
  * }
143
143
  * ```
144
144
  */
145
- declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
145
+ export declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
146
146
  converter: TConstructor;
147
147
  fallback: InferPrimitiveReturnType<TConstructor>;
148
148
  required?: false;
@@ -150,16 +150,15 @@ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyIn
150
150
  converter: TConstructor;
151
151
  required: true;
152
152
  }): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor>>;
153
- declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
153
+ export declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
154
154
  converter: TConstructor;
155
155
  fallback?: undefined;
156
156
  required?: false;
157
157
  }): EnvaptFieldDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;
158
158
  /**
159
159
  * Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env
160
- * value is missing or empty after trimming, independent of the global `Envapter.strict` flag.
161
- * Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime
162
- * Validator rejects dynamic objects that bypass the types.
160
+ * value is missing or empty. Pairing `required: true` with `fallback` matches no overload at
161
+ * compile time, and a call that bypasses the types throws `InvalidUserDefinedConfig` at runtime.
163
162
  *
164
163
  * @param key - Environment variable name(s) to load
165
164
  * @param options - `{ required: true }`
@@ -172,17 +171,17 @@ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyIn
172
171
  * }
173
172
  * ```
174
173
  */
175
- declare function Envapt(key: EnvKeyInput, options: {
174
+ export declare function Envapt(key: EnvKeyInput, options: {
176
175
  required: true;
177
176
  }): EnvaptFieldDecorator<string>;
178
177
  /**
179
- * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,
180
- * so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing
181
- * `schema` with `converter` matches no overload at compile time, and the runtime Validator
182
- * rejects dynamic objects that bypass the types.
178
+ * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only.
179
+ * A `validate` that returns a Promise throws `InvalidUserDefinedConfig` at runtime. Pairing
180
+ * `schema` with `converter` matches no overload at compile time, and a call that bypasses the
181
+ * types throws `InvalidUserDefinedConfig` at runtime.
183
182
  * @public
184
183
  */
185
- declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
184
+ export declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
186
185
  schema: SchemaConstraint<Schema>;
187
186
  fallback?: InferSchemaOutput<Schema>;
188
187
  required?: false;
@@ -191,5 +190,4 @@ declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, optio
191
190
  required: true;
192
191
  }): EnvaptFieldDecorator<InferSchemaOutput<Schema>>;
193
192
  //#endregion
194
- export { Envapt };
195
193
  //# sourceMappingURL=Envapt.d.mts.map
@@ -7,38 +7,37 @@ import { EnvaptFieldDecorator } from "../../types/Decorator.mjs";
7
7
  * @public
8
8
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
9
9
  */
10
- declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptFieldDecorator<boolean>;
11
- declare function EnvBool(key: EnvKeyInput): EnvaptFieldDecorator<boolean | undefined>;
10
+ export declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptFieldDecorator<boolean>;
11
+ export declare function EnvBool(key: EnvKeyInput): EnvaptFieldDecorator<boolean | undefined>;
12
12
  /**
13
13
  * Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.
14
14
  * @public
15
15
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
16
16
  */
17
- declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptFieldDecorator<number>;
18
- declare function EnvNum(key: EnvKeyInput): EnvaptFieldDecorator<number | undefined>;
17
+ export declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptFieldDecorator<number>;
18
+ export declare function EnvNum(key: EnvKeyInput): EnvaptFieldDecorator<number | undefined>;
19
19
  /**
20
20
  * Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.
21
21
  * @public
22
22
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
23
23
  */
24
- declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptFieldDecorator<string>;
25
- declare function EnvStr(key: EnvKeyInput): EnvaptFieldDecorator<string | undefined>;
24
+ export declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptFieldDecorator<string>;
25
+ export declare function EnvStr(key: EnvKeyInput): EnvaptFieldDecorator<string | undefined>;
26
26
  /**
27
27
  * Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a
28
28
  * millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.
29
29
  * @public
30
30
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
31
31
  */
32
- declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptFieldDecorator<number>;
33
- declare function EnvTime(key: EnvKeyInput): EnvaptFieldDecorator<number | undefined>;
32
+ export declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptFieldDecorator<number>;
33
+ export declare function EnvTime(key: EnvKeyInput): EnvaptFieldDecorator<number | undefined>;
34
34
  /**
35
- * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`
36
- * instance, not a URL string.
35
+ * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback must be a
36
+ * `URL` instance.
37
37
  * @public
38
38
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
39
39
  */
40
- declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptFieldDecorator<URL>;
41
- declare function EnvUrl(key: EnvKeyInput): EnvaptFieldDecorator<URL | undefined>;
40
+ export declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptFieldDecorator<URL>;
41
+ export declare function EnvUrl(key: EnvKeyInput): EnvaptFieldDecorator<URL | undefined>;
42
42
  //#endregion
43
- export { EnvBool, EnvNum, EnvStr, EnvTime, EnvUrl };
44
43
  //# sourceMappingURL=SugarDecorators.d.mts.map
@@ -31,11 +31,11 @@ import { EnvaptAccessorDecorator } from "../../types/Decorator.mjs";
31
31
  * }
32
32
  * ```
33
33
  */
34
- declare function Envapt(key: EnvKeyInput, options?: {
34
+ export declare function Envapt(key: EnvKeyInput, options?: {
35
35
  fallback: undefined;
36
36
  converter?: undefined;
37
37
  }): EnvaptAccessorDecorator<string | undefined>;
38
- declare function Envapt<TFallback>(key: EnvKeyInput, options: {
38
+ export declare function Envapt<TFallback>(key: EnvKeyInput, options: {
39
39
  converter: (raw: string | undefined, fallback: TFallback) => TFallback;
40
40
  fallback: TFallback;
41
41
  } | {
@@ -66,7 +66,7 @@ declare function Envapt<TFallback>(key: EnvKeyInput, options: {
66
66
  * }
67
67
  * ```
68
68
  */
69
- declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
69
+ export declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
70
70
  converter: ConverterFunction<TReturnType>;
71
71
  required?: false;
72
72
  } | {
@@ -89,11 +89,11 @@ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
89
89
  * \@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })
90
90
  * static accessor port: number;
91
91
  *
92
- * // the Url fallback is a URL instance, not a string
92
+ * // the Url fallback is a URL instance
93
93
  * \@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })
94
94
  * static accessor url: URL;
95
95
  *
96
- * // prefers CANARY_URL when present, otherwise APP_URL
96
+ * // reads CANARY_URL when present, otherwise APP_URL
97
97
  * \@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })
98
98
  * static accessor canaryUrl: URL | undefined;
99
99
  *
@@ -112,7 +112,7 @@ declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
112
112
  * }
113
113
  * ```
114
114
  */
115
- declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
115
+ export declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
116
116
  converter: TConverter;
117
117
  fallback: InferConverterFallbackType<TConverter>;
118
118
  required?: false;
@@ -120,7 +120,7 @@ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvK
120
120
  converter: TConverter;
121
121
  required: true;
122
122
  }): EnvaptAccessorDecorator<InferConverterReturnType<TConverter>>;
123
- declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
123
+ export declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
124
124
  converter: TConverter;
125
125
  fallback?: undefined;
126
126
  required?: false;
@@ -142,7 +142,7 @@ declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvK
142
142
  * }
143
143
  * ```
144
144
  */
145
- declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
145
+ export declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
146
146
  converter: TConstructor;
147
147
  fallback: InferPrimitiveReturnType<TConstructor>;
148
148
  required?: false;
@@ -150,16 +150,15 @@ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyIn
150
150
  converter: TConstructor;
151
151
  required: true;
152
152
  }): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor>>;
153
- declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
153
+ export declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
154
154
  converter: TConstructor;
155
155
  fallback?: undefined;
156
156
  required?: false;
157
157
  }): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;
158
158
  /**
159
159
  * Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env
160
- * value is missing or empty after trimming, independent of the global `Envapter.strict` flag.
161
- * Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime
162
- * Validator rejects dynamic objects that bypass the types.
160
+ * value is missing or empty. Pairing `required: true` with `fallback` matches no overload at
161
+ * compile time, and a call that bypasses the types throws `InvalidUserDefinedConfig` at runtime.
163
162
  *
164
163
  * @param key - Environment variable name(s) to load
165
164
  * @param options - `{ required: true }`
@@ -172,17 +171,17 @@ declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyIn
172
171
  * }
173
172
  * ```
174
173
  */
175
- declare function Envapt(key: EnvKeyInput, options: {
174
+ export declare function Envapt(key: EnvKeyInput, options: {
176
175
  required: true;
177
176
  }): EnvaptAccessorDecorator<string>;
178
177
  /**
179
- * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,
180
- * so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing
181
- * `schema` with `converter` matches no overload at compile time, and the runtime Validator
182
- * rejects dynamic objects that bypass the types.
178
+ * A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only.
179
+ * A `validate` that returns a Promise throws `InvalidUserDefinedConfig` at runtime. Pairing
180
+ * `schema` with `converter` matches no overload at compile time, and a call that bypasses the
181
+ * types throws `InvalidUserDefinedConfig` at runtime.
183
182
  * @public
184
183
  */
185
- declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
184
+ export declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
186
185
  schema: SchemaConstraint<Schema>;
187
186
  fallback?: InferSchemaOutput<Schema>;
188
187
  required?: false;
@@ -191,5 +190,4 @@ declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, optio
191
190
  required: true;
192
191
  }): EnvaptAccessorDecorator<InferSchemaOutput<Schema>>;
193
192
  //#endregion
194
- export { Envapt };
195
193
  //# sourceMappingURL=Envapt.d.mts.map
@@ -7,38 +7,37 @@ import { EnvaptAccessorDecorator } from "../../types/Decorator.mjs";
7
7
  * @public
8
8
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
9
9
  */
10
- declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptAccessorDecorator<boolean>;
11
- declare function EnvBool(key: EnvKeyInput): EnvaptAccessorDecorator<boolean | undefined>;
10
+ export declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptAccessorDecorator<boolean>;
11
+ export declare function EnvBool(key: EnvKeyInput): EnvaptAccessorDecorator<boolean | undefined>;
12
12
  /**
13
13
  * Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.
14
14
  * @public
15
15
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
16
16
  */
17
- declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptAccessorDecorator<number>;
18
- declare function EnvNum(key: EnvKeyInput): EnvaptAccessorDecorator<number | undefined>;
17
+ export declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptAccessorDecorator<number>;
18
+ export declare function EnvNum(key: EnvKeyInput): EnvaptAccessorDecorator<number | undefined>;
19
19
  /**
20
20
  * Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.
21
21
  * @public
22
22
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
23
23
  */
24
- declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptAccessorDecorator<string>;
25
- declare function EnvStr(key: EnvKeyInput): EnvaptAccessorDecorator<string | undefined>;
24
+ export declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptAccessorDecorator<string>;
25
+ export declare function EnvStr(key: EnvKeyInput): EnvaptAccessorDecorator<string | undefined>;
26
26
  /**
27
27
  * Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a
28
28
  * millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.
29
29
  * @public
30
30
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
31
31
  */
32
- declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptAccessorDecorator<number>;
33
- declare function EnvTime(key: EnvKeyInput): EnvaptAccessorDecorator<number | undefined>;
32
+ export declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptAccessorDecorator<number>;
33
+ export declare function EnvTime(key: EnvKeyInput): EnvaptAccessorDecorator<number | undefined>;
34
34
  /**
35
- * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`
36
- * instance, not a URL string.
35
+ * Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback must be a
36
+ * `URL` instance.
37
37
  * @public
38
38
  * @see {@link https://envapt.materwelon.dev/docs/decorators#shorthand-decorators}
39
39
  */
40
- declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptAccessorDecorator<URL>;
41
- declare function EnvUrl(key: EnvKeyInput): EnvaptAccessorDecorator<URL | undefined>;
40
+ export declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptAccessorDecorator<URL>;
41
+ export declare function EnvUrl(key: EnvKeyInput): EnvaptAccessorDecorator<URL | undefined>;
42
42
  //#endregion
43
- export { EnvBool, EnvNum, EnvStr, EnvTime, EnvUrl };
44
43
  //# sourceMappingURL=SugarDecorators.d.mts.map
@@ -25,7 +25,7 @@ import { AdvancedMethods } from "../core/AdvancedMethods.mjs";
25
25
  *
26
26
  * @public
27
27
  */
28
- declare class Envapter extends AdvancedMethods {
28
+ export declare class Envapter extends AdvancedMethods {
29
29
  /**
30
30
  * Tagged template literal for resolving environment variables in template strings.
31
31
  *
@@ -84,5 +84,5 @@ declare class Envapter extends AdvancedMethods {
84
84
  has(key: EnvKeyInput): boolean;
85
85
  }
86
86
  //#endregion
87
- export { Envapter, Environment };
87
+ export { Environment };
88
88
  //# sourceMappingURL=Envapter.d.mts.map
@@ -9,7 +9,7 @@ import { EnvFileOptions } from "../infra/Dotenv.mjs";
9
9
  * `Envapter.fileApiMode`.
10
10
  * @public
11
11
  */
12
- declare class NodeEnvapter extends Envapter {
12
+ export declare class NodeEnvapter extends Envapter {
13
13
  /**
14
14
  * Set custom .env file paths. Accepts either a single path or array of paths.
15
15
  * Setting new paths clears the cache and reloads environment variables.
@@ -27,12 +27,12 @@ declare class NodeEnvapter extends Envapter {
27
27
  /**
28
28
  * Set a base directory that relative `.env` paths resolve against instead of
29
29
  * `process.cwd()`: the auto-cascade, `Envapter.configureProfiles` paths, and relative
30
- * `envPaths`. Absolute paths always bypass it. Pass a directory, or a module URL
31
- * (`import.meta.url`, ESM) / `import.meta.dirname` / `__dirname` (CJS) to anchor
32
- * resolution next to the calling file regardless of launch directory.
30
+ * `envPaths`. Absolute paths always bypass it. Pass a directory path (`import.meta.dirname`,
31
+ * or `__dirname` in CJS) or a module URL (`import.meta.url`) to resolve paths next to the
32
+ * calling file regardless of launch directory.
33
33
  *
34
34
  * Set this before `envPaths` so relative `envPaths` validate against the right directory.
35
- * Unset (`undefined`) restores `process.cwd()` resolution.
35
+ * Setting `undefined` restores `process.cwd()` resolution.
36
36
  * @see {@link https://envapt.materwelon.dev/docs/configuration#reading-from-a-fixed-directory}
37
37
  */
38
38
  static set baseDir(value: string | URL | undefined);
@@ -79,5 +79,4 @@ declare class NodeEnvapter extends Envapter {
79
79
  static resetProfiles(): void;
80
80
  }
81
81
  //#endregion
82
- export { NodeEnvapter };
83
82
  //# sourceMappingURL=NodeEnvapter.d.mts.map
@@ -3,14 +3,13 @@ import { Envapter } from "./Envapter.mjs";
3
3
  import { EnvFileOptions } from "../infra/Dotenv.mjs";
4
4
  //#region src/engine/PortableEnvapter.d.ts
5
5
  /**
6
- * The browser/Workers/edge facade. {@link Envapter} with the filesystem-only config APIs present in
7
- * the type but inert at runtime by default. Under the default `fileApiMode` of `'warn'` they warn once
8
- * and no-op (getters return an empty default matching their type, setters do nothing). `'throw'` restores
9
- * the {@link EnvaptError} `FileApiUnsupported`. The read side still throws `NoSourceBound` on first read
10
- * until `useSource` binds a source.
6
+ * The browser/Workers/edge facade. It is {@link Envapter} with the filesystem-only config APIs kept in
7
+ * the type. Under the default `fileApiMode` of `'warn'` they warn once and no-op (getters return an
8
+ * empty default matching their type and setters do nothing). `'throw'` makes them throw
9
+ * {@link EnvaptError} `FileApiUnsupported`. Reads throw `NoSourceBound` until `useSource` binds a source.
11
10
  * @public
12
11
  */
13
- declare class PortableEnvapter extends Envapter {
12
+ export declare class PortableEnvapter extends Envapter {
14
13
  static get envPaths(): string[];
15
14
  static set envPaths(_paths: string[] | string);
16
15
  static get baseDir(): string | undefined;
@@ -21,5 +20,4 @@ declare class PortableEnvapter extends Envapter {
21
20
  static resetProfiles(): void;
22
21
  }
23
22
  //#endregion
24
- export { PortableEnvapter };
25
23
  //# sourceMappingURL=PortableEnvapter.d.mts.map
@@ -1,14 +1,12 @@
1
1
  //#region src/infra/Debug.d.ts
2
2
  /**
3
3
  * Debug log levels for {@link Envapter.debug}. `silent` (default) emits nothing.
4
- * `warn` covers signals that might indicate misconfiguration, failed file reads,
5
- * unresolved templates (when not strict), and any read of a missing or empty variable
6
- * (whether it returns a fallback or `undefined`). `verbose` adds every loaded file,
4
+ * `warn` logs failed file reads, unresolved templates (when not strict), and any read of a
5
+ * missing or empty variable, whether it returns a fallback or `undefined`. `verbose` adds every loaded file,
7
6
  * per-file key count, per-key load lines, and effective-paths / cache-rebuild notices.
8
7
  * @public
9
8
  * @see {@link https://envapt.materwelon.dev/docs/configuration#debug-logging}
10
9
  */
11
- type DebugLevel = 'silent' | 'warn' | 'verbose';
10
+ export type DebugLevel = 'silent' | 'warn' | 'verbose';
12
11
  //#endregion
13
- export { DebugLevel };
14
12
  //# sourceMappingURL=Debug.d.mts.map
@@ -1,18 +1,16 @@
1
1
  //#region src/infra/Dotenv.d.ts
2
2
  /**
3
- * Public options for the internal `.env` loader. Mirrors the subset of dotenv's
4
- * `config()` options that envapt actually supports (no DOTENV_KEY, no quiet).
3
+ * Options for the `.env` loader, matching the dotenv `config()` options of the same name.
5
4
  * For debug output, use `Envapter.debug` (or the `ENVAPT_DEBUG` env var).
6
5
  *
7
6
  * @public
8
7
  * @see {@link https://envapt.materwelon.dev/docs/configuration#which-files-load}
9
8
  */
10
- interface EnvFileOptions {
9
+ export interface EnvFileOptions {
11
10
  /** Encoding for reading .env files. Defaults to 'utf8'. */
12
11
  encoding?: string;
13
12
  /** When true, later files override earlier ones (and existing processEnv values). Default false (first-wins). */
14
13
  override?: boolean;
15
14
  }
16
15
  //#endregion
17
- export { EnvFileOptions };
18
16
  //# sourceMappingURL=Dotenv.d.mts.map
@@ -5,7 +5,7 @@ import { StandardSchemaV1 } from "./StandardSchema.mjs";
5
5
  * and configuration (3xx) failures.
6
6
  * @see {@link https://envapt.materwelon.dev/docs/errors#codes}
7
7
  */
8
- declare enum EnvaptErrorCodes {
8
+ export declare enum EnvaptErrorCodes {
9
9
  /** Thrown when an invalid fallback value is provided */
10
10
  InvalidFallback = 101,
11
11
  /** Thrown when fallback value type doesn't match expected converter type */
@@ -42,7 +42,7 @@ declare enum EnvaptErrorCodes {
42
42
  EnvFilesNotFound = 303,
43
43
  /** Thrown when no valid environment key is provided */
44
44
  InvalidKeyInput = 304,
45
- /** Thrown when a required environment value is missing or empty (post-trim) */
45
+ /** Thrown when a required environment value is missing or empty */
46
46
  MissingEnvValue = 305,
47
47
  /** Thrown when a file-based API (envPaths, baseDir, configureProfiles) is used on a source without filesystem support */
48
48
  FileApiUnsupported = 306,
@@ -56,7 +56,7 @@ interface EnvaptErrorOptions {
56
56
  cause?: unknown;
57
57
  }
58
58
  /**
59
- * Custom error for better DX and debugging when using Envapt.
59
+ * The error envapt throws. Its `code` identifies the failure.
60
60
  *
61
61
  * @example
62
62
  * ```ts
@@ -64,7 +64,7 @@ interface EnvaptErrorOptions {
64
64
  * ```
65
65
  * @see {@link https://envapt.materwelon.dev/docs/errors#the-error-shape}
66
66
  */
67
- declare class EnvaptError extends Error {
67
+ export declare class EnvaptError extends Error {
68
68
  /** The {@link EnvaptErrorCodes} value identifying what failed. */
69
69
  readonly code: EnvaptErrorCodes;
70
70
  /**
@@ -77,5 +77,4 @@ declare class EnvaptError extends Error {
77
77
  constructor(code: EnvaptErrorCodes, message: string, options?: EnvaptErrorOptions);
78
78
  }
79
79
  //#endregion
80
- export { EnvaptError, EnvaptErrorCodes };
81
80
  //# sourceMappingURL=Error.d.mts.map
@@ -4,18 +4,17 @@
4
4
  * so envapt has zero runtime peer dependencies on any specific schema library
5
5
  * (zod / valibot / arktype / etc).
6
6
  *
7
- * envapt narrows usage to SYNCHRONOUS schemas only: env loading is boot-time,
8
- * `validate` returning `Promise<Result>` is rejected at the type level (see
9
- * `SchemaMustBeSync` brand in `Types.ts`) and at runtime by the Parser dispatch.
7
+ * envapt accepts synchronous schemas only. A `validate` that returns a Promise fails to
8
+ * type-check and throws `InvalidUserDefinedConfig` at runtime.
10
9
  *
11
10
  * @public
12
11
  * @see {@link https://envapt.materwelon.dev/docs/standard-schema#any-conformant-validator-or-none}
13
12
  */
14
- interface StandardSchemaV1<Input = unknown, Output = Input> {
13
+ export interface StandardSchemaV1<Input = unknown, Output = Input> {
15
14
  /** The Standard Schema entry point holding the validator and the inferred input/output types. */
16
15
  readonly '~standard': StandardSchemaV1.Props<Input, Output>;
17
16
  }
18
- declare namespace StandardSchemaV1 {
17
+ export declare namespace StandardSchemaV1 {
19
18
  interface Props<Input = unknown, Output = Input> {
20
19
  readonly version: 1;
21
20
  readonly vendor: string;
@@ -44,7 +43,6 @@ declare namespace StandardSchemaV1 {
44
43
  type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
45
44
  type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
46
45
  }
47
- type InferSchemaOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;
46
+ export type InferSchemaOutput<Schema extends StandardSchemaV1> = StandardSchemaV1.InferOutput<Schema>;
48
47
  //#endregion
49
- export { InferSchemaOutput, StandardSchemaV1 };
50
48
  //# sourceMappingURL=StandardSchema.d.mts.map
@@ -7,7 +7,7 @@ import { FileCapableSource } from "../types/Source.mjs";
7
7
  * @public
8
8
  * @see {@link https://envapt.materwelon.dev/docs/sources#the-providers}
9
9
  */
10
- declare class FileSource implements FileCapableSource {
10
+ export declare class FileSource implements FileCapableSource {
11
11
  /** Always `true`. The engine layers the `.env` cascade and `baseDir` on top of `process.env`. */
12
12
  readonly supportsFiles = true;
13
13
  /** Returns a snapshot clone of `process.env` as plain strings. */
@@ -26,5 +26,4 @@ declare class FileSource implements FileCapableSource {
26
26
  writeVars(vars: Record<string, string>): void;
27
27
  }
28
28
  //#endregion
29
- export { FileSource };
30
29
  //# sourceMappingURL=FileSource.d.mts.map
@@ -1,16 +1,16 @@
1
1
  import { BareSource } from "../types/Source.mjs";
2
2
  //#region src/sources/PortableSource.d.ts
3
3
  /**
4
- * Environment source seeded from an object you provide, for every runtime without a filesystem. The
5
- * config your bundler injects into a browser build (Vite's `import.meta.env`, a webpack `DefinePlugin`
6
- * global), the Cloudflare `env` binding, a Vercel Edge or Fastly config object, a test fixture, or any
7
- * plain object. Pass it straight through. Non-string values are JSON-stringified so the converters
8
- * still apply, which means they must be JSON-serializable. Without a filesystem the `.env` cascade and
9
- * file APIs do not apply.
4
+ * Environment source seeded from an object you provide, for every runtime without a filesystem. Pass
5
+ * the object straight through, such as the config your bundler injects into a browser build (Vite's
6
+ * `import.meta.env`, a webpack `DefinePlugin` global), the Cloudflare `env` binding, a Vercel Edge or
7
+ * Fastly config object, a test fixture, or any plain object. Non-string values are JSON-stringified so
8
+ * the converters still apply. Those values must be JSON-serializable. Without a filesystem the `.env`
9
+ * cascade and file APIs do not apply.
10
10
  * @public
11
11
  * @see {@link https://envapt.materwelon.dev/docs/sources#the-providers}
12
12
  */
13
- declare class PortableSource implements BareSource {
13
+ export declare class PortableSource implements BareSource {
14
14
  /** Always `false`. With no filesystem, the `.env` cascade and file APIs do not apply. */
15
15
  readonly supportsFiles = false;
16
16
  private readonly vars;
@@ -20,5 +20,4 @@ declare class PortableSource implements BareSource {
20
20
  readVars(): Record<string, string>;
21
21
  }
22
22
  //#endregion
23
- export { PortableSource };
24
23
  //# sourceMappingURL=PortableSource.d.mts.map
@@ -9,7 +9,6 @@ import { Source } from "../types/Source.mjs";
9
9
  * @public
10
10
  * @see {@link https://envapt.materwelon.dev/docs/sources#combining-sources}
11
11
  */
12
- declare function merge(...members: (Source | ((key: string) => string | undefined))[]): Source;
12
+ export declare function merge(...members: (Source | ((key: string) => string | undefined))[]): Source;
13
13
  //#endregion
14
- export { merge };
15
14
  //# sourceMappingURL=merge.d.mts.map
@@ -42,10 +42,6 @@ interface ConverterMap {
42
42
  email: string;
43
43
  }
44
44
  type BuiltInConverterReturnType<ConverterKey extends BuiltInConverter> = ConverterMap[ConverterKey];
45
- /**
46
- * Time unit types for duration conversions
47
- * @internal
48
- */
49
45
  type TimeUnit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w';
50
46
  /**
51
47
  * Fallback type for time duration conversions
@@ -1,12 +1,11 @@
1
1
  //#region src/types/Decorator.d.ts
2
- type EnvaptFieldDecorator<Output> = <Target, Key extends keyof Target>(target: Target, key: [Output] extends [Target[Key]] ? Key : {
2
+ export type EnvaptFieldDecorator<Output> = <Target, Key extends keyof Target>(target: Target, key: [Output] extends [Target[Key]] ? Key : {
3
3
  '[envapt] field type must hold the converter output': Output;
4
4
  }) => void;
5
- type EnvaptAccessorDecorator<Output> = <This, Value>(target: ClassAccessorDecoratorTarget<This, [Output] extends [Value] ? Value : {
5
+ export type EnvaptAccessorDecorator<Output> = <This, Value>(target: ClassAccessorDecoratorTarget<This, [Output] extends [Value] ? Value : {
6
6
  '[envapt] field type must hold the converter output': Output;
7
7
  }>, context: ClassAccessorDecoratorContext<This, [Output] extends [Value] ? Value : {
8
8
  '[envapt] field type must hold the converter output': Output;
9
9
  }>) => ClassAccessorDecoratorResult<This, Value>;
10
10
  //#endregion
11
- export { EnvaptAccessorDecorator, EnvaptFieldDecorator };
12
11
  //# sourceMappingURL=Decorator.d.mts.map