@orpc/trpc 1.10.2 → 1.10.4
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 +8 -20
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -38,12 +38,14 @@ function toORPCProcedure(procedure) {
|
|
|
38
38
|
return new ORPC.Procedure({
|
|
39
39
|
errorMap: {},
|
|
40
40
|
meta: procedure._def.meta ?? {},
|
|
41
|
-
inputValidationIndex: 0,
|
|
42
|
-
outputValidationIndex: 0,
|
|
43
41
|
route: get(procedure._def.meta, ["route"]) ?? {},
|
|
44
42
|
middlewares: [],
|
|
45
|
-
inputSchema:
|
|
46
|
-
outputSchema:
|
|
43
|
+
inputSchema: toStandardSchema(procedure._def.inputs.at(-1)),
|
|
44
|
+
outputSchema: toStandardSchema(procedure._def.output),
|
|
45
|
+
inputValidationIndex: Number.NaN,
|
|
46
|
+
// disable input validation
|
|
47
|
+
outputValidationIndex: Number.NaN,
|
|
48
|
+
// disable output validation
|
|
47
49
|
handler: async ({ context, signal, path, input, lastEventId }) => {
|
|
48
50
|
try {
|
|
49
51
|
const trpcInput = lastEventId !== void 0 && (input === void 0 || isObject(input)) ? { ...input, lastEventId } : input;
|
|
@@ -86,25 +88,11 @@ function toORPCProcedure(procedure) {
|
|
|
86
88
|
}
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
|
-
function
|
|
91
|
+
function toStandardSchema(schema) {
|
|
90
92
|
if (!isTypescriptObject(schema) || !("~standard" in schema) || !isTypescriptObject(schema["~standard"])) {
|
|
91
93
|
return void 0;
|
|
92
94
|
}
|
|
93
|
-
return
|
|
94
|
-
get: (target, prop) => {
|
|
95
|
-
if (prop === "~standard") {
|
|
96
|
-
return new Proxy(target["~standard"], {
|
|
97
|
-
get: (target2, prop2) => {
|
|
98
|
-
if (prop2 === "validate") {
|
|
99
|
-
return (value) => ({ value });
|
|
100
|
-
}
|
|
101
|
-
return Reflect.get(target2, prop2, target2);
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return Reflect.get(target, prop, target);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
95
|
+
return schema;
|
|
108
96
|
}
|
|
109
97
|
|
|
110
98
|
export { toORPCRouter };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orpc/trpc",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.10.
|
|
4
|
+
"version": "1.10.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
|
7
7
|
"repository": {
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"@trpc/server": ">=11.4.2"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@orpc/client": "1.10.
|
|
32
|
-
"@orpc/shared": "1.10.
|
|
33
|
-
"@orpc/server": "1.10.
|
|
31
|
+
"@orpc/client": "1.10.4",
|
|
32
|
+
"@orpc/shared": "1.10.4",
|
|
33
|
+
"@orpc/server": "1.10.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@trpc/server": "^11.
|
|
36
|
+
"@trpc/server": "^11.7.1",
|
|
37
37
|
"zod": "^4.1.12"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|