@xylabs/zod 5.0.94 → 5.0.96
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 +158 -324
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/zodAllFactory.d.ts +1 -7
- package/dist/neutral/zodAllFactory.d.ts.map +1 -1
- package/package.json +11 -12
package/README.md
CHANGED
|
@@ -1,67 +1,59 @@
|
|
|
1
1
|
# @xylabs/zod
|
|
2
2
|
|
|
3
|
-
[![
|
|
3
|
+
[![npm][npm-badge]][npm-link]
|
|
4
|
+
[![license][license-badge]][license-link]
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
[![npm-badge][]][npm-link]
|
|
7
|
-
[![npm-downloads-badge][]][npm-link]
|
|
8
|
-
[![jsdelivr-badge][]][jsdelivr-link]
|
|
9
|
-
[![npm-license-badge][]](LICENSE)
|
|
10
|
-
[![codacy-badge][]][codacy-link]
|
|
11
|
-
[![codeclimate-badge][]][codeclimate-link]
|
|
12
|
-
[![snyk-badge][]][snyk-link]
|
|
13
|
-
[![socket-badge][]][socket-link]
|
|
6
|
+
> Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
14
7
|
|
|
8
|
+
## Install
|
|
15
9
|
|
|
16
|
-
|
|
10
|
+
Using npm:
|
|
17
11
|
|
|
12
|
+
```sh
|
|
13
|
+
npm install {{name}}
|
|
14
|
+
```
|
|
18
15
|
|
|
16
|
+
Using yarn:
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
```sh
|
|
19
|
+
yarn add {{name}}
|
|
20
|
+
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Using pnpm:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
```sh
|
|
25
|
+
pnpm add {{name}}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Using bun:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
bun add {{name}}
|
|
32
|
+
```
|
|
25
33
|
|
|
26
|
-
## Interfaces
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
31
38
|
|
|
32
|
-
##
|
|
39
|
+
## Reference
|
|
33
40
|
|
|
34
|
-
|
|
35
|
-
| ------ | ------ |
|
|
36
|
-
| [ZodFactoryConfig](#type-aliases/ZodFactoryConfig) | Configuration for zod factory assertion behavior, either an AssertConfig or a named config object. |
|
|
37
|
-
| [AllZodFactories](#type-aliases/AllZodFactories) | - |
|
|
41
|
+
### packages
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
### zod
|
|
40
44
|
|
|
41
|
-
|
|
42
|
-
| ------ | ------ |
|
|
43
|
-
| [zodAllFactory](#functions/zodAllFactory) | Creates a bundle of `is`, `as`, and `to` factory functions for a given zod schema. |
|
|
44
|
-
| [zodAsAsyncFactory](#functions/zodAsAsyncFactory) | Creates an async function that validates a value against a zod schema and returns it with a narrowed type. Uses `safeParseAsync` for schemas with async refinements. When called without an assert config, returns undefined on failure. |
|
|
45
|
-
| [zodAsFactory](#functions/zodAsFactory) | Creates a function that validates a value against a zod schema and returns it with a narrowed type. When called without an assert config, returns undefined on failure. When called with an assert config, throws on failure. |
|
|
46
|
-
| [zodIsFactory](#functions/zodIsFactory) | Creates a type guard function that checks if a value matches a zod schema. |
|
|
47
|
-
| [zodToAsyncFactory](#functions/zodToAsyncFactory) | Creates an async function that converts a value to the zod schema type, delegating to `zodAsAsyncFactory` internally. Provides overloads for optional assertion: without assert config resolves to undefined on failure, with assert config throws on failure. |
|
|
48
|
-
| [zodToFactory](#functions/zodToFactory) | Creates a function that converts a value to the zod schema type, delegating to `zodAsFactory` internally. Provides overloads for optional assertion: without assert config returns undefined on failure, with assert config throws on failure. |
|
|
45
|
+
### .temp-typedoc
|
|
49
46
|
|
|
50
|
-
### functions
|
|
47
|
+
### functions
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
### <a id="zodAllFactory"></a>zodAllFactory
|
|
53
50
|
|
|
54
51
|
[**@xylabs/zod**](#../README)
|
|
55
52
|
|
|
56
53
|
***
|
|
57
54
|
|
|
58
55
|
```ts
|
|
59
|
-
function zodAllFactory<T, TName>(zod
|
|
60
|
-
[key: string]: {
|
|
61
|
-
<T> (value: T): T & T | undefined;
|
|
62
|
-
<T> (value: T, assert: ZodFactoryConfig): T & T;
|
|
63
|
-
};
|
|
64
|
-
};
|
|
56
|
+
function zodAllFactory<T, TName>(zod, name): object;
|
|
65
57
|
```
|
|
66
58
|
|
|
67
59
|
**`Alpha`**
|
|
@@ -70,41 +62,44 @@ Creates a bundle of `is`, `as`, and `to` factory functions for a given zod schem
|
|
|
70
62
|
|
|
71
63
|
## Type Parameters
|
|
72
64
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
### T
|
|
66
|
+
|
|
67
|
+
`T`
|
|
68
|
+
|
|
69
|
+
### TName
|
|
70
|
+
|
|
71
|
+
`TName` *extends* `string`
|
|
77
72
|
|
|
78
73
|
## Parameters
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
### zod
|
|
76
|
+
|
|
77
|
+
`ZodType`\<`T`\>
|
|
78
|
+
|
|
79
|
+
The zod schema to validate against
|
|
80
|
+
|
|
81
|
+
### name
|
|
82
|
+
|
|
83
|
+
`TName`
|
|
84
|
+
|
|
85
|
+
The name used to suffix the generated function names (e.g. 'Address' produces `isAddress`, `asAddress`, `toAddress`)
|
|
84
86
|
|
|
85
87
|
## Returns
|
|
86
88
|
|
|
87
|
-
|
|
88
|
-
{
|
|
89
|
-
[key: string]: {
|
|
90
|
-
<T> (value: T): T & T | undefined;
|
|
91
|
-
<T> (value: T, assert: ZodFactoryConfig): T & T;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
```
|
|
89
|
+
`object`
|
|
95
90
|
|
|
96
91
|
An object containing `is<Name>`, `as<Name>`, and `to<Name>` functions
|
|
97
92
|
|
|
98
|
-
|
|
93
|
+
### <a id="zodAsAsyncFactory"></a>zodAsAsyncFactory
|
|
99
94
|
|
|
100
95
|
[**@xylabs/zod**](#../README)
|
|
101
96
|
|
|
102
97
|
***
|
|
103
98
|
|
|
104
99
|
```ts
|
|
105
|
-
function zodAsAsyncFactory<TZod>(zod
|
|
106
|
-
<T> (value
|
|
107
|
-
<T> (value
|
|
100
|
+
function zodAsAsyncFactory<TZod>(zod, name): {
|
|
101
|
+
<T> (value): Promise<T & TZod | undefined>;
|
|
102
|
+
<T> (value, assert): Promise<T & TZod>;
|
|
108
103
|
};
|
|
109
104
|
```
|
|
110
105
|
|
|
@@ -113,72 +108,43 @@ Uses `safeParseAsync` for schemas with async refinements. When called without an
|
|
|
113
108
|
|
|
114
109
|
## Type Parameters
|
|
115
110
|
|
|
116
|
-
|
|
117
|
-
| ------ |
|
|
118
|
-
| `TZod` |
|
|
111
|
+
### TZod
|
|
119
112
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
| Parameter | Type | Description |
|
|
123
|
-
| ------ | ------ | ------ |
|
|
124
|
-
| `zod` | `ZodType`\<`TZod`\> | The zod schema to validate against |
|
|
125
|
-
| `name` | `string` | A name used in error messages for identification |
|
|
126
|
-
|
|
127
|
-
## Returns
|
|
113
|
+
`TZod`
|
|
128
114
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
<T>(value: T): Promise<T & TZod | undefined>;
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Type Parameters
|
|
136
|
-
|
|
137
|
-
| Type Parameter |
|
|
138
|
-
| ------ |
|
|
139
|
-
| `T` |
|
|
140
|
-
|
|
141
|
-
### Parameters
|
|
142
|
-
|
|
143
|
-
| Parameter | Type |
|
|
144
|
-
| ------ | ------ |
|
|
145
|
-
| `value` | `T` |
|
|
115
|
+
## Parameters
|
|
146
116
|
|
|
147
|
-
###
|
|
117
|
+
### zod
|
|
148
118
|
|
|
149
|
-
`
|
|
119
|
+
`ZodType`\<`TZod`\>
|
|
150
120
|
|
|
151
|
-
|
|
152
|
-
<T>(value: T, assert: ZodFactoryConfig): Promise<T & TZod>;
|
|
153
|
-
```
|
|
121
|
+
The zod schema to validate against
|
|
154
122
|
|
|
155
|
-
###
|
|
123
|
+
### name
|
|
156
124
|
|
|
157
|
-
|
|
158
|
-
| ------ |
|
|
159
|
-
| `T` |
|
|
125
|
+
`string`
|
|
160
126
|
|
|
161
|
-
|
|
127
|
+
A name used in error messages for identification
|
|
162
128
|
|
|
163
|
-
|
|
164
|
-
| ------ | ------ |
|
|
165
|
-
| `value` | `T` |
|
|
166
|
-
| `assert` | [`ZodFactoryConfig`](#../type-aliases/ZodFactoryConfig) |
|
|
129
|
+
## Returns
|
|
167
130
|
|
|
168
|
-
|
|
131
|
+
An async function that validates and narrows the type of a value
|
|
169
132
|
|
|
170
|
-
|
|
133
|
+
\{
|
|
134
|
+
\<`T`\> (`value`): `Promise`\<`T` & `TZod` \| `undefined`\>;
|
|
135
|
+
\<`T`\> (`value`, `assert`): `Promise`\<`T` & `TZod`\>;
|
|
136
|
+
\}
|
|
171
137
|
|
|
172
|
-
|
|
138
|
+
### <a id="zodAsFactory"></a>zodAsFactory
|
|
173
139
|
|
|
174
140
|
[**@xylabs/zod**](#../README)
|
|
175
141
|
|
|
176
142
|
***
|
|
177
143
|
|
|
178
144
|
```ts
|
|
179
|
-
function zodAsFactory<TZod>(zod
|
|
180
|
-
<T> (value
|
|
181
|
-
<T> (value
|
|
145
|
+
function zodAsFactory<TZod>(zod, name): {
|
|
146
|
+
<T> (value): T & TZod | undefined;
|
|
147
|
+
<T> (value, assert): T & TZod;
|
|
182
148
|
};
|
|
183
149
|
```
|
|
184
150
|
|
|
@@ -187,120 +153,75 @@ When called without an assert config, returns undefined on failure. When called
|
|
|
187
153
|
|
|
188
154
|
## Type Parameters
|
|
189
155
|
|
|
190
|
-
|
|
191
|
-
| ------ |
|
|
192
|
-
| `TZod` |
|
|
193
|
-
|
|
194
|
-
## Parameters
|
|
195
|
-
|
|
196
|
-
| Parameter | Type | Description |
|
|
197
|
-
| ------ | ------ | ------ |
|
|
198
|
-
| `zod` | `ZodType`\<`TZod`\> | The zod schema to validate against |
|
|
199
|
-
| `name` | `string` | A name used in error messages for identification |
|
|
200
|
-
|
|
201
|
-
## Returns
|
|
202
|
-
|
|
203
|
-
A function that validates and narrows the type of a value
|
|
204
|
-
|
|
205
|
-
```ts
|
|
206
|
-
<T>(value: T): T & TZod | undefined;
|
|
207
|
-
```
|
|
156
|
+
### TZod
|
|
208
157
|
|
|
209
|
-
|
|
158
|
+
`TZod`
|
|
210
159
|
|
|
211
|
-
|
|
212
|
-
| ------ |
|
|
213
|
-
| `T` |
|
|
160
|
+
## Parameters
|
|
214
161
|
|
|
215
|
-
###
|
|
162
|
+
### zod
|
|
216
163
|
|
|
217
|
-
|
|
218
|
-
| ------ | ------ |
|
|
219
|
-
| `value` | `T` |
|
|
164
|
+
`ZodType`\<`TZod`\>
|
|
220
165
|
|
|
221
|
-
|
|
166
|
+
The zod schema to validate against
|
|
222
167
|
|
|
223
|
-
|
|
168
|
+
### name
|
|
224
169
|
|
|
225
|
-
|
|
226
|
-
<T>(value: T, assert: ZodFactoryConfig): T & TZod;
|
|
227
|
-
```
|
|
170
|
+
`string`
|
|
228
171
|
|
|
229
|
-
|
|
172
|
+
A name used in error messages for identification
|
|
230
173
|
|
|
231
|
-
|
|
232
|
-
| ------ |
|
|
233
|
-
| `T` |
|
|
234
|
-
|
|
235
|
-
### Parameters
|
|
236
|
-
|
|
237
|
-
| Parameter | Type |
|
|
238
|
-
| ------ | ------ |
|
|
239
|
-
| `value` | `T` |
|
|
240
|
-
| `assert` | [`ZodFactoryConfig`](#../type-aliases/ZodFactoryConfig) |
|
|
174
|
+
## Returns
|
|
241
175
|
|
|
242
|
-
|
|
176
|
+
A function that validates and narrows the type of a value
|
|
243
177
|
|
|
244
|
-
|
|
178
|
+
\{
|
|
179
|
+
\<`T`\> (`value`): `T` & `TZod` \| `undefined`;
|
|
180
|
+
\<`T`\> (`value`, `assert`): `T` & `TZod`;
|
|
181
|
+
\}
|
|
245
182
|
|
|
246
|
-
|
|
183
|
+
### <a id="zodIsFactory"></a>zodIsFactory
|
|
247
184
|
|
|
248
185
|
[**@xylabs/zod**](#../README)
|
|
249
186
|
|
|
250
187
|
***
|
|
251
188
|
|
|
252
189
|
```ts
|
|
253
|
-
function zodIsFactory<TZod>(zod
|
|
190
|
+
function zodIsFactory<TZod>(zod): <T>(value) => value is T & TZod;
|
|
254
191
|
```
|
|
255
192
|
|
|
256
193
|
Creates a type guard function that checks if a value matches a zod schema.
|
|
257
194
|
|
|
258
195
|
## Type Parameters
|
|
259
196
|
|
|
260
|
-
|
|
261
|
-
| ------ |
|
|
262
|
-
| `TZod` |
|
|
197
|
+
### TZod
|
|
263
198
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
| Parameter | Type | Description |
|
|
267
|
-
| ------ | ------ | ------ |
|
|
268
|
-
| `zod` | `ZodType`\<`TZod`\> | The zod schema to validate against |
|
|
199
|
+
`TZod`
|
|
269
200
|
|
|
270
|
-
##
|
|
271
|
-
|
|
272
|
-
A type guard function that returns true if the value passes validation
|
|
273
|
-
|
|
274
|
-
```ts
|
|
275
|
-
<T>(value: T): value is T & TZod;
|
|
276
|
-
```
|
|
201
|
+
## Parameters
|
|
277
202
|
|
|
278
|
-
###
|
|
203
|
+
### zod
|
|
279
204
|
|
|
280
|
-
|
|
281
|
-
| ------ |
|
|
282
|
-
| `T` |
|
|
205
|
+
`ZodType`\<`TZod`\>
|
|
283
206
|
|
|
284
|
-
|
|
207
|
+
The zod schema to validate against
|
|
285
208
|
|
|
286
|
-
|
|
287
|
-
| ------ | ------ |
|
|
288
|
-
| `value` | `T` |
|
|
209
|
+
## Returns
|
|
289
210
|
|
|
290
|
-
|
|
211
|
+
A type guard function that returns true if the value passes validation
|
|
291
212
|
|
|
292
|
-
`value is T & TZod`
|
|
213
|
+
\<`T`\>(`value`) => `value is T & TZod`
|
|
293
214
|
|
|
294
|
-
|
|
215
|
+
### <a id="zodToAsyncFactory"></a>zodToAsyncFactory
|
|
295
216
|
|
|
296
217
|
[**@xylabs/zod**](#../README)
|
|
297
218
|
|
|
298
219
|
***
|
|
299
220
|
|
|
300
221
|
```ts
|
|
301
|
-
function zodToAsyncFactory<TZod>(zod
|
|
302
|
-
<T> (value
|
|
303
|
-
<T> (value
|
|
222
|
+
function zodToAsyncFactory<TZod>(zod, name): {
|
|
223
|
+
<T> (value): Promise<T & TZod | undefined>;
|
|
224
|
+
<T> (value, assert): Promise<T & TZod>;
|
|
304
225
|
};
|
|
305
226
|
```
|
|
306
227
|
|
|
@@ -309,72 +230,43 @@ Provides overloads for optional assertion: without assert config resolves to und
|
|
|
309
230
|
|
|
310
231
|
## Type Parameters
|
|
311
232
|
|
|
312
|
-
|
|
313
|
-
| ------ |
|
|
314
|
-
| `TZod` |
|
|
315
|
-
|
|
316
|
-
## Parameters
|
|
317
|
-
|
|
318
|
-
| Parameter | Type | Description |
|
|
319
|
-
| ------ | ------ | ------ |
|
|
320
|
-
| `zod` | `ZodType`\<`TZod`\> | The zod schema to validate against |
|
|
321
|
-
| `name` | `string` | A name used in error messages for identification |
|
|
322
|
-
|
|
323
|
-
## Returns
|
|
324
|
-
|
|
325
|
-
An async function that validates and converts a value to the schema type
|
|
326
|
-
|
|
327
|
-
```ts
|
|
328
|
-
<T>(value: T): Promise<T & TZod | undefined>;
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Type Parameters
|
|
233
|
+
### TZod
|
|
332
234
|
|
|
333
|
-
|
|
334
|
-
| ------ |
|
|
335
|
-
| `T` |
|
|
235
|
+
`TZod`
|
|
336
236
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
| Parameter | Type |
|
|
340
|
-
| ------ | ------ |
|
|
341
|
-
| `value` | `T` |
|
|
237
|
+
## Parameters
|
|
342
238
|
|
|
343
|
-
###
|
|
239
|
+
### zod
|
|
344
240
|
|
|
345
|
-
`
|
|
241
|
+
`ZodType`\<`TZod`\>
|
|
346
242
|
|
|
347
|
-
|
|
348
|
-
<T>(value: T, assert: ZodFactoryConfig): Promise<T & TZod>;
|
|
349
|
-
```
|
|
243
|
+
The zod schema to validate against
|
|
350
244
|
|
|
351
|
-
###
|
|
245
|
+
### name
|
|
352
246
|
|
|
353
|
-
|
|
354
|
-
| ------ |
|
|
355
|
-
| `T` |
|
|
247
|
+
`string`
|
|
356
248
|
|
|
357
|
-
|
|
249
|
+
A name used in error messages for identification
|
|
358
250
|
|
|
359
|
-
|
|
360
|
-
| ------ | ------ |
|
|
361
|
-
| `value` | `T` |
|
|
362
|
-
| `assert` | [`ZodFactoryConfig`](#../type-aliases/ZodFactoryConfig) |
|
|
251
|
+
## Returns
|
|
363
252
|
|
|
364
|
-
|
|
253
|
+
An async function that validates and converts a value to the schema type
|
|
365
254
|
|
|
366
|
-
|
|
255
|
+
\{
|
|
256
|
+
\<`T`\> (`value`): `Promise`\<`T` & `TZod` \| `undefined`\>;
|
|
257
|
+
\<`T`\> (`value`, `assert`): `Promise`\<`T` & `TZod`\>;
|
|
258
|
+
\}
|
|
367
259
|
|
|
368
|
-
|
|
260
|
+
### <a id="zodToFactory"></a>zodToFactory
|
|
369
261
|
|
|
370
262
|
[**@xylabs/zod**](#../README)
|
|
371
263
|
|
|
372
264
|
***
|
|
373
265
|
|
|
374
266
|
```ts
|
|
375
|
-
function zodToFactory<TZod>(zod
|
|
376
|
-
<T> (value
|
|
377
|
-
<T> (value
|
|
267
|
+
function zodToFactory<TZod>(zod, name): {
|
|
268
|
+
<T> (value): T & TZod | undefined;
|
|
269
|
+
<T> (value, assert): T & TZod;
|
|
378
270
|
};
|
|
379
271
|
```
|
|
380
272
|
|
|
@@ -383,65 +275,36 @@ Provides overloads for optional assertion: without assert config returns undefin
|
|
|
383
275
|
|
|
384
276
|
## Type Parameters
|
|
385
277
|
|
|
386
|
-
|
|
387
|
-
| ------ |
|
|
388
|
-
| `TZod` |
|
|
389
|
-
|
|
390
|
-
## Parameters
|
|
391
|
-
|
|
392
|
-
| Parameter | Type | Description |
|
|
393
|
-
| ------ | ------ | ------ |
|
|
394
|
-
| `zod` | `ZodType`\<`TZod`\> | The zod schema to validate against |
|
|
395
|
-
| `name` | `string` | A name used in error messages for identification |
|
|
396
|
-
|
|
397
|
-
## Returns
|
|
398
|
-
|
|
399
|
-
A function that validates and converts a value to the schema type
|
|
400
|
-
|
|
401
|
-
```ts
|
|
402
|
-
<T>(value: T): T & TZod | undefined;
|
|
403
|
-
```
|
|
278
|
+
### TZod
|
|
404
279
|
|
|
405
|
-
|
|
280
|
+
`TZod`
|
|
406
281
|
|
|
407
|
-
|
|
408
|
-
| ------ |
|
|
409
|
-
| `T` |
|
|
282
|
+
## Parameters
|
|
410
283
|
|
|
411
|
-
###
|
|
284
|
+
### zod
|
|
412
285
|
|
|
413
|
-
|
|
414
|
-
| ------ | ------ |
|
|
415
|
-
| `value` | `T` |
|
|
286
|
+
`ZodType`\<`TZod`\>
|
|
416
287
|
|
|
417
|
-
|
|
288
|
+
The zod schema to validate against
|
|
418
289
|
|
|
419
|
-
|
|
290
|
+
### name
|
|
420
291
|
|
|
421
|
-
|
|
422
|
-
<T>(value: T, assert: ZodFactoryConfig): T & TZod;
|
|
423
|
-
```
|
|
292
|
+
`string`
|
|
424
293
|
|
|
425
|
-
|
|
294
|
+
A name used in error messages for identification
|
|
426
295
|
|
|
427
|
-
|
|
428
|
-
| ------ |
|
|
429
|
-
| `T` |
|
|
430
|
-
|
|
431
|
-
### Parameters
|
|
432
|
-
|
|
433
|
-
| Parameter | Type |
|
|
434
|
-
| ------ | ------ |
|
|
435
|
-
| `value` | `T` |
|
|
436
|
-
| `assert` | [`ZodFactoryConfig`](#../type-aliases/ZodFactoryConfig) |
|
|
296
|
+
## Returns
|
|
437
297
|
|
|
438
|
-
|
|
298
|
+
A function that validates and converts a value to the schema type
|
|
439
299
|
|
|
440
|
-
|
|
300
|
+
\{
|
|
301
|
+
\<`T`\> (`value`): `T` & `TZod` \| `undefined`;
|
|
302
|
+
\<`T`\> (`value`, `assert`): `T` & `TZod`;
|
|
303
|
+
\}
|
|
441
304
|
|
|
442
|
-
### interfaces
|
|
305
|
+
### interfaces
|
|
443
306
|
|
|
444
|
-
|
|
307
|
+
### <a id="ZodFactoryConfigObject"></a>ZodFactoryConfigObject
|
|
445
308
|
|
|
446
309
|
[**@xylabs/zod**](#../README)
|
|
447
310
|
|
|
@@ -451,32 +314,37 @@ Configuration object for zod factory functions, providing a name for error messa
|
|
|
451
314
|
|
|
452
315
|
## Properties
|
|
453
316
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
317
|
+
### name
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
name: string;
|
|
321
|
+
```
|
|
457
322
|
|
|
458
|
-
### type-aliases
|
|
323
|
+
### type-aliases
|
|
459
324
|
|
|
460
|
-
|
|
325
|
+
### <a id="AllZodFactories"></a>AllZodFactories
|
|
461
326
|
|
|
462
327
|
[**@xylabs/zod**](#../README)
|
|
463
328
|
|
|
464
329
|
***
|
|
465
330
|
|
|
466
331
|
```ts
|
|
467
|
-
type AllZodFactories<TType, TName> =
|
|
332
|
+
type AllZodFactories<TType, TName> = Record<`is${TName}`, ReturnType<typeof zodIsFactory>> & Record<`as${TName}`, ReturnType<typeof zodAsFactory>> & Record<`to${TName}`, ReturnType<typeof zodToFactory>>;
|
|
468
333
|
```
|
|
469
334
|
|
|
470
335
|
**`Alpha`**
|
|
471
336
|
|
|
472
337
|
## Type Parameters
|
|
473
338
|
|
|
474
|
-
|
|
475
|
-
| ------ |
|
|
476
|
-
| `TType` |
|
|
477
|
-
| `TName` *extends* `string` |
|
|
339
|
+
### TType
|
|
478
340
|
|
|
479
|
-
|
|
341
|
+
`TType`
|
|
342
|
+
|
|
343
|
+
### TName
|
|
344
|
+
|
|
345
|
+
`TName` *extends* `string`
|
|
346
|
+
|
|
347
|
+
### <a id="ZodFactoryConfig"></a>ZodFactoryConfig
|
|
480
348
|
|
|
481
349
|
[**@xylabs/zod**](#../README)
|
|
482
350
|
|
|
@@ -491,41 +359,7 @@ type ZodFactoryConfig =
|
|
|
491
359
|
Configuration for zod factory assertion behavior, either an AssertConfig or a named config object.
|
|
492
360
|
|
|
493
361
|
|
|
494
|
-
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
495
|
-
|
|
496
|
-
## Maintainers
|
|
497
|
-
|
|
498
|
-
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
499
|
-
- [Matt Jones](https://github.com/jonesmac)
|
|
500
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
501
|
-
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
502
|
-
|
|
503
|
-
## License
|
|
504
|
-
|
|
505
|
-
> See the [LICENSE](LICENSE) file for license details
|
|
506
|
-
|
|
507
|
-
## Credits
|
|
508
|
-
|
|
509
|
-
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
|
|
510
|
-
|
|
511
|
-
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
512
|
-
|
|
513
|
-
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
|
|
514
|
-
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
|
|
515
362
|
[npm-badge]: https://img.shields.io/npm/v/@xylabs/zod.svg
|
|
516
363
|
[npm-link]: https://www.npmjs.com/package/@xylabs/zod
|
|
517
|
-
[
|
|
518
|
-
[
|
|
519
|
-
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
520
|
-
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
521
|
-
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
522
|
-
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
523
|
-
|
|
524
|
-
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/zod
|
|
525
|
-
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/zod
|
|
526
|
-
|
|
527
|
-
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/zod/badge
|
|
528
|
-
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/zod
|
|
529
|
-
|
|
530
|
-
[socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/zod
|
|
531
|
-
[socket-link]: https://socket.dev/npm/package/@xylabs/zod
|
|
364
|
+
[license-badge]: https://img.shields.io/npm/l/@xylabs/zod.svg
|
|
365
|
+
[license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/zodAsFactory.ts","../../src/zodIsFactory.ts","../../src/zodToFactory.ts","../../src/zodAllFactory.ts","../../src/zodAsAsyncFactory.ts","../../src/zodToAsyncFactory.ts"],"sourcesContent":["import type { AssertConfig } from '@xylabs/error'\nimport { assertError } from '@xylabs/error'\nimport type * as z from 'zod'\n\nimport type { ZodFactoryConfig } from './Config.ts'\n\n/**\n * Creates a function that validates a value against a zod schema and returns it with a narrowed type.\n * When called without an assert config, returns undefined on failure. When called with an assert config, throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns A function that validates and narrows the type of a value\n */\nexport function zodAsFactory<TZod>(zod: z.ZodType<TZod>, name: string) {\n function asFunc<T>(value: T): (T & TZod) | undefined\n function asFunc<T>(value: T, assert: ZodFactoryConfig): (T & TZod)\n function asFunc<T>(value: T, assert?: ZodFactoryConfig): (T & TZod) | undefined {\n const result = zod.safeParse(value)\n if (result.success) {\n return value as (T & TZod)\n }\n if (assert !== undefined) {\n let assertConfig: AssertConfig\n switch (typeof assert) {\n case 'string': {\n assertConfig = `[${name}][${value}] ${assert}`\n break\n }\n case 'object': {\n assertConfig = `[${name}][${assert.name}][${value}] ${result.error.message}`\n break\n }\n case 'boolean': {\n assertConfig = `[${name}][${value}] ${result.error.message}`\n break\n }\n case 'function': {\n assertConfig = assert(value, result.error.message)\n break\n }\n }\n return assertError(value, assertConfig, result.error.message)\n }\n }\n\n return asFunc\n}\n","import type * as z from 'zod'\n\n/**\n * Creates a type guard function that checks if a value matches a zod schema.\n * @param zod - The zod schema to validate against\n * @returns A type guard function that returns true if the value passes validation\n */\nexport function zodIsFactory<TZod>(zod: z.ZodType<TZod>) {\n return <T>(value: T): value is T & TZod => zod.safeParse(value).success\n}\n","import { isDefined } from '@xylabs/typeof'\nimport type * as z from 'zod'\n\nimport type { ZodFactoryConfig } from './Config.ts'\nimport { zodAsFactory } from './zodAsFactory.ts'\n\n/**\n * Creates a function that converts a value to the zod schema type, delegating to `zodAsFactory` internally.\n * Provides overloads for optional assertion: without assert config returns undefined on failure, with assert config throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns A function that validates and converts a value to the schema type\n */\nexport function zodToFactory<TZod>(zod: z.ZodType<TZod>, name: string) {\n const as = zodAsFactory<TZod>(zod, name)\n function toFunc<T>(value: T): (T & TZod) | undefined\n function toFunc<T>(value: T, assert: ZodFactoryConfig): (T & TZod)\n function toFunc<T>(value: T, assert?: ZodFactoryConfig): (T & TZod) | undefined {\n if (isDefined(assert)) {\n return as(value, assert)\n }\n return as(value)\n }\n return toFunc\n}\n","import type * as z from 'zod'\n\nimport { zodAsFactory } from './zodAsFactory.ts'\nimport { zodIsFactory } from './zodIsFactory.ts'\nimport { zodToFactory } from './zodToFactory.ts'\n\n/** @alpha */\nexport type AllZodFactories<TType, TName extends string
|
|
1
|
+
{"version":3,"sources":["../../src/zodAsFactory.ts","../../src/zodIsFactory.ts","../../src/zodToFactory.ts","../../src/zodAllFactory.ts","../../src/zodAsAsyncFactory.ts","../../src/zodToAsyncFactory.ts"],"sourcesContent":["import type { AssertConfig } from '@xylabs/error'\nimport { assertError } from '@xylabs/error'\nimport type * as z from 'zod'\n\nimport type { ZodFactoryConfig } from './Config.ts'\n\n/**\n * Creates a function that validates a value against a zod schema and returns it with a narrowed type.\n * When called without an assert config, returns undefined on failure. When called with an assert config, throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns A function that validates and narrows the type of a value\n */\nexport function zodAsFactory<TZod>(zod: z.ZodType<TZod>, name: string) {\n function asFunc<T>(value: T): (T & TZod) | undefined\n function asFunc<T>(value: T, assert: ZodFactoryConfig): (T & TZod)\n function asFunc<T>(value: T, assert?: ZodFactoryConfig): (T & TZod) | undefined {\n const result = zod.safeParse(value)\n if (result.success) {\n return value as (T & TZod)\n }\n if (assert !== undefined) {\n let assertConfig: AssertConfig\n switch (typeof assert) {\n case 'string': {\n assertConfig = `[${name}][${value}] ${assert}`\n break\n }\n case 'object': {\n assertConfig = `[${name}][${assert.name}][${value}] ${result.error.message}`\n break\n }\n case 'boolean': {\n assertConfig = `[${name}][${value}] ${result.error.message}`\n break\n }\n case 'function': {\n assertConfig = assert(value, result.error.message)\n break\n }\n }\n return assertError(value, assertConfig, result.error.message)\n }\n }\n\n return asFunc\n}\n","import type * as z from 'zod'\n\n/**\n * Creates a type guard function that checks if a value matches a zod schema.\n * @param zod - The zod schema to validate against\n * @returns A type guard function that returns true if the value passes validation\n */\nexport function zodIsFactory<TZod>(zod: z.ZodType<TZod>) {\n return <T>(value: T): value is T & TZod => zod.safeParse(value).success\n}\n","import { isDefined } from '@xylabs/typeof'\nimport type * as z from 'zod'\n\nimport type { ZodFactoryConfig } from './Config.ts'\nimport { zodAsFactory } from './zodAsFactory.ts'\n\n/**\n * Creates a function that converts a value to the zod schema type, delegating to `zodAsFactory` internally.\n * Provides overloads for optional assertion: without assert config returns undefined on failure, with assert config throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns A function that validates and converts a value to the schema type\n */\nexport function zodToFactory<TZod>(zod: z.ZodType<TZod>, name: string) {\n const as = zodAsFactory<TZod>(zod, name)\n function toFunc<T>(value: T): (T & TZod) | undefined\n function toFunc<T>(value: T, assert: ZodFactoryConfig): (T & TZod)\n function toFunc<T>(value: T, assert?: ZodFactoryConfig): (T & TZod) | undefined {\n if (isDefined(assert)) {\n return as(value, assert)\n }\n return as(value)\n }\n return toFunc\n}\n","import type * as z from 'zod'\n\nimport { zodAsFactory } from './zodAsFactory.ts'\nimport { zodIsFactory } from './zodIsFactory.ts'\nimport { zodToFactory } from './zodToFactory.ts'\n\n/** @alpha */\nexport type AllZodFactories<TType, TName extends string>\n = Record<`is${TName}`, ReturnType<typeof zodIsFactory<TType>>>\n & Record<`as${TName}`, ReturnType<typeof zodAsFactory<TType>>>\n & Record<`to${TName}`, ReturnType<typeof zodToFactory<TType>>>\n\n/**\n * Creates a bundle of `is`, `as`, and `to` factory functions for a given zod schema.\n * @alpha\n * @param zod - The zod schema to validate against\n * @param name - The name used to suffix the generated function names (e.g. 'Address' produces `isAddress`, `asAddress`, `toAddress`)\n * @returns An object containing `is<Name>`, `as<Name>`, and `to<Name>` functions\n */\nexport function zodAllFactory<T, TName extends string>(zod: z.ZodType<T>, name: TName) {\n return {\n [`is${name}`]: zodIsFactory<T>(zod),\n [`as${name}`]: zodAsFactory<T>(zod, `as${name}`),\n [`to${name}`]: zodToFactory<T>(zod, `to${name}`),\n }\n}\n","import type { AssertConfig } from '@xylabs/error'\nimport { assertError } from '@xylabs/error'\nimport type * as z from 'zod'\n\nimport type { ZodFactoryConfig } from './Config.ts'\n\n/**\n * Creates an async function that validates a value against a zod schema and returns it with a narrowed type.\n * Uses `safeParseAsync` for schemas with async refinements. When called without an assert config, returns undefined on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns An async function that validates and narrows the type of a value\n */\nexport function zodAsAsyncFactory<TZod>(zod: z.ZodType<TZod>, name: string) {\n function asFunc<T>(value: T): Promise<(T & TZod) | undefined>\n function asFunc<T>(value: T, assert: ZodFactoryConfig): Promise<(T & TZod)>\n async function asFunc<T>(value: T, assert?: ZodFactoryConfig): Promise<(T & TZod) | undefined> {\n const result = await zod.safeParseAsync(value)\n if (result.success) {\n return value as (T & TZod)\n }\n if (assert !== undefined) {\n let assertConfig: AssertConfig\n switch (typeof assert) {\n case 'string': {\n assertConfig = `[${name}][${value}] ${assert}`\n break\n }\n case 'object': {\n assertConfig = `[${name}][${assert.name}][${value}] ${result.error.message}`\n break\n }\n case 'boolean': {\n assertConfig = `[${name}][${value}] ${result.error.message}`\n break\n }\n case 'function': {\n assertConfig = assert(value, result.error.message)\n break\n }\n }\n return assertError(value, assertConfig, result.error.message)\n }\n }\n\n return asFunc\n}\n","import { isDefined } from '@xylabs/typeof'\nimport type * as z from 'zod'\n\nimport type { ZodFactoryConfig } from './Config.ts'\nimport { zodAsAsyncFactory } from './zodAsAsyncFactory.ts'\n\n/**\n * Creates an async function that converts a value to the zod schema type, delegating to `zodAsAsyncFactory` internally.\n * Provides overloads for optional assertion: without assert config resolves to undefined on failure, with assert config throws on failure.\n * @param zod - The zod schema to validate against\n * @param name - A name used in error messages for identification\n * @returns An async function that validates and converts a value to the schema type\n */\nexport function zodToAsyncFactory<TZod>(zod: z.ZodType<TZod>, name: string) {\n const as = zodAsAsyncFactory<TZod>(zod, name)\n function toFunc<T>(value: T): Promise<(T & TZod) | undefined>\n function toFunc<T>(value: T, assert: ZodFactoryConfig): Promise<(T & TZod)>\n async function toFunc<T>(value: T, assert?: ZodFactoryConfig): Promise<(T & TZod) | undefined> {\n if (isDefined(assert)) {\n return await as(value, assert)\n }\n return await as(value)\n }\n return toFunc\n}\n"],"mappings":"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","names":["assertError","isDefined","isDefined"]}
|
|
@@ -3,13 +3,7 @@ import { zodAsFactory } from './zodAsFactory.ts';
|
|
|
3
3
|
import { zodIsFactory } from './zodIsFactory.ts';
|
|
4
4
|
import { zodToFactory } from './zodToFactory.ts';
|
|
5
5
|
/** @alpha */
|
|
6
|
-
export type AllZodFactories<TType, TName extends string> = {
|
|
7
|
-
[K in `is${TName}`]: ReturnType<typeof zodIsFactory<TType>>;
|
|
8
|
-
} & {
|
|
9
|
-
[K in `as${TName}`]: ReturnType<typeof zodAsFactory<TType>>;
|
|
10
|
-
} & {
|
|
11
|
-
[K in `to${TName}`]: ReturnType<typeof zodToFactory<TType>>;
|
|
12
|
-
};
|
|
6
|
+
export type AllZodFactories<TType, TName extends string> = Record<`is${TName}`, ReturnType<typeof zodIsFactory<TType>>> & Record<`as${TName}`, ReturnType<typeof zodAsFactory<TType>>> & Record<`to${TName}`, ReturnType<typeof zodToFactory<TType>>>;
|
|
13
7
|
/**
|
|
14
8
|
* Creates a bundle of `is`, `as`, and `to` factory functions for a given zod schema.
|
|
15
9
|
* @alpha
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zodAllFactory.d.ts","sourceRoot":"","sources":["../../src/zodAllFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,aAAa;AACb,MAAM,MAAM,eAAe,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"zodAllFactory.d.ts","sourceRoot":"","sources":["../../src/zodAllFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAEhD,aAAa;AACb,MAAM,MAAM,eAAe,CAAC,KAAK,EAAE,KAAK,SAAS,MAAM,IACnD,MAAM,CAAC,KAAK,KAAK,EAAE,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAC1D,MAAM,CAAC,KAAK,KAAK,EAAE,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,GAC5D,MAAM,CAAC,KAAK,KAAK,EAAE,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAElE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK;;;;;EAMpF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/zod",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.96",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -22,12 +22,10 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/neutral/index.d.ts",
|
|
25
|
-
"import": "./dist/neutral/index.mjs",
|
|
26
25
|
"default": "./dist/neutral/index.mjs"
|
|
27
26
|
},
|
|
28
27
|
"./package.json": "./package.json"
|
|
29
28
|
},
|
|
30
|
-
"types": "./dist/neutral/index.d.ts",
|
|
31
29
|
"files": [
|
|
32
30
|
"dist",
|
|
33
31
|
"!**/*.bench.*",
|
|
@@ -36,24 +34,25 @@
|
|
|
36
34
|
"README.md"
|
|
37
35
|
],
|
|
38
36
|
"dependencies": {
|
|
39
|
-
"@xylabs/
|
|
40
|
-
"@xylabs/
|
|
37
|
+
"@xylabs/typeof": "~5.0.96",
|
|
38
|
+
"@xylabs/error": "~5.0.96"
|
|
41
39
|
},
|
|
42
40
|
"devDependencies": {
|
|
43
|
-
"@types/node": "^25.
|
|
44
|
-
"@xylabs/
|
|
45
|
-
"@xylabs/
|
|
46
|
-
"@xylabs/tsconfig": "~7.7.3",
|
|
47
|
-
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
41
|
+
"@types/node": "^25.6.0",
|
|
42
|
+
"@xylabs/toolchain": "~7.10.4",
|
|
43
|
+
"@xylabs/tsconfig": "~7.10.4",
|
|
48
44
|
"esbuild": "^0.28.0",
|
|
49
45
|
"typescript": "^5",
|
|
50
|
-
"vite": "^
|
|
51
|
-
"vitest": "^4.1.
|
|
46
|
+
"vite": "^8.0.8",
|
|
47
|
+
"vitest": "^4.1.4",
|
|
52
48
|
"zod": "^4.3.6"
|
|
53
49
|
},
|
|
54
50
|
"peerDependencies": {
|
|
55
51
|
"zod": "^4"
|
|
56
52
|
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18"
|
|
55
|
+
},
|
|
57
56
|
"publishConfig": {
|
|
58
57
|
"access": "public"
|
|
59
58
|
}
|