ahmed-rivet-convex 2.2.0 → 2.2.1

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.
@@ -4366,7 +4366,10 @@ async function persistDD31(lc, clientID, memdag, perdag, mutators, closed, forma
4366
4366
  if (compareCookiesForSnapshots(
4367
4367
  memdagBaseSnapshot,
4368
4368
  latestPerdagBaseSnapshot
4369
- ) > 0) {
4369
+ ) > 0 && mutationIDsAreAtLeast(
4370
+ memdagBaseSnapshot.meta.lastMutationIDs,
4371
+ latestPerdagBaseSnapshot.meta.lastMutationIDs
4372
+ )) {
4370
4373
  memdagBaseSnapshotPersisted = true;
4371
4374
  await Promise.all(
4372
4375
  Array.from(gatheredChunks.values(), (c) => perdagWrite.putChunk(c))
@@ -4429,6 +4432,14 @@ async function persistDD31(lc, clientID, memdag, perdag, mutators, closed, forma
4429
4432
  );
4430
4433
  }
4431
4434
  }
4435
+ function mutationIDsAreAtLeast(candidate, durable) {
4436
+ for (const [clientID, durableMutationID] of Object.entries(durable)) {
4437
+ if ((candidate[clientID] ?? 0) < durableMutationID) {
4438
+ return false;
4439
+ }
4440
+ }
4441
+ return true;
4442
+ }
4432
4443
  async function getClientGroupInfo(perdagRead, clientGroupID) {
4433
4444
  const clientGroup = await getClientGroup(clientGroupID, perdagRead);
4434
4445
  assert(clientGroup, `No client group for clientGroupID: ${clientGroupID}`);
@@ -6919,7 +6930,7 @@ var downstreamSchema = valita_exports.union(
6919
6930
  transformErrorMessageSchema
6920
6931
  );
6921
6932
 
6922
- // ../../node_modules/@msgpack/msgpack/dist.esm/utils/utf8.mjs
6933
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/utils/utf8.mjs
6923
6934
  function utf8Count(str) {
6924
6935
  const strLength = str.length;
6925
6936
  let byteLength = 0;
@@ -7050,7 +7061,7 @@ function utf8Decode(bytes, inputOffset, byteLength) {
7050
7061
  }
7051
7062
  }
7052
7063
 
7053
- // ../../node_modules/@msgpack/msgpack/dist.esm/ExtData.mjs
7064
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/ExtData.mjs
7054
7065
  var ExtData = class {
7055
7066
  type;
7056
7067
  data;
@@ -7060,7 +7071,7 @@ var ExtData = class {
7060
7071
  }
7061
7072
  };
7062
7073
 
7063
- // ../../node_modules/@msgpack/msgpack/dist.esm/DecodeError.mjs
7074
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/DecodeError.mjs
7064
7075
  var DecodeError = class _DecodeError extends Error {
7065
7076
  constructor(message) {
7066
7077
  super(message);
@@ -7074,7 +7085,7 @@ var DecodeError = class _DecodeError extends Error {
7074
7085
  }
7075
7086
  };
7076
7087
 
7077
- // ../../node_modules/@msgpack/msgpack/dist.esm/utils/int.mjs
7088
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/utils/int.mjs
7078
7089
  var UINT32_MAX = 4294967295;
7079
7090
  function setUint64(view, offset, value) {
7080
7091
  const high = value / 4294967296;
@@ -7099,7 +7110,7 @@ function getUint64(view, offset) {
7099
7110
  return high * 4294967296 + low;
7100
7111
  }
7101
7112
 
7102
- // ../../node_modules/@msgpack/msgpack/dist.esm/timestamp.mjs
7113
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/timestamp.mjs
7103
7114
  var EXT_TIMESTAMP = -1;
7104
7115
  var TIMESTAMP32_MAX_SEC = 4294967296 - 1;
7105
7116
  var TIMESTAMP64_MAX_SEC = 17179869184 - 1;
@@ -7179,7 +7190,7 @@ var timestampExtension = {
7179
7190
  decode: decodeTimestampExtension
7180
7191
  };
7181
7192
 
7182
- // ../../node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.mjs
7193
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/ExtensionCodec.mjs
7183
7194
  var ExtensionCodec = class _ExtensionCodec {
7184
7195
  static defaultCodec = new _ExtensionCodec();
7185
7196
  // ensures ExtensionCodecType<X> matches ExtensionCodec<X>
@@ -7241,7 +7252,7 @@ var ExtensionCodec = class _ExtensionCodec {
7241
7252
  }
7242
7253
  };
7243
7254
 
7244
- // ../../node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.mjs
7255
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/utils/typedArrays.mjs
7245
7256
  function isArrayBufferLike(buffer) {
7246
7257
  return buffer instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && buffer instanceof SharedArrayBuffer;
7247
7258
  }
@@ -7257,7 +7268,7 @@ function ensureUint8Array(buffer) {
7257
7268
  }
7258
7269
  }
7259
7270
 
7260
- // ../../node_modules/@msgpack/msgpack/dist.esm/Encoder.mjs
7271
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/Encoder.mjs
7261
7272
  var DEFAULT_MAX_DEPTH = 100;
7262
7273
  var DEFAULT_INITIAL_BUFFER_SIZE = 2048;
7263
7274
  var Encoder = class _Encoder {
@@ -7660,18 +7671,18 @@ var Encoder = class _Encoder {
7660
7671
  }
7661
7672
  };
7662
7673
 
7663
- // ../../node_modules/@msgpack/msgpack/dist.esm/encode.mjs
7674
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/encode.mjs
7664
7675
  function encode(value, options) {
7665
7676
  const encoder = new Encoder(options);
7666
7677
  return encoder.encodeSharedRef(value);
7667
7678
  }
7668
7679
 
7669
- // ../../node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.mjs
7680
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/utils/prettyByte.mjs
7670
7681
  function prettyByte(byte) {
7671
7682
  return `${byte < 0 ? "-" : ""}0x${Math.abs(byte).toString(16).padStart(2, "0")}`;
7672
7683
  }
7673
7684
 
7674
- // ../../node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.mjs
7685
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/CachedKeyDecoder.mjs
7675
7686
  var DEFAULT_MAX_KEY_LENGTH = 16;
7676
7687
  var DEFAULT_MAX_LENGTH_PER_KEY = 16;
7677
7688
  var CachedKeyDecoder = class {
@@ -7727,7 +7738,7 @@ var CachedKeyDecoder = class {
7727
7738
  }
7728
7739
  };
7729
7740
 
7730
- // ../../node_modules/@msgpack/msgpack/dist.esm/Decoder.mjs
7741
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/Decoder.mjs
7731
7742
  var STATE_ARRAY = "array";
7732
7743
  var STATE_MAP_KEY = "map_key";
7733
7744
  var STATE_MAP_VALUE = "map_value";
@@ -8355,13 +8366,13 @@ var Decoder = class _Decoder {
8355
8366
  }
8356
8367
  };
8357
8368
 
8358
- // ../../node_modules/@msgpack/msgpack/dist.esm/decode.mjs
8369
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/@msgpack/msgpack/dist.esm/decode.mjs
8359
8370
  function decode(buffer, options) {
8360
8371
  const decoder = new Decoder(options);
8361
8372
  return decoder.decode(buffer);
8362
8373
  }
8363
8374
 
8364
- // ../../node_modules/pako/dist/pako.esm.mjs
8375
+ // ../../../../../Users/ahmedbanihani/Documents/zero-sync-engine-convex-code/node_modules/pako/dist/pako.esm.mjs
8365
8376
  var Z_FIXED$1 = 4;
8366
8377
  var Z_BINARY = 0;
8367
8378
  var Z_TEXT = 1;
@@ -14995,7 +15006,7 @@ function makeMessage(message, context, logLevel) {
14995
15006
  }
14996
15007
 
14997
15008
  // ../zero-client/src/client/version.ts
14998
- var version2 = "2.2.0";
15009
+ var version2 = "2.2.1";
14999
15010
 
15000
15011
  // ../zero-client/src/client/log-options.ts
15001
15012
  var LevelFilterLogSink = class {
@@ -16763,6 +16774,9 @@ var Zero = class _Zero {
16763
16774
  minDelayMs: 0
16764
16775
  },
16765
16776
  licenseKey: "zero-client-static-key",
16777
+ // Let the app bound snapshot retention. Undefined keeps Replicache's
16778
+ // 24h default; ReplicacheImpl validates the floor and throws below it.
16779
+ clientMaxAgeMs: options.clientMaxAgeMs,
16766
16780
  kvStore
16767
16781
  };
16768
16782
  this.#zeroContext = new ZeroContext(
@@ -18073,4 +18087,4 @@ export {
18073
18087
  pako/dist/pako.esm.mjs:
18074
18088
  (*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) *)
18075
18089
  */
18076
- //# sourceMappingURL=chunk-RIN53NKR.js.map
18090
+ //# sourceMappingURL=chunk-AFP2JY7C.js.map