@spooky-sync/core 0.0.1-canary.24 → 0.0.1-canary.25

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.js CHANGED
@@ -1544,14 +1544,12 @@ function diffRecordVersionArray(local, remote) {
1544
1544
  };
1545
1545
  }
1546
1546
  function createDiffFromDbOp(op, recordId, version, versions) {
1547
- if (op !== "DELETE") {
1548
- const old = versions?.find((record) => record[0] === encodeRecordId(recordId));
1549
- if (old && old[1] >= version) return {
1550
- added: [],
1551
- updated: [],
1552
- removed: []
1553
- };
1554
- }
1547
+ const old = versions?.find((record) => record[0] === encodeRecordId(recordId));
1548
+ if (old && old[1] >= version) return {
1549
+ added: [],
1550
+ updated: [],
1551
+ removed: []
1552
+ };
1555
1553
  if (op === "CREATE") return {
1556
1554
  added: [{
1557
1555
  id: recordId,
@@ -1821,6 +1819,14 @@ var SpookySync = class {
1821
1819
  });
1822
1820
  }
1823
1821
  async handleRemoteListRefChange(action, queryId, recordId, version) {
1822
+ if (action === "DELETE") {
1823
+ this.logger.debug({
1824
+ queryId: queryId.toString(),
1825
+ recordId: recordId.toString(),
1826
+ Category: "spooky-client::SpookySync::handleRemoteListRefChange"
1827
+ }, "Ignoring DELETE on list_ref — should not happen");
1828
+ return;
1829
+ }
1824
1830
  const existing = this.dataModule.getQueryById(queryId);
1825
1831
  if (!existing) {
1826
1832
  this.logger.warn({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spooky-sync/core",
3
- "version": "0.0.1-canary.24",
3
+ "version": "0.0.1-canary.25",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -126,6 +126,18 @@ export class SpookySync<S extends SchemaStructure> {
126
126
  recordId: RecordId,
127
127
  version: number
128
128
  ) {
129
+ if (action === 'DELETE') {
130
+ this.logger.debug(
131
+ {
132
+ queryId: queryId.toString(),
133
+ recordId: recordId.toString(),
134
+ Category: 'spooky-client::SpookySync::handleRemoteListRefChange',
135
+ },
136
+ 'Ignoring DELETE on list_ref — should not happen'
137
+ );
138
+ return;
139
+ }
140
+
129
141
  const existing = this.dataModule.getQueryById(queryId);
130
142
 
131
143
  if (!existing) {
@@ -135,17 +135,14 @@ export function createDiffFromDbOp(
135
135
  version: number,
136
136
  versions?: RecordVersionArray
137
137
  ): RecordVersionDiff {
138
- // Version guard: skip stale CREATE/UPDATE, but always process DELETE
139
- if (op !== 'DELETE') {
140
- const old = versions?.find((record) => record[0] === encodeRecordId(recordId));
141
-
142
- if (old && old[1] >= version) {
143
- return {
144
- added: [],
145
- updated: [],
146
- removed: [],
147
- };
148
- }
138
+ const old = versions?.find((record) => record[0] === encodeRecordId(recordId));
139
+
140
+ if (old && old[1] >= version) {
141
+ return {
142
+ added: [],
143
+ updated: [],
144
+ removed: [],
145
+ };
149
146
  }
150
147
 
151
148
  if (op === 'CREATE') {