API View source
Types
The main public types exported by causal-order.
Core event types
-
NodeId- Branded node identifier used to separate same-node and cross-node reasoning. -
EventId- Branded event identifier used for duplicate and reference checks. -
HlcTimestamp- Serialized hybrid logical clock string. -
ValidatedHlcTimestamp- Branded HLC timestamp that has passed validation. -
EventEnvelope<T = unknown>- Public shape for an input event and its ordering metadata. -
ValidatedEventEnvelope<T = unknown>- Validated event envelope safe for downstream ordering logic. -
CausalOrdering- Pairwise ordering result such as before, after, equal, or unknown. -
CausalEvidence- Machine-readable evidence explaining why one event was ordered relative to another.
Translation types
-
TranslatedEventEnvelope<T = unknown>- Readonly translated event-envelope shape returned by the raw-record ingress layer. -
TranslateMapper<TInput, TValue>- Synchronous mapper shape used by translateBatch() field extractors. -
TranslateTimestampInput- Accepted raw timestamp input for translation: bigint, safe integer number, canonical integer string, or Date for explicit rejection handling. -
TranslateBatchConfig<TInput, TPayload = TInput>- Mapper configuration for translating raw records into event envelopes. -
TranslateBatchPolicy- Policy configuration controlling how translation failures are surfaced or failed. -
TranslationAnomalyCode- Stable code describing a translation-time mapping or coercion failure. -
TranslationAnomalyDomain- Stable top-level domain for translation anomaly classification. -
TranslationAnomalyFamily- Stable family split between mapping and structural translation failures. -
TranslationAnomalyCategory- Stable category used for machine-readable translation anomaly handling. -
TranslationRecordFailureAction- Fail-fast or warning action for record-level translation failures. -
TranslationOptionalFieldAction- Handling action for optional-field translation failures, including continue behavior where omission is honest. -
TranslationPolicyKey- Stable policy selector describing the translation failure class being handled. -
TranslationPolicyDecision- Resolved policy decision attached to structured translation anomalies. -
TranslationField- Stable field label used in structured translation anomalies. -
TranslationMapperName- Stable mapper-function label used in structured translation anomalies. -
TranslationAnomalyStage- Translation pipeline stage where a structured anomaly was raised. -
TranslationActualValueType- Normalized runtime value classification attached to translation anomalies. -
TranslationDiagnosticSource- Stable source split between mapping and structural translation failures. -
TranslationDiagnosticRecord<TInput = unknown>- Record-local translation diagnostic context including index and original input. -
TranslationDiagnosticOrdering- Deterministic ordering metadata attached to emitted translation anomalies. -
TranslationFieldReferenceKind- Stable field-reference kind used by translation diagnostics. -
TranslationFieldReference- Machine-readable field reference attached to translation diagnostics. -
TranslationAnomalyClassification- Stable machine-readable classification attached to translation anomalies. -
TranslationDiagnosticLocation- Structured field and mapper location metadata for translation diagnostics. -
TranslationDiagnosticContract- Contract-facing detail attached to translation diagnostics. -
TranslationDiagnostic<TInput = unknown>- Nested machine-readable diagnostic object attached to translation anomalies. -
TranslationAnomaly<TInput = unknown>- Structured translation failure record carrying mapper, field, stage, and actual-value metadata. -
TranslateBatchResult<TPayload = unknown, TInput = unknown>- Top-level translation result containing accepted envelopes and structured anomalies.
Validation and anomaly types
-
ValidationErrorCode- Stable code describing a validation failure category. -
ValidationWarningCode- Stable code describing a non-fatal validation warning. -
ValidationError- Structured validation failure entry. -
ValidationWarning- Structured non-fatal validation warning entry. -
ValidationSuccess<TValue>- Successful validation wrapper carrying the validated value. -
ValidationFailure- Failed validation wrapper carrying errors and warnings. -
ValidationResult<TValue = never>- Discriminated union returned by validation helpers. -
AnomalyType- Stable anomaly category emitted by ordering and analysis helpers. -
EventAnomaly<T = unknown>- Structured anomaly record tied to one or more events.
Ordering result types
-
OrderedEvent<T = unknown>- Ordered event entry with confidence, basis, and optional causal evidence. -
OrderStats- Summary counts describing the outcome of a bounded ordering run. -
OrderResult<T = unknown>- Top-level bounded ordering result containing ordered events, anomalies, and stats. -
TieBreaker<T>- Deterministic comparison function used when stronger ordering is absent. -
OrderOptions<T>- Options controlling bounded ordering behavior and anomaly handling.
Inspection types
-
OrderedEventExplanation<T = unknown>- Compact explanation payload describing why an ordered event landed where it did. -
OrderedEventInspection<T = unknown>- Compact event-level inspection snapshot derived from an ordered result entry. -
InspectedEventAnomaly<T = unknown>- Compact anomaly view used by inspection helpers for operator-facing output. -
OrderedEventCounts<T = unknown>- Grouped inspection counts by order basis and confidence level. -
OrderResultInspection<T = unknown>- Payload-agnostic inspection snapshot returned by inspectOrderResult(). -
OrderBatchInspection<T = unknown>- Payload-agnostic inspection snapshot returned by inspectOrderBatch(). -
EventAnomalySummary- Grouped event-anomaly totals by type and severity. -
TranslationAnomalySummary- Grouped translation-anomaly totals by code, field, mapper, stage, and policy action.
Extension-policy boundary types
-
PolicyVisibilityKind- Audit-output category used at the core-to-policy boundary for higher-layer decisions. -
PolicyVisibilityRecord- Operator-visible audit record describing what a higher-layer policy did without mutating payloads silently. -
ExtensionPolicyAction- Payload-agnostic contradiction-policy action shared across boundary-level policy hooks. -
CausalContradictionCandidate<T = unknown>- Payload-agnostic contradiction candidate surfaced at the core-to-policy boundary. -
CausalContradictionPolicyResult- Result shape for contradiction-policy evaluation with explicit operator visibility. -
CausalContradictionPolicy<T = unknown, TContext = unknown>- Policy interface for contradiction handling outside the core payload contract. -
EntityForkCandidate<T = unknown, TIdentity = unknown>- Payload-agnostic entity-fork candidate supplied by higher-layer identity logic. -
ForkResolutionAction- Fork-policy action set that avoids implicit payload merging inside the core. -
ForkResolutionPolicyResult- Result shape for fork-resolution decisions with explicit visibility output. -
ForkResolutionPolicy<T = unknown, TIdentity = unknown, TContext = unknown>- Policy interface for entity-fork handling outside the core payload contract. -
SemanticDedupeCandidate<T = unknown>- Payload-agnostic semantic-dedupe candidate surfaced at the core-to-policy boundary across different identifiers. -
SemanticDedupeAction- Dedupe-policy action set that preserves explicit operator-facing visibility. -
SemanticDedupePolicyResult- Result shape for semantic-dedupe decisions including retained and suppressed IDs. -
SemanticDedupePolicy<T = unknown, TContext = unknown>- Policy interface for semantic dedupe without forcing payload-aware merge logic into the core.
Streaming types
-
CorrectionScope- Indicates whether a stream correction is local to a batch or broader in scope. -
CorrectionNotice- Structured notice attached to correction-capable stream batches. -
StreamAnomalyHorizon- Anomaly carry model for stream windows and emitted history. -
LateArrivalPolicy- Policy controlling how late stream events are surfaced or rejected. -
WatermarkSignal- Structured watermark progress signal returned by watermark helpers. -
WatermarkFunction<T>- Function shape used to derive stream watermark progress. -
StreamOrderOptions<T>- Options controlling streaming ordering, watermarking, and correction behavior. -
StreamOrderBatch<T = unknown>- Structured batch emitted by streaming ordering.
The confidence model used in ordered output is currently: proven, derived, fallback, unknown.