@orpc/zod 0.0.0-next.fe39bf3 → 0.0.0-next.ff5907c
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 +10 -9
- package/dist/src/coercer.d.ts +8 -3
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -42,16 +42,16 @@ import { guard, isObject } from "@orpc/shared";
|
|
42
42
|
import {
|
43
43
|
ZodFirstPartyTypeKind
|
44
44
|
} from "zod";
|
45
|
-
var
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
const inputSchema =
|
45
|
+
var ZodSmartCoercionPlugin = class {
|
46
|
+
init(options) {
|
47
|
+
options.clientInterceptors ??= [];
|
48
|
+
options.clientInterceptors.unshift((options2) => {
|
49
|
+
const inputSchema = options2.procedure["~orpc"].inputSchema;
|
50
50
|
if (!inputSchema || inputSchema["~standard"].vendor !== "zod") {
|
51
|
-
return
|
51
|
+
return options2.next();
|
52
52
|
}
|
53
|
-
const coercedInput = zodCoerceInternal(inputSchema,
|
54
|
-
return
|
53
|
+
const coercedInput = zodCoerceInternal(inputSchema, options2.input, { bracketNotation: true });
|
54
|
+
return options2.next({ ...options2, input: coercedInput });
|
55
55
|
});
|
56
56
|
}
|
57
57
|
};
|
@@ -962,7 +962,8 @@ export {
|
|
962
962
|
NON_LOGIC_KEYWORDS,
|
963
963
|
UNDEFINED_JSON_SCHEMA,
|
964
964
|
UNSUPPORTED_JSON_SCHEMA,
|
965
|
-
ZodAutoCoercePlugin,
|
965
|
+
ZodSmartCoercionPlugin as ZodAutoCoercePlugin,
|
966
|
+
ZodSmartCoercionPlugin,
|
966
967
|
ZodToJsonSchemaConverter,
|
967
968
|
blob,
|
968
969
|
file,
|
package/dist/src/coercer.d.ts
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
import type { Context } from '@orpc/server';
|
2
2
|
import type { Plugin } from '@orpc/server/plugins';
|
3
|
-
import type {
|
4
|
-
export declare class
|
5
|
-
|
3
|
+
import type { StandardHandlerOptions } from '@orpc/server/standard';
|
4
|
+
export declare class ZodSmartCoercionPlugin<TContext extends Context> implements Plugin<TContext> {
|
5
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
6
6
|
}
|
7
|
+
export {
|
8
|
+
/**
|
9
|
+
* @deprecated ZodAutoCoercePlugin has renamed to ZodSmartCoercionPlugin
|
10
|
+
*/
|
11
|
+
ZodSmartCoercionPlugin as ZodAutoCoercePlugin, };
|
7
12
|
//# sourceMappingURL=coercer.d.ts.map
|
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.ff5907c",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -29,16 +29,16 @@
|
|
29
29
|
"dist"
|
30
30
|
],
|
31
31
|
"peerDependencies": {
|
32
|
-
"@orpc/
|
33
|
-
"@orpc/
|
34
|
-
"@orpc/
|
32
|
+
"@orpc/server": "0.0.0-next.ff5907c",
|
33
|
+
"@orpc/openapi": "0.0.0-next.ff5907c",
|
34
|
+
"@orpc/contract": "0.0.0-next.ff5907c"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
37
|
"@standard-schema/spec": "^1.0.0",
|
38
38
|
"json-schema-typed": "^8.0.1",
|
39
39
|
"wildcard-match": "^5.1.3",
|
40
40
|
"zod": "^3.24.1",
|
41
|
-
"@orpc/shared": "0.0.0-next.
|
41
|
+
"@orpc/shared": "0.0.0-next.ff5907c"
|
42
42
|
},
|
43
43
|
"scripts": {
|
44
44
|
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|