@e-n-v/env 0.0.7 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BooleanMap-B7MeMkJC.d.ts → BooleanMap-BPQuO3Ae.d.ts} +1 -3
- package/dist/{BooleanMap-D93UJnv5.d.cts → BooleanMap-CX_YrPCf.d.cts} +1 -3
- package/dist/EnvChannelOptions-BbKeuO-o.d.cts +366 -0
- package/dist/EnvChannelOptions-BbKeuO-o.d.ts +366 -0
- package/dist/{EnvSource-DA3ZGlES.js → EnvSource-WAGWqRVM.js} +6 -10
- package/dist/{EnvSource-BVnmdHku.cjs → EnvSource-s8F_M_6O.cjs} +21 -28
- package/dist/EnvVarSchema-CDZGmnex.cjs +15 -0
- package/dist/EnvVarSchema-Dr6q7jf6.js +10 -0
- package/dist/{ProcessEnvChannel-Do4-yiLI.d.ts → ProcessEnvChannel-CwhV7_EB.d.ts} +2 -4
- package/dist/{ProcessEnvChannel-D465c-dp.d.cts → ProcessEnvChannel-DWHPZePe.d.cts} +2 -4
- package/dist/channels.cjs +3 -4
- package/dist/channels.d.cts +3 -4
- package/dist/channels.d.ts +3 -4
- package/dist/channels.js +2 -4
- package/dist/cli.cjs +10 -23
- package/dist/cli.d.cts +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +7 -13
- package/dist/core.cjs +13 -14
- package/dist/core.d.cts +147 -6
- package/dist/core.d.ts +147 -6
- package/dist/core.js +9 -11
- package/dist/{custom-Bt_wnxIu.js → custom-Bd-jLg80.js} +3 -12
- package/dist/{custom-D_Rqjm09.cjs → custom-Dyb9TnER.cjs} +48 -58
- package/dist/files.cjs +6 -6
- package/dist/files.d.cts +2 -2
- package/dist/files.d.ts +2 -2
- package/dist/files.js +2 -5
- package/dist/{parse-awxwtQ1N.d.ts → index-B2eNij2x.d.cts} +1 -2
- package/dist/{parse-5fpTbjTr.d.cts → index-BHTM8nxS.d.ts} +1 -2
- package/dist/{prompt-DG8haZjn.d.ts → index-BKBW9Dxs.d.cts} +3 -4
- package/dist/{prompt-lmZdPaBh.d.cts → index-CEyOIRdj.d.ts} +3 -4
- package/dist/{EnvModel-BiT0OiDZ.d.ts → index-Cb0abjLf.d.ts} +59 -7
- package/dist/{EnvModel-I0fWZZ_n.d.cts → index-Cz3frUwZ.d.cts} +58 -6
- package/dist/index.cjs +27 -30
- package/dist/index.d.cts +11 -13
- package/dist/index.d.ts +11 -13
- package/dist/index.js +8 -14
- package/dist/model.cjs +10 -11
- package/dist/model.d.cts +2 -35
- package/dist/model.d.ts +2 -35
- package/dist/model.js +2 -6
- package/dist/parse.cjs +14 -14
- package/dist/parse.d.cts +5 -8
- package/dist/parse.d.ts +5 -8
- package/dist/parse.js +4 -7
- package/dist/preprocessors-BKuIcZa1.d.ts +83 -0
- package/dist/preprocessors-DFVyF0c7.d.cts +83 -0
- package/dist/prompt.cjs +12 -15
- package/dist/prompt.d.cts +5 -10
- package/dist/prompt.d.ts +5 -10
- package/dist/prompt.js +3 -9
- package/dist/{redis-Cazgs3_J.cjs → redis-CyTF0SYT.cjs} +260 -268
- package/dist/{redis-DXhlNtvD.js → redis-D18f4ztf.js} +15 -22
- package/dist/{index-UQm0jdkG.d.cts → redis-DsW-Vkwq.d.cts} +2 -6
- package/dist/{index-ClKndmJv.d.ts → redis-tRD4nAy_.d.ts} +2 -6
- package/dist/{resolveChannel-v9BDsw-M.js → resolveChannel-D1Fzl4TL.js} +59 -63
- package/dist/{resolveChannel-CjAuxy3p.cjs → resolveChannel-DxZNYdDe.cjs} +84 -92
- package/dist/{chunk-pbleEpgJ.cjs → rolldown-runtime-C0BPl7ul.cjs} +15 -16
- package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.js} +4 -4
- package/dist/{schema-DdDa3Qjy.d.cts → schema-B-JLVS42.d.ts} +1 -3
- package/dist/{schema-CHypJTDK.d.ts → schema-B1i83alz.d.cts} +1 -3
- package/dist/schema-CtP5lpU1.js +11 -0
- package/dist/schema-D9nJKipf.cjs +22 -0
- package/dist/schemas/zod.cjs +42 -340
- package/dist/schemas/zod.d.cts +112 -114
- package/dist/schemas/zod.d.ts +112 -114
- package/dist/schemas/zod.js +111 -401
- package/dist/schemas.cjs +152 -155
- package/dist/schemas.d.cts +1 -2
- package/dist/schemas.d.ts +1 -2
- package/dist/schemas.js +2 -6
- package/dist/{src-CdqOYilA.cjs → src-5GYFbR9n.cjs} +21 -24
- package/dist/{src-BrNrE0hX.js → src-8rEOvFG5.js} +11 -14
- package/dist/{src-DI-VW4dW.js → src-CdzAzdq-.js} +77 -110
- package/dist/{src-B5Qu-M-r.js → src-Cg49gGJb.js} +9 -43
- package/dist/{src-dO72HN6e.cjs → src-CttkcdpE.cjs} +90 -130
- package/dist/{src-PHSSk-t3.cjs → src-D5KzIEH_.cjs} +130 -110
- package/dist/{src-DVdOONrX.cjs → src-DB0Har0j.cjs} +911 -932
- package/dist/{src-DQaQ28lz.js → src-DWc-WWjX.js} +107 -89
- package/dist/{src-vBXlFkSP.js → src-DvUBRBe3.js} +115 -136
- package/dist/{src-DywfI0fM.cjs → src-TZx_e95f.cjs} +78 -131
- package/dist/{vars-DF9DoAF4.d.ts → vars-DtzGL5Nc.d.cts} +1 -4
- package/dist/{vars-KUgv2rti.d.cts → vars-obKYxaSu.d.ts} +1 -4
- package/dist/vars.cjs +175 -160
- package/dist/vars.d.cts +2 -6
- package/dist/vars.d.ts +2 -6
- package/dist/vars.js +21 -9
- package/package.json +3 -2
- package/dist/EnvChannelOptions-BPkWDrmr.d.cts +0 -108
- package/dist/EnvChannelOptions-CRwDLWjd.d.ts +0 -108
- package/dist/coerce-DNIuYAx4.js +0 -11028
- package/dist/coerce-b7UVodS9.cjs +0 -12365
- package/dist/model-BNDYMM9l.d.ts +0 -29
- package/dist/model-CJMnbGuS.d.cts +0 -29
- package/dist/validate-8HbVniNt.d.cts +0 -204
- package/dist/validate-CE8hQ5JG.d.ts +0 -204
- package/dist/vars-BHXXBiY1.cjs +0 -27
- package/dist/vars-FOuH_HuL.js +0 -22
- /package/dist/{EnvChannel-LMIRYvT1.d.cts → EnvChannel-CfSwa_25.d.cts} +0 -0
- /package/dist/{EnvChannel-w27PEm7x.d.ts → EnvChannel-CfSwa_25.d.ts} +0 -0
- /package/dist/{StringEnvVarSchema-BwSGgmeG.d.ts → StringEnvVarSchema-D9Jr1Aws.d.cts} +0 -0
- /package/dist/{StringEnvVarSchema-DnsZTIS0.d.cts → StringEnvVarSchema-D9Jr1Aws.d.ts} +0 -0
|
@@ -13,7 +13,6 @@ var EnvVarSchemaBase = class {
|
|
|
13
13
|
this.process = input.process;
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
|
|
17
16
|
//#endregion
|
|
18
17
|
//#region ../core/src/processing/helpers/toList.ts
|
|
19
18
|
/**
|
|
@@ -30,7 +29,6 @@ function toList(items) {
|
|
|
30
29
|
if (items.length === 2) return `${items[0]} and ${items[1]}`;
|
|
31
30
|
return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
32
|
//#endregion
|
|
35
33
|
//#region ../core/src/processing/helpers/validate.ts
|
|
36
34
|
/**
|
|
@@ -45,7 +43,6 @@ function validate(value, checks) {
|
|
|
45
43
|
}
|
|
46
44
|
return value;
|
|
47
45
|
}
|
|
48
|
-
|
|
49
46
|
//#endregion
|
|
50
47
|
//#region ../core/src/processing/processors/typed/string.ts
|
|
51
48
|
/**
|
|
@@ -60,7 +57,6 @@ function string$1(...checks) {
|
|
|
60
57
|
return input;
|
|
61
58
|
};
|
|
62
59
|
}
|
|
63
|
-
|
|
64
60
|
//#endregion
|
|
65
61
|
//#region ../core/src/processing/processors/typed/number.ts
|
|
66
62
|
/**
|
|
@@ -70,20 +66,19 @@ function string$1(...checks) {
|
|
|
70
66
|
function number$1(...checks) {
|
|
71
67
|
return (input) => {
|
|
72
68
|
if (typeof input === "number") {
|
|
73
|
-
if (
|
|
69
|
+
if (!Number.isFinite(input)) throw new Error("Value must be a finite number");
|
|
74
70
|
if (checks.length > 0) return validate(input, checks);
|
|
75
71
|
return input;
|
|
76
72
|
}
|
|
77
73
|
if (typeof input !== "string") throw new Error("Value must be a string or number");
|
|
78
74
|
const trimmed = input.trim();
|
|
79
75
|
if (trimmed === "") return;
|
|
80
|
-
const parsed =
|
|
81
|
-
if (
|
|
76
|
+
const parsed = Number(trimmed);
|
|
77
|
+
if (!Number.isFinite(parsed)) throw new Error(`"${input}" is not a valid number`);
|
|
82
78
|
if (checks.length > 0) return validate(parsed, checks);
|
|
83
79
|
return parsed;
|
|
84
80
|
};
|
|
85
81
|
}
|
|
86
|
-
|
|
87
82
|
//#endregion
|
|
88
83
|
//#region ../core/src/processing/constants/FALSE_STRINGS.ts
|
|
89
84
|
const FALSE_STRINGS = [
|
|
@@ -92,7 +87,6 @@ const FALSE_STRINGS = [
|
|
|
92
87
|
"no",
|
|
93
88
|
"off"
|
|
94
89
|
];
|
|
95
|
-
|
|
96
90
|
//#endregion
|
|
97
91
|
//#region ../core/src/processing/constants/TRUE_STRINGS.ts
|
|
98
92
|
const TRUE_STRINGS = [
|
|
@@ -101,7 +95,6 @@ const TRUE_STRINGS = [
|
|
|
101
95
|
"yes",
|
|
102
96
|
"on"
|
|
103
97
|
];
|
|
104
|
-
|
|
105
98
|
//#endregion
|
|
106
99
|
//#region ../core/src/processing/processors/typed/boolean.ts
|
|
107
100
|
/**
|
|
@@ -123,7 +116,6 @@ function boolean$1() {
|
|
|
123
116
|
throw new Error(`"${input}" is not a valid boolean. Use: ${trueList} or ${falseList}`);
|
|
124
117
|
};
|
|
125
118
|
}
|
|
126
|
-
|
|
127
119
|
//#endregion
|
|
128
120
|
//#region ../core/src/processing/processors/typed/enumeration.ts
|
|
129
121
|
/**
|
|
@@ -140,7 +132,6 @@ function enumeration$1(allowedValues, ...checks) {
|
|
|
140
132
|
return trimmed;
|
|
141
133
|
};
|
|
142
134
|
}
|
|
143
|
-
|
|
144
135
|
//#endregion
|
|
145
136
|
//#region ../core/src/processing/processors/processors.ts
|
|
146
137
|
/**
|
|
@@ -154,7 +145,6 @@ const processors = {
|
|
|
154
145
|
number: number$1,
|
|
155
146
|
string: string$1
|
|
156
147
|
};
|
|
157
|
-
|
|
158
148
|
//#endregion
|
|
159
149
|
//#region ../core/src/schemas/typed/BooleanEnvVarSchema.ts
|
|
160
150
|
var BooleanEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -166,7 +156,6 @@ var BooleanEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
166
156
|
});
|
|
167
157
|
}
|
|
168
158
|
};
|
|
169
|
-
|
|
170
159
|
//#endregion
|
|
171
160
|
//#region ../core/src/schemas/typed/EnumEnvVarSchema.ts
|
|
172
161
|
var EnumEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -180,7 +169,6 @@ var EnumEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
180
169
|
this.values = input.values;
|
|
181
170
|
}
|
|
182
171
|
};
|
|
183
|
-
|
|
184
172
|
//#endregion
|
|
185
173
|
//#region ../core/src/schemas/typed/NumberEnvVarSchema.ts
|
|
186
174
|
var NumberEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -192,7 +180,6 @@ var NumberEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
192
180
|
});
|
|
193
181
|
}
|
|
194
182
|
};
|
|
195
|
-
|
|
196
183
|
//#endregion
|
|
197
184
|
//#region ../core/src/schemas/typed/StringEnvVarSchema.ts
|
|
198
185
|
var StringEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -206,16 +193,6 @@ var StringEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
206
193
|
this.secret = input.secret;
|
|
207
194
|
}
|
|
208
195
|
};
|
|
209
|
-
|
|
210
|
-
//#endregion
|
|
211
|
-
//#region ../core/src/schemas/EnvVarSchema.ts
|
|
212
|
-
/**
|
|
213
|
-
* Type guard to check if a value is a EnvVarSchema instance
|
|
214
|
-
*/
|
|
215
|
-
function isEnvVarSchema(value) {
|
|
216
|
-
return value instanceof StringEnvVarSchema || value instanceof NumberEnvVarSchema || value instanceof BooleanEnvVarSchema || value instanceof EnumEnvVarSchema;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
196
|
//#endregion
|
|
220
197
|
//#region ../core/src/processing/preprocessors/typed/number.ts
|
|
221
198
|
/**
|
|
@@ -228,7 +205,6 @@ const number = () => (value) => {
|
|
|
228
205
|
} catch {}
|
|
229
206
|
return value;
|
|
230
207
|
};
|
|
231
|
-
|
|
232
208
|
//#endregion
|
|
233
209
|
//#region ../core/src/processing/preprocessors/typed/boolean.ts
|
|
234
210
|
const boolean = (options = {
|
|
@@ -248,24 +224,26 @@ const boolean = (options = {
|
|
|
248
224
|
return value;
|
|
249
225
|
};
|
|
250
226
|
};
|
|
251
|
-
|
|
252
227
|
//#endregion
|
|
253
228
|
//#region ../core/src/processing/preprocessors/typed/enumeration.ts
|
|
254
229
|
/**
|
|
255
230
|
* Create an enum preprocessor - pass through unchanged
|
|
256
231
|
*/
|
|
257
232
|
const enumeration = () => (value) => value;
|
|
258
|
-
|
|
259
233
|
//#endregion
|
|
260
234
|
//#region ../core/src/processing/preprocessors/typed/string.ts
|
|
261
235
|
/**
|
|
262
236
|
* Create a string preprocessor - pass through unchanged
|
|
263
237
|
*/
|
|
264
238
|
const string = () => (value) => value;
|
|
265
|
-
|
|
266
239
|
//#endregion
|
|
267
240
|
//#region ../core/src/processing/preprocessors/preprocessors.ts
|
|
268
241
|
/**
|
|
242
|
+
* Default preprocessors for environment variable types.
|
|
243
|
+
* Each preprocessor factory returns a function that takes a string value and returns T | string.
|
|
244
|
+
* Preprocessors may normalize but should not throw—fall back to the original value when normalization fails.
|
|
245
|
+
*/
|
|
246
|
+
/**
|
|
269
247
|
* Default preprocessors map for each environment variable type
|
|
270
248
|
*/
|
|
271
249
|
const preprocessors = {
|
|
@@ -274,7 +252,6 @@ const preprocessors = {
|
|
|
274
252
|
number,
|
|
275
253
|
string
|
|
276
254
|
};
|
|
277
|
-
|
|
278
255
|
//#endregion
|
|
279
256
|
//#region ../core/src/processing/preprocessors/resolvePreprocessor.ts
|
|
280
257
|
const defaultFactories = {
|
|
@@ -304,16 +281,5 @@ function resolvePreprocessor(envVarType, preprocessorOptions) {
|
|
|
304
281
|
if (typeof override === "function") return override;
|
|
305
282
|
return preprocessors.boolean(override);
|
|
306
283
|
}
|
|
307
|
-
|
|
308
|
-
//#endregion
|
|
309
|
-
//#region ../core/src/schemas/schema.ts
|
|
310
|
-
const schema = {
|
|
311
|
-
string: (input = {}) => new StringEnvVarSchema(input),
|
|
312
|
-
number: (input = {}) => new NumberEnvVarSchema(input),
|
|
313
|
-
boolean: (input = {}) => new BooleanEnvVarSchema(input),
|
|
314
|
-
enum: (input) => new EnumEnvVarSchema(input)
|
|
315
|
-
};
|
|
316
|
-
const s = schema;
|
|
317
|
-
|
|
318
284
|
//#endregion
|
|
319
|
-
export {
|
|
285
|
+
export { EnumEnvVarSchema as a, enumeration$1 as c, string$1 as d, validate as f, NumberEnvVarSchema as i, boolean$1 as l, EnvVarSchemaBase as m, preprocessors as n, BooleanEnvVarSchema as o, toList as p, StringEnvVarSchema as r, processors as s, resolvePreprocessor as t, number$1 as u };
|