@orpc/server 0.0.0-next.31590a1 → 0.0.0-next.32cb70c
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-ESTRJAOX.js +299 -0
- package/dist/{chunk-NOA3GBJQ.js → chunk-KK4SDLC7.js} +9 -69
- package/dist/chunk-WUOGVGWG.js +1 -0
- package/dist/fetch.js +9 -12
- package/dist/hono.js +13 -25
- package/dist/index.js +2 -16
- package/dist/next.js +10 -13
- package/dist/node.js +61 -149
- package/dist/src/adapters/fetch/index.d.ts +4 -2
- 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/adapters/fetch/orpc-procedure-matcher.d.ts +12 -0
- package/dist/src/adapters/fetch/super-json.d.ts +12 -0
- package/dist/src/adapters/fetch/types.d.ts +10 -2
- package/dist/src/adapters/hono/middleware.d.ts +2 -3
- package/dist/src/adapters/next/serve.d.ts +2 -3
- package/dist/src/adapters/node/index.d.ts +3 -2
- 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 +14 -13
- package/dist/src/implementer-variants.d.ts +5 -6
- package/dist/src/implementer.d.ts +6 -7
- package/dist/src/index.d.ts +1 -3
- package/package.json +3 -17
- package/dist/chunk-CVIWJKJC.js +0 -308
- package/dist/chunk-EYGVJA7A.js +0 -136
- package/dist/chunk-OXB4YX67.js +0 -111
- package/dist/plugins.js +0 -11
- package/dist/src/adapters/fetch/rpc-handler.d.ts +0 -10
- package/dist/src/adapters/fetch/utils.d.ts +0 -6
- package/dist/src/adapters/node/rpc-handler.d.ts +0 -10
- package/dist/src/adapters/node/utils.d.ts +0 -5
- package/dist/src/adapters/standard/handler.d.ts +0 -47
- package/dist/src/adapters/standard/index.d.ts +0 -7
- package/dist/src/adapters/standard/rpc-codec.d.ts +0 -15
- package/dist/src/adapters/standard/rpc-handler.d.ts +0 -8
- package/dist/src/adapters/standard/rpc-matcher.d.ts +0 -10
- package/dist/src/adapters/standard/rpc-serializer.d.ts +0 -16
- package/dist/src/adapters/standard/types.d.ts +0 -44
- package/dist/src/plugins/base.d.ts +0 -11
- package/dist/src/plugins/cors.d.ts +0 -18
- package/dist/src/plugins/index.d.ts +0 -4
- package/dist/src/plugins/response-headers.d.ts +0 -10
- package/dist/src/utils.d.ts +0 -24
- package/dist/standard.js +0 -17
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { HTTPPath } from '@orpc/contract';
|
2
|
-
import type { StandardMatcher, StandardMatchResult } from './types';
|
3
|
-
import { type AnyRouter } from '../../router';
|
4
|
-
export declare class RPCMatcher implements StandardMatcher {
|
5
|
-
private readonly tree;
|
6
|
-
private pendingRouters;
|
7
|
-
init(router: AnyRouter, path?: string[]): void;
|
8
|
-
match(_method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
9
|
-
}
|
10
|
-
//# sourceMappingURL=rpc-matcher.d.ts.map
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { Segment } from '@orpc/shared';
|
2
|
-
export type RPCSerializedJsonMeta = ['bigint' | 'date' | 'nan' | 'undefined' | 'set' | 'map' | 'regexp' | 'url', Segment[]][];
|
3
|
-
export type RPCSerialized = {
|
4
|
-
json: unknown;
|
5
|
-
meta: RPCSerializedJsonMeta;
|
6
|
-
} | FormData | Blob;
|
7
|
-
export type RPCSerializedFormDataMaps = Segment[][];
|
8
|
-
export declare class RPCSerializer {
|
9
|
-
serialize(data: unknown): RPCSerialized;
|
10
|
-
deserialize(serialized: RPCSerialized): unknown;
|
11
|
-
}
|
12
|
-
export declare function serializeRPCJson(value: unknown, segments?: Segment[], meta?: RPCSerializedJsonMeta): {
|
13
|
-
json: unknown;
|
14
|
-
meta: RPCSerializedJsonMeta;
|
15
|
-
};
|
16
|
-
//# sourceMappingURL=rpc-serializer.d.ts.map
|
@@ -1,44 +0,0 @@
|
|
1
|
-
import type { AbortSignal, HTTPPath, ORPCError } from '@orpc/contract';
|
2
|
-
import type { JsonValue } from '@orpc/shared';
|
3
|
-
import type { AnyProcedure } from '../../procedure';
|
4
|
-
import type { AnyRouter } from '../../router';
|
5
|
-
export interface StandardHeaders {
|
6
|
-
[key: string]: string | string[] | undefined;
|
7
|
-
}
|
8
|
-
export type StandardBody = undefined | JsonValue | Blob | URLSearchParams | FormData;
|
9
|
-
export interface StandardRequest {
|
10
|
-
/**
|
11
|
-
* Can be { request: Request } or { request: IncomingMessage, response: ServerResponse } based on the adapter.
|
12
|
-
*/
|
13
|
-
raw: Record<string, unknown>;
|
14
|
-
method: string;
|
15
|
-
url: URL;
|
16
|
-
headers: StandardHeaders;
|
17
|
-
/**
|
18
|
-
* The body has been parsed base on the content-type header.
|
19
|
-
* This method can safely call multiple times (cached).
|
20
|
-
*/
|
21
|
-
body(): Promise<StandardBody>;
|
22
|
-
signal?: AbortSignal;
|
23
|
-
}
|
24
|
-
export interface StandardResponse {
|
25
|
-
status: number;
|
26
|
-
headers: StandardHeaders;
|
27
|
-
body: StandardBody;
|
28
|
-
}
|
29
|
-
export type StandardParams = Record<string, string>;
|
30
|
-
export type StandardMatchResult = {
|
31
|
-
path: string[];
|
32
|
-
procedure: AnyProcedure;
|
33
|
-
params?: StandardParams;
|
34
|
-
} | undefined;
|
35
|
-
export interface StandardMatcher {
|
36
|
-
init(router: AnyRouter): void;
|
37
|
-
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
38
|
-
}
|
39
|
-
export interface StandardCodec {
|
40
|
-
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
41
|
-
encodeError(error: ORPCError<any, any>): StandardResponse;
|
42
|
-
decode(request: StandardRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
43
|
-
}
|
44
|
-
//# sourceMappingURL=types.d.ts.map
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { StandardHandlerOptions } from '../adapters/standard';
|
2
|
-
import type { Context } from '../context';
|
3
|
-
export interface Plugin<TContext extends Context> {
|
4
|
-
init?(options: StandardHandlerOptions<TContext>): void;
|
5
|
-
}
|
6
|
-
export declare class CompositePlugin<TContext extends Context> implements Plugin<TContext> {
|
7
|
-
private readonly plugins;
|
8
|
-
constructor(plugins?: Plugin<TContext>[]);
|
9
|
-
init(options: StandardHandlerOptions<TContext>): void;
|
10
|
-
}
|
11
|
-
//# sourceMappingURL=base.d.ts.map
|
@@ -1,18 +0,0 @@
|
|
1
|
-
import type { StandardHandlerInterceptorOptions, StandardHandlerOptions } from '../adapters/standard';
|
2
|
-
import type { Context } from '../context';
|
3
|
-
import type { Plugin } from './base';
|
4
|
-
import { type Value } from '@orpc/shared';
|
5
|
-
export interface CORSOptions<TContext extends Context> {
|
6
|
-
origin: Value<string | string[] | null | undefined, [origin: string, options: StandardHandlerInterceptorOptions<TContext>]>;
|
7
|
-
allowMethods?: string[];
|
8
|
-
allowHeaders?: string[];
|
9
|
-
maxAge?: number;
|
10
|
-
credentials?: boolean;
|
11
|
-
exposeHeaders?: string[];
|
12
|
-
}
|
13
|
-
export declare class CORSPlugin<TContext extends Context> implements Plugin<TContext> {
|
14
|
-
private readonly options;
|
15
|
-
constructor(options?: Partial<CORSOptions<TContext>>);
|
16
|
-
init(options: StandardHandlerOptions<TContext>): void;
|
17
|
-
}
|
18
|
-
//# sourceMappingURL=cors.d.ts.map
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { StandardHandlerOptions } from '../adapters/standard';
|
2
|
-
import type { Context } from '../context';
|
3
|
-
import type { Plugin } from './base';
|
4
|
-
export interface ResponseHeadersPluginContext {
|
5
|
-
resHeaders?: Headers;
|
6
|
-
}
|
7
|
-
export declare class ResponseHeadersPlugin<TContext extends ResponseHeadersPluginContext & Context> implements Plugin<TContext> {
|
8
|
-
init(options: StandardHandlerOptions<TContext>): void;
|
9
|
-
}
|
10
|
-
//# sourceMappingURL=response-headers.d.ts.map
|
package/dist/src/utils.d.ts
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
import type { AnyContractProcedure, AnyContractRouter, HTTPPath } from '@orpc/contract';
|
2
|
-
import type { Lazy } from './lazy';
|
3
|
-
import type { AnyProcedure } from './procedure';
|
4
|
-
import type { AnyRouter } from './router';
|
5
|
-
export interface EachContractProcedureOptions {
|
6
|
-
router: AnyRouter | AnyContractRouter;
|
7
|
-
path: string[];
|
8
|
-
}
|
9
|
-
export interface EachContractProcedureCallbackOptions {
|
10
|
-
contract: AnyContractProcedure;
|
11
|
-
path: string[];
|
12
|
-
}
|
13
|
-
export interface EachContractProcedureLaziedOptions {
|
14
|
-
lazied: Lazy<AnyProcedure> | Lazy<Record<string, AnyRouter> | AnyProcedure>;
|
15
|
-
path: string[];
|
16
|
-
}
|
17
|
-
export declare function eachContractProcedure(options: EachContractProcedureOptions, callback: (options: EachContractProcedureCallbackOptions) => void, laziedOptions?: EachContractProcedureLaziedOptions[]): EachContractProcedureLaziedOptions[];
|
18
|
-
export declare function eachAllContractProcedure(options: EachContractProcedureOptions, callback: (options: EachContractProcedureCallbackOptions) => void): Promise<void>;
|
19
|
-
export declare function convertPathToHttpPath(path: string[]): HTTPPath;
|
20
|
-
/**
|
21
|
-
* Create a new procedure that ensure the contract is applied to the procedure.
|
22
|
-
*/
|
23
|
-
export declare function createContractedProcedure(contract: AnyContractProcedure, procedure: AnyProcedure): AnyProcedure;
|
24
|
-
//# sourceMappingURL=utils.d.ts.map
|
package/dist/standard.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
RPCCodec,
|
3
|
-
RPCMatcher,
|
4
|
-
RPCSerializer,
|
5
|
-
StandardHandler,
|
6
|
-
serializeRPCJson
|
7
|
-
} from "./chunk-CVIWJKJC.js";
|
8
|
-
import "./chunk-NOA3GBJQ.js";
|
9
|
-
import "./chunk-OXB4YX67.js";
|
10
|
-
export {
|
11
|
-
RPCCodec,
|
12
|
-
RPCMatcher,
|
13
|
-
RPCSerializer,
|
14
|
-
StandardHandler,
|
15
|
-
serializeRPCJson
|
16
|
-
};
|
17
|
-
//# sourceMappingURL=standard.js.map
|