@orpc/zod 0.0.0-next.dbce934 → 0.0.0-next.dc2afcb
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 +10 -7
- package/dist/index.mjs +2 -5
- package/dist/zod4/index.d.mts +1 -1
- package/dist/zod4/index.d.ts +1 -1
- package/dist/zod4/index.mjs +10 -4
- package/package.json +10 -11
package/README.md
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<image align="center" src="https://orpc.
|
|
2
|
+
<image align="center" src="https://orpc.dev/logo.webp" width=280 alt="oRPC logo" />
|
|
3
3
|
</div>
|
|
4
4
|
|
|
5
5
|
<h1></h1>
|
|
6
6
|
|
|
7
7
|
<div align="center">
|
|
8
|
-
<a href="https://codecov.io/gh/
|
|
9
|
-
<img alt="codecov" src="https://codecov.io/gh/
|
|
8
|
+
<a href="https://codecov.io/gh/middleapi/orpc">
|
|
9
|
+
<img alt="codecov" src="https://codecov.io/gh/middleapi/orpc/branch/main/graph/badge.svg">
|
|
10
10
|
</a>
|
|
11
11
|
<a href="https://www.npmjs.com/package/@orpc/zod">
|
|
12
12
|
<img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fzod?logo=npm" />
|
|
13
13
|
</a>
|
|
14
|
-
<a href="https://github.com/
|
|
15
|
-
<img alt="MIT License" src="https://img.shields.io/github/license/
|
|
14
|
+
<a href="https://github.com/middleapi/orpc/blob/main/LICENSE">
|
|
15
|
+
<img alt="MIT License" src="https://img.shields.io/github/license/middleapi/orpc?logo=open-source-initiative" />
|
|
16
16
|
</a>
|
|
17
17
|
<a href="https://discord.gg/TXEbwRBvQn">
|
|
18
18
|
<img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
|
|
19
19
|
</a>
|
|
20
|
+
<a href="https://deepwiki.com/middleapi/orpc">
|
|
21
|
+
<img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki">
|
|
22
|
+
</a>
|
|
20
23
|
</div>
|
|
21
24
|
|
|
22
25
|
<h3 align="center">Typesafe APIs Made Simple 🪄</h3>
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
|
|
43
46
|
## Documentation
|
|
44
47
|
|
|
45
|
-
You can find the full documentation [here](https://orpc.
|
|
48
|
+
You can find the full documentation [here](https://orpc.dev).
|
|
46
49
|
|
|
47
50
|
## Packages
|
|
48
51
|
|
|
@@ -139,4 +142,4 @@ const InputSchema = oz.openapi(
|
|
|
139
142
|
|
|
140
143
|
## License
|
|
141
144
|
|
|
142
|
-
Distributed under the MIT License. See [LICENSE](https://github.com/
|
|
145
|
+
Distributed under the MIT License. See [LICENSE](https://github.com/middleapi/orpc/blob/main/LICENSE) for more information.
|
package/dist/index.mjs
CHANGED
|
@@ -724,7 +724,7 @@ class ZodToJsonSchemaConverter {
|
|
|
724
724
|
const anyOf = [];
|
|
725
725
|
let required = true;
|
|
726
726
|
for (const item of schema_._def.options) {
|
|
727
|
-
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth);
|
|
727
|
+
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth + 1);
|
|
728
728
|
if (!itemRequired) {
|
|
729
729
|
required = false;
|
|
730
730
|
if (itemJson !== this.unsupportedJsonSchema) {
|
|
@@ -734,9 +734,6 @@ class ZodToJsonSchemaConverter {
|
|
|
734
734
|
anyOf.push(itemJson);
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
if (anyOf.length === 1) {
|
|
738
|
-
return [required, anyOf[0]];
|
|
739
|
-
}
|
|
740
737
|
return [required, { anyOf }];
|
|
741
738
|
}
|
|
742
739
|
case ZodFirstPartyTypeKind.ZodIntersection: {
|
|
@@ -744,7 +741,7 @@ class ZodToJsonSchemaConverter {
|
|
|
744
741
|
const allOf = [];
|
|
745
742
|
let required = false;
|
|
746
743
|
for (const item of [schema_._def.left, schema_._def.right]) {
|
|
747
|
-
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth);
|
|
744
|
+
const [itemRequired, itemJson] = this.convert(item, options, lazyDepth, false, false, structureDepth + 1);
|
|
748
745
|
allOf.push(itemJson);
|
|
749
746
|
if (itemRequired) {
|
|
750
747
|
required = true;
|
package/dist/zod4/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import * as zod_v4_core from 'zod/v4/core';
|
|
|
7
7
|
import { $ZodType, $input, $output } from 'zod/v4/core';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated Use [Smart Coercion Plugin](https://orpc.
|
|
10
|
+
* @deprecated Use [Smart Coercion Plugin](https://orpc.dev/docs/openapi/plugins/smart-coercion) instead.
|
|
11
11
|
*/
|
|
12
12
|
declare class experimental_ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
|
13
13
|
#private;
|
package/dist/zod4/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as zod_v4_core from 'zod/v4/core';
|
|
|
7
7
|
import { $ZodType, $input, $output } from 'zod/v4/core';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated Use [Smart Coercion Plugin](https://orpc.
|
|
10
|
+
* @deprecated Use [Smart Coercion Plugin](https://orpc.dev/docs/openapi/plugins/smart-coercion) instead.
|
|
11
11
|
*/
|
|
12
12
|
declare class experimental_ZodSmartCoercionPlugin<TContext extends Context> implements StandardHandlerPlugin<TContext> {
|
|
13
13
|
#private;
|
package/dist/zod4/index.mjs
CHANGED
|
@@ -446,7 +446,7 @@ class ZodToJsonSchemaConverter {
|
|
|
446
446
|
const anyOf = [];
|
|
447
447
|
let required = true;
|
|
448
448
|
for (const item of union._zod.def.options) {
|
|
449
|
-
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth);
|
|
449
|
+
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth + 1);
|
|
450
450
|
if (!itemRequired) {
|
|
451
451
|
required = false;
|
|
452
452
|
}
|
|
@@ -460,14 +460,14 @@ class ZodToJsonSchemaConverter {
|
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
|
-
return [required,
|
|
463
|
+
return [required, { anyOf }];
|
|
464
464
|
}
|
|
465
465
|
case "intersection": {
|
|
466
466
|
const intersection = schema2;
|
|
467
467
|
const json = { allOf: [] };
|
|
468
468
|
let required = false;
|
|
469
469
|
for (const item of [intersection._zod.def.left, intersection._zod.def.right]) {
|
|
470
|
-
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth);
|
|
470
|
+
const [itemRequired, itemJson] = this.#convert(item, options2, lazyDepth2, structureDepth + 1);
|
|
471
471
|
json.allOf.push(itemJson);
|
|
472
472
|
if (itemRequired) {
|
|
473
473
|
required = true;
|
|
@@ -591,7 +591,13 @@ class ZodToJsonSchemaConverter {
|
|
|
591
591
|
}
|
|
592
592
|
case "pipe": {
|
|
593
593
|
const pipe = schema2;
|
|
594
|
-
return this.#convert(
|
|
594
|
+
return this.#convert(
|
|
595
|
+
// prefer out schema when in schema is preprocess/transform
|
|
596
|
+
options2.strategy === "input" && pipe._zod.def.in._zod.def.type !== "transform" ? pipe._zod.def.in : pipe._zod.def.out,
|
|
597
|
+
options2,
|
|
598
|
+
lazyDepth2,
|
|
599
|
+
structureDepth
|
|
600
|
+
);
|
|
595
601
|
}
|
|
596
602
|
case "readonly": {
|
|
597
603
|
const readonly_ = schema2;
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/zod",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.dc2afcb",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"homepage": "https://orpc.
|
|
6
|
+
"homepage": "https://orpc.dev",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/middleapi/orpc.git",
|
|
10
10
|
"directory": "packages/zod"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
|
-
"unnoq",
|
|
14
13
|
"orpc"
|
|
15
14
|
],
|
|
16
15
|
"exports": {
|
|
@@ -30,18 +29,18 @@
|
|
|
30
29
|
],
|
|
31
30
|
"peerDependencies": {
|
|
32
31
|
"zod": ">=3.25.0",
|
|
33
|
-
"@orpc/contract": "0.0.0-next.
|
|
34
|
-
"@orpc/server": "0.0.0-next.
|
|
32
|
+
"@orpc/contract": "0.0.0-next.dc2afcb",
|
|
33
|
+
"@orpc/server": "0.0.0-next.dc2afcb"
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
36
|
"escape-string-regexp": "^5.0.0",
|
|
38
|
-
"wildcard-match": "^5.1.
|
|
39
|
-
"@orpc/json-schema": "0.0.0-next.
|
|
40
|
-
"@orpc/shared": "0.0.0-next.
|
|
41
|
-
"@orpc/openapi": "0.0.0-next.
|
|
37
|
+
"wildcard-match": "^5.1.4",
|
|
38
|
+
"@orpc/json-schema": "0.0.0-next.dc2afcb",
|
|
39
|
+
"@orpc/shared": "0.0.0-next.dc2afcb",
|
|
40
|
+
"@orpc/openapi": "0.0.0-next.dc2afcb"
|
|
42
41
|
},
|
|
43
42
|
"devDependencies": {
|
|
44
|
-
"zod": "^4.
|
|
43
|
+
"zod": "^4.3.6"
|
|
45
44
|
},
|
|
46
45
|
"scripts": {
|
|
47
46
|
"build": "unbuild",
|