Skip to content

@statesync/core


@statesync/core / InvalidationEvent

Interface: InvalidationEvent

Defined in: types.ts:60

An event signaling that the authoritative state for a given topic has changed.

The engine uses this to decide whether a new snapshot should be fetched. Transport layers (WebSocket, SSE, polling, etc.) produce these events and deliver them via an InvalidationSubscriber.

Example

ts
const event: InvalidationEvent = {
  topic: 'user-profile',
  revision: '42' as Revision,
  sourceId: 'server-1',
  timestampMs: Date.now(),
};

Properties

revision

ts
revision: Revision;

Defined in: types.ts:64

The revision that the server has moved to. Must be a canonical decimal u64 string.


sourceId?

ts
optional sourceId: string;

Defined in: types.ts:69

Optional identifier of the source that produced this event. Useful for deduplication or debugging in multi-source setups.


timestampMs?

ts
optional timestampMs: number;

Defined in: types.ts:74

Optional timestamp (milliseconds since epoch) of when the event was produced. The engine does not use this for ordering; it is informational only.


topic

ts
topic: string;

Defined in: types.ts:62

The topic this invalidation belongs to.

Released under the MIT License.