@xnetjs/sqlite 0.1.1 → 0.2.0

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.
@@ -591,6 +591,9 @@ var ElectronSQLiteAdapter = class {
591
591
  for (const property of input.properties) {
592
592
  ops.push(
593
593
  () => this.getOrPrepare(
594
+ // Full LWW ordering triple (lamport → wallTime → author), matching
595
+ // `shouldReplace` in @xnetjs/data. A lamport-only guard let arrival
596
+ // order decide same-lamport conflicts, diverging replicas (0272).
594
597
  `INSERT INTO node_properties
595
598
  (node_id, property_key, value, lamport_time, updated_by, updated_at)
596
599
  VALUES (?, ?, ?, ?, ?, ?)
@@ -599,7 +602,11 @@ var ElectronSQLiteAdapter = class {
599
602
  lamport_time = excluded.lamport_time,
600
603
  updated_by = excluded.updated_by,
601
604
  updated_at = excluded.updated_at
602
- WHERE excluded.lamport_time > node_properties.lamport_time`
605
+ WHERE excluded.lamport_time > node_properties.lamport_time
606
+ OR (excluded.lamport_time = node_properties.lamport_time
607
+ AND (excluded.updated_at > node_properties.updated_at
608
+ OR (excluded.updated_at = node_properties.updated_at
609
+ AND excluded.updated_by > node_properties.updated_by)))`
603
610
  ).run(
604
611
  property.nodeId,
605
612
  property.propertyKey,
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  createWebSQLiteAdapter,
7
7
  resetWebSQLiteOpfsStorage
8
- } from "../chunk-BBZDKLA3.js";
8
+ } from "../chunk-4RB2QHGD.js";
9
9
  import "../chunk-SV475UL5.js";
10
10
  import {
11
11
  bootLogMessage
@@ -3,7 +3,7 @@ import {
3
3
  createWebSQLiteAdapter,
4
4
  resetWebSQLiteOpfsStorage,
5
5
  stepIncrementalVacuumToCompletion
6
- } from "../chunk-BBZDKLA3.js";
6
+ } from "../chunk-4RB2QHGD.js";
7
7
  import "../chunk-SV475UL5.js";
8
8
  import "../chunk-CBU263LI.js";
9
9
  import "../chunk-W3L4FXU5.js";
@@ -489,6 +489,9 @@ var WebSQLiteAdapter = class {
489
489
  }
490
490
  for (const property of input.properties) {
491
491
  await this.run(
492
+ // Full LWW ordering triple (lamport → wallTime → author), matching
493
+ // `shouldReplace` in @xnetjs/data. A lamport-only guard let arrival
494
+ // order decide same-lamport conflicts, diverging replicas (0272).
492
495
  `INSERT INTO node_properties
493
496
  (node_id, property_key, value, lamport_time, updated_by, updated_at)
494
497
  VALUES (?, ?, ?, ?, ?, ?)
@@ -497,7 +500,11 @@ var WebSQLiteAdapter = class {
497
500
  lamport_time = excluded.lamport_time,
498
501
  updated_by = excluded.updated_by,
499
502
  updated_at = excluded.updated_at
500
- WHERE excluded.lamport_time > node_properties.lamport_time`,
503
+ WHERE excluded.lamport_time > node_properties.lamport_time
504
+ OR (excluded.lamport_time = node_properties.lamport_time
505
+ AND (excluded.updated_at > node_properties.updated_at
506
+ OR (excluded.updated_at = node_properties.updated_at
507
+ AND excluded.updated_by > node_properties.updated_by)))`,
501
508
  [
502
509
  property.nodeId,
503
510
  property.propertyKey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xnetjs/sqlite",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Unified SQLite adapter for xNet across all platforms",
5
5
  "license": "MIT",
6
6
  "repository": {