@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.
Files changed (108) hide show
  1. package/dist/{BooleanMap-DmFnCA-O.d.ts → BooleanMap-BPQuO3Ae.d.ts} +1 -3
  2. package/dist/{BooleanMap-B2eIP3tZ.d.cts → BooleanMap-CX_YrPCf.d.cts} +1 -3
  3. package/dist/EnvChannelOptions-BbKeuO-o.d.cts +366 -0
  4. package/dist/EnvChannelOptions-BbKeuO-o.d.ts +366 -0
  5. package/dist/{EnvSource-DA3ZGlES.js → EnvSource-WAGWqRVM.js} +6 -10
  6. package/dist/{EnvSource-BVnmdHku.cjs → EnvSource-s8F_M_6O.cjs} +21 -28
  7. package/dist/EnvVarSchema-CDZGmnex.cjs +15 -0
  8. package/dist/EnvVarSchema-Dr6q7jf6.js +10 -0
  9. package/dist/{ProcessEnvChannel-Do4-yiLI.d.ts → ProcessEnvChannel-CwhV7_EB.d.ts} +2 -4
  10. package/dist/{ProcessEnvChannel-D465c-dp.d.cts → ProcessEnvChannel-DWHPZePe.d.cts} +2 -4
  11. package/dist/{StringEnvVarSchema-B8MT7htU.d.ts → StringEnvVarSchema-D9Jr1Aws.d.cts} +5 -3
  12. package/dist/{StringEnvVarSchema-BF6C0nyT.d.cts → StringEnvVarSchema-D9Jr1Aws.d.ts} +5 -3
  13. package/dist/channels.cjs +3 -4
  14. package/dist/channels.d.cts +3 -4
  15. package/dist/channels.d.ts +3 -4
  16. package/dist/channels.js +2 -4
  17. package/dist/cli.cjs +10 -23
  18. package/dist/cli.d.cts +1 -1
  19. package/dist/cli.d.ts +1 -1
  20. package/dist/cli.js +7 -13
  21. package/dist/core.cjs +13 -14
  22. package/dist/core.d.cts +147 -6
  23. package/dist/core.d.ts +147 -6
  24. package/dist/core.js +9 -11
  25. package/dist/{custom-Bt_wnxIu.js → custom-Bd-jLg80.js} +3 -12
  26. package/dist/{custom-D_Rqjm09.cjs → custom-Dyb9TnER.cjs} +48 -58
  27. package/dist/files.cjs +6 -6
  28. package/dist/files.d.cts +2 -2
  29. package/dist/files.d.ts +2 -2
  30. package/dist/files.js +2 -5
  31. package/dist/{parse-DwtLpVhC.d.ts → index-B2eNij2x.d.cts} +1 -2
  32. package/dist/{parse-BT1QSa5e.d.cts → index-BHTM8nxS.d.ts} +1 -2
  33. package/dist/{prompt-yKdccbtZ.d.ts → index-BKBW9Dxs.d.cts} +3 -4
  34. package/dist/{prompt-C5WudV9x.d.cts → index-CEyOIRdj.d.ts} +3 -4
  35. package/dist/{EnvModel-CrGclUpJ.d.cts → index-Cb0abjLf.d.ts} +59 -7
  36. package/dist/{EnvModel-D8rt0EJ6.d.ts → index-Cz3frUwZ.d.cts} +58 -6
  37. package/dist/index.cjs +33 -0
  38. package/dist/index.d.cts +19 -0
  39. package/dist/index.d.ts +19 -0
  40. package/dist/index.js +15 -0
  41. package/dist/model.cjs +10 -11
  42. package/dist/model.d.cts +2 -35
  43. package/dist/model.d.ts +2 -35
  44. package/dist/model.js +2 -6
  45. package/dist/parse.cjs +14 -14
  46. package/dist/parse.d.cts +5 -8
  47. package/dist/parse.d.ts +5 -8
  48. package/dist/parse.js +4 -7
  49. package/dist/preprocessors-BKuIcZa1.d.ts +83 -0
  50. package/dist/preprocessors-DFVyF0c7.d.cts +83 -0
  51. package/dist/prompt.cjs +12 -15
  52. package/dist/prompt.d.cts +5 -10
  53. package/dist/prompt.d.ts +5 -10
  54. package/dist/prompt.js +3 -9
  55. package/dist/{redis-EcC7TX3K.cjs → redis-CyTF0SYT.cjs} +321 -253
  56. package/dist/{redis-CJOpRPjc.js → redis-D18f4ztf.js} +76 -37
  57. package/dist/{index-Dq_0aeAL.d.ts → redis-DsW-Vkwq.d.cts} +26 -6
  58. package/dist/{index-D8pslhp4.d.cts → redis-tRD4nAy_.d.ts} +26 -6
  59. package/dist/{resolveChannel-v9BDsw-M.js → resolveChannel-D1Fzl4TL.js} +59 -63
  60. package/dist/{resolveChannel-CjAuxy3p.cjs → resolveChannel-DxZNYdDe.cjs} +84 -92
  61. package/dist/{chunk-pbleEpgJ.cjs → rolldown-runtime-C0BPl7ul.cjs} +15 -16
  62. package/dist/{chunk-Bp6m_JJh.js → rolldown-runtime-D7D4PA-g.js} +4 -4
  63. package/dist/{schema-jN4EtvEP.d.ts → schema-B-JLVS42.d.ts} +1 -3
  64. package/dist/{schema-DH4GiW9A.d.cts → schema-B1i83alz.d.cts} +1 -3
  65. package/dist/schema-CtP5lpU1.js +11 -0
  66. package/dist/schema-D9nJKipf.cjs +22 -0
  67. package/dist/schemas/zod.cjs +112 -359
  68. package/dist/schemas/zod.d.cts +117 -87
  69. package/dist/schemas/zod.d.ts +117 -87
  70. package/dist/schemas/zod.js +116 -377
  71. package/dist/schemas.cjs +152 -133
  72. package/dist/schemas.d.cts +2 -3
  73. package/dist/schemas.d.ts +2 -3
  74. package/dist/schemas.js +2 -6
  75. package/dist/{src-Cjo2XA4n.cjs → src-5GYFbR9n.cjs} +21 -25
  76. package/dist/{src-BBwjK5SK.js → src-8rEOvFG5.js} +11 -15
  77. package/dist/{src-Dtv7TlJx.js → src-CdzAzdq-.js} +100 -114
  78. package/dist/{src-CLTURaoo.js → src-Cg49gGJb.js} +18 -44
  79. package/dist/{src-DWYoqPX1.cjs → src-CttkcdpE.cjs} +114 -133
  80. package/dist/{src-XjL5cyPG.cjs → src-D5KzIEH_.cjs} +130 -107
  81. package/dist/src-DB0Har0j.cjs +1632 -0
  82. package/dist/{src-CVdUqK3q.js → src-DWc-WWjX.js} +107 -86
  83. package/dist/{src-B7FG1rak.js → src-DvUBRBe3.js} +205 -116
  84. package/dist/{src-meUnCASg.cjs → src-TZx_e95f.cjs} +87 -132
  85. package/dist/{vars-BNVI6k89.d.ts → vars-DtzGL5Nc.d.cts} +1 -4
  86. package/dist/{vars-CptZRPX5.d.cts → vars-obKYxaSu.d.ts} +1 -4
  87. package/dist/vars.cjs +175 -138
  88. package/dist/vars.d.cts +3 -7
  89. package/dist/vars.d.ts +3 -7
  90. package/dist/vars.js +21 -9
  91. package/package.json +9 -8
  92. package/dist/EnvChannelOptions-BPkWDrmr.d.cts +0 -108
  93. package/dist/EnvChannelOptions-CRwDLWjd.d.ts +0 -108
  94. package/dist/coerce-DNIuYAx4.js +0 -11028
  95. package/dist/coerce-b7UVodS9.cjs +0 -12365
  96. package/dist/model-Dic8IJsf.d.ts +0 -29
  97. package/dist/model-ft0WhSSS.d.cts +0 -29
  98. package/dist/root.cjs +0 -36
  99. package/dist/root.d.cts +0 -21
  100. package/dist/root.d.ts +0 -21
  101. package/dist/root.js +0 -21
  102. package/dist/src-DZmpNGrQ.cjs +0 -1411
  103. package/dist/validate-BxA3a-ns.d.cts +0 -203
  104. package/dist/validate-CyxrRacF.d.ts +0 -203
  105. package/dist/vars-CYOaskkK.cjs +0 -27
  106. package/dist/vars-DOW0LiiN.js +0 -22
  107. /package/dist/{EnvChannel-LMIRYvT1.d.cts → EnvChannel-CfSwa_25.d.cts} +0 -0
  108. /package/dist/{EnvChannel-w27PEm7x.d.ts → EnvChannel-CfSwa_25.d.ts} +0 -0
@@ -1,18 +1,18 @@
1
-
2
1
  //#region ../core/src/schemas/EnvVarSchemaBase.ts
3
2
  var EnvVarSchemaBase = class {
4
3
  required;
5
4
  default;
6
5
  description;
6
+ link;
7
7
  process;
8
8
  constructor(input) {
9
9
  this.required = input?.required ?? true;
10
10
  this.default = input?.default;
11
11
  this.description = input?.description;
12
+ this.link = input?.link;
12
13
  this.process = input.process;
13
14
  }
14
15
  };
15
-
16
16
  //#endregion
17
17
  //#region ../core/src/processing/helpers/toList.ts
18
18
  /**
@@ -29,7 +29,6 @@ function toList(items) {
29
29
  if (items.length === 2) return `${items[0]} and ${items[1]}`;
30
30
  return `${items.slice(0, -1).join(", ")}, and ${items[items.length - 1]}`;
31
31
  }
32
-
33
32
  //#endregion
34
33
  //#region ../core/src/processing/helpers/validate.ts
35
34
  /**
@@ -44,7 +43,6 @@ function validate(value, checks) {
44
43
  }
45
44
  return value;
46
45
  }
47
-
48
46
  //#endregion
49
47
  //#region ../core/src/processing/processors/typed/string.ts
50
48
  /**
@@ -59,7 +57,6 @@ function string$1(...checks) {
59
57
  return input;
60
58
  };
61
59
  }
62
-
63
60
  //#endregion
64
61
  //#region ../core/src/processing/processors/typed/number.ts
65
62
  /**
@@ -68,16 +65,20 @@ function string$1(...checks) {
68
65
  */
69
66
  function number$1(...checks) {
70
67
  return (input) => {
71
- if (typeof input !== "string") throw new Error("Value must be a string");
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");
72
74
  const trimmed = input.trim();
73
75
  if (trimmed === "") return;
74
- const parsed = parseFloat(trimmed);
75
- if (isNaN(parsed)) throw new Error(`"${input}" is not a valid number`);
76
+ const parsed = Number(trimmed);
77
+ if (!Number.isFinite(parsed)) throw new Error(`"${input}" is not a valid number`);
76
78
  if (checks.length > 0) return validate(parsed, checks);
77
79
  return parsed;
78
80
  };
79
81
  }
80
-
81
82
  //#endregion
82
83
  //#region ../core/src/processing/constants/FALSE_STRINGS.ts
83
84
  const FALSE_STRINGS = [
@@ -86,7 +87,6 @@ const FALSE_STRINGS = [
86
87
  "no",
87
88
  "off"
88
89
  ];
89
-
90
90
  //#endregion
91
91
  //#region ../core/src/processing/constants/TRUE_STRINGS.ts
92
92
  const TRUE_STRINGS = [
@@ -95,7 +95,6 @@ const TRUE_STRINGS = [
95
95
  "yes",
96
96
  "on"
97
97
  ];
98
-
99
98
  //#endregion
100
99
  //#region ../core/src/processing/processors/typed/boolean.ts
101
100
  /**
@@ -106,7 +105,8 @@ function boolean$1() {
106
105
  const trueValues = new Set(TRUE_STRINGS);
107
106
  const falseValues = new Set(FALSE_STRINGS);
108
107
  return (input) => {
109
- if (typeof input !== "string") throw new Error("Value must be a string");
108
+ if (typeof input === "boolean") return input;
109
+ if (typeof input !== "string") throw new Error("Value must be a string or boolean");
110
110
  const trimmed = input.trim().toLowerCase();
111
111
  if (trimmed === "") return;
112
112
  if (trueValues.has(trimmed)) return true;
@@ -116,7 +116,6 @@ function boolean$1() {
116
116
  throw new Error(`"${input}" is not a valid boolean. Use: ${trueList} or ${falseList}`);
117
117
  };
118
118
  }
119
-
120
119
  //#endregion
121
120
  //#region ../core/src/processing/processors/typed/enumeration.ts
122
121
  /**
@@ -133,7 +132,6 @@ function enumeration$1(allowedValues, ...checks) {
133
132
  return trimmed;
134
133
  };
135
134
  }
136
-
137
135
  //#endregion
138
136
  //#region ../core/src/processing/processors/processors.ts
139
137
  /**
@@ -147,7 +145,6 @@ const processors = {
147
145
  number: number$1,
148
146
  string: string$1
149
147
  };
150
-
151
148
  //#endregion
152
149
  //#region ../core/src/schemas/typed/BooleanEnvVarSchema.ts
153
150
  var BooleanEnvVarSchema = class extends EnvVarSchemaBase {
@@ -159,7 +156,6 @@ var BooleanEnvVarSchema = class extends EnvVarSchemaBase {
159
156
  });
160
157
  }
161
158
  };
162
-
163
159
  //#endregion
164
160
  //#region ../core/src/schemas/typed/EnumEnvVarSchema.ts
165
161
  var EnumEnvVarSchema = class extends EnvVarSchemaBase {
@@ -173,7 +169,6 @@ var EnumEnvVarSchema = class extends EnvVarSchemaBase {
173
169
  this.values = input.values;
174
170
  }
175
171
  };
176
-
177
172
  //#endregion
178
173
  //#region ../core/src/schemas/typed/NumberEnvVarSchema.ts
179
174
  var NumberEnvVarSchema = class extends EnvVarSchemaBase {
@@ -185,7 +180,6 @@ var NumberEnvVarSchema = class extends EnvVarSchemaBase {
185
180
  });
186
181
  }
187
182
  };
188
-
189
183
  //#endregion
190
184
  //#region ../core/src/schemas/typed/StringEnvVarSchema.ts
191
185
  var StringEnvVarSchema = class extends EnvVarSchemaBase {
@@ -199,16 +193,6 @@ var StringEnvVarSchema = class extends EnvVarSchemaBase {
199
193
  this.secret = input.secret;
200
194
  }
201
195
  };
202
-
203
- //#endregion
204
- //#region ../core/src/schemas/EnvVarSchema.ts
205
- /**
206
- * Type guard to check if a value is a EnvVarSchema instance
207
- */
208
- function isEnvVarSchema(value) {
209
- return value instanceof StringEnvVarSchema || value instanceof NumberEnvVarSchema || value instanceof BooleanEnvVarSchema || value instanceof EnumEnvVarSchema;
210
- }
211
-
212
196
  //#endregion
213
197
  //#region ../core/src/processing/preprocessors/typed/number.ts
214
198
  /**
@@ -221,7 +205,6 @@ const number = () => (value) => {
221
205
  } catch {}
222
206
  return value;
223
207
  };
224
-
225
208
  //#endregion
226
209
  //#region ../core/src/processing/preprocessors/typed/boolean.ts
227
210
  const boolean = (options = {
@@ -241,24 +224,26 @@ const boolean = (options = {
241
224
  return value;
242
225
  };
243
226
  };
244
-
245
227
  //#endregion
246
228
  //#region ../core/src/processing/preprocessors/typed/enumeration.ts
247
229
  /**
248
230
  * Create an enum preprocessor - pass through unchanged
249
231
  */
250
232
  const enumeration = () => (value) => value;
251
-
252
233
  //#endregion
253
234
  //#region ../core/src/processing/preprocessors/typed/string.ts
254
235
  /**
255
236
  * Create a string preprocessor - pass through unchanged
256
237
  */
257
238
  const string = () => (value) => value;
258
-
259
239
  //#endregion
260
240
  //#region ../core/src/processing/preprocessors/preprocessors.ts
261
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
+ /**
262
247
  * Default preprocessors map for each environment variable type
263
248
  */
264
249
  const preprocessors = {
@@ -267,7 +252,6 @@ const preprocessors = {
267
252
  number,
268
253
  string
269
254
  };
270
-
271
255
  //#endregion
272
256
  //#region ../core/src/processing/preprocessors/resolvePreprocessor.ts
273
257
  const defaultFactories = {
@@ -297,117 +281,88 @@ function resolvePreprocessor(envVarType, preprocessorOptions) {
297
281
  if (typeof override === "function") return override;
298
282
  return preprocessors.boolean(override);
299
283
  }
300
-
301
- //#endregion
302
- //#region ../core/src/schemas/schema.ts
303
- const schema = {
304
- string: (input = {}) => new StringEnvVarSchema(input),
305
- number: (input = {}) => new NumberEnvVarSchema(input),
306
- boolean: (input = {}) => new BooleanEnvVarSchema(input),
307
- enum: (input) => new EnumEnvVarSchema(input)
308
- };
309
- const s = schema;
310
-
311
284
  //#endregion
312
- Object.defineProperty(exports, 'BooleanEnvVarSchema', {
313
- enumerable: true,
314
- get: function () {
315
- return BooleanEnvVarSchema;
316
- }
317
- });
318
- Object.defineProperty(exports, 'EnumEnvVarSchema', {
319
- enumerable: true,
320
- get: function () {
321
- return EnumEnvVarSchema;
322
- }
323
- });
324
- Object.defineProperty(exports, 'EnvVarSchemaBase', {
325
- enumerable: true,
326
- get: function () {
327
- return EnvVarSchemaBase;
328
- }
285
+ Object.defineProperty(exports, "BooleanEnvVarSchema", {
286
+ enumerable: true,
287
+ get: function() {
288
+ return BooleanEnvVarSchema;
289
+ }
329
290
  });
330
- Object.defineProperty(exports, 'NumberEnvVarSchema', {
331
- enumerable: true,
332
- get: function () {
333
- return NumberEnvVarSchema;
334
- }
291
+ Object.defineProperty(exports, "EnumEnvVarSchema", {
292
+ enumerable: true,
293
+ get: function() {
294
+ return EnumEnvVarSchema;
295
+ }
335
296
  });
336
- Object.defineProperty(exports, 'StringEnvVarSchema', {
337
- enumerable: true,
338
- get: function () {
339
- return StringEnvVarSchema;
340
- }
297
+ Object.defineProperty(exports, "EnvVarSchemaBase", {
298
+ enumerable: true,
299
+ get: function() {
300
+ return EnvVarSchemaBase;
301
+ }
341
302
  });
342
- Object.defineProperty(exports, 'boolean', {
343
- enumerable: true,
344
- get: function () {
345
- return boolean$1;
346
- }
303
+ Object.defineProperty(exports, "NumberEnvVarSchema", {
304
+ enumerable: true,
305
+ get: function() {
306
+ return NumberEnvVarSchema;
307
+ }
347
308
  });
348
- Object.defineProperty(exports, 'enumeration', {
349
- enumerable: true,
350
- get: function () {
351
- return enumeration$1;
352
- }
309
+ Object.defineProperty(exports, "StringEnvVarSchema", {
310
+ enumerable: true,
311
+ get: function() {
312
+ return StringEnvVarSchema;
313
+ }
353
314
  });
354
- Object.defineProperty(exports, 'isEnvVarSchema', {
355
- enumerable: true,
356
- get: function () {
357
- return isEnvVarSchema;
358
- }
315
+ Object.defineProperty(exports, "boolean", {
316
+ enumerable: true,
317
+ get: function() {
318
+ return boolean$1;
319
+ }
359
320
  });
360
- Object.defineProperty(exports, 'number', {
361
- enumerable: true,
362
- get: function () {
363
- return number$1;
364
- }
321
+ Object.defineProperty(exports, "enumeration", {
322
+ enumerable: true,
323
+ get: function() {
324
+ return enumeration$1;
325
+ }
365
326
  });
366
- Object.defineProperty(exports, 'preprocessors', {
367
- enumerable: true,
368
- get: function () {
369
- return preprocessors;
370
- }
327
+ Object.defineProperty(exports, "number", {
328
+ enumerable: true,
329
+ get: function() {
330
+ return number$1;
331
+ }
371
332
  });
372
- Object.defineProperty(exports, 'processors', {
373
- enumerable: true,
374
- get: function () {
375
- return processors;
376
- }
333
+ Object.defineProperty(exports, "preprocessors", {
334
+ enumerable: true,
335
+ get: function() {
336
+ return preprocessors;
337
+ }
377
338
  });
378
- Object.defineProperty(exports, 'resolvePreprocessor', {
379
- enumerable: true,
380
- get: function () {
381
- return resolvePreprocessor;
382
- }
339
+ Object.defineProperty(exports, "processors", {
340
+ enumerable: true,
341
+ get: function() {
342
+ return processors;
343
+ }
383
344
  });
384
- Object.defineProperty(exports, 's', {
385
- enumerable: true,
386
- get: function () {
387
- return s;
388
- }
345
+ Object.defineProperty(exports, "resolvePreprocessor", {
346
+ enumerable: true,
347
+ get: function() {
348
+ return resolvePreprocessor;
349
+ }
389
350
  });
390
- Object.defineProperty(exports, 'schema', {
391
- enumerable: true,
392
- get: function () {
393
- return schema;
394
- }
351
+ Object.defineProperty(exports, "string", {
352
+ enumerable: true,
353
+ get: function() {
354
+ return string$1;
355
+ }
395
356
  });
396
- Object.defineProperty(exports, 'string', {
397
- enumerable: true,
398
- get: function () {
399
- return string$1;
400
- }
357
+ Object.defineProperty(exports, "toList", {
358
+ enumerable: true,
359
+ get: function() {
360
+ return toList;
361
+ }
401
362
  });
402
- Object.defineProperty(exports, 'toList', {
403
- enumerable: true,
404
- get: function () {
405
- return toList;
406
- }
363
+ Object.defineProperty(exports, "validate", {
364
+ enumerable: true,
365
+ get: function() {
366
+ return validate;
367
+ }
407
368
  });
408
- Object.defineProperty(exports, 'validate', {
409
- enumerable: true,
410
- get: function () {
411
- return validate;
412
- }
413
- });
@@ -1,8 +1,5 @@
1
- import { a as SupportedSchema } from "./EnvModel-D8rt0EJ6.js";
2
- import { t as define } from "./model-Dic8IJsf.js";
3
-
1
+ import { c as SupportedSchema, r as define } from "./index-Cz3frUwZ.cjs";
4
2
  //#region src/vars.d.ts
5
-
6
3
  /**
7
4
  * Sugar helper for creating environment variable models with predefined schemas
8
5
  *
@@ -1,8 +1,5 @@
1
- import { a as SupportedSchema } from "./EnvModel-CrGclUpJ.cjs";
2
- import { t as define } from "./model-ft0WhSSS.cjs";
3
-
1
+ import { c as SupportedSchema, r as define } from "./index-Cb0abjLf.js";
4
2
  //#region src/vars.d.ts
5
-
6
3
  /**
7
4
  * Sugar helper for creating environment variable models with predefined schemas
8
5
  *