Package-level declarations

Types

Link copied to clipboard
sealed class Action

One thing an interaction does.

Link copied to clipboard
class ActionError(val identity: String, val verb: String, val path: String, val at: List<Int> = emptyList(), message: String? = null)

Why an interaction stopped.

Link copied to clipboard
data class ApplyResult(val state: <Error class: unknown class>, val events: List<EmittedEvent> = emptyList(), val error: ActionError? = null)

What one interaction produced.

Link copied to clipboard
data class EmittedEvent(val name: String, val params: <Error class: unknown class> = JsonObject(emptyMap()))

An event an interaction produced, in the order it was reached.

Link copied to clipboard
class JoyStore(view: <Error class: unknown class>, initialState: <Error class: unknown class> = JsonObject(emptyMap()), resolver: <Error class: unknown class> = Resolver.Default, onEvent: (EmittedEvent) -> Unit? = null, onError: (LoggedEvent, ActionError) -> Unit? = null)

The one state owner: holds the state and the session log, and runs dispatch → apply → resolve serially.

Link copied to clipboard
data class LoggedEvent(val binding: Action.Emit, val payload: <Error class: unknown class> = JsonNull)

One interaction as it was fired — enough to replay it.

Link copied to clipboard
sealed class MutationAction : Action

A write against state: a verb, an RFC 6901 path, and whatever the verb needs.

Functions

Link copied to clipboard
fun applyAction(state: <Error class: unknown class>, action: Action, payload: <Error class: unknown class> = JsonNull): ApplyResult

Runs action against state and returns the settled state plus the events it emitted.

Link copied to clipboard
fun dispatchEvent(state: <Error class: unknown class>, binding: Action.Emit, handlers: Map<String, Action>, payload: <Error class: unknown class> = JsonNull): ApplyResult

Resolves a fired binding against the document's handlers region and runs one interaction.

Link copied to clipboard
fun handlersOf(document: <Error class: unknown class>): Map<String, Action>

The document's handlers region: event name → Action.