node-env-resolver 6.5.1 → 6.6.0

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 (92) hide show
  1. package/README.md +708 -400
  2. package/dist/builder.cjs +1 -1
  3. package/dist/builder.d.cts +1 -1
  4. package/dist/builder.d.ts +1 -1
  5. package/dist/builder.js +1 -1
  6. package/dist/chunk-3EWCMDFP.js +9 -0
  7. package/dist/chunk-BFLXBLZ3.cjs +1 -0
  8. package/dist/chunk-CDXO2XX3.cjs +2 -0
  9. package/dist/chunk-CTJYBBOB.js +2 -0
  10. package/dist/chunk-DIJNUFGZ.cjs +15 -0
  11. package/dist/chunk-DYFRO3NM.cjs +9 -0
  12. package/dist/chunk-K4NIC5T3.js +9 -0
  13. package/dist/chunk-WVMDTD6J.cjs +9 -0
  14. package/dist/chunk-ZMRT37K3.js +1 -0
  15. package/dist/chunk-ZSM2NDX5.js +15 -0
  16. package/dist/cli/bin.cjs +74 -0
  17. package/dist/cli/bin.js +74 -0
  18. package/dist/cli.d.cts +1 -1
  19. package/dist/cli.d.ts +1 -1
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.cts +59 -3
  22. package/dist/index.d.ts +59 -3
  23. package/dist/index.js +1 -1
  24. package/dist/provider-kit.cjs +2 -0
  25. package/dist/provider-kit.d.cts +50 -0
  26. package/dist/provider-kit.d.ts +50 -0
  27. package/dist/provider-kit.js +2 -0
  28. package/dist/resolver.cjs +1 -1
  29. package/dist/resolver.d.cts +1 -1
  30. package/dist/resolver.d.ts +1 -1
  31. package/dist/resolver.js +1 -1
  32. package/dist/resolvers.cjs +1 -1
  33. package/dist/resolvers.d.cts +2 -27
  34. package/dist/resolvers.d.ts +2 -27
  35. package/dist/resolvers.js +1 -1
  36. package/dist/runtime/index.cjs +1 -0
  37. package/dist/runtime/index.d.cts +161 -0
  38. package/dist/runtime/index.d.ts +161 -0
  39. package/dist/runtime/index.js +1 -0
  40. package/dist/types--RcOnfdl.d.cts +284 -0
  41. package/dist/types--RcOnfdl.d.ts +284 -0
  42. package/dist/types.cjs +1 -1
  43. package/dist/types.d.cts +1 -129
  44. package/dist/types.d.ts +1 -129
  45. package/dist/types.js +1 -1
  46. package/dist/utils.cjs +1 -1
  47. package/dist/utils.d.cts +56 -12
  48. package/dist/utils.d.ts +56 -12
  49. package/dist/utils.js +1 -1
  50. package/dist/valibot.cjs +1 -1
  51. package/dist/valibot.d.cts +12 -25
  52. package/dist/valibot.d.ts +12 -25
  53. package/dist/valibot.js +1 -1
  54. package/dist/validators.cjs +2 -2
  55. package/dist/validators.d.cts +25 -48
  56. package/dist/validators.d.ts +25 -48
  57. package/dist/validators.js +2 -2
  58. package/dist/web.cjs +5 -5
  59. package/dist/web.d.cts +3 -1
  60. package/dist/web.d.ts +3 -1
  61. package/dist/web.js +5 -5
  62. package/dist/zod.cjs +1 -1
  63. package/dist/zod.d.cts +12 -25
  64. package/dist/zod.d.ts +12 -25
  65. package/dist/zod.js +1 -1
  66. package/package.json +26 -31
  67. package/binding.gyp +0 -9
  68. package/dist/chunk-2IQQVAXA.cjs +0 -9
  69. package/dist/chunk-46CBATKM.js +0 -1
  70. package/dist/chunk-C34FGZOG.js +0 -9
  71. package/dist/chunk-FNF55TN4.cjs +0 -1
  72. package/dist/chunk-G36OESVW.cjs +0 -1
  73. package/dist/chunk-I5UKYTX6.js +0 -1
  74. package/dist/chunk-MFFH2ZXS.js +0 -17
  75. package/dist/chunk-QCKMQEJP.cjs +0 -17
  76. package/dist/chunk-S7AB6UX7.cjs +0 -9
  77. package/dist/chunk-TGIYWWDY.js +0 -9
  78. package/dist/chunk-VUUPIWFJ.js +0 -9
  79. package/dist/chunk-ZDRU3RSU.cjs +0 -9
  80. package/dist/cli-main.cjs +0 -4
  81. package/dist/cli-main.js +0 -4
  82. package/dist/redaction.cjs +0 -1
  83. package/dist/redaction.d.cts +0 -54
  84. package/dist/redaction.d.ts +0 -54
  85. package/dist/redaction.js +0 -1
  86. package/dist/typegen.cjs +0 -1
  87. package/dist/typegen.d.cts +0 -52
  88. package/dist/typegen.d.ts +0 -52
  89. package/dist/typegen.js +0 -1
  90. package/index.js +0 -1
  91. /package/dist/{cli-main.d.cts → cli/bin.d.cts} +0 -0
  92. /package/dist/{cli-main.d.ts → cli/bin.d.ts} +0 -0
@@ -1,54 +0,0 @@
1
- /**
2
- * Symbol used to mark a value as intentionally revealed, so the redactor skips it.
3
- */
4
- declare const REVEAL_SYMBOL: unique symbol;
5
- /**
6
- * A value wrapped with REVEAL_SYMBOL so the redactor skips redaction.
7
- */
8
- type Revealed<T> = {
9
- readonly [REVEAL_SYMBOL]: true;
10
- readonly value: T;
11
- };
12
- /**
13
- * Wrap a value so the redactor intentionally skips it.
14
- * Use this when you need to log a sensitive value for debugging.
15
- */
16
- declare function reveal<T>(value: T): Revealed<T>;
17
- /**
18
- * Extract the set of keys marked as sensitive from a resolved config object.
19
- */
20
- declare function getSensitiveKeys(config: object): Set<string>;
21
- /**
22
- * Extract a map of sensitive key → resolved string value from a resolved config.
23
- * Only includes keys whose resolved values are non-empty strings.
24
- */
25
- declare function getSensitiveValues(config: object): Map<string, string>;
26
- /**
27
- * Mask a string value for display. Shows the first `showChars` characters
28
- * followed by asterisks.
29
- *
30
- * @param value - The string to mask
31
- * @param showChars - Number of leading characters to show (default: 2)
32
- */
33
- declare function redactString(value: string, showChars?: number): string;
34
- /**
35
- * Create a bound redaction function for a specific resolved config.
36
- * The regex is built once and cached via WeakMap.
37
- *
38
- * @param config - A resolved config object (from resolve/resolveAsync)
39
- * @returns A function that redacts sensitive values from any input
40
- */
41
- declare function createRedactor(config: object): (value: unknown) => unknown;
42
- declare function redactSensitiveConfig(value: unknown, config: object): unknown;
43
- /**
44
- * Patch global console methods to redact sensitive values.
45
- * Returns an unpatch function to restore original behavior.
46
- *
47
- * Best-effort, Node-only. Not guaranteed for all logging pipelines.
48
- *
49
- * @param config - A resolved config object with sensitive keys attached
50
- * @returns A function to unpatch (restore original console methods)
51
- */
52
- declare function patchGlobalConsole(config: object): () => void;
53
-
54
- export { REVEAL_SYMBOL, type Revealed, createRedactor, getSensitiveKeys, getSensitiveValues, patchGlobalConsole, redactSensitiveConfig, redactString, reveal };
@@ -1,54 +0,0 @@
1
- /**
2
- * Symbol used to mark a value as intentionally revealed, so the redactor skips it.
3
- */
4
- declare const REVEAL_SYMBOL: unique symbol;
5
- /**
6
- * A value wrapped with REVEAL_SYMBOL so the redactor skips redaction.
7
- */
8
- type Revealed<T> = {
9
- readonly [REVEAL_SYMBOL]: true;
10
- readonly value: T;
11
- };
12
- /**
13
- * Wrap a value so the redactor intentionally skips it.
14
- * Use this when you need to log a sensitive value for debugging.
15
- */
16
- declare function reveal<T>(value: T): Revealed<T>;
17
- /**
18
- * Extract the set of keys marked as sensitive from a resolved config object.
19
- */
20
- declare function getSensitiveKeys(config: object): Set<string>;
21
- /**
22
- * Extract a map of sensitive key → resolved string value from a resolved config.
23
- * Only includes keys whose resolved values are non-empty strings.
24
- */
25
- declare function getSensitiveValues(config: object): Map<string, string>;
26
- /**
27
- * Mask a string value for display. Shows the first `showChars` characters
28
- * followed by asterisks.
29
- *
30
- * @param value - The string to mask
31
- * @param showChars - Number of leading characters to show (default: 2)
32
- */
33
- declare function redactString(value: string, showChars?: number): string;
34
- /**
35
- * Create a bound redaction function for a specific resolved config.
36
- * The regex is built once and cached via WeakMap.
37
- *
38
- * @param config - A resolved config object (from resolve/resolveAsync)
39
- * @returns A function that redacts sensitive values from any input
40
- */
41
- declare function createRedactor(config: object): (value: unknown) => unknown;
42
- declare function redactSensitiveConfig(value: unknown, config: object): unknown;
43
- /**
44
- * Patch global console methods to redact sensitive values.
45
- * Returns an unpatch function to restore original behavior.
46
- *
47
- * Best-effort, Node-only. Not guaranteed for all logging pipelines.
48
- *
49
- * @param config - A resolved config object with sensitive keys attached
50
- * @returns A function to unpatch (restore original console methods)
51
- */
52
- declare function patchGlobalConsole(config: object): () => void;
53
-
54
- export { REVEAL_SYMBOL, type Revealed, createRedactor, getSensitiveKeys, getSensitiveValues, patchGlobalConsole, redactSensitiveConfig, redactString, reveal };
package/dist/redaction.js DELETED
@@ -1 +0,0 @@
1
- export{a as REVEAL_SYMBOL,f as createRedactor,c as getSensitiveKeys,d as getSensitiveValues,h as patchGlobalConsole,g as redactSensitiveConfig,e as redactString,b as reveal}from'./chunk-I5UKYTX6.js';import'./chunk-46CBATKM.js';import'./chunk-I7AUKTXE.js';
package/dist/typegen.cjs DELETED
@@ -1 +0,0 @@
1
- 'use strict';var chunkZDRU3RSU_cjs=require('./chunk-ZDRU3RSU.cjs');require('./chunk-D6WM53FN.cjs');Object.defineProperty(exports,"generateTypes",{enumerable:true,get:function(){return chunkZDRU3RSU_cjs.a}});Object.defineProperty(exports,"writeTypes",{enumerable:true,get:function(){return chunkZDRU3RSU_cjs.b}});
@@ -1,52 +0,0 @@
1
- import { SimpleEnvSchema } from './types.cjs';
2
-
3
- /**
4
- * Best-effort TypeScript type generation from env schemas.
5
- *
6
- * Generated types represent the **coerced output schema** (what resolve() returns).
7
- * process.env augmentations remain string-ish at runtime — these are convenience,
8
- * not enforcement. Edge cases (custom validators, complex compositions) fall back
9
- * to `string`.
10
- *
11
- * @example
12
- * ```ts
13
- * import { generateTypes, writeTypes } from 'node-env-resolver/typegen';
14
- * import { string, number, oneOf, sensitive } from 'node-env-resolver/validators';
15
- *
16
- * const schema = {
17
- * PORT: number({ default: 3000, description: 'Server port' }),
18
- * API_KEY: sensitive(string({ description: 'API key for external service' })),
19
- * NODE_ENV: oneOf(['development', 'production', 'test'] as const),
20
- * };
21
- *
22
- * const types = generateTypes(schema);
23
- * writeTypes(schema, './env.d.ts');
24
- * ```
25
- */
26
-
27
- interface TypegenOptions {
28
- /** Augment global process.env types (default: true) */
29
- augmentProcessEnv?: boolean;
30
- /** Augment global import.meta.env types (default: true) */
31
- augmentImportMetaEnv?: boolean;
32
- /** Custom banner comment at the top of the file */
33
- banner?: string;
34
- }
35
- /**
36
- * Generate TypeScript type definitions from a schema.
37
- *
38
- * @param schema - The env schema definition
39
- * @param options - Generation options
40
- * @returns The generated .d.ts file content as a string
41
- */
42
- declare function generateTypes(schema: SimpleEnvSchema, options?: TypegenOptions): string;
43
- /**
44
- * Generate TypeScript type definitions and write them to a file.
45
- *
46
- * @param schema - The env schema definition
47
- * @param outputPath - Path to write the .d.ts file
48
- * @param options - Generation options
49
- */
50
- declare function writeTypes(schema: SimpleEnvSchema, outputPath: string, options?: TypegenOptions): void;
51
-
52
- export { type TypegenOptions, generateTypes, writeTypes };
package/dist/typegen.d.ts DELETED
@@ -1,52 +0,0 @@
1
- import { SimpleEnvSchema } from './types.js';
2
-
3
- /**
4
- * Best-effort TypeScript type generation from env schemas.
5
- *
6
- * Generated types represent the **coerced output schema** (what resolve() returns).
7
- * process.env augmentations remain string-ish at runtime — these are convenience,
8
- * not enforcement. Edge cases (custom validators, complex compositions) fall back
9
- * to `string`.
10
- *
11
- * @example
12
- * ```ts
13
- * import { generateTypes, writeTypes } from 'node-env-resolver/typegen';
14
- * import { string, number, oneOf, sensitive } from 'node-env-resolver/validators';
15
- *
16
- * const schema = {
17
- * PORT: number({ default: 3000, description: 'Server port' }),
18
- * API_KEY: sensitive(string({ description: 'API key for external service' })),
19
- * NODE_ENV: oneOf(['development', 'production', 'test'] as const),
20
- * };
21
- *
22
- * const types = generateTypes(schema);
23
- * writeTypes(schema, './env.d.ts');
24
- * ```
25
- */
26
-
27
- interface TypegenOptions {
28
- /** Augment global process.env types (default: true) */
29
- augmentProcessEnv?: boolean;
30
- /** Augment global import.meta.env types (default: true) */
31
- augmentImportMetaEnv?: boolean;
32
- /** Custom banner comment at the top of the file */
33
- banner?: string;
34
- }
35
- /**
36
- * Generate TypeScript type definitions from a schema.
37
- *
38
- * @param schema - The env schema definition
39
- * @param options - Generation options
40
- * @returns The generated .d.ts file content as a string
41
- */
42
- declare function generateTypes(schema: SimpleEnvSchema, options?: TypegenOptions): string;
43
- /**
44
- * Generate TypeScript type definitions and write them to a file.
45
- *
46
- * @param schema - The env schema definition
47
- * @param outputPath - Path to write the .d.ts file
48
- * @param options - Generation options
49
- */
50
- declare function writeTypes(schema: SimpleEnvSchema, outputPath: string, options?: TypegenOptions): void;
51
-
52
- export { type TypegenOptions, generateTypes, writeTypes };
package/dist/typegen.js DELETED
@@ -1 +0,0 @@
1
- export{a as generateTypes,b as writeTypes}from'./chunk-TGIYWWDY.js';import'./chunk-I7AUKTXE.js';