ahmed-rivet-convex 2.2.7 → 2.2.8
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.
|
@@ -4542,6 +4542,16 @@ var PersistBaseMovedError = class extends Error {
|
|
|
4542
4542
|
}
|
|
4543
4543
|
name = "PersistBaseMovedError";
|
|
4544
4544
|
};
|
|
4545
|
+
async function zeroDataOrBaseMoved(getZeroData, hash) {
|
|
4546
|
+
try {
|
|
4547
|
+
return await getZeroData(hash);
|
|
4548
|
+
} catch (e) {
|
|
4549
|
+
if (e instanceof ChunkNotFoundError) {
|
|
4550
|
+
throw new PersistBaseMovedError(hash, e.hash);
|
|
4551
|
+
}
|
|
4552
|
+
throw e;
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4545
4555
|
async function persistDD31(lc, clientID, memdag, perdag, mutators, closed, formatVersion, getZeroData, onGatherMemOnlyChunksForTest = () => Promise.resolve()) {
|
|
4546
4556
|
if (closed()) {
|
|
4547
4557
|
return;
|
|
@@ -4611,8 +4621,8 @@ async function persistDD31(lc, clientID, memdag, perdag, mutators, closed, forma
|
|
|
4611
4621
|
return;
|
|
4612
4622
|
}
|
|
4613
4623
|
let memdagBaseSnapshotPersisted = false;
|
|
4614
|
-
const zeroDataForMemdagBaseSnapshot = getZeroData && await getZeroData
|
|
4615
|
-
const zeroDataForPerdagHeadAtRead = getZeroData && await getZeroData
|
|
4624
|
+
const zeroDataForMemdagBaseSnapshot = getZeroData && await zeroDataOrBaseMoved(getZeroData, memdagBaseSnapshot.chunk.hash);
|
|
4625
|
+
const zeroDataForPerdagHeadAtRead = getZeroData && await zeroDataOrBaseMoved(getZeroData, perdagHeadHashAtRead);
|
|
4616
4626
|
if (closed()) {
|
|
4617
4627
|
return;
|
|
4618
4628
|
}
|
|
@@ -6393,6 +6403,11 @@ var ReplicacheImpl = class {
|
|
|
6393
6403
|
* `refresh()` behaves the same way. Callers that need to know the write did
|
|
6394
6404
|
* not land must use `onClientStateNotFound`.
|
|
6395
6405
|
*/
|
|
6406
|
+
/** Consecutive `PersistBaseMovedError` reschedules. A moved base resolves
|
|
6407
|
+
* on the next attempt; one that keeps "moving" is not a race any more —
|
|
6408
|
+
* past the cap the error is rethrown so the host's persist-failure
|
|
6409
|
+
* recovery sees it instead of a silent reschedule loop. */
|
|
6410
|
+
#persistBaseMovedStreak = 0;
|
|
6396
6411
|
persist() {
|
|
6397
6412
|
return this.#persistLock.withLock(async () => {
|
|
6398
6413
|
const { clientID } = this;
|
|
@@ -6411,13 +6426,14 @@ var ReplicacheImpl = class {
|
|
|
6411
6426
|
Latest,
|
|
6412
6427
|
this.#zero?.getTxData
|
|
6413
6428
|
);
|
|
6429
|
+
this.#persistBaseMovedStreak = 0;
|
|
6414
6430
|
} catch (e) {
|
|
6415
6431
|
if (e instanceof ClientStateNotFoundError) {
|
|
6416
6432
|
this.#clientStateNotFoundOnClient(clientID);
|
|
6417
6433
|
} else if (e instanceof IDBNotFoundError) {
|
|
6418
6434
|
this.#idbNotFound(e);
|
|
6419
6435
|
return;
|
|
6420
|
-
} else if (e instanceof PersistBaseMovedError) {
|
|
6436
|
+
} else if (e instanceof PersistBaseMovedError && ++this.#persistBaseMovedStreak <= 5) {
|
|
6421
6437
|
this.#lc.debug?.("Persist base moved; rescheduling", e.message);
|
|
6422
6438
|
void this.#schedulePersist();
|
|
6423
6439
|
} else if (this.#closed) {
|
|
@@ -15595,7 +15611,7 @@ function makeMessage(message, context, logLevel) {
|
|
|
15595
15611
|
}
|
|
15596
15612
|
|
|
15597
15613
|
// ../zero-client/src/client/version.ts
|
|
15598
|
-
var version2 = "2.2.
|
|
15614
|
+
var version2 = "2.2.8";
|
|
15599
15615
|
|
|
15600
15616
|
// ../zero-client/src/client/log-options.ts
|
|
15601
15617
|
var LevelFilterLogSink = class {
|
package/dist/react.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LogContext } from '@rocicorp/logger';
|
|
2
2
|
import type { Enum } from '../../../shared/src/enum.ts';
|
|
3
3
|
import type { LazyStore } from '../dag/lazy-store.ts';
|
|
4
|
-
import type
|
|
4
|
+
import { type Store } from '../dag/store.ts';
|
|
5
5
|
import * as FormatVersion from '../format-version-enum.ts';
|
|
6
6
|
import type { Hash } from '../hash.ts';
|
|
7
7
|
import type { ClientID } from '../sync/ids.ts';
|
|
@@ -269,16 +269,6 @@ export declare class ReplicacheImpl<MD extends MutatorDefs = {}> {
|
|
|
269
269
|
*/
|
|
270
270
|
poke(poke: PokeInternal): Promise<void>;
|
|
271
271
|
beginPull(): Promise<BeginPullResult>;
|
|
272
|
-
/**
|
|
273
|
-
* Writes the in-memory state to IndexedDB.
|
|
274
|
-
*
|
|
275
|
-
* Behaviour change: if this instance's IndexedDB database was deleted under
|
|
276
|
-
* it (another tab's collector, or cleared site data), this no longer rejects
|
|
277
|
-
* with `IDBNotFoundError`. It reports the loss once through
|
|
278
|
-
* `onClientStateNotFound('idb-deleted')` and resolves; nothing was persisted.
|
|
279
|
-
* `refresh()` behaves the same way. Callers that need to know the write did
|
|
280
|
-
* not land must use `onClientStateNotFound`.
|
|
281
|
-
*/
|
|
282
272
|
persist(): Promise<void>;
|
|
283
273
|
/**
|
|
284
274
|
* Pulls the latest persisted state from IndexedDB. Like `persist()`, a
|
package/dist/zero.js
CHANGED
package/package.json
CHANGED