MockTypedViewSpec interface

Namespace @runic-artifex/views/mock · @runic-artifex/views 0.7.0-preview.5

interface MockTypedViewSpec

What a generated mock{Name}() knows about its client. Generated code is its only intended caller.

Properties

kind

readonly kind: string;

No documentation.

route

readonly route: string;

The root route prefix.

fields

readonly fields: Readonly<Record<string, FieldCodec>>;

Codecs of value fields by wire name. Other fields, such as content references, are stored as given.

defaults

readonly defaults: MockState;

State the client always receives, such as canSave: true.

checkedFields

readonly checkedFields?: readonly string[];

No documentation.

collections

readonly collections?: Readonly<Record<string, FieldCodec & {
    key(item: never): string;
}>>;

Keyed collections by wire name: a row codec and its key.

setters

readonly setters?: Readonly<Record<string, {
    readonly route: string;
    readonly field: string;
    readonly read: (argument: unknown) => unknown;
    readonly checked?: string;
}>>;

Setters by client method: route suffix, wire field, and how to read the route argument as a wire value.

commands

readonly commands?: Readonly<Record<string, {
    readonly route: string;
    readonly read?: (argument: unknown) => unknown;
    readonly available?: string;
    readonly encodeFailure?: (value: unknown) => unknown;
}>>;

Commands by client method. encodeFailure encodes a declared failure.

operations

readonly operations?: Readonly<Record<string, {
    readonly member: string;
    readonly decodeInput?: (wire: unknown) => unknown;
    readonly encodeResult?: (value: unknown) => unknown;
    readonly stream?: boolean;
    readonly encodeFailure?: (value: unknown) => unknown;
}>>;

Operations by client command method. encodeFailure encodes a declared failure.

contract

readonly contract?: string;

The generated contract, {ViewModel full name}:{fingerprint}.

interactions

readonly interactions?: Readonly<Record<string, {
    readonly encodeInput: (value: unknown) => unknown;
    readonly decodeOutput: (wire: unknown) => unknown;
}>>;

No documentation.