node-env-resolver 6.5.1 → 6.6.0
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/README.md +708 -400
- package/dist/builder.cjs +1 -1
- package/dist/builder.d.cts +1 -1
- package/dist/builder.d.ts +1 -1
- package/dist/builder.js +1 -1
- package/dist/chunk-3EWCMDFP.js +9 -0
- package/dist/chunk-BFLXBLZ3.cjs +1 -0
- package/dist/chunk-CDXO2XX3.cjs +2 -0
- package/dist/chunk-CTJYBBOB.js +2 -0
- package/dist/chunk-DIJNUFGZ.cjs +15 -0
- package/dist/chunk-DYFRO3NM.cjs +9 -0
- package/dist/chunk-K4NIC5T3.js +9 -0
- package/dist/chunk-WVMDTD6J.cjs +9 -0
- package/dist/chunk-ZMRT37K3.js +1 -0
- package/dist/chunk-ZSM2NDX5.js +15 -0
- package/dist/cli/bin.cjs +74 -0
- package/dist/cli/bin.js +74 -0
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +59 -3
- package/dist/index.d.ts +59 -3
- package/dist/index.js +1 -1
- package/dist/provider-kit.cjs +2 -0
- package/dist/provider-kit.d.cts +50 -0
- package/dist/provider-kit.d.ts +50 -0
- package/dist/provider-kit.js +2 -0
- package/dist/resolver.cjs +1 -1
- package/dist/resolver.d.cts +1 -1
- package/dist/resolver.d.ts +1 -1
- package/dist/resolver.js +1 -1
- package/dist/resolvers.cjs +1 -1
- package/dist/resolvers.d.cts +2 -27
- package/dist/resolvers.d.ts +2 -27
- package/dist/resolvers.js +1 -1
- package/dist/runtime/index.cjs +1 -0
- package/dist/runtime/index.d.cts +161 -0
- package/dist/runtime/index.d.ts +161 -0
- package/dist/runtime/index.js +1 -0
- package/dist/types--RcOnfdl.d.cts +284 -0
- package/dist/types--RcOnfdl.d.ts +284 -0
- package/dist/types.cjs +1 -1
- package/dist/types.d.cts +1 -129
- package/dist/types.d.ts +1 -129
- package/dist/types.js +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.cts +56 -12
- package/dist/utils.d.ts +56 -12
- package/dist/utils.js +1 -1
- package/dist/valibot.cjs +1 -1
- package/dist/valibot.d.cts +12 -25
- package/dist/valibot.d.ts +12 -25
- package/dist/valibot.js +1 -1
- package/dist/validators.cjs +2 -2
- package/dist/validators.d.cts +25 -48
- package/dist/validators.d.ts +25 -48
- package/dist/validators.js +2 -2
- package/dist/web.cjs +5 -5
- package/dist/web.d.cts +3 -1
- package/dist/web.d.ts +3 -1
- package/dist/web.js +5 -5
- package/dist/zod.cjs +1 -1
- package/dist/zod.d.cts +12 -25
- package/dist/zod.d.ts +12 -25
- package/dist/zod.js +1 -1
- package/package.json +26 -31
- package/binding.gyp +0 -9
- package/dist/chunk-2IQQVAXA.cjs +0 -9
- package/dist/chunk-46CBATKM.js +0 -1
- package/dist/chunk-C34FGZOG.js +0 -9
- package/dist/chunk-FNF55TN4.cjs +0 -1
- package/dist/chunk-G36OESVW.cjs +0 -1
- package/dist/chunk-I5UKYTX6.js +0 -1
- package/dist/chunk-MFFH2ZXS.js +0 -17
- package/dist/chunk-QCKMQEJP.cjs +0 -17
- package/dist/chunk-S7AB6UX7.cjs +0 -9
- package/dist/chunk-TGIYWWDY.js +0 -9
- package/dist/chunk-VUUPIWFJ.js +0 -9
- package/dist/chunk-ZDRU3RSU.cjs +0 -9
- package/dist/cli-main.cjs +0 -4
- package/dist/cli-main.js +0 -4
- package/dist/redaction.cjs +0 -1
- package/dist/redaction.d.cts +0 -54
- package/dist/redaction.d.ts +0 -54
- package/dist/redaction.js +0 -1
- package/dist/typegen.cjs +0 -1
- package/dist/typegen.d.cts +0 -52
- package/dist/typegen.d.ts +0 -52
- package/dist/typegen.js +0 -1
- package/index.js +0 -1
- /package/dist/{cli-main.d.cts → cli/bin.d.cts} +0 -0
- /package/dist/{cli-main.d.ts → cli/bin.d.ts} +0 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug view for environment variable resolution
|
|
3
|
+
*
|
|
4
|
+
* Provides a safe, operator-friendly inspection surface that:
|
|
5
|
+
* - Shows provenance/source without exposing values
|
|
6
|
+
* - Supports masked preview, fingerprint, or length-only modes
|
|
7
|
+
* - Marks sensitive values for special handling
|
|
8
|
+
* - Tracks consumed vs available
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
declare const DEFAULT_SENSITIVE_PATTERNS: readonly RegExp[];
|
|
12
|
+
/**
|
|
13
|
+
* Value display modes - from most to least safe
|
|
14
|
+
*/
|
|
15
|
+
type DebugValueMode = 'none' | 'length' | 'fingerprint' | 'masked';
|
|
16
|
+
/**
|
|
17
|
+
* Security snapshot entry - for incident response
|
|
18
|
+
*/
|
|
19
|
+
interface SecuritySnapshotEntry {
|
|
20
|
+
key: string;
|
|
21
|
+
resolved: boolean;
|
|
22
|
+
consumed: boolean;
|
|
23
|
+
source: string | null;
|
|
24
|
+
reference?: string | null;
|
|
25
|
+
resolvedVia?: string | null;
|
|
26
|
+
sensitive: boolean;
|
|
27
|
+
length: number;
|
|
28
|
+
fingerprint: string | null;
|
|
29
|
+
preview: string | null;
|
|
30
|
+
timestamp?: number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Visibility levels for different use cases
|
|
34
|
+
*
|
|
35
|
+
* - provenance: key, resolved, source, sensitive (safe default for production)
|
|
36
|
+
* - fingerprint: adds fingerprint (best for incident response)
|
|
37
|
+
* - masked: adds preview (only with explicit opt-in)
|
|
38
|
+
*/
|
|
39
|
+
type VisibilityLevel = 'provenance' | 'fingerprint' | 'masked';
|
|
40
|
+
/**
|
|
41
|
+
* Security snapshot options
|
|
42
|
+
*/
|
|
43
|
+
interface SecuritySnapshotOptions {
|
|
44
|
+
/** Visibility level (default: 'provenance') */
|
|
45
|
+
visibility?: VisibilityLevel;
|
|
46
|
+
/** Include source in output (default: true) */
|
|
47
|
+
includeSource?: boolean;
|
|
48
|
+
/** Include consumed vs available (default: true) */
|
|
49
|
+
includeConsumed?: boolean;
|
|
50
|
+
/** Include timestamp (default: false) */
|
|
51
|
+
includeTimestamp?: boolean;
|
|
52
|
+
/** Custom sensitive key patterns */
|
|
53
|
+
sensitiveKeys?: readonly string[];
|
|
54
|
+
/** Custom sensitive key matcher */
|
|
55
|
+
isSensitive?: (key: string, value: string) => boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Individual debug entry for a single env var
|
|
59
|
+
*/
|
|
60
|
+
interface DebugEntry {
|
|
61
|
+
key: string;
|
|
62
|
+
resolved: boolean;
|
|
63
|
+
source: string | null;
|
|
64
|
+
reference: string | null;
|
|
65
|
+
resolvedVia: string | null;
|
|
66
|
+
sensitive: boolean;
|
|
67
|
+
length: number;
|
|
68
|
+
fingerprint: string | null;
|
|
69
|
+
preview: string | null;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Debug view options
|
|
73
|
+
*/
|
|
74
|
+
interface DebugOptions {
|
|
75
|
+
/** Enable debug view generation (default: false) */
|
|
76
|
+
enabled?: boolean;
|
|
77
|
+
/** Value display mode */
|
|
78
|
+
valueMode?: DebugValueMode;
|
|
79
|
+
/** Include source in debug output (default: true) */
|
|
80
|
+
includeSource?: boolean;
|
|
81
|
+
/** Custom sensitive key patterns */
|
|
82
|
+
sensitiveKeys?: readonly string[];
|
|
83
|
+
/** Custom sensitive key matcher */
|
|
84
|
+
isSensitive?: (key: string, value: string) => boolean;
|
|
85
|
+
/** Callback called for each debug entry as it's resolved (default: none) */
|
|
86
|
+
onDebugEntry?: (entry: DebugEntry) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Generate debug view for resolved config
|
|
90
|
+
*/
|
|
91
|
+
declare function createDebugView(resolved: Record<string, unknown>, provenance: Record<string, Provenance>, options: DebugOptions): DebugEntry[];
|
|
92
|
+
/**
|
|
93
|
+
* Default debug options - safe defaults
|
|
94
|
+
*/
|
|
95
|
+
declare const DEFAULT_DEBUG_OPTIONS: DebugOptions;
|
|
96
|
+
/**
|
|
97
|
+
* Generate security snapshot for incident response
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```typescript
|
|
101
|
+
* const snapshot = createSecuritySnapshot(
|
|
102
|
+
* resolvedConfig,
|
|
103
|
+
* provenanceMap,
|
|
104
|
+
* consumedMap,
|
|
105
|
+
* { visibility: 'fingerprint', includeConsumed: true }
|
|
106
|
+
* );
|
|
107
|
+
*
|
|
108
|
+
* // Output:
|
|
109
|
+
* // [
|
|
110
|
+
* // { key: "PORT", resolved: true, consumed: true, source: "processEnv", sensitive: false, length: 4, preview: "3000" },
|
|
111
|
+
* // { key: "STRIPE_SECRET_KEY", resolved: true, consumed: true, source: "awsSecrets", sensitive: true, fingerprint: "sha256:ab12cd34", length: 51 }
|
|
112
|
+
* // ]
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
declare function createSecuritySnapshot(resolved: Record<string, unknown>, provenance: Record<string, Provenance>, consumed: Record<string, boolean>, options: SecuritySnapshotOptions): SecuritySnapshotEntry[];
|
|
116
|
+
/**
|
|
117
|
+
* Generate a redacted object for human-readable debugging
|
|
118
|
+
*
|
|
119
|
+
* Non-sensitive values: shown as-is or masked
|
|
120
|
+
* Sensitive values: [sha256:xxxx] or [redacted]
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```typescript
|
|
124
|
+
* const redacted = createRedactedObject(
|
|
125
|
+
* resolvedConfig,
|
|
126
|
+
* provenanceMap,
|
|
127
|
+
* { valueMode: 'fingerprint' }
|
|
128
|
+
* );
|
|
129
|
+
*
|
|
130
|
+
* // Output:
|
|
131
|
+
* // { PORT: "3000", STRIPE_SECRET_KEY: "[sha256:ab12cd34]", DATABASE_URL: "[sha256:94e1b7aa]" }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
declare function createRedactedObject(resolved: Record<string, unknown>, provenance: Record<string, Provenance>, options: DebugOptions): Record<string, string>;
|
|
135
|
+
|
|
136
|
+
type Validator<T> = ((value: string) => T) & {
|
|
137
|
+
optional?: boolean;
|
|
138
|
+
default?: T;
|
|
139
|
+
};
|
|
140
|
+
type SimpleEnvSchema = Record<string, Validator<unknown> | string | number | boolean | readonly string[]>;
|
|
141
|
+
type InferSimpleValue<V> = V extends Validator<infer R> ? V extends {
|
|
142
|
+
optional: true;
|
|
143
|
+
} ? R | undefined : R : V extends number ? number : V extends boolean ? boolean : V extends readonly (infer U)[] ? V extends {
|
|
144
|
+
__optional: true;
|
|
145
|
+
} ? U | undefined : U : V extends string ? string : never;
|
|
146
|
+
type InferSimpleSchema<T extends SimpleEnvSchema> = {
|
|
147
|
+
[K in keyof T]: InferSimpleValue<T[K]>;
|
|
148
|
+
};
|
|
149
|
+
type InferNestedSchema<T extends SimpleEnvSchema> = InferSimpleSchema<T>;
|
|
150
|
+
type InferResolveResult<T extends SimpleEnvSchema, O extends ResolveOptions | undefined> = O extends {
|
|
151
|
+
nestedDelimiter: string;
|
|
152
|
+
} ? InferNestedSchema<T> : InferSimpleSchema<T>;
|
|
153
|
+
interface SyncResolver {
|
|
154
|
+
loadSync(): Record<string, string>;
|
|
155
|
+
load?(): Promise<Record<string, string>>;
|
|
156
|
+
name?: string;
|
|
157
|
+
metadata?: Record<string, unknown>;
|
|
158
|
+
}
|
|
159
|
+
interface AsyncResolver {
|
|
160
|
+
load(): Promise<Record<string, string>>;
|
|
161
|
+
loadSync?(): Record<string, string>;
|
|
162
|
+
name?: string;
|
|
163
|
+
metadata?: Record<string, unknown>;
|
|
164
|
+
}
|
|
165
|
+
type Resolver = SyncResolver | AsyncResolver;
|
|
166
|
+
interface ReferenceResolution {
|
|
167
|
+
value: string;
|
|
168
|
+
resolvedVia?: string;
|
|
169
|
+
metadata?: Record<string, unknown>;
|
|
170
|
+
}
|
|
171
|
+
interface ReferenceContext {
|
|
172
|
+
key: string;
|
|
173
|
+
source: string | null;
|
|
174
|
+
reference: string;
|
|
175
|
+
}
|
|
176
|
+
interface ReferenceHandler {
|
|
177
|
+
name?: string;
|
|
178
|
+
resolve(reference: string, context: ReferenceContext): string | ReferenceResolution | Promise<string | ReferenceResolution>;
|
|
179
|
+
resolveSync?(reference: string, context: ReferenceContext): string | ReferenceResolution;
|
|
180
|
+
}
|
|
181
|
+
interface ReferenceOptions {
|
|
182
|
+
handlers: Record<string, ReferenceHandler>;
|
|
183
|
+
onUnresolved?: 'error' | 'ignore';
|
|
184
|
+
}
|
|
185
|
+
declare const isSyncResolver: (resolver: Resolver) => resolver is SyncResolver;
|
|
186
|
+
declare const isAsyncOnlyResolver: (resolver: Resolver) => resolver is AsyncResolver;
|
|
187
|
+
interface ResolveOptions {
|
|
188
|
+
priority?: 'first' | 'last';
|
|
189
|
+
nestedDelimiter?: string;
|
|
190
|
+
validateDefaults?: boolean;
|
|
191
|
+
secretsDir?: string;
|
|
192
|
+
arraySeparator?: string;
|
|
193
|
+
interpolate?: boolean;
|
|
194
|
+
strict?: boolean;
|
|
195
|
+
policies?: Record<string, unknown>;
|
|
196
|
+
enableAudit?: boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Prevent writing resolved values back into process.env.
|
|
199
|
+
* Default: true (secure-by-default)
|
|
200
|
+
*
|
|
201
|
+
* Set to false only if you explicitly need legacy write-back behavior.
|
|
202
|
+
*/
|
|
203
|
+
preventProcessEnvWrite?: boolean;
|
|
204
|
+
/** Debug view options for safe inspection */
|
|
205
|
+
debug?: DebugOptions;
|
|
206
|
+
/** Optional secret/reference dereferencing */
|
|
207
|
+
references?: ReferenceOptions;
|
|
208
|
+
}
|
|
209
|
+
type SafeResolveResultType<T> = {
|
|
210
|
+
success: true;
|
|
211
|
+
data: T;
|
|
212
|
+
} | {
|
|
213
|
+
success: false;
|
|
214
|
+
error: string;
|
|
215
|
+
details?: unknown;
|
|
216
|
+
};
|
|
217
|
+
type ExtractSchema<T> = T extends readonly [unknown, infer S] ? S : never;
|
|
218
|
+
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
219
|
+
type ExtractSchemasUnion<T> = T extends readonly (infer E)[] ? E extends readonly [unknown, infer S] ? S extends SimpleEnvSchema ? S : never : never : never;
|
|
220
|
+
type MergedSchema<T> = UnionToIntersection<ExtractSchemasUnion<T>>;
|
|
221
|
+
type InferMergedSchemaResult<T extends readonly [unknown, SimpleEnvSchema][]> = MergedSchema<T> extends SimpleEnvSchema ? {
|
|
222
|
+
[K in keyof MergedSchema<T>]: InferSimpleValue<MergedSchema<T>[K]>;
|
|
223
|
+
} : Record<string, unknown>;
|
|
224
|
+
type InferMergedSchema<T extends readonly [unknown, SimpleEnvSchema][]> = T extends readonly [unknown, infer S1, ...infer Rest] ? Rest extends readonly [unknown, SimpleEnvSchema][] ? S1 & InferMergedSchema<Rest> : S1 : T extends readonly [unknown, infer S] ? S : Record<string, never>;
|
|
225
|
+
|
|
226
|
+
interface ResolveConfig<T extends SimpleEnvSchema = SimpleEnvSchema> {
|
|
227
|
+
schema?: T;
|
|
228
|
+
resolvers?: readonly [SyncResolver, SimpleEnvSchema][];
|
|
229
|
+
options?: Partial<ResolveOptions>;
|
|
230
|
+
references?: ReferenceOptions;
|
|
231
|
+
}
|
|
232
|
+
interface ResolveAsyncConfig<T extends SimpleEnvSchema = SimpleEnvSchema> {
|
|
233
|
+
schema?: T;
|
|
234
|
+
resolvers?: readonly [Resolver, SimpleEnvSchema][];
|
|
235
|
+
options?: Partial<ResolveOptions>;
|
|
236
|
+
references?: ReferenceOptions;
|
|
237
|
+
}
|
|
238
|
+
interface ResolveConfigWithSchema<T extends SimpleEnvSchema> {
|
|
239
|
+
schema: T;
|
|
240
|
+
options?: Partial<ResolveOptions>;
|
|
241
|
+
references?: ReferenceOptions;
|
|
242
|
+
}
|
|
243
|
+
interface ResolveConfigWithResolvers<T extends readonly [SyncResolver, SimpleEnvSchema][]> {
|
|
244
|
+
resolvers: T;
|
|
245
|
+
options?: Partial<ResolveOptions>;
|
|
246
|
+
references?: ReferenceOptions;
|
|
247
|
+
}
|
|
248
|
+
interface ResolveAsyncConfigWithSchema<T extends SimpleEnvSchema> {
|
|
249
|
+
schema: T;
|
|
250
|
+
options?: Partial<ResolveOptions>;
|
|
251
|
+
references?: ReferenceOptions;
|
|
252
|
+
}
|
|
253
|
+
interface ResolveAsyncConfigWithResolvers<T extends readonly [Resolver, SimpleEnvSchema][]> {
|
|
254
|
+
resolvers: T;
|
|
255
|
+
options?: Partial<ResolveOptions>;
|
|
256
|
+
references?: ReferenceOptions;
|
|
257
|
+
}
|
|
258
|
+
type Provenance = {
|
|
259
|
+
source: string;
|
|
260
|
+
timestamp: number;
|
|
261
|
+
metadata?: Record<string, unknown>;
|
|
262
|
+
cached?: boolean;
|
|
263
|
+
reference?: string;
|
|
264
|
+
resolvedVia?: string;
|
|
265
|
+
};
|
|
266
|
+
type PolicyOptions = {
|
|
267
|
+
allowDotenvInProduction?: boolean;
|
|
268
|
+
requireSecretsForSensitive?: boolean;
|
|
269
|
+
blockInsecureProtocols?: boolean;
|
|
270
|
+
enforceAllowedSources?: Record<string, string[]>;
|
|
271
|
+
};
|
|
272
|
+
type SimpleEnvValue = Validator<unknown> | string | number | boolean | readonly string[];
|
|
273
|
+
type EnvSchema = Record<string, unknown>;
|
|
274
|
+
interface EnvDefinition {
|
|
275
|
+
type?: string;
|
|
276
|
+
validator?: (value: string, key?: string) => unknown;
|
|
277
|
+
default?: unknown;
|
|
278
|
+
optional?: boolean;
|
|
279
|
+
secretsDir?: string;
|
|
280
|
+
}
|
|
281
|
+
type InferType = unknown;
|
|
282
|
+
type InferSchema = unknown;
|
|
283
|
+
|
|
284
|
+
export { type AsyncResolver as A, createSecuritySnapshot as B, createRedactedObject as C, type DebugValueMode as D, type EnvSchema as E, DEFAULT_DEBUG_OPTIONS as F, DEFAULT_SENSITIVE_PATTERNS as G, type InferMergedSchema as H, type InferSimpleSchema as I, type ExtractSchema as J, type InferNestedSchema as K, type SafeResolveResultType as L, type MergedSchema as M, type ResolveConfigWithResolvers as N, type ResolveAsyncConfigWithResolvers as O, type PolicyOptions as P, type ResolveOptions as R, type SimpleEnvSchema as S, type UnionToIntersection as U, type Validator as V, type Resolver as a, type ReferenceOptions as b, type EnvDefinition as c, type SyncResolver as d, type ReferenceHandler as e, type ResolveAsyncConfig as f, type InferSimpleValue as g, type ResolveAsyncConfigWithSchema as h, type InferMergedSchemaResult as i, type ResolveConfigWithSchema as j, type ResolveConfig as k, type ReferenceContext as l, type ReferenceResolution as m, type Provenance as n, type SimpleEnvValue as o, type InferType as p, type InferSchema as q, type InferResolveResult as r, isSyncResolver as s, isAsyncOnlyResolver as t, type DebugOptions as u, type DebugEntry as v, type VisibilityLevel as w, type SecuritySnapshotOptions as x, type SecuritySnapshotEntry as y, createDebugView as z };
|
package/dist/types.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkBFLXBLZ3_cjs=require('./chunk-BFLXBLZ3.cjs');require('./chunk-D6WM53FN.cjs');Object.defineProperty(exports,"isAsyncOnlyResolver",{enumerable:true,get:function(){return chunkBFLXBLZ3_cjs.b}});Object.defineProperty(exports,"isSyncResolver",{enumerable:true,get:function(){return chunkBFLXBLZ3_cjs.a}});
|
package/dist/types.d.cts
CHANGED
|
@@ -1,129 +1 @@
|
|
|
1
|
-
|
|
2
|
-
sensitive?: boolean;
|
|
3
|
-
description?: string;
|
|
4
|
-
type?: string;
|
|
5
|
-
enumValues?: readonly string[];
|
|
6
|
-
}
|
|
7
|
-
type Validator<T> = ((value: string) => T) & {
|
|
8
|
-
optional?: boolean;
|
|
9
|
-
default?: T;
|
|
10
|
-
__meta?: ValidatorMeta;
|
|
11
|
-
};
|
|
12
|
-
type SimpleEnvSchema = Record<string, Validator<unknown> | string | number | boolean | readonly string[]>;
|
|
13
|
-
type InferSimpleValue<V> = V extends Validator<infer R> ? V extends {
|
|
14
|
-
optional: true;
|
|
15
|
-
} ? R | undefined : R : V extends number ? number : V extends boolean ? boolean : V extends readonly (infer U)[] ? V extends {
|
|
16
|
-
__optional: true;
|
|
17
|
-
} ? U | undefined : U : V extends string ? string : never;
|
|
18
|
-
type InferSimpleSchema<T extends SimpleEnvSchema> = {
|
|
19
|
-
[K in keyof T]: InferSimpleValue<T[K]>;
|
|
20
|
-
};
|
|
21
|
-
type InferNestedSchema<T extends SimpleEnvSchema> = InferSimpleSchema<T>;
|
|
22
|
-
type InferResolveResult<T extends SimpleEnvSchema, O extends ResolveOptions | undefined> = O extends {
|
|
23
|
-
nestedDelimiter: string;
|
|
24
|
-
} ? InferNestedSchema<T> : InferSimpleSchema<T>;
|
|
25
|
-
interface SyncResolver {
|
|
26
|
-
loadSync(): Record<string, string>;
|
|
27
|
-
load?(): Promise<Record<string, string>>;
|
|
28
|
-
name?: string;
|
|
29
|
-
metadata?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
interface AsyncResolver {
|
|
32
|
-
load(): Promise<Record<string, string>>;
|
|
33
|
-
loadSync?(): Record<string, string>;
|
|
34
|
-
name?: string;
|
|
35
|
-
metadata?: Record<string, unknown>;
|
|
36
|
-
}
|
|
37
|
-
type Resolver = SyncResolver | AsyncResolver;
|
|
38
|
-
declare const isSyncResolver: (resolver: Resolver) => resolver is SyncResolver;
|
|
39
|
-
declare const isAsyncOnlyResolver: (resolver: Resolver) => resolver is AsyncResolver;
|
|
40
|
-
interface ResolveOptions {
|
|
41
|
-
priority?: 'first' | 'last';
|
|
42
|
-
nestedDelimiter?: string;
|
|
43
|
-
validateDefaults?: boolean;
|
|
44
|
-
secretsDir?: string;
|
|
45
|
-
arraySeparator?: string;
|
|
46
|
-
interpolate?: boolean;
|
|
47
|
-
strict?: boolean;
|
|
48
|
-
policies?: Record<string, unknown>;
|
|
49
|
-
enableAudit?: boolean;
|
|
50
|
-
}
|
|
51
|
-
type SafeResolveResultType<T> = {
|
|
52
|
-
success: true;
|
|
53
|
-
data: T;
|
|
54
|
-
} | {
|
|
55
|
-
success: false;
|
|
56
|
-
error: string;
|
|
57
|
-
details?: unknown;
|
|
58
|
-
};
|
|
59
|
-
type ExtractSchema<T> = T extends readonly [unknown, infer S] ? S : never;
|
|
60
|
-
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
61
|
-
type ExtractSchemasUnion<T> = T extends readonly (infer E)[] ? E extends readonly [unknown, infer S] ? S extends SimpleEnvSchema ? S : never : never : never;
|
|
62
|
-
type MergedSchema<T> = UnionToIntersection<ExtractSchemasUnion<T>>;
|
|
63
|
-
type InferMergedSchemaResult<T extends readonly [unknown, SimpleEnvSchema][]> = MergedSchema<T> extends SimpleEnvSchema ? {
|
|
64
|
-
[K in keyof MergedSchema<T>]: InferSimpleValue<MergedSchema<T>[K]>;
|
|
65
|
-
} : Record<string, unknown>;
|
|
66
|
-
type InferMergedSchema<T extends readonly [unknown, SimpleEnvSchema][]> = T extends readonly [
|
|
67
|
-
unknown,
|
|
68
|
-
infer S1,
|
|
69
|
-
...infer Rest
|
|
70
|
-
] ? Rest extends readonly [unknown, SimpleEnvSchema][] ? S1 & InferMergedSchema<Rest> : S1 : T extends readonly [unknown, infer S] ? S : Record<string, never>;
|
|
71
|
-
|
|
72
|
-
interface ResolveConfig<T extends SimpleEnvSchema = SimpleEnvSchema> {
|
|
73
|
-
schema?: T;
|
|
74
|
-
resolvers?: readonly [SyncResolver, SimpleEnvSchema][];
|
|
75
|
-
options?: Partial<ResolveOptions>;
|
|
76
|
-
}
|
|
77
|
-
interface ResolveAsyncConfig<T extends SimpleEnvSchema = SimpleEnvSchema> {
|
|
78
|
-
schema?: T;
|
|
79
|
-
resolvers?: readonly [Resolver, SimpleEnvSchema][];
|
|
80
|
-
options?: Partial<ResolveOptions>;
|
|
81
|
-
}
|
|
82
|
-
interface ResolveConfigWithSchema<T extends SimpleEnvSchema> {
|
|
83
|
-
schema: T;
|
|
84
|
-
options?: Partial<ResolveOptions>;
|
|
85
|
-
}
|
|
86
|
-
interface ResolveConfigWithResolvers<T extends readonly [SyncResolver, SimpleEnvSchema][]> {
|
|
87
|
-
resolvers: T;
|
|
88
|
-
options?: Partial<ResolveOptions>;
|
|
89
|
-
}
|
|
90
|
-
interface ResolveAsyncConfigWithSchema<T extends SimpleEnvSchema> {
|
|
91
|
-
schema: T;
|
|
92
|
-
options?: Partial<ResolveOptions>;
|
|
93
|
-
}
|
|
94
|
-
interface ResolveAsyncConfigWithResolvers<T extends readonly [Resolver, SimpleEnvSchema][]> {
|
|
95
|
-
resolvers: T;
|
|
96
|
-
options?: Partial<ResolveOptions>;
|
|
97
|
-
}
|
|
98
|
-
type Provenance = {
|
|
99
|
-
source: string;
|
|
100
|
-
timestamp: number;
|
|
101
|
-
metadata?: Record<string, unknown>;
|
|
102
|
-
cached?: boolean;
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Symbol used to attach provenance metadata (key -> source/timestamp) to resolved config objects.
|
|
106
|
-
*/
|
|
107
|
-
declare const PROVENANCE_SYMBOL: unique symbol;
|
|
108
|
-
type PolicyOptions = {
|
|
109
|
-
allowDotenvInProduction?: boolean;
|
|
110
|
-
requireSecretsForSensitive?: boolean;
|
|
111
|
-
blockInsecureProtocols?: boolean;
|
|
112
|
-
enforceAllowedSources?: Record<string, readonly string[]>;
|
|
113
|
-
};
|
|
114
|
-
type SimpleEnvValue = Validator<unknown> | string | number | boolean | readonly string[];
|
|
115
|
-
type EnvSchema = Record<string, unknown>;
|
|
116
|
-
interface EnvDefinition {
|
|
117
|
-
type?: string;
|
|
118
|
-
validator?: (value: string, key?: string) => unknown;
|
|
119
|
-
default?: unknown;
|
|
120
|
-
optional?: boolean;
|
|
121
|
-
secretsDir?: string;
|
|
122
|
-
sensitive?: boolean;
|
|
123
|
-
description?: string;
|
|
124
|
-
}
|
|
125
|
-
declare const SENSITIVE_KEYS_SYMBOL: unique symbol;
|
|
126
|
-
type InferType = unknown;
|
|
127
|
-
type InferSchema = unknown;
|
|
128
|
-
|
|
129
|
-
export { type AsyncResolver, type EnvDefinition, type EnvSchema, type ExtractSchema, type InferMergedSchema, type InferMergedSchemaResult, type InferNestedSchema, type InferResolveResult, type InferSchema, type InferSimpleSchema, type InferSimpleValue, type InferType, type MergedSchema, PROVENANCE_SYMBOL, type PolicyOptions, type Provenance, type ResolveAsyncConfig, type ResolveAsyncConfigWithResolvers, type ResolveAsyncConfigWithSchema, type ResolveConfig, type ResolveConfigWithResolvers, type ResolveConfigWithSchema, type ResolveOptions, type Resolver, SENSITIVE_KEYS_SYMBOL, type SafeResolveResultType, type SimpleEnvSchema, type SimpleEnvValue, type SyncResolver, type UnionToIntersection, type Validator, type ValidatorMeta, isAsyncOnlyResolver, isSyncResolver };
|
|
1
|
+
export { A as AsyncResolver, c as EnvDefinition, E as EnvSchema, J as ExtractSchema, H as InferMergedSchema, i as InferMergedSchemaResult, K as InferNestedSchema, r as InferResolveResult, q as InferSchema, I as InferSimpleSchema, g as InferSimpleValue, p as InferType, M as MergedSchema, P as PolicyOptions, n as Provenance, l as ReferenceContext, e as ReferenceHandler, b as ReferenceOptions, m as ReferenceResolution, f as ResolveAsyncConfig, O as ResolveAsyncConfigWithResolvers, h as ResolveAsyncConfigWithSchema, k as ResolveConfig, N as ResolveConfigWithResolvers, j as ResolveConfigWithSchema, R as ResolveOptions, a as Resolver, L as SafeResolveResultType, S as SimpleEnvSchema, o as SimpleEnvValue, d as SyncResolver, U as UnionToIntersection, V as Validator, t as isAsyncOnlyResolver, s as isSyncResolver } from './types--RcOnfdl.cjs';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,129 +1 @@
|
|
|
1
|
-
|
|
2
|
-
sensitive?: boolean;
|
|
3
|
-
description?: string;
|
|
4
|
-
type?: string;
|
|
5
|
-
enumValues?: readonly string[];
|
|
6
|
-
}
|
|
7
|
-
type Validator<T> = ((value: string) => T) & {
|
|
8
|
-
optional?: boolean;
|
|
9
|
-
default?: T;
|
|
10
|
-
__meta?: ValidatorMeta;
|
|
11
|
-
};
|
|
12
|
-
type SimpleEnvSchema = Record<string, Validator<unknown> | string | number | boolean | readonly string[]>;
|
|
13
|
-
type InferSimpleValue<V> = V extends Validator<infer R> ? V extends {
|
|
14
|
-
optional: true;
|
|
15
|
-
} ? R | undefined : R : V extends number ? number : V extends boolean ? boolean : V extends readonly (infer U)[] ? V extends {
|
|
16
|
-
__optional: true;
|
|
17
|
-
} ? U | undefined : U : V extends string ? string : never;
|
|
18
|
-
type InferSimpleSchema<T extends SimpleEnvSchema> = {
|
|
19
|
-
[K in keyof T]: InferSimpleValue<T[K]>;
|
|
20
|
-
};
|
|
21
|
-
type InferNestedSchema<T extends SimpleEnvSchema> = InferSimpleSchema<T>;
|
|
22
|
-
type InferResolveResult<T extends SimpleEnvSchema, O extends ResolveOptions | undefined> = O extends {
|
|
23
|
-
nestedDelimiter: string;
|
|
24
|
-
} ? InferNestedSchema<T> : InferSimpleSchema<T>;
|
|
25
|
-
interface SyncResolver {
|
|
26
|
-
loadSync(): Record<string, string>;
|
|
27
|
-
load?(): Promise<Record<string, string>>;
|
|
28
|
-
name?: string;
|
|
29
|
-
metadata?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
interface AsyncResolver {
|
|
32
|
-
load(): Promise<Record<string, string>>;
|
|
33
|
-
loadSync?(): Record<string, string>;
|
|
34
|
-
name?: string;
|
|
35
|
-
metadata?: Record<string, unknown>;
|
|
36
|
-
}
|
|
37
|
-
type Resolver = SyncResolver | AsyncResolver;
|
|
38
|
-
declare const isSyncResolver: (resolver: Resolver) => resolver is SyncResolver;
|
|
39
|
-
declare const isAsyncOnlyResolver: (resolver: Resolver) => resolver is AsyncResolver;
|
|
40
|
-
interface ResolveOptions {
|
|
41
|
-
priority?: 'first' | 'last';
|
|
42
|
-
nestedDelimiter?: string;
|
|
43
|
-
validateDefaults?: boolean;
|
|
44
|
-
secretsDir?: string;
|
|
45
|
-
arraySeparator?: string;
|
|
46
|
-
interpolate?: boolean;
|
|
47
|
-
strict?: boolean;
|
|
48
|
-
policies?: Record<string, unknown>;
|
|
49
|
-
enableAudit?: boolean;
|
|
50
|
-
}
|
|
51
|
-
type SafeResolveResultType<T> = {
|
|
52
|
-
success: true;
|
|
53
|
-
data: T;
|
|
54
|
-
} | {
|
|
55
|
-
success: false;
|
|
56
|
-
error: string;
|
|
57
|
-
details?: unknown;
|
|
58
|
-
};
|
|
59
|
-
type ExtractSchema<T> = T extends readonly [unknown, infer S] ? S : never;
|
|
60
|
-
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
61
|
-
type ExtractSchemasUnion<T> = T extends readonly (infer E)[] ? E extends readonly [unknown, infer S] ? S extends SimpleEnvSchema ? S : never : never : never;
|
|
62
|
-
type MergedSchema<T> = UnionToIntersection<ExtractSchemasUnion<T>>;
|
|
63
|
-
type InferMergedSchemaResult<T extends readonly [unknown, SimpleEnvSchema][]> = MergedSchema<T> extends SimpleEnvSchema ? {
|
|
64
|
-
[K in keyof MergedSchema<T>]: InferSimpleValue<MergedSchema<T>[K]>;
|
|
65
|
-
} : Record<string, unknown>;
|
|
66
|
-
type InferMergedSchema<T extends readonly [unknown, SimpleEnvSchema][]> = T extends readonly [
|
|
67
|
-
unknown,
|
|
68
|
-
infer S1,
|
|
69
|
-
...infer Rest
|
|
70
|
-
] ? Rest extends readonly [unknown, SimpleEnvSchema][] ? S1 & InferMergedSchema<Rest> : S1 : T extends readonly [unknown, infer S] ? S : Record<string, never>;
|
|
71
|
-
|
|
72
|
-
interface ResolveConfig<T extends SimpleEnvSchema = SimpleEnvSchema> {
|
|
73
|
-
schema?: T;
|
|
74
|
-
resolvers?: readonly [SyncResolver, SimpleEnvSchema][];
|
|
75
|
-
options?: Partial<ResolveOptions>;
|
|
76
|
-
}
|
|
77
|
-
interface ResolveAsyncConfig<T extends SimpleEnvSchema = SimpleEnvSchema> {
|
|
78
|
-
schema?: T;
|
|
79
|
-
resolvers?: readonly [Resolver, SimpleEnvSchema][];
|
|
80
|
-
options?: Partial<ResolveOptions>;
|
|
81
|
-
}
|
|
82
|
-
interface ResolveConfigWithSchema<T extends SimpleEnvSchema> {
|
|
83
|
-
schema: T;
|
|
84
|
-
options?: Partial<ResolveOptions>;
|
|
85
|
-
}
|
|
86
|
-
interface ResolveConfigWithResolvers<T extends readonly [SyncResolver, SimpleEnvSchema][]> {
|
|
87
|
-
resolvers: T;
|
|
88
|
-
options?: Partial<ResolveOptions>;
|
|
89
|
-
}
|
|
90
|
-
interface ResolveAsyncConfigWithSchema<T extends SimpleEnvSchema> {
|
|
91
|
-
schema: T;
|
|
92
|
-
options?: Partial<ResolveOptions>;
|
|
93
|
-
}
|
|
94
|
-
interface ResolveAsyncConfigWithResolvers<T extends readonly [Resolver, SimpleEnvSchema][]> {
|
|
95
|
-
resolvers: T;
|
|
96
|
-
options?: Partial<ResolveOptions>;
|
|
97
|
-
}
|
|
98
|
-
type Provenance = {
|
|
99
|
-
source: string;
|
|
100
|
-
timestamp: number;
|
|
101
|
-
metadata?: Record<string, unknown>;
|
|
102
|
-
cached?: boolean;
|
|
103
|
-
};
|
|
104
|
-
/**
|
|
105
|
-
* Symbol used to attach provenance metadata (key -> source/timestamp) to resolved config objects.
|
|
106
|
-
*/
|
|
107
|
-
declare const PROVENANCE_SYMBOL: unique symbol;
|
|
108
|
-
type PolicyOptions = {
|
|
109
|
-
allowDotenvInProduction?: boolean;
|
|
110
|
-
requireSecretsForSensitive?: boolean;
|
|
111
|
-
blockInsecureProtocols?: boolean;
|
|
112
|
-
enforceAllowedSources?: Record<string, readonly string[]>;
|
|
113
|
-
};
|
|
114
|
-
type SimpleEnvValue = Validator<unknown> | string | number | boolean | readonly string[];
|
|
115
|
-
type EnvSchema = Record<string, unknown>;
|
|
116
|
-
interface EnvDefinition {
|
|
117
|
-
type?: string;
|
|
118
|
-
validator?: (value: string, key?: string) => unknown;
|
|
119
|
-
default?: unknown;
|
|
120
|
-
optional?: boolean;
|
|
121
|
-
secretsDir?: string;
|
|
122
|
-
sensitive?: boolean;
|
|
123
|
-
description?: string;
|
|
124
|
-
}
|
|
125
|
-
declare const SENSITIVE_KEYS_SYMBOL: unique symbol;
|
|
126
|
-
type InferType = unknown;
|
|
127
|
-
type InferSchema = unknown;
|
|
128
|
-
|
|
129
|
-
export { type AsyncResolver, type EnvDefinition, type EnvSchema, type ExtractSchema, type InferMergedSchema, type InferMergedSchemaResult, type InferNestedSchema, type InferResolveResult, type InferSchema, type InferSimpleSchema, type InferSimpleValue, type InferType, type MergedSchema, PROVENANCE_SYMBOL, type PolicyOptions, type Provenance, type ResolveAsyncConfig, type ResolveAsyncConfigWithResolvers, type ResolveAsyncConfigWithSchema, type ResolveConfig, type ResolveConfigWithResolvers, type ResolveConfigWithSchema, type ResolveOptions, type Resolver, SENSITIVE_KEYS_SYMBOL, type SafeResolveResultType, type SimpleEnvSchema, type SimpleEnvValue, type SyncResolver, type UnionToIntersection, type Validator, type ValidatorMeta, isAsyncOnlyResolver, isSyncResolver };
|
|
1
|
+
export { A as AsyncResolver, c as EnvDefinition, E as EnvSchema, J as ExtractSchema, H as InferMergedSchema, i as InferMergedSchemaResult, K as InferNestedSchema, r as InferResolveResult, q as InferSchema, I as InferSimpleSchema, g as InferSimpleValue, p as InferType, M as MergedSchema, P as PolicyOptions, n as Provenance, l as ReferenceContext, e as ReferenceHandler, b as ReferenceOptions, m as ReferenceResolution, f as ResolveAsyncConfig, O as ResolveAsyncConfigWithResolvers, h as ResolveAsyncConfigWithSchema, k as ResolveConfig, N as ResolveConfigWithResolvers, j as ResolveConfigWithSchema, R as ResolveOptions, a as Resolver, L as SafeResolveResultType, S as SimpleEnvSchema, o as SimpleEnvValue, d as SyncResolver, U as UnionToIntersection, V as Validator, t as isAsyncOnlyResolver, s as isSyncResolver } from './types--RcOnfdl.js';
|
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{b as isAsyncOnlyResolver,a as isSyncResolver}from'./chunk-ZMRT37K3.js';import'./chunk-I7AUKTXE.js';
|
package/dist/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkDYFRO3NM_cjs=require('./chunk-DYFRO3NM.cjs');require('./chunk-WVMDTD6J.cjs'),require('./chunk-CDXO2XX3.cjs'),require('./chunk-O7NR4K6A.cjs'),require('./chunk-4QOKRJ3F.cjs'),require('./chunk-BFLXBLZ3.cjs');var chunkD6WM53FN_cjs=require('./chunk-D6WM53FN.cjs');function x(e,n={}){let{ttl:r=3e5,maxAge:s=36e5,staleWhileRevalidate:o=false}=n,t=null,a={name:`cached(${e.name})`,metadata:{},async load(){let i=Date.now();if(!t||i-t.timestamp>s){let u=e.load?await e.load():{};return t={data:u,timestamp:i},a.metadata={cached:false},u}if(i-t.timestamp<r)return a.metadata={cached:true},t.data;if(o&&!t.refreshPromise){let u=Promise.resolve(e.load?e.load():Promise.resolve({}));return t.refreshPromise=u.then(d=>(t.data=d,t.timestamp=Date.now(),t.refreshPromise=void 0,d)).catch(()=>(t.refreshPromise=void 0,t.data)),a.metadata={cached:true,stale:true},t.data}let c=e.load?await e.load():{};return t={data:c,timestamp:i},a.metadata={cached:false},c}};return a}var w={short:30*1e3,minute:60*1e3,minutes5:300*1e3,minutes15:900*1e3,hour:3600*1e3,hours6:360*60*1e3,day:1440*60*1e3};function P(e={}){return {ttl:e.ttl??w.minutes5,maxAge:e.maxAge??w.hour,staleWhileRevalidate:e.staleWhileRevalidate??true,key:"aws-secrets"}}function v(e,n=3,r=1e3){return {name:`retry(${e.name})`,async load(){let s;for(let o=0;o<=n;o++)try{return e.load?await e.load():{}}catch(t){s=t instanceof Error?t:new Error(String(t)),o<n&&await new Promise(a=>setTimeout(a,r*Math.pow(2,o)));}throw s}}}function C(e,n){if(Object.is(e,n))return true;try{return JSON.stringify(e)===JSON.stringify(n)}catch{return false}}function O(e,n={}){let{intervalMs:r=1e4,immediate:s=true,onChange:o,onError:t,equals:a=C}=n,i,c=null,u=false,d=false,p=false,l=()=>{u||(c=setTimeout(()=>{c=null,m();},r));},m=async()=>{if(u||d)return i;d=true,c&&(clearTimeout(c),c=null);try{let f=await e(),g=i;return i=f,p&&!a(f,g)&&await o?.(f,g),p=!0,f}catch(f){return t?.(f),i}finally{d=false,u||l();}};return s?m():l(),{getCurrent:()=>i,refresh:()=>m(),stop:()=>{u=true,c&&(clearTimeout(c),c=null);}}}function S(e,n){let r=n.toUpperCase();return {name:`withPrefix(${e.name}, ${n})`,async load(){let s=e.load?await e.load():{},o={};for(let[t,a]of Object.entries(s))if(t.toUpperCase().startsWith(r)){let i=t.slice(n.length);o[i]=a;}else o[t]=a;return o},loadSync(){if(!e.loadSync)throw new Error(`Resolver ${e.name} does not support sync loading`);let s=e.loadSync(),o={};for(let[t,a]of Object.entries(s))if(t.toUpperCase().startsWith(r)){let i=t.slice(n.length);o[i]=a;}else o[t]=a;return o}}}function $(e,n){let r={...e};for(let[s,o]of Object.entries(n))Object.defineProperty(r,s,{get(){return o(e)},enumerable:true,configurable:true});return r}function k(e,n){return {name:`withAliases(${e.name})`,async load(){let r=e.load?await e.load():{};return T(r,n)},loadSync(){if(!e.loadSync)throw new Error(`Resolver ${e.name} does not support sync loading`);let r=e.loadSync();return T(r,n)}}}function T(e,n){let r={...e};for(let[s,o]of Object.entries(n))for(let t of o)if(e[t]!==void 0){r[s]=e[t];break}return r}function E(e,n){return {name:`withTransform(${e.name})`,async load(){let r=e.load?await e.load():{};return R(r,n)},loadSync(){if(!e.loadSync)throw new Error(`Resolver ${e.name} does not support sync loading`);let r=e.loadSync();return R(r,n)}}}function R(e,n){let r={...e};for(let[s,o]of Object.entries(n))if(e[s]!==void 0)try{r[s]=o(e[s]);}catch(t){throw new Error(`Transform failed for ${s}: ${t instanceof Error?t.message:String(t)}`,{cause:t})}return r}function A(e,n){let s=`${n.toUpperCase()}_`;return {name:`withNamespace(${e.name}, ${n})`,async load(){let o=e.load?await e.load():{},t={};for(let[a,i]of Object.entries(o))if(a.toUpperCase().startsWith(s)){let c=a.slice(s.length);t[c]=i;}return t},loadSync(){if(!e.loadSync)throw new Error(`Resolver ${e.name} does not support sync loading`);let o=e.loadSync(),t={};for(let[a,i]of Object.entries(o))if(a.toUpperCase().startsWith(s)){let c=a.slice(s.length);t[c]=i;}return t}}}function j(e,n){let{onChange:r,debounce:s=100,files:o=[".env"]}=n??{},t,a=null,i=[],c=async()=>{try{return await import('./index.cjs'),t=await chunkDYFRO3NM_cjs.d(e),t}catch(l){throw console.error("[watch] Failed to load config:",l),l}},u=()=>{a&&clearTimeout(a),a=setTimeout(async()=>{try{let l=await c();r?.(l);}catch(l){console.error("[watch] Failed to reload config:",l);}},s);},{watch:d}=chunkD6WM53FN_cjs.a("fs"),{join:p}=chunkD6WM53FN_cjs.a("path");for(let l of o)try{let m=d(p(process.cwd(),l),u);i.push(m);}catch{}return c().catch(console.error),{getConfig:()=>t,stop:()=>{a&&clearTimeout(a);for(let l of i)l.close();}}}exports.TTL=w;exports.awsCache=P;exports.cached=x;exports.poll=O;exports.retry=v;exports.watch=j;exports.withAliases=k;exports.withComputed=$;exports.withNamespace=A;exports.withPrefix=S;exports.withTransform=E;
|