@orpc/server 0.15.0 → 0.16.0
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.
@@ -114,20 +114,20 @@ function createProcedureCaller(options) {
|
|
114
114
|
const procedure = await loadProcedure(options.procedure);
|
115
115
|
const context = await value(options.context);
|
116
116
|
const execute = async () => {
|
117
|
-
const validInput = (() => {
|
117
|
+
const validInput = await (async () => {
|
118
118
|
const schema = procedure.zz$p.contract.zz$cp.InputSchema;
|
119
119
|
if (!schema) {
|
120
120
|
return input;
|
121
121
|
}
|
122
|
-
|
123
|
-
|
124
|
-
} catch (e) {
|
122
|
+
const result = await schema["~standard"].validate(input);
|
123
|
+
if (result.issues) {
|
125
124
|
throw new ORPCError({
|
126
125
|
message: "Validation input failed",
|
127
126
|
code: "BAD_REQUEST",
|
128
|
-
|
127
|
+
issues: result.issues
|
129
128
|
});
|
130
129
|
}
|
130
|
+
return result.value;
|
131
131
|
})();
|
132
132
|
const meta = {
|
133
133
|
path,
|
@@ -160,15 +160,14 @@ function createProcedureCaller(options) {
|
|
160
160
|
if (!schema) {
|
161
161
|
return output2;
|
162
162
|
}
|
163
|
-
const result = await schema.
|
164
|
-
if (result.
|
163
|
+
const result = await schema["~standard"].validate(output2);
|
164
|
+
if (result.issues) {
|
165
165
|
throw new ORPCError({
|
166
166
|
message: "Validation output failed",
|
167
|
-
code: "INTERNAL_SERVER_ERROR"
|
168
|
-
cause: result.error
|
167
|
+
code: "INTERNAL_SERVER_ERROR"
|
169
168
|
});
|
170
169
|
}
|
171
|
-
return result.
|
170
|
+
return result.value;
|
172
171
|
})();
|
173
172
|
return validOutput;
|
174
173
|
};
|
@@ -271,4 +270,4 @@ export {
|
|
271
270
|
decorateProcedure,
|
272
271
|
isProcedure
|
273
272
|
};
|
274
|
-
//# sourceMappingURL=chunk-
|
273
|
+
//# sourceMappingURL=chunk-Z2PQ6UAM.js.map
|
package/dist/fetch.js
CHANGED
package/dist/index.js
CHANGED
@@ -12,10 +12,10 @@ export declare class RouterImplementer<TContext extends Context, TContract exten
|
|
12
12
|
constructor(zz$ri: {
|
13
13
|
contract: TContract;
|
14
14
|
});
|
15
|
-
router
|
16
|
-
lazy(loader: () => Promise<{
|
17
|
-
default:
|
18
|
-
}>): DecoratedLazy<
|
15
|
+
router<U extends RouterWithContract<TContext, TContract>>(router: U): HandledRouter<U>;
|
16
|
+
lazy<U extends RouterWithContract<TContext, TContract>>(loader: () => Promise<{
|
17
|
+
default: U;
|
18
|
+
}>): DecoratedLazy<U>;
|
19
19
|
}
|
20
20
|
export type ChainedRouterImplementer<TContext extends Context, TContract extends ContractRouter, TExtraContext extends Context> = {
|
21
21
|
[K in keyof TContract]: TContract[K] extends ContractProcedure<infer UInputSchema, infer UOutputSchema> ? ProcedureImplementer<TContext, TExtraContext, UInputSchema, UOutputSchema> : TContract[K] extends ContractRouter ? ChainedRouterImplementer<TContext, TContract[K], TExtraContext> : never;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.
|
4
|
+
"version": "0.16.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -34,16 +34,15 @@
|
|
34
34
|
"dist"
|
35
35
|
],
|
36
36
|
"peerDependencies": {
|
37
|
-
"zod": "
|
38
|
-
"@orpc/zod": "0.15.0"
|
37
|
+
"@orpc/zod": "0.16.0"
|
39
38
|
},
|
40
39
|
"dependencies": {
|
41
|
-
"@orpc/contract": "0.
|
42
|
-
"@orpc/shared": "0.
|
43
|
-
"@orpc/transformer": "0.
|
40
|
+
"@orpc/contract": "0.16.0",
|
41
|
+
"@orpc/shared": "0.16.0",
|
42
|
+
"@orpc/transformer": "0.16.0"
|
44
43
|
},
|
45
44
|
"devDependencies": {
|
46
|
-
"@orpc/openapi": "0.
|
45
|
+
"@orpc/openapi": "0.16.0"
|
47
46
|
},
|
48
47
|
"scripts": {
|
49
48
|
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|