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.BaseModelOne 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
envelopeandtrigger; the rest are the catalog’s exposed roots for the type.
- class roboto.domain.triggers.samples.PlatformEventSamplesResponse(/, **data)#
Bases:
pydantic.BaseModelWire 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
NamespaceSourcethat hydrates every root from the sample scenario.Serves each root the way a real firing does — including
actionas the invocation’s provenance anduploadas the bare transaction id — so a sample carries exactly the roots a trigger would see.- record_for_root(root, event)#
- Parameters:
root (str)
- 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,changedandtagroots are built by the sameEventNamespacethat serves them when a trigger fires; the entity roots are exactly the onescatalogexposes for the type.- Parameters:
- Return type:
- 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_typefrom the sample scenario.- Parameters:
event_type (roboto.domain.platform_events.events.PlatformEventType)
- Return type:
- roboto.domain.triggers.samples.sample_trigger()#
The trigger the sample is evaluated for; what
{{trigger.*}}sees.- Return type:
- 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.tagsis addressable,dataset.tags.0is not.- Parameters:
record (collections.abc.Mapping[str, Any])
prefix (str)
- Return type:
list[str]