@rocicorp/zero 0.20.2025050400 → 0.20.2025050600

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 (140) hide show
  1. package/out/analyze-query/src/bin-analyze.js +10 -3
  2. package/out/analyze-query/src/bin-analyze.js.map +1 -1
  3. package/out/{chunk-KOXC55U7.js → chunk-EBZYAQDK.js} +14 -5
  4. package/out/chunk-EBZYAQDK.js.map +7 -0
  5. package/out/{chunk-54ZZCBOP.js → chunk-N44AEZOH.js} +2 -2
  6. package/out/{chunk-IFAC3PDK.js → chunk-VA2YVVTK.js} +58 -9
  7. package/out/{chunk-IFAC3PDK.js.map → chunk-VA2YVVTK.js.map} +2 -2
  8. package/out/{inspector-Z55GQ5JV.js → inspector-GCX7QH7K.js} +3 -3
  9. package/out/react.js +1 -1
  10. package/out/solid.js +3 -3
  11. package/out/z2s/src/compiler.d.ts.map +1 -1
  12. package/out/z2s/src/compiler.js +5 -1
  13. package/out/z2s/src/compiler.js.map +1 -1
  14. package/out/zero-cache/src/config/network.d.ts +5 -0
  15. package/out/zero-cache/src/config/network.d.ts.map +1 -0
  16. package/out/zero-cache/src/config/network.js +47 -0
  17. package/out/zero-cache/src/config/network.js.map +1 -0
  18. package/out/zero-cache/src/config/normalize.d.ts +29 -0
  19. package/out/zero-cache/src/config/normalize.d.ts.map +1 -0
  20. package/out/zero-cache/src/config/normalize.js +73 -0
  21. package/out/zero-cache/src/config/normalize.js.map +1 -0
  22. package/out/zero-cache/src/config/zero-config.d.ts +262 -99
  23. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  24. package/out/zero-cache/src/config/zero-config.js +64 -32
  25. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  26. package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
  27. package/out/zero-cache/src/server/change-streamer.js +19 -4
  28. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  29. package/out/zero-cache/src/server/main.d.ts +1 -1
  30. package/out/zero-cache/src/server/main.d.ts.map +1 -1
  31. package/out/zero-cache/src/server/main.js +14 -26
  32. package/out/zero-cache/src/server/main.js.map +1 -1
  33. package/out/zero-cache/src/server/replicator.d.ts.map +1 -1
  34. package/out/zero-cache/src/server/replicator.js +15 -4
  35. package/out/zero-cache/src/server/replicator.js.map +1 -1
  36. package/out/zero-cache/src/server/runner/run-worker.d.ts +7 -0
  37. package/out/zero-cache/src/server/runner/run-worker.d.ts.map +1 -1
  38. package/out/zero-cache/src/server/runner/run-worker.js +34 -73
  39. package/out/zero-cache/src/server/runner/run-worker.js.map +1 -1
  40. package/out/zero-cache/src/server/runner/runtime.d.ts.map +1 -1
  41. package/out/zero-cache/src/server/runner/runtime.js +12 -1
  42. package/out/zero-cache/src/server/runner/runtime.js.map +1 -1
  43. package/out/zero-cache/src/server/runner/zero-dispatcher.d.ts +2 -9
  44. package/out/zero-cache/src/server/runner/zero-dispatcher.d.ts.map +1 -1
  45. package/out/zero-cache/src/server/runner/zero-dispatcher.js +9 -46
  46. package/out/zero-cache/src/server/runner/zero-dispatcher.js.map +1 -1
  47. package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
  48. package/out/zero-cache/src/server/syncer.js +4 -2
  49. package/out/zero-cache/src/server/syncer.js.map +1 -1
  50. package/out/zero-cache/src/server/worker-dispatcher.d.ts +16 -0
  51. package/out/zero-cache/src/server/worker-dispatcher.d.ts.map +1 -0
  52. package/out/zero-cache/src/server/worker-dispatcher.js +99 -0
  53. package/out/zero-cache/src/server/worker-dispatcher.js.map +1 -0
  54. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +1 -1
  55. package/out/zero-cache/src/services/change-source/pg/change-source.js +12 -6
  56. package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
  57. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +6 -3
  58. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
  59. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +31 -16
  60. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
  61. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts +1 -1
  62. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts.map +1 -1
  63. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js +4 -15
  64. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js.map +1 -1
  65. package/out/zero-cache/src/services/change-streamer/schema/init.d.ts.map +1 -1
  66. package/out/zero-cache/src/services/change-streamer/schema/init.js +8 -0
  67. package/out/zero-cache/src/services/change-streamer/schema/init.js.map +1 -1
  68. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts +2 -1
  69. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts.map +1 -1
  70. package/out/zero-cache/src/services/change-streamer/schema/tables.js +19 -13
  71. package/out/zero-cache/src/services/change-streamer/schema/tables.js.map +1 -1
  72. package/out/zero-cache/src/services/change-streamer/storer.d.ts +1 -1
  73. package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +1 -1
  74. package/out/zero-cache/src/services/change-streamer/storer.js +6 -2
  75. package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
  76. package/out/zero-cache/src/services/http-service.d.ts +5 -2
  77. package/out/zero-cache/src/services/http-service.d.ts.map +1 -1
  78. package/out/zero-cache/src/services/http-service.js +27 -11
  79. package/out/zero-cache/src/services/http-service.js.map +1 -1
  80. package/out/zero-cache/src/services/statz.d.ts +1 -1
  81. package/out/zero-cache/src/services/statz.d.ts.map +1 -1
  82. package/out/zero-cache/src/services/statz.js +6 -7
  83. package/out/zero-cache/src/services/statz.js.map +1 -1
  84. package/out/zero-cache/src/types/error-for-client.d.ts +1 -1
  85. package/out/zero-cache/src/types/pg.d.ts.map +1 -1
  86. package/out/zero-cache/src/types/pg.js +23 -21
  87. package/out/zero-cache/src/types/pg.js.map +1 -1
  88. package/out/zero-cache/src/{services/dispatcher → types}/websocket-handoff.d.ts +18 -2
  89. package/out/zero-cache/src/types/websocket-handoff.d.ts.map +1 -0
  90. package/out/zero-cache/src/{services/dispatcher → types}/websocket-handoff.js +14 -6
  91. package/out/zero-cache/src/types/websocket-handoff.js.map +1 -0
  92. package/out/zero-cache/src/{services/dispatcher → workers}/connect-params.d.ts +1 -1
  93. package/out/zero-cache/src/workers/connect-params.d.ts.map +1 -0
  94. package/out/zero-cache/src/{services/dispatcher → workers}/connect-params.js +3 -3
  95. package/out/zero-cache/src/workers/connect-params.js.map +1 -0
  96. package/out/zero-cache/src/workers/connection.d.ts +1 -1
  97. package/out/zero-cache/src/workers/connection.d.ts.map +1 -1
  98. package/out/zero-cache/src/workers/connection.js +8 -3
  99. package/out/zero-cache/src/workers/connection.js.map +1 -1
  100. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts +1 -1
  101. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +1 -1
  102. package/out/zero-cache/src/workers/syncer.d.ts.map +1 -1
  103. package/out/zero-cache/src/workers/syncer.js +1 -1
  104. package/out/zero-cache/src/workers/syncer.js.map +1 -1
  105. package/out/zero-protocol/src/ast.d.ts +2 -2
  106. package/out/zero-protocol/src/ast.d.ts.map +1 -1
  107. package/out/zero-protocol/src/ast.js +3 -1
  108. package/out/zero-protocol/src/ast.js.map +1 -1
  109. package/out/zero.js +3 -3
  110. package/out/zql/src/ivm/constraint.d.ts +24 -0
  111. package/out/zql/src/ivm/constraint.d.ts.map +1 -1
  112. package/out/zql/src/ivm/constraint.js +65 -0
  113. package/out/zql/src/ivm/constraint.js.map +1 -1
  114. package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
  115. package/out/zql/src/ivm/memory-source.js +10 -5
  116. package/out/zql/src/ivm/memory-source.js.map +1 -1
  117. package/out/zql/src/query/query-impl.d.ts +1 -1
  118. package/out/zql/src/query/query-impl.d.ts.map +1 -1
  119. package/out/zql/src/query/query-impl.js +5 -3
  120. package/out/zql/src/query/query-impl.js.map +1 -1
  121. package/package.json +1 -1
  122. package/out/chunk-KOXC55U7.js.map +0 -7
  123. package/out/zero-cache/src/server/runner/config.d.ts +0 -368
  124. package/out/zero-cache/src/server/runner/config.d.ts.map +0 -1
  125. package/out/zero-cache/src/server/runner/config.js +0 -103
  126. package/out/zero-cache/src/server/runner/config.js.map +0 -1
  127. package/out/zero-cache/src/services/dispatcher/connect-params.d.ts.map +0 -1
  128. package/out/zero-cache/src/services/dispatcher/connect-params.js.map +0 -1
  129. package/out/zero-cache/src/services/dispatcher/dispatcher.d.ts +0 -15
  130. package/out/zero-cache/src/services/dispatcher/dispatcher.d.ts.map +0 -1
  131. package/out/zero-cache/src/services/dispatcher/dispatcher.js +0 -64
  132. package/out/zero-cache/src/services/dispatcher/dispatcher.js.map +0 -1
  133. package/out/zero-cache/src/services/dispatcher/websocket-handoff.d.ts.map +0 -1
  134. package/out/zero-cache/src/services/dispatcher/websocket-handoff.js.map +0 -1
  135. package/out/zero-cache/src/types/timeout.d.ts +0 -11
  136. package/out/zero-cache/src/types/timeout.d.ts.map +0 -1
  137. package/out/zero-cache/src/types/timeout.js +0 -23
  138. package/out/zero-cache/src/types/timeout.js.map +0 -1
  139. /package/out/{chunk-54ZZCBOP.js.map → chunk-N44AEZOH.js.map} +0 -0
  140. /package/out/{inspector-Z55GQ5JV.js.map → inspector-GCX7QH7K.js.map} +0 -0
@@ -14,7 +14,7 @@ import {
14
14
  readonlyObject,
15
15
  readonlyRecord,
16
16
  valita_exports
17
- } from "./chunk-KOXC55U7.js";
17
+ } from "./chunk-EBZYAQDK.js";
18
18
  import {
19
19
  assert,
20
20
  assertArray,
@@ -2840,4 +2840,4 @@ export {
2840
2840
  toPrimaryKeyString,
2841
2841
  sourceNameFromKey
2842
2842
  };
2843
- //# sourceMappingURL=chunk-54ZZCBOP.js.map
2843
+ //# sourceMappingURL=chunk-N44AEZOH.js.map
@@ -84,7 +84,7 @@ import {
84
84
  withRead,
85
85
  withWrite,
86
86
  withWriteNoImplicitCommit
87
- } from "./chunk-54ZZCBOP.js";
87
+ } from "./chunk-N44AEZOH.js";
88
88
  import {
89
89
  AbstractQuery,
90
90
  ExpressionBuilder,
@@ -120,7 +120,7 @@ import {
120
120
  transformFilters,
121
121
  valita_exports,
122
122
  wrapIterable
123
- } from "./chunk-KOXC55U7.js";
123
+ } from "./chunk-EBZYAQDK.js";
124
124
  import {
125
125
  __export,
126
126
  assert,
@@ -7104,6 +7104,50 @@ function constraintMatchesPrimaryKey(constraint, primary) {
7104
7104
  }
7105
7105
  return true;
7106
7106
  }
7107
+ function pullSimpleAndComponents(condition) {
7108
+ if (condition.type === "and") {
7109
+ return condition.conditions.flatMap(pullSimpleAndComponents);
7110
+ }
7111
+ if (condition.type === "simple") {
7112
+ return [condition];
7113
+ }
7114
+ if (condition.type === "or" && condition.conditions.length === 1) {
7115
+ return pullSimpleAndComponents(condition.conditions[0]);
7116
+ }
7117
+ return [];
7118
+ }
7119
+ function primaryKeyConstraintFromFilters(condition, primary) {
7120
+ if (condition === void 0) {
7121
+ return void 0;
7122
+ }
7123
+ const conditions = pullSimpleAndComponents(condition);
7124
+ if (conditions.length === 0) {
7125
+ return void 0;
7126
+ }
7127
+ const ret = {};
7128
+ for (const subCondition of conditions) {
7129
+ if (subCondition.op === "=") {
7130
+ const column = extractColumn(subCondition);
7131
+ if (column !== void 0) {
7132
+ if (!primary.includes(column.name)) {
7133
+ continue;
7134
+ }
7135
+ ret[column.name] = column.value;
7136
+ }
7137
+ }
7138
+ }
7139
+ if (Object.keys(ret).length !== primary.length) {
7140
+ return void 0;
7141
+ }
7142
+ return ret;
7143
+ }
7144
+ function extractColumn(condition) {
7145
+ if (condition.left.type === "column") {
7146
+ assert(condition.right.type === "literal");
7147
+ return { name: condition.left.name, value: condition.right.value };
7148
+ }
7149
+ return void 0;
7150
+ }
7107
7151
 
7108
7152
  // ../zql/src/ivm/memory-source.ts
7109
7153
  var MemorySource = class _MemorySource {
@@ -7231,7 +7275,11 @@ var MemorySource = class _MemorySource {
7231
7275
  indexSort.push([key, "asc"]);
7232
7276
  }
7233
7277
  }
7234
- if (this.#primaryKey.length > 1 || !req.constraint || !constraintMatchesPrimaryKey(req.constraint, this.#primaryKey)) {
7278
+ const pkConstraint = primaryKeyConstraintFromFilters(
7279
+ conn.filters?.condition,
7280
+ this.#primaryKey
7281
+ );
7282
+ if (this.#primaryKey.length > 1 || !req.constraint || !constraintMatchesPrimaryKey(req.constraint, this.#primaryKey) && !pkConstraint) {
7235
7283
  indexSort.push(...requestedSort);
7236
7284
  }
7237
7285
  const index = this.#getOrCreateIndex(indexSort, from);
@@ -7239,11 +7287,12 @@ var MemorySource = class _MemorySource {
7239
7287
  const comparator2 = (r1, r2) => compare(r1, r2) * (req.reverse ? -1 : 1);
7240
7288
  const startAt = req.start?.row;
7241
7289
  let scanStart;
7242
- if (req.constraint) {
7290
+ const constraint = pkConstraint ?? req.constraint;
7291
+ if (constraint) {
7243
7292
  scanStart = {};
7244
7293
  for (const [key, dir] of indexSort) {
7245
- if (hasOwn(req.constraint, key)) {
7246
- scanStart[key] = req.constraint[key];
7294
+ if (hasOwn(constraint, key)) {
7295
+ scanStart[key] = constraint[key];
7247
7296
  } else {
7248
7297
  if (req.reverse) {
7249
7298
  scanStart[key] = dir === "asc" ? maxValue : minValue;
@@ -8472,7 +8521,7 @@ function makeMessage(message, context, logLevel) {
8472
8521
  }
8473
8522
 
8474
8523
  // ../zero-client/src/client/version.ts
8475
- var version2 = "0.20.2025050400";
8524
+ var version2 = "0.20.2025050600";
8476
8525
 
8477
8526
  // ../zero-client/src/client/log-options.ts
8478
8527
  var LevelFilterLogSink = class {
@@ -10953,7 +11002,7 @@ var Zero = class {
10953
11002
  */
10954
11003
  async inspect() {
10955
11004
  BUNDLE_SIZE: {
10956
- const m = await import("./inspector-Z55GQ5JV.js");
11005
+ const m = await import("./inspector-GCX7QH7K.js");
10957
11006
  return m.newInspector(this.#rep, this.#schema, async () => {
10958
11007
  await this.#connectResolver.promise;
10959
11008
  return this.#socket;
@@ -11080,4 +11129,4 @@ export {
11080
11129
  update_needed_reason_type_enum_exports,
11081
11130
  Zero
11082
11131
  };
11083
- //# sourceMappingURL=chunk-IFAC3PDK.js.map
11132
+ //# sourceMappingURL=chunk-VA2YVVTK.js.map