@powerhousedao/reactor 4.1.0-dev.12 → 4.1.0-dev.121

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 (366) hide show
  1. package/dist/src/cache/buffer/ring-buffer.d.ts +37 -0
  2. package/dist/src/cache/buffer/ring-buffer.d.ts.map +1 -0
  3. package/dist/src/cache/buffer/ring-buffer.js +69 -0
  4. package/dist/src/cache/buffer/ring-buffer.js.map +1 -0
  5. package/dist/src/cache/index.d.ts +3 -0
  6. package/dist/src/cache/index.d.ts.map +1 -0
  7. package/dist/src/cache/index.js +2 -0
  8. package/dist/src/cache/index.js.map +1 -0
  9. package/dist/src/cache/kysely-operation-index.d.ts +13 -0
  10. package/dist/src/cache/kysely-operation-index.d.ts.map +1 -0
  11. package/dist/src/cache/kysely-operation-index.js +207 -0
  12. package/dist/src/cache/kysely-operation-index.js.map +1 -0
  13. package/dist/src/cache/kysely-write-cache.d.ts +134 -0
  14. package/dist/src/cache/kysely-write-cache.d.ts.map +1 -0
  15. package/dist/src/cache/kysely-write-cache.js +375 -0
  16. package/dist/src/cache/kysely-write-cache.js.map +1 -0
  17. package/dist/src/cache/lru/lru-tracker.d.ts +15 -0
  18. package/dist/src/cache/lru/lru-tracker.d.ts.map +1 -0
  19. package/dist/src/cache/lru/lru-tracker.js +96 -0
  20. package/dist/src/cache/lru/lru-tracker.js.map +1 -0
  21. package/dist/src/cache/operation-index-types.d.ts +49 -0
  22. package/dist/src/cache/operation-index-types.d.ts.map +1 -0
  23. package/dist/src/cache/operation-index-types.js +4 -0
  24. package/dist/src/cache/operation-index-types.js.map +1 -0
  25. package/dist/src/cache/write/interfaces.d.ts +83 -0
  26. package/dist/src/cache/write/interfaces.d.ts.map +1 -0
  27. package/dist/src/cache/write/interfaces.js +2 -0
  28. package/dist/src/cache/write/interfaces.js.map +1 -0
  29. package/dist/src/cache/write-cache-types.d.ts +42 -0
  30. package/dist/src/cache/write-cache-types.d.ts.map +1 -0
  31. package/dist/src/cache/write-cache-types.js +2 -0
  32. package/dist/src/cache/write-cache-types.js.map +1 -0
  33. package/dist/src/client/reactor-client.d.ts +103 -0
  34. package/dist/src/client/reactor-client.d.ts.map +1 -0
  35. package/dist/src/client/reactor-client.js +184 -0
  36. package/dist/src/client/reactor-client.js.map +1 -0
  37. package/dist/src/client/types.d.ts +213 -0
  38. package/dist/src/client/types.d.ts.map +1 -0
  39. package/dist/src/client/types.js +14 -0
  40. package/dist/src/client/types.js.map +1 -0
  41. package/dist/src/core/builder.d.ts +20 -0
  42. package/dist/src/core/builder.d.ts.map +1 -0
  43. package/dist/src/core/builder.js +47 -0
  44. package/dist/src/core/builder.js.map +1 -0
  45. package/dist/src/core/reactor-builder.d.ts +37 -0
  46. package/dist/src/core/reactor-builder.d.ts.map +1 -0
  47. package/dist/src/core/reactor-builder.js +138 -0
  48. package/dist/src/core/reactor-builder.js.map +1 -0
  49. package/dist/src/core/reactor.d.ts +111 -0
  50. package/dist/src/core/reactor.d.ts.map +1 -0
  51. package/dist/src/core/reactor.js +952 -0
  52. package/dist/src/core/reactor.js.map +1 -0
  53. package/dist/src/core/types.d.ts +183 -0
  54. package/dist/src/core/types.d.ts.map +1 -0
  55. package/dist/src/core/types.js +2 -0
  56. package/dist/src/core/types.js.map +1 -0
  57. package/dist/src/core/utils.d.ts +51 -0
  58. package/dist/src/core/utils.d.ts.map +1 -0
  59. package/dist/src/core/utils.js +141 -0
  60. package/dist/src/core/utils.js.map +1 -0
  61. package/dist/src/events/event-bus.d.ts +3 -3
  62. package/dist/src/events/event-bus.d.ts.map +1 -1
  63. package/dist/src/events/event-bus.js.map +1 -1
  64. package/dist/src/events/interfaces.d.ts +1 -1
  65. package/dist/src/events/interfaces.d.ts.map +1 -1
  66. package/dist/src/events/types.d.ts +31 -1
  67. package/dist/src/events/types.d.ts.map +1 -1
  68. package/dist/src/events/types.js +7 -0
  69. package/dist/src/events/types.js.map +1 -1
  70. package/dist/src/executor/interfaces.d.ts +31 -54
  71. package/dist/src/executor/interfaces.d.ts.map +1 -1
  72. package/dist/src/executor/simple-job-executor-manager.d.ts +32 -0
  73. package/dist/src/executor/simple-job-executor-manager.d.ts.map +1 -0
  74. package/dist/src/executor/simple-job-executor-manager.js +214 -0
  75. package/dist/src/executor/simple-job-executor-manager.js.map +1 -0
  76. package/dist/src/executor/simple-job-executor.d.ts +62 -0
  77. package/dist/src/executor/simple-job-executor.d.ts.map +1 -0
  78. package/dist/src/executor/simple-job-executor.js +705 -0
  79. package/dist/src/executor/simple-job-executor.js.map +1 -0
  80. package/dist/src/executor/types.d.ts +32 -8
  81. package/dist/src/executor/types.d.ts.map +1 -1
  82. package/dist/src/executor/types.js.map +1 -1
  83. package/dist/src/executor/util.d.ts +65 -0
  84. package/dist/src/executor/util.d.ts.map +1 -0
  85. package/dist/src/executor/util.js +154 -0
  86. package/dist/src/executor/util.js.map +1 -0
  87. package/dist/src/index.d.ts +35 -3
  88. package/dist/src/index.d.ts.map +1 -1
  89. package/dist/src/index.js +43 -2
  90. package/dist/src/index.js.map +1 -1
  91. package/dist/src/job-tracker/in-memory-job-tracker.d.ts +16 -0
  92. package/dist/src/job-tracker/in-memory-job-tracker.d.ts.map +1 -0
  93. package/dist/src/job-tracker/in-memory-job-tracker.js +84 -0
  94. package/dist/src/job-tracker/in-memory-job-tracker.js.map +1 -0
  95. package/dist/src/job-tracker/index.d.ts +3 -0
  96. package/dist/src/job-tracker/index.d.ts.map +1 -0
  97. package/dist/src/job-tracker/index.js +2 -0
  98. package/dist/src/job-tracker/index.js.map +1 -0
  99. package/dist/src/job-tracker/interfaces.d.ts +42 -0
  100. package/dist/src/job-tracker/interfaces.d.ts.map +1 -0
  101. package/dist/src/job-tracker/interfaces.js +2 -0
  102. package/dist/src/job-tracker/interfaces.js.map +1 -0
  103. package/dist/src/queue/interfaces.d.ts +46 -5
  104. package/dist/src/queue/interfaces.d.ts.map +1 -1
  105. package/dist/src/queue/job-execution-handle.d.ts +25 -0
  106. package/dist/src/queue/job-execution-handle.d.ts.map +1 -0
  107. package/dist/src/queue/job-execution-handle.js +62 -0
  108. package/dist/src/queue/job-execution-handle.js.map +1 -0
  109. package/dist/src/queue/queue.d.ts +56 -5
  110. package/dist/src/queue/queue.d.ts.map +1 -1
  111. package/dist/src/queue/queue.js +284 -36
  112. package/dist/src/queue/queue.js.map +1 -1
  113. package/dist/src/queue/types.d.ts +38 -5
  114. package/dist/src/queue/types.d.ts.map +1 -1
  115. package/dist/src/queue/types.js +12 -0
  116. package/dist/src/queue/types.js.map +1 -1
  117. package/dist/src/read-models/coordinator.d.ts +38 -0
  118. package/dist/src/read-models/coordinator.d.ts.map +1 -0
  119. package/dist/src/read-models/coordinator.js +72 -0
  120. package/dist/src/read-models/coordinator.js.map +1 -0
  121. package/dist/src/read-models/document-view.d.ts +24 -0
  122. package/dist/src/read-models/document-view.d.ts.map +1 -0
  123. package/dist/src/read-models/document-view.js +368 -0
  124. package/dist/src/read-models/document-view.js.map +1 -0
  125. package/dist/src/read-models/interfaces.d.ts +29 -0
  126. package/dist/src/read-models/interfaces.d.ts.map +1 -0
  127. package/dist/src/read-models/interfaces.js +2 -0
  128. package/dist/src/read-models/interfaces.js.map +1 -0
  129. package/dist/src/read-models/types.d.ts +46 -0
  130. package/dist/src/read-models/types.d.ts.map +1 -0
  131. package/dist/src/read-models/types.js +2 -0
  132. package/dist/src/read-models/types.js.map +1 -0
  133. package/dist/src/registry/implementation.d.ts +62 -0
  134. package/dist/src/registry/implementation.d.ts.map +1 -0
  135. package/dist/src/registry/implementation.js +96 -0
  136. package/dist/src/registry/implementation.js.map +1 -0
  137. package/dist/src/registry/index.d.ts +3 -0
  138. package/dist/src/registry/index.d.ts.map +1 -0
  139. package/dist/src/registry/index.js +2 -0
  140. package/dist/src/registry/index.js.map +1 -0
  141. package/dist/src/registry/interfaces.d.ts +39 -0
  142. package/dist/src/registry/interfaces.d.ts.map +1 -0
  143. package/dist/src/registry/interfaces.js +2 -0
  144. package/dist/src/registry/interfaces.js.map +1 -0
  145. package/dist/src/shared/awaiter.d.ts +32 -0
  146. package/dist/src/shared/awaiter.d.ts.map +1 -0
  147. package/dist/src/shared/awaiter.js +132 -0
  148. package/dist/src/shared/awaiter.js.map +1 -0
  149. package/dist/src/shared/consistency-tracker.d.ts +48 -0
  150. package/dist/src/shared/consistency-tracker.d.ts.map +1 -0
  151. package/dist/src/shared/consistency-tracker.js +123 -0
  152. package/dist/src/shared/consistency-tracker.js.map +1 -0
  153. package/dist/src/shared/errors.d.ts +17 -0
  154. package/dist/src/shared/errors.d.ts.map +1 -0
  155. package/dist/src/shared/errors.js +33 -0
  156. package/dist/src/shared/errors.js.map +1 -0
  157. package/dist/src/shared/factories.d.ts +16 -0
  158. package/dist/src/shared/factories.d.ts.map +1 -0
  159. package/dist/src/shared/factories.js +33 -0
  160. package/dist/src/shared/factories.js.map +1 -0
  161. package/dist/src/shared/types.d.ts +126 -20
  162. package/dist/src/shared/types.d.ts.map +1 -1
  163. package/dist/src/shared/types.js +35 -1
  164. package/dist/src/shared/types.js.map +1 -1
  165. package/dist/src/shared/utils.d.ts +3 -0
  166. package/dist/src/shared/utils.d.ts.map +1 -0
  167. package/dist/src/shared/utils.js +8 -0
  168. package/dist/src/shared/utils.js.map +1 -0
  169. package/dist/src/signer/passthrough-signer.d.ts +6 -0
  170. package/dist/src/signer/passthrough-signer.d.ts.map +1 -0
  171. package/dist/src/signer/passthrough-signer.js +6 -0
  172. package/dist/src/signer/passthrough-signer.js.map +1 -0
  173. package/dist/src/signer/types.d.ts +15 -0
  174. package/dist/src/signer/types.d.ts.map +1 -0
  175. package/dist/src/signer/types.js +2 -0
  176. package/dist/src/signer/types.js.map +1 -0
  177. package/dist/src/storage/index.d.ts +4 -0
  178. package/dist/src/storage/index.d.ts.map +1 -0
  179. package/dist/src/storage/index.js +3 -0
  180. package/dist/src/storage/index.js.map +1 -0
  181. package/dist/src/storage/interfaces.d.ts +335 -0
  182. package/dist/src/storage/interfaces.d.ts.map +1 -0
  183. package/dist/src/storage/interfaces.js +19 -0
  184. package/dist/src/storage/interfaces.js.map +1 -0
  185. package/dist/src/storage/kysely/document-indexer.d.ts +28 -0
  186. package/dist/src/storage/kysely/document-indexer.d.ts.map +1 -0
  187. package/dist/src/storage/kysely/document-indexer.js +350 -0
  188. package/dist/src/storage/kysely/document-indexer.js.map +1 -0
  189. package/dist/src/storage/kysely/keyframe-store.d.ts +15 -0
  190. package/dist/src/storage/kysely/keyframe-store.d.ts.map +1 -0
  191. package/dist/src/storage/kysely/keyframe-store.js +64 -0
  192. package/dist/src/storage/kysely/keyframe-store.js.map +1 -0
  193. package/dist/src/storage/kysely/store.d.ts +15 -0
  194. package/dist/src/storage/kysely/store.d.ts.map +1 -0
  195. package/dist/src/storage/kysely/store.js +196 -0
  196. package/dist/src/storage/kysely/store.js.map +1 -0
  197. package/dist/src/storage/kysely/sync-cursor-storage.d.ts +13 -0
  198. package/dist/src/storage/kysely/sync-cursor-storage.d.ts.map +1 -0
  199. package/dist/src/storage/kysely/sync-cursor-storage.js +93 -0
  200. package/dist/src/storage/kysely/sync-cursor-storage.js.map +1 -0
  201. package/dist/src/storage/kysely/sync-remote-storage.d.ts +13 -0
  202. package/dist/src/storage/kysely/sync-remote-storage.d.ts.map +1 -0
  203. package/dist/src/storage/kysely/sync-remote-storage.js +134 -0
  204. package/dist/src/storage/kysely/sync-remote-storage.js.map +1 -0
  205. package/dist/src/storage/kysely/types.d.ts +135 -0
  206. package/dist/src/storage/kysely/types.d.ts.map +1 -0
  207. package/dist/src/storage/kysely/types.js +2 -0
  208. package/dist/src/storage/kysely/types.js.map +1 -0
  209. package/dist/src/storage/migrations/001_create_operation_table.d.ts +3 -0
  210. package/dist/src/storage/migrations/001_create_operation_table.d.ts.map +1 -0
  211. package/dist/src/storage/migrations/001_create_operation_table.js +40 -0
  212. package/dist/src/storage/migrations/001_create_operation_table.js.map +1 -0
  213. package/dist/src/storage/migrations/002_create_keyframe_table.d.ts +3 -0
  214. package/dist/src/storage/migrations/002_create_keyframe_table.d.ts.map +1 -0
  215. package/dist/src/storage/migrations/002_create_keyframe_table.js +27 -0
  216. package/dist/src/storage/migrations/002_create_keyframe_table.js.map +1 -0
  217. package/dist/src/storage/migrations/003_create_document_table.d.ts +3 -0
  218. package/dist/src/storage/migrations/003_create_document_table.d.ts.map +1 -0
  219. package/dist/src/storage/migrations/003_create_document_table.js +10 -0
  220. package/dist/src/storage/migrations/003_create_document_table.js.map +1 -0
  221. package/dist/src/storage/migrations/004_create_document_relationship_table.d.ts +3 -0
  222. package/dist/src/storage/migrations/004_create_document_relationship_table.d.ts.map +1 -0
  223. package/dist/src/storage/migrations/004_create_document_relationship_table.js +35 -0
  224. package/dist/src/storage/migrations/004_create_document_relationship_table.js.map +1 -0
  225. package/dist/src/storage/migrations/005_create_indexer_state_table.d.ts +3 -0
  226. package/dist/src/storage/migrations/005_create_indexer_state_table.d.ts.map +1 -0
  227. package/dist/src/storage/migrations/005_create_indexer_state_table.js +10 -0
  228. package/dist/src/storage/migrations/005_create_indexer_state_table.js.map +1 -0
  229. package/dist/src/storage/migrations/006_create_document_snapshot_table.d.ts +3 -0
  230. package/dist/src/storage/migrations/006_create_document_snapshot_table.d.ts.map +1 -0
  231. package/dist/src/storage/migrations/006_create_document_snapshot_table.js +49 -0
  232. package/dist/src/storage/migrations/006_create_document_snapshot_table.js.map +1 -0
  233. package/dist/src/storage/migrations/007_create_slug_mapping_table.d.ts +3 -0
  234. package/dist/src/storage/migrations/007_create_slug_mapping_table.d.ts.map +1 -0
  235. package/dist/src/storage/migrations/007_create_slug_mapping_table.js +24 -0
  236. package/dist/src/storage/migrations/007_create_slug_mapping_table.js.map +1 -0
  237. package/dist/src/storage/migrations/008_create_view_state_table.d.ts +3 -0
  238. package/dist/src/storage/migrations/008_create_view_state_table.d.ts.map +1 -0
  239. package/dist/src/storage/migrations/008_create_view_state_table.js +9 -0
  240. package/dist/src/storage/migrations/008_create_view_state_table.js.map +1 -0
  241. package/dist/src/storage/migrations/009_create_operation_index_tables.d.ts +3 -0
  242. package/dist/src/storage/migrations/009_create_operation_index_tables.d.ts.map +1 -0
  243. package/dist/src/storage/migrations/009_create_operation_index_tables.js +50 -0
  244. package/dist/src/storage/migrations/009_create_operation_index_tables.js.map +1 -0
  245. package/dist/src/storage/migrations/010_create_sync_tables.d.ts +3 -0
  246. package/dist/src/storage/migrations/010_create_sync_tables.d.ts.map +1 -0
  247. package/dist/src/storage/migrations/010_create_sync_tables.js +43 -0
  248. package/dist/src/storage/migrations/010_create_sync_tables.js.map +1 -0
  249. package/dist/src/storage/migrations/index.d.ts +3 -0
  250. package/dist/src/storage/migrations/index.d.ts.map +1 -0
  251. package/dist/src/storage/migrations/index.js +3 -0
  252. package/dist/src/storage/migrations/index.js.map +1 -0
  253. package/dist/src/storage/migrations/migrator.d.ts +5 -0
  254. package/dist/src/storage/migrations/migrator.d.ts.map +1 -0
  255. package/dist/src/storage/migrations/migrator.js +55 -0
  256. package/dist/src/storage/migrations/migrator.js.map +1 -0
  257. package/dist/src/storage/migrations/run-migrations.d.ts +2 -0
  258. package/dist/src/storage/migrations/run-migrations.d.ts.map +1 -0
  259. package/dist/src/storage/migrations/run-migrations.js +58 -0
  260. package/dist/src/storage/migrations/run-migrations.js.map +1 -0
  261. package/dist/src/storage/migrations/types.d.ts +9 -0
  262. package/dist/src/storage/migrations/types.d.ts.map +1 -0
  263. package/dist/src/storage/migrations/types.js +2 -0
  264. package/dist/src/storage/migrations/types.js.map +1 -0
  265. package/dist/src/storage/txn.d.ts +15 -0
  266. package/dist/src/storage/txn.d.ts.map +1 -0
  267. package/dist/src/storage/txn.js +43 -0
  268. package/dist/src/storage/txn.js.map +1 -0
  269. package/dist/src/subs/default-error-handler.d.ts +13 -0
  270. package/dist/src/subs/default-error-handler.d.ts.map +1 -0
  271. package/dist/src/subs/default-error-handler.js +27 -0
  272. package/dist/src/subs/default-error-handler.js.map +1 -0
  273. package/dist/src/subs/react-subscription-manager.d.ts +45 -0
  274. package/dist/src/subs/react-subscription-manager.d.ts.map +1 -0
  275. package/dist/src/subs/react-subscription-manager.js +185 -0
  276. package/dist/src/subs/react-subscription-manager.js.map +1 -0
  277. package/dist/src/subs/types.d.ts +64 -0
  278. package/dist/src/subs/types.d.ts.map +1 -0
  279. package/dist/src/subs/types.js +2 -0
  280. package/dist/src/subs/types.js.map +1 -0
  281. package/dist/src/sync/channels/index.d.ts +3 -0
  282. package/dist/src/sync/channels/index.d.ts.map +1 -0
  283. package/dist/src/sync/channels/index.js +3 -0
  284. package/dist/src/sync/channels/index.js.map +1 -0
  285. package/dist/src/sync/channels/internal-channel.d.ts +57 -0
  286. package/dist/src/sync/channels/internal-channel.d.ts.map +1 -0
  287. package/dist/src/sync/channels/internal-channel.js +106 -0
  288. package/dist/src/sync/channels/internal-channel.js.map +1 -0
  289. package/dist/src/sync/channels/utils.d.ts +15 -0
  290. package/dist/src/sync/channels/utils.d.ts.map +1 -0
  291. package/dist/src/sync/channels/utils.js +26 -0
  292. package/dist/src/sync/channels/utils.js.map +1 -0
  293. package/dist/src/sync/errors.d.ts +10 -0
  294. package/dist/src/sync/errors.d.ts.map +1 -0
  295. package/dist/src/sync/errors.js +17 -0
  296. package/dist/src/sync/errors.js.map +1 -0
  297. package/dist/src/sync/index.d.ts +12 -0
  298. package/dist/src/sync/index.d.ts.map +1 -0
  299. package/dist/src/sync/index.js +9 -0
  300. package/dist/src/sync/index.js.map +1 -0
  301. package/dist/src/sync/interfaces.d.ts +150 -0
  302. package/dist/src/sync/interfaces.d.ts.map +1 -0
  303. package/dist/src/sync/interfaces.js +2 -0
  304. package/dist/src/sync/interfaces.js.map +1 -0
  305. package/dist/src/sync/mailbox.d.ts +21 -0
  306. package/dist/src/sync/mailbox.d.ts.map +1 -0
  307. package/dist/src/sync/mailbox.js +59 -0
  308. package/dist/src/sync/mailbox.js.map +1 -0
  309. package/dist/src/sync/sync-builder.d.ts +17 -0
  310. package/dist/src/sync/sync-builder.d.ts.map +1 -0
  311. package/dist/src/sync/sync-builder.js +29 -0
  312. package/dist/src/sync/sync-builder.js.map +1 -0
  313. package/dist/src/sync/sync-manager.d.ts +33 -0
  314. package/dist/src/sync/sync-manager.d.ts.map +1 -0
  315. package/dist/src/sync/sync-manager.js +196 -0
  316. package/dist/src/sync/sync-manager.js.map +1 -0
  317. package/dist/src/sync/sync-operation.d.ts +28 -0
  318. package/dist/src/sync/sync-operation.d.ts.map +1 -0
  319. package/dist/src/sync/sync-operation.js +63 -0
  320. package/dist/src/sync/sync-operation.js.map +1 -0
  321. package/dist/src/sync/types.d.ts +61 -0
  322. package/dist/src/sync/types.d.ts.map +1 -0
  323. package/dist/src/sync/types.js +16 -0
  324. package/dist/src/sync/types.js.map +1 -0
  325. package/dist/src/sync/utils.d.ts +17 -0
  326. package/dist/src/sync/utils.d.ts.map +1 -0
  327. package/dist/src/sync/utils.js +34 -0
  328. package/dist/src/sync/utils.js.map +1 -0
  329. package/dist/src/utils/reshuffle.d.ts +30 -0
  330. package/dist/src/utils/reshuffle.d.ts.map +1 -0
  331. package/dist/src/utils/reshuffle.js +47 -0
  332. package/dist/src/utils/reshuffle.js.map +1 -0
  333. package/package.json +23 -7
  334. package/dist/bench/end-to-end-flow.bench.d.ts +0 -2
  335. package/dist/bench/end-to-end-flow.bench.d.ts.map +0 -1
  336. package/dist/bench/end-to-end-flow.bench.js +0 -256
  337. package/dist/bench/end-to-end-flow.bench.js.map +0 -1
  338. package/dist/bench/event-bus.bench.d.ts +0 -2
  339. package/dist/bench/event-bus.bench.d.ts.map +0 -1
  340. package/dist/bench/event-bus.bench.js +0 -238
  341. package/dist/bench/event-bus.bench.js.map +0 -1
  342. package/dist/bench/queue-only.bench.d.ts +0 -2
  343. package/dist/bench/queue-only.bench.d.ts.map +0 -1
  344. package/dist/bench/queue-only.bench.js +0 -40
  345. package/dist/bench/queue-only.bench.js.map +0 -1
  346. package/dist/bench/reactor-throughput.bench.d.ts +0 -2
  347. package/dist/bench/reactor-throughput.bench.d.ts.map +0 -1
  348. package/dist/bench/reactor-throughput.bench.js +0 -137
  349. package/dist/bench/reactor-throughput.bench.js.map +0 -1
  350. package/dist/src/executor/job-executor.d.ts +0 -62
  351. package/dist/src/executor/job-executor.d.ts.map +0 -1
  352. package/dist/src/executor/job-executor.js +0 -325
  353. package/dist/src/executor/job-executor.js.map +0 -1
  354. package/dist/test/event-bus.test.d.ts +0 -2
  355. package/dist/test/event-bus.test.d.ts.map +0 -1
  356. package/dist/test/event-bus.test.js +0 -532
  357. package/dist/test/event-bus.test.js.map +0 -1
  358. package/dist/test/job-executor.test.d.ts +0 -2
  359. package/dist/test/job-executor.test.d.ts.map +0 -1
  360. package/dist/test/job-executor.test.js +0 -581
  361. package/dist/test/job-executor.test.js.map +0 -1
  362. package/dist/test/queue.test.d.ts +0 -2
  363. package/dist/test/queue.test.d.ts.map +0 -1
  364. package/dist/test/queue.test.js +0 -396
  365. package/dist/test/queue.test.js.map +0 -1
  366. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-migrations.js","sourceRoot":"","sources":["../../../../src/storage/migrations/run-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAElE,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhC,MAAM,YAAY,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,CAAC;IACjD,MAAM,EAAE,GAAG,IAAI,MAAM,CAAM;QACzB,OAAO,EAAE,YAAY,CAAC,OAAO;KAC9B,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjC,OAAO,CAAC,GAAG,CAAC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;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,EAAE,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;YAC7D,OAAO,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC;YAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CACX,QAAQ,EACR,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACvD,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC;AAED,KAAK,IAAI,EAAE,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { Migration } from "kysely";
2
+ export type MigrationStrategy = "auto" | "manual" | "none";
3
+ export interface MigrationResult {
4
+ success: boolean;
5
+ migrationsExecuted: string[];
6
+ error?: Error;
7
+ }
8
+ export type ReactorMigration = Migration;
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/storage/migrations/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,MAAM,gBAAgB,GAAG,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/storage/migrations/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,15 @@
1
+ import type { Operation } from "document-model";
2
+ import { type AtomicTxn as IAtomicTxn } from "./interfaces.js";
3
+ import type { InsertableOperation } from "./kysely/types.js";
4
+ export declare class AtomicTransaction implements IAtomicTxn {
5
+ private documentId;
6
+ private documentType;
7
+ private scope;
8
+ private branch;
9
+ private baseRevision;
10
+ private operations;
11
+ constructor(documentId: string, documentType: string, scope: string, branch: string, baseRevision: number);
12
+ addOperations(...operations: Operation[]): void;
13
+ getOperations(): InsertableOperation[];
14
+ }
15
+ //# sourceMappingURL=txn.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txn.d.ts","sourceRoot":"","sources":["../../../src/storage/txn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,KAAK,SAAS,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,qBAAa,iBAAkB,YAAW,UAAU;IAIhD,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,YAAY;IACpB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,YAAY;IAPtB,OAAO,CAAC,UAAU,CAA6B;gBAGrC,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM;IAK9B,aAAa,CAAC,GAAG,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI;IAsB/C,aAAa,IAAI,mBAAmB,EAAE;CAGvC"}
@@ -0,0 +1,43 @@
1
+ import { v4 as uuidv4 } from "uuid";
2
+ import {} from "./interfaces.js";
3
+ export class AtomicTransaction {
4
+ documentId;
5
+ documentType;
6
+ scope;
7
+ branch;
8
+ baseRevision;
9
+ operations = [];
10
+ constructor(documentId, documentType, scope, branch, baseRevision) {
11
+ this.documentId = documentId;
12
+ this.documentType = documentType;
13
+ this.scope = scope;
14
+ this.branch = branch;
15
+ this.baseRevision = baseRevision;
16
+ //
17
+ }
18
+ addOperations(...operations) {
19
+ for (const op of operations) {
20
+ this.operations.push({
21
+ // WRONG
22
+ jobId: uuidv4(),
23
+ // WRONG
24
+ opId: op.id || uuidv4(),
25
+ prevOpId: "", // Will be set during apply
26
+ documentId: this.documentId,
27
+ documentType: this.documentType,
28
+ scope: this.scope,
29
+ branch: this.branch,
30
+ timestampUtcMs: new Date(op.timestampUtcMs),
31
+ index: op.index,
32
+ action: JSON.stringify(op.action),
33
+ skip: op.skip,
34
+ error: op.error || null,
35
+ hash: op.hash,
36
+ });
37
+ }
38
+ }
39
+ getOperations() {
40
+ return this.operations;
41
+ }
42
+ }
43
+ //# sourceMappingURL=txn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"txn.js","sourceRoot":"","sources":["../../../src/storage/txn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAgC,MAAM,iBAAiB,CAAC;AAG/D,MAAM,OAAO,iBAAiB;IAIlB;IACA;IACA;IACA;IACA;IAPF,UAAU,GAA0B,EAAE,CAAC;IAE/C,YACU,UAAkB,EAClB,YAAoB,EACpB,KAAa,EACb,MAAc,EACd,YAAoB;QAJpB,eAAU,GAAV,UAAU,CAAQ;QAClB,iBAAY,GAAZ,YAAY,CAAQ;QACpB,UAAK,GAAL,KAAK,CAAQ;QACb,WAAM,GAAN,MAAM,CAAQ;QACd,iBAAY,GAAZ,YAAY,CAAQ;QAE5B,EAAE;IACJ,CAAC;IAED,aAAa,CAAC,GAAG,UAAuB;QACtC,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;YAC5B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;gBACnB,QAAQ;gBACR,KAAK,EAAE,MAAM,EAAE;gBACf,QAAQ;gBACR,IAAI,EAAE,EAAE,CAAC,EAAE,IAAI,MAAM,EAAE;gBACvB,QAAQ,EAAE,EAAE,EAAE,2BAA2B;gBACzC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,cAAc,EAAE,IAAI,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC;gBAC3C,KAAK,EAAE,EAAE,CAAC,KAAK;gBACf,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC;gBACjC,IAAI,EAAE,EAAE,CAAC,IAAI;gBACb,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,IAAI;gBACvB,IAAI,EAAE,EAAE,CAAC,IAAI;aACd,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,13 @@
1
+ import type { ISubscriptionErrorHandler, SubscriptionErrorContext } from "./types.js";
2
+ /**
3
+ * Default error handler that re-throws subscription errors.
4
+ * This ensures that errors are not silently swallowed.
5
+ */
6
+ export declare class DefaultSubscriptionErrorHandler implements ISubscriptionErrorHandler {
7
+ handleError(error: unknown, context: SubscriptionErrorContext): void;
8
+ }
9
+ /**
10
+ * Creates a default subscription error handler instance
11
+ */
12
+ export declare function createDefaultSubscriptionErrorHandler(): ISubscriptionErrorHandler;
13
+ //# sourceMappingURL=default-error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-error-handler.d.ts","sourceRoot":"","sources":["../../../src/subs/default-error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAEpB;;;GAGG;AACH,qBAAa,+BACX,YAAW,yBAAyB;IAEpC,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,wBAAwB,GAAG,IAAI;CAcrE;AAED;;GAEG;AACH,wBAAgB,qCAAqC,IAAI,yBAAyB,CAEjF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Default error handler that re-throws subscription errors.
3
+ * This ensures that errors are not silently swallowed.
4
+ */
5
+ export class DefaultSubscriptionErrorHandler {
6
+ handleError(error, context) {
7
+ const errorMessage = `Subscription error in ${context.eventType} (${context.subscriptionId})`;
8
+ if (error instanceof Error) {
9
+ // Preserve the original error with additional context
10
+ const enhancedError = new Error(`${errorMessage}: ${error.message}`);
11
+ enhancedError.cause = error;
12
+ enhancedError.stack = error.stack;
13
+ throw enhancedError;
14
+ }
15
+ else {
16
+ // Handle non-Error objects
17
+ throw new Error(`${errorMessage}: ${String(error)}`);
18
+ }
19
+ }
20
+ }
21
+ /**
22
+ * Creates a default subscription error handler instance
23
+ */
24
+ export function createDefaultSubscriptionErrorHandler() {
25
+ return new DefaultSubscriptionErrorHandler();
26
+ }
27
+ //# sourceMappingURL=default-error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default-error-handler.js","sourceRoot":"","sources":["../../../src/subs/default-error-handler.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,OAAO,+BAA+B;IAG1C,WAAW,CAAC,KAAc,EAAE,OAAiC;QAC3D,MAAM,YAAY,GAAG,yBAAyB,OAAO,CAAC,SAAS,KAAK,OAAO,CAAC,cAAc,GAAG,CAAC;QAE9F,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,sDAAsD;YACtD,MAAM,aAAa,GAAG,IAAI,KAAK,CAAC,GAAG,YAAY,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACrE,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC;YAC5B,aAAa,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;YAClC,MAAM,aAAa,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,2BAA2B;YAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,YAAY,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,qCAAqC;IACnD,OAAO,IAAI,+BAA+B,EAAE,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { PHDocument } from "document-model";
2
+ import type { PagedResults, RelationshipChangeType, SearchFilter, ViewFilter } from "../shared/types.js";
3
+ import type { IReactorSubscriptionManager, ISubscriptionErrorHandler } from "./types.js";
4
+ type DocumentCreatedCallback = (result: PagedResults<string>) => void;
5
+ type DocumentDeletedCallback = (documentIds: string[]) => void;
6
+ type DocumentStateUpdatedCallback = (result: PagedResults<PHDocument>) => void;
7
+ type RelationshipChangedCallback = (parentId: string, childId: string, changeType: RelationshipChangeType) => void;
8
+ export declare class ReactorSubscriptionManager implements IReactorSubscriptionManager {
9
+ private createdSubscriptions;
10
+ private deletedSubscriptions;
11
+ private updatedSubscriptions;
12
+ private relationshipSubscriptions;
13
+ private subscriptionCounter;
14
+ private errorHandler;
15
+ constructor(errorHandler: ISubscriptionErrorHandler);
16
+ onDocumentCreated(callback: DocumentCreatedCallback, search?: SearchFilter): () => void;
17
+ onDocumentDeleted(callback: DocumentDeletedCallback, search?: SearchFilter): () => void;
18
+ onDocumentStateUpdated(callback: DocumentStateUpdatedCallback, search?: SearchFilter, view?: ViewFilter): () => void;
19
+ onRelationshipChanged(callback: RelationshipChangedCallback, search?: SearchFilter): () => void;
20
+ /**
21
+ * Notify subscribers about created documents
22
+ */
23
+ notifyDocumentsCreated(documentIds: string[], documentTypes?: Map<string, string>, parentIds?: Map<string, string | null>): void;
24
+ /**
25
+ * Notify subscribers about deleted documents
26
+ */
27
+ notifyDocumentsDeleted(documentIds: string[], documentTypes?: Map<string, string>, parentIds?: Map<string, string | null>): void;
28
+ /**
29
+ * Notify subscribers about updated documents
30
+ */
31
+ notifyDocumentsUpdated(documents: PHDocument[]): void;
32
+ /**
33
+ * Notify subscribers about relationship changes
34
+ */
35
+ notifyRelationshipChanged(parentId: string, childId: string, changeType: RelationshipChangeType, childType?: string): void;
36
+ /**
37
+ * Clear all subscriptions
38
+ */
39
+ clearAll(): void;
40
+ private filterDocumentIds;
41
+ private filterDocuments;
42
+ private matchesRelationshipFilter;
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=react-subscription-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-subscription-manager.d.ts","sourceRoot":"","sources":["../../../src/subs/react-subscription-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,KAAK,uBAAuB,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;AACtE,KAAK,uBAAuB,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;AAC/D,KAAK,4BAA4B,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;AAC/E,KAAK,2BAA2B,GAAG,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,sBAAsB,KAC/B,IAAI,CAAC;AASV,qBAAa,0BAA2B,YAAW,2BAA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AI;IAuBP;;OAEG;IACH,QAAQ,IAAI,IAAI;IAOhB,OAAO,CAAC,iBAAiB;IAyBzB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,yBAAyB;CAclC"}
@@ -0,0 +1,185 @@
1
+ export class ReactorSubscriptionManager {
2
+ createdSubscriptions = new Map();
3
+ deletedSubscriptions = new Map();
4
+ updatedSubscriptions = new Map();
5
+ relationshipSubscriptions = new Map();
6
+ subscriptionCounter = 0;
7
+ errorHandler;
8
+ constructor(errorHandler) {
9
+ this.errorHandler = errorHandler;
10
+ }
11
+ onDocumentCreated(callback, search) {
12
+ const id = `created-${++this.subscriptionCounter}`;
13
+ this.createdSubscriptions.set(id, { id, callback, search });
14
+ return () => {
15
+ this.createdSubscriptions.delete(id);
16
+ };
17
+ }
18
+ onDocumentDeleted(callback, search) {
19
+ const id = `deleted-${++this.subscriptionCounter}`;
20
+ this.deletedSubscriptions.set(id, { id, callback, search });
21
+ return () => {
22
+ this.deletedSubscriptions.delete(id);
23
+ };
24
+ }
25
+ onDocumentStateUpdated(callback, search, view) {
26
+ const id = `updated-${++this.subscriptionCounter}`;
27
+ this.updatedSubscriptions.set(id, { id, callback, search, view });
28
+ return () => {
29
+ this.updatedSubscriptions.delete(id);
30
+ };
31
+ }
32
+ onRelationshipChanged(callback, search) {
33
+ const id = `relationship-${++this.subscriptionCounter}`;
34
+ this.relationshipSubscriptions.set(id, { id, callback, search });
35
+ return () => {
36
+ this.relationshipSubscriptions.delete(id);
37
+ };
38
+ }
39
+ /**
40
+ * Notify subscribers about created documents
41
+ */
42
+ notifyDocumentsCreated(documentIds, documentTypes, parentIds) {
43
+ const result = {
44
+ results: documentIds,
45
+ options: { cursor: "", limit: documentIds.length },
46
+ };
47
+ for (const subscription of this.createdSubscriptions.values()) {
48
+ const filteredIds = this.filterDocumentIds(documentIds, subscription.search, documentTypes, parentIds);
49
+ if (filteredIds.length > 0) {
50
+ try {
51
+ subscription.callback({
52
+ ...result,
53
+ results: filteredIds,
54
+ });
55
+ }
56
+ catch (error) {
57
+ this.errorHandler.handleError(error, {
58
+ eventType: "created",
59
+ subscriptionId: subscription.id,
60
+ eventData: filteredIds,
61
+ });
62
+ }
63
+ }
64
+ }
65
+ }
66
+ /**
67
+ * Notify subscribers about deleted documents
68
+ */
69
+ notifyDocumentsDeleted(documentIds, documentTypes, parentIds) {
70
+ for (const subscription of this.deletedSubscriptions.values()) {
71
+ const filteredIds = this.filterDocumentIds(documentIds, subscription.search, documentTypes, parentIds);
72
+ if (filteredIds.length > 0) {
73
+ try {
74
+ subscription.callback(filteredIds);
75
+ }
76
+ catch (error) {
77
+ this.errorHandler.handleError(error, {
78
+ eventType: "deleted",
79
+ subscriptionId: subscription.id,
80
+ eventData: filteredIds,
81
+ });
82
+ }
83
+ }
84
+ }
85
+ }
86
+ /**
87
+ * Notify subscribers about updated documents
88
+ */
89
+ notifyDocumentsUpdated(documents) {
90
+ const result = {
91
+ results: documents,
92
+ options: { cursor: "", limit: documents.length },
93
+ };
94
+ for (const subscription of this.updatedSubscriptions.values()) {
95
+ const filteredDocs = this.filterDocuments(documents, subscription.search);
96
+ if (filteredDocs.length > 0) {
97
+ try {
98
+ subscription.callback({
99
+ ...result,
100
+ results: filteredDocs,
101
+ });
102
+ }
103
+ catch (error) {
104
+ this.errorHandler.handleError(error, {
105
+ eventType: "updated",
106
+ subscriptionId: subscription.id,
107
+ eventData: filteredDocs,
108
+ });
109
+ }
110
+ }
111
+ }
112
+ }
113
+ /**
114
+ * Notify subscribers about relationship changes
115
+ */
116
+ notifyRelationshipChanged(parentId, childId, changeType, childType) {
117
+ for (const subscription of this.relationshipSubscriptions.values()) {
118
+ if (this.matchesRelationshipFilter(parentId, childId, childType, subscription.search)) {
119
+ try {
120
+ subscription.callback(parentId, childId, changeType);
121
+ }
122
+ catch (error) {
123
+ this.errorHandler.handleError(error, {
124
+ eventType: "relationshipChanged",
125
+ subscriptionId: subscription.id,
126
+ eventData: { parentId, childId, changeType },
127
+ });
128
+ }
129
+ }
130
+ }
131
+ }
132
+ /**
133
+ * Clear all subscriptions
134
+ */
135
+ clearAll() {
136
+ this.createdSubscriptions.clear();
137
+ this.deletedSubscriptions.clear();
138
+ this.updatedSubscriptions.clear();
139
+ this.relationshipSubscriptions.clear();
140
+ }
141
+ filterDocumentIds(documentIds, search, documentTypes, parentIds) {
142
+ if (!search)
143
+ return documentIds;
144
+ return documentIds.filter((id) => {
145
+ if (search.ids && !search.ids.includes(id))
146
+ return false;
147
+ if (search.type && documentTypes) {
148
+ const docType = documentTypes.get(id);
149
+ if (docType !== search.type)
150
+ return false;
151
+ }
152
+ if (search.parentId && parentIds) {
153
+ const parentId = parentIds.get(id);
154
+ if (parentId !== search.parentId)
155
+ return false;
156
+ }
157
+ return true;
158
+ });
159
+ }
160
+ filterDocuments(documents, search) {
161
+ if (!search)
162
+ return documents;
163
+ return documents.filter((doc) => {
164
+ if (search.ids && !search.ids.includes(doc.header.id))
165
+ return false;
166
+ if (search.type && doc.header.documentType !== search.type)
167
+ return false;
168
+ if (search.slugs && !search.slugs.includes(doc.header.slug))
169
+ return false;
170
+ return true;
171
+ });
172
+ }
173
+ matchesRelationshipFilter(parentId, childId, childType, search) {
174
+ if (!search)
175
+ return true;
176
+ if (search.parentId && parentId !== search.parentId)
177
+ return false;
178
+ if (search.ids && !search.ids.includes(childId))
179
+ return false;
180
+ if (search.type && childType && childType !== search.type)
181
+ return false;
182
+ return true;
183
+ }
184
+ }
185
+ //# sourceMappingURL=react-subscription-manager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-subscription-manager.js","sourceRoot":"","sources":["../../../src/subs/react-subscription-manager.ts"],"names":[],"mappings":"AA4BA,MAAM,OAAO,0BAA0B;IAC7B,oBAAoB,GAAG,IAAI,GAAG,EAGnC,CAAC;IACI,oBAAoB,GAAG,IAAI,GAAG,EAGnC,CAAC;IACI,oBAAoB,GAAG,IAAI,GAAG,EAGnC,CAAC;IACI,yBAAyB,GAAG,IAAI,GAAG,EAGx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,KAAK,MAAM,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAClE,IAAI,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,OAAO,KAAK,CAAC;QAC9D,IAAI,MAAM,CAAC,IAAI,IAAI,SAAS,IAAI,SAAS,KAAK,MAAM,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QAExE,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
@@ -0,0 +1,64 @@
1
+ import type { PHDocument } from "document-model";
2
+ import type { PagedResults, RelationshipChangeType, SearchFilter, ViewFilter } from "../shared/types.js";
3
+ /**
4
+ * Error handler for subscription callback errors
5
+ */
6
+ export interface ISubscriptionErrorHandler {
7
+ /**
8
+ * Called when a subscription callback throws an error
9
+ * @param error - The error that was thrown
10
+ * @param context - Context about which subscription failed
11
+ */
12
+ handleError(error: unknown, context: SubscriptionErrorContext): void;
13
+ }
14
+ /**
15
+ * Context information about a subscription error
16
+ */
17
+ export interface SubscriptionErrorContext {
18
+ /** The type of event that was being processed */
19
+ eventType: "created" | "deleted" | "updated" | "relationshipChanged";
20
+ /** The subscription ID that failed */
21
+ subscriptionId: string;
22
+ /** Optional additional data about the event */
23
+ eventData?: unknown;
24
+ }
25
+ /**
26
+ * Interface for subscribing to document events in the reactor.
27
+ */
28
+ export interface IReactorSubscriptionManager {
29
+ /**
30
+ * Subscribes to document creation events
31
+ *
32
+ * @param callback - Function called when documents are created
33
+ * @param search - Optional search filter to limit which documents trigger events
34
+ * @param view - Optional filter containing branch and scopes information
35
+ * @returns A function that unsubscribes from the events
36
+ */
37
+ onDocumentCreated(callback: (result: PagedResults<string>) => void, search?: SearchFilter): () => void;
38
+ /**
39
+ * Subscribes to document deletion events
40
+ *
41
+ * @param callback - Function called when documents are deleted
42
+ * @param search - Optional search filter to limit which documents trigger events
43
+ * @returns A function that unsubscribes from the events
44
+ */
45
+ onDocumentDeleted(callback: (documentIds: string[]) => void, search?: SearchFilter): () => void;
46
+ /**
47
+ * Subscribes to document state updates
48
+ *
49
+ * @param callback - Function called when documents are updated
50
+ * @param search - Optional search filter to limit which documents trigger events
51
+ * @param view - Optional filter containing branch and scopes information
52
+ * @returns A function that unsubscribes from the events
53
+ */
54
+ onDocumentStateUpdated(callback: (result: PagedResults<PHDocument>) => void, search?: SearchFilter, view?: ViewFilter): () => void;
55
+ /**
56
+ * Subscribes to parent-child relationship change events
57
+ *
58
+ * @param callback - Function called when parent-child relationships change
59
+ * @param search - Optional search filter to limit which documents trigger events
60
+ * @returns A function that unsubscribes from the events
61
+ */
62
+ onRelationshipChanged(callback: (parentId: string, childId: string, changeType: RelationshipChangeType) => void, search?: SearchFilter): () => void;
63
+ }
64
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/subs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACtB,YAAY,EACZ,UAAU,EACX,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACtE;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,qBAAqB,CAAC;IACrE,sCAAsC;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;OAOG;IACH,iBAAiB,CACf,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,KAAK,IAAI,EAChD,MAAM,CAAC,EAAE,YAAY,GACpB,MAAM,IAAI,CAAC;IAEd;;;;;;OAMG;IACH,iBAAiB,CACf,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,IAAI,EACzC,MAAM,CAAC,EAAE,YAAY,GACpB,MAAM,IAAI,CAAC;IAEd;;;;;;;OAOG;IACH,sBAAsB,CACpB,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,KAAK,IAAI,EACpD,MAAM,CAAC,EAAE,YAAY,EACrB,IAAI,CAAC,EAAE,UAAU,GAChB,MAAM,IAAI,CAAC;IAEd;;;;;;OAMG;IACH,qBAAqB,CACnB,QAAQ,EAAE,CACR,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,sBAAsB,KAC/B,IAAI,EACT,MAAM,CAAC,EAAE,YAAY,GACpB,MAAM,IAAI,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/subs/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export { InternalChannel } from "./internal-channel.js";
2
+ export { envelopeToSyncOperation } from "./utils.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { InternalChannel } from "./internal-channel.js";
2
+ export { envelopeToSyncOperation } from "./utils.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { ISyncCursorStorage } from "../../storage/interfaces.js";
2
+ import type { IChannel } from "../interfaces.js";
3
+ import type { SyncOperation } from "../sync-operation.js";
4
+ import { Mailbox } from "../mailbox.js";
5
+ import type { SyncEnvelope } from "../types.js";
6
+ /**
7
+ * In-memory synchronization channel for testing purposes only.
8
+ *
9
+ * InternalChannel enables direct bidirectional communication between two reactor
10
+ * instances without network transport. Channels are wired together by passing
11
+ * a send function that delivers envelopes to the peer's inbox.
12
+ */
13
+ export declare class InternalChannel implements IChannel {
14
+ readonly inbox: Mailbox<SyncOperation>;
15
+ readonly outbox: Mailbox<SyncOperation>;
16
+ readonly deadLetter: Mailbox<SyncOperation>;
17
+ private readonly channelId;
18
+ private readonly remoteName;
19
+ private readonly cursorStorage;
20
+ private readonly send;
21
+ private isShutdown;
22
+ constructor(channelId: string, remoteName: string, cursorStorage: ISyncCursorStorage, send: (envelope: SyncEnvelope) => void);
23
+ /**
24
+ * Shuts down the channel and prevents further operations.
25
+ */
26
+ shutdown(): void;
27
+ /**
28
+ * Receives a sync envelope from a peer channel.
29
+ *
30
+ * This method is called by the peer's send function to deliver an envelope
31
+ * to this channel's inbox.
32
+ *
33
+ * @param envelope - The sync envelope to receive
34
+ * @throws {InternalChannelError} If channel is shutdown
35
+ */
36
+ receive(envelope: SyncEnvelope): void;
37
+ /**
38
+ * Updates the synchronization cursor for this channel's remote.
39
+ *
40
+ * Cursors track progress through the operation stream and enable resuming
41
+ * synchronization after restarts. The cursor is exclusive - the next sync
42
+ * will start at cursorOrdinal + 1.
43
+ *
44
+ * @param cursorOrdinal - The last processed ordinal (exclusive)
45
+ */
46
+ updateCursor(cursorOrdinal: number): Promise<void>;
47
+ /**
48
+ * Handles sync operations added to the outbox by sending them to the peer.
49
+ *
50
+ * This method is called automatically via the outbox.onAdded callback.
51
+ * It converts the sync operation to a SyncEnvelope and sends it via the send function.
52
+ *
53
+ * @param syncOp - The sync operation to transport
54
+ */
55
+ private handleOutboxAdded;
56
+ }
57
+ //# sourceMappingURL=internal-channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal-channel.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/internal-channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,aAAa,CAAC;AAI9D;;;;;;GAMG;AACH,qBAAa,eAAgB,YAAW,QAAQ;IAC9C,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACxC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IAE5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAmC;IACxD,OAAO,CAAC,UAAU,CAAU;gBAG1B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,kBAAkB,EACjC,IAAI,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI;IAiBxC;;OAEG;IACH,QAAQ,IAAI,IAAI;IAIhB;;;;;;;;OAQG;IACH,OAAO,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAcrC;;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