@orpc/server 0.0.0-next.ac2a918 → 0.0.0-next.ac2c329
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/README.md +15 -2
- package/dist/adapters/fetch/index.d.mts +58 -0
- package/dist/adapters/fetch/index.d.ts +58 -0
- package/dist/adapters/fetch/index.mjs +105 -0
- package/dist/adapters/node/index.d.mts +57 -0
- package/dist/adapters/node/index.d.ts +57 -0
- package/dist/adapters/node/index.mjs +90 -0
- package/dist/adapters/standard/index.d.mts +26 -0
- package/dist/adapters/standard/index.d.ts +26 -0
- package/dist/adapters/standard/index.mjs +8 -0
- package/dist/index.d.mts +291 -0
- package/dist/index.d.ts +291 -0
- package/dist/{index.js → index.mjs} +107 -157
- package/dist/plugins/index.d.mts +124 -0
- package/dist/plugins/index.d.ts +124 -0
- package/dist/plugins/index.mjs +252 -0
- package/dist/shared/server.B5yVxwZh.d.mts +17 -0
- package/dist/shared/server.BVwwTHyO.mjs +9 -0
- package/dist/shared/server.BW-nUGgA.mjs +36 -0
- package/dist/shared/server.By38lRwX.d.ts +17 -0
- package/dist/{chunk-MHVECKBC.js → shared/server.C37gDhSZ.mjs} +167 -224
- package/dist/shared/server.ClO23hLW.d.mts +73 -0
- package/dist/shared/server.Cqam9L0P.d.mts +10 -0
- package/dist/shared/server.CuXY46Yy.d.ts +10 -0
- package/dist/shared/server.DFuJLDuo.mjs +190 -0
- package/dist/shared/server.DQJX4Gnf.d.mts +143 -0
- package/dist/shared/server.DQJX4Gnf.d.ts +143 -0
- package/dist/shared/server.DsVSuKTu.d.ts +73 -0
- package/package.json +24 -43
- package/dist/chunk-MBMXGUNI.js +0 -32
- package/dist/chunk-NTHCS5CK.js +0 -182
- package/dist/chunk-TXHKQO7N.js +0 -120
- package/dist/fetch.js +0 -10
- package/dist/hono.js +0 -34
- package/dist/next.js +0 -31
- package/dist/node.js +0 -31
- package/dist/plugins.js +0 -11
- package/dist/src/adapters/fetch/index.d.ts +0 -3
- package/dist/src/adapters/fetch/rpc-handler.d.ts +0 -11
- package/dist/src/adapters/fetch/types.d.ts +0 -14
- package/dist/src/adapters/hono/index.d.ts +0 -3
- package/dist/src/adapters/hono/middleware.d.ts +0 -12
- package/dist/src/adapters/next/index.d.ts +0 -3
- package/dist/src/adapters/next/serve.d.ts +0 -19
- package/dist/src/adapters/node/index.d.ts +0 -3
- package/dist/src/adapters/node/rpc-handler.d.ts +0 -11
- package/dist/src/adapters/node/types.d.ts +0 -22
- package/dist/src/adapters/standard/handler.d.ts +0 -53
- package/dist/src/adapters/standard/index.d.ts +0 -6
- package/dist/src/adapters/standard/rpc-codec.d.ts +0 -16
- 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/types.d.ts +0 -21
- package/dist/src/builder-variants.d.ts +0 -75
- package/dist/src/builder.d.ts +0 -58
- package/dist/src/config.d.ts +0 -6
- package/dist/src/context.d.ts +0 -8
- package/dist/src/error.d.ts +0 -12
- package/dist/src/hidden.d.ts +0 -8
- package/dist/src/implementer-procedure.d.ts +0 -33
- package/dist/src/implementer-variants.d.ts +0 -18
- package/dist/src/implementer.d.ts +0 -29
- package/dist/src/index.d.ts +0 -25
- package/dist/src/lazy-utils.d.ts +0 -6
- package/dist/src/lazy.d.ts +0 -22
- package/dist/src/middleware-decorated.d.ts +0 -11
- package/dist/src/middleware-utils.d.ts +0 -5
- package/dist/src/middleware.d.ts +0 -38
- package/dist/src/plugins/base.d.ts +0 -11
- package/dist/src/plugins/cors.d.ts +0 -19
- package/dist/src/plugins/index.d.ts +0 -4
- package/dist/src/plugins/response-headers.d.ts +0 -10
- package/dist/src/procedure-client.d.ts +0 -33
- package/dist/src/procedure-decorated.d.ts +0 -24
- package/dist/src/procedure-utils.d.ts +0 -19
- package/dist/src/procedure.d.ts +0 -31
- package/dist/src/router-accessible-lazy.d.ts +0 -8
- package/dist/src/router-client.d.ts +0 -12
- package/dist/src/router.d.ts +0 -30
- package/dist/src/utils.d.ts +0 -24
- package/dist/standard.js +0 -13
@@ -0,0 +1,190 @@
|
|
1
|
+
import { toHttpPath, StandardRPCJsonSerializer, StandardRPCSerializer } from '@orpc/client/standard';
|
2
|
+
import { toArray, intercept, parseEmptyableJSON } from '@orpc/shared';
|
3
|
+
import '@orpc/standard-server/batch';
|
4
|
+
import { ORPCError, toORPCError } from '@orpc/client';
|
5
|
+
import { S as StrictGetMethodPlugin } from './server.BW-nUGgA.mjs';
|
6
|
+
import { c as createProcedureClient, t as traverseContractProcedures, i as isProcedure, u as unlazy, g as getRouter, a as createContractedProcedure } from './server.C37gDhSZ.mjs';
|
7
|
+
|
8
|
+
class CompositeStandardHandlerPlugin {
|
9
|
+
plugins;
|
10
|
+
constructor(plugins = []) {
|
11
|
+
this.plugins = [...plugins].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
12
|
+
}
|
13
|
+
init(options) {
|
14
|
+
for (const plugin of this.plugins) {
|
15
|
+
plugin.init?.(options);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
class StandardHandler {
|
21
|
+
constructor(router, matcher, codec, options) {
|
22
|
+
this.matcher = matcher;
|
23
|
+
this.codec = codec;
|
24
|
+
const plugins = new CompositeStandardHandlerPlugin(options.plugins);
|
25
|
+
plugins.init(options);
|
26
|
+
this.interceptors = toArray(options.interceptors);
|
27
|
+
this.clientInterceptors = toArray(options.clientInterceptors);
|
28
|
+
this.rootInterceptors = toArray(options.rootInterceptors);
|
29
|
+
this.matcher.init(router);
|
30
|
+
}
|
31
|
+
interceptors;
|
32
|
+
clientInterceptors;
|
33
|
+
rootInterceptors;
|
34
|
+
async handle(request, options) {
|
35
|
+
const prefix = options.prefix?.replace(/\/$/, "") || void 0;
|
36
|
+
if (prefix && !request.url.pathname.startsWith(`${prefix}/`) && request.url.pathname !== prefix) {
|
37
|
+
return { matched: false, response: void 0 };
|
38
|
+
}
|
39
|
+
return intercept(
|
40
|
+
this.rootInterceptors,
|
41
|
+
{ ...options, request, prefix },
|
42
|
+
async (interceptorOptions) => {
|
43
|
+
let isDecoding = false;
|
44
|
+
try {
|
45
|
+
return await intercept(
|
46
|
+
this.interceptors,
|
47
|
+
interceptorOptions,
|
48
|
+
async ({ request: request2, context, prefix: prefix2 }) => {
|
49
|
+
const method = request2.method;
|
50
|
+
const url = request2.url;
|
51
|
+
const pathname = prefix2 ? url.pathname.replace(prefix2, "") : url.pathname;
|
52
|
+
const match = await this.matcher.match(method, `/${pathname.replace(/^\/|\/$/g, "")}`);
|
53
|
+
if (!match) {
|
54
|
+
return { matched: false, response: void 0 };
|
55
|
+
}
|
56
|
+
const client = createProcedureClient(match.procedure, {
|
57
|
+
context,
|
58
|
+
path: match.path,
|
59
|
+
interceptors: this.clientInterceptors
|
60
|
+
});
|
61
|
+
isDecoding = true;
|
62
|
+
const input = await this.codec.decode(request2, match.params, match.procedure);
|
63
|
+
isDecoding = false;
|
64
|
+
const lastEventId = Array.isArray(request2.headers["last-event-id"]) ? request2.headers["last-event-id"].at(-1) : request2.headers["last-event-id"];
|
65
|
+
const output = await client(input, { signal: request2.signal, lastEventId });
|
66
|
+
const response = this.codec.encode(output, match.procedure);
|
67
|
+
return {
|
68
|
+
matched: true,
|
69
|
+
response
|
70
|
+
};
|
71
|
+
}
|
72
|
+
);
|
73
|
+
} catch (e) {
|
74
|
+
const error = isDecoding && !(e instanceof ORPCError) ? new ORPCError("BAD_REQUEST", {
|
75
|
+
message: `Malformed request. Ensure the request body is properly formatted and the 'Content-Type' header is set correctly.`,
|
76
|
+
cause: e
|
77
|
+
}) : toORPCError(e);
|
78
|
+
const response = this.codec.encodeError(error);
|
79
|
+
return {
|
80
|
+
matched: true,
|
81
|
+
response
|
82
|
+
};
|
83
|
+
}
|
84
|
+
}
|
85
|
+
);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
class StandardRPCCodec {
|
90
|
+
constructor(serializer) {
|
91
|
+
this.serializer = serializer;
|
92
|
+
}
|
93
|
+
async decode(request, _params, _procedure) {
|
94
|
+
const serialized = request.method === "GET" ? parseEmptyableJSON(request.url.searchParams.getAll("data").at(-1)) : await request.body();
|
95
|
+
return this.serializer.deserialize(serialized);
|
96
|
+
}
|
97
|
+
encode(output, _procedure) {
|
98
|
+
return {
|
99
|
+
status: 200,
|
100
|
+
headers: {},
|
101
|
+
body: this.serializer.serialize(output)
|
102
|
+
};
|
103
|
+
}
|
104
|
+
encodeError(error) {
|
105
|
+
return {
|
106
|
+
status: error.status,
|
107
|
+
headers: {},
|
108
|
+
body: this.serializer.serialize(error.toJSON())
|
109
|
+
};
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
class StandardRPCMatcher {
|
114
|
+
tree = {};
|
115
|
+
pendingRouters = [];
|
116
|
+
init(router, path = []) {
|
117
|
+
const laziedOptions = traverseContractProcedures({ router, path }, ({ path: path2, contract }) => {
|
118
|
+
const httpPath = toHttpPath(path2);
|
119
|
+
if (isProcedure(contract)) {
|
120
|
+
this.tree[httpPath] = {
|
121
|
+
path: path2,
|
122
|
+
contract,
|
123
|
+
procedure: contract,
|
124
|
+
// this mean dev not used contract-first so we can used contract as procedure directly
|
125
|
+
router
|
126
|
+
};
|
127
|
+
} else {
|
128
|
+
this.tree[httpPath] = {
|
129
|
+
path: path2,
|
130
|
+
contract,
|
131
|
+
procedure: void 0,
|
132
|
+
router
|
133
|
+
};
|
134
|
+
}
|
135
|
+
});
|
136
|
+
this.pendingRouters.push(...laziedOptions.map((option) => ({
|
137
|
+
...option,
|
138
|
+
httpPathPrefix: toHttpPath(option.path)
|
139
|
+
})));
|
140
|
+
}
|
141
|
+
async match(_method, pathname) {
|
142
|
+
if (this.pendingRouters.length) {
|
143
|
+
const newPendingRouters = [];
|
144
|
+
for (const pendingRouter of this.pendingRouters) {
|
145
|
+
if (pathname.startsWith(pendingRouter.httpPathPrefix)) {
|
146
|
+
const { default: router } = await unlazy(pendingRouter.router);
|
147
|
+
this.init(router, pendingRouter.path);
|
148
|
+
} else {
|
149
|
+
newPendingRouters.push(pendingRouter);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
this.pendingRouters = newPendingRouters;
|
153
|
+
}
|
154
|
+
const match = this.tree[pathname];
|
155
|
+
if (!match) {
|
156
|
+
return void 0;
|
157
|
+
}
|
158
|
+
if (!match.procedure) {
|
159
|
+
const { default: maybeProcedure } = await unlazy(getRouter(match.router, match.path));
|
160
|
+
if (!isProcedure(maybeProcedure)) {
|
161
|
+
throw new Error(`
|
162
|
+
[Contract-First] Missing or invalid implementation for procedure at path: ${toHttpPath(match.path)}.
|
163
|
+
Ensure that the procedure is correctly defined and matches the expected contract.
|
164
|
+
`);
|
165
|
+
}
|
166
|
+
match.procedure = createContractedProcedure(maybeProcedure, match.contract);
|
167
|
+
}
|
168
|
+
return {
|
169
|
+
path: match.path,
|
170
|
+
procedure: match.procedure
|
171
|
+
};
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
class StandardRPCHandler extends StandardHandler {
|
176
|
+
constructor(router, options) {
|
177
|
+
options.plugins ??= [];
|
178
|
+
const strictGetMethodPluginEnabled = options.strictGetMethodPluginEnabled ?? true;
|
179
|
+
if (strictGetMethodPluginEnabled) {
|
180
|
+
options.plugins.push(new StrictGetMethodPlugin());
|
181
|
+
}
|
182
|
+
const jsonSerializer = new StandardRPCJsonSerializer(options);
|
183
|
+
const serializer = new StandardRPCSerializer(jsonSerializer);
|
184
|
+
const matcher = new StandardRPCMatcher();
|
185
|
+
const codec = new StandardRPCCodec(serializer);
|
186
|
+
super(router, matcher, codec, options);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
export { CompositeStandardHandlerPlugin as C, StandardHandler as S, StandardRPCCodec as a, StandardRPCHandler as b, StandardRPCMatcher as c };
|
@@ -0,0 +1,143 @@
|
|
1
|
+
import { ORPCErrorCode, ORPCErrorOptions, ORPCError, HTTPPath, ClientContext, Client } from '@orpc/client';
|
2
|
+
import { MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
|
3
|
+
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@orpc/contract';
|
4
|
+
|
5
|
+
type Context = Record<PropertyKey, any>;
|
6
|
+
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
7
|
+
type MergedCurrentContext<T extends Context, U extends Context> = Omit<T, keyof U> & U;
|
8
|
+
declare function mergeCurrentContext<T extends Context, U extends Context>(context: T, other: U): MergedCurrentContext<T, U>;
|
9
|
+
|
10
|
+
type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
|
11
|
+
type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
|
12
|
+
type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
13
|
+
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
14
|
+
};
|
15
|
+
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
16
|
+
declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
|
17
|
+
|
18
|
+
declare const LAZY_SYMBOL: unique symbol;
|
19
|
+
interface LazyMeta {
|
20
|
+
prefix?: HTTPPath;
|
21
|
+
}
|
22
|
+
interface Lazy<T> {
|
23
|
+
[LAZY_SYMBOL]: {
|
24
|
+
loader: () => Promise<{
|
25
|
+
default: T;
|
26
|
+
}>;
|
27
|
+
meta: LazyMeta;
|
28
|
+
};
|
29
|
+
}
|
30
|
+
type Lazyable<T> = T | Lazy<T>;
|
31
|
+
declare function lazy<T>(loader: () => Promise<{
|
32
|
+
default: T;
|
33
|
+
}>, meta?: LazyMeta): Lazy<T>;
|
34
|
+
declare function isLazy(item: unknown): item is Lazy<any>;
|
35
|
+
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
36
|
+
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
37
|
+
default: T extends Lazy<infer U> ? U : T;
|
38
|
+
}>;
|
39
|
+
|
40
|
+
interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
41
|
+
context: TCurrentContext;
|
42
|
+
input: TInput;
|
43
|
+
path: readonly string[];
|
44
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
45
|
+
signal?: AbortSignal;
|
46
|
+
lastEventId: string | undefined;
|
47
|
+
errors: TErrorConstructorMap;
|
48
|
+
}
|
49
|
+
interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
50
|
+
(opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
|
51
|
+
}
|
52
|
+
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
53
|
+
__initialContext?: (type: TInitialContext) => unknown;
|
54
|
+
middlewares: readonly AnyMiddleware[];
|
55
|
+
inputValidationIndex: number;
|
56
|
+
outputValidationIndex: number;
|
57
|
+
handler: ProcedureHandler<TCurrentContext, any, any, any, any>;
|
58
|
+
}
|
59
|
+
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
60
|
+
'~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
61
|
+
constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>);
|
62
|
+
}
|
63
|
+
type AnyProcedure = Procedure<any, any, any, any, any, any>;
|
64
|
+
declare function isProcedure(item: unknown): item is AnyProcedure;
|
65
|
+
|
66
|
+
type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
|
67
|
+
output: TOutput;
|
68
|
+
context: TOutContext;
|
69
|
+
}>;
|
70
|
+
type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
|
71
|
+
context?: TOutContext;
|
72
|
+
} : {
|
73
|
+
context: TOutContext;
|
74
|
+
};
|
75
|
+
interface MiddlewareNextFn<TOutput> {
|
76
|
+
<U extends Context = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
|
77
|
+
}
|
78
|
+
interface MiddlewareOutputFn<TOutput> {
|
79
|
+
(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
80
|
+
}
|
81
|
+
interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
82
|
+
context: TInContext;
|
83
|
+
path: readonly string[];
|
84
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
85
|
+
signal?: AbortSignal;
|
86
|
+
lastEventId: string | undefined;
|
87
|
+
next: MiddlewareNextFn<TOutput>;
|
88
|
+
errors: TErrorConstructorMap;
|
89
|
+
}
|
90
|
+
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
91
|
+
(options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
|
92
|
+
}
|
93
|
+
type AnyMiddleware = Middleware<any, any, any, any, any, any>;
|
94
|
+
interface MapInputMiddleware<TInput, TMappedInput> {
|
95
|
+
(input: TInput): TMappedInput;
|
96
|
+
}
|
97
|
+
declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
98
|
+
|
99
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
100
|
+
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
101
|
+
context: TInitialContext;
|
102
|
+
input: unknown;
|
103
|
+
errors: ORPCErrorConstructorMap<TErrorMap>;
|
104
|
+
path: readonly string[];
|
105
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
106
|
+
signal?: AbortSignal;
|
107
|
+
lastEventId: string | undefined;
|
108
|
+
}
|
109
|
+
/**
|
110
|
+
* Options for creating a procedure caller with comprehensive type safety
|
111
|
+
*/
|
112
|
+
type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
|
113
|
+
/**
|
114
|
+
* This is helpful for logging and analytics.
|
115
|
+
*/
|
116
|
+
path?: readonly string[];
|
117
|
+
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>[];
|
118
|
+
} & (Record<never, never> extends TInitialContext ? {
|
119
|
+
context?: Value<TInitialContext, [clientContext: TClientContext]>;
|
120
|
+
} : {
|
121
|
+
context: Value<TInitialContext, [clientContext: TClientContext]>;
|
122
|
+
});
|
123
|
+
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...[options]: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
124
|
+
|
125
|
+
type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
|
126
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
|
127
|
+
};
|
128
|
+
type AnyRouter = Router<any, any>;
|
129
|
+
type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infer UInitialContext> ? UInitialContext : never;
|
130
|
+
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
|
131
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
132
|
+
};
|
133
|
+
type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
|
134
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
|
135
|
+
};
|
136
|
+
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
137
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
138
|
+
};
|
139
|
+
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
140
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
141
|
+
};
|
142
|
+
|
143
|
+
export { type AnyMiddleware as A, type ProcedureHandlerOptions as B, type Context as C, type ProcedureDef as D, isProcedure as E, type ProcedureClientInterceptorOptions as F, createProcedureClient as G, type InferRouterInitialContexts as H, type InferRouterInitialContext as I, type InferRouterCurrentContexts as J, type InferRouterInputs as K, type Lazyable as L, type Middleware as M, type InferRouterOutputs as N, type ORPCErrorConstructorMap as O, Procedure as P, type Router as R, type MergedInitialContext as a, type MergedCurrentContext as b, type MapInputMiddleware as c, type CreateProcedureClientOptions as d, type ProcedureClient as e, type AnyRouter as f, type Lazy as g, type AnyProcedure as h, type ProcedureHandler as i, type ORPCErrorConstructorMapItemOptions as j, type ORPCErrorConstructorMapItem as k, createORPCErrorConstructorMap as l, mergeCurrentContext as m, LAZY_SYMBOL as n, type LazyMeta as o, lazy as p, isLazy as q, getLazyMeta as r, type MiddlewareResult as s, type MiddlewareNextFnOptions as t, unlazy as u, validateORPCError as v, type MiddlewareNextFn as w, type MiddlewareOutputFn as x, type MiddlewareOptions as y, middlewareOutputFn as z };
|
@@ -0,0 +1,143 @@
|
|
1
|
+
import { ORPCErrorCode, ORPCErrorOptions, ORPCError, HTTPPath, ClientContext, Client } from '@orpc/client';
|
2
|
+
import { MaybeOptionalOptions, Promisable, Interceptor, Value } from '@orpc/shared';
|
3
|
+
import { ErrorMap, ErrorMapItem, InferSchemaInput, AnySchema, Meta, ContractProcedureDef, InferSchemaOutput, ErrorFromErrorMap, AnyContractRouter, ContractProcedure } from '@orpc/contract';
|
4
|
+
|
5
|
+
type Context = Record<PropertyKey, any>;
|
6
|
+
type MergedInitialContext<TInitial extends Context, TAdditional extends Context, TCurrent extends Context> = TInitial & Omit<TAdditional, keyof TCurrent>;
|
7
|
+
type MergedCurrentContext<T extends Context, U extends Context> = Omit<T, keyof U> & U;
|
8
|
+
declare function mergeCurrentContext<T extends Context, U extends Context>(context: T, other: U): MergedCurrentContext<T, U>;
|
9
|
+
|
10
|
+
type ORPCErrorConstructorMapItemOptions<TData> = Omit<ORPCErrorOptions<TData>, 'defined' | 'status'>;
|
11
|
+
type ORPCErrorConstructorMapItem<TCode extends ORPCErrorCode, TInData> = (...rest: MaybeOptionalOptions<ORPCErrorConstructorMapItemOptions<TInData>>) => ORPCError<TCode, TInData>;
|
12
|
+
type ORPCErrorConstructorMap<T extends ErrorMap> = {
|
13
|
+
[K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
|
14
|
+
};
|
15
|
+
declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
|
16
|
+
declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
|
17
|
+
|
18
|
+
declare const LAZY_SYMBOL: unique symbol;
|
19
|
+
interface LazyMeta {
|
20
|
+
prefix?: HTTPPath;
|
21
|
+
}
|
22
|
+
interface Lazy<T> {
|
23
|
+
[LAZY_SYMBOL]: {
|
24
|
+
loader: () => Promise<{
|
25
|
+
default: T;
|
26
|
+
}>;
|
27
|
+
meta: LazyMeta;
|
28
|
+
};
|
29
|
+
}
|
30
|
+
type Lazyable<T> = T | Lazy<T>;
|
31
|
+
declare function lazy<T>(loader: () => Promise<{
|
32
|
+
default: T;
|
33
|
+
}>, meta?: LazyMeta): Lazy<T>;
|
34
|
+
declare function isLazy(item: unknown): item is Lazy<any>;
|
35
|
+
declare function getLazyMeta(lazied: Lazy<any>): LazyMeta;
|
36
|
+
declare function unlazy<T extends Lazyable<any>>(lazied: T): Promise<{
|
37
|
+
default: T extends Lazy<infer U> ? U : T;
|
38
|
+
}>;
|
39
|
+
|
40
|
+
interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
41
|
+
context: TCurrentContext;
|
42
|
+
input: TInput;
|
43
|
+
path: readonly string[];
|
44
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
45
|
+
signal?: AbortSignal;
|
46
|
+
lastEventId: string | undefined;
|
47
|
+
errors: TErrorConstructorMap;
|
48
|
+
}
|
49
|
+
interface ProcedureHandler<TCurrentContext extends Context, TInput, THandlerOutput, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
50
|
+
(opt: ProcedureHandlerOptions<TCurrentContext, TInput, ORPCErrorConstructorMap<TErrorMap>, TMeta>): Promisable<THandlerOutput>;
|
51
|
+
}
|
52
|
+
interface ProcedureDef<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> extends ContractProcedureDef<TInputSchema, TOutputSchema, TErrorMap, TMeta> {
|
53
|
+
__initialContext?: (type: TInitialContext) => unknown;
|
54
|
+
middlewares: readonly AnyMiddleware[];
|
55
|
+
inputValidationIndex: number;
|
56
|
+
outputValidationIndex: number;
|
57
|
+
handler: ProcedureHandler<TCurrentContext, any, any, any, any>;
|
58
|
+
}
|
59
|
+
declare class Procedure<TInitialContext extends Context, TCurrentContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
60
|
+
'~orpc': ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>;
|
61
|
+
constructor(def: ProcedureDef<TInitialContext, TCurrentContext, TInputSchema, TOutputSchema, TErrorMap, TMeta>);
|
62
|
+
}
|
63
|
+
type AnyProcedure = Procedure<any, any, any, any, any, any>;
|
64
|
+
declare function isProcedure(item: unknown): item is AnyProcedure;
|
65
|
+
|
66
|
+
type MiddlewareResult<TOutContext extends Context, TOutput> = Promisable<{
|
67
|
+
output: TOutput;
|
68
|
+
context: TOutContext;
|
69
|
+
}>;
|
70
|
+
type MiddlewareNextFnOptions<TOutContext extends Context> = Record<never, never> extends TOutContext ? {
|
71
|
+
context?: TOutContext;
|
72
|
+
} : {
|
73
|
+
context: TOutContext;
|
74
|
+
};
|
75
|
+
interface MiddlewareNextFn<TOutput> {
|
76
|
+
<U extends Context = Record<never, never>>(...rest: MaybeOptionalOptions<MiddlewareNextFnOptions<U>>): MiddlewareResult<U, TOutput>;
|
77
|
+
}
|
78
|
+
interface MiddlewareOutputFn<TOutput> {
|
79
|
+
(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
80
|
+
}
|
81
|
+
interface MiddlewareOptions<TInContext extends Context, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
82
|
+
context: TInContext;
|
83
|
+
path: readonly string[];
|
84
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
85
|
+
signal?: AbortSignal;
|
86
|
+
lastEventId: string | undefined;
|
87
|
+
next: MiddlewareNextFn<TOutput>;
|
88
|
+
errors: TErrorConstructorMap;
|
89
|
+
}
|
90
|
+
interface Middleware<TInContext extends Context, TOutContext extends Context, TInput, TOutput, TErrorConstructorMap extends ORPCErrorConstructorMap<any>, TMeta extends Meta> {
|
91
|
+
(options: MiddlewareOptions<TInContext, TOutput, TErrorConstructorMap, TMeta>, input: TInput, output: MiddlewareOutputFn<TOutput>): Promisable<MiddlewareResult<TOutContext, TOutput>>;
|
92
|
+
}
|
93
|
+
type AnyMiddleware = Middleware<any, any, any, any, any, any>;
|
94
|
+
interface MapInputMiddleware<TInput, TMappedInput> {
|
95
|
+
(input: TInput): TMappedInput;
|
96
|
+
}
|
97
|
+
declare function middlewareOutputFn<TOutput>(output: TOutput): MiddlewareResult<Record<never, never>, TOutput>;
|
98
|
+
|
99
|
+
type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>;
|
100
|
+
interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap, TMeta extends Meta> {
|
101
|
+
context: TInitialContext;
|
102
|
+
input: unknown;
|
103
|
+
errors: ORPCErrorConstructorMap<TErrorMap>;
|
104
|
+
path: readonly string[];
|
105
|
+
procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, TMeta>;
|
106
|
+
signal?: AbortSignal;
|
107
|
+
lastEventId: string | undefined;
|
108
|
+
}
|
109
|
+
/**
|
110
|
+
* Options for creating a procedure caller with comprehensive type safety
|
111
|
+
*/
|
112
|
+
type CreateProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext> = {
|
113
|
+
/**
|
114
|
+
* This is helpful for logging and analytics.
|
115
|
+
*/
|
116
|
+
path?: readonly string[];
|
117
|
+
interceptors?: Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap, TMeta>, InferSchemaOutput<TOutputSchema>, ErrorFromErrorMap<TErrorMap>>[];
|
118
|
+
} & (Record<never, never> extends TInitialContext ? {
|
119
|
+
context?: Value<TInitialContext, [clientContext: TClientContext]>;
|
120
|
+
} : {
|
121
|
+
context: Value<TInitialContext, [clientContext: TClientContext]>;
|
122
|
+
});
|
123
|
+
declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TMeta extends Meta, TClientContext extends ClientContext>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TMeta>>, ...[options]: MaybeOptionalOptions<CreateProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TMeta, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
|
124
|
+
|
125
|
+
type Router<T extends AnyContractRouter, TInitialContext extends Context> = T extends ContractProcedure<infer UInputSchema, infer UOutputSchema, infer UErrorMap, infer UMeta> ? Procedure<TInitialContext, any, UInputSchema, UOutputSchema, UErrorMap, UMeta> : {
|
126
|
+
[K in keyof T]: T[K] extends AnyContractRouter ? Lazyable<Router<T[K], TInitialContext>> : never;
|
127
|
+
};
|
128
|
+
type AnyRouter = Router<any, any>;
|
129
|
+
type InferRouterInitialContext<T extends AnyRouter> = T extends Router<any, infer UInitialContext> ? UInitialContext : never;
|
130
|
+
type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
|
131
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
|
132
|
+
};
|
133
|
+
type InferRouterCurrentContexts<T extends AnyRouter> = T extends Procedure<any, infer UCurrentContext, any, any, any, any> ? UCurrentContext : {
|
134
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterCurrentContexts<U> : never;
|
135
|
+
};
|
136
|
+
type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
|
137
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
|
138
|
+
};
|
139
|
+
type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
|
140
|
+
[K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
|
141
|
+
};
|
142
|
+
|
143
|
+
export { type AnyMiddleware as A, type ProcedureHandlerOptions as B, type Context as C, type ProcedureDef as D, isProcedure as E, type ProcedureClientInterceptorOptions as F, createProcedureClient as G, type InferRouterInitialContexts as H, type InferRouterInitialContext as I, type InferRouterCurrentContexts as J, type InferRouterInputs as K, type Lazyable as L, type Middleware as M, type InferRouterOutputs as N, type ORPCErrorConstructorMap as O, Procedure as P, type Router as R, type MergedInitialContext as a, type MergedCurrentContext as b, type MapInputMiddleware as c, type CreateProcedureClientOptions as d, type ProcedureClient as e, type AnyRouter as f, type Lazy as g, type AnyProcedure as h, type ProcedureHandler as i, type ORPCErrorConstructorMapItemOptions as j, type ORPCErrorConstructorMapItem as k, createORPCErrorConstructorMap as l, mergeCurrentContext as m, LAZY_SYMBOL as n, type LazyMeta as o, lazy as p, isLazy as q, getLazyMeta as r, type MiddlewareResult as s, type MiddlewareNextFnOptions as t, unlazy as u, validateORPCError as v, type MiddlewareNextFn as w, type MiddlewareOutputFn as x, type MiddlewareOptions as y, middlewareOutputFn as z };
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import { HTTPPath, ORPCError } from '@orpc/client';
|
2
|
+
import { Meta, InferSchemaOutput, AnySchema, ErrorFromErrorMap } from '@orpc/contract';
|
3
|
+
import { Interceptor, ThrowableError } from '@orpc/shared';
|
4
|
+
import { StandardResponse, StandardLazyRequest } from '@orpc/standard-server';
|
5
|
+
import { f as AnyRouter, h as AnyProcedure, C as Context, F as ProcedureClientInterceptorOptions, R as Router } from './server.DQJX4Gnf.js';
|
6
|
+
|
7
|
+
type StandardParams = Record<string, string>;
|
8
|
+
type StandardMatchResult = {
|
9
|
+
path: readonly string[];
|
10
|
+
procedure: AnyProcedure;
|
11
|
+
params?: StandardParams;
|
12
|
+
} | undefined;
|
13
|
+
interface StandardMatcher {
|
14
|
+
init(router: AnyRouter): void;
|
15
|
+
match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
|
16
|
+
}
|
17
|
+
interface StandardCodec {
|
18
|
+
encode(output: unknown, procedure: AnyProcedure): StandardResponse;
|
19
|
+
encodeError(error: ORPCError<any, any>): StandardResponse;
|
20
|
+
decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
|
21
|
+
}
|
22
|
+
|
23
|
+
interface StandardHandlerPlugin<TContext extends Context> {
|
24
|
+
order?: number;
|
25
|
+
init?(options: StandardHandlerOptions<TContext>): void;
|
26
|
+
}
|
27
|
+
declare class CompositeStandardHandlerPlugin<T extends Context, TPlugin extends StandardHandlerPlugin<T>> implements StandardHandlerPlugin<T> {
|
28
|
+
protected readonly plugins: TPlugin[];
|
29
|
+
constructor(plugins?: readonly TPlugin[]);
|
30
|
+
init(options: StandardHandlerOptions<T>): void;
|
31
|
+
}
|
32
|
+
|
33
|
+
interface StandardHandleOptions<T extends Context> {
|
34
|
+
prefix?: HTTPPath;
|
35
|
+
context: T;
|
36
|
+
}
|
37
|
+
type StandardHandleResult = {
|
38
|
+
matched: true;
|
39
|
+
response: StandardResponse;
|
40
|
+
} | {
|
41
|
+
matched: false;
|
42
|
+
response: undefined;
|
43
|
+
};
|
44
|
+
interface StandardHandlerInterceptorOptions<T extends Context> extends StandardHandleOptions<T> {
|
45
|
+
request: StandardLazyRequest;
|
46
|
+
}
|
47
|
+
interface StandardHandlerOptions<TContext extends Context> {
|
48
|
+
plugins?: StandardHandlerPlugin<TContext>[];
|
49
|
+
/**
|
50
|
+
* Interceptors at the request level, helpful when you want catch errors
|
51
|
+
*/
|
52
|
+
interceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, ThrowableError>[];
|
53
|
+
/**
|
54
|
+
* Interceptors at the root level, helpful when you want override the request/response
|
55
|
+
*/
|
56
|
+
rootInterceptors?: Interceptor<StandardHandlerInterceptorOptions<TContext>, StandardHandleResult, ThrowableError>[];
|
57
|
+
/**
|
58
|
+
*
|
59
|
+
* Interceptors for procedure client.
|
60
|
+
*/
|
61
|
+
clientInterceptors?: Interceptor<ProcedureClientInterceptorOptions<TContext, Record<never, never>, Meta>, InferSchemaOutput<AnySchema>, ErrorFromErrorMap<Record<never, never>>>[];
|
62
|
+
}
|
63
|
+
declare class StandardHandler<T extends Context> {
|
64
|
+
private readonly matcher;
|
65
|
+
private readonly codec;
|
66
|
+
private readonly interceptors;
|
67
|
+
private readonly clientInterceptors;
|
68
|
+
private readonly rootInterceptors;
|
69
|
+
constructor(router: Router<any, T>, matcher: StandardMatcher, codec: StandardCodec, options: NoInfer<StandardHandlerOptions<T>>);
|
70
|
+
handle(request: StandardLazyRequest, options: StandardHandleOptions<T>): Promise<StandardHandleResult>;
|
71
|
+
}
|
72
|
+
|
73
|
+
export { CompositeStandardHandlerPlugin as C, type StandardHandlerInterceptorOptions as S, type StandardHandlerPlugin as a, type StandardHandlerOptions as b, type StandardCodec as c, type StandardParams as d, type StandardMatcher as e, type StandardMatchResult as f, type StandardHandleOptions as g, type StandardHandleResult as h, StandardHandler as i };
|
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.ac2c329",
|
5
5
|
"license": "MIT",
|
6
6
|
"homepage": "https://orpc.unnoq.com",
|
7
7
|
"repository": {
|
@@ -15,66 +15,47 @@
|
|
15
15
|
],
|
16
16
|
"exports": {
|
17
17
|
".": {
|
18
|
-
"types": "./dist/
|
19
|
-
"import": "./dist/index.
|
20
|
-
"default": "./dist/index.
|
18
|
+
"types": "./dist/index.d.mts",
|
19
|
+
"import": "./dist/index.mjs",
|
20
|
+
"default": "./dist/index.mjs"
|
21
21
|
},
|
22
22
|
"./plugins": {
|
23
|
-
"types": "./dist/
|
24
|
-
"import": "./dist/plugins.
|
25
|
-
"default": "./dist/plugins.
|
23
|
+
"types": "./dist/plugins/index.d.mts",
|
24
|
+
"import": "./dist/plugins/index.mjs",
|
25
|
+
"default": "./dist/plugins/index.mjs"
|
26
26
|
},
|
27
27
|
"./standard": {
|
28
|
-
"types": "./dist/
|
29
|
-
"import": "./dist/standard.
|
30
|
-
"default": "./dist/standard.
|
28
|
+
"types": "./dist/adapters/standard/index.d.mts",
|
29
|
+
"import": "./dist/adapters/standard/index.mjs",
|
30
|
+
"default": "./dist/adapters/standard/index.mjs"
|
31
31
|
},
|
32
32
|
"./fetch": {
|
33
|
-
"types": "./dist/
|
34
|
-
"import": "./dist/fetch.
|
35
|
-
"default": "./dist/fetch.
|
36
|
-
},
|
37
|
-
"./hono": {
|
38
|
-
"types": "./dist/src/adapters/hono/index.d.ts",
|
39
|
-
"import": "./dist/hono.js",
|
40
|
-
"default": "./dist/hono.js"
|
41
|
-
},
|
42
|
-
"./next": {
|
43
|
-
"types": "./dist/src/adapters/next/index.d.ts",
|
44
|
-
"import": "./dist/next.js",
|
45
|
-
"default": "./dist/next.js"
|
33
|
+
"types": "./dist/adapters/fetch/index.d.mts",
|
34
|
+
"import": "./dist/adapters/fetch/index.mjs",
|
35
|
+
"default": "./dist/adapters/fetch/index.mjs"
|
46
36
|
},
|
47
37
|
"./node": {
|
48
|
-
"types": "./dist/
|
49
|
-
"import": "./dist/node.
|
50
|
-
"default": "./dist/node.
|
51
|
-
},
|
52
|
-
"./🔒/*": {
|
53
|
-
"types": "./dist/src/*.d.ts"
|
38
|
+
"types": "./dist/adapters/node/index.d.mts",
|
39
|
+
"import": "./dist/adapters/node/index.mjs",
|
40
|
+
"default": "./dist/adapters/node/index.mjs"
|
54
41
|
}
|
55
42
|
},
|
56
43
|
"files": [
|
57
|
-
"!**/*.map",
|
58
|
-
"!**/*.tsbuildinfo",
|
59
44
|
"dist"
|
60
45
|
],
|
61
|
-
"peerDependencies": {
|
62
|
-
"hono": ">=4.6.0",
|
63
|
-
"next": ">=14.0.0"
|
64
|
-
},
|
65
46
|
"dependencies": {
|
66
|
-
"@orpc/
|
67
|
-
"@orpc/
|
68
|
-
"@orpc/
|
69
|
-
"@orpc/standard-server
|
70
|
-
"@orpc/
|
71
|
-
"@orpc/
|
47
|
+
"@orpc/shared": "0.0.0-next.ac2c329",
|
48
|
+
"@orpc/contract": "0.0.0-next.ac2c329",
|
49
|
+
"@orpc/client": "0.0.0-next.ac2c329",
|
50
|
+
"@orpc/standard-server": "0.0.0-next.ac2c329",
|
51
|
+
"@orpc/standard-server-node": "0.0.0-next.ac2c329",
|
52
|
+
"@orpc/standard-server-fetch": "0.0.0-next.ac2c329"
|
72
53
|
},
|
73
54
|
"devDependencies": {
|
74
|
-
"
|
55
|
+
"supertest": "^7.0.0"
|
75
56
|
},
|
76
57
|
"scripts": {
|
77
|
-
"build": "
|
58
|
+
"build": "unbuild",
|
78
59
|
"build:watch": "pnpm run build --watch",
|
79
60
|
"type:check": "tsc -b"
|
80
61
|
}
|