@rljson/rljson 0.0.76 → 0.0.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -18,6 +18,7 @@ export * from './rljson.ts';
18
18
  export * from './route/route.ts';
19
19
  export * from './sync/ack-payload.ts';
20
20
  export * from './sync/client-id.ts';
21
+ export * from './sync/conflict.ts';
21
22
  export * from './sync/connector-payload.ts';
22
23
  export * from './sync/gap-fill.ts';
23
24
  export * from './sync/sync-config.ts';
@@ -0,0 +1,39 @@
1
+ import { InsertHistoryTimeId } from '../insertHistory/insertHistory.ts';
2
+ /**
3
+ * The type of conflict detected in the InsertHistory DAG.
4
+ *
5
+ * - `'dagBranch'` — Two or more InsertHistory rows share the same
6
+ * predecessor, creating divergent branches. This indicates concurrent
7
+ * writes from different clients that have not yet been merged.
8
+ */
9
+ export type ConflictType = 'dagBranch';
10
+ /**
11
+ * Represents a detected conflict in the InsertHistory DAG.
12
+ *
13
+ * A `Conflict` is emitted when the system detects that the InsertHistory
14
+ * for a table has diverged into multiple branches (multiple "tips" that
15
+ * are not ancestors of each other).
16
+ * Detection only — no resolution: this type signals that a conflict
17
+ * exists. Resolution logic is left to upper layers (application code).
18
+ */
19
+ export interface Conflict {
20
+ /** The table where the conflict was detected (without InsertHistory suffix). */
21
+ table: string;
22
+ /** The type of conflict. */
23
+ type: ConflictType;
24
+ /** Timestamp (ms since epoch) when the conflict was detected. */
25
+ detectedAt: number;
26
+ /**
27
+ * The InsertHistory tip timeIds that form the branches.
28
+ *
29
+ * A "tip" is a timeId that is not referenced as `previous` by any other
30
+ * InsertHistory row. Multiple tips indicate a DAG fork.
31
+ *
32
+ * Always contains at least two entries when `type === 'dagBranch'`.
33
+ */
34
+ branches: InsertHistoryTimeId[];
35
+ }
36
+ /**
37
+ * Callback invoked when a conflict is detected.
38
+ */
39
+ export type ConflictCallback = (conflict: Conflict) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rljson/rljson",
3
- "version": "0.0.76",
3
+ "version": "0.0.77",
4
4
  "description": "The RLJSON data format specification",
5
5
  "homepage": "https://github.com/rljson/rljson",
6
6
  "bugs": "https://github.com/rljson/rljson/issues",