@orpc/server 0.0.0-next.d42488d → 0.0.0-next.da84cda
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/chunk-VY6NXNQT.js +301 -0
- package/dist/chunk-WUOGVGWG.js +1 -0
- package/dist/{chunk-FN62GL22.js → chunk-XDC42C3C.js} +78 -33
- package/dist/fetch.js +10 -281
- package/dist/hono.js +30 -0
- package/dist/index.js +143 -111
- package/dist/next.js +36 -0
- package/dist/node.js +87 -0
- package/dist/src/{fetch → adapters/fetch}/index.d.ts +1 -1
- package/dist/src/adapters/fetch/orpc-handler.d.ts +20 -0
- package/dist/src/adapters/fetch/orpc-payload-codec.d.ts +16 -0
- package/dist/src/{fetch → adapters/fetch}/orpc-procedure-matcher.d.ts +2 -2
- package/dist/src/adapters/fetch/types.d.ts +21 -0
- package/dist/src/adapters/hono/index.d.ts +3 -0
- package/dist/src/adapters/hono/middleware.d.ts +12 -0
- package/dist/src/adapters/next/index.d.ts +3 -0
- package/dist/src/adapters/next/serve.d.ts +19 -0
- package/dist/src/adapters/node/index.d.ts +5 -0
- package/dist/src/adapters/node/orpc-handler.d.ts +12 -0
- package/dist/src/adapters/node/request-listener.d.ts +28 -0
- package/dist/src/adapters/node/types.d.ts +22 -0
- package/dist/src/builder.d.ts +11 -10
- package/dist/src/error.d.ts +10 -0
- package/dist/src/implementer-chainable.d.ts +2 -2
- package/dist/src/index.d.ts +3 -1
- package/dist/src/lazy-decorated.d.ts +3 -6
- package/dist/src/middleware-decorated.d.ts +6 -5
- package/dist/src/middleware.d.ts +20 -8
- package/dist/src/procedure-builder.d.ts +17 -15
- package/dist/src/procedure-client.d.ts +9 -16
- package/dist/src/procedure-decorated.d.ts +22 -10
- package/dist/src/procedure-implementer.d.ts +13 -12
- package/dist/src/procedure-utils.d.ts +17 -0
- package/dist/src/procedure.d.ts +33 -13
- package/dist/src/router-builder.d.ts +4 -4
- package/dist/src/router-client.d.ts +7 -6
- package/dist/src/router-implementer.d.ts +2 -2
- package/dist/src/router.d.ts +4 -4
- package/dist/src/types.d.ts +2 -0
- package/package.json +24 -8
- package/dist/src/fetch/composite-handler.d.ts +0 -8
- package/dist/src/fetch/orpc-handler.d.ts +0 -20
- package/dist/src/fetch/orpc-payload-codec.d.ts +0 -9
- package/dist/src/fetch/types.d.ts +0 -16
- /package/dist/src/{fetch → adapters/fetch}/super-json.d.ts +0 -0
package/dist/src/types.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
import type { FindGlobalInstanceType } from '@orpc/shared';
|
1
2
|
import type { ANY_PROCEDURE } from './procedure';
|
2
3
|
export type Context = Record<string, any> | undefined;
|
3
4
|
export type WELL_CONTEXT = Record<string, unknown> | undefined;
|
4
5
|
export type MergeContext<TA extends Context, TB extends Context> = TA extends undefined ? TB : TB extends undefined ? TA : TA & TB;
|
6
|
+
export type AbortSignal = FindGlobalInstanceType<'AbortSignal'>;
|
5
7
|
export interface WithSignal {
|
6
8
|
signal?: AbortSignal;
|
7
9
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@orpc/server",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.0-next.
|
4
|
+
"version": "0.0.0-next.da84cda",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -20,10 +20,25 @@
|
|
20
20
|
"default": "./dist/index.js"
|
21
21
|
},
|
22
22
|
"./fetch": {
|
23
|
-
"types": "./dist/src/fetch/index.d.ts",
|
23
|
+
"types": "./dist/src/adapters/fetch/index.d.ts",
|
24
24
|
"import": "./dist/fetch.js",
|
25
25
|
"default": "./dist/fetch.js"
|
26
26
|
},
|
27
|
+
"./hono": {
|
28
|
+
"types": "./dist/src/adapters/hono/index.d.ts",
|
29
|
+
"import": "./dist/hono.js",
|
30
|
+
"default": "./dist/hono.js"
|
31
|
+
},
|
32
|
+
"./next": {
|
33
|
+
"types": "./dist/src/adapters/next/index.d.ts",
|
34
|
+
"import": "./dist/next.js",
|
35
|
+
"default": "./dist/next.js"
|
36
|
+
},
|
37
|
+
"./node": {
|
38
|
+
"types": "./dist/src/adapters/node/index.d.ts",
|
39
|
+
"import": "./dist/node.js",
|
40
|
+
"default": "./dist/node.js"
|
41
|
+
},
|
27
42
|
"./🔒/*": {
|
28
43
|
"types": "./dist/src/*.d.ts"
|
29
44
|
}
|
@@ -33,15 +48,16 @@
|
|
33
48
|
"!**/*.tsbuildinfo",
|
34
49
|
"dist"
|
35
50
|
],
|
36
|
-
"
|
37
|
-
"
|
38
|
-
"
|
51
|
+
"peerDependencies": {
|
52
|
+
"hono": ">=4.6.0",
|
53
|
+
"next": ">=14.0.0"
|
39
54
|
},
|
40
|
-
"
|
41
|
-
"
|
55
|
+
"dependencies": {
|
56
|
+
"@orpc/contract": "0.0.0-next.da84cda",
|
57
|
+
"@orpc/shared": "0.0.0-next.da84cda"
|
42
58
|
},
|
43
59
|
"scripts": {
|
44
|
-
"build": "tsup --
|
60
|
+
"build": "tsup --onSuccess='tsc -b --noCheck'",
|
45
61
|
"build:watch": "pnpm run build --watch",
|
46
62
|
"type:check": "tsc -b"
|
47
63
|
}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import type { Context } from '../types';
|
2
|
-
import type { ConditionalFetchHandler, FetchHandler, FetchOptions } from './types';
|
3
|
-
export declare class CompositeHandler<T extends Context> implements FetchHandler<T> {
|
4
|
-
private readonly handlers;
|
5
|
-
constructor(handlers: ConditionalFetchHandler<T>[]);
|
6
|
-
fetch(request: Request, ...opt: [options: FetchOptions<T>] | (undefined extends T ? [] : never)): Promise<Response>;
|
7
|
-
}
|
8
|
-
//# sourceMappingURL=composite-handler.d.ts.map
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import type { Hooks } from '@orpc/shared';
|
2
|
-
import type { Router } from '../router';
|
3
|
-
import type { Context, WithSignal } from '../types';
|
4
|
-
import type { ConditionalFetchHandler, FetchOptions } from './types';
|
5
|
-
import { type PublicORPCPayloadCodec } from './orpc-payload-codec';
|
6
|
-
import { type PublicORPCProcedureMatcher } from './orpc-procedure-matcher';
|
7
|
-
export type ORPCHandlerOptions<T extends Context> = Hooks<Request, Response, T, WithSignal> & {
|
8
|
-
procedureMatcher?: PublicORPCProcedureMatcher;
|
9
|
-
payloadCodec?: PublicORPCPayloadCodec;
|
10
|
-
};
|
11
|
-
export declare class ORPCHandler<T extends Context> implements ConditionalFetchHandler<T> {
|
12
|
-
readonly router: Router<T, any>;
|
13
|
-
readonly options?: NoInfer<ORPCHandlerOptions<T>> | undefined;
|
14
|
-
private readonly procedureMatcher;
|
15
|
-
private readonly payloadCodec;
|
16
|
-
constructor(router: Router<T, any>, options?: NoInfer<ORPCHandlerOptions<T>> | undefined);
|
17
|
-
condition(request: Request): boolean;
|
18
|
-
fetch(request: Request, ...[options]: [options: FetchOptions<T>] | (undefined extends T ? [] : never)): Promise<Response>;
|
19
|
-
}
|
20
|
-
//# sourceMappingURL=orpc-handler.d.ts.map
|
@@ -1,9 +0,0 @@
|
|
1
|
-
export declare class ORPCPayloadCodec {
|
2
|
-
encode(payload: unknown): {
|
3
|
-
body: FormData | string;
|
4
|
-
headers?: Headers;
|
5
|
-
};
|
6
|
-
decode(re: Request | Response): Promise<unknown>;
|
7
|
-
}
|
8
|
-
export type PublicORPCPayloadCodec = Pick<ORPCPayloadCodec, keyof ORPCPayloadCodec>;
|
9
|
-
//# sourceMappingURL=orpc-payload-codec.d.ts.map
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { HTTPPath } from '@orpc/contract';
|
2
|
-
import type { Context, WithSignal } from '../types';
|
3
|
-
export type FetchOptions<T extends Context> = WithSignal & {
|
4
|
-
prefix?: HTTPPath;
|
5
|
-
} & (undefined extends T ? {
|
6
|
-
context?: T;
|
7
|
-
} : {
|
8
|
-
context: T;
|
9
|
-
});
|
10
|
-
export interface FetchHandler<T extends Context> {
|
11
|
-
fetch: (request: Request, ...opt: [options: FetchOptions<T>] | (undefined extends T ? [] : never)) => Promise<Response>;
|
12
|
-
}
|
13
|
-
export interface ConditionalFetchHandler<T extends Context> extends FetchHandler<T> {
|
14
|
-
condition: (request: Request) => boolean;
|
15
|
-
}
|
16
|
-
//# sourceMappingURL=types.d.ts.map
|
File without changes
|