MCPcopy Create free account
hub / github.com/middleapi/orpc / onStart

Function onStart

packages/shared/src/interceptor.ts:21–28  ·  view source on GitHub ↗
(
  callback: NoInfer<(options: TOptions, ...rest: TRest) => Promisable<void>>,
)

Source from the content-addressed store, hash-verified

19 * Can be used for interceptors or middlewares
20 */
21export function onStart<T, TOptions extends { next(): any }, TRest extends any[]>(
22 callback: NoInfer<(options: TOptions, ...rest: TRest) => Promisable<void>>,
23): (options: TOptions, ...rest: TRest) => T | Promise<Awaited<ReturnType<TOptions['next']>>> {
24 return async (options, ...rest) => {
25 await callback(options, ...rest)
26 return await options.next()
27 }
28}
29
30/**
31 * Can be used for interceptors or middlewares

Callers 4

onStartDeferredFunction · 0.90

Calls 2

callbackFunction · 0.85
nextMethod · 0.45

Tested by

no test coverage detected