envapt 7.0.0-next.0 → 7.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/browser/engine/PortableEnvapter.mjs +2 -0
- package/dist/browser/engine/PortableEnvapter.mjs.map +1 -0
- package/dist/browser/engine/installFileApiStubs.mjs +1 -1
- package/dist/browser/engine/installFileApiStubs.mjs.map +1 -1
- package/dist/browser/index.mjs +1 -2
- package/dist/{node → types}/engine/NodeEnvapter.d.mts +0 -2
- package/dist/types/engine/PortableEnvapter.d.mts +14 -0
- package/dist/{node → types}/index.d.mts +0 -2
- package/dist/{browser/index.d.mts → types/index.portable.d.mts} +2 -2
- package/dist/{node/sources/NodeEnvSource.d.cts → types/sources/NodeEnvSource.d.mts} +2 -2
- package/dist/workerd/engine/PortableEnvapter.mjs +2 -0
- package/dist/workerd/engine/PortableEnvapter.mjs.map +1 -0
- package/dist/workerd/engine/installFileApiStubs.mjs +1 -1
- package/dist/workerd/engine/installFileApiStubs.mjs.map +1 -1
- package/dist/workerd/index.mjs +1 -2
- package/package.json +25 -22
- package/dist/browser/index.mjs.map +0 -1
- package/dist/node/config.d.mts +0 -2
- package/dist/node/converters/Converters.d.cts +0 -93
- package/dist/node/converters/Converters.d.mts +0 -95
- package/dist/node/converters/ValueConverter.d.cts +0 -25
- package/dist/node/converters/ValueConverter.d.mts +0 -27
- package/dist/node/core/AdvancedMethods.d.cts +0 -76
- package/dist/node/core/AdvancedMethods.d.mts +0 -78
- package/dist/node/core/EnvapterBase.d.cts +0 -75
- package/dist/node/core/EnvapterBase.d.mts +0 -77
- package/dist/node/core/EnvironmentMethods.d.cts +0 -115
- package/dist/node/core/EnvironmentMethods.d.mts +0 -117
- package/dist/node/core/PrimitiveMethods.d.cts +0 -70
- package/dist/node/core/PrimitiveMethods.d.mts +0 -72
- package/dist/node/decorators/legacy/Envapt.d.cts +0 -218
- package/dist/node/decorators/legacy/Envapt.d.mts +0 -220
- package/dist/node/decorators/legacy/SugarDecorators.d.cts +0 -40
- package/dist/node/decorators/legacy/SugarDecorators.d.mts +0 -42
- package/dist/node/decorators/modern/Envapt.d.cts +0 -218
- package/dist/node/decorators/modern/Envapt.d.mts +0 -220
- package/dist/node/decorators/modern/SugarDecorators.d.cts +0 -40
- package/dist/node/decorators/modern/SugarDecorators.d.mts +0 -42
- package/dist/node/engine/Envapter.d.cts +0 -70
- package/dist/node/engine/Envapter.d.mts +0 -72
- package/dist/node/engine/NodeEnvapter.d.cts +0 -73
- package/dist/node/engine/TemplateResolver.d.cts +0 -17
- package/dist/node/engine/TemplateResolver.d.mts +0 -19
- package/dist/node/index.d.cts +0 -19
- package/dist/node/infra/Debug.d.cts +0 -13
- package/dist/node/infra/Debug.d.mts +0 -15
- package/dist/node/infra/Dotenv.d.cts +0 -17
- package/dist/node/infra/Dotenv.d.mts +0 -19
- package/dist/node/infra/Error.d.cts +0 -72
- package/dist/node/infra/Error.d.mts +0 -74
- package/dist/node/infra/StandardSchema.d.cts +0 -59
- package/dist/node/infra/StandardSchema.d.mts +0 -61
- package/dist/node/legacy.d.cts +0 -4
- package/dist/node/legacy.d.mts +0 -6
- package/dist/node/sources/ManualEnvSource.d.cts +0 -19
- package/dist/node/sources/ManualEnvSource.d.mts +0 -21
- package/dist/node/sources/NodeEnvSource.d.mts +0 -22
- package/dist/node/sources/WorkerEnvSource.d.cts +0 -19
- package/dist/node/sources/WorkerEnvSource.d.mts +0 -21
- package/dist/node/types/Conversion.d.cts +0 -123
- package/dist/node/types/Conversion.d.mts +0 -125
- package/dist/node/types/Decorator.d.cts +0 -26
- package/dist/node/types/Decorator.d.mts +0 -28
- package/dist/node/types/Env.d.cts +0 -17
- package/dist/node/types/Env.d.mts +0 -19
- package/dist/node/types/Options.d.cts +0 -39
- package/dist/node/types/Options.d.mts +0 -41
- package/dist/node/types/Schema.d.cts +0 -12
- package/dist/node/types/Schema.d.mts +0 -14
- package/dist/node/types/Source.d.cts +0 -44
- package/dist/node/types/Source.d.mts +0 -46
- package/dist/workerd/converters/Converters.d.mts +0 -93
- package/dist/workerd/converters/ValueConverter.d.mts +0 -25
- package/dist/workerd/core/AdvancedMethods.d.mts +0 -76
- package/dist/workerd/core/EnvapterBase.d.mts +0 -75
- package/dist/workerd/core/EnvironmentMethods.d.mts +0 -115
- package/dist/workerd/core/PrimitiveMethods.d.mts +0 -70
- package/dist/workerd/decorators/legacy/Envapt.d.mts +0 -218
- package/dist/workerd/decorators/legacy/SugarDecorators.d.mts +0 -40
- package/dist/workerd/decorators/modern/Envapt.d.mts +0 -218
- package/dist/workerd/decorators/modern/SugarDecorators.d.mts +0 -40
- package/dist/workerd/engine/Envapter.d.mts +0 -70
- package/dist/workerd/engine/TemplateResolver.d.mts +0 -17
- package/dist/workerd/index.d.mts +0 -18
- package/dist/workerd/index.mjs.map +0 -1
- package/dist/workerd/infra/Debug.d.mts +0 -13
- package/dist/workerd/infra/Dotenv.d.mts +0 -17
- package/dist/workerd/infra/Error.d.mts +0 -72
- package/dist/workerd/infra/StandardSchema.d.mts +0 -59
- package/dist/workerd/legacy.d.mts +0 -4
- package/dist/workerd/sources/ManualEnvSource.d.mts +0 -19
- package/dist/workerd/sources/WorkerEnvSource.d.mts +0 -19
- package/dist/workerd/types/Conversion.d.mts +0 -123
- package/dist/workerd/types/Decorator.d.mts +0 -26
- package/dist/workerd/types/Env.d.mts +0 -17
- package/dist/workerd/types/Options.d.mts +0 -39
- package/dist/workerd/types/Schema.d.mts +0 -12
- package/dist/workerd/types/Source.d.mts +0 -44
- /package/dist/{node/config.d.cts → types/config.d.mts} +0 -0
- /package/dist/{browser → types}/converters/Converters.d.mts +0 -0
- /package/dist/{browser → types}/converters/ValueConverter.d.mts +0 -0
- /package/dist/{browser → types}/core/AdvancedMethods.d.mts +0 -0
- /package/dist/{browser → types}/core/EnvapterBase.d.mts +0 -0
- /package/dist/{browser → types}/core/EnvironmentMethods.d.mts +0 -0
- /package/dist/{browser → types}/core/PrimitiveMethods.d.mts +0 -0
- /package/dist/{browser → types}/decorators/legacy/Envapt.d.mts +0 -0
- /package/dist/{browser → types}/decorators/legacy/SugarDecorators.d.mts +0 -0
- /package/dist/{browser → types}/decorators/modern/Envapt.d.mts +0 -0
- /package/dist/{browser → types}/decorators/modern/SugarDecorators.d.mts +0 -0
- /package/dist/{browser → types}/engine/Envapter.d.mts +0 -0
- /package/dist/{browser → types}/engine/TemplateResolver.d.mts +0 -0
- /package/dist/{browser → types}/infra/Debug.d.mts +0 -0
- /package/dist/{browser → types}/infra/Dotenv.d.mts +0 -0
- /package/dist/{browser → types}/infra/Error.d.mts +0 -0
- /package/dist/{browser → types}/infra/StandardSchema.d.mts +0 -0
- /package/dist/{browser → types}/legacy.d.mts +0 -0
- /package/dist/{browser → types}/sources/ManualEnvSource.d.mts +0 -0
- /package/dist/{browser → types}/sources/WorkerEnvSource.d.mts +0 -0
- /package/dist/{browser → types}/types/Conversion.d.mts +0 -0
- /package/dist/{browser → types}/types/Decorator.d.mts +0 -0
- /package/dist/{browser → types}/types/Env.d.mts +0 -0
- /package/dist/{browser → types}/types/Options.d.mts +0 -0
- /package/dist/{browser → types}/types/Schema.d.mts +0 -0
- /package/dist/{browser → types}/types/Source.d.mts +0 -0
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { ArrayOf } from "../../converters/Converters.cjs";
|
|
2
|
-
import { BuiltInConverter, ConverterFunction, InferConverterFallbackType, InferConverterReturnType, InferPrimitiveReturnType, PrimitiveConstructor } from "../../types/Conversion.cjs";
|
|
3
|
-
import { InferSchemaOutput, StandardSchemaV1 } from "../../infra/StandardSchema.cjs";
|
|
4
|
-
import { SchemaConstraint } from "../../types/Schema.cjs";
|
|
5
|
-
import { EnvKeyInput } from "../../types/Env.cjs";
|
|
6
|
-
import { EnvaptAccessorDecorator } from "../../types/Decorator.cjs";
|
|
7
|
-
|
|
8
|
-
//#region src/decorators/modern/Envapt.d.ts
|
|
9
|
-
/**
|
|
10
|
-
* A custom converter function with a fallback (both required), or a fallback only.
|
|
11
|
-
*
|
|
12
|
-
* @param key - Environment variable name(s) to load
|
|
13
|
-
* @param options - Configuration options
|
|
14
|
-
* @public
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* class Config {
|
|
18
|
-
* \@Envapt('API_KEY', {
|
|
19
|
-
* fallback: 'default-key',
|
|
20
|
-
* converter(raw, _fallback) {
|
|
21
|
-
* if (!raw || raw.trim() === '') throw new Error('API_KEY required');
|
|
22
|
-
* return raw.trim();
|
|
23
|
-
* }
|
|
24
|
-
* })
|
|
25
|
-
* static accessor apiKey: string;
|
|
26
|
-
*
|
|
27
|
-
* \@Envapt('LOG_FILE', { fallback: '/var/log/app.log' })
|
|
28
|
-
* static accessor logFile: string;
|
|
29
|
-
*
|
|
30
|
-
* \@Envapt('RETRY_POLICY', { fallback: { retries: 3, backoff: 'exponential' } })
|
|
31
|
-
* static accessor retryPolicy: unknown;
|
|
32
|
-
* }
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
declare function Envapt(key: EnvKeyInput, options: {
|
|
36
|
-
fallback: undefined;
|
|
37
|
-
converter?: undefined;
|
|
38
|
-
}): EnvaptAccessorDecorator<string | undefined>;
|
|
39
|
-
declare function Envapt<TFallback>(key: EnvKeyInput, options: {
|
|
40
|
-
converter: (raw: string | undefined, fallback: TFallback) => TFallback;
|
|
41
|
-
fallback: TFallback;
|
|
42
|
-
} | {
|
|
43
|
-
fallback: TFallback;
|
|
44
|
-
converter?: undefined;
|
|
45
|
-
}): EnvaptAccessorDecorator<TFallback>;
|
|
46
|
-
/**
|
|
47
|
-
* A custom converter function without a fallback. Omit `required` to return the converter's
|
|
48
|
-
* output (possibly `undefined`), or pass `required: true` to throw `MissingEnvValue` on
|
|
49
|
-
* missing or empty values.
|
|
50
|
-
*
|
|
51
|
-
* @param key - Environment variable name(s) to load
|
|
52
|
-
* @param options - Configuration options
|
|
53
|
-
* @public
|
|
54
|
-
* @example
|
|
55
|
-
* ```ts
|
|
56
|
-
* class Config {
|
|
57
|
-
* \@Envapt('FEATURE_FLAGS', { converter(raw) {
|
|
58
|
-
* return raw ? raw.split('|').map(s => s.trim()) : [];
|
|
59
|
-
* } })
|
|
60
|
-
* static accessor featureFlags: string[];
|
|
61
|
-
*
|
|
62
|
-
* \@Envapt('JWT_SECRET', {
|
|
63
|
-
* converter: (raw) => Buffer.from(raw ?? '', 'base64'),
|
|
64
|
-
* required: true
|
|
65
|
-
* })
|
|
66
|
-
* static accessor jwtSecret: Buffer;
|
|
67
|
-
* }
|
|
68
|
-
* ```
|
|
69
|
-
*/
|
|
70
|
-
declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
|
|
71
|
-
converter: ConverterFunction<TReturnType>;
|
|
72
|
-
required?: false;
|
|
73
|
-
} | {
|
|
74
|
-
converter: ConverterFunction<TReturnType>;
|
|
75
|
-
required: true;
|
|
76
|
-
}): EnvaptAccessorDecorator<TReturnType>;
|
|
77
|
-
/**
|
|
78
|
-
* A built-in or array converter with a fallback, or `required: true`. The fallback type tracks
|
|
79
|
-
* the converter, so `Converters.Time` takes a number or time-string and `Converters.Url` takes
|
|
80
|
-
* a `URL` instance.
|
|
81
|
-
*
|
|
82
|
-
* @param key - Environment variable name(s) to load
|
|
83
|
-
* @param options - Configuration options
|
|
84
|
-
* @public
|
|
85
|
-
* @example
|
|
86
|
-
* ```ts
|
|
87
|
-
* import { Converters } from 'envapt';
|
|
88
|
-
*
|
|
89
|
-
* class Config {
|
|
90
|
-
* \@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })
|
|
91
|
-
* static accessor port: number;
|
|
92
|
-
*
|
|
93
|
-
* // the Url fallback is a URL instance, not a string
|
|
94
|
-
* \@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })
|
|
95
|
-
* static accessor url: URL;
|
|
96
|
-
*
|
|
97
|
-
* // prefers CANARY_URL when present, otherwise APP_URL
|
|
98
|
-
* \@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })
|
|
99
|
-
* static accessor canaryUrl: URL | null;
|
|
100
|
-
*
|
|
101
|
-
* // Time takes a number (milliseconds) or a time-string fallback (`<number><unit>`)
|
|
102
|
-
* \@Envapt('REQUEST_TIMEOUT', { converter: Converters.Time, fallback: '10s' })
|
|
103
|
-
* static accessor requestTimeout: number;
|
|
104
|
-
*
|
|
105
|
-
* \@Envapt('ALLOWED_ORIGINS', {
|
|
106
|
-
* converter: Converters.array({ of: Converters.String }),
|
|
107
|
-
* fallback: ['https://example.com']
|
|
108
|
-
* })
|
|
109
|
-
* static accessor allowedOrigins: string[];
|
|
110
|
-
*
|
|
111
|
-
* \@Envapt('DATABASE_URL', { converter: Converters.Url, required: true })
|
|
112
|
-
* static accessor databaseUrl: URL;
|
|
113
|
-
* }
|
|
114
|
-
* ```
|
|
115
|
-
*/
|
|
116
|
-
declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
|
|
117
|
-
converter: TConverter;
|
|
118
|
-
fallback: InferConverterFallbackType<TConverter>;
|
|
119
|
-
required?: false;
|
|
120
|
-
} | {
|
|
121
|
-
converter: TConverter;
|
|
122
|
-
required: true;
|
|
123
|
-
}): EnvaptAccessorDecorator<InferConverterReturnType<TConverter>>;
|
|
124
|
-
declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
|
|
125
|
-
converter: TConverter;
|
|
126
|
-
fallback: undefined;
|
|
127
|
-
required?: false;
|
|
128
|
-
}): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | undefined>;
|
|
129
|
-
declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
|
|
130
|
-
converter: TConverter;
|
|
131
|
-
required?: false;
|
|
132
|
-
}): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | null>;
|
|
133
|
-
/**
|
|
134
|
-
* A primitive constructor (`Number`, `Boolean`) with an optional fallback.
|
|
135
|
-
*
|
|
136
|
-
* @param key - Environment variable name(s) to load
|
|
137
|
-
* @param options - Configuration options
|
|
138
|
-
* @public
|
|
139
|
-
* @example
|
|
140
|
-
* ```ts
|
|
141
|
-
* class Config {
|
|
142
|
-
* \@Envapt('MAX_CONNECTIONS', { converter: Number, fallback: 100 })
|
|
143
|
-
* static accessor maxConnections: number;
|
|
144
|
-
*
|
|
145
|
-
* \@Envapt('FEATURE_ENABLED', { converter: Boolean, fallback: false })
|
|
146
|
-
* static accessor featureEnabled: boolean;
|
|
147
|
-
* }
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
|
|
151
|
-
converter: TConstructor;
|
|
152
|
-
fallback: InferPrimitiveReturnType<TConstructor>;
|
|
153
|
-
required?: false;
|
|
154
|
-
} | {
|
|
155
|
-
converter: TConstructor;
|
|
156
|
-
required: true;
|
|
157
|
-
}): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor>>;
|
|
158
|
-
declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
|
|
159
|
-
converter: TConstructor;
|
|
160
|
-
fallback: undefined;
|
|
161
|
-
required?: false;
|
|
162
|
-
}): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;
|
|
163
|
-
declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
|
|
164
|
-
converter: TConstructor;
|
|
165
|
-
required?: false;
|
|
166
|
-
}): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | null>;
|
|
167
|
-
/**
|
|
168
|
-
* Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env
|
|
169
|
-
* value is missing or empty after trimming, independent of the global `Envapter.strict` flag.
|
|
170
|
-
* Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime
|
|
171
|
-
* Validator rejects dynamic objects that bypass the types.
|
|
172
|
-
*
|
|
173
|
-
* @param key - Environment variable name(s) to load
|
|
174
|
-
* @param options - `{ required: true }`
|
|
175
|
-
* @public
|
|
176
|
-
* @example
|
|
177
|
-
* ```ts
|
|
178
|
-
* class Config {
|
|
179
|
-
* \@Envapt('API_KEY', { required: true })
|
|
180
|
-
* static accessor apiKey: string;
|
|
181
|
-
* }
|
|
182
|
-
* ```
|
|
183
|
-
*/
|
|
184
|
-
declare function Envapt(key: EnvKeyInput, options: {
|
|
185
|
-
required: true;
|
|
186
|
-
}): EnvaptAccessorDecorator<string>;
|
|
187
|
-
/**
|
|
188
|
-
* No-fallback form. The property resolves from env or `null`.
|
|
189
|
-
*
|
|
190
|
-
* @param key - Environment variable name(s) to load
|
|
191
|
-
* @public
|
|
192
|
-
* @example
|
|
193
|
-
* ```ts
|
|
194
|
-
* class Config {
|
|
195
|
-
* \@Envapt('SIMPLE_VALUE')
|
|
196
|
-
* static accessor simple: string | null;
|
|
197
|
-
* }
|
|
198
|
-
* ```
|
|
199
|
-
*/
|
|
200
|
-
declare function Envapt(key: EnvKeyInput): EnvaptAccessorDecorator<string | null>;
|
|
201
|
-
/**
|
|
202
|
-
* A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,
|
|
203
|
-
* so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing
|
|
204
|
-
* `schema` with `converter` matches no overload at compile time, and the runtime Validator
|
|
205
|
-
* rejects dynamic objects that bypass the types.
|
|
206
|
-
* @public
|
|
207
|
-
*/
|
|
208
|
-
declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
|
|
209
|
-
schema: SchemaConstraint<Schema>;
|
|
210
|
-
fallback?: InferSchemaOutput<Schema>;
|
|
211
|
-
required?: false;
|
|
212
|
-
} | {
|
|
213
|
-
schema: SchemaConstraint<Schema>;
|
|
214
|
-
required: true;
|
|
215
|
-
}): EnvaptAccessorDecorator<InferSchemaOutput<Schema>>;
|
|
216
|
-
//#endregion
|
|
217
|
-
export { Envapt };
|
|
218
|
-
//# sourceMappingURL=Envapt.d.cts.map
|
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { ArrayOf } from "../../converters/Converters.mjs";
|
|
4
|
-
import { BuiltInConverter, ConverterFunction, InferConverterFallbackType, InferConverterReturnType, InferPrimitiveReturnType, PrimitiveConstructor } from "../../types/Conversion.mjs";
|
|
5
|
-
import { InferSchemaOutput, StandardSchemaV1 } from "../../infra/StandardSchema.mjs";
|
|
6
|
-
import { SchemaConstraint } from "../../types/Schema.mjs";
|
|
7
|
-
import { EnvKeyInput } from "../../types/Env.mjs";
|
|
8
|
-
import { EnvaptAccessorDecorator } from "../../types/Decorator.mjs";
|
|
9
|
-
|
|
10
|
-
//#region src/decorators/modern/Envapt.d.ts
|
|
11
|
-
/**
|
|
12
|
-
* A custom converter function with a fallback (both required), or a fallback only.
|
|
13
|
-
*
|
|
14
|
-
* @param key - Environment variable name(s) to load
|
|
15
|
-
* @param options - Configuration options
|
|
16
|
-
* @public
|
|
17
|
-
* @example
|
|
18
|
-
* ```ts
|
|
19
|
-
* class Config {
|
|
20
|
-
* \@Envapt('API_KEY', {
|
|
21
|
-
* fallback: 'default-key',
|
|
22
|
-
* converter(raw, _fallback) {
|
|
23
|
-
* if (!raw || raw.trim() === '') throw new Error('API_KEY required');
|
|
24
|
-
* return raw.trim();
|
|
25
|
-
* }
|
|
26
|
-
* })
|
|
27
|
-
* static accessor apiKey: string;
|
|
28
|
-
*
|
|
29
|
-
* \@Envapt('LOG_FILE', { fallback: '/var/log/app.log' })
|
|
30
|
-
* static accessor logFile: string;
|
|
31
|
-
*
|
|
32
|
-
* \@Envapt('RETRY_POLICY', { fallback: { retries: 3, backoff: 'exponential' } })
|
|
33
|
-
* static accessor retryPolicy: unknown;
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*/
|
|
37
|
-
declare function Envapt(key: EnvKeyInput, options: {
|
|
38
|
-
fallback: undefined;
|
|
39
|
-
converter?: undefined;
|
|
40
|
-
}): EnvaptAccessorDecorator<string | undefined>;
|
|
41
|
-
declare function Envapt<TFallback>(key: EnvKeyInput, options: {
|
|
42
|
-
converter: (raw: string | undefined, fallback: TFallback) => TFallback;
|
|
43
|
-
fallback: TFallback;
|
|
44
|
-
} | {
|
|
45
|
-
fallback: TFallback;
|
|
46
|
-
converter?: undefined;
|
|
47
|
-
}): EnvaptAccessorDecorator<TFallback>;
|
|
48
|
-
/**
|
|
49
|
-
* A custom converter function without a fallback. Omit `required` to return the converter's
|
|
50
|
-
* output (possibly `undefined`), or pass `required: true` to throw `MissingEnvValue` on
|
|
51
|
-
* missing or empty values.
|
|
52
|
-
*
|
|
53
|
-
* @param key - Environment variable name(s) to load
|
|
54
|
-
* @param options - Configuration options
|
|
55
|
-
* @public
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* class Config {
|
|
59
|
-
* \@Envapt('FEATURE_FLAGS', { converter(raw) {
|
|
60
|
-
* return raw ? raw.split('|').map(s => s.trim()) : [];
|
|
61
|
-
* } })
|
|
62
|
-
* static accessor featureFlags: string[];
|
|
63
|
-
*
|
|
64
|
-
* \@Envapt('JWT_SECRET', {
|
|
65
|
-
* converter: (raw) => Buffer.from(raw ?? '', 'base64'),
|
|
66
|
-
* required: true
|
|
67
|
-
* })
|
|
68
|
-
* static accessor jwtSecret: Buffer;
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
*/
|
|
72
|
-
declare function Envapt<TReturnType>(key: EnvKeyInput, options: {
|
|
73
|
-
converter: ConverterFunction<TReturnType>;
|
|
74
|
-
required?: false;
|
|
75
|
-
} | {
|
|
76
|
-
converter: ConverterFunction<TReturnType>;
|
|
77
|
-
required: true;
|
|
78
|
-
}): EnvaptAccessorDecorator<TReturnType>;
|
|
79
|
-
/**
|
|
80
|
-
* A built-in or array converter with a fallback, or `required: true`. The fallback type tracks
|
|
81
|
-
* the converter, so `Converters.Time` takes a number or time-string and `Converters.Url` takes
|
|
82
|
-
* a `URL` instance.
|
|
83
|
-
*
|
|
84
|
-
* @param key - Environment variable name(s) to load
|
|
85
|
-
* @param options - Configuration options
|
|
86
|
-
* @public
|
|
87
|
-
* @example
|
|
88
|
-
* ```ts
|
|
89
|
-
* import { Converters } from 'envapt';
|
|
90
|
-
*
|
|
91
|
-
* class Config {
|
|
92
|
-
* \@Envapt('APP_PORT', { converter: Converters.Number, fallback: 3000 })
|
|
93
|
-
* static accessor port: number;
|
|
94
|
-
*
|
|
95
|
-
* // the Url fallback is a URL instance, not a string
|
|
96
|
-
* \@Envapt('APP_URL', { converter: Converters.Url, fallback: new URL('http://localhost:3000') })
|
|
97
|
-
* static accessor url: URL;
|
|
98
|
-
*
|
|
99
|
-
* // prefers CANARY_URL when present, otherwise APP_URL
|
|
100
|
-
* \@Envapt(['CANARY_URL', 'APP_URL'], { converter: Converters.Url })
|
|
101
|
-
* static accessor canaryUrl: URL | null;
|
|
102
|
-
*
|
|
103
|
-
* // Time takes a number (milliseconds) or a time-string fallback (`<number><unit>`)
|
|
104
|
-
* \@Envapt('REQUEST_TIMEOUT', { converter: Converters.Time, fallback: '10s' })
|
|
105
|
-
* static accessor requestTimeout: number;
|
|
106
|
-
*
|
|
107
|
-
* \@Envapt('ALLOWED_ORIGINS', {
|
|
108
|
-
* converter: Converters.array({ of: Converters.String }),
|
|
109
|
-
* fallback: ['https://example.com']
|
|
110
|
-
* })
|
|
111
|
-
* static accessor allowedOrigins: string[];
|
|
112
|
-
*
|
|
113
|
-
* \@Envapt('DATABASE_URL', { converter: Converters.Url, required: true })
|
|
114
|
-
* static accessor databaseUrl: URL;
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
|
|
119
|
-
converter: TConverter;
|
|
120
|
-
fallback: InferConverterFallbackType<TConverter>;
|
|
121
|
-
required?: false;
|
|
122
|
-
} | {
|
|
123
|
-
converter: TConverter;
|
|
124
|
-
required: true;
|
|
125
|
-
}): EnvaptAccessorDecorator<InferConverterReturnType<TConverter>>;
|
|
126
|
-
declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
|
|
127
|
-
converter: TConverter;
|
|
128
|
-
fallback: undefined;
|
|
129
|
-
required?: false;
|
|
130
|
-
}): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | undefined>;
|
|
131
|
-
declare function Envapt<TConverter extends BuiltInConverter | ArrayOf>(key: EnvKeyInput, options: {
|
|
132
|
-
converter: TConverter;
|
|
133
|
-
required?: false;
|
|
134
|
-
}): EnvaptAccessorDecorator<InferConverterReturnType<TConverter> | null>;
|
|
135
|
-
/**
|
|
136
|
-
* A primitive constructor (`Number`, `Boolean`) with an optional fallback.
|
|
137
|
-
*
|
|
138
|
-
* @param key - Environment variable name(s) to load
|
|
139
|
-
* @param options - Configuration options
|
|
140
|
-
* @public
|
|
141
|
-
* @example
|
|
142
|
-
* ```ts
|
|
143
|
-
* class Config {
|
|
144
|
-
* \@Envapt('MAX_CONNECTIONS', { converter: Number, fallback: 100 })
|
|
145
|
-
* static accessor maxConnections: number;
|
|
146
|
-
*
|
|
147
|
-
* \@Envapt('FEATURE_ENABLED', { converter: Boolean, fallback: false })
|
|
148
|
-
* static accessor featureEnabled: boolean;
|
|
149
|
-
* }
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
|
|
153
|
-
converter: TConstructor;
|
|
154
|
-
fallback: InferPrimitiveReturnType<TConstructor>;
|
|
155
|
-
required?: false;
|
|
156
|
-
} | {
|
|
157
|
-
converter: TConstructor;
|
|
158
|
-
required: true;
|
|
159
|
-
}): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor>>;
|
|
160
|
-
declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
|
|
161
|
-
converter: TConstructor;
|
|
162
|
-
fallback: undefined;
|
|
163
|
-
required?: false;
|
|
164
|
-
}): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | undefined>;
|
|
165
|
-
declare function Envapt<TConstructor extends PrimitiveConstructor>(key: EnvKeyInput, options: {
|
|
166
|
-
converter: TConstructor;
|
|
167
|
-
required?: false;
|
|
168
|
-
}): EnvaptAccessorDecorator<InferPrimitiveReturnType<TConstructor> | null>;
|
|
169
|
-
/**
|
|
170
|
-
* Required, no converter (raw string). Throws `MissingEnvValue` on first access when the env
|
|
171
|
-
* value is missing or empty after trimming, independent of the global `Envapter.strict` flag.
|
|
172
|
-
* Pairing `required: true` with `fallback` matches no overload at compile time, and the runtime
|
|
173
|
-
* Validator rejects dynamic objects that bypass the types.
|
|
174
|
-
*
|
|
175
|
-
* @param key - Environment variable name(s) to load
|
|
176
|
-
* @param options - `{ required: true }`
|
|
177
|
-
* @public
|
|
178
|
-
* @example
|
|
179
|
-
* ```ts
|
|
180
|
-
* class Config {
|
|
181
|
-
* \@Envapt('API_KEY', { required: true })
|
|
182
|
-
* static accessor apiKey: string;
|
|
183
|
-
* }
|
|
184
|
-
* ```
|
|
185
|
-
*/
|
|
186
|
-
declare function Envapt(key: EnvKeyInput, options: {
|
|
187
|
-
required: true;
|
|
188
|
-
}): EnvaptAccessorDecorator<string>;
|
|
189
|
-
/**
|
|
190
|
-
* No-fallback form. The property resolves from env or `null`.
|
|
191
|
-
*
|
|
192
|
-
* @param key - Environment variable name(s) to load
|
|
193
|
-
* @public
|
|
194
|
-
* @example
|
|
195
|
-
* ```ts
|
|
196
|
-
* class Config {
|
|
197
|
-
* \@Envapt('SIMPLE_VALUE')
|
|
198
|
-
* static accessor simple: string | null;
|
|
199
|
-
* }
|
|
200
|
-
* ```
|
|
201
|
-
*/
|
|
202
|
-
declare function Envapt(key: EnvKeyInput): EnvaptAccessorDecorator<string | null>;
|
|
203
|
-
/**
|
|
204
|
-
* A Standard Schema v1 adapter (zod, valibot, arktype, hand-rolled). Synchronous schemas only,
|
|
205
|
-
* so a Promise-returning `validate` throws `InvalidUserDefinedConfig` at runtime. Pairing
|
|
206
|
-
* `schema` with `converter` matches no overload at compile time, and the runtime Validator
|
|
207
|
-
* rejects dynamic objects that bypass the types.
|
|
208
|
-
* @public
|
|
209
|
-
*/
|
|
210
|
-
declare function Envapt<Schema extends StandardSchemaV1>(key: EnvKeyInput, options: {
|
|
211
|
-
schema: SchemaConstraint<Schema>;
|
|
212
|
-
fallback?: InferSchemaOutput<Schema>;
|
|
213
|
-
required?: false;
|
|
214
|
-
} | {
|
|
215
|
-
schema: SchemaConstraint<Schema>;
|
|
216
|
-
required: true;
|
|
217
|
-
}): EnvaptAccessorDecorator<InferSchemaOutput<Schema>>;
|
|
218
|
-
//#endregion
|
|
219
|
-
export { Envapt };
|
|
220
|
-
//# sourceMappingURL=Envapt.d.mts.map
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { TimeFallback } from "../../types/Conversion.cjs";
|
|
2
|
-
import { EnvKeyInput } from "../../types/Env.cjs";
|
|
3
|
-
import { EnvaptAccessorDecorator } from "../../types/Decorator.cjs";
|
|
4
|
-
|
|
5
|
-
//#region src/decorators/modern/SugarDecorators.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Boolean, fallback })`.
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptAccessorDecorator<boolean>;
|
|
11
|
-
declare function EnvBool(key: EnvKeyInput): EnvaptAccessorDecorator<boolean | null>;
|
|
12
|
-
/**
|
|
13
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptAccessorDecorator<number>;
|
|
17
|
-
declare function EnvNum(key: EnvKeyInput): EnvaptAccessorDecorator<number | null>;
|
|
18
|
-
/**
|
|
19
|
-
* Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptAccessorDecorator<string>;
|
|
23
|
-
declare function EnvStr(key: EnvKeyInput): EnvaptAccessorDecorator<string | null>;
|
|
24
|
-
/**
|
|
25
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a
|
|
26
|
-
* millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.
|
|
27
|
-
* @public
|
|
28
|
-
*/
|
|
29
|
-
declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptAccessorDecorator<number>;
|
|
30
|
-
declare function EnvTime(key: EnvKeyInput): EnvaptAccessorDecorator<number | null>;
|
|
31
|
-
/**
|
|
32
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`
|
|
33
|
-
* instance, not a URL string.
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptAccessorDecorator<URL>;
|
|
37
|
-
declare function EnvUrl(key: EnvKeyInput): EnvaptAccessorDecorator<URL | null>;
|
|
38
|
-
//#endregion
|
|
39
|
-
export { EnvBool, EnvNum, EnvStr, EnvTime, EnvUrl };
|
|
40
|
-
//# sourceMappingURL=SugarDecorators.d.cts.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { TimeFallback } from "../../types/Conversion.mjs";
|
|
4
|
-
import { EnvKeyInput } from "../../types/Env.mjs";
|
|
5
|
-
import { EnvaptAccessorDecorator } from "../../types/Decorator.mjs";
|
|
6
|
-
|
|
7
|
-
//#region src/decorators/modern/SugarDecorators.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Boolean, fallback })`.
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
declare function EnvBool(key: EnvKeyInput, fallback: boolean): EnvaptAccessorDecorator<boolean>;
|
|
13
|
-
declare function EnvBool(key: EnvKeyInput): EnvaptAccessorDecorator<boolean | null>;
|
|
14
|
-
/**
|
|
15
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Number, fallback })`.
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
declare function EnvNum(key: EnvKeyInput, fallback: number): EnvaptAccessorDecorator<number>;
|
|
19
|
-
declare function EnvNum(key: EnvKeyInput): EnvaptAccessorDecorator<number | null>;
|
|
20
|
-
/**
|
|
21
|
-
* Shorthand for `@Envapt(key, { converter: Converters.String, fallback })`.
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
declare function EnvStr(key: EnvKeyInput, fallback: string): EnvaptAccessorDecorator<string>;
|
|
25
|
-
declare function EnvStr(key: EnvKeyInput): EnvaptAccessorDecorator<string | null>;
|
|
26
|
-
/**
|
|
27
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Time, fallback })`. The fallback is a
|
|
28
|
-
* millisecond number or a time string (`'15m'`), and the resolved value is always milliseconds.
|
|
29
|
-
* @public
|
|
30
|
-
*/
|
|
31
|
-
declare function EnvTime(key: EnvKeyInput, fallback: TimeFallback): EnvaptAccessorDecorator<number>;
|
|
32
|
-
declare function EnvTime(key: EnvKeyInput): EnvaptAccessorDecorator<number | null>;
|
|
33
|
-
/**
|
|
34
|
-
* Shorthand for `@Envapt(key, { converter: Converters.Url, fallback })`. The fallback is a `URL`
|
|
35
|
-
* instance, not a URL string.
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
declare function EnvUrl(key: EnvKeyInput, fallback: URL): EnvaptAccessorDecorator<URL>;
|
|
39
|
-
declare function EnvUrl(key: EnvKeyInput): EnvaptAccessorDecorator<URL | null>;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { EnvBool, EnvNum, EnvStr, EnvTime, EnvUrl };
|
|
42
|
-
//# sourceMappingURL=SugarDecorators.d.mts.map
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Environment } from "../core/EnvironmentMethods.cjs";
|
|
2
|
-
import { AdvancedMethods } from "../core/AdvancedMethods.cjs";
|
|
3
|
-
|
|
4
|
-
//#region src/engine/Envapter.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Main configuration class for environment variable management.
|
|
7
|
-
*
|
|
8
|
-
* Provides both static and instance methods for retrieving typed environment variables
|
|
9
|
-
* with support for template resolution, multiple .env files, and environment detection.
|
|
10
|
-
*
|
|
11
|
-
* Extend your own classes from this to define properties with \@Envapt decorators and get access to environment-variable methods.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```ts
|
|
15
|
-
* // Static usage
|
|
16
|
-
* const port = Envapter.getNumber('PORT', 3000);
|
|
17
|
-
* const url = Envapter.get('API_URL', 'http://localhost');
|
|
18
|
-
* const replica = Envapter.get(['READONLY_URL', 'DATABASE_URL'], 'sqlite://memory');
|
|
19
|
-
*
|
|
20
|
-
* // Instance usage
|
|
21
|
-
* const env = new Envapter();
|
|
22
|
-
* const dbUrl = env.get('DATABASE_URL', 'sqlite://memory');
|
|
23
|
-
* const primaryHost = env.get(['PRIMARY_HOST', 'SECONDARY_HOST']);
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @public
|
|
27
|
-
*/
|
|
28
|
-
declare class Envapter extends AdvancedMethods {
|
|
29
|
-
/**
|
|
30
|
-
* Tagged template literal for resolving environment variables in template strings.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* // Given API_HOST=api.example.com and API_PORT=8080 in environment
|
|
35
|
-
* const endpoint = Envapter.resolve`Connecting to ${'API_HOST'}:${'API_PORT'}`;
|
|
36
|
-
* // Returns: "Connecting to api.example.com:8080"
|
|
37
|
-
*
|
|
38
|
-
* // Works with template variables in .env too:
|
|
39
|
-
* // API_URL=https://${API_HOST}:${API_PORT}
|
|
40
|
-
* const message = Envapter.resolve`Service endpoint: ${'API_URL'}`;
|
|
41
|
-
* // Returns: "Service endpoint: https://api.example.com:8080"
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
static resolve(strings: TemplateStringsArray, ...keys: string[]): string;
|
|
45
|
-
/**
|
|
46
|
-
* @see {@link Envapter.resolve}
|
|
47
|
-
*/
|
|
48
|
-
resolve(strings: TemplateStringsArray, ...keys: string[]): string;
|
|
49
|
-
/**
|
|
50
|
-
* Assert that one or more environment variables are present and non-empty (post-trim,
|
|
51
|
-
* after template resolution). Throws `MissingEnvValue` listing every missing key.
|
|
52
|
-
*
|
|
53
|
-
* For typed fail-fast in functional code, use `Envapter.getUsing(key, { converter, required: true })`.
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* ```ts
|
|
57
|
-
* Envapter.require('DATABASE_URL');
|
|
58
|
-
* Envapter.require('DATABASE_URL', 'API_KEY', 'SENTRY_DSN');
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
static require(...keys: [string, ...string[]]): void;
|
|
62
|
-
private static resolveAndValidate;
|
|
63
|
-
/**
|
|
64
|
-
* @see {@link Envapter.require}
|
|
65
|
-
*/
|
|
66
|
-
require(...keys: [string, ...string[]]): void;
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
export { Envapter };
|
|
70
|
-
//# sourceMappingURL=Envapter.d.cts.map
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { Environment } from "../core/EnvironmentMethods.mjs";
|
|
4
|
-
import { AdvancedMethods } from "../core/AdvancedMethods.mjs";
|
|
5
|
-
|
|
6
|
-
//#region src/engine/Envapter.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* Main configuration class for environment variable management.
|
|
9
|
-
*
|
|
10
|
-
* Provides both static and instance methods for retrieving typed environment variables
|
|
11
|
-
* with support for template resolution, multiple .env files, and environment detection.
|
|
12
|
-
*
|
|
13
|
-
* Extend your own classes from this to define properties with \@Envapt decorators and get access to environment-variable methods.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* // Static usage
|
|
18
|
-
* const port = Envapter.getNumber('PORT', 3000);
|
|
19
|
-
* const url = Envapter.get('API_URL', 'http://localhost');
|
|
20
|
-
* const replica = Envapter.get(['READONLY_URL', 'DATABASE_URL'], 'sqlite://memory');
|
|
21
|
-
*
|
|
22
|
-
* // Instance usage
|
|
23
|
-
* const env = new Envapter();
|
|
24
|
-
* const dbUrl = env.get('DATABASE_URL', 'sqlite://memory');
|
|
25
|
-
* const primaryHost = env.get(['PRIMARY_HOST', 'SECONDARY_HOST']);
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
declare class Envapter extends AdvancedMethods {
|
|
31
|
-
/**
|
|
32
|
-
* Tagged template literal for resolving environment variables in template strings.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```ts
|
|
36
|
-
* // Given API_HOST=api.example.com and API_PORT=8080 in environment
|
|
37
|
-
* const endpoint = Envapter.resolve`Connecting to ${'API_HOST'}:${'API_PORT'}`;
|
|
38
|
-
* // Returns: "Connecting to api.example.com:8080"
|
|
39
|
-
*
|
|
40
|
-
* // Works with template variables in .env too:
|
|
41
|
-
* // API_URL=https://${API_HOST}:${API_PORT}
|
|
42
|
-
* const message = Envapter.resolve`Service endpoint: ${'API_URL'}`;
|
|
43
|
-
* // Returns: "Service endpoint: https://api.example.com:8080"
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
static resolve(strings: TemplateStringsArray, ...keys: string[]): string;
|
|
47
|
-
/**
|
|
48
|
-
* @see {@link Envapter.resolve}
|
|
49
|
-
*/
|
|
50
|
-
resolve(strings: TemplateStringsArray, ...keys: string[]): string;
|
|
51
|
-
/**
|
|
52
|
-
* Assert that one or more environment variables are present and non-empty (post-trim,
|
|
53
|
-
* after template resolution). Throws `MissingEnvValue` listing every missing key.
|
|
54
|
-
*
|
|
55
|
-
* For typed fail-fast in functional code, use `Envapter.getUsing(key, { converter, required: true })`.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```ts
|
|
59
|
-
* Envapter.require('DATABASE_URL');
|
|
60
|
-
* Envapter.require('DATABASE_URL', 'API_KEY', 'SENTRY_DSN');
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
static require(...keys: [string, ...string[]]): void;
|
|
64
|
-
private static resolveAndValidate;
|
|
65
|
-
/**
|
|
66
|
-
* @see {@link Envapter.require}
|
|
67
|
-
*/
|
|
68
|
-
require(...keys: [string, ...string[]]): void;
|
|
69
|
-
}
|
|
70
|
-
//#endregion
|
|
71
|
-
export { Envapter };
|
|
72
|
-
//# sourceMappingURL=Envapter.d.mts.map
|