@e-n-v/env 0.0.1 → 0.0.4

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 (99) hide show
  1. package/README.md +43 -24
  2. package/dist/BooleanMap-B2eIP3tZ.d.cts +32 -0
  3. package/dist/BooleanMap-DmFnCA-O.d.ts +32 -0
  4. package/dist/EnvChannel-LMIRYvT1.d.cts +16 -0
  5. package/dist/EnvChannel-w27PEm7x.d.ts +16 -0
  6. package/dist/EnvChannelOptions-BPkWDrmr.d.cts +108 -0
  7. package/dist/EnvChannelOptions-CRwDLWjd.d.ts +108 -0
  8. package/dist/EnvModel-CrGclUpJ.d.cts +134 -0
  9. package/dist/EnvModel-D8rt0EJ6.d.ts +134 -0
  10. package/dist/EnvSource-BVnmdHku.cjs +420 -0
  11. package/dist/EnvSource-DA3ZGlES.js +400 -0
  12. package/dist/ProcessEnvChannel-D465c-dp.d.cts +97 -0
  13. package/dist/ProcessEnvChannel-Do4-yiLI.d.ts +97 -0
  14. package/dist/StringEnvVarSchema-B8MT7htU.d.ts +64 -0
  15. package/dist/StringEnvVarSchema-BF6C0nyT.d.cts +64 -0
  16. package/dist/channels.cjs +8 -0
  17. package/dist/channels.d.cts +20 -0
  18. package/dist/channels.d.ts +20 -0
  19. package/dist/channels.js +4 -0
  20. package/dist/chunk-pbleEpgJ.cjs +44 -0
  21. package/dist/cli.cjs +16 -10
  22. package/dist/cli.js +7 -2
  23. package/dist/coerce-DNIuYAx4.js +11028 -0
  24. package/dist/coerce-b7UVodS9.cjs +12365 -0
  25. package/dist/core.cjs +68 -0
  26. package/dist/core.d.cts +6 -0
  27. package/dist/core.d.ts +6 -0
  28. package/dist/core.js +40 -0
  29. package/dist/custom-Bt_wnxIu.js +114 -0
  30. package/dist/custom-D_Rqjm09.cjs +168 -0
  31. package/dist/files.cjs +18 -0
  32. package/dist/files.d.cts +38 -0
  33. package/dist/files.d.ts +38 -0
  34. package/dist/files.js +13 -0
  35. package/dist/index-D8pslhp4.d.cts +170 -0
  36. package/dist/index-Dq_0aeAL.d.ts +170 -0
  37. package/dist/model-Dic8IJsf.d.ts +29 -0
  38. package/dist/model-ft0WhSSS.d.cts +29 -0
  39. package/dist/model.cjs +14 -0
  40. package/dist/model.d.cts +35 -0
  41. package/dist/model.d.ts +35 -0
  42. package/dist/model.js +9 -0
  43. package/dist/parse-BT1QSa5e.d.cts +28 -0
  44. package/dist/parse-DwtLpVhC.d.ts +28 -0
  45. package/dist/parse.cjs +17 -0
  46. package/dist/parse.d.cts +52 -0
  47. package/dist/parse.d.ts +52 -0
  48. package/dist/parse.js +10 -0
  49. package/dist/prompt-C5WudV9x.d.cts +74 -0
  50. package/dist/prompt-yKdccbtZ.d.ts +74 -0
  51. package/dist/prompt.cjs +24 -0
  52. package/dist/prompt.d.cts +17 -0
  53. package/dist/prompt.d.ts +17 -0
  54. package/dist/prompt.js +12 -0
  55. package/dist/redis-CJOpRPjc.js +395 -0
  56. package/dist/redis-EcC7TX3K.cjs +611 -0
  57. package/dist/resolveChannel-CjAuxy3p.cjs +257 -0
  58. package/dist/resolveChannel-v9BDsw-M.js +224 -0
  59. package/dist/root.cjs +36 -0
  60. package/dist/root.d.cts +21 -0
  61. package/dist/root.d.ts +21 -0
  62. package/dist/root.js +21 -0
  63. package/dist/schema-DH4GiW9A.d.cts +18 -0
  64. package/dist/schema-jN4EtvEP.d.ts +18 -0
  65. package/dist/schemas/zod.cjs +629 -0
  66. package/dist/schemas/zod.d.cts +239 -0
  67. package/dist/schemas/zod.d.ts +239 -0
  68. package/dist/schemas/zod.js +550 -0
  69. package/dist/schemas.cjs +133 -0
  70. package/dist/schemas.d.cts +3 -0
  71. package/dist/schemas.d.ts +3 -0
  72. package/dist/schemas.js +6 -0
  73. package/dist/src-B7FG1rak.js +638 -0
  74. package/dist/src-BBwjK5SK.js +127 -0
  75. package/dist/src-CLTURaoo.js +311 -0
  76. package/dist/src-CVdUqK3q.js +850 -0
  77. package/dist/src-Cjo2XA4n.cjs +138 -0
  78. package/dist/{src-oetJm-nZ.cjs → src-DWYoqPX1.cjs} +31 -1964
  79. package/dist/src-DZmpNGrQ.cjs +1411 -0
  80. package/dist/{src-RlCvrI0s.js → src-Dtv7TlJx.js} +14 -1726
  81. package/dist/src-XjL5cyPG.cjs +873 -0
  82. package/dist/src-meUnCASg.cjs +413 -0
  83. package/dist/validate-BxA3a-ns.d.cts +203 -0
  84. package/dist/validate-CyxrRacF.d.ts +203 -0
  85. package/dist/vars-BNVI6k89.d.ts +21 -0
  86. package/dist/vars-CYOaskkK.cjs +27 -0
  87. package/dist/vars-CptZRPX5.d.cts +21 -0
  88. package/dist/vars-DOW0LiiN.js +22 -0
  89. package/dist/vars.cjs +138 -0
  90. package/dist/vars.d.cts +7 -0
  91. package/dist/vars.d.ts +7 -0
  92. package/dist/vars.js +9 -0
  93. package/package.json +59 -9
  94. package/assets/demo.gif +0 -0
  95. package/assets/env-logo.png +0 -0
  96. package/dist/bundle.cjs +0 -1290
  97. package/dist/bundle.d.cts +0 -1057
  98. package/dist/bundle.d.ts +0 -1055
  99. package/dist/bundle.js +0 -1244
@@ -0,0 +1,400 @@
1
+ import { mkdirSync, promises, readFileSync, writeFileSync } from "node:fs";
2
+ import { dirname, resolve } from "node:path";
3
+
4
+ //#region ../files/src/utils.ts
5
+ function normalizeContent(content) {
6
+ return content.replace(/\r\n/g, "\n");
7
+ }
8
+ function splitLines(content) {
9
+ return content === "" ? [] : content.split("\n");
10
+ }
11
+ function validateKey(key) {
12
+ const trimmed = key.trim();
13
+ if (!trimmed) throw new TypeError("Environment variable name cannot be empty");
14
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(trimmed)) throw new TypeError(`Invalid environment variable name: ${trimmed}`);
15
+ return trimmed;
16
+ }
17
+ function parseAssignmentEndingAt(lines, endIndex) {
18
+ const lastLine = lines[endIndex];
19
+ if (typeof lastLine !== "string" || isSkippableLine(lastLine)) return null;
20
+ const block = [];
21
+ let start = endIndex;
22
+ while (start >= 0) {
23
+ const currentLine = lines[start];
24
+ if (typeof currentLine !== "string") break;
25
+ block.unshift(currentLine);
26
+ if (containsAssignmentOperator(currentLine)) {
27
+ const parsed = tryParseAssignmentBlock(block);
28
+ if (!parsed) return null;
29
+ return {
30
+ ...parsed,
31
+ startIndex: start,
32
+ endIndex
33
+ };
34
+ }
35
+ start -= 1;
36
+ }
37
+ return null;
38
+ }
39
+ function isSkippableLine(line) {
40
+ const trimmed = line.trim();
41
+ return trimmed.length === 0 || trimmed.startsWith("#");
42
+ }
43
+ function containsAssignmentOperator(line) {
44
+ const trimmed = line.trimStart();
45
+ if (trimmed.length === 0 || trimmed.startsWith("#")) return false;
46
+ const commentIndex = trimmed.indexOf("#");
47
+ return (commentIndex === -1 ? trimmed : trimmed.slice(0, commentIndex)).includes("=");
48
+ }
49
+ function tryParseAssignmentBlock(blockLines) {
50
+ if (blockLines.length === 0) return null;
51
+ const firstLine = blockLines[0];
52
+ const leadingMatch = firstLine.match(/^\s*/);
53
+ const leading = leadingMatch ? leadingMatch[0] : "";
54
+ let remainder = firstLine.slice(leading.length);
55
+ if (remainder.length === 0 || remainder.startsWith("#")) return null;
56
+ let exportPrefix = "";
57
+ if (remainder.startsWith("export")) {
58
+ const afterExport = remainder.slice(6);
59
+ if (/^\s/.test(afterExport)) {
60
+ const spacingMatch = afterExport.match(/^\s+/);
61
+ const spacing = spacingMatch ? spacingMatch[0] : " ";
62
+ exportPrefix = `export${spacing}`;
63
+ remainder = afterExport.slice(spacing.length);
64
+ }
65
+ }
66
+ const equalsIndex = remainder.indexOf("=");
67
+ if (equalsIndex === -1) return null;
68
+ const key = validateKey(remainder.slice(0, equalsIndex).trim());
69
+ const parsedValue = parseValueSource([remainder.slice(equalsIndex + 1).replace(/^\s+/, ""), ...blockLines.slice(1)].join("\n"));
70
+ if (!parsedValue) return null;
71
+ const trailingTrimmed = parsedValue.trailing.trim();
72
+ if (trailingTrimmed.length > 0 && !trailingTrimmed.startsWith("#")) return null;
73
+ return {
74
+ key,
75
+ value: parsedValue.value,
76
+ leading,
77
+ exportPrefix,
78
+ trailing: parsedValue.trailing,
79
+ lines: [...blockLines]
80
+ };
81
+ }
82
+ function parseValueSource(source) {
83
+ if (source.length === 0) return {
84
+ value: "",
85
+ trailing: ""
86
+ };
87
+ const firstChar = source[0];
88
+ if (firstChar === "\"") return parseDoubleQuotedValue(source);
89
+ if (firstChar === "'") return parseSingleQuotedValue(source);
90
+ if (source.includes("\n")) return null;
91
+ const commentIndex = source.indexOf(" #");
92
+ const raw = commentIndex === -1 ? source : source.slice(0, commentIndex);
93
+ const trailing = commentIndex === -1 ? source.slice(raw.length) : source.slice(commentIndex);
94
+ return {
95
+ value: raw.trim(),
96
+ trailing
97
+ };
98
+ }
99
+ function parseDoubleQuotedValue(source) {
100
+ let value = "";
101
+ let escaping = false;
102
+ for (let i = 1; i < source.length; i += 1) {
103
+ const char = source[i] ?? "";
104
+ if (escaping) {
105
+ switch (char) {
106
+ case "n":
107
+ value += "\n";
108
+ break;
109
+ case "r":
110
+ value += "\r";
111
+ break;
112
+ case "t":
113
+ value += " ";
114
+ break;
115
+ case "\"":
116
+ value += "\"";
117
+ break;
118
+ case "\\":
119
+ value += "\\";
120
+ break;
121
+ default:
122
+ value += char;
123
+ break;
124
+ }
125
+ escaping = false;
126
+ continue;
127
+ }
128
+ if (char === "\\") {
129
+ escaping = true;
130
+ continue;
131
+ }
132
+ if (char === "\"") {
133
+ const trailing = source.slice(i + 1);
134
+ return {
135
+ value,
136
+ trailing
137
+ };
138
+ }
139
+ if (char === "\n") {
140
+ value += "\n";
141
+ continue;
142
+ }
143
+ value += char;
144
+ }
145
+ return null;
146
+ }
147
+ function parseSingleQuotedValue(source) {
148
+ let value = "";
149
+ for (let i = 1; i < source.length; i += 1) {
150
+ const char = source[i] ?? "";
151
+ if (char === "'") {
152
+ const trailing = source.slice(i + 1);
153
+ return {
154
+ value,
155
+ trailing
156
+ };
157
+ }
158
+ if (char === "\n") {
159
+ value += "\n";
160
+ continue;
161
+ }
162
+ value += char;
163
+ }
164
+ return null;
165
+ }
166
+
167
+ //#endregion
168
+ //#region ../files/src/get.ts
169
+ function get(content, arg) {
170
+ const lines = splitLines(normalizeContent(content));
171
+ if (typeof arg === "undefined") {
172
+ const map = scanAll(lines);
173
+ return Object.fromEntries(map);
174
+ }
175
+ if (typeof arg === "string") return scanForSingle(lines, arg);
176
+ const normalizedTargets = Array.from(new Set(arg.map((name) => validateKey(name))));
177
+ const lookup = scanForMany(lines, new Set(normalizedTargets));
178
+ const ordered = normalizedTargets.map((key) => [key, lookup.get(key)]);
179
+ return Object.fromEntries(ordered);
180
+ }
181
+ function scanAll(lines) {
182
+ const result = /* @__PURE__ */ new Map();
183
+ iterateAssignments(lines, (assignment) => {
184
+ if (!result.has(assignment.key)) result.set(assignment.key, assignment.value);
185
+ });
186
+ return result;
187
+ }
188
+ function scanForSingle(lines, target) {
189
+ const name = validateKey(target);
190
+ let found;
191
+ iterateAssignments(lines, (assignment) => {
192
+ if (assignment.key === name) {
193
+ found = assignment.value;
194
+ return true;
195
+ }
196
+ });
197
+ return found;
198
+ }
199
+ function scanForMany(lines, targets) {
200
+ const normalizedTargets = /* @__PURE__ */ new Set();
201
+ for (const target of targets) normalizedTargets.add(validateKey(target));
202
+ const found = /* @__PURE__ */ new Map();
203
+ const remaining = new Set(normalizedTargets);
204
+ iterateAssignments(lines, (assignment) => {
205
+ if (!remaining.has(assignment.key) || found.has(assignment.key)) return;
206
+ found.set(assignment.key, assignment.value);
207
+ remaining.delete(assignment.key);
208
+ if (remaining.size === 0) return true;
209
+ });
210
+ return found;
211
+ }
212
+ function iterateAssignments(lines, callback) {
213
+ for (let i = lines.length - 1; i >= 0;) {
214
+ const parsed = parseAssignmentEndingAt(lines, i);
215
+ if (!parsed) {
216
+ i -= 1;
217
+ continue;
218
+ }
219
+ if (callback(parsed) === true) return;
220
+ i = parsed.startIndex - 1;
221
+ }
222
+ }
223
+
224
+ //#endregion
225
+ //#region ../files/src/set.ts
226
+ function set(content, arg, value) {
227
+ const normalized = normalizeContent(content);
228
+ const lines = splitLines(normalized);
229
+ const entries = normalizeWriteArguments(arg, value);
230
+ if (entries.length === 0) return ensureTrailingNewline(normalized);
231
+ const replacements = new Map(entries);
232
+ const touched = /* @__PURE__ */ new Set();
233
+ for (let i = lines.length - 1; i >= 0;) {
234
+ if (replacements.size === 0) break;
235
+ const parsed = parseAssignmentEndingAt(lines, i);
236
+ if (!parsed) {
237
+ i -= 1;
238
+ continue;
239
+ }
240
+ const { key, startIndex, endIndex, leading, exportPrefix, trailing, value: currentValue } = parsed;
241
+ const nextValue = replacements.get(key);
242
+ if (typeof nextValue === "undefined" || touched.has(key)) {
243
+ i = startIndex - 1;
244
+ continue;
245
+ }
246
+ if (nextValue === currentValue) {
247
+ touched.add(key);
248
+ replacements.delete(key);
249
+ i = startIndex - 1;
250
+ continue;
251
+ }
252
+ const block = buildAssignmentLines(key, nextValue, {
253
+ leading,
254
+ exportPrefix,
255
+ trailing
256
+ });
257
+ lines.splice(startIndex, endIndex - startIndex + 1, ...block);
258
+ touched.add(key);
259
+ replacements.delete(key);
260
+ i = startIndex - 1;
261
+ }
262
+ for (const [key, val] of entries) {
263
+ if (touched.has(key)) continue;
264
+ const block = buildAssignmentLines(key, val);
265
+ const insertIndex = lines.length > 0 && lines[lines.length - 1] === "" ? lines.length - 1 : lines.length;
266
+ lines.splice(insertIndex, 0, ...block);
267
+ touched.add(key);
268
+ }
269
+ return ensureTrailingNewline(lines.join("\n"));
270
+ }
271
+ function ensureTrailingNewline(content) {
272
+ if (content.length === 0) return "";
273
+ if (!content.endsWith("\n")) return `${content}\n`;
274
+ return content;
275
+ }
276
+ function isObjectRecord(value) {
277
+ return typeof value === "object" && value !== null && !Array.isArray(value);
278
+ }
279
+ function normalizeWriteArguments(arg, value) {
280
+ if (typeof arg === "string") {
281
+ if (typeof value === "undefined") throw new TypeError(`Value for variable "${arg}" must be provided`);
282
+ return [[validateKey(arg), formatValueInput(value)]];
283
+ }
284
+ if (!isObjectRecord(arg)) throw new TypeError("Argument must be a string name or an object of key-value pairs");
285
+ const entries = [];
286
+ for (const [key, rawValue] of Object.entries(arg)) {
287
+ if (typeof rawValue === "undefined") throw new TypeError(`Value for variable "${key}" must be provided`);
288
+ entries.push([validateKey(key), formatValueInput(rawValue)]);
289
+ }
290
+ return entries;
291
+ }
292
+ function formatValueInput(value) {
293
+ if (typeof value === "bigint") return value.toString();
294
+ return String(value);
295
+ }
296
+ function serializeValue(value) {
297
+ const normalized = value.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
298
+ if (!(normalized.length === 0 || /[\s"'\\#]/.test(normalized) || normalized.includes("\n"))) return normalized;
299
+ let result = "\"";
300
+ for (const char of normalized) {
301
+ if (char === "\"") {
302
+ result += "\\\"";
303
+ continue;
304
+ }
305
+ if (char === "\\") {
306
+ result += "\\\\";
307
+ continue;
308
+ }
309
+ if (char === "\n") {
310
+ result += "\n";
311
+ continue;
312
+ }
313
+ result += char;
314
+ }
315
+ result += "\"";
316
+ return result;
317
+ }
318
+ function buildAssignmentLines(key, value, style = {}) {
319
+ const leading = style.leading ?? "";
320
+ const exportPrefix = style.exportPrefix ?? "";
321
+ const trailing = style.trailing ?? "";
322
+ const segments = serializeValue(value).split("\n");
323
+ return segments.map((segment, index) => {
324
+ if (index === 0) return `${leading}${exportPrefix}${key}=${segment}${segments.length === 1 ? trailing : ""}`;
325
+ if (index === segments.length - 1 && trailing && segments.length > 1) return `${segment}${trailing}`;
326
+ return segment;
327
+ });
328
+ }
329
+
330
+ //#endregion
331
+ //#region ../files/src/EnvSource.ts
332
+ var EnvSource = class {
333
+ filePath;
334
+ constructor(filePath) {
335
+ this.filePath = resolve(process.cwd(), filePath);
336
+ }
337
+ readSync(arg) {
338
+ const content = this.readContentSync();
339
+ if (typeof arg === "undefined") return get(content);
340
+ if (typeof arg === "string") return get(content, arg);
341
+ return get(content, arg);
342
+ }
343
+ async read(arg) {
344
+ const content = await this.readContent();
345
+ if (typeof arg === "undefined") return get(content);
346
+ if (typeof arg === "string") return get(content, arg);
347
+ return get(content, arg);
348
+ }
349
+ writeSync(arg, value) {
350
+ const originalContent = this.readContentSync();
351
+ let nextContent;
352
+ if (typeof arg === "string") nextContent = set(originalContent, arg, value);
353
+ else nextContent = set(originalContent, arg);
354
+ if (nextContent === originalContent) return;
355
+ this.ensureDirectorySync();
356
+ writeFileSync(this.filePath, nextContent, "utf8");
357
+ }
358
+ async write(arg, value) {
359
+ const originalContent = await this.readContent();
360
+ let nextContent;
361
+ if (typeof arg === "string") nextContent = set(originalContent, arg, value);
362
+ else nextContent = set(originalContent, arg);
363
+ if (nextContent === originalContent) return;
364
+ await this.ensureDirectory();
365
+ await promises.writeFile(this.filePath, nextContent, "utf8");
366
+ }
367
+ readContentSync() {
368
+ try {
369
+ return readFileSync(this.filePath, "utf8").replace(/\r\n/g, "\n");
370
+ } catch (error) {
371
+ if (error.code === "ENOENT") return "";
372
+ throw error;
373
+ }
374
+ }
375
+ async readContent() {
376
+ try {
377
+ return (await promises.readFile(this.filePath, "utf8")).replace(/\r\n/g, "\n");
378
+ } catch (error) {
379
+ if (error.code === "ENOENT") return "";
380
+ throw error;
381
+ }
382
+ }
383
+ ensureDirectorySync() {
384
+ try {
385
+ mkdirSync(dirname(this.filePath), { recursive: true });
386
+ } catch (error) {
387
+ if (error.code !== "EEXIST") throw error;
388
+ }
389
+ }
390
+ async ensureDirectory() {
391
+ try {
392
+ await promises.mkdir(dirname(this.filePath), { recursive: true });
393
+ } catch (error) {
394
+ if (error.code !== "EEXIST") throw error;
395
+ }
396
+ }
397
+ };
398
+
399
+ //#endregion
400
+ export { set as n, get as r, EnvSource as t };
@@ -0,0 +1,97 @@
1
+ import { c as DotEnvXInstance, o as DotEnvXSetOptions, s as DotEnvXGetOptions, t as EnvChannelOptions } from "./EnvChannelOptions-BPkWDrmr.cjs";
2
+ import { t as EnvChannel } from "./EnvChannel-LMIRYvT1.cjs";
3
+
4
+ //#region ../channels/src/resolveChannel.d.ts
5
+
6
+ /**
7
+ * Resolve channel options into an EnvChannel instance
8
+ * @param options - The channel options to resolve
9
+ * @param defaultPath - Default path to use for env files (default: ".env")
10
+ * @returns An EnvChannel instance
11
+ */
12
+ declare function resolveChannel(options: EnvChannelOptions, defaultPath?: string): EnvChannel;
13
+ //#endregion
14
+ //#region ../channels/src/channels/default/DefaultEnvChannel.d.ts
15
+ /**
16
+ * Default implementation of EnvChannel that works with .env files using envrw
17
+ */
18
+ declare class DefaultEnvChannel implements EnvChannel {
19
+ private envSource;
20
+ /**
21
+ * Create a new DefaultEnvChannel
22
+ * @param filePath - Path to the .env file to manage
23
+ */
24
+ constructor(filePath: string);
25
+ /**
26
+ * Get all environment variables
27
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
28
+ */
29
+ get(): Promise<Record<string, string>>;
30
+ /**
31
+ * Set multiple environment variables
32
+ * @param values - Object containing key-value pairs to set
33
+ * @returns Promise that resolves when the values have been set
34
+ */
35
+ set(values: Record<string, string>): Promise<void>;
36
+ }
37
+ //#endregion
38
+ //#region ../channels/src/channels/dotenvx/DotEnvXChannel.d.ts
39
+ /**
40
+ * Simple DotEnvX implementation of EnvChannel that wraps @dotenvx/dotenvx library
41
+ * This is just an API mapping wrapper without caching or complex state management
42
+ */
43
+ declare class DotEnvXChannel implements EnvChannel {
44
+ private dotenvx;
45
+ private getOptions;
46
+ private setOptions;
47
+ private defaultPath;
48
+ /**
49
+ * Create a new DotEnvXChannel
50
+ * @param dotenvx - The dotenvx instance to use
51
+ * @param defaultPath - Default path for env files
52
+ * @param getOptions - Options for get operations
53
+ * @param setOptions - Options for set operations
54
+ */
55
+ constructor(dotenvx: DotEnvXInstance, defaultPath?: string, getOptions?: DotEnvXGetOptions, setOptions?: DotEnvXSetOptions);
56
+ /**
57
+ * Get all environment variables
58
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
59
+ */
60
+ get(): Promise<Record<string, string>>;
61
+ /**
62
+ * Set multiple environment variables
63
+ * @param values - Object containing key-value pairs to set
64
+ * @returns Promise that resolves when the values have been set
65
+ */
66
+ set(values: Record<string, string>): Promise<void>;
67
+ /**
68
+ * Get the primary path being used for env files
69
+ * @returns The primary path
70
+ */
71
+ getPrimaryPath(): string;
72
+ /**
73
+ * Clear any cached data (no-op for this implementation since we don't cache)
74
+ */
75
+ clearCache(): void;
76
+ }
77
+ //#endregion
78
+ //#region ../channels/src/channels/processenv/ProcessEnvChannel.d.ts
79
+ /**
80
+ * EnvChannel implementation that works with process.env
81
+ * This channel reads from and writes to the current process environment
82
+ */
83
+ declare class ProcessEnvChannel implements EnvChannel {
84
+ /**
85
+ * Get all environment variables from process.env
86
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
87
+ */
88
+ get(): Promise<Record<string, string>>;
89
+ /**
90
+ * Set multiple environment variables in process.env
91
+ * @param values - Object containing key-value pairs to set
92
+ * @returns Promise that resolves when the values have been set
93
+ */
94
+ set(values: Record<string, string>): Promise<void>;
95
+ }
96
+ //#endregion
97
+ export { resolveChannel as i, DotEnvXChannel as n, DefaultEnvChannel as r, ProcessEnvChannel as t };
@@ -0,0 +1,97 @@
1
+ import { c as DotEnvXInstance, o as DotEnvXSetOptions, s as DotEnvXGetOptions, t as EnvChannelOptions } from "./EnvChannelOptions-CRwDLWjd.js";
2
+ import { t as EnvChannel } from "./EnvChannel-w27PEm7x.js";
3
+
4
+ //#region ../channels/src/resolveChannel.d.ts
5
+
6
+ /**
7
+ * Resolve channel options into an EnvChannel instance
8
+ * @param options - The channel options to resolve
9
+ * @param defaultPath - Default path to use for env files (default: ".env")
10
+ * @returns An EnvChannel instance
11
+ */
12
+ declare function resolveChannel(options: EnvChannelOptions, defaultPath?: string): EnvChannel;
13
+ //#endregion
14
+ //#region ../channels/src/channels/default/DefaultEnvChannel.d.ts
15
+ /**
16
+ * Default implementation of EnvChannel that works with .env files using envrw
17
+ */
18
+ declare class DefaultEnvChannel implements EnvChannel {
19
+ private envSource;
20
+ /**
21
+ * Create a new DefaultEnvChannel
22
+ * @param filePath - Path to the .env file to manage
23
+ */
24
+ constructor(filePath: string);
25
+ /**
26
+ * Get all environment variables
27
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
28
+ */
29
+ get(): Promise<Record<string, string>>;
30
+ /**
31
+ * Set multiple environment variables
32
+ * @param values - Object containing key-value pairs to set
33
+ * @returns Promise that resolves when the values have been set
34
+ */
35
+ set(values: Record<string, string>): Promise<void>;
36
+ }
37
+ //#endregion
38
+ //#region ../channels/src/channels/dotenvx/DotEnvXChannel.d.ts
39
+ /**
40
+ * Simple DotEnvX implementation of EnvChannel that wraps @dotenvx/dotenvx library
41
+ * This is just an API mapping wrapper without caching or complex state management
42
+ */
43
+ declare class DotEnvXChannel implements EnvChannel {
44
+ private dotenvx;
45
+ private getOptions;
46
+ private setOptions;
47
+ private defaultPath;
48
+ /**
49
+ * Create a new DotEnvXChannel
50
+ * @param dotenvx - The dotenvx instance to use
51
+ * @param defaultPath - Default path for env files
52
+ * @param getOptions - Options for get operations
53
+ * @param setOptions - Options for set operations
54
+ */
55
+ constructor(dotenvx: DotEnvXInstance, defaultPath?: string, getOptions?: DotEnvXGetOptions, setOptions?: DotEnvXSetOptions);
56
+ /**
57
+ * Get all environment variables
58
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
59
+ */
60
+ get(): Promise<Record<string, string>>;
61
+ /**
62
+ * Set multiple environment variables
63
+ * @param values - Object containing key-value pairs to set
64
+ * @returns Promise that resolves when the values have been set
65
+ */
66
+ set(values: Record<string, string>): Promise<void>;
67
+ /**
68
+ * Get the primary path being used for env files
69
+ * @returns The primary path
70
+ */
71
+ getPrimaryPath(): string;
72
+ /**
73
+ * Clear any cached data (no-op for this implementation since we don't cache)
74
+ */
75
+ clearCache(): void;
76
+ }
77
+ //#endregion
78
+ //#region ../channels/src/channels/processenv/ProcessEnvChannel.d.ts
79
+ /**
80
+ * EnvChannel implementation that works with process.env
81
+ * This channel reads from and writes to the current process environment
82
+ */
83
+ declare class ProcessEnvChannel implements EnvChannel {
84
+ /**
85
+ * Get all environment variables from process.env
86
+ * @returns Promise that resolves to object containing all environment variable key-value pairs
87
+ */
88
+ get(): Promise<Record<string, string>>;
89
+ /**
90
+ * Set multiple environment variables in process.env
91
+ * @param values - Object containing key-value pairs to set
92
+ * @returns Promise that resolves when the values have been set
93
+ */
94
+ set(values: Record<string, string>): Promise<void>;
95
+ }
96
+ //#endregion
97
+ export { resolveChannel as i, DotEnvXChannel as n, DefaultEnvChannel as r, ProcessEnvChannel as t };
@@ -0,0 +1,64 @@
1
+ //#region ../core/src/processing/types/Processor.d.ts
2
+ /**
3
+ * Processor function that transforms a string input to type T.
4
+ * Returns T if processing succeeds, undefined for empty/null values, throws descriptive errors for invalid values.
5
+ * Used by environment variable schemas to convert string values to their target types.
6
+ */
7
+ type Processor<T> = (value: string) => T | undefined;
8
+ //#endregion
9
+ //#region ../core/src/types/EnvVarType.d.ts
10
+ type EnvVarType = "string" | "number" | "boolean" | "enum";
11
+ //#endregion
12
+ //#region ../core/src/schemas/EnvVarSchemaInput.d.ts
13
+ interface EnvVarSchemaInput<T> {
14
+ process?: Processor<T>;
15
+ required?: boolean;
16
+ default?: T;
17
+ description?: string;
18
+ }
19
+ //#endregion
20
+ //#region ../core/src/schemas/EnvVarSchemaBase.d.ts
21
+ declare abstract class EnvVarSchemaBase<T> {
22
+ abstract readonly type: EnvVarType;
23
+ readonly required: boolean;
24
+ readonly default?: T;
25
+ readonly description?: string;
26
+ readonly process: Processor<T>;
27
+ constructor(input: EnvVarSchemaInput<T>);
28
+ }
29
+ //#endregion
30
+ //#region ../core/src/schemas/typed/BooleanEnvVarSchema.d.ts
31
+ interface BooleanEnvVarSchemaInput extends EnvVarSchemaInput<boolean> {}
32
+ declare class BooleanEnvVarSchema extends EnvVarSchemaBase<boolean> {
33
+ readonly type: "boolean";
34
+ constructor(input?: BooleanEnvVarSchemaInput);
35
+ }
36
+ //#endregion
37
+ //#region ../core/src/schemas/typed/EnumEnvVarSchema.d.ts
38
+ interface EnumEnvVarSchemaInput<T extends string = string> extends EnvVarSchemaInput<T> {
39
+ values: readonly T[];
40
+ }
41
+ declare class EnumEnvVarSchema<T extends string = string> extends EnvVarSchemaBase<T> {
42
+ readonly type: "enum";
43
+ readonly values: readonly T[];
44
+ constructor(input: EnumEnvVarSchemaInput<T>);
45
+ }
46
+ //#endregion
47
+ //#region ../core/src/schemas/typed/NumberEnvVarSchema.d.ts
48
+ interface NumberEnvVarSchemaInput extends EnvVarSchemaInput<number> {}
49
+ declare class NumberEnvVarSchema extends EnvVarSchemaBase<number> {
50
+ readonly type: "number";
51
+ constructor(input?: NumberEnvVarSchemaInput);
52
+ }
53
+ //#endregion
54
+ //#region ../core/src/schemas/typed/StringEnvVarSchema.d.ts
55
+ interface StringEnvVarSchemaInput extends EnvVarSchemaInput<string> {
56
+ secret?: boolean;
57
+ }
58
+ declare class StringEnvVarSchema extends EnvVarSchemaBase<string> {
59
+ readonly type: "string";
60
+ readonly secret?: boolean;
61
+ constructor(input?: StringEnvVarSchemaInput);
62
+ }
63
+ //#endregion
64
+ export { EnumEnvVarSchema as a, BooleanEnvVarSchemaInput as c, EnvVarType as d, Processor as f, NumberEnvVarSchemaInput as i, EnvVarSchemaBase as l, StringEnvVarSchemaInput as n, EnumEnvVarSchemaInput as o, NumberEnvVarSchema as r, BooleanEnvVarSchema as s, StringEnvVarSchema as t, EnvVarSchemaInput as u };