@powerhousedao/reactor-browser 6.0.0-dev.9 → 6.0.0-dev.91

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 (404) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/codegen.d.ts +4 -0
  4. package/dist/codegen.d.ts.map +1 -0
  5. package/dist/src/actions/dispatch.d.ts.map +1 -1
  6. package/dist/src/actions/document.d.ts +17 -4
  7. package/dist/src/actions/document.d.ts.map +1 -1
  8. package/dist/src/actions/drive.d.ts +1 -1
  9. package/dist/src/actions/drive.d.ts.map +1 -1
  10. package/dist/src/actions/index.d.ts +1 -1
  11. package/dist/src/actions/index.d.ts.map +1 -1
  12. package/dist/src/actions/queue.d.ts +2 -2
  13. package/dist/src/actions/queue.d.ts.map +1 -1
  14. package/dist/src/actions/sign.d.ts.map +1 -1
  15. package/dist/src/analytics/context.d.ts.map +1 -1
  16. package/dist/src/analytics.js +67641 -3
  17. package/dist/src/connect.js +2559 -2
  18. package/dist/src/errors.d.ts +1 -0
  19. package/dist/src/errors.d.ts.map +1 -1
  20. package/dist/src/graphql/client.d.ts +34 -0
  21. package/dist/src/graphql/client.d.ts.map +1 -0
  22. package/dist/src/graphql/gen/schema.d.ts +1074 -0
  23. package/dist/src/graphql/gen/schema.d.ts.map +1 -0
  24. package/dist/src/hooks/add-ph-event-handlers.d.ts.map +1 -1
  25. package/dist/src/hooks/config/connect.d.ts +2 -2
  26. package/dist/src/hooks/connect.d.ts +4 -7
  27. package/dist/src/hooks/connect.d.ts.map +1 -1
  28. package/dist/src/hooks/connection-state.d.ts +11 -0
  29. package/dist/src/hooks/connection-state.d.ts.map +1 -0
  30. package/dist/src/hooks/document-operations.d.ts +20 -0
  31. package/dist/src/hooks/document-operations.d.ts.map +1 -0
  32. package/dist/src/hooks/index.d.ts +7 -3
  33. package/dist/src/hooks/index.d.ts.map +1 -1
  34. package/dist/src/hooks/loading.d.ts +2 -0
  35. package/dist/src/hooks/loading.d.ts.map +1 -1
  36. package/dist/src/hooks/make-ph-event-functions.d.ts +1 -1
  37. package/dist/src/hooks/make-ph-event-functions.d.ts.map +1 -1
  38. package/dist/src/hooks/node-actions.d.ts +1 -0
  39. package/dist/src/hooks/node-actions.d.ts.map +1 -1
  40. package/dist/src/hooks/reactor.d.ts +7 -27
  41. package/dist/src/hooks/reactor.d.ts.map +1 -1
  42. package/dist/src/hooks/renown.d.ts +12 -5
  43. package/dist/src/hooks/renown.d.ts.map +1 -1
  44. package/dist/src/hooks/use-feature-flags.d.ts +0 -27
  45. package/dist/src/hooks/use-feature-flags.d.ts.map +1 -1
  46. package/dist/src/hooks/use-get-switchboard-link.d.ts.map +1 -1
  47. package/dist/src/hooks/vetra-packages.d.ts +10 -6
  48. package/dist/src/hooks/vetra-packages.d.ts.map +1 -1
  49. package/dist/src/index.d.ts +6 -1
  50. package/dist/src/index.d.ts.map +1 -1
  51. package/dist/src/index.js +32421 -15
  52. package/dist/src/package-manager.d.ts +32 -0
  53. package/dist/src/package-manager.d.ts.map +1 -0
  54. package/dist/src/pglite/drop.d.ts +1 -0
  55. package/dist/src/pglite/drop.d.ts.map +1 -1
  56. package/dist/src/pglite/index.d.ts +1 -1
  57. package/dist/src/pglite/index.d.ts.map +1 -1
  58. package/dist/src/re-exports.d.ts +3 -0
  59. package/dist/src/re-exports.d.ts.map +1 -0
  60. package/dist/src/reactor-client-document-cache.d.ts +0 -2
  61. package/dist/src/reactor-client-document-cache.d.ts.map +1 -1
  62. package/dist/src/reactor.d.ts +16 -7
  63. package/dist/src/reactor.d.ts.map +1 -1
  64. package/dist/src/registry/client.d.ts +9 -0
  65. package/dist/src/registry/client.d.ts.map +1 -0
  66. package/dist/src/registry/index.d.ts +3 -0
  67. package/dist/src/registry/index.d.ts.map +1 -0
  68. package/dist/src/registry/types.d.ts +9 -0
  69. package/dist/src/registry/types.d.ts.map +1 -0
  70. package/dist/src/relational/hooks/useRelationalDb.d.ts +3 -2
  71. package/dist/src/relational/hooks/useRelationalDb.d.ts.map +1 -1
  72. package/dist/src/relational/hooks/useRelationalQuery.d.ts +2 -2
  73. package/dist/src/relational/hooks/useRelationalQuery.d.ts.map +1 -1
  74. package/dist/src/relational/utils/createProcessorQuery.d.ts +4 -4
  75. package/dist/src/relational/utils/createProcessorQuery.d.ts.map +1 -1
  76. package/dist/src/remote-controller/action-tracker.d.ts +20 -0
  77. package/dist/src/remote-controller/action-tracker.d.ts.map +1 -0
  78. package/dist/src/remote-controller/index.d.ts +7 -0
  79. package/dist/src/remote-controller/index.d.ts.map +1 -0
  80. package/dist/src/remote-controller/remote-client.d.ts +30 -0
  81. package/dist/src/remote-controller/remote-client.d.ts.map +1 -0
  82. package/dist/src/remote-controller/remote-controller.d.ts +108 -0
  83. package/dist/src/remote-controller/remote-controller.d.ts.map +1 -0
  84. package/dist/src/remote-controller/types.d.ts +118 -0
  85. package/dist/src/remote-controller/types.d.ts.map +1 -0
  86. package/dist/src/remote-controller/utils.d.ts +28 -0
  87. package/dist/src/remote-controller/utils.d.ts.map +1 -0
  88. package/dist/src/renown/components/RenownAuthButton.d.ts +12 -0
  89. package/dist/src/renown/components/RenownAuthButton.d.ts.map +1 -0
  90. package/dist/src/renown/components/RenownLoginButton.d.ts +11 -0
  91. package/dist/src/renown/components/RenownLoginButton.d.ts.map +1 -0
  92. package/dist/src/renown/components/RenownUserButton.d.ts +21 -0
  93. package/dist/src/renown/components/RenownUserButton.d.ts.map +1 -0
  94. package/dist/src/renown/components/icons.d.ts +20 -0
  95. package/dist/src/renown/components/icons.d.ts.map +1 -0
  96. package/dist/src/renown/components/index.d.ts +8 -0
  97. package/dist/src/renown/components/index.d.ts.map +1 -0
  98. package/dist/src/renown/components/slot.d.ts +8 -0
  99. package/dist/src/renown/components/slot.d.ts.map +1 -0
  100. package/dist/src/renown/index.d.ts +4 -0
  101. package/dist/src/renown/index.d.ts.map +1 -1
  102. package/dist/src/renown/renown-init.d.ts +22 -0
  103. package/dist/src/renown/renown-init.d.ts.map +1 -0
  104. package/dist/src/renown/use-renown-auth.d.ts +17 -0
  105. package/dist/src/renown/use-renown-auth.d.ts.map +1 -0
  106. package/dist/src/renown/use-renown-init.d.ts +25 -0
  107. package/dist/src/renown/use-renown-init.d.ts.map +1 -0
  108. package/dist/src/renown/utils.d.ts +9 -4
  109. package/dist/src/renown/utils.d.ts.map +1 -1
  110. package/dist/src/storage/base-storage.d.ts +9 -0
  111. package/dist/src/storage/base-storage.d.ts.map +1 -0
  112. package/dist/src/storage/local-storage.d.ts +5 -0
  113. package/dist/src/storage/local-storage.d.ts.map +1 -0
  114. package/dist/src/types/global.d.ts +7 -17
  115. package/dist/src/types/global.d.ts.map +1 -1
  116. package/dist/src/types/vetra.d.ts +22 -4
  117. package/dist/src/types/vetra.d.ts.map +1 -1
  118. package/dist/src/utils/drive-url.d.ts +2 -0
  119. package/dist/src/utils/drive-url.d.ts.map +1 -0
  120. package/dist/src/utils/drives.d.ts +5 -35
  121. package/dist/src/utils/drives.d.ts.map +1 -1
  122. package/dist/src/utils/index.d.ts +1 -0
  123. package/dist/src/utils/index.d.ts.map +1 -1
  124. package/dist/src/utils/vetra.d.ts.map +1 -1
  125. package/dist/test/remote-controller/action-tracker.test.d.ts +2 -0
  126. package/dist/test/remote-controller/action-tracker.test.d.ts.map +1 -0
  127. package/dist/test/remote-controller/remote-client.test.d.ts +2 -0
  128. package/dist/test/remote-controller/remote-client.test.d.ts.map +1 -0
  129. package/dist/test/remote-controller/remote-controller.test.d.ts +2 -0
  130. package/dist/test/remote-controller/remote-controller.test.d.ts.map +1 -0
  131. package/dist/test/remote-controller/utils.test.d.ts +2 -0
  132. package/dist/test/remote-controller/utils.test.d.ts.map +1 -0
  133. package/dist/test/renown/components.test.d.ts +2 -0
  134. package/dist/test/renown/components.test.d.ts.map +1 -0
  135. package/dist/test/renown/script.node.test.d.ts +2 -0
  136. package/dist/test/renown/script.node.test.d.ts.map +1 -0
  137. package/dist/tsconfig.tsbuildinfo +1 -1
  138. package/dist/vitest.config.d.ts.map +1 -1
  139. package/package.json +41 -43
  140. package/dist/src/actions/dispatch.js +0 -47
  141. package/dist/src/actions/dispatch.js.map +0 -1
  142. package/dist/src/actions/document.js +0 -659
  143. package/dist/src/actions/document.js.map +0 -1
  144. package/dist/src/actions/drive.js +0 -255
  145. package/dist/src/actions/drive.js.map +0 -1
  146. package/dist/src/actions/index.js +0 -4
  147. package/dist/src/actions/index.js.map +0 -1
  148. package/dist/src/actions/queue.js +0 -160
  149. package/dist/src/actions/queue.js.map +0 -1
  150. package/dist/src/actions/sign.js +0 -71
  151. package/dist/src/actions/sign.js.map +0 -1
  152. package/dist/src/analytics/context.js +0 -148
  153. package/dist/src/analytics/context.js.map +0 -1
  154. package/dist/src/analytics/hooks/analytics-query.js +0 -157
  155. package/dist/src/analytics/hooks/analytics-query.js.map +0 -1
  156. package/dist/src/analytics/hooks/document-timeline.js +0 -10
  157. package/dist/src/analytics/hooks/document-timeline.js.map +0 -1
  158. package/dist/src/analytics/hooks/index.js +0 -4
  159. package/dist/src/analytics/hooks/index.js.map +0 -1
  160. package/dist/src/analytics/hooks/timeline-items.js +0 -104
  161. package/dist/src/analytics/hooks/timeline-items.js.map +0 -1
  162. package/dist/src/analytics/index.js +0 -3
  163. package/dist/src/analytics/index.js.map +0 -1
  164. package/dist/src/analytics/store/browser.js +0 -2
  165. package/dist/src/analytics/store/browser.js.map +0 -1
  166. package/dist/src/analytics/store/memory.js +0 -2
  167. package/dist/src/analytics/store/memory.js.map +0 -1
  168. package/dist/src/analytics/types.js +0 -2
  169. package/dist/src/analytics/types.js.map +0 -1
  170. package/dist/src/analytics.js.map +0 -1
  171. package/dist/src/connect.js.map +0 -1
  172. package/dist/src/constants.js +0 -3
  173. package/dist/src/constants.js.map +0 -1
  174. package/dist/src/context/index.js +0 -2
  175. package/dist/src/context/index.js.map +0 -1
  176. package/dist/src/context/read-mode.js +0 -177
  177. package/dist/src/context/read-mode.js.map +0 -1
  178. package/dist/src/document-cache.js +0 -143
  179. package/dist/src/document-cache.js.map +0 -1
  180. package/dist/src/document-model.js +0 -6
  181. package/dist/src/document-model.js.map +0 -1
  182. package/dist/src/errors.js +0 -27
  183. package/dist/src/errors.js.map +0 -1
  184. package/dist/src/global/core.js +0 -22
  185. package/dist/src/global/core.js.map +0 -1
  186. package/dist/src/global/index.js +0 -2
  187. package/dist/src/global/index.js.map +0 -1
  188. package/dist/src/global/types.js +0 -2
  189. package/dist/src/global/types.js.map +0 -1
  190. package/dist/src/hooks/add-ph-event-handlers.js +0 -109
  191. package/dist/src/hooks/add-ph-event-handlers.js.map +0 -1
  192. package/dist/src/hooks/allowed-document-model-modules.js +0 -10
  193. package/dist/src/hooks/allowed-document-model-modules.js.map +0 -1
  194. package/dist/src/hooks/child-nodes.js +0 -15
  195. package/dist/src/hooks/child-nodes.js.map +0 -1
  196. package/dist/src/hooks/config/connect.js +0 -210
  197. package/dist/src/hooks/config/connect.js.map +0 -1
  198. package/dist/src/hooks/config/editor.js +0 -43
  199. package/dist/src/hooks/config/editor.js.map +0 -1
  200. package/dist/src/hooks/config/set-config-by-key.js +0 -15
  201. package/dist/src/hooks/config/set-config-by-key.js.map +0 -1
  202. package/dist/src/hooks/config/set-config-by-object.js +0 -84
  203. package/dist/src/hooks/config/set-config-by-object.js.map +0 -1
  204. package/dist/src/hooks/config/use-value-by-key.js +0 -23
  205. package/dist/src/hooks/config/use-value-by-key.js.map +0 -1
  206. package/dist/src/hooks/config/utils.js +0 -6
  207. package/dist/src/hooks/config/utils.js.map +0 -1
  208. package/dist/src/hooks/connect.js +0 -16
  209. package/dist/src/hooks/connect.js.map +0 -1
  210. package/dist/src/hooks/crypto.d.ts +0 -9
  211. package/dist/src/hooks/crypto.d.ts.map +0 -1
  212. package/dist/src/hooks/crypto.js +0 -13
  213. package/dist/src/hooks/crypto.js.map +0 -1
  214. package/dist/src/hooks/did.d.ts +0 -2
  215. package/dist/src/hooks/did.d.ts.map +0 -1
  216. package/dist/src/hooks/did.js +0 -3
  217. package/dist/src/hooks/did.js.map +0 -1
  218. package/dist/src/hooks/dispatch.js +0 -20
  219. package/dist/src/hooks/dispatch.js.map +0 -1
  220. package/dist/src/hooks/document-by-id.js +0 -13
  221. package/dist/src/hooks/document-by-id.js.map +0 -1
  222. package/dist/src/hooks/document-cache.js +0 -124
  223. package/dist/src/hooks/document-cache.js.map +0 -1
  224. package/dist/src/hooks/document-model-modules.js +0 -10
  225. package/dist/src/hooks/document-model-modules.js.map +0 -1
  226. package/dist/src/hooks/document-of-type.js +0 -22
  227. package/dist/src/hooks/document-of-type.js.map +0 -1
  228. package/dist/src/hooks/document-types.js +0 -13
  229. package/dist/src/hooks/document-types.js.map +0 -1
  230. package/dist/src/hooks/drive-by-id.js +0 -12
  231. package/dist/src/hooks/drive-by-id.js.map +0 -1
  232. package/dist/src/hooks/drives.js +0 -9
  233. package/dist/src/hooks/drives.js.map +0 -1
  234. package/dist/src/hooks/editor-modules.js +0 -43
  235. package/dist/src/hooks/editor-modules.js.map +0 -1
  236. package/dist/src/hooks/features.js +0 -6
  237. package/dist/src/hooks/features.js.map +0 -1
  238. package/dist/src/hooks/folder-by-id.js +0 -6
  239. package/dist/src/hooks/folder-by-id.js.map +0 -1
  240. package/dist/src/hooks/import-script-modules.js +0 -6
  241. package/dist/src/hooks/import-script-modules.js.map +0 -1
  242. package/dist/src/hooks/index.js +0 -41
  243. package/dist/src/hooks/index.js.map +0 -1
  244. package/dist/src/hooks/items-in-selected-drive.js +0 -35
  245. package/dist/src/hooks/items-in-selected-drive.js.map +0 -1
  246. package/dist/src/hooks/items-in-selected-folder.js +0 -33
  247. package/dist/src/hooks/items-in-selected-folder.js.map +0 -1
  248. package/dist/src/hooks/loading.js +0 -3
  249. package/dist/src/hooks/loading.js.map +0 -1
  250. package/dist/src/hooks/login-status.d.ts +0 -2
  251. package/dist/src/hooks/login-status.d.ts.map +0 -1
  252. package/dist/src/hooks/login-status.js +0 -3
  253. package/dist/src/hooks/login-status.js.map +0 -1
  254. package/dist/src/hooks/make-ph-event-functions.js +0 -46
  255. package/dist/src/hooks/make-ph-event-functions.js.map +0 -1
  256. package/dist/src/hooks/modals.js +0 -26
  257. package/dist/src/hooks/modals.js.map +0 -1
  258. package/dist/src/hooks/node-actions.js +0 -97
  259. package/dist/src/hooks/node-actions.js.map +0 -1
  260. package/dist/src/hooks/node-by-id.js +0 -7
  261. package/dist/src/hooks/node-by-id.js.map +0 -1
  262. package/dist/src/hooks/node-path.js +0 -23
  263. package/dist/src/hooks/node-path.js.map +0 -1
  264. package/dist/src/hooks/parent-folder.js +0 -13
  265. package/dist/src/hooks/parent-folder.js.map +0 -1
  266. package/dist/src/hooks/processor-manager.d.ts +0 -9
  267. package/dist/src/hooks/processor-manager.d.ts.map +0 -1
  268. package/dist/src/hooks/processor-manager.js +0 -9
  269. package/dist/src/hooks/processor-manager.js.map +0 -1
  270. package/dist/src/hooks/processor-modules.d.ts +0 -4
  271. package/dist/src/hooks/processor-modules.d.ts.map +0 -1
  272. package/dist/src/hooks/processor-modules.js +0 -12
  273. package/dist/src/hooks/processor-modules.js.map +0 -1
  274. package/dist/src/hooks/reactor.js +0 -44
  275. package/dist/src/hooks/reactor.js.map +0 -1
  276. package/dist/src/hooks/renown.js +0 -9
  277. package/dist/src/hooks/renown.js.map +0 -1
  278. package/dist/src/hooks/revision-history.js +0 -17
  279. package/dist/src/hooks/revision-history.js.map +0 -1
  280. package/dist/src/hooks/selected-document.js +0 -35
  281. package/dist/src/hooks/selected-document.js.map +0 -1
  282. package/dist/src/hooks/selected-drive.js +0 -63
  283. package/dist/src/hooks/selected-drive.js.map +0 -1
  284. package/dist/src/hooks/selected-folder.js +0 -10
  285. package/dist/src/hooks/selected-folder.js.map +0 -1
  286. package/dist/src/hooks/selected-node.js +0 -54
  287. package/dist/src/hooks/selected-node.js.map +0 -1
  288. package/dist/src/hooks/selected-timeline-item.js +0 -9
  289. package/dist/src/hooks/selected-timeline-item.js.map +0 -1
  290. package/dist/src/hooks/subgraph-modules.js +0 -6
  291. package/dist/src/hooks/subgraph-modules.js.map +0 -1
  292. package/dist/src/hooks/supported-document-types.js +0 -7
  293. package/dist/src/hooks/supported-document-types.js.map +0 -1
  294. package/dist/src/hooks/timeline-revision.js +0 -9
  295. package/dist/src/hooks/timeline-revision.js.map +0 -1
  296. package/dist/src/hooks/toast.js +0 -9
  297. package/dist/src/hooks/toast.js.map +0 -1
  298. package/dist/src/hooks/use-feature-flags.js +0 -73
  299. package/dist/src/hooks/use-feature-flags.js.map +0 -1
  300. package/dist/src/hooks/use-get-switchboard-link.js +0 -38
  301. package/dist/src/hooks/use-get-switchboard-link.js.map +0 -1
  302. package/dist/src/hooks/use-on-drop-file.js +0 -21
  303. package/dist/src/hooks/use-on-drop-file.js.map +0 -1
  304. package/dist/src/hooks/user-permissions.js +0 -17
  305. package/dist/src/hooks/user-permissions.js.map +0 -1
  306. package/dist/src/hooks/user.d.ts +0 -8
  307. package/dist/src/hooks/user.d.ts.map +0 -1
  308. package/dist/src/hooks/user.js +0 -9
  309. package/dist/src/hooks/user.js.map +0 -1
  310. package/dist/src/hooks/vetra-packages.js +0 -17
  311. package/dist/src/hooks/vetra-packages.js.map +0 -1
  312. package/dist/src/index.js.map +0 -1
  313. package/dist/src/pglite/drop.js +0 -19
  314. package/dist/src/pglite/drop.js.map +0 -1
  315. package/dist/src/pglite/hooks/index.js +0 -2
  316. package/dist/src/pglite/hooks/index.js.map +0 -1
  317. package/dist/src/pglite/hooks/usePGlite.js +0 -37
  318. package/dist/src/pglite/hooks/usePGlite.js.map +0 -1
  319. package/dist/src/pglite/index.js +0 -3
  320. package/dist/src/pglite/index.js.map +0 -1
  321. package/dist/src/reactor-client-document-cache.js +0 -142
  322. package/dist/src/reactor-client-document-cache.js.map +0 -1
  323. package/dist/src/reactor.js +0 -162
  324. package/dist/src/reactor.js.map +0 -1
  325. package/dist/src/relational/hooks/index.js +0 -3
  326. package/dist/src/relational/hooks/index.js.map +0 -1
  327. package/dist/src/relational/hooks/useRelationalDb.js +0 -36
  328. package/dist/src/relational/hooks/useRelationalDb.js.map +0 -1
  329. package/dist/src/relational/hooks/useRelationalQuery.js +0 -76
  330. package/dist/src/relational/hooks/useRelationalQuery.js.map +0 -1
  331. package/dist/src/relational/index.js +0 -3
  332. package/dist/src/relational/index.js.map +0 -1
  333. package/dist/src/relational/utils/createProcessorQuery.js +0 -24
  334. package/dist/src/relational/utils/createProcessorQuery.js.map +0 -1
  335. package/dist/src/relational/utils/index.js +0 -2
  336. package/dist/src/relational/utils/index.js.map +0 -1
  337. package/dist/src/renown/constants.js +0 -40
  338. package/dist/src/renown/constants.js.map +0 -1
  339. package/dist/src/renown/index.js +0 -3
  340. package/dist/src/renown/index.js.map +0 -1
  341. package/dist/src/renown/utils.js +0 -56
  342. package/dist/src/renown/utils.js.map +0 -1
  343. package/dist/src/storage/index.js +0 -2
  344. package/dist/src/storage/index.js.map +0 -1
  345. package/dist/src/storage/types.js +0 -2
  346. package/dist/src/storage/types.js.map +0 -1
  347. package/dist/src/types/config.js +0 -2
  348. package/dist/src/types/config.js.map +0 -1
  349. package/dist/src/types/documents.js +0 -2
  350. package/dist/src/types/documents.js.map +0 -1
  351. package/dist/src/types/global.js +0 -2
  352. package/dist/src/types/global.js.map +0 -1
  353. package/dist/src/types/index.js +0 -2
  354. package/dist/src/types/index.js.map +0 -1
  355. package/dist/src/types/modals.js +0 -2
  356. package/dist/src/types/modals.js.map +0 -1
  357. package/dist/src/types/reactor.js +0 -2
  358. package/dist/src/types/reactor.js.map +0 -1
  359. package/dist/src/types/timeline.js +0 -2
  360. package/dist/src/types/timeline.js.map +0 -1
  361. package/dist/src/types/toast.js +0 -2
  362. package/dist/src/types/toast.js.map +0 -1
  363. package/dist/src/types/upload.js +0 -2
  364. package/dist/src/types/upload.js.map +0 -1
  365. package/dist/src/types/vetra.js +0 -2
  366. package/dist/src/types/vetra.js.map +0 -1
  367. package/dist/src/utils/documents.js +0 -20
  368. package/dist/src/utils/documents.js.map +0 -1
  369. package/dist/src/utils/drives.js +0 -142
  370. package/dist/src/utils/drives.js.map +0 -1
  371. package/dist/src/utils/export-document.js +0 -18
  372. package/dist/src/utils/export-document.js.map +0 -1
  373. package/dist/src/utils/get-revision-from-date.js +0 -10
  374. package/dist/src/utils/get-revision-from-date.js.map +0 -1
  375. package/dist/src/utils/index.js +0 -11
  376. package/dist/src/utils/index.js.map +0 -1
  377. package/dist/src/utils/nodes.js +0 -17
  378. package/dist/src/utils/nodes.js.map +0 -1
  379. package/dist/src/utils/switchboard.js +0 -76
  380. package/dist/src/utils/switchboard.js.map +0 -1
  381. package/dist/src/utils/url.js +0 -77
  382. package/dist/src/utils/url.js.map +0 -1
  383. package/dist/src/utils/user.js +0 -15
  384. package/dist/src/utils/user.js.map +0 -1
  385. package/dist/src/utils/validate-document.js +0 -38
  386. package/dist/src/utils/validate-document.js.map +0 -1
  387. package/dist/src/utils/vetra.js +0 -86
  388. package/dist/src/utils/vetra.js.map +0 -1
  389. package/dist/test/analytics.test.js +0 -263
  390. package/dist/test/analytics.test.js.map +0 -1
  391. package/dist/test/document-cache.test.js +0 -457
  392. package/dist/test/document-cache.test.js.map +0 -1
  393. package/dist/test/drop.test.js +0 -86
  394. package/dist/test/drop.test.js.map +0 -1
  395. package/dist/test/getSwitchboardUrl.test.js +0 -107
  396. package/dist/test/getSwitchboardUrl.test.js.map +0 -1
  397. package/dist/test/hooks/document-cache.test.js +0 -642
  398. package/dist/test/hooks/document-cache.test.js.map +0 -1
  399. package/dist/test/reactor.test.js +0 -26
  400. package/dist/test/reactor.test.js.map +0 -1
  401. package/dist/test/switchboard.test.js +0 -27
  402. package/dist/test/switchboard.test.js.map +0 -1
  403. package/dist/vitest.config.js +0 -24
  404. package/dist/vitest.config.js.map +0 -1
@@ -0,0 +1,32 @@
1
+ import type { IDocumentModelLoader, IDocumentModelRegistry } from "@powerhousedao/reactor";
2
+ import type { DocumentModelModule } from "document-model";
3
+ import type { IPackageListerUnsubscribe, IPackageManager, IPackagesListener, VetraPackage } from "./types/vetra.js";
4
+ export interface PendingInstallation {
5
+ documentType: string;
6
+ packageName: string;
7
+ }
8
+ export interface DismissedPackage {
9
+ packageName: string;
10
+ documentTypes: string[];
11
+ }
12
+ export type PendingInstallationsListener = () => void;
13
+ export declare class BrowserPackageManager implements IPackageManager, IDocumentModelLoader {
14
+ #private;
15
+ constructor(namespace: string, registryCdnUrl?: string);
16
+ init(): Promise<void>;
17
+ get packages(): VetraPackage[];
18
+ get localPackageIds(): Set<string>;
19
+ addPackage(name: string, registryUrl: string): Promise<void>;
20
+ addLocalPackage(name: string, localPackage: VetraPackage): Promise<void>;
21
+ removePackage(name: string): Promise<void>;
22
+ subscribe(handler: IPackagesListener): IPackageListerUnsubscribe;
23
+ setDocumentModelRegistry(registry: IDocumentModelRegistry): void;
24
+ load(documentType: string): Promise<DocumentModelModule<any>>;
25
+ approveInstallation(packageName: string): Promise<void>;
26
+ rejectInstallation(packageName: string): void;
27
+ subscribePendingChanges(listener: PendingInstallationsListener): () => void;
28
+ getPendingInstallations(): PendingInstallation[];
29
+ getDismissedPackages(): DismissedPackage[];
30
+ removeDismissed(packageName: string): void;
31
+ }
32
+ //# sourceMappingURL=package-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/package-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAoB,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG5E,OAAO,KAAK,EACV,yBAAyB,EACzB,eAAe,EACf,iBAAiB,EAEjB,YAAY,EACb,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,MAAM,4BAA4B,GAAG,MAAM,IAAI,CAAC;AA+DtD,qBAAa,qBACX,YAAW,eAAe,EAAE,oBAAoB;;gBAiBpC,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IAgBhD,IAAI;IAWV,IAAI,QAAQ,mBAEX;IAED,IAAI,eAAe,IAAI,GAAG,CAAC,MAAM,CAAC,CAEjC;IAEK,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAe5C,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY;IAMxD,aAAa,CAAC,IAAI,EAAE,MAAM;IAShC,SAAS,CAAC,OAAO,EAAE,iBAAiB,GAAG,yBAAyB;IAiBhE,wBAAwB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,IAAI;IAI1D,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IA0B7D,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA8C7D,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAiB7C,uBAAuB,CAAC,QAAQ,EAAE,4BAA4B,GAAG,MAAM,IAAI;IAO3E,uBAAuB,IAAI,mBAAmB,EAAE;IAIhD,oBAAoB,IAAI,gBAAgB,EAAE;IAI1C,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;CA6B3C"}
@@ -1,3 +1,4 @@
1
1
  import type { PGlite } from "@electric-sql/pglite";
2
2
  export declare function dropAllTables(pg: PGlite, schema?: string): Promise<void>;
3
+ export declare function dropAllReactorStorage(pg: PGlite): Promise<void>;
3
4
  //# sourceMappingURL=drop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../../src/pglite/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGnD,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,MAAuB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAgBf"}
1
+ {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../../src/pglite/drop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAqBnD,wBAAsB,aAAa,CACjC,EAAE,EAAE,MAAM,EACV,MAAM,GAAE,MAAuB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrE"}
@@ -1,3 +1,3 @@
1
- export { dropAllTables as truncateAllTables } from "./drop.js";
1
+ export { dropAllTables as truncateAllTables, dropAllReactorStorage, } from "./drop.js";
2
2
  export * from "./hooks/index.js";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pglite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC/D,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pglite/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,iBAAiB,EAClC,qBAAqB,GACtB,MAAM,WAAW,CAAC;AACnB,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ChannelScheme, ConsoleLogger, DocumentChangeType, DocumentIntegrityService, driveCollectionId, GqlRequestChannel, InMemoryQueue, IntervalPollTimer, REACTOR_SCHEMA, ReactorBuilder, ReactorClientBuilder, RelationalDbProcessor, SyncOperationStatus, } from "@powerhousedao/reactor";
2
+ export type { ConnectionState, ConnectionStateSnapshot, Database, IChannel, IDocumentModelLoader, IProcessor, IProcessorHostModule, IRelationalDb, Job, JwtHandler, KeyframeValidationIssue, OperationWithContext, ProcessorFactory, ProcessorFilter, ProcessorRecord, RebuildResult, Remote, SignerConfig, SnapshotValidationIssue, SyncOperation, ValidationResult, } from "@powerhousedao/reactor";
3
+ //# sourceMappingURL=re-exports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"re-exports.d.ts","sourceRoot":"","sources":["../../src/re-exports.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,eAAe,EACf,uBAAuB,EACvB,QAAQ,EACR,QAAQ,EACR,oBAAoB,EACpB,UAAU,EACV,oBAAoB,EACpB,aAAa,EACb,GAAG,EACH,UAAU,EACV,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,aAAa,EACb,MAAM,EACN,YAAY,EACZ,uBAAuB,EACvB,aAAa,EACb,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
@@ -6,8 +6,6 @@ import type { IDocumentCache } from "./types/documents.js";
6
6
  *
7
7
  * This cache subscribes to document change events via IReactorClient.subscribe()
8
8
  * and automatically updates the cache when documents are created, updated, or deleted.
9
- *
10
- * Use this implementation when FEATURE_LEGACY_READ_ENABLED is false.
11
9
  */
12
10
  export declare class ReactorClientDocumentCache implements IDocumentCache {
13
11
  private client;
@@ -1 +1 @@
1
- {"version":3,"file":"reactor-client-document-cache.d.ts","sourceRoot":"","sources":["../../src/reactor-client-document-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAChC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AE5B,MAAM,EAAE,cAAc;IAM1C,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,qBAAqB;YAUf,qBAAqB;IAUnC,OAAO,CAAC,2BAA2B;IAQnC,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;IAgBvD,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IA2D9C,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAiBlE;;OAEG;IACH,OAAO,IAAI,IAAI;CAMhB"}
@@ -1,7 +1,6 @@
1
1
  import type { IReactorClient } from "@powerhousedao/reactor";
2
- import type { IConnectCrypto, IRenown } from "@renown/sdk";
3
- import { ConnectCrypto } from "@renown/sdk";
4
- import type { DocumentDriveDocument, DocumentDriveServerOptions, IDocumentDriveServer } from "document-drive";
2
+ import type { IRenown } from "@renown/sdk";
3
+ import { type DocumentDriveServerOptions, type IDocumentDriveServer } from "document-drive";
5
4
  export type ReactorDefaultDrivesConfig = {
6
5
  defaultDrivesUrl?: string[];
7
6
  };
@@ -10,9 +9,19 @@ export type RefreshReactorDataConfig = {
10
9
  debounceDelayMs?: number;
11
10
  immediateThresholdMs?: number;
12
11
  };
13
- export declare const refreshReactorData: (reactor: IDocumentDriveServer | undefined, immediate?: boolean) => Promise<void>;
12
+ export declare const refreshReactorData: (reactor: IReactorClient, immediate?: boolean) => Promise<void>;
14
13
  export declare const refreshReactorDataClient: (reactor: IReactorClient | undefined, immediate?: boolean) => Promise<void>;
15
- export declare function initLegacyReactor(legacyReactor: IDocumentDriveServer, renown: IRenown | undefined, connectCrypto: IConnectCrypto | undefined): Promise<void>;
16
- export declare function handleCreateFirstLocalDrive(reactor: IDocumentDriveServer | undefined, localDrivesEnabled?: boolean): Promise<DocumentDriveDocument | undefined>;
17
- export declare function initConnectCrypto(): Promise<ConnectCrypto>;
14
+ export declare function initLegacyReactor(legacyReactor: IDocumentDriveServer, renown: IRenown | undefined): Promise<void>;
15
+ /**
16
+ * @deprecated Use {@link initRenownCrypto} instead
17
+ *
18
+ * Initialize ConnectCrypto
19
+ * @returns ConnectCrypto instance
20
+ */
21
+ export declare function initConnectCrypto(): Promise<import("@renown/sdk").RenownCrypto>;
22
+ /**
23
+ * Initialize RenownCrypto
24
+ * @returns RenownCrypto instance
25
+ */
26
+ export declare function initRenownCrypto(): Promise<import("@renown/sdk").RenownCrypto>;
18
27
  //# sourceMappingURL=reactor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reactor.d.ts","sourceRoot":"","sources":["../../src/reactor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAEV,qBAAqB,EACrB,0BAA0B,EAC1B,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AAKxB,MAAM,MAAM,0BAA0B,GAAG;IACvC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,SAAQ,0BAA+B,KACtC,IAAI,CAAC,0BAA0B,EAAE,eAAe,CA6ClD,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAkFF,eAAO,MAAM,kBAAkB,YAzDZ,oBAAoB,GAAG,SAAS,uCAyDkB,CAAC;AACtE,eAAO,MAAM,wBAAwB,YA1BlB,cAAc,GAAG,SAAS,uCA2BF,CAAC;AAE5C,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,oBAAoB,EACnC,MAAM,EAAE,OAAO,GAAG,SAAS,EAC3B,aAAa,EAAE,cAAc,GAAG,SAAS,iBAQ1C;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,oBAAoB,GAAG,SAAS,EACzC,kBAAkB,UAAO,8CAyB1B;AAsBD,wBAAsB,iBAAiB,2BAItC"}
1
+ {"version":3,"file":"reactor.d.ts","sourceRoot":"","sources":["../../src/reactor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EAC1B,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,0BAA0B,GAAG;IACvC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,6BAA6B,GACxC,SAAQ,0BAA+B,KACtC,IAAI,CAAC,0BAA0B,EAAE,eAAe,CA6ClD,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAkFF,eAAO,MAAM,kBAAkB,YAzDZ,cAAc,uCAyDoC,CAAC;AACtE,eAAO,MAAM,wBAAwB,YA1BlB,cAAc,GAAG,SAAS,uCA2BF,CAAC;AAE5C,wBAAsB,iBAAiB,CACrC,aAAa,EAAE,oBAAoB,EACnC,MAAM,EAAE,OAAO,GAAG,SAAS,iBAQ5B;AAmBD;;;;;GAKG;AACH,wBAAsB,iBAAiB,gDAEtC;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,gDAGrC"}
@@ -0,0 +1,9 @@
1
+ import type { RegistryPackageInfo } from "./types.js";
2
+ export declare class RegistryClient {
3
+ readonly apiUrl: string;
4
+ constructor(cdnUrl: string);
5
+ getPackages(): Promise<RegistryPackageInfo[]>;
6
+ getPackagesByDocumentType(documentType: string): Promise<string[]>;
7
+ searchPackages(query: string): Promise<RegistryPackageInfo[]>;
8
+ }
9
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/registry/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AA8BtD,qBAAa,cAAc;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;IAIpB,WAAW,IAAI,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAO7C,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASlE,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;CAUpE"}
@@ -0,0 +1,3 @@
1
+ export { RegistryClient } from "./client.js";
2
+ export type { RegistryPackageInfo } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ export interface RegistryPackageInfo {
2
+ name: string;
3
+ description?: string;
4
+ version?: string;
5
+ category?: string;
6
+ publisher?: string;
7
+ publisherUrl?: string;
8
+ }
9
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/registry/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB"}
@@ -1,12 +1,13 @@
1
1
  import type { LiveNamespace } from "@electric-sql/pglite/live";
2
- import type { IRelationalDb as _IRelationalDb } from "document-drive";
2
+ import type { IRelationalDbLegacy as _IRelationalDb } from "document-drive";
3
3
  export type RelationalDbWithLive<Schema> = _IRelationalDb<Schema> & {
4
4
  live: LiveNamespace;
5
5
  };
6
- export interface IRelationalDb<Schema> {
6
+ interface IRelationalDb<Schema> {
7
7
  db: RelationalDbWithLive<Schema> | null;
8
8
  isLoading: boolean;
9
9
  error: Error | null;
10
10
  }
11
11
  export declare const useRelationalDb: <Schema>() => IRelationalDb<Schema>;
12
+ export {};
12
13
  //# sourceMappingURL=useRelationalDb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useRelationalDb.d.ts","sourceRoot":"","sources":["../../../../src/relational/hooks/useRelationalDb.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,aAAa,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQtE,MAAM,MAAM,oBAAoB,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG;IAClE,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,aAAa,CAAC,MAAM;IACnC,EAAE,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAkBD,eAAO,MAAM,eAAe,GAAI,MAAM,4BAsBrC,CAAC"}
1
+ {"version":3,"file":"useRelationalDb.d.ts","sourceRoot":"","sources":["../../../../src/relational/hooks/useRelationalDb.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,2BAA2B,CAAC;AAC/E,OAAO,KAAK,EAAE,mBAAmB,IAAI,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAQ5E,MAAM,MAAM,oBAAoB,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC,GAAG;IAClE,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF,UAAU,aAAa,CAAC,MAAM;IAC5B,EAAE,EAAE,oBAAoB,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACxC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAkBD,eAAO,MAAM,eAAe,GAAI,MAAM,4BAsBrC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { LiveQueryResults } from "@electric-sql/pglite/live";
2
- import type { IRelationalQueryBuilder, RelationalDbProcessorClass } from "document-drive";
2
+ import type { IRelationalQueryBuilderLegacy, RelationalDbProcessorClassLegacy } from "document-drive";
3
3
  export type QueryCallbackReturnType = {
4
4
  sql: string;
5
5
  parameters?: readonly unknown[];
@@ -7,7 +7,7 @@ export type QueryCallbackReturnType = {
7
7
  export type useRelationalQueryOptions = {
8
8
  hashNamespace?: boolean;
9
9
  };
10
- export declare function useRelationalQuery<Schema, T = unknown, TParams = undefined>(ProcessorClass: RelationalDbProcessorClass<Schema>, driveId: string, queryCallback: (db: IRelationalQueryBuilder<Schema>, parameters?: TParams) => QueryCallbackReturnType, parameters?: TParams, options?: useRelationalQueryOptions): {
10
+ export declare function useRelationalQuery<Schema, T = unknown, TParams = undefined>(ProcessorClass: RelationalDbProcessorClassLegacy<Schema>, driveId: string, queryCallback: (db: IRelationalQueryBuilderLegacy<Schema>, parameters?: TParams) => QueryCallbackReturnType, parameters?: TParams, options?: useRelationalQueryOptions): {
11
11
  readonly isLoading: boolean;
12
12
  readonly error: Error | null;
13
13
  readonly result: LiveQueryResults<T> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"useRelationalQuery.d.ts","sourceRoot":"","sources":["../../../../src/relational/hooks/useRelationalQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IAEtC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAuBF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,SAAS,EACzE,cAAc,EAAE,0BAA0B,CAAC,MAAM,CAAC,EAClD,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,CACb,EAAE,EAAE,uBAAuB,CAAC,MAAM,CAAC,EACnC,UAAU,CAAC,EAAE,OAAO,KACjB,uBAAuB,EAC5B,UAAU,CAAC,EAAE,OAAO,EACpB,OAAO,CAAC,EAAE,yBAAyB;;;;EAiFpC"}
1
+ {"version":3,"file":"useRelationalQuery.d.ts","sourceRoot":"","sources":["../../../../src/relational/hooks/useRelationalQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EACV,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,gBAAgB,CAAC;AAIxB,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IAEtC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAuBF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,CAAC,GAAG,OAAO,EAAE,OAAO,GAAG,SAAS,EACzE,cAAc,EAAE,gCAAgC,CAAC,MAAM,CAAC,EACxD,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,CACb,EAAE,EAAE,6BAA6B,CAAC,MAAM,CAAC,EACzC,UAAU,CAAC,EAAE,OAAO,KACjB,uBAAuB,EAC5B,UAAU,CAAC,EAAE,OAAO,EACpB,OAAO,CAAC,EAAE,yBAAyB;;;;EAiFpC"}
@@ -1,14 +1,14 @@
1
1
  import type { LiveQueryResults } from "@electric-sql/pglite/live";
2
2
  import type { QueryCallbackReturnType, useRelationalQueryOptions } from "@powerhousedao/reactor-browser";
3
- import type { IRelationalQueryBuilder, RelationalDbProcessorClass } from "document-drive";
3
+ import type { IRelationalQueryBuilderLegacy, RelationalDbProcessorClassLegacy } from "document-drive";
4
4
  import type { CompiledQuery } from "kysely";
5
- export declare function createProcessorQuery<TSchema>(ProcessorClass: RelationalDbProcessorClass<TSchema>): {
6
- <TQueryBuilder extends (db: IRelationalQueryBuilder<TSchema>) => QueryCallbackReturnType>(driveId: string, queryCallback: TQueryBuilder): {
5
+ export declare function createProcessorQuery<TSchema>(ProcessorClass: RelationalDbProcessorClassLegacy<TSchema>): {
6
+ <TQueryBuilder extends (db: IRelationalQueryBuilderLegacy<TSchema>) => QueryCallbackReturnType>(driveId: string, queryCallback: TQueryBuilder): {
7
7
  isLoading: boolean;
8
8
  error: Error | null;
9
9
  result: LiveQueryResults<ReturnType<TQueryBuilder> extends CompiledQuery<infer R> ? R : any> | null;
10
10
  };
11
- <TParams, TQueryBuilder extends (db: IRelationalQueryBuilder<TSchema>, parameters: TParams) => QueryCallbackReturnType>(driveId: string, queryCallback: TQueryBuilder, parameters: TParams, options?: useRelationalQueryOptions): {
11
+ <TParams, TQueryBuilder extends (db: IRelationalQueryBuilderLegacy<TSchema>, parameters: TParams) => QueryCallbackReturnType>(driveId: string, queryCallback: TQueryBuilder, parameters: TParams, options?: useRelationalQueryOptions): {
12
12
  isLoading: boolean;
13
13
  error: Error | null;
14
14
  result: LiveQueryResults<ReturnType<TQueryBuilder> extends CompiledQuery<infer R> ? R : any> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"createProcessorQuery.d.ts","sourceRoot":"","sources":["../../../../src/relational/utils/createProcessorQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,uBAAuB,EACvB,0BAA0B,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAiB5C,wBAAgB,oBAAoB,CAAC,OAAO,EAC1C,cAAc,EAAE,0BAA0B,CAAC,OAAO,CAAC;KAIjD,aAAa,SAAS,CACpB,EAAE,EAAE,uBAAuB,CAAC,OAAO,CAAC,KACjC,uBAAuB,WAEnB,MAAM,iBACA,aAAa,GAC3B;QACD,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,EAAE,gBAAgB,CACtB,UAAU,CAAC,aAAa,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CACnE,GAAG,IAAI,CAAC;KACV;KAIC,OAAO,EACP,aAAa,SAAS,CACpB,EAAE,EAAE,uBAAuB,CAAC,OAAO,CAAC,EACpC,UAAU,EAAE,OAAO,KAChB,uBAAuB,WAEnB,MAAM,iBACA,aAAa,cAChB,OAAO,YACT,yBAAyB,GAClC;QACD,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,EAAE,gBAAgB,CACtB,UAAU,CAAC,aAAa,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CACnE,GAAG,IAAI,CAAC;KACV;EA2CF"}
1
+ {"version":3,"file":"createProcessorQuery.d.ts","sourceRoot":"","sources":["../../../../src/relational/utils/createProcessorQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,EACV,uBAAuB,EACvB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAiB5C,wBAAgB,oBAAoB,CAAC,OAAO,EAC1C,cAAc,EAAE,gCAAgC,CAAC,OAAO,CAAC;KAIvD,aAAa,SAAS,CACpB,EAAE,EAAE,6BAA6B,CAAC,OAAO,CAAC,KACvC,uBAAuB,WAEnB,MAAM,iBACA,aAAa,GAC3B;QACD,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,EAAE,gBAAgB,CACtB,UAAU,CAAC,aAAa,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CACnE,GAAG,IAAI,CAAC;KACV;KAIC,OAAO,EACP,aAAa,SAAS,CACpB,EAAE,EAAE,6BAA6B,CAAC,OAAO,CAAC,EAC1C,UAAU,EAAE,OAAO,KAChB,uBAAuB,WAEnB,MAAM,iBACA,aAAa,cAChB,OAAO,YACT,yBAAyB,GAClC;QACD,SAAS,EAAE,OAAO,CAAC;QACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,EAAE,gBAAgB,CACtB,UAAU,CAAC,aAAa,CAAC,SAAS,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CACnE,GAAG,IAAI,CAAC;KACV;EA2CF"}
@@ -0,0 +1,20 @@
1
+ import type { Action } from "document-model";
2
+ import type { TrackedAction } from "./types.js";
3
+ /**
4
+ * Tracks pending actions with their operation context (prevOpHash, prevOpIndex).
5
+ * Actions are accumulated until flushed (on push).
6
+ */
7
+ export declare class ActionTracker {
8
+ private pending;
9
+ /** Track a new action with its operation context. */
10
+ track(action: Action, prevOpHash: string, prevOpIndex: number): void;
11
+ /** Flush all pending actions and return them. Clears the internal queue. */
12
+ flush(): TrackedAction[];
13
+ /** Number of pending actions. */
14
+ get count(): number;
15
+ /** Prepend previously flushed actions back to the queue (for retry on failure). */
16
+ restore(actions: TrackedAction[]): void;
17
+ /** Clear all pending actions without returning them. */
18
+ clear(): void;
19
+ }
20
+ //# sourceMappingURL=action-tracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-tracker.d.ts","sourceRoot":"","sources":["../../../src/remote-controller/action-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,OAAO,CAAuB;IAEtC,qDAAqD;IACrD,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAIpE,4EAA4E;IAC5E,KAAK,IAAI,aAAa,EAAE;IAMxB,iCAAiC;IACjC,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,mFAAmF;IACnF,OAAO,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,IAAI;IAIvC,wDAAwD;IACxD,KAAK,IAAI,IAAI;CAGd"}
@@ -0,0 +1,7 @@
1
+ export { ActionTracker } from "./action-tracker.js";
2
+ export { RemoteClient } from "./remote-client.js";
3
+ export { RemoteDocumentController, type RemoteDocumentControllerWith, } from "./remote-controller.js";
4
+ export { PropagationMode } from "./types.js";
5
+ export type { ConflictInfo, ConflictStrategy, RemoteDocumentChangeEvent as DocumentChangeEvent, DocumentChangeListener, GetDocumentResult, GetDocumentWithOperationsResult, GetOperationsResult, IRemoteClient, IRemoteController, MergeHandler, PushResult, ReactorGraphQLClient, RemoteControllerOptions, RemoteDocumentData, RemoteOperation, RemoteOperationResultPage, SyncStatus, TrackedAction, } from "./types.js";
6
+ export { ConflictError, convertRemoteOperations } from "./utils.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/remote-controller/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,wBAAwB,EACxB,KAAK,4BAA4B,GAClC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,yBAAyB,IAAI,mBAAmB,EAChD,sBAAsB,EACtB,iBAAiB,EACjB,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,yBAAyB,EACzB,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { GetDocumentResult, GetDocumentWithOperationsResult, GetOperationsResult, IRemoteClient, PropagationMode, ReactorGraphQLClient, RemoteDocumentData } from "./types.js";
2
+ export declare class RemoteClient implements IRemoteClient {
3
+ private readonly client;
4
+ private readonly pageSize;
5
+ constructor(client: ReactorGraphQLClient, pageSize?: number);
6
+ /** Fetch a document by identifier. Returns null if not found. */
7
+ getDocument(identifier: string, branch?: string): Promise<GetDocumentResult | null>;
8
+ /**
9
+ * Fetch a document and its first page of operations in a single query.
10
+ * Returns null if the document is not found.
11
+ */
12
+ getDocumentWithOperations(identifier: string, branch?: string, operationsCursor?: string): Promise<GetDocumentWithOperationsResult | null>;
13
+ /**
14
+ * Fetch all operations for a document, paginating through all pages.
15
+ * Returns operations grouped by scope and the final cursor for incremental fetches.
16
+ *
17
+ * @param startCursor - If provided, resume fetching from this cursor position
18
+ * (for incremental pulls after the initial fetch).
19
+ */
20
+ getAllOperations(documentId: string, branch?: string, sinceRevision?: number, scopes?: string[], startCursor?: string): Promise<GetOperationsResult>;
21
+ /** Push actions to an existing document via MutateDocument. */
22
+ pushActions(documentIdentifier: string, actions: ReadonlyArray<NonNullable<unknown>>, branch?: string): Promise<RemoteDocumentData>;
23
+ /** Create a new document on the remote. */
24
+ createDocument(document: NonNullable<unknown>, parentIdentifier?: string): Promise<RemoteDocumentData>;
25
+ /** Create an empty document of a given type on the remote. */
26
+ createEmptyDocument(documentType: string, parentIdentifier?: string): Promise<RemoteDocumentData>;
27
+ /** Delete a document on the remote. Returns true if successful. */
28
+ deleteDocument(identifier: string, propagate?: PropagationMode): Promise<boolean>;
29
+ }
30
+ //# sourceMappingURL=remote-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-client.d.ts","sourceRoot":"","sources":["../../../src/remote-controller/remote-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAOpB,qBAAa,YAAa,YAAW,aAAa;IAI9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAHzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAGf,MAAM,EAAE,oBAAoB,EAC7C,QAAQ,CAAC,EAAE,MAAM;IAKnB,iEAAiE;IAC3D,WAAW,CACf,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAQpC;;;OAGG;IACG,yBAAyB,CAC7B,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,+BAA+B,GAAG,IAAI,CAAC;IAkClD;;;;;;OAMG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM,EACtB,MAAM,CAAC,EAAE,MAAM,EAAE,EACjB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC;IAoC/B,+DAA+D;IACzD,WAAW,CACf,kBAAkB,EAAE,MAAM,EAC1B,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAC5C,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,kBAAkB,CAAC;IAS9B,2CAA2C;IACrC,cAAc,CAClB,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,EAC9B,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,kBAAkB,CAAC;IAQ9B,8DAA8D;IACxD,mBAAmB,CACvB,YAAY,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,kBAAkB,CAAC;IAQ9B,mEAAmE;IAC7D,cAAc,CAClB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,eAAe,GAC1B,OAAO,CAAC,OAAO,CAAC;CAOpB"}
@@ -0,0 +1,108 @@
1
+ import type { DocumentOperations, PHDocument, PHDocumentController, PHDocumentHeader } from "document-model";
2
+ import type { DocumentChangeListener, IRemoteController, PropagationMode, PushResult, RemoteControllerOptions, RemoteDocumentData, SyncStatus } from "./types.js";
3
+ /** Extract TState from a PHDocumentController subclass. */
4
+ type InferState<C> = C extends PHDocumentController<infer S> ? S : never;
5
+ /**
6
+ * Extract action methods from a controller type.
7
+ * These are the dynamically-added methods (not on the base PHDocumentController prototype).
8
+ */
9
+ type ActionMethodsOf<C, TRemote> = {
10
+ [K in Exclude<keyof C, keyof PHDocumentController<any>>]: C[K] extends (input: infer I) => unknown ? (input: I) => TRemote & ActionMethodsOf<C, TRemote> : C[K];
11
+ };
12
+ /** The full return type: RemoteDocumentController + action methods. */
13
+ export type RemoteDocumentControllerWith<C extends PHDocumentController<any>> = RemoteDocumentController<C> & ActionMethodsOf<C, RemoteDocumentController<C>>;
14
+ /**
15
+ * A controller that wraps a PHDocumentController with remote push/pull capabilities.
16
+ * Composes a local controller and adds GraphQL-based sync with a reactor server.
17
+ */
18
+ export declare class RemoteDocumentController<TController extends PHDocumentController<any>> implements IRemoteController<InferState<TController>> {
19
+ private inner;
20
+ private readonly remoteClient;
21
+ private readonly tracker;
22
+ private readonly options;
23
+ private documentId;
24
+ private remoteRevision;
25
+ private lastCursor;
26
+ private pushScheduled;
27
+ private pushQueue;
28
+ private listeners;
29
+ private constructor();
30
+ get header(): PHDocumentHeader;
31
+ get state(): InferState<TController>;
32
+ get operations(): DocumentOperations;
33
+ get document(): PHDocument<InferState<TController>>;
34
+ get status(): SyncStatus;
35
+ /** Register a listener for document changes. Returns an unsubscribe function. */
36
+ onChange(listener: DocumentChangeListener): () => void;
37
+ private notifyListeners;
38
+ /** Push all pending actions to remote, then pull latest state. */
39
+ push(): Promise<PushResult>;
40
+ /** Delete the document on the remote. */
41
+ delete(propagate?: PropagationMode): Promise<boolean>;
42
+ /** Pull latest state from remote, replacing local document. Returns the remote document data. */
43
+ pull(): Promise<RemoteDocumentData>;
44
+ /**
45
+ * Pull an existing document from remote and create a controller for it.
46
+ */
47
+ static pull<C extends PHDocumentController<any>>(ControllerClass: new (doc?: PHDocument<any>) => C, options: RemoteControllerOptions): Promise<RemoteDocumentControllerWith<C>>;
48
+ /**
49
+ * Wrap an existing controller instance with remote capabilities.
50
+ * Pending local actions on the inner controller are NOT tracked
51
+ * (only new actions through the remote controller are tracked).
52
+ */
53
+ static from<C extends PHDocumentController<any>>(controller: C, options: RemoteControllerOptions): RemoteDocumentControllerWith<C>;
54
+ /** Create the document on the remote if it doesn't exist yet. */
55
+ private ensureRemoteDocument;
56
+ /** Set up interceptors for all action methods on the inner controller. */
57
+ private setupActionInterceptors;
58
+ /**
59
+ * Find the new operation added after applying an action,
60
+ * by comparing current operation counts against a previous snapshot.
61
+ */
62
+ private findNewOperation;
63
+ /**
64
+ * Get the last operation in a specific scope, optionally excluding
65
+ * a given operation (e.g. the one just added).
66
+ */
67
+ private getLastOperationInScope;
68
+ /**
69
+ * Detect and handle conflicts between local pending actions and remote state.
70
+ * Returns the (possibly rebased) tracked actions to push.
71
+ */
72
+ private handleConflicts;
73
+ /**
74
+ * Pull latest remote state and replay actions through interceptors.
75
+ * Returns newly tracked actions with correct prevOpHash values.
76
+ */
77
+ private pullAndReplay;
78
+ /** Prepare actions for push, optionally signing them. */
79
+ private prepareActionsForPush;
80
+ /** Sign an action using the configured signer, preserving existing signatures. */
81
+ private signAction;
82
+ /**
83
+ * Fetch document and operations in a single query, using the stored cursor
84
+ * for incremental fetches. If the first page has more results, continues
85
+ * paginating with follow-up queries. Falls back to a full fetch if the
86
+ * cursor is stale and produces a count mismatch.
87
+ */
88
+ private fetchDocumentAndOperations;
89
+ /**
90
+ * Full fetch fallback: fetches all operations from the beginning.
91
+ * Used when an incremental fetch produces a count mismatch.
92
+ */
93
+ private fullFetch;
94
+ /**
95
+ * Validate that the merged operations match the expected revision per scope.
96
+ * Each scope's operation count should equal its revision number.
97
+ */
98
+ private hasExpectedOperationCounts;
99
+ /**
100
+ * Merge existing local operations with newly fetched operations.
101
+ * Appends new operations to existing ones per scope.
102
+ */
103
+ private mergeOperations;
104
+ /** Schedule a push via microtask (for streaming mode coalescing). */
105
+ private schedulePush;
106
+ }
107
+ export {};
108
+ //# sourceMappingURL=remote-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote-controller.d.ts","sourceRoot":"","sources":["../../../src/remote-controller/remote-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,kBAAkB,EAGlB,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAEV,sBAAsB,EAEtB,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,uBAAuB,EAEvB,kBAAkB,EAElB,UAAU,EAEX,MAAM,YAAY,CAAC;AAUpB,2DAA2D;AAC3D,KAAK,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,oBAAoB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEzE;;;GAGG;AACH,KAAK,eAAe,CAAC,CAAC,EAAE,OAAO,IAAI;KAChC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CACrE,KAAK,EAAE,MAAM,CAAC,KACX,OAAO,GACR,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,eAAe,CAAC,CAAC,EAAE,OAAO,CAAC,GACnD,CAAC,CAAC,CAAC,CAAC;CACT,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,4BAA4B,CAAC,CAAC,SAAS,oBAAoB,CAAC,GAAG,CAAC,IAC1E,wBAAwB,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC;AAEhF;;;GAGG;AACH,qBAAa,wBAAwB,CACnC,WAAW,SAAS,oBAAoB,CAAC,GAAG,CAAC,CAC7C,YAAW,iBAAiB,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IACrD,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAgB;IAC7C,OAAO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AiE;YACnD,oBAAoB;IASlC,0EAA0E;IAC1E,OAAO,CAAC,uBAAuB;IAwD/B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAY/B;;;OAGG;YACW,eAAe;IAqE7B;;;OAGG;YACW,aAAa;IAiB3B,yDAAyD;YAC3C,qBAAqB;IAyBnC,kFAAkF;YACpE,UAAU;IAiBxB;;;;;OAKG;YACW,0BAA0B;IA4DxC;;;OAGG;YACW,SAAS;IAiBvB;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAalC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAuBvB,qEAAqE;IACrE,OAAO,CAAC,YAAY;CAgBrB"}
@@ -0,0 +1,118 @@
1
+ import type { Action, DocumentOperations, ISigner, PHBaseState, PHDocument, PHDocumentHeader } from "document-model";
2
+ import type { GetDocumentOperationsQuery, PhDocumentFieldsFragment, PropagationMode, Sdk } from "../graphql/gen/schema.js";
3
+ export { PropagationMode } from "../graphql/gen/schema.js";
4
+ export type RemoteDocumentData = PhDocumentFieldsFragment;
5
+ export type RemoteOperation = GetDocumentOperationsQuery["documentOperations"]["items"][number];
6
+ export type RemoteOperationResultPage = GetDocumentOperationsQuery["documentOperations"];
7
+ export type ReactorGraphQLClient = Pick<Sdk, "GetDocument" | "GetDocumentWithOperations" | "GetDocumentOperations" | "MutateDocument" | "CreateDocument" | "CreateEmptyDocument" | "DeleteDocument">;
8
+ /**
9
+ * Options for creating a RemoteDocumentController.
10
+ */
11
+ export type RemoteControllerOptions = {
12
+ client: ReactorGraphQLClient;
13
+ /** Remote document id. Omit for new documents. */
14
+ documentId?: string;
15
+ /** "batch" requires explicit push(), "streaming" auto-pushes after actions. Defaults to "batch" */
16
+ mode?: "batch" | "streaming";
17
+ /** Optional signer for action signing. */
18
+ signer?: ISigner;
19
+ /** Branch name, defaults to "main". */
20
+ branch?: string;
21
+ /** Parent document identifier for creating new documents. */
22
+ parentIdentifier?: string;
23
+ /** Conflict resolution strategy when remote has new operations. Default: no check (current behavior). */
24
+ onConflict?: ConflictStrategy;
25
+ /** Called when a streaming-mode push fails. If not provided, errors are silently swallowed. */
26
+ onPushError?: (error: unknown) => void;
27
+ /** Number of operations to fetch per page. Defaults to 100. */
28
+ operationsPageSize?: number;
29
+ };
30
+ /**
31
+ * Result of a push operation.
32
+ */
33
+ export type PushResult = {
34
+ remoteDocument: RemoteDocumentData;
35
+ actionCount: number;
36
+ /** The actions that were sent to the server (after signing, if applicable). */
37
+ operations: ReadonlyArray<Action>;
38
+ };
39
+ /**
40
+ * Sync status of the controller.
41
+ */
42
+ export type SyncStatus = {
43
+ pendingActionCount: number;
44
+ connected: boolean;
45
+ documentId: string;
46
+ remoteRevision: Record<string, number>;
47
+ };
48
+ /**
49
+ * A tracked action with operation context for signing.
50
+ */
51
+ export type TrackedAction = {
52
+ action: Action;
53
+ prevOpHash: string;
54
+ prevOpIndex: number;
55
+ };
56
+ /** Information about a detected conflict. */
57
+ export type ConflictInfo = {
58
+ /** Remote operations added since the last pull, grouped by scope. */
59
+ remoteOperations: Record<string, RemoteOperation[]>;
60
+ /** Local actions pending push. */
61
+ localActions: TrackedAction[];
62
+ /** Remote revision at last pull. */
63
+ knownRevision: Record<string, number>;
64
+ /** Current remote revision. */
65
+ currentRevision: Record<string, number>;
66
+ };
67
+ /** Custom merge handler receives conflict info and returns actions to push (or throws to abort). */
68
+ export type MergeHandler = (conflict: ConflictInfo) => Action[] | Promise<Action[]>;
69
+ /** Conflict resolution strategy. */
70
+ export type ConflictStrategy = "reject" | "rebase" | MergeHandler;
71
+ /** Event emitted when the document changes. */
72
+ export type RemoteDocumentChangeEvent = {
73
+ source: "action" | "pull";
74
+ document: PHDocument<PHBaseState>;
75
+ };
76
+ /** Listener for document change events. */
77
+ export type DocumentChangeListener = (event: RemoteDocumentChangeEvent) => void;
78
+ /** Result of fetching operations, including the cursor for incremental fetches. */
79
+ export type GetOperationsResult = {
80
+ operationsByScope: Record<string, RemoteOperation[]>;
81
+ /** Opaque cursor for resuming pagination. Undefined if there were no results. */
82
+ cursor: string | undefined;
83
+ };
84
+ /** Result of fetching a document together with its first page of operations. */
85
+ export type GetDocumentWithOperationsResult = {
86
+ document: RemoteDocumentData;
87
+ childIds: ReadonlyArray<string>;
88
+ /** First page of operations (may need further pagination if hasNextPage is true). */
89
+ operations: GetOperationsResult;
90
+ /** True if there are more pages of operations to fetch. */
91
+ hasMoreOperations: boolean;
92
+ };
93
+ export interface IRemoteClient {
94
+ getDocument(identifier: string, branch?: string): Promise<GetDocumentResult | null>;
95
+ /** Fetch document metadata and the first page of operations in a single query. */
96
+ getDocumentWithOperations(identifier: string, branch?: string, operationsCursor?: string): Promise<GetDocumentWithOperationsResult | null>;
97
+ getAllOperations(documentId: string, branch?: string, sinceRevision?: number, scopes?: string[], cursor?: string): Promise<GetOperationsResult>;
98
+ pushActions(documentIdentifier: string, actions: ReadonlyArray<NonNullable<unknown>>, branch?: string): Promise<RemoteDocumentData>;
99
+ createDocument(document: NonNullable<unknown>, parentIdentifier?: string): Promise<RemoteDocumentData>;
100
+ createEmptyDocument(documentType: string, parentIdentifier?: string): Promise<RemoteDocumentData>;
101
+ deleteDocument(identifier: string, propagate?: PropagationMode): Promise<boolean>;
102
+ }
103
+ export type GetDocumentResult = {
104
+ document: RemoteDocumentData;
105
+ childIds: ReadonlyArray<string>;
106
+ };
107
+ export interface IRemoteController<TState extends PHBaseState = PHBaseState> {
108
+ readonly header: PHDocumentHeader;
109
+ readonly state: TState;
110
+ readonly operations: DocumentOperations;
111
+ readonly document: PHDocument<TState>;
112
+ readonly status: SyncStatus;
113
+ onChange(listener: DocumentChangeListener): () => void;
114
+ push(): Promise<PushResult>;
115
+ pull(): Promise<RemoteDocumentData>;
116
+ delete(propagate?: PropagationMode): Promise<boolean>;
117
+ }
118
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/remote-contro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CAAC,OAAO,CAAC,EAC9B,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE/B,mBAAmB,CACjB,YAAY,EAAE,MAAM,EACpB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAE/B,cAAc,CACZ,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,eAAe,GAC1B,OAAO,CAAC,OAAO,CAAC,CAAC;CACrB;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,iBAAiB,CAAC,MAAM,SAAS,WAAW,GAAG,WAAW;IACzE,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAE5B,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAAC;IACvD,IAAI,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5B,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpC,MAAM,CAAC,SAAS,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD"}
@@ -0,0 +1,28 @@
1
+ import type { DocumentOperations, Operation, PHBaseState, PHDocument } from "document-model";
2
+ import type { ConflictInfo, RemoteDocumentData, RemoteOperation } from "./types.js";
3
+ /** Convert SCREAMING_SNAKE_CASE to camelCase (e.g. "SET_MODEL_NAME" → "setModelName"). */
4
+ export declare function screamingSnakeToCamel(s: string): string;
5
+ /** Error thrown when a push conflict is detected with the "reject" strategy. */
6
+ export declare class ConflictError extends Error {
7
+ readonly conflict: ConflictInfo;
8
+ constructor(conflict: ConflictInfo);
9
+ }
10
+ /** Convert a remote operation to the local Operation type. */
11
+ export declare function remoteOperationToLocal(remote: RemoteOperation): Operation;
12
+ /**
13
+ * Deserialize a signature string back to a 5-element tuple.
14
+ * The server serializes tuples via `tuple.join(", ")`.
15
+ */
16
+ export declare function deserializeSignature(s: string): [string, string, string, string, string];
17
+ /** Convert remote operations to local DocumentOperations format. */
18
+ export declare function convertRemoteOperations(operationsByScope: Record<string, RemoteOperation[]>): DocumentOperations;
19
+ /** Reconstruct a PHDocument from remote document data and operations. */
20
+ export declare function buildPulledDocument(remoteDoc: RemoteDocumentData, operations: DocumentOperations, initialDoc: PHDocument<PHBaseState>, branch: string): PHDocument<PHBaseState>;
21
+ /** Extract revision map from a remote document's revisionsList. */
22
+ export declare function extractRevisionMap(revisionsList: RemoteDocumentData["revisionsList"]): Record<string, number>;
23
+ /**
24
+ * Check if any scope in currentRevision is ahead of knownRevision.
25
+ * When `scopes` is provided, only those scopes are checked.
26
+ */
27
+ export declare function hasRevisionConflict(currentRevision: Record<string, number>, knownRevision: Record<string, number>, scopes?: ReadonlySet<string>): boolean;
28
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/remote-controller/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,SAAS,EACT,WAAW,EACX,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,0FAA0F;AAC1F,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED,gFAAgF;AAChF,qBAAa,aAAc,SAAQ,KAAK;aACV,QAAQ,EAAE,YAAY;gBAAtB,QAAQ,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