@spooky-sync/core 0.0.1-canary.269 → 0.0.1-canary.270

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
@@ -1076,8 +1076,8 @@ function selfAllowlistedVariant(flag, userId) {
1076
1076
 
1077
1077
  //#endregion
1078
1078
  //#region src/modules/devtools/index.ts
1079
- const CORE_VERSION = "0.0.1-canary.269";
1080
- const WASM_VERSION = "0.0.1-canary.269";
1079
+ const CORE_VERSION = "0.0.1-canary.270";
1080
+ const WASM_VERSION = "0.0.1-canary.270";
1081
1081
  const SURREAL_VERSION = "3.0.3";
1082
1082
  var DevToolsService = class DevToolsService {
1083
1083
  eventsHistory = [];
@@ -3163,7 +3163,7 @@ function* readMembership(env, hashes, opts = {}) {
3163
3163
  }
3164
3164
  const batch = snapshotsFromBatch(edges, counts, hashById);
3165
3165
  const held = new Map(chunk.map((h) => [h, byHash.get(h).remoteArray.length]));
3166
- const suspect = new Set(suspectHashes(batch, held, Array.isArray(edges) ? edges.length : 0));
3166
+ const suspect = new Set(suspectHashes(batch, held, edges.length));
3167
3167
  for (const [h, snap] of batch) if (suspect.has(h)) rereads.push(byHash.get(h));
3168
3168
  else snapshots.set(h, snap);
3169
3169
  });
@@ -13025,7 +13025,7 @@ function createTabsCoordinator(config, s, host) {
13025
13025
  return new TabsCoordinator({
13026
13026
  tabId: s.tabId,
13027
13027
  fingerprint: computeTabsFingerprint({
13028
- coreVersion: "0.0.1-canary.269",
13028
+ coreVersion: "0.0.1-canary.270",
13029
13029
  schemaHash: hash53(config.schemaSurql),
13030
13030
  endpoint: config.database.endpoint ?? "",
13031
13031
  namespace: config.database.namespace,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spooky-sync/core",
3
- "version": "0.0.1-canary.269",
3
+ "version": "0.0.1-canary.270",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -63,8 +63,8 @@
63
63
  }
64
64
  },
65
65
  "dependencies": {
66
- "@spooky-sync/query-builder": "0.0.1-canary.269",
67
- "@spooky-sync/ssp-wasm": "0.0.1-canary.269",
66
+ "@spooky-sync/query-builder": "0.0.1-canary.270",
67
+ "@spooky-sync/ssp-wasm": "0.0.1-canary.270",
68
68
  "@sqlite.org/sqlite-wasm": "3.53.0-build1",
69
69
  "@surrealdb/wasm": "^3.0.3",
70
70
  "blurhash": "^2.0.5",
@@ -233,6 +233,11 @@ describe('readMembership', () => {
233
233
  });
234
234
  expect(rereadFail.result.failed).toBe(true);
235
235
  expect(n).toBe(3);
236
+ const rereadUnusable = await runPure(readMembership(env, ['a', 'b']), {
237
+ state: s,
238
+ handlers: { 'remote.query': (e: any) => (e.sql.includes('IN $ins') ? [ok([]), ok([])] : [ok('x'), ok(null), ok(null)]) },
239
+ });
240
+ expect(rereadUnusable.result).toEqual({ changed: false, failed: true });
236
241
  const single = buildState([buildEntry({ def: { hash: 'a', id: qid('a') }, lifecycle: { phase: 'live' }, remoteArray: [['thing:1', 1]] })]);
237
242
  const notArray = await runPure(readMembership(env, ['a']), { state: single, handlers: { 'remote.query': () => [ok('x'), ok(null), ok(null)] } });
238
243
  expect(notArray.result).toEqual({ changed: false, failed: true });
@@ -182,7 +182,7 @@ export function* readMembership(
182
182
  }
183
183
  const batch = snapshotsFromBatch(edges, counts as never, hashById);
184
184
  const held = new Map(chunk.map((h) => [h, byHash.get(h)!.remoteArray.length]));
185
- const suspect = new Set(suspectHashes(batch, held, Array.isArray(edges) ? edges.length : 0));
185
+ const suspect = new Set(suspectHashes(batch, held, edges.length));
186
186
  for (const [h, snap] of batch) {
187
187
  if (suspect.has(h)) rereads.push(byHash.get(h)!);
188
188
  else snapshots.set(h, snap);
@@ -111,6 +111,9 @@ describe('query reducers', () => {
111
111
  const reset = R.resetRegisterAttempts('a')(s);
112
112
  expect(reset.queries.get('a')!.registerAttempts).toBe(0);
113
113
  expect(R.resetRegisterAttempts('a')(reset)).toBe(reset);
114
+ const lost = R.setViewLost('a', 2, 900)(reset);
115
+ expect(lost.queries.get('a')).toMatchObject({ viewLostCount: 2, viewLostRetryAt: 900 });
116
+ expect(R.setViewLost('a', 2, 900)(lost)).toBe(lost);
114
117
  });
115
118
 
116
119
  it('subscribe / unsubscribe track the eviction clock', () => {