@orpc/server 0.29.0 → 0.31.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-XDC42C3C.js → chunk-GK2Z6B6W.js} +34 -31
- package/dist/{chunk-VY6NXNQT.js → chunk-SXUFCJBY.js} +2 -2
- package/dist/fetch.js +2 -2
- package/dist/hono.js +2 -2
- package/dist/index.js +525 -88
- package/dist/next.js +2 -2
- package/dist/node.js +2 -2
- package/dist/src/builder-with-errors-middlewares.d.ts +50 -0
- package/dist/src/builder-with-errors.d.ts +49 -0
- package/dist/src/builder-with-middlewares.d.ts +47 -0
- package/dist/src/builder.d.ts +28 -21
- package/dist/src/context.d.ts +11 -0
- package/dist/src/error.d.ts +1 -1
- package/dist/src/hidden.d.ts +2 -2
- package/dist/src/implementer-chainable.d.ts +7 -3
- package/dist/src/index.d.ts +2 -2
- package/dist/src/middleware-decorated.d.ts +2 -1
- package/dist/src/middleware.d.ts +1 -0
- package/dist/src/procedure-builder-with-input.d.ts +34 -0
- package/dist/src/procedure-builder-with-output.d.ts +33 -0
- package/dist/src/procedure-builder.d.ts +19 -16
- package/dist/src/procedure-decorated.d.ts +8 -8
- package/dist/src/procedure-implementer.d.ts +6 -3
- package/dist/src/procedure.d.ts +4 -2
- package/dist/src/router-builder.d.ts +18 -14
- package/dist/src/router-implementer.d.ts +7 -6
- package/dist/src/router.d.ts +2 -2
- package/package.json +3 -3
@@ -1,21 +1,22 @@
|
|
1
1
|
import type { ContractRouter } from '@orpc/contract';
|
2
|
+
import type { ContextGuard } from './context';
|
2
3
|
import type { FlattenLazy } from './lazy';
|
3
4
|
import type { Middleware } from './middleware';
|
4
5
|
import type { Router } from './router';
|
5
6
|
import type { AdaptedRouter } from './router-builder';
|
6
7
|
import type { Context, MergeContext } from './types';
|
7
|
-
export interface RouterImplementerDef<TContext extends Context, TExtraContext extends Context, TContract extends ContractRouter
|
8
|
-
middlewares
|
8
|
+
export interface RouterImplementerDef<TContext extends Context, TExtraContext extends Context, TContract extends ContractRouter<any>> {
|
9
|
+
middlewares: Middleware<MergeContext<TContext, TExtraContext>, Partial<TExtraContext> | undefined, unknown, any, Record<never, never>>[];
|
9
10
|
contract: TContract;
|
10
11
|
}
|
11
|
-
export declare class RouterImplementer<TContext extends Context, TExtraContext extends Context, TContract extends ContractRouter
|
12
|
+
export declare class RouterImplementer<TContext extends Context, TExtraContext extends Context, TContract extends ContractRouter<any>> {
|
12
13
|
'~type': "RouterImplementer";
|
13
14
|
'~orpc': RouterImplementerDef<TContext, TExtraContext, TContract>;
|
14
15
|
constructor(def: RouterImplementerDef<TContext, TExtraContext, TContract>);
|
15
|
-
use<U extends Context &
|
16
|
-
router<U extends Router<MergeContext<TContext, TExtraContext>, TContract>>(router: U): AdaptedRouter<TContext, U
|
16
|
+
use<U extends Context & ContextGuard<MergeContext<TContext, TExtraContext>>>(middleware: Middleware<MergeContext<TContext, TExtraContext>, U, unknown, unknown, Record<never, never>>): RouterImplementer<TContext, MergeContext<TExtraContext, U>, TContract>;
|
17
|
+
router<U extends Router<MergeContext<TContext, TExtraContext>, TContract>>(router: U): AdaptedRouter<TContext, U, Record<never, never>>;
|
17
18
|
lazy<U extends Router<MergeContext<TContext, TExtraContext>, TContract>>(loader: () => Promise<{
|
18
19
|
default: U;
|
19
|
-
}>): AdaptedRouter<TContext, FlattenLazy<U>>;
|
20
|
+
}>): AdaptedRouter<TContext, FlattenLazy<U>, Record<never, never>>;
|
20
21
|
}
|
21
22
|
//# sourceMappingURL=router-implementer.d.ts.map
|
package/dist/src/router.d.ts
CHANGED
@@ -2,8 +2,8 @@ import type { ContractProcedure, ContractRouter, SchemaInput, SchemaOutput } fro
|
|
2
2
|
import type { ANY_LAZY, Lazy, Lazyable } from './lazy';
|
3
3
|
import type { ANY_PROCEDURE, Procedure } from './procedure';
|
4
4
|
import type { Context } from './types';
|
5
|
-
export type Router<TContext extends Context, TContract extends ContractRouter
|
6
|
-
[K in keyof TContract]: TContract[K] extends ContractRouter ? Router<TContext, TContract[K]> : never;
|
5
|
+
export type Router<TContext extends Context, TContract extends ContractRouter<any>> = Lazyable<TContract extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap> ? Procedure<TContext, any, UInputSchema, UOutputSchema, any, UErrorMap> : {
|
6
|
+
[K in keyof TContract]: TContract[K] extends ContractRouter<any> ? Router<TContext, TContract[K]> : never;
|
7
7
|
}>;
|
8
8
|
export type ANY_ROUTER = Router<any, any>;
|
9
9
|
export type InferRouterInputs<T extends ANY_ROUTER> = T extends Lazy<infer U extends ANY_ROUTER> ? InferRouterInputs<U> : T extends Procedure<any, any, infer UInputSchema, any, any, any> ? SchemaInput<UInputSchema> : {
|
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.31.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -53,8 +53,8 @@
|
|
53
53
|
"next": ">=14.0.0"
|
54
54
|
},
|
55
55
|
"dependencies": {
|
56
|
-
"@orpc/contract": "0.
|
57
|
-
"@orpc/shared": "0.
|
56
|
+
"@orpc/contract": "0.31.0",
|
57
|
+
"@orpc/shared": "0.31.0"
|
58
58
|
},
|
59
59
|
"scripts": {
|
60
60
|
"build": "tsup --onSuccess='tsc -b --noCheck'",
|