@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,63 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { Downstream } from '../../../../zero-protocol/src/down.ts';
3
- import type { MutationID } from '../../../../zero-protocol/src/mutation-id.ts';
4
- import { type PushBody } from '../../../../zero-protocol/src/push.ts';
5
- import { type ZeroConfig } from '../../config/zero-config.ts';
6
- import type { Source } from '../../types/streams.ts';
7
- import type { HandlerResult, StreamResult } from '../../workers/connection.ts';
8
- import type { RefCountedService, Service } from '../service.ts';
9
- import type { ConnectionContext, ConnectionContextManager, ConnectionSelector } from '../view-syncer/connection-context-manager.ts';
10
- export interface Pusher extends RefCountedService {
11
- initConnection(selector: ConnectionSelector): Source<Downstream>;
12
- enqueuePush(selector: ConnectionSelector, push: PushBody): HandlerResult;
13
- ackMutationResponses(requester: ConnectionSelector, upToID: MutationID): Promise<void>;
14
- deleteClientMutations(requester: ConnectionSelector, clientIDs: string[]): Promise<void>;
15
- }
16
- type Config = Pick<ZeroConfig, 'app' | 'shard'>;
17
- /**
18
- * Receives push messages from zero-client and forwards
19
- * them the the user's API server.
20
- *
21
- * If the user's API server is taking too long to process
22
- * the push, the PusherService will add the push to a queue
23
- * and send pushes in bulk the next time the user's API server
24
- * is available.
25
- *
26
- * - One PusherService exists per client group.
27
- * - Mutations for a given client are always sent in-order
28
- * - Mutations for different clients in the same group may be interleaved
29
- */
30
- export declare class PusherService implements Service, Pusher {
31
- #private;
32
- readonly id: string;
33
- constructor(appConfig: Config, lc: LogContext, clientGroupID: string, connContextManager: ConnectionContextManager);
34
- initConnection(selector: ConnectionSelector): Source<Downstream>;
35
- enqueuePush(selector: ConnectionSelector, push: PushBody): Exclude<HandlerResult, StreamResult>;
36
- ackMutationResponses(requester: ConnectionSelector, upToID: MutationID): Promise<void>;
37
- /**
38
- * Bulk cleanup is routed through the requester's push context.
39
- *
40
- * This assumes the client group shares a compatible push endpoint/auth
41
- * context.
42
- */
43
- deleteClientMutations(requester: ConnectionSelector, clientIDs: string[]): Promise<void>;
44
- ref(): void;
45
- unref(): void;
46
- hasRefs(): boolean;
47
- run(): Promise<void>;
48
- stop(): Promise<void>;
49
- }
50
- type PusherEntry = {
51
- push: PushBody;
52
- connCtx: ConnectionContext;
53
- };
54
- type PusherEntryOrStop = PusherEntry | 'stop';
55
- /**
56
- * Pushes for different clients, sockets, or auth revisions could be interleaved.
57
- *
58
- * In order to batch safely, we only combine pushes from the same
59
- * clientID/wsID/revision snapshot.
60
- */
61
- export declare function combinePushes(entries: readonly (PusherEntryOrStop | undefined)[]): [PusherEntry[], boolean];
62
- export {};
63
- //# sourceMappingURL=pusher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pusher.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/mutagen/pusher.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAOjD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uCAAuC,CAAC;AAYtE,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,8CAA8C,CAAC;AAG7E,OAAO,EAAC,KAAK,QAAQ,EAAC,MAAM,uCAAuC,CAAC;AAEpE,OAAO,EAAC,KAAK,UAAU,EAAC,MAAM,6BAA6B,CAAC;AAK5D,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,wBAAwB,CAAC;AAEnD,OAAO,KAAK,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAC,iBAAiB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,8CAA8C,CAAC;AAEtD,MAAM,WAAW,MAAO,SAAQ,iBAAiB;IAC/C,cAAc,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IACjE,WAAW,CAAC,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,QAAQ,GAAG,aAAa,CAAC;IACzE,oBAAoB,CAClB,SAAS,EAAE,kBAAkB,EAC7B,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,qBAAqB,CACnB,SAAS,EAAE,kBAAkB,EAC7B,SAAS,EAAE,MAAM,EAAE,GA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1,368 +0,0 @@
1
- /**
2
- * The change log lives in its own SQLite database, `${replicaFile}-change-log`,
3
- * rather than in the replica file. It is a catchup cache: everything it holds is
4
- * either already durable in the replica's litestream backup or re-derivable from
5
- * the upstream replication slot, so it is deliberately excluded from the backup
6
- * and is never a source of truth.
7
- *
8
- * The change-streamer writes it, from the stream loop that fans changes out to
9
- * subscribers, and commits it before forwarding each transaction's `commit`
10
- * message. Its head is therefore always at or above the watermark the stream
11
- * would resume from, which is what {@link reconcileChangeLog} anchors on.
12
- *
13
- * Beside the buffer it holds the log's *cookie jar* — the backfill progress
14
- * state folded up to the same head. That is `change-log-cookies.ts`; this file
15
- * owns its tables' lifecycle, because a cookie set is only meaningful paired
16
- * with the watermark it was folded to, and so must be created, dropped, and —
17
- * whenever reconciliation moves the head — replaced with the anchor's, all with
18
- * the buffer rather than beside it.
19
- *
20
- * Because it is disposable, it has no migration framework. Any inconsistency —
21
- * a schema change, a leftover file from a different replica, a gap left by a
22
- * crash or by running with the writer disabled, a corrupt file — is resolved by
23
- * {@link reconcileChangeLog} and {@link openChangeLogDBForWriting}, which
24
- * truncate a bounded suffix or replace and reseed the log at the resume
25
- * watermark. The worst outcome is a `too-old` for a lagging subscriber; a
26
- * silently delivered gap is not reachable.
27
- *
28
- * Disk sizing: a task that writes the log needs room for the replica *plus* the
29
- * retained change stream — the log's main file, its wal2 sidecars, and pages a
30
- * purge has freed but not yet returned to the OS. The change-streamer schedules
31
- * purges against the same floor as the PG change log, so retention is bounded
32
- * by the confirmed backup watermark ANDed with the minimum retention window —
33
- * a function of the backup interval, not a constant: 15–30+ minutes behind an
34
- * RMv1 sync interval, ~60 seconds once litestream v5 backs up every 15–30 s.
35
- * A held snapshot reservation pins retention unboundedly for its duration, so
36
- * peak retained bytes is set by the slowest concurrent restore rather than by
37
- * the retention setting — size disk and alerts on that. The log is excluded
38
- * from the litestream backup, so this is local disk only and never S3.
39
- */
40
- import type { LogContext } from '@rocicorp/logger';
41
- import { Database } from '../../../../zqlite/src/db.ts';
42
- import { type CookieSet } from './change-log-cookies.ts';
43
- /**
44
- * Bumped whenever the change-log database's schema changes. Since the file is a
45
- * cache, a mismatch costs one reseed rather than a migration.
46
- *
47
- * v2 re-homed the writer to the change-streamer: the log anchors on the
48
- * watermark its stream connection resumes from rather than on the replica's
49
- * state version, and its meta row carries the replica's identity triple plus
50
- * the seed point.
51
- *
52
- * v3 added the cookie tables (see `change-log-cookies.ts`), i.e. the log's
53
- * second job. The reseed it costs on upgrade buys one retention window of
54
- * catchup reach on a log nothing reads yet.
55
- *
56
- * v4 stores each row's tag and estimated retained bytes alongside its JSON.
57
- * Readers can now filter without parsing arbitrary row payloads, and
58
- * reconciliation can bound truncation by bytes as well as rows.
59
- *
60
- * `auto_vacuum = INCREMENTAL` arrived within v2, deliberately without a bump:
61
- * it is a file-header property rather than a schema change, and the reseed a
62
- * version mismatch triggers cannot enable it (see
63
- * {@link applyChangeLogPragmas}), so {@link openChangeLogDBForWriting} guards
64
- * on the pragma itself instead of on this number.
65
- */
66
- export declare const CHANGE_LOG_DB_SCHEMA_VERSION = 4;
67
- export declare const CHANGE_LOG_STREAM_TABLE = "_zero.changeLogStream";
68
- export declare const CHANGE_LOG_STREAM_WRITE_TIME_INDEX = "_zero.changeLogStream_writeTimeMs";
69
- /**
70
- * Estimates the retained payload size of a stream row. This deliberately does
71
- * not claim to measure SQLite b-tree/page overhead; it is stable across the
72
- * write path, reconciliation, and the startup scan used by observability.
73
- */
74
- export declare function estimateChangeLogStreamRowBytes(watermark: string, tag: string, change: string, precommit?: string, hasWriteTime?: boolean): number;
75
- export declare const CREATE_CHANGE_LOG_STREAM_SCHEMA = "\n CREATE TABLE \"_zero.changeLogStream\" (\n \"watermark\" TEXT NOT NULL,\n \"pos\" INTEGER NOT NULL,\n \"tag\" TEXT NOT NULL,\n \"estimatedBytes\" INTEGER NOT NULL,\n \"change\" TEXT NOT NULL,\n \"precommit\" TEXT,\n \"writeTimeMs\" INTEGER,\n PRIMARY KEY (\"watermark\", \"pos\")\n );\n\n CREATE INDEX \"_zero.changeLogStream_writeTimeMs\"\n ON \"_zero.changeLogStream\" (\"writeTimeMs\", \"watermark\")\n WHERE \"writeTimeMs\" IS NOT NULL;\n";
76
- export declare const CHANGE_LOG_META_TABLE = "_zero.changeLogMeta";
77
- /**
78
- * `${replicaFile}-change-log`, matching the `-serving-copy` convention.
79
- *
80
- * The name outlives the writer's move into the change-streamer: the
81
- * change-streamer derives the path from the replica file it owns, so renaming
82
- * would save no plumbing and would orphan the old file on every existing
83
- * volume, where nothing would delete it.
84
- *
85
- * Its `-wal` / `-wal2` / `-shm` sidecars are suffixes of *this* name, so they
86
- * never collide with the replica's own sidecars.
87
- */
88
- export declare function changeLogFileName(replicaFile: string): string;
89
- /**
90
- * Removes the change-log database and its `-wal` / `-wal2` / `-shm` sidecars.
91
- * Safe to call when the file does not exist.
92
- */
93
- export declare function deleteChangeLogDB(replicaFile: string): void;
94
- /**
95
- * Which replica the log's contents belong to.
96
- *
97
- * `generation` is RMv1's `replicaVersion`: the version at which initial sync
98
- * copied every row. It is shared by every sibling of a forked replica, which is
99
- * why it cannot be the whole of the identity under RMv2 — `epoch` and
100
- * `replicaID` are what distinguish two siblings' logs. Both are `null` until
101
- * RMv2 supplies them, and a `null` matches only another `null`, so a log
102
- * written before they exist is still recognized as this replica's.
103
- */
104
- export type ChangeLogIdentity = {
105
- readonly epoch: string | null;
106
- readonly generation: string;
107
- readonly replicaID: string | null;
108
- };
109
- /**
110
- * Where the stream connection resumes, and everything the log's state at that
111
- * position consists of.
112
- *
113
- * The two fields travel together because a cookie set is only meaningful paired
114
- * with the watermark it was folded up to (invariant 15). They are read from one
115
- * store, in one snapshot: `Storer.getStartStreamInitializationParameters()`
116
- * reads both from Postgres in a single REPEATABLE READ transaction. Pairing one
117
- * store's cookies with another's watermark would silently drop every backfill
118
- * that completed in the interval, and those rows are unrecoverable — backfill
119
- * transactions are synthesized by the change source rather than replayed from
120
- * the slot.
121
- */
122
- export type ChangeLogResumePoint = {
123
- /**
124
- * The watermark this stream connection resumes from. The log's own head is
125
- * measured against it, and a reseed seeds a synthetic transaction at it.
126
- *
127
- * Deliberately *not* "the replica's state version": after the writer moved to
128
- * the change-streamer, the canonical replicator is a subscriber downstream of
129
- * the write loop, so its state version is a consequence of this log rather
130
- * than a constraint on it.
131
- */
132
- readonly resumeWatermark: string;
133
- /**
134
- * The cookie set that belongs to {@link resumeWatermark}. Any reconciliation
135
- * that moves the head invalidates the set the log was holding — the cookies
136
- * are unversioned point-in-time state, and truncating the stream above `W`
137
- * does not roll them back to `W` — so the same transaction installs this one
138
- * in its place (invariant 17).
139
- *
140
- * Postgres supplies it while it remains the store the stream resumes from. At
141
- * the C5 flip the log's own head *is* the resume point, phantoms cannot
142
- * exist, and both this field and the truncate-above path become dead code.
143
- */
144
- readonly cookies: CookieSet;
145
- };
146
- /**
147
- * What the log is reconciled against. Reconciliation runs once per stream
148
- * connection, since every reconnect can re-read a different resume point.
149
- */
150
- export type ChangeLogAnchor = ChangeLogResumePoint & {
151
- readonly identity: ChangeLogIdentity;
152
- /**
153
- * The change-streamer's clock, at reconciliation time. Supplied rather than
154
- * read inline so that tests control it. Used for `seededAtMs` and for the
155
- * seed transaction's `writeTimeMs`, which is what the purger's time floor
156
- * measures.
157
- */
158
- readonly nowMs: number;
159
- };
160
- /** The meta row, i.e. everything the log records about itself. */
161
- export type ChangeLogMeta = ChangeLogIdentity & {
162
- readonly schemaVersion: number;
163
- readonly seededAtMs: number;
164
- readonly seedWatermark: string;
165
- };
166
- /**
167
- * Opens the change-log database beside `replicaFile`.
168
- *
169
- * A writable handle creates the file if it is absent; a `readonly` handle
170
- * throws, which is the normal state for a change-streamer whose writer is
171
- * disabled. Pragmas are the caller's responsibility, since only the writer sets
172
- * the persistent ones.
173
- */
174
- export declare function openChangeLogDB(lc: LogContext, replicaFile: string, opts: {
175
- readonly: boolean;
176
- }): Database;
177
- /**
178
- * Configures the change-log database, which the change-streamer's writer owns
179
- * exclusively. These are the settings the `separate-files` mode of
180
- * `sqlite-change-log-ceiling.bench.ts` measured.
181
- *
182
- * `wal2` because the log is a continuous append that catchup reads
183
- * continuously, which is the case wal2 exists for: it avoids checkpoint
184
- * starvation without needing an autocheckpoint. `wal_autocheckpoint` therefore
185
- * keeps its default, unlike the backup replica's 0, which hands checkpointing
186
- * to litestream — nothing else owns this file.
187
- *
188
- * `synchronous = NORMAL` because the commit sits on the forward path, once per
189
- * upstream transaction, and NORMAL keeps that from costing an fsync. It is not
190
- * a durability compromise here: in WAL mode NORMAL still writes every commit
191
- * through to the OS, so it survives a process crash, an OOM kill, or a SIGKILL.
192
- * It is lost only to kernel panic or power loss, and those destroy the node —
193
- * the task restarts elsewhere, restores the replica from S3, and has no
194
- * change-log file at all. Whatever a power loss does take is detected by
195
- * {@link reconcileChangeLog} and reseeded.
196
- *
197
- * `auto_vacuum = INCREMENTAL` so that purge can return freed pages to the OS
198
- * rather than leaving the file at its high-water mark. **It must be the first
199
- * statement here.** SQLite honours a `none` -> `incremental` transition only
200
- * while the file is still empty, and `journal_mode = wal2` materializes page 1;
201
- * appending the pragma instead of prepending it silently leaves the file at
202
- * mode 0 forever, since neither `DROP TABLE` nor a reseed makes a file empty
203
- * again. {@link openChangeLogDBForWriting} verifies the result.
204
- */
205
- export declare function applyChangeLogPragmas(db: Database): void;
206
- /**
207
- * Opens the change-log database for the writer, applies its pragmas, and
208
- * reconciles it against `anchor`, returning the handle and what reconciliation
209
- * had to do.
210
- *
211
- * Corruption is answered with a rebuild rather than an escalation, which is a
212
- * deliberate divergence from how the replica's own corruption is handled. A
213
- * corrupt replica is a lost source of truth, so it ends in a restore or an
214
- * auto-reset; the change log holds nothing that is not either already in the
215
- * replica's litestream backup or re-derivable from the upstream slot, so the
216
- * entire response is to delete the file and seed a new one at the resume
217
- * watermark. The cost is one retention window of catchup — reconnecting
218
- * subscribers below the head get `too-old` — which is what every other
219
- * {@link ReseedReason} costs.
220
- *
221
- * Only corruption is rebuilt through. Anything else (a bad path, a permissions
222
- * error, a full disk) is a problem with the environment rather than with the
223
- * file's contents, and deleting a database in response would destroy state
224
- * without fixing it. Those propagate to the caller, which disables the writer
225
- * and keeps replicating.
226
- *
227
- * A file that predates `auto_vacuum = INCREMENTAL` takes the same rebuild, for
228
- * the same reason and at the same cost: the pragma only takes on an empty file,
229
- * so a reseed cannot enable it. Unlike corruption, a *second* failure there is
230
- * tolerated rather than thrown — see {@link ensureIncrementalAutoVacuum}.
231
- */
232
- /**
233
- * Returns an anchor after the database opens.
234
- *
235
- * The resolver can inspect the existing file before it selects the anchor. A
236
- * valid log can use its own head. A new or invalid log uses the replica seed.
237
- * The rebuild path calls the resolver again for the new file.
238
- */
239
- export type AnchorResolver = (db: Database) => ChangeLogAnchor;
240
- export declare function openChangeLogDBForWriting(lc: LogContext, replicaFile: string, anchor: AnchorResolver): {
241
- db: Database;
242
- result: ReconcileResult;
243
- replacedFile: boolean;
244
- };
245
- /**
246
- * Replaces an already-closed change-log file after bounded reconciliation
247
- * declined its work. The caller closes cached readers before calling this so
248
- * none can continue serving the unlinked inode.
249
- */
250
- export declare function rebuildChangeLogDBForWriting(lc: LogContext, replicaFile: string, anchor: ChangeLogAnchor, required: ChangeLogRebuildRequired): {
251
- db: Database;
252
- result: ReconcileResult;
253
- replacedFile: true;
254
- };
255
- export type ReseedReason = 'created' | 'schema-mismatch' | 'identity-mismatch' | 'gap' | 'oversized-truncate';
256
- /**
257
- * Reconciliation runs synchronously on the change-streamer's event loop. A
258
- * normal phantom is one transaction, so work above either limit is answered by
259
- * unlinking and reseeding this disposable cache rather than deleting an
260
- * arbitrarily large suffix in place.
261
- */
262
- export declare const MAX_RECONCILE_TRUNCATE_ROWS = 10000;
263
- export declare const MAX_RECONCILE_TRUNCATE_BYTES: number;
264
- export declare class ChangeLogRebuildRequired extends Error {
265
- readonly name = "ChangeLogRebuildRequired";
266
- readonly reason: ReseedReason;
267
- readonly rows?: number | undefined;
268
- readonly estimatedBytes?: number | undefined;
269
- constructor(reason: ReseedReason, rows?: number | undefined, estimatedBytes?: number | undefined);
270
- }
271
- type ReconcileOptions = {
272
- /** Throw before an unbounded delete/drop so the file owner can unlink it. */
273
- readonly rebuildInsteadOfUnboundedWork?: boolean | undefined;
274
- /** Preserve the reason that caused an old file to be unlinked. */
275
- readonly reseedReason?: ReseedReason | undefined;
276
- };
277
- /**
278
- * `cookiesStale` records that the cookie set the log held did not survive
279
- * reconciliation. The cookies are unversioned point-in-time state, so any
280
- * reconciliation that moves the head invalidates them, and the same transaction
281
- * replaces them with the anchor's — the set that belongs to the resume
282
- * watermark (see `change-log-cookies.ts`). It is `action !== 'none'` today; it
283
- * is a field rather than a derivation because the replacement reads as intent
284
- * at the call site, and because it is what the `cookie_reseed` counter is keyed
285
- * on.
286
- */
287
- export type ReconcileResult = {
288
- action: 'none';
289
- head: string;
290
- cookiesStale: false;
291
- } | {
292
- action: 'truncated';
293
- head: string;
294
- rows: number;
295
- cookiesStale: true;
296
- } | {
297
- action: 'reseeded';
298
- head: string;
299
- reason: ReseedReason;
300
- cookiesStale: true;
301
- };
302
- /**
303
- * Brings the change log into agreement with the watermark its stream connection
304
- * resumes from, in one transaction on the change-log database:
305
- *
306
- * ```
307
- * head === resumeWatermark → keep appending
308
- * head > resumeWatermark → truncate above resumeWatermark
309
- * otherwise → wipe, seed at resumeWatermark, record the reason
310
- * ```
311
- *
312
- * The log commits before anything that can advance the resume watermark, so a
313
- * *phantom* — a transaction the log holds whose watermark the resumed stream
314
- * re-delivers — is the normal state, and truncate-above is the whole of
315
- * reconciliation rather than a special case. A phantom's rows all carry the
316
- * transaction's commit watermark, which is strictly greater than the resume
317
- * watermark, so deleting on that predicate removes phantoms whole and retains
318
- * every transaction at or below the resume point.
319
- *
320
- * It must run per stream connection, not once per process: the stream loop
321
- * re-reads its resume watermark on every reconnect, and the writer inserts with
322
- * a plain `INSERT` against `PRIMARY KEY ("watermark","pos")`, so an
323
- * un-truncated overlap is a constraint violation on the first re-delivered
324
- * transaction.
325
- *
326
- * Anything truncation cannot resolve — the file was deleted, the writer was
327
- * disabled for a while, the replica was restored, power was lost with
328
- * `synchronous=NORMAL` — surfaces as a head that does not land on the resume
329
- * watermark, and is resolved by wiping and reseeding there.
330
- *
331
- * Whichever of the two moves the head also replaces the cookie set with the one
332
- * the anchor carries, in the same transaction: the head and the cookies are one
333
- * position, and nothing may observe them at two.
334
- */
335
- export declare function reconcileChangeLog(lc: LogContext, db: Database, anchor: ChangeLogAnchor, opts?: ReconcileOptions): ReconcileResult;
336
- /**
337
- * Returns the reason that the log must be recreated. Returns `undefined` when
338
- * the writer can continue to use the log.
339
- *
340
- * This function takes only the expected identity because callers use the result
341
- * to select the anchor.
342
- */
343
- export declare function changeLogWipeReason(db: Database, identity: ChangeLogIdentity): ReseedReason | undefined;
344
- /**
345
- * Seeds a valid synthetic transaction at the anchor's resume watermark, making
346
- * an otherwise empty log serviceable as a catchup boundary for a subscriber
347
- * that is exactly at that watermark.
348
- */
349
- export declare function seedChangeLogStream(db: Database, anchor: ChangeLogAnchor): void;
350
- /** Reads the whole meta row. Throws if the log has not been reconciled. */
351
- export declare function readChangeLogMeta(db: Database): ChangeLogMeta;
352
- /**
353
- * `max()` on the primary key's leading column, i.e. an index seek. Null when
354
- * the log is empty.
355
- */
356
- export declare function readChangeLogHead(db: Database): string | null;
357
- /**
358
- * The covered watermark range. Both scalar subqueries seek the watermark
359
- * index, so unlike a `count()` this does not scan the log. Both bounds are
360
- * null when it is empty.
361
- */
362
- export declare function readChangeLogBounds(db: Database): ChangeLogBounds;
363
- export type ChangeLogBounds = {
364
- readonly minWatermark: string | null;
365
- readonly headWatermark: string | null;
366
- };
367
- export {};
368
- //# sourceMappingURL=change-log-db.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change-log-db.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/change-log-db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA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,EAAE,eAAe,EACvB,IAAI,GAAE,gBAAqB,GAC1B,eAAe,CAoBjB;AAgGD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,iBAAiB,GAC1B,YAAY,GAAG,SAAS,CAwC1B;AA2DD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,eAAe,GACtB,IAAI,CAqBN;AAED,2EAA2E;AAC3E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,aAAa,CAY7D;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAO7D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,CAUjE;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CACvC,CAAC"}
@@ -1,56 +0,0 @@
1
- import type { StatementRunner } from '../../db/statements.ts';
2
- import { type DataOrSchemaChange } from '../change-source/protocol/current/data.ts';
3
- import { type CookieOpTag } from './change-log-cookies.ts';
4
- export type ChangeLogStreamTransactionStats = {
5
- readonly rows: number;
6
- readonly estimatedBytes: number;
7
- /** Present only for transactions selected for shadow-write validation. */
8
- readonly hash?: string | undefined;
9
- /**
10
- * The cookie mutations this transaction's schema changes folded in, in stream
11
- * order. Empty for the overwhelming majority of transactions.
12
- */
13
- readonly cookieMutations: readonly CookieOpTag[];
14
- };
15
- export declare class ChangeLogStreamInvariantError extends Error {
16
- readonly name = "ChangeLogStreamInvariantError";
17
- }
18
- /**
19
- * Appends the canonical downstream stream to the change-log database, which is
20
- * a separate file from the replica, and folds its schema changes into the log's
21
- * cookie jar (`change-log-cookies.ts`) as it goes.
22
- *
23
- * This class owns the change log's transaction, and its transaction alone. It is
24
- * driven from the change-streamer's stream loop, which commits it before
25
- * forwarding a transaction's `commit` message; see `SQLiteChangeLogWriter` in
26
- * `change-streamer/sqlite-change-log-writer.ts` for the ordering that makes a
27
- * hole unreachable, and for the fail-soft policy that wraps every call here.
28
- *
29
- * Because the cookies are written in that same transaction, they are atomic with
30
- * the head and {@link rollback} discards them with the rows they were folded
31
- * from. Neither needs any handling of its own.
32
- */
33
- export declare class ChangeLogStreamWriter {
34
- #private;
35
- constructor(db: StatementRunner);
36
- begin(watermark: string, json: string, storedChange?: string, hash?: boolean): void;
37
- /**
38
- * Appends one data or schema change. The parsed message is taken rather than
39
- * just its tag because a schema change also mutates the cookie jar, and the
40
- * caller already holds it — so the fold costs no re-parse.
41
- *
42
- * The cookie statements run here, i.e. inside this transaction and in stream
43
- * order relative to the rows they were folded from. The Postgres change log
44
- * has to flush its buffered batch to get the same ordering
45
- * (`Storer.#processQueue()`); SQLite gets it from statement order.
46
- */
47
- append(json: string, change: DataOrSchemaChange, storedChange?: string): void;
48
- commit(watermark: string, json: string, writeTimeMs: number, storedChange?: string): ChangeLogStreamTransactionStats;
49
- /**
50
- * Discards the open transaction, if any. Safe to call when none is open — the
51
- * caller rolls back on an interrupted change stream, which can arrive between
52
- * transactions as well as inside one.
53
- */
54
- rollback(): void;
55
- }
56
- //# sourceMappingURL=change-log-stream-writer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change-log-stream-writer.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/change-log-stream-writer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,EAAwB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAMhF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,SAAS,WAAW,EAAE,CAAC;CAClD,CAAC;AAEF,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,SAAkB,IAAI,mCAAmC;CAC1D;AAWD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,qBAAqB;;IAYhC,YAAY,EAAE,EAAE,eAAe,EAc9B;IAED,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,YAAY,SAAwC,EACpD,IAAI,UAAO,GACV,IAAI,CAmCN;IAED;;;;;;;;;OASG;IACH,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,kBAAkB,EAC1B,YAAY,SAA2C,GACtD,IAAI,CAwBN;IAED,MAAM,CACJ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,YAAY,SAAyC,GACpD,+BAA+B,CA2CjC;IAED;;;;OAIG;IACH,QAAQ,IAAI,IAAI,CAMf;CAmBF"}
@@ -1,37 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import type { DownloadStatus } from '../../../../zero-events/src/status.ts';
3
- import type { StatementRunner } from '../../db/statements.ts';
4
- import type { ChangeStreamData } from '../change-source/protocol/current/downstream.ts';
5
- import type { ReplicatorMode } from './replicator.ts';
6
- export type ChangeProcessorMode = ReplicatorMode | 'initial-sync';
7
- export type CommitResult = {
8
- watermark: string;
9
- completedBackfill: DownloadStatus | undefined;
10
- schemaUpdated: boolean;
11
- changeLogUpdated: boolean;
12
- /**
13
- * Millisecond epoch at which the transaction committed upstream, if the
14
- * ChangeSource reported one. Propagated to ViewSyncers as the origin
15
- * timestamp of the end-to-end serving lag measurement.
16
- */
17
- upstreamCommitTimeMs?: number | undefined;
18
- };
19
- /**
20
- * The ChangeProcessor partitions the stream of messages into transactions
21
- * by creating a {@link TransactionProcessor} when a transaction begins, and dispatching
22
- * messages to it until the commit is received.
23
- *
24
- * From https://www.postgresql.org/docs/current/protocol-logical-replication.html#PROTOCOL-LOGICAL-MESSAGES-FLOW :
25
- *
26
- * "The logical replication protocol sends individual transactions one by one.
27
- * This means that all messages between a pair of Begin and Commit messages
28
- * belong to the same transaction."
29
- */
30
- export declare class ChangeProcessor {
31
- #private;
32
- constructor(db: StatementRunner, mode: ChangeProcessorMode, failService: (lc: LogContext, err: unknown) => void);
33
- abort(lc: LogContext): void;
34
- /** @return If a transaction was committed. */
35
- processMessage(lc: LogContext, downstream: ChangeStreamData): CommitResult | null;
36
- }
37
- //# sourceMappingURL=change-processor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change-processor.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/change-processor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAQjD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,uCAAuC,CAAC;AAmB1E,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAsC5D,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,iDAAiD,CAAC;AACtF,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAUpD,MAAM,MAAM,mBAAmB,GAAG,cAAc,GAAG,cAAc,CAAC;AASlE,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,cAAc,GAAG,SAAS,CAAC;IAC9C,aAAa,EAAE,OAAO,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;GAUG;AACH,qBAAa,eAAe;;IAiB1B,YACE,EAAE,EAAE,eAAe,EACnB,IAAI,EAAE,mBAAmB,EACzB,WAAW,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,EAQpD;IA2BD,KAAK,CAAC,EAAE,EAAE,UAAU,QAEnB;IAED,8CAA8C;IAC9C,cAAc,CACZ,EAAE,EAAE,UAAU,EACd,UAAU,EAAE,gBAAgB,GAC3B,YAAY,GAAG,IAAI,CAkBrB;CAyIF"}
@@ -1,82 +0,0 @@
1
- import type { LogContext } from '@rocicorp/logger';
2
- import { type Sized, type Source } from '../../types/streams.ts';
3
- import type { ChangeStreamer, SubscriberContext } from '../change-streamer/change-streamer.ts';
4
- import type { SubscribeDownstream } from '../change-streamer/subscribe.ts';
5
- import type { RunningState } from '../running-state.ts';
6
- export type SwitchoverOptions = {
7
- /**
8
- * Called when a replication-manager with a newer replica version grants
9
- * permission to restore its replica. This should initiate a graceful
10
- * restart of the server (during which the current subscription continues
11
- * to be served).
12
- */
13
- onRestoreGranted: () => void;
14
- /**
15
- * The replica file, from which the state of the last committed
16
- * transaction is read for switchover subscriptions.
17
- */
18
- replicaFile: string;
19
- /** For testing. */
20
- timeoutMs?: number | undefined;
21
- /** For testing. */
22
- searchTimeoutMs?: number | undefined;
23
- };
24
- export type Downstream = Source<Sized<SubscribeDownstream>>;
25
- /**
26
- * Handles the switchover of a serving replica's subscription from a draining
27
- * replication-manager to another one, without interrupting the current
28
- * subscription.
29
- *
30
- * Upon {@link onChangeStreamerDrain}, the handler repeatedly (with backoff)
31
- * opens a new `switchover` subscription, at the watermark of the replica's
32
- * last committed transaction, to whichever replication-manager the
33
- * connection is routed to. The first message on the new subscription
34
- * determines the outcome:
35
- * * `status`: The subscription was accepted (i.e. the replica is compatible).
36
- * The current subscription is cancelled (aborting any transaction in
37
- * progress), and the new one is made available via
38
- * {@link getNextConnection}. Note that the new subscription may start with
39
- * transactions that were committed from the current subscription in the
40
- * meantime, which the consumer must skip.
41
- * * `status` with `restore: queued`: The replication-manager has a newer
42
- * replica version, and is holding the subscription until it grants
43
- * permission to restore. The held subscription is monitored for the grant.
44
- * * `status` with `restore: granted`: Permission to restore is granted, and
45
- * {@link SwitchoverOptions.onRestoreGranted} is called. The granted
46
- * subscription is kept open until the process exits, so that the
47
- * replication-manager can track the grant until the restore begins.
48
- * * Anything else (e.g. an error, or a `draining` replication-manager):
49
- * The switchover is retried later.
50
- *
51
- * If no other replication-manager accepts or holds a switchover subscription
52
- * within {@link DEFAULT_SWITCHOVER_SEARCH_TIMEOUT_MS} (e.g. because the
53
- * draining one is the only one), the current subscription is closed so that
54
- * the draining replication-manager can shut down, and the consumer reconnects
55
- * on its own.
56
- *
57
- * The current subscription continues to be consumed throughout. A
58
- * switchover is scoped to the subscription from which it switches: If that
59
- * subscription ends first (e.g. the replication-manager shuts down), the
60
- * switchover is abandoned, including any held (but not granted)
61
- * subscription, as the consumer reconnects on its own.
62
- */
63
- export declare class DrainHandler {
64
- #private;
65
- /**
66
- * @param committedContext Returns the subscriber context as of the
67
- * replica's last committed transaction.
68
- */
69
- constructor(lc: LogContext, changeStreamer: ChangeStreamer, state: RunningState, options: SwitchoverOptions, committedContext: () => SubscriberContext);
70
- /**
71
- * Called when the change-streamer of the `current` subscription is
72
- * draining.
73
- */
74
- onChangeStreamerDrain(current: Downstream): void;
75
- get hasNextConnection(): boolean;
76
- /**
77
- * Returns (and clears) the subscription that replaces the (now cancelled)
78
- * current one, if a switchover succeeded.
79
- */
80
- getNextConnection(): Downstream | undefined;
81
- }
82
- //# sourceMappingURL=drain-handler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drain-handler.d.ts","sourceRoot":"","sources":["../../../../../../zero-cache/src/services/replicator/drain-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAEjD,OAAO,EAAW,KAAK,KAAK,EAAE,KAAK,MAAM,EAAC,MAAM,wBAAwB,CAAC;AACzE,OAAO,KAAK,EACV,cAAc,EAEd,iBAAiB,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAqBtD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAE7B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE/B,mBAAmB;IACnB,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;AAS5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBAAa,YAAY;;IAYvB;;;OAGG;IACH,YACE,EAAE,EAAE,UAAU,EACd,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,iBAAiB,EAC1B,gBAAgB,EAAE,MAAM,iBAAiB,EAO1C;IAED;;;OAGG;IACH,qBAAqB,CAAC,OAAO,EAAE,UAAU,QAaxC;IAED,IAAI,iBAAiB,IAAI,OAAO,CAE/B;IAED;;;OAGG;IACH,iBAAiB,IAAI,UAAU,GAAG,SAAS,CAI1C;CA+JF"}