@rocicorp/zero 0.20.2025052000 → 0.20.2025052100

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.
@@ -7275,14 +7275,14 @@ var MemorySource = class _MemorySource {
7275
7275
  conn.filters?.condition,
7276
7276
  this.#primaryKey
7277
7277
  );
7278
- const constraint = pkConstraint ?? req.constraint;
7278
+ const fetchOrPkConstraint = pkConstraint ?? req.constraint;
7279
7279
  const indexSort = [];
7280
- if (constraint) {
7281
- for (const key of Object.keys(constraint)) {
7280
+ if (fetchOrPkConstraint) {
7281
+ for (const key of Object.keys(fetchOrPkConstraint)) {
7282
7282
  indexSort.push([key, "asc"]);
7283
7283
  }
7284
7284
  }
7285
- if (this.#primaryKey.length > 1 || !constraint || !constraintMatchesPrimaryKey(constraint, this.#primaryKey)) {
7285
+ if (this.#primaryKey.length > 1 || !fetchOrPkConstraint || !constraintMatchesPrimaryKey(fetchOrPkConstraint, this.#primaryKey)) {
7286
7286
  indexSort.push(...requestedSort);
7287
7287
  }
7288
7288
  const index = this.#getOrCreateIndex(indexSort, from);
@@ -7290,11 +7290,11 @@ var MemorySource = class _MemorySource {
7290
7290
  const comparator2 = (r1, r2) => compare(r1, r2) * (req.reverse ? -1 : 1);
7291
7291
  const startAt = req.start?.row;
7292
7292
  let scanStart;
7293
- if (constraint) {
7293
+ if (fetchOrPkConstraint) {
7294
7294
  scanStart = {};
7295
7295
  for (const [key, dir] of indexSort) {
7296
- if (hasOwn(constraint, key)) {
7297
- scanStart[key] = constraint[key];
7296
+ if (hasOwn(fetchOrPkConstraint, key)) {
7297
+ scanStart[key] = fetchOrPkConstraint[key];
7298
7298
  } else {
7299
7299
  if (req.reverse) {
7300
7300
  scanStart[key] = dir === "asc" ? maxValue : minValue;
@@ -7310,7 +7310,10 @@ var MemorySource = class _MemorySource {
7310
7310
  const withOverlay = generateWithOverlay(
7311
7311
  startAt,
7312
7312
  pkConstraint ? once(rowsIterable) : rowsIterable,
7313
- constraint,
7313
+ // use `req.constraint` here and not `fetchOrPkConstraint` since `fetchOrPkConstraint` could be the
7314
+ // primary key constraint. The primary key constraint comes from filters and is acting as a filter
7315
+ // rather than as the fetch constraint.
7316
+ req.constraint,
7314
7317
  this.#overlay,
7315
7318
  this.#splitEditOverlay,
7316
7319
  callingConnectionIndex,
@@ -7319,7 +7322,9 @@ var MemorySource = class _MemorySource {
7319
7322
  );
7320
7323
  const withConstraint = generateWithConstraint(
7321
7324
  generateWithStart(withOverlay, req.start, comparator2),
7322
- constraint
7325
+ // we use `req.constraint` and not `fetchOrPkConstraint` here because we need to
7326
+ // AND the constraint with what could have been the primary key constraint
7327
+ req.constraint
7323
7328
  );
7324
7329
  yield* conn.filters ? generateWithFilter(withConstraint, conn.filters.predicate) : withConstraint;
7325
7330
  }
@@ -8527,7 +8532,7 @@ function makeMessage(message, context, logLevel) {
8527
8532
  }
8528
8533
 
8529
8534
  // ../zero-client/src/client/version.ts
8530
- var version2 = "0.20.2025052000";
8535
+ var version2 = "0.20.2025052100";
8531
8536
 
8532
8537
  // ../zero-client/src/client/log-options.ts
8533
8538
  var LevelFilterLogSink = class {
@@ -11135,4 +11140,4 @@ export {
11135
11140
  update_needed_reason_type_enum_exports,
11136
11141
  Zero
11137
11142
  };
11138
- //# sourceMappingURL=chunk-BOTUSRLW.js.map
11143
+ //# sourceMappingURL=chunk-TWNGMKRD.js.map