@powerhousedao/reactor 6.0.0-dev.13 → 6.0.0-dev.130

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 (409) hide show
  1. package/dist/index.d.ts +4320 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +9442 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +21 -20
  6. package/dist/src/actions/index.d.ts +0 -24
  7. package/dist/src/actions/index.d.ts.map +0 -1
  8. package/dist/src/actions/index.js +0 -76
  9. package/dist/src/actions/index.js.map +0 -1
  10. package/dist/src/cache/buffer/ring-buffer.d.ts +0 -37
  11. package/dist/src/cache/buffer/ring-buffer.d.ts.map +0 -1
  12. package/dist/src/cache/buffer/ring-buffer.js +0 -69
  13. package/dist/src/cache/buffer/ring-buffer.js.map +0 -1
  14. package/dist/src/cache/document-meta-cache-types.d.ts +0 -114
  15. package/dist/src/cache/document-meta-cache-types.d.ts.map +0 -1
  16. package/dist/src/cache/document-meta-cache-types.js +0 -2
  17. package/dist/src/cache/document-meta-cache-types.js.map +0 -1
  18. package/dist/src/cache/document-meta-cache.d.ts +0 -30
  19. package/dist/src/cache/document-meta-cache.d.ts.map +0 -1
  20. package/dist/src/cache/document-meta-cache.js +0 -128
  21. package/dist/src/cache/document-meta-cache.js.map +0 -1
  22. package/dist/src/cache/index.d.ts +0 -3
  23. package/dist/src/cache/index.d.ts.map +0 -1
  24. package/dist/src/cache/index.js +0 -2
  25. package/dist/src/cache/index.js.map +0 -1
  26. package/dist/src/cache/kysely-operation-index.d.ts +0 -15
  27. package/dist/src/cache/kysely-operation-index.d.ts.map +0 -1
  28. package/dist/src/cache/kysely-operation-index.js +0 -250
  29. package/dist/src/cache/kysely-operation-index.js.map +0 -1
  30. package/dist/src/cache/kysely-write-cache.d.ts +0 -134
  31. package/dist/src/cache/kysely-write-cache.d.ts.map +0 -1
  32. package/dist/src/cache/kysely-write-cache.js +0 -388
  33. package/dist/src/cache/kysely-write-cache.js.map +0 -1
  34. package/dist/src/cache/lru/lru-tracker.d.ts +0 -15
  35. package/dist/src/cache/lru/lru-tracker.d.ts.map +0 -1
  36. package/dist/src/cache/lru/lru-tracker.js +0 -96
  37. package/dist/src/cache/lru/lru-tracker.js.map +0 -1
  38. package/dist/src/cache/operation-index-types.d.ts +0 -50
  39. package/dist/src/cache/operation-index-types.d.ts.map +0 -1
  40. package/dist/src/cache/operation-index-types.js +0 -4
  41. package/dist/src/cache/operation-index-types.js.map +0 -1
  42. package/dist/src/cache/write/interfaces.d.ts +0 -83
  43. package/dist/src/cache/write/interfaces.d.ts.map +0 -1
  44. package/dist/src/cache/write/interfaces.js +0 -2
  45. package/dist/src/cache/write/interfaces.js.map +0 -1
  46. package/dist/src/cache/write-cache-types.d.ts +0 -42
  47. package/dist/src/cache/write-cache-types.d.ts.map +0 -1
  48. package/dist/src/cache/write-cache-types.js +0 -2
  49. package/dist/src/cache/write-cache-types.js.map +0 -1
  50. package/dist/src/client/reactor-client.d.ts +0 -117
  51. package/dist/src/client/reactor-client.d.ts.map +0 -1
  52. package/dist/src/client/reactor-client.js +0 -406
  53. package/dist/src/client/reactor-client.js.map +0 -1
  54. package/dist/src/client/types.d.ts +0 -241
  55. package/dist/src/client/types.d.ts.map +0 -1
  56. package/dist/src/client/types.js +0 -14
  57. package/dist/src/client/types.js.map +0 -1
  58. package/dist/src/core/reactor-builder.d.ts +0 -47
  59. package/dist/src/core/reactor-builder.d.ts.map +0 -1
  60. package/dist/src/core/reactor-builder.js +0 -231
  61. package/dist/src/core/reactor-builder.js.map +0 -1
  62. package/dist/src/core/reactor-client-builder.d.ts +0 -49
  63. package/dist/src/core/reactor-client-builder.d.ts.map +0 -1
  64. package/dist/src/core/reactor-client-builder.js +0 -123
  65. package/dist/src/core/reactor-client-builder.js.map +0 -1
  66. package/dist/src/core/reactor.d.ts +0 -116
  67. package/dist/src/core/reactor.d.ts.map +0 -1
  68. package/dist/src/core/reactor.js +0 -981
  69. package/dist/src/core/reactor.js.map +0 -1
  70. package/dist/src/core/types.d.ts +0 -276
  71. package/dist/src/core/types.d.ts.map +0 -1
  72. package/dist/src/core/types.js +0 -2
  73. package/dist/src/core/types.js.map +0 -1
  74. package/dist/src/core/utils.d.ts +0 -59
  75. package/dist/src/core/utils.d.ts.map +0 -1
  76. package/dist/src/core/utils.js +0 -171
  77. package/dist/src/core/utils.js.map +0 -1
  78. package/dist/src/events/event-bus.d.ts +0 -8
  79. package/dist/src/events/event-bus.d.ts.map +0 -1
  80. package/dist/src/events/event-bus.js +0 -53
  81. package/dist/src/events/event-bus.js.map +0 -1
  82. package/dist/src/events/interfaces.d.ts +0 -27
  83. package/dist/src/events/interfaces.d.ts.map +0 -1
  84. package/dist/src/events/interfaces.js +0 -2
  85. package/dist/src/events/interfaces.js.map +0 -1
  86. package/dist/src/events/types.d.ts +0 -67
  87. package/dist/src/events/types.d.ts.map +0 -1
  88. package/dist/src/events/types.js +0 -28
  89. package/dist/src/events/types.js.map +0 -1
  90. package/dist/src/executor/interfaces.d.ts +0 -49
  91. package/dist/src/executor/interfaces.d.ts.map +0 -1
  92. package/dist/src/executor/interfaces.js +0 -2
  93. package/dist/src/executor/interfaces.js.map +0 -1
  94. package/dist/src/executor/simple-job-executor-manager.d.ts +0 -34
  95. package/dist/src/executor/simple-job-executor-manager.d.ts.map +0 -1
  96. package/dist/src/executor/simple-job-executor-manager.js +0 -233
  97. package/dist/src/executor/simple-job-executor-manager.js.map +0 -1
  98. package/dist/src/executor/simple-job-executor.d.ts +0 -80
  99. package/dist/src/executor/simple-job-executor.d.ts.map +0 -1
  100. package/dist/src/executor/simple-job-executor.js +0 -898
  101. package/dist/src/executor/simple-job-executor.js.map +0 -1
  102. package/dist/src/executor/types.d.ts +0 -93
  103. package/dist/src/executor/types.d.ts.map +0 -1
  104. package/dist/src/executor/types.js +0 -11
  105. package/dist/src/executor/types.js.map +0 -1
  106. package/dist/src/executor/util.d.ts +0 -74
  107. package/dist/src/executor/util.d.ts.map +0 -1
  108. package/dist/src/executor/util.js +0 -184
  109. package/dist/src/executor/util.js.map +0 -1
  110. package/dist/src/index.d.ts +0 -53
  111. package/dist/src/index.d.ts.map +0 -1
  112. package/dist/src/index.js +0 -62
  113. package/dist/src/index.js.map +0 -1
  114. package/dist/src/job-tracker/in-memory-job-tracker.d.ts +0 -25
  115. package/dist/src/job-tracker/in-memory-job-tracker.d.ts.map +0 -1
  116. package/dist/src/job-tracker/in-memory-job-tracker.js +0 -112
  117. package/dist/src/job-tracker/in-memory-job-tracker.js.map +0 -1
  118. package/dist/src/job-tracker/index.d.ts +0 -3
  119. package/dist/src/job-tracker/index.d.ts.map +0 -1
  120. package/dist/src/job-tracker/index.js +0 -2
  121. package/dist/src/job-tracker/index.js.map +0 -1
  122. package/dist/src/job-tracker/interfaces.d.ts +0 -39
  123. package/dist/src/job-tracker/interfaces.d.ts.map +0 -1
  124. package/dist/src/job-tracker/interfaces.js +0 -2
  125. package/dist/src/job-tracker/interfaces.js.map +0 -1
  126. package/dist/src/logging/console.d.ts +0 -23
  127. package/dist/src/logging/console.d.ts.map +0 -1
  128. package/dist/src/logging/console.js +0 -108
  129. package/dist/src/logging/console.js.map +0 -1
  130. package/dist/src/logging/types.d.ts +0 -12
  131. package/dist/src/logging/types.d.ts.map +0 -1
  132. package/dist/src/logging/types.js +0 -2
  133. package/dist/src/logging/types.js.map +0 -1
  134. package/dist/src/processors/index.d.ts +0 -3
  135. package/dist/src/processors/index.d.ts.map +0 -1
  136. package/dist/src/processors/index.js +0 -2
  137. package/dist/src/processors/index.js.map +0 -1
  138. package/dist/src/processors/processor-manager.d.ts +0 -38
  139. package/dist/src/processors/processor-manager.d.ts.map +0 -1
  140. package/dist/src/processors/processor-manager.js +0 -165
  141. package/dist/src/processors/processor-manager.js.map +0 -1
  142. package/dist/src/processors/types.d.ts +0 -63
  143. package/dist/src/processors/types.d.ts.map +0 -1
  144. package/dist/src/processors/types.js +0 -2
  145. package/dist/src/processors/types.js.map +0 -1
  146. package/dist/src/processors/utils.d.ts +0 -10
  147. package/dist/src/processors/utils.d.ts.map +0 -1
  148. package/dist/src/processors/utils.js +0 -59
  149. package/dist/src/processors/utils.js.map +0 -1
  150. package/dist/src/queue/interfaces.d.ts +0 -103
  151. package/dist/src/queue/interfaces.d.ts.map +0 -1
  152. package/dist/src/queue/interfaces.js +0 -2
  153. package/dist/src/queue/interfaces.js.map +0 -1
  154. package/dist/src/queue/job-execution-handle.d.ts +0 -25
  155. package/dist/src/queue/job-execution-handle.d.ts.map +0 -1
  156. package/dist/src/queue/job-execution-handle.js +0 -62
  157. package/dist/src/queue/job-execution-handle.js.map +0 -1
  158. package/dist/src/queue/queue.d.ts +0 -81
  159. package/dist/src/queue/queue.d.ts.map +0 -1
  160. package/dist/src/queue/queue.js +0 -384
  161. package/dist/src/queue/queue.js.map +0 -1
  162. package/dist/src/queue/types.d.ts +0 -73
  163. package/dist/src/queue/types.d.ts.map +0 -1
  164. package/dist/src/queue/types.js +0 -19
  165. package/dist/src/queue/types.js.map +0 -1
  166. package/dist/src/read-models/base-read-model.d.ts +0 -60
  167. package/dist/src/read-models/base-read-model.d.ts.map +0 -1
  168. package/dist/src/read-models/base-read-model.js +0 -143
  169. package/dist/src/read-models/base-read-model.js.map +0 -1
  170. package/dist/src/read-models/coordinator.d.ts +0 -39
  171. package/dist/src/read-models/coordinator.d.ts.map +0 -1
  172. package/dist/src/read-models/coordinator.js +0 -72
  173. package/dist/src/read-models/coordinator.js.map +0 -1
  174. package/dist/src/read-models/document-view.d.ts +0 -24
  175. package/dist/src/read-models/document-view.d.ts.map +0 -1
  176. package/dist/src/read-models/document-view.js +0 -375
  177. package/dist/src/read-models/document-view.js.map +0 -1
  178. package/dist/src/read-models/interfaces.d.ts +0 -29
  179. package/dist/src/read-models/interfaces.d.ts.map +0 -1
  180. package/dist/src/read-models/interfaces.js +0 -2
  181. package/dist/src/read-models/interfaces.js.map +0 -1
  182. package/dist/src/read-models/types.d.ts +0 -47
  183. package/dist/src/read-models/types.d.ts.map +0 -1
  184. package/dist/src/read-models/types.js +0 -2
  185. package/dist/src/read-models/types.js.map +0 -1
  186. package/dist/src/registry/implementation.d.ts +0 -70
  187. package/dist/src/registry/implementation.d.ts.map +0 -1
  188. package/dist/src/registry/implementation.js +0 -216
  189. package/dist/src/registry/implementation.js.map +0 -1
  190. package/dist/src/registry/index.d.ts +0 -3
  191. package/dist/src/registry/index.d.ts.map +0 -1
  192. package/dist/src/registry/index.js +0 -2
  193. package/dist/src/registry/index.js.map +0 -1
  194. package/dist/src/registry/interfaces.d.ts +0 -100
  195. package/dist/src/registry/interfaces.d.ts.map +0 -1
  196. package/dist/src/registry/interfaces.js +0 -2
  197. package/dist/src/registry/interfaces.js.map +0 -1
  198. package/dist/src/shared/awaiter.d.ts +0 -35
  199. package/dist/src/shared/awaiter.d.ts.map +0 -1
  200. package/dist/src/shared/awaiter.js +0 -123
  201. package/dist/src/shared/awaiter.js.map +0 -1
  202. package/dist/src/shared/consistency-tracker.d.ts +0 -48
  203. package/dist/src/shared/consistency-tracker.d.ts.map +0 -1
  204. package/dist/src/shared/consistency-tracker.js +0 -123
  205. package/dist/src/shared/consistency-tracker.js.map +0 -1
  206. package/dist/src/shared/drive-url.d.ts +0 -15
  207. package/dist/src/shared/drive-url.d.ts.map +0 -1
  208. package/dist/src/shared/drive-url.js +0 -17
  209. package/dist/src/shared/drive-url.js.map +0 -1
  210. package/dist/src/shared/errors.d.ts +0 -41
  211. package/dist/src/shared/errors.d.ts.map +0 -1
  212. package/dist/src/shared/errors.js +0 -75
  213. package/dist/src/shared/errors.js.map +0 -1
  214. package/dist/src/shared/factories.d.ts +0 -16
  215. package/dist/src/shared/factories.d.ts.map +0 -1
  216. package/dist/src/shared/factories.js +0 -33
  217. package/dist/src/shared/factories.js.map +0 -1
  218. package/dist/src/shared/types.d.ts +0 -135
  219. package/dist/src/shared/types.d.ts.map +0 -1
  220. package/dist/src/shared/types.js +0 -38
  221. package/dist/src/shared/types.js.map +0 -1
  222. package/dist/src/shared/utils.d.ts +0 -3
  223. package/dist/src/shared/utils.d.ts.map +0 -1
  224. package/dist/src/shared/utils.js +0 -8
  225. package/dist/src/shared/utils.js.map +0 -1
  226. package/dist/src/signer/passthrough-signer.d.ts +0 -12
  227. package/dist/src/signer/passthrough-signer.d.ts.map +0 -1
  228. package/dist/src/signer/passthrough-signer.js +0 -19
  229. package/dist/src/signer/passthrough-signer.js.map +0 -1
  230. package/dist/src/signer/types.d.ts +0 -17
  231. package/dist/src/signer/types.d.ts.map +0 -1
  232. package/dist/src/signer/types.js +0 -2
  233. package/dist/src/signer/types.js.map +0 -1
  234. package/dist/src/storage/consistency-aware-legacy-storage.d.ts +0 -33
  235. package/dist/src/storage/consistency-aware-legacy-storage.d.ts.map +0 -1
  236. package/dist/src/storage/consistency-aware-legacy-storage.js +0 -65
  237. package/dist/src/storage/consistency-aware-legacy-storage.js.map +0 -1
  238. package/dist/src/storage/index.d.ts +0 -4
  239. package/dist/src/storage/index.d.ts.map +0 -1
  240. package/dist/src/storage/index.js +0 -3
  241. package/dist/src/storage/index.js.map +0 -1
  242. package/dist/src/storage/interfaces.d.ts +0 -439
  243. package/dist/src/storage/interfaces.d.ts.map +0 -1
  244. package/dist/src/storage/interfaces.js +0 -19
  245. package/dist/src/storage/interfaces.js.map +0 -1
  246. package/dist/src/storage/kysely/document-indexer.d.ts +0 -28
  247. package/dist/src/storage/kysely/document-indexer.d.ts.map +0 -1
  248. package/dist/src/storage/kysely/document-indexer.js +0 -350
  249. package/dist/src/storage/kysely/document-indexer.js.map +0 -1
  250. package/dist/src/storage/kysely/keyframe-store.d.ts +0 -15
  251. package/dist/src/storage/kysely/keyframe-store.d.ts.map +0 -1
  252. package/dist/src/storage/kysely/keyframe-store.js +0 -64
  253. package/dist/src/storage/kysely/keyframe-store.js.map +0 -1
  254. package/dist/src/storage/kysely/store.d.ts +0 -16
  255. package/dist/src/storage/kysely/store.d.ts.map +0 -1
  256. package/dist/src/storage/kysely/store.js +0 -233
  257. package/dist/src/storage/kysely/store.js.map +0 -1
  258. package/dist/src/storage/kysely/sync-cursor-storage.d.ts +0 -13
  259. package/dist/src/storage/kysely/sync-cursor-storage.d.ts.map +0 -1
  260. package/dist/src/storage/kysely/sync-cursor-storage.js +0 -93
  261. package/dist/src/storage/kysely/sync-cursor-storage.js.map +0 -1
  262. package/dist/src/storage/kysely/sync-remote-storage.d.ts +0 -13
  263. package/dist/src/storage/kysely/sync-remote-storage.d.ts.map +0 -1
  264. package/dist/src/storage/kysely/sync-remote-storage.js +0 -133
  265. package/dist/src/storage/kysely/sync-remote-storage.js.map +0 -1
  266. package/dist/src/storage/kysely/types.d.ts +0 -135
  267. package/dist/src/storage/kysely/types.d.ts.map +0 -1
  268. package/dist/src/storage/kysely/types.js +0 -2
  269. package/dist/src/storage/kysely/types.js.map +0 -1
  270. package/dist/src/storage/migrations/001_create_operation_table.d.ts +0 -3
  271. package/dist/src/storage/migrations/001_create_operation_table.d.ts.map +0 -1
  272. package/dist/src/storage/migrations/001_create_operation_table.js +0 -41
  273. package/dist/src/storage/migrations/001_create_operation_table.js.map +0 -1
  274. package/dist/src/storage/migrations/002_create_keyframe_table.d.ts +0 -3
  275. package/dist/src/storage/migrations/002_create_keyframe_table.d.ts.map +0 -1
  276. package/dist/src/storage/migrations/002_create_keyframe_table.js +0 -27
  277. package/dist/src/storage/migrations/002_create_keyframe_table.js.map +0 -1
  278. package/dist/src/storage/migrations/003_create_document_table.d.ts +0 -3
  279. package/dist/src/storage/migrations/003_create_document_table.d.ts.map +0 -1
  280. package/dist/src/storage/migrations/003_create_document_table.js +0 -10
  281. package/dist/src/storage/migrations/003_create_document_table.js.map +0 -1
  282. package/dist/src/storage/migrations/004_create_document_relationship_table.d.ts +0 -3
  283. package/dist/src/storage/migrations/004_create_document_relationship_table.d.ts.map +0 -1
  284. package/dist/src/storage/migrations/004_create_document_relationship_table.js +0 -35
  285. package/dist/src/storage/migrations/004_create_document_relationship_table.js.map +0 -1
  286. package/dist/src/storage/migrations/005_create_indexer_state_table.d.ts +0 -3
  287. package/dist/src/storage/migrations/005_create_indexer_state_table.d.ts.map +0 -1
  288. package/dist/src/storage/migrations/005_create_indexer_state_table.js +0 -10
  289. package/dist/src/storage/migrations/005_create_indexer_state_table.js.map +0 -1
  290. package/dist/src/storage/migrations/006_create_document_snapshot_table.d.ts +0 -3
  291. package/dist/src/storage/migrations/006_create_document_snapshot_table.d.ts.map +0 -1
  292. package/dist/src/storage/migrations/006_create_document_snapshot_table.js +0 -49
  293. package/dist/src/storage/migrations/006_create_document_snapshot_table.js.map +0 -1
  294. package/dist/src/storage/migrations/007_create_slug_mapping_table.d.ts +0 -3
  295. package/dist/src/storage/migrations/007_create_slug_mapping_table.d.ts.map +0 -1
  296. package/dist/src/storage/migrations/007_create_slug_mapping_table.js +0 -24
  297. package/dist/src/storage/migrations/007_create_slug_mapping_table.js.map +0 -1
  298. package/dist/src/storage/migrations/008_create_view_state_table.d.ts +0 -3
  299. package/dist/src/storage/migrations/008_create_view_state_table.d.ts.map +0 -1
  300. package/dist/src/storage/migrations/008_create_view_state_table.js +0 -10
  301. package/dist/src/storage/migrations/008_create_view_state_table.js.map +0 -1
  302. package/dist/src/storage/migrations/009_create_operation_index_tables.d.ts +0 -3
  303. package/dist/src/storage/migrations/009_create_operation_index_tables.d.ts.map +0 -1
  304. package/dist/src/storage/migrations/009_create_operation_index_tables.js +0 -50
  305. package/dist/src/storage/migrations/009_create_operation_index_tables.js.map +0 -1
  306. package/dist/src/storage/migrations/010_create_sync_tables.d.ts +0 -3
  307. package/dist/src/storage/migrations/010_create_sync_tables.d.ts.map +0 -1
  308. package/dist/src/storage/migrations/010_create_sync_tables.js +0 -43
  309. package/dist/src/storage/migrations/010_create_sync_tables.js.map +0 -1
  310. package/dist/src/storage/migrations/index.d.ts +0 -3
  311. package/dist/src/storage/migrations/index.d.ts.map +0 -1
  312. package/dist/src/storage/migrations/index.js +0 -3
  313. package/dist/src/storage/migrations/index.js.map +0 -1
  314. package/dist/src/storage/migrations/migrator.d.ts +0 -6
  315. package/dist/src/storage/migrations/migrator.d.ts.map +0 -1
  316. package/dist/src/storage/migrations/migrator.js +0 -78
  317. package/dist/src/storage/migrations/migrator.js.map +0 -1
  318. package/dist/src/storage/migrations/run-migrations.d.ts +0 -2
  319. package/dist/src/storage/migrations/run-migrations.d.ts.map +0 -1
  320. package/dist/src/storage/migrations/run-migrations.js +0 -58
  321. package/dist/src/storage/migrations/run-migrations.js.map +0 -1
  322. package/dist/src/storage/migrations/types.d.ts +0 -9
  323. package/dist/src/storage/migrations/types.d.ts.map +0 -1
  324. package/dist/src/storage/migrations/types.js +0 -2
  325. package/dist/src/storage/migrations/types.js.map +0 -1
  326. package/dist/src/storage/txn.d.ts +0 -15
  327. package/dist/src/storage/txn.d.ts.map +0 -1
  328. package/dist/src/storage/txn.js +0 -42
  329. package/dist/src/storage/txn.js.map +0 -1
  330. package/dist/src/subs/default-error-handler.d.ts +0 -13
  331. package/dist/src/subs/default-error-handler.d.ts.map +0 -1
  332. package/dist/src/subs/default-error-handler.js +0 -27
  333. package/dist/src/subs/default-error-handler.js.map +0 -1
  334. package/dist/src/subs/react-subscription-manager.d.ts +0 -45
  335. package/dist/src/subs/react-subscription-manager.d.ts.map +0 -1
  336. package/dist/src/subs/react-subscription-manager.js +0 -185
  337. package/dist/src/subs/react-subscription-manager.js.map +0 -1
  338. package/dist/src/subs/subscription-notification-read-model.d.ts +0 -17
  339. package/dist/src/subs/subscription-notification-read-model.d.ts.map +0 -1
  340. package/dist/src/subs/subscription-notification-read-model.js +0 -62
  341. package/dist/src/subs/subscription-notification-read-model.js.map +0 -1
  342. package/dist/src/subs/types.d.ts +0 -64
  343. package/dist/src/subs/types.d.ts.map +0 -1
  344. package/dist/src/subs/types.js +0 -2
  345. package/dist/src/subs/types.js.map +0 -1
  346. package/dist/src/sync/channels/composite-channel-factory.d.ts +0 -30
  347. package/dist/src/sync/channels/composite-channel-factory.d.ts.map +0 -1
  348. package/dist/src/sync/channels/composite-channel-factory.js +0 -87
  349. package/dist/src/sync/channels/composite-channel-factory.js.map +0 -1
  350. package/dist/src/sync/channels/gql-channel-factory.d.ts +0 -25
  351. package/dist/src/sync/channels/gql-channel-factory.d.ts.map +0 -1
  352. package/dist/src/sync/channels/gql-channel-factory.js +0 -76
  353. package/dist/src/sync/channels/gql-channel-factory.js.map +0 -1
  354. package/dist/src/sync/channels/gql-channel.d.ts +0 -118
  355. package/dist/src/sync/channels/gql-channel.d.ts.map +0 -1
  356. package/dist/src/sync/channels/gql-channel.js +0 -423
  357. package/dist/src/sync/channels/gql-channel.js.map +0 -1
  358. package/dist/src/sync/channels/index.d.ts +0 -6
  359. package/dist/src/sync/channels/index.d.ts.map +0 -1
  360. package/dist/src/sync/channels/index.js +0 -6
  361. package/dist/src/sync/channels/index.js.map +0 -1
  362. package/dist/src/sync/channels/polling-channel.d.ts +0 -39
  363. package/dist/src/sync/channels/polling-channel.d.ts.map +0 -1
  364. package/dist/src/sync/channels/polling-channel.js +0 -72
  365. package/dist/src/sync/channels/polling-channel.js.map +0 -1
  366. package/dist/src/sync/channels/utils.d.ts +0 -30
  367. package/dist/src/sync/channels/utils.d.ts.map +0 -1
  368. package/dist/src/sync/channels/utils.js +0 -96
  369. package/dist/src/sync/channels/utils.js.map +0 -1
  370. package/dist/src/sync/errors.d.ts +0 -10
  371. package/dist/src/sync/errors.d.ts.map +0 -1
  372. package/dist/src/sync/errors.js +0 -17
  373. package/dist/src/sync/errors.js.map +0 -1
  374. package/dist/src/sync/index.d.ts +0 -12
  375. package/dist/src/sync/index.d.ts.map +0 -1
  376. package/dist/src/sync/index.js +0 -9
  377. package/dist/src/sync/index.js.map +0 -1
  378. package/dist/src/sync/interfaces.d.ts +0 -180
  379. package/dist/src/sync/interfaces.d.ts.map +0 -1
  380. package/dist/src/sync/interfaces.js +0 -2
  381. package/dist/src/sync/interfaces.js.map +0 -1
  382. package/dist/src/sync/mailbox.d.ts +0 -21
  383. package/dist/src/sync/mailbox.d.ts.map +0 -1
  384. package/dist/src/sync/mailbox.js +0 -59
  385. package/dist/src/sync/mailbox.js.map +0 -1
  386. package/dist/src/sync/sync-builder.d.ts +0 -19
  387. package/dist/src/sync/sync-builder.d.ts.map +0 -1
  388. package/dist/src/sync/sync-builder.js +0 -39
  389. package/dist/src/sync/sync-builder.js.map +0 -1
  390. package/dist/src/sync/sync-manager.d.ts +0 -37
  391. package/dist/src/sync/sync-manager.d.ts.map +0 -1
  392. package/dist/src/sync/sync-manager.js +0 -266
  393. package/dist/src/sync/sync-manager.js.map +0 -1
  394. package/dist/src/sync/sync-operation.d.ts +0 -28
  395. package/dist/src/sync/sync-operation.d.ts.map +0 -1
  396. package/dist/src/sync/sync-operation.js +0 -63
  397. package/dist/src/sync/sync-operation.js.map +0 -1
  398. package/dist/src/sync/types.d.ts +0 -60
  399. package/dist/src/sync/types.d.ts.map +0 -1
  400. package/dist/src/sync/types.js +0 -16
  401. package/dist/src/sync/types.js.map +0 -1
  402. package/dist/src/sync/utils.d.ts +0 -36
  403. package/dist/src/sync/utils.d.ts.map +0 -1
  404. package/dist/src/sync/utils.js +0 -78
  405. package/dist/src/sync/utils.js.map +0 -1
  406. package/dist/src/utils/reshuffle.d.ts +0 -30
  407. package/dist/src/utils/reshuffle.d.ts.map +0 -1
  408. package/dist/src/utils/reshuffle.js +0 -47
  409. package/dist/src/utils/reshuffle.js.map +0 -1
@@ -1,423 +0,0 @@
1
- import { ChannelError } from "../errors.js";
2
- import { Mailbox } from "../mailbox.js";
3
- import { ChannelErrorSource } from "../types.js";
4
- import { envelopesToSyncOperations } from "./utils.js";
5
- /**
6
- * GraphQL-based synchronization channel for network communication between reactors.
7
- */
8
- export class GqlChannel {
9
- logger;
10
- inbox;
11
- outbox;
12
- deadLetter;
13
- channelId;
14
- remoteName;
15
- cursorStorage;
16
- config;
17
- isShutdown;
18
- pollTimer;
19
- failureCount;
20
- lastSuccessUtcMs;
21
- lastFailureUtcMs;
22
- constructor(logger, channelId, remoteName, cursorStorage, config) {
23
- this.logger = logger;
24
- this.channelId = channelId;
25
- this.remoteName = remoteName;
26
- this.cursorStorage = cursorStorage;
27
- this.config = {
28
- url: config.url,
29
- authToken: config.authToken,
30
- pollIntervalMs: config.pollIntervalMs ?? 2000,
31
- retryBaseDelayMs: config.retryBaseDelayMs ?? 1000,
32
- retryMaxDelayMs: config.retryMaxDelayMs ?? 300000,
33
- maxFailures: config.maxFailures ?? 5,
34
- fetchFn: config.fetchFn,
35
- collectionId: config.collectionId,
36
- filter: config.filter,
37
- };
38
- this.isShutdown = false;
39
- this.failureCount = 0;
40
- this.inbox = new Mailbox();
41
- this.outbox = new Mailbox();
42
- this.deadLetter = new Mailbox();
43
- this.outbox.onAdded((syncOp) => {
44
- this.handleOutboxAdded(syncOp);
45
- });
46
- }
47
- /**
48
- * Shuts down the channel and prevents further operations.
49
- */
50
- shutdown() {
51
- this.isShutdown = true;
52
- if (this.pollTimer) {
53
- clearTimeout(this.pollTimer);
54
- this.pollTimer = undefined;
55
- }
56
- }
57
- /**
58
- * Initializes the channel by registering it on the remote server and starting polling.
59
- */
60
- async init() {
61
- await this.touchRemoteChannel();
62
- this.startPolling();
63
- }
64
- /**
65
- * Starts the polling loop to fetch operations from the remote.
66
- */
67
- startPolling() {
68
- if (this.isShutdown) {
69
- return;
70
- }
71
- void this.poll().then(() => {
72
- this.pollTimer = setTimeout(() => {
73
- this.startPolling(); // Schedule next poll
74
- }, this.config.pollIntervalMs);
75
- });
76
- }
77
- /**
78
- * Polls the remote for new sync envelopes.
79
- */
80
- async poll() {
81
- if (this.isShutdown) {
82
- return;
83
- }
84
- if (this.failureCount >= this.config.maxFailures) {
85
- return;
86
- }
87
- let cursor;
88
- try {
89
- cursor = await this.cursorStorage.get(this.remoteName);
90
- }
91
- catch (error) {
92
- this.handlePollError(error);
93
- return;
94
- }
95
- const cursorOrdinal = cursor.cursorOrdinal;
96
- let envelopes;
97
- try {
98
- envelopes = await this.pollSyncEnvelopes(cursorOrdinal);
99
- }
100
- catch (error) {
101
- this.handlePollError(error);
102
- return;
103
- }
104
- let maxCursorOrdinal = cursorOrdinal;
105
- for (const envelope of envelopes) {
106
- if (envelope.type.toLowerCase() === "operations" && envelope.operations) {
107
- const syncOps = envelopesToSyncOperations(envelope, this.remoteName);
108
- for (const syncOp of syncOps) {
109
- syncOp.transported();
110
- this.inbox.add(syncOp);
111
- }
112
- }
113
- if (envelope.cursor && envelope.cursor.cursorOrdinal > maxCursorOrdinal) {
114
- maxCursorOrdinal = envelope.cursor.cursorOrdinal;
115
- }
116
- }
117
- if (maxCursorOrdinal > cursorOrdinal) {
118
- try {
119
- await this.updateCursor(maxCursorOrdinal);
120
- }
121
- catch (error) {
122
- this.handlePollError(error);
123
- return;
124
- }
125
- }
126
- this.lastSuccessUtcMs = Date.now();
127
- this.failureCount = 0;
128
- }
129
- /**
130
- * Handles polling errors with exponential backoff.
131
- */
132
- handlePollError(error) {
133
- const err = error instanceof Error ? error : new Error(String(error));
134
- if (err.message.includes("Channel not found")) {
135
- this.recoverFromChannelNotFound();
136
- return;
137
- }
138
- this.failureCount++;
139
- this.lastFailureUtcMs = Date.now();
140
- const channelError = new ChannelError(ChannelErrorSource.Inbox, err);
141
- this.logger.error("GqlChannel poll error (@FailureCount/@MaxFailures): @Error", this.failureCount, this.config.maxFailures, channelError);
142
- if (this.failureCount >= this.config.maxFailures) {
143
- this.logger.error("GqlChannel @ChannelId exceeded failure threshold, stopping polls", this.channelId);
144
- }
145
- }
146
- /**
147
- * Recovers from a "Channel not found" error by re-registering and restarting polling.
148
- */
149
- recoverFromChannelNotFound() {
150
- this.logger.info("GqlChannel @ChannelId not found on remote, re-registering...", this.channelId);
151
- if (this.pollTimer) {
152
- clearTimeout(this.pollTimer);
153
- this.pollTimer = undefined;
154
- }
155
- void this.touchRemoteChannel()
156
- .then(() => {
157
- this.logger.info("GqlChannel @ChannelId re-registered successfully", this.channelId);
158
- this.failureCount = 0;
159
- this.startPolling();
160
- })
161
- .catch((recoveryError) => {
162
- this.logger.error("GqlChannel @ChannelId failed to re-register: @Error", this.channelId, recoveryError);
163
- this.failureCount++;
164
- this.lastFailureUtcMs = Date.now();
165
- this.pollTimer = setTimeout(() => {
166
- this.startPolling();
167
- }, this.config.pollIntervalMs);
168
- });
169
- }
170
- /**
171
- * Queries the remote GraphQL endpoint for sync envelopes.
172
- */
173
- async pollSyncEnvelopes(cursorOrdinal) {
174
- const query = `
175
- query PollSyncEnvelopes($channelId: String!, $cursorOrdinal: Int!) {
176
- pollSyncEnvelopes(channelId: $channelId, cursorOrdinal: $cursorOrdinal) {
177
- type
178
- channelMeta {
179
- id
180
- }
181
- operations {
182
- operation {
183
- index
184
- timestampUtcMs
185
- hash
186
- skip
187
- error
188
- id
189
- action {
190
- id
191
- type
192
- timestampUtcMs
193
- input
194
- scope
195
- attachments {
196
- data
197
- mimeType
198
- hash
199
- extension
200
- fileName
201
- }
202
- context {
203
- signer {
204
- user {
205
- address
206
- networkId
207
- chainId
208
- }
209
- app {
210
- name
211
- key
212
- }
213
- signatures
214
- }
215
- }
216
- }
217
- }
218
- context {
219
- documentId
220
- documentType
221
- scope
222
- branch
223
- }
224
- }
225
- cursor {
226
- remoteName
227
- cursorOrdinal
228
- lastSyncedAtUtcMs
229
- }
230
- }
231
- }
232
- `;
233
- const variables = {
234
- channelId: this.channelId,
235
- cursorOrdinal,
236
- };
237
- const response = await this.executeGraphQL(query, variables);
238
- return response.pollSyncEnvelopes;
239
- }
240
- /**
241
- * Registers or updates this channel on the remote server via GraphQL mutation.
242
- */
243
- async touchRemoteChannel() {
244
- const mutation = `
245
- mutation TouchChannel($input: TouchChannelInput!) {
246
- touchChannel(input: $input)
247
- }
248
- `;
249
- const variables = {
250
- input: {
251
- id: this.channelId,
252
- name: this.channelId,
253
- collectionId: this.config.collectionId,
254
- filter: {
255
- documentId: this.config.filter.documentId,
256
- scope: this.config.filter.scope,
257
- branch: this.config.filter.branch,
258
- },
259
- },
260
- };
261
- await this.executeGraphQL(mutation, variables);
262
- }
263
- /**
264
- * Handles sync operations added to the outbox by sending them to the remote.
265
- */
266
- handleOutboxAdded(syncOp) {
267
- if (this.isShutdown) {
268
- return;
269
- }
270
- // Execute async but don't await (fire and forget with error handling)
271
- this.pushSyncOperation(syncOp).catch((error) => {
272
- const err = error instanceof Error ? error : new Error(String(error));
273
- const channelError = new ChannelError(ChannelErrorSource.Outbox, err);
274
- syncOp.failed(channelError);
275
- this.deadLetter.add(syncOp);
276
- this.outbox.remove(syncOp);
277
- });
278
- }
279
- /**
280
- * Pushes a sync operation to the remote via GraphQL mutation.
281
- */
282
- async pushSyncOperation(syncOp) {
283
- syncOp.started();
284
- this.logger.debug("[PUSH]: @Operations", syncOp.operations.map((op) => `(${op.context.documentId}, ${op.context.branch}, ${op.context.scope}, ${op.operation.index})`));
285
- const envelope = {
286
- type: "operations",
287
- channelMeta: { id: this.channelId },
288
- operations: syncOp.operations,
289
- };
290
- const mutation = `
291
- mutation PushSyncEnvelope($envelope: SyncEnvelopeInput!) {
292
- pushSyncEnvelope(envelope: $envelope)
293
- }
294
- `;
295
- const variables = {
296
- envelope: this.serializeEnvelope(envelope),
297
- };
298
- await this.executeGraphQL(mutation, variables);
299
- // Successfully sent - the outbox will be cleared when we receive ACK
300
- // For now, we optimistically remove from outbox
301
- this.outbox.remove(syncOp);
302
- }
303
- /**
304
- * Serializes a SyncEnvelope for GraphQL transport.
305
- *
306
- * Signatures are serialized as comma-separated strings since GraphQL schema
307
- * defines them as [String!]!. Extra context fields (resultingState, ordinal)
308
- * are stripped since they are not defined in OperationContextInput.
309
- */
310
- serializeEnvelope(envelope) {
311
- return {
312
- type: envelope.type.toUpperCase(),
313
- channelMeta: envelope.channelMeta,
314
- operations: envelope.operations?.map((opWithContext) => ({
315
- operation: {
316
- index: opWithContext.operation.index,
317
- timestampUtcMs: opWithContext.operation.timestampUtcMs,
318
- hash: opWithContext.operation.hash,
319
- skip: opWithContext.operation.skip,
320
- error: opWithContext.operation.error,
321
- id: opWithContext.operation.id,
322
- action: this.serializeAction(opWithContext.operation.action),
323
- },
324
- context: {
325
- documentId: opWithContext.context.documentId,
326
- documentType: opWithContext.context.documentType,
327
- scope: opWithContext.context.scope,
328
- branch: opWithContext.context.branch,
329
- },
330
- })),
331
- cursor: envelope.cursor,
332
- };
333
- }
334
- /**
335
- * Serializes an action for GraphQL transport, converting signature tuples to strings.
336
- */
337
- serializeAction(action) {
338
- const signer = action.context?.signer;
339
- if (!signer?.signatures) {
340
- return action;
341
- }
342
- return {
343
- ...action,
344
- context: {
345
- ...action.context,
346
- signer: {
347
- ...signer,
348
- signatures: signer.signatures.map((sig) => Array.isArray(sig) ? sig.join(", ") : sig),
349
- },
350
- },
351
- };
352
- }
353
- /**
354
- * Executes a GraphQL query or mutation against the remote endpoint.
355
- */
356
- async executeGraphQL(query, variables) {
357
- const headers = {
358
- "Content-Type": "application/json",
359
- };
360
- if (this.config.authToken) {
361
- headers["Authorization"] = `Bearer ${this.config.authToken}`;
362
- }
363
- const fetchFn = this.config.fetchFn ?? fetch;
364
- let response;
365
- try {
366
- response = await fetchFn(this.config.url, {
367
- method: "POST",
368
- headers,
369
- body: JSON.stringify({
370
- query,
371
- variables,
372
- }),
373
- });
374
- }
375
- catch (error) {
376
- throw new Error(`GraphQL request failed: ${error instanceof Error ? error.message : String(error)}`);
377
- }
378
- if (!response.ok) {
379
- throw new Error(`GraphQL request failed: ${response.status} ${response.statusText}`);
380
- }
381
- let result;
382
- try {
383
- result = (await response.json());
384
- }
385
- catch (error) {
386
- throw new Error(`Failed to parse GraphQL response: ${error instanceof Error ? error.message : String(error)}`);
387
- }
388
- if (result.errors) {
389
- throw new Error(`GraphQL errors: ${JSON.stringify(result.errors, null, 2)}`);
390
- }
391
- if (!result.data) {
392
- throw new Error("GraphQL response missing data field");
393
- }
394
- return result.data;
395
- }
396
- /**
397
- * Updates the synchronization cursor for this channel's remote.
398
- */
399
- async updateCursor(cursorOrdinal) {
400
- const cursor = {
401
- remoteName: this.remoteName,
402
- cursorOrdinal,
403
- lastSyncedAtUtcMs: Date.now(),
404
- };
405
- await this.cursorStorage.upsert(cursor);
406
- }
407
- /**
408
- * Gets the current health status of the channel.
409
- */
410
- getHealth() {
411
- return {
412
- state: this.failureCount >= this.config.maxFailures
413
- ? "error"
414
- : this.failureCount > 0
415
- ? "running"
416
- : "idle",
417
- lastSuccessUtcMs: this.lastSuccessUtcMs,
418
- lastFailureUtcMs: this.lastFailureUtcMs,
419
- failureCount: this.failureCount,
420
- };
421
- }
422
- }
423
- //# sourceMappingURL=gql-channel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gql-channel.js","sourceRoot":"","sources":["../../../../src/sync/channels/gql-channel.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AA0BvD;;GAEG;AACH,MAAM,OAAO,UAAU;IAgBF;IAfV,KAAK,CAAyB;IAC9B,MAAM,CAAyB;IAC/B,UAAU,CAAyB;IAE3B,SAAS,CAAS;IAClB,UAAU,CAAS;IACnB,aAAa,CAAqB;IAClC,MAAM,CAAmB;IAClC,UAAU,CAAU;IACpB,SAAS,CAAkB;IAC3B,YAAY,CAAS;IACrB,gBAAgB,CAAU;IAC1B,gBAAgB,CAAU;IAElC,YACmB,MAAe,EAChC,SAAiB,EACjB,UAAkB,EAClB,aAAiC,EACjC,MAAwB;QAJP,WAAM,GAAN,MAAM,CAAS;QAMhC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG;YACZ,GAAG,EAAE,MAAM,CAAC,GAAG;Y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GqlChannel, type GqlChannelConfig } from "./gql-channel.js";
3
- export { GqlChannelFactory } from "./gql-channel-factory.js";
4
- export { CompositeChannelFactory } from "./composite-channel-factory.js";
5
- export { envelopeToSyncOperation } from "./utils.js";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,6 +0,0 @@
1
- export { PollingChannel } from "./polling-channel.js";
2
- export { GqlChannel } from "./gql-channel.js";
3
- export { GqlChannelFactory } from "./gql-channel-factory.js";
4
- export { CompositeChannelFactory } from "./composite-channel-factory.js";
5
- export { envelopeToSyncOperation } from "./utils.js";
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/sync/channels/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAyB,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -1,39 +0,0 @@
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
- * Channel for cursor-based polling by external clients.
8
- *
9
- * PollingChannel does NOT auto-remove operations from the outbox.
10
- * Operations remain until explicitly acknowledged via cursor
11
- * advancement through updateCursor().
12
- */
13
- export declare class PollingChannel 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 isShutdown;
21
- constructor(channelId: string, remoteName: string, cursorStorage: ISyncCursorStorage);
22
- shutdown(): void;
23
- init(): Promise<void>;
24
- /**
25
- * Receives a sync envelope from a peer channel.
26
- *
27
- * @param envelope - The sync envelope to receive
28
- * @throws {PollingChannelError} If channel is shutdown
29
- */
30
- receive(envelope: SyncEnvelope): void;
31
- /**
32
- * Advances the cursor and removes acknowledged operations from outbox.
33
- * Operations with ordinal <= cursorOrdinal are considered acknowledged.
34
- *
35
- * @param cursorOrdinal - The last processed ordinal (exclusive)
36
- */
37
- updateCursor(cursorOrdinal: number): Promise<void>;
38
- }
39
- //# sourceMappingURL=polling-channel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"polling-channel.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/polling-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;AAG9D;;;;;;GAMG;AACH,qBAAa,cAAe,YAAW,QAAQ;IAC7C,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,UAAU,CAAU;gBAG1B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,kBAAkB;IAYnC,QAAQ,IAAI,IAAI;IAIV,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAE3B;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI;IAgBrC;;;;;OAKG;IACG,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBzD"}
@@ -1,72 +0,0 @@
1
- import { PollingChannelError } from "../errors.js";
2
- import { Mailbox } from "../mailbox.js";
3
- import { envelopesToSyncOperations } from "./utils.js";
4
- /**
5
- * Channel for cursor-based polling by external clients.
6
- *
7
- * PollingChannel does NOT auto-remove operations from the outbox.
8
- * Operations remain until explicitly acknowledged via cursor
9
- * advancement through updateCursor().
10
- */
11
- export class PollingChannel {
12
- inbox;
13
- outbox;
14
- deadLetter;
15
- channelId;
16
- remoteName;
17
- cursorStorage;
18
- isShutdown;
19
- constructor(channelId, remoteName, cursorStorage) {
20
- this.channelId = channelId;
21
- this.remoteName = remoteName;
22
- this.cursorStorage = cursorStorage;
23
- this.isShutdown = false;
24
- this.inbox = new Mailbox();
25
- this.outbox = new Mailbox();
26
- this.deadLetter = new Mailbox();
27
- }
28
- shutdown() {
29
- this.isShutdown = true;
30
- }
31
- async init() { }
32
- /**
33
- * Receives a sync envelope from a peer channel.
34
- *
35
- * @param envelope - The sync envelope to receive
36
- * @throws {PollingChannelError} If channel is shutdown
37
- */
38
- receive(envelope) {
39
- if (this.isShutdown) {
40
- throw new PollingChannelError(`Channel ${this.channelId} is shutdown and cannot receive envelopes`);
41
- }
42
- if (envelope.type === "operations" && envelope.operations) {
43
- const syncOps = envelopesToSyncOperations(envelope, this.remoteName);
44
- for (const syncOp of syncOps) {
45
- syncOp.transported();
46
- this.inbox.add(syncOp);
47
- }
48
- }
49
- }
50
- /**
51
- * Advances the cursor and removes acknowledged operations from outbox.
52
- * Operations with ordinal <= cursorOrdinal are considered acknowledged.
53
- *
54
- * @param cursorOrdinal - The last processed ordinal (exclusive)
55
- */
56
- async updateCursor(cursorOrdinal) {
57
- const cursor = {
58
- remoteName: this.remoteName,
59
- cursorOrdinal,
60
- lastSyncedAtUtcMs: Date.now(),
61
- };
62
- await this.cursorStorage.upsert(cursor);
63
- for (const op of this.outbox.items) {
64
- const maxOrdinal = Math.max(...op.operations.map((o) => o.context.ordinal));
65
- if (maxOrdinal <= cursorOrdinal) {
66
- op.executed();
67
- this.outbox.remove(op);
68
- }
69
- }
70
- }
71
- }
72
- //# sourceMappingURL=polling-channel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"polling-channel.js","sourceRoot":"","sources":["../../../../src/sync/channels/polling-channel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGnD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IAChB,KAAK,CAAyB;IAC9B,MAAM,CAAyB;IAC/B,UAAU,CAAyB;IAE3B,SAAS,CAAS;IAClB,UAAU,CAAS;IACnB,aAAa,CAAqB;IAC3C,UAAU,CAAU;IAE5B,YACE,SAAiB,EACjB,UAAkB,EAClB,aAAiC;QAEjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CA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AAG,IAAI,CAAC,GAAG,CACzB,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAC/C,CAAC;YACF,IAAI,UAAU,IAAI,aAAa,EAAE,CAAC;gBAChC,EAAE,CAAC,QAAQ,EAAE,CAAC;gBACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -1,30 +0,0 @@
1
- import { SyncOperation } from "../sync-operation.js";
2
- import type { SyncEnvelope } from "../types.js";
3
- /**
4
- * Converts a SyncEnvelope containing operations into a SyncOperation.
5
- *
6
- * Extracts the necessary metadata from the envelope's operations to create
7
- * a sync operation that can be processed by the receiving channel. Also
8
- * deserializes any signatures from comma-separated strings back to tuples,
9
- * as GraphQL transport serializes Signature tuples for compatibility.
10
- *
11
- * @param envelope - The sync envelope containing operations
12
- * @param remoteName - The name of the remote this sync operation is associated with
13
- * @returns A new SyncOperation containing the envelope's operations with deserialized signatures
14
- * @throws Error if envelope has no operations or operations array is empty
15
- */
16
- export declare function envelopeToSyncOperation(envelope: SyncEnvelope, remoteName: string): SyncOperation;
17
- /**
18
- * Converts a SyncEnvelope containing operations into multiple SyncOperations.
19
- *
20
- * This function batches operations by documentId, preserving cross-document ordering.
21
- * For operations [a1, a2, a3, b1, b2, a4], it returns:
22
- * - SyncOperation 1: [a1, a2, a3] for doc-a
23
- * - SyncOperation 2: [b1, b2] for doc-b
24
- * - SyncOperation 3: [a4] for doc-a
25
- *
26
- * This ensures operations are grouped for efficient processing while maintaining
27
- * causality across documents.
28
- */
29
- export declare function envelopesToSyncOperations(envelope: SyncEnvelope, remoteName: string): SyncOperation[];
30
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAsDhD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,MAAM,GACjB,aAAa,CA2Bf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,MAAM,GACjB,aAAa,EAAE,CAqBjB"}