@geekmidas/envkit 0.0.3 → 0.0.5

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.
@@ -1,11 +1,12 @@
1
- const require_EnvironmentParser = require('../EnvironmentParser-Bz9IoLJs.cjs');
2
- const require_vi_bdSIJ99Y = require('../vi.bdSIJ99Y-CT9xbG7X.cjs');
3
- const zod_v4 = require_EnvironmentParser.__toESM(require("zod/v4"));
1
+ const require_chunk = require('../chunk-CUT6urMc.cjs');
2
+ const require_EnvironmentParser = require('../EnvironmentParser-BDPDLv6i.cjs');
3
+ const zod_v4 = require_chunk.__toESM(require("zod/v4"));
4
+ const vitest = require_chunk.__toESM(require("vitest"));
4
5
 
5
6
  //#region src/__tests__/ConfigParser.spec.ts
6
- require_vi_bdSIJ99Y.describe("ConfigParser", () => {
7
- require_vi_bdSIJ99Y.describe("Basic functionality", () => {
8
- require_vi_bdSIJ99Y.it("should parse simple Zod schemas", () => {
7
+ (0, vitest.describe)("ConfigParser", () => {
8
+ (0, vitest.describe)("Basic functionality", () => {
9
+ (0, vitest.it)("should parse simple Zod schemas", () => {
9
10
  const config = {
10
11
  name: zod_v4.z.string().default("Test"),
11
12
  age: zod_v4.z.number().default(25),
@@ -13,25 +14,25 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
13
14
  };
14
15
  const parser = new require_EnvironmentParser.ConfigParser(config);
15
16
  const result = parser.parse();
16
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
17
+ (0, vitest.expect)(result).toEqual({
17
18
  name: "Test",
18
19
  age: 25,
19
20
  active: true
20
21
  });
21
22
  });
22
- require_vi_bdSIJ99Y.it("should handle optional values", () => {
23
+ (0, vitest.it)("should handle optional values", () => {
23
24
  const config = {
24
25
  required: zod_v4.z.string().default("value"),
25
26
  optional: zod_v4.z.string().optional()
26
27
  };
27
28
  const parser = new require_EnvironmentParser.ConfigParser(config);
28
29
  const result = parser.parse();
29
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
30
+ (0, vitest.expect)(result).toEqual({
30
31
  required: "value",
31
32
  optional: void 0
32
33
  });
33
34
  });
34
- require_vi_bdSIJ99Y.it("should validate and use provided default values", () => {
35
+ (0, vitest.it)("should validate and use provided default values", () => {
35
36
  const config = {
36
37
  port: zod_v4.z.number().default(3e3),
37
38
  host: zod_v4.z.string().default("localhost"),
@@ -39,15 +40,15 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
39
40
  };
40
41
  const parser = new require_EnvironmentParser.ConfigParser(config);
41
42
  const result = parser.parse();
42
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
43
+ (0, vitest.expect)(result).toEqual({
43
44
  port: 3e3,
44
45
  host: "localhost",
45
46
  debug: false
46
47
  });
47
48
  });
48
49
  });
49
- require_vi_bdSIJ99Y.describe("Nested objects", () => {
50
- require_vi_bdSIJ99Y.it("should parse nested configuration objects", () => {
50
+ (0, vitest.describe)("Nested objects", () => {
51
+ (0, vitest.it)("should parse nested configuration objects", () => {
51
52
  const config = {
52
53
  database: {
53
54
  host: zod_v4.z.string().default("localhost"),
@@ -61,7 +62,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
61
62
  };
62
63
  const parser = new require_EnvironmentParser.ConfigParser(config);
63
64
  const result = parser.parse();
64
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
65
+ (0, vitest.expect)(result).toEqual({
65
66
  database: {
66
67
  host: "localhost",
67
68
  port: 5432,
@@ -73,7 +74,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
73
74
  }
74
75
  });
75
76
  });
76
- require_vi_bdSIJ99Y.it("should handle deeply nested objects", () => {
77
+ (0, vitest.it)("should handle deeply nested objects", () => {
77
78
  const config = { app: {
78
79
  name: zod_v4.z.string().default("MyApp"),
79
80
  version: zod_v4.z.string().default("1.0.0"),
@@ -90,7 +91,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
90
91
  } };
91
92
  const parser = new require_EnvironmentParser.ConfigParser(config);
92
93
  const result = parser.parse();
93
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({ app: {
94
+ (0, vitest.expect)(result).toEqual({ app: {
94
95
  name: "MyApp",
95
96
  version: "1.0.0",
96
97
  features: {
@@ -105,7 +106,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
105
106
  }
106
107
  } });
107
108
  });
108
- require_vi_bdSIJ99Y.it("should handle mixed nested and flat configuration", () => {
109
+ (0, vitest.it)("should handle mixed nested and flat configuration", () => {
109
110
  const config = {
110
111
  appName: zod_v4.z.string().default("Test App"),
111
112
  database: {
@@ -120,7 +121,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
120
121
  };
121
122
  const parser = new require_EnvironmentParser.ConfigParser(config);
122
123
  const result = parser.parse();
123
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
124
+ (0, vitest.expect)(result).toEqual({
124
125
  appName: "Test App",
125
126
  database: {
126
127
  url: "postgres://localhost/test",
@@ -134,16 +135,16 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
134
135
  });
135
136
  });
136
137
  });
137
- require_vi_bdSIJ99Y.describe("Error handling", () => {
138
- require_vi_bdSIJ99Y.it("should throw ZodError for schemas without defaults", () => {
138
+ (0, vitest.describe)("Error handling", () => {
139
+ (0, vitest.it)("should throw ZodError for schemas without defaults", () => {
139
140
  const config = {
140
141
  required: zod_v4.z.string(),
141
142
  alsoRequired: zod_v4.z.number()
142
143
  };
143
144
  const parser = new require_EnvironmentParser.ConfigParser(config);
144
- require_vi_bdSIJ99Y.globalExpect(() => parser.parse()).toThrow(zod_v4.z.ZodError);
145
+ (0, vitest.expect)(() => parser.parse()).toThrow(zod_v4.z.ZodError);
145
146
  });
146
- require_vi_bdSIJ99Y.it("should collect multiple validation errors", () => {
147
+ (0, vitest.it)("should collect multiple validation errors", () => {
147
148
  const config = {
148
149
  field1: zod_v4.z.string(),
149
150
  field2: zod_v4.z.number(),
@@ -152,14 +153,14 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
152
153
  const parser = new require_EnvironmentParser.ConfigParser(config);
153
154
  try {
154
155
  parser.parse();
155
- require_vi_bdSIJ99Y.globalExpect(true).toBe(false);
156
+ (0, vitest.expect)(true).toBe(false);
156
157
  } catch (error) {
157
- require_vi_bdSIJ99Y.globalExpect(error).toBeInstanceOf(zod_v4.z.ZodError);
158
+ (0, vitest.expect)(error).toBeInstanceOf(zod_v4.z.ZodError);
158
159
  const zodError = error;
159
- require_vi_bdSIJ99Y.globalExpect(zodError.issues).toHaveLength(3);
160
+ (0, vitest.expect)(zodError.issues).toHaveLength(3);
160
161
  }
161
162
  });
162
- require_vi_bdSIJ99Y.it("should include correct paths in nested validation errors", () => {
163
+ (0, vitest.it)("should include correct paths in nested validation errors", () => {
163
164
  const config = {
164
165
  database: {
165
166
  host: zod_v4.z.string(),
@@ -170,31 +171,31 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
170
171
  const parser = new require_EnvironmentParser.ConfigParser(config);
171
172
  try {
172
173
  parser.parse();
173
- require_vi_bdSIJ99Y.globalExpect(true).toBe(false);
174
+ (0, vitest.expect)(true).toBe(false);
174
175
  } catch (error) {
175
- require_vi_bdSIJ99Y.globalExpect(error).toBeInstanceOf(zod_v4.z.ZodError);
176
+ (0, vitest.expect)(error).toBeInstanceOf(zod_v4.z.ZodError);
176
177
  const zodError = error;
177
178
  const paths = zodError.issues.map((err) => err.path.join("."));
178
- require_vi_bdSIJ99Y.globalExpect(paths).toContain("database.host");
179
- require_vi_bdSIJ99Y.globalExpect(paths).toContain("database.port");
180
- require_vi_bdSIJ99Y.globalExpect(paths).toContain("api.key");
179
+ (0, vitest.expect)(paths).toContain("database.host");
180
+ (0, vitest.expect)(paths).toContain("database.port");
181
+ (0, vitest.expect)(paths).toContain("api.key");
181
182
  }
182
183
  });
183
- require_vi_bdSIJ99Y.it("should use default values that pass validation", () => {
184
+ (0, vitest.it)("should use default values that pass validation", () => {
184
185
  const config = {
185
186
  port: zod_v4.z.number().min(1e3).max(65535).default(3e3),
186
187
  email: zod_v4.z.string().email().default("admin@example.com")
187
188
  };
188
189
  const parser = new require_EnvironmentParser.ConfigParser(config);
189
190
  const result = parser.parse();
190
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
191
+ (0, vitest.expect)(result).toEqual({
191
192
  port: 3e3,
192
193
  email: "admin@example.com"
193
194
  });
194
195
  });
195
196
  });
196
- require_vi_bdSIJ99Y.describe("Type safety", () => {
197
- require_vi_bdSIJ99Y.it("should infer correct types for simple configuration", () => {
197
+ (0, vitest.describe)("Type safety", () => {
198
+ (0, vitest.it)("should infer correct types for simple configuration", () => {
198
199
  const config = {
199
200
  name: zod_v4.z.string().default("test"),
200
201
  count: zod_v4.z.number().default(42),
@@ -204,10 +205,10 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
204
205
  const result = parser.parse();
205
206
  const _typeCheck = true;
206
207
  const _typeCheck2 = true;
207
- require_vi_bdSIJ99Y.globalExpect(_typeCheck).toBe(true);
208
- require_vi_bdSIJ99Y.globalExpect(_typeCheck2).toBe(true);
208
+ (0, vitest.expect)(_typeCheck).toBe(true);
209
+ (0, vitest.expect)(_typeCheck2).toBe(true);
209
210
  });
210
- require_vi_bdSIJ99Y.it("should infer correct types for nested configuration", () => {
211
+ (0, vitest.it)("should infer correct types for nested configuration", () => {
211
212
  const config = {
212
213
  database: {
213
214
  host: zod_v4.z.string().default("localhost"),
@@ -219,10 +220,10 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
219
220
  const result = parser.parse();
220
221
  const _typeCheck = true;
221
222
  const _typeCheck2 = true;
222
- require_vi_bdSIJ99Y.globalExpect(_typeCheck).toBe(true);
223
- require_vi_bdSIJ99Y.globalExpect(_typeCheck2).toBe(true);
223
+ (0, vitest.expect)(_typeCheck).toBe(true);
224
+ (0, vitest.expect)(_typeCheck2).toBe(true);
224
225
  });
225
- require_vi_bdSIJ99Y.it("should handle optional types correctly", () => {
226
+ (0, vitest.it)("should handle optional types correctly", () => {
226
227
  const config = {
227
228
  required: zod_v4.z.string().default("value"),
228
229
  optional: zod_v4.z.string().optional(),
@@ -232,8 +233,8 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
232
233
  const result = parser.parse();
233
234
  });
234
235
  });
235
- require_vi_bdSIJ99Y.describe("Complex schemas", () => {
236
- require_vi_bdSIJ99Y.it("should handle enum schemas", () => {
236
+ (0, vitest.describe)("Complex schemas", () => {
237
+ (0, vitest.it)("should handle enum schemas", () => {
237
238
  const config = {
238
239
  environment: zod_v4.z.enum([
239
240
  "development",
@@ -249,36 +250,36 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
249
250
  };
250
251
  const parser = new require_EnvironmentParser.ConfigParser(config);
251
252
  const result = parser.parse();
252
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
253
+ (0, vitest.expect)(result).toEqual({
253
254
  environment: "development",
254
255
  logLevel: "info"
255
256
  });
256
257
  });
257
- require_vi_bdSIJ99Y.it("should handle union schemas", () => {
258
+ (0, vitest.it)("should handle union schemas", () => {
258
259
  const config = {
259
260
  port: zod_v4.z.union([zod_v4.z.string(), zod_v4.z.number()]).default(3e3),
260
261
  timeout: zod_v4.z.union([zod_v4.z.number(), zod_v4.z.null()]).default(null)
261
262
  };
262
263
  const parser = new require_EnvironmentParser.ConfigParser(config);
263
264
  const result = parser.parse();
264
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
265
+ (0, vitest.expect)(result).toEqual({
265
266
  port: 3e3,
266
267
  timeout: null
267
268
  });
268
269
  });
269
- require_vi_bdSIJ99Y.it("should handle array schemas", () => {
270
+ (0, vitest.it)("should handle array schemas", () => {
270
271
  const config = {
271
272
  tags: zod_v4.z.array(zod_v4.z.string()).default(["tag1", "tag2"]),
272
273
  ports: zod_v4.z.array(zod_v4.z.number()).default([3e3, 3001])
273
274
  };
274
275
  const parser = new require_EnvironmentParser.ConfigParser(config);
275
276
  const result = parser.parse();
276
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
277
+ (0, vitest.expect)(result).toEqual({
277
278
  tags: ["tag1", "tag2"],
278
279
  ports: [3e3, 3001]
279
280
  });
280
281
  });
281
- require_vi_bdSIJ99Y.it("should handle record schemas", () => {
282
+ (0, vitest.it)("should handle record schemas", () => {
282
283
  const config = {
283
284
  metadata: zod_v4.z.record(zod_v4.z.string(), zod_v4.z.string()).default({
284
285
  key1: "value1",
@@ -291,7 +292,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
291
292
  };
292
293
  const parser = new require_EnvironmentParser.ConfigParser(config);
293
294
  const result = parser.parse();
294
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
295
+ (0, vitest.expect)(result).toEqual({
295
296
  metadata: {
296
297
  key1: "value1",
297
298
  key2: "value2"
@@ -302,7 +303,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
302
303
  }
303
304
  });
304
305
  });
305
- require_vi_bdSIJ99Y.it("should handle transformed schemas", () => {
306
+ (0, vitest.it)("should handle transformed schemas", () => {
306
307
  const config = {
307
308
  portString: zod_v4.z.string().transform(Number).default(8080),
308
309
  booleanString: zod_v4.z.string().transform((v) => v === "true").default(false),
@@ -310,7 +311,7 @@ require_vi_bdSIJ99Y.describe("ConfigParser", () => {
310
311
  };
311
312
  const parser = new require_EnvironmentParser.ConfigParser(config);
312
313
  const result = parser.parse();
313
- require_vi_bdSIJ99Y.globalExpect(result).toEqual({
314
+ (0, vitest.expect)(result).toEqual({
314
315
  portString: 8080,
315
316
  booleanString: false,
316
317
  jsonString: { key: "value" }
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -1,6 +1,6 @@
1
- import { describe, globalExpect, it } from "../vi.bdSIJ99Y-CkiV-M6Y.mjs";
2
- import { ConfigParser } from "../EnvironmentParser-Boj5EFmL.mjs";
1
+ import { ConfigParser } from "../EnvironmentParser-CQUOGqc0.mjs";
3
2
  import { z } from "zod/v4";
3
+ import { describe, expect, it } from "vitest";
4
4
 
5
5
  //#region src/__tests__/ConfigParser.spec.ts
6
6
  describe("ConfigParser", () => {
@@ -13,7 +13,7 @@ describe("ConfigParser", () => {
13
13
  };
14
14
  const parser = new ConfigParser(config);
15
15
  const result = parser.parse();
16
- globalExpect(result).toEqual({
16
+ expect(result).toEqual({
17
17
  name: "Test",
18
18
  age: 25,
19
19
  active: true
@@ -26,7 +26,7 @@ describe("ConfigParser", () => {
26
26
  };
27
27
  const parser = new ConfigParser(config);
28
28
  const result = parser.parse();
29
- globalExpect(result).toEqual({
29
+ expect(result).toEqual({
30
30
  required: "value",
31
31
  optional: void 0
32
32
  });
@@ -39,7 +39,7 @@ describe("ConfigParser", () => {
39
39
  };
40
40
  const parser = new ConfigParser(config);
41
41
  const result = parser.parse();
42
- globalExpect(result).toEqual({
42
+ expect(result).toEqual({
43
43
  port: 3e3,
44
44
  host: "localhost",
45
45
  debug: false
@@ -61,7 +61,7 @@ describe("ConfigParser", () => {
61
61
  };
62
62
  const parser = new ConfigParser(config);
63
63
  const result = parser.parse();
64
- globalExpect(result).toEqual({
64
+ expect(result).toEqual({
65
65
  database: {
66
66
  host: "localhost",
67
67
  port: 5432,
@@ -90,7 +90,7 @@ describe("ConfigParser", () => {
90
90
  } };
91
91
  const parser = new ConfigParser(config);
92
92
  const result = parser.parse();
93
- globalExpect(result).toEqual({ app: {
93
+ expect(result).toEqual({ app: {
94
94
  name: "MyApp",
95
95
  version: "1.0.0",
96
96
  features: {
@@ -120,7 +120,7 @@ describe("ConfigParser", () => {
120
120
  };
121
121
  const parser = new ConfigParser(config);
122
122
  const result = parser.parse();
123
- globalExpect(result).toEqual({
123
+ expect(result).toEqual({
124
124
  appName: "Test App",
125
125
  database: {
126
126
  url: "postgres://localhost/test",
@@ -141,7 +141,7 @@ describe("ConfigParser", () => {
141
141
  alsoRequired: z.number()
142
142
  };
143
143
  const parser = new ConfigParser(config);
144
- globalExpect(() => parser.parse()).toThrow(z.ZodError);
144
+ expect(() => parser.parse()).toThrow(z.ZodError);
145
145
  });
146
146
  it("should collect multiple validation errors", () => {
147
147
  const config = {
@@ -152,11 +152,11 @@ describe("ConfigParser", () => {
152
152
  const parser = new ConfigParser(config);
153
153
  try {
154
154
  parser.parse();
155
- globalExpect(true).toBe(false);
155
+ expect(true).toBe(false);
156
156
  } catch (error) {
157
- globalExpect(error).toBeInstanceOf(z.ZodError);
157
+ expect(error).toBeInstanceOf(z.ZodError);
158
158
  const zodError = error;
159
- globalExpect(zodError.issues).toHaveLength(3);
159
+ expect(zodError.issues).toHaveLength(3);
160
160
  }
161
161
  });
162
162
  it("should include correct paths in nested validation errors", () => {
@@ -170,14 +170,14 @@ describe("ConfigParser", () => {
170
170
  const parser = new ConfigParser(config);
171
171
  try {
172
172
  parser.parse();
173
- globalExpect(true).toBe(false);
173
+ expect(true).toBe(false);
174
174
  } catch (error) {
175
- globalExpect(error).toBeInstanceOf(z.ZodError);
175
+ expect(error).toBeInstanceOf(z.ZodError);
176
176
  const zodError = error;
177
177
  const paths = zodError.issues.map((err) => err.path.join("."));
178
- globalExpect(paths).toContain("database.host");
179
- globalExpect(paths).toContain("database.port");
180
- globalExpect(paths).toContain("api.key");
178
+ expect(paths).toContain("database.host");
179
+ expect(paths).toContain("database.port");
180
+ expect(paths).toContain("api.key");
181
181
  }
182
182
  });
183
183
  it("should use default values that pass validation", () => {
@@ -187,7 +187,7 @@ describe("ConfigParser", () => {
187
187
  };
188
188
  const parser = new ConfigParser(config);
189
189
  const result = parser.parse();
190
- globalExpect(result).toEqual({
190
+ expect(result).toEqual({
191
191
  port: 3e3,
192
192
  email: "admin@example.com"
193
193
  });
@@ -204,8 +204,8 @@ describe("ConfigParser", () => {
204
204
  const result = parser.parse();
205
205
  const _typeCheck = true;
206
206
  const _typeCheck2 = true;
207
- globalExpect(_typeCheck).toBe(true);
208
- globalExpect(_typeCheck2).toBe(true);
207
+ expect(_typeCheck).toBe(true);
208
+ expect(_typeCheck2).toBe(true);
209
209
  });
210
210
  it("should infer correct types for nested configuration", () => {
211
211
  const config = {
@@ -219,8 +219,8 @@ describe("ConfigParser", () => {
219
219
  const result = parser.parse();
220
220
  const _typeCheck = true;
221
221
  const _typeCheck2 = true;
222
- globalExpect(_typeCheck).toBe(true);
223
- globalExpect(_typeCheck2).toBe(true);
222
+ expect(_typeCheck).toBe(true);
223
+ expect(_typeCheck2).toBe(true);
224
224
  });
225
225
  it("should handle optional types correctly", () => {
226
226
  const config = {
@@ -249,7 +249,7 @@ describe("ConfigParser", () => {
249
249
  };
250
250
  const parser = new ConfigParser(config);
251
251
  const result = parser.parse();
252
- globalExpect(result).toEqual({
252
+ expect(result).toEqual({
253
253
  environment: "development",
254
254
  logLevel: "info"
255
255
  });
@@ -261,7 +261,7 @@ describe("ConfigParser", () => {
261
261
  };
262
262
  const parser = new ConfigParser(config);
263
263
  const result = parser.parse();
264
- globalExpect(result).toEqual({
264
+ expect(result).toEqual({
265
265
  port: 3e3,
266
266
  timeout: null
267
267
  });
@@ -273,7 +273,7 @@ describe("ConfigParser", () => {
273
273
  };
274
274
  const parser = new ConfigParser(config);
275
275
  const result = parser.parse();
276
- globalExpect(result).toEqual({
276
+ expect(result).toEqual({
277
277
  tags: ["tag1", "tag2"],
278
278
  ports: [3e3, 3001]
279
279
  });
@@ -291,7 +291,7 @@ describe("ConfigParser", () => {
291
291
  };
292
292
  const parser = new ConfigParser(config);
293
293
  const result = parser.parse();
294
- globalExpect(result).toEqual({
294
+ expect(result).toEqual({
295
295
  metadata: {
296
296
  key1: "value1",
297
297
  key2: "value2"
@@ -310,7 +310,7 @@ describe("ConfigParser", () => {
310
310
  };
311
311
  const parser = new ConfigParser(config);
312
312
  const result = parser.parse();
313
- globalExpect(result).toEqual({
313
+ expect(result).toEqual({
314
314
  portString: 8080,
315
315
  booleanString: false,
316
316
  jsonString: { key: "value" }