@orpc/zod 0.0.0-next.9cd4eb7 → 0.0.0-next.9de128a
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.mjs +2 -2
- package/dist/zod4/index.d.mts +4 -4
- package/dist/zod4/index.d.ts +4 -4
- package/dist/zod4/index.mjs +13 -12
- package/package.json +7 -7
package/dist/index.mjs
CHANGED
|
@@ -129,7 +129,7 @@ class ZodSmartCoercionPlugin {
|
|
|
129
129
|
options.clientInterceptors ??= [];
|
|
130
130
|
options.clientInterceptors.unshift((options2) => {
|
|
131
131
|
const inputSchema = options2.procedure["~orpc"].inputSchema;
|
|
132
|
-
if (!inputSchema || inputSchema["~standard"].vendor !== "zod") {
|
|
132
|
+
if (!inputSchema || inputSchema["~standard"].vendor !== "zod" || "_zod" in inputSchema) {
|
|
133
133
|
return options2.next();
|
|
134
134
|
}
|
|
135
135
|
const coercedInput = zodCoerceInternal(inputSchema, options2.input);
|
|
@@ -401,7 +401,7 @@ class ZodToJsonSchemaConverter {
|
|
|
401
401
|
this.anyJsonSchema = options.anyJsonSchema ?? {};
|
|
402
402
|
}
|
|
403
403
|
condition(schema) {
|
|
404
|
-
return schema !== void 0 && schema["~standard"].vendor === "zod";
|
|
404
|
+
return schema !== void 0 && schema["~standard"].vendor === "zod" && !("_zod" in schema);
|
|
405
405
|
}
|
|
406
406
|
convert(schema, options, lazyDepth = 0, isHandledCustomJSONSchema = false, isHandledZodDescription = false, structureDepth = 0) {
|
|
407
407
|
const def = schema._def;
|
package/dist/zod4/index.d.mts
CHANGED
|
@@ -89,7 +89,7 @@ declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
|
|
89
89
|
* })
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
|
-
declare const
|
|
92
|
+
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
93
93
|
$anchor?: string;
|
|
94
94
|
$comment?: string;
|
|
95
95
|
$defs?: Record<string, JSONSchema>;
|
|
@@ -168,7 +168,7 @@ declare const experimental_JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
|
168
168
|
* })
|
|
169
169
|
* ```
|
|
170
170
|
*/
|
|
171
|
-
declare const
|
|
171
|
+
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
172
172
|
$anchor?: string;
|
|
173
173
|
$comment?: string;
|
|
174
174
|
$defs?: Record<string, JSONSchema>;
|
|
@@ -247,7 +247,7 @@ declare const experimental_JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
|
247
247
|
* })
|
|
248
248
|
* ```
|
|
249
249
|
*/
|
|
250
|
-
declare const
|
|
250
|
+
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
251
251
|
$anchor?: string;
|
|
252
252
|
$comment?: string;
|
|
253
253
|
$defs?: Record<string, JSONSchema>;
|
|
@@ -310,5 +310,5 @@ declare const experimental_JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry
|
|
|
310
310
|
writeOnly?: boolean;
|
|
311
311
|
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
312
312
|
|
|
313
|
-
export {
|
|
313
|
+
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter, experimental_ZodSmartCoercionPlugin };
|
|
314
314
|
export type { ZodToJsonSchemaConverterOptions };
|
package/dist/zod4/index.d.ts
CHANGED
|
@@ -89,7 +89,7 @@ declare class ZodToJsonSchemaConverter implements ConditionalSchemaConverter {
|
|
|
89
89
|
* })
|
|
90
90
|
* ```
|
|
91
91
|
*/
|
|
92
|
-
declare const
|
|
92
|
+
declare const JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
93
93
|
$anchor?: string;
|
|
94
94
|
$comment?: string;
|
|
95
95
|
$defs?: Record<string, JSONSchema>;
|
|
@@ -168,7 +168,7 @@ declare const experimental_JSON_SCHEMA_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
|
168
168
|
* })
|
|
169
169
|
* ```
|
|
170
170
|
*/
|
|
171
|
-
declare const
|
|
171
|
+
declare const JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
172
172
|
$anchor?: string;
|
|
173
173
|
$comment?: string;
|
|
174
174
|
$defs?: Record<string, JSONSchema>;
|
|
@@ -247,7 +247,7 @@ declare const experimental_JSON_SCHEMA_INPUT_REGISTRY: zod_v4_core.$ZodRegistry<
|
|
|
247
247
|
* })
|
|
248
248
|
* ```
|
|
249
249
|
*/
|
|
250
|
-
declare const
|
|
250
|
+
declare const JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry<{
|
|
251
251
|
$anchor?: string;
|
|
252
252
|
$comment?: string;
|
|
253
253
|
$defs?: Record<string, JSONSchema>;
|
|
@@ -310,5 +310,5 @@ declare const experimental_JSON_SCHEMA_OUTPUT_REGISTRY: zod_v4_core.$ZodRegistry
|
|
|
310
310
|
writeOnly?: boolean;
|
|
311
311
|
}, zod_v4_core.$ZodType<unknown, unknown, zod_v4_core.$ZodTypeInternals<unknown, unknown>>>;
|
|
312
312
|
|
|
313
|
-
export {
|
|
313
|
+
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter, experimental_ZodSmartCoercionPlugin };
|
|
314
314
|
export type { ZodToJsonSchemaConverterOptions };
|
package/dist/zod4/index.mjs
CHANGED
|
@@ -8,7 +8,7 @@ class experimental_ZodSmartCoercionPlugin {
|
|
|
8
8
|
options.clientInterceptors ??= [];
|
|
9
9
|
options.clientInterceptors.unshift((options2) => {
|
|
10
10
|
const inputSchema = options2.procedure["~orpc"].inputSchema;
|
|
11
|
-
if (!inputSchema || inputSchema["~standard"].vendor !== "zod") {
|
|
11
|
+
if (!inputSchema || inputSchema["~standard"].vendor !== "zod" || !("_zod" in inputSchema)) {
|
|
12
12
|
return options2.next();
|
|
13
13
|
}
|
|
14
14
|
const coercedInput = this.#coerce(inputSchema, options2.input);
|
|
@@ -269,9 +269,9 @@ class experimental_ZodSmartCoercionPlugin {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
const
|
|
273
|
-
const
|
|
274
|
-
const
|
|
272
|
+
const JSON_SCHEMA_REGISTRY = registry();
|
|
273
|
+
const JSON_SCHEMA_INPUT_REGISTRY = registry();
|
|
274
|
+
const JSON_SCHEMA_OUTPUT_REGISTRY = registry();
|
|
275
275
|
|
|
276
276
|
class ZodToJsonSchemaConverter {
|
|
277
277
|
maxLazyDepth;
|
|
@@ -289,7 +289,7 @@ class ZodToJsonSchemaConverter {
|
|
|
289
289
|
this.interceptors = options.interceptors ?? [];
|
|
290
290
|
}
|
|
291
291
|
condition(schema) {
|
|
292
|
-
return schema !== void 0 && schema["~standard"].vendor === "zod";
|
|
292
|
+
return schema !== void 0 && schema["~standard"].vendor === "zod" && "_zod" in schema;
|
|
293
293
|
}
|
|
294
294
|
convert(schema, options) {
|
|
295
295
|
return this.#convert(schema, options, 0, 0);
|
|
@@ -627,18 +627,19 @@ class ZodToJsonSchemaConverter {
|
|
|
627
627
|
);
|
|
628
628
|
}
|
|
629
629
|
#getCustomJsonSchema(schema, options) {
|
|
630
|
-
if (options.strategy === "input" &&
|
|
631
|
-
return
|
|
630
|
+
if (options.strategy === "input" && JSON_SCHEMA_INPUT_REGISTRY.has(schema)) {
|
|
631
|
+
return JSON_SCHEMA_INPUT_REGISTRY.get(schema);
|
|
632
632
|
}
|
|
633
|
-
if (options.strategy === "output" &&
|
|
634
|
-
return
|
|
633
|
+
if (options.strategy === "output" && JSON_SCHEMA_OUTPUT_REGISTRY.has(schema)) {
|
|
634
|
+
return JSON_SCHEMA_OUTPUT_REGISTRY.get(schema);
|
|
635
635
|
}
|
|
636
|
-
if (
|
|
637
|
-
return
|
|
636
|
+
if (JSON_SCHEMA_REGISTRY.has(schema)) {
|
|
637
|
+
return JSON_SCHEMA_REGISTRY.get(schema);
|
|
638
638
|
}
|
|
639
639
|
const global = globalRegistry.get(schema);
|
|
640
640
|
if (global) {
|
|
641
641
|
return {
|
|
642
|
+
title: global.title,
|
|
642
643
|
description: global.description,
|
|
643
644
|
examples: Array.isArray(global.examples) ? global.examples : void 0
|
|
644
645
|
};
|
|
@@ -676,4 +677,4 @@ class ZodToJsonSchemaConverter {
|
|
|
676
677
|
}
|
|
677
678
|
}
|
|
678
679
|
|
|
679
|
-
export {
|
|
680
|
+
export { JSON_SCHEMA_INPUT_REGISTRY, JSON_SCHEMA_OUTPUT_REGISTRY, JSON_SCHEMA_REGISTRY, ZodToJsonSchemaConverter, experimental_ZodSmartCoercionPlugin };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/zod",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.0-next.
|
|
4
|
+
"version": "0.0.0-next.9de128a",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -30,18 +30,18 @@
|
|
|
30
30
|
],
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"zod": ">=3.25.0",
|
|
33
|
-
"@orpc/contract": "0.0.0-next.
|
|
34
|
-
"@orpc/server": "0.0.0-next.
|
|
33
|
+
"@orpc/contract": "0.0.0-next.9de128a",
|
|
34
|
+
"@orpc/server": "0.0.0-next.9de128a"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"escape-string-regexp": "^5.0.0",
|
|
38
38
|
"wildcard-match": "^5.1.3",
|
|
39
|
-
"@orpc/json-schema": "0.0.0-next.
|
|
40
|
-
"@orpc/
|
|
41
|
-
"@orpc/
|
|
39
|
+
"@orpc/json-schema": "0.0.0-next.9de128a",
|
|
40
|
+
"@orpc/shared": "0.0.0-next.9de128a",
|
|
41
|
+
"@orpc/openapi": "0.0.0-next.9de128a"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"zod": "^4.0.
|
|
44
|
+
"zod": "^4.0.14"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "unbuild",
|