@orpc/server 0.11.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-CVLK2PBB.js → chunk-FL4ZAGNE.js} +134 -56
- package/dist/fetch.js +76 -649
- package/dist/index.js +191 -116
- package/dist/src/builder.d.ts +6 -1
- package/dist/src/fetch/handle.d.ts +7 -0
- package/dist/src/fetch/handler.d.ts +3 -0
- package/dist/src/fetch/index.d.ts +4 -0
- package/dist/src/{adapters/fetch.d.ts → fetch/types.d.ts} +9 -15
- package/dist/src/index.d.ts +3 -0
- package/dist/src/lazy.d.ts +23 -0
- package/dist/src/middleware.d.ts +1 -0
- package/dist/src/procedure-builder.d.ts +1 -0
- package/dist/src/procedure-caller.d.ts +7 -5
- package/dist/src/procedure-implementer.d.ts +6 -1
- package/dist/src/procedure.d.ts +6 -2
- package/dist/src/router-builder.d.ts +6 -0
- package/dist/src/router-caller.d.ts +3 -2
- package/dist/src/router-implementer.d.ts +8 -3
- package/dist/src/router.d.ts +5 -3
- package/dist/src/types.d.ts +1 -0
- package/dist/src/utils.d.ts +1 -0
- package/package.json +10 -9
@@ -1,8 +1,10 @@
|
|
1
|
+
import type { DecoratedLazy } from './lazy';
|
1
2
|
import type { Middleware } from './middleware';
|
2
|
-
import type { RouterWithContract } from './router';
|
3
|
+
import type { HandledRouter, RouterWithContract } from './router';
|
3
4
|
import type { Context } from './types';
|
4
5
|
import { type ContractProcedure, type ContractRouter } from '@orpc/contract';
|
5
6
|
import { ProcedureImplementer } from './procedure-implementer';
|
7
|
+
export declare const ROUTER_CONTRACT_SYMBOL: unique symbol;
|
6
8
|
export declare class RouterImplementer<TContext extends Context, TContract extends ContractRouter> {
|
7
9
|
zz$ri: {
|
8
10
|
contract: TContract;
|
@@ -10,10 +12,13 @@ export declare class RouterImplementer<TContext extends Context, TContract exten
|
|
10
12
|
constructor(zz$ri: {
|
11
13
|
contract: TContract;
|
12
14
|
});
|
13
|
-
router(router: RouterWithContract<TContext, TContract>): RouterWithContract<TContext, TContract
|
15
|
+
router(router: RouterWithContract<TContext, TContract>): HandledRouter<RouterWithContract<TContext, TContract>>;
|
16
|
+
lazy(loader: () => Promise<{
|
17
|
+
default: RouterWithContract<TContext, TContract>;
|
18
|
+
}>): DecoratedLazy<RouterWithContract<TContext, TContract>>;
|
14
19
|
}
|
15
20
|
export type ChainedRouterImplementer<TContext extends Context, TContract extends ContractRouter, TExtraContext extends Context> = {
|
16
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;
|
17
22
|
} & RouterImplementer<TContext, TContract>;
|
18
23
|
export declare function chainRouterImplementer<TContext extends Context, TContract extends ContractRouter, TExtraContext extends Context>(contract: TContract, middlewares?: Middleware<any, any, any, any>[]): ChainedRouterImplementer<TContext, TContract, TExtraContext>;
|
19
|
-
|
24
|
+
//# sourceMappingURL=router-implementer.d.ts.map
|
package/dist/src/router.d.ts
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
import type { ContractProcedure, ContractRouter, SchemaInput, SchemaOutput } from '@orpc/contract';
|
2
|
+
import type { ANY_LAZY, DecoratedLazy, Lazy } from './lazy';
|
2
3
|
import type { Context } from './types';
|
3
4
|
import { type DecoratedProcedure, type Procedure } from './procedure';
|
4
5
|
export interface Router<TContext extends Context> {
|
5
|
-
[k: string]: Procedure<TContext, any, any, any, any> | Router<TContext
|
6
|
+
[k: string]: Procedure<TContext, any, any, any, any> | Lazy<Procedure<TContext, any, any, any, any>> | Router<TContext> | Lazy<Router<TContext>>;
|
6
7
|
}
|
7
8
|
export type HandledRouter<TRouter extends Router<any>> = {
|
8
|
-
[K in keyof TRouter]: TRouter[K] extends Procedure<infer UContext, infer UExtraContext, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> ? DecoratedProcedure<UContext, UExtraContext, UInputSchema, UOutputSchema, UFuncOutput> : TRouter[K] extends Router<any> ? HandledRouter<TRouter[K]> : never;
|
9
|
+
[K in keyof TRouter]: TRouter[K] extends Procedure<infer UContext, infer UExtraContext, infer UInputSchema, infer UOutputSchema, infer UFuncOutput> ? DecoratedProcedure<UContext, UExtraContext, UInputSchema, UOutputSchema, UFuncOutput> : TRouter[K] extends ANY_LAZY ? DecoratedLazy<TRouter[K]> : TRouter[K] extends Router<any> ? HandledRouter<TRouter[K]> : never;
|
9
10
|
};
|
10
11
|
export type RouterWithContract<TContext extends Context, TContract extends ContractRouter> = {
|
11
|
-
[K in keyof TContract]: TContract[K] extends ContractProcedure<infer UInputSchema, infer UOutputSchema> ? Procedure<TContext, any, UInputSchema, UOutputSchema, any> : TContract[K] extends ContractRouter ? RouterWithContract<TContext, TContract[K]> : never;
|
12
|
+
[K in keyof TContract]: TContract[K] extends ContractProcedure<infer UInputSchema, infer UOutputSchema> ? Procedure<TContext, any, UInputSchema, UOutputSchema, any> | Lazy<Procedure<TContext, any, UInputSchema, UOutputSchema, any>> : TContract[K] extends ContractRouter ? RouterWithContract<TContext, TContract[K]> | Lazy<RouterWithContract<TContext, TContract[K]>> : never;
|
12
13
|
};
|
13
14
|
export declare function toContractRouter(router: ContractRouter | Router<any>): ContractRouter;
|
14
15
|
export type InferRouterInputs<T extends Router<any>> = {
|
@@ -17,3 +18,4 @@ export type InferRouterInputs<T extends Router<any>> = {
|
|
17
18
|
export type InferRouterOutputs<T extends Router<any>> = {
|
18
19
|
[K in keyof T]: T[K] extends Procedure<any, any, any, infer UOutputSchema, infer UFuncOutput> ? SchemaOutput<UOutputSchema, UFuncOutput> : T[K] extends Router<any> ? InferRouterOutputs<T[K]> : never;
|
19
20
|
};
|
21
|
+
//# sourceMappingURL=router.d.ts.map
|
package/dist/src/types.d.ts
CHANGED
package/dist/src/utils.d.ts
CHANGED
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.13.0",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -20,7 +20,7 @@
|
|
20
20
|
"default": "./dist/index.js"
|
21
21
|
},
|
22
22
|
"./fetch": {
|
23
|
-
"types": "./dist/src/
|
23
|
+
"types": "./dist/src/fetch/index.d.ts",
|
24
24
|
"import": "./dist/fetch.js",
|
25
25
|
"default": "./dist/fetch.js"
|
26
26
|
},
|
@@ -29,23 +29,24 @@
|
|
29
29
|
}
|
30
30
|
},
|
31
31
|
"files": [
|
32
|
-
"
|
32
|
+
"!**/*.map",
|
33
|
+
"!**/*.tsbuildinfo",
|
33
34
|
"dist"
|
34
35
|
],
|
35
36
|
"peerDependencies": {
|
36
37
|
"zod": ">=3.23.0",
|
37
|
-
"@orpc/zod": "0.
|
38
|
+
"@orpc/zod": "0.13.0"
|
38
39
|
},
|
39
40
|
"dependencies": {
|
40
|
-
"@orpc/
|
41
|
-
"@orpc/
|
42
|
-
"@orpc/shared": "0.
|
41
|
+
"@orpc/transformer": "0.13.0",
|
42
|
+
"@orpc/contract": "0.13.0",
|
43
|
+
"@orpc/shared": "0.13.0"
|
43
44
|
},
|
44
45
|
"devDependencies": {
|
45
|
-
"
|
46
|
+
"@orpc/openapi": "0.13.0"
|
46
47
|
},
|
47
48
|
"scripts": {
|
48
|
-
"build": "tsup --clean --entry.index=src/index.ts --entry.fetch=src/
|
49
|
+
"build": "tsup --clean --sourcemap --entry.index=src/index.ts --entry.fetch=src/fetch/index.ts --format=esm --onSuccess='tsc -b --noCheck'",
|
49
50
|
"build:watch": "pnpm run build --watch",
|
50
51
|
"type:check": "tsc -b"
|
51
52
|
}
|