Skip to content

Kitto.Notification.Types

Base value types for the KittoX notification / background-job subsystem: the server-to-client event (TKXEvent), its kind/severity enumerations and the job status enumeration. TKXEvent is a plain value record of immutable fields (strings + enums), so it can be safely copied into per-session queues and passed across threads without any ownership concern; structured extra data travels as a JSON string in Payload.

TKXEvent record

A server-to-client notification event. A pure value type: all fields are strings or enums, so an event is trivially copyable and thread-safe. It is published on the TKXEventBus to a Topic and delivered to subscribed sessions over SSE.

pascal
class function JobStarted(const AUser, ATitle, AJobId: string): TKXEvent;

Builds a "job started" event for the given user job.

pascal
class function JobProgress(const AUser, AJobId, AMessage: string;

Builds a "job progress" event carrying percent and message.

pascal
class function JobCompleted(const AUser, ATitle, AJobId, AResultUrl: string): TKXEvent;

Builds a "job completed" event whose Action is the result URL.

pascal
class function JobFailed(const AUser, ATitle, AJobId, AError: string): TKXEvent;

Builds a "job failed" event whose Body carries the error text.

pascal
function EventName: string;

The client-side SSE event name for this event's Kind (e.g. job-progress, job-completed).

pascal
function ToJSON: string;

Serializes the event to a compact JSON object (the SSE data payload). The Payload field, if non-empty and valid JSON, is embedded as a nested object.

pascal
function ToSSEFrame: string;

Formats the event as a complete SSE frame (event: name\n data: {json}\n\n).

Routines

pascal
function SeverityToStr(const ASeverity: TKXEventSeverity): string;

Returns the lowercase string form of a severity (info/success/warning/error).

pascal
function JobIdToUrl(const AJobId: TGUID): string;

Formats a job id as a URL-safe token (hyphenated hex, no braces).

pascal
function TryUrlToJobId(const AToken: string;

Parses a URL job-id token back to a TGUID; returns False if invalid.

Released under Apache License, Version 2.0.