@e-n-v/env 0.0.5 → 0.0.8
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-DmFnCA-O.d.ts → BooleanMap-BPQuO3Ae.d.ts} +1 -3
- package/dist/{BooleanMap-B2eIP3tZ.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/{StringEnvVarSchema-B8MT7htU.d.ts → StringEnvVarSchema-D9Jr1Aws.d.cts} +5 -3
- package/dist/{StringEnvVarSchema-BF6C0nyT.d.cts → StringEnvVarSchema-D9Jr1Aws.d.ts} +5 -3
- 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-DwtLpVhC.d.ts → index-B2eNij2x.d.cts} +1 -2
- package/dist/{parse-BT1QSa5e.d.cts → index-BHTM8nxS.d.ts} +1 -2
- package/dist/{prompt-yKdccbtZ.d.ts → index-BKBW9Dxs.d.cts} +3 -4
- package/dist/{prompt-C5WudV9x.d.cts → index-CEyOIRdj.d.ts} +3 -4
- package/dist/{EnvModel-CrGclUpJ.d.cts → index-Cb0abjLf.d.ts} +59 -7
- package/dist/{EnvModel-D8rt0EJ6.d.ts → index-Cz3frUwZ.d.cts} +58 -6
- package/dist/index.cjs +33 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +15 -0
- 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-EcC7TX3K.cjs → redis-CyTF0SYT.cjs} +321 -253
- package/dist/{redis-CJOpRPjc.js → redis-D18f4ztf.js} +76 -37
- package/dist/{index-Dq_0aeAL.d.ts → redis-DsW-Vkwq.d.cts} +26 -6
- package/dist/{index-D8pslhp4.d.cts → redis-tRD4nAy_.d.ts} +26 -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-jN4EtvEP.d.ts → schema-B-JLVS42.d.ts} +1 -3
- package/dist/{schema-DH4GiW9A.d.cts → 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 +112 -359
- package/dist/schemas/zod.d.cts +117 -87
- package/dist/schemas/zod.d.ts +117 -87
- package/dist/schemas/zod.js +116 -377
- package/dist/schemas.cjs +152 -133
- package/dist/schemas.d.cts +2 -3
- package/dist/schemas.d.ts +2 -3
- package/dist/schemas.js +2 -6
- package/dist/{src-Cjo2XA4n.cjs → src-5GYFbR9n.cjs} +21 -25
- package/dist/{src-BBwjK5SK.js → src-8rEOvFG5.js} +11 -15
- package/dist/{src-Dtv7TlJx.js → src-CdzAzdq-.js} +100 -114
- package/dist/{src-CLTURaoo.js → src-Cg49gGJb.js} +18 -44
- package/dist/{src-DWYoqPX1.cjs → src-CttkcdpE.cjs} +114 -133
- package/dist/{src-XjL5cyPG.cjs → src-D5KzIEH_.cjs} +130 -107
- package/dist/src-DB0Har0j.cjs +1632 -0
- package/dist/{src-CVdUqK3q.js → src-DWc-WWjX.js} +107 -86
- package/dist/{src-B7FG1rak.js → src-DvUBRBe3.js} +205 -116
- package/dist/{src-meUnCASg.cjs → src-TZx_e95f.cjs} +87 -132
- package/dist/{vars-BNVI6k89.d.ts → vars-DtzGL5Nc.d.cts} +1 -4
- package/dist/{vars-CptZRPX5.d.cts → vars-obKYxaSu.d.ts} +1 -4
- package/dist/vars.cjs +175 -138
- package/dist/vars.d.cts +3 -7
- package/dist/vars.d.ts +3 -7
- package/dist/vars.js +21 -9
- package/package.json +9 -8
- 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-Dic8IJsf.d.ts +0 -29
- package/dist/model-ft0WhSSS.d.cts +0 -29
- package/dist/root.cjs +0 -36
- package/dist/root.d.cts +0 -21
- package/dist/root.d.ts +0 -21
- package/dist/root.js +0 -21
- package/dist/src-DZmpNGrQ.cjs +0 -1411
- package/dist/validate-BxA3a-ns.d.cts +0 -203
- package/dist/validate-CyxrRacF.d.ts +0 -203
- package/dist/vars-CYOaskkK.cjs +0 -27
- package/dist/vars-DOW0LiiN.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
|
@@ -3,15 +3,16 @@ var EnvVarSchemaBase = class {
|
|
|
3
3
|
required;
|
|
4
4
|
default;
|
|
5
5
|
description;
|
|
6
|
+
link;
|
|
6
7
|
process;
|
|
7
8
|
constructor(input) {
|
|
8
9
|
this.required = input?.required ?? true;
|
|
9
10
|
this.default = input?.default;
|
|
10
11
|
this.description = input?.description;
|
|
12
|
+
this.link = input?.link;
|
|
11
13
|
this.process = input.process;
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
|
-
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region ../core/src/processing/helpers/toList.ts
|
|
17
18
|
/**
|
|
@@ -28,7 +29,6 @@ function toList(items) {
|
|
|
28
29
|
if (items.length === 2) return `${items[0]} and ${items[1]}`;
|
|
29
30
|
return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
|
|
30
31
|
}
|
|
31
|
-
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region ../core/src/processing/helpers/validate.ts
|
|
34
34
|
/**
|
|
@@ -43,7 +43,6 @@ function validate(value, checks) {
|
|
|
43
43
|
}
|
|
44
44
|
return value;
|
|
45
45
|
}
|
|
46
|
-
|
|
47
46
|
//#endregion
|
|
48
47
|
//#region ../core/src/processing/processors/typed/string.ts
|
|
49
48
|
/**
|
|
@@ -58,7 +57,6 @@ function string$1(...checks) {
|
|
|
58
57
|
return input;
|
|
59
58
|
};
|
|
60
59
|
}
|
|
61
|
-
|
|
62
60
|
//#endregion
|
|
63
61
|
//#region ../core/src/processing/processors/typed/number.ts
|
|
64
62
|
/**
|
|
@@ -67,16 +65,20 @@ function string$1(...checks) {
|
|
|
67
65
|
*/
|
|
68
66
|
function number$1(...checks) {
|
|
69
67
|
return (input) => {
|
|
70
|
-
if (typeof input
|
|
68
|
+
if (typeof input === "number") {
|
|
69
|
+
if (!Number.isFinite(input)) throw new Error("Value must be a finite number");
|
|
70
|
+
if (checks.length > 0) return validate(input, checks);
|
|
71
|
+
return input;
|
|
72
|
+
}
|
|
73
|
+
if (typeof input !== "string") throw new Error("Value must be a string or number");
|
|
71
74
|
const trimmed = input.trim();
|
|
72
75
|
if (trimmed === "") return;
|
|
73
|
-
const parsed =
|
|
74
|
-
if (
|
|
76
|
+
const parsed = Number(trimmed);
|
|
77
|
+
if (!Number.isFinite(parsed)) throw new Error(`"${input}" is not a valid number`);
|
|
75
78
|
if (checks.length > 0) return validate(parsed, checks);
|
|
76
79
|
return parsed;
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
|
-
|
|
80
82
|
//#endregion
|
|
81
83
|
//#region ../core/src/processing/constants/FALSE_STRINGS.ts
|
|
82
84
|
const FALSE_STRINGS = [
|
|
@@ -85,7 +87,6 @@ const FALSE_STRINGS = [
|
|
|
85
87
|
"no",
|
|
86
88
|
"off"
|
|
87
89
|
];
|
|
88
|
-
|
|
89
90
|
//#endregion
|
|
90
91
|
//#region ../core/src/processing/constants/TRUE_STRINGS.ts
|
|
91
92
|
const TRUE_STRINGS = [
|
|
@@ -94,7 +95,6 @@ const TRUE_STRINGS = [
|
|
|
94
95
|
"yes",
|
|
95
96
|
"on"
|
|
96
97
|
];
|
|
97
|
-
|
|
98
98
|
//#endregion
|
|
99
99
|
//#region ../core/src/processing/processors/typed/boolean.ts
|
|
100
100
|
/**
|
|
@@ -105,7 +105,8 @@ function boolean$1() {
|
|
|
105
105
|
const trueValues = new Set(TRUE_STRINGS);
|
|
106
106
|
const falseValues = new Set(FALSE_STRINGS);
|
|
107
107
|
return (input) => {
|
|
108
|
-
if (typeof input
|
|
108
|
+
if (typeof input === "boolean") return input;
|
|
109
|
+
if (typeof input !== "string") throw new Error("Value must be a string or boolean");
|
|
109
110
|
const trimmed = input.trim().toLowerCase();
|
|
110
111
|
if (trimmed === "") return;
|
|
111
112
|
if (trueValues.has(trimmed)) return true;
|
|
@@ -115,7 +116,6 @@ function boolean$1() {
|
|
|
115
116
|
throw new Error(`"${input}" is not a valid boolean. Use: ${trueList} or ${falseList}`);
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
|
|
119
119
|
//#endregion
|
|
120
120
|
//#region ../core/src/processing/processors/typed/enumeration.ts
|
|
121
121
|
/**
|
|
@@ -132,7 +132,6 @@ function enumeration$1(allowedValues, ...checks) {
|
|
|
132
132
|
return trimmed;
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
|
|
136
135
|
//#endregion
|
|
137
136
|
//#region ../core/src/processing/processors/processors.ts
|
|
138
137
|
/**
|
|
@@ -146,7 +145,6 @@ const processors = {
|
|
|
146
145
|
number: number$1,
|
|
147
146
|
string: string$1
|
|
148
147
|
};
|
|
149
|
-
|
|
150
148
|
//#endregion
|
|
151
149
|
//#region ../core/src/schemas/typed/BooleanEnvVarSchema.ts
|
|
152
150
|
var BooleanEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -158,7 +156,6 @@ var BooleanEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
158
156
|
});
|
|
159
157
|
}
|
|
160
158
|
};
|
|
161
|
-
|
|
162
159
|
//#endregion
|
|
163
160
|
//#region ../core/src/schemas/typed/EnumEnvVarSchema.ts
|
|
164
161
|
var EnumEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -172,7 +169,6 @@ var EnumEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
172
169
|
this.values = input.values;
|
|
173
170
|
}
|
|
174
171
|
};
|
|
175
|
-
|
|
176
172
|
//#endregion
|
|
177
173
|
//#region ../core/src/schemas/typed/NumberEnvVarSchema.ts
|
|
178
174
|
var NumberEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -184,7 +180,6 @@ var NumberEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
184
180
|
});
|
|
185
181
|
}
|
|
186
182
|
};
|
|
187
|
-
|
|
188
183
|
//#endregion
|
|
189
184
|
//#region ../core/src/schemas/typed/StringEnvVarSchema.ts
|
|
190
185
|
var StringEnvVarSchema = class extends EnvVarSchemaBase {
|
|
@@ -198,16 +193,6 @@ var StringEnvVarSchema = class extends EnvVarSchemaBase {
|
|
|
198
193
|
this.secret = input.secret;
|
|
199
194
|
}
|
|
200
195
|
};
|
|
201
|
-
|
|
202
|
-
//#endregion
|
|
203
|
-
//#region ../core/src/schemas/EnvVarSchema.ts
|
|
204
|
-
/**
|
|
205
|
-
* Type guard to check if a value is a EnvVarSchema instance
|
|
206
|
-
*/
|
|
207
|
-
function isEnvVarSchema(value) {
|
|
208
|
-
return value instanceof StringEnvVarSchema || value instanceof NumberEnvVarSchema || value instanceof BooleanEnvVarSchema || value instanceof EnumEnvVarSchema;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
196
|
//#endregion
|
|
212
197
|
//#region ../core/src/processing/preprocessors/typed/number.ts
|
|
213
198
|
/**
|
|
@@ -220,7 +205,6 @@ const number = () => (value) => {
|
|
|
220
205
|
} catch {}
|
|
221
206
|
return value;
|
|
222
207
|
};
|
|
223
|
-
|
|
224
208
|
//#endregion
|
|
225
209
|
//#region ../core/src/processing/preprocessors/typed/boolean.ts
|
|
226
210
|
const boolean = (options = {
|
|
@@ -240,24 +224,26 @@ const boolean = (options = {
|
|
|
240
224
|
return value;
|
|
241
225
|
};
|
|
242
226
|
};
|
|
243
|
-
|
|
244
227
|
//#endregion
|
|
245
228
|
//#region ../core/src/processing/preprocessors/typed/enumeration.ts
|
|
246
229
|
/**
|
|
247
230
|
* Create an enum preprocessor - pass through unchanged
|
|
248
231
|
*/
|
|
249
232
|
const enumeration = () => (value) => value;
|
|
250
|
-
|
|
251
233
|
//#endregion
|
|
252
234
|
//#region ../core/src/processing/preprocessors/typed/string.ts
|
|
253
235
|
/**
|
|
254
236
|
* Create a string preprocessor - pass through unchanged
|
|
255
237
|
*/
|
|
256
238
|
const string = () => (value) => value;
|
|
257
|
-
|
|
258
239
|
//#endregion
|
|
259
240
|
//#region ../core/src/processing/preprocessors/preprocessors.ts
|
|
260
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
|
+
/**
|
|
261
247
|
* Default preprocessors map for each environment variable type
|
|
262
248
|
*/
|
|
263
249
|
const preprocessors = {
|
|
@@ -266,7 +252,6 @@ const preprocessors = {
|
|
|
266
252
|
number,
|
|
267
253
|
string
|
|
268
254
|
};
|
|
269
|
-
|
|
270
255
|
//#endregion
|
|
271
256
|
//#region ../core/src/processing/preprocessors/resolvePreprocessor.ts
|
|
272
257
|
const defaultFactories = {
|
|
@@ -296,16 +281,5 @@ function resolvePreprocessor(envVarType, preprocessorOptions) {
|
|
|
296
281
|
if (typeof override === "function") return override;
|
|
297
282
|
return preprocessors.boolean(override);
|
|
298
283
|
}
|
|
299
|
-
|
|
300
|
-
//#endregion
|
|
301
|
-
//#region ../core/src/schemas/schema.ts
|
|
302
|
-
const schema = {
|
|
303
|
-
string: (input = {}) => new StringEnvVarSchema(input),
|
|
304
|
-
number: (input = {}) => new NumberEnvVarSchema(input),
|
|
305
|
-
boolean: (input = {}) => new BooleanEnvVarSchema(input),
|
|
306
|
-
enum: (input) => new EnumEnvVarSchema(input)
|
|
307
|
-
};
|
|
308
|
-
const s = schema;
|
|
309
|
-
|
|
310
284
|
//#endregion
|
|
311
|
-
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 };
|