MockView interface

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

interface MockView

No documentation.

Properties

route

readonly route: string;

The route prefix, such as counter or content1.

state

readonly state: MockState;

The current wire state.

revision

readonly revision: number;

The revision of the current state.

interactionHandlers

readonly interactionHandlers: readonly string[];

Interaction names that a mounted client currently handles.

Methods

update

update(patch: MockState | ((state: MockState) => MockState)): void;

Merges a patch, advances the revision and pushes the state like a .NET publication.

push

push(frame: Record<string, unknown>): void;

Pushes a raw frame to the client, such as a stale or malformed state.

pushFailure

pushFailure(failure: {
    readonly kind?: BridgeErrorKind;
    readonly message: string;
    readonly detail?: BridgeFailureDetail;
}): void;

Pushes a failure notice: .NET cannot publish this route for now, so the client keeps its last state and reports the error.

collection

collection(field: string): MockCollection;

Edits a field declared in collections.

batch

batch(edit: () => void): void;

Pushes the collection edits made by edit as one delta frame.

operations

operations(member?: string): readonly MockOperation[];

Operations started on this View, oldest first, optionally of one command member.

interact

interact(name: string, input: unknown, options?: MockInteractionOptions): Promise<MockInteractionReply>;

Sends an interaction request to the client's handler, as .NET does.