@syncular/server 0.56.1 → 0.58.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.
@@ -51,6 +51,12 @@ export type CommandMutation = {
51
51
  readonly table: string;
52
52
  readonly op: 'upsert';
53
53
  readonly values: Readonly<Record<string, RowValue>>;
54
+ /**
55
+ * Explicit insert (§6.2 `baseVersion = 0`): recreates a row deleted
56
+ * inside the tombstone horizon; an existing row answers
57
+ * `sync.version_conflict`. Absent: an unversioned upsert.
58
+ */
59
+ readonly insert?: true;
54
60
  } | {
55
61
  readonly table: string;
56
62
  readonly op: 'rescope';
@@ -274,6 +274,9 @@ function commandOperations(mutations, schema) {
274
274
  table: table.name,
275
275
  rowId,
276
276
  op: mutation.op,
277
+ ...(mutation.op === 'upsert' && mutation.insert === true
278
+ ? { baseVersion: 0 }
279
+ : {}),
277
280
  payload: encodeSparseRow(table.columns, table.primaryKeyIndex, values),
278
281
  };
279
282
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syncular/server",
3
- "version": "0.56.1",
3
+ "version": "0.58.0",
4
4
  "description": "Syncular server: handleSyncRequest + storage/auth interfaces for the sync protocol",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Benjamin Kniffler",
@@ -68,7 +68,7 @@
68
68
  "verify:node": "cd ../.. && bun build ./packages/server/test/sqlite-runtime/verify-node.mjs --target=node --conditions=bun --outfile=./packages/server/.verify-node.built.mjs && node ./packages/server/.verify-node.built.mjs"
69
69
  },
70
70
  "dependencies": {
71
- "@syncular/core": "0.56.1"
71
+ "@syncular/core": "0.58.0"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@electric-sql/pglite": "^0.5.4"
package/src/operations.ts CHANGED
@@ -108,6 +108,12 @@ export type CommandMutation =
108
108
  readonly table: string;
109
109
  readonly op: 'upsert';
110
110
  readonly values: Readonly<Record<string, RowValue>>;
111
+ /**
112
+ * Explicit insert (§6.2 `baseVersion = 0`): recreates a row deleted
113
+ * inside the tombstone horizon; an existing row answers
114
+ * `sync.version_conflict`. Absent: an unversioned upsert.
115
+ */
116
+ readonly insert?: true;
111
117
  }
112
118
  | {
113
119
  readonly table: string;
@@ -581,6 +587,9 @@ function commandOperations(
581
587
  table: table.name,
582
588
  rowId,
583
589
  op: mutation.op,
590
+ ...(mutation.op === 'upsert' && mutation.insert === true
591
+ ? { baseVersion: 0 }
592
+ : {}),
584
593
  payload: encodeSparseRow(table.columns, table.primaryKeyIndex, values),
585
594
  };
586
595
  });