roboto.domain.triggers.samples#

Sample events: what a trigger’s condition and target templates can see, shown with realistic values.

Before writing a condition or a message template, an author needs to know what {{dataset.name}} or file.relative_path will resolve to. The event catalog says which namespace roots an event exposes, but not what sits under them. A sample fills that in: it is built with the same EventNamespace and record models that serve a real firing, so the shape it shows is the shape a trigger sees. One coherent scenario runs through every root — one robot, one drive, one file, one action run on it — so the values read as a story rather than as placeholders.

Values are illustrative, not templates for real ids. Every id here is fabricated.

Module Contents#

class roboto.domain.triggers.samples.PlatformEventSample(/, **data)#

Bases: pydantic.BaseModel

One event type, dereferenced: the envelope, every root it exposes, and the template paths that resolve against them.

Parameters:

data (Any)

event: dict[str, Any]#

id, type, time, org, and payload.

Type:

The event envelope as it would arrive

event_type: roboto.domain.platform_events.PlatformEventType#

The event type this sample illustrates.

namespace: dict[str, dict[str, Any]]#

Every namespace root a condition or template may reference for this event type, keyed by root name, with the full record under each. Always includes envelope and trigger; the rest are the catalog’s exposed roots for the type.

paths: list[str]#

Every root.path a {{ }} placeholder or condition field may name, in the order the roots and their fields appear in namespace.

class roboto.domain.triggers.samples.PlatformEventSamplesResponse(/, **data)#

Bases: pydantic.BaseModel

Wire shape of GET /v1/triggers/events/samples: one sample per platform event type.

Parameters:

data (Any)

samples: dict[roboto.domain.platform_events.PlatformEventType, PlatformEventSample]#
roboto.domain.triggers.samples.SAMPLE_TIME#

The instant every sample event and record is dated from, so samples are stable across calls.

class roboto.domain.triggers.samples.SampleNamespaceSource#

A NamespaceSource that hydrates every root from the sample scenario.

Serves each root the way a real firing does — including action as the invocation’s provenance and upload as the bare transaction id — so a sample carries exactly the roots a trigger would see.

record_for_root(root, event)#
Parameters:
Return type:

Optional[collections.abc.Mapping[str, Any]]

roboto.domain.triggers.samples.platform_event_sample(event_type, catalog=DEFAULT_PLATFORM_EVENT_CATALOG)#

Build the sample for one event type.

The event, changed and tag roots are built by the same EventNamespace that serves them when a trigger fires; the entity roots are exactly the ones catalog exposes for the type.

Parameters:
Return type:

PlatformEventSample

roboto.domain.triggers.samples.platform_event_samples(catalog=DEFAULT_PLATFORM_EVENT_CATALOG)#

A sample for every event type in catalog, in catalog order.

Parameters:

catalog (roboto.domain.platform_events.PlatformEventCatalog)

Return type:

dict[roboto.domain.platform_events.PlatformEventType, PlatformEventSample]

roboto.domain.triggers.samples.sample_platform_event(event_type)#

A valid, fully populated event of event_type from the sample scenario.

Parameters:

event_type (roboto.domain.platform_events.events.PlatformEventType)

Return type:

roboto.domain.platform_events.events.PlatformEvent

roboto.domain.triggers.samples.sample_trigger()#

The trigger the sample is evaluated for; what {{trigger.*}} sees.

Return type:

roboto.domain.triggers.record.TriggerRecord

roboto.domain.triggers.samples.template_paths(record, prefix)#

Every dotted path a template may reference under prefix, in document order.

Walks nested mappings only. A list is a leaf, because path resolution descends through mappings and stops at anything else: dataset.tags is addressable, dataset.tags.0 is not.

Parameters:
  • record (collections.abc.Mapping[str, Any])

  • prefix (str)

Return type:

list[str]