@rocicorp/zero 0.21.2025052000 → 0.21.2025052101

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.
Files changed (42) hide show
  1. package/out/{chunk-QICPWKOW.js → chunk-I4FFQDCA.js} +18 -13
  2. package/out/{chunk-QICPWKOW.js.map → chunk-I4FFQDCA.js.map} +2 -2
  3. package/out/solid.js +1 -1
  4. package/out/zero-cache/src/config/zero-config.d.ts +0 -8
  5. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  6. package/out/zero-cache/src/config/zero-config.js +4 -11
  7. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  8. package/out/zero-cache/src/db/pg-copy.d.ts +18 -0
  9. package/out/zero-cache/src/db/pg-copy.d.ts.map +1 -0
  10. package/out/zero-cache/src/db/pg-copy.js +81 -0
  11. package/out/zero-cache/src/db/pg-copy.js.map +1 -0
  12. package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
  13. package/out/zero-cache/src/server/change-streamer.js +1 -14
  14. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  15. package/out/zero-cache/src/services/change-source/pg/copy-runner.d.ts +23 -0
  16. package/out/zero-cache/src/services/change-source/pg/copy-runner.d.ts.map +1 -0
  17. package/out/zero-cache/src/services/change-source/pg/copy-runner.js +98 -0
  18. package/out/zero-cache/src/services/change-source/pg/copy-runner.js.map +1 -0
  19. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts +0 -1
  20. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +1 -1
  21. package/out/zero-cache/src/services/change-source/pg/initial-sync.js +123 -82
  22. package/out/zero-cache/src/services/change-source/pg/initial-sync.js.map +1 -1
  23. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +1 -3
  24. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
  25. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +5 -16
  26. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
  27. package/out/zero-cache/src/services/http-service.d.ts.map +1 -1
  28. package/out/zero-cache/src/services/http-service.js +5 -18
  29. package/out/zero-cache/src/services/http-service.js.map +1 -1
  30. package/out/zero-cache/src/types/lite.d.ts +0 -1
  31. package/out/zero-cache/src/types/lite.d.ts.map +1 -1
  32. package/out/zero-cache/src/types/lite.js +0 -3
  33. package/out/zero-cache/src/types/lite.js.map +1 -1
  34. package/out/zero-cache/src/types/timeout.d.ts +11 -0
  35. package/out/zero-cache/src/types/timeout.d.ts.map +1 -0
  36. package/out/zero-cache/src/types/timeout.js +23 -0
  37. package/out/zero-cache/src/types/timeout.js.map +1 -0
  38. package/out/zero.js +1 -1
  39. package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
  40. package/out/zql/src/ivm/memory-source.js +20 -14
  41. package/out/zql/src/ivm/memory-source.js.map +1 -1
  42. package/package.json +1 -1
@@ -7271,17 +7271,18 @@ var MemorySource = class _MemorySource {
7271
7271
  assert(callingConnectionIndex !== -1, "Output not found");
7272
7272
  const conn = this.#connections[callingConnectionIndex];
7273
7273
  const { sort: requestedSort } = conn;
7274
- const indexSort = [];
7275
- if (req.constraint) {
7276
- for (const key of Object.keys(req.constraint)) {
7277
- indexSort.push([key, "asc"]);
7278
- }
7279
- }
7280
7274
  const pkConstraint = primaryKeyConstraintFromFilters(
7281
7275
  conn.filters?.condition,
7282
7276
  this.#primaryKey
7283
7277
  );
7284
- if (this.#primaryKey.length > 1 || !req.constraint || !constraintMatchesPrimaryKey(req.constraint, this.#primaryKey) && !pkConstraint) {
7278
+ const fetchOrPkConstraint = pkConstraint ?? req.constraint;
7279
+ const indexSort = [];
7280
+ if (fetchOrPkConstraint) {
7281
+ for (const key of Object.keys(fetchOrPkConstraint)) {
7282
+ indexSort.push([key, "asc"]);
7283
+ }
7284
+ }
7285
+ if (this.#primaryKey.length > 1 || !fetchOrPkConstraint || !constraintMatchesPrimaryKey(fetchOrPkConstraint, this.#primaryKey)) {
7285
7286
  indexSort.push(...requestedSort);
7286
7287
  }
7287
7288
  const index = this.#getOrCreateIndex(indexSort, from);
@@ -7289,12 +7290,11 @@ var MemorySource = class _MemorySource {
7289
7290
  const comparator2 = (r1, r2) => compare(r1, r2) * (req.reverse ? -1 : 1);
7290
7291
  const startAt = req.start?.row;
7291
7292
  let scanStart;
7292
- const constraint = pkConstraint ?? req.constraint;
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,6 +7310,9 @@ var MemorySource = class _MemorySource {
7310
7310
  const withOverlay = generateWithOverlay(
7311
7311
  startAt,
7312
7312
  pkConstraint ? once(rowsIterable) : rowsIterable,
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.
7313
7316
  req.constraint,
7314
7317
  this.#overlay,
7315
7318
  this.#splitEditOverlay,
@@ -7319,6 +7322,8 @@ var MemorySource = class _MemorySource {
7319
7322
  );
7320
7323
  const withConstraint = generateWithConstraint(
7321
7324
  generateWithStart(withOverlay, req.start, comparator2),
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
7322
7327
  req.constraint
7323
7328
  );
7324
7329
  yield* conn.filters ? generateWithFilter(withConstraint, conn.filters.predicate) : withConstraint;
@@ -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.21.2025052000";
8535
+ var version2 = "0.21.2025052101";
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-QICPWKOW.js.map
11143
+ //# sourceMappingURL=chunk-I4FFQDCA.js.map