import { Domain } from '@things-factory/shell'; export declare class TwinEvent { readonly id: string; domain?: Domain; domainId?: string; instanceId: string; eventType: string; revision?: number; /** * 이 사실이 **어느 공장에서** 일어났나 — `TwinStructure.rev`. * * 이것이 없던 시절에는 구조가 바뀌면 저널을 통째로 지우는 것이 유일한 길이었다(안 지우면 옛 * 이벤트를 새 공장에 대고 계산해 이력이 거짓말을 한다). 이 한 칸이 셋째 길을 연다 — 재생이 * 구조가 바뀌는 지점에서 전환한 뒤 이어서 계산한다. * * **비어 있을 수 있다**: 컬럼이 생기기 전에 쓰인 행이다. 그 행들은 **가장 오래된 리비전**에 * 속한다(0 을 채워 넣지 않는다 — 0 은 "모름" 이 아니라 유효한 번호처럼 보인다). */ structureRev?: number; eventTime?: Date; /** * 이 사실을 일으킨 **지시** — 커널이 커맨드에서 이어 준 상관값(기본은 commandId). * * 이것이 감사 기록(TwinAuditEvent.commandId)과 저널을 잇는 유일한 다리다. 없으면 승인 기록은 * "사람이 허락했다" 까지이고, 그 뒤 공장이 실제로 어떻게 움직였는지와 이어지지 않는다. * * **대부분의 행은 비어 있다** — 커맨드가 아니라 시뮬 시간이 낳은 사실이기 때문이다. 그것이 정상이고, * 비어 있다고 "덜 채워진 옛 행" 으로 보면 안 된다(같은 오해를 bizStep 에서 이미 한 번 했다). */ correlationId?: string; action?: string; bizStep?: string; epc?: string; orderId?: string; bizTransaction?: string; locationId?: string; moverId?: string; /** * **Whether the sender declared this fact as having actually happened** — the envelope's * `provenance`, promoted here. * * ── Why a column (measured 2026-09-09) ────────────────────────────────── * This table held 1,134 rows, all of them generator output, and **there was nowhere to ask * about it**: * * ``` * select count(*) from twin_events 1134 * select count(*) where payload like '%SIM-%' 1134 * select count(*) where order_id like 'WO-SIM-%' 558 <- half of them * ``` * * The only signal was the sender's naming convention (`SIM-`), and the column that convention * reaches was empty on half the rows. While it sits inside `payload`, none of the five drivers * can answer "count these without the invented ones" — the same reason `action` was promoted. * * ── Three states, kept apart ──────────────────────────────────────────── * ``` * 'simulated' the sender said it was invented * 'actual' the sender said it happened * null **not declared** — which is not `actual` * ``` * * Folding the last two together means a generator that omits the declaration has its output * counted as production, and nothing says so. Hence no default: an absent declaration is not * disguised as a valid-looking value (the discipline of `structureRev` and `lastWarningCount`). * * ── No index ──────────────────────────────────────────────────────────── * Three possible values is low cardinality within one twin — the judgement already made for * `bizStep` and `locationId`. Performance folds arrive already narrowed by domain, instance and * time, so filtering after that is cheap. */ provenance?: string; payload?: any; createdAt?: Date; }