zodified-config 1.0.6 → 2.1.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.
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ const validate = (schema) => {
18
18
  try {
19
19
  const result = schema.safeParse(config_1.default);
20
20
  if (result.success === false) {
21
- throw new ZodValidationError('INVALID_CONFIG', result.error.errors);
21
+ throw new ZodValidationError('INVALID_CONFIG', result.error.issues);
22
22
  }
23
23
  return true;
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zodified-config",
3
- "version": "1.0.6",
3
+ "version": "2.1.0",
4
4
  "description": "Typesafe config validated by Zod",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "config": "^3.3.12",
26
- "zod": "^3.23.8"
26
+ "zod": "^4.1.5"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@eslint/js": "^9.22.0",
package/LICENCE.md DELETED
@@ -1,16 +0,0 @@
1
- MIT No Attribution
2
-
3
- Copyright 2025 Jonathan Fielding
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this
6
- software and associated documentation files (the "Software"), to deal in the Software
7
- without restriction, including without limitation the rights to use, copy, modify,
8
- merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
9
- permit persons to whom the Software is furnished to do so.
10
-
11
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
12
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
13
- PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
14
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
15
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
16
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md DELETED
@@ -1,56 +0,0 @@
1
- # Zodified Config
2
-
3
- Typesafe config validated by Zod 🎉
4
-
5
- ## Install
6
-
7
- You can install `zodified-config` from NPM using your prefered package manage.
8
-
9
- For npm you can install as follows:
10
-
11
- ```
12
- npm i zodified-config
13
- ```
14
-
15
- ## Usage
16
-
17
- To use zodified-config, please follow the 3 steps explained below:
18
-
19
- ### 1. Defining your schema
20
- ```ts
21
- // src/schema.ts
22
- import z from 'zod';
23
-
24
- export const configSchema = z.object({
25
- value: z.string()
26
- });
27
-
28
- export type Config = z.infer<typeof configSchema>;
29
- ```
30
-
31
- ### 2. Validating your config
32
-
33
- ```ts
34
- // src/index.ts
35
- import config from 'zodified-config'
36
- import type { Config } from './schema'
37
-
38
- declare module 'zodified-config' {
39
- interface ValidatedConfig extends Config {}
40
- }
41
-
42
- try {
43
- zodifiedConfig.validate(invalidSchema);
44
- } catch (error: unknown) {
45
- // if you enter here, it means the config is invalid or something else went wrong
46
- // check the error.message
47
- }
48
- ```
49
-
50
- ### 3. Accessing configuration values
51
- ```ts
52
- // file other.ts
53
- import config from 'zodified-config'
54
-
55
- config.get('value');
56
- ```