import { OperationDefinition, OperationKey, OperationMap, ServiceDefinition } from "../service"; import { CompiledOperationHandlerFor, OperationHandler, SyncOperationHandler } from "./operation-handler"; /** * A Nexus Service implementation, that provides handlers for each of its operations. * * @experimental */ export declare class ServiceHandler { readonly definition: ServiceDefinition; readonly handlers: ServiceHandlerFor; private readonly operationsMap; /** * Build a `ServiceHandler` from a service definition and a collection of operation handlers. * * There must be an operation handler for every operation in the service definition. * * @param service The service definition * @param handlers The collection of handlers * @returns The compiled service handler * * @internal * @hidden */ static build(service: ServiceDefinition, handlers: ServiceHandlerFor): ServiceHandler; private constructor(); /** * Returns the definition and handler for a given operation. * * @param operationName */ getOperationHandler>(operationName: K): CompiledOperationHandlerFor; } /** * Constructs a service handler for a given service contract. * * @experimental */ export declare function serviceHandler(service: ServiceDefinition, handlers: ServiceHandlerFor): ServiceHandler; /** * A type that defines a handler for a given operation. * * @experimental */ export type OperationHandlerFor = T extends OperationDefinition ? OperationHandler | SyncOperationHandler : never; /** * A type that defines a collection of handlers for a given collection of operation interfaces. * * @experimental */ export type ServiceHandlerFor = { [K in keyof T & string]: OperationHandlerFor; };