@powerhousedao/reactor-browser 5.0.0-staging.9 → 5.0.1-staging.10

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 (506) hide show
  1. package/README.md +204 -90
  2. package/dist/src/actions/dispatch.d.ts +2 -2
  3. package/dist/src/actions/dispatch.d.ts.map +1 -1
  4. package/dist/src/actions/dispatch.js +1 -1
  5. package/dist/src/actions/dispatch.js.map +1 -1
  6. package/dist/src/actions/document.d.ts +4 -2
  7. package/dist/src/actions/document.d.ts.map +1 -1
  8. package/dist/src/actions/document.js +236 -22
  9. package/dist/src/actions/document.js.map +1 -1
  10. package/dist/src/actions/drive.d.ts +5 -6
  11. package/dist/src/actions/drive.d.ts.map +1 -1
  12. package/dist/src/actions/drive.js +13 -52
  13. package/dist/src/actions/drive.js.map +1 -1
  14. package/dist/src/actions/index.d.ts +3 -5
  15. package/dist/src/actions/index.d.ts.map +1 -1
  16. package/dist/src/actions/index.js +3 -5
  17. package/dist/src/actions/index.js.map +1 -1
  18. package/dist/src/actions/queue.d.ts +3 -1
  19. package/dist/src/actions/queue.d.ts.map +1 -1
  20. package/dist/src/actions/queue.js +19 -3
  21. package/dist/src/actions/queue.js.map +1 -1
  22. package/dist/src/actions/sign.d.ts +1 -1
  23. package/dist/src/actions/sign.d.ts.map +1 -1
  24. package/dist/src/actions/sign.js +7 -7
  25. package/dist/src/actions/sign.js.map +1 -1
  26. package/dist/src/analytics/context.d.ts +3 -4
  27. package/dist/src/analytics/context.d.ts.map +1 -1
  28. package/dist/src/analytics/context.js +8 -4
  29. package/dist/src/analytics/context.js.map +1 -1
  30. package/dist/src/analytics/{hooks.d.ts → hooks/analytics-query.d.ts} +4 -3
  31. package/dist/src/analytics/hooks/analytics-query.d.ts.map +1 -0
  32. package/dist/src/analytics/{hooks.js → hooks/analytics-query.js} +4 -4
  33. package/dist/src/analytics/hooks/analytics-query.js.map +1 -0
  34. package/dist/src/analytics/hooks/document-timeline.d.ts +19 -0
  35. package/dist/src/analytics/hooks/document-timeline.d.ts.map +1 -0
  36. package/dist/src/analytics/hooks/document-timeline.js +10 -0
  37. package/dist/src/analytics/hooks/document-timeline.js.map +1 -0
  38. package/dist/src/analytics/hooks/index.d.ts +4 -0
  39. package/dist/src/analytics/hooks/index.d.ts.map +1 -0
  40. package/dist/src/analytics/hooks/index.js +4 -0
  41. package/dist/src/analytics/hooks/index.js.map +1 -0
  42. package/dist/src/analytics/hooks/timeline-items.d.ts +25 -0
  43. package/dist/src/analytics/hooks/timeline-items.d.ts.map +1 -0
  44. package/dist/src/analytics/hooks/timeline-items.js +104 -0
  45. package/dist/src/analytics/hooks/timeline-items.js.map +1 -0
  46. package/dist/src/analytics/index.d.ts +2 -1
  47. package/dist/src/analytics/index.d.ts.map +1 -1
  48. package/dist/src/analytics/index.js +2 -1
  49. package/dist/src/analytics/index.js.map +1 -1
  50. package/dist/src/analytics/store/browser.d.ts +1 -1
  51. package/dist/src/analytics/store/browser.d.ts.map +1 -1
  52. package/dist/src/analytics/store/browser.js +1 -1
  53. package/dist/src/analytics/store/browser.js.map +1 -1
  54. package/dist/src/analytics/store/memory.d.ts +1 -1
  55. package/dist/src/analytics/store/memory.d.ts.map +1 -1
  56. package/dist/src/analytics/store/memory.js +1 -1
  57. package/dist/src/analytics/store/memory.js.map +1 -1
  58. package/dist/src/analytics/types.d.ts +2 -3
  59. package/dist/src/analytics/types.d.ts.map +1 -1
  60. package/dist/src/analytics.d.ts +3 -0
  61. package/dist/src/analytics.d.ts.map +1 -0
  62. package/dist/src/analytics.js +3 -0
  63. package/dist/src/analytics.js.map +1 -0
  64. package/dist/src/connect.d.ts +2 -0
  65. package/dist/src/connect.d.ts.map +1 -0
  66. package/dist/src/connect.js +2 -0
  67. package/dist/src/connect.js.map +1 -0
  68. package/dist/src/context/index.d.ts +1 -1
  69. package/dist/src/context/index.d.ts.map +1 -1
  70. package/dist/src/context/index.js +1 -1
  71. package/dist/src/context/index.js.map +1 -1
  72. package/dist/src/context/read-mode.d.ts +2 -2
  73. package/dist/src/context/read-mode.d.ts.map +1 -1
  74. package/dist/src/context/read-mode.js +23 -41
  75. package/dist/src/context/read-mode.js.map +1 -1
  76. package/dist/src/document-model.d.ts +1 -2
  77. package/dist/src/document-model.d.ts.map +1 -1
  78. package/dist/src/document-model.js +1 -1
  79. package/dist/src/document-model.js.map +1 -1
  80. package/dist/src/errors.d.ts +16 -0
  81. package/dist/src/errors.d.ts.map +1 -0
  82. package/dist/src/errors.js +27 -0
  83. package/dist/src/errors.js.map +1 -0
  84. package/dist/src/global/core.d.ts.map +1 -1
  85. package/dist/src/global/core.js +0 -1
  86. package/dist/src/global/core.js.map +1 -1
  87. package/dist/src/global/index.d.ts +0 -1
  88. package/dist/src/global/index.d.ts.map +1 -1
  89. package/dist/src/global/index.js +0 -1
  90. package/dist/src/global/index.js.map +1 -1
  91. package/dist/src/global/types.d.ts +2 -2
  92. package/dist/src/global/types.d.ts.map +1 -1
  93. package/dist/src/hooks/add-ph-event-handlers.d.ts.map +1 -0
  94. package/dist/src/hooks/add-ph-event-handlers.js +100 -0
  95. package/dist/src/hooks/add-ph-event-handlers.js.map +1 -0
  96. package/dist/src/hooks/allowed-document-model-modules.d.ts +2 -0
  97. package/dist/src/hooks/allowed-document-model-modules.d.ts.map +1 -0
  98. package/dist/src/hooks/allowed-document-model-modules.js +10 -0
  99. package/dist/src/hooks/allowed-document-model-modules.js.map +1 -0
  100. package/dist/src/hooks/child-nodes.d.ts +4 -0
  101. package/dist/src/hooks/child-nodes.d.ts.map +1 -0
  102. package/dist/src/hooks/child-nodes.js +15 -0
  103. package/dist/src/hooks/child-nodes.js.map +1 -0
  104. package/dist/src/hooks/config/connect.d.ts +96 -0
  105. package/dist/src/hooks/config/connect.d.ts.map +1 -0
  106. package/dist/src/hooks/config/connect.js +210 -0
  107. package/dist/src/hooks/config/connect.js.map +1 -0
  108. package/dist/src/hooks/config/editor.d.ts +32 -0
  109. package/dist/src/hooks/config/editor.d.ts.map +1 -0
  110. package/dist/src/hooks/config/editor.js +43 -0
  111. package/dist/src/hooks/config/editor.js.map +1 -0
  112. package/dist/src/hooks/config/set-config-by-key.d.ts +5 -0
  113. package/dist/src/hooks/config/set-config-by-key.d.ts.map +1 -0
  114. package/dist/src/hooks/config/set-config-by-key.js +15 -0
  115. package/dist/src/hooks/config/set-config-by-key.js.map +1 -0
  116. package/dist/src/hooks/config/set-config-by-object.d.ts +31 -0
  117. package/dist/src/hooks/config/set-config-by-object.d.ts.map +1 -0
  118. package/dist/src/hooks/config/set-config-by-object.js +84 -0
  119. package/dist/src/hooks/config/set-config-by-object.js.map +1 -0
  120. package/dist/src/hooks/config/use-value-by-key.d.ts +13 -0
  121. package/dist/src/hooks/config/use-value-by-key.d.ts.map +1 -0
  122. package/dist/src/hooks/config/use-value-by-key.js +23 -0
  123. package/dist/src/hooks/config/use-value-by-key.js.map +1 -0
  124. package/dist/src/hooks/config/utils.d.ts +3 -0
  125. package/dist/src/hooks/config/utils.d.ts.map +1 -0
  126. package/dist/src/hooks/config/utils.js +6 -0
  127. package/dist/src/hooks/config/utils.js.map +1 -0
  128. package/dist/src/hooks/connect.d.ts +16 -0
  129. package/dist/src/hooks/connect.d.ts.map +1 -0
  130. package/dist/src/hooks/connect.js +16 -0
  131. package/dist/src/hooks/connect.js.map +1 -0
  132. package/dist/src/hooks/crypto.d.ts +1 -2
  133. package/dist/src/hooks/crypto.d.ts.map +1 -1
  134. package/dist/src/hooks/crypto.js +2 -10
  135. package/dist/src/hooks/crypto.js.map +1 -1
  136. package/dist/src/hooks/did.d.ts +2 -0
  137. package/dist/src/hooks/did.d.ts.map +1 -0
  138. package/dist/src/hooks/did.js +3 -0
  139. package/dist/src/hooks/did.js.map +1 -0
  140. package/dist/src/hooks/dispatch.d.ts +3 -2
  141. package/dist/src/hooks/dispatch.d.ts.map +1 -1
  142. package/dist/src/hooks/dispatch.js +1 -0
  143. package/dist/src/hooks/dispatch.js.map +1 -1
  144. package/dist/src/hooks/document-by-id.d.ts +6 -0
  145. package/dist/src/hooks/document-by-id.d.ts.map +1 -0
  146. package/dist/src/hooks/document-by-id.js +13 -0
  147. package/dist/src/hooks/document-by-id.js.map +1 -0
  148. package/dist/src/hooks/document-cache.d.ts +60 -0
  149. package/dist/src/hooks/document-cache.d.ts.map +1 -0
  150. package/dist/src/hooks/document-cache.js +97 -0
  151. package/dist/src/hooks/document-cache.js.map +1 -0
  152. package/dist/src/hooks/document-model-modules.d.ts +4 -0
  153. package/dist/src/hooks/document-model-modules.d.ts.map +1 -0
  154. package/dist/src/hooks/document-model-modules.js +10 -0
  155. package/dist/src/hooks/document-model-modules.js.map +1 -0
  156. package/dist/src/hooks/document-of-type.d.ts +5 -0
  157. package/dist/src/hooks/document-of-type.d.ts.map +1 -0
  158. package/dist/src/hooks/document-of-type.js +22 -0
  159. package/dist/src/hooks/document-of-type.js.map +1 -0
  160. package/dist/src/hooks/document-types.d.ts +7 -0
  161. package/dist/src/hooks/document-types.d.ts.map +1 -0
  162. package/dist/src/hooks/document-types.js +13 -0
  163. package/dist/src/hooks/document-types.js.map +1 -0
  164. package/dist/src/hooks/drive-by-id.d.ts +4 -0
  165. package/dist/src/hooks/drive-by-id.d.ts.map +1 -0
  166. package/dist/src/hooks/drive-by-id.js +12 -0
  167. package/dist/src/hooks/drive-by-id.js.map +1 -0
  168. package/dist/src/hooks/drives.d.ts +8 -23
  169. package/dist/src/hooks/drives.d.ts.map +1 -1
  170. package/dist/src/hooks/drives.js +8 -88
  171. package/dist/src/hooks/drives.js.map +1 -1
  172. package/dist/src/hooks/editor-modules.d.ts +9 -0
  173. package/dist/src/hooks/editor-modules.d.ts.map +1 -0
  174. package/dist/src/hooks/editor-modules.js +43 -0
  175. package/dist/src/hooks/editor-modules.js.map +1 -0
  176. package/dist/src/hooks/folder-by-id.d.ts +3 -0
  177. package/dist/src/hooks/folder-by-id.d.ts.map +1 -0
  178. package/dist/src/hooks/folder-by-id.js +6 -0
  179. package/dist/src/hooks/folder-by-id.js.map +1 -0
  180. package/dist/src/hooks/import-script-modules.d.ts +3 -0
  181. package/dist/src/hooks/import-script-modules.d.ts.map +1 -0
  182. package/dist/src/hooks/import-script-modules.js +6 -0
  183. package/dist/src/hooks/import-script-modules.js.map +1 -0
  184. package/dist/src/hooks/index.d.ts +37 -11
  185. package/dist/src/hooks/index.d.ts.map +1 -1
  186. package/dist/src/hooks/index.js +37 -11
  187. package/dist/src/hooks/index.js.map +1 -1
  188. package/dist/src/hooks/items-in-selected-drive.d.ts +13 -0
  189. package/dist/src/hooks/items-in-selected-drive.d.ts.map +1 -0
  190. package/dist/src/hooks/items-in-selected-drive.js +35 -0
  191. package/dist/src/hooks/items-in-selected-drive.js.map +1 -0
  192. package/dist/src/hooks/items-in-selected-folder.d.ts +11 -0
  193. package/dist/src/hooks/items-in-selected-folder.d.ts.map +1 -0
  194. package/dist/src/hooks/items-in-selected-folder.js +33 -0
  195. package/dist/src/hooks/items-in-selected-folder.js.map +1 -0
  196. package/dist/src/hooks/loading.d.ts +2 -0
  197. package/dist/src/hooks/loading.d.ts.map +1 -0
  198. package/dist/src/hooks/loading.js +3 -0
  199. package/dist/src/hooks/loading.js.map +1 -0
  200. package/dist/src/hooks/login-status.d.ts +2 -0
  201. package/dist/src/hooks/login-status.d.ts.map +1 -0
  202. package/dist/src/hooks/login-status.js +3 -0
  203. package/dist/src/hooks/login-status.js.map +1 -0
  204. package/dist/src/hooks/make-ph-event-functions.d.ts +7 -0
  205. package/dist/src/hooks/make-ph-event-functions.d.ts.map +1 -0
  206. package/dist/src/hooks/make-ph-event-functions.js +46 -0
  207. package/dist/src/hooks/make-ph-event-functions.js.map +1 -0
  208. package/dist/src/hooks/modals.d.ts +17 -0
  209. package/dist/src/hooks/modals.d.ts.map +1 -0
  210. package/dist/src/hooks/modals.js +26 -0
  211. package/dist/src/hooks/modals.js.map +1 -0
  212. package/dist/src/hooks/node-actions.d.ts +11 -0
  213. package/dist/src/hooks/node-actions.d.ts.map +1 -0
  214. package/dist/src/hooks/node-actions.js +97 -0
  215. package/dist/src/hooks/node-actions.js.map +1 -0
  216. package/dist/src/hooks/node-by-id.d.ts +4 -0
  217. package/dist/src/hooks/node-by-id.d.ts.map +1 -0
  218. package/dist/src/hooks/node-by-id.js +7 -0
  219. package/dist/src/hooks/node-by-id.js.map +1 -0
  220. package/dist/src/hooks/node-path.d.ts +6 -0
  221. package/dist/src/hooks/node-path.d.ts.map +1 -0
  222. package/dist/src/hooks/node-path.js +23 -0
  223. package/dist/src/hooks/node-path.js.map +1 -0
  224. package/dist/src/hooks/parent-folder.d.ts +4 -0
  225. package/dist/src/hooks/parent-folder.d.ts.map +1 -0
  226. package/dist/src/hooks/parent-folder.js +13 -0
  227. package/dist/src/hooks/parent-folder.js.map +1 -0
  228. package/dist/src/hooks/processor-manager.d.ts +8 -2
  229. package/dist/src/hooks/processor-manager.d.ts.map +1 -1
  230. package/dist/src/hooks/processor-manager.js +8 -6
  231. package/dist/src/hooks/processor-manager.js.map +1 -1
  232. package/dist/src/hooks/processor-modules.d.ts +4 -0
  233. package/dist/src/hooks/processor-modules.d.ts.map +1 -0
  234. package/dist/src/hooks/processor-modules.js +12 -0
  235. package/dist/src/hooks/processor-modules.js.map +1 -0
  236. package/dist/src/hooks/reactor.d.ts +8 -2
  237. package/dist/src/hooks/reactor.d.ts.map +1 -1
  238. package/dist/src/hooks/reactor.js +8 -6
  239. package/dist/src/hooks/reactor.js.map +1 -1
  240. package/dist/src/hooks/renown.d.ts +6 -1
  241. package/dist/src/hooks/renown.d.ts.map +1 -1
  242. package/dist/src/hooks/renown.js +8 -6
  243. package/dist/src/hooks/renown.js.map +1 -1
  244. package/dist/src/hooks/revision-history.d.ts +11 -0
  245. package/dist/src/hooks/revision-history.d.ts.map +1 -0
  246. package/dist/src/hooks/revision-history.js +17 -0
  247. package/dist/src/hooks/revision-history.js.map +1 -0
  248. package/dist/src/hooks/selected-document.d.ts +10 -0
  249. package/dist/src/hooks/selected-document.d.ts.map +1 -0
  250. package/dist/src/hooks/selected-document.js +26 -0
  251. package/dist/src/hooks/selected-document.js.map +1 -0
  252. package/dist/src/hooks/selected-drive.d.ts +13 -0
  253. package/dist/src/hooks/selected-drive.d.ts.map +1 -0
  254. package/dist/src/hooks/selected-drive.js +63 -0
  255. package/dist/src/hooks/selected-drive.js.map +1 -0
  256. package/dist/src/hooks/selected-folder.d.ts +4 -0
  257. package/dist/src/hooks/selected-folder.d.ts.map +1 -0
  258. package/dist/src/hooks/selected-folder.js +10 -0
  259. package/dist/src/hooks/selected-folder.js.map +1 -0
  260. package/dist/src/hooks/selected-node.d.ts +9 -0
  261. package/dist/src/hooks/selected-node.d.ts.map +1 -0
  262. package/dist/src/hooks/selected-node.js +54 -0
  263. package/dist/src/hooks/selected-node.js.map +1 -0
  264. package/dist/src/hooks/selected-timeline-item.d.ts +7 -0
  265. package/dist/src/hooks/selected-timeline-item.d.ts.map +1 -0
  266. package/dist/src/hooks/selected-timeline-item.js +9 -0
  267. package/dist/src/hooks/selected-timeline-item.js.map +1 -0
  268. package/dist/src/hooks/subgraph-modules.d.ts +3 -0
  269. package/dist/src/hooks/subgraph-modules.d.ts.map +1 -0
  270. package/dist/src/hooks/subgraph-modules.js +6 -0
  271. package/dist/src/hooks/subgraph-modules.js.map +1 -0
  272. package/dist/src/hooks/supported-document-types.d.ts +3 -0
  273. package/dist/src/hooks/supported-document-types.d.ts.map +1 -0
  274. package/dist/src/hooks/supported-document-types.js +7 -0
  275. package/dist/src/hooks/supported-document-types.js.map +1 -0
  276. package/dist/src/hooks/timeline-revision.d.ts +7 -0
  277. package/dist/src/hooks/timeline-revision.d.ts.map +1 -0
  278. package/dist/src/hooks/timeline-revision.js +9 -0
  279. package/dist/src/hooks/timeline-revision.js.map +1 -0
  280. package/dist/src/hooks/use-get-switchboard-link.d.ts +14 -0
  281. package/dist/src/hooks/use-get-switchboard-link.d.ts.map +1 -0
  282. package/dist/src/hooks/use-get-switchboard-link.js +38 -0
  283. package/dist/src/hooks/use-get-switchboard-link.js.map +1 -0
  284. package/dist/src/hooks/use-on-drop-file.d.ts +3 -0
  285. package/dist/src/hooks/use-on-drop-file.d.ts.map +1 -0
  286. package/dist/src/hooks/use-on-drop-file.js +21 -0
  287. package/dist/src/hooks/use-on-drop-file.js.map +1 -0
  288. package/dist/src/hooks/user-permissions.d.ts +5 -0
  289. package/dist/src/hooks/user-permissions.d.ts.map +1 -0
  290. package/dist/src/hooks/user-permissions.js +17 -0
  291. package/dist/src/hooks/user-permissions.js.map +1 -0
  292. package/dist/src/hooks/user.d.ts +1 -6
  293. package/dist/src/hooks/user.d.ts.map +1 -1
  294. package/dist/src/hooks/user.js +2 -25
  295. package/dist/src/hooks/user.js.map +1 -1
  296. package/dist/src/hooks/vetra-packages.d.ts +7 -17
  297. package/dist/src/hooks/vetra-packages.d.ts.map +1 -1
  298. package/dist/src/hooks/vetra-packages.js +13 -73
  299. package/dist/src/hooks/vetra-packages.js.map +1 -1
  300. package/dist/src/index.d.ts +1 -2
  301. package/dist/src/index.d.ts.map +1 -1
  302. package/dist/src/index.js +1 -2
  303. package/dist/src/index.js.map +1 -1
  304. package/dist/src/pglite/hooks/usePGlite.d.ts +1 -1
  305. package/dist/src/pglite/hooks/usePGlite.d.ts.map +1 -1
  306. package/dist/src/pglite/index.d.ts +0 -4
  307. package/dist/src/pglite/index.d.ts.map +1 -1
  308. package/dist/src/pglite/index.js +0 -4
  309. package/dist/src/pglite/index.js.map +1 -1
  310. package/dist/src/reactor.d.ts +13 -9
  311. package/dist/src/reactor.d.ts.map +1 -1
  312. package/dist/src/reactor.js +89 -21
  313. package/dist/src/reactor.js.map +1 -1
  314. package/dist/src/relational/hooks/useRelationalDb.d.ts +2 -2
  315. package/dist/src/relational/hooks/useRelationalDb.d.ts.map +1 -1
  316. package/dist/src/relational/hooks/useRelationalDb.js +1 -1
  317. package/dist/src/relational/hooks/useRelationalDb.js.map +1 -1
  318. package/dist/src/relational/hooks/useRelationalQuery.d.ts +2 -3
  319. package/dist/src/relational/hooks/useRelationalQuery.d.ts.map +1 -1
  320. package/dist/src/relational/hooks/useRelationalQuery.js +1 -1
  321. package/dist/src/relational/hooks/useRelationalQuery.js.map +1 -1
  322. package/dist/src/relational/utils/createProcessorQuery.d.ts +4 -4
  323. package/dist/src/relational/utils/createProcessorQuery.d.ts.map +1 -1
  324. package/dist/src/relational/utils/createProcessorQuery.js +2 -2
  325. package/dist/src/relational/utils/createProcessorQuery.js.map +1 -1
  326. package/dist/src/renown/utils.d.ts +3 -4
  327. package/dist/src/renown/utils.d.ts.map +1 -1
  328. package/dist/src/renown/utils.js +12 -12
  329. package/dist/src/renown/utils.js.map +1 -1
  330. package/dist/src/types/config.d.ts +96 -0
  331. package/dist/src/types/config.d.ts.map +1 -0
  332. package/dist/src/types/config.js +2 -0
  333. package/dist/src/types/config.js.map +1 -0
  334. package/dist/src/types/documents.d.ts +21 -0
  335. package/dist/src/types/documents.d.ts.map +1 -0
  336. package/dist/src/types/documents.js +2 -0
  337. package/dist/src/types/documents.js.map +1 -0
  338. package/dist/src/types/global.d.ts +35 -55
  339. package/dist/src/types/global.d.ts.map +1 -1
  340. package/dist/src/types/index.d.ts +8 -4
  341. package/dist/src/types/index.d.ts.map +1 -1
  342. package/dist/src/types/index.js +1 -4
  343. package/dist/src/types/index.js.map +1 -1
  344. package/dist/src/types/modals.d.ts +32 -0
  345. package/dist/src/types/modals.d.ts.map +1 -0
  346. package/dist/src/types/modals.js +2 -0
  347. package/dist/src/types/modals.js.map +1 -0
  348. package/dist/src/types/reactor.d.ts +0 -2
  349. package/dist/src/types/reactor.d.ts.map +1 -1
  350. package/dist/src/types/timeline.d.ts +24 -0
  351. package/dist/src/types/timeline.d.ts.map +1 -0
  352. package/dist/src/types/timeline.js +2 -0
  353. package/dist/src/types/timeline.js.map +1 -0
  354. package/dist/src/types/upload.d.ts +16 -0
  355. package/dist/src/types/upload.d.ts.map +1 -0
  356. package/dist/src/types/upload.js +2 -0
  357. package/dist/src/types/upload.js.map +1 -0
  358. package/dist/src/types/vetra.d.ts +6 -14
  359. package/dist/src/types/vetra.d.ts.map +1 -1
  360. package/dist/src/utils/documents.d.ts +2 -0
  361. package/dist/src/utils/documents.d.ts.map +1 -0
  362. package/dist/src/utils/documents.js +20 -0
  363. package/dist/src/utils/documents.js.map +1 -0
  364. package/dist/src/utils/drives.d.ts +24 -9
  365. package/dist/src/utils/drives.d.ts.map +1 -1
  366. package/dist/src/utils/drives.js +95 -19
  367. package/dist/src/utils/drives.js.map +1 -1
  368. package/dist/src/utils/export-document.d.ts +3 -0
  369. package/dist/src/utils/export-document.d.ts.map +1 -0
  370. package/dist/src/utils/export-document.js +18 -0
  371. package/dist/src/utils/export-document.js.map +1 -0
  372. package/dist/src/utils/get-revision-from-date.d.ts +3 -0
  373. package/dist/src/utils/get-revision-from-date.d.ts.map +1 -0
  374. package/dist/src/utils/get-revision-from-date.js +10 -0
  375. package/dist/src/utils/get-revision-from-date.js.map +1 -0
  376. package/dist/src/utils/index.d.ts +4 -0
  377. package/dist/src/utils/index.d.ts.map +1 -1
  378. package/dist/src/utils/index.js +4 -0
  379. package/dist/src/utils/index.js.map +1 -1
  380. package/dist/src/utils/nodes.d.ts +1 -1
  381. package/dist/src/utils/nodes.d.ts.map +1 -1
  382. package/dist/src/utils/switchboard.d.ts +3 -4
  383. package/dist/src/utils/switchboard.d.ts.map +1 -1
  384. package/dist/src/utils/switchboard.js +19 -15
  385. package/dist/src/utils/switchboard.js.map +1 -1
  386. package/dist/src/utils/url.d.ts +5 -2
  387. package/dist/src/utils/url.d.ts.map +1 -1
  388. package/dist/src/utils/url.js +14 -3
  389. package/dist/src/utils/url.js.map +1 -1
  390. package/dist/src/utils/user.js +2 -2
  391. package/dist/src/utils/user.js.map +1 -1
  392. package/dist/src/utils/validate-document.d.ts +3 -0
  393. package/dist/src/utils/validate-document.d.ts.map +1 -0
  394. package/dist/src/utils/validate-document.js +38 -0
  395. package/dist/src/utils/validate-document.js.map +1 -0
  396. package/dist/src/utils/vetra.d.ts +3 -3
  397. package/dist/src/utils/vetra.d.ts.map +1 -1
  398. package/dist/src/utils/vetra.js +21 -15
  399. package/dist/src/utils/vetra.js.map +1 -1
  400. package/dist/test/analytics.test.d.ts +2 -0
  401. package/dist/test/analytics.test.d.ts.map +1 -0
  402. package/dist/test/analytics.test.js +263 -0
  403. package/dist/test/analytics.test.js.map +1 -0
  404. package/dist/test/getSwitchboardUrl.test.d.ts +2 -0
  405. package/dist/test/getSwitchboardUrl.test.d.ts.map +1 -0
  406. package/dist/test/getSwitchboardUrl.test.js +105 -0
  407. package/dist/test/getSwitchboardUrl.test.js.map +1 -0
  408. package/dist/test/reactor.test.d.ts +2 -0
  409. package/dist/test/reactor.test.d.ts.map +1 -0
  410. package/dist/test/reactor.test.js +26 -0
  411. package/dist/test/reactor.test.js.map +1 -0
  412. package/dist/test/switchboard.test.d.ts +2 -0
  413. package/dist/test/switchboard.test.d.ts.map +1 -0
  414. package/dist/test/switchboard.test.js +25 -0
  415. package/dist/test/switchboard.test.js.map +1 -0
  416. package/dist/tsconfig.tsbuildinfo +1 -0
  417. package/dist/vitest.config.js +1 -1
  418. package/dist/vitest.config.js.map +1 -1
  419. package/package.json +36 -33
  420. package/dist/src/analytics/analytics.d.ts +0 -5
  421. package/dist/src/analytics/analytics.d.ts.map +0 -1
  422. package/dist/src/analytics/analytics.js +0 -6
  423. package/dist/src/analytics/analytics.js.map +0 -1
  424. package/dist/src/analytics/hooks.d.ts.map +0 -1
  425. package/dist/src/analytics/hooks.js.map +0 -1
  426. package/dist/src/crypto/browser.d.ts +0 -8
  427. package/dist/src/crypto/browser.d.ts.map +0 -1
  428. package/dist/src/crypto/browser.js +0 -73
  429. package/dist/src/crypto/browser.js.map +0 -1
  430. package/dist/src/crypto/index.d.ts +0 -35
  431. package/dist/src/crypto/index.d.ts.map +0 -1
  432. package/dist/src/crypto/index.js +0 -153
  433. package/dist/src/crypto/index.js.map +0 -1
  434. package/dist/src/events/add-ph-event-handlers.d.ts.map +0 -1
  435. package/dist/src/events/add-ph-event-handlers.js +0 -26
  436. package/dist/src/events/add-ph-event-handlers.js.map +0 -1
  437. package/dist/src/events/config.d.ts +0 -8
  438. package/dist/src/events/config.d.ts.map +0 -1
  439. package/dist/src/events/config.js +0 -25
  440. package/dist/src/events/config.js.map +0 -1
  441. package/dist/src/events/crypto.d.ts +0 -13
  442. package/dist/src/events/crypto.d.ts.map +0 -1
  443. package/dist/src/events/crypto.js +0 -49
  444. package/dist/src/events/crypto.js.map +0 -1
  445. package/dist/src/events/documents.d.ts +0 -7
  446. package/dist/src/events/documents.d.ts.map +0 -1
  447. package/dist/src/events/documents.js +0 -19
  448. package/dist/src/events/documents.js.map +0 -1
  449. package/dist/src/events/drives.d.ts +0 -13
  450. package/dist/src/events/drives.d.ts.map +0 -1
  451. package/dist/src/events/drives.js +0 -57
  452. package/dist/src/events/drives.js.map +0 -1
  453. package/dist/src/events/index.d.ts +0 -13
  454. package/dist/src/events/index.d.ts.map +0 -1
  455. package/dist/src/events/index.js +0 -13
  456. package/dist/src/events/index.js.map +0 -1
  457. package/dist/src/events/nodes.d.ts +0 -7
  458. package/dist/src/events/nodes.d.ts.map +0 -1
  459. package/dist/src/events/nodes.js +0 -34
  460. package/dist/src/events/nodes.js.map +0 -1
  461. package/dist/src/events/processors.d.ts +0 -8
  462. package/dist/src/events/processors.d.ts.map +0 -1
  463. package/dist/src/events/processors.js +0 -25
  464. package/dist/src/events/processors.js.map +0 -1
  465. package/dist/src/events/reactor.d.ts +0 -8
  466. package/dist/src/events/reactor.d.ts.map +0 -1
  467. package/dist/src/events/reactor.js +0 -25
  468. package/dist/src/events/reactor.js.map +0 -1
  469. package/dist/src/events/renown.d.ts +0 -8
  470. package/dist/src/events/renown.d.ts.map +0 -1
  471. package/dist/src/events/renown.js +0 -27
  472. package/dist/src/events/renown.js.map +0 -1
  473. package/dist/src/events/types.d.ts +0 -60
  474. package/dist/src/events/types.d.ts.map +0 -1
  475. package/dist/src/events/types.js +0 -2
  476. package/dist/src/events/types.js.map +0 -1
  477. package/dist/src/events/user.d.ts +0 -14
  478. package/dist/src/events/user.d.ts.map +0 -1
  479. package/dist/src/events/user.js +0 -49
  480. package/dist/src/events/user.js.map +0 -1
  481. package/dist/src/events/vetra-packages.d.ts +0 -8
  482. package/dist/src/events/vetra-packages.d.ts.map +0 -1
  483. package/dist/src/events/vetra-packages.js +0 -29
  484. package/dist/src/events/vetra-packages.js.map +0 -1
  485. package/dist/src/hooks/config.d.ts +0 -5
  486. package/dist/src/hooks/config.d.ts.map +0 -1
  487. package/dist/src/hooks/config.js +0 -18
  488. package/dist/src/hooks/config.js.map +0 -1
  489. package/dist/src/hooks/documents.d.ts +0 -13
  490. package/dist/src/hooks/documents.d.ts.map +0 -1
  491. package/dist/src/hooks/documents.js +0 -46
  492. package/dist/src/hooks/documents.js.map +0 -1
  493. package/dist/src/hooks/drive-context.d.ts +0 -21
  494. package/dist/src/hooks/drive-context.d.ts.map +0 -1
  495. package/dist/src/hooks/drive-context.js +0 -26
  496. package/dist/src/hooks/drive-context.js.map +0 -1
  497. package/dist/src/hooks/nodes.d.ts +0 -41
  498. package/dist/src/hooks/nodes.d.ts.map +0 -1
  499. package/dist/src/hooks/nodes.js +0 -160
  500. package/dist/src/hooks/nodes.js.map +0 -1
  501. package/dist/src/types/drive-editor.d.ts +0 -71
  502. package/dist/src/types/drive-editor.d.ts.map +0 -1
  503. package/dist/src/types/drive-editor.js +0 -2
  504. package/dist/src/types/drive-editor.js.map +0 -1
  505. package/dist/tsconfig.lib.tsbuildinfo +0 -1
  506. /package/dist/src/{events → hooks}/add-ph-event-handlers.d.ts +0 -0
package/README.md CHANGED
@@ -8,9 +8,9 @@ This library provides hooks intended to be used by editors (including drive edit
8
8
 
9
9
  All of the data used by these hooks is ultimately derived from the `Reactor`, which manages the asynchronous eventually consistent state of drives and documents.
10
10
 
11
-
12
11
  ### Selected drives, folders and documents
13
- In the application, there are certain items that can be set as "selected".
12
+
13
+ In the application, there are certain items that can be set as "selected".
14
14
 
15
15
  - selected drive
16
16
  - selected folder
@@ -32,15 +32,16 @@ To set the selected document/folder, we provide a function `setSelectedNode` whi
32
32
 
33
33
  ## Hooks
34
34
 
35
-
36
35
  ### Reactor
36
+
37
37
  ```ts
38
- function useReactor(): Reactor | undefined
38
+ function useReactor(): Reactor | undefined;
39
39
  ```
40
40
 
41
- Returns the reactor instance.
41
+ Returns the reactor instance.
42
42
 
43
43
  ##### Usage
44
+
44
45
  ```jsx
45
46
  import { useReactor } from '@powerhousedao/state`
46
47
 
@@ -52,15 +53,17 @@ function MyEditorComponent() {
52
53
  ### Drives
53
54
 
54
55
  #### useDrives
56
+
55
57
  ```ts
56
- function useDrives(): DocumentDriveDocument[] | undefined
58
+ function useDrives(): DocumentDriveDocument[] | undefined;
57
59
  ```
60
+
58
61
  Returns the drives for a reactor.
59
62
 
60
63
  ##### Usage
61
64
 
62
65
  ```jsx
63
- import { useDrives } from '@powerhousedao/state';
66
+ import { useDrives } from "@powerhousedao/state";
64
67
 
65
68
  function MyEditorComponent() {
66
69
  const drives = useDrives();
@@ -68,8 +71,11 @@ function MyEditorComponent() {
68
71
  ```
69
72
 
70
73
  #### useDriveById
74
+
71
75
  ```ts
72
- function useDriveById(id: string | null | undefined): DocumentDriveDocument | undefined
76
+ function useDriveById(
77
+ id: string | null | undefined,
78
+ ): DocumentDriveDocument | undefined;
73
79
  ```
74
80
 
75
81
  Returns a drive by id.
@@ -77,7 +83,7 @@ Returns a drive by id.
77
83
  ##### Usage
78
84
 
79
85
  ```jsx
80
- import { useDriveById } from '@powerhousedao/state';
86
+ import { useDriveById } from "@powerhousedao/state";
81
87
 
82
88
  function MyEditorComponent() {
83
89
  const driveById = useDriveById();
@@ -85,8 +91,9 @@ function MyEditorComponent() {
85
91
  ```
86
92
 
87
93
  #### useSelectedDrive
94
+
88
95
  ```ts
89
- function useSelectedDrive(): DocumentDriveDocument | undefined
96
+ function useSelectedDrive(): DocumentDriveDocument | undefined;
90
97
  ```
91
98
 
92
99
  Returns the selected drive. You can se the selected drive with `setSelectedDrive`.
@@ -94,7 +101,7 @@ Returns the selected drive. You can se the selected drive with `setSelectedDrive
94
101
  ##### Usage
95
102
 
96
103
  ```jsx
97
- import { useSelectedDrive } from '@powerhousedao/state';
104
+ import { useSelectedDrive } from "@powerhousedao/state";
98
105
 
99
106
  function MyEditorComponent() {
100
107
  const selectedDrive = useSelectedDrive();
@@ -102,41 +109,48 @@ function MyEditorComponent() {
102
109
  ```
103
110
 
104
111
  #### drive properties convenience hooks
112
+
105
113
  We provide hooks for accessing various properties on the drive object for your convenience. These use the above hooks to get a drive and then return properties in the object.
106
114
 
107
115
  ```ts
108
116
  /** Returns the remote URL for a drive. */
109
- function useDriveRemoteUrl(driveId: string | null | undefined): string | undefined
117
+ function useDriveRemoteUrl(
118
+ driveId: string | null | undefined,
119
+ ): string | undefined;
110
120
 
111
121
  /** Returns the pull responder trigger for a drive. */
112
122
  function useDrivePullResponderTrigger(
113
123
  driveId: string | null | undefined,
114
- ): Trigger | undefined
124
+ ): Trigger | undefined;
115
125
 
116
126
  /** Returns the pull responder URL for a drive. */
117
- function useDrivePullResponderUrl(driveId: string | null | undefined): string | undefined
127
+ function useDrivePullResponderUrl(
128
+ driveId: string | null | undefined,
129
+ ): string | undefined;
118
130
 
119
131
  /** Returns whether a drive is remote. */
120
- function useDriveIsRemote(driveId: string | null | undefined): boolean
132
+ function useDriveIsRemote(driveId: string | null | undefined): boolean;
121
133
 
122
134
  /** Returns the sharing type for a drive. */
123
- function useDriveSharingType(driveId: string | null | undefined): SharingType | undefined
135
+ function useDriveSharingType(
136
+ driveId: string | null | undefined,
137
+ ): SharingType | undefined;
124
138
 
125
139
  /** Returns whether a drive is available offline. */
126
- function useDriveAvailableOffline(driveId: string | null | undefined): boolean
140
+ function useDriveAvailableOffline(driveId: string | null | undefined): boolean;
127
141
  ```
128
142
 
129
143
  ##### Usage
130
144
 
131
145
  ```jsx
132
- import {
146
+ import {
133
147
  useDriveRemoteUrl,
134
148
  useDrivePullResponderTrigger,
135
149
  useDrivePullResponderUrl,
136
150
  useDriveIsRemote,
137
151
  useDriveSharingType,
138
152
  useDriveAvailableOffline,
139
- } from '@powerhousedao/state';
153
+ } from "@powerhousedao/state";
140
154
 
141
155
  function MyEditorComponent() {
142
156
  const myDriveId = "some-drive-id";
@@ -154,68 +168,147 @@ function MyEditorComponent() {
154
168
  driveIsRemote,
155
169
  driveSharingType,
156
170
  driveAvailableOffline,
157
- })
171
+ });
158
172
  }
159
173
  ```
160
174
 
161
175
  ### Documents
162
176
 
163
- #### useAllDocuments/useSelectedDriveDocuments
177
+ #### useDocumentById
178
+
164
179
  ```ts
165
- function useAllDocuments(): PHDocument[] | undefined
180
+ function useDocumentById(id: string | null | undefined): PHDocument | undefined;
181
+ ```
182
+
183
+ Returns a document and a dispatch function by id.
184
+
185
+ ##### Usage
186
+
187
+ ```jsx
188
+ import { useDocumentById } from "@powerhousedao/state";
189
+
190
+ function MyEditorComponent() {
191
+ const myDocumentId = "some-document-id";
192
+ const [document, dispatch] = useDocumentById(myDocumentId);
193
+ }
166
194
  ```
167
- Returns all of the documents in the reactor.
195
+
196
+ #### useGetDocument
168
197
 
169
198
  ```ts
170
- function useSelectedDriveDocuments(): PHDocument[] | undefined
199
+ function useGetDocument(id: string | null | undefined): PHDocument | undefined;
171
200
  ```
172
- Returns the documents in the reactor for the selected drive.
201
+
202
+ Retrieves a document from the reactor and subscribes to changes using React Suspense. This hook will suspend rendering while the document is loading.
173
203
 
174
204
  ##### Usage
175
205
 
176
206
  ```jsx
177
- import { useAllDocuments, useSelectedDriveDocuments } from '@powerhousedao/state';
207
+ import { useGetDocument } from "@powerhousedao/state";
178
208
 
179
209
  function MyEditorComponent() {
180
- const allDocuments = useAllDocuments();
181
- const selectedDriveDocuments = useSelectedDriveDocuments();
210
+ const documentId = "some-document-id";
211
+ const document = useGetDocument(documentId);
182
212
  }
183
213
  ```
184
214
 
185
- #### useSelectedDocument
215
+ #### useGetDocuments
216
+
186
217
  ```ts
187
- function useSelectedDocument(): PHDocument | undefined
218
+ function useGetDocuments(
219
+ ids: string[] | null | undefined,
220
+ ): PHDocument[] | undefined;
188
221
  ```
189
- Returns the selected document. You can set the selected document with `setSelectedNode`.
222
+
223
+ Retrieves multiple documents from the reactor using React Suspense. This hook will suspend rendering while any of the documents are loading.
190
224
 
191
225
  ##### Usage
192
226
 
193
227
  ```jsx
194
- import { useSelectedDocument } from '@powerhousedao/state';
228
+ import { useGetDocuments } from "@powerhousedao/state";
195
229
 
196
230
  function MyEditorComponent() {
197
- const selectedDocument = useSelectedDocument();
231
+ const documentIds = ["doc-id-1", "doc-id-2", "doc-id-3"];
232
+ const documents = useGetDocuments(documentIds);
198
233
  }
199
234
  ```
200
235
 
201
- #### useDocumentById
236
+ #### useGetDocumentAsync
237
+
238
+ ```ts
239
+ function useGetDocumentAsync(id: string | null | undefined): {
240
+ status: "initial" | "pending" | "success" | "error";
241
+ data: PHDocument | undefined;
242
+ isPending: boolean;
243
+ error: unknown;
244
+ reload: (() => void) | undefined;
245
+ };
246
+ ```
247
+
248
+ Retrieves a document from the reactor without suspending rendering. Returns the current state of the document loading operation, including status, data, error, and a reload function.
249
+
250
+ ##### Usage
251
+
252
+ ```jsx
253
+ import { useGetDocumentAsync } from "@powerhousedao/state";
254
+
255
+ function MyEditorComponent() {
256
+ const documentId = "some-document-id";
257
+ const { status, data, isPending, error, reload } =
258
+ useGetDocumentAsync(documentId);
259
+
260
+ if (isPending) {
261
+ return <div>Loading...</div>;
262
+ }
263
+
264
+ if (error) {
265
+ return <div>Error: {error.message}</div>;
266
+ }
267
+
268
+ if (status === "success" && data) {
269
+ return <div>Document: {data.name}</div>;
270
+ }
271
+ }
272
+ ```
273
+
274
+ #### useDocumentsInSelectedDrive
275
+
276
+ ```ts
277
+ function useDocumentsInSelectedDrive(): PHDocument[] | undefined;
278
+ ```
279
+
280
+ Returns the documents in the reactor for the selected drive.
281
+
282
+ ##### Usage
283
+
284
+ ```jsx
285
+ import { useDocumentsInSelectedDrive } from "@powerhousedao/state";
286
+
287
+ function MyEditorComponent() {
288
+ const selectedDriveDocuments = useDocumentsInSelectedDrive();
289
+ }
290
+ ```
291
+
292
+ #### useSelectedDocument
293
+
202
294
  ```ts
203
- function useDocumentById(id: string | null | undefined): PHDocument | undefined
295
+ function useSelectedDocument(): PHDocument | undefined;
204
296
  ```
205
- Returns a document by id.
297
+
298
+ Returns the selected document. You can set the selected document with `setSelectedNode`.
206
299
 
207
300
  ##### Usage
208
301
 
209
302
  ```jsx
210
- import { useDocumentById } from '@powerhousedao/state';
303
+ import { useSelectedDocument } from "@powerhousedao/state";
211
304
 
212
305
  function MyEditorComponent() {
213
- const myDocumentId = 'some-document-id';
214
- const documentById = useDocumentById(myDocumentId);
306
+ const selectedDocument = useSelectedDocument();
215
307
  }
216
308
  ```
217
309
 
218
310
  ### Nodes
311
+
219
312
  "Nodes" refers to the items found in a given drive's `state.global.nodes` array. Nodes can represent both files (documents) and folders.
220
313
 
221
314
  A document in a drive will have a node in the drive's node list which has the same id as the document.
@@ -231,30 +324,32 @@ type FileNode = {
231
324
  kind: string;
232
325
  name: string;
233
326
  parentFolder: string | null | undefined;
234
- }
327
+ };
235
328
 
236
329
  type FolderNode = {
237
330
  id: string;
238
331
  kind: string;
239
332
  name: string;
240
333
  parentFolder: string | null | undefined;
241
- }
334
+ };
242
335
 
243
336
  type Node = FileNode | FolderNode;
244
337
  ```
245
338
 
246
339
  #### useNodes
340
+
247
341
  Ideally you should not need to handle the list of nodes directly, since we already provide documents and folders. But these hooks are provided just in case.
248
342
 
249
343
  ```ts
250
- function useNodes(): Node[] | undefined
344
+ function useNodes(): Node[] | undefined;
251
345
  ```
346
+
252
347
  Returns the nodes for a drive.
253
348
 
254
349
  ##### Usage
255
350
 
256
351
  ```jsx
257
- import { useNodes} from '@powerhousedao/state';
352
+ import { useNodes } from "@powerhousedao/state";
258
353
 
259
354
  function MyEditorComponent() {
260
355
  const nodes = useNodes();
@@ -262,34 +357,38 @@ function MyEditorComponent() {
262
357
  ```
263
358
 
264
359
  #### useNodeById
360
+
265
361
  ```ts
266
- function useNodeById(id: string | null | undefined): Node | undefined
362
+ function useNodeById(id: string | null | undefined): Node | undefined;
267
363
  ```
364
+
268
365
  Returns a node in the selected drive by id.
269
366
 
270
367
  ##### Usage
271
368
 
272
369
  ```jsx
273
- import { useNodeById } from '@powerhousedao/state';
370
+ import { useNodeById } from "@powerhousedao/state";
274
371
 
275
372
  function MyEditorComponent() {
276
- const myFolderId = 'some-folder-id';
277
- const myDocumentId = 'some-document-id';
373
+ const myFolderId = "some-folder-id";
374
+ const myDocumentId = "some-document-id";
278
375
  const myFolderNode = useNodeById(myFolderId);
279
376
  const myFileNode = useNodeById(myDocumentId);
280
377
  }
281
378
  ```
282
379
 
283
380
  #### useSelectedFolder
381
+
284
382
  ```ts
285
- function useSelectedFolder(): FolderNode | undefined
383
+ function useSelectedFolder(): FolderNode | undefined;
286
384
  ```
385
+
287
386
  Returns the selected folder. You can set the selected folder with `setSelectedNode`
288
387
 
289
388
  ##### Usage
290
389
 
291
390
  ```jsx
292
- import { useSelectedFolder } from '@powerhousedao/state';
391
+ import { useSelectedFolder } from "@powerhousedao/state";
293
392
 
294
393
  function MyEditorComponent() {
295
394
  const selectedFolder = useSelectedFolder();
@@ -297,9 +396,11 @@ function MyEditorComponent() {
297
396
  ```
298
397
 
299
398
  #### useSelectedNodePath
399
+
300
400
  ```ts
301
- function useSelectedNodePath(): Node[]
401
+ function useSelectedNodePath(): Node[];
302
402
  ```
403
+
303
404
  Returns the path to the selected node. Useful for navigational components like breadcrumbs.
304
405
 
305
406
  ##### Usage
@@ -317,18 +418,21 @@ function MyEditorComponent() {
317
418
  #### useChildNodes/useFolderChildNodes/useFileChildNodes
318
419
 
319
420
  ```ts
320
- function useChildNodes(): Node[]
421
+ function useChildNodes(): Node[];
321
422
  ```
423
+
322
424
  Returns the child nodes for the selected drive or folder.
323
425
 
324
426
  ```ts
325
- function useFolderChildNodes(): FolderNode[]
427
+ function useFolderChildNodes(): FolderNode[];
326
428
  ```
429
+
327
430
  Returns the folder child nodes for the selected drive or folder.
328
431
 
329
432
  ```ts
330
- function useFileChildNodes(): FileNode[]
433
+ function useFileChildNodes(): FileNode[];
331
434
  ```
435
+
332
436
  Returns the file (document) child nodes for the selected drive or folder.
333
437
 
334
438
  ##### Usage
@@ -352,17 +456,23 @@ function MyEditorComponent() {
352
456
  ```
353
457
 
354
458
  #### useChildNodesForId/useFolderChildNodesForId/useFileChildNodesForId
459
+
355
460
  ```ts
356
- function useChildNodesForId(id: string | null | undefined): Node[]
461
+ function useChildNodesForId(id: string | null | undefined): Node[];
357
462
  ```
463
+
358
464
  Returns the child nodes for a drive or folder by id.
465
+
359
466
  ```ts
360
- function useFolderChildNodesForId(id: string | null | undefined): FolderNode[]
467
+ function useFolderChildNodesForId(id: string | null | undefined): FolderNode[];
361
468
  ```
469
+
362
470
  Returns the folder child nodes for a drive or folder by id.
471
+
363
472
  ```ts
364
- function useFileChildNodesForId(id: string | null | undefined): FileNode[]
473
+ function useFileChildNodesForId(id: string | null | undefined): FileNode[];
365
474
  ```
475
+
366
476
  Returns the file (document) child nodes for a drive or folder by id.
367
477
 
368
478
  ##### Usage
@@ -387,30 +497,34 @@ function MyEditorComponent() {
387
497
  ```
388
498
 
389
499
  #### useNodeName/useNodeKind
500
+
390
501
  ```ts
391
- function useNodeName(id: string | null | undefined): string | undefined
502
+ function useNodeName(id: string | null | undefined): string | undefined;
392
503
  ```
504
+
393
505
  Returns the name of a node.
506
+
394
507
  ```ts
395
- function useNodeKind(id: string | null | undefined): NodeKind | undefined
508
+ function useNodeKind(id: string | null | undefined): NodeKind | undefined;
396
509
  ```
510
+
397
511
  Returns the kind of a node.
398
512
 
399
513
  ##### Usage
400
514
 
401
515
  ```jsx
402
- import { useNodeName, useNodeKind } from '@powerhousedao/state';
516
+ import { useNodeName, useNodeKind } from "@powerhousedao/state";
403
517
 
404
518
  function MyEditorComponent() {
405
- const nodeId = 'some-node-id';
519
+ const nodeId = "some-node-id";
406
520
  const nodeName = useNodeName(nodeId);
407
521
  const nodeKind = useNodeKind(nodeId);
408
522
 
409
- if (nodeKind === 'file') {
523
+ if (nodeKind === "file") {
410
524
  return <File name={nodeName} />;
411
525
  }
412
526
 
413
- if (nodeKind === 'folder') {
527
+ if (nodeKind === "folder") {
414
528
  return <Folder name={nodeName} />;
415
529
  }
416
530
  }
@@ -433,7 +547,7 @@ Each Vetra package contains a `modules` field which optionally contains lists of
433
547
  #### useVetraPackages
434
548
 
435
549
  ```ts
436
- function useVetraPackages(): VetraPackage[] | undefined
550
+ function useVetraPackages(): VetraPackage[] | undefined;
437
551
  ```
438
552
 
439
553
  Returns all of the Vetra packages in your Connect app.
@@ -441,17 +555,17 @@ Returns all of the Vetra packages in your Connect app.
441
555
  ##### Usage
442
556
 
443
557
  ```jsx
444
- import { useVetraPackages } from '@powerhousedao/state'
558
+ import { useVetraPackages } from "@powerhousedao/state";
445
559
 
446
560
  function MyEditorComponent() {
447
- const vetraPackages = useVetraPackages()
561
+ const vetraPackages = useVetraPackages();
448
562
  }
449
563
  ```
450
564
 
451
565
  #### useDocumentModelModules
452
566
 
453
567
  ```ts
454
- function useDocumentModelModules(): DocumentModelModule[] | undefined
568
+ function useDocumentModelModules(): DocumentModelModule[] | undefined;
455
569
  ```
456
570
 
457
571
  Returns the document model modules from your Vetra packages.
@@ -459,38 +573,38 @@ Returns the document model modules from your Vetra packages.
459
573
  ##### Usage
460
574
 
461
575
  ```jsx
462
- import { useDocumentModelModules } from '@powerhousedao/state'
576
+ import { useDocumentModelModules } from "@powerhousedao/state";
463
577
 
464
578
  function MyEditorComponent() {
465
- const documentModelModules = useDocumentModelModules()
579
+ const documentModelModules = useDocumentModelModules();
466
580
  }
467
581
  ```
468
582
 
469
583
  #### useDocumentModelModuleById
470
584
 
471
585
  ```ts
472
- function useDocumentModelModuleById(): DocumentModelModule[] | undefined
586
+ function useDocumentModelModuleById(): DocumentModelModule[] | undefined;
473
587
  ```
474
588
 
475
589
  Returns the document model for a given id (document type).
476
- *NOTE* What we call here an id is really the value in the "document type" field in the document model editor
477
- *NOTE* Connect assumes that these document types (ids) are unique. It is your responsibility to enforce this.
590
+ _NOTE_ What we call here an id is really the value in the "document type" field in the document model editor
591
+ _NOTE_ Connect assumes that these document types (ids) are unique. It is your responsibility to enforce this.
478
592
 
479
593
  ##### Usage
480
594
 
481
595
  ```jsx
482
- import { useDocumentModelModuleById } from '@powerhousedao/state'
596
+ import { useDocumentModelModuleById } from "@powerhousedao/state";
483
597
 
484
598
  function MyEditorComponent() {
485
- const documentType = 'my-org/my-document';
486
- const documentModelModuleById = useDocumentModelModuleById(documentType)
599
+ const documentType = "my-org/my-document";
600
+ const documentModelModuleById = useDocumentModelModuleById(documentType);
487
601
  }
488
602
  ```
489
603
 
490
604
  #### useEditorModules
491
605
 
492
606
  ```ts
493
- function useEditorModules(): EditorModule[] | undefined
607
+ function useEditorModules(): EditorModule[] | undefined;
494
608
  ```
495
609
 
496
610
  Returns the editor modules from your Vetra packages.
@@ -498,17 +612,17 @@ Returns the editor modules from your Vetra packages.
498
612
  ##### Usage
499
613
 
500
614
  ```jsx
501
- import { useEditorModules } from '@powerhousedao/state'
615
+ import { useEditorModules } from "@powerhousedao/state";
502
616
 
503
617
  function MyEditorComponent() {
504
- const editorModules = useEditorModules()
618
+ const editorModules = useEditorModules();
505
619
  }
506
620
  ```
507
621
 
508
622
  #### useDriveEditorModules
509
623
 
510
624
  ```ts
511
- function useDriveEditorModules(): DriveEditorModule[] | undefined
625
+ function useDriveEditorModules(): DriveEditorModule[] | undefined;
512
626
  ```
513
627
 
514
628
  Returns the drive editor modules from your Vetra packages.
@@ -516,17 +630,17 @@ Returns the drive editor modules from your Vetra packages.
516
630
  ##### Usage
517
631
 
518
632
  ```jsx
519
- import { useDriveEditorModules } from '@powerhousedao/state'
633
+ import { useDriveEditorModules } from "@powerhousedao/state";
520
634
 
521
635
  function MyDriveEditorComponent() {
522
- const driveEditorModules = useDriveEditorModules()
636
+ const driveEditorModules = useDriveEditorModules();
523
637
  }
524
638
  ```
525
639
 
526
640
  #### useProcessorModules
527
641
 
528
642
  ```ts
529
- function useProcessorModules(): ProcessorModule[] | undefined
643
+ function useProcessorModules(): ProcessorModule[] | undefined;
530
644
  ```
531
645
 
532
646
  Returns the processor modules from your Vetra packages.
@@ -534,17 +648,17 @@ Returns the processor modules from your Vetra packages.
534
648
  ##### Usage
535
649
 
536
650
  ```jsx
537
- import { useProcessorModules } from '@powerhousedao/state'
651
+ import { useProcessorModules } from "@powerhousedao/state";
538
652
 
539
653
  function MyProcessorComponent() {
540
- const processorModules = useProcessorModules()
654
+ const processorModules = useProcessorModules();
541
655
  }
542
656
  ```
543
657
 
544
658
  #### useSubgraphModules
545
659
 
546
660
  ```ts
547
- function useSubgraphModules(): SubgraphModule[] | undefined
661
+ function useSubgraphModules(): SubgraphModule[] | undefined;
548
662
  ```
549
663
 
550
664
  Returns the subgraph modules from your Vetra packages.
@@ -552,17 +666,17 @@ Returns the subgraph modules from your Vetra packages.
552
666
  ##### Usage
553
667
 
554
668
  ```jsx
555
- import { useSubgraphModules } from '@powerhousedao/state'
669
+ import { useSubgraphModules } from "@powerhousedao/state";
556
670
 
557
671
  function MySubgraphComponent() {
558
- const subgraphModules = useSubgraphModules()
672
+ const subgraphModules = useSubgraphModules();
559
673
  }
560
674
  ```
561
675
 
562
676
  #### useImportScriptModules
563
677
 
564
678
  ```ts
565
- function useImportScriptModules(): ImportScriptModule[] | undefined
679
+ function useImportScriptModules(): ImportScriptModule[] | undefined;
566
680
  ```
567
681
 
568
682
  Returns the import script modules from your Vetra packages.
@@ -570,9 +684,9 @@ Returns the import script modules from your Vetra packages.
570
684
  ##### Usage
571
685
 
572
686
  ```jsx
573
- import { useImportScriptModules } from '@powerhousedao/state'
687
+ import { useImportScriptModules } from "@powerhousedao/state";
574
688
 
575
689
  function MyImportScriptComponent() {
576
- const importScriptModules = useImportScriptModules()
690
+ const importScriptModules = useImportScriptModules();
577
691
  }
578
- ```
692
+ ```
@@ -1,4 +1,4 @@
1
- import { type Action, type PHDocument } from "document-model";
2
- export declare function dispatchActions(actionOrActions: Action[] | Action | undefined, document: PHDocument | undefined): Promise<PHDocument | undefined>;
1
+ import type { Action, PHDocument } from "document-model";
2
+ export declare function dispatchActions<TDocument = PHDocument, TAction = Action>(actionOrActions: TAction[] | TAction | undefined, document: TDocument | undefined): Promise<PHDocument | undefined>;
3
3
  export declare function dispatchActions(actionOrActions: Action[] | Action | undefined, documentId: string): Promise<PHDocument | undefined>;
4
4
  //# sourceMappingURL=dispatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/actions/dispatch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAe9D,wBAAsB,eAAe,CACnC,eAAe,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,EAC9C,QAAQ,EAAE,UAAU,GAAG,SAAS,GAC/B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;AACnC,wBAAsB,eAAe,CACnC,eAAe,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,EAE9C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/actions/dispatch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAezD,wBAAsB,eAAe,CAAC,SAAS,GAAG,UAAU,EAAE,OAAO,GAAG,MAAM,EAC5E,eAAe,EAAE,OAAO,EAAE,GAAG,OAAO,GAAG,SAAS,EAChD,QAAQ,EAAE,SAAS,GAAG,SAAS,GAC9B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;AACnC,wBAAsB,eAAe,CACnC,eAAe,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,EAE9C,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC"}
@@ -3,7 +3,7 @@ import { queueActions } from "./queue.js";
3
3
  import { makeSignedActionsWithContext } from "./sign.js";
4
4
  async function getDocument(documentId) {
5
5
  try {
6
- return await window.reactor?.getDocument(documentId);
6
+ return await window.ph?.reactor?.getDocument(documentId);
7
7
  }
8
8
  catch (error) {
9
9
  logger.debug(`Failed to get document with id ${documentId}:`, error);