@orpc/server 0.43.0 → 0.45.0
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 +1 -1
- package/dist/adapters/fetch/index.d.mts +27 -0
- package/dist/adapters/fetch/index.d.ts +27 -0
- package/dist/adapters/fetch/index.mjs +9 -0
- package/dist/adapters/hono/index.d.mts +20 -0
- package/dist/adapters/hono/index.d.ts +20 -0
- package/dist/{hono.js → adapters/hono/index.mjs} +11 -13
- package/dist/adapters/next/index.d.mts +27 -0
- package/dist/adapters/next/index.d.ts +27 -0
- package/dist/{next.js → adapters/next/index.mjs} +11 -13
- package/dist/adapters/node/index.d.mts +35 -0
- package/dist/adapters/node/index.d.ts +35 -0
- package/dist/adapters/node/index.mjs +28 -0
- package/dist/adapters/standard/index.d.mts +29 -0
- package/dist/adapters/standard/index.d.ts +29 -0
- package/dist/adapters/standard/index.mjs +7 -0
- package/dist/index.d.mts +255 -0
- package/dist/index.d.ts +255 -0
- package/dist/{index.js → index.mjs} +33 -113
- package/dist/plugins/index.d.mts +31 -0
- package/dist/plugins/index.d.ts +31 -0
- package/dist/{chunk-TXHKQO7N.js → plugins/index.mjs} +11 -28
- package/dist/{chunk-TV5DRAST.js → shared/server.BBGuTxHE.mjs} +12 -31
- package/dist/shared/server.B_cAGti1.d.mts +9 -0
- package/dist/{chunk-WDY5PTME.js → shared/server.CUE4Aija.mjs} +8 -16
- package/dist/shared/server.Cn9ybJtE.d.mts +152 -0
- package/dist/shared/server.Cn9ybJtE.d.ts +152 -0
- package/dist/shared/server.CynXWJja.d.ts +9 -0
- package/dist/shared/server.D86dtDX_.d.mts +77 -0
- package/dist/shared/server.Q6ZmnTgO.mjs +12 -0
- package/dist/{chunk-MHVECKBC.js → shared/server.V6zT5iYQ.mjs} +48 -90
- package/dist/shared/server.dPmfqnQI.d.ts +77 -0
- package/package.json +29 -34
- package/dist/fetch.js +0 -10
- 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
@@ -1,33 +1,12 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
createContractedProcedure,
|
9
|
-
createLazyProcedureFormAnyLazy,
|
10
|
-
createProcedureClient,
|
11
|
-
deepSetLazyRouterPrefix,
|
12
|
-
eachAllContractProcedure,
|
13
|
-
eachContractProcedure,
|
14
|
-
flatLazy,
|
15
|
-
getLazyRouterPrefix,
|
16
|
-
getRouterChild,
|
17
|
-
getRouterContract,
|
18
|
-
isLazy,
|
19
|
-
isProcedure,
|
20
|
-
lazy,
|
21
|
-
middlewareOutputFn,
|
22
|
-
setRouterContract,
|
23
|
-
unlazy
|
24
|
-
} from "./chunk-MHVECKBC.js";
|
1
|
+
import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure } from '@orpc/contract';
|
2
|
+
export { ValidationError, eventIterator, type } from '@orpc/contract';
|
3
|
+
import { P as Procedure, d as addMiddleware, c as createProcedureClient, f as adaptRouter, h as flatLazy, l as lazy, s as setRouterContract, i as isProcedure, j as isLazy, k as createLazyProcedureFormAnyLazy, g as getRouterChild } from './shared/server.V6zT5iYQ.mjs';
|
4
|
+
export { L as LAZY_LOADER_SYMBOL, a as convertPathToHttpPath, q as createAccessibleLazyRouter, b as createContractedProcedure, n as deepSetLazyRouterPrefix, r as eachAllContractProcedure, e as eachContractProcedure, o as getLazyRouterPrefix, m as getRouterContract, p as middlewareOutputFn, u as unlazy } from './shared/server.V6zT5iYQ.mjs';
|
5
|
+
export { ORPCError, isDefinedError, safe } from '@orpc/client';
|
6
|
+
export { onError, onFinish, onStart, onSuccess } from '@orpc/shared';
|
7
|
+
export { getEventMeta, withEventMeta } from '@orpc/standard-server';
|
25
8
|
|
26
|
-
|
27
|
-
import { mergeErrorMap as mergeErrorMap2, mergeMeta as mergeMeta2, mergePrefix, mergeRoute as mergeRoute2, mergeTags } from "@orpc/contract";
|
28
|
-
|
29
|
-
// src/config.ts
|
30
|
-
var DEFAULT_CONFIG = {
|
9
|
+
const DEFAULT_CONFIG = {
|
31
10
|
initialInputValidationIndex: 0,
|
32
11
|
initialOutputValidationIndex: 0
|
33
12
|
};
|
@@ -38,7 +17,6 @@ function fallbackConfig(key, value) {
|
|
38
17
|
return value;
|
39
18
|
}
|
40
19
|
|
41
|
-
// src/middleware-decorated.ts
|
42
20
|
function decorateMiddleware(middleware) {
|
43
21
|
const decorated = middleware;
|
44
22
|
decorated.mapInput = (mapInput) => {
|
@@ -65,30 +43,28 @@ function decorateMiddleware(middleware) {
|
|
65
43
|
return decorated;
|
66
44
|
}
|
67
45
|
|
68
|
-
|
69
|
-
import { mergeErrorMap, mergeMeta, mergeRoute } from "@orpc/contract";
|
70
|
-
var DecoratedProcedure = class _DecoratedProcedure extends Procedure {
|
46
|
+
class DecoratedProcedure extends Procedure {
|
71
47
|
errors(errors) {
|
72
|
-
return new
|
48
|
+
return new DecoratedProcedure({
|
73
49
|
...this["~orpc"],
|
74
50
|
errorMap: mergeErrorMap(this["~orpc"].errorMap, errors)
|
75
51
|
});
|
76
52
|
}
|
77
53
|
meta(meta) {
|
78
|
-
return new
|
54
|
+
return new DecoratedProcedure({
|
79
55
|
...this["~orpc"],
|
80
56
|
meta: mergeMeta(this["~orpc"].meta, meta)
|
81
57
|
});
|
82
58
|
}
|
83
59
|
route(route) {
|
84
|
-
return new
|
60
|
+
return new DecoratedProcedure({
|
85
61
|
...this["~orpc"],
|
86
62
|
route: mergeRoute(this["~orpc"].route, route)
|
87
63
|
});
|
88
64
|
}
|
89
65
|
use(middleware, mapInput) {
|
90
66
|
const mapped = mapInput ? decorateMiddleware(middleware).mapInput(mapInput) : middleware;
|
91
|
-
return new
|
67
|
+
return new DecoratedProcedure({
|
92
68
|
...this["~orpc"],
|
93
69
|
middlewares: addMiddleware(this["~orpc"].middlewares, mapped)
|
94
70
|
});
|
@@ -108,10 +84,9 @@ var DecoratedProcedure = class _DecoratedProcedure extends Procedure {
|
|
108
84
|
actionable(...rest) {
|
109
85
|
return this.callable(...rest);
|
110
86
|
}
|
111
|
-
}
|
87
|
+
}
|
112
88
|
|
113
|
-
|
114
|
-
var Builder = class _Builder {
|
89
|
+
class Builder {
|
115
90
|
"~orpc";
|
116
91
|
constructor(def) {
|
117
92
|
this["~orpc"] = def;
|
@@ -122,7 +97,7 @@ var Builder = class _Builder {
|
|
122
97
|
$config(config) {
|
123
98
|
const inputValidationCount = this["~orpc"].inputValidationIndex - fallbackConfig("initialInputValidationIndex", this["~orpc"].config.initialInputValidationIndex);
|
124
99
|
const outputValidationCount = this["~orpc"].outputValidationIndex - fallbackConfig("initialOutputValidationIndex", this["~orpc"].config.initialOutputValidationIndex);
|
125
|
-
return new
|
100
|
+
return new Builder({
|
126
101
|
...this["~orpc"],
|
127
102
|
config,
|
128
103
|
inputValidationIndex: fallbackConfig("initialInputValidationIndex", config.initialInputValidationIndex) + inputValidationCount,
|
@@ -133,7 +108,7 @@ var Builder = class _Builder {
|
|
133
108
|
* Reset initial context
|
134
109
|
*/
|
135
110
|
$context() {
|
136
|
-
return new
|
111
|
+
return new Builder({
|
137
112
|
...this["~orpc"],
|
138
113
|
middlewares: [],
|
139
114
|
inputValidationIndex: fallbackConfig("initialInputValidationIndex", this["~orpc"].config.initialInputValidationIndex),
|
@@ -144,7 +119,7 @@ var Builder = class _Builder {
|
|
144
119
|
* Reset initial meta
|
145
120
|
*/
|
146
121
|
$meta(initialMeta) {
|
147
|
-
return new
|
122
|
+
return new Builder({
|
148
123
|
...this["~orpc"],
|
149
124
|
meta: initialMeta
|
150
125
|
});
|
@@ -153,7 +128,7 @@ var Builder = class _Builder {
|
|
153
128
|
* Reset initial route
|
154
129
|
*/
|
155
130
|
$route(initialRoute) {
|
156
|
-
return new
|
131
|
+
return new Builder({
|
157
132
|
...this["~orpc"],
|
158
133
|
route: initialRoute
|
159
134
|
});
|
@@ -162,39 +137,39 @@ var Builder = class _Builder {
|
|
162
137
|
return decorateMiddleware(middleware);
|
163
138
|
}
|
164
139
|
errors(errors) {
|
165
|
-
return new
|
140
|
+
return new Builder({
|
166
141
|
...this["~orpc"],
|
167
|
-
errorMap:
|
142
|
+
errorMap: mergeErrorMap(this["~orpc"].errorMap, errors)
|
168
143
|
});
|
169
144
|
}
|
170
145
|
use(middleware, mapInput) {
|
171
146
|
const mapped = mapInput ? decorateMiddleware(middleware).mapInput(mapInput) : middleware;
|
172
|
-
return new
|
147
|
+
return new Builder({
|
173
148
|
...this["~orpc"],
|
174
149
|
middlewares: addMiddleware(this["~orpc"].middlewares, mapped)
|
175
150
|
});
|
176
151
|
}
|
177
152
|
meta(meta) {
|
178
|
-
return new
|
153
|
+
return new Builder({
|
179
154
|
...this["~orpc"],
|
180
|
-
meta:
|
155
|
+
meta: mergeMeta(this["~orpc"].meta, meta)
|
181
156
|
});
|
182
157
|
}
|
183
158
|
route(route) {
|
184
|
-
return new
|
159
|
+
return new Builder({
|
185
160
|
...this["~orpc"],
|
186
|
-
route:
|
161
|
+
route: mergeRoute(this["~orpc"].route, route)
|
187
162
|
});
|
188
163
|
}
|
189
164
|
input(schema) {
|
190
|
-
return new
|
165
|
+
return new Builder({
|
191
166
|
...this["~orpc"],
|
192
167
|
inputSchema: schema,
|
193
168
|
inputValidationIndex: fallbackConfig("initialInputValidationIndex", this["~orpc"].config.initialInputValidationIndex) + this["~orpc"].middlewares.length
|
194
169
|
});
|
195
170
|
}
|
196
171
|
output(schema) {
|
197
|
-
return new
|
172
|
+
return new Builder({
|
198
173
|
...this["~orpc"],
|
199
174
|
outputSchema: schema,
|
200
175
|
outputValidationIndex: fallbackConfig("initialOutputValidationIndex", this["~orpc"].config.initialOutputValidationIndex) + this["~orpc"].middlewares.length
|
@@ -207,13 +182,13 @@ var Builder = class _Builder {
|
|
207
182
|
});
|
208
183
|
}
|
209
184
|
prefix(prefix) {
|
210
|
-
return new
|
185
|
+
return new Builder({
|
211
186
|
...this["~orpc"],
|
212
187
|
prefix: mergePrefix(this["~orpc"].prefix, prefix)
|
213
188
|
});
|
214
189
|
}
|
215
190
|
tag(...tags) {
|
216
|
-
return new
|
191
|
+
return new Builder({
|
217
192
|
...this["~orpc"],
|
218
193
|
tags: mergeTags(this["~orpc"].tags, tags)
|
219
194
|
});
|
@@ -224,8 +199,8 @@ var Builder = class _Builder {
|
|
224
199
|
lazy(loader) {
|
225
200
|
return adaptRouter(flatLazy(lazy(loader)), this["~orpc"]);
|
226
201
|
}
|
227
|
-
}
|
228
|
-
|
202
|
+
}
|
203
|
+
const os = new Builder({
|
229
204
|
config: {},
|
230
205
|
route: {},
|
231
206
|
meta: {},
|
@@ -237,13 +212,10 @@ var os = new Builder({
|
|
237
212
|
middlewares: []
|
238
213
|
});
|
239
214
|
|
240
|
-
// src/context.ts
|
241
215
|
function mergeContext(context, other) {
|
242
216
|
return { ...context, ...other };
|
243
217
|
}
|
244
218
|
|
245
|
-
// src/implementer.ts
|
246
|
-
import { isContractProcedure } from "@orpc/contract";
|
247
219
|
function implementerInternal(contract, config, middlewares) {
|
248
220
|
if (isContractProcedure(contract)) {
|
249
221
|
const impl2 = new Builder({
|
@@ -329,12 +301,10 @@ function implement(contract, config = {}) {
|
|
329
301
|
return impl;
|
330
302
|
}
|
331
303
|
|
332
|
-
// src/procedure-utils.ts
|
333
304
|
function call(procedure, input, ...rest) {
|
334
305
|
return createProcedureClient(procedure, ...rest)(input);
|
335
306
|
}
|
336
307
|
|
337
|
-
// src/router-client.ts
|
338
308
|
function createRouterClient(router, ...rest) {
|
339
309
|
if (isProcedure(router)) {
|
340
310
|
const caller = createProcedureClient(router, ...rest);
|
@@ -360,54 +330,4 @@ function createRouterClient(router, ...rest) {
|
|
360
330
|
return recursive;
|
361
331
|
}
|
362
332
|
|
363
|
-
|
364
|
-
import { isDefinedError, ORPCError, safe } from "@orpc/client";
|
365
|
-
import { eventIterator, type, ValidationError } from "@orpc/contract";
|
366
|
-
import { onError, onFinish, onStart, onSuccess } from "@orpc/shared";
|
367
|
-
import { getEventMeta, withEventMeta } from "@orpc/standard-server";
|
368
|
-
export {
|
369
|
-
Builder,
|
370
|
-
DecoratedProcedure,
|
371
|
-
LAZY_LOADER_SYMBOL,
|
372
|
-
ORPCError,
|
373
|
-
Procedure,
|
374
|
-
ValidationError,
|
375
|
-
adaptRouter,
|
376
|
-
call,
|
377
|
-
convertPathToHttpPath,
|
378
|
-
createAccessibleLazyRouter,
|
379
|
-
createContractedProcedure,
|
380
|
-
createLazyProcedureFormAnyLazy,
|
381
|
-
createProcedureClient,
|
382
|
-
createRouterClient,
|
383
|
-
decorateMiddleware,
|
384
|
-
deepSetLazyRouterPrefix,
|
385
|
-
eachAllContractProcedure,
|
386
|
-
eachContractProcedure,
|
387
|
-
eventIterator,
|
388
|
-
fallbackConfig,
|
389
|
-
flatLazy,
|
390
|
-
getEventMeta,
|
391
|
-
getLazyRouterPrefix,
|
392
|
-
getRouterChild,
|
393
|
-
getRouterContract,
|
394
|
-
implement,
|
395
|
-
implementerInternal,
|
396
|
-
isDefinedError,
|
397
|
-
isLazy,
|
398
|
-
isProcedure,
|
399
|
-
lazy,
|
400
|
-
mergeContext,
|
401
|
-
middlewareOutputFn,
|
402
|
-
onError,
|
403
|
-
onFinish,
|
404
|
-
onStart,
|
405
|
-
onSuccess,
|
406
|
-
os,
|
407
|
-
safe,
|
408
|
-
setRouterContract,
|
409
|
-
type,
|
410
|
-
unlazy,
|
411
|
-
withEventMeta
|
412
|
-
};
|
413
|
-
//# sourceMappingURL=index.js.map
|
333
|
+
export { Builder, DecoratedProcedure, Procedure, adaptRouter, call, createLazyProcedureFormAnyLazy, createProcedureClient, createRouterClient, decorateMiddleware, fallbackConfig, flatLazy, getRouterChild, implement, implementerInternal, isLazy, isProcedure, lazy, mergeContext, os, setRouterContract };
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { d as StandardHandlerInterceptorOptions, P as Plugin, a as StandardHandlerOptions } from '../shared/server.D86dtDX_.mjs';
|
2
|
+
export { C as CompositePlugin } from '../shared/server.D86dtDX_.mjs';
|
3
|
+
import { Value } from '@orpc/shared';
|
4
|
+
import { C as Context } from '../shared/server.Cn9ybJtE.mjs';
|
5
|
+
import '@orpc/contract';
|
6
|
+
import '@orpc/standard-server';
|
7
|
+
import '@orpc/client';
|
8
|
+
|
9
|
+
interface CORSOptions<TContext extends Context> {
|
10
|
+
origin?: Value<string | string[] | null | undefined, [origin: string, options: StandardHandlerInterceptorOptions<TContext>]>;
|
11
|
+
timingOrigin?: Value<string | string[] | null | undefined, [origin: string, options: StandardHandlerInterceptorOptions<TContext>]>;
|
12
|
+
allowMethods?: string[];
|
13
|
+
allowHeaders?: string[];
|
14
|
+
maxAge?: number;
|
15
|
+
credentials?: boolean;
|
16
|
+
exposeHeaders?: string[];
|
17
|
+
}
|
18
|
+
declare class CORSPlugin<TContext extends Context> implements Plugin<TContext> {
|
19
|
+
private readonly options;
|
20
|
+
constructor(options?: Partial<CORSOptions<TContext>>);
|
21
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
22
|
+
}
|
23
|
+
|
24
|
+
interface ResponseHeadersPluginContext {
|
25
|
+
resHeaders?: Headers;
|
26
|
+
}
|
27
|
+
declare class ResponseHeadersPlugin<TContext extends ResponseHeadersPluginContext & Context> implements Plugin<TContext> {
|
28
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
29
|
+
}
|
30
|
+
|
31
|
+
export { type CORSOptions, CORSPlugin, Plugin, ResponseHeadersPlugin, type ResponseHeadersPluginContext };
|
@@ -0,0 +1,31 @@
|
|
1
|
+
import { d as StandardHandlerInterceptorOptions, P as Plugin, a as StandardHandlerOptions } from '../shared/server.dPmfqnQI.js';
|
2
|
+
export { C as CompositePlugin } from '../shared/server.dPmfqnQI.js';
|
3
|
+
import { Value } from '@orpc/shared';
|
4
|
+
import { C as Context } from '../shared/server.Cn9ybJtE.js';
|
5
|
+
import '@orpc/contract';
|
6
|
+
import '@orpc/standard-server';
|
7
|
+
import '@orpc/client';
|
8
|
+
|
9
|
+
interface CORSOptions<TContext extends Context> {
|
10
|
+
origin?: Value<string | string[] | null | undefined, [origin: string, options: StandardHandlerInterceptorOptions<TContext>]>;
|
11
|
+
timingOrigin?: Value<string | string[] | null | undefined, [origin: string, options: StandardHandlerInterceptorOptions<TContext>]>;
|
12
|
+
allowMethods?: string[];
|
13
|
+
allowHeaders?: string[];
|
14
|
+
maxAge?: number;
|
15
|
+
credentials?: boolean;
|
16
|
+
exposeHeaders?: string[];
|
17
|
+
}
|
18
|
+
declare class CORSPlugin<TContext extends Context> implements Plugin<TContext> {
|
19
|
+
private readonly options;
|
20
|
+
constructor(options?: Partial<CORSOptions<TContext>>);
|
21
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
22
|
+
}
|
23
|
+
|
24
|
+
interface ResponseHeadersPluginContext {
|
25
|
+
resHeaders?: Headers;
|
26
|
+
}
|
27
|
+
declare class ResponseHeadersPlugin<TContext extends ResponseHeadersPluginContext & Context> implements Plugin<TContext> {
|
28
|
+
init(options: StandardHandlerOptions<TContext>): void;
|
29
|
+
}
|
30
|
+
|
31
|
+
export { type CORSOptions, CORSPlugin, Plugin, ResponseHeadersPlugin, type ResponseHeadersPluginContext };
|
@@ -1,18 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
constructor(plugins = []) {
|
4
|
-
this.plugins = plugins;
|
5
|
-
}
|
6
|
-
init(options) {
|
7
|
-
for (const plugin of this.plugins) {
|
8
|
-
plugin.init?.(options);
|
9
|
-
}
|
10
|
-
}
|
11
|
-
};
|
1
|
+
export { C as CompositePlugin } from '../shared/server.Q6ZmnTgO.mjs';
|
2
|
+
import { value } from '@orpc/shared';
|
12
3
|
|
13
|
-
|
14
|
-
import { value } from "@orpc/shared";
|
15
|
-
var CORSPlugin = class {
|
4
|
+
class CORSPlugin {
|
16
5
|
options;
|
17
6
|
constructor(options) {
|
18
7
|
const defaults = {
|
@@ -84,10 +73,9 @@ var CORSPlugin = class {
|
|
84
73
|
return result;
|
85
74
|
});
|
86
75
|
}
|
87
|
-
}
|
76
|
+
}
|
88
77
|
|
89
|
-
|
90
|
-
var ResponseHeadersPlugin = class {
|
78
|
+
class ResponseHeadersPlugin {
|
91
79
|
init(options) {
|
92
80
|
options.rootInterceptors ??= [];
|
93
81
|
options.rootInterceptors.push(async (interceptorOptions) => {
|
@@ -98,23 +86,18 @@ var ResponseHeadersPlugin = class {
|
|
98
86
|
return result;
|
99
87
|
}
|
100
88
|
const responseHeaders = result.response.headers;
|
101
|
-
for (const [key,
|
89
|
+
for (const [key, value] of headers) {
|
102
90
|
if (Array.isArray(responseHeaders[key])) {
|
103
|
-
responseHeaders[key].push(
|
91
|
+
responseHeaders[key].push(value);
|
104
92
|
} else if (responseHeaders[key] !== void 0) {
|
105
|
-
responseHeaders[key] = [responseHeaders[key],
|
93
|
+
responseHeaders[key] = [responseHeaders[key], value];
|
106
94
|
} else {
|
107
|
-
responseHeaders[key] =
|
95
|
+
responseHeaders[key] = value;
|
108
96
|
}
|
109
97
|
}
|
110
98
|
return result;
|
111
99
|
});
|
112
100
|
}
|
113
|
-
}
|
101
|
+
}
|
114
102
|
|
115
|
-
export {
|
116
|
-
CompositePlugin,
|
117
|
-
CORSPlugin,
|
118
|
-
ResponseHeadersPlugin
|
119
|
-
};
|
120
|
-
//# sourceMappingURL=chunk-TXHKQO7N.js.map
|
103
|
+
export { CORSPlugin, ResponseHeadersPlugin };
|
@@ -1,20 +1,10 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
getRouterChild,
|
7
|
-
isProcedure,
|
8
|
-
unlazy
|
9
|
-
} from "./chunk-MHVECKBC.js";
|
10
|
-
import {
|
11
|
-
CompositePlugin
|
12
|
-
} from "./chunk-TXHKQO7N.js";
|
1
|
+
import { ORPCError, toORPCError } from '@orpc/client';
|
2
|
+
import { intercept, trim, parseEmptyableJSON } from '@orpc/shared';
|
3
|
+
import { C as CompositePlugin } from './server.Q6ZmnTgO.mjs';
|
4
|
+
import { c as createProcedureClient, e as eachContractProcedure, a as convertPathToHttpPath, i as isProcedure, u as unlazy, g as getRouterChild, b as createContractedProcedure } from './server.V6zT5iYQ.mjs';
|
5
|
+
import { RPCSerializer } from '@orpc/client/standard';
|
13
6
|
|
14
|
-
|
15
|
-
import { ORPCError, toORPCError } from "@orpc/client";
|
16
|
-
import { intercept, trim } from "@orpc/shared";
|
17
|
-
var StandardHandler = class {
|
7
|
+
class StandardHandler {
|
18
8
|
constructor(router, matcher, codec, options = {}) {
|
19
9
|
this.matcher = matcher;
|
20
10
|
this.codec = codec;
|
@@ -78,12 +68,9 @@ var StandardHandler = class {
|
|
78
68
|
}
|
79
69
|
);
|
80
70
|
}
|
81
|
-
}
|
71
|
+
}
|
82
72
|
|
83
|
-
|
84
|
-
import { RPCSerializer } from "@orpc/client/rpc";
|
85
|
-
import { parseEmptyableJSON } from "@orpc/standard-server";
|
86
|
-
var RPCCodec = class {
|
73
|
+
class RPCCodec {
|
87
74
|
serializer;
|
88
75
|
constructor(options = {}) {
|
89
76
|
this.serializer = options.serializer ?? new RPCSerializer();
|
@@ -106,10 +93,9 @@ var RPCCodec = class {
|
|
106
93
|
body: this.serializer.serialize(error.toJSON())
|
107
94
|
};
|
108
95
|
}
|
109
|
-
}
|
96
|
+
}
|
110
97
|
|
111
|
-
|
112
|
-
var RPCMatcher = class {
|
98
|
+
class RPCMatcher {
|
113
99
|
tree = {};
|
114
100
|
pendingRouters = [];
|
115
101
|
init(router, path = []) {
|
@@ -172,11 +158,6 @@ var RPCMatcher = class {
|
|
172
158
|
procedure: match.procedure
|
173
159
|
};
|
174
160
|
}
|
175
|
-
}
|
161
|
+
}
|
176
162
|
|
177
|
-
export {
|
178
|
-
StandardHandler,
|
179
|
-
RPCCodec,
|
180
|
-
RPCMatcher
|
181
|
-
};
|
182
|
-
//# sourceMappingURL=chunk-TV5DRAST.js.map
|
163
|
+
export { RPCCodec as R, StandardHandler as S, RPCMatcher as a };
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { C as Context } from './server.Cn9ybJtE.mjs';
|
2
|
+
import { a as StandardHandlerOptions, b as StandardMatcher, c as StandardCodec } from './server.D86dtDX_.mjs';
|
3
|
+
|
4
|
+
interface RPCHandlerOptions<T extends Context> extends StandardHandlerOptions<T> {
|
5
|
+
matcher?: StandardMatcher;
|
6
|
+
codec?: StandardCodec;
|
7
|
+
}
|
8
|
+
|
9
|
+
export type { RPCHandlerOptions as R };
|
@@ -1,32 +1,24 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
RPCMatcher,
|
4
|
-
StandardHandler
|
5
|
-
} from "./chunk-TV5DRAST.js";
|
1
|
+
import { toStandardRequest, toFetchResponse } from '@orpc/standard-server-fetch';
|
2
|
+
import { a as RPCMatcher, R as RPCCodec, S as StandardHandler } from './server.BBGuTxHE.mjs';
|
6
3
|
|
7
|
-
|
8
|
-
import { toFetchResponse, toStandardRequest } from "@orpc/standard-server-fetch";
|
9
|
-
var RPCHandler = class {
|
4
|
+
class RPCHandler {
|
10
5
|
standardHandler;
|
11
6
|
constructor(router, options) {
|
12
7
|
const matcher = options?.matcher ?? new RPCMatcher();
|
13
8
|
const codec = options?.codec ?? new RPCCodec();
|
14
9
|
this.standardHandler = new StandardHandler(router, matcher, codec, options);
|
15
10
|
}
|
16
|
-
async handle(request, ...
|
11
|
+
async handle(request, ...[options]) {
|
17
12
|
const standardRequest = toStandardRequest(request);
|
18
|
-
const result = await this.standardHandler.handle(standardRequest,
|
13
|
+
const result = await this.standardHandler.handle(standardRequest, options);
|
19
14
|
if (!result.matched) {
|
20
15
|
return result;
|
21
16
|
}
|
22
17
|
return {
|
23
18
|
matched: true,
|
24
|
-
response: toFetchResponse(result.response)
|
19
|
+
response: toFetchResponse(result.response, options)
|
25
20
|
};
|
26
21
|
}
|
27
|
-
}
|
22
|
+
}
|
28
23
|
|
29
|
-
export {
|
30
|
-
RPCHandler
|
31
|
-
};
|
32
|
-
//# sourceMappingURL=chunk-WDY5PTME.js.map
|
24
|
+
export { RPCHandler as R };
|