Events Core schema — Kernel Protocol reference
Events Core schemas of the ObjectStack Kernel Protocol: Event, EventMetadata and 2 more — each property with its type, default and a TypeScript example.
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
| Property | Type | Required | Description |
|---|---|---|---|
| id | string | optional | Unique event identifier |
| name | string | ✅ | Event name (dot notation by convention, e.g. user.created, order.paid; the platform-checked event vocabulary is the closed DataEventType / BulkDataEventType enums) |
| payload | any | ✅ | Event payload schema |
| metadata | { source: string; timestamp: string; userId?: string; tenantId?: string; … } | ✅ | Event metadata |
Nested Shape: Event.metadata
| Property | Type | Required | Description |
|---|---|---|---|
| source | string | ✅ | Event source (e.g., plugin name, system component) |
| timestamp | string | ✅ | ISO 8601 datetime when event was created |
| userId | string | optional | User who triggered the event |
| tenantId | string | optional | Tenant identifier for multi-tenant systems |
| correlationId | string | optional | Correlation ID for event tracing |
| causationId | string | optional | ID of the event that caused this event |
| priority | Enum<'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 } | optional | Per-emit cluster routing & delivery options. See /docs/kernel/cluster §4. |
EventMetadata
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| source | string | ✅ | Event source (e.g., plugin name, system component) |
| timestamp | string | ✅ | ISO 8601 datetime when event was created |
| userId | string | optional | User who triggered the event |
| tenantId | string | optional | Tenant identifier for multi-tenant systems |
| correlationId | string | optional | Correlation ID for event tracing |
| causationId | string | optional | ID of the event that caused this event |
| priority | Enum<'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 } | optional | Per-emit cluster routing & delivery options. See /docs/kernel/cluster §4. |
Nested Shape: EventMetadata.cluster
| Property | Type | Required | Description |
|---|---|---|---|
| scope | Enum<'local' | 'cluster' | 'tenant'> | optional (default: "local") | Delivery scope. Default local for backward compatibility. |
| deliverySemantics | Enum<'best-effort' | 'at-least-once' | 'exactly-once'> | optional | Delivery guarantee. Default depends on scope. |
| partitionKey | string | optional | Stable key that guarantees emit-order delivery for same-key events. |
EventPriority
Allowed Values
criticalhighnormallowbackground
EventTypeDefinition
Properties
| Property | Type | Required | Description |
|---|---|---|---|
| name | string | ✅ | Event type name (dot notation by convention, e.g. order.created; the platform-checked event vocabulary is the closed DataEventType / BulkDataEventType enums) |
| version | string | optional (default: "1.0.0") | Event schema version |
| schema | any | optional | JSON Schema for event payload validation |
| description | string | optional | Event type description |
| deprecated | boolean | optional (default: false) | Whether this event type is deprecated |
| tags | string[] | optional | Event type tags |
Events Bus
Events Bus schemas of the ObjectStack Kernel Protocol: EventBusConfig — each property with its type, default and a TypeScript example.
Events Dlq
Events Dlq schemas of the ObjectStack Kernel Protocol: DeadLetterQueueEntry, EventLogEntry — each property with its type, default and a TypeScript example.