interface MockViewDefinition No documentation.
Properties
set
readonly set?: Readonly<Record<string, MockSetter>>; Setter handlers by member wire name, such as { set: { title: (state, value) => … } }. A set of a state member without a handler applies its value.
commands
readonly commands?: Readonly<Record<string, MockCommand>>; Command handlers by member wire name, such as { commands: { save: state => … } }.
can
readonly can?: Readonly<Record<string, MockAvailability>>; Command availability by member wire name. Without one, a command is available unless the state has its availability member can{Name} set to false.
collections
readonly collections?: Readonly<Record<string, (item: unknown) => string>>; Row keys of each keyed collection field, which collection(field) edits with indexed changes.
queries
readonly queries?: Readonly<Record<string, MockQuerySource>>; Query collections by member wire name (query-collections/1): their rows, which the mock filters, sorts and serves by range like a .NET row source, optionally with latency. The mock keeps the member's state (query, total, version); query(member) changes its rows and shows the loads it served.
checkedFields
readonly checkedFields?: readonly string[]; Wire names of checked fields (write and their fields versions).
fieldPaths
readonly fieldPaths?: Readonly<Record<string, readonly (readonly string[])[]>>; Field paths by member (field-paths/1): the member names below an object member, or below a row of a keyed collection (whose collections entry gives the rows' keys), such as { lines: [["quantity"]] }. A write of a field path rebuilds the object or the row and applies it with rows or set, or by replacing it.
rows
readonly rows?: Readonly<Record<string, (state: MockState, key: string, row: unknown) => Partial<MockState> | void | Promise<Partial<MockState> | void>>>; Row editors by keyed collection, such as { lines: (state, key, row) => … }: they receive a row with one cell changed and return a state patch, or throw to reject it. Without one, the row replaces the row with its key.
texts
readonly texts?: readonly string[]; Wire names of text members (string members other than append-only text fields). On a connection that uses text-splice/1, frames change them with splices, and setters accept splices, as a producer does.
operations
readonly operations?: Readonly<Record<string, MockOperationHandler | "manual">>; Operation handlers by command member, such as save. Without one, an operation runs the command's handler, if any, and succeeds.
streams
readonly streams?: readonly string[]; Command members whose operations yield a stream.
contract
readonly contract?: string; The View's operation contract, {view}:{fingerprint}. Defaults to mock.{route}:mock.
requests
readonly requests?: Readonly<Record<string, {
readonly contract?: string;
}>>; The View's view requests by name (view-requests/1), such as { focus: {} }. A registration that names another request, or a contract other than a contract given here, is unsupported, as a producer answers it. Generated typed mocks fill it in.
regions
readonly regions?: Readonly<Record<string, MockRegionDefinition>>; Region collections by member wire name (region-collections/1). The member's state value is { regions: [{ key, content }], selected }; region requests select or close its regions by key.