@powerhousedao/reactor 6.0.0-dev.7 → 6.0.0-dev.78

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 (376) hide show
  1. package/dist/src/cache/collection-membership-cache.d.ts +13 -0
  2. package/dist/src/cache/collection-membership-cache.d.ts.map +1 -0
  3. package/dist/src/cache/document-meta-cache.d.ts.map +1 -1
  4. package/dist/src/cache/kysely-operation-index.d.ts +6 -1
  5. package/dist/src/cache/kysely-operation-index.d.ts.map +1 -1
  6. package/dist/src/cache/kysely-write-cache.d.ts +9 -2
  7. package/dist/src/cache/kysely-write-cache.d.ts.map +1 -1
  8. package/dist/src/cache/operation-index-types.d.ts +16 -2
  9. package/dist/src/cache/operation-index-types.d.ts.map +1 -1
  10. package/dist/src/cache/write/interfaces.d.ts +7 -2
  11. package/dist/src/cache/write/interfaces.d.ts.map +1 -1
  12. package/dist/src/client/reactor-client.d.ts +13 -10
  13. package/dist/src/client/reactor-client.d.ts.map +1 -1
  14. package/dist/src/client/types.d.ts +25 -6
  15. package/dist/src/client/types.d.ts.map +1 -1
  16. package/dist/src/core/reactor-builder.d.ts +23 -10
  17. package/dist/src/core/reactor-builder.d.ts.map +1 -1
  18. package/dist/src/core/reactor-client-builder.d.ts +5 -4
  19. package/dist/src/core/reactor-client-builder.d.ts.map +1 -1
  20. package/dist/src/core/reactor.d.ts +20 -80
  21. package/dist/src/core/reactor.d.ts.map +1 -1
  22. package/dist/src/core/types.d.ts +64 -28
  23. package/dist/src/core/types.d.ts.map +1 -1
  24. package/dist/src/core/utils.d.ts +39 -3
  25. package/dist/src/core/utils.d.ts.map +1 -1
  26. package/dist/src/events/types.d.ts +35 -10
  27. package/dist/src/events/types.d.ts.map +1 -1
  28. package/dist/src/executor/document-action-handler.d.ts +37 -0
  29. package/dist/src/executor/document-action-handler.d.ts.map +1 -0
  30. package/dist/src/executor/signature-verifier.d.ts +9 -0
  31. package/dist/src/executor/signature-verifier.d.ts.map +1 -0
  32. package/dist/src/executor/simple-job-executor-manager.d.ts +6 -1
  33. package/dist/src/executor/simple-job-executor-manager.d.ts.map +1 -1
  34. package/dist/src/executor/simple-job-executor.d.ts +6 -46
  35. package/dist/src/executor/simple-job-executor.d.ts.map +1 -1
  36. package/dist/src/executor/types.d.ts +1 -3
  37. package/dist/src/executor/types.d.ts.map +1 -1
  38. package/dist/src/executor/util.d.ts +12 -2
  39. package/dist/src/executor/util.d.ts.map +1 -1
  40. package/dist/src/index.d.ts +11 -9
  41. package/dist/src/index.d.ts.map +1 -1
  42. package/dist/src/index.js +20208 -61
  43. package/dist/src/job-tracker/in-memory-job-tracker.d.ts +4 -3
  44. package/dist/src/job-tracker/in-memory-job-tracker.d.ts.map +1 -1
  45. package/dist/src/job-tracker/interfaces.d.ts +3 -1
  46. package/dist/src/job-tracker/interfaces.d.ts.map +1 -1
  47. package/dist/src/logging/console.d.ts +1 -22
  48. package/dist/src/logging/console.d.ts.map +1 -1
  49. package/dist/src/logging/types.d.ts +1 -11
  50. package/dist/src/logging/types.d.ts.map +1 -1
  51. package/dist/src/processors/index.d.ts +1 -1
  52. package/dist/src/processors/index.d.ts.map +1 -1
  53. package/dist/src/processors/processor-manager.d.ts +19 -6
  54. package/dist/src/processors/processor-manager.d.ts.map +1 -1
  55. package/dist/src/processors/relational/types.d.ts +2 -0
  56. package/dist/src/processors/relational/types.d.ts.map +1 -0
  57. package/dist/src/processors/relational/utils.d.ts +2 -0
  58. package/dist/src/processors/relational/utils.d.ts.map +1 -0
  59. package/dist/src/processors/utils.d.ts +3 -2
  60. package/dist/src/processors/utils.d.ts.map +1 -1
  61. package/dist/src/queue/job-execution-handle.d.ts +3 -0
  62. package/dist/src/queue/job-execution-handle.d.ts.map +1 -1
  63. package/dist/src/queue/queue.d.ts +30 -1
  64. package/dist/src/queue/queue.d.ts.map +1 -1
  65. package/dist/src/queue/types.d.ts +4 -3
  66. package/dist/src/queue/types.d.ts.map +1 -1
  67. package/dist/src/read-models/base-read-model.d.ts +11 -9
  68. package/dist/src/read-models/base-read-model.d.ts.map +1 -1
  69. package/dist/src/read-models/coordinator.d.ts +2 -2
  70. package/dist/src/read-models/coordinator.d.ts.map +1 -1
  71. package/dist/src/read-models/document-view.d.ts +7 -4
  72. package/dist/src/read-models/document-view.d.ts.map +1 -1
  73. package/dist/src/read-models/interfaces.d.ts +1 -1
  74. package/dist/src/read-models/interfaces.d.ts.map +1 -1
  75. package/dist/src/read-models/types.d.ts +16 -0
  76. package/dist/src/read-models/types.d.ts.map +1 -1
  77. package/dist/src/registry/document-model-resolver.d.ts +29 -0
  78. package/dist/src/registry/document-model-resolver.d.ts.map +1 -0
  79. package/dist/src/registry/implementation.d.ts +4 -0
  80. package/dist/src/registry/implementation.d.ts.map +1 -1
  81. package/dist/src/registry/index.d.ts +3 -1
  82. package/dist/src/registry/index.d.ts.map +1 -1
  83. package/dist/src/registry/interfaces.d.ts +8 -0
  84. package/dist/src/registry/interfaces.d.ts.map +1 -1
  85. package/dist/src/shared/awaiter.d.ts +2 -2
  86. package/dist/src/shared/awaiter.d.ts.map +1 -1
  87. package/dist/src/shared/collect-all-pages.d.ts +7 -0
  88. package/dist/src/shared/collect-all-pages.d.ts.map +1 -0
  89. package/dist/src/shared/drive-url.d.ts +15 -0
  90. package/dist/src/shared/drive-url.d.ts.map +1 -0
  91. package/dist/src/shared/errors.d.ts +9 -0
  92. package/dist/src/shared/errors.d.ts.map +1 -1
  93. package/dist/src/shared/factories.d.ts +6 -2
  94. package/dist/src/shared/factories.d.ts.map +1 -1
  95. package/dist/src/shared/types.d.ts +32 -6
  96. package/dist/src/shared/types.d.ts.map +1 -1
  97. package/dist/src/signer/passthrough-signer.d.ts +1 -1
  98. package/dist/src/signer/passthrough-signer.d.ts.map +1 -1
  99. package/dist/src/storage/interfaces.d.ts +238 -124
  100. package/dist/src/storage/interfaces.d.ts.map +1 -1
  101. package/dist/src/storage/kysely/document-indexer.d.ts +17 -18
  102. package/dist/src/storage/kysely/document-indexer.d.ts.map +1 -1
  103. package/dist/src/storage/kysely/store.d.ts +5 -4
  104. package/dist/src/storage/kysely/store.d.ts.map +1 -1
  105. package/dist/src/storage/kysely/sync-cursor-storage.d.ts +1 -1
  106. package/dist/src/storage/kysely/sync-cursor-storage.d.ts.map +1 -1
  107. package/dist/src/storage/kysely/sync-dead-letter-storage.d.ts +17 -0
  108. package/dist/src/storage/kysely/sync-dead-letter-storage.d.ts.map +1 -0
  109. package/dist/src/storage/kysely/types.d.ts +22 -0
  110. package/dist/src/storage/kysely/types.d.ts.map +1 -1
  111. package/dist/src/storage/migrations/011_add_cursor_type_column.d.ts +3 -0
  112. package/dist/src/storage/migrations/011_add_cursor_type_column.d.ts.map +1 -0
  113. package/dist/src/storage/migrations/012_add_source_remote_column.d.ts +3 -0
  114. package/dist/src/storage/migrations/012_add_source_remote_column.d.ts.map +1 -0
  115. package/dist/src/storage/migrations/013_create_sync_dead_letters_table.d.ts +3 -0
  116. package/dist/src/storage/migrations/013_create_sync_dead_letters_table.d.ts.map +1 -0
  117. package/dist/src/storage/migrations/014_create_processor_cursor_table.d.ts +3 -0
  118. package/dist/src/storage/migrations/014_create_processor_cursor_table.d.ts.map +1 -0
  119. package/dist/src/storage/migrations/migrator.d.ts.map +1 -1
  120. package/dist/src/subs/default-error-handler.d.ts.map +1 -1
  121. package/dist/src/subs/subscription-notification-read-model.d.ts +3 -2
  122. package/dist/src/subs/subscription-notification-read-model.d.ts.map +1 -1
  123. package/dist/src/sync/batch-aggregator.d.ts +25 -0
  124. package/dist/src/sync/batch-aggregator.d.ts.map +1 -0
  125. package/dist/src/sync/buffered-mailbox.d.ts +36 -0
  126. package/dist/src/sync/buffered-mailbox.d.ts.map +1 -0
  127. package/dist/src/sync/channels/gql-req-channel.d.ts +121 -0
  128. package/dist/src/sync/channels/gql-req-channel.d.ts.map +1 -0
  129. package/dist/src/sync/channels/gql-request-channel-factory.d.ts +32 -0
  130. package/dist/src/sync/channels/gql-request-channel-factory.d.ts.map +1 -0
  131. package/dist/src/sync/channels/gql-res-channel.d.ts +31 -0
  132. package/dist/src/sync/channels/gql-res-channel.d.ts.map +1 -0
  133. package/dist/src/sync/channels/gql-response-channel-factory.d.ts +13 -0
  134. package/dist/src/sync/channels/gql-response-channel-factory.d.ts.map +1 -0
  135. package/dist/src/sync/channels/index.d.ts +6 -4
  136. package/dist/src/sync/channels/index.d.ts.map +1 -1
  137. package/dist/src/sync/channels/interval-poll-timer.d.ts +40 -0
  138. package/dist/src/sync/channels/interval-poll-timer.d.ts.map +1 -0
  139. package/dist/src/sync/channels/poll-timer.d.ts +14 -0
  140. package/dist/src/sync/channels/poll-timer.d.ts.map +1 -0
  141. package/dist/src/sync/channels/utils.d.ts +15 -1
  142. package/dist/src/sync/channels/utils.d.ts.map +1 -1
  143. package/dist/src/sync/index.d.ts +11 -7
  144. package/dist/src/sync/index.d.ts.map +1 -1
  145. package/dist/src/sync/interfaces.d.ts +42 -19
  146. package/dist/src/sync/interfaces.d.ts.map +1 -1
  147. package/dist/src/sync/mailbox.d.ts +51 -12
  148. package/dist/src/sync/mailbox.d.ts.map +1 -1
  149. package/dist/src/sync/sync-awaiter.d.ts +34 -0
  150. package/dist/src/sync/sync-awaiter.d.ts.map +1 -0
  151. package/dist/src/sync/sync-builder.d.ts +5 -1
  152. package/dist/src/sync/sync-builder.d.ts.map +1 -1
  153. package/dist/src/sync/sync-manager.d.ts +22 -8
  154. package/dist/src/sync/sync-manager.d.ts.map +1 -1
  155. package/dist/src/sync/sync-operation.d.ts +4 -2
  156. package/dist/src/sync/sync-operation.d.ts.map +1 -1
  157. package/dist/src/sync/sync-status-tracker.d.ts +31 -0
  158. package/dist/src/sync/sync-status-tracker.d.ts.map +1 -0
  159. package/dist/src/sync/types.d.ts +107 -2
  160. package/dist/src/sync/types.d.ts.map +1 -1
  161. package/dist/src/sync/utils.d.ts +37 -2
  162. package/dist/src/sync/utils.d.ts.map +1 -1
  163. package/dist/src/utils/reshuffle.d.ts +22 -5
  164. package/dist/src/utils/reshuffle.d.ts.map +1 -1
  165. package/package.json +24 -20
  166. package/dist/src/actions/index.js +0 -76
  167. package/dist/src/actions/index.js.map +0 -1
  168. package/dist/src/cache/buffer/ring-buffer.js +0 -69
  169. package/dist/src/cache/buffer/ring-buffer.js.map +0 -1
  170. package/dist/src/cache/document-meta-cache-types.js +0 -2
  171. package/dist/src/cache/document-meta-cache-types.js.map +0 -1
  172. package/dist/src/cache/document-meta-cache.js +0 -128
  173. package/dist/src/cache/document-meta-cache.js.map +0 -1
  174. package/dist/src/cache/index.js +0 -2
  175. package/dist/src/cache/index.js.map +0 -1
  176. package/dist/src/cache/kysely-operation-index.js +0 -250
  177. package/dist/src/cache/kysely-operation-index.js.map +0 -1
  178. package/dist/src/cache/kysely-write-cache.js +0 -388
  179. package/dist/src/cache/kysely-write-cache.js.map +0 -1
  180. package/dist/src/cache/lru/lru-tracker.js +0 -96
  181. package/dist/src/cache/lru/lru-tracker.js.map +0 -1
  182. package/dist/src/cache/operation-index-types.js +0 -4
  183. package/dist/src/cache/operation-index-types.js.map +0 -1
  184. package/dist/src/cache/write/interfaces.js +0 -2
  185. package/dist/src/cache/write/interfaces.js.map +0 -1
  186. package/dist/src/cache/write-cache-types.js +0 -2
  187. package/dist/src/cache/write-cache-types.js.map +0 -1
  188. package/dist/src/client/reactor-client.js +0 -406
  189. package/dist/src/client/reactor-client.js.map +0 -1
  190. package/dist/src/client/types.js +0 -14
  191. package/dist/src/client/types.js.map +0 -1
  192. package/dist/src/core/reactor-builder.js +0 -231
  193. package/dist/src/core/reactor-builder.js.map +0 -1
  194. package/dist/src/core/reactor-client-builder.js +0 -123
  195. package/dist/src/core/reactor-client-builder.js.map +0 -1
  196. package/dist/src/core/reactor.js +0 -981
  197. package/dist/src/core/reactor.js.map +0 -1
  198. package/dist/src/core/types.js +0 -2
  199. package/dist/src/core/types.js.map +0 -1
  200. package/dist/src/core/utils.js +0 -171
  201. package/dist/src/core/utils.js.map +0 -1
  202. package/dist/src/events/event-bus.js +0 -53
  203. package/dist/src/events/event-bus.js.map +0 -1
  204. package/dist/src/events/interfaces.js +0 -2
  205. package/dist/src/events/interfaces.js.map +0 -1
  206. package/dist/src/events/types.js +0 -28
  207. package/dist/src/events/types.js.map +0 -1
  208. package/dist/src/executor/interfaces.js +0 -2
  209. package/dist/src/executor/interfaces.js.map +0 -1
  210. package/dist/src/executor/simple-job-executor-manager.js +0 -233
  211. package/dist/src/executor/simple-job-executor-manager.js.map +0 -1
  212. package/dist/src/executor/simple-job-executor.js +0 -898
  213. package/dist/src/executor/simple-job-executor.js.map +0 -1
  214. package/dist/src/executor/types.js +0 -11
  215. package/dist/src/executor/types.js.map +0 -1
  216. package/dist/src/executor/util.js +0 -184
  217. package/dist/src/executor/util.js.map +0 -1
  218. package/dist/src/index.js.map +0 -1
  219. package/dist/src/job-tracker/in-memory-job-tracker.js +0 -112
  220. package/dist/src/job-tracker/in-memory-job-tracker.js.map +0 -1
  221. package/dist/src/job-tracker/index.js +0 -2
  222. package/dist/src/job-tracker/index.js.map +0 -1
  223. package/dist/src/job-tracker/interfaces.js +0 -2
  224. package/dist/src/job-tracker/interfaces.js.map +0 -1
  225. package/dist/src/logging/console.js +0 -108
  226. package/dist/src/logging/console.js.map +0 -1
  227. package/dist/src/logging/types.js +0 -2
  228. package/dist/src/logging/types.js.map +0 -1
  229. package/dist/src/processors/index.js +0 -2
  230. package/dist/src/processors/index.js.map +0 -1
  231. package/dist/src/processors/processor-manager.js +0 -165
  232. package/dist/src/processors/processor-manager.js.map +0 -1
  233. package/dist/src/processors/types.d.ts +0 -63
  234. package/dist/src/processors/types.d.ts.map +0 -1
  235. package/dist/src/processors/types.js +0 -2
  236. package/dist/src/processors/types.js.map +0 -1
  237. package/dist/src/processors/utils.js +0 -58
  238. package/dist/src/processors/utils.js.map +0 -1
  239. package/dist/src/queue/interfaces.js +0 -2
  240. package/dist/src/queue/interfaces.js.map +0 -1
  241. package/dist/src/queue/job-execution-handle.js +0 -62
  242. package/dist/src/queue/job-execution-handle.js.map +0 -1
  243. package/dist/src/queue/queue.js +0 -384
  244. package/dist/src/queue/queue.js.map +0 -1
  245. package/dist/src/queue/types.js +0 -19
  246. package/dist/src/queue/types.js.map +0 -1
  247. package/dist/src/read-models/base-read-model.js +0 -143
  248. package/dist/src/read-models/base-read-model.js.map +0 -1
  249. package/dist/src/read-models/coordinator.js +0 -72
  250. package/dist/src/read-models/coordinator.js.map +0 -1
  251. package/dist/src/read-models/document-view.js +0 -375
  252. package/dist/src/read-models/document-view.js.map +0 -1
  253. package/dist/src/read-models/interfaces.js +0 -2
  254. package/dist/src/read-models/interfaces.js.map +0 -1
  255. package/dist/src/read-models/types.js +0 -2
  256. package/dist/src/read-models/types.js.map +0 -1
  257. package/dist/src/registry/implementation.js +0 -216
  258. package/dist/src/registry/implementation.js.map +0 -1
  259. package/dist/src/registry/index.js +0 -2
  260. package/dist/src/registry/index.js.map +0 -1
  261. package/dist/src/registry/interfaces.js +0 -2
  262. package/dist/src/registry/interfaces.js.map +0 -1
  263. package/dist/src/shared/awaiter.js +0 -123
  264. package/dist/src/shared/awaiter.js.map +0 -1
  265. package/dist/src/shared/consistency-tracker.js +0 -123
  266. package/dist/src/shared/consistency-tracker.js.map +0 -1
  267. package/dist/src/shared/errors.js +0 -75
  268. package/dist/src/shared/errors.js.map +0 -1
  269. package/dist/src/shared/factories.js +0 -33
  270. package/dist/src/shared/factories.js.map +0 -1
  271. package/dist/src/shared/types.js +0 -38
  272. package/dist/src/shared/types.js.map +0 -1
  273. package/dist/src/shared/utils.js +0 -8
  274. package/dist/src/shared/utils.js.map +0 -1
  275. package/dist/src/signer/passthrough-signer.js +0 -19
  276. package/dist/src/signer/passthrough-signer.js.map +0 -1
  277. package/dist/src/signer/types.js +0 -2
  278. package/dist/src/signer/types.js.map +0 -1
  279. package/dist/src/storage/consistency-aware-legacy-storage.d.ts +0 -33
  280. package/dist/src/storage/consistency-aware-legacy-storage.d.ts.map +0 -1
  281. package/dist/src/storage/consistency-aware-legacy-storage.js +0 -65
  282. package/dist/src/storage/consistency-aware-legacy-storage.js.map +0 -1
  283. package/dist/src/storage/index.js +0 -3
  284. package/dist/src/storage/index.js.map +0 -1
  285. package/dist/src/storage/interfaces.js +0 -19
  286. package/dist/src/storage/interfaces.js.map +0 -1
  287. package/dist/src/storage/kysely/document-indexer.js +0 -350
  288. package/dist/src/storage/kysely/document-indexer.js.map +0 -1
  289. package/dist/src/storage/kysely/keyframe-store.js +0 -64
  290. package/dist/src/storage/kysely/keyframe-store.js.map +0 -1
  291. package/dist/src/storage/kysely/store.js +0 -233
  292. package/dist/src/storage/kysely/store.js.map +0 -1
  293. package/dist/src/storage/kysely/sync-cursor-storage.js +0 -93
  294. package/dist/src/storage/kysely/sync-cursor-storage.js.map +0 -1
  295. package/dist/src/storage/kysely/sync-remote-storage.js +0 -133
  296. package/dist/src/storage/kysely/sync-remote-storage.js.map +0 -1
  297. package/dist/src/storage/kysely/types.js +0 -2
  298. package/dist/src/storage/kysely/types.js.map +0 -1
  299. package/dist/src/storage/migrations/001_create_operation_table.js +0 -41
  300. package/dist/src/storage/migrations/001_create_operation_table.js.map +0 -1
  301. package/dist/src/storage/migrations/002_create_keyframe_table.js +0 -27
  302. package/dist/src/storage/migrations/002_create_keyframe_table.js.map +0 -1
  303. package/dist/src/storage/migrations/003_create_document_table.js +0 -10
  304. package/dist/src/storage/migrations/003_create_document_table.js.map +0 -1
  305. package/dist/src/storage/migrations/004_create_document_relationship_table.js +0 -35
  306. package/dist/src/storage/migrations/004_create_document_relationship_table.js.map +0 -1
  307. package/dist/src/storage/migrations/005_create_indexer_state_table.js +0 -10
  308. package/dist/src/storage/migrations/005_create_indexer_state_table.js.map +0 -1
  309. package/dist/src/storage/migrations/006_create_document_snapshot_table.js +0 -49
  310. package/dist/src/storage/migrations/006_create_document_snapshot_table.js.map +0 -1
  311. package/dist/src/storage/migrations/007_create_slug_mapping_table.js +0 -24
  312. package/dist/src/storage/migrations/007_create_slug_mapping_table.js.map +0 -1
  313. package/dist/src/storage/migrations/008_create_view_state_table.js +0 -10
  314. package/dist/src/storage/migrations/008_create_view_state_table.js.map +0 -1
  315. package/dist/src/storage/migrations/009_create_operation_index_tables.js +0 -50
  316. package/dist/src/storage/migrations/009_create_operation_index_tables.js.map +0 -1
  317. package/dist/src/storage/migrations/010_create_sync_tables.js +0 -43
  318. package/dist/src/storage/migrations/010_create_sync_tables.js.map +0 -1
  319. package/dist/src/storage/migrations/index.js +0 -3
  320. package/dist/src/storage/migrations/index.js.map +0 -1
  321. package/dist/src/storage/migrations/migrator.js +0 -78
  322. package/dist/src/storage/migrations/migrator.js.map +0 -1
  323. package/dist/src/storage/migrations/run-migrations.js +0 -58
  324. package/dist/src/storage/migrations/run-migrations.js.map +0 -1
  325. package/dist/src/storage/migrations/types.js +0 -2
  326. package/dist/src/storage/migrations/types.js.map +0 -1
  327. package/dist/src/storage/txn.js +0 -42
  328. package/dist/src/storage/txn.js.map +0 -1
  329. package/dist/src/subs/default-error-handler.js +0 -27
  330. package/dist/src/subs/default-error-handler.js.map +0 -1
  331. package/dist/src/subs/react-subscription-manager.js +0 -185
  332. package/dist/src/subs/react-subscription-manager.js.map +0 -1
  333. package/dist/src/subs/subscription-notification-read-model.js +0 -62
  334. package/dist/src/subs/subscription-notification-read-model.js.map +0 -1
  335. package/dist/src/subs/types.js +0 -2
  336. package/dist/src/subs/types.js.map +0 -1
  337. package/dist/src/sync/channels/composite-channel-factory.d.ts +0 -30
  338. package/dist/src/sync/channels/composite-channel-factory.d.ts.map +0 -1
  339. package/dist/src/sync/channels/composite-channel-factory.js +0 -87
  340. package/dist/src/sync/channels/composite-channel-factory.js.map +0 -1
  341. package/dist/src/sync/channels/gql-channel-factory.d.ts +0 -25
  342. package/dist/src/sync/channels/gql-channel-factory.d.ts.map +0 -1
  343. package/dist/src/sync/channels/gql-channel-factory.js +0 -76
  344. package/dist/src/sync/channels/gql-channel-factory.js.map +0 -1
  345. package/dist/src/sync/channels/gql-channel.d.ts +0 -118
  346. package/dist/src/sync/channels/gql-channel.d.ts.map +0 -1
  347. package/dist/src/sync/channels/gql-channel.js +0 -423
  348. package/dist/src/sync/channels/gql-channel.js.map +0 -1
  349. package/dist/src/sync/channels/index.js +0 -6
  350. package/dist/src/sync/channels/index.js.map +0 -1
  351. package/dist/src/sync/channels/polling-channel.d.ts +0 -39
  352. package/dist/src/sync/channels/polling-channel.d.ts.map +0 -1
  353. package/dist/src/sync/channels/polling-channel.js +0 -72
  354. package/dist/src/sync/channels/polling-channel.js.map +0 -1
  355. package/dist/src/sync/channels/utils.js +0 -96
  356. package/dist/src/sync/channels/utils.js.map +0 -1
  357. package/dist/src/sync/errors.js +0 -17
  358. package/dist/src/sync/errors.js.map +0 -1
  359. package/dist/src/sync/index.js +0 -9
  360. package/dist/src/sync/index.js.map +0 -1
  361. package/dist/src/sync/interfaces.js +0 -2
  362. package/dist/src/sync/interfaces.js.map +0 -1
  363. package/dist/src/sync/mailbox.js +0 -59
  364. package/dist/src/sync/mailbox.js.map +0 -1
  365. package/dist/src/sync/sync-builder.js +0 -39
  366. package/dist/src/sync/sync-builder.js.map +0 -1
  367. package/dist/src/sync/sync-manager.js +0 -266
  368. package/dist/src/sync/sync-manager.js.map +0 -1
  369. package/dist/src/sync/sync-operation.js +0 -63
  370. package/dist/src/sync/sync-operation.js.map +0 -1
  371. package/dist/src/sync/types.js +0 -16
  372. package/dist/src/sync/types.js.map +0 -1
  373. package/dist/src/sync/utils.js +0 -78
  374. package/dist/src/sync/utils.js.map +0 -1
  375. package/dist/src/utils/reshuffle.js +0 -47
  376. package/dist/src/utils/reshuffle.js.map +0 -1
@@ -1,43 +0,0 @@
1
- import { sql } from "kysely";
2
- export async function up(db) {
3
- await db.schema
4
- .createTable("sync_remotes")
5
- .addColumn("name", "text", (col) => col.primaryKey())
6
- .addColumn("collection_id", "text", (col) => col.notNull())
7
- .addColumn("channel_type", "text", (col) => col.notNull())
8
- .addColumn("channel_id", "text", (col) => col.notNull().defaultTo(""))
9
- .addColumn("remote_name", "text", (col) => col.notNull().defaultTo(""))
10
- .addColumn("channel_parameters", "jsonb", (col) => col.notNull().defaultTo(sql `'{}'::jsonb`))
11
- .addColumn("filter_document_ids", "jsonb")
12
- .addColumn("filter_scopes", "jsonb")
13
- .addColumn("filter_branch", "text", (col) => col.notNull().defaultTo("main"))
14
- .addColumn("push_state", "text", (col) => col.notNull().defaultTo("idle"))
15
- .addColumn("push_last_success_utc_ms", "text")
16
- .addColumn("push_last_failure_utc_ms", "text")
17
- .addColumn("push_failure_count", "integer", (col) => col.notNull().defaultTo(0))
18
- .addColumn("pull_state", "text", (col) => col.notNull().defaultTo("idle"))
19
- .addColumn("pull_last_success_utc_ms", "text")
20
- .addColumn("pull_last_failure_utc_ms", "text")
21
- .addColumn("pull_failure_count", "integer", (col) => col.notNull().defaultTo(0))
22
- .addColumn("created_at", "timestamptz", (col) => col.notNull().defaultTo(sql `NOW()`))
23
- .addColumn("updated_at", "timestamptz", (col) => col.notNull().defaultTo(sql `NOW()`))
24
- .execute();
25
- await db.schema
26
- .createIndex("idx_sync_remotes_collection")
27
- .on("sync_remotes")
28
- .column("collection_id")
29
- .execute();
30
- await db.schema
31
- .createTable("sync_cursors")
32
- .addColumn("remote_name", "text", (col) => col.primaryKey().references("sync_remotes.name").onDelete("cascade"))
33
- .addColumn("cursor_ordinal", "bigint", (col) => col.notNull().defaultTo(0))
34
- .addColumn("last_synced_at_utc_ms", "text")
35
- .addColumn("updated_at", "timestamptz", (col) => col.notNull().defaultTo(sql `NOW()`))
36
- .execute();
37
- await db.schema
38
- .createIndex("idx_sync_cursors_ordinal")
39
- .on("sync_cursors")
40
- .column("cursor_ordinal")
41
- .execute();
42
- }
43
- //# sourceMappingURL=010_create_sync_tables.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"010_create_sync_tables.js","sourceRoot":"","sources":["../../../../src/storage/migrations/010_create_sync_tables.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,M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C,CACrE;SACA,SAAS,CAAC,gBAAgB,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;SAC1E,SAAS,CAAC,uBAAuB,EAAE,MAAM,CAAC;SAC1C,SAAS,CAAC,YAAY,EAAE,aAAa,EAAE,CAAC,GAAG,EAAE,EAAE,CAC9C,GAAG,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,GAAG,CAAA,OAAO,CAAC,CACpC;SACA,OAAO,EAAE,CAAC;IAEb,MAAM,EAAE,CAAC,MAAM;SACZ,WAAW,CAAC,0BAA0B,CAAC;SACvC,EAAE,CAAC,cAAc,CAAC;SAClB,MAAM,CAAC,gBAAgB,CAAC;SACxB,OAAO,EAAE,CAAC;AACf,CAAC"}
@@ -1,3 +0,0 @@
1
- export * from "./types.js";
2
- export * from "./migrator.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/storage/migrations/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC"}
@@ -1,78 +0,0 @@
1
- import { Migrator, sql } from "kysely";
2
- export const REACTOR_SCHEMA = "reactor";
3
- import * as migration001 from "./001_create_operation_table.js";
4
- import * as migration002 from "./002_create_keyframe_table.js";
5
- import * as migration003 from "./003_create_document_table.js";
6
- import * as migration004 from "./004_create_document_relationship_table.js";
7
- import * as migration005 from "./005_create_indexer_state_table.js";
8
- import * as migration006 from "./006_create_document_snapshot_table.js";
9
- import * as migration007 from "./007_create_slug_mapping_table.js";
10
- import * as migration008 from "./008_create_view_state_table.js";
11
- import * as migration009 from "./009_create_operation_index_tables.js";
12
- import * as migration010 from "./010_create_sync_tables.js";
13
- const migrations = {
14
- "001_create_operation_table": migration001,
15
- "002_create_keyframe_table": migration002,
16
- "003_create_document_table": migration003,
17
- "004_create_document_relationship_table": migration004,
18
- "005_create_indexer_state_table": migration005,
19
- "006_create_document_snapshot_table": migration006,
20
- "007_create_slug_mapping_table": migration007,
21
- "008_create_view_state_table": migration008,
22
- "009_create_operation_index_tables": migration009,
23
- "010_create_sync_tables": migration010,
24
- };
25
- class ProgrammaticMigrationProvider {
26
- getMigrations() {
27
- return Promise.resolve(migrations);
28
- }
29
- }
30
- export async function runMigrations(db, schema = REACTOR_SCHEMA) {
31
- try {
32
- await sql `CREATE SCHEMA IF NOT EXISTS ${sql.id(schema)}`.execute(db);
33
- }
34
- catch (error) {
35
- return {
36
- success: false,
37
- migrationsExecuted: [],
38
- error: error instanceof Error ? error : new Error("Failed to create schema"),
39
- };
40
- }
41
- const migrator = new Migrator({
42
- db: db.withSchema(schema),
43
- provider: new ProgrammaticMigrationProvider(),
44
- migrationTableSchema: schema,
45
- });
46
- let error;
47
- let results;
48
- try {
49
- const result = await migrator.migrateToLatest();
50
- error = result.error;
51
- results = result.results;
52
- }
53
- catch (e) {
54
- error = e;
55
- results = [];
56
- }
57
- const migrationsExecuted = results?.map((result) => result.migrationName) ?? [];
58
- if (error) {
59
- return {
60
- success: false,
61
- migrationsExecuted,
62
- error: error instanceof Error ? error : new Error("Unknown migration error"),
63
- };
64
- }
65
- return {
66
- success: true,
67
- migrationsExecuted,
68
- };
69
- }
70
- export async function getMigrationStatus(db, schema = REACTOR_SCHEMA) {
71
- const migrator = new Migrator({
72
- db: db.withSchema(schema),
73
- provider: new ProgrammaticMigrationProvider(),
74
- migrationTableSchema: schema,
75
- });
76
- return await migrator.getMigrations();
77
- }
78
- //# sourceMappingURL=migrator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrator.js","sourceRoot":"","sources":["../../../../src/storage/migrations/migrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAIvC,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AACxC,OAAO,KAAK,YAAY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aAAa,EAAE,CAAC;AACxC,CAAC"}
@@ -1,58 +0,0 @@
1
- import { PGlite } from "@electric-sql/pglite";
2
- import { Kysely } from "kysely";
3
- import { PGliteDialect } from "kysely-pglite-dialect";
4
- import { runMigrations, getMigrationStatus } from "./migrator.js";
5
- async function main() {
6
- const command = process.argv[2];
7
- const db = new Kysely({
8
- dialect: new PGliteDialect(new PGlite()),
9
- });
10
- try {
11
- if (command === "up" || !command) {
12
- console.log("Running migrations...");
13
- const result = await runMigrations(db);
14
- if (!result.success) {
15
- console.error("Migration failed:", result.error?.message);
16
- process.exit(1);
17
- }
18
- if (result.migrationsExecuted.length === 0) {
19
- console.log("No migrations to run - database is up to date");
20
- }
21
- else {
22
- console.log(`Successfully executed ${result.migrationsExecuted.length} migration(s):`);
23
- for (const name of result.migrationsExecuted) {
24
- console.log(` - ${name}`);
25
- }
26
- }
27
- }
28
- else if (command === "status") {
29
- console.log("Checking migration status...");
30
- const migrations = await getMigrationStatus(db);
31
- console.log("\nMigration Status:");
32
- console.log("=================");
33
- for (const migration of migrations) {
34
- const status = migration.executedAt
35
- ? `✓ Executed at ${migration.executedAt.toISOString()}`
36
- : "○ Pending";
37
- console.log(`${status} - ${migration.name}`);
38
- }
39
- }
40
- else {
41
- console.error(`Unknown command: ${command}`);
42
- console.log("\nUsage:");
43
- console.log(" pnpm migrate - Run pending migrations");
44
- console.log(" pnpm migrate up - Run pending migrations");
45
- console.log(" pnpm migrate status - Show migration status");
46
- process.exit(1);
47
- }
48
- }
49
- catch (error) {
50
- console.error("Error:", error instanceof Error ? error.message : String(error));
51
- process.exit(1);
52
- }
53
- finally {
54
- await db.destroy();
55
- }
56
- }
57
- void main();
58
- //# sourceMappingURL=run-migrations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"run-migrations.js","sourceRoot":"","sources":["../../../../src/storage/migrations/run-migrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,E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0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/storage/migrations/types.ts"],"names":[],"mappings":""}
@@ -1,42 +0,0 @@
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 -- we should be using the jobId
22
- jobId: uuidv4(),
23
- opId: op.id,
24
- prevOpId: "", // Will be set during apply
25
- documentId: this.documentId,
26
- documentType: this.documentType,
27
- scope: this.scope,
28
- branch: this.branch,
29
- timestampUtcMs: new Date(op.timestampUtcMs),
30
- index: op.index,
31
- action: JSON.stringify(op.action),
32
- skip: op.skip,
33
- error: op.error || null,
34
- hash: op.hash,
35
- });
36
- }
37
- }
38
- getOperations() {
39
- return this.operations;
40
- }
41
- }
42
- //# sourceMappingURL=txn.js.map
@@ -1 +0,0 @@
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,wCAAwC;gBACxC,KAAK,EAAE,MAAM,EAAE;gBACf,IAAI,EAAE,EAAE,CAAC,EAAE;gBACX,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"}
@@ -1,27 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,185 +0,0 @@
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
@@ -1 +0,0 @@
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,EAGxC,CAAC;IAEI,mBAAmB,GAAG,CAAC,CAAC;IACxB,YAAY,CAA4B;IAEhD,YAAY,YAAuC;QACjD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,iBAAiB,CACf,QAAiC,EACjC,MAAqB;QAErB,MAAM,EAAE,GAAG,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACnD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAE5D,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC;IAED,iBAAiB,CACf,QAAiC,EACjC,MAAqB;QAErB,MAAM,EAAE,GAAG,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACnD,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QAE5D,OAAO,GAA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C,MAAM,CAAC,EAAE,CAAC;gBAAE,OAAO,KAAK,CAAC;YACpE,IAAI,MAAM,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,CAAC,YAAY,KAAK,MAAM,CAAC,IAAI;gBAAE,OAAO,KAAK,CAAC;YACzE,IAAI,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;gBAAE,OAAO,KAAK,CAAC;YAE1E,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,yBAAyB,CAC/B,QAAgB,EAChB,OAAe,EACf,SAAkB,EAClB,MAAqB;QAErB,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAEzB,IAAI,MAAM,CAAC,QAAQ,IAAI,QAAQ,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"}
@@ -1,62 +0,0 @@
1
- import { RelationshipChangeType } from "../shared/types.js";
2
- /**
3
- * A read model that notifies the subscription manager when operations are processed.
4
- * This bridges the gap between operation processing and subscription callbacks.
5
- *
6
- * Must be processed AFTER other read models have completed and AFTER OPERATIONS_READY
7
- * is emitted, so that reactor.get() returns fresh data when callbacks fire.
8
- */
9
- export class SubscriptionNotificationReadModel {
10
- subscriptionManager;
11
- documentView;
12
- constructor(subscriptionManager, documentView) {
13
- this.subscriptionManager = subscriptionManager;
14
- this.documentView = documentView;
15
- }
16
- async indexOperations(operations) {
17
- if (operations.length === 0)
18
- return;
19
- const created = [];
20
- const deleted = [];
21
- const updatedIds = new Set();
22
- const documentTypes = new Map();
23
- const parentIds = new Map();
24
- for (const item of operations) {
25
- const { operation, context } = item;
26
- const actionType = operation.action.type;
27
- documentTypes.set(context.documentId, context.documentType);
28
- if (actionType === "CREATE_DOCUMENT") {
29
- created.push(context.documentId);
30
- }
31
- else if (actionType === "DELETE_DOCUMENT") {
32
- const input = operation.action.input;
33
- const deletedId = input.documentId ?? context.documentId;
34
- deleted.push(deletedId);
35
- }
36
- else if (actionType === "ADD_RELATIONSHIP") {
37
- const input = operation.action.input;
38
- this.subscriptionManager.notifyRelationshipChanged(input.sourceId, input.targetId, RelationshipChangeType.Added, input.childType);
39
- }
40
- else if (actionType === "REMOVE_RELATIONSHIP") {
41
- const input = operation.action.input;
42
- this.subscriptionManager.notifyRelationshipChanged(input.sourceId, input.targetId, RelationshipChangeType.Removed, input.childType);
43
- }
44
- else {
45
- if (!created.includes(context.documentId)) {
46
- updatedIds.add(context.documentId);
47
- }
48
- }
49
- }
50
- if (created.length > 0) {
51
- this.subscriptionManager.notifyDocumentsCreated(created, documentTypes, parentIds);
52
- }
53
- if (deleted.length > 0) {
54
- this.subscriptionManager.notifyDocumentsDeleted(deleted, documentTypes, parentIds);
55
- }
56
- if (updatedIds.size > 0 && this.documentView) {
57
- const documents = await Promise.all(Array.from(updatedIds).map((id) => this.documentView.get(id)));
58
- this.subscriptionManager.notifyDocumentsUpdated(documents);
59
- }
60
- }
61
- }
62
- //# sourceMappingURL=subscription-notification-read-model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subscription-notification-read-model.js","sourceRoot":"","sources":["../../../src/subs/subscription-notification-read-model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAO5D;;;;;;GAMG;AACH,MAAM,OAAO,iCAAiC;IAElC;IACA;IAFV,YACU,mBAA+C,EAC/C,YAA4B;QAD5B,wBAAmB,GAAnB,mBAAmB,CAA4B;QAC/C,iBAAY,G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3,"file":"types.js","sourceRoot":"","sources":["../../../src/subs/types.ts"],"names":[],"mappings":""}
@@ -1,30 +0,0 @@
1
- import type { ILogger } from "../../logging/types.js";
2
- import type { ISyncCursorStorage } from "../../storage/interfaces.js";
3
- import type { IChannel, IChannelFactory } from "../interfaces.js";
4
- import type { ChannelConfig, RemoteFilter } from "../types.js";
5
- /**
6
- * Factory for creating channel instances of multiple types.
7
- *
8
- * Supports both "gql" channels for network-based synchronization and
9
- * "internal" channels for in-process communication.
10
- */
11
- export declare class CompositeChannelFactory implements IChannelFactory {
12
- private readonly logger;
13
- constructor(logger: ILogger);
14
- /**
15
- * Creates a new channel instance based on the configuration type.
16
- *
17
- * @param remoteId - Unique identifier for the remote
18
- * @param remoteName - Human-readable name for the remote
19
- * @param config - Channel configuration including type and parameters
20
- * @param cursorStorage - Storage for persisting synchronization cursors
21
- * @param collectionId - Collection ID for filtering
22
- * @param filter - Remote filter configuration
23
- * @returns A new channel instance
24
- * @throws Error if config.type is not supported or required parameters are missing
25
- */
26
- instance(remoteId: string, remoteName: string, config: ChannelConfig, cursorStorage: ISyncCursorStorage, collectionId: string, filter: RemoteFilter): IChannel;
27
- private createGqlChannel;
28
- private createPollingChannel;
29
- }
30
- //# sourceMappingURL=composite-channel-factory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"composite-channel-factory.d.ts","sourceRoot":"","sources":["../../../../src/sync/channels/composite-channel-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI/D;;;;;GAKG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAC7D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;gBAErB,MAAM,EAAE,OAAO;IAI3B;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,kBAAkB,EACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,YAAY,GACnB,QAAQ;IAqBX,OAAO,CAAC,gBAAgB;IAwExB,OAAO,CAAC,oBAAoB;CAO7B"}