DatasetReferenceActions

class DatasetReferenceActions(datasets: suspend (String) -> DatasetState?, manifests: suspend (context: String, caller: Caller) -> Manifest, described: Set<String>)

The actions of a dataset's rows on the aggregates they refer to: a console offers, on a row, the commands of the aggregate a REFERENCE field holds the id of, and sends them here; the catalog sends each to the owning service as the caller, so that service authorizes it as it would a direct call. The browser talks to the catalog alone: no other service's URL, no CORS.

  • actionsOf: per REFERENCE field of the version a dataset serves, the commands the owning context's Manifest declares on the aggregate (read through the manifests of the peers described by their Manifest, wow.peers.<context>.contract: manifest) that create nothing and take a flat body, whose properties are strings, numbers, booleans or enumerations: what a row's form can ask for. A context without such a client offers nothing, nor does one whose Manifest cannot be read now.

  • send: a command actionsOf offers, sent through the caller's commands as a NamedCommand to the aggregate of the row's id, in the caller's tenant, waiting with the owning service's default plan (until its snapshot holds the commit, or it is committed). An unknown dataset or field is 404 (ReferenceActionErrors), a command not offered 400 wow.command.unhandled: the relay is no open door. The owning service's refusal passes through, in its code, status and words.

Both are service routes of the context: referenceActions and sendReferenceAction.

Constructors

Link copied to clipboard
constructor(datasets: suspend (String) -> DatasetState?, manifests: suspend (context: String, caller: Caller) -> Manifest, described: Set<String>)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun actionsOf(dataset: String, caller: Caller): ReferenceActions?

The reference actions of dataset for caller, or null when no dataset of that id is served.

Link copied to clipboard
@ServiceRoute(method = RouteMethod.GET, path = "datasets/{dataset}/reference-actions", errors = ["analytics-catalog.dataset.not-served"])
suspend fun referenceActions(call: RouteCall, dataset: String): ReferenceActions

The commands each REFERENCE field of the served dataset offers on its rows, as the caller may see them.

Link copied to clipboard
suspend fun send(dataset: String, field: String, id: String, command: String, body: ObjectNode, caller: Caller, commands: CommandClient): CommandResult

Sends command with body through commands to the aggregate id of field of dataset refers to, as caller.

Link copied to clipboard
@ServiceRoute(method = RouteMethod.POST, path = "datasets/{dataset}/rows/{field}/{id}/{command}", name = "sendReferenceAction", errors = ["analytics-catalog.dataset.not-served", "analytics-catalog.dataset.not-a-reference"])
suspend fun sendReferenceAction(call: RouteCall, dataset: String, field: String, id: String, command: String, body: ObjectNode): CommandResult

One of the commands the row's field offers, sent with body to the aggregate id it refers to, as the caller: the owning service's result, or its refusal as it answered it.