@orpc/server 0.0.0-next.df024bb → 0.0.0-next.e0f01a5

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.
Files changed (44) hide show
  1. package/README.md +14 -1
  2. package/dist/adapters/fetch/index.d.mts +43 -11
  3. package/dist/adapters/fetch/index.d.ts +43 -11
  4. package/dist/adapters/fetch/index.mjs +103 -7
  5. package/dist/adapters/node/index.d.mts +45 -22
  6. package/dist/adapters/node/index.d.ts +45 -22
  7. package/dist/adapters/node/index.mjs +81 -21
  8. package/dist/adapters/standard/index.d.mts +12 -15
  9. package/dist/adapters/standard/index.d.ts +12 -15
  10. package/dist/adapters/standard/index.mjs +6 -5
  11. package/dist/index.d.mts +161 -124
  12. package/dist/index.d.ts +161 -124
  13. package/dist/index.mjs +78 -48
  14. package/dist/plugins/index.d.mts +112 -18
  15. package/dist/plugins/index.d.ts +112 -18
  16. package/dist/plugins/index.mjs +157 -8
  17. package/dist/shared/server.B1oIHH_j.d.mts +74 -0
  18. package/dist/shared/server.BVHsfJ99.d.mts +144 -0
  19. package/dist/shared/server.BVHsfJ99.d.ts +144 -0
  20. package/dist/shared/server.BVwwTHyO.mjs +9 -0
  21. package/dist/shared/server.BW-nUGgA.mjs +36 -0
  22. package/dist/shared/server.BuLPHTX1.d.mts +18 -0
  23. package/dist/shared/{server.V6zT5iYQ.mjs → server.C37gDhSZ.mjs} +158 -173
  24. package/dist/shared/server.CaWivVk3.d.ts +74 -0
  25. package/dist/shared/server.DFuJLDuo.mjs +190 -0
  26. package/dist/shared/server.DMhSfHk1.d.ts +10 -0
  27. package/dist/shared/server.D_vpYits.d.ts +18 -0
  28. package/dist/shared/server.Dwnm6cSk.d.mts +10 -0
  29. package/package.json +8 -22
  30. package/dist/adapters/hono/index.d.mts +0 -20
  31. package/dist/adapters/hono/index.d.ts +0 -20
  32. package/dist/adapters/hono/index.mjs +0 -32
  33. package/dist/adapters/next/index.d.mts +0 -27
  34. package/dist/adapters/next/index.d.ts +0 -27
  35. package/dist/adapters/next/index.mjs +0 -29
  36. package/dist/shared/server.BBGuTxHE.mjs +0 -163
  37. package/dist/shared/server.BMaJxq9W.d.mts +0 -9
  38. package/dist/shared/server.BT-fqIEm.d.mts +0 -77
  39. package/dist/shared/server.DpdgHO1j.d.ts +0 -9
  40. package/dist/shared/server.KwueCzFr.mjs +0 -26
  41. package/dist/shared/server.Q6ZmnTgO.mjs +0 -12
  42. package/dist/shared/server.ptXwNGQr.d.mts +0 -158
  43. package/dist/shared/server.ptXwNGQr.d.ts +0 -158
  44. package/dist/shared/server.xL87pHsk.d.ts +0 -77
@@ -1,18 +1,48 @@
1
+ import { isContractProcedure, ValidationError, mergePrefix, mergeErrorMap, enhanceRoute } from '@orpc/contract';
1
2
  import { fallbackORPCErrorStatus, ORPCError } from '@orpc/client';
2
- import { isContractProcedure, ValidationError, mergePrefix, mergeErrorMap, adaptRoute } from '@orpc/contract';
3
- import { value, intercept, toError } from '@orpc/shared';
3
+ import { value, intercept } from '@orpc/shared';
4
4
 
5
- const LAZY_LOADER_SYMBOL = Symbol("ORPC_LAZY_LOADER");
6
- function lazy(loader) {
5
+ const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
6
+ function lazy(loader, meta = {}) {
7
7
  return {
8
- [LAZY_LOADER_SYMBOL]: loader
8
+ [LAZY_SYMBOL]: {
9
+ loader,
10
+ meta
11
+ }
9
12
  };
10
13
  }
11
14
  function isLazy(item) {
12
- return (typeof item === "object" || typeof item === "function") && item !== null && LAZY_LOADER_SYMBOL in item && typeof item[LAZY_LOADER_SYMBOL] === "function";
15
+ return (typeof item === "object" || typeof item === "function") && item !== null && LAZY_SYMBOL in item;
16
+ }
17
+ function getLazyMeta(lazied) {
18
+ return lazied[LAZY_SYMBOL].meta;
13
19
  }
14
20
  function unlazy(lazied) {
15
- return isLazy(lazied) ? lazied[LAZY_LOADER_SYMBOL]() : Promise.resolve({ default: lazied });
21
+ return isLazy(lazied) ? lazied[LAZY_SYMBOL].loader() : Promise.resolve({ default: lazied });
22
+ }
23
+
24
+ function isStartWithMiddlewares(middlewares, compare) {
25
+ if (compare.length > middlewares.length) {
26
+ return false;
27
+ }
28
+ for (let i = 0; i < middlewares.length; i++) {
29
+ if (compare[i] === void 0) {
30
+ return true;
31
+ }
32
+ if (middlewares[i] !== compare[i]) {
33
+ return false;
34
+ }
35
+ }
36
+ return true;
37
+ }
38
+ function mergeMiddlewares(first, second, options) {
39
+ if (options.dedupeLeading && isStartWithMiddlewares(second, first)) {
40
+ return second;
41
+ }
42
+ return [...first, ...second];
43
+ }
44
+ function addMiddleware(middlewares, addition) {
45
+ return [...middlewares, addition];
16
46
  }
17
47
 
18
48
  class Procedure {
@@ -28,50 +58,8 @@ function isProcedure(item) {
28
58
  return isContractProcedure(item) && "middlewares" in item["~orpc"] && "inputValidationIndex" in item["~orpc"] && "outputValidationIndex" in item["~orpc"] && "handler" in item["~orpc"];
29
59
  }
30
60
 
31
- function flatLazy(lazied) {
32
- const flattenLoader = async () => {
33
- let current = await unlazy(lazied);
34
- while (true) {
35
- if (!isLazy(current.default)) {
36
- break;
37
- }
38
- current = await unlazy(current.default);
39
- }
40
- return current;
41
- };
42
- return lazy(flattenLoader);
43
- }
44
- function createLazyProcedureFormAnyLazy(lazied) {
45
- const lazyProcedure = lazy(async () => {
46
- const { default: maybeProcedure } = await unlazy(flatLazy(lazied));
47
- if (!isProcedure(maybeProcedure)) {
48
- throw new Error(`
49
- Expected a lazy<procedure> but got lazy<unknown>.
50
- This should be caught by TypeScript compilation.
51
- Please report this issue if this makes you feel uncomfortable.
52
- `);
53
- }
54
- return { default: maybeProcedure };
55
- });
56
- return lazyProcedure;
57
- }
58
-
59
- function dedupeMiddlewares(compare, middlewares) {
60
- let min = 0;
61
- for (let i = 0; i < middlewares.length; i++) {
62
- const index = compare.indexOf(middlewares[i], min);
63
- if (index === -1) {
64
- return middlewares.slice(i);
65
- }
66
- min = index + 1;
67
- }
68
- return [];
69
- }
70
- function mergeMiddlewares(first, second) {
71
- return [...first, ...dedupeMiddlewares(first, second)];
72
- }
73
- function addMiddleware(middlewares, addition) {
74
- return [...middlewares, addition];
61
+ function mergeCurrentContext(context, other) {
62
+ return { ...context, ...other };
75
63
  }
76
64
 
77
65
  function createORPCErrorConstructorMap(errors) {
@@ -139,7 +127,7 @@ function createProcedureClient(lazyableProcedure, ...[options]) {
139
127
  );
140
128
  } catch (e) {
141
129
  if (!(e instanceof ORPCError)) {
142
- throw toError(e);
130
+ throw e;
143
131
  }
144
132
  const validated = await validateORPCError(procedure["~orpc"].errorMap, e);
145
133
  throw validated;
@@ -181,193 +169,187 @@ async function executeProcedureInternal(procedure, options) {
181
169
  const middlewares = procedure["~orpc"].middlewares;
182
170
  const inputValidationIndex = Math.min(Math.max(0, procedure["~orpc"].inputValidationIndex), middlewares.length);
183
171
  const outputValidationIndex = Math.min(Math.max(0, procedure["~orpc"].outputValidationIndex), middlewares.length);
184
- let currentIndex = 0;
185
- let currentContext = options.context;
186
- let currentInput = options.input;
187
- const next = async (...[nextOptions]) => {
188
- const index = currentIndex;
189
- currentIndex += 1;
190
- currentContext = { ...currentContext, ...nextOptions?.context };
172
+ const next = async (index, context, input) => {
173
+ let currentInput = input;
191
174
  if (index === inputValidationIndex) {
192
175
  currentInput = await validateInput(procedure, currentInput);
193
176
  }
194
177
  const mid = middlewares[index];
195
- const result = mid ? await mid({ ...options, context: currentContext, next }, currentInput, middlewareOutputFn) : { output: await procedure["~orpc"].handler({ ...options, context: currentContext, input: currentInput }), context: currentContext };
178
+ const output = mid ? (await mid({
179
+ ...options,
180
+ context,
181
+ next: async (...[nextOptions]) => {
182
+ const nextContext = nextOptions?.context ?? {};
183
+ return {
184
+ output: await next(index + 1, mergeCurrentContext(context, nextContext), currentInput),
185
+ context: nextContext
186
+ };
187
+ }
188
+ }, currentInput, middlewareOutputFn)).output : await procedure["~orpc"].handler({ ...options, context, input: currentInput });
196
189
  if (index === outputValidationIndex) {
197
- const validatedOutput = await validateOutput(procedure, result.output);
198
- return {
199
- ...result,
200
- output: validatedOutput
201
- };
190
+ return await validateOutput(procedure, output);
202
191
  }
203
- return result;
192
+ return output;
204
193
  };
205
- return (await next({})).output;
194
+ return next(0, options.context, options.input);
206
195
  }
207
196
 
208
- const ROUTER_CONTRACT_SYMBOL = Symbol("ORPC_ROUTER_CONTRACT");
209
- function setRouterContract(obj, contract) {
210
- return new Proxy(obj, {
197
+ const HIDDEN_ROUTER_CONTRACT_SYMBOL = Symbol("ORPC_HIDDEN_ROUTER_CONTRACT");
198
+ function setHiddenRouterContract(router, contract) {
199
+ return new Proxy(router, {
211
200
  get(target, key) {
212
- if (key === ROUTER_CONTRACT_SYMBOL) {
201
+ if (key === HIDDEN_ROUTER_CONTRACT_SYMBOL) {
213
202
  return contract;
214
203
  }
215
204
  return Reflect.get(target, key);
216
205
  }
217
206
  });
218
207
  }
219
- function getRouterContract(obj) {
220
- return obj[ROUTER_CONTRACT_SYMBOL];
208
+ function getHiddenRouterContract(router) {
209
+ return router[HIDDEN_ROUTER_CONTRACT_SYMBOL];
221
210
  }
222
- const LAZY_ROUTER_PREFIX_SYMBOL = Symbol("ORPC_LAZY_ROUTER_PREFIX");
223
- function deepSetLazyRouterPrefix(router, prefix) {
224
- return new Proxy(router, {
225
- get(target, key) {
226
- if (key !== LAZY_ROUTER_PREFIX_SYMBOL) {
227
- const val = Reflect.get(target, key);
228
- if (isLazy(val)) {
229
- return deepSetLazyRouterPrefix(val, prefix);
230
- }
231
- return val;
232
- }
233
- return prefix;
211
+
212
+ function getRouter(router, path) {
213
+ let current = router;
214
+ for (let i = 0; i < path.length; i++) {
215
+ const segment = path[i];
216
+ if (!current) {
217
+ return void 0;
234
218
  }
235
- });
236
- }
237
- function getLazyRouterPrefix(obj) {
238
- return obj[LAZY_ROUTER_PREFIX_SYMBOL];
219
+ if (isProcedure(current)) {
220
+ return void 0;
221
+ }
222
+ if (!isLazy(current)) {
223
+ current = current[segment];
224
+ continue;
225
+ }
226
+ const lazied = current;
227
+ const rest = path.slice(i);
228
+ return lazy(async () => {
229
+ const unwrapped = await unlazy(lazied);
230
+ const next = getRouter(unwrapped.default, rest);
231
+ return unlazy(next);
232
+ }, getLazyMeta(lazied));
233
+ }
234
+ return current;
239
235
  }
240
-
241
236
  function createAccessibleLazyRouter(lazied) {
242
- const flattenLazy = flatLazy(lazied);
243
- const recursive = new Proxy(flattenLazy, {
237
+ const recursive = new Proxy(lazied, {
244
238
  get(target, key) {
245
239
  if (typeof key !== "string") {
246
240
  return Reflect.get(target, key);
247
241
  }
248
- const next = getRouterChild(flattenLazy, key);
242
+ const next = getRouter(lazied, [key]);
249
243
  return createAccessibleLazyRouter(next);
250
244
  }
251
245
  });
252
246
  return recursive;
253
247
  }
254
-
255
- function adaptRouter(router, options) {
248
+ function enhanceRouter(router, options) {
256
249
  if (isLazy(router)) {
257
- const adapted2 = lazy(async () => {
258
- const unlaziedRouter = (await unlazy(router)).default;
259
- const adapted3 = adaptRouter(unlaziedRouter, options);
260
- return { default: adapted3 };
250
+ const laziedMeta = getLazyMeta(router);
251
+ const enhancedPrefix = laziedMeta?.prefix ? mergePrefix(options.prefix, laziedMeta?.prefix) : options.prefix;
252
+ const enhanced2 = lazy(async () => {
253
+ const { default: unlaziedRouter } = await unlazy(router);
254
+ const enhanced3 = enhanceRouter(unlaziedRouter, options);
255
+ return unlazy(enhanced3);
256
+ }, {
257
+ ...laziedMeta,
258
+ prefix: enhancedPrefix
261
259
  });
262
- const accessible = createAccessibleLazyRouter(adapted2);
263
- const currentPrefix = getLazyRouterPrefix(router);
264
- const prefix = currentPrefix ? mergePrefix(options.prefix, currentPrefix) : options.prefix;
265
- if (prefix) {
266
- return deepSetLazyRouterPrefix(accessible, prefix);
267
- }
260
+ const accessible = createAccessibleLazyRouter(enhanced2);
268
261
  return accessible;
269
262
  }
270
263
  if (isProcedure(router)) {
271
- const newMiddlewares = mergeMiddlewares(options.middlewares, router["~orpc"].middlewares);
264
+ const newMiddlewares = mergeMiddlewares(options.middlewares, router["~orpc"].middlewares, { dedupeLeading: options.dedupeLeadingMiddlewares });
272
265
  const newMiddlewareAdded = newMiddlewares.length - router["~orpc"].middlewares.length;
273
- const adapted2 = new Procedure({
266
+ const enhanced2 = new Procedure({
274
267
  ...router["~orpc"],
275
- route: adaptRoute(router["~orpc"].route, options),
268
+ route: enhanceRoute(router["~orpc"].route, options),
276
269
  errorMap: mergeErrorMap(options.errorMap, router["~orpc"].errorMap),
277
270
  middlewares: newMiddlewares,
278
271
  inputValidationIndex: router["~orpc"].inputValidationIndex + newMiddlewareAdded,
279
272
  outputValidationIndex: router["~orpc"].outputValidationIndex + newMiddlewareAdded
280
273
  });
281
- return adapted2;
274
+ return enhanced2;
282
275
  }
283
- const adapted = {};
276
+ const enhanced = {};
284
277
  for (const key in router) {
285
- adapted[key] = adaptRouter(router[key], options);
286
- }
287
- return adapted;
288
- }
289
- function getRouterChild(router, ...path) {
290
- let current = router;
291
- for (let i = 0; i < path.length; i++) {
292
- const segment = path[i];
293
- if (!current) {
294
- return void 0;
295
- }
296
- if (isProcedure(current)) {
297
- return void 0;
298
- }
299
- if (!isLazy(current)) {
300
- current = current[segment];
301
- continue;
302
- }
303
- const lazied = current;
304
- const rest = path.slice(i);
305
- const newLazy = lazy(async () => {
306
- const unwrapped = await unlazy(lazied);
307
- if (!unwrapped.default) {
308
- return unwrapped;
309
- }
310
- const next = getRouterChild(unwrapped.default, ...rest);
311
- return { default: next };
312
- });
313
- return flatLazy(newLazy);
278
+ enhanced[key] = enhanceRouter(router[key], options);
314
279
  }
315
- return current;
280
+ return enhanced;
316
281
  }
317
-
318
- function eachContractProcedure(options, callback, laziedOptions = []) {
319
- const hiddenContract = getRouterContract(options.router);
320
- if (hiddenContract) {
321
- return eachContractProcedure(
322
- {
323
- router: hiddenContract,
324
- path: options.path
325
- },
326
- callback,
327
- laziedOptions
328
- );
282
+ function traverseContractProcedures(options, callback, lazyOptions = []) {
283
+ let currentRouter = options.router;
284
+ const hiddenContract = getHiddenRouterContract(options.router);
285
+ if (hiddenContract !== void 0) {
286
+ currentRouter = hiddenContract;
329
287
  }
330
- if (isLazy(options.router)) {
331
- laziedOptions.push({
332
- lazied: options.router,
288
+ if (isLazy(currentRouter)) {
289
+ lazyOptions.push({
290
+ router: currentRouter,
333
291
  path: options.path
334
292
  });
335
- } else if (isContractProcedure(options.router)) {
293
+ } else if (isContractProcedure(currentRouter)) {
336
294
  callback({
337
- contract: options.router,
295
+ contract: currentRouter,
338
296
  path: options.path
339
297
  });
340
298
  } else {
341
- for (const key in options.router) {
342
- eachContractProcedure(
299
+ for (const key in currentRouter) {
300
+ traverseContractProcedures(
343
301
  {
344
- router: options.router[key],
302
+ router: currentRouter[key],
345
303
  path: [...options.path, key]
346
304
  },
347
305
  callback,
348
- laziedOptions
306
+ lazyOptions
349
307
  );
350
308
  }
351
309
  }
352
- return laziedOptions;
310
+ return lazyOptions;
353
311
  }
354
- async function eachAllContractProcedure(options, callback) {
312
+ async function resolveContractProcedures(options, callback) {
355
313
  const pending = [options];
356
- for (const item of pending) {
357
- const lazies = eachContractProcedure(item, callback);
358
- for (const lazy of lazies) {
359
- const { default: router } = await unlazy(lazy.lazied);
314
+ for (const options2 of pending) {
315
+ const lazyOptions = traverseContractProcedures(options2, callback);
316
+ for (const options3 of lazyOptions) {
317
+ const { default: router } = await unlazy(options3.router);
360
318
  pending.push({
361
- path: lazy.path,
362
- router
319
+ router,
320
+ path: options3.path
363
321
  });
364
322
  }
365
323
  }
366
324
  }
367
- function convertPathToHttpPath(path) {
368
- return `/${path.map(encodeURIComponent).join("/")}`;
325
+ async function unlazyRouter(router) {
326
+ if (isProcedure(router)) {
327
+ return router;
328
+ }
329
+ const unlazied = {};
330
+ for (const key in router) {
331
+ const item = router[key];
332
+ const { default: unlaziedRouter } = await unlazy(item);
333
+ unlazied[key] = await unlazyRouter(unlaziedRouter);
334
+ }
335
+ return unlazied;
369
336
  }
370
- function createContractedProcedure(contract, procedure) {
337
+
338
+ function createAssertedLazyProcedure(lazied) {
339
+ const lazyProcedure = lazy(async () => {
340
+ const { default: maybeProcedure } = await unlazy(lazied);
341
+ if (!isProcedure(maybeProcedure)) {
342
+ throw new Error(`
343
+ Expected a lazy<procedure> but got lazy<unknown>.
344
+ This should be caught by TypeScript compilation.
345
+ Please report this issue if this makes you feel uncomfortable.
346
+ `);
347
+ }
348
+ return { default: maybeProcedure };
349
+ }, getLazyMeta(lazied));
350
+ return lazyProcedure;
351
+ }
352
+ function createContractedProcedure(procedure, contract) {
371
353
  return new Procedure({
372
354
  ...procedure["~orpc"],
373
355
  errorMap: contract["~orpc"].errorMap,
@@ -375,5 +357,8 @@ function createContractedProcedure(contract, procedure) {
375
357
  meta: contract["~orpc"].meta
376
358
  });
377
359
  }
360
+ function call(procedure, input, ...rest) {
361
+ return createProcedureClient(procedure, ...rest)(input);
362
+ }
378
363
 
379
- export { LAZY_LOADER_SYMBOL as L, Procedure as P, convertPathToHttpPath as a, createContractedProcedure as b, createProcedureClient as c, addMiddleware as d, eachContractProcedure as e, adaptRouter as f, getRouterChild as g, flatLazy as h, isProcedure as i, isLazy as j, createLazyProcedureFormAnyLazy as k, lazy as l, getRouterContract as m, deepSetLazyRouterPrefix as n, getLazyRouterPrefix as o, middlewareOutputFn as p, createAccessibleLazyRouter as q, eachAllContractProcedure as r, setRouterContract as s, unlazy as u };
364
+ export { LAZY_SYMBOL as L, Procedure as P, createContractedProcedure as a, addMiddleware as b, createProcedureClient as c, isLazy as d, enhanceRouter as e, createAssertedLazyProcedure as f, getRouter as g, createORPCErrorConstructorMap as h, isProcedure as i, getLazyMeta as j, middlewareOutputFn as k, lazy as l, mergeCurrentContext as m, isStartWithMiddlewares as n, mergeMiddlewares as o, call as p, getHiddenRouterContract as q, createAccessibleLazyRouter as r, setHiddenRouterContract as s, traverseContractProcedures as t, unlazy as u, validateORPCError as v, resolveContractProcedures as w, unlazyRouter as x };
@@ -0,0 +1,74 @@
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 { C as Context, f as AnyRouter, h as AnyProcedure, F as ProcedureClientInterceptorOptions, R as Router } from './server.BVHsfJ99.js';
6
+
7
+ interface StandardHandlerPlugin<TContext extends Context> {
8
+ order?: number;
9
+ init?(options: StandardHandlerOptions<TContext>): void;
10
+ }
11
+ declare class CompositeStandardHandlerPlugin<T extends Context, TPlugin extends StandardHandlerPlugin<T>> implements StandardHandlerPlugin<T> {
12
+ protected readonly plugins: TPlugin[];
13
+ constructor(plugins?: readonly TPlugin[]);
14
+ init(options: StandardHandlerOptions<T>): void;
15
+ }
16
+
17
+ type StandardParams = Record<string, string>;
18
+ type StandardMatchResult = {
19
+ path: readonly string[];
20
+ procedure: AnyProcedure;
21
+ params?: StandardParams;
22
+ } | undefined;
23
+ interface StandardMatcher {
24
+ init(router: AnyRouter): void;
25
+ match(method: string, pathname: HTTPPath): Promise<StandardMatchResult>;
26
+ }
27
+ interface StandardCodec {
28
+ encode(output: unknown, procedure: AnyProcedure): StandardResponse;
29
+ encodeError(error: ORPCError<any, any>): StandardResponse;
30
+ decode(request: StandardLazyRequest, params: StandardParams | undefined, procedure: AnyProcedure): Promise<unknown>;
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, StandardHandler as i };
74
+ export type { StandardHandlerInterceptorOptions as S, StandardHandlerPlugin as a, StandardHandlerOptions as b, StandardCodec as c, StandardParams as d, StandardMatcher as e, StandardMatchResult as f, StandardHandleOptions as g, StandardHandleResult as h };