Skip to content
1 min read · 94 words

Type Alias: IsolatedFacade<S>

ts
type IsolatedFacade<S> = {
  [K in keyof S["methods"]]: (
    args: [...MethodArgs<S["methods"][K]>, signal?: AbortSignal],
  ) => Promise<MethodResult<S["methods"][K]>>;
} & {
  [K in keyof S["streams"]]: (
    args: StreamArgs<S["streams"][K]>,
  ) => ReadableStream<StreamDelta<S["streams"][K]>>;
};

Defined in: src/batteries/isolation/types.ts:253

The host-side callable facade a IsolatedServiceSpec maps to — .api on the IsolatedService returned by createIsolatedService. Every declared method becomes an async function returning Promise<R> and accepting an optional trailing AbortSignal (accepted uniformly regardless of whether the method declared { signal: true } — a signal handed to a method that didn't opt in is simply not forwarded to the guest). Every declared stream becomes a synchronous function returning a ReadableStream<D> immediately.

Type Parameters

Type Parameter
S extends IsolatedServiceSpec