@proventuslabs/nestjs-zod 1.2.0 → 2.0.1

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.
package/README.md CHANGED
@@ -6,10 +6,9 @@ A collection of NestJS modules to integrate Zod v4 into your application with en
6
6
 
7
7
  - 🔧 **Zod-powered Configuration**: Type-safe configuration management using Zod schemas (v4)
8
8
  - 🌍 **Environment Variable Support**: Automatic parsing and validation of environment variables
9
- - 📁 **Configuration Files**: Support for YAML configuration files
10
9
  - 🏗️ **Configurable Modules**: Enhanced NestJS configurable modules with Zod validation
11
10
  - 🎯 **Type Safety**: Full TypeScript support with automatic type inference
12
- - 🔄 **Merge Strategy**: Environment variables override configuration file values
11
+ - 🔄 **Merge Strategy**: Environment variables override schema defaults
13
12
  - 📝 **Descriptive Errors**: Enhanced error messages with schema descriptions
14
13
 
15
14
  ## 📦 Installation
@@ -39,7 +38,7 @@ import { z } from "zod";
39
38
  const appConfig = registerConfig(
40
39
  "app",
41
40
  z.object({
42
- port: z.number().default(3000).describe("Server port"),
41
+ port: z.coerce.number<string | undefined>().default(3000).describe("Server port"),
43
42
  host: z.string().default("localhost").describe("Server host"),
44
43
  apiKey: z.string().describe("API key for external services"),
45
44
  }),
@@ -79,9 +78,9 @@ export class AppService {
79
78
 
80
79
  ## 🔧 Configuration and Options
81
80
 
82
- It comes out of the box with the support for env variables and yaml files.
81
+ It comes out of the box with the support for env variables.
83
82
 
84
- Priority order: **Environment Variables** > **YAML Files** > **Schema Defaults**
83
+ Priority order: **Environment Variables** > **Schema Defaults**
85
84
 
86
85
  ### Environment Variables
87
86
 
@@ -97,15 +96,6 @@ APP_DATABASE__HOST=localhost
97
96
  APP_DATABASE__PORT=5432
98
97
  ```
99
98
 
100
- ### Configuration Files
101
-
102
- Support for YAML files via environment variables:
103
-
104
- ```bash
105
- CONFIG_FILE=./config/app.yaml # Load from file
106
- CONFIG_CONTENT="..." # Inline YAML content
107
- ```
108
-
109
99
  ### Schema defaults
110
100
 
111
101
  ```typescript
@@ -114,8 +104,8 @@ const dbConfig = registerConfig(
114
104
  "database",
115
105
  z.object({
116
106
  host: z.string().default("localhost"),
117
- port: z.number().default(5432),
118
- ssl: z.boolean().default(false),
107
+ port: z.coerce.number<string | undefined>().default(5432),
108
+ ssl: z.coerce.boolean<string | undefined>().default(false),
119
109
  })
120
110
  );
121
111
  ```
@@ -135,6 +125,7 @@ registerConfig(namespace, zodSchema, options?)
135
125
  - `namespace`: Configuration namespace (camelCase)
136
126
  - `zodSchema`: Zod schema for validation
137
127
  - `options.whitelistKeys`: Environment variables to allow without namespace prefix
128
+ - `options.variables`: Environment variables to use (defaults `process.env`)
138
129
 
139
130
  #### Whitelist Keys
140
131
 
@@ -144,7 +135,7 @@ By default, only environment variables with the namespace prefix are processed.
144
135
  const appConfig = registerConfig(
145
136
  "app",
146
137
  z.object({
147
- port: z.number().default(3000),
138
+ port: z.coerce.number<string | undefined>().default(3000),
148
139
  apiKey: z.string().describe("API key from environment"),
149
140
  }),
150
141
  {
@@ -171,7 +162,7 @@ const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } =
171
162
  new ZodConfigurableModuleBuilder(
172
163
  z.object({
173
164
  apiKey: z.string(),
174
- baseUrl: z.string().url().default("https://api.example.com"),
165
+ baseUrl: z.url().default("https://api.example.com"),
175
166
  timeout: z.number().default(5000),
176
167
  })
177
168
  ).build();
@@ -233,7 +224,7 @@ constructor(
233
224
  const appConfig = registerConfig(
234
225
  "app",
235
226
  z.object({
236
- port: z.number().default(3000).describe("HTTP server port"),
227
+ port: z.coerce.number<string | undefined>().default(3000).describe("HTTP server port"),
237
228
  apiKey: z.string().describe("Third-party API authentication key"),
238
229
  }),
239
230
  { whitelistKeys: new Set(["API_KEY"]) }
@@ -1,5 +1,5 @@
1
1
  import { type ConfigObject, type ConfigType as NestConfigType } from "@nestjs/config";
2
- import type { CamelCase, JsonValue } from "type-fest";
2
+ import type { CamelCase } from "type-fest";
3
3
  import { type $ZodType } from "zod/v4/core";
4
4
  /**
5
5
  * Simple type alias for config namespace.
@@ -28,12 +28,6 @@ export type NamespacedConfigType<R extends ReturnType<typeof registerConfig<stri
28
28
  /**
29
29
  * Registers a config with the `ConfigModule.forFeature` for partial configuration under the provided namespace.
30
30
  *
31
- * This function handles configuration by validating and merging values from multiple sources:
32
- * - **Environment Variables:** Reads environment variables as JSON values, using the namespace prefix and validating them against the provided schema.
33
- * - **Configuration File:** Optionally reads configuration from a file or inline YAML content, specified by the `CONFIG_FILE` or `CONFIG_CONTENT` environment variables respectively.
34
- *
35
- * **Merge order is Config File < Enviornment Variables** thus enviornment variables _override_ whatever the config sets.
36
- *
37
31
  * @param namespace - The namespace of the config
38
32
  * @param configSchema - The schema of the config
39
33
  * @param whitelistKeys - Set of keys to be whitelisted and get passed to the schema as-is
@@ -51,7 +45,7 @@ export type NamespacedConfigType<R extends ReturnType<typeof registerConfig<stri
51
45
  * export type AppConfigNamespaced = NamespacedConfigType<typeof appConfig>;
52
46
  * export type AppConfig = ConfigType<typeof appConfig>;
53
47
  */
54
- export declare function registerConfig<N extends string, C extends ConfigObject, I extends JsonValue | unknown>(namespace: ConfigNamespace<N>, configSchema: $ZodType<C, I>, options?: {
48
+ export declare function registerConfig<N extends string, C extends ConfigObject, I extends Record<string, string | undefined>>(namespace: ConfigNamespace<N>, configSchema: $ZodType<C, I>, options?: {
55
49
  whitelistKeys?: Set<string>;
56
50
  variables?: Record<string, string | undefined>;
57
51
  }): import("@nestjs/config").ConfigFactory<C> & import("@nestjs/config").ConfigFactoryKeyHost<C | Promise<C>> & {
@@ -6,18 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.registerConfig = registerConfig;
7
7
  const node_process_1 = __importDefault(require("node:process"));
8
8
  const config_1 = require("@nestjs/config");
9
- const lodash_1 = require("lodash");
10
9
  const core_1 = require("zod/v4/core");
11
10
  const internal_1 = require("../internal");
12
11
  /**
13
12
  * Registers a config with the `ConfigModule.forFeature` for partial configuration under the provided namespace.
14
13
  *
15
- * This function handles configuration by validating and merging values from multiple sources:
16
- * - **Environment Variables:** Reads environment variables as JSON values, using the namespace prefix and validating them against the provided schema.
17
- * - **Configuration File:** Optionally reads configuration from a file or inline YAML content, specified by the `CONFIG_FILE` or `CONFIG_CONTENT` environment variables respectively.
18
- *
19
- * **Merge order is Config File < Enviornment Variables** thus enviornment variables _override_ whatever the config sets.
20
- *
21
14
  * @param namespace - The namespace of the config
22
15
  * @param configSchema - The schema of the config
23
16
  * @param whitelistKeys - Set of keys to be whitelisted and get passed to the schema as-is
@@ -39,8 +32,7 @@ function registerConfig(namespace, configSchema, options = {}) {
39
32
  const { variables = node_process_1.default.env, whitelistKeys } = options;
40
33
  const service = (0, config_1.registerAs)(namespace, async () => {
41
34
  const [decodedEnv, envKeys] = (0, internal_1.decodeVariables)(variables, namespace, whitelistKeys);
42
- const decodedConfig = (0, internal_1.decodeConfig)(variables.CONFIG_CONTENT, variables.CONFIG_FILE);
43
- const parsedConfig = await (0, core_1.safeParseAsync)(configSchema, (0, lodash_1.merge)({}, decodedConfig[namespace], decodedEnv[namespace]));
35
+ const parsedConfig = await (0, core_1.safeParseAsync)(configSchema, decodedEnv[namespace] ?? {});
44
36
  if (!parsedConfig.success)
45
37
  throw new TypeError(`Invalid config for "${namespace}":\n${(0, internal_1.typifyError)(configSchema, parsedConfig.error, namespace, envKeys)}`, { cause: parsedConfig.error });
46
38
  const config = parsedConfig.data;
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":";;;;;AAkEA,wCAqCC;AAvGD,gEAAmC;AAEnC,2CAAkG;AAElG,mCAA+B;AAE/B,sCAA4D;AAE5D,0CAAyE;AAgCzE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAgB,cAAc,CAK7B,SAA6B,EAC7B,YAA4B,EAC5B,UAGI,EAAE;IAEN,MAAM,EAAE,SAAS,GAAG,sBAAO,CAA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B,EAC5B,UAGI,EAAE;IAEN,MAAM,EAAE,SAAS,GAAG,sBAAO,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IAE3D,MAAM,OAAO,GAAG,IAAA,mBAAU,EAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,IAAA,0BAAe,EAAC,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAEnF,MAAM,YAAY,GAAG,MAAM,IAAA,qBAAc,EAAC,YAAY,EAAE,UAAU,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;QACrF,IAAI,CAAC,YAAY,CAAC,OAAO;YACxB,MAAM,IAAI,SAAS,CAClB,uBAAuB,SAAS,OAAO,IAAA,sBAAW,EAAC,YAAY,EAAE,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAC1G,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAC7B,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC;QAEjC,OAAO,MAAM,CAAC;IACf,CAAC,CAAwD,CAAC;IAE1D,mEAAmE;IACnE,OAAO,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE;QAClD,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC;AAED,kBAAe,cAAc,CAAC"}
@@ -1,15 +1,4 @@
1
- import type { JsonValue } from "type-fest";
2
1
  import { type $ZodError, type $ZodType, toJSONSchema } from "zod/v4/core";
3
- /**
4
- * Reads configuration from either a string content or a file path.
5
- * String content takes precedence over file path to avoid unnecessary filesystem operations.
6
- *
7
- * @param content - Optional string content in YAML format
8
- * @param file - Optional path to a configuration file
9
- * @returns The parsed configuration as a record of string keys to JSON values
10
- * @throws {Error} if neither content nor file contains a valid configuration object
11
- */
12
- export declare function decodeConfig(content?: string, file?: string): Record<string, JsonValue>;
13
2
  /**
14
3
  * Transforms environment variables from a flat structure with a specific namespace prefix
15
4
  * into a nested object structure with camelCase keys, while preserving the original keys
@@ -40,7 +29,7 @@ export declare function decodeConfig(content?: string, file?: string): Record<st
40
29
  * 1. The transformed nested configuration object
41
30
  * 2. A Map relating the transformed path keys to original environment variable names for error reporting
42
31
  */
43
- export declare function decodeVariables(variables: Record<string, string | undefined>, namespace: string, whitelistKeys?: Set<string | number | symbol>, jsonify?: (value: string | undefined) => JsonValue | undefined): readonly [Record<string, JsonValue | undefined>, Map<string, string>];
32
+ export declare function decodeVariables(variables: Record<string, string | undefined>, namespace: string, whitelistKeys?: Set<string | number | symbol>): readonly [Record<string, string | undefined>, Map<string, string>];
44
33
  /**
45
34
  * Converts a Zod validation error into a formatted TypeError with enhanced context.
46
35
  *
package/dist/internal.js CHANGED
@@ -1,77 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.typifyError = void 0;
7
- exports.decodeConfig = decodeConfig;
8
4
  exports.decodeVariables = decodeVariables;
9
- const node_fs_1 = __importDefault(require("node:fs"));
10
5
  const lodash_1 = require("lodash");
11
- const yaml_1 = __importDefault(require("yaml"));
12
6
  const core_1 = require("zod/v4/core");
13
- /**
14
- * Raw content of the config file as UTF-8.
15
- */
16
- let cachedConfigFileContent;
17
- /**
18
- * Parsed YAML file - unknown as we don't know what shape it will have until we validate it.
19
- */
20
- let parsedConfigFileContent;
21
- /**
22
- * Parses a string content into a JavaScript object using YAML parser.
23
- * Uses a cached result if the content has been parsed before.
24
- *
25
- * @param content - The string content in YAML format to parse
26
- * @returns The parsed JavaScript object representation of the YAML content
27
- */
28
- function parseConfig(content) {
29
- if (!(0, lodash_1.isUndefined)(parsedConfigFileContent))
30
- return parsedConfigFileContent;
31
- parsedConfigFileContent = yaml_1.default.parse(content);
32
- return parsedConfigFileContent;
33
- }
34
- /**
35
- * Reads and parses a configuration file from the filesystem.
36
- * Uses cached file content if available to prevent multiple filesystem reads.
37
- *
38
- * @param path - The path to the configuration file
39
- * @returns The parsed JavaScript object representation of the file
40
- * @throws {Error} if the file cannot be read or parsed
41
- */
42
- function parseConfigFile(path) {
43
- try {
44
- if (!(0, lodash_1.isString)(cachedConfigFileContent))
45
- cachedConfigFileContent = node_fs_1.default.readFileSync(path).toString("utf8");
46
- return parseConfig(cachedConfigFileContent);
47
- }
48
- catch (err) {
49
- const message = err instanceof Error ? err.message : new String(err).toString();
50
- throw new Error(`Unable to open the config file provided: ${message}`, {
51
- cause: err,
52
- });
53
- }
54
- }
55
- /**
56
- * Reads configuration from either a string content or a file path.
57
- * String content takes precedence over file path to avoid unnecessary filesystem operations.
58
- *
59
- * @param content - Optional string content in YAML format
60
- * @param file - Optional path to a configuration file
61
- * @returns The parsed configuration as a record of string keys to JSON values
62
- * @throws {Error} if neither content nor file contains a valid configuration object
63
- */
64
- function decodeConfig(content, file) {
65
- let readConfig = {};
66
- // NOTE: `content` takes precedence over a `file` (to avoid a file system read in case of both)
67
- if ((0, lodash_1.isString)(content))
68
- readConfig = parseConfig(content);
69
- else if ((0, lodash_1.isString)(file))
70
- readConfig = parseConfigFile(file);
71
- if (!(0, lodash_1.isObjectLike)(readConfig))
72
- throw new Error(`Config file provided must contain the JSON configuration object`);
73
- return readConfig;
74
- }
75
7
  /**
76
8
  * Transforms environment variable keys into nested object notation starting from the provided namespace.
77
9
  * For example, transforms "APP_SERVER__HOST" into "app.server.host" using camelCase ("APP" was the env namespace).
@@ -87,21 +19,6 @@ function nestedConventionNamespaced(envKey, envNamespace) {
87
19
  .replace(/__/g, ".")
88
20
  .replace(/[a-z_]+/g, (word) => (0, lodash_1.camelCase)(word));
89
21
  }
90
- /**
91
- * Attempts to parse a string value as JSON, falling back to the original string if parsing fails.
92
- * Used for converting environment variables that might contain JSON values to mimic config file read from ENVs as well.
93
- *
94
- * @param value - The string value to parse as JSON
95
- * @returns The parsed JSON value or the original string if parsing fails
96
- */
97
- function jsonParse(value) {
98
- try {
99
- return JSON.parse(value ?? "");
100
- }
101
- catch {
102
- return value;
103
- }
104
- }
105
22
  /**
106
23
  * Transforms environment variables from a flat structure with a specific namespace prefix
107
24
  * into a nested object structure with camelCase keys, while preserving the original keys
@@ -132,7 +49,7 @@ function jsonParse(value) {
132
49
  * 1. The transformed nested configuration object
133
50
  * 2. A Map relating the transformed path keys to original environment variable names for error reporting
134
51
  */
135
- function decodeVariables(variables, namespace, whitelistKeys = new Set(), jsonify = jsonParse) {
52
+ function decodeVariables(variables, namespace, whitelistKeys = new Set()) {
136
53
  const envKeys = new Map();
137
54
  const envNamespace = (0, lodash_1.snakeCase)(namespace).toUpperCase();
138
55
  const relevantEnv = (0, lodash_1.pickBy)(variables, (_value, key) => key.startsWith(envNamespace) || whitelistKeys.has(key));
@@ -141,8 +58,7 @@ function decodeVariables(variables, namespace, whitelistKeys = new Set(), jsonif
141
58
  key = `${envNamespace}_${key}`;
142
59
  const newKey = nestedConventionNamespaced(key, envNamespace);
143
60
  envKeys.set(newKey, key);
144
- const newValue = jsonify(value);
145
- return (0, lodash_1.set)(env, newKey, newValue);
61
+ return (0, lodash_1.set)(env, newKey, value);
146
62
  }, {});
147
63
  return [decodedEnv, envKeys];
148
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":";;;;;;AAyEA,oCAUC;AA+DD,0CA0BC;AA5KD,sDAAyB;AAEzB,mCAYgB;AAEhB,gDAAwB;AACxB,sCAAqF;AAErF;;GAEG;AACH,IAAI,uBAA2C,CAAC;AAChD;;GAEG;AACH,IAAI,uBAA4C,CAAC;AAEjD;;;;;;GAMG;AACH,SAAS,WAAW,CAAC,OAAe;IACnC,IAAI,CAAC,IAAA,oBAAW,EAAC,uBAAuB,CAAC;QAAE,OAAO,uBAAuB,CAAC;IAE1E,uBAAuB,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AAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAEjE,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,GAAG,GAAG,GAAG,WAAW,EAAE,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC,CAAC;AAnCW,QAAA,WAAW,eAmCtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proventuslabs/nestjs-zod",
3
- "version": "1.2.0",
3
+ "version": "2.0.1",
4
4
  "license": "MIT",
5
5
  "description": "A collection of NestJS modules to integrate Zod into your application.",
6
6
  "keywords": [
@@ -38,8 +38,7 @@
38
38
  "test:coverage:watch": "jest --coverage --watch"
39
39
  },
40
40
  "dependencies": {
41
- "lodash": "^4.17.21",
42
- "yaml": "^2.8.0"
41
+ "lodash": "^4.17.21"
43
42
  },
44
43
  "peerDependencies": {
45
44
  "@nestjs/common": "^10.0.0 || ^11.0.0",