UNPKG

@orpc/server

Version:

<div align="center"> <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" /> </div>

45 lines (41 loc) 1.65 kB
import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard'; import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.Bmh5xd4n.js'; import { HibernationEventIterator } from '@orpc/standard-server'; export { HibernationEventIterator, HibernationEventIteratorCallback } from '@orpc/standard-server'; import { C as Context, R as Router } from '../shared/server.CYNGeoCm.js'; import '@orpc/client'; import '@orpc/contract'; import '@orpc/shared'; interface EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions { /** * The type of event, each type corresponds a different operation * * - 'message' = 'yield' * - 'error' = 'throw' * - 'done' = 'return' * * @default 'message' */ event?: 'message' | 'error' | 'done'; } /** * Encodes a Hibernation RPC Event * * @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin} */ declare function encodeHibernationRPCEvent(id: string, payload: unknown, options?: EncodeHibernationRPCEventOptions): string; interface HibernationPluginContext { iterator?: HibernationEventIterator<any>; } /** * Enable Hibernation APIs * * @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin} */ declare class HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> { readonly CONTEXT_SYMBOL: symbol; order: number; init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void; } export { HibernationPlugin, encodeHibernationRPCEvent }; export type { EncodeHibernationRPCEventOptions, HibernationPluginContext };