Skip to content

UDC collections

Anything a UI filters, sorts or pages — events, CPU samples, counts per minute, a menu, a list of keys — memento serves as a UDC collection. UDC is one protocol for filtering, sorting and paging across every DigitalCube project, with a server library (@jsudc/server), a core of schemas and a client (@jsudc/core), and React views (@jsudc/react). Its own site is jsudc.dev.

Every action is a POST /memento/udc/<action> with a JSON body, answered with HTTP 200 and an envelope whose kind says ok or error (udc.list.ok / udc.list.err). The actions memento answers are collections, describe, list (filter, sort, offset paging, an exact total) and read.

POST /memento/udc/list
{
"collection": "cpu_load",
"filter": { "field": "instance_id", "op": "eq", "value": "stage" },
"sort": [{ "field": "occurred_at", "dir": "desc" }],
"page": { "limit": 1 }
}
udc.list.ok
{
"kind": "udc.list.ok",
"id": "",
"payload": {
"rows": [
{
"__meta": { "id": "afc33f2d…", "version": 1 },
"occurred_at": "2026-11-02T00:41:19.588Z",
"instance_type": "server",
"instance_id": "stage",
"load_1min": 6.9,
"load_5min": 7.16,
"load_15min": 7.86,
"rendered": "Server stage — CPU: 6.9, 7.16, 7.86"
}
],
"next_cursor": null,
"total": 95492
}
}

Every collection is read-only. Events are immutable and are pushed with POST /memento/events; mutate and the schema edits answer unsupported_op.

collection rows
events every live (not archived) event of the key’s tenant, with api_key (the prefix of the key that wrote it)
cpu_load CPU_LOAD events only, payload.load_1min / 5min / 15min as decimal columns; a table and a chart
activity the tenant’s events counted per minute and per event_type, computed per request with a GROUP BY; the last 60 minutes unless the filter names minute; one integer column per type of lookups.yaml for the chart’s series
menu the examples site’s sidebar, menu.yaml as tree rows; not tenant data; its udc:collections branch lists every collection served

With accounts on, memento adds the session collections the service site reads:

collection rows
api_keys the tenant’s keys: name, prefix, scopes, status, daily limit, used today, events in the last 24 h
api_key_events the events collection over events written with a key; needs a filter on api_key
api_key_history the key lifecycle events (APIKEY_*) of one key; needs a filter on instance_id
api_key_activity the activity collection over events written with a key, bucketed per key too
api_key_usage the hourly usage meter: requests, events written, rows read, stream seconds, bytes in
admin_users every user (administrators only)
admin_api_keys every key of every tenant (administrators only)
  • An API key for events, cpu_load, activity and menu: read for reads. The tenant is the key’s, as everywhere (Tenants and API keys).
  • The session cookie for the session collections (auth: "session", or "admin" for the two admin ones), with Content-Type: application/json. They refuse a key.
  • Either for menu when accounts are on (key_or_session): the service site has no key, so its sidebar reads the menu with the cookie; writes still need a key.

A refusal is answered in the protocol, not with an HTTP error: {"kind":"udc.list.err","payload":{"code":"forbidden",…}}.

A UDC filter is the same shape as memento’s own Filter DSL — conditions field / op / value under and, or and not — over any field of the collection, with a few operators spelled UDC’s way:

memento Filter DSL UDC
prefix starts_with
ne neq
nin not_in
is_null with false is_not_null

UDC also has ends_with. The Search example shows one search in both spellings, side by side.

events and cpu_load carry the rendered sentence. A client that sends the header X-Memento-Locale: sr on /udc/list and /udc/read gets the rows rendered in Serbian, for the response only (Rendering). The examples site sends the header’s language with every request, so switching EN / SR reloads every list in the other language.

Through @jsudc/react, and nothing else for list data: a UdcProvider with a UdcClient (httpUrl the memento base, the key as Authorization: Bearer, and X-Memento-Locale), then UdcDataView for a whole table / chart view with its filter chips, sort and paging, or useUdcCollection when the page draws the rows itself. Filter, sort and page live in the UDC request — and, with UdcReactRouterUrlState, in the page’s URL — never in hand-written query parameters.

This is a rule of the repository, not only a habit: new list data is a new UDC collection, read through @jsudc/react. One protocol means one place, jsudc, to fix a bug or add a feature, and every project gets it with the next install.

v1.1.0released built 663143e