/** * Capability plumbing between structs and the message cap table. * * Generated code reads/writes interface-typed fields through getInterfaceClient and * setInterfaceClient; the connection encodes/decodes the message cap table to and from * Payload.capTable separately. */ import { Struct } from "../serialization/pointers/struct"; import { Client } from "./client"; import { Server } from "./server"; /** Anything a generated interface-field setter accepts. */ export type ClientLike = Client | Server | { client: Client; }; /** A client whose calls all reject with `reason`. */ export declare function brokenClient(reason: string): Client; /** * The client for the capability at pointer field `index` of `s`. Returns a broken * client if the field is null or the cap table has no entry for it. */ export declare function getInterfaceClient(index: number, s: Struct): Client; /** Normalize a generated client wrapper or a Server to a bare Client. */ export declare function normalizeClient(value: ClientLike): Client; /** * Walk a PromisedAnswer transform path from a Payload's content and return the client * for the capability at the end of it. */ export declare function resolveCapability(payload: Struct, transform: number[]): Client; /** * Store a capability into pointer field `index` of `s`, registering it in the * containing message's cap table. */ export declare function setInterfaceClient(index: number, value: ClientLike, s: Struct): void;