ObjectStackObjectStack

Events Core

Events Core protocol schemas

Source: packages/spec/src/kernel/events/core.zod.ts

TypeScript Usage

import { EventSchema, EventMetadataSchema, EventPriority, EventTypeDefinitionSchema } from '@objectstack/spec/kernel';
import type { Event, EventPriority, EventTypeDefinition } from '@objectstack/spec/kernel';

// Validate data
const result = EventSchema.parse(data);

Event

Properties

PropertyTypeRequiredDescription
idstringoptionalUnique event identifier
namestringEvent name (dot notation by convention, e.g. user.created, order.paid; the platform-checked event vocabulary is the closed DataEventType / BulkDataEventType enums)
payloadanyEvent payload schema
metadata{ source: string; timestamp: string; userId?: string; tenantId?: string; … }Event metadata

Nested Shape: Event.metadata

PropertyTypeRequiredDescription
sourcestringEvent source (e.g., plugin name, system component)
timestampstringISO 8601 datetime when event was created
userIdstringoptionalUser who triggered the event
tenantIdstringoptionalTenant identifier for multi-tenant systems
correlationIdstringoptionalCorrelation ID for event tracing
causationIdstringoptionalID of the event that caused this event
priorityEnum<'critical' | 'high' | 'normal' | 'low' | 'background'>optional (default: "normal")Event priority
cluster{ scope: Enum<'local' | 'cluster' | 'tenant'>; deliverySemantics?: Enum<'best-effort' | 'at-least-once' | 'exactly-once'>; partitionKey?: string }optionalPer-emit cluster routing & delivery options. See /docs/kernel/cluster §4.

EventMetadata

Properties

PropertyTypeRequiredDescription
sourcestringEvent source (e.g., plugin name, system component)
timestampstringISO 8601 datetime when event was created
userIdstringoptionalUser who triggered the event
tenantIdstringoptionalTenant identifier for multi-tenant systems
correlationIdstringoptionalCorrelation ID for event tracing
causationIdstringoptionalID of the event that caused this event
priorityEnum<'critical' | 'high' | 'normal' | 'low' | 'background'>optional (default: "normal")Event priority
cluster{ scope: Enum<'local' | 'cluster' | 'tenant'>; deliverySemantics?: Enum<'best-effort' | 'at-least-once' | 'exactly-once'>; partitionKey?: string }optionalPer-emit cluster routing & delivery options. See /docs/kernel/cluster §4.

Nested Shape: EventMetadata.cluster

PropertyTypeRequiredDescription
scopeEnum<'local' | 'cluster' | 'tenant'>optional (default: "local")Delivery scope. Default local for backward compatibility.
deliverySemanticsEnum<'best-effort' | 'at-least-once' | 'exactly-once'>optionalDelivery guarantee. Default depends on scope.
partitionKeystringoptionalStable key that guarantees emit-order delivery for same-key events.

EventPriority

Allowed Values

  • critical
  • high
  • normal
  • low
  • background

EventTypeDefinition

Properties

PropertyTypeRequiredDescription
namestringEvent type name (dot notation by convention, e.g. order.created; the platform-checked event vocabulary is the closed DataEventType / BulkDataEventType enums)
versionstringoptional (default: "1.0.0")Event schema version
schemaanyoptionalJSON Schema for event payload validation
descriptionstringoptionalEvent type description
deprecatedbooleanoptional (default: false)Whether this event type is deprecated
tagsstring[]optionalEvent type tags

On this page