export type Procedure = T extends (arg: infer I) => infer O ? (query: I & QueryOptions) => Return : undefined; export type Remote> = { [K in keyof T]: Procedure; }; export type Return = T extends Promise ? Promise : Promise; export interface QueryOptions { signal?: AbortSignal; timeout?: number; transfer?: Set; } export interface TransferOptions { transfer?: Set; } export type NonUndefined = A extends undefined ? never : A; export type ProcedureNames> = Array<{ [K in keyof T]-?: NonUndefined extends Function ? K : never; }[keyof T]>; /** * Any method name of the associated with RPC service. */ export type Method> = ServiceQuery['method']; /** * Namespace of the RCP service */ export type Namespace> = ServiceQuery['namespace']; export type Values> = T[keyof T]; export type Keys> = keyof T; export type Inn> = ServiceQuery['input']; export type Out> = ServiceQuery['result']; export type RPCQuery> = Pick, 'method' | 'namespace' | 'input' | 'timeout' | 'signal'>; export type ServiceQuery = Values<{ [NS in keyof T]: NamespacedQuery; }>; export type NamespacedQuery = Values<{ [M in keyof S]-?: S[M] extends (input: infer I) => infer O ? { namespace: NS; method: M; input: I & QueryOptions; result: R; } & QueryOptions : never; }>; type R = O extends Promise ? Promise> : Promise>; type WithTransferOptions = O extends Record ? O & TransferOptions : O; export type MultiService = { [NS in keyof T]: NamespacedService; }; type NamespacedService = { [M in keyof S]: NamespacedMethod; }; export type NamespacedMethod = T extends (arg: infer I) => infer O ? (query: I & QueryOptions) => Return : never; export {}; //# sourceMappingURL=rpc.d.ts.map