@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 +1 @@
1
- {"version":3,"file":"replicache-options.d.ts","sourceRoot":"","sources":["../../../../replicache/src/replicache-options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAE,OAAO,EAAC,MAAM,kBA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CAAC;AAElD,MAAM,MAAM,eAAe,CACzB,OAAO,SAAS,WAAW,EAC3B,CAAC,IACC,OAAO,SAAS,gBAAgB,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC;AAiB5E,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,kBAAkB,GAAG,SAAS,GACtC,MAAM,CAUR"}
@@ -110,7 +110,7 @@ var WriteTransactionImpl = class extends ReadTransactionImpl {
110
110
  };
111
111
  function getScanIterator(dbRead, options) {
112
112
  if (options && isScanIndexOptions(options)) return getScanIteratorForIndexMap(dbRead, options);
113
- return dbRead.map.scan(fromKeyForNonIndexScan(options), false);
113
+ return dbRead.map.scan(fromKeyForNonIndexScan(options));
114
114
  }
115
115
  function fromKeyForNonIndexScan(options) {
116
116
  if (!options) return "";
@@ -1 +1 @@
1
- {"version":3,"file":"transactions.js","names":["#keys","#scans","#tx"],"sources":["../../../../replicache/src/transactions.ts"],"sourcesContent":["import './process-env.ts';\nimport type {LogContext} from '@rocicorp/logger';\nimport {greaterThan} from 'compare-utf8';\nimport type {JSONValue, ReadonlyJSONValue} from '../../shared/src/json.ts';\nimport {type IndexKey, decodeIndexKey} from './db/index.ts';\nimport type {Read} from './db/read.ts';\nimport type {Write} from './db/write.ts';\nimport {deepFreeze} from './frozen-json.ts';\nimport type {IndexDefinition} from './index-defs.ts';\nimport type {ZeroTxData} from './replicache-options.ts';\nimport type {ScanResult} from './scan-iterator.ts';\nimport {ScanResultImpl, fromKeyForIndexScanInternal} from './scan-iterator.ts';\nimport {\n type KeyTypeForScanOptions,\n type ScanIndexOptions,\n type ScanNoIndexOptions,\n type ScanOptions,\n isScanIndexOptions,\n toDbScanOptions,\n} from './scan-options.ts';\nimport type {ScanSubscriptionInfo} from './subscriptions.ts';\nimport type {ClientID} from './sync/ids.ts';\nimport {rejectIfClosed, throwIfClosed} from './transaction-closed-error.ts';\n\nexport type TransactionEnvironment = 'client' | 'server';\nexport type TransactionLocation = TransactionEnvironment;\nexport type TransactionReason = 'initial' | 'rebase' | 'authoritative';\n\n/**\n * Basic deep readonly type. It works for {@link JSONValue}.\n */\nexport type DeepReadonly<T> = T extends\n | null\n | boolean\n | string\n | number\n | undefined\n ? T\n : DeepReadonlyObject<T>;\n\nexport type DeepReadonlyObject<T> = {\n readonly [K in keyof T]: DeepReadonly<T[K]>;\n};\n\n/**\n * ReadTransactions are used with {@link Replicache.query} and\n * {@link Replicache.subscribe} and allows read operations on the\n * database.\n */\nexport interface ReadTransaction {\n readonly clientID: ClientID;\n /** @deprecated Use {@link ReadTransaction.location} instead. */\n readonly environment: TransactionLocation;\n readonly location: TransactionLocation;\n\n /**\n * Get a single value from the database. If the `key` is not present this\n * returns `undefined`.\n *\n * Important: The returned JSON is readonly and should not be modified. This\n * is only enforced statically by TypeScript and there are no runtime checks\n * for performance reasons. If you mutate the return value you will get\n * undefined behavior.\n */\n\n get(key: string): Promise<ReadonlyJSONValue | undefined>;\n get<T extends JSONValue>(key: string): Promise<DeepReadonly<T> | undefined>;\n\n /** Determines if a single `key` is present in the database. */\n has(key: string): Promise<boolean>;\n\n /** Whether the database is empty. */\n isEmpty(): Promise<boolean>;\n\n /**\n * Gets many values from the database. This returns a {@link ScanResult} which\n * implements `AsyncIterable`. It also has methods to iterate over the\n * {@link ScanResult.keys | keys} and {@link ScanResult.entries | entries}.\n *\n * If `options` has an `indexName`, then this does a scan over an index with\n * that name. A scan over an index uses a tuple for the key consisting of\n * `[secondary: string, primary: string]`.\n *\n * If the {@link ScanResult} is used after the `ReadTransaction` has been closed\n * it will throw a {@link TransactionClosedError}.\n *\n * Important: The returned JSON is readonly and should not be modified. This\n * is only enforced statically by TypeScript and there are no runtime checks\n * for performance reasons. If you mutate the return value you will get\n * undefined behavior.\n */\n scan(options: ScanIndexOptions): ScanResult<IndexKey, ReadonlyJSONValue>;\n scan(options?: ScanNoIndexOptions): ScanResult<string, ReadonlyJSONValue>;\n scan(options?: ScanOptions): ScanResult<IndexKey | string, ReadonlyJSONValue>;\n\n scan<V extends ReadonlyJSONValue>(\n options: ScanIndexOptions,\n ): ScanResult<IndexKey, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanNoIndexOptions,\n ): ScanResult<string, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, DeepReadonly<V>>;\n}\n\nlet transactionIDCounter = 0;\n\nexport class ReadTransactionImpl implements ReadTransaction {\n readonly clientID: ClientID;\n readonly dbtx: Read;\n protected readonly _lc: LogContext;\n\n /**\n * The location in which this transaction is being used. This is either `client` or `server`.\n */\n readonly location: TransactionLocation;\n /** @deprecated Use {@link ReadTransaction.location} instead. */\n readonly environment: TransactionLocation;\n\n constructor(\n clientID: ClientID,\n dbRead: Read,\n lc: LogContext,\n rpcName = 'openReadTransaction',\n ) {\n this.clientID = clientID;\n this.dbtx = dbRead;\n this._lc = lc\n .withContext(rpcName)\n .withContext('txid', transactionIDCounter++);\n this.environment = 'client';\n this.location = 'client';\n }\n\n get(key: string): Promise<ReadonlyJSONValue | undefined>;\n get<V extends JSONValue>(key: string): Promise<DeepReadonly<V> | undefined> {\n return (\n rejectIfClosed(this.dbtx) ||\n (this.dbtx.get(key) as Promise<DeepReadonly<V> | undefined>)\n );\n }\n\n // oxlint-disable-next-line require-await\n async has(key: string): Promise<boolean> {\n throwIfClosed(this.dbtx);\n return this.dbtx.has(key);\n }\n\n // oxlint-disable-next-line require-await\n async isEmpty(): Promise<boolean> {\n throwIfClosed(this.dbtx);\n return this.dbtx.isEmpty();\n }\n\n scan(options: ScanIndexOptions): ScanResult<IndexKey, ReadonlyJSONValue>;\n scan(options?: ScanNoIndexOptions): ScanResult<string, ReadonlyJSONValue>;\n scan(options?: ScanOptions): ScanResult<IndexKey | string, ReadonlyJSONValue>;\n\n scan<V extends ReadonlyJSONValue>(\n options: ScanIndexOptions,\n ): ScanResult<IndexKey, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanNoIndexOptions,\n ): ScanResult<string, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, DeepReadonly<V>>;\n\n scan(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, ReadonlyJSONValue> {\n return scan(options, this.dbtx, noop);\n }\n}\n\nfunction noop(_: unknown): void {\n // empty\n}\n\nfunction scan<Options extends ScanOptions, V extends JSONValue>(\n options: Options | undefined,\n dbRead: Read,\n onLimitKey: (inclusiveLimitKey: string) => void,\n): ScanResult<KeyTypeForScanOptions<Options>, V> {\n const iter = getScanIterator<Options, V>(dbRead, options);\n return makeScanResultFromScanIteratorInternal(\n iter,\n options ?? ({} as Options),\n dbRead,\n onLimitKey,\n );\n}\n\n// An implementation of ReadTransaction that keeps track of `keys` and `scans`\n// for use with Subscriptions.\nexport class SubscriptionTransactionWrapper implements ReadTransaction {\n readonly #keys: Set<string> = new Set();\n readonly #scans: ScanSubscriptionInfo[] = [];\n readonly #tx: ReadTransactionImpl;\n\n constructor(tx: ReadTransactionImpl) {\n this.#tx = tx;\n }\n\n get environment(): TransactionLocation {\n return this.#tx.location;\n }\n\n get location(): TransactionLocation {\n return this.#tx.location;\n }\n\n get clientID(): string {\n return this.#tx.clientID;\n }\n\n isEmpty(): Promise<boolean> {\n // Any change to the subscription requires rerunning it.\n this.#scans.push({options: {}});\n return this.#tx.isEmpty();\n }\n\n get(key: string): Promise<ReadonlyJSONValue | undefined>;\n get<T extends JSONValue>(key: string): Promise<DeepReadonly<T> | undefined> {\n this.#keys.add(key);\n return this.#tx.get(key) as Promise<DeepReadonly<T> | undefined>;\n }\n\n has(key: string): Promise<boolean> {\n this.#keys.add(key);\n return this.#tx.has(key);\n }\n\n scan(options: ScanIndexOptions): ScanResult<IndexKey, ReadonlyJSONValue>;\n scan(options?: ScanNoIndexOptions): ScanResult<string, ReadonlyJSONValue>;\n scan(options?: ScanOptions): ScanResult<IndexKey | string, ReadonlyJSONValue>;\n\n scan<V extends ReadonlyJSONValue>(\n options: ScanIndexOptions,\n ): ScanResult<IndexKey, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanNoIndexOptions,\n ): ScanResult<string, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, DeepReadonly<V>>;\n\n scan(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, ReadonlyJSONValue> {\n const scanInfo: ScanSubscriptionInfo = {\n options: toDbScanOptions(options),\n inclusiveLimitKey: undefined,\n };\n this.#scans.push(scanInfo);\n return scan(options, this.#tx.dbtx, inclusiveLimitKey => {\n scanInfo.inclusiveLimitKey = inclusiveLimitKey;\n });\n }\n\n get keys(): ReadonlySet<string> {\n return this.#keys;\n }\n\n get scans(): ScanSubscriptionInfo[] {\n return this.#scans;\n }\n}\n\n/**\n * WriteTransactions are used with *mutators* which are registered using\n * {@link ReplicacheOptions.mutators} and allows read and write operations on the\n * database.\n */\nexport interface WriteTransaction extends ReadTransaction {\n /**\n * The ID of the mutation that is being applied.\n */\n readonly mutationID: number;\n\n /**\n * The reason for the transaction. This can be `initial`, `rebase` or `authoriative`.\n */\n readonly reason: TransactionReason;\n\n /**\n * Sets a single `value` in the database. The value will be frozen (using\n * `Object.freeze`) in debug mode.\n */\n set(key: string, value: ReadonlyJSONValue): Promise<void>;\n\n /**\n * @deprecated Use {@link WriteTransaction.set} instead.\n */\n put(key: string, value: ReadonlyJSONValue): Promise<void>;\n\n /**\n * Removes a `key` and its value from the database. Returns `true` if there was a\n * `key` to remove.\n */\n del(key: string): Promise<boolean>;\n}\n\n// Internal symbol, not exported by Replicache\n// but accessible to Zero.\nexport const zeroData = Symbol();\n\nexport class WriteTransactionImpl\n extends ReadTransactionImpl\n implements WriteTransaction\n{\n // use `declare` to specialize the type.\n declare readonly dbtx: Write;\n readonly reason: TransactionReason;\n readonly mutationID: number;\n readonly [zeroData]: ZeroTxData | undefined;\n\n constructor(\n clientID: ClientID,\n mutationID: number,\n reason: TransactionReason,\n zData: ZeroTxData | undefined,\n dbWrite: Write,\n lc: LogContext,\n rpcName = 'openWriteTransaction',\n ) {\n super(clientID, dbWrite, lc, rpcName);\n this.mutationID = mutationID;\n this.reason = reason;\n this[zeroData] = zData;\n }\n\n put(key: string, value: ReadonlyJSONValue): Promise<void> {\n return this.set(key, value);\n }\n\n async set(key: string, value: ReadonlyJSONValue): Promise<void> {\n throwIfClosed(this.dbtx);\n await this.dbtx.put(this._lc, key, deepFreeze(value));\n }\n\n del(key: string): Promise<boolean> {\n return rejectIfClosed(this.dbtx) ?? this.dbtx.del(this._lc, key);\n }\n}\n\nexport type CreateIndexDefinition = IndexDefinition & {name: string};\n\ntype Entry<Key, Value> = readonly [key: Key, value: Value];\n\ntype IndexKeyEntry<Value> = Entry<IndexKey, Value>;\n\ntype StringKeyEntry<Value> = Entry<string, Value>;\n\nexport type EntryForOptions<\n Options extends ScanOptions,\n V,\n> = Options extends ScanIndexOptions ? IndexKeyEntry<V> : StringKeyEntry<V>;\n\nfunction getScanIterator<Options extends ScanOptions, V>(\n dbRead: Read,\n options: Options | undefined,\n): AsyncIterable<EntryForOptions<Options, V>> {\n if (options && isScanIndexOptions(options)) {\n return getScanIteratorForIndexMap(dbRead, options) as AsyncIterable<\n EntryForOptions<Options, V>\n >;\n }\n\n return dbRead.map.scan(\n fromKeyForNonIndexScan(options),\n false,\n ) as AsyncIterable<EntryForOptions<Options, V>>;\n}\n\nexport function fromKeyForNonIndexScan(\n options: ScanNoIndexOptions | undefined,\n): string {\n if (!options) {\n return '';\n }\n\n const {prefix = '', start} = options;\n if (start && greaterThan(start.key, prefix)) {\n return start.key;\n }\n return prefix;\n}\n\nfunction makeScanResultFromScanIteratorInternal<\n Options extends ScanOptions,\n V extends JSONValue,\n>(\n iter: AsyncIterable<EntryForOptions<Options, V>>,\n options: Options,\n dbRead: Read,\n onLimitKey: (inclusiveLimitKey: string) => void,\n): ScanResult<KeyTypeForScanOptions<Options>, V> {\n return new ScanResultImpl(iter, options, dbRead, onLimitKey);\n}\n\nasync function* getScanIteratorForIndexMap(\n dbRead: Read,\n options: ScanIndexOptions,\n): AsyncIterable<IndexKeyEntry<ReadonlyJSONValue>> {\n if (process.env.DISABLE_REPLICACHE_INDEXES) {\n // Indexes are compiled out of this build so no index name ever exists.\n // Thrown here (inside the generator) so that the error surfaces on first\n // iteration, matching getMapForIndex — tx.scan() itself never throws.\n throw new Error(`Unknown index name: ${options.indexName}`);\n }\n const map = dbRead.getMapForIndex(options.indexName);\n for await (const entry of map.scan(\n fromKeyForIndexScanInternal(options),\n false,\n )) {\n yield [decodeIndexKey(entry[0]), entry[1]];\n }\n}\n"],"mappings":";;;;;;AA0GA,IAAI,uBAAuB;AAE3B,IAAa,sBAAb,MAA4D;CAC1D;CACA;CACA;;;;CAKA;;CAEA;CAEA,YACE,UACA,QACA,IACA,UAAU,uBACV;EACA,KAAK,WAAW;EAChB,KAAK,OAAO;EACZ,KAAK,MAAM,GACR,YAAY,OAAO,EACnB,YAAY,QAAQ,sBAAsB;EAC7C,KAAK,cAAc;EACnB,KAAK,WAAW;CAClB;CAGA,IAAyB,KAAmD;EAC1E,OACE,eAAe,KAAK,IAAI,KACvB,KAAK,KAAK,IAAI,GAAG;CAEtB;CAGA,MAAM,IAAI,KAA+B;EACvC,cAAc,KAAK,IAAI;EACvB,OAAO,KAAK,KAAK,IAAI,GAAG;CAC1B;CAGA,MAAM,UAA4B;EAChC,cAAc,KAAK,IAAI;EACvB,OAAO,KAAK,KAAK,QAAQ;CAC3B;CAgBA,KACE,SACkD;EAClD,OAAO,KAAK,SAAS,KAAK,MAAM,IAAI;CACtC;AACF;AAEA,SAAS,KAAK,GAAkB,CAEhC;AAEA,SAAS,KACP,SACA,QACA,YAC+C;CAE/C,OAAO,uCADM,gBAA4B,QAAQ,OAE/C,GACA,WAAY,CAAC,GACb,QACA,UACF;AACF;AAIA,IAAa,iCAAb,MAA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AAI,KAAK,KAAK,KAAK,WAAW,KAAK,CAAC;CACtD;CAEA,IAAI,KAA+B;EACjC,OAAO,eAAe,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,GAAG;CACjE;AACF;AAeA,SAAS,gBACP,QACA,SAC4C;CAC5C,IAAI,WAAW,mBAAmB,OAAO,GACvC,OAAO,2BAA2B,QAAQ,OAAO;CAKnD,OAAO,OAAO,IAAI,KAChB,uBAAuB,OAAO,GAC9B,KACF;AACF;AAEA,SAAgB,uBACd,SACQ;CACR,IAAI,CAAC,SACH,OAAO;CAGT,MAAM,EAAC,SAAS,IAAI,UAAS;CAC7B,IAAI,SAAS,YAAY,MAAM,KAAK,MAAM,GACxC,OAAO,MAAM;CAEf,OAAO;AACT;AAEA,SAAS,uCAIP,MACA,SACA,QACA,YAC+C;CAC/C,OAAO,IAAI,eAAe,MAAM,SAAS,QAAQ,UAAU;AAC7D;AAEA,gBAAgB,2BACd,QACA,SACiD;CAK/C,MAAM,IAAI,MAAM,uBAAuB,QAAQ,WAAW;AAS9D"}
1
+ {"version":3,"file":"transactions.js","names":["#keys","#scans","#tx"],"sources":["../../../../replicache/src/transactions.ts"],"sourcesContent":["import './process-env.ts';\nimport type {LogContext} from '@rocicorp/logger';\nimport {greaterThan} from 'compare-utf8';\nimport type {JSONValue, ReadonlyJSONValue} from '../../shared/src/json.ts';\nimport {type IndexKey, decodeIndexKey} from './db/index.ts';\nimport type {Read} from './db/read.ts';\nimport type {Write} from './db/write.ts';\nimport {deepFreeze} from './frozen-json.ts';\nimport type {IndexDefinition} from './index-defs.ts';\nimport type {ZeroTxData} from './replicache-options.ts';\nimport type {ScanResult} from './scan-iterator.ts';\nimport {ScanResultImpl, fromKeyForIndexScanInternal} from './scan-iterator.ts';\nimport {\n type KeyTypeForScanOptions,\n type ScanIndexOptions,\n type ScanNoIndexOptions,\n type ScanOptions,\n isScanIndexOptions,\n toDbScanOptions,\n} from './scan-options.ts';\nimport type {ScanSubscriptionInfo} from './subscriptions.ts';\nimport type {ClientID} from './sync/ids.ts';\nimport {rejectIfClosed, throwIfClosed} from './transaction-closed-error.ts';\n\nexport type TransactionEnvironment = 'client' | 'server';\nexport type TransactionLocation = TransactionEnvironment;\nexport type TransactionReason = 'initial' | 'rebase' | 'authoritative';\n\n/**\n * Basic deep readonly type. It works for {@link JSONValue}.\n */\nexport type DeepReadonly<T> = T extends\n | null\n | boolean\n | string\n | number\n | undefined\n ? T\n : DeepReadonlyObject<T>;\n\nexport type DeepReadonlyObject<T> = {\n readonly [K in keyof T]: DeepReadonly<T[K]>;\n};\n\n/**\n * ReadTransactions are used with {@link Replicache.query} and\n * {@link Replicache.subscribe} and allows read operations on the\n * database.\n */\nexport interface ReadTransaction {\n readonly clientID: ClientID;\n /** @deprecated Use {@link ReadTransaction.location} instead. */\n readonly environment: TransactionLocation;\n readonly location: TransactionLocation;\n\n /**\n * Get a single value from the database. If the `key` is not present this\n * returns `undefined`.\n *\n * Important: The returned JSON is readonly and should not be modified. This\n * is only enforced statically by TypeScript and there are no runtime checks\n * for performance reasons. If you mutate the return value you will get\n * undefined behavior.\n */\n\n get(key: string): Promise<ReadonlyJSONValue | undefined>;\n get<T extends JSONValue>(key: string): Promise<DeepReadonly<T> | undefined>;\n\n /** Determines if a single `key` is present in the database. */\n has(key: string): Promise<boolean>;\n\n /** Whether the database is empty. */\n isEmpty(): Promise<boolean>;\n\n /**\n * Gets many values from the database. This returns a {@link ScanResult} which\n * implements `AsyncIterable`. It also has methods to iterate over the\n * {@link ScanResult.keys | keys} and {@link ScanResult.entries | entries}.\n *\n * If `options` has an `indexName`, then this does a scan over an index with\n * that name. A scan over an index uses a tuple for the key consisting of\n * `[secondary: string, primary: string]`.\n *\n * If the {@link ScanResult} is used after the `ReadTransaction` has been closed\n * it will throw a {@link TransactionClosedError}.\n *\n * Important: The returned JSON is readonly and should not be modified. This\n * is only enforced statically by TypeScript and there are no runtime checks\n * for performance reasons. If you mutate the return value you will get\n * undefined behavior.\n */\n scan(options: ScanIndexOptions): ScanResult<IndexKey, ReadonlyJSONValue>;\n scan(options?: ScanNoIndexOptions): ScanResult<string, ReadonlyJSONValue>;\n scan(options?: ScanOptions): ScanResult<IndexKey | string, ReadonlyJSONValue>;\n\n scan<V extends ReadonlyJSONValue>(\n options: ScanIndexOptions,\n ): ScanResult<IndexKey, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanNoIndexOptions,\n ): ScanResult<string, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, DeepReadonly<V>>;\n}\n\nlet transactionIDCounter = 0;\n\nexport class ReadTransactionImpl implements ReadTransaction {\n readonly clientID: ClientID;\n readonly dbtx: Read;\n protected readonly _lc: LogContext;\n\n /**\n * The location in which this transaction is being used. This is either `client` or `server`.\n */\n readonly location: TransactionLocation;\n /** @deprecated Use {@link ReadTransaction.location} instead. */\n readonly environment: TransactionLocation;\n\n constructor(\n clientID: ClientID,\n dbRead: Read,\n lc: LogContext,\n rpcName = 'openReadTransaction',\n ) {\n this.clientID = clientID;\n this.dbtx = dbRead;\n this._lc = lc\n .withContext(rpcName)\n .withContext('txid', transactionIDCounter++);\n this.environment = 'client';\n this.location = 'client';\n }\n\n get(key: string): Promise<ReadonlyJSONValue | undefined>;\n get<V extends JSONValue>(key: string): Promise<DeepReadonly<V> | undefined> {\n return (\n rejectIfClosed(this.dbtx) ||\n (this.dbtx.get(key) as Promise<DeepReadonly<V> | undefined>)\n );\n }\n\n // oxlint-disable-next-line require-await\n async has(key: string): Promise<boolean> {\n throwIfClosed(this.dbtx);\n return this.dbtx.has(key);\n }\n\n // oxlint-disable-next-line require-await\n async isEmpty(): Promise<boolean> {\n throwIfClosed(this.dbtx);\n return this.dbtx.isEmpty();\n }\n\n scan(options: ScanIndexOptions): ScanResult<IndexKey, ReadonlyJSONValue>;\n scan(options?: ScanNoIndexOptions): ScanResult<string, ReadonlyJSONValue>;\n scan(options?: ScanOptions): ScanResult<IndexKey | string, ReadonlyJSONValue>;\n\n scan<V extends ReadonlyJSONValue>(\n options: ScanIndexOptions,\n ): ScanResult<IndexKey, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanNoIndexOptions,\n ): ScanResult<string, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, DeepReadonly<V>>;\n\n scan(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, ReadonlyJSONValue> {\n return scan(options, this.dbtx, noop);\n }\n}\n\nfunction noop(_: unknown): void {\n // empty\n}\n\nfunction scan<Options extends ScanOptions, V extends JSONValue>(\n options: Options | undefined,\n dbRead: Read,\n onLimitKey: (inclusiveLimitKey: string) => void,\n): ScanResult<KeyTypeForScanOptions<Options>, V> {\n const iter = getScanIterator<Options, V>(dbRead, options);\n return makeScanResultFromScanIteratorInternal(\n iter,\n options ?? ({} as Options),\n dbRead,\n onLimitKey,\n );\n}\n\n// An implementation of ReadTransaction that keeps track of `keys` and `scans`\n// for use with Subscriptions.\nexport class SubscriptionTransactionWrapper implements ReadTransaction {\n readonly #keys: Set<string> = new Set();\n readonly #scans: ScanSubscriptionInfo[] = [];\n readonly #tx: ReadTransactionImpl;\n\n constructor(tx: ReadTransactionImpl) {\n this.#tx = tx;\n }\n\n get environment(): TransactionLocation {\n return this.#tx.location;\n }\n\n get location(): TransactionLocation {\n return this.#tx.location;\n }\n\n get clientID(): string {\n return this.#tx.clientID;\n }\n\n isEmpty(): Promise<boolean> {\n // Any change to the subscription requires rerunning it.\n this.#scans.push({options: {}});\n return this.#tx.isEmpty();\n }\n\n get(key: string): Promise<ReadonlyJSONValue | undefined>;\n get<T extends JSONValue>(key: string): Promise<DeepReadonly<T> | undefined> {\n this.#keys.add(key);\n return this.#tx.get(key) as Promise<DeepReadonly<T> | undefined>;\n }\n\n has(key: string): Promise<boolean> {\n this.#keys.add(key);\n return this.#tx.has(key);\n }\n\n scan(options: ScanIndexOptions): ScanResult<IndexKey, ReadonlyJSONValue>;\n scan(options?: ScanNoIndexOptions): ScanResult<string, ReadonlyJSONValue>;\n scan(options?: ScanOptions): ScanResult<IndexKey | string, ReadonlyJSONValue>;\n\n scan<V extends ReadonlyJSONValue>(\n options: ScanIndexOptions,\n ): ScanResult<IndexKey, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanNoIndexOptions,\n ): ScanResult<string, DeepReadonly<V>>;\n scan<V extends ReadonlyJSONValue>(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, DeepReadonly<V>>;\n\n scan(\n options?: ScanOptions,\n ): ScanResult<IndexKey | string, ReadonlyJSONValue> {\n const scanInfo: ScanSubscriptionInfo = {\n options: toDbScanOptions(options),\n inclusiveLimitKey: undefined,\n };\n this.#scans.push(scanInfo);\n return scan(options, this.#tx.dbtx, inclusiveLimitKey => {\n scanInfo.inclusiveLimitKey = inclusiveLimitKey;\n });\n }\n\n get keys(): ReadonlySet<string> {\n return this.#keys;\n }\n\n get scans(): ScanSubscriptionInfo[] {\n return this.#scans;\n }\n}\n\n/**\n * WriteTransactions are used with *mutators* which are registered using\n * {@link ReplicacheOptions.mutators} and allows read and write operations on the\n * database.\n */\nexport interface WriteTransaction extends ReadTransaction {\n /**\n * The ID of the mutation that is being applied.\n */\n readonly mutationID: number;\n\n /**\n * The reason for the transaction. This can be `initial`, `rebase` or `authoriative`.\n */\n readonly reason: TransactionReason;\n\n /**\n * Sets a single `value` in the database. The value will be frozen (using\n * `Object.freeze`) in debug mode.\n */\n set(key: string, value: ReadonlyJSONValue): Promise<void>;\n\n /**\n * @deprecated Use {@link WriteTransaction.set} instead.\n */\n put(key: string, value: ReadonlyJSONValue): Promise<void>;\n\n /**\n * Removes a `key` and its value from the database. Returns `true` if there was a\n * `key` to remove.\n */\n del(key: string): Promise<boolean>;\n}\n\n// Internal symbol, not exported by Replicache\n// but accessible to Zero.\nexport const zeroData = Symbol();\n\nexport class WriteTransactionImpl\n extends ReadTransactionImpl\n implements WriteTransaction\n{\n // use `declare` to specialize the type.\n declare readonly dbtx: Write;\n readonly reason: TransactionReason;\n readonly mutationID: number;\n readonly [zeroData]: ZeroTxData | undefined;\n\n constructor(\n clientID: ClientID,\n mutationID: number,\n reason: TransactionReason,\n zData: ZeroTxData | undefined,\n dbWrite: Write,\n lc: LogContext,\n rpcName = 'openWriteTransaction',\n ) {\n super(clientID, dbWrite, lc, rpcName);\n this.mutationID = mutationID;\n this.reason = reason;\n this[zeroData] = zData;\n }\n\n put(key: string, value: ReadonlyJSONValue): Promise<void> {\n return this.set(key, value);\n }\n\n async set(key: string, value: ReadonlyJSONValue): Promise<void> {\n throwIfClosed(this.dbtx);\n await this.dbtx.put(this._lc, key, deepFreeze(value));\n }\n\n del(key: string): Promise<boolean> {\n return rejectIfClosed(this.dbtx) ?? this.dbtx.del(this._lc, key);\n }\n}\n\nexport type CreateIndexDefinition = IndexDefinition & {name: string};\n\ntype Entry<Key, Value> = readonly [key: Key, value: Value];\n\ntype IndexKeyEntry<Value> = Entry<IndexKey, Value>;\n\ntype StringKeyEntry<Value> = Entry<string, Value>;\n\nexport type EntryForOptions<\n Options extends ScanOptions,\n V,\n> = Options extends ScanIndexOptions ? IndexKeyEntry<V> : StringKeyEntry<V>;\n\nfunction getScanIterator<Options extends ScanOptions, V>(\n dbRead: Read,\n options: Options | undefined,\n): AsyncIterable<EntryForOptions<Options, V>> {\n if (options && isScanIndexOptions(options)) {\n return getScanIteratorForIndexMap(dbRead, options) as AsyncIterable<\n EntryForOptions<Options, V>\n >;\n }\n\n return dbRead.map.scan(fromKeyForNonIndexScan(options)) as AsyncIterable<\n EntryForOptions<Options, V>\n >;\n}\n\nexport function fromKeyForNonIndexScan(\n options: ScanNoIndexOptions | undefined,\n): string {\n if (!options) {\n return '';\n }\n\n const {prefix = '', start} = options;\n if (start && greaterThan(start.key, prefix)) {\n return start.key;\n }\n return prefix;\n}\n\nfunction makeScanResultFromScanIteratorInternal<\n Options extends ScanOptions,\n V extends JSONValue,\n>(\n iter: AsyncIterable<EntryForOptions<Options, V>>,\n options: Options,\n dbRead: Read,\n onLimitKey: (inclusiveLimitKey: string) => void,\n): ScanResult<KeyTypeForScanOptions<Options>, V> {\n return new ScanResultImpl(iter, options, dbRead, onLimitKey);\n}\n\nasync function* getScanIteratorForIndexMap(\n dbRead: Read,\n options: ScanIndexOptions,\n): AsyncIterable<IndexKeyEntry<ReadonlyJSONValue>> {\n if (process.env.DISABLE_REPLICACHE_INDEXES) {\n // Indexes are compiled out of this build so no index name ever exists.\n // Thrown here (inside the generator) so that the error surfaces on first\n // iteration, matching getMapForIndex — tx.scan() itself never throws.\n throw new Error(`Unknown index name: ${options.indexName}`);\n }\n const map = dbRead.getMapForIndex(options.indexName);\n for await (const entry of map.scan(fromKeyForIndexScanInternal(options))) {\n yield [decodeIndexKey(entry[0]), entry[1]];\n }\n}\n"],"mappings":";;;;;;AA0GA,IAAI,uBAAuB;AAE3B,IAAa,sBAAb,MAA4D;CAC1D;CACA;CACA;;;;CAKA;;CAEA;CAEA,YACE,UACA,QACA,IACA,UAAU,uBACV;EACA,KAAK,WAAW;EAChB,KAAK,OAAO;EACZ,KAAK,MAAM,GACR,YAAY,OAAO,EACnB,YAAY,QAAQ,sBAAsB;EAC7C,KAAK,cAAc;EACnB,KAAK,WAAW;CAClB;CAGA,IAAyB,KAAmD;EAC1E,OACE,eAAe,KAAK,IAAI,KACvB,KAAK,KAAK,IAAI,GAAG;CAEtB;CAGA,MAAM,IAAI,KAA+B;EACvC,cAAc,KAAK,IAAI;EACvB,OAAO,KAAK,KAAK,IAAI,GAAG;CAC1B;CAGA,MAAM,UAA4B;EAChC,cAAc,KAAK,IAAI;EACvB,OAAO,KAAK,KAAK,QAAQ;CAC3B;CAgBA,KACE,SACkD;EAClD,OAAO,KAAK,SAAS,KAAK,MAAM,IAAI;CACtC;AACF;AAEA,SAAS,KAAK,GAAkB,CAEhC;AAEA,SAAS,KACP,S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AO,KAAK,IAAI,KAAK,KAAK;CAC5B;CAEA,MAAM,IAAI,KAAa,OAAyC;EAC9D,cAAc,KAAK,IAAI;EACvB,MAAM,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,WAAW,KAAK,CAAC;CACtD;CAEA,IAAI,KAA+B;EACjC,OAAO,eAAe,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,GAAG;CACjE;AACF;AAeA,SAAS,gBACP,QACA,SAC4C;CAC5C,IAAI,WAAW,mBAAmB,OAAO,GACvC,OAAO,2BAA2B,QAAQ,OAAO;CAKnD,OAAO,OAAO,IAAI,KAAK,uBAAuB,OAAO,CAAC;AAGxD;AAEA,SAAgB,uBACd,SACQ;CACR,IAAI,CAAC,SACH,OAAO;CAGT,MAAM,EAAC,SAAS,IAAI,UAAS;CAC7B,IAAI,SAAS,YAAY,MAAM,KAAK,MAAM,GACxC,OAAO,MAAM;CAEf,OAAO;AACT;AAEA,SAAS,uCAIP,MACA,SACA,QACA,YAC+C;CAC/C,OAAO,IAAI,eAAe,MAAM,SAAS,QAAQ,UAAU;AAC7D;AAEA,gBAAgB,2BACd,QACA,SACiD;CAK/C,MAAM,IAAI,MAAM,uBAAuB,QAAQ,WAAW;AAM9D"}
@@ -6,10 +6,5 @@ export declare function defined<T>(arr: (T | undefined)[]): T[];
6
6
  export declare function areEqual<T>(arr1: readonly T[], arr2: readonly T[]): boolean;
7
7
  export declare function zip<T1, T2>(a1: readonly T1[], a2: readonly T2[]): [T1, T2][];
8
8
  export declare function last<T>(arr: T[]): T | undefined;
9
- /**
10
- * Creates an empty array. Pass this to `getOrInsertComputed` instead of an
11
- * inline `() => []` so that a hit does not allocate a closure.
12
- */
13
- export declare const newArray: <T>() => T[];
14
9
  export declare function groupBy<T, K>(arr: readonly T[], keyFn: (el: T) => K): Map<K, T[]>;
15
10
  //# sourceMappingURL=arrays.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrays.d.ts","sourceRoot":"","sources":["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,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAO5E;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,SAAS,CAE/C;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,GAAG,EAAE,SAAS,CAAC,EAAE,EACjB,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAClB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAYb"}
@@ -1,6 +1,19 @@
1
1
  import { assert } from "./asserts.js";
2
- import { getOrInsertComputed } from "./map.js";
3
2
  //#region ../shared/src/arrays.ts
3
+ /**
4
+ * Returns `arr` as is if none of the elements are `undefined`.
5
+ * Otherwise returns a new array with only defined elements in `arr`.
6
+ */
7
+ function defined(arr) {
8
+ let i = arr.findIndex((x) => x === void 0);
9
+ if (i < 0) return arr;
10
+ const defined = arr.slice(0, i);
11
+ for (i++; i < arr.length; i++) {
12
+ const x = arr[i];
13
+ if (x !== void 0) defined.push(x);
14
+ }
15
+ return defined;
16
+ }
4
17
  function areEqual(arr1, arr2) {
5
18
  return arr1.length === arr2.length && arr1.every((e, i) => e === arr2[i]);
6
19
  }
@@ -13,17 +26,20 @@ function zip(a1, a2) {
13
26
  function last(arr) {
14
27
  return arr.at(-1);
15
28
  }
16
- /**
17
- * Creates an empty array. Pass this to `getOrInsertComputed` instead of an
18
- * inline `() => []` so that a hit does not allocate a closure.
19
- */
20
- var newArray = () => [];
21
29
  function groupBy(arr, keyFn) {
22
30
  const groups = /* @__PURE__ */ new Map();
23
- for (const el of arr) getOrInsertComputed(groups, keyFn(el), newArray).push(el);
31
+ for (const el of arr) {
32
+ const key = keyFn(el);
33
+ let group = groups.get(key);
34
+ if (group === void 0) {
35
+ group = [];
36
+ groups.set(key, group);
37
+ }
38
+ group.push(el);
39
+ }
24
40
  return groups;
25
41
  }
26
42
  //#endregion
27
- export { areEqual, groupBy, last, newArray, zip };
43
+ export { areEqual, defined, groupBy, last, zip };
28
44
 
29
45
  //# sourceMappingURL=arrays.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"arrays.js","names":[],"sources":["../../../../shared/src/arrays.ts"],"sourcesContent":["import {assert} from './asserts.ts';\nimport {getOrInsertComputed} from './map.ts';\n\n/**\n * Returns `arr` as is if none of the elements are `undefined`.\n * Otherwise returns a new array with only defined elements in `arr`.\n */\nexport function defined<T>(arr: (T | undefined)[]): T[] {\n // avoid an array copy if possible\n let i = arr.findIndex(x => x === undefined);\n if (i < 0) {\n return arr as T[];\n }\n const defined: T[] = arr.slice(0, i) as T[];\n for (i++; i < arr.length; i++) {\n const x = arr[i];\n if (x !== undefined) {\n defined.push(x);\n }\n }\n return defined;\n}\n\nexport function areEqual<T>(arr1: readonly T[], arr2: readonly T[]): boolean {\n return arr1.length === arr2.length && arr1.every((e, i) => e === arr2[i]);\n}\n\nexport function zip<T1, T2>(a1: readonly T1[], a2: readonly T2[]): [T1, T2][] {\n assert(a1.length === a2.length, 'zip: arrays must have equal length');\n const result: [T1, T2][] = [];\n for (let i = 0; i < a1.length; i++) {\n result.push([a1[i], a2[i]]);\n }\n return result;\n}\n\nexport function last<T>(arr: T[]): T | undefined {\n return arr.at(-1);\n}\n\n/**\n * Creates an empty array. Pass this to `getOrInsertComputed` instead of an\n * inline `() => []` so that a hit does not allocate a closure.\n */\nexport const newArray = <T>(): T[] => [];\n\nexport function groupBy<T, K>(\n arr: readonly T[],\n keyFn: (el: T) => K,\n): Map<K, T[]> {\n const groups = new Map<K, T[]>();\n for (const el of arr) {\n const key = keyFn(el);\n getOrInsertComputed(groups, key, newArray).push(el);\n }\n return groups;\n}\n"],"mappings":";;;AAuBA,SAAgB,SAAY,MAAoB,MAA6B;CAC3E,OAAO,KAAK,WAAW,KAAK,UAAU,KAAK,OAAO,GAAG,MAAM,MAAM,KAAK,EAAE;AAC1E;AAEA,SAAgB,IAAY,IAAmB,IAA+B;CAC5E,OAAO,GAAG,WAAW,GAAG,QAAQ,oCAAoC;CACpE,MAAM,SAAqB,CAAC;CAC5B,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,QAAQ,KAC7B,OAAO,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;CAE5B,OAAO;AACT;AAEA,SAAgB,KAAQ,KAAyB;CAC/C,OAAO,IAAI,GAAG,EAAE;AAClB;;;;;AAMA,IAAa,iBAAyB,CAAC;AAEvC,SAAgB,QACd,KACA,OACa;CACb,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,MAAM,KAEf,oBAAoB,QADR,MAAM,EACU,GAAK,QAAQ,EAAE,KAAK,EAAE;CAEpD,OAAO;AACT"}
1
+ {"version":3,"file":"arrays.js","names":[],"sources":["../../../../shared/src/arrays.ts"],"sourcesContent":["import {assert} from './asserts.ts';\n\n/**\n * Returns `arr` as is if none of the elements are `undefined`.\n * Otherwise returns a new array with only defined elements in `arr`.\n */\nexport function defined<T>(arr: (T | undefined)[]): T[] {\n // avoid an array copy if possible\n let i = arr.findIndex(x => x === undefined);\n if (i < 0) {\n return arr as T[];\n }\n const defined: T[] = arr.slice(0, i) as T[];\n for (i++; i < arr.length; i++) {\n const x = arr[i];\n if (x !== undefined) {\n defined.push(x);\n }\n }\n return defined;\n}\n\nexport function areEqual<T>(arr1: readonly T[], arr2: readonly T[]): boolean {\n return arr1.length === arr2.length && arr1.every((e, i) => e === arr2[i]);\n}\n\nexport function zip<T1, T2>(a1: readonly T1[], a2: readonly T2[]): [T1, T2][] {\n assert(a1.length === a2.length, 'zip: arrays must have equal length');\n const result: [T1, T2][] = [];\n for (let i = 0; i < a1.length; i++) {\n result.push([a1[i], a2[i]]);\n }\n return result;\n}\n\nexport function last<T>(arr: T[]): T | undefined {\n return arr.at(-1);\n}\n\nexport function groupBy<T, K>(\n arr: readonly T[],\n keyFn: (el: T) => K,\n): Map<K, T[]> {\n const groups = new Map<K, T[]>();\n for (const el of arr) {\n const key = keyFn(el);\n let group = groups.get(key);\n if (group === undefined) {\n group = [];\n groups.set(key, group);\n }\n group.push(el);\n }\n return groups;\n}\n"],"mappings":";;;;;;AAMA,SAAgB,QAAW,KAA6B;CAEtD,IAAI,IAAI,IAAI,WAAU,MAAK,MAAM,KAAA,CAAS;CAC1C,IAAI,IAAI,GACN,OAAO;CAET,MAAM,UAAe,IAAI,MAAM,GAAG,CAAC;CACnC,KAAK,KAAK,IAAI,IAAI,QAAQ,KAAK;EAC7B,MAAM,IAAI,IAAI;EACd,IAAI,MAAM,KAAA,GACR,QAAQ,KAAK,CAAC;CAElB;CACA,OAAO;AACT;AAEA,SAAgB,SAAY,MAAoB,MAA6B;CAC3E,OAAO,KAAK,WAAW,KAAK,UAAU,KAAK,OAAO,GAAG,MAAM,MAAM,KAAK,EAAE;AAC1E;AAEA,SAAgB,IAAY,IAAmB,IAA+B;CAC5E,OAAO,GAAG,WAAW,GAAG,QAAQ,oCAAoC;CACpE,MAAM,SAAqB,CAAC;CAC5B,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,QAAQ,KAC7B,OAAO,KAAK,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC;CAE5B,OAAO;AACT;AAEA,SAAgB,KAAQ,KAAyB;CAC/C,OAAO,IAAI,GAAG,EAAE;AAClB;AAEA,SAAgB,QACd,KACA,OACa;CACb,MAAM,yBAAS,IAAI,IAAY;CAC/B,KAAK,MAAM,MAAM,KAAK;EACpB,MAAM,MAAM,MAAM,EAAE;EACpB,IAAI,QAAQ,OAAO,IAAI,GAAG;EAC1B,IAAI,UAAU,KAAA,GAAW;GACvB,QAAQ,CAAC;GACT,OAAO,IAAI,KAAK,KAAK;EACvB;EACA,MAAM,KAAK,EAAE;CACf;CACA,OAAO;AACT"}
@@ -0,0 +1,19 @@
1
+ /** Encodes `bytes` as unpadded base64url. */
2
+ export declare function toBase64url(bytes: Uint8Array): string;
3
+ /**
4
+ * Decodes base64url, padded or not.
5
+ *
6
+ * @throws SyntaxError if `encoded` is not base64url, including when it has
7
+ * whitespace, which the standard and atob skip. atob doesn't reject
8
+ * everything the standard rejects, so this checks first.
9
+ */
10
+ export declare function fromBase64url(encoded: string): Uint8Array;
11
+ /** @visibleForTesting */
12
+ export declare function toBase64urlWithBtoa(bytes: Uint8Array): string;
13
+ /**
14
+ * Decodes base64url that {@link fromBase64url} has checked.
15
+ *
16
+ * @visibleForTesting
17
+ */
18
+ export declare function fromBase64urlWithAtob(s: string): Uint8Array;
19
+ //# sourceMappingURL=base64.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../../shared/src/base64.ts"],"names":[],"mappings":"AAaA,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAOrD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAUzD;AAED,yBAAyB;AACzB,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAU7D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAI3D"}
@@ -0,0 +1,40 @@
1
+ //#region ../shared/src/base64.ts
2
+ var PADDING = /=+$/;
3
+ var BASE64URL = /^(?:[\w-]{4})*(?:[\w-]{2}(?:==)?|[\w-]{3}=?)?$/;
4
+ /** Encodes `bytes` as unpadded base64url. */
5
+ function toBase64url(bytes) {
6
+ const native = bytes;
7
+ return native.toBase64 ? native.toBase64({
8
+ alphabet: "base64url",
9
+ omitPadding: true
10
+ }) : toBase64urlWithBtoa(bytes);
11
+ }
12
+ /**
13
+ * Decodes base64url, padded or not.
14
+ *
15
+ * @throws SyntaxError if `encoded` is not base64url, including when it has
16
+ * whitespace, which the standard and atob skip. atob doesn't reject
17
+ * everything the standard rejects, so this checks first.
18
+ */
19
+ function fromBase64url(encoded) {
20
+ if (!BASE64URL.test(encoded)) throw new SyntaxError("Invalid base64url");
21
+ const native = Uint8Array;
22
+ return native.fromBase64 ? native.fromBase64(encoded, { alphabet: "base64url" }) : fromBase64urlWithAtob(encoded);
23
+ }
24
+ /** @visibleForTesting */
25
+ function toBase64urlWithBtoa(bytes) {
26
+ const { fromCharCode } = String;
27
+ return btoa(Array.from(bytes, (b) => fromCharCode(b)).join("")).replaceAll("+", "-").replaceAll("/", "_").replace(PADDING, "");
28
+ }
29
+ /**
30
+ * Decodes base64url that {@link fromBase64url} has checked.
31
+ *
32
+ * @visibleForTesting
33
+ */
34
+ function fromBase64urlWithAtob(s) {
35
+ return Uint8Array.from(atob(s.replaceAll("-", "+").replaceAll("_", "/")), (c) => c.charCodeAt(0));
36
+ }
37
+ //#endregion
38
+ export { fromBase64url, toBase64url };
39
+
40
+ //# sourceMappingURL=base64.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64.js","names":[],"sources":["../../../../shared/src/base64.ts"],"sourcesContent":["// Unpadded base64url (RFC 4648 §5: base64 with `-` and `_` instead of `+` and\n// `/`) for Uint8Arrays. Uses the standard `Uint8Array.prototype.toBase64` and\n// `Uint8Array.fromBase64` when the runtime has them, and btoa/atob otherwise\n// (Node 22, older browsers). Node's Buffer isn't used: React Native apps\n// often polyfill it with the `buffer` package, which has no base64url.\n\ntype Base64urlOptions = {alphabet: 'base64url'; omitPadding?: boolean};\n\nconst PADDING = /=+$/;\n// Whole groups of four characters, then an unpadded or correctly padded last\n// group.\nconst BASE64URL = /^(?:[\\w-]{4})*(?:[\\w-]{2}(?:==)?|[\\w-]{3}=?)?$/;\n\n/** Encodes `bytes` as unpadded base64url. */\nexport function toBase64url(bytes: Uint8Array): string {\n const native = bytes as Uint8Array & {\n toBase64?: (options: Base64urlOptions) => string;\n };\n return native.toBase64\n ? native.toBase64({alphabet: 'base64url', omitPadding: true})\n : toBase64urlWithBtoa(bytes);\n}\n\n/**\n * Decodes base64url, padded or not.\n *\n * @throws SyntaxError if `encoded` is not base64url, including when it has\n * whitespace, which the standard and atob skip. atob doesn't reject\n * everything the standard rejects, so this checks first.\n */\nexport function fromBase64url(encoded: string): Uint8Array {\n if (!BASE64URL.test(encoded)) {\n throw new SyntaxError('Invalid base64url');\n }\n const native = Uint8Array as {\n fromBase64?: (s: string, options: Base64urlOptions) => Uint8Array;\n };\n return native.fromBase64\n ? native.fromBase64(encoded, {alphabet: 'base64url'})\n : fromBase64urlWithAtob(encoded);\n}\n\n/** @visibleForTesting */\nexport function toBase64urlWithBtoa(bytes: Uint8Array): string {\n // A local, so the loop doesn't look it up on String for every byte\n // (Hermes).\n const {fromCharCode} = String;\n // One character per byte. Spreading a large array into fromCharCode could\n // overflow the stack.\n return btoa(Array.from(bytes, b => fromCharCode(b)).join(''))\n .replaceAll('+', '-')\n .replaceAll('/', '_')\n .replace(PADDING, '');\n}\n\n/**\n * Decodes base64url that {@link fromBase64url} has checked.\n *\n * @visibleForTesting\n */\nexport function fromBase64urlWithAtob(s: string): Uint8Array {\n return Uint8Array.from(atob(s.replaceAll('-', '+').replaceAll('_', '/')), c =>\n c.charCodeAt(0),\n );\n}\n"],"mappings":";AAQA,IAAM,UAAU;AAGhB,IAAM,YAAY;;AAGlB,SAAgB,YAAY,OAA2B;CACrD,MAAM,SAAS;CAGf,OAAO,OAAO,WACV,OAAO,SAAS;EAAC,UAAU;EAAa,aAAa;CAAI,CAAC,IAC1D,oBAAoB,KAAK;AAC/B;;;;;;;;AASA,SAAgB,cAAc,SAA6B;CACzD,IAAI,CAAC,UAAU,KAAK,OAAO,GACzB,MAAM,IAAI,YAAY,mBAAmB;CAE3C,MAAM,SAAS;CAGf,OAAO,OAAO,aACV,OAAO,WAAW,SAAS,EAAC,UAAU,YAAW,CAAC,IAClD,sBAAsB,OAAO;AACnC;;AAGA,SAAgB,oBAAoB,OAA2B;CAG7D,MAAM,EAAC,iBAAgB;CAGvB,OAAO,KAAK,MAAM,KAAK,QAAO,MAAK,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EACzD,WAAW,KAAK,GAAG,EACnB,WAAW,KAAK,GAAG,EACnB,QAAQ,SAAS,EAAE;AACxB;;;;;;AAOA,SAAgB,sBAAsB,GAAuB;CAC3D,OAAO,WAAW,KAAK,KAAK,EAAE,WAAW,KAAK,GAAG,EAAE,WAAW,KAAK,GAAG,CAAC,IAAG,MACxE,EAAE,WAAW,CAAC,CAChB;AACF"}
@@ -1,15 +1,4 @@
1
1
  import type { ReadonlyJSONValue } from './json.ts';
2
2
  export declare function getErrorMessage(error: unknown): string;
3
- /**
4
- * Returns the chain of `cause` values hanging off `error`, outermost first.
5
- *
6
- * Errors that Zero raises on a fatal path wrap the original exception as
7
- * `cause`. Console sinks on some runtimes (React Native's Hermes among them)
8
- * print only the outer error's message and stack, so the original error's
9
- * name, message and stack are lost unless they are logged as separate
10
- * arguments. Spread the result of this function into a log call to keep them
11
- * visible.
12
- */
13
- export declare function getErrorCauses(error: unknown): unknown[];
14
3
  export declare function getErrorDetails(error: unknown): ReadonlyJSONValue | undefined;
15
4
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../shared/src/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,WAAW,CAAC;AAEjD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD;AAkDD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,EAAE,CAaxD;AAiBD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CA0B7E"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../shared/src/error.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,WAAW,CAAC;AAEjD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD;AAkDD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,GAAG,SAAS,CA0B7E"}
@@ -29,40 +29,6 @@ function getErrorMessageInternal(error, seen) {
29
29
  } catch {}
30
30
  return `Unknown error of type ${typeof error} was thrown and the message could not be determined. See cause for details.`;
31
31
  }
32
- /**
33
- * Returns the chain of `cause` values hanging off `error`, outermost first.
34
- *
35
- * Errors that Zero raises on a fatal path wrap the original exception as
36
- * `cause`. Console sinks on some runtimes (React Native's Hermes among them)
37
- * print only the outer error's message and stack, so the original error's
38
- * name, message and stack are lost unless they are logged as separate
39
- * arguments. Spread the result of this function into a log call to keep them
40
- * visible.
41
- */
42
- function getErrorCauses(error) {
43
- const causes = [];
44
- const seen = new Set([error]);
45
- let current = error;
46
- for (;;) {
47
- const cause = readCause(current);
48
- if (cause === void 0 || seen.has(cause)) return causes;
49
- seen.add(cause);
50
- causes.push(cause);
51
- current = cause;
52
- }
53
- }
54
- /**
55
- * Reads `cause` exactly once. `error` is `unknown`, so `cause` may be an
56
- * accessor or proxy trap: a stateful getter must not be consulted twice per
57
- * hop, and a throwing one must not escape from a log call in an error handler.
58
- */
59
- function readCause(error) {
60
- try {
61
- return typeof error === "object" && error !== null && "cause" in error ? error.cause : void 0;
62
- } catch {
63
- return;
64
- }
65
- }
66
32
  function getErrorDetails(error) {
67
33
  if (error instanceof Error) {
68
34
  if ("details" in error) try {
@@ -79,6 +45,6 @@ function getErrorDetails(error) {
79
45
  } catch {}
80
46
  }
81
47
  //#endregion
82
- export { getErrorCauses, getErrorDetails, getErrorMessage };
48
+ export { getErrorDetails, getErrorMessage };
83
49
 
84
50
  //# sourceMappingURL=error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","names":[],"sources":["../../../../shared/src/error.ts"],"sourcesContent":["import {jsonSchema} from './json-schema.ts';\nimport type {ReadonlyJSONValue} from './json.ts';\n\nexport function getErrorMessage(error: unknown): string {\n return getErrorMessageInternal(error, new Set());\n}\n\nfunction getErrorMessageInternal(error: unknown, seen: Set<unknown>): string {\n if (typeof error === 'string') {\n return error;\n }\n\n if (typeof error === 'object' && error !== null) {\n if (seen.has(error)) {\n return 'Circular error reference detected while extracting the error message.';\n }\n seen.add(error);\n }\n\n if (error instanceof Error) {\n if (error.message) {\n return error.message;\n }\n\n if ('cause' in error) {\n const {cause} = error as {cause: unknown};\n if (cause !== undefined) {\n const causeMessage = getErrorMessageInternal(cause, seen);\n if (causeMessage) {\n return causeMessage;\n }\n }\n }\n }\n\n if (\n typeof error === 'object' &&\n error !== null &&\n 'message' in error &&\n typeof (error as {message: unknown}).message === 'string'\n ) {\n const message = (error as {message: string}).message;\n if (message) {\n return message;\n }\n }\n\n try {\n const json = jsonSchema.parse(error);\n return `Parsed message: ${JSON.stringify(json)}`;\n } catch {}\n\n return `Unknown error of type ${typeof error} was thrown and the message could not be determined. See cause for details.`;\n}\n\n/**\n * Returns the chain of `cause` values hanging off `error`, outermost first.\n *\n * Errors that Zero raises on a fatal path wrap the original exception as\n * `cause`. Console sinks on some runtimes (React Native's Hermes among them)\n * print only the outer error's message and stack, so the original error's\n * name, message and stack are lost unless they are logged as separate\n * arguments. Spread the result of this function into a log call to keep them\n * visible.\n */\nexport function getErrorCauses(error: unknown): unknown[] {\n const causes: unknown[] = [];\n const seen = new Set<unknown>([error]);\n let current = error;\n for (;;) {\n const cause = readCause(current);\n if (cause === undefined || seen.has(cause)) {\n return causes;\n }\n seen.add(cause);\n causes.push(cause);\n current = cause;\n }\n}\n\n/**\n * Reads `cause` exactly once. `error` is `unknown`, so `cause` may be an\n * accessor or proxy trap: a stateful getter must not be consulted twice per\n * hop, and a throwing one must not escape from a log call in an error handler.\n */\nfunction readCause(error: unknown): unknown {\n try {\n return typeof error === 'object' && error !== null && 'cause' in error\n ? (error as {cause: unknown}).cause\n : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport function getErrorDetails(error: unknown): ReadonlyJSONValue | undefined {\n if (error instanceof Error) {\n if ('details' in error) {\n try {\n return jsonSchema.parse(error?.details);\n } catch {}\n }\n\n if (error.name && error.name !== 'Error') {\n return {name: error.name};\n }\n\n return undefined;\n }\n\n if (typeof error === 'object' && error !== null && 'details' in error) {\n try {\n return jsonSchema.parse((error as {details: ReadonlyJSONValue})?.details);\n } catch {}\n }\n\n try {\n return jsonSchema.parse(error);\n } catch {}\n\n return undefined;\n}\n"],"mappings":";;AAGA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,wBAAwB,uBAAO,IAAI,IAAI,CAAC;AACjD;AAEA,SAAS,wBAAwB,OAAgB,MAA4B;CAC3E,IAAI,OAAO,UAAU,UACnB,OAAO;CAGT,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAC/C,IAAI,KAAK,IAAI,KAAK,GAChB,OAAO;EAET,KAAK,IAAI,KAAK;CAChB;CAEA,IAAI,iBAAiB,OAAO;EAC1B,IAAI,MAAM,SACR,OAAO,MAAM;EAGf,IAAI,WAAW,OAAO;GACpB,MAAM,EAAC,UAAS;GAChB,IAAI,UAAU,KAAA,GAAW;IACvB,MAAM,eAAe,wBAAwB,OAAO,IAAI;IACxD,IAAI,cACF,OAAO;GAEX;EACF;CACF;CAEA,IACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACb,OAAQ,MAA6B,YAAY,UACjD;EACA,MAAM,UAAW,MAA4B;EAC7C,IAAI,SACF,OAAO;CAEX;CAEA,IAAI;EACF,MAAM,OAAO,WAAW,MAAM,KAAK;EACnC,OAAO,mBAAmB,KAAK,UAAU,IAAI;CAC/C,QAAQ,CAAC;CAET,OAAO,yBAAyB,OAAO,MAAM;AAC/C;;;;;;;;;;;AAYA,SAAgB,eAAe,OAA2B;CACxD,MAAM,SAAoB,CAAC;CAC3B,MAAM,OAAO,IAAI,IAAa,CAAC,KAAK,CAAC;CACrC,IAAI,UAAU;CACd,SAAS;EACP,MAAM,QAAQ,UAAU,OAAO;EAC/B,IAAI,UAAU,KAAA,KAAa,KAAK,IAAI,KAAK,GACvC,OAAO;EAET,KAAK,IAAI,KAAK;EACd,OAAO,KAAK,KAAK;EACjB,UAAU;CACZ;AACF;;;;;;AAOA,SAAS,UAAU,OAAyB;CAC1C,IAAI;EACF,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,WAAW,QAC5D,MAA2B,QAC5B,KAAA;CACN,QAAQ;EACN;CACF;AACF;AAEA,SAAgB,gBAAgB,OAA+C;CAC7E,IAAI,iBAAiB,OAAO;EAC1B,IAAI,aAAa,OACf,IAAI;GACF,OAAO,WAAW,MAAM,OAAO,OAAO;EACxC,QAAQ,CAAC;EAGX,IAAI,MAAM,QAAQ,MAAM,SAAS,SAC/B,OAAO,EAAC,MAAM,MAAM,KAAI;EAG1B;CACF;CAEA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa,OAC9D,IAAI;EACF,OAAO,WAAW,MAAO,OAAwC,OAAO;CAC1E,QAAQ,CAAC;CAGX,IAAI;EACF,OAAO,WAAW,MAAM,KAAK;CAC/B,QAAQ,CAAC;AAGX"}
1
+ {"version":3,"file":"error.js","names":[],"sources":["../../../../shared/src/error.ts"],"sourcesContent":["import {jsonSchema} from './json-schema.ts';\nimport type {ReadonlyJSONValue} from './json.ts';\n\nexport function getErrorMessage(error: unknown): string {\n return getErrorMessageInternal(error, new Set());\n}\n\nfunction getErrorMessageInternal(error: unknown, seen: Set<unknown>): string {\n if (typeof error === 'string') {\n return error;\n }\n\n if (typeof error === 'object' && error !== null) {\n if (seen.has(error)) {\n return 'Circular error reference detected while extracting the error message.';\n }\n seen.add(error);\n }\n\n if (error instanceof Error) {\n if (error.message) {\n return error.message;\n }\n\n if ('cause' in error) {\n const {cause} = error as {cause: unknown};\n if (cause !== undefined) {\n const causeMessage = getErrorMessageInternal(cause, seen);\n if (causeMessage) {\n return causeMessage;\n }\n }\n }\n }\n\n if (\n typeof error === 'object' &&\n error !== null &&\n 'message' in error &&\n typeof (error as {message: unknown}).message === 'string'\n ) {\n const message = (error as {message: string}).message;\n if (message) {\n return message;\n }\n }\n\n try {\n const json = jsonSchema.parse(error);\n return `Parsed message: ${JSON.stringify(json)}`;\n } catch {}\n\n return `Unknown error of type ${typeof error} was thrown and the message could not be determined. See cause for details.`;\n}\n\nexport function getErrorDetails(error: unknown): ReadonlyJSONValue | undefined {\n if (error instanceof Error) {\n if ('details' in error) {\n try {\n return jsonSchema.parse(error?.details);\n } catch {}\n }\n\n if (error.name && error.name !== 'Error') {\n return {name: error.name};\n }\n\n return undefined;\n }\n\n if (typeof error === 'object' && error !== null && 'details' in error) {\n try {\n return jsonSchema.parse((error as {details: ReadonlyJSONValue})?.details);\n } catch {}\n }\n\n try {\n return jsonSchema.parse(error);\n } catch {}\n\n return undefined;\n}\n"],"mappings":";;AAGA,SAAgB,gBAAgB,OAAwB;CACtD,OAAO,wBAAwB,uBAAO,IAAI,IAAI,CAAC;AACjD;AAEA,SAAS,wBAAwB,OAAgB,MAA4B;CAC3E,IAAI,OAAO,UAAU,UACnB,OAAO;CAGT,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM;EAC/C,IAAI,KAAK,IAAI,KAAK,GAChB,OAAO;EAET,KAAK,IAAI,KAAK;CAChB;CAEA,IAAI,iBAAiB,OAAO;EAC1B,IAAI,MAAM,SACR,OAAO,MAAM;EAGf,IAAI,WAAW,OAAO;GACpB,MAAM,EAAC,UAAS;GAChB,IAAI,UAAU,KAAA,GAAW;IACvB,MAAM,eAAe,wBAAwB,OAAO,IAAI;IACxD,IAAI,cACF,OAAO;GAEX;EACF;CACF;CAEA,IACE,OAAO,UAAU,YACjB,UAAU,QACV,aAAa,SACb,OAAQ,MAA6B,YAAY,UACjD;EACA,MAAM,UAAW,MAA4B;EAC7C,IAAI,SACF,OAAO;CAEX;CAEA,IAAI;EACF,MAAM,OAAO,WAAW,MAAM,KAAK;EACnC,OAAO,mBAAmB,KAAK,UAAU,IAAI;CAC/C,QAAQ,CAAC;CAET,OAAO,yBAAyB,OAAO,MAAM;AAC/C;AAEA,SAAgB,gBAAgB,OAA+C;CAC7E,IAAI,iBAAiB,OAAO;EAC1B,IAAI,aAAa,OACf,IAAI;GACF,OAAO,WAAW,MAAM,OAAO,OAAO;EACxC,QAAQ,CAAC;EAGX,IAAI,MAAM,QAAQ,MAAM,SAAS,SAC/B,OAAO,EAAC,MAAM,MAAM,KAAI;EAG1B;CACF;CAEA,IAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,aAAa,OAC9D,IAAI;EACF,OAAO,WAAW,MAAO,OAAwC,OAAO;CAC1E,QAAQ,CAAC;CAGX,IAAI;EACF,OAAO,WAAW,MAAM,KAAK;CAC/B,QAAQ,CAAC;AAGX"}
@@ -1,5 +1,4 @@
1
1
  export declare const h32: (s: string) => number;
2
2
  export declare const h64: (s: string) => bigint;
3
3
  export declare const h128: (s: string) => bigint;
4
- export { avalanche32, PRIME32_1, PRIME32_5, round32 } from './xxhash32.ts';
5
4
  //# sourceMappingURL=hash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../../shared/src/hash.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,WAG5B,CAAC;AACF,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,WAAe,CAAC;AAC7C,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,WAAe,CAAC;AAkJ9C,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../../shared/src/hash.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,WAAmB,CAAC;AACjD,eAAO,MAAM,GAAG,GAAI,GAAG,MAAM,WAAe,CAAC;AAC7C,eAAO,MAAM,IAAI,GAAI,GAAG,MAAM,WAAe,CAAC"}
@@ -1,93 +1,16 @@
1
- import { PRIME32_1, PRIME32_2, PRIME32_3, PRIME32_4, PRIME32_5, avalanche32, round32 } from "./xxhash32.js";
1
+ import { xxHash32 } from "js-xxhash";
2
2
  //#region ../shared/src/hash.ts
3
- var h32 = (s) => {
4
- digest(s, 1);
5
- return digests[0];
6
- };
7
- var h64 = (s) => wide(s, 2);
8
- var h128 = (s) => wide(s, 4);
9
- var MAX_WORDS = 4;
10
- var accs = new Int32Array(MAX_WORDS);
11
- var stripes = new Int32Array(MAX_WORDS * 4);
12
- var digests = new Uint32Array(MAX_WORDS);
13
- var encoder;
3
+ var h32 = (s) => xxHash32(s, 0);
4
+ var h64 = (s) => hash(s, 2);
5
+ var h128 = (s) => hash(s, 4);
14
6
  /**
15
- * xxHash32 over the UTF-8 bytes of `str` under seeds `0..words-1`, leaving the
16
- * digests in `digests[0..words)`.
17
- *
18
- * A seed only changes the initial accumulator values, so every word digests the
19
- * same input lanes. This walks the bytes once, advancing all `words` sets of
20
- * accumulators per lane, and UTF-8 encodes the string once. The result is
21
- * identical to `words` separate `xxHash32(str, i)` calls — which is what this
22
- * used to delegate to, and what `hash.test.ts` checks it still matches.
7
+ * xxHash32 only computes 32-bit values. Run it n times with different seeds to
8
+ * get a larger hash with better collision resistance.
23
9
  */
24
- function digest(str, words) {
25
- const b = (encoder ??= new TextEncoder()).encode(str);
26
- const len = b.length;
27
- for (let w = 0; w < words; w++) accs[w] = w + PRIME32_5 & 4294967295;
28
- let offset = 0;
29
- if (len >= 16) {
30
- for (let w = 0; w < words; w++) {
31
- const base = w << 2;
32
- stripes[base] = w + PRIME32_1 + PRIME32_2 & 4294967295;
33
- stripes[base + 1] = w + PRIME32_2 & 4294967295;
34
- stripes[base + 2] = w;
35
- stripes[base + 3] = w - PRIME32_1 & 4294967295;
36
- }
37
- const limit = len - 16;
38
- for (; offset <= limit; offset += 16) {
39
- const l0 = b[offset] | b[offset + 1] << 8 | b[offset + 2] << 16 | b[offset + 3] << 24;
40
- const l1 = b[offset + 4] | b[offset + 5] << 8 | b[offset + 6] << 16 | b[offset + 7] << 24;
41
- const l2 = b[offset + 8] | b[offset + 9] << 8 | b[offset + 10] << 16 | b[offset + 11] << 24;
42
- const l3 = b[offset + 12] | b[offset + 13] << 8 | b[offset + 14] << 16 | b[offset + 15] << 24;
43
- for (let w = 0; w < words; w++) {
44
- const base = w << 2;
45
- stripes[base] = round32(stripes[base], l0);
46
- stripes[base + 1] = round32(stripes[base + 1], l1);
47
- stripes[base + 2] = round32(stripes[base + 2], l2);
48
- stripes[base + 3] = round32(stripes[base + 3], l3);
49
- }
50
- }
51
- for (let w = 0; w < words; w++) {
52
- const base = w << 2;
53
- const s0 = stripes[base];
54
- const s1 = stripes[base + 1];
55
- const s2 = stripes[base + 2];
56
- const s3 = stripes[base + 3];
57
- accs[w] = (s0 << 1 | s0 >>> 31) + (s1 << 7 | s1 >>> 25) + (s2 << 12 | s2 >>> 20) + (s3 << 18 | s3 >>> 14) & 4294967295;
58
- }
59
- }
60
- for (let w = 0; w < words; w++) accs[w] = accs[w] + len & 4294967295;
61
- const limit4 = len - 4;
62
- for (; offset <= limit4; offset += 4) {
63
- const laneN0 = b[offset] + (b[offset + 1] << 8);
64
- const laneN1 = b[offset + 2] + (b[offset + 3] << 8);
65
- const laneP = laneN0 * PRIME32_3 + (laneN1 * PRIME32_3 << 16);
66
- for (let w = 0; w < words; w++) {
67
- let acc = accs[w] + laneP | 0;
68
- acc = acc << 17 | acc >>> 15;
69
- accs[w] = Math.imul(acc, PRIME32_4);
70
- }
71
- }
72
- for (; offset < len; ++offset) {
73
- const lane = b[offset];
74
- for (let w = 0; w < words; w++) {
75
- let acc = accs[w] + Math.imul(lane, PRIME32_5) | 0;
76
- acc = acc << 11 | acc >>> 21;
77
- accs[w] = Math.imul(acc, PRIME32_1);
78
- }
79
- }
80
- for (let w = 0; w < words; w++) digests[w] = avalanche32(accs[w]);
81
- }
82
- /**
83
- * A hash wider than 32 bits, folding `words` digests together highest seed
84
- * first.
85
- */
86
- function wide(str, words) {
87
- digest(str, words);
88
- let result = 0n;
89
- for (let w = 0; w < words; w++) result = (result << 32n) + BigInt(digests[w]);
90
- return result;
10
+ function hash(str, words) {
11
+ let hash = 0n;
12
+ for (let i = 0; i < words; i++) hash = (hash << 32n) + BigInt(xxHash32(str, i));
13
+ return hash;
91
14
  }
92
15
  //#endregion
93
16
  export { h128, h32, h64 };
@@ -1 +1 @@
1
- {"version":3,"file":"hash.js","names":[],"sources":["../../../../shared/src/hash.ts"],"sourcesContent":["import {\n avalanche32,\n PRIME32_1,\n PRIME32_2,\n PRIME32_3,\n PRIME32_4,\n PRIME32_5,\n round32,\n} from './xxhash32.ts';\n\nexport const h32 = (s: string) => {\n digest(s, 1);\n return digests[0];\n};\nexport const h64 = (s: string) => wide(s, 2);\nexport const h128 = (s: string) => wide(s, 4);\n\nconst MAX_WORDS = 4;\n\n// `digest` is synchronous and does not recurse, so these can be reused across\n// calls instead of allocated per call.\nconst accs = new Int32Array(MAX_WORDS);\nconst stripes = new Int32Array(MAX_WORDS * 4);\nconst digests = new Uint32Array(MAX_WORDS);\nlet encoder: TextEncoder | undefined;\n\n/**\n * xxHash32 over the UTF-8 bytes of `str` under seeds `0..words-1`, leaving the\n * digests in `digests[0..words)`.\n *\n * A seed only changes the initial accumulator values, so every word digests the\n * same input lanes. This walks the bytes once, advancing all `words` sets of\n * accumulators per lane, and UTF-8 encodes the string once. The result is\n * identical to `words` separate `xxHash32(str, i)` calls — which is what this\n * used to delegate to, and what `hash.test.ts` checks it still matches.\n */\nfunction digest(str: string, words: number): void {\n const b = (encoder ??= new TextEncoder()).encode(str);\n const len = b.length;\n\n for (let w = 0; w < words; w++) {\n accs[w] = (w + PRIME32_5) & 0xffffffff;\n }\n\n let offset = 0;\n\n /*\n Step 2. Process stripes\n A stripe is a contiguous segment of 16 bytes, evenly divided into 4 lanes\n of 4 bytes each, each lane updating its own accumulator. Inputs shorter\n than a stripe skip straight to step 4 with a single accumulator.\n */\n if (len >= 16) {\n for (let w = 0; w < words; w++) {\n const base = w << 2;\n stripes[base] = (w + PRIME32_1 + PRIME32_2) & 0xffffffff;\n stripes[base + 1] = (w + PRIME32_2) & 0xffffffff;\n stripes[base + 2] = w;\n stripes[base + 3] = (w - PRIME32_1) & 0xffffffff;\n }\n\n const limit = len - 16;\n for (; offset <= limit; offset += 16) {\n const l0 =\n b[offset] |\n (b[offset + 1] << 8) |\n (b[offset + 2] << 16) |\n (b[offset + 3] << 24);\n const l1 =\n b[offset + 4] |\n (b[offset + 5] << 8) |\n (b[offset + 6] << 16) |\n (b[offset + 7] << 24);\n const l2 =\n b[offset + 8] |\n (b[offset + 9] << 8) |\n (b[offset + 10] << 16) |\n (b[offset + 11] << 24);\n const l3 =\n b[offset + 12] |\n (b[offset + 13] << 8) |\n (b[offset + 14] << 16) |\n (b[offset + 15] << 24);\n for (let w = 0; w < words; w++) {\n const base = w << 2;\n stripes[base] = round32(stripes[base], l0);\n stripes[base + 1] = round32(stripes[base + 1], l1);\n stripes[base + 2] = round32(stripes[base + 2], l2);\n stripes[base + 3] = round32(stripes[base + 3], l3);\n }\n }\n\n /*\n Step 3. Accumulator convergence\n acc = (acc1 <<< 1) + (acc2 <<< 7) + (acc3 <<< 12) + (acc4 <<< 18);\n */\n for (let w = 0; w < words; w++) {\n const base = w << 2;\n const s0 = stripes[base];\n const s1 = stripes[base + 1];\n const s2 = stripes[base + 2];\n const s3 = stripes[base + 3];\n accs[w] =\n (((s0 << 1) | (s0 >>> 31)) +\n ((s1 << 7) | (s1 >>> 25)) +\n ((s2 << 12) | (s2 >>> 20)) +\n ((s3 << 18) | (s3 >>> 14))) &\n 0xffffffff;\n }\n }\n\n // Step 4. Add input length.\n for (let w = 0; w < words; w++) {\n accs[w] = (accs[w] + len) & 0xffffffff;\n }\n\n // Step 5. Consume the remaining input, 4 bytes at a time and then 1 at a time.\n const limit4 = len - 4;\n for (; offset <= limit4; offset += 4) {\n const laneN0 = b[offset] + (b[offset + 1] << 8);\n const laneN1 = b[offset + 2] + (b[offset + 3] << 8);\n const laneP = laneN0 * PRIME32_3 + ((laneN1 * PRIME32_3) << 16);\n for (let w = 0; w < words; w++) {\n let acc = (accs[w] + laneP) | 0;\n acc = (acc << 17) | (acc >>> 15);\n accs[w] = Math.imul(acc, PRIME32_4);\n }\n }\n\n for (; offset < len; ++offset) {\n const lane = b[offset];\n for (let w = 0; w < words; w++) {\n let acc = (accs[w] + Math.imul(lane, PRIME32_5)) | 0;\n acc = (acc << 11) | (acc >>> 21);\n accs[w] = Math.imul(acc, PRIME32_1);\n }\n }\n\n // Step 6. Final mix (avalanche). The Uint32Array store turns any negatives\n // back into a positive number.\n for (let w = 0; w < words; w++) {\n digests[w] = avalanche32(accs[w]);\n }\n}\n\n/**\n * A hash wider than 32 bits, folding `words` digests together highest seed\n * first.\n */\nfunction wide(str: string, words: number): bigint {\n digest(str, words);\n let result = 0n;\n for (let w = 0; w < words; w++) {\n result = (result << 32n) + BigInt(digests[w]);\n }\n return result;\n}\n\n// Re-exported for zero-protocol's AST hash, which cannot import xxhash32.ts\n// directly without tripping a tsc 7.0.2 bug (see the import comment in\n// zero-protocol/src/query-hash-visitor.ts).\nexport {avalanche32, PRIME32_1, PRIME32_5, round32} from './xxhash32.ts';\n"],"mappings":";;AAUA,IAAa,OAAO,MAAc;CAChC,OAAO,GAAG,CAAC;CACX,OAAO,QAAQ;AACjB;AACA,IAAa,OAAO,MAAc,KAAK,GAAG,CAAC;AAC3C,IAAa,QAAQ,MAAc,KAAK,GAAG,CAAC;AAE5C,IAAM,YAAY;AAIlB,IAAM,OAAO,IAAI,WAAW,SAAS;AACrC,IAAM,UAAU,IAAI,WAAW,YAAY,CAAC;AAC5C,IAAM,UAAU,IAAI,YAAY,SAAS;AACzC,IAAI;;;;;;;;;;;AAYJ,SAAS,OAAO,KAAa,OAAqB;CAChD,MAAM,KAAK,YAAY,IAAI,YAAY,GAAG,OAAO,GAAG;CACpD,MAAM,MAAM,EAAE;CAEd,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,KAAK,KAAM,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AC1B,KAAK,MACA,MAAM,IAAM,OAAO,OAClB,MAAM,IAAM,OAAO,OACnB,MAAM,KAAO,OAAO,OACpB,MAAM,KAAO,OAAO,MACxB;EACJ;CACF;CAGA,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,KAAK,KAAM,KAAK,KAAK,MAAO;CAI9B,MAAM,SAAS,MAAM;CACrB,OAAO,UAAU,QAAQ,UAAU,GAAG;EACpC,MAAM,SAAS,EAAE,WAAW,EAAE,SAAS,MAAM;EAC7C,MAAM,SAAS,EAAE,SAAS,MAAM,EAAE,SAAS,MAAM;EACjD,MAAM,QAAQ,SAAS,aAAc,SAAS,aAAc;EAC5D,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;GAC9B,IAAI,MAAO,KAAK,KAAK,QAAS;GAC9B,MAAO,OAAO,KAAO,QAAQ;GAC7B,KAAK,KAAK,KAAK,KAAK,KAAK,SAAS;EACpC;CACF;CAEA,OAAO,SAAS,KAAK,EAAE,QAAQ;EAC7B,MAAM,OAAO,EAAE;EACf,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KAAK;GAC9B,IAAI,MAAO,KAAK,KAAK,KAAK,KAAK,MAAM,SAAS,IAAK;GACnD,MAAO,OAAO,KAAO,QAAQ;GAC7B,KAAK,KAAK,KAAK,KAAK,KAAK,SAAS;EACpC;CACF;CAIA,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,QAAQ,KAAK,YAAY,KAAK,EAAE;AAEpC;;;;;AAMA,SAAS,KAAK,KAAa,OAAuB;CAChD,OAAO,KAAK,KAAK;CACjB,IAAI,SAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,UAAU,UAAU,OAAO,OAAO,QAAQ,EAAE;CAE9C,OAAO;AACT"}
1
+ {"version":3,"file":"hash.js","names":[],"sources":["../../../../shared/src/hash.ts"],"sourcesContent":["import {xxHash32} from 'js-xxhash';\n\nexport const h32 = (s: string) => xxHash32(s, 0);\nexport const h64 = (s: string) => hash(s, 2);\nexport const h128 = (s: string) => hash(s, 4);\n\n/**\n * xxHash32 only computes 32-bit values. Run it n times with different seeds to\n * get a larger hash with better collision resistance.\n */\nfunction hash(str: string, words: number): bigint {\n let hash = 0n;\n for (let i = 0; i < words; i++) {\n hash = (hash << 32n) + BigInt(xxHash32(str, i));\n }\n return hash;\n}\n"],"mappings":";;AAEA,IAAa,OAAO,MAAc,SAAS,GAAG,CAAC;AAC/C,IAAa,OAAO,MAAc,KAAK,GAAG,CAAC;AAC3C,IAAa,QAAQ,MAAc,KAAK,GAAG,CAAC;;;;;AAM5C,SAAS,KAAK,KAAa,OAAuB;CAChD,IAAI,OAAO;CACX,KAAK,IAAI,IAAI,GAAG,IAAI,OAAO,KACzB,QAAQ,QAAQ,OAAO,OAAO,SAAS,KAAK,CAAC,CAAC;CAEhD,OAAO;AACT"}
@@ -16,7 +16,5 @@ export declare function wrapIterable<T>(iter: Iterable<T>): IteratorWithHelpers<
16
16
  */
17
17
  export declare function toSorted<T>(iter: Iterable<T>, compare?: (a: T, b: T) => number): T[];
18
18
  export declare function some<T>(iterable: Iterable<T>, predicate: (item: T, index: number) => boolean): boolean;
19
- export declare const emptyIterator: IterableIterator<any, undefined, any>;
20
- export declare function makeEmptyIteratorWithReturn<T>(value: T): IterableIterator<any, T, any>;
21
19
  export {};
22
20
  //# sourceMappingURL=iterables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"iterables.d.ts","sourceRoot":"","sources":["../../../../shared/src/iterables.ts"],"names":[],"mappings":"AAAA,wBAAiB,aAAa,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,2BAIxD;AAwBD,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAK3D;AAED,wBAAiB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,C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C,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,GAC/B,CAAC,EAAE,CAGL;AAED,wBAAgB,IAAI,CAAC,CAAC,EACpB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,EACrB,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,GAC7C,OAAO,CAQT"}
@@ -55,24 +55,7 @@ function some(iterable, predicate) {
55
55
  for (const item of iterable) if (predicate(item, index++)) return true;
56
56
  return false;
57
57
  }
58
- var EmptyIteratorWithReturn = class {
59
- value;
60
- done = true;
61
- constructor(value) {
62
- this.value = value;
63
- }
64
- [Symbol.iterator]() {
65
- return this;
66
- }
67
- next() {
68
- return this;
69
- }
70
- };
71
- var emptyIterator = new EmptyIteratorWithReturn(void 0);
72
- function makeEmptyIteratorWithReturn(value) {
73
- return new EmptyIteratorWithReturn(value);
74
- }
75
58
  //#endregion
76
- export { emptyIterator, joinIterables, makeEmptyIteratorWithReturn, once, some, toSorted, wrapIterable };
59
+ export { joinIterables, once, some, toSorted, wrapIterable };
77
60
 
78
61
  //# sourceMappingURL=iterables.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"iterables.js","names":["#iterator"],"sources":["../../../../shared/src/iterables.ts"],"sourcesContent":["export function* joinIterables<T>(...iters: Iterable<T>[]) {\n for (const iter of iters) {\n yield* iter;\n }\n}\n\nfunction* filterIter<T>(\n iter: Iterable<T>,\n p: (t: T, index: number) => boolean,\n): Iterable<T> {\n let index = 0;\n for (const t of iter) {\n if (p(t, index++)) {\n yield t;\n }\n }\n}\n\nfunction* mapIter<T, U>(\n iter: Iterable<T>,\n f: (t: T, index: number) => U,\n): Iterable<U> {\n let index = 0;\n for (const t of iter) {\n yield f(t, index++);\n }\n}\n\nexport function first<T>(stream: Iterable<T>): T | undefined {\n const it = stream[Symbol.iterator]();\n const {value} = it.next();\n it.return?.();\n return value;\n}\n\nexport function* once<T>(stream: Iterable<T>): Iterable<T> {\n const it = stream[Symbol.iterator]();\n const {value} = it.next();\n if (value !== undefined) {\n yield value;\n }\n it.return?.();\n}\n\n// ES2024 Iterator helpers are available in Node 22+ and part of ES2024.\n// https://github.com/tc39/proposal-iterator-helpers\n\ntype IteratorWithHelpers<T> = Iterator<T> & {\n map<U>(f: (t: T, index: number) => U): IteratorWithHelpers<U>;\n filter(p: (t: T, index: number) => boolean): IteratorWithHelpers<T>;\n some(p: (t: T, index: number) => boolean): boolean;\n [Symbol.iterator](): IteratorWithHelpers<T>;\n};\n\ntype IteratorConstructor = {\n from<T>(this: void, iter: Iterable<T>): IteratorWithHelpers<T>;\n};\n\n// Check if native Iterator.from is available and bind it once at startup\n// We use globalThis to access the runtime value safely\nconst iteratorCtor = (globalThis as {Iterator?: IteratorConstructor}).Iterator;\nconst nativeIteratorFrom = iteratorCtor?.from as\n | (<T>(iter: Iterable<T>) => IteratorWithHelpers<T>)\n | undefined;\n\nconst iteratorFrom: <T>(e: Iterable<T>) => IteratorWithHelpers<T> =\n nativeIteratorFrom ?? (e => new IterWrapper(e));\n\n// Fallback implementation for environments without ES2024 Iterator helpers\nclass IterWrapper<T> implements IteratorWithHelpers<T>, IterableIterator<T> {\n readonly #iterator: Iterator<T>;\n\n constructor(iterable: Iterable<T>) {\n this.#iterator = iterable[Symbol.iterator]();\n }\n\n next(): IteratorResult<T> {\n return this.#iterator.next();\n }\n\n [Symbol.iterator](): IteratorWithHelpers<T> {\n return this;\n }\n\n map<U>(f: (t: T, index: number) => U): IterWrapper<U> {\n return new IterWrapper(mapIter(this, f));\n }\n\n filter(p: (t: T, index: number) => boolean): IterWrapper<T> {\n return new IterWrapper(filterIter(this, p));\n }\n\n some(p: (t: T, index: number) => boolean): boolean {\n return some(this, p);\n }\n}\n\nexport function wrapIterable<T>(iter: Iterable<T>): IteratorWithHelpers<T> {\n return iteratorFrom(iter);\n}\n\n/**\n * This will make a new array where the elements are the same as the iterable\n * but sorted according to the compare function. If the compare function is not\n * provided, it will sort the elements in JS standard way which is string\n * compare.\n */\nexport function toSorted<T>(\n iter: Iterable<T>,\n compare?: (a: T, b: T) => number,\n): T[] {\n // oxlint-disable-next-line e18e/prefer-array-to-sorted\n return [...iter].sort(compare);\n}\n\nexport function some<T>(\n iterable: Iterable<T>,\n predicate: (item: T, index: number) => boolean,\n): boolean {\n let index = 0;\n for (const item of iterable) {\n if (predicate(item, index++)) {\n return true;\n }\n }\n return false;\n}\n\nclass EmptyIteratorWithReturn<T>\n // oxlint-disable-next-line typescript/no-explicit-any\n implements IterableIterator<any, T, any>, IteratorReturnResult<T>\n{\n readonly value: T;\n readonly done = true;\n\n constructor(value: T) {\n this.value = value;\n }\n\n [Symbol.iterator]() {\n return this;\n }\n\n next() {\n return this;\n }\n}\n\n// oxlint-disable-next-line typescript/no-explicit-any\nexport const emptyIterator: IterableIterator<any, undefined, any> =\n new EmptyIteratorWithReturn(undefined);\n\nexport function makeEmptyIteratorWithReturn<T>(\n value: T,\n // oxlint-disable-next-line typescript/no-explicit-any\n): IterableIterator<any, T, any> {\n return new EmptyIteratorWithReturn(value);\n}\n"],"mappings":";AAAA,UAAiB,cAAiB,GAAG,OAAsB;CACzD,KAAK,MAAM,QAAQ,OACjB,OAAO;AAEX;AAEA,UAAU,WACR,MACA,GACa;CACb,IAAI,QAAQ;CACZ,KAAK,MAAM,KAAK,MACd,IAAI,EAAE,GAAG,OAAO,GACd,MAAM;AAGZ;AAEA,UAAU,QACR,MACA,GACa;CACb,IAAI,QAAQ;CACZ,KAAK,MAAM,KAAK,MACd,MAAM,EAAE,GAAG,OAAO;AAEtB;AASA,UAAiB,KAAQ,QAAkC;CACzD,MAAM,KAAK,OAAO,OAAO,UAAU;CACnC,MAAM,EAAC,UAAS,GAAG,KAAK;CACxB,IAAI,UAAU,KAAA,GACZ,MAAM;CAER,GAAG,SAAS;AACd;AAuBA,IAAM,eALgB,WAAgD,UAC7B,UAKhB,MAAK,IAAI,YAAY,CAAC;AAG/C,IAAM,cAAN,MAAM,YAAsE;CAC1E;CAEA,YAAY,UAAuB;EACjC,KAAKA,YAAY,SAAS,OAAO,UAAU;CAC7C;CAEA,OAA0B;EACxB,OAAO,KAAKA,UAAU,KAAK;CAC7B;CAEA,CAAC,OAAO,YAAoC;EAC1C,OAAO;CACT;CAEA,IAAO,GAA+C;EACpD,OAAO,IAAI,YAAY,QAAQ,MAAM,CAAC,CAAC;CACzC;CAEA,OAAO,GAAqD;EAC1D,OAAO,IAAI,YAAY,WAAW,MAAM,CAAC,CAAC;CAC5C;CAEA,KAAK,GAA8C;EACjD,OAAO,KAAK,MAAM,CAAC;CACrB;AACF;AAEA,SAAgB,aAAgB,MAA2C;CACzE,OAAO,aAAa,IAAI;AAC1B;;;;;;;AAQA,SAAgB,SACd,MACA,SACK;CAEL,OAAO,CAAC,GAAG,IAAI,EAAE,KAAK,OAAO;AAC/B;AAEA,SAAgB,KACd,UACA,WACS;CACT,IAAI,QAAQ;CACZ,KAAK,MAAM,QAAQ,UACjB,IAAI,UAAU,MAAM,OAAO,GACzB,OAAO;CAGX,OAAO;AACT;AAEA,IAAM,0BAAN,MAGA;CACE;CACA,OAAgB;CAEhB,YAAY,OAAU;EACpB,KAAK,QAAQ;CACf;CAEA,CAAC,OAAO,YAAY;EAClB,OAAO;CACT;CAEA,OAAO;EACL,OAAO;CACT;AACF;AAGA,IAAa,gBACX,IAAI,wBAAwB,KAAA,CAAS;AAEvC,SAAgB,4BACd,OAE+B;CAC/B,OAAO,IAAI,wBAAwB,KAAK;AAC1C"}
1
+ {"version":3,"file":"iterables.js","names":["#iterator"],"sources":["../../../../shared/src/iterables.ts"],"sourcesContent":["export function* joinIterables<T>(...iters: Iterable<T>[]) {\n for (const iter of iters) {\n yield* iter;\n }\n}\n\nfunction* filterIter<T>(\n iter: Iterable<T>,\n p: (t: T, index: number) => boolean,\n): Iterable<T> {\n let index = 0;\n for (const t of iter) {\n if (p(t, index++)) {\n yield t;\n }\n }\n}\n\nfunction* mapIter<T, U>(\n iter: Iterable<T>,\n f: (t: T, index: number) => U,\n): Iterable<U> {\n let index = 0;\n for (const t of iter) {\n yield f(t, index++);\n }\n}\n\nexport function first<T>(stream: Iterable<T>): T | undefined {\n const it = stream[Symbol.iterator]();\n const {value} = it.next();\n it.return?.();\n return value;\n}\n\nexport function* once<T>(stream: Iterable<T>): Iterable<T> {\n const it = stream[Symbol.iterator]();\n const {value} = it.next();\n if (value !== undefined) {\n yield value;\n }\n it.return?.();\n}\n\n// ES2024 Iterator helpers are available in Node 22+ and part of ES2024.\n// https://github.com/tc39/proposal-iterator-helpers\n\ntype IteratorWithHelpers<T> = Iterator<T> & {\n map<U>(f: (t: T, index: number) => U): IteratorWithHelpers<U>;\n filter(p: (t: T, index: number) => boolean): IteratorWithHelpers<T>;\n some(p: (t: T, index: number) => boolean): boolean;\n [Symbol.iterator](): IteratorWithHelpers<T>;\n};\n\ntype IteratorConstructor = {\n from<T>(this: void, iter: Iterable<T>): IteratorWithHelpers<T>;\n};\n\n// Check if native Iterator.from is available and bind it once at startup\n// We use globalThis to access the runtime value safely\nconst iteratorCtor = (globalThis as {Iterator?: IteratorConstructor}).Iterator;\nconst nativeIteratorFrom = iteratorCtor?.from as\n | (<T>(iter: Iterable<T>) => IteratorWithHelpers<T>)\n | undefined;\n\nconst iteratorFrom: <T>(e: Iterable<T>) => IteratorWithHelpers<T> =\n nativeIteratorFrom ?? (e => new IterWrapper(e));\n\n// Fallback implementation for environments without ES2024 Iterator helpers\nclass IterWrapper<T> implements IteratorWithHelpers<T>, IterableIterator<T> {\n readonly #iterator: Iterator<T>;\n\n constructor(iterable: Iterable<T>) {\n this.#iterator = iterable[Symbol.iterator]();\n }\n\n next(): IteratorResult<T> {\n return this.#iterator.next();\n }\n\n [Symbol.iterator](): IteratorWithHelpers<T> {\n return this;\n }\n\n map<U>(f: (t: T, index: number) => U): IterWrapper<U> {\n return new IterWrapper(mapIter(this, f));\n }\n\n filter(p: (t: T, index: number) => boolean): IterWrapper<T> {\n return new IterWrapper(filterIter(this, p));\n }\n\n some(p: (t: T, index: number) => boolean): boolean {\n return some(this, p);\n }\n}\n\nexport function wrapIterable<T>(iter: Iterable<T>): IteratorWithHelpers<T> {\n return iteratorFrom(iter);\n}\n\n/**\n * This will make a new array where the elements are the same as the iterable\n * but sorted according to the compare function. If the compare function is not\n * provided, it will sort the elements in JS standard way which is string\n * compare.\n */\nexport function toSorted<T>(\n iter: Iterable<T>,\n compare?: (a: T, b: T) => number,\n): T[] {\n // oxlint-disable-next-line e18e/prefer-array-to-sorted\n return [...iter].sort(compare);\n}\n\nexport function some<T>(\n iterable: Iterable<T>,\n predicate: (item: T, index: number) => boolean,\n): boolean {\n let index = 0;\n for (const item of iterable) {\n if (predicate(item, index++)) {\n return true;\n }\n }\n return false;\n}\n"],"mappings":";AAAA,UAAiB,cAAiB,GAAG,OAAsB;CACzD,KAAK,MAAM,QAAQ,OACjB,OAAO;AAEX;AAEA,UAAU,WACR,MACA,GACa;CACb,IAAI,QAAQ;CACZ,KAAK,MAAM,KAAK,MACd,IAAI,EAAE,GAAG,OAAO,GACd,MAAM;AAGZ;AAEA,UAAU,QACR,MACA,GACa;CACb,IAAI,QAAQ;CACZ,KAAK,MAAM,KAAK,MACd,MAAM,EAAE,GAAG,OAAO;AAEtB;AASA,UAAiB,KAAQ,QAAkC;CACzD,MAAM,KAAK,OAAO,OAAO,UAAU;CACnC,MAAM,EAAC,UAAS,GAAG,KAAK;CACxB,IAAI,UAAU,KAAA,GACZ,MAAM;CAER,GAAG,SAAS;AACd;AAuBA,IAAM,eALgB,WAAgD,UAC7B,UAKhB,MAAK,IAAI,YAAY,CAAC;AAG/C,IAAM,cAAN,MAAM,YAAsE;CAC1E;CAEA,YAAY,UAAuB;EACjC,KAAKA,YAAY,SAAS,OAAO,UAAU;CAC7C;CAEA,OAA0B;EACxB,OAAO,KAAKA,UAAU,KAAK;CAC7B;CAEA,CAAC,OAAO,YAAoC;EAC1C,OAAO;CACT;CAEA,IAAO,GAA+C;EACpD,OAAO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