@rocicorp/zero 1.12.0-canary.6 → 1.12.0-canary.7

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 (373) hide show
  1. package/out/zero/package.js +10 -10
  2. package/out/zero/package.js.map +1 -1
  3. package/out/zero-cache/src/auth/write-authorizer.js +9 -2
  4. package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
  5. package/out/zero-cache/src/server/change-streamer.js +1 -0
  6. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  7. package/out/zero-cache/src/services/change-source/common/replica-restore.js.map +1 -1
  8. package/out/zero-cache/src/services/change-source/pg/change-source-init.js +17 -9
  9. package/out/zero-cache/src/services/change-source/pg/change-source-init.js.map +1 -1
  10. package/out/zero-cache/src/services/change-streamer/server-start-metrics.js +1 -1
  11. package/out/zero-cache/src/services/change-streamer/server-start-metrics.js.map +1 -1
  12. package/out/zero-cache/src/services/mutagen/mutagen.js +1 -2
  13. package/out/zero-cache/src/services/mutagen/mutagen.js.map +1 -1
  14. package/out/zero-cache/src/services/view-syncer/view-syncer.js +19 -2
  15. package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
  16. package/out/zero-client/src/client/version.js +1 -1
  17. package/out/zero-protocol/src/inspect-down.d.ts +81 -81
  18. package/out/zero-protocol/src/up.d.ts +60 -60
  19. package/package.json +10 -10
  20. package/out/shared/src/cache.d.ts +0 -22
  21. package/out/shared/src/cache.d.ts.map +0 -1
  22. package/out/shared/src/custom-key-map.d.ts +0 -26
  23. package/out/shared/src/custom-key-map.d.ts.map +0 -1
  24. package/out/shared/src/custom-key-set.d.ts +0 -25
  25. package/out/shared/src/custom-key-set.d.ts.map +0 -1
  26. package/out/shared/src/logging-test-utils.d.ts +0 -12
  27. package/out/shared/src/logging-test-utils.d.ts.map +0 -1
  28. package/out/shared/src/queue.d.ts +0 -53
  29. package/out/shared/src/queue.d.ts.map +0 -1
  30. package/out/shared/src/ring-buffer.d.ts +0 -42
  31. package/out/shared/src/ring-buffer.d.ts.map +0 -1
  32. package/out/shared/src/sorted-entries.d.ts +0 -2
  33. package/out/shared/src/sorted-entries.d.ts.map +0 -1
  34. package/out/zero/src/server/change-streamer.d.ts +0 -2
  35. package/out/zero/src/server/change-streamer.d.ts.map +0 -1
  36. package/out/zero/src/server/main.d.ts +0 -2
  37. package/out/zero/src/server/main.d.ts.map +0 -1
  38. package/out/zero/src/server/reaper.d.ts +0 -2
  39. package/out/zero/src/server/reaper.d.ts.map +0 -1
  40. package/out/zero/src/server/replicator.d.ts +0 -2
  41. package/out/zero/src/server/replicator.d.ts.map +0 -1
  42. package/out/zero/src/server/syncer.d.ts +0 -2
  43. package/out/zero/src/server/syncer.d.ts.map +0 -1
  44. package/out/zero-cache/src/auth/jwt.d.ts +0 -12
  45. package/out/zero-cache/src/auth/jwt.d.ts.map +0 -1
  46. package/out/zero-cache/src/auth/load-permissions.d.ts +0 -17
  47. package/out/zero-cache/src/auth/load-permissions.d.ts.map +0 -1
  48. package/out/zero-cache/src/auth/write-authorizer.d.ts +0 -28
  49. package/out/zero-cache/src/auth/write-authorizer.d.ts.map +0 -1
  50. package/out/zero-cache/src/config/server-context.d.ts +0 -16
  51. package/out/zero-cache/src/config/server-context.d.ts.map +0 -1
  52. package/out/zero-cache/src/custom/fetch.d.ts +0 -38
  53. package/out/zero-cache/src/custom/fetch.d.ts.map +0 -1
  54. package/out/zero-cache/src/custom/metrics.d.ts +0 -31
  55. package/out/zero-cache/src/custom/metrics.d.ts.map +0 -1
  56. package/out/zero-cache/src/custom-queries/transform-query.d.ts +0 -68
  57. package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +0 -1
  58. package/out/zero-cache/src/db/create.d.ts +0 -12
  59. package/out/zero-cache/src/db/create.d.ts.map +0 -1
  60. package/out/zero-cache/src/db/delete-lite-db.d.ts +0 -2
  61. package/out/zero-cache/src/db/delete-lite-db.d.ts.map +0 -1
  62. package/out/zero-cache/src/db/index-predicate.d.ts +0 -4
  63. package/out/zero-cache/src/db/index-predicate.d.ts.map +0 -1
  64. package/out/zero-cache/src/db/migration-lite.d.ts +0 -78
  65. package/out/zero-cache/src/db/migration-lite.d.ts.map +0 -1
  66. package/out/zero-cache/src/db/migration.d.ts +0 -80
  67. package/out/zero-cache/src/db/migration.d.ts.map +0 -1
  68. package/out/zero-cache/src/db/pg-copy-binary.d.ts +0 -101
  69. package/out/zero-cache/src/db/pg-copy-binary.d.ts.map +0 -1
  70. package/out/zero-cache/src/db/pg-copy.d.ts +0 -30
  71. package/out/zero-cache/src/db/pg-copy.d.ts.map +0 -1
  72. package/out/zero-cache/src/db/pg-type-parser.d.ts +0 -15
  73. package/out/zero-cache/src/db/pg-type-parser.d.ts.map +0 -1
  74. package/out/zero-cache/src/db/transaction-pool.d.ts +0 -205
  75. package/out/zero-cache/src/db/transaction-pool.d.ts.map +0 -1
  76. package/out/zero-cache/src/db/warmup.d.ts +0 -4
  77. package/out/zero-cache/src/db/warmup.d.ts.map +0 -1
  78. package/out/zero-cache/src/observability/events.d.ts +0 -15
  79. package/out/zero-cache/src/observability/events.d.ts.map +0 -1
  80. package/out/zero-cache/src/observability/log-throttle.d.ts +0 -44
  81. package/out/zero-cache/src/observability/log-throttle.d.ts.map +0 -1
  82. package/out/zero-cache/src/server/anonymous-otel-start.d.ts +0 -21
  83. package/out/zero-cache/src/server/anonymous-otel-start.d.ts.map +0 -1
  84. package/out/zero-cache/src/server/change-streamer.d.ts +0 -3
  85. package/out/zero-cache/src/server/change-streamer.d.ts.map +0 -1
  86. package/out/zero-cache/src/server/inspector-delegate.d.ts +0 -71
  87. package/out/zero-cache/src/server/inspector-delegate.d.ts.map +0 -1
  88. package/out/zero-cache/src/server/main.d.ts +0 -3
  89. package/out/zero-cache/src/server/main.d.ts.map +0 -1
  90. package/out/zero-cache/src/server/otel-diag-logger.d.ts +0 -16
  91. package/out/zero-cache/src/server/otel-diag-logger.d.ts.map +0 -1
  92. package/out/zero-cache/src/server/otel-start.d.ts +0 -3
  93. package/out/zero-cache/src/server/otel-start.d.ts.map +0 -1
  94. package/out/zero-cache/src/server/priority-op.d.ts +0 -8
  95. package/out/zero-cache/src/server/priority-op.d.ts.map +0 -1
  96. package/out/zero-cache/src/server/reaper.d.ts +0 -3
  97. package/out/zero-cache/src/server/reaper.d.ts.map +0 -1
  98. package/out/zero-cache/src/server/replicator.d.ts +0 -10
  99. package/out/zero-cache/src/server/replicator.d.ts.map +0 -1
  100. package/out/zero-cache/src/server/slot-keeper.d.ts +0 -26
  101. package/out/zero-cache/src/server/slot-keeper.d.ts.map +0 -1
  102. package/out/zero-cache/src/server/syncer-assigner.d.ts +0 -14
  103. package/out/zero-cache/src/server/syncer-assigner.d.ts.map +0 -1
  104. package/out/zero-cache/src/server/syncer.d.ts +0 -3
  105. package/out/zero-cache/src/server/syncer.d.ts.map +0 -1
  106. package/out/zero-cache/src/server/worker-dispatcher.d.ts +0 -17
  107. package/out/zero-cache/src/server/worker-dispatcher.d.ts.map +0 -1
  108. package/out/zero-cache/src/services/analyze.d.ts +0 -9
  109. package/out/zero-cache/src/services/analyze.d.ts.map +0 -1
  110. package/out/zero-cache/src/services/change-source/change-source.d.ts +0 -39
  111. package/out/zero-cache/src/services/change-source/change-source.d.ts.map +0 -1
  112. package/out/zero-cache/src/services/change-source/common/backfill-manager.d.ts +0 -57
  113. package/out/zero-cache/src/services/change-source/common/backfill-manager.d.ts.map +0 -1
  114. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.d.ts +0 -55
  115. package/out/zero-cache/src/services/change-source/common/change-stream-multiplexer.d.ts.map +0 -1
  116. package/out/zero-cache/src/services/change-source/common/init-cleanup.d.ts +0 -24
  117. package/out/zero-cache/src/services/change-source/common/init-cleanup.d.ts.map +0 -1
  118. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts +0 -140
  119. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts.map +0 -1
  120. package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts +0 -14
  121. package/out/zero-cache/src/services/change-source/common/replica-schema.d.ts.map +0 -1
  122. package/out/zero-cache/src/services/change-source/custom/change-source.d.ts +0 -25
  123. package/out/zero-cache/src/services/change-source/custom/change-source.d.ts.map +0 -1
  124. package/out/zero-cache/src/services/change-source/pg/backfill-metadata.d.ts +0 -14
  125. package/out/zero-cache/src/services/change-source/pg/backfill-metadata.d.ts.map +0 -1
  126. package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts +0 -36
  127. package/out/zero-cache/src/services/change-source/pg/backfill-stream.d.ts.map +0 -1
  128. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts +0 -72
  129. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts.map +0 -1
  130. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts +0 -127
  131. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +0 -1
  132. package/out/zero-cache/src/services/change-source/pg/fork-request.d.ts +0 -57
  133. package/out/zero-cache/src/services/change-source/pg/fork-request.d.ts.map +0 -1
  134. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts +0 -155
  135. package/out/zero-cache/src/services/change-source/pg/initial-sync.d.ts.map +0 -1
  136. package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts +0 -17
  137. package/out/zero-cache/src/services/change-source/pg/logical-replication/binary-reader.d.ts.map +0 -1
  138. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput-parser.d.ts +0 -28
  139. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput-parser.d.ts.map +0 -1
  140. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput.types.d.ts +0 -76
  141. package/out/zero-cache/src/services/change-source/pg/logical-replication/pgoutput.types.d.ts.map +0 -1
  142. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts +0 -169
  143. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts.map +0 -1
  144. package/out/zero-cache/src/services/change-source/pg/replication-slot-cleanup-monitor.d.ts +0 -16
  145. package/out/zero-cache/src/services/change-source/pg/replication-slot-cleanup-monitor.d.ts.map +0 -1
  146. package/out/zero-cache/src/services/change-source/pg/replication-slot-health.d.ts +0 -15
  147. package/out/zero-cache/src/services/change-source/pg/replication-slot-health.d.ts.map +0 -1
  148. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts +0 -127
  149. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts.map +0 -1
  150. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts +0 -9
  151. package/out/zero-cache/src/services/change-source/pg/schema/init.d.ts.map +0 -1
  152. package/out/zero-cache/src/services/change-source/protocol/backfill-progress.d.ts +0 -68
  153. package/out/zero-cache/src/services/change-source/protocol/backfill-progress.d.ts.map +0 -1
  154. package/out/zero-cache/src/services/change-streamer/backfill-state-tracker.d.ts +0 -72
  155. package/out/zero-cache/src/services/change-streamer/backfill-state-tracker.d.ts.map +0 -1
  156. package/out/zero-cache/src/services/change-streamer/backfill-state.d.ts +0 -50
  157. package/out/zero-cache/src/services/change-streamer/backfill-state.d.ts.map +0 -1
  158. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts +0 -12
  159. package/out/zero-cache/src/services/change-streamer/backup-cleanup-monitor-factory.d.ts.map +0 -1
  160. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts +0 -57
  161. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts.map +0 -1
  162. package/out/zero-cache/src/services/change-streamer/broadcast.d.ts +0 -98
  163. package/out/zero-cache/src/services/change-streamer/broadcast.d.ts.map +0 -1
  164. package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts +0 -34
  165. package/out/zero-cache/src/services/change-streamer/change-log-codec.d.ts.map +0 -1
  166. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts +0 -34
  167. package/out/zero-cache/src/services/change-streamer/change-log-compare-digest.d.ts.map +0 -1
  168. package/out/zero-cache/src/services/change-streamer/change-log-initializer.d.ts +0 -158
  169. package/out/zero-cache/src/services/change-streamer/change-log-initializer.d.ts.map +0 -1
  170. package/out/zero-cache/src/services/change-streamer/change-log-transaction-hash.d.ts +0 -19
  171. package/out/zero-cache/src/services/change-streamer/change-log-transaction-hash.d.ts.map +0 -1
  172. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts +0 -78
  173. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +0 -1
  174. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts +0 -152
  175. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts.map +0 -1
  176. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +0 -575
  177. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts.map +0 -1
  178. package/out/zero-cache/src/services/change-streamer/drain-tracker.d.ts +0 -24
  179. package/out/zero-cache/src/services/change-streamer/drain-tracker.d.ts.map +0 -1
  180. package/out/zero-cache/src/services/change-streamer/error-type-enum.d.ts +0 -15
  181. package/out/zero-cache/src/services/change-streamer/error-type-enum.d.ts.map +0 -1
  182. package/out/zero-cache/src/services/change-streamer/forwarder.d.ts +0 -49
  183. package/out/zero-cache/src/services/change-streamer/forwarder.d.ts.map +0 -1
  184. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.d.ts +0 -80
  185. package/out/zero-cache/src/services/change-streamer/litestream-sync-requester.d.ts.map +0 -1
  186. package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.d.ts +0 -88
  187. package/out/zero-cache/src/services/change-streamer/litestream3-prometheus-poller.d.ts.map +0 -1
  188. package/out/zero-cache/src/services/change-streamer/replica-poller.d.ts +0 -15
  189. package/out/zero-cache/src/services/change-streamer/replica-poller.d.ts.map +0 -1
  190. package/out/zero-cache/src/services/change-streamer/restore-admission.d.ts +0 -243
  191. package/out/zero-cache/src/services/change-streamer/restore-admission.d.ts.map +0 -1
  192. package/out/zero-cache/src/services/change-streamer/schema/init.d.ts +0 -6
  193. package/out/zero-cache/src/services/change-streamer/schema/init.d.ts.map +0 -1
  194. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts +0 -152
  195. package/out/zero-cache/src/services/change-streamer/schema/tables.d.ts.map +0 -1
  196. package/out/zero-cache/src/services/change-streamer/server-start-metrics.d.ts +0 -33
  197. package/out/zero-cache/src/services/change-streamer/server-start-metrics.d.ts.map +0 -1
  198. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts +0 -11
  199. package/out/zero-cache/src/services/change-streamer/shard-sampling.d.ts.map +0 -1
  200. package/out/zero-cache/src/services/change-streamer/snapshot-message.d.ts +0 -92
  201. package/out/zero-cache/src/services/change-streamer/snapshot-message.d.ts.map +0 -1
  202. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts +0 -36
  203. package/out/zero-cache/src/services/change-streamer/snapshot-reservations.d.ts.map +0 -1
  204. package/out/zero-cache/src/services/change-streamer/snapshot.d.ts +0 -22
  205. package/out/zero-cache/src/services/change-streamer/snapshot.d.ts.map +0 -1
  206. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts +0 -99
  207. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-catchup.d.ts.map +0 -1
  208. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts +0 -83
  209. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-comparator.d.ts.map +0 -1
  210. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-purge-scheduler.d.ts +0 -121
  211. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-purge-scheduler.d.ts.map +0 -1
  212. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts +0 -73
  213. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-read-router.d.ts.map +0 -1
  214. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts +0 -62
  215. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-reader.d.ts.map +0 -1
  216. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.d.ts +0 -114
  217. package/out/zero-cache/src/services/change-streamer/sqlite-change-log-writer.d.ts.map +0 -1
  218. package/out/zero-cache/src/services/change-streamer/storer.d.ts +0 -276
  219. package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +0 -1
  220. package/out/zero-cache/src/services/change-streamer/subscribe.d.ts +0 -485
  221. package/out/zero-cache/src/services/change-streamer/subscribe.d.ts.map +0 -1
  222. package/out/zero-cache/src/services/change-streamer/subscriber.d.ts +0 -205
  223. package/out/zero-cache/src/services/change-streamer/subscriber.d.ts.map +0 -1
  224. package/out/zero-cache/src/services/change-streamer/upstream-acker.d.ts +0 -52
  225. package/out/zero-cache/src/services/change-streamer/upstream-acker.d.ts.map +0 -1
  226. package/out/zero-cache/src/services/limiter/sliding-window-limiter.d.ts +0 -57
  227. package/out/zero-cache/src/services/limiter/sliding-window-limiter.d.ts.map +0 -1
  228. package/out/zero-cache/src/services/litestream/commands.d.ts +0 -77
  229. package/out/zero-cache/src/services/litestream/commands.d.ts.map +0 -1
  230. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts +0 -78
  231. package/out/zero-cache/src/services/litestream/litestream-controller.d.ts.map +0 -1
  232. package/out/zero-cache/src/services/litestream/metrics.d.ts +0 -31
  233. package/out/zero-cache/src/services/litestream/metrics.d.ts.map +0 -1
  234. package/out/zero-cache/src/services/litestream/restore-progress.d.ts +0 -24
  235. package/out/zero-cache/src/services/litestream/restore-progress.d.ts.map +0 -1
  236. package/out/zero-cache/src/services/mutagen/mutagen.d.ts +0 -40
  237. package/out/zero-cache/src/services/mutagen/mutagen.d.ts.map +0 -1
  238. package/out/zero-cache/src/services/mutagen/pusher.d.ts +0 -63
  239. package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +0 -1
  240. package/out/zero-cache/src/services/replicator/change-log-db.d.ts +0 -368
  241. package/out/zero-cache/src/services/replicator/change-log-db.d.ts.map +0 -1
  242. package/out/zero-cache/src/services/replicator/change-log-stream-writer.d.ts +0 -56
  243. package/out/zero-cache/src/services/replicator/change-log-stream-writer.d.ts.map +0 -1
  244. package/out/zero-cache/src/services/replicator/change-processor.d.ts +0 -37
  245. package/out/zero-cache/src/services/replicator/change-processor.d.ts.map +0 -1
  246. package/out/zero-cache/src/services/replicator/drain-handler.d.ts +0 -82
  247. package/out/zero-cache/src/services/replicator/drain-handler.d.ts.map +0 -1
  248. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts +0 -25
  249. package/out/zero-cache/src/services/replicator/incremental-sync.d.ts.map +0 -1
  250. package/out/zero-cache/src/services/replicator/notifier.d.ts +0 -9
  251. package/out/zero-cache/src/services/replicator/notifier.d.ts.map +0 -1
  252. package/out/zero-cache/src/services/replicator/replication-status.d.ts +0 -71
  253. package/out/zero-cache/src/services/replicator/replication-status.d.ts.map +0 -1
  254. package/out/zero-cache/src/services/replicator/replicator.d.ts +0 -86
  255. package/out/zero-cache/src/services/replicator/replicator.d.ts.map +0 -1
  256. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts +0 -55
  257. package/out/zero-cache/src/services/replicator/reporter/recorder.d.ts.map +0 -1
  258. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts +0 -132
  259. package/out/zero-cache/src/services/replicator/sqlite-change-log-observability.d.ts.map +0 -1
  260. package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.d.ts +0 -120
  261. package/out/zero-cache/src/services/replicator/sqlite-change-log-purger.d.ts.map +0 -1
  262. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts +0 -111
  263. package/out/zero-cache/src/services/replicator/write-worker-client.d.ts.map +0 -1
  264. package/out/zero-cache/src/services/run-ast.d.ts +0 -39
  265. package/out/zero-cache/src/services/run-ast.d.ts.map +0 -1
  266. package/out/zero-cache/src/services/runner.d.ts +0 -19
  267. package/out/zero-cache/src/services/runner.d.ts.map +0 -1
  268. package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts +0 -17
  269. package/out/zero-cache/src/services/view-syncer/active-users-gauge.d.ts.map +0 -1
  270. package/out/zero-cache/src/services/view-syncer/advancement-metrics.d.ts +0 -26
  271. package/out/zero-cache/src/services/view-syncer/advancement-metrics.d.ts.map +0 -1
  272. package/out/zero-cache/src/services/view-syncer/batch-pacer.d.ts +0 -79
  273. package/out/zero-cache/src/services/view-syncer/batch-pacer.d.ts.map +0 -1
  274. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts +0 -97
  275. package/out/zero-cache/src/services/view-syncer/client-handler.d.ts.map +0 -1
  276. package/out/zero-cache/src/services/view-syncer/client-schema.d.ts +0 -18
  277. package/out/zero-cache/src/services/view-syncer/client-schema.d.ts.map +0 -1
  278. package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts +0 -184
  279. package/out/zero-cache/src/services/view-syncer/connection-context-manager.d.ts.map +0 -1
  280. package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts +0 -22
  281. package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts.map +0 -1
  282. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +0 -128
  283. package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +0 -1
  284. package/out/zero-cache/src/services/view-syncer/cvr.d.ts +0 -294
  285. package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +0 -1
  286. package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.d.ts +0 -81
  287. package/out/zero-cache/src/services/view-syncer/deferred-writes-budget.d.ts.map +0 -1
  288. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts +0 -45
  289. package/out/zero-cache/src/services/view-syncer/drain-coordinator.d.ts.map +0 -1
  290. package/out/zero-cache/src/services/view-syncer/e2e-serving-lag.d.ts +0 -53
  291. package/out/zero-cache/src/services/view-syncer/e2e-serving-lag.d.ts.map +0 -1
  292. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts +0 -33
  293. package/out/zero-cache/src/services/view-syncer/hydration-budget.d.ts.map +0 -1
  294. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts +0 -51
  295. package/out/zero-cache/src/services/view-syncer/hydration-circuit-breaker.d.ts.map +0 -1
  296. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts +0 -34
  297. package/out/zero-cache/src/services/view-syncer/inspect-handler.d.ts.map +0 -1
  298. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +0 -296
  299. package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +0 -1
  300. package/out/zero-cache/src/services/view-syncer/plan-warnings.d.ts +0 -7
  301. package/out/zero-cache/src/services/view-syncer/plan-warnings.d.ts.map +0 -1
  302. package/out/zero-cache/src/services/view-syncer/push-cost.d.ts +0 -132
  303. package/out/zero-cache/src/services/view-syncer/push-cost.d.ts.map +0 -1
  304. package/out/zero-cache/src/services/view-syncer/push-cutoff.d.ts +0 -55
  305. package/out/zero-cache/src/services/view-syncer/push-cutoff.d.ts.map +0 -1
  306. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts +0 -28
  307. package/out/zero-cache/src/services/view-syncer/query-covering.d.ts.map +0 -1
  308. package/out/zero-cache/src/services/view-syncer/query-shape.d.ts +0 -25
  309. package/out/zero-cache/src/services/view-syncer/query-shape.d.ts.map +0 -1
  310. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts +0 -89
  311. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts.map +0 -1
  312. package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts +0 -90
  313. package/out/zero-cache/src/services/view-syncer/row-record-cache.d.ts.map +0 -1
  314. package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts +0 -17
  315. package/out/zero-cache/src/services/view-syncer/row-set-signature.d.ts.map +0 -1
  316. package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts +0 -86
  317. package/out/zero-cache/src/services/view-syncer/schema/cvr.d.ts.map +0 -1
  318. package/out/zero-cache/src/services/view-syncer/schema/init.d.ts +0 -5
  319. package/out/zero-cache/src/services/view-syncer/schema/init.d.ts.map +0 -1
  320. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +0 -563
  321. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts.map +0 -1
  322. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts +0 -95
  323. package/out/zero-cache/src/services/view-syncer/snapshot-row-cache.d.ts.map +0 -1
  324. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts +0 -420
  325. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +0 -1
  326. package/out/zero-cache/src/services/view-syncer/tracer.d.ts +0 -2
  327. package/out/zero-cache/src/services/view-syncer/tracer.d.ts.map +0 -1
  328. package/out/zero-cache/src/services/view-syncer/ttl-clock.d.ts +0 -10
  329. package/out/zero-cache/src/services/view-syncer/ttl-clock.d.ts.map +0 -1
  330. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +0 -133
  331. package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +0 -1
  332. package/out/zero-cache/src/types/downstream.d.ts +0 -11
  333. package/out/zero-cache/src/types/downstream.d.ts.map +0 -1
  334. package/out/zero-cache/src/types/error-with-level.d.ts +0 -9
  335. package/out/zero-cache/src/types/error-with-level.d.ts.map +0 -1
  336. package/out/zero-cache/src/types/pg-patch.d.ts +0 -21
  337. package/out/zero-cache/src/types/pg-patch.d.ts.map +0 -1
  338. package/out/zero-cache/src/types/pg-versions.d.ts +0 -3
  339. package/out/zero-cache/src/types/pg-versions.d.ts.map +0 -1
  340. package/out/zero-cache/src/types/poke-chunk.d.ts +0 -18
  341. package/out/zero-cache/src/types/poke-chunk.d.ts.map +0 -1
  342. package/out/zero-cache/src/types/streams.d.ts +0 -115
  343. package/out/zero-cache/src/types/streams.d.ts.map +0 -1
  344. package/out/zero-cache/src/types/subscription.d.ts +0 -197
  345. package/out/zero-cache/src/types/subscription.d.ts.map +0 -1
  346. package/out/zero-cache/src/workers/connect-params.d.ts +0 -28
  347. package/out/zero-cache/src/workers/connect-params.d.ts.map +0 -1
  348. package/out/zero-cache/src/workers/connection.d.ts +0 -77
  349. package/out/zero-cache/src/workers/connection.d.ts.map +0 -1
  350. package/out/zero-cache/src/workers/replicator.d.ts +0 -57
  351. package/out/zero-cache/src/workers/replicator.d.ts.map +0 -1
  352. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts +0 -14
  353. package/out/zero-cache/src/workers/syncer-ws-message-handler.d.ts.map +0 -1
  354. package/out/zero-cache/src/workers/syncer.d.ts +0 -67
  355. package/out/zero-cache/src/workers/syncer.d.ts.map +0 -1
  356. package/out/zero-events/src/index.d.ts +0 -27
  357. package/out/zero-events/src/index.d.ts.map +0 -1
  358. package/out/zero-events/src/json.d.ts +0 -20
  359. package/out/zero-events/src/json.d.ts.map +0 -1
  360. package/out/zero-events/src/status.d.ts +0 -144
  361. package/out/zero-events/src/status.d.ts.map +0 -1
  362. package/out/zqlite/src/database-storage.d.ts +0 -43
  363. package/out/zqlite/src/database-storage.d.ts.map +0 -1
  364. package/out/zqlite/src/explain-queries.d.ts +0 -4
  365. package/out/zqlite/src/explain-queries.d.ts.map +0 -1
  366. package/out/zqlite/src/internal/sql-inline.d.ts +0 -13
  367. package/out/zqlite/src/internal/sql-inline.d.ts.map +0 -1
  368. package/out/zqlite/src/resolve-scalar-subqueries.d.ts +0 -72
  369. package/out/zqlite/src/resolve-scalar-subqueries.d.ts.map +0 -1
  370. package/out/zqlite/src/sqlite-cost-model.d.ts +0 -17
  371. package/out/zqlite/src/sqlite-cost-model.d.ts.map +0 -1
  372. package/out/zqlite/src/sqlite-stat-fanout.d.ts +0 -121
  373. package/out/zqlite/src/sqlite-stat-fanout.d.ts.map +0 -1
@@ -1,25 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { Source } from '../../types/streams.ts';
3
- import type { ReservationFollowup } from '../change-streamer/change-streamer-http.ts';
4
- import { type ChangeStreamer } from '../change-streamer/change-streamer.ts';
5
- import { type SwitchoverOptions } from './drain-handler.ts';
6
- import { type ReplicationStatusPublisher } from './replication-status.ts';
7
- import type { ReplicaState, ReplicatorMode } from './replicator.ts';
8
- import { type ReplicationLagReadinessOptions } from './reporter/recorder.ts';
9
- import type { WriteWorkerClient } from './write-worker-client.ts';
10
- /**
11
- * The {@link IncrementalSyncer} manages a logical replication stream from upstream,
12
- * handling application lifecycle events (start, stop) and retrying the
13
- * connection with exponential backoff. The actual handling of the logical
14
- * replication messages is done by the {@link ChangeProcessor}, which runs
15
- * in a worker thread via the {@link WriteWorkerClient}.
16
- */
17
- export declare class IncrementalSyncer {
18
- #private;
19
- constructor(lc: LogContext, taskID: string, id: string, changeStreamer: ChangeStreamer, worker: WriteWorkerClient, mode: ReplicatorMode, statusPublisher: ReplicationStatusPublisher | null, replicationLagReadinessOptions?: ReplicationLagReadinessOptions, initialConnection?: ReservationFollowup, switchover?: SwitchoverOptions);
20
- ready(): Promise<void>;
21
- run(): Promise<void>;
22
- subscribe(): Source<ReplicaState>;
23
- stop(lc: LogContext, err?: unknown): void;
24
- }
25
- //# sourceMappingURL=incremental-sync.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"incremental-sync.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/incremental-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAOjD,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAGnD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,4CAA4C,CAAC;AACpF,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,uCAAuC,CAAC;AAM/C,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAEL,KAAK,8BAA8B,EACpC,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAchE;;;;;;GAMG;AACH,qBAAa,iBAAiB;;IA2B5B,YACE,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAE,cAAc,EACpB,eAAe,EAAE,0BAA0B,GAAG,IAAI,EAClD,8BAA8B,GAAE,8BAAmC,EACnE,iBAAiB,CAAC,EAAE,mBAAmB,EACvC,UAAU,CAAC,EAAE,iBAAiB,EAuB/B;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;IAEK,GAAG,kBAsSR;IA6BD,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,CAEhC;IAqCD,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,OAAO,QAIjC;CACF"}
@@ -1,9 +0,0 @@
1
- import { type Result, Subscription } from '../../types/subscription.ts';
2
- import type { ReplicaState, ReplicaStateNotifier } from './replicator.ts';
3
- export declare class Notifier implements ReplicaStateNotifier {
4
- #private;
5
- get latestState(): ReplicaState | undefined;
6
- subscribe(): Subscription<ReplicaState>;
7
- notifySubscribers(state?: ReplicaState): Promise<Result>[];
8
- }
9
- //# sourceMappingURL=notifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"notifier.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/notifier.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,MAAM,EACX,YAAY,EACb,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAC,YAAY,EAAE,oBAAoB,EAAC,MAAM,iBAAiB,CAAC;AAqCxE,qBAAa,QAAS,YAAW,oBAAoB;;IAInD,IAAI,WAAW,IAAI,YAAY,GAAG,SAAS,CAE1C;IAyBD,SAAS,IAAI,YAAY,CAAC,YAAY,CAAC,CAStC;IAED,iBAAiB,CACf,KAAK,GAAE,YAAuC,GAC7C,OAAO,CAAC,MAAM,CAAC,EAAE,CAMnB;CACF"}
@@ -1,71 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { JSONObject } from '../../../../zero-events/src/json.ts';
3
- import type { IndexingStatus, ReplicationStage, ReplicationState, ReplicationStatusEvent, Status } from '../../../../zero-events/src/status.ts';
4
- import { Database } from '../../../../zqlite/src/db.ts';
5
- import type { LiteIndexSpec } from '../../db/specs.ts';
6
- import { publishCriticalEvent } from '../../observability/events.ts';
7
- export type GrowthOptions = {
8
- /** How often to check the replica size. */
9
- pollMs?: number;
10
- /** Republish when the replica grew by at least this many bytes ... */
11
- minDeltaBytes?: number;
12
- /** ... and by at least this fraction of the last published size. */
13
- minDeltaRatio?: number;
14
- };
15
- export declare class ReplicationStatusPublisher {
16
- #private;
17
- static forTesting(): ReplicationStatusPublisher;
18
- static forRunningTransaction(tx: Database, publishFn?: typeof publishCriticalEvent): ReplicationStatusPublisher;
19
- static forReplicaFile(file: string, publishFn?: typeof publishCriticalEvent): ReplicationStatusPublisher;
20
- constructor(dbRunner: <T>(lc: LogContext, fn: (db: Database) => T) => T, publishFn?: typeof publishCriticalEvent);
21
- publish(lc: LogContext, stage: ReplicationStage, description?: string, interval?: number, extraState?: () => Partial<ReplicationState>, now?: Date): this;
22
- /**
23
- * Like {@link publish}, but waits (for at most `maxWaitMs`) for the event
24
- * to be sent. Use this before a long synchronous operation (e.g. creating
25
- * an index) that blocks the event loop and would otherwise prevent the
26
- * event from being sent until the operation completes.
27
- */
28
- publishAndFlush(lc: LogContext, stage: ReplicationStage, description?: string, interval?: number, extraState?: () => Partial<ReplicationState>, maxWaitMs?: number): Promise<void>;
29
- /**
30
- * Republishes the last published status whenever the replica has grown by
31
- * the given delta since the last published `replicaSize`, until
32
- * {@link stop}. Consumers (e.g. Cloud Zero, which sizes the disk requests of
33
- * replicas from it) thereby see growth from any source, not only from
34
- * backfills and initial syncs. The status interval of {@link publish} keeps
35
- * running alongside.
36
- */
37
- watchGrowth(lc: LogContext, options?: GrowthOptions): this;
38
- publishAndThrowError(lc: LogContext, stage: ReplicationStage, e: unknown): Promise<never>;
39
- /** Stops the status interval and the growth watch. */
40
- stop(): this;
41
- }
42
- /**
43
- * Tracks the progress of a sequence of index creations for reporting in
44
- * the `indexingStatus` field of {@link ReplicationState}.
45
- */
46
- export declare class IndexingProgress {
47
- #private;
48
- /**
49
- * @param totalIndexes The total number of indexes to be created, if known.
50
- */
51
- constructor(totalIndexes?: number, now?: () => number);
52
- /** Marks the start of creating the `index`. */
53
- start(index: LiteIndexSpec): void;
54
- /**
55
- * Restarts the timer of the current index, e.g. to exclude time spent
56
- * reporting its start from its creation time.
57
- */
58
- restartTimer(): void;
59
- /**
60
- * Marks the completion of the index passed to the last call to
61
- * {@link start}, returning the milliseconds it took to create.
62
- */
63
- finish(): number;
64
- /** The `extraState` for {@link ReplicationStatusPublisher.publish}. */
65
- readonly state: () => Partial<ReplicationState>;
66
- status(): IndexingStatus | undefined;
67
- }
68
- export declare function publishReplicationError(lc: LogContext, stage: ReplicationStage, description: string, errorDetails?: JSONObject, now?: Date): Promise<void>;
69
- export declare function replicationStatusError(lc: LogContext, stage: ReplicationStage, e: unknown, db?: Database, now?: Date): ReplicationStatusEvent;
70
- export declare function replicationStatusEvent(lc: LogContext, db: Database | undefined, stage: ReplicationStage, status: Status, description?: string, now?: Date): ReplicationStatusEvent;
71
- //# sourceMappingURL=replication-status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replication-status.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/replication-status.ts"],"names":[],"mappings":"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"}
@@ -1,86 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { ReadonlyJSONObject } from '../../../../shared/src/json.ts';
3
- import type { Source } from '../../types/streams.ts';
4
- import type { ReservationFollowup } from '../change-streamer/change-streamer-http.ts';
5
- import type { ChangeStreamer } from '../change-streamer/change-streamer.ts';
6
- import type { Service } from '../service.ts';
7
- import type { SwitchoverOptions } from './drain-handler.ts';
8
- import { type ReplicationStatusPublisher } from './replication-status.ts';
9
- import type { ReplicationLagReadinessOptions } from './reporter/recorder.ts';
10
- import type { WriteWorkerClient } from './write-worker-client.ts';
11
- /** See {@link ReplicaStateNotifier.subscribe()}. */
12
- export type ReplicaState = {
13
- readonly state: 'version-ready';
14
- /**
15
- * The replica watermark that became ready. Omitted for the initial
16
- * "current state is ready" notification, which should not count as newly
17
- * unserved work for a freshly-started ViewSyncer.
18
- */
19
- readonly watermark?: string | undefined;
20
- /**
21
- * Millisecond epoch when `watermark` became ready to read from the replica.
22
- */
23
- readonly replicaReadyTimeMs?: number | undefined;
24
- /**
25
- * Millisecond epoch at which the transaction behind `watermark` committed
26
- * *upstream*, as reported by the ChangeSource. Unlike `replicaReadyTimeMs`,
27
- * which is stamped locally when the change lands in the replica, this is the
28
- * origin of the whole pipeline, so `now - upstreamCommitTimeMs` at the point
29
- * the change is poked to clients is the end-to-end serving lag.
30
- *
31
- * Note that this crosses a clock domain: it comes from the upstream
32
- * database, whereas it is subtracted from the local clock in the ViewSyncer.
33
- * The existing `zero.replication.total_lag` metric spans the same boundary.
34
- *
35
- * Undefined when the ChangeSource does not report a commit time, and for the
36
- * initial "current state is ready" notification.
37
- */
38
- readonly upstreamCommitTimeMs?: number | undefined;
39
- readonly testSeqNum?: number | undefined;
40
- };
41
- export interface ReplicaStateNotifier {
42
- /**
43
- * Creates a cancelable subscription of changes in the replica state.
44
- *
45
- * A `version-ready` message indicates that the replica is ready to be
46
- * read, and henceforth that a _new_ version is ready, i.e. whenever a
47
- * change is committed to the replica. The `version-ready` message itself
48
- * otherwise contains no other information; the subscriber queries the
49
- * replica for the current data.
50
- *
51
- * A `maintenance` state indicates that the replica should not be read from.
52
- * If a subscriber is holding any transaction locks, it should release them
53
- * until the next `version-ready` signal.
54
- *
55
- * Upon subscription, the current state of the replica is sent immediately
56
- * if known. If multiple notifications occur before the subscriber
57
- * can consume them, all but the last notification are discarded by the
58
- * Subscription object (i.e. not buffered). Thus, a subscriber only
59
- * ever consumes the current (i.e. known) state of the replica. This avoids
60
- * a buildup of "work" if a subscriber is too busy to consume all
61
- * notifications.
62
- */
63
- subscribe(): Source<ReplicaState>;
64
- }
65
- export interface Replicator extends ReplicaStateNotifier {
66
- /**
67
- * Returns an opaque message for human-readable consumption. This is
68
- * purely for ensuring that the Replicator has started at least once to
69
- * bootstrap a new replica.
70
- */
71
- status(): Promise<ReadonlyJSONObject>;
72
- }
73
- export type ReplicatorMode = 'backup' | 'serving';
74
- export declare class ReplicatorService implements Replicator, Service {
75
- #private;
76
- readonly id: string;
77
- constructor(lc: LogContext, taskID: string, id: string, mode: ReplicatorMode, changeStreamer: ChangeStreamer, worker: WriteWorkerClient, statusPublisher: ReplicationStatusPublisher | null, replicationLagReadinessOptions?: ReplicationLagReadinessOptions, initialConnection?: ReservationFollowup, switchover?: SwitchoverOptions);
78
- status(): Promise<{
79
- status: string;
80
- }>;
81
- ready(): Promise<void>;
82
- run(): Promise<void>;
83
- subscribe(): Source<ReplicaState>;
84
- stop(): Promise<void>;
85
- }
86
- //# sourceMappingURL=replicator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replicator.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/replicator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,4CAA4C,CAAC;AACpF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAC,8BAA8B,EAAC,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAEhE,oDAAoD;AACpD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC;;OAEG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjD;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAInD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,UAAW,SAAQ,oBAAoB;IACtD;;;;OAIG;IACH,MAAM,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACvC;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElD,qBAAa,iBAAkB,YAAW,UAAU,EAAE,OAAO;;IAC3D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAOpB,YACE,EAAE,EAAE,UAAU,EACd,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,cAAc,EACpB,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,iBAAiB,EACzB,eAAe,EAAE,0BAA0B,GAAG,IAAI,EAClD,8BAA8B,GAAE,8BAAmC,EAKnE,iBAAiB,CAAC,EAAE,mBAAmB,EACvC,UAAU,CAAC,EAAE,iBAAiB,EAqB/B;IAED,MAAM;;OAEL;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;IAED,GAAG,kBAYF;IAED,SAAS,IAAI,MAAM,CAAC,YAAY,CAAC,CAEhC;IAEK,IAAI,kBAOT;CACF"}
@@ -1,55 +0,0 @@
1
- import type { ObservableResult } from '@opentelemetry/api';
2
- import type { LogContext } from '@rocicorp/logger';
3
- import type { ReplicationReport } from './report-schema.ts';
4
- export type ReplicationLagReadinessOptions = {
5
- readinessThresholdMs?: number | undefined;
6
- maxReadinessDelayMs?: number | undefined;
7
- setTimeoutFn?: typeof setTimeout | undefined;
8
- clearTimeoutFn?: typeof clearTimeout | undefined;
9
- };
10
- export declare class ReplicationReportRecorder {
11
- #private;
12
- constructor(lc: LogContext, { readinessThresholdMs, maxReadinessDelayMs, setTimeoutFn, clearTimeoutFn, }?: ReplicationLagReadinessOptions);
13
- ready(): Promise<void>;
14
- record(report: ReplicationReport): void;
15
- readonly reportUpstreamLag: (o: ObservableResult) => void;
16
- readonly reportReplicaLag: (o: ObservableResult) => void;
17
- readonly reportTotalLag: (o: ObservableResult) => void;
18
- readonly reportLastTotalLag: (o: ObservableResult) => void;
19
- readonly reportUpstreamClockSkew: (o: ObservableResult) => void;
20
- }
21
- /**
22
- * Estimates how far the upstream database's clock is from ours, in
23
- * milliseconds, positive meaning upstream is ahead.
24
- *
25
- * `sendTimeMs` and `receiveTimeMs` are both stamped in the
26
- * replication-manager, either side of `commitTimeMs`, which upstream stamps.
27
- * Assuming the upstream commit fell midway through that round trip, the
28
- * difference between where it actually landed and that midpoint is the clock
29
- * offset -- the same round-trip estimate NTP uses.
30
- *
31
- * The estimate is biased by any asymmetry between the two legs: the outbound
32
- * leg is a SQL round trip, while the return leg additionally waits on a WAL
33
- * flush and the walsender (which the pre-PG-17 path notes can add 50~100ms on
34
- * an idle database). So treat this as a detector of gross skew -- the kind
35
- * that invalidates sync.e2e_serving_lag -- and not as a sub-100ms correction.
36
- *
37
- * The rigorous bound, if a tighter reading is ever needed: the commit
38
- * genuinely happened between send and receive, so a `commitTimeMs` outside
39
- * that window proves skew of at least the amount by which it falls outside,
40
- * independent of any latency assumption.
41
- */
42
- export declare function estimateUpstreamClockSkewMs({ sendTimeMs, commitTimeMs, receiveTimeMs, }: {
43
- sendTimeMs: number;
44
- commitTimeMs: number;
45
- receiveTimeMs: number;
46
- }): number;
47
- /**
48
- * Returns whether the `report` is the signal sent by the change-streamer,
49
- * once the subscriber is caught up, to indicate that lag reporting is
50
- * disabled upstream (and thus readiness cannot be gated on lag reports).
51
- *
52
- * This is a lag report with a `nextSendTimeMs` of 0 and no `lastTimings`.
53
- */
54
- export declare function isLagReportingDisabledSignal(report: ReplicationReport): boolean;
55
- //# sourceMappingURL=recorder.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../../../../zero-cache/src/services/replicator/reporter/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAC,UAAU,EAAW,MAAM,kBAAkB,CAAC;AAG3D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,oBAAoB,CAAC;AAM1D,MAAM,MAAM,8BAA8B,GAAG;IAC3C,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,YAAY,CAAC,EAAE,OAAO,UAAU,GAAG,SAAS,CAAC;IAC7C,cAAc,CAAC,EAAE,OAAO,YAAY,GAAG,SAAS,CAAC;CAClD,CAAC;AAEF,qBAAa,yBAAyB;;IASpC,YACE,EAAE,EAAE,UAAU,EACd,EACE,oBAA2B,EAC3B,mBAA6B,EAC7B,YAAyB,EACzB,cAA6B,GAC9B,GAAE,8BAAmC,EAgBvC;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;IAED,MAAM,CAAC,MAAM,EAAE,iBAAiB,QAsC/B;IA0DD,QAAQ,CAAC,iBAAiB,MAAO,gBAAgB,UAK/C;IAEF,QAAQ,CAAC,gBAAgB,MAAO,gBAAgB,UAK9C;IAEF,QAAQ,CAAC,cAAc,MAAO,gBAAgB,UAK5C;IAEF,QAAQ,CAAC,kBAAkB,MAAO,gBAAgB,UAKhD;IAEF,QAAQ,CAAC,uBAAuB,MAAO,gBAAgB,UAKrD;CACH;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,UAAU,EACV,YAAY,EACZ,aAAa,GACd,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,iBAAiB,GACxB,OAAO,CAET"}
@@ -1,132 +0,0 @@
1
- /**
2
- * Observability for the SQLite change log.
3
- *
4
- * Everything here now runs in the **change-streamer** process, which is where
5
- * the writer lives. The module stays beside the rest of the change-log code
6
- * under `services/replicator/` for the same reason `change-log-db.ts` and
7
- * `change-log-stream-writer.ts` do: moving files would obscure the topology
8
- * diff, and the writer's home is a property of who calls it rather than of
9
- * where it sits. Metric names are unchanged from 7H — only their emitting
10
- * process, and therefore their resource attributes, moved.
11
- */
12
- import type { LogContext } from '@rocicorp/logger';
13
- import type { Database } from '../../../../zqlite/src/db.ts';
14
- import type { ChangeStreamData } from '../change-source/protocol/current/downstream.ts';
15
- import { type CookieOpTag, type CookieRowCounts } from './change-log-cookies.ts';
16
- import { type ChangeLogMeta, type ReconcileResult } from './change-log-db.ts';
17
- import type { ChangeLogStreamTransactionStats } from './change-log-stream-writer.ts';
18
- /**
19
- * Reports the reconciliation of the change-log database against the watermark
20
- * the stream connection resumes from. This runs once per stream connection, so
21
- * a reconnect storm is visible here as well as a restart.
22
- *
23
- * A wipe is not an error — it is how every abnormal change-log state is
24
- * collapsed into a correct one — but each wipe costs the retention window, so
25
- * every reconnecting subscriber below the head gets `too-old`. The `gap` reason
26
- * in particular means the log neither held the resume watermark nor could be
27
- * truncated to it, so a nonzero rate in steady state is an alert, not a
28
- * statistic.
29
- */
30
- export declare function recordSQLiteChangeLogReconcile(lc: LogContext, result: ReconcileResult): void;
31
- /**
32
- * What the log says about itself. Nothing here reads the replica: after the
33
- * writer moved to the change-streamer, the replica's state version is a
34
- * consequence of this log rather than a fact about it.
35
- */
36
- export type SQLiteChangeLogStartupInfo = ChangeLogMeta & {
37
- readonly minWatermark: string;
38
- readonly headWatermark: string;
39
- };
40
- export type SQLiteChangeLogInfo = SQLiteChangeLogStartupInfo & {
41
- readonly rows: number;
42
- readonly estimatedBytes: number;
43
- readonly cookieRows: CookieRowCounts;
44
- };
45
- /**
46
- * Reads the meta row and covered range. Unlike {@link getSQLiteChangeLogInfo}
47
- * this does not scan the log; see {@link readChangeLogBounds}.
48
- *
49
- * Call this after reconciliation, which is the only point at which the head is
50
- * known to be the resume watermark.
51
- */
52
- export declare function getSQLiteChangeLogStartupInfo(changeLog: Database): SQLiteChangeLogStartupInfo;
53
- /**
54
- * Extends {@link getSQLiteChangeLogStartupInfo} with the retained row and
55
- * estimated byte totals. Computing these scans the entire change-log table, so
56
- * only call it when the totals are consumed, i.e. when the writer (and thus the
57
- * observer) is enabled.
58
- */
59
- export declare function getSQLiteChangeLogInfo(changeLog: Database): SQLiteChangeLogInfo;
60
- export declare function logSQLiteChangeLogStartup(lc: LogContext, file: string, info: SQLiteChangeLogStartupInfo): void;
61
- /**
62
- * The on-disk footprint of a SQLite database: its main file plus its `-wal` and
63
- * `-wal2` sidecars, whichever exist. `-shm` is excluded — it is a
64
- * shared-memory index rather than retained bytes.
65
- *
66
- * A missing file counts as zero rather than warning. Which sidecars exist
67
- * depends on the journal mode, and the change-log database is absent entirely
68
- * until the writer creates it.
69
- */
70
- export declare function sqliteFileBytes(lc: LogContext, file: string): Promise<number>;
71
- /** What the writer reports back for a committed transaction. */
72
- export type ChangeLogCommit = {
73
- readonly watermark: string;
74
- readonly stats: ChangeLogStreamTransactionStats;
75
- /**
76
- * Appending the commit row and committing the log's transaction. This is the
77
- * cost that sits on the forward path, once per upstream transaction.
78
- */
79
- readonly logCommitMs: number;
80
- };
81
- export type SQLiteChangeLogObservabilityState = {
82
- readonly receivedHead: string;
83
- readonly sqliteHead: string;
84
- readonly headLag: number | undefined;
85
- readonly rows: number;
86
- readonly estimatedBytes: number;
87
- readonly cookieRows: CookieRowCounts;
88
- readonly cookieMutations: number;
89
- readonly rollbacks: number;
90
- readonly invariantFailures: number;
91
- readonly hashMatches: number;
92
- readonly hashMismatches: number;
93
- readonly hashUnpaired: number;
94
- };
95
- /**
96
- * Records writer metrics in the change-streamer process. State changes only
97
- * after the corresponding write succeeds, except receivedHead, which advances
98
- * when a commit message arrives so that transient lag behind the log is
99
- * observable.
100
- */
101
- export declare class SQLiteChangeLogObserver {
102
- #private;
103
- constructor(lc: LogContext, info: SQLiteChangeLogInfo);
104
- /**
105
- * Called as each message arrives, before it is written. For a sampled
106
- * transaction, hashes the *received* stream and compares it with the hash the
107
- * writer computes over what it *stored*.
108
- */
109
- messageReceived(data: ChangeStreamData, json: string, validateHash?: boolean, storedChange?: string): void;
110
- /** Called after the message has been written to the log. */
111
- messageProcessed(data: ChangeStreamData, commit: ChangeLogCommit | null, durationMs: number | undefined): void;
112
- messageFailed(data: ChangeStreamData, error: unknown, durationMs: number | undefined): void;
113
- /**
114
- * A committed transaction folded schema changes into the cookie jar. Reported
115
- * separately from {@link messageProcessed} because it costs a read of the
116
- * cookie tables, which is only worth taking when they actually moved.
117
- */
118
- cookiesMutated(ops: readonly CookieOpTag[], rows: CookieRowCounts): void;
119
- /**
120
- * A missed truncate-above surfaces as a constraint violation on the writer's
121
- * plain `INSERT`, which the fail-soft policy would otherwise absorb quietly.
122
- * Classifying it as an invariant failure is what keeps a reconciliation bug
123
- * from looking like a lost cache.
124
- */
125
- invariantFailure(message: string, details?: Record<string, unknown>): void;
126
- /** The source interrupted the stream mid-transaction. */
127
- abort(): void;
128
- /** Reconciliation moved the head, so the observer's totals are restated. */
129
- reconciled(info: SQLiteChangeLogInfo): void;
130
- state(): SQLiteChangeLogObservabilityState;
131
- }
132
- //# sourceMappingURL=sqlite-change-log-observability.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-change-log-observability.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/sqlite-change-log-observability.ts"],"names":[],"mappings":"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"}
@@ -1,120 +0,0 @@
1
- /**
2
- * Deletes aged-out transactions from the change-log database, one bounded write
3
- * transaction at a time.
4
- *
5
- * The purger is a pure function of one database: it takes the floors its caller
6
- * has already gated on and narrows them, never widens them, and it reads no
7
- * replication state. That is what makes it testable without a scheduler and
8
- * what lets slice 9 run it from the change-streamer's stream loop, between the
9
- * writer's commits, on the writer's own connection.
10
- */
11
- import type { Database } from '../../../../zqlite/src/db.ts';
12
- /**
13
- * The eligible set, as three ANDed bounds. Only the `externalFloor` is a safety
14
- * property; the other two make the log serviceable and make purge conservative.
15
- *
16
- * `"watermark" < @externalFloor` is deliberately strict. A follower that lost
17
- * its replica restores it from S3 at watermark `W` and then asks this log for
18
- * everything after `W`, which requires the `commit` row *at* `W` to still be
19
- * here (`SQLITE_CHANGE_LOG_BOUNDARY_SQL`). Deleting it returns `too-old` to the
20
- * very subscriber the floor exists to protect.
21
- *
22
- * The head cap reads `max("watermark")` from the log's own database, which
23
- * keeps the purger a pure function of one file. The cap is inert in normal
24
- * operation: the floor is derived from a backup of a replica that consumes this
25
- * loop's output, and the log commits before that output is forwarded, so
26
- * `externalFloor <= head` holds by construction. It engages only on a *stale*
27
- * log — writer stopped, mode flipped to `off`, another task took over — where
28
- * deleting to a floor that has run past a frozen log would empty the file. Note
29
- * that head can be a phantom — committed here but not yet re-deliverable by a
30
- * resumed stream — for as long as it takes the watermark the stream would
31
- * resume from to advance past it. That is harmless precisely because head is
32
- * never a purge candidate, and it is why the purger asserts nothing about
33
- * anything outside its own file.
34
- *
35
- * Ordered by `("writeTimeMs", "watermark")` so it rides the partial index,
36
- * which carries one entry per transaction rather than one per change. The
37
- * `LIMIT` keeps a drain from re-scanning the remaining history on every batch,
38
- * which would be quadratic in the number of eligible transactions and would do
39
- * it inside the `BEGIN IMMEDIATE`, holding the write lock alongside the delete.
40
- *
41
- * Exported so the focused query-plan test covers the production query.
42
- */
43
- export declare const SQLITE_CHANGE_LOG_ELIGIBLE_COMMITS_SQL = "\n SELECT \"watermark\"\n FROM \"_zero.changeLogStream\"\n WHERE \"writeTimeMs\" IS NOT NULL\n AND \"writeTimeMs\" < @retentionCutoffMs\n AND \"watermark\" < @externalFloor\n AND \"watermark\" < (SELECT max(\"watermark\") FROM \"_zero.changeLogStream\")\n ORDER BY \"writeTimeMs\", \"watermark\"\n LIMIT @limit\n";
44
- /**
45
- * Counts the rows at `@watermark`, capped at `@limit`. The cap is what keeps
46
- * batch sizing O(budget): this runs per candidate inside the
47
- * `BEGIN IMMEDIATE`, and the transaction being sized can be arbitrarily
48
- * large — an uncapped count of a multi-million-row backfill would rescan
49
- * every remaining row on every tear batch, holding the write lock (and the
50
- * appending path behind it) for the duration, quadratically over the drain.
51
- * The caller only needs to know whether the transaction fits its remaining
52
- * budget, so it passes `remaining + 1` and reads a count above `remaining`
53
- * as "does not fit".
54
- *
55
- * Exported so the focused tests cover the production query.
56
- */
57
- export declare const SQLITE_CHANGE_LOG_COUNT_TRANSACTION_SQL = "\n SELECT count(*) AS \"rows\" FROM (\n SELECT 1\n FROM \"_zero.changeLogStream\"\n WHERE \"watermark\" = @watermark\n LIMIT @limit\n )\n";
58
- export type PurgeBatchResult = {
59
- readonly deletedRows: number;
60
- /**
61
- * The watermark through which whole transactions were removed. `undefined`
62
- * when the batch only tore rows off the minimum transaction without
63
- * completing it — in that case `deletedRows > 0` and `moreEligible` is true.
64
- */
65
- readonly deletedThrough: string | undefined;
66
- /** True while a tear is in progress, as well as while whole transactions remain eligible. */
67
- readonly moreEligible: boolean;
68
- };
69
- export type PurgeBatchOptions = {
70
- /**
71
- * The floor the caller has already gated on subscriber ACKs and snapshot
72
- * reservations — normally the confirmed S3 backup watermark. Transactions at
73
- * or above it are NOT durable anywhere else: the change log is excluded from
74
- * the litestream backup, so this is the boundary a follower restores to and
75
- * then catches up from. Compared strictly (`<`), so the transaction *at* the
76
- * floor survives as that follower's catchup boundary. The purger narrows this
77
- * input and never widens it.
78
- */
79
- readonly externalFloor: string;
80
- /**
81
- * A *minimum* retention, ANDed on top of `externalFloor` rather than an
82
- * alternative to it. Which of the two binds depends on the backup interval.
83
- */
84
- readonly retentionCutoffMs: number;
85
- /** Starting chunk size. Not the bound — `maxDurationMs` is. */
86
- readonly maxRows: number;
87
- /**
88
- * The statement duration target, enforced by feedback rather than by
89
- * interruption: SQLite cannot yield mid-statement, so the purger measures
90
- * each delete and shrinks the next batch's row budget when one overruns
91
- * (see {@link SQLiteChangeLogPurger.budgetRows}) — which means the first
92
- * delete after a restart, sized by `maxRows` alone, can still overrun it.
93
- * The target is this consequential because purge shares the writer's
94
- * connection: there is no lock to arbitrate and no `busy_timeout` to bound
95
- * the wait — a long statement blocks the appending path, and the forward
96
- * behind it, directly and for its full duration. That is why this is a
97
- * precondition of purging from the stream loop rather than a tuning knob.
98
- */
99
- readonly maxDurationMs: number;
100
- };
101
- export declare class SQLiteChangeLogPurger {
102
- #private;
103
- /**
104
- * @param db a writable connection to a change log the writer has already
105
- * created and reconciled — in slice 9, the writer's own connection.
106
- * Statements are prepared eagerly, so a caller that may run before the
107
- * log exists opens the connection lazily and treats construction failure
108
- * as a skipped cycle.
109
- */
110
- constructor(db: Database, now?: () => number);
111
- /** The row budget the next batch would use. Exposed for tests and metrics. */
112
- get budgetRows(): number | undefined;
113
- /**
114
- * Removes one bounded batch of aged-out history, in one `BEGIN IMMEDIATE`
115
- * transaction. Callers loop while `moreEligible`, releasing whatever guards
116
- * they hold between batches.
117
- */
118
- purgeBatch(opts: PurgeBatchOptions): PurgeBatchResult;
119
- }
120
- //# sourceMappingURL=sqlite-change-log-purger.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sqlite-change-log-purger.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/sqlite-change-log-purger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAC,QAAQ,EAAY,MAAM,8BAA8B,CAAC;AAGtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,sCAAsC,2UASlD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uCAAuC,4JAOnD,CAAC;AAuCF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5C,6FAA6F;IAC7F,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC,CAAC;AAWF,qBAAa,qBAAqB;;IAahC;;;;;;OAMG;IACH,YACE,EAAE,EAAE,QAAQ,EACZ,GAAG,GAAE,MAAM,MAA0C,EAYtD;IAED,8EAA8E;IAC9E,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,CAsBpD;CAkLF"}