@rocicorp/zero 1.10.0-canary.24 → 1.10.0-canary.26

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 (568) hide show
  1. package/out/analyze-query/src/bin-analyze.js +8 -9
  2. package/out/analyze-query/src/bin-analyze.js.map +1 -1
  3. package/out/replicache/src/btree/node.d.ts.map +1 -1
  4. package/out/replicache/src/btree/node.js +6 -3
  5. package/out/replicache/src/btree/node.js.map +1 -1
  6. package/out/replicache/src/btree/read.d.ts +1 -12
  7. package/out/replicache/src/btree/read.d.ts.map +1 -1
  8. package/out/replicache/src/btree/read.js +12 -24
  9. package/out/replicache/src/btree/read.js.map +1 -1
  10. package/out/replicache/src/dag/gc.d.ts.map +1 -1
  11. package/out/replicache/src/dag/gc.js +11 -8
  12. package/out/replicache/src/dag/gc.js.map +1 -1
  13. package/out/replicache/src/dag/store-impl.d.ts +2 -12
  14. package/out/replicache/src/dag/store-impl.d.ts.map +1 -1
  15. package/out/replicache/src/dag/store-impl.js +8 -22
  16. package/out/replicache/src/dag/store-impl.js.map +1 -1
  17. package/out/replicache/src/db/rebase.d.ts +2 -14
  18. package/out/replicache/src/db/rebase.d.ts.map +1 -1
  19. package/out/replicache/src/db/rebase.js +5 -27
  20. package/out/replicache/src/db/rebase.js.map +1 -1
  21. package/out/replicache/src/db/write.js.map +1 -1
  22. package/out/replicache/src/kv/expo-sqlite/store.d.ts.map +1 -1
  23. package/out/replicache/src/kv/expo-sqlite/store.js +5 -28
  24. package/out/replicache/src/kv/expo-sqlite/store.js.map +1 -1
  25. package/out/replicache/src/kv/idb-store-with-mem-fallback.d.ts +5 -15
  26. package/out/replicache/src/kv/idb-store-with-mem-fallback.d.ts.map +1 -1
  27. package/out/replicache/src/kv/idb-store-with-mem-fallback.js +25 -25
  28. package/out/replicache/src/kv/idb-store-with-mem-fallback.js.map +1 -1
  29. package/out/replicache/src/kv/idb-store.d.ts +0 -9
  30. package/out/replicache/src/kv/idb-store.d.ts.map +1 -1
  31. package/out/replicache/src/kv/idb-store.js +2 -14
  32. package/out/replicache/src/kv/idb-store.js.map +1 -1
  33. package/out/replicache/src/kv/mem-store.d.ts +0 -1
  34. package/out/replicache/src/kv/mem-store.d.ts.map +1 -1
  35. package/out/replicache/src/kv/mem-store.js +0 -3
  36. package/out/replicache/src/kv/mem-store.js.map +1 -1
  37. package/out/replicache/src/kv/op-sqlite/store.d.ts.map +1 -1
  38. package/out/replicache/src/kv/op-sqlite/store.js +1 -1
  39. package/out/replicache/src/kv/op-sqlite/store.js.map +1 -1
  40. package/out/replicache/src/kv/sqlite-store.d.ts +1 -13
  41. package/out/replicache/src/kv/sqlite-store.d.ts.map +1 -1
  42. package/out/replicache/src/kv/sqlite-store.js +6 -73
  43. package/out/replicache/src/kv/sqlite-store.js.map +1 -1
  44. package/out/replicache/src/kv/store.d.ts +0 -6
  45. package/out/replicache/src/kv/store.d.ts.map +1 -1
  46. package/out/replicache/src/persist/collect-idb-databases.d.ts +5 -10
  47. package/out/replicache/src/persist/collect-idb-databases.d.ts.map +1 -1
  48. package/out/replicache/src/persist/collect-idb-databases.js +9 -16
  49. package/out/replicache/src/persist/collect-idb-databases.js.map +1 -1
  50. package/out/replicache/src/persist/persist.d.ts.map +1 -1
  51. package/out/replicache/src/persist/persist.js +6 -13
  52. package/out/replicache/src/persist/persist.js.map +1 -1
  53. package/out/replicache/src/persist/refresh.js +2 -6
  54. package/out/replicache/src/persist/refresh.js.map +1 -1
  55. package/out/replicache/src/replicache-impl.d.ts +3 -14
  56. package/out/replicache/src/replicache-impl.d.ts.map +1 -1
  57. package/out/replicache/src/replicache-impl.js +11 -118
  58. package/out/replicache/src/replicache-impl.js.map +1 -1
  59. package/out/replicache/src/replicache-options.d.ts +0 -9
  60. package/out/replicache/src/replicache-options.d.ts.map +1 -1
  61. package/out/replicache/src/transactions.d.ts.map +1 -1
  62. package/out/replicache/src/transactions.js +1 -1
  63. package/out/replicache/src/transactions.js.map +1 -1
  64. package/out/shared/src/arrays.d.ts +0 -5
  65. package/out/shared/src/arrays.d.ts.map +1 -1
  66. package/out/shared/src/arrays.js +24 -8
  67. package/out/shared/src/arrays.js.map +1 -1
  68. package/out/shared/src/base64.d.ts +19 -0
  69. package/out/shared/src/base64.d.ts.map +1 -0
  70. package/out/shared/src/base64.js +40 -0
  71. package/out/shared/src/base64.js.map +1 -0
  72. package/out/shared/src/error.d.ts +0 -11
  73. package/out/shared/src/error.d.ts.map +1 -1
  74. package/out/shared/src/error.js +1 -35
  75. package/out/shared/src/error.js.map +1 -1
  76. package/out/shared/src/hash.d.ts +0 -1
  77. package/out/shared/src/hash.d.ts.map +1 -1
  78. package/out/shared/src/hash.js +10 -87
  79. package/out/shared/src/hash.js.map +1 -1
  80. package/out/shared/src/iterables.d.ts +0 -2
  81. package/out/shared/src/iterables.d.ts.map +1 -1
  82. package/out/shared/src/iterables.js +1 -18
  83. package/out/shared/src/iterables.js.map +1 -1
  84. package/out/shared/src/json.d.ts.map +1 -1
  85. package/out/shared/src/json.js +2 -2
  86. package/out/shared/src/json.js.map +1 -1
  87. package/out/shared/src/map.d.ts +2 -24
  88. package/out/shared/src/map.d.ts.map +1 -1
  89. package/out/shared/src/map.js +4 -18
  90. package/out/shared/src/map.js.map +1 -1
  91. package/out/shared/src/ring-buffer.d.ts +0 -8
  92. package/out/shared/src/ring-buffer.d.ts.map +1 -1
  93. package/out/shared/src/ring-buffer.js +1 -22
  94. package/out/shared/src/ring-buffer.js.map +1 -1
  95. package/out/z2s/src/sql.d.ts.map +1 -1
  96. package/out/z2s/src/sql.js +2 -2
  97. package/out/z2s/src/sql.js.map +1 -1
  98. package/out/zero/package.js +3 -2
  99. package/out/zero/package.js.map +1 -1
  100. package/out/zero-cache/src/auth/read-authorizer.js +1 -1
  101. package/out/zero-cache/src/auth/write-authorizer.d.ts.map +1 -1
  102. package/out/zero-cache/src/auth/write-authorizer.js +0 -1
  103. package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
  104. package/out/zero-cache/src/config/zero-config.d.ts +2 -42
  105. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  106. package/out/zero-cache/src/config/zero-config.js +28 -149
  107. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  108. package/out/zero-cache/src/custom-queries/transform-query.js +1 -1
  109. package/out/zero-cache/src/db/create.d.ts.map +1 -1
  110. package/out/zero-cache/src/db/create.js +1 -4
  111. package/out/zero-cache/src/db/create.js.map +1 -1
  112. package/out/zero-cache/src/db/lite-tables.d.ts +2 -10
  113. package/out/zero-cache/src/db/lite-tables.d.ts.map +1 -1
  114. package/out/zero-cache/src/db/lite-tables.js +6 -10
  115. package/out/zero-cache/src/db/lite-tables.js.map +1 -1
  116. package/out/zero-cache/src/db/specs.d.ts +0 -41
  117. package/out/zero-cache/src/db/specs.d.ts.map +1 -1
  118. package/out/zero-cache/src/db/specs.js +3 -30
  119. package/out/zero-cache/src/db/specs.js.map +1 -1
  120. package/out/zero-cache/src/observability/metrics.d.ts.map +1 -1
  121. package/out/zero-cache/src/observability/metrics.js +7 -2
  122. package/out/zero-cache/src/observability/metrics.js.map +1 -1
  123. package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
  124. package/out/zero-cache/src/server/change-streamer.js +4 -13
  125. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  126. package/out/zero-cache/src/server/inspector-delegate.d.ts +2 -18
  127. package/out/zero-cache/src/server/inspector-delegate.d.ts.map +1 -1
  128. package/out/zero-cache/src/server/inspector-delegate.js +17 -25
  129. package/out/zero-cache/src/server/inspector-delegate.js.map +1 -1
  130. package/out/zero-cache/src/server/main.d.ts.map +1 -1
  131. package/out/zero-cache/src/server/main.js +1 -8
  132. package/out/zero-cache/src/server/main.js.map +1 -1
  133. package/out/zero-cache/src/server/mutator.js +0 -2
  134. package/out/zero-cache/src/server/mutator.js.map +1 -1
  135. package/out/zero-cache/src/server/reaper.d.ts.map +1 -1
  136. package/out/zero-cache/src/server/reaper.js +0 -2
  137. package/out/zero-cache/src/server/reaper.js.map +1 -1
  138. package/out/zero-cache/src/server/replicator.d.ts.map +1 -1
  139. package/out/zero-cache/src/server/replicator.js +2 -8
  140. package/out/zero-cache/src/server/replicator.js.map +1 -1
  141. package/out/zero-cache/src/server/runner/zero-dispatcher.d.ts.map +1 -1
  142. package/out/zero-cache/src/server/runner/zero-dispatcher.js +0 -3
  143. package/out/zero-cache/src/server/runner/zero-dispatcher.js.map +1 -1
  144. package/out/zero-cache/src/server/syncer.d.ts.map +1 -1
  145. package/out/zero-cache/src/server/syncer.js +1 -5
  146. package/out/zero-cache/src/server/syncer.js.map +1 -1
  147. package/out/zero-cache/src/services/analyze.d.ts.map +1 -1
  148. package/out/zero-cache/src/services/analyze.js +9 -11
  149. package/out/zero-cache/src/services/analyze.js.map +1 -1
  150. package/out/zero-cache/src/services/change-source/common/backfill-manager.d.ts.map +1 -1
  151. package/out/zero-cache/src/services/change-source/common/backfill-manager.js +1 -14
  152. package/out/zero-cache/src/services/change-source/common/backfill-manager.js.map +1 -1
  153. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.d.ts.map +1 -1
  154. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.js +3 -15
  155. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.js.map +1 -1
  156. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts +1 -11
  157. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +1 -1
  158. package/out/zero-cache/src/services/change-source/pg/change-source.js +2 -21
  159. package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
  160. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts +0 -1
  161. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +1 -1
  162. package/out/zero-cache/src/services/change-source/pg/initial-sync.js +7 -8
  163. package/out/zero-cache/src/services/change-source/pg/initial-sync.js.map +1 -1
  164. package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts +229 -1513
  165. package/out/zero-cache/src/services/change-source/pg/schema/ddl.d.ts.map +1 -1
  166. package/out/zero-cache/src/services/change-source/pg/schema/ddl.js +2 -2
  167. package/out/zero-cache/src/services/change-source/pg/schema/ddl.js.map +1 -1
  168. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts +1 -1
  169. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts.map +1 -1
  170. package/out/zero-cache/src/services/change-source/pg/schema/init.js +6 -15
  171. package/out/zero-cache/src/services/change-source/pg/schema/init.js.map +1 -1
  172. package/out/zero-cache/src/services/change-source/pg/schema/published.d.ts +20 -137
  173. package/out/zero-cache/src/services/change-source/pg/schema/published.d.ts.map +1 -1
  174. package/out/zero-cache/src/services/change-source/pg/schema/published.js +13 -82
  175. package/out/zero-cache/src/services/change-source/pg/schema/published.js.map +1 -1
  176. package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts +21 -128
  177. package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts.map +1 -1
  178. package/out/zero-cache/src/services/change-source/pg/schema/shard.js +5 -5
  179. package/out/zero-cache/src/services/change-source/pg/schema/shard.js.map +1 -1
  180. package/out/zero-cache/src/services/change-source/protocol/current/data.d.ts +0 -2
  181. package/out/zero-cache/src/services/change-source/protocol/current/data.d.ts.map +1 -1
  182. package/out/zero-cache/src/services/change-source/protocol/current/downstream.d.ts +0 -3
  183. package/out/zero-cache/src/services/change-source/protocol/current/downstream.d.ts.map +1 -1
  184. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +0 -3
  185. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
  186. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +1 -3
  187. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
  188. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +0 -1
  189. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts.map +1 -1
  190. package/out/zero-cache/src/services/litestream/commands.d.ts.map +1 -1
  191. package/out/zero-cache/src/services/litestream/commands.js +3 -8
  192. package/out/zero-cache/src/services/litestream/commands.js.map +1 -1
  193. package/out/zero-cache/src/services/litestream/config-v5.yml +1 -15
  194. package/out/zero-cache/src/services/mutagen/mutagen.d.ts +0 -5
  195. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +1 -1
  196. package/out/zero-cache/src/services/mutagen/mutagen.js +1 -7
  197. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  198. package/out/zero-cache/src/services/mutagen/pusher.d.ts +119 -119
  199. package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
  200. package/out/zero-cache/src/services/mutagen/pusher.js +6 -5
  201. package/out/zero-cache/src/services/mutagen/pusher.js.map +1 -1
  202. package/out/zero-cache/src/services/replicator/change-processor.d.ts.map +1 -1
  203. package/out/zero-cache/src/services/replicator/change-processor.js +16 -16
  204. package/out/zero-cache/src/services/replicator/change-processor.js.map +1 -1
  205. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +1 -1
  206. package/out/zero-cache/src/services/replicator/incremental-sync.js +0 -1
  207. package/out/zero-cache/src/services/replicator/incremental-sync.js.map +1 -1
  208. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts +2 -27
  209. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts.map +1 -1
  210. package/out/zero-cache/src/services/replicator/write-worker-client.js +2 -3
  211. package/out/zero-cache/src/services/replicator/write-worker-client.js.map +1 -1
  212. package/out/zero-cache/src/services/replicator/write-worker.js +5 -24
  213. package/out/zero-cache/src/services/replicator/write-worker.js.map +1 -1
  214. package/out/zero-cache/src/services/run-ast.d.ts +0 -12
  215. package/out/zero-cache/src/services/run-ast.d.ts.map +1 -1
  216. package/out/zero-cache/src/services/run-ast.js +15 -27
  217. package/out/zero-cache/src/services/run-ast.js.map +1 -1
  218. package/out/zero-cache/src/services/runner.d.ts.map +1 -1
  219. package/out/zero-cache/src/services/runner.js +1 -1
  220. package/out/zero-cache/src/services/runner.js.map +1 -1
  221. package/out/zero-cache/src/services/view-syncer/cvr.d.ts +0 -45
  222. package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
  223. package/out/zero-cache/src/services/view-syncer/cvr.js +1 -133
  224. package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
  225. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts +1 -14
  226. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts.map +1 -1
  227. package/out/zero-cache/src/services/view-syncer/drain-coordinator.js +4 -30
  228. package/out/zero-cache/src/services/view-syncer/drain-coordinator.js.map +1 -1
  229. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts +1 -1
  230. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts.map +1 -1
  231. package/out/zero-cache/src/services/view-syncer/inspect-handler.js +2 -2
  232. package/out/zero-cache/src/services/view-syncer/inspect-handler.js.map +1 -1
  233. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +1 -2
  234. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
  235. package/out/zero-cache/src/services/view-syncer/pipeline-driver.js +27 -48
  236. package/out/zero-cache/src/services/view-syncer/pipeline-driver.js.map +1 -1
  237. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts.map +1 -1
  238. package/out/zero-cache/src/services/view-syncer/query-covering.js +6 -2
  239. package/out/zero-cache/src/services/view-syncer/query-covering.js.map +1 -1
  240. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +4 -42
  241. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +1 -1
  242. package/out/zero-cache/src/services/view-syncer/snapshotter.js +28 -117
  243. package/out/zero-cache/src/services/view-syncer/snapshotter.js.map +1 -1
  244. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +1 -11
  245. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
  246. package/out/zero-cache/src/services/view-syncer/view-syncer.js +95 -466
  247. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  248. package/out/zero-cache/src/types/processes.d.ts +0 -32
  249. package/out/zero-cache/src/types/processes.d.ts.map +1 -1
  250. package/out/zero-cache/src/types/processes.js +4 -43
  251. package/out/zero-cache/src/types/processes.js.map +1 -1
  252. package/out/zero-cache/src/types/profiler.d.ts +0 -12
  253. package/out/zero-cache/src/types/profiler.d.ts.map +1 -1
  254. package/out/zero-cache/src/types/profiler.js +1 -46
  255. package/out/zero-cache/src/types/profiler.js.map +1 -1
  256. package/out/zero-cache/src/types/row-key.d.ts.map +1 -1
  257. package/out/zero-cache/src/types/row-key.js +5 -5
  258. package/out/zero-cache/src/types/row-key.js.map +1 -1
  259. package/out/zero-cache/src/workers/connect-params.d.ts +7 -0
  260. package/out/zero-cache/src/workers/connect-params.d.ts.map +1 -1
  261. package/out/zero-cache/src/workers/connect-params.js +20 -1
  262. package/out/zero-cache/src/workers/connect-params.js.map +1 -1
  263. package/out/zero-cache/src/workers/connection.d.ts +4 -4
  264. package/out/zero-cache/src/workers/connection.d.ts.map +1 -1
  265. package/out/zero-cache/src/workers/connection.js +8 -8
  266. package/out/zero-cache/src/workers/connection.js.map +1 -1
  267. package/out/zero-cache/src/workers/replicator.d.ts +0 -1
  268. package/out/zero-cache/src/workers/replicator.d.ts.map +1 -1
  269. package/out/zero-cache/src/workers/replicator.js +2 -4
  270. package/out/zero-cache/src/workers/replicator.js.map +1 -1
  271. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +1 -1
  272. package/out/zero-cache/src/workers/syncer-ws-message-handler.js +16 -21
  273. package/out/zero-cache/src/workers/syncer-ws-message-handler.js.map +1 -1
  274. package/out/zero-cache/src/workers/syncer.d.ts.map +1 -1
  275. package/out/zero-cache/src/workers/syncer.js +1 -10
  276. package/out/zero-cache/src/workers/syncer.js.map +1 -1
  277. package/out/zero-client/src/client/connection-manager.d.ts +0 -20
  278. package/out/zero-client/src/client/connection-manager.d.ts.map +1 -1
  279. package/out/zero-client/src/client/connection-manager.js +13 -77
  280. package/out/zero-client/src/client/connection-manager.js.map +1 -1
  281. package/out/zero-client/src/client/connection-status-enum.d.ts +0 -2
  282. package/out/zero-client/src/client/connection-status-enum.d.ts.map +1 -1
  283. package/out/zero-client/src/client/connection-status-enum.js +1 -3
  284. package/out/zero-client/src/client/connection-status-enum.js.map +1 -1
  285. package/out/zero-client/src/client/connection.d.ts +0 -6
  286. package/out/zero-client/src/client/connection.d.ts.map +1 -1
  287. package/out/zero-client/src/client/connection.js +1 -2
  288. package/out/zero-client/src/client/connection.js.map +1 -1
  289. package/out/zero-client/src/client/context.d.ts +2 -27
  290. package/out/zero-client/src/client/context.d.ts.map +1 -1
  291. package/out/zero-client/src/client/context.js +1 -112
  292. package/out/zero-client/src/client/context.js.map +1 -1
  293. package/out/zero-client/src/client/custom.js +2 -2
  294. package/out/zero-client/src/client/custom.js.map +1 -1
  295. package/out/zero-client/src/client/error.js +1 -1
  296. package/out/zero-client/src/client/inspector/lazy-inspector.js +2 -2
  297. package/out/zero-client/src/client/inspector/lazy-inspector.js.map +1 -1
  298. package/out/zero-client/src/client/ivm-branch.d.ts.map +1 -1
  299. package/out/zero-client/src/client/ivm-branch.js +3 -20
  300. package/out/zero-client/src/client/ivm-branch.js.map +1 -1
  301. package/out/zero-client/src/client/mutation-tracker.d.ts.map +1 -1
  302. package/out/zero-client/src/client/mutation-tracker.js +1 -1
  303. package/out/zero-client/src/client/mutation-tracker.js.map +1 -1
  304. package/out/zero-client/src/client/mutator-proxy.d.ts.map +1 -1
  305. package/out/zero-client/src/client/mutator-proxy.js +1 -2
  306. package/out/zero-client/src/client/mutator-proxy.js.map +1 -1
  307. package/out/zero-client/src/client/options.d.ts +0 -3
  308. package/out/zero-client/src/client/options.d.ts.map +1 -1
  309. package/out/zero-client/src/client/options.js.map +1 -1
  310. package/out/zero-client/src/client/query-manager.d.ts +0 -2
  311. package/out/zero-client/src/client/query-manager.d.ts.map +1 -1
  312. package/out/zero-client/src/client/query-manager.js +14 -50
  313. package/out/zero-client/src/client/query-manager.js.map +1 -1
  314. package/out/zero-client/src/client/version.js +1 -1
  315. package/out/zero-client/src/client/zero-rep.d.ts +0 -1
  316. package/out/zero-client/src/client/zero-rep.d.ts.map +1 -1
  317. package/out/zero-client/src/client/zero-rep.js +6 -9
  318. package/out/zero-client/src/client/zero-rep.js.map +1 -1
  319. package/out/zero-client/src/client/zero.d.ts +3 -18
  320. package/out/zero-client/src/client/zero.d.ts.map +1 -1
  321. package/out/zero-client/src/client/zero.js +36 -123
  322. package/out/zero-client/src/client/zero.js.map +1 -1
  323. package/out/zero-client/src/types/query-result.d.ts +0 -2
  324. package/out/zero-client/src/types/query-result.d.ts.map +1 -1
  325. package/out/zero-protocol/src/analyze-query-result.d.ts +5 -5
  326. package/out/zero-protocol/src/analyze-query-result.d.ts.map +1 -1
  327. package/out/zero-protocol/src/analyze-query-result.js +1 -1
  328. package/out/zero-protocol/src/analyze-query-result.js.map +1 -1
  329. package/out/zero-protocol/src/ast.d.ts +1 -64
  330. package/out/zero-protocol/src/ast.d.ts.map +1 -1
  331. package/out/zero-protocol/src/ast.js +54 -225
  332. package/out/zero-protocol/src/ast.js.map +1 -1
  333. package/out/zero-protocol/src/connect.d.ts +13 -0
  334. package/out/zero-protocol/src/connect.d.ts.map +1 -1
  335. package/out/zero-protocol/src/connect.js +30 -1
  336. package/out/zero-protocol/src/connect.js.map +1 -1
  337. package/out/zero-protocol/src/down.d.ts +2 -2
  338. package/out/zero-protocol/src/error.d.ts +1 -1
  339. package/out/zero-protocol/src/inspect-down.d.ts +6 -6
  340. package/out/zero-protocol/src/poke.d.ts +11 -4
  341. package/out/zero-protocol/src/poke.d.ts.map +1 -1
  342. package/out/zero-protocol/src/poke.js +3 -2
  343. package/out/zero-protocol/src/poke.js.map +1 -1
  344. package/out/zero-protocol/src/protocol-flag-enum.d.ts +7 -0
  345. package/out/zero-protocol/src/protocol-flag-enum.d.ts.map +1 -0
  346. package/out/zero-protocol/src/protocol-flag-enum.js +7 -0
  347. package/out/zero-protocol/src/protocol-flag-enum.js.map +1 -0
  348. package/out/zero-protocol/src/protocol-flag.d.ts +14 -0
  349. package/out/zero-protocol/src/protocol-flag.d.ts.map +1 -0
  350. package/out/zero-protocol/src/protocol-flag.js +8 -0
  351. package/out/zero-protocol/src/protocol-flag.js.map +1 -0
  352. package/out/zero-protocol/src/protocol-version.d.ts +30 -6
  353. package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
  354. package/out/zero-protocol/src/protocol-version.js +1 -1
  355. package/out/zero-protocol/src/protocol-version.js.map +1 -1
  356. package/out/zero-protocol/src/query-hash.d.ts +2 -7
  357. package/out/zero-protocol/src/query-hash.d.ts.map +1 -1
  358. package/out/zero-protocol/src/query-hash.js +10 -10
  359. package/out/zero-protocol/src/query-hash.js.map +1 -1
  360. package/out/zero-react/src/use-query.d.ts +4 -5
  361. package/out/zero-react/src/use-query.d.ts.map +1 -1
  362. package/out/zero-react/src/use-query.js +9 -86
  363. package/out/zero-react/src/use-query.js.map +1 -1
  364. package/out/zero-solid/src/solid-view.d.ts +0 -17
  365. package/out/zero-solid/src/solid-view.d.ts.map +1 -1
  366. package/out/zero-solid/src/solid-view.js +1 -39
  367. package/out/zero-solid/src/solid-view.js.map +1 -1
  368. package/out/zero-solid/src/use-query.js +3 -5
  369. package/out/zero-solid/src/use-query.js.map +1 -1
  370. package/out/zql/src/builder/builder.d.ts +0 -19
  371. package/out/zql/src/builder/builder.d.ts.map +1 -1
  372. package/out/zql/src/builder/builder.js +11 -28
  373. package/out/zql/src/builder/builder.js.map +1 -1
  374. package/out/zql/src/builder/debug-delegate.d.ts +1 -6
  375. package/out/zql/src/builder/debug-delegate.d.ts.map +1 -1
  376. package/out/zql/src/builder/debug-delegate.js +2 -14
  377. package/out/zql/src/builder/debug-delegate.js.map +1 -1
  378. package/out/zql/src/ivm/array-view.d.ts +0 -29
  379. package/out/zql/src/ivm/array-view.d.ts.map +1 -1
  380. package/out/zql/src/ivm/array-view.js +12 -63
  381. package/out/zql/src/ivm/array-view.js.map +1 -1
  382. package/out/zql/src/ivm/cap.d.ts.map +1 -1
  383. package/out/zql/src/ivm/cap.js +3 -5
  384. package/out/zql/src/ivm/cap.js.map +1 -1
  385. package/out/zql/src/ivm/data.d.ts.map +1 -1
  386. package/out/zql/src/ivm/data.js +3 -8
  387. package/out/zql/src/ivm/data.js.map +1 -1
  388. package/out/zql/src/ivm/exists.d.ts +1 -1
  389. package/out/zql/src/ivm/exists.d.ts.map +1 -1
  390. package/out/zql/src/ivm/exists.js.map +1 -1
  391. package/out/zql/src/ivm/fan-in.d.ts +2 -2
  392. package/out/zql/src/ivm/fan-in.d.ts.map +1 -1
  393. package/out/zql/src/ivm/fan-in.js +5 -6
  394. package/out/zql/src/ivm/fan-in.js.map +1 -1
  395. package/out/zql/src/ivm/fan-out.d.ts +2 -2
  396. package/out/zql/src/ivm/fan-out.d.ts.map +1 -1
  397. package/out/zql/src/ivm/fan-out.js.map +1 -1
  398. package/out/zql/src/ivm/filter-operators.d.ts +6 -7
  399. package/out/zql/src/ivm/filter-operators.d.ts.map +1 -1
  400. package/out/zql/src/ivm/filter-operators.js +12 -29
  401. package/out/zql/src/ivm/filter-operators.js.map +1 -1
  402. package/out/zql/src/ivm/filter.d.ts +2 -2
  403. package/out/zql/src/ivm/filter.d.ts.map +1 -1
  404. package/out/zql/src/ivm/filter.js +4 -7
  405. package/out/zql/src/ivm/filter.js.map +1 -1
  406. package/out/zql/src/ivm/flipped-join.js +2 -2
  407. package/out/zql/src/ivm/flipped-join.js.map +1 -1
  408. package/out/zql/src/ivm/maybe-split-and-push-edit-change.d.ts +1 -1
  409. package/out/zql/src/ivm/maybe-split-and-push-edit-change.d.ts.map +1 -1
  410. package/out/zql/src/ivm/maybe-split-and-push-edit-change.js +4 -6
  411. package/out/zql/src/ivm/maybe-split-and-push-edit-change.js.map +1 -1
  412. package/out/zql/src/ivm/memory-source.d.ts +3 -15
  413. package/out/zql/src/ivm/memory-source.d.ts.map +1 -1
  414. package/out/zql/src/ivm/memory-source.js +23 -57
  415. package/out/zql/src/ivm/memory-source.js.map +1 -1
  416. package/out/zql/src/ivm/operator.d.ts +0 -40
  417. package/out/zql/src/ivm/operator.d.ts.map +1 -1
  418. package/out/zql/src/ivm/operator.js.map +1 -1
  419. package/out/zql/src/ivm/take.d.ts.map +1 -1
  420. package/out/zql/src/ivm/take.js +4 -3
  421. package/out/zql/src/ivm/take.js.map +1 -1
  422. package/out/zql/src/ivm/union-fan-in.d.ts.map +1 -1
  423. package/out/zql/src/ivm/union-fan-in.js +7 -9
  424. package/out/zql/src/ivm/union-fan-in.js.map +1 -1
  425. package/out/zql/src/ivm/view-apply-change.d.ts.map +1 -1
  426. package/out/zql/src/ivm/view-apply-change.js +4 -9
  427. package/out/zql/src/ivm/view-apply-change.js.map +1 -1
  428. package/out/zql/src/ivm/view.d.ts +0 -15
  429. package/out/zql/src/ivm/view.d.ts.map +1 -1
  430. package/out/zql/src/mutate/mutator-registry.d.ts.map +1 -1
  431. package/out/zql/src/mutate/mutator-registry.js +2 -2
  432. package/out/zql/src/mutate/mutator-registry.js.map +1 -1
  433. package/out/zql/src/planner/planner-builder.d.ts +3 -12
  434. package/out/zql/src/planner/planner-builder.d.ts.map +1 -1
  435. package/out/zql/src/planner/planner-builder.js +20 -40
  436. package/out/zql/src/planner/planner-builder.js.map +1 -1
  437. package/out/zql/src/planner/planner-connection.d.ts +2 -28
  438. package/out/zql/src/planner/planner-connection.d.ts.map +1 -1
  439. package/out/zql/src/planner/planner-connection.js +8 -108
  440. package/out/zql/src/planner/planner-connection.js.map +1 -1
  441. package/out/zql/src/planner/planner-debug.d.ts +1 -1
  442. package/out/zql/src/planner/planner-debug.d.ts.map +1 -1
  443. package/out/zql/src/planner/planner-debug.js +8 -3
  444. package/out/zql/src/planner/planner-debug.js.map +1 -1
  445. package/out/zql/src/planner/planner-fan-out.d.ts +0 -1
  446. package/out/zql/src/planner/planner-fan-out.d.ts.map +1 -1
  447. package/out/zql/src/planner/planner-fan-out.js +0 -3
  448. package/out/zql/src/planner/planner-fan-out.js.map +1 -1
  449. package/out/zql/src/planner/planner-graph.d.ts +0 -2
  450. package/out/zql/src/planner/planner-graph.d.ts.map +1 -1
  451. package/out/zql/src/planner/planner-graph.js +0 -2
  452. package/out/zql/src/planner/planner-graph.js.map +1 -1
  453. package/out/zql/src/planner/planner-join.d.ts +0 -2
  454. package/out/zql/src/planner/planner-join.d.ts.map +1 -1
  455. package/out/zql/src/planner/planner-join.js +0 -7
  456. package/out/zql/src/planner/planner-join.js.map +1 -1
  457. package/out/zql/src/planner/planner-node.d.ts +1 -2
  458. package/out/zql/src/planner/planner-node.d.ts.map +1 -1
  459. package/out/zql/src/planner/planner-node.js.map +1 -1
  460. package/out/zql/src/planner/planner-source.d.ts +2 -2
  461. package/out/zql/src/planner/planner-source.d.ts.map +1 -1
  462. package/out/zql/src/planner/planner-source.js +2 -2
  463. package/out/zql/src/planner/planner-source.js.map +1 -1
  464. package/out/zql/src/query/query-delegate-base.d.ts +1 -9
  465. package/out/zql/src/query/query-delegate-base.d.ts.map +1 -1
  466. package/out/zql/src/query/query-delegate-base.js +36 -132
  467. package/out/zql/src/query/query-delegate-base.js.map +1 -1
  468. package/out/zql/src/query/query-delegate.d.ts +1 -50
  469. package/out/zql/src/query/query-delegate.d.ts.map +1 -1
  470. package/out/zql/src/query/query-impl.d.ts +14 -25
  471. package/out/zql/src/query/query-impl.d.ts.map +1 -1
  472. package/out/zql/src/query/query-impl.js +94 -397
  473. package/out/zql/src/query/query-impl.js.map +1 -1
  474. package/out/zql/src/query/query-internals.d.ts +11 -21
  475. package/out/zql/src/query/query-internals.d.ts.map +1 -1
  476. package/out/zql/src/query/query-internals.js.map +1 -1
  477. package/out/zql/src/query/query.d.ts +2 -11
  478. package/out/zql/src/query/query.d.ts.map +1 -1
  479. package/out/zql/src/query/runnable-query-impl.d.ts +2 -3
  480. package/out/zql/src/query/runnable-query-impl.d.ts.map +1 -1
  481. package/out/zql/src/query/runnable-query-impl.js +2 -15
  482. package/out/zql/src/query/runnable-query-impl.js.map +1 -1
  483. package/out/zql/src/query/typed-view.d.ts +1 -1
  484. package/out/zql/src/query/typed-view.d.ts.map +1 -1
  485. package/out/zqlite/src/db.d.ts +1 -9
  486. package/out/zqlite/src/db.d.ts.map +1 -1
  487. package/out/zqlite/src/db.js +2 -8
  488. package/out/zqlite/src/db.js.map +1 -1
  489. package/out/zqlite/src/query-builder.d.ts +1 -1
  490. package/out/zqlite/src/query-builder.d.ts.map +1 -1
  491. package/out/zqlite/src/query-builder.js +2 -4
  492. package/out/zqlite/src/query-builder.js.map +1 -1
  493. package/out/zqlite/src/query-delegate.d.ts.map +1 -1
  494. package/out/zqlite/src/query-delegate.js +6 -5
  495. package/out/zqlite/src/query-delegate.js.map +1 -1
  496. package/out/zqlite/src/sqlite-cost-model.d.ts.map +1 -1
  497. package/out/zqlite/src/sqlite-cost-model.js +30 -2
  498. package/out/zqlite/src/sqlite-cost-model.js.map +1 -1
  499. package/out/zqlite/src/sqlite-stat-fanout.d.ts.map +1 -1
  500. package/out/zqlite/src/sqlite-stat-fanout.js +5 -4
  501. package/out/zqlite/src/sqlite-stat-fanout.js.map +1 -1
  502. package/out/zqlite/src/table-source.d.ts +3 -16
  503. package/out/zqlite/src/table-source.d.ts.map +1 -1
  504. package/out/zqlite/src/table-source.js +14 -33
  505. package/out/zqlite/src/table-source.js.map +1 -1
  506. package/package.json +3 -2
  507. package/out/replicache/src/dag/invalid-ref-count-error.d.ts +0 -12
  508. package/out/replicache/src/dag/invalid-ref-count-error.d.ts.map +0 -1
  509. package/out/replicache/src/dag/invalid-ref-count-error.js +0 -19
  510. package/out/replicache/src/dag/invalid-ref-count-error.js.map +0 -1
  511. package/out/shared/src/xxhash32.d.ts +0 -36
  512. package/out/shared/src/xxhash32.d.ts.map +0 -1
  513. package/out/shared/src/xxhash32.js +0 -51
  514. package/out/shared/src/xxhash32.js.map +0 -1
  515. package/out/zero-cache/src/db/index-predicate.d.ts +0 -4
  516. package/out/zero-cache/src/db/index-predicate.d.ts.map +0 -1
  517. package/out/zero-cache/src/db/index-predicate.js +0 -46
  518. package/out/zero-cache/src/db/index-predicate.js.map +0 -1
  519. package/out/zero-cache/src/services/change-source/pg/schema/index-predicate.d.ts +0 -19
  520. package/out/zero-cache/src/services/change-source/pg/schema/index-predicate.d.ts.map +0 -1
  521. package/out/zero-cache/src/services/change-source/pg/schema/index-predicate.js +0 -581
  522. package/out/zero-cache/src/services/change-source/pg/schema/index-predicate.js.map +0 -1
  523. package/out/zero-cache/src/services/litestream/litestream-checkpointer.js +0 -131
  524. package/out/zero-cache/src/services/litestream/litestream-checkpointer.js.map +0 -1
  525. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts +0 -70
  526. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts.map +0 -1
  527. package/out/zero-cache/src/services/litestream/litestream-controller.js +0 -101
  528. package/out/zero-cache/src/services/litestream/litestream-controller.js.map +0 -1
  529. package/out/zero-cache/src/services/profz.d.ts +0 -7
  530. package/out/zero-cache/src/services/profz.d.ts.map +0 -1
  531. package/out/zero-cache/src/services/profz.js +0 -103
  532. package/out/zero-cache/src/services/profz.js.map +0 -1
  533. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts +0 -33
  534. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts.map +0 -1
  535. package/out/zero-cache/src/services/view-syncer/hydration-budget.js +0 -62
  536. package/out/zero-cache/src/services/view-syncer/hydration-budget.js.map +0 -1
  537. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts +0 -51
  538. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts.map +0 -1
  539. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.js +0 -78
  540. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.js.map +0 -1
  541. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts +0 -95
  542. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts.map +0 -1
  543. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.js +0 -155
  544. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.js.map +0 -1
  545. package/out/zero-protocol/src/query-hash-visitor.d.ts +0 -81
  546. package/out/zero-protocol/src/query-hash-visitor.d.ts.map +0 -1
  547. package/out/zero-protocol/src/query-hash-visitor.js +0 -324
  548. package/out/zero-protocol/src/query-hash-visitor.js.map +0 -1
  549. package/out/zql/src/builder/correlated-predicate-pushdown.d.ts +0 -43
  550. package/out/zql/src/builder/correlated-predicate-pushdown.d.ts.map +0 -1
  551. package/out/zql/src/builder/correlated-predicate-pushdown.js +0 -161
  552. package/out/zql/src/builder/correlated-predicate-pushdown.js.map +0 -1
  553. package/out/zql/src/ivm/connection-index.d.ts +0 -68
  554. package/out/zql/src/ivm/connection-index.d.ts.map +0 -1
  555. package/out/zql/src/ivm/connection-index.js +0 -149
  556. package/out/zql/src/ivm/connection-index.js.map +0 -1
  557. package/out/zql/src/ivm/deferred-input.d.ts +0 -44
  558. package/out/zql/src/ivm/deferred-input.d.ts.map +0 -1
  559. package/out/zql/src/ivm/deferred-input.js +0 -89
  560. package/out/zql/src/ivm/deferred-input.js.map +0 -1
  561. package/out/zql/src/planner/planner-filter.d.ts +0 -59
  562. package/out/zql/src/planner/planner-filter.d.ts.map +0 -1
  563. package/out/zql/src/planner/planner-filter.js +0 -116
  564. package/out/zql/src/planner/planner-filter.js.map +0 -1
  565. package/out/zql/src/query/query-transitions.d.ts +0 -171
  566. package/out/zql/src/query/query-transitions.d.ts.map +0 -1
  567. package/out/zql/src/query/query-transitions.js +0 -204
  568. package/out/zql/src/query/query-transitions.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection-index.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/connection-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAE,KAAK,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAG9D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;CACnC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,eAAe,CAAC,CAAC;;IAM5B,GAAG,CAAC,UAAU,EAAE,CAAC,EAAE,OAAO,EAAE,mBAAmB,GAAG,SAAS,GAAG,IAAI;IAwBlE,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,IAAI;IA8B3B,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;OAIG;IACH,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO;IAY5B;;;;OAIG;IACH,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO;CAS/C;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,mBAAmB,GAAG,SAAS,GACzC,gBAAgB,GAAG,SAAS,CA4D9B"}
@@ -1,149 +0,0 @@
1
- //#region ../zql/src/ivm/connection-index.ts
2
- /**
3
- * Indexes the connections of a source by a static equality constraint
4
- * (`column = literal` or `column IN (literals)`) taken from each
5
- * connection's filters, so that a push can determine in O(distinct indexed
6
- * columns) whether any connection could possibly accept a row, before doing
7
- * any per-connection work.
8
- *
9
- * The index is conservative: {@link mayAccept} returns `true` whenever a
10
- * connection's filters could accept the row, and may return `true` when they
11
- * do not (e.g. the connection has further conditions that reject it).
12
- * It only ever returns `false` when every connection's filters reject the
13
- * row. Connections without a static equality constraint (no filters, or
14
- * filters whose top level is not an equality) count as unconstrained and
15
- * make every row a candidate, as does an index with no connections at all.
16
- *
17
- * Values are matched with SameValueZero (`Map` key semantics), which agrees
18
- * with the `=` / `IN` predicates (`===` / `Set#has`) for every value except
19
- * `NaN`, where the index is merely more permissive.
20
- */
21
- var ConnectionIndex = class {
22
- #byColumn = /* @__PURE__ */ new Map();
23
- #constraints = /* @__PURE__ */ new Map();
24
- #unconstrained = 0;
25
- add(connection, filters) {
26
- if (this.#constraints.has(connection)) throw new Error("connection is already indexed");
27
- const constraint = staticConstraint(filters);
28
- this.#constraints.set(connection, constraint);
29
- if (!constraint) {
30
- this.#unconstrained++;
31
- return;
32
- }
33
- if (constraint.values.length === 0) return;
34
- let byValue = this.#byColumn.get(constraint.column);
35
- if (!byValue) {
36
- byValue = /* @__PURE__ */ new Map();
37
- this.#byColumn.set(constraint.column, byValue);
38
- }
39
- for (const value of constraint.values) byValue.set(value, (byValue.get(value) ?? 0) + 1);
40
- }
41
- remove(connection) {
42
- if (!this.#constraints.has(connection)) throw new Error("connection is not indexed");
43
- const constraint = this.#constraints.get(connection);
44
- this.#constraints.delete(connection);
45
- if (!constraint) {
46
- this.#unconstrained--;
47
- return;
48
- }
49
- if (constraint.values.length === 0) return;
50
- const byValue = this.#byColumn.get(constraint.column);
51
- if (!byValue) throw new Error(`no index for column ${constraint.column}`);
52
- for (const value of constraint.values) {
53
- const count = byValue.get(value) ?? 0;
54
- if (count <= 1) byValue.delete(value);
55
- else byValue.set(value, count - 1);
56
- }
57
- if (byValue.size === 0) this.#byColumn.delete(constraint.column);
58
- }
59
- get size() {
60
- return this.#constraints.size;
61
- }
62
- /**
63
- * Returns `false` only if the filters of every indexed connection reject
64
- * `row`. An empty index accepts every row: a source with no connections
65
- * is still written to (e.g. to populate it).
66
- */
67
- mayAccept(row) {
68
- if (this.#unconstrained > 0 || this.#constraints.size === 0) return true;
69
- for (const [column, byValue] of this.#byColumn) if (byValue.has(row[column])) return true;
70
- return false;
71
- }
72
- /**
73
- * Returns `false` only if the filters of every indexed connection reject
74
- * the row(s) of `change`: the row for an add or remove, and both the old
75
- * and the new row for an edit.
76
- */
77
- mayAcceptChange(change) {
78
- if (this.mayAccept(change[1])) return true;
79
- return change[0] === 2 && this.mayAccept(change[2]);
80
- }
81
- };
82
- /**
83
- * Extracts a static equality constraint that every row accepted by
84
- * `condition` must satisfy, or `undefined` if there is none.
85
- *
86
- * - `column = literal`, `column IS literal` and `column IN (literals)`
87
- * constrain the column. `column = null` (which the predicate folds to
88
- * `false`) and an empty `IN` constrain it to the empty set, i.e. the
89
- * connection never accepts a row.
90
- * - An `and` is constrained by any of its constrained conditions; the one
91
- * with the fewest values is chosen, so a never-matching condition wins.
92
- * - An `or` is constrained only if all of its branches constrain the same
93
- * column, by the union of their values. Never-matching branches cannot
94
- * widen the result and are ignored.
95
- * - Anything else (`!=`, `IS NOT`, `NOT IN`, ranges, `LIKE`, a literal on
96
- * the left) is unconstrained.
97
- */
98
- function staticConstraint(condition) {
99
- if (!condition) return;
100
- switch (condition.type) {
101
- case "simple": {
102
- const { left, right, op } = condition;
103
- if (left.type !== "column" || right.type !== "literal") return;
104
- switch (op) {
105
- case "=": return {
106
- column: left.name,
107
- values: right.value === null ? [] : [right.value]
108
- };
109
- case "IS": return {
110
- column: left.name,
111
- values: [right.value]
112
- };
113
- case "IN": return Array.isArray(right.value) ? {
114
- column: left.name,
115
- values: right.value
116
- } : void 0;
117
- default: return;
118
- }
119
- }
120
- case "and": {
121
- let best;
122
- for (const c of condition.conditions) {
123
- const constraint = staticConstraint(c);
124
- if (constraint && (!best || constraint.values.length < best.values.length)) best = constraint;
125
- }
126
- return best;
127
- }
128
- case "or": {
129
- let column;
130
- const values = [];
131
- for (const c of condition.conditions) {
132
- const constraint = staticConstraint(c);
133
- if (!constraint) return;
134
- if (constraint.values.length === 0) continue;
135
- if (column !== void 0 && constraint.column !== column) return;
136
- column = constraint.column;
137
- values.push(...constraint.values);
138
- }
139
- return {
140
- column: column ?? "",
141
- values
142
- };
143
- }
144
- }
145
- }
146
- //#endregion
147
- export { ConnectionIndex };
148
-
149
- //# sourceMappingURL=connection-index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connection-index.js","names":["#byColumn","#constraints","#unconstrained"],"sources":["../../../../../zql/src/ivm/connection-index.ts"],"sourcesContent":["import type {Row, Value} from '../../../zero-protocol/src/data.ts';\nimport type {NoSubqueryCondition} from '../builder/filter.ts';\nimport {ChangeType} from './change-type.ts';\nimport {SourceChangeIndex} from './source-change-index.ts';\nimport type {SourceChange} from './source.ts';\n\n/**\n * The static equality constraint a connection's filters place on a single\n * column: the row is accepted only if `row[column]` is one of `values`.\n * The push-time counterpart of the fetch-time `Constraint` in\n * `constraint.ts`, which pins columns to single values.\n */\nexport type StaticConstraint = {\n readonly column: string;\n readonly values: readonly Value[];\n};\n\n/**\n * Indexes the connections of a source by a static equality constraint\n * (`column = literal` or `column IN (literals)`) taken from each\n * connection's filters, so that a push can determine in O(distinct indexed\n * columns) whether any connection could possibly accept a row, before doing\n * any per-connection work.\n *\n * The index is conservative: {@link mayAccept} returns `true` whenever a\n * connection's filters could accept the row, and may return `true` when they\n * do not (e.g. the connection has further conditions that reject it).\n * It only ever returns `false` when every connection's filters reject the\n * row. Connections without a static equality constraint (no filters, or\n * filters whose top level is not an equality) count as unconstrained and\n * make every row a candidate, as does an index with no connections at all.\n *\n * Values are matched with SameValueZero (`Map` key semantics), which agrees\n * with the `=` / `IN` predicates (`===` / `Set#has`) for every value except\n * `NaN`, where the index is merely more permissive.\n */\nexport class ConnectionIndex<C> {\n // column -> value -> number of connections constrained to that value.\n readonly #byColumn = new Map<string, Map<Value, number>>();\n readonly #constraints = new Map<C, StaticConstraint | undefined>();\n #unconstrained = 0;\n\n add(connection: C, filters: NoSubqueryCondition | undefined): void {\n if (this.#constraints.has(connection)) {\n throw new Error('connection is already indexed');\n }\n const constraint = staticConstraint(filters);\n this.#constraints.set(connection, constraint);\n if (!constraint) {\n this.#unconstrained++;\n return;\n }\n if (constraint.values.length === 0) {\n // Never matches: indexed nowhere, so it is never a candidate.\n return;\n }\n let byValue = this.#byColumn.get(constraint.column);\n if (!byValue) {\n byValue = new Map();\n this.#byColumn.set(constraint.column, byValue);\n }\n for (const value of constraint.values) {\n byValue.set(value, (byValue.get(value) ?? 0) + 1);\n }\n }\n\n remove(connection: C): void {\n if (!this.#constraints.has(connection)) {\n throw new Error('connection is not indexed');\n }\n const constraint = this.#constraints.get(connection);\n this.#constraints.delete(connection);\n if (!constraint) {\n this.#unconstrained--;\n return;\n }\n if (constraint.values.length === 0) {\n return;\n }\n const byValue = this.#byColumn.get(constraint.column);\n if (!byValue) {\n throw new Error(`no index for column ${constraint.column}`);\n }\n for (const value of constraint.values) {\n const count = byValue.get(value) ?? 0;\n if (count <= 1) {\n byValue.delete(value);\n } else {\n byValue.set(value, count - 1);\n }\n }\n if (byValue.size === 0) {\n this.#byColumn.delete(constraint.column);\n }\n }\n\n get size(): number {\n return this.#constraints.size;\n }\n\n /**\n * Returns `false` only if the filters of every indexed connection reject\n * `row`. An empty index accepts every row: a source with no connections\n * is still written to (e.g. to populate it).\n */\n mayAccept(row: Row): boolean {\n if (this.#unconstrained > 0 || this.#constraints.size === 0) {\n return true;\n }\n for (const [column, byValue] of this.#byColumn) {\n if (byValue.has(row[column])) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Returns `false` only if the filters of every indexed connection reject\n * the row(s) of `change`: the row for an add or remove, and both the old\n * and the new row for an edit.\n */\n mayAcceptChange(change: SourceChange): boolean {\n if (this.mayAccept(change[SourceChangeIndex.ROW])) {\n return true;\n }\n return (\n change[SourceChangeIndex.TYPE] === ChangeType.EDIT &&\n this.mayAccept(change[SourceChangeIndex.OLD_ROW])\n );\n }\n}\n\n/**\n * Extracts a static equality constraint that every row accepted by\n * `condition` must satisfy, or `undefined` if there is none.\n *\n * - `column = literal`, `column IS literal` and `column IN (literals)`\n * constrain the column. `column = null` (which the predicate folds to\n * `false`) and an empty `IN` constrain it to the empty set, i.e. the\n * connection never accepts a row.\n * - An `and` is constrained by any of its constrained conditions; the one\n * with the fewest values is chosen, so a never-matching condition wins.\n * - An `or` is constrained only if all of its branches constrain the same\n * column, by the union of their values. Never-matching branches cannot\n * widen the result and are ignored.\n * - Anything else (`!=`, `IS NOT`, `NOT IN`, ranges, `LIKE`, a literal on\n * the left) is unconstrained.\n */\nexport function staticConstraint(\n condition: NoSubqueryCondition | undefined,\n): StaticConstraint | undefined {\n if (!condition) {\n return undefined;\n }\n switch (condition.type) {\n case 'simple': {\n const {left, right, op} = condition;\n if (left.type !== 'column' || right.type !== 'literal') {\n return undefined;\n }\n switch (op) {\n case '=':\n return {\n column: left.name,\n values: right.value === null ? [] : [right.value],\n };\n case 'IS':\n return {column: left.name, values: [right.value]};\n case 'IN':\n return Array.isArray(right.value)\n ? {column: left.name, values: right.value}\n : undefined;\n default:\n return undefined;\n }\n }\n case 'and': {\n let best: StaticConstraint | undefined;\n for (const c of condition.conditions) {\n const constraint = staticConstraint(c);\n if (\n constraint &&\n (!best || constraint.values.length < best.values.length)\n ) {\n best = constraint;\n }\n }\n return best;\n }\n case 'or': {\n let column: string | undefined;\n const values: Value[] = [];\n for (const c of condition.conditions) {\n const constraint = staticConstraint(c);\n if (!constraint) {\n return undefined;\n }\n if (constraint.values.length === 0) {\n continue; // a never-matching branch cannot widen the result\n }\n if (column !== undefined && constraint.column !== column) {\n return undefined;\n }\n column = constraint.column;\n values.push(...constraint.values);\n }\n // Every branch never matches: the whole `or` never matches.\n return {column: column ?? '', values};\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoCA,IAAa,kBAAb,MAAgC;CAE9B,4BAAqB,IAAI,IAAgC;CACzD,+BAAwB,IAAI,IAAqC;CACjE,iBAAiB;CAEjB,IAAI,YAAe,SAAgD;EACjE,IAAI,KAAKC,aAAa,IAAI,UAAU,GAClC,MAAM,IAAI,MAAM,+BAA+B;EAEjD,MAAM,aAAa,iBAAiB,OAAO;EAC3C,KAAKA,aAAa,IAAI,YAAY,UAAU;EAC5C,IAAI,CAAC,YAAY;GACf,KAAKC;GACL;EACF;EACA,IAAI,WAAW,OAAO,WAAW,GAE/B;EAEF,IAAI,UAAU,KAAKF,UAAU,IAAI,WAAW,MAAM;EAClD,IAAI,CAAC,SAAS;GACZ,0BAAU,IAAI,IAAI;GAClB,KAAKA,UAAU,IAAI,WAAW,QAAQ,OAAO;EAC/C;EACA,KAAK,MAAM,SAAS,WAAW,QAC7B,QAAQ,IAAI,QAAQ,QAAQ,IAAI,KAAK,KAAK,KAAK,CAAC;CAEpD;CAEA,OAAO,YAAqB;EAC1B,IAAI,CAAC,KAAKC,aAAa,IAAI,UAAU,GACnC,MAAM,IAAI,MAAM,2BAA2B;EAE7C,MAAM,aAAa,KAAKA,aAAa,IAAI,UAAU;EACnD,KAAKA,aAAa,OAAO,UAAU;EACnC,IAAI,CAAC,YAAY;GACf,KAAKC;GACL;EACF;EACA,IAAI,WAAW,OAAO,WAAW,GAC/B;EAEF,MAAM,UAAU,KAAKF,UAAU,IAAI,WAAW,MAAM;EACpD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,uBAAuB,WAAW,QAAQ;EAE5D,KAAK,MAAM,SAAS,WAAW,QAAQ;GACrC,MAAM,QAAQ,QAAQ,IAAI,KAAK,KAAK;GACpC,IAAI,SAAS,GACX,QAAQ,OAAO,KAAK;QAEpB,QAAQ,IAAI,OAAO,QAAQ,CAAC;EAEhC;EACA,IAAI,QAAQ,SAAS,GACnB,KAAKA,UAAU,OAAO,WAAW,MAAM;CAE3C;CAEA,IAAI,OAAe;EACjB,OAAO,KAAKC,aAAa;CAC3B;;;;;;CAOA,UAAU,KAAmB;EAC3B,IAAI,KAAKC,iBAAiB,KAAK,KAAKD,aAAa,SAAS,GACxD,OAAO;EAET,KAAK,MAAM,CAAC,QAAQ,YAAY,KAAKD,WACnC,IAAI,QAAQ,IAAI,IAAI,OAAO,GACzB,OAAO;EAGX,OAAO;CACT;;;;;;CAOA,gBAAgB,QAA+B;EAC7C,IAAI,KAAK,UAAU,OAAO,EAAsB,GAC9C,OAAO;EAET,OACE,OAAO,OAA4B,KACnC,KAAK,UAAU,OAAO,EAA0B;CAEpD;AACF;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBACd,WAC8B;CAC9B,IAAI,CAAC,WACH;CAEF,QAAQ,UAAU,MAAlB;EACE,KAAK,UAAU;GACb,MAAM,EAAC,MAAM,OAAO,OAAM;GAC1B,IAAI,KAAK,SAAS,YAAY,MAAM,SAAS,WAC3C;GAEF,QAAQ,IAAR;IACE,KAAK,KACH,OAAO;KACL,QAAQ,KAAK;KACb,QAAQ,MAAM,UAAU,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK;IAClD;IACF,KAAK,MACH,OAAO;KAAC,QAAQ,KAAK;KAAM,QAAQ,CAAC,MAAM,KAAK;IAAC;IAClD,KAAK,MACH,OAAO,MAAM,QAAQ,MAAM,KAAK,IAC5B;KAAC,QAAQ,KAAK;KAAM,QAAQ,MAAM;IAAK,IACvC,KAAA;IACN,SACE;GACJ;EACF;EACA,KAAK,OAAO;GACV,IAAI;GACJ,KAAK,MAAM,KAAK,UAAU,YAAY;IACpC,MAAM,aAAa,iBAAiB,CAAC;IACrC,IACE,eACC,CAAC,QAAQ,WAAW,OAAO,SAAS,KAAK,OAAO,SAEjD,OAAO;GAEX;GACA,OAAO;EACT;EACA,KAAK,MAAM;GACT,IAAI;GACJ,MAAM,SAAkB,CAAC;GACzB,KAAK,MAAM,KAAK,UAAU,YAAY;IACpC,MAAM,aAAa,iBAAiB,CAAC;IACrC,IAAI,CAAC,YACH;IAEF,IAAI,WAAW,OAAO,WAAW,GAC/B;IAEF,IAAI,WAAW,KAAA,KAAa,WAAW,WAAW,QAChD;IAEF,SAAS,WAAW;IACpB,OAAO,KAAK,GAAG,WAAW,MAAM;GAClC;GAEA,OAAO;IAAC,QAAQ,UAAU;IAAI;GAAM;EACtC;CACF;AACF"}
@@ -1,44 +0,0 @@
1
- import type { Node } from './data.ts';
2
- import type { FetchRequest, Input, Output } from './operator.ts';
3
- import type { SourceSchema } from './schema.ts';
4
- import { type Stream } from './stream.ts';
5
- /**
6
- * A placeholder `Input` for a view whose pipeline has not been built yet.
7
- *
8
- * Until {@link attach} is called it behaves like an empty pipeline: `fetch`
9
- * yields nothing and pushes never happen. When the real pipeline is attached
10
- * the view is hydrated with a single `fetch`, whose rows are delivered to the
11
- * view as add changes, so the view sees the data exactly as it would see rows
12
- * arriving incrementally.
13
- *
14
- * This lets `materialize()` stay synchronous and return a view immediately
15
- * while the expensive pipeline construction and hydration are postponed, for
16
- * example until the client's replica has been loaded into the IVM sources.
17
- */
18
- export declare class DeferredInput implements Input {
19
- #private;
20
- /**
21
- * @param schema The schema the built pipeline reports. Passed in so this
22
- * input can answer `getSchema()` unconditionally, as the `Input` contract
23
- * requires, before its pipeline exists.
24
- * @param build Builds the real pipeline. Called once, from {@link attach}.
25
- */
26
- constructor(schema: SourceSchema, build: () => Input);
27
- get attached(): boolean;
28
- get destroyed(): boolean;
29
- setOutput(output: Output): void;
30
- getSchema(): SourceSchema;
31
- fetch(req: FetchRequest): Stream<Node | 'yield'>;
32
- destroy(): void;
33
- /**
34
- * Build the real pipeline and hydrate the output with its current contents.
35
- *
36
- * Must be called inside the delegate's `batchViewUpdates`; the delegate is
37
- * responsible for notifying commit listeners afterwards so views flush.
38
- *
39
- * If building or hydrating throws, the pipeline is torn down again and this
40
- * input stays unattached so the caller can report the failure.
41
- */
42
- attach(): void;
43
- }
44
- //# sourceMappingURL=deferred-input.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deferred-input.d.ts","sourceRoot":"","sources":["../../../../../zql/src/ivm/deferred-input.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAC,YAAY,EAAE,KAAK,EAAE,MAAM,EAAC,MAAM,eAAe,CAAC;AAC/D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAU,KAAK,MAAM,EAAC,MAAM,aAAa,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,YAAW,KAAK;;IAOzC;;;;;OAKG;gBACS,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,KAAK;IAKpD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAK/B,SAAS,IAAI,YAAY;IAIzB,KAAK,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC;IAIhD,OAAO,IAAI,IAAI;IAKf;;;;;;;;OAQG;IACH,MAAM,IAAI,IAAI;CAwBf"}
@@ -1,89 +0,0 @@
1
- import { assert } from "../../../shared/src/asserts.js";
2
- import { emptyArray } from "../../../shared/src/sentinels.js";
3
- import { makeAddChange } from "./change.js";
4
- import { consume } from "./stream.js";
5
- //#region ../zql/src/ivm/deferred-input.ts
6
- /**
7
- * A placeholder `Input` for a view whose pipeline has not been built yet.
8
- *
9
- * Until {@link attach} is called it behaves like an empty pipeline: `fetch`
10
- * yields nothing and pushes never happen. When the real pipeline is attached
11
- * the view is hydrated with a single `fetch`, whose rows are delivered to the
12
- * view as add changes, so the view sees the data exactly as it would see rows
13
- * arriving incrementally.
14
- *
15
- * This lets `materialize()` stay synchronous and return a view immediately
16
- * while the expensive pipeline construction and hydration are postponed, for
17
- * example until the client's replica has been loaded into the IVM sources.
18
- */
19
- var DeferredInput = class {
20
- #schema;
21
- #build;
22
- #output;
23
- #input;
24
- #destroyed = false;
25
- /**
26
- * @param schema The schema the built pipeline reports. Passed in so this
27
- * input can answer `getSchema()` unconditionally, as the `Input` contract
28
- * requires, before its pipeline exists.
29
- * @param build Builds the real pipeline. Called once, from {@link attach}.
30
- */
31
- constructor(schema, build) {
32
- this.#schema = schema;
33
- this.#build = build;
34
- }
35
- get attached() {
36
- return this.#input !== void 0;
37
- }
38
- get destroyed() {
39
- return this.#destroyed;
40
- }
41
- setOutput(output) {
42
- this.#output = output;
43
- this.#input?.setOutput(output);
44
- }
45
- getSchema() {
46
- return this.#schema;
47
- }
48
- fetch(req) {
49
- return this.#input ? this.#input.fetch(req) : emptyArray;
50
- }
51
- destroy() {
52
- this.#destroyed = true;
53
- this.#input?.destroy();
54
- }
55
- /**
56
- * Build the real pipeline and hydrate the output with its current contents.
57
- *
58
- * Must be called inside the delegate's `batchViewUpdates`; the delegate is
59
- * responsible for notifying commit listeners afterwards so views flush.
60
- *
61
- * If building or hydrating throws, the pipeline is torn down again and this
62
- * input stays unattached so the caller can report the failure.
63
- */
64
- attach() {
65
- assert(!this.#input, "DeferredInput: pipeline already attached");
66
- assert(!this.#destroyed, "DeferredInput: cannot attach after destroy");
67
- const input = this.#build();
68
- const output = this.#output;
69
- if (!output) {
70
- this.#input = input;
71
- return;
72
- }
73
- try {
74
- input.setOutput(output);
75
- for (const node of input.fetch({})) {
76
- if (node === "yield") continue;
77
- consume(output.push(makeAddChange(node), input));
78
- }
79
- } catch (e) {
80
- input.destroy();
81
- throw e;
82
- }
83
- this.#input = input;
84
- }
85
- };
86
- //#endregion
87
- export { DeferredInput };
88
-
89
- //# sourceMappingURL=deferred-input.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deferred-input.js","names":["#schema","#build","#input","#destroyed","#output"],"sources":["../../../../../zql/src/ivm/deferred-input.ts"],"sourcesContent":["import {assert} from '../../../shared/src/asserts.ts';\nimport {emptyArray} from '../../../shared/src/sentinels.ts';\nimport {makeAddChange} from './change.ts';\nimport type {Node} from './data.ts';\nimport type {FetchRequest, Input, Output} from './operator.ts';\nimport type {SourceSchema} from './schema.ts';\nimport {consume, type Stream} from './stream.ts';\n\n/**\n * A placeholder `Input` for a view whose pipeline has not been built yet.\n *\n * Until {@link attach} is called it behaves like an empty pipeline: `fetch`\n * yields nothing and pushes never happen. When the real pipeline is attached\n * the view is hydrated with a single `fetch`, whose rows are delivered to the\n * view as add changes, so the view sees the data exactly as it would see rows\n * arriving incrementally.\n *\n * This lets `materialize()` stay synchronous and return a view immediately\n * while the expensive pipeline construction and hydration are postponed, for\n * example until the client's replica has been loaded into the IVM sources.\n */\nexport class DeferredInput implements Input {\n readonly #schema: SourceSchema;\n readonly #build: () => Input;\n #output: Output | undefined;\n #input: Input | undefined;\n #destroyed = false;\n\n /**\n * @param schema The schema the built pipeline reports. Passed in so this\n * input can answer `getSchema()` unconditionally, as the `Input` contract\n * requires, before its pipeline exists.\n * @param build Builds the real pipeline. Called once, from {@link attach}.\n */\n constructor(schema: SourceSchema, build: () => Input) {\n this.#schema = schema;\n this.#build = build;\n }\n\n get attached(): boolean {\n return this.#input !== undefined;\n }\n\n get destroyed(): boolean {\n return this.#destroyed;\n }\n\n setOutput(output: Output): void {\n this.#output = output;\n this.#input?.setOutput(output);\n }\n\n getSchema(): SourceSchema {\n return this.#schema;\n }\n\n fetch(req: FetchRequest): Stream<Node | 'yield'> {\n return this.#input ? this.#input.fetch(req) : emptyArray;\n }\n\n destroy(): void {\n this.#destroyed = true;\n this.#input?.destroy();\n }\n\n /**\n * Build the real pipeline and hydrate the output with its current contents.\n *\n * Must be called inside the delegate's `batchViewUpdates`; the delegate is\n * responsible for notifying commit listeners afterwards so views flush.\n *\n * If building or hydrating throws, the pipeline is torn down again and this\n * input stays unattached so the caller can report the failure.\n */\n attach(): void {\n assert(!this.#input, 'DeferredInput: pipeline already attached');\n assert(!this.#destroyed, 'DeferredInput: cannot attach after destroy');\n const input = this.#build();\n const output = this.#output;\n if (!output) {\n // The view never asked for output; there is nothing to hydrate.\n this.#input = input;\n return;\n }\n try {\n input.setOutput(output);\n for (const node of input.fetch({})) {\n if (node === 'yield') {\n continue;\n }\n consume(output.push(makeAddChange(node), input));\n }\n } catch (e) {\n input.destroy();\n throw e;\n }\n this.#input = input;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqBA,IAAa,gBAAb,MAA4C;CAC1C;CACA;CACA;CACA;CACA,aAAa;;;;;;;CAQb,YAAY,QAAsB,OAAoB;EACpD,KAAKA,UAAU;EACf,KAAKC,SAAS;CAChB;CAEA,IAAI,WAAoB;EACtB,OAAO,KAAKC,WAAW,KAAA;CACzB;CAEA,IAAI,YAAqB;EACvB,OAAO,KAAKC;CACd;CAEA,UAAU,QAAsB;EAC9B,KAAKC,UAAU;EACf,KAAKF,QAAQ,UAAU,MAAM;CAC/B;CAEA,YAA0B;EACxB,OAAO,KAAKF;CACd;CAEA,MAAM,KAA2C;EAC/C,OAAO,KAAKE,SAAS,KAAKA,OAAO,MAAM,GAAG,IAAI;CAChD;CAEA,UAAgB;EACd,KAAKC,aAAa;EAClB,KAAKD,QAAQ,QAAQ;CACvB;;;;;;;;;;CAWA,SAAe;EACb,OAAO,CAAC,KAAKA,QAAQ,0CAA0C;EAC/D,OAAO,CAAC,KAAKC,YAAY,4CAA4C;EACrE,MAAM,QAAQ,KAAKF,OAAO;EAC1B,MAAM,SAAS,KAAKG;EACpB,IAAI,CAAC,QAAQ;GAEX,KAAKF,SAAS;GACd;EACF;EACA,IAAI;GACF,MAAM,UAAU,MAAM;GACtB,KAAK,MAAM,QAAQ,MAAM,MAAM,CAAC,CAAC,GAAG;IAClC,IAAI,SAAS,SACX;IAEF,QAAQ,OAAO,KAAK,cAAc,IAAI,GAAG,KAAK,CAAC;GACjD;EACF,SAAS,GAAG;GACV,MAAM,QAAQ;GACd,MAAM;EACR;EACA,KAAKA,SAAS;CAChB;AACF"}
@@ -1,59 +0,0 @@
1
- import type { NoSubqueryCondition } from '../builder/filter.ts';
2
- import type { PlannerConstraint } from './planner-constraint.ts';
3
- import type { PlanDebugger } from './planner-debug.ts';
4
- import type { CostEstimate, JoinOrConnection, PlannerNode } from './planner-node.ts';
5
- import type { PlannerTerminus } from './planner-terminus.ts';
6
- /**
7
- * Represents a simple (non-CSQ) branch of an OR in the planner graph.
8
- *
9
- * # Why this node exists
10
- * Without `PlannerFilter`, the planner would not see simple branches of an
11
- * OR at all — `processOr` historically only admitted subquery-bearing
12
- * branches into the graph. That meant the cost model never got to weigh
13
- * the per-branch filter that the runtime actually pushes down via
14
- * `FetchRequest.filter` for UFI/UFO branches.
15
- *
16
- * # What it does
17
- * - Stores the simple branch's `NoSubqueryCondition`.
18
- * - Forwards `propagateConstraints` to its input (typically a `PlannerFanOut`
19
- * leading back to a `PlannerConnection`).
20
- * - When the enclosing FanIn is in `UFI` mode, registers the condition at
21
- * the receiving `PlannerConnection` under the current `branchPattern` via
22
- * `connection.setPerBranchFilter(...)`. This lets the cost model see the
23
- * true per-branch filter at fetch time.
24
- * - In `FI` mode, registration is skipped — at runtime, FI/FO uses a
25
- * single shared scan of the source for all branches, so per-branch filters
26
- * would mis-credit the source scan cost.
27
- *
28
- * # Cost
29
- * Pass-through. The filter node itself adds no execution cost; the only
30
- * effect is at the connection layer (lower estimated rows).
31
- *
32
- * # Planner/runtime branch-count mismatch
33
- * For OR with multiple simple branches and a flipped CSQ (e.g.
34
- * `or(a=1, b=2, exists(...))`), the planner builds one `PlannerFilter` per
35
- * simple branch, but at runtime `applyFilterWithFlips` bundles all
36
- * non-flipped branches into a single source fetch with `(a=1 OR b=2)` —
37
- * one source scan, not N. In UFI mode the planner therefore models N
38
- * independent source scans against the runtime's 1, slightly inflating
39
- * the cost of OR-with-many-simples shapes. Common `or(simple, exists)`
40
- * shapes have only one simple branch and are unaffected.
41
- */
42
- export declare class PlannerFilter {
43
- #private;
44
- readonly kind: "filter";
45
- constructor(input: Exclude<PlannerNode, PlannerTerminus>, condition: NoSubqueryCondition | undefined);
46
- setOutput(node: PlannerNode): void;
47
- get output(): PlannerNode;
48
- closestJoinOrSource(): JoinOrConnection;
49
- propagateConstraints(branchPattern: number[], constraint: PlannerConstraint | undefined, from?: PlannerNode, planDebugger?: PlanDebugger): void;
50
- estimateCost(downstreamChildSelectivity: number, branchPattern: number[], planDebugger?: PlanDebugger): CostEstimate;
51
- /**
52
- * Forward unlimit propagation along the parent chain (toward the source).
53
- */
54
- propagateUnlimitFromFlippedJoin(): void;
55
- reset(): void;
56
- /** For debugging. */
57
- getConditionForDebug(): NoSubqueryCondition | undefined;
58
- }
59
- //# sourceMappingURL=planner-filter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-filter.d.ts","sourceRoot":"","sources":["../../../../../zql/src/planner/planner-filter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,sBAAsB,CAAC;AAE9D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,aAAa;;IACxB,QAAQ,CAAC,IAAI,EAAG,QAAQ,CAAU;gBAMhC,KAAK,EAAE,OAAO,CAAC,WAAW,EAAE,eAAe,CAAC,EAC5C,SAAS,EAAE,mBAAmB,GAAG,SAAS;IAM5C,SAAS,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAIlC,IAAI,MAAM,IAAI,WAAW,CAGxB;IAED,mBAAmB,IAAI,gBAAgB;IAIvC,oBAAoB,CAClB,aAAa,EAAE,MAAM,EAAE,EACvB,UAAU,EAAE,iBAAiB,GAAG,SAAS,EACzC,IAAI,CAAC,EAAE,WAAW,EAClB,YAAY,CAAC,EAAE,YAAY,GAC1B,IAAI;IA8BP,YAAY,CACV,0BAA0B,EAAE,MAAM,EAClC,aAAa,EAAE,MAAM,EAAE,EACvB,YAAY,CAAC,EAAE,YAAY,GAC1B,YAAY;IAqBf;;OAEG;IACH,+BAA+B,IAAI,IAAI;IAWvC,KAAK,IAAI,IAAI;IAMb,qBAAqB;IACrB,oBAAoB,IAAI,mBAAmB,GAAG,SAAS;CAGxD"}
@@ -1,116 +0,0 @@
1
- import { assert } from "../../../shared/src/asserts.js";
2
- import { omitFanout } from "./planner-node.js";
3
- //#region ../zql/src/planner/planner-filter.ts
4
- /**
5
- * Represents a simple (non-CSQ) branch of an OR in the planner graph.
6
- *
7
- * # Why this node exists
8
- * Without `PlannerFilter`, the planner would not see simple branches of an
9
- * OR at all — `processOr` historically only admitted subquery-bearing
10
- * branches into the graph. That meant the cost model never got to weigh
11
- * the per-branch filter that the runtime actually pushes down via
12
- * `FetchRequest.filter` for UFI/UFO branches.
13
- *
14
- * # What it does
15
- * - Stores the simple branch's `NoSubqueryCondition`.
16
- * - Forwards `propagateConstraints` to its input (typically a `PlannerFanOut`
17
- * leading back to a `PlannerConnection`).
18
- * - When the enclosing FanIn is in `UFI` mode, registers the condition at
19
- * the receiving `PlannerConnection` under the current `branchPattern` via
20
- * `connection.setPerBranchFilter(...)`. This lets the cost model see the
21
- * true per-branch filter at fetch time.
22
- * - In `FI` mode, registration is skipped — at runtime, FI/FO uses a
23
- * single shared scan of the source for all branches, so per-branch filters
24
- * would mis-credit the source scan cost.
25
- *
26
- * # Cost
27
- * Pass-through. The filter node itself adds no execution cost; the only
28
- * effect is at the connection layer (lower estimated rows).
29
- *
30
- * # Planner/runtime branch-count mismatch
31
- * For OR with multiple simple branches and a flipped CSQ (e.g.
32
- * `or(a=1, b=2, exists(...))`), the planner builds one `PlannerFilter` per
33
- * simple branch, but at runtime `applyFilterWithFlips` bundles all
34
- * non-flipped branches into a single source fetch with `(a=1 OR b=2)` —
35
- * one source scan, not N. In UFI mode the planner therefore models N
36
- * independent source scans against the runtime's 1, slightly inflating
37
- * the cost of OR-with-many-simples shapes. Common `or(simple, exists)`
38
- * shapes have only one simple branch and are unaffected.
39
- */
40
- var PlannerFilter = class {
41
- kind = "filter";
42
- #input;
43
- #condition;
44
- #output;
45
- constructor(input, condition) {
46
- this.#input = input;
47
- this.#condition = condition;
48
- }
49
- setOutput(node) {
50
- this.#output = node;
51
- }
52
- get output() {
53
- assert(this.#output !== void 0, "Output not set");
54
- return this.#output;
55
- }
56
- closestJoinOrSource() {
57
- return this.#input.closestJoinOrSource();
58
- }
59
- propagateConstraints(branchPattern, constraint, from, planDebugger) {
60
- planDebugger?.log({
61
- type: "node-constraint",
62
- nodeType: "filter",
63
- node: "filter",
64
- branchPattern,
65
- constraint,
66
- from: from?.kind ?? "unknown"
67
- });
68
- if (this.#condition && from?.kind === "fan-in" && from.type === "UFI") {
69
- const conn = findParentConnection(this.#input);
70
- if (conn) conn.setPerBranchFilter(branchPattern, this.#condition);
71
- }
72
- this.#input.propagateConstraints(branchPattern, constraint, this, planDebugger);
73
- }
74
- estimateCost(downstreamChildSelectivity, branchPattern, planDebugger) {
75
- const cost = this.#input.estimateCost(downstreamChildSelectivity, branchPattern, planDebugger);
76
- if (planDebugger) planDebugger.log({
77
- type: "node-cost",
78
- nodeType: "filter",
79
- node: "filter",
80
- branchPattern,
81
- downstreamChildSelectivity,
82
- costEstimate: omitFanout(cost)
83
- });
84
- return cost;
85
- }
86
- /**
87
- * Forward unlimit propagation along the parent chain (toward the source).
88
- */
89
- propagateUnlimitFromFlippedJoin() {
90
- if ("propagateUnlimitFromFlippedJoin" in this.#input && typeof this.#input.propagateUnlimitFromFlippedJoin === "function") this.#input.propagateUnlimitFromFlippedJoin();
91
- }
92
- reset() {}
93
- /** For debugging. */
94
- getConditionForDebug() {
95
- return this.#condition;
96
- }
97
- };
98
- /**
99
- * Walk the input chain (toward the source) looking for the first
100
- * `PlannerConnection`. The simple branch's filter is meant to land on the
101
- * connection that the FanOut wraps — for nested AST shapes, that may be
102
- * several joins above.
103
- */
104
- function findParentConnection(node) {
105
- switch (node.kind) {
106
- case "connection": return node;
107
- case "fan-out": return findParentConnection(node.input);
108
- case "join": return findParentConnection(node.parent);
109
- case "fan-in": return;
110
- case "filter": return;
111
- }
112
- }
113
- //#endregion
114
- export { PlannerFilter };
115
-
116
- //# sourceMappingURL=planner-filter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"planner-filter.js","names":["#input","#condition","#output"],"sources":["../../../../../zql/src/planner/planner-filter.ts"],"sourcesContent":["import {assert} from '../../../shared/src/asserts.ts';\nimport type {NoSubqueryCondition} from '../builder/filter.ts';\nimport type {PlannerConnection} from './planner-connection.ts';\nimport type {PlannerConstraint} from './planner-constraint.ts';\nimport type {PlanDebugger} from './planner-debug.ts';\nimport {omitFanout} from './planner-node.ts';\nimport type {\n CostEstimate,\n JoinOrConnection,\n PlannerNode,\n} from './planner-node.ts';\nimport type {PlannerTerminus} from './planner-terminus.ts';\n\n/**\n * Represents a simple (non-CSQ) branch of an OR in the planner graph.\n *\n * # Why this node exists\n * Without `PlannerFilter`, the planner would not see simple branches of an\n * OR at all — `processOr` historically only admitted subquery-bearing\n * branches into the graph. That meant the cost model never got to weigh\n * the per-branch filter that the runtime actually pushes down via\n * `FetchRequest.filter` for UFI/UFO branches.\n *\n * # What it does\n * - Stores the simple branch's `NoSubqueryCondition`.\n * - Forwards `propagateConstraints` to its input (typically a `PlannerFanOut`\n * leading back to a `PlannerConnection`).\n * - When the enclosing FanIn is in `UFI` mode, registers the condition at\n * the receiving `PlannerConnection` under the current `branchPattern` via\n * `connection.setPerBranchFilter(...)`. This lets the cost model see the\n * true per-branch filter at fetch time.\n * - In `FI` mode, registration is skipped — at runtime, FI/FO uses a\n * single shared scan of the source for all branches, so per-branch filters\n * would mis-credit the source scan cost.\n *\n * # Cost\n * Pass-through. The filter node itself adds no execution cost; the only\n * effect is at the connection layer (lower estimated rows).\n *\n * # Planner/runtime branch-count mismatch\n * For OR with multiple simple branches and a flipped CSQ (e.g.\n * `or(a=1, b=2, exists(...))`), the planner builds one `PlannerFilter` per\n * simple branch, but at runtime `applyFilterWithFlips` bundles all\n * non-flipped branches into a single source fetch with `(a=1 OR b=2)` —\n * one source scan, not N. In UFI mode the planner therefore models N\n * independent source scans against the runtime's 1, slightly inflating\n * the cost of OR-with-many-simples shapes. Common `or(simple, exists)`\n * shapes have only one simple branch and are unaffected.\n */\nexport class PlannerFilter {\n readonly kind = 'filter' as const;\n readonly #input: Exclude<PlannerNode, PlannerTerminus>;\n readonly #condition: NoSubqueryCondition | undefined;\n #output?: PlannerNode | undefined;\n\n constructor(\n input: Exclude<PlannerNode, PlannerTerminus>,\n condition: NoSubqueryCondition | undefined,\n ) {\n this.#input = input;\n this.#condition = condition;\n }\n\n setOutput(node: PlannerNode): void {\n this.#output = node;\n }\n\n get output(): PlannerNode {\n assert(this.#output !== undefined, 'Output not set');\n return this.#output;\n }\n\n closestJoinOrSource(): JoinOrConnection {\n return this.#input.closestJoinOrSource();\n }\n\n propagateConstraints(\n branchPattern: number[],\n constraint: PlannerConstraint | undefined,\n from?: PlannerNode,\n planDebugger?: PlanDebugger,\n ): void {\n planDebugger?.log({\n type: 'node-constraint',\n nodeType: 'filter',\n node: 'filter',\n branchPattern,\n constraint,\n from: from?.kind ?? 'unknown',\n });\n\n // Only register the per-branch filter when we're actually going to do\n // a per-branch fetch at runtime — i.e., when our enclosing FanIn is in\n // UFI mode. In FI mode, all branches share a single source scan, so\n // applying our filter at the source would drop rows that other\n // branches need.\n if (this.#condition && from?.kind === 'fan-in' && from.type === 'UFI') {\n const conn = findParentConnection(this.#input);\n if (conn) {\n conn.setPerBranchFilter(branchPattern, this.#condition);\n }\n }\n\n this.#input.propagateConstraints(\n branchPattern,\n constraint,\n this,\n planDebugger,\n );\n }\n\n estimateCost(\n downstreamChildSelectivity: number,\n branchPattern: number[],\n planDebugger?: PlanDebugger,\n ): CostEstimate {\n const cost = this.#input.estimateCost(\n downstreamChildSelectivity,\n branchPattern,\n planDebugger,\n );\n\n if (planDebugger) {\n planDebugger.log({\n type: 'node-cost',\n nodeType: 'filter',\n node: 'filter',\n branchPattern,\n downstreamChildSelectivity,\n costEstimate: omitFanout(cost),\n });\n }\n\n return cost;\n }\n\n /**\n * Forward unlimit propagation along the parent chain (toward the source).\n */\n propagateUnlimitFromFlippedJoin(): void {\n if (\n 'propagateUnlimitFromFlippedJoin' in this.#input &&\n typeof this.#input.propagateUnlimitFromFlippedJoin === 'function'\n ) {\n (\n this.#input as {propagateUnlimitFromFlippedJoin(): void}\n ).propagateUnlimitFromFlippedJoin();\n }\n }\n\n reset(): void {\n // No mutable structural state. Per-branch filters are re-registered on\n // every propagation pass, and PlannerConnection clears its\n // #perBranchFilters in its own reset().\n }\n\n /** For debugging. */\n getConditionForDebug(): NoSubqueryCondition | undefined {\n return this.#condition;\n }\n}\n\n/**\n * Walk the input chain (toward the source) looking for the first\n * `PlannerConnection`. The simple branch's filter is meant to land on the\n * connection that the FanOut wraps — for nested AST shapes, that may be\n * several joins above.\n */\nfunction findParentConnection(\n node: Exclude<PlannerNode, PlannerTerminus>,\n): PlannerConnection | undefined {\n switch (node.kind) {\n case 'connection':\n return node;\n case 'fan-out':\n return findParentConnection(node.input);\n case 'join':\n return findParentConnection(node.parent);\n case 'fan-in':\n // Reaching a FanIn while walking up means the simple branch sits\n // above a nested OR/UFI. The connection that matters for *this*\n // simple branch's filter is the one feeding the outer FanOut, but\n // from a nested FanIn we don't have a single input to walk through.\n // Be conservative: don't register, accept that deeply nested OR\n // shapes lose this optimization.\n return undefined;\n case 'filter':\n // Shouldn't occur in graphs built by `processOr` — a PlannerFilter's\n // input is always the FanOut it's a branch of, never another filter.\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,IAAa,gBAAb,MAA2B;CACzB,OAAgB;CAChB;CACA;CACA;CAEA,YACE,OACA,WACA;EACA,KAAKA,SAAS;EACd,KAAKC,aAAa;CACpB;CAEA,UAAU,MAAyB;EACjC,KAAKC,UAAU;CACjB;CAEA,IAAI,SAAsB;EACxB,OAAO,KAAKA,YAAY,KAAA,GAAW,gBAAgB;EACnD,OAAO,KAAKA;CACd;CAEA,sBAAwC;EACtC,OAAO,KAAKF,OAAO,oBAAoB;CACzC;CAEA,qBACE,eACA,YACA,MACA,cACM;EACN,cAAc,IAAI;GAChB,MAAM;GACN,UAAU;GACV,MAAM;GACN;GACA;GACA,MAAM,MAAM,QAAQ;EACtB,CAAC;EAOD,IAAI,KAAKC,cAAc,MAAM,SAAS,YAAY,KAAK,SAAS,OAAO;GACrE,MAAM,OAAO,qBAAqB,KAAKD,MAAM;GAC7C,IAAI,MACF,KAAK,mBAAmB,eAAe,KAAKC,UAAU;EAE1D;EAEA,KAAKD,OAAO,qBACV,eACA,YACA,MACA,YACF;CACF;CAEA,aACE,4BACA,eACA,cACc;EACd,MAAM,OAAO,KAAKA,OAAO,aACvB,4BACA,eACA,YACF;EAEA,IAAI,cACF,aAAa,IAAI;GACf,MAAM;GACN,UAAU;GACV,MAAM;GACN;GACA;GACA,cAAc,WAAW,IAAI;EAC/B,CAAC;EAGH,OAAO;CACT;;;;CAKA,kCAAwC;EACtC,IACE,qCAAqC,KAAKA,UAC1C,OAAO,KAAKA,OAAO,oCAAoC,YAEvD,KACOA,OACL,gCAAgC;CAEtC;CAEA,QAAc,CAId;;CAGA,uBAAwD;EACtD,OAAO,KAAKC;CACd;AACF;;;;;;;AAQA,SAAS,qBACP,MAC+B;CAC/B,QAAQ,KAAK,MAAb;EACE,KAAK,cACH,OAAO;EACT,KAAK,WACH,OAAO,qBAAqB,KAAK,KAAK;EACxC,KAAK,QACH,OAAO,qBAAqB,KAAK,MAAM;EACzC,KAAK,UAOH;EACF,KAAK,UAGH;CACJ;AACF"}