node-env-resolver 6.6.0 → 6.7.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 (114) hide show
  1. package/README.md +186 -11
  2. package/dist/audit.d.ts +7 -8
  3. package/dist/audit.d.ts.map +1 -0
  4. package/dist/builder.cjs +1 -1
  5. package/dist/builder.d.ts +9 -12
  6. package/dist/builder.d.ts.map +1 -0
  7. package/dist/builder.js +1 -1
  8. package/dist/chunk-3TXO5AOZ.cjs +3 -0
  9. package/dist/chunk-4CLWNKB5.js +1 -0
  10. package/dist/chunk-4DUWYBNJ.cjs +6 -0
  11. package/dist/chunk-6NSX37SO.js +6 -0
  12. package/dist/chunk-BITH5LSH.js +3 -0
  13. package/dist/{chunk-DIJNUFGZ.cjs → chunk-G5HNCCR6.cjs} +3 -3
  14. package/dist/chunk-IP6POQCY.cjs +1 -0
  15. package/dist/{chunk-ZSM2NDX5.js → chunk-JVRRDD3Y.js} +3 -3
  16. package/dist/chunk-KHEBSYFP.js +9 -0
  17. package/dist/chunk-NHXSZY2U.cjs +9 -0
  18. package/dist/chunk-NKISCWWB.js +1 -0
  19. package/dist/chunk-UZ7HKTYL.cjs +1 -0
  20. package/dist/cli/bin.cjs +67 -27
  21. package/dist/cli/bin.d.ts +11 -0
  22. package/dist/cli/bin.d.ts.map +1 -0
  23. package/dist/cli/bin.js +67 -27
  24. package/dist/cli/scan.d.ts +24 -0
  25. package/dist/cli/scan.d.ts.map +1 -0
  26. package/dist/cli.d.ts +4 -7
  27. package/dist/cli.d.ts.map +1 -0
  28. package/dist/debug.d.ts +142 -0
  29. package/dist/debug.d.ts.map +1 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.d.ts +19 -61
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +1 -1
  34. package/dist/inspect.d.ts +63 -0
  35. package/dist/inspect.d.ts.map +1 -0
  36. package/dist/process-env.d.ts +32 -0
  37. package/dist/process-env.d.ts.map +1 -0
  38. package/dist/provider-kit.d.ts +7 -8
  39. package/dist/provider-kit.d.ts.map +1 -0
  40. package/dist/providers.d.ts +49 -0
  41. package/dist/providers.d.ts.map +1 -0
  42. package/dist/references.d.ts +5 -0
  43. package/dist/references.d.ts.map +1 -0
  44. package/dist/resolver.cjs +1 -1
  45. package/dist/resolver.d.ts +16 -8
  46. package/dist/resolver.d.ts.map +1 -0
  47. package/dist/resolver.js +1 -1
  48. package/dist/resolvers.cjs +1 -1
  49. package/dist/resolvers.d.ts +13 -31
  50. package/dist/resolvers.d.ts.map +1 -0
  51. package/dist/resolvers.js +1 -1
  52. package/dist/runtime/index.cjs +1 -1
  53. package/dist/runtime/index.d.ts +8 -108
  54. package/dist/runtime/index.d.ts.map +1 -0
  55. package/dist/runtime/index.js +1 -1
  56. package/dist/runtime/patch-console.d.ts +23 -0
  57. package/dist/runtime/patch-console.d.ts.map +1 -0
  58. package/dist/runtime/redactor.d.ts +22 -0
  59. package/dist/runtime/redactor.d.ts.map +1 -0
  60. package/dist/runtime/response.d.ts +59 -0
  61. package/dist/runtime/response.d.ts.map +1 -0
  62. package/dist/security.d.ts +49 -0
  63. package/dist/security.d.ts.map +1 -0
  64. package/dist/sensitivity.d.ts +34 -0
  65. package/dist/sensitivity.d.ts.map +1 -0
  66. package/dist/types.d.ts +150 -1
  67. package/dist/types.d.ts.map +1 -0
  68. package/dist/utils.cjs +1 -1
  69. package/dist/utils.d.ts +19 -21
  70. package/dist/utils.d.ts.map +1 -0
  71. package/dist/utils.js +1 -1
  72. package/dist/valibot.cjs +1 -1
  73. package/dist/valibot.d.ts +9 -11
  74. package/dist/valibot.d.ts.map +1 -0
  75. package/dist/valibot.js +1 -1
  76. package/dist/validation-types.d.ts +3 -4
  77. package/dist/validation-types.d.ts.map +1 -0
  78. package/dist/validators.cjs +2 -2
  79. package/dist/validators.d.ts +59 -44
  80. package/dist/validators.d.ts.map +1 -0
  81. package/dist/validators.js +2 -2
  82. package/dist/web.cjs +3 -3
  83. package/dist/web.d.ts +8 -10
  84. package/dist/web.d.ts.map +1 -0
  85. package/dist/web.js +3 -3
  86. package/dist/zod.cjs +1 -1
  87. package/dist/zod.d.ts +9 -11
  88. package/dist/zod.d.ts.map +1 -0
  89. package/dist/zod.js +1 -1
  90. package/package.json +15 -23
  91. package/dist/audit.d.cts +0 -52
  92. package/dist/builder.d.cts +0 -149
  93. package/dist/chunk-3EWCMDFP.js +0 -9
  94. package/dist/chunk-4QOKRJ3F.cjs +0 -1
  95. package/dist/chunk-DYFRO3NM.cjs +0 -9
  96. package/dist/chunk-K4NIC5T3.js +0 -9
  97. package/dist/chunk-WKIPEKF6.js +0 -1
  98. package/dist/chunk-WVMDTD6J.cjs +0 -9
  99. package/dist/cli/bin.d.cts +0 -1
  100. package/dist/cli.d.cts +0 -52
  101. package/dist/index.d.cts +0 -220
  102. package/dist/provider-kit.d.cts +0 -50
  103. package/dist/resolver.d.cts +0 -20
  104. package/dist/resolvers.d.cts +0 -190
  105. package/dist/runtime/index.d.cts +0 -161
  106. package/dist/types--RcOnfdl.d.cts +0 -284
  107. package/dist/types--RcOnfdl.d.ts +0 -284
  108. package/dist/types.d.cts +0 -1
  109. package/dist/utils.d.cts +0 -327
  110. package/dist/valibot.d.cts +0 -143
  111. package/dist/validation-types.d.cts +0 -29
  112. package/dist/validators.d.cts +0 -933
  113. package/dist/web.d.cts +0 -71
  114. package/dist/zod.d.cts +0 -122
package/dist/web.d.cts DELETED
@@ -1,71 +0,0 @@
1
- import { a as Resolver, b as ReferenceOptions, P as PolicyOptions, E as EnvSchema, c as EnvDefinition, S as SimpleEnvSchema, I as InferSimpleSchema } from './types--RcOnfdl.cjs';
2
-
3
- /**
4
- * Client/server split API for web applications
5
- * Import from 'node-env-resolver/web' to use client-safe environment resolution
6
- */
7
-
8
- interface ClientEnvOptions {
9
- resolvers?: Resolver[];
10
- clientPrefix?: string;
11
- strict?: boolean;
12
- references?: ReferenceOptions;
13
- }
14
- interface EnvSplitOptions {
15
- resolvers?: Resolver[];
16
- clientPrefix?: string;
17
- strict?: boolean;
18
- interpolate?: boolean;
19
- policies?: PolicyOptions;
20
- references?: ReferenceOptions;
21
- }
22
- interface EnvSplitSchema {
23
- server: EnvSchema;
24
- client: EnvSchema;
25
- }
26
- type InferType<T extends EnvDefinition> = T extends {
27
- enum: readonly (infer U)[];
28
- } ? U : T extends {
29
- type: 'number';
30
- } ? number : T extends {
31
- type: 'boolean';
32
- } ? boolean : T extends {
33
- type: 'url';
34
- } ? URL : T extends {
35
- type: 'port';
36
- } ? number : T extends {
37
- type: 'timestamp';
38
- } ? number : T extends {
39
- type: 'date';
40
- } ? string : T extends {
41
- type: 'json';
42
- } ? unknown : string;
43
- type InferClientSchema<T extends EnvSchema, TPrefix extends string> = {
44
- [K in keyof T as K extends `${TPrefix}${string}` ? K : never]: InferType<T[K] extends EnvDefinition ? T[K] : never>;
45
- };
46
- /**
47
- * Create a client-safe environment resolver that only exposes variables with the specified prefix
48
- * @param schema Environment schema with client variables prefixed (e.g., PUBLIC_API_URL)
49
- * @param options Configuration options
50
- * @returns Promise resolving to client environment variables only
51
- */
52
- declare function resolveClientEnv<TSchema extends EnvSchema, TPrefix extends string = 'PUBLIC_'>(schema: TSchema, options?: ClientEnvOptions & {
53
- clientPrefix?: TPrefix;
54
- }): Promise<InferClientSchema<TSchema, TPrefix>>;
55
- /**
56
- * Create split server and client environment resolvers
57
- * @param schema Object with server and client schemas
58
- * @param options Configuration options
59
- * @returns Promise resolving to { server, client } environments
60
- */
61
- declare function resolveEnvSplit<TServerSchema extends SimpleEnvSchema, TClientSchema extends SimpleEnvSchema, TPrefix extends string = 'PUBLIC_'>(schema: {
62
- server: TServerSchema;
63
- client: TClientSchema;
64
- }, options?: EnvSplitOptions & {
65
- clientPrefix?: TPrefix;
66
- }): Promise<{
67
- server: InferSimpleSchema<TServerSchema>;
68
- client: InferSimpleSchema<TClientSchema>;
69
- }>;
70
-
71
- export { type ClientEnvOptions, type EnvSplitOptions, type EnvSplitSchema, resolveClientEnv, resolveEnvSplit };
package/dist/zod.d.cts DELETED
@@ -1,122 +0,0 @@
1
- import { a as Resolver, P as PolicyOptions, b as ReferenceOptions } from './types--RcOnfdl.cjs';
2
- import { SafeResolveResult } from './validation-types.cjs';
3
-
4
- /**
5
- * Zod integration for node-env-resolver
6
- * Import from 'node-env-resolver/zod' to use this
7
- */
8
-
9
- type ResolveZodOptions = {
10
- resolvers?: Resolver[];
11
- interpolate?: boolean;
12
- strict?: boolean;
13
- policies?: PolicyOptions;
14
- references?: ReferenceOptions;
15
- };
16
- type InferZodOutput<T> = T extends {
17
- parse: (input: unknown) => infer R;
18
- } ? R : never;
19
- /**
20
- * Resolve environment variables using Zod schema (throws on validation error)
21
- *
22
- * @example
23
- * ```ts
24
- * import { resolveZod } from 'node-env-resolver/zod';
25
- * import * as z from 'zod';
26
- *
27
- * const schema = z.object({
28
- * PORT: z.coerce.number().default(3000),
29
- * DATABASE_URL: z.string().url()
30
- * });
31
- *
32
- * const env = await resolveZod(schema);
33
- * console.log(env.PORT); // number
34
- * ```
35
- */
36
- declare function resolveZod<TSchema extends {
37
- parse: (input: unknown) => unknown;
38
- }>(zodSchema: TSchema, options?: ResolveZodOptions): Promise<InferZodOutput<TSchema>>;
39
- /**
40
- * Safe version - returns result object instead of throwing (unified error format)
41
- *
42
- * @example
43
- * ```ts
44
- * import { safeResolveZod } from 'node-env-resolver/zod';
45
- * import * as z from 'zod';
46
- *
47
- * const schema = z.object({
48
- * PORT: z.coerce.number(),
49
- * DATABASE_URL: z.string().url()
50
- * });
51
- *
52
- * const result = await safeResolveZod(schema);
53
- *
54
- * if (result.success) {
55
- * console.log(result.data.PORT);
56
- * } else {
57
- * console.error(result.error);
58
- * result.issues.forEach(issue => {
59
- * console.log(`${issue.path.join('.')}: ${issue.message}`);
60
- * });
61
- * }
62
- * ```
63
- */
64
- declare function safeResolveZod<TSchema extends {
65
- safeParse: (input: unknown) => {
66
- success: boolean;
67
- data?: unknown;
68
- error?: unknown;
69
- };
70
- }>(zodSchema: TSchema, options?: ResolveZodOptions): Promise<SafeResolveResult<InferZodOutput<TSchema>>>;
71
- /**
72
- * Sync version of resolveZod (throws on validation error)
73
- *
74
- * @example
75
- * ```ts
76
- * import { resolveSyncZod } from 'node-env-resolver/zod';
77
- * import * as z from 'zod';
78
- *
79
- * const schema = z.object({
80
- * PORT: z.coerce.number().default(3000)
81
- * });
82
- *
83
- * const env = resolveSyncZod(schema);
84
- * console.log(env.PORT);
85
- * ```
86
- */
87
- declare function resolveSyncZod<TSchema extends {
88
- parse: (input: unknown) => unknown;
89
- }>(zodSchema: TSchema, options?: ResolveZodOptions): InferZodOutput<TSchema>;
90
- /**
91
- * Safe sync version - returns result object instead of throwing (unified error format)
92
- *
93
- * @example
94
- * ```ts
95
- * import { safeResolveSyncZod } from 'node-env-resolver/zod';
96
- * import * as z from 'zod';
97
- *
98
- * const schema = z.object({
99
- * PORT: z.coerce.number()
100
- * });
101
- *
102
- * const result = safeResolveSyncZod(schema);
103
- *
104
- * if (result.success) {
105
- * console.log(result.data.PORT);
106
- * } else {
107
- * console.error(result.error);
108
- * result.issues.forEach(issue => {
109
- * console.log(`${issue.path.join('.')}: ${issue.message}`);
110
- * });
111
- * }
112
- * ```
113
- */
114
- declare function safeResolveSyncZod<TSchema extends {
115
- safeParse: (input: unknown) => {
116
- success: boolean;
117
- data?: unknown;
118
- error?: unknown;
119
- };
120
- }>(zodSchema: TSchema, options?: ResolveZodOptions): SafeResolveResult<InferZodOutput<TSchema>>;
121
-
122
- export { type InferZodOutput, resolveSyncZod, resolveZod, safeResolveSyncZod, safeResolveZod };