@powerhousedao/shared 6.2.3-dev.4 → 6.2.3-dev.41

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 (273) hide show
  1. package/dist/analytics/index.d.ts +4 -4
  2. package/dist/analytics/index.d.ts.map +1 -1
  3. package/dist/analytics/index.js +25 -24
  4. package/dist/analytics/index.js.map +1 -1
  5. package/dist/clis/args/{access-token-To5LaIfL.mjs → access-token-3Hqv_U8I.mjs} +2 -2
  6. package/dist/clis/args/{access-token-To5LaIfL.mjs.map → access-token-3Hqv_U8I.mjs.map} +1 -1
  7. package/dist/clis/args/access-token-C5sKsH2O.d.mts +16 -0
  8. package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +1 -0
  9. package/dist/clis/args/access-token.d.mts +3 -2
  10. package/dist/clis/args/access-token.mjs +1 -1
  11. package/dist/clis/args/{common-CcYbXrBx.mjs → common-BXabdhiO.mjs} +30 -7
  12. package/dist/clis/args/common-BXabdhiO.mjs.map +1 -0
  13. package/dist/clis/args/common-Bnm859xU.d.mts +186 -0
  14. package/dist/clis/args/common-Bnm859xU.d.mts.map +1 -0
  15. package/dist/clis/args/common.d.mts +3 -2
  16. package/dist/clis/args/common.mjs +1 -1
  17. package/dist/clis/args/{connect-BVVvCmL9.mjs → connect-BG3HkYBk.mjs} +8 -3
  18. package/dist/clis/args/connect-BG3HkYBk.mjs.map +1 -0
  19. package/dist/clis/args/connect-DjeiqXus.d.mts +450 -0
  20. package/dist/clis/args/connect-DjeiqXus.d.mts.map +1 -0
  21. package/dist/clis/args/connect.d.mts +3 -2
  22. package/dist/clis/args/connect.mjs +1 -1
  23. package/dist/clis/args/{generate-CA916Fvj.mjs → generate-BOItUNvP.mjs} +40 -2
  24. package/dist/clis/args/generate-BOItUNvP.mjs.map +1 -0
  25. package/dist/clis/args/generate-BPBBLeUD.d.mts +103 -0
  26. package/dist/clis/args/generate-BPBBLeUD.d.mts.map +1 -0
  27. package/dist/clis/args/generate.d.mts +3 -2
  28. package/dist/clis/args/generate.mjs +1 -1
  29. package/dist/clis/args/{help-Bqbgbalu.mjs → help-DS1NlcJQ.mjs} +15 -15
  30. package/dist/clis/args/{help-Bqbgbalu.mjs.map → help-DS1NlcJQ.mjs.map} +1 -1
  31. package/dist/clis/args/help-DVPTARGn.d.mts +190 -0
  32. package/dist/clis/args/help-DVPTARGn.d.mts.map +1 -0
  33. package/dist/clis/args/help.d.mts +3 -2
  34. package/dist/clis/args/help.mjs +1 -1
  35. package/dist/clis/args/index.d.mts +20 -19
  36. package/dist/clis/args/index.mjs +18 -18
  37. package/dist/clis/args/init-CFeTq4Cq.d.mts +52 -0
  38. package/dist/clis/args/init-CFeTq4Cq.d.mts.map +1 -0
  39. package/dist/clis/args/{init-rz9Ei7nq.mjs → init-Dvb42Y87.mjs} +2 -2
  40. package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-Dvb42Y87.mjs.map} +1 -1
  41. package/dist/clis/args/init.d.mts +3 -2
  42. package/dist/clis/args/init.mjs +1 -1
  43. package/dist/clis/args/inspect-BjRmtB86.d.mts +13 -0
  44. package/dist/clis/args/inspect-BjRmtB86.d.mts.map +1 -0
  45. package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-UNQgtuR0.mjs} +2 -2
  46. package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-UNQgtuR0.mjs.map} +1 -1
  47. package/dist/clis/args/inspect.d.mts +3 -2
  48. package/dist/clis/args/inspect.mjs +1 -1
  49. package/dist/clis/args/install-B0tMyUMw.d.mts +37 -0
  50. package/dist/clis/args/install-B0tMyUMw.d.mts.map +1 -0
  51. package/dist/clis/args/{install-Sz2DlCHh.mjs → install-F-27kF6m.mjs} +2 -2
  52. package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-F-27kF6m.mjs.map} +1 -1
  53. package/dist/clis/args/install.d.mts +3 -2
  54. package/dist/clis/args/install.mjs +1 -1
  55. package/dist/clis/args/{list-DM2d6f1m.mjs → list-Bkfn8Yuo.mjs} +2 -2
  56. package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-Bkfn8Yuo.mjs.map} +1 -1
  57. package/dist/clis/args/list-DrbxA7JJ.d.mts +10 -0
  58. package/dist/clis/args/list-DrbxA7JJ.d.mts.map +1 -0
  59. package/dist/clis/args/list.d.mts +3 -2
  60. package/dist/clis/args/list.mjs +1 -1
  61. package/dist/clis/args/{login-DiKT5Jfu.mjs → login-CIFkQExi.mjs} +2 -2
  62. package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-CIFkQExi.mjs.map} +1 -1
  63. package/dist/clis/args/login-CXRJXg71.d.mts +25 -0
  64. package/dist/clis/args/login-CXRJXg71.d.mts.map +1 -0
  65. package/dist/clis/args/login.d.mts +3 -2
  66. package/dist/clis/args/login.mjs +1 -1
  67. package/dist/clis/args/{magic-string.es-h_0HDQBQ.mjs → magic-string.es-BWtG0AyA.mjs} +33 -27
  68. package/dist/clis/args/magic-string.es-BWtG0AyA.mjs.map +1 -0
  69. package/dist/clis/args/migrate-DkCQRL2D.d.mts +19 -0
  70. package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +1 -0
  71. package/dist/clis/args/{migrate-CG_gWc4k.mjs → migrate-DwJGhc2d.mjs} +2 -2
  72. package/dist/clis/args/{migrate-CG_gWc4k.mjs.map → migrate-DwJGhc2d.mjs.map} +1 -1
  73. package/dist/clis/args/migrate.d.mts +3 -2
  74. package/dist/clis/args/migrate.mjs +1 -1
  75. package/dist/clis/args/publish-CeW4bOrl.d.mts +16 -0
  76. package/dist/clis/args/publish-CeW4bOrl.d.mts.map +1 -0
  77. package/dist/clis/args/{publish-DDZYsUfV.mjs → publish-DHqlGWmL.mjs} +2 -2
  78. package/dist/clis/args/{publish-DDZYsUfV.mjs.map → publish-DHqlGWmL.mjs.map} +1 -1
  79. package/dist/clis/args/publish.d.mts +3 -2
  80. package/dist/clis/args/publish.mjs +1 -1
  81. package/dist/clis/args/{registry-C_OVFQmI.mjs → registry-DIwES3l2.mjs} +2 -2
  82. package/dist/clis/args/{registry-C_OVFQmI.mjs.map → registry-DIwES3l2.mjs.map} +1 -1
  83. package/dist/clis/args/registry-DNH8xuaE.d.mts +17 -0
  84. package/dist/clis/args/registry-DNH8xuaE.d.mts.map +1 -0
  85. package/dist/clis/args/registry.d.mts +3 -2
  86. package/dist/clis/args/registry.mjs +1 -1
  87. package/dist/clis/args/service-CHjY5epu.d.mts +27 -0
  88. package/dist/clis/args/service-CHjY5epu.d.mts.map +1 -0
  89. package/dist/clis/args/{service-CHOOr0Gg.mjs → service-Cpjlyeu5.mjs} +2 -2
  90. package/dist/clis/args/{service-CHOOr0Gg.mjs.map → service-Cpjlyeu5.mjs.map} +1 -1
  91. package/dist/clis/args/service.d.mts +3 -2
  92. package/dist/clis/args/service.mjs +1 -1
  93. package/dist/clis/args/{switchboard-Dsp7nosi.mjs → switchboard-CCaAtU56.mjs} +2 -2
  94. package/dist/clis/args/{switchboard-Dsp7nosi.mjs.map → switchboard-CCaAtU56.mjs.map} +1 -1
  95. package/dist/clis/args/switchboard-RrNb1fUH.d.mts +70 -0
  96. package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +1 -0
  97. package/dist/clis/args/switchboard.d.mts +3 -2
  98. package/dist/clis/args/switchboard.mjs +1 -1
  99. package/dist/clis/args/{uninstall-CTwTX0u_.mjs → uninstall-3U0B8g5c.mjs} +2 -2
  100. package/dist/clis/args/{uninstall-CTwTX0u_.mjs.map → uninstall-3U0B8g5c.mjs.map} +1 -1
  101. package/dist/clis/args/uninstall-CDx7lwxn.d.mts +28 -0
  102. package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +1 -0
  103. package/dist/clis/args/uninstall.d.mts +3 -2
  104. package/dist/clis/args/uninstall.mjs +1 -1
  105. package/dist/clis/args/unpublish-CEDsk6uv.d.mts +22 -0
  106. package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +1 -0
  107. package/dist/clis/args/{unpublish-BPMkGEg5.mjs → unpublish-s9zUh6Gw.mjs} +2 -2
  108. package/dist/clis/args/{unpublish-BPMkGEg5.mjs.map → unpublish-s9zUh6Gw.mjs.map} +1 -1
  109. package/dist/clis/args/unpublish.d.mts +3 -2
  110. package/dist/clis/args/unpublish.mjs +1 -1
  111. package/dist/clis/args/{vetra-b4KUu1Ax.mjs → vetra-BUNlAAPp.mjs} +2 -2
  112. package/dist/clis/args/{vetra-b4KUu1Ax.mjs.map → vetra-BUNlAAPp.mjs.map} +1 -1
  113. package/dist/clis/args/vetra-DkDaWFPi.d.mts +111 -0
  114. package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +1 -0
  115. package/dist/clis/args/vetra-ports.test.d.mts +2 -1
  116. package/dist/clis/args/vetra-ports.test.mjs +285 -180
  117. package/dist/clis/args/vetra-ports.test.mjs.map +1 -1
  118. package/dist/clis/args/vetra.d.mts +3 -2
  119. package/dist/clis/args/vetra.mjs +1 -1
  120. package/dist/clis/build-config-CR5lvv_A.mjs +231 -0
  121. package/dist/clis/build-config-CR5lvv_A.mjs.map +1 -0
  122. package/dist/clis/build-config.d.mts +44 -10614
  123. package/dist/clis/build-config.d.mts.map +1 -1
  124. package/dist/clis/build-config.mjs +2 -88
  125. package/dist/clis/build-pieces.d.mts +100 -0
  126. package/dist/clis/build-pieces.d.mts.map +1 -0
  127. package/dist/clis/build-pieces.mjs +371 -0
  128. package/dist/clis/build-pieces.mjs.map +1 -0
  129. package/dist/clis/command-names.d.mts +2 -2
  130. package/dist/clis/command-names.d.mts.map +1 -1
  131. package/dist/clis/command-names.mjs.map +1 -1
  132. package/dist/clis/constants.d.mts +3 -462
  133. package/dist/clis/constants.mjs +25 -8
  134. package/dist/clis/constants.mjs.map +1 -1
  135. package/dist/clis/index-6CZwrmQi.d.mts +11154 -0
  136. package/dist/clis/index-6CZwrmQi.d.mts.map +1 -0
  137. package/dist/clis/index.d.mts +1382 -1221
  138. package/dist/clis/index.d.mts.map +1 -1
  139. package/dist/clis/index.mjs +257 -71
  140. package/dist/clis/index.mjs.map +1 -1
  141. package/dist/clis/project-env.d.mts +4 -4
  142. package/dist/clis/project-env.d.mts.map +1 -1
  143. package/dist/clis/project-env.mjs.map +1 -1
  144. package/dist/clis/project-ports.d.mts +5 -5
  145. package/dist/clis/project-ports.d.mts.map +1 -1
  146. package/dist/clis/project-ports.mjs +1 -1
  147. package/dist/clis/project-ports.mjs.map +1 -1
  148. package/dist/clis/services/telemetry.d.mts +7 -7
  149. package/dist/clis/services/telemetry.d.mts.map +1 -1
  150. package/dist/clis/services/telemetry.mjs.map +1 -1
  151. package/dist/clis/types-DM26OWlT.d.mts +541 -0
  152. package/dist/clis/types-DM26OWlT.d.mts.map +1 -0
  153. package/dist/clis/utils.d.mts +4 -4
  154. package/dist/clis/utils.d.mts.map +1 -1
  155. package/dist/clis/utils.mjs.map +1 -1
  156. package/dist/{config-loader-B845Hidf.js → config-loader-CXhzL512.js} +33 -8
  157. package/dist/config-loader-CXhzL512.js.map +1 -0
  158. package/dist/connect/config-loader.d.ts +15 -8
  159. package/dist/connect/config-loader.d.ts.map +1 -1
  160. package/dist/connect/config-loader.js +2 -2
  161. package/dist/connect/index.d.ts +190 -56
  162. package/dist/connect/index.d.ts.map +1 -1
  163. package/dist/connect/index.js +303 -30
  164. package/dist/connect/index.js.map +1 -1
  165. package/dist/connect/json-adapter.d.ts +3 -4
  166. package/dist/connect/json-adapter.d.ts.map +1 -1
  167. package/dist/connect/json-adapter.js.map +1 -1
  168. package/dist/constants-CZasmdmu.d.ts +9 -0
  169. package/dist/constants-CZasmdmu.d.ts.map +1 -0
  170. package/dist/constants.d.ts +3 -2
  171. package/dist/constants.js +11 -5
  172. package/dist/constants.js.map +1 -1
  173. package/dist/document-drive/index.d.ts +131 -105
  174. package/dist/document-drive/index.d.ts.map +1 -1
  175. package/dist/document-drive/index.js +116 -54
  176. package/dist/document-drive/index.js.map +1 -1
  177. package/dist/document-model/index.d.ts +4 -4
  178. package/dist/document-model/index.js +294 -231
  179. package/dist/document-model/index.js.map +1 -1
  180. package/dist/document-model/mock.d.ts +2 -3
  181. package/dist/document-model/mock.d.ts.map +1 -1
  182. package/dist/document-model/mock.js +2 -1
  183. package/dist/document-model/mock.js.map +1 -1
  184. package/dist/document-model/utils.d.ts +3 -2
  185. package/dist/document-model/utils.js +1 -1
  186. package/dist/index-DdXp-CVw.d.ts +36 -0
  187. package/dist/index-DdXp-CVw.d.ts.map +1 -0
  188. package/dist/index.d.ts +7 -6
  189. package/dist/index.js.map +1 -1
  190. package/dist/processors/index.d.ts +3 -2
  191. package/dist/processors/index.js +63 -4
  192. package/dist/processors/index.js.map +1 -1
  193. package/dist/purge-v06m_oGz.js +381 -0
  194. package/dist/purge-v06m_oGz.js.map +1 -0
  195. package/dist/registry/index.d.ts +15 -15
  196. package/dist/registry/index.d.ts.map +1 -1
  197. package/dist/registry/index.js +24 -6
  198. package/dist/registry/index.js.map +1 -1
  199. package/dist/registry/manifest-slim.d.ts +4 -3
  200. package/dist/registry/manifest-slim.d.ts.map +1 -1
  201. package/dist/registry/manifest-slim.js +21 -0
  202. package/dist/registry/manifest-slim.js.map +1 -1
  203. package/dist/registry/updates.d.ts +3 -3
  204. package/dist/registry/updates.d.ts.map +1 -1
  205. package/dist/registry/updates.js.map +1 -1
  206. package/dist/registry/urls.d.ts +2 -2
  207. package/dist/registry/urls.d.ts.map +1 -1
  208. package/dist/registry/urls.js.map +1 -1
  209. package/dist/{types-YqLqb0Zb.d.ts → types-B11NGQOQ.d.ts} +39 -43
  210. package/dist/types-B11NGQOQ.d.ts.map +1 -0
  211. package/dist/{types-C1in4fl3.d.ts → types-Bsp8VL2y.d.ts} +2 -2
  212. package/dist/types-Bsp8VL2y.d.ts.map +1 -0
  213. package/dist/{types-CpnWmiFY.d.ts → types-CFbd2nan.d.ts} +2012 -821
  214. package/dist/types-CFbd2nan.d.ts.map +1 -0
  215. package/dist/{utils-DP122OSS.d.ts → utils-BrKxCmKx.d.ts} +2 -2
  216. package/dist/utils-BrKxCmKx.d.ts.map +1 -0
  217. package/dist/{utils-aaTmfxFW.js → utils-CSF716ux.js} +10 -3
  218. package/dist/utils-CSF716ux.js.map +1 -0
  219. package/package.json +10 -5
  220. package/dist/clis/args/access-token--9H57y8J.d.mts +0 -18
  221. package/dist/clis/args/access-token--9H57y8J.d.mts.map +0 -1
  222. package/dist/clis/args/common-CcYbXrBx.mjs.map +0 -1
  223. package/dist/clis/args/common-zPBoTNJF.d.mts +0 -183
  224. package/dist/clis/args/common-zPBoTNJF.d.mts.map +0 -1
  225. package/dist/clis/args/connect-BVVvCmL9.mjs.map +0 -1
  226. package/dist/clis/args/connect-BtU0MTTc.d.mts +0 -443
  227. package/dist/clis/args/connect-BtU0MTTc.d.mts.map +0 -1
  228. package/dist/clis/args/generate-CA916Fvj.mjs.map +0 -1
  229. package/dist/clis/args/generate-DnV-bfXt.d.mts +0 -87
  230. package/dist/clis/args/generate-DnV-bfXt.d.mts.map +0 -1
  231. package/dist/clis/args/help-CjAsudUn.d.mts +0 -193
  232. package/dist/clis/args/help-CjAsudUn.d.mts.map +0 -1
  233. package/dist/clis/args/init-CUXyfquF.d.mts +0 -55
  234. package/dist/clis/args/init-CUXyfquF.d.mts.map +0 -1
  235. package/dist/clis/args/inspect-DtZeoA5c.d.mts +0 -15
  236. package/dist/clis/args/inspect-DtZeoA5c.d.mts.map +0 -1
  237. package/dist/clis/args/install-CkP8zcHb.d.mts +0 -40
  238. package/dist/clis/args/install-CkP8zcHb.d.mts.map +0 -1
  239. package/dist/clis/args/list-BGf8s_gj.d.mts +0 -12
  240. package/dist/clis/args/list-BGf8s_gj.d.mts.map +0 -1
  241. package/dist/clis/args/login-DNsHwvqk.d.mts +0 -27
  242. package/dist/clis/args/login-DNsHwvqk.d.mts.map +0 -1
  243. package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs.map +0 -1
  244. package/dist/clis/args/migrate-sixkWhxm.d.mts +0 -21
  245. package/dist/clis/args/migrate-sixkWhxm.d.mts.map +0 -1
  246. package/dist/clis/args/publish-Dqe5DUst.d.mts +0 -18
  247. package/dist/clis/args/publish-Dqe5DUst.d.mts.map +0 -1
  248. package/dist/clis/args/registry-C_RfTsKB.d.mts +0 -19
  249. package/dist/clis/args/registry-C_RfTsKB.d.mts.map +0 -1
  250. package/dist/clis/args/service-DhIkf8-O.d.mts +0 -22
  251. package/dist/clis/args/service-DhIkf8-O.d.mts.map +0 -1
  252. package/dist/clis/args/switchboard-BlPaq2at.d.mts +0 -72
  253. package/dist/clis/args/switchboard-BlPaq2at.d.mts.map +0 -1
  254. package/dist/clis/args/uninstall-BpA3YYbw.d.mts +0 -31
  255. package/dist/clis/args/uninstall-BpA3YYbw.d.mts.map +0 -1
  256. package/dist/clis/args/unpublish-CvwaIimG.d.mts +0 -24
  257. package/dist/clis/args/unpublish-CvwaIimG.d.mts.map +0 -1
  258. package/dist/clis/args/vetra-CoMvTJK7.d.mts +0 -113
  259. package/dist/clis/args/vetra-CoMvTJK7.d.mts.map +0 -1
  260. package/dist/clis/build-config.mjs.map +0 -1
  261. package/dist/clis/constants.d.mts.map +0 -1
  262. package/dist/config-loader-B845Hidf.js.map +0 -1
  263. package/dist/constants-BP_gjn8g.d.ts +0 -8
  264. package/dist/constants-BP_gjn8g.d.ts.map +0 -1
  265. package/dist/index-C_iVZe7f.d.ts +0 -7
  266. package/dist/index-C_iVZe7f.d.ts.map +0 -1
  267. package/dist/index-DyYIJtVy.d.ts +0 -836
  268. package/dist/index-DyYIJtVy.d.ts.map +0 -1
  269. package/dist/types-C1in4fl3.d.ts.map +0 -1
  270. package/dist/types-CpnWmiFY.d.ts.map +0 -1
  271. package/dist/types-YqLqb0Zb.d.ts.map +0 -1
  272. package/dist/utils-DP122OSS.d.ts.map +0 -1
  273. package/dist/utils-aaTmfxFW.js.map +0 -1
@@ -1,26 +1,23 @@
1
- import { f as IAnalyticsStore } from "./types-C1in4fl3.js";
2
- import { ZodRawShape, z } from "zod";
1
+ import { f as IAnalyticsStore } from "./types-Bsp8VL2y.js";
2
+ import "./utils-BrKxCmKx.js";
3
+ import { ZodIssue, ZodRawShape, z } from "zod";
3
4
  import { Draft } from "mutative";
4
- import * as cmd_ts_dist_cjs_argparser_js0 from "cmd-ts/dist/cjs/argparser.js";
5
+ import { Kysely, QueryCreator } from "kysely";
5
6
  import { ArgParser } from "cmd-ts/dist/cjs/argparser.js";
6
- import * as cmd_ts_dist_cjs_helpdoc_js0 from "cmd-ts/dist/cjs/helpdoc.js";
7
- import * as cmd_ts_dist_cjs_runner_js0 from "cmd-ts/dist/cjs/runner.js";
8
7
  import { Agent } from "package-manager-detector";
9
8
  import { OperationWithContext } from "@powerhousedao/shared/document-model";
10
- import { Kysely, QueryCreator } from "kysely";
11
9
  import { IncomingMessage, ServerResponse } from "node:http";
12
10
  import { FC, ReactNode } from "react";
13
-
14
11
  //#region clis/args/common.d.ts
15
- declare const getPackageManagerCommand: Partial<cmd_ts_dist_cjs_argparser_js0.Register> & {
16
- parse(context: cmd_ts_dist_cjs_argparser_js0.ParseContext): Promise<cmd_ts_dist_cjs_argparser_js0.ParsingResult<{
12
+ declare const getPackageManagerCommand: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
13
+ parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
17
14
  packageManager: Agent | undefined;
18
15
  npm: boolean | undefined;
19
16
  pnpm: boolean | undefined;
20
17
  yarn: boolean | undefined;
21
18
  bun: boolean | undefined;
22
19
  }>>;
23
- } & cmd_ts_dist_cjs_helpdoc_js0.PrintHelp & cmd_ts_dist_cjs_helpdoc_js0.ProvidesHelp & cmd_ts_dist_cjs_helpdoc_js0.Named & Partial<cmd_ts_dist_cjs_helpdoc_js0.Versioned> & cmd_ts_dist_cjs_argparser_js0.Register & cmd_ts_dist_cjs_runner_js0.Handling<{
20
+ } & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
24
21
  packageManager: Agent | undefined;
25
22
  npm: boolean | undefined;
26
23
  pnpm: boolean | undefined;
@@ -33,14 +30,14 @@ declare const getPackageManagerCommand: Partial<cmd_ts_dist_cjs_argparser_js0.Re
33
30
  yarn: boolean | undefined;
34
31
  bun: boolean | undefined;
35
32
  }> & {
36
- run(context: cmd_ts_dist_cjs_argparser_js0.ParseContext): Promise<cmd_ts_dist_cjs_argparser_js0.ParsingResult<{
33
+ run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
37
34
  packageManager: Agent | undefined;
38
35
  npm: boolean | undefined;
39
36
  pnpm: boolean | undefined;
40
37
  yarn: boolean | undefined;
41
38
  bun: boolean | undefined;
42
39
  }>>;
43
- } & Partial<cmd_ts_dist_cjs_helpdoc_js0.Versioned & cmd_ts_dist_cjs_helpdoc_js0.Descriptive & cmd_ts_dist_cjs_helpdoc_js0.Aliased>;
40
+ } & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
44
41
  //#endregion
45
42
  //#region processors/constants.d.ts
46
43
  declare const PROCESSOR_APPS: readonly ["connect", "switchboard"];
@@ -79,7 +76,8 @@ type PHDocumentSignatureInfo = {
79
76
  /**
80
77
  * The public key of the document creator.
81
78
  **/
82
- publicKey: JsonWebKey; /** The nonce that was appended to the message to create the signature. */
79
+ publicKey: JsonWebKey;
80
+ /** The nonce that was appended to the message to create the signature. */
83
81
  nonce: string;
84
82
  };
85
83
  /** Joins a signature's params for transport. Already-joined input passes through. */
@@ -96,11 +94,200 @@ declare function deserializeSignature(signature: Signature | string): Signature;
96
94
  * Configuration for hashing document state in operations.
97
95
  */
98
96
  type HashConfig = {
99
- /** The hashing algorithm to use (e.g., "sha1", "sha256") */algorithm: string; /** The encoding format for the hash output (e.g., "base64", "hex") */
100
- encoding: string; /** Optional algorithm-specific parameters */
97
+ /** The hashing algorithm to use (e.g., "sha1", "sha256") */
98
+ algorithm: string;
99
+ /** The encoding format for the hash output (e.g., "base64", "hex") */
100
+ encoding: string;
101
+ /** Optional algorithm-specific parameters */
101
102
  params?: Record<string, unknown>;
102
103
  };
103
104
  //#endregion
105
+ //#region document-model/operations.d.ts
106
+ declare function setNameOperation<TDocument extends PHDocument>(document: TDocument, input: {
107
+ name: string;
108
+ }): TDocument & {
109
+ header: {
110
+ name: string;
111
+ id: string;
112
+ sig: PHDocumentSignatureInfo;
113
+ documentType: string;
114
+ createdAtUtcIso: string;
115
+ slug: string;
116
+ branch: string;
117
+ revision: {
118
+ [scope: string]: number;
119
+ };
120
+ lastModifiedAtUtcIso: string;
121
+ protocolVersions?: {
122
+ [key: string]: number;
123
+ };
124
+ meta?: PHDocumentMeta;
125
+ };
126
+ };
127
+ declare function setPreferredEditorOperation<TDocument extends PHDocument>(document: TDocument, input: {
128
+ preferredEditor: string | null;
129
+ }): TDocument;
130
+ declare function undoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
131
+ document: TDocument;
132
+ action: Action;
133
+ skip: number;
134
+ reuseLastOperationIndex: boolean;
135
+ };
136
+ /**
137
+ * V2 of undoOperation for protocol version 2+.
138
+ * Key differences from undoOperation:
139
+ * - Never reuses operation index (always increments)
140
+ * - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
141
+ * - No complex skip calculation - simpler model where each UNDO is independent
142
+ */
143
+ declare function undoOperationV2<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
144
+ document: TDocument;
145
+ action: Action;
146
+ skip: number;
147
+ reuseLastOperationIndex: false;
148
+ };
149
+ declare function redoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
150
+ document: TDocument;
151
+ action: Action;
152
+ skip: number;
153
+ reuseLastOperationIndex: boolean;
154
+ };
155
+ /**
156
+ * An operation that was applied to a {@link BaseDocument}.
157
+ *
158
+ * @remarks
159
+ * Wraps an action with an index, to be added to the operations history of a Document.
160
+ * The `index` field is used to keep all operations in order and enable replaying the
161
+ * document's history from the beginning. Note that indices and skips are relative to
162
+ * a specific reactor. Example below:
163
+ *
164
+ * For (index, skip, ts, action)
165
+ * A - [(0, 0, 1, "A0"), (1, 0, 2, "A1")]
166
+ * B - [(0, 0, 0, "B0"), (1, 0, 3, "B1")]
167
+ * ...
168
+ * B gets A's Operations Scenario:
169
+ * B' - [(0, 0, 0, "B0"), (1, 0, 3, "B1"), (2, 1, 1, "A0"), (3, 0, 2, "A1"), (4, 0, 3, "B1")]
170
+ * Then A needs to end up with:
171
+ * A' - [(0, 0, 1, "A0"), (1, 0, 2, "A1"), (2, 2, 0, "B0"), (3, 0, 1, "A0"), (4, 0, 2, "A1"), (5, 0, 3, "B1")]
172
+ * So that both A and B end up with the stream of actions (action):
173
+ * [("B0"), ("A0"), ("A1"), ("B1")]
174
+ *
175
+ * @typeParam A - The type of the action.
176
+ */
177
+ type Operation = {
178
+ /**
179
+ * This is a stable id, derived from various document and action properties
180
+ * in deriveOperationId().
181
+ *
182
+ * It _cannot_ be an arbitrary string.
183
+ *
184
+ * It it also not unique per operation, as reshuffled operations will keep'
185
+ * the same id they had before they were reshuffled. This means that the
186
+ * IOperationStore may have multiple operations with the same operation id.
187
+ **/
188
+ id: string;
189
+ /** Position of the operation in the history. This is relative to a specific reactor -- they may not all agree on this value. */
190
+ index: number;
191
+ /** The number of operations skipped with this Operation. This is relative to a specific reactor -- they may not all agree on this value. */
192
+ skip: number;
193
+ /** Timestamp of when the operation was added */
194
+ timestampUtcMs: string;
195
+ /** Hash of the resulting document data after the operation */
196
+ hash: string;
197
+ /** Error message for a failed action */
198
+ error?: string;
199
+ /**
200
+ * If authorization rejected the action, this records the reason why.
201
+ */
202
+ deniedReason?: string;
203
+ /** The resulting state after the operation */
204
+ resultingState?: string;
205
+ /**
206
+ * The action that was applied to the document to produce this operation.
207
+ */
208
+ action: Action;
209
+ };
210
+ /**
211
+ * The operations history of the document by scope.
212
+ *
213
+ * This will be removed in a future release.
214
+ *
215
+ * TODO: Type should be Partial<Record<string, Operation[]>>,
216
+ * but that is a breaking change for codegen + external doc models.
217
+ */
218
+ type DocumentOperations = Record<string, Operation[]>;
219
+ /**
220
+ * What happened to an operation. An operation that is not `applied` still
221
+ * occupies its index but contributes nothing to the document's state.
222
+ */
223
+ type OperationOutcome = {
224
+ kind: "applied";
225
+ } | {
226
+ kind: "reducer-error";
227
+ message: string;
228
+ } | {
229
+ kind: "denied";
230
+ reason: string;
231
+ };
232
+ /**
233
+ * Reads an operation's outcome. A denial takes precedence over a reducer
234
+ * error, since a denied operation never reaches its reducer.
235
+ */
236
+ declare function operationOutcome(operation: Operation): OperationOutcome;
237
+ type OperationContext = {
238
+ documentId: string;
239
+ documentType: string;
240
+ scope: string;
241
+ branch: string;
242
+ resultingState?: string;
243
+ ordinal: number;
244
+ };
245
+ type OperationWithContext$1 = {
246
+ operation: Operation;
247
+ context: OperationContext;
248
+ };
249
+ //#endregion
250
+ //#region document-model/signature-policy.d.ts
251
+ /** The `protocolVersions` key that fixes a document's signature requirement. */
252
+ declare const SIGNATURE_PROTOCOL = "signature";
253
+ /** `protocolVersions.signature` of a document that requires v2 tuples. */
254
+ declare const SIGNATURE_PROTOCOL_V2 = 2;
255
+ /** `v2-required`: v2 tuples only and a content-addressed id. */
256
+ type SignaturePolicy$1 = "legacy" | "v2-required";
257
+ /** What a new document is created as unless the caller or host says otherwise. */
258
+ declare const DEFAULT_SIGNATURE_POLICY: SignaturePolicy$1;
259
+ declare function isSignaturePolicy(value: unknown): value is SignaturePolicy$1;
260
+ type ProtocolVersions = {
261
+ [protocol: string]: number;
262
+ };
263
+ /** Read from a header, a CREATE_DOCUMENT input or a bare map. */
264
+ declare function signaturePolicyOf(source: {
265
+ protocolVersions?: ProtocolVersions | null;
266
+ } | ProtocolVersions | null | undefined): SignaturePolicy$1;
267
+ /** `protocolVersions` for a new v2-required document. */
268
+ declare function v2RequiredProtocolVersions(base?: ProtocolVersions): ProtocolVersions;
269
+ /**
270
+ * The policy a create call asks for: `signaturePolicy`, else the `signature`
271
+ * key of its `protocolVersions`, else `fallback`, the host's default.
272
+ */
273
+ declare function requestedSignaturePolicy(request: {
274
+ signaturePolicy?: SignaturePolicy$1;
275
+ protocolVersions?: ProtocolVersions;
276
+ } | undefined, fallback: SignaturePolicy$1): SignaturePolicy$1;
277
+ /** `protocolVersions` for a new document under `policy`, over `base`. */
278
+ declare function protocolVersionsFor(policy: SignaturePolicy$1, base?: ProtocolVersions): ProtocolVersions;
279
+ /** What the id of a v2-required document is a hash of. */
280
+ type DocumentIdParams = {
281
+ documentType: string;
282
+ createdAtUtcIso: string;
283
+ nonce: string;
284
+ protocolVersions: ProtocolVersions;
285
+ };
286
+ /** `base64url(sha256(canonicalJson(params)))`, unpadded. */
287
+ declare function deriveDocumentId(params: DocumentIdParams): string;
288
+ /** Whether `id` has the shape `deriveDocumentId` produces. */
289
+ declare function isDerivedDocumentId(id: string): boolean;
290
+ //#endregion
104
291
  //#region document-model/state.d.ts
105
292
  /**
106
293
  * Creates a default PHAuthState
@@ -140,11 +327,16 @@ type PHDocumentState = {
140
327
  * with the UPGRADE_DOCUMENT operation to specify the DocumentModelModule
141
328
  * version to use for reducer execution.
142
329
  */
143
- version: number; /** Hash configuration for operation state verification */
144
- hash: HashConfig; /** True if and only if the document has been deleted */
145
- isDeleted?: boolean; /** The timestamp when the document was deleted, in UTC ISO format */
146
- deletedAtUtcIso?: string; /** Optional: who deleted the document */
147
- deletedBy?: string; /** Optional: reason for deletion */
330
+ version: number;
331
+ /** Hash configuration for operation state verification */
332
+ hash: HashConfig;
333
+ /** True if and only if the document has been deleted */
334
+ isDeleted?: boolean;
335
+ /** The timestamp when the document was deleted, in UTC ISO format */
336
+ deletedAtUtcIso?: string;
337
+ /** Optional: who deleted the document */
338
+ deletedBy?: string;
339
+ /** Optional: reason for deletion */
148
340
  deletionReason?: string;
149
341
  };
150
342
  /**
@@ -167,7 +359,8 @@ type PHAuthState = {
167
359
  creator?: string;
168
360
  };
169
361
  type Grant = {
170
- /** Stable id. */id: string;
362
+ /** Stable id. */
363
+ id: string;
171
364
  description: string;
172
365
  effect: "allow" | "deny";
173
366
  principal: Principal;
@@ -252,7 +445,9 @@ type Operand = {
252
445
  * The base state of the document.
253
446
  */
254
447
  type PHBaseState = {
255
- /** Carries authentication information. */auth: PHAuthState; /** Carries information about the document. */
448
+ /** Carries authentication information. */
449
+ auth: PHAuthState;
450
+ /** Carries information about the document. */
256
451
  document: PHDocumentState;
257
452
  };
258
453
  declare function defaultGlobalState(): DocumentModelGlobalState;
@@ -262,183 +457,47 @@ declare function createGlobalState(state?: Partial<DocumentModelGlobalState>): D
262
457
  declare function createLocalState(state?: Partial<DocumentModelLocalState>): DocumentModelLocalState;
263
458
  declare function createState(baseState?: Partial<PHBaseState>, globalState?: Partial<DocumentModelGlobalState>, localState?: Partial<DocumentModelLocalState>): DocumentModelPHState;
264
459
  //#endregion
265
- //#region document-model/operations.d.ts
266
- declare function setNameOperation<TDocument extends PHDocument>(document: TDocument, input: {
267
- name: string;
268
- }): TDocument & {
269
- header: {
270
- name: string;
271
- id: string;
272
- sig: PHDocumentSignatureInfo;
273
- documentType: string;
274
- createdAtUtcIso: string;
275
- slug: string;
276
- branch: string;
277
- revision: {
278
- [scope: string]: number;
279
- };
280
- lastModifiedAtUtcIso: string;
281
- protocolVersions?: {
282
- [key: string]: number;
283
- };
284
- meta?: PHDocumentMeta;
285
- };
286
- };
287
- declare function setPreferredEditorOperation<TDocument extends PHDocument>(document: TDocument, input: {
288
- preferredEditor: string | null;
289
- }): TDocument;
290
- declare function undoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
291
- document: TDocument;
292
- action: Action;
293
- skip: number;
294
- reuseLastOperationIndex: boolean;
295
- };
296
- /**
297
- * V2 of undoOperation for protocol version 2+.
298
- * Key differences from undoOperation:
299
- * - Never reuses operation index (always increments)
300
- * - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
301
- * - No complex skip calculation - simpler model where each UNDO is independent
302
- */
303
- declare function undoOperationV2<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
304
- document: TDocument;
305
- action: Action;
306
- skip: number;
307
- reuseLastOperationIndex: false;
308
- };
309
- declare function redoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
310
- document: TDocument;
311
- action: Action;
312
- skip: number;
313
- reuseLastOperationIndex: boolean;
460
+ //#region document-model/documents.d.ts
461
+ /** Meta information about the document. */
462
+ type PHDocumentMeta = {
463
+ /** The preferred editor for the document. */
464
+ preferredEditor?: string;
314
465
  };
315
- declare function loadStateOperation<TState extends PHBaseState>(document: PHDocument<TState>, action: LoadStateActionInput): PHDocument<TState>;
316
466
  /**
317
- * An operation that was applied to a {@link BaseDocument}.
318
- *
319
- * @remarks
320
- * Wraps an action with an index, to be added to the operations history of a Document.
321
- * The `index` field is used to keep all operations in order and enable replaying the
322
- * document's history from the beginning. Note that indices and skips are relative to
323
- * a specific reactor. Example below:
324
- *
325
- * For (index, skip, ts, action)
326
- * A - [(0, 0, 1, "A0"), (1, 0, 2, "A1")]
327
- * B - [(0, 0, 0, "B0"), (1, 0, 3, "B1")]
328
- * ...
329
- * B gets A's Operations Scenario:
330
- * B' - [(0, 0, 0, "B0"), (1, 0, 3, "B1"), (2, 1, 1, "A0"), (3, 0, 2, "A1"), (4, 0, 3, "B1")]
331
- * Then A needs to end up with:
332
- * A' - [(0, 0, 1, "A0"), (1, 0, 2, "A1"), (2, 2, 0, "B0"), (3, 0, 1, "A0"), (4, 0, 2, "A1"), (5, 0, 3, "B1")]
333
- * So that both A and B end up with the stream of actions (action):
334
- * [("B0"), ("A0"), ("A1"), ("B1")]
335
- *
336
- * @typeParam A - The type of the action.
467
+ * The header of a document.
337
468
  */
338
- type Operation = {
469
+ type PHDocumentHeader = {
339
470
  /**
340
- * This is a stable id, derived from various document and action properties
341
- * in deriveOperationId().
471
+ * The id of the document.
342
472
  *
343
- * It _cannot_ be an arbitrary string.
473
+ * This is a Ed25519 signature and is immutable.
474
+ **/
475
+ id: string;
476
+ /**
477
+ * Information to verify the document creator.
344
478
  *
345
- * It it also not unique per operation, as reshuffled operations will keep'
346
- * the same id they had before they were reshuffled. This means that the
347
- * IOperationStore may have multiple operations with the same operation id.
479
+ * This is immutable.
348
480
  **/
349
- id: string; /** Position of the operation in the history. This is relative to a specific reactor -- they may not all agree on this value. */
350
- index: number; /** The number of operations skipped with this Operation. This is relative to a specific reactor -- they may not all agree on this value. */
351
- skip: number; /** Timestamp of when the operation was added */
352
- timestampUtcMs: string; /** Hash of the resulting document data after the operation */
353
- hash: string; /** Error message for a failed action */
354
- error?: string;
481
+ sig: PHDocumentSignatureInfo;
355
482
  /**
356
- * If authorization rejected the action, this records the reason why.
357
- */
358
- deniedReason?: string; /** The resulting state after the operation */
359
- resultingState?: string;
360
- /**
361
- * The action that was applied to the document to produce this operation.
362
- */
363
- action: Action;
364
- };
365
- /**
366
- * The operations history of the document by scope.
367
- *
368
- * This will be removed in a future release.
369
- *
370
- * TODO: Type should be Partial<Record<string, Operation[]>>,
371
- * but that is a breaking change for codegen + external doc models.
372
- */
373
- type DocumentOperations = Record<string, Operation[]>;
374
- /**
375
- * What happened to an operation. An operation that is not `applied` still
376
- * occupies its index but contributes nothing to the document's state.
377
- */
378
- type OperationOutcome = {
379
- kind: "applied";
380
- } | {
381
- kind: "reducer-error";
382
- message: string;
383
- } | {
384
- kind: "denied";
385
- reason: string;
386
- };
387
- /**
388
- * Reads an operation's outcome. A denial takes precedence over a reducer
389
- * error, since a denied operation never reaches its reducer.
390
- */
391
- declare function operationOutcome(operation: Operation): OperationOutcome;
392
- type OperationContext = {
393
- documentId: string;
394
- documentType: string;
395
- scope: string;
396
- branch: string;
397
- resultingState?: string;
398
- ordinal: number;
399
- };
400
- type OperationWithContext$1 = {
401
- operation: Operation;
402
- context: OperationContext;
403
- };
404
- //#endregion
405
- //#region document-model/documents.d.ts
406
- /** Meta information about the document. */
407
- type PHDocumentMeta = {
408
- /** The preferred editor for the document. */preferredEditor?: string;
409
- };
410
- /**
411
- * The header of a document.
412
- */
413
- type PHDocumentHeader = {
414
- /**
415
- * The id of the document.
416
- *
417
- * This is a Ed25519 signature and is immutable.
418
- **/
419
- id: string;
420
- /**
421
- * Information to verify the document creator.
422
- *
423
- * This is immutable.
424
- **/
425
- sig: PHDocumentSignatureInfo;
426
- /**
427
- * The type of the document.
428
- *
429
- * This is used as part of the signature payload and thus, cannot be changed
430
- * after the document header has been created.
431
- **/
432
- documentType: string;
483
+ * The type of the document.
484
+ *
485
+ * This is used as part of the signature payload and thus, cannot be changed
486
+ * after the document header has been created.
487
+ **/
488
+ documentType: string;
433
489
  /**
434
490
  * The timestamp of the creation date of the document, in UTC ISO format.
435
491
  *
436
492
  * This is used as part of the signature payload and thus, cannot be changed
437
493
  * after the document header has been created.
438
494
  **/
439
- createdAtUtcIso: string; /** The slug of the document. */
440
- slug: string; /** The name of the document. */
441
- name: string; /** The branch of this document. */
495
+ createdAtUtcIso: string;
496
+ /** The slug of the document. */
497
+ slug: string;
498
+ /** The name of the document. */
499
+ name: string;
500
+ /** The branch of this document. */
442
501
  branch: string;
443
502
  /**
444
503
  * The revision of each scope of the document. This object is updated every
@@ -461,7 +520,8 @@ type PHDocumentHeader = {
461
520
  */
462
521
  protocolVersions?: {
463
522
  [key: string]: number;
464
- }; /** Meta information about the document. */
523
+ };
524
+ /** Meta information about the document. */
465
525
  meta?: PHDocumentMeta;
466
526
  };
467
527
  /**
@@ -473,7 +533,9 @@ type PHDocumentHeader = {
473
533
  * @typeParam TState - The type of the document state.
474
534
  */
475
535
  type PHDocument<TState extends PHBaseState = PHBaseState> = {
476
- /** The header of the document. */header: PHDocumentHeader; /** The document model specific state. */
536
+ /** The header of the document. */
537
+ header: PHDocumentHeader;
538
+ /** The document model specific state. */
477
539
  state: TState;
478
540
  /**
479
541
  * The initial state of the document, enabling replaying operations.
@@ -504,9 +566,23 @@ declare function isUndo(action: Action): action is UndoAction;
504
566
  declare function isDocumentAction(action: Action): action is DocumentAction;
505
567
  /**
506
568
  * Creates a new document. When `documentType` is given the header is stamped
507
- * with it and the document-scope operations are seeded.
569
+ * with it and the document-scope operations are seeded. Without
570
+ * `protocolVersions` the document is v2-required and takes a derived id; with
571
+ * them it is v2-required only if they say so (see {@link protocolVersionsFor}).
572
+ */
573
+ declare function baseCreateDocument<TState extends PHBaseState = PHBaseState>(createState: CreateState<TState>, initialState?: Partial<TState>, documentType?: string, protocolVersions?: ProtocolVersions): PHDocument<TState>;
574
+ /**
575
+ * `document`, not yet created, under a fresh header for `policy`. A legacy
576
+ * header takes `id` when given; a v2-required one ignores `id` and derives its
577
+ * own, so a caller that needs a fixed id must ask for legacy.
578
+ * `protocolVersions` are merged over the document's. Name, slug, branch and
579
+ * meta carry over. A document already under `policy` is returned as is unless
580
+ * a legacy `id` or `protocolVersions` are given.
508
581
  */
509
- declare function baseCreateDocument<TState extends PHBaseState = PHBaseState>(createState: CreateState<TState>, initialState?: Partial<TState>, documentType?: string): PHDocument<TState>;
582
+ declare function withSignaturePolicy<TDocument extends PHDocument>(document: TDocument, policy: SignaturePolicy$1, options?: {
583
+ id?: string;
584
+ protocolVersions?: ProtocolVersions;
585
+ }): TDocument;
510
586
  declare function hashDocumentStateForScope(document: {
511
587
  state: {
512
588
  [key: string]: unknown;
@@ -670,31 +746,6 @@ declare const undo: (count?: number, scope?: string) => UndoAction;
670
746
  * @category Actions
671
747
  */
672
748
  declare const redo: (count?: number, scope?: string) => RedoAction;
673
- /**
674
- * Joins multiple operations into a single {@link loadState | LOAD_STATE} operation.
675
- *
676
- * @remarks
677
- * Useful to keep operations history smaller. Operations to prune are selected by index,
678
- * similar to the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | slice} method in Arrays.
679
- *
680
- * @param start - Index of the first operation to prune
681
- * @param end - Index of the last operation to prune
682
- * @category Actions
683
- */
684
- declare const prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
685
- /**
686
- * Replaces the state of the document.
687
- *
688
- * @remarks
689
- * This action shouldn't be used directly. It is dispatched by the {@link prune} action.
690
- *
691
- * @param state - State to be set in the document.
692
- * @param operations - Number of operations that were removed from the previous state.
693
- * @category Actions
694
- */
695
- declare const loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
696
- name: string;
697
- }, operations: number) => LoadStateAction;
698
749
  declare const noop: (scope?: string) => NOOPAction;
699
750
  /**
700
751
  * Helper function to be used by action creators.
@@ -730,7 +781,9 @@ declare const operationWithContext: (operation: Operation, context: ActionContex
730
781
  declare const actionContext: () => ActionContext;
731
782
  declare const actionSigner: (user: UserActionSigner, app: AppActionSigner, signatures?: Signature[]) => ActionSigner;
732
783
  declare function buildOperationSignature(context: ActionSignatureContext, signMethod: ActionSigningHandler): Promise<Signature>;
784
+ /** @deprecated Emits a legacy SHA-1 tuple; sign through `ISigner.signAction`. */
733
785
  declare function buildSignedAction<TState extends PHBaseState = PHBaseState>(action: Action, reducer: Reducer<TState>, document: PHDocument<TState>, signer: ActionSigner, signHandler: ActionSigningHandler): Promise<Operation>;
786
+ /** @deprecated Use `verifyActionSignature` from `@powerhousedao/reactor`. */
734
787
  declare function verifyOperationSignature(signature: Signature, signer: Omit<ActionSigner, "signatures">, verifyHandler: ActionVerificationHandler): Promise<boolean>;
735
788
  /**
736
789
  * Changes the name of the document.
@@ -784,10 +837,10 @@ declare const updateOperationExample: (input: UpdateOperationExampleInput) => Up
784
837
  declare const deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
785
838
  declare const reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
786
839
  declare const operationExampleCreators: {
787
- addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
788
- updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
789
- deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
790
- reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
840
+ addOperationExample: typeof addOperationExample;
841
+ updateOperationExample: typeof updateOperationExample;
842
+ deleteOperationExample: typeof deleteOperationExample;
843
+ reorderOperationExamples: typeof reorderOperationExamples;
791
844
  };
792
845
  declare const setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
793
846
  declare const setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
@@ -801,531 +854,1124 @@ declare const deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteCh
801
854
  declare const reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
802
855
  declare const releaseNewVersion: () => ReleaseNewVersionAction;
803
856
  declare const baseActions: {
804
- setName: (name: string | {
805
- name: string;
806
- }) => SetNameAction;
807
- setPreferredEditor: (input: string | null | {
808
- preferredEditor: string | null;
809
- }) => SetPreferredEditorAction;
810
- undo: (count?: number, scope?: string) => UndoAction;
811
- redo: (count?: number, scope?: string) => RedoAction;
812
- prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
813
- loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
814
- name: string;
815
- }, operations: number) => LoadStateAction;
816
- noop: (scope?: string) => NOOPAction;
857
+ setName: typeof setName;
858
+ setPreferredEditor: typeof setPreferredEditor;
859
+ undo: typeof undo;
860
+ redo: typeof redo;
861
+ noop: typeof noop;
817
862
  };
818
863
  declare const documentModelActions: {
819
- setModelName: (input: SetModelNameInput) => SetModelNameAction;
820
- setModelId: (input: SetModelIdInput) => SetModelIdAction;
821
- setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
822
- setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
823
- setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
824
- setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
825
- addModule: (input: AddModuleInput) => AddModuleAction;
826
- setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
827
- setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
828
- deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
829
- reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
830
- addOperation: (input: AddOperationInput) => AddOperationAction;
831
- setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
832
- setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
833
- setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
834
- setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
835
- setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
836
- setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
837
- moveOperation: (input: MoveOperationInput) => MoveOperationAction;
838
- deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
839
- reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
840
- addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
841
- setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
842
- setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
843
- setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
844
- setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
845
- deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
846
- reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
847
- addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
848
- updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
849
- deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
850
- reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
851
- setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
852
- setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
853
- addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
854
- updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
855
- deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
856
- reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
857
- addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
858
- updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
859
- deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
860
- reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
861
- releaseNewVersion: () => ReleaseNewVersionAction;
864
+ setModelName: typeof setModelName;
865
+ setModelId: typeof setModelId;
866
+ setModelExtension: typeof setModelExtension;
867
+ setModelDescription: typeof setModelDescription;
868
+ setAuthorName: typeof setAuthorName;
869
+ setAuthorWebsite: typeof setAuthorWebsite;
870
+ addModule: typeof addModule;
871
+ setModuleName: typeof setModuleName;
872
+ setModuleDescription: typeof setModuleDescription;
873
+ deleteModule: typeof deleteModule;
874
+ reorderModules: typeof reorderModules;
875
+ addOperation: typeof addOperation;
876
+ setOperationName: typeof setOperationName;
877
+ setOperationScope: typeof setOperationScope;
878
+ setOperationSchema: typeof setOperationSchema;
879
+ setOperationDescription: typeof setOperationDescription;
880
+ setOperationTemplate: typeof setOperationTemplate;
881
+ setOperationReducer: typeof setOperationReducer;
882
+ moveOperation: typeof moveOperation;
883
+ deleteOperation: typeof deleteOperation;
884
+ reorderModuleOperations: typeof reorderModuleOperations;
885
+ addOperationError: typeof addOperationError;
886
+ setOperationErrorCode: typeof setOperationErrorCode;
887
+ setOperationErrorName: typeof setOperationErrorName;
888
+ setOperationErrorDescription: typeof setOperationErrorDescription;
889
+ setOperationErrorTemplate: typeof setOperationErrorTemplate;
890
+ deleteOperationError: typeof deleteOperationError;
891
+ reorderOperationErrors: typeof reorderOperationErrors;
892
+ addOperationExample: typeof addOperationExample;
893
+ updateOperationExample: typeof updateOperationExample;
894
+ deleteOperationExample: typeof deleteOperationExample;
895
+ reorderOperationExamples: typeof reorderOperationExamples;
896
+ setStateSchema: typeof setStateSchema;
897
+ setInitialState: typeof setInitialState;
898
+ addStateExample: typeof addStateExample;
899
+ updateStateExample: typeof updateStateExample;
900
+ deleteStateExample: typeof deleteStateExample;
901
+ reorderStateExamples: typeof reorderStateExamples;
902
+ addChangeLogItem: typeof addChangeLogItem;
903
+ updateChangeLogItem: typeof updateChangeLogItem;
904
+ deleteChangeLogItem: typeof deleteChangeLogItem;
905
+ reorderChangeLogItems: typeof reorderChangeLogItems;
906
+ releaseNewVersion: typeof releaseNewVersion;
862
907
  };
863
908
  declare const actions: {
864
- setModelName: (input: SetModelNameInput) => SetModelNameAction;
865
- setModelId: (input: SetModelIdInput) => SetModelIdAction;
866
- setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
867
- setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
868
- setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
869
- setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
870
- addModule: (input: AddModuleInput) => AddModuleAction;
871
- setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
872
- setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
873
- deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
874
- reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
875
- addOperation: (input: AddOperationInput) => AddOperationAction;
876
- setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
877
- setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
878
- setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
879
- setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
880
- setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
881
- setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
882
- moveOperation: (input: MoveOperationInput) => MoveOperationAction;
883
- deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
884
- reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
885
- addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
886
- setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
887
- setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
888
- setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
889
- setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
890
- deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
891
- reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
892
- addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
893
- updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
894
- deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
895
- reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
896
- setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
897
- setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
898
- addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
899
- updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
900
- deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
901
- reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
902
- addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
903
- updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
904
- deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
905
- reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
906
- releaseNewVersion: () => ReleaseNewVersionAction;
907
- setName: (name: string | {
908
- name: string;
909
- }) => SetNameAction;
910
- setPreferredEditor: (input: string | null | {
911
- preferredEditor: string | null;
912
- }) => SetPreferredEditorAction;
913
- undo: (count?: number, scope?: string) => UndoAction;
914
- redo: (count?: number, scope?: string) => RedoAction;
915
- prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
916
- loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
917
- name: string;
918
- }, operations: number) => LoadStateAction;
919
- noop: (scope?: string) => NOOPAction;
909
+ setName: typeof setName;
910
+ setPreferredEditor: typeof setPreferredEditor;
911
+ undo: typeof undo;
912
+ redo: typeof redo;
913
+ noop: typeof noop;
914
+ setModelName: typeof setModelName;
915
+ setModelId: typeof setModelId;
916
+ setModelExtension: typeof setModelExtension;
917
+ setModelDescription: typeof setModelDescription;
918
+ setAuthorName: typeof setAuthorName;
919
+ setAuthorWebsite: typeof setAuthorWebsite;
920
+ addModule: typeof addModule;
921
+ setModuleName: typeof setModuleName;
922
+ setModuleDescription: typeof setModuleDescription;
923
+ deleteModule: typeof deleteModule;
924
+ reorderModules: typeof reorderModules;
925
+ addOperation: typeof addOperation;
926
+ setOperationName: typeof setOperationName;
927
+ setOperationScope: typeof setOperationScope;
928
+ setOperationSchema: typeof setOperationSchema;
929
+ setOperationDescription: typeof setOperationDescription;
930
+ setOperationTemplate: typeof setOperationTemplate;
931
+ setOperationReducer: typeof setOperationReducer;
932
+ moveOperation: typeof moveOperation;
933
+ deleteOperation: typeof deleteOperation;
934
+ reorderModuleOperations: typeof reorderModuleOperations;
935
+ addOperationError: typeof addOperationError;
936
+ setOperationErrorCode: typeof setOperationErrorCode;
937
+ setOperationErrorName: typeof setOperationErrorName;
938
+ setOperationErrorDescription: typeof setOperationErrorDescription;
939
+ setOperationErrorTemplate: typeof setOperationErrorTemplate;
940
+ deleteOperationError: typeof deleteOperationError;
941
+ reorderOperationErrors: typeof reorderOperationErrors;
942
+ addOperationExample: typeof addOperationExample;
943
+ updateOperationExample: typeof updateOperationExample;
944
+ deleteOperationExample: typeof deleteOperationExample;
945
+ reorderOperationExamples: typeof reorderOperationExamples;
946
+ setStateSchema: typeof setStateSchema;
947
+ setInitialState: typeof setInitialState;
948
+ addStateExample: typeof addStateExample;
949
+ updateStateExample: typeof updateStateExample;
950
+ deleteStateExample: typeof deleteStateExample;
951
+ reorderStateExamples: typeof reorderStateExamples;
952
+ addChangeLogItem: typeof addChangeLogItem;
953
+ updateChangeLogItem: typeof updateChangeLogItem;
954
+ deleteChangeLogItem: typeof deleteChangeLogItem;
955
+ reorderChangeLogItems: typeof reorderChangeLogItems;
956
+ releaseNewVersion: typeof releaseNewVersion;
920
957
  };
921
958
  /**
922
959
  * The context of an action.
923
960
  */
924
961
  type ActionContext = {
925
- /** The index of the previous operation, showing intended ordering. */prevOpIndex?: number; /** The hash of the previous operation, showing intended state. */
926
- prevOpHash?: string; /** A nonce, to cover specific signing attacks and to prevent replay attacks from no-ops. */
927
- nonce?: string; /** The signer of the action. */
962
+ /** The index of the previous operation, showing intended ordering. */
963
+ prevOpIndex?: number;
964
+ /** The hash of the previous operation, showing intended state. */
965
+ prevOpHash?: string;
966
+ /** A nonce, to cover specific signing attacks and to prevent replay attacks from no-ops. */
967
+ nonce?: string;
968
+ /** The signer of the action. */
928
969
  signer?: ActionSigner;
929
970
  };
930
971
  /**
931
972
  * Defines the basic structure of an action.
932
973
  */
933
974
  type Action = {
934
- /** The id of the action. This is distinct from the operation id. */id: string; /** The name of the action. */
935
- type: string; /** The timestamp of the action. */
936
- timestampUtcMs: string; /** The payload of the action. */
937
- input: unknown; /** The scope of the action */
938
- scope: string; /** The context of the action. */
975
+ /** The id of the action. This is distinct from the operation id. */
976
+ id: string;
977
+ /** The name of the action. */
978
+ type: string;
979
+ /** The timestamp of the action. */
980
+ timestampUtcMs: string;
981
+ /** The payload of the action. */
982
+ input: unknown;
983
+ /** The scope of the action */
984
+ scope: string;
985
+ /** The context of the action. */
939
986
  context?: ActionContext;
940
987
  };
941
988
  //#endregion
942
- //#region processors/http.d.ts
943
- /** Methods a package route may bind. OPTIONS belongs to the CORS layer. */
944
- type RouteMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
945
- interface RouteUser {
946
- address: string;
947
- chainId: number;
948
- networkId: string;
949
- appKey: string;
989
+ //#region document-model/action-signature.d.ts
990
+ declare const ACTION_SIGNATURE_V2_PREFIX = "v2:";
991
+ /** The log an operation is stored in, which a v2 tuple is bound to. */
992
+ type ActionSigningTarget = {
993
+ documentId: string;
994
+ branch: string;
995
+ };
996
+ /** Who a v2 tuple attributes the action to; both halves are in the preimage. */
997
+ type ActionSignerIdentity = {
998
+ user: UserActionSigner;
999
+ app: AppActionSigner;
1000
+ };
1001
+ /** A value that would not survive a JSON store round trip unchanged. */
1002
+ declare class CanonicalJsonError extends Error {
1003
+ constructor(path: string, detail: string);
950
1004
  }
951
- type RouteActor = {
952
- user: RouteUser | undefined;
953
- authEnabled: boolean;
1005
+ /** Sorted-key JSON, as the state hash encodes; drops `undefined` properties. */
1006
+ declare function canonicalJson(value: unknown, label?: string): string;
1007
+ /** Actions the reactor reduces itself, onto the document scope. */
1008
+ declare const DOCUMENT_SCOPE_ACTION_TYPES: ReadonlySet<string>;
1009
+ /** Where a document-scope action writes: `sourceId` or `documentId`. */
1010
+ declare function targetDocumentId(action: {
1011
+ type: string;
1012
+ input: unknown;
1013
+ }, fallback: string): string;
1014
+ /** The log an action submitted to a job on `documentId` is stored in. */
1015
+ declare function actionSigningTarget(action: {
1016
+ type: string;
1017
+ input: unknown;
1018
+ }, documentId: string, branch: string): ActionSigningTarget;
1019
+ /** The identity a signer writes into `context.signer`, and signs over. */
1020
+ declare function actionSignerIdentity(signer: {
1021
+ user?: UserActionSigner;
1022
+ app?: AppActionSigner;
1023
+ }): ActionSignerIdentity;
1024
+ /** The v2 preimage; throws `CanonicalJsonError` on an unsignable action. */
1025
+ declare function actionPreimageV2(action: Action, target: ActionSigningTarget, signer: ActionSignerIdentity): string;
1026
+ /** `"v2:" + base64url(sha256(preimage))`, unpadded. */
1027
+ declare function hashActionV2(action: Action, target: ActionSigningTarget, signer: ActionSignerIdentity): Promise<string>;
1028
+ /** Signs `action` as a v2 tuple; the message layout is the legacy one. */
1029
+ declare function signActionV2(params: {
1030
+ action: Action;
1031
+ target: ActionSigningTarget;
1032
+ signer: ActionSignerIdentity;
1033
+ sign: ActionSigningHandler;
1034
+ previousStateHash?: string;
1035
+ }): Promise<Signature>;
1036
+ /** Element [2] carries the v2 prefix, whether or not it is well formed. */
1037
+ declare function isV2ActionHash(hash: string): boolean;
1038
+ /** The strict shape of a v2 tuple, apart from what its hash covers. */
1039
+ declare function v2TupleProblem(tuple: Signature): string | undefined;
1040
+ //#endregion
1041
+ //#region document-model/action-transport.d.ts
1042
+ /**
1043
+ * An action's signer, as the wire declares it: signatures joined into strings,
1044
+ * because GraphQL declares them as a list of strings rather than of lists.
1045
+ */
1046
+ type TransportSigner = {
1047
+ user?: {
1048
+ address: string;
1049
+ networkId: string;
1050
+ chainId: number;
1051
+ };
1052
+ app?: {
1053
+ name: string;
1054
+ key: string;
1055
+ };
1056
+ signatures: string[];
954
1057
  };
955
- type AuthorizerResult = {
956
- authorized: true;
957
- } /** Refused; the scope answers with its own JSON error envelope. */ | {
958
- authorized: false;
959
- status: number;
960
- message: string;
1058
+ /** An action's context, as the wire declares it. */
1059
+ type TransportActionContext = {
1060
+ prevOpIndex?: number;
1061
+ prevOpHash?: string;
1062
+ nonce?: string;
1063
+ signer?: TransportSigner;
1064
+ };
1065
+ /** An action projected onto exactly the fields the wire declares. */
1066
+ type TransportAction = {
1067
+ id: string;
1068
+ type: string;
1069
+ timestampUtcMs: string;
1070
+ /**
1071
+ * Non-nullable, because the wire declares it so. An action's own type says
1072
+ * `unknown`, which admits the absent input an action creator called without
1073
+ * one produces - {@link toTransportAction} refuses that rather than passing
1074
+ * it on.
1075
+ */
1076
+ input: NonNullable<unknown>;
1077
+ scope: string;
1078
+ context?: TransportActionContext;
1079
+ };
1080
+ /**
1081
+ * Projects an action onto the fields the GraphQL `ActionInput` declares.
1082
+ *
1083
+ * A projection rather than a spread, because an input object rejects a field it
1084
+ * does not declare, and that refusal takes the whole request with it. An action
1085
+ * read back out of storage can carry fields the type no longer has - a legacy
1086
+ * `attachments` array, or the operation fields left behind by a signing helper
1087
+ * that returns an operation - and any one of them would sink an otherwise valid
1088
+ * submission.
1089
+ *
1090
+ * Only fields the action actually carries are emitted, so an unsigned action
1091
+ * sends no context at all rather than a context full of nulls.
1092
+ */
1093
+ declare function toTransportAction(action: Action): TransportAction;
1094
+ //#endregion
1095
+ //#region document-model/auth.d.ts
1096
+ type InitializeAuthActionInput = {
1097
+ version: number;
1098
+ grants: Grant[];
1099
+ };
1100
+ type SetGrantActionInput = {
1101
+ grant: Grant;
1102
+ };
1103
+ type RemoveGrantActionInput = {
1104
+ id: string;
1105
+ };
1106
+ type MoveGrantActionInput = {
1107
+ id: string;
1108
+ /** Target index in the grant list; clamped to the valid range. */
1109
+ index: number;
1110
+ };
1111
+ type InitializeAuthAction = Action & {
1112
+ type: "INITIALIZE_AUTH";
1113
+ input: InitializeAuthActionInput;
1114
+ };
1115
+ type SetGrantAction = Action & {
1116
+ type: "SET_GRANT";
1117
+ input: SetGrantActionInput;
1118
+ };
1119
+ type RemoveGrantAction = Action & {
1120
+ type: "REMOVE_GRANT";
1121
+ input: RemoveGrantActionInput;
1122
+ };
1123
+ type MoveGrantAction = Action & {
1124
+ type: "MOVE_GRANT";
1125
+ input: MoveGrantActionInput;
1126
+ };
1127
+ type AuthAction = InitializeAuthAction | SetGrantAction | RemoveGrantAction | MoveGrantAction;
1128
+ declare const AUTH_ACTION_TYPES: readonly ["INITIALIZE_AUTH", "SET_GRANT", "REMOVE_GRANT", "MOVE_GRANT"];
1129
+ declare function isAuthAction(action: Action): action is AuthAction;
1130
+ /** Highest known policy version; decide() fails closed above it. */
1131
+ declare const MAX_SUPPORTED_AUTH_VERSION = 1;
1132
+ declare const InitializeAuthActionInputSchema: () => z.ZodObject<{
1133
+ version: z.ZodNumber;
1134
+ grants: z.ZodArray<z.ZodCustom<Grant, Grant>>;
1135
+ }, z.core.$strip>;
1136
+ declare const SetGrantActionInputSchema: () => z.ZodObject<{
1137
+ grant: z.ZodCustom<Grant, Grant>;
1138
+ }, z.core.$strip>;
1139
+ declare const RemoveGrantActionInputSchema: () => z.ZodObject<{
1140
+ id: z.ZodString;
1141
+ }, z.core.$strip>;
1142
+ declare const MoveGrantActionInputSchema: () => z.ZodObject<{
1143
+ id: z.ZodString;
1144
+ index: z.ZodNumber;
1145
+ }, z.core.$strip>;
1146
+ declare const initializeAuth: (input: InitializeAuthActionInput) => InitializeAuthAction;
1147
+ declare const setGrant: (input: SetGrantActionInput) => SetGrantAction;
1148
+ declare const removeGrant: (input: RemoveGrantActionInput) => RemoveGrantAction;
1149
+ declare const moveGrant: (input: MoveGrantActionInput) => MoveGrantAction;
1150
+ /**
1151
+ * True when `signerKey` (an ActionSigner app key, a did:key) identifies the same
1152
+ * key recorded as the document creator. Returns false
1153
+ * when there is no creator (empty JWK) or no signer key.
1154
+ */
1155
+ declare function isDocumentCreator(creatorKey: JsonWebKey | undefined, signerKey: string | undefined): boolean;
1156
+ /**
1157
+ * Sets the initial policy. Valid only while the auth scope is uninitialized
1158
+ * (version 0). The input version is the policy language version and must be an
1159
+ * integer >= 1; 0 is reserved for the uninitialized state. On a signed-header
1160
+ * document it must be signed by the document creator (`header.sig.publicKey`).
1161
+ * A creator-less policy must include a grant permitting execute on the auth
1162
+ * scope, or it would be born locked out.
1163
+ */
1164
+ declare function applyInitializeAuthAction<TState extends PHBaseState>(document: PHDocument<TState>, action: InitializeAuthAction): PHDocument<TState>;
1165
+ /** Upserts a grant by id: replaces in place if present, otherwise appends. */
1166
+ declare function applySetGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: SetGrantAction): PHDocument<TState>;
1167
+ /**
1168
+ * Removes a grant by id; throws if the id is not present or if the removal
1169
+ * would leave a creator-less policy with no auth-administration grant.
1170
+ */
1171
+ declare function applyRemoveGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: RemoveGrantAction): PHDocument<TState>;
1172
+ /**
1173
+ * Moves a grant by id to a new index. Order is load-bearing (the last
1174
+ * applicable grant wins), so the relative order of the other grants is kept.
1175
+ * The target index is clamped to the valid range; an unknown id throws.
1176
+ *
1177
+ * Order alone decides which grant wins, so a move can take administration away
1178
+ * without changing the list's contents. It carries the same retention rule as
1179
+ * the two mutation paths.
1180
+ */
1181
+ declare function applyMoveGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: MoveGrantAction): PHDocument<TState>;
1182
+ /**
1183
+ * Dispatches an auth-scope action to its handler. This is the auth scope's
1184
+ * dedicated reducer: it is applied by the base reducer instead of the model
1185
+ * reducer, mirroring the document-scope platform handlers. Unknown types are a
1186
+ * no-op, matching the model-reducer default.
1187
+ */
1188
+ declare function applyAuthAction<TState extends PHBaseState>(document: PHDocument<TState>, action: Action): PHDocument<TState>;
1189
+ /**
1190
+ * Because only creators can initialize auth scopes, we must verify that either
1191
+ * the document has no auth or the version and creator match.
1192
+ */
1193
+ declare function assertAuthPreservedOnDuplicate(documentId: string, source: PHAuthState | undefined, duplicated: PHAuthState | undefined): void;
1194
+ /**
1195
+ * The auth scope a state snapshot may install, given the policy already there.
1196
+ *
1197
+ * `applyAuthAction` is the validated door onto `state.auth`, but a whole-state
1198
+ * snapshot (UPGRADE_DOCUMENT's `initialState`) replaces the scope wholesale and
1199
+ * is authorized as a `document`-scope write. Without this, a subject holding
1200
+ * `execute` on `document` and no auth grant at all can install a policy of its
1201
+ * choosing, name itself `creator` (which exempts the policy from the retention
1202
+ * rule for good), or wipe an existing policy by carrying the default
1203
+ * uninitialized one.
1204
+ *
1205
+ * Three cases:
1206
+ *
1207
+ * - the snapshot carries no policy, or an uninitialized one: the document
1208
+ * keeps the policy it has, so a default-state upgrade cannot reset it;
1209
+ * - the document is uninitialized and the snapshot carries a policy: the
1210
+ * policy is installed after the same validation genesis applies, so it
1211
+ * cannot be born locked out;
1212
+ * - both carry a policy: they must agree. A duplicate preserves its source's
1213
+ * policy (see {@link assertAuthPreservedOnDuplicate}), and anything else is
1214
+ * an attempt to replace one policy with another.
1215
+ */
1216
+ declare function resolveSnapshotAuth(documentId: string, documentType: string, current: PHAuthState | undefined, incoming: PHAuthState | undefined): PHAuthState;
1217
+ /** UNDO and REDO are rejected on the auth scope. */
1218
+ declare function assertAuthScopeActionAllowed(action: Action): void;
1219
+ type AuthVerb = "read" | "execute";
1220
+ type AuthRequest = {
1221
+ verb: AuthVerb;
1222
+ scope: string;
1223
+ /** For execute: the operation (action type) being attempted. Omitted for reads. */
1224
+ operation?: string;
1225
+ };
1226
+ type AuthSubject = {
1227
+ /** Verified signer address; undefined for an anonymous subject. */
1228
+ address?: string;
1229
+ /** The signer's app key (a did:key), used to match the document creator. */
1230
+ key?: string;
1231
+ };
1232
+ /**
1233
+ * What condition attr paths resolve against, beyond the subject. Supplied
1234
+ * only while authConditions enforcement is on: with no context a grant
1235
+ * carrying `where` or a { match } principal never applies.
1236
+ */
1237
+ type ConditionContext = {
1238
+ /** The executing scope's own state, for `doc.<scope>.*` paths. */
1239
+ scopeState: unknown;
1240
+ /** The action's input, for `action.input.*` paths. Absent for reads. */
1241
+ actionInput?: unknown;
1242
+ };
1243
+ type AuthDecision = "allow" | "deny";
1244
+ /** Why the policy refused a request. */
1245
+ type AuthRefusal = "version-unsupported" | "no-applicable-grant" | "denied-by-grant";
1246
+ /**
1247
+ * A decision together with why it refused. A refusal names which of the
1248
+ * policy's rules produced it, so an operation records the reason it was refused
1249
+ * rather than one reason standing for every refusal.
1250
+ */
1251
+ type AuthEvaluation = {
1252
+ decision: "allow";
961
1253
  } | {
962
- authorized: false;
963
- response: Response;
1254
+ decision: "deny";
1255
+ refusal: AuthRefusal;
1256
+ grantId?: string;
964
1257
  };
965
- /** A route-specific gate, for policies the standard modes cannot express. */
966
- type RouteAuthorizer = (req: IncomingMessage) => Promise<AuthorizerResult> | AuthorizerResult;
967
- /** How a route authenticates. */
968
- type RouteAuth = /** Default. A verifiable bearer is required; a caller without one gets 401. */"renown" | "renown-optional" | "public" | RouteAuthorizer;
969
- /** How the request body reaches the handler. */
970
- type RouteBody = /** Default. Buffered, and readable through the Fetch Request. */"parsed" /** Buffered and also handed over as `ctx.rawBody`, byte for byte. */ | "raw" /** Not buffered; the Fetch Request body is the live request stream. */ | "stream" /** The body is not read at all. */ | "none";
971
- interface RouteOptions {
972
- auth?: RouteAuth;
973
- body?: RouteBody;
974
- /** Refuse a body larger than this with 413. Ignored when body is `stream`. */
975
- maxBodyBytes?: number;
976
- /** Serve sub-paths too, not just an exact match. */
977
- prefix?: boolean;
978
- }
979
- /** Where the request reached the host, resolved through any reverse proxy. */
980
- interface RouteTransport {
981
- proto: string;
982
- host: string;
983
- prefix: string;
984
- baseUrl: string;
985
- }
986
- interface RouteContext {
987
- /** Decoded path params. */
988
- params: Record<string, string>;
989
- user: RouteUser | undefined;
990
- authEnabled: boolean;
991
- /** The exact octets received. Present only when body is `raw`. */
992
- rawBody: Buffer | undefined;
993
- /** Aborts when the client disconnects. */
994
- signal: AbortSignal;
995
- transport: RouteTransport;
996
- }
997
- type RouteHandler = (request: Request, ctx: RouteContext) => Response | Promise<Response>;
998
- interface RouteSpec extends RouteOptions {
999
- method: RouteMethod | RouteMethod[];
1000
- /** Relative to the scope: "runs/:id", never "/api/@scope/pkg/runs/:id". */
1001
- path: string;
1002
- handler: RouteHandler;
1258
+ /**
1259
+ * Evaluates the auth policy for a single request and reports why it refused.
1260
+ * Pure and deterministic.
1261
+ *
1262
+ * An uninitialized policy (version 0, absent auth state, or a legacy `{}`
1263
+ * auth scope serialized before PHAuthState had a version) leaves the document
1264
+ * open. Once a policy exists the default is deny, and grants stack in order.
1265
+ *
1266
+ * Group principals match only against a supplied groups map (the groups
1267
+ * projection, present when authGroups is on); with no map they never apply.
1268
+ * `where` clauses and { match } principals likewise evaluate only against a
1269
+ * supplied condition context (present when authConditions is on).
1270
+ */
1271
+ declare function evaluate(auth: PHAuthState | undefined, subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthEvaluation;
1272
+ /**
1273
+ * Evaluates the auth policy for a single request. Pure and deterministic. This
1274
+ * is {@link evaluate} with the reason dropped.
1275
+ */
1276
+ declare function decide(auth: PHAuthState | undefined, subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthDecision;
1277
+ /**
1278
+ * The group document ids a single auth action's input names with `{ group }`
1279
+ * principals. INITIALIZE_AUTH contributes the groups named across its grants,
1280
+ * SET_GRANT the groups named by its one grant; REMOVE_GRANT and MOVE_GRANT
1281
+ * contribute nothing. Total over any input shape, because references are read
1282
+ * from the input as it arrived, including inputs later stored as errors.
1283
+ */
1284
+ declare function mentionedGroupIds(action: Action): string[];
1285
+ //#endregion
1286
+ //#region document-model/auth-v1.d.ts
1287
+ /** Maximum number of grants in a policy. */
1288
+ declare const MAX_AUTH_GRANTS = 100;
1289
+ /** Maximum nesting depth of a condition tree. */
1290
+ declare const MAX_CONDITION_DEPTH = 10;
1291
+ /** Maximum node count (conditions plus operands) of a condition tree. */
1292
+ declare const MAX_CONDITION_NODES = 100;
1293
+ /** Maximum entries in an execute capability's operation list. */
1294
+ declare const MAX_CAPABILITY_OPERATIONS = 100;
1295
+ /**
1296
+ * Thrown when a grant violates the v1 validation rules. The message is stored
1297
+ * on error operations, so it must be a pure function of the input.
1298
+ */
1299
+ declare class InvalidGrantError extends Error {
1300
+ readonly grantId: string;
1301
+ constructor(grantId: string, problem: string);
1003
1302
  }
1004
- interface NodeRouteSpec extends Omit<RouteOptions, "body" | "maxBodyBytes"> {
1005
- method: RouteMethod | RouteMethod[];
1006
- path: string;
1007
- handler: (req: IncomingMessage, res: ServerResponse, ctx: Omit<RouteContext, "rawBody" | "signal">) => void | Promise<void>;
1303
+ /** Thrown for a `{ group }` principal on a group document: references never chain. */
1304
+ declare class GroupPrincipalNotAllowedError extends Error {
1305
+ readonly grantId: string;
1306
+ constructor(grantId: string);
1008
1307
  }
1009
- interface ScopedRouteHandle {
1010
- /** The absolute public URL this route answers on. */
1011
- readonly url: string;
1012
- dispose(): void;
1308
+ /**
1309
+ * Thrown when a change would leave a creator-less policy with no grant
1310
+ * permitting execute on the auth scope. Without the creator carve-out no
1311
+ * subject could ever administer such a policy again.
1312
+ */
1313
+ declare class AuthAdministrationLockoutError extends Error {
1314
+ readonly grantId: string;
1315
+ constructor(grantId: string);
1013
1316
  }
1014
- type WebhookScheme = "none" /** A shared secret presented verbatim. No digest, so no digest options. */ | "token" /** The digest of the body, alone. */ | "hmac" /** That digest behind a label, `sha256=<digest>`. */ | "hmac-prefixed" | "hmac-timestamped";
1015
- /** Hashes a sender may compute the digest with. */
1016
- type WebhookHashAlgorithm = "sha1" | "sha256" | "sha512";
1017
- /** How the digest is written into the header. */
1018
- type WebhookSignatureEncoding = "hex" | "base64";
1019
- interface WebhookVerification {
1020
- scheme: WebhookScheme;
1021
- /** Resolved value, never a reference — the caller resolves refs. */
1022
- secret?: string;
1023
- /** Overrides the scheme's conventional header. */
1024
- header?: string;
1025
- /** Replay window for timestamped schemes. */
1026
- toleranceSeconds?: number;
1027
- algorithm?: WebhookHashAlgorithm;
1028
- /** Defaults to `hex`. Base64 comparison is case-sensitive; hex is not. */
1029
- encoding?: WebhookSignatureEncoding;
1030
- prefix?: string;
1317
+ /**
1318
+ * Thrown when INITIALIZE_AUTH would create a creator-less policy with no grant
1319
+ * permitting execute on the auth scope. Such a policy would be born with no
1320
+ * subject able to administer it.
1321
+ */
1322
+ declare class AuthAdministrationMissingError extends Error {
1323
+ constructor();
1031
1324
  }
1032
- type WebhookField = string | {
1033
- header: string;
1034
- } /** Dot-separated path into the parsed body, e.g. `data.object.id`. */ | {
1035
- body: string;
1036
- };
1037
- interface WebhookRequest {
1038
- /** The caller's own key for this endpoint, e.g. a document id. */
1039
- key: string;
1040
- method: string;
1041
- path: string;
1042
- queryParams: Record<string, string>;
1043
- /** Lowercased, with credentials redacted. */
1044
- headers: Record<string, string>;
1045
- /** The exact bytes received. */
1046
- raw: Buffer;
1047
- /** JSON and form bodies decoded; anything else as text. */
1048
- body: unknown;
1325
+ declare function isPlainValue(value: unknown): value is Record<string, unknown>;
1326
+ /** Returns the first v1-rule violation, or null. Pure, total, deterministic. */
1327
+ declare function grantProblem(value: unknown): string | null;
1328
+ declare const GrantSchema: () => z.ZodCustom<Grant, Grant>;
1329
+ /** V1 shape rules plus the group-document group-principal ban. */
1330
+ declare function assertValidGrant(grant: unknown, documentType: string): void;
1331
+ /**
1332
+ * Validates an initial grant list: the count cap, every grant, and — on a
1333
+ * creator-less policy — that some grant keeps the auth scope administrable.
1334
+ */
1335
+ declare function assertValidInitialGrants(grants: Grant[], documentType: string, creator: string | undefined): void;
1336
+ /**
1337
+ * Validates a grant upsert: the grant itself, the count cap on append, and
1338
+ * administration retention. Retention is checked on an append as well as an
1339
+ * in-place replace, because a grant appended after the administration grant can
1340
+ * shadow it (evaluation is last-applicable-grant-wins) and so take
1341
+ * administration away without removing anything.
1342
+ */
1343
+ declare function assertValidGrantUpsert(grant: Grant, existing: Grant[], documentType: string, creator: string | undefined): void;
1344
+ /**
1345
+ * A creator-less policy must always retain a grant permitting execute on the
1346
+ * auth scope; on a signed document the creator carve-out keeps administration
1347
+ * reachable instead. Rejects a change that takes the last such grant away. A
1348
+ * policy already without one is left alone: the change is not what locks it.
1349
+ */
1350
+ declare function assertAuthAdministrationRetained(creator: string | undefined, previous: Grant[], next: Grant[], grantId: string): void;
1351
+ /**
1352
+ * Evaluates a version-1 condition. Deterministic, total, and pure: any input
1353
+ * shape yields a boolean and never throws, and a malformed condition is
1354
+ * false. These are consensus semantics, versioned by `PHAuthState.version`;
1355
+ * changing them requires a new version.
1356
+ */
1357
+ declare function evaluateCondition(condition: Condition, subject: AuthSubject, request: AuthRequest, conditions: ConditionContext): boolean;
1358
+ /**
1359
+ * The group document ids named by `{ group }` principals in a grant list, in
1360
+ * order of first appearance. These are the streams the groups projection reads.
1361
+ */
1362
+ declare function referencedGroupIds(grants: Grant[]): string[];
1363
+ /**
1364
+ * Evaluates a v1 grant stack: default deny, last applicable grant wins, and
1365
+ * reports which grant decided it. Group principals match only against a
1366
+ * supplied groups map, and `where` clauses and { match } principals evaluate
1367
+ * only against a supplied condition context; a grant that uses an unsupplied
1368
+ * feature never applies.
1369
+ */
1370
+ declare function evaluateGrantStack(grants: Grant[], subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthEvaluation;
1371
+ /**
1372
+ * Evaluates a v1 grant stack: default deny, last applicable grant wins. This is
1373
+ * {@link evaluateGrantStack} with the reason dropped.
1374
+ */
1375
+ declare function evaluateGrants(grants: Grant[], subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthDecision;
1376
+ //#endregion
1377
+ //#region document-model/constants.d.ts
1378
+ declare const documentModelFileExtension: "phdm";
1379
+ declare const documentModelInitialLocalState: DocumentModelLocalState;
1380
+ declare const documentModelInitialGlobalState: DocumentModelGlobalState;
1381
+ declare const documentModelGlobalState: DocumentModelGlobalState;
1382
+ declare const HASH_ALGORITHM_SHA1 = "sha1";
1383
+ declare const HASH_ALGORITHM_SHA256 = "sha256";
1384
+ declare const HASH_ALGORITHM_SHA512 = "sha512";
1385
+ declare const HASH_ENCODING_BASE64 = "base64";
1386
+ declare const HASH_ENCODING_HEX = "hex";
1387
+ //#endregion
1388
+ //#region document-model/crypto.d.ts
1389
+ declare const hashBrowser: (data: string | Uint8Array | ArrayBufferView | DataView, algorithm?: string, encoding?: string, _params?: Record<string, unknown>) => string;
1390
+ declare function getUnixTimestamp(date: Date | string): string;
1391
+ declare function buildOperationSignatureParams({ documentId, signer, action, previousStateHash }: ActionSignatureContext): [string, string, string, string];
1392
+ declare function buildOperationSignatureMessage(params: [string, string, string, string]): Uint8Array;
1393
+ declare function ab2hex(ab: ArrayBuffer | ArrayBufferView): string;
1394
+ declare function hex2ab(hex: string): Uint8Array<ArrayBuffer>;
1395
+ /**
1396
+ * Decodes a base58btc (Bitcoin/IPFS alphabet) string to bytes. Returns null on
1397
+ * any character outside the alphabet.
1398
+ */
1399
+ declare function base58Decode(input: string): Uint8Array | null;
1400
+ /** Encodes bytes as unpadded base64url. */
1401
+ declare function bytesToBase64Url(bytes: Uint8Array): string;
1402
+ /** Decodes a base64url string to bytes (portable across node, browsers, workers). */
1403
+ declare function base64UrlToBytes(input: string): Uint8Array;
1404
+ //#endregion
1405
+ //#region document-model/denied.d.ts
1406
+ /**
1407
+ * True iff authorization rejected the action.
1408
+ */
1409
+ declare function isDenied(operation: Operation): boolean;
1410
+ /**
1411
+ * The closed set of strings persisted as `deniedReason`. Re-evaluation compares
1412
+ * them, so they are consensus data: exact strings that embed no grant id,
1413
+ * subject or timestamp. Changing one is history-visible.
1414
+ */
1415
+ declare const DOCUMENT_DELETED_REASON = "document deleted";
1416
+ declare const AUTH_VERSION_UNSUPPORTED_REASON = "auth policy version unsupported";
1417
+ declare const AUTH_NO_GRANT_REASON = "no grant permits this operation";
1418
+ declare const AUTH_DENIED_BY_GRANT_REASON = "denied by grant";
1419
+ //#endregion
1420
+ //#region document-model/document-schema.d.ts
1421
+ declare const BaseDocumentHeaderSchema: z.ZodObject<{
1422
+ id: z.ZodString;
1423
+ name: z.ZodString;
1424
+ createdAtUtcIso: z.ZodString;
1425
+ lastModifiedAtUtcIso: z.ZodString;
1426
+ documentType: z.ZodString;
1427
+ }, z.core.$strip>;
1428
+ declare const BaseDocumentStateSchema: z.ZodObject<{
1429
+ global: z.ZodUnknown;
1430
+ }, z.core.$strip>;
1431
+ /** Schema for validating the header object of a DocumentModel document */
1432
+ declare const DocumentModelHeaderSchema: z.ZodObject<{
1433
+ id: z.ZodString;
1434
+ name: z.ZodString;
1435
+ createdAtUtcIso: z.ZodString;
1436
+ lastModifiedAtUtcIso: z.ZodString;
1437
+ documentType: z.ZodLiteral<"powerhouse/document-model">;
1438
+ }, z.core.$strip>;
1439
+ /** Schema for validating the state object of a DocumentModel document */
1440
+ declare const DocumentModelPHStateSchema: z.ZodObject<{
1441
+ global: z.ZodObject<Required<{
1442
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
1443
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1444
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1445
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1446
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1447
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
1448
+ }>, z.core.$strip>;
1449
+ }, z.core.$strip>;
1450
+ declare const DocumentModelSchema: z.ZodObject<{
1451
+ header: z.ZodObject<{
1452
+ id: z.ZodString;
1453
+ name: z.ZodString;
1454
+ createdAtUtcIso: z.ZodString;
1455
+ lastModifiedAtUtcIso: z.ZodString;
1456
+ documentType: z.ZodLiteral<"powerhouse/document-model">;
1457
+ }, z.core.$strip>;
1458
+ state: z.ZodObject<{
1459
+ global: z.ZodObject<Required<{
1460
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
1461
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1462
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1463
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1464
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1465
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
1466
+ }>, z.core.$strip>;
1467
+ }, z.core.$strip>;
1468
+ initialState: z.ZodObject<{
1469
+ global: z.ZodObject<Required<{
1470
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
1471
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1472
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1473
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1474
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1475
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
1476
+ }>, z.core.$strip>;
1477
+ }, z.core.$strip>;
1478
+ }, z.core.$strip>;
1479
+ /** Simple helper function to check if a state object is a DocumentModel document state object */
1480
+ declare function isDocumentModelState(state: unknown): state is DocumentModelPHState;
1481
+ /** Simple helper function to assert that a document state object is a DocumentModel document state object */
1482
+ declare function assertIsDocumentModelState(state: unknown): asserts state is DocumentModelPHState;
1483
+ /** Simple helper function to check if a document is a DocumentModel document */
1484
+ declare function isDocumentModelDocument(document: unknown): document is DocumentModelDocument;
1485
+ /** Simple helper function to assert that a document is a DocumentModel document */
1486
+ declare function assertIsDocumentModelDocument(document: unknown): asserts document is DocumentModelDocument;
1487
+ //#endregion
1488
+ //#region document-model/document-type.d.ts
1489
+ declare const documentModelDocumentType = "powerhouse/document-model";
1490
+ declare const groupDocumentType = "powerhouse/reactor-group";
1491
+ /**
1492
+ * The group-model action types that change membership. The groups projection
1493
+ * filters its reads to these, so any other group operation is invisible to a
1494
+ * decision. Kept here so the reactor never depends on the group package; a
1495
+ * reactor-group test guards against drift.
1496
+ */
1497
+ declare const groupMembershipActionTypes: readonly ["ADD_MEMBER", "REMOVE_MEMBER"];
1498
+ //#endregion
1499
+ //#region document-model/errors.d.ts
1500
+ declare const FileSystemError: Error;
1501
+ declare class InvalidActionInputError extends Error {
1502
+ data: unknown;
1503
+ constructor(data: unknown);
1049
1504
  }
1050
- interface WebhookReply {
1051
- status: number;
1052
- body?: string;
1053
- contentType?: string;
1505
+ declare class InvalidActionInputZodError extends InvalidActionInputError {
1506
+ issues: ZodIssue[];
1507
+ constructor(issues: ZodIssue[]);
1054
1508
  }
1055
- interface WebhookPolicy {
1056
- verify?: WebhookVerification;
1057
- /** Uppercase. Undefined accepts every method. */
1058
- methods?: string[];
1059
- dedupe?: {
1060
- field: WebhookField;
1061
- ttlSeconds?: number;
1062
- };
1063
- challengeField?: WebhookField;
1064
- maxBodyBytes?: number;
1509
+ /**
1510
+ * Error thrown when attempting to downgrade a document version.
1511
+ */
1512
+ declare class DowngradeNotSupportedError extends Error {
1513
+ readonly documentType: string;
1514
+ readonly fromVersion: number;
1515
+ readonly toVersion: number;
1516
+ constructor(documentType: string, fromVersion: number, toVersion: number);
1065
1517
  }
1066
- interface WebhookSpec {
1067
- /** Distinguishes several endpoint families within one package. */
1068
- name: string;
1069
- defaults?: WebhookPolicy;
1070
- onRequest: (request: WebhookRequest) => Promise<WebhookReply> | WebhookReply;
1071
- policyFor?: (key: string) => Promise<WebhookPolicy | undefined> | WebhookPolicy | undefined;
1518
+ /**
1519
+ * Thrown when INITIALIZE_AUTH is applied to an already-initialized auth scope.
1520
+ * The genesis action is valid only at auth revision zero.
1521
+ */
1522
+ declare class AuthAlreadyInitializedError extends Error {
1523
+ readonly documentId: string;
1524
+ constructor(documentId: string);
1072
1525
  }
1073
- interface WebhookEndpointInfo {
1074
- key: string;
1075
- token: string;
1076
- url: string;
1077
- createdAt: string;
1526
+ /**
1527
+ * Thrown when INITIALIZE_AUTH is not signed by the document creator (its signer
1528
+ * does not match `header.sig.publicKey`), so it cannot set the auth policy.
1529
+ */
1530
+ declare class AuthInitializerNotCreatorError extends Error {
1531
+ readonly documentId: string;
1532
+ constructor(documentId: string);
1078
1533
  }
1079
- interface IWebhookEndpoints {
1080
- endpointFor(key: string): Promise<Omit<WebhookEndpointInfo, "key">>;
1081
- revoke(key: string): Promise<void>;
1082
- list(): Promise<WebhookEndpointInfo[]>;
1534
+ /**
1535
+ * Thrown when INITIALIZE_AUTH carries a version below 1. Version 0 is reserved
1536
+ * for the uninitialized auth scope.
1537
+ */
1538
+ declare class InvalidAuthVersionError extends Error {
1539
+ readonly documentId: string;
1540
+ readonly version: number;
1541
+ constructor(documentId: string, version: number);
1083
1542
  }
1084
- interface IWebhookScope {
1085
- register(spec: WebhookSpec): Promise<IWebhookEndpoints>;
1086
- readonly hasPublicOrigin: boolean;
1543
+ /** Thrown when a duplicate would lose the source policy's version or creator binding. */
1544
+ declare class AuthPolicyNotPreservedError extends Error {
1545
+ readonly documentId: string;
1546
+ constructor(documentId: string);
1087
1547
  }
1088
- interface IHttpScope {
1089
- readonly owner: string;
1090
- readonly baseUrl: string;
1091
- get(path: string, handler: RouteHandler): ScopedRouteHandle;
1092
- get(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1093
- post(path: string, handler: RouteHandler): ScopedRouteHandle;
1094
- post(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1095
- put(path: string, handler: RouteHandler): ScopedRouteHandle;
1096
- put(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1097
- patch(path: string, handler: RouteHandler): ScopedRouteHandle;
1098
- patch(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1099
- delete(path: string, handler: RouteHandler): ScopedRouteHandle;
1100
- delete(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1101
- /** Registered independently of GET: a HEAD response is not a bodyless GET. */
1102
- head(path: string, handler: RouteHandler): ScopedRouteHandle;
1103
- head(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1104
- route(spec: RouteSpec): ScopedRouteHandle;
1105
- nodeRoute(spec: NodeRouteSpec): ScopedRouteHandle;
1106
- readonly webhooks: IWebhookScope;
1107
- /** Release every route this scope registered. Called on package teardown. */
1108
- dispose(): void;
1548
+ /**
1549
+ * Thrown when a grant referenced by REMOVE_GRANT or MOVE_GRANT does not exist.
1550
+ */
1551
+ declare class GrantNotFoundError extends Error {
1552
+ readonly grantId: string;
1553
+ constructor(grantId: string);
1109
1554
  }
1110
- //#endregion
1111
- //#region processors/types.d.ts
1112
- type ProcessorDispatchResult = {
1113
- id: string;
1114
- status: string;
1115
- };
1116
- interface IProcessorDispatch {
1117
- execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
1555
+ /**
1556
+ * Thrown when a disallowed action (UNDO, REDO) targets the auth scope.
1557
+ */
1558
+ declare class AuthActionNotAllowedError extends Error {
1559
+ readonly actionType: string;
1560
+ constructor(actionType: string);
1118
1561
  }
1119
- interface IProcessorHostModuleBase {
1120
- analyticsStore: IAnalyticsStore;
1121
- relationalDb: IRelationalDb;
1122
- processorApp: ProcessorApp;
1123
- dispatch: IProcessorDispatch;
1124
- getReadModel<T>(name: string): T;
1125
- config?: Map<string, unknown>;
1126
- /**
1127
- * The package's slice of the HTTP surface, bound to its own namespace.
1128
- *
1129
- * Declared on the host-agnostic base rather than on each host's module so
1130
- * the two cannot drift: codegen types generated processors against
1131
- * reactor-browser's `IProcessorHostModule`, and the same source has to
1132
- * compile against reactor-api's.
1133
- *
1134
- * Absent whenever the host has no HTTP server — processors also run in the
1135
- * browser — and on the reactor when the package's name cannot be resolved to
1136
- * a routable namespace, so a caller must always check before using it.
1137
- */
1138
- http?: IHttpScope;
1562
+ declare class HashMismatchError extends Error {
1563
+ protected _scope: string;
1564
+ protected _document: PHDocument;
1565
+ protected _operation: Operation;
1566
+ constructor(scope: string, document: PHDocument, operation: Operation);
1567
+ get document(): PHDocument;
1568
+ get scope(): string;
1569
+ get operation(): Operation;
1139
1570
  }
1140
1571
  /**
1141
- * Filter for matching operations to processors.
1142
- * All fields are optional arrays - when provided, operations must match at least one value in each specified field.
1143
- * When a field is undefined or empty, it matches all values for that field.
1572
+ * Thrown when replay or import requires a document model version that is not
1573
+ * registered. Carries the data the UI needs to explain the mismatch.
1144
1574
  */
1145
- type ProcessorFilter = {
1146
- documentType?: string[];
1147
- scope?: string[];
1148
- branch?: string[];
1149
- documentId?: string[];
1575
+ declare class UnsupportedDocumentModelVersionError extends Error {
1576
+ readonly documentType: string;
1577
+ readonly requiredVersion: number;
1578
+ readonly availableVersions: number[];
1579
+ constructor(documentType: string, requiredVersion: number, availableVersions: number[]);
1580
+ static isError(error: unknown): error is UnsupportedDocumentModelVersionError;
1581
+ }
1582
+ //#endregion
1583
+ //#region document-model/upgrades.d.ts
1584
+ /** Upgrade reducer transforms a document from one version to another */
1585
+ type UpgradeReducer<TFrom extends PHBaseState, TTo extends PHBaseState> = (document: PHDocument<TFrom>, action: Action) => PHDocument<TTo>;
1586
+ type ModelVersion = number;
1587
+ /** Metadata about a version transition */
1588
+ type UpgradeTransition = {
1589
+ toVersion: ModelVersion;
1590
+ upgradeReducer: UpgradeReducer<any, any>;
1591
+ description?: string;
1592
+ };
1593
+ type TupleMember<T extends readonly unknown[]> = T[number];
1594
+ /** Manifest declaring all supported versions and upgrade paths */
1595
+ type UpgradeManifest<TVersions extends readonly number[]> = {
1596
+ documentType: string;
1597
+ latestVersion: TupleMember<TVersions>;
1598
+ supportedVersions: TVersions;
1599
+ upgrades: { [V in Exclude<TupleMember<TVersions>, 1> as `v${V}`]: UpgradeTransition; };
1150
1600
  };
1151
1601
  /**
1152
- * Describes an object that can process operations.
1602
+ * Canonical document-model version normalization: documents stamped with 0
1603
+ * or nothing at all predate versioning and are treated as version 1, the
1604
+ * same version the registry assigns unversioned modules. Every consumer
1605
+ * that resolves a module or compares versions must use this rule; resolving
1606
+ * 0 to "latest" instead re-pins a legacy document's history to whichever
1607
+ * module happens to be newest.
1153
1608
  */
1154
- interface IProcessor {
1155
- /**
1156
- * Processes a list of operations with context.
1157
- * Called when operations match this processor's filter.
1158
- */
1159
- onOperations(operations: OperationWithContext[]): Promise<void>;
1160
- /**
1161
- * Called when the processor is disconnected.
1162
- * Used to clean up any resources allocated during processor creation.
1163
- */
1164
- onDisconnect(): Promise<void>;
1165
- }
1609
+ declare function normalizeDocumentModelVersion(version: number | undefined | null): number;
1166
1610
  /**
1167
- * Relates a processor to its filter configuration.
1611
+ * Applies an UPGRADE_DOCUMENT action to a document.
1612
+ * Handles all upgrade scenarios including initial upgrades, no-ops, and multi-step upgrades.
1613
+ *
1614
+ * Behavior based on fromVersion/toVersion:
1615
+ * - fromVersion === toVersion (and fromVersion > 0): No-op - return unchanged document
1616
+ * - fromVersion > toVersion: Throw DowngradeNotSupportedError
1617
+ * - All other cases: Apply upgradePath transitions (if provided), then apply initialState, set version
1168
1618
  */
1169
- type ProcessorRecord = {
1170
- processor: IProcessor;
1171
- filter: ProcessorFilter;
1172
- startFrom?: "beginning" | "current";
1173
- id?: string;
1174
- };
1619
+ declare function applyUpgradeDocumentAction(document: PHDocument, action: UpgradeDocumentAction, upgradePath?: UpgradeTransition[]): PHDocument;
1620
+ /** CREATE_DOCUMENT fixes `protocolVersions`; this puts them back after a reducer. */
1621
+ declare function withProtocolVersions<TDocument extends PHDocument>(document: TDocument, protocolVersions: PHDocument["header"]["protocolVersions"]): TDocument;
1175
1622
  /**
1176
- * A factory function that creates processor records for a given drive.
1177
- * Called once per drive when the drive is first detected or when the factory is registered.
1623
+ * Applies a DELETE_DOCUMENT action, or a PURGE_DOCUMENT marker, to a document.
1624
+ * Marks the document as deleted in the document scope state.
1178
1625
  */
1179
- type ProcessorFactory = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => Promise<ProcessorRecord[]> | ProcessorRecord[];
1180
- /** Takes a processor host module and builds processor factories using its context. */
1181
- type ProcessorFactoryBuilder<TModule extends IProcessorHostModuleBase = IProcessorHostModuleBase> = {
1182
- bivarianceHack(module: TModule): Promise<ProcessorFactory> | ProcessorFactory;
1183
- }["bivarianceHack"];
1184
- type ProcessorStatus = "active" | "errored";
1185
- type TrackedProcessor = {
1186
- processorId: string;
1187
- factoryId: string;
1188
- driveId: string;
1189
- processorIndex: number;
1190
- record: ProcessorRecord;
1191
- lastOrdinal: number;
1192
- status: ProcessorStatus;
1193
- lastError: string | undefined;
1194
- lastErrorTimestamp: Date | undefined;
1195
- retry: () => Promise<void>;
1626
+ declare function applyDeleteDocumentAction(document: PHDocument, action: DeleteDocumentAction | PurgeDocumentAction): PHDocument;
1627
+ /**
1628
+ * Computes the ordered list of upgrade transitions needed to move from
1629
+ * fromVersion to toVersion using the provided manifest.
1630
+ * Walks keys v(fromVersion+1)..v(toVersion) and throws a descriptive Error
1631
+ * if the manifest is absent or any step is missing.
1632
+ */
1633
+ declare function computeUpgradeTransitions(manifest: UpgradeManifest<readonly number[]> | undefined, fromVersion: number, toVersion: number): UpgradeTransition[];
1634
+ //#endregion
1635
+ //#region document-model/versioned-replay.d.ts
1636
+ type VersionedReducers = Record<number, Reducer<PHBaseState>>;
1637
+ type VersionedReplayConfig = {
1638
+ reducers: VersionedReducers;
1639
+ upgradeManifest?: UpgradeManifest<readonly number[]>;
1196
1640
  };
1197
1641
  /**
1198
- * Manages processor creation and destruction based on drive operations.
1642
+ * Version-aware document replay. Replays a versioned document through per-version
1643
+ * reducers, applying upgrade transitions at segment boundaries.
1644
+ *
1645
+ * Algorithm (D5):
1646
+ * a. Build spine from operations["document"]. Empty spine or no upgrades → legacy fallback.
1647
+ * b. Collect UPGRADE_DOCUMENT ops from the spine.
1648
+ * c. Seed state from the creation upgrade (fromVersion===0). Missing seed with validated
1649
+ * upgrades throws; otherwise falls back to legacy.
1650
+ * d. Identify validated upgrades (fromVersion > 0, version increases). Compute per-scope
1651
+ * boundaries using revision snapshot (preferred) or timestamp fallback.
1652
+ * e. Loop over version segments, replaying each scope's ops through the matching reducer,
1653
+ * then applying the upgrade transition before the next segment.
1654
+ * f. Set header.revision["document"], verify per-scope hashes against state at op-time
1655
+ * (not post-upgrade state) when checkHashes is false, and map timestamps from input.
1656
+ *
1657
+ * operations must include ALL scopes (document scope is NOT stripped).
1658
+ * reuseOperationResultingState is ignored by this function — zip operations never carry
1659
+ * resultingState.
1199
1660
  */
1200
- interface IProcessorManager {
1201
- /**
1202
- * Registers a processor factory.
1203
- * Immediately creates processors for all existing drives.
1204
- */
1205
- registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
1206
- /**
1207
- * Unregisters a processor factory and disconnects all processors it created.
1208
- */
1209
- unregisterFactory(identifier: string): Promise<void>;
1210
- /**
1211
- * Gets a tracked processor by its ID.
1212
- */
1213
- get(processorId: string): TrackedProcessor | undefined;
1214
- /**
1215
- * Gets all tracked processors.
1216
- */
1217
- getAll(): TrackedProcessor[];
1218
- }
1219
- type ProcessorApp = (typeof PROCESSOR_APPS)[number];
1220
- type ProcessorApps = readonly ProcessorApp[];
1661
+ declare function replayDocumentVersioned<TState extends PHBaseState>(initialState: TState, operations: DocumentOperations, config: VersionedReplayConfig, header: PHDocumentHeader, dispatch?: SignalDispatch, options?: ReplayDocumentOptions): PHDocument<TState>;
1221
1662
  //#endregion
1222
- //#region processors/relational/types.d.ts
1223
- type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
1224
- type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
1225
- withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
1663
+ //#region document-model/files.d.ts
1664
+ declare function createZip(document: PHDocument): Promise<Uint8Array>;
1665
+ /**
1666
+ * Creates a minimal ZIP backup from strand data.
1667
+ * Used when the full document is not available (e.g., in onOperations handler).
1668
+ * Creates a ZIP with minimal header and empty operations.
1669
+ */
1670
+ declare function createMinimalZip(data: MinimalBackupData): Promise<Uint8Array>;
1671
+ declare function baseSaveToFileHandle(document: PHDocument, input: FileSystemFileHandle): Promise<void>;
1672
+ declare function baseLoadFromInput<TState extends PHBaseState>(input: FileInput, reducer: Reducer<TState>, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
1673
+ declare function baseLoadFromInputVersioned<TState extends PHBaseState>(input: FileInput, config: VersionedReplayConfig, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
1674
+ type BulkArchiveEntry = {
1675
+ /** "/"-separated zip path of a file entry (no trailing slash). */
1676
+ path: string;
1677
+ data: Uint8Array;
1226
1678
  };
1227
- type HashAlgorithms = "fnv1a";
1228
- type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
1229
1679
  /**
1230
- * The standardized relational database interface for relational db processors.
1231
- * This abstraction provides type-safe database operations while hiding the underlying
1232
- * database framework implementation details.
1233
- **/
1234
- type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {
1235
- createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
1236
- queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
1680
+ * Whether this zip is a single Powerhouse document: the document's four JSON
1681
+ * entries (header/state/current-state/operations) at the archive root. A
1682
+ * bulk archive has a folder tree instead. Returns false for any input that
1683
+ * is not a readable zip.
1684
+ */
1685
+ declare function isDocumentZip(data: Uint8Array): Promise<boolean>;
1686
+ /**
1687
+ * The file entries of a zip (directory entries excluded). Used for bulk
1688
+ * archives; throws when the archive holds no files. Note this does NOT
1689
+ * validate that the entries are document zips — pair with isDocumentZip.
1690
+ */
1691
+ declare function parseBulkArchive(data: Uint8Array): Promise<BulkArchiveEntry[]>;
1692
+ /**
1693
+ * Assemble a zip from raw entries. A key ending in "/" with empty data is a
1694
+ * directory entry, so an archive's folder structure survives a round-trip.
1695
+ */
1696
+ declare function zipEntries(entries: Record<string, Uint8Array>): Promise<Uint8Array>;
1697
+ declare const documentModelLoadFromInput: LoadFromInput<DocumentModelPHState>;
1698
+ declare const documentModelSaveToFileHandle: SaveToFileHandle;
1699
+ declare function writeFileBrowser(path: string, name: string, stream: Uint8Array): Promise<string>;
1700
+ declare function readFileBrowser(path: string): void;
1701
+ declare function fetchFileBrowser(url: string): Promise<{
1702
+ data: Buffer;
1703
+ mimeType?: string;
1704
+ }>;
1705
+ declare const getFileBrowser: (file: string) => Promise<void>;
1706
+ //#endregion
1707
+ //#region document-model/header.d.ts
1708
+ /**
1709
+ * Creates a verification-only signer from a public key.
1710
+ * This signer can only verify signatures, not sign data.
1711
+ *
1712
+ * @param pubKey - The public key to use for verification.
1713
+ * @returns An ISigner that can only verify signatures.
1714
+ */
1715
+ declare function createVerificationSigner(pubKey: JsonWebKey): Promise<ISigner>;
1716
+ /**
1717
+ * Signs a header. Generally, this is not called directly, but rather through
1718
+ * {@link createSignedHeader}.
1719
+ *
1720
+ * @param parameters - The parameters used to sign the header.
1721
+ * @param signer - The signer of the document.
1722
+ *
1723
+ * @returns The signature of the header.
1724
+ */
1725
+ declare const sign: (parameters: SigningParameters, signer: ISigner) => Promise<string>;
1726
+ /**
1727
+ * Verifies a header signature. Generally, this is not called directly, but
1728
+ * rather through {@link validateHeader}.
1729
+ *
1730
+ * @param parameters - The parameters used to sign the header.
1731
+ * @param signature - The signature to verify.
1732
+ * @param signer - The signer of the document.
1733
+ */
1734
+ declare const verify: (parameters: SigningParameters, signature: string, signer: ISigner) => Promise<void>;
1735
+ /**
1736
+ * Validates a header signature.
1737
+ */
1738
+ declare const validateHeader: (header: PHDocumentHeader) => Promise<void>;
1739
+ /**
1740
+ * Creates a header that has yet to be signed. This header is not valid, but
1741
+ * can be input into {@link createSignedHeader} to create a signed header.
1742
+ *
1743
+ * With `protocolVersions` requiring v2 signatures the header takes a random
1744
+ * nonce and the id {@link deriveDocumentId} gives, so `id` must be omitted.
1745
+ *
1746
+ * @returns An unsigned header for a document.
1747
+ */
1748
+ declare const createPresignedHeader: (id?: string, documentType?: string, protocolVersions?: ProtocolVersions) => PHDocumentHeader;
1749
+ /**
1750
+ * A header for a copy of a document headed `source`. A copy is v2-required
1751
+ * when its source is or when `policy` asks for it, and then takes a derived id;
1752
+ * otherwise it takes `id`. It keeps the source's other protocol versions.
1753
+ */
1754
+ declare function createCopyHeader(source: Pick<PHDocumentHeader, "documentType" | "protocolVersions">, id?: string, policy?: SignaturePolicy$1): PHDocumentHeader;
1755
+ /** Whether a v2-required `header` carries the id its params derive. */
1756
+ declare function hasDerivedDocumentId(header: PHDocumentHeader): boolean;
1757
+ /**
1758
+ * Creates a new, signed header for a document. This will replace the id of the
1759
+ * document.
1760
+ *
1761
+ * @param unsignedHeader - The unsigned header to created the signed header from.
1762
+ * @param signer - The signer of the document.
1763
+ *
1764
+ * @returns A new signed header for a document. Some fields are mutable and
1765
+ * some are not. See the PHDocumentHeader type for more information.
1766
+ */
1767
+ declare const createSignedHeader: (unsignedHeader: PHDocumentHeader, documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
1768
+ /**
1769
+ * Creates a signed header for a document. The document header requires a signer
1770
+ * as the document id is a cryptographic signature.
1771
+ *
1772
+ * @param documentType - The type of the document.
1773
+ * @param signer - The signer of the document.
1774
+ *
1775
+ * @returns The signed header for a document. Some fields are mutable and
1776
+ * some are not. See the PHDocumentHeader type for more information.
1777
+ */
1778
+ declare const createSignedHeaderForSigner: (documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
1779
+ //#endregion
1780
+ //#region document-model/peer-agreement.d.ts
1781
+ /** The reactor feature flags a capability's support is a function of. */
1782
+ type PeerCapabilityFlags = {
1783
+ readonly [flag: string]: boolean | undefined;
1784
+ };
1785
+ /** A document protocol, named by its `protocolVersions` key. */
1786
+ type ProtocolCapability = {
1787
+ kind: "protocol";
1788
+ name: string;
1789
+ /** What a peer that announces nothing is assumed to support. */
1790
+ baseline: readonly number[];
1791
+ supported(flags: PeerCapabilityFlags): readonly number[];
1792
+ /** The version new documents take when peers agree. Absent: not negotiated. */
1793
+ preferred?(flags: PeerCapabilityFlags): number;
1794
+ /** A header may omit the key. */
1795
+ optional: boolean;
1796
+ };
1797
+ /** A feature that changes what a peer sends or expects on the wire. */
1798
+ type FeatureCapability = {
1799
+ kind: "feature";
1800
+ name: string;
1801
+ baseline: readonly number[];
1802
+ supported(flags: PeerCapabilityFlags): readonly number[];
1803
+ };
1804
+ type PeerCapability = ProtocolCapability | FeatureCapability;
1805
+ /** A purged document's protocol; never preferred, so creation never selects it. */
1806
+ declare const DOCUMENT_PURGE_PROTOCOL = "document-purge";
1807
+ /** A peer that takes refusals of polled purge markers on the poll. */
1808
+ declare const MARKER_REFUSAL_FEATURE = "marker-refusal";
1809
+ declare const PEER_CAPABILITIES: readonly PeerCapability[];
1810
+ /** `base` plus `extra`; an extra replaces a base entry of the same name. */
1811
+ declare function mergePeerCapabilities(base: readonly PeerCapability[], extra: readonly PeerCapability[]): PeerCapability[];
1812
+ declare const PEER_MANIFEST_FORMAT = 1;
1813
+ type Supports = {
1814
+ protocols: {
1815
+ [protocol: string]: readonly number[];
1816
+ };
1817
+ features: {
1818
+ [feature: string]: readonly number[];
1819
+ };
1237
1820
  };
1238
- type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
1239
- type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
1240
- interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
1241
- namespace: string;
1242
- query: IRelationalQueryBuilder<TDatabaseSchema>;
1243
- filter: ProcessorFilter;
1244
- initAndUpgrade(): Promise<void>;
1245
- }
1246
- declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
1821
+ type PeerManifest = Supports & {
1822
+ format: 1;
1823
+ /** The signer's did:key, when configured; informational. */
1824
+ appKey?: string;
1825
+ /** Grows with every start of the reactor; a peer ignores an older one. */
1826
+ sequence: number;
1827
+ /** base64url(sha256(canonicalJson(Supports & { sequence }))) */
1828
+ revision: string;
1829
+ };
1830
+ /** What this reactor supports, for every capability it registers. */
1831
+ declare function localSupports(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags): Supports;
1832
+ /** What a peer that announces nothing supports. */
1833
+ declare function legacySupports(capabilities: readonly PeerCapability[]): Supports;
1834
+ declare function manifestRevision(supports: Supports, sequence?: number): string;
1835
+ declare function localPeerManifest(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags, appKey?: string, sequence?: number): PeerManifest;
1836
+ /** A manifest sent before the one already held; silence carries no sequence. */
1837
+ declare function isOlderManifest(next: PeerManifest | null, held: PeerManifest | null | undefined): boolean;
1838
+ /** A peer's manifest, or the baselines for a peer that announced none. */
1839
+ declare function peerSupports(manifest: PeerManifest | null, capabilities: readonly PeerCapability[]): Supports;
1247
1840
  /**
1248
- * Base class for relational db processors that require a relational database storage.
1249
- * This class abstracts database initialization, migration management, and resource cleanup,
1250
- * allowing derived classes to focus on business logic.
1841
+ * A manifest as received from a peer, or null when it is not one. Formats only
1842
+ * add fields, so one of an unknown format is read as its two maps.
1251
1843
  */
1252
- declare abstract class RelationalDbProcessor<TDatabaseSchema = unknown> implements IRelationalDbProcessor<TDatabaseSchema> {
1253
- protected _namespace: string;
1254
- protected _filter: ProcessorFilter;
1255
- protected relationalDb: IRelationalDb<TDatabaseSchema>;
1256
- constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>);
1257
- static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
1258
- /**
1259
- * Returns the namespace for a given drive id.
1260
- * This method can be overridden by derived classes to provide a custom namespace.
1261
- */
1262
- static getNamespace(driveId: string): string;
1263
- static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
1264
- /**
1265
- * Processes a list of operations with context.
1266
- * Called when operations match this processor's filter.
1267
- */
1268
- abstract onOperations(operations: OperationWithContext[]): Promise<void>;
1269
- /**
1270
- * Returns the filter for the processor.
1271
- * This method can be overridden by derived classes to provide a custom filter.
1272
- */
1273
- get filter(): ProcessorFilter;
1274
- /**
1275
- * Returns the namespace used by the processor.
1276
- */
1277
- get namespace(): string;
1278
- get query(): IRelationalQueryBuilder<TDatabaseSchema>;
1279
- /**
1280
- * Abstract method that derived classes must implement.
1281
- * This method is meant to be called on subclasses to initialize and upgrade the database.
1282
- */
1283
- abstract initAndUpgrade(): Promise<void>;
1284
- /**
1285
- * Called when the processor is disconnected.
1286
- * This method is meant to be overridden by subclasses to clean up resources.
1287
- */
1288
- abstract onDisconnect(): Promise<void>;
1289
- }
1844
+ declare function readPeerManifest(value: unknown): PeerManifest | null;
1845
+ /** Why a document may not go to a peer. */
1846
+ type HoldReason = {
1847
+ protocol: string;
1848
+ version: number;
1849
+ peerSupports: readonly number[];
1850
+ };
1851
+ /** Only keys this reactor registers are judged; an absent key agrees. */
1852
+ declare function holdReason(peer: Supports, versions: {
1853
+ readonly [protocol: string]: number;
1854
+ }, capabilities: readonly PeerCapability[]): HoldReason | undefined;
1855
+ /** Whether a peer runs every version this reactor does, so nothing is held. */
1856
+ declare function coversLocal(peer: Supports, local: Supports, capabilities: readonly PeerCapability[]): boolean;
1857
+ /**
1858
+ * protocolVersions for a new document: per negotiated protocol, the highest
1859
+ * version up to the local preference that every member supports, else the
1860
+ * lowest local one. `requested` wins over what is selected.
1861
+ */
1862
+ declare function selectProtocolVersions(input: {
1863
+ capabilities: readonly PeerCapability[];
1864
+ flags: PeerCapabilityFlags;
1865
+ members: Iterable<Supports>;
1866
+ requested?: {
1867
+ readonly [protocol: string]: number;
1868
+ };
1869
+ }): {
1870
+ [protocol: string]: number;
1871
+ };
1290
1872
  //#endregion
1291
- //#region processors/relational/utils.d.ts
1873
+ //#region document-model/purge.d.ts
1874
+ declare const PURGE_DOCUMENT = "PURGE_DOCUMENT";
1875
+ type PurgeMarkerOperation = Operation & {
1876
+ action: PurgeDocumentAction;
1877
+ };
1878
+ type ActionLike = Pick<Action, "type">;
1879
+ declare function isPurgeMarker(value: Action): value is PurgeDocumentAction;
1880
+ declare function isPurgeMarker(value: Operation): value is PurgeMarkerOperation;
1881
+ declare function isPurgeMarker(value: OperationWithContext$1): value is OperationWithContext$1 & {
1882
+ operation: PurgeMarkerOperation;
1883
+ };
1884
+ declare function isPurgeMarker(value: ActionLike | {
1885
+ action?: ActionLike;
1886
+ } | {
1887
+ operation: Operation;
1888
+ }): boolean;
1889
+ /** An unsigned marker; `purgedAtUtcIso` is the action's own timestamp. */
1890
+ declare function purgeDocumentAction(input: Omit<PurgeDocumentActionInput, "purgedAtUtcIso">, options?: {
1891
+ id?: string;
1892
+ timestampUtcMs?: string;
1893
+ }): PurgeDocumentAction;
1894
+ /** The sole row of a purged stream: document/main, index 0, skip 0, hash "". */
1895
+ declare function purgeMarkerOperation(action: PurgeDocumentAction): PurgeMarkerOperation;
1896
+ /** Protocol versions of a purged id; derived, never stored. */
1897
+ declare function purgedProtocolVersions(): {
1898
+ [protocol: string]: number;
1899
+ };
1900
+ //#endregion
1901
+ //#region document-model/reducer.d.ts
1902
+ declare function replayOperations<TState extends PHBaseState = PHBaseState>(initialState: TState, clearedOperations: DocumentOperations, stateReducer: StateReducer<TState>, header: PHDocumentHeader, dispatch?: SignalDispatch, documentReducer?: typeof baseReducer, skipHeaderOperations?: SkipHeaderOperations, options?: ReplayDocumentOptions): PHDocument<TState>;
1292
1903
  /**
1293
- * Hashes a string to a lowercase base-26 string.
1294
- * @param str The string to hash.
1295
- * @param length The length of the hash. Defaults to 10.
1296
- * @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
1297
- * @returns The hashed string.
1904
+ * Updates the document state based on the provided action.
1905
+ *
1906
+ * @param state The current state of the document.
1907
+ * @param action The action being applied to the document.
1908
+ * @param skip The number of operations to skip before applying the action.
1909
+ * @param reuseLastOperationIndex Whether to reuse the last operation index (used when a an UNDO operation is performed after an existing one).
1910
+ * @param context The operation context for deterministic ID generation.
1911
+ * @returns The updated document state.
1298
1912
  */
1299
- declare function hashNamespace(str: string, length?: number): string;
1913
+ declare function updateDocument<TDocument extends PHDocument>(document: TDocument, action: Action, reuseLastOperationIndex: boolean, skip: number, context: OperationContext, operation?: Operation, skipIndexValidation?: boolean): TDocument;
1300
1914
  /**
1301
- * Creates a RelationalDb instance with namespace support.
1302
- * @param baseDb The base RelationalDb instance to enhance.
1303
- * @param baseOptions The default options for namespace creation. Hashes namespace by default.
1304
- * @returns The enhanced RelationalDb instance.
1915
+ * Processes an UNDO or REDO action.
1916
+ *
1917
+ * @param document The current state of the document.
1918
+ * @param action The action being applied to the document.
1919
+ * @param skip The number of operations to skip before applying the action.
1920
+ * @returns The updated document, calculated skip value and transformed action (if applied).
1305
1921
  */
1306
- declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
1307
- type NamespaceOptions = {
1308
- hashNamespace?: boolean;
1922
+ declare function processUndoRedo<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, skip: number, protocolVersion?: number): {
1923
+ document: PHDocument<TState>;
1924
+ action: Action;
1925
+ skip: number;
1926
+ reuseLastOperationIndex: boolean;
1309
1927
  };
1310
- declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
1311
- declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
1312
1928
  /**
1313
- * Returns a query builder for a RelationalDb instance.
1314
- * @param query The RelationalDb instance to convert.
1315
- * @returns The IRelationalQueryBuilder instance.
1929
+ * Base document reducer that wraps a custom document reducer and handles
1930
+ * document-level actions such as undo, redo, and set name.
1931
+ *
1932
+ * @template TGlobalState - The type of the state of the custom reducer.
1933
+ * @template TAction - The type of the actions of the custom reducer.
1934
+ * @param state - The current state of the document.
1935
+ * @param action - The action object to apply to the state.
1936
+ * @param customReducer - The custom reducer that implements the application logic
1937
+ * specific to the document's state.
1938
+ * @returns The new state of the document.
1316
1939
  */
1317
- declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
1940
+ declare function baseReducer<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, customReducer: StateReducer<TState>, dispatch?: SignalDispatch, options?: ReducerOptions): PHDocument<TState>;
1941
+ /**
1942
+ * Helper function to create a document model reducer.
1943
+ *
1944
+ * @remarks
1945
+ * This function creates a new reducer that wraps the provided `reducer` with
1946
+ * `documentReducer`, adding support for document actions:
1947
+ * - `SET_NAME`
1948
+ * - `UNDO`
1949
+ * - `REDO`
1950
+ *
1951
+ * It also updates the document-related attributes on every operation.
1952
+ *
1953
+ * @param reducer - The custom reducer to wrap.
1954
+ * @param documentReducer - The document reducer to use.
1955
+ *
1956
+ * @returns The new reducer.
1957
+ */
1958
+ declare function createReducer<TState extends PHBaseState = PHBaseState>(stateReducer: StateReducer<TState>, documentReducer?: typeof baseReducer): Reducer<TState>;
1959
+ //#endregion
1960
+ //#region document-model/reducers.d.ts
1961
+ declare const documentModelHeaderReducer: DocumentModelHeaderOperations;
1962
+ declare const documentModelModuleReducer: DocumentModelModuleOperations;
1963
+ declare const documentModelOperationErrorReducer: DocumentModelOperationErrorOperations;
1964
+ declare const documentModelOperationExampleReducer: DocumentModelOperationExampleOperations;
1965
+ declare const documentModelOperationReducer: DocumentModelOperationOperations;
1966
+ declare const documentModelStateSchemaReducer: DocumentModelStateOperations;
1967
+ declare const documentModelVersioningReducer: DocumentModelVersioningOperations;
1968
+ declare const documentModelStateReducer: StateReducer<DocumentModelPHState>;
1969
+ declare const documentModelReducer: Reducer<DocumentModelPHState>;
1318
1970
  //#endregion
1319
1971
  //#region document-model/schemas.d.ts
1320
1972
  type definedNonNullAny = {};
1321
1973
  declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
1322
1974
  declare const definedNonNullAnySchema: z.ZodAny & z.ZodType<definedNonNullAny, any, z.core.$ZodTypeInternals<definedNonNullAny, any>>;
1323
- declare const Load_StateSchema: z.ZodEnum<{
1324
- LOAD_STATE: "LOAD_STATE";
1325
- }>;
1326
- declare const PruneSchema: z.ZodEnum<{
1327
- PRUNE: "PRUNE";
1328
- }>;
1329
1975
  declare const RedoSchema: z.ZodEnum<{
1330
1976
  REDO: "REDO";
1331
1977
  }>;
@@ -1340,18 +1986,6 @@ declare const UndoSchema: z.ZodEnum<{
1340
1986
  }>;
1341
1987
  declare function OperationScopeSchema(): z.ZodString;
1342
1988
  declare function DocumentActionSchema(): z.ZodUnion<readonly [z.ZodObject<Required<{
1343
- id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1344
- timestampUtcMs: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1345
- input: z.ZodType<LoadStateActionInput, LoadStateActionInput, z.core.$ZodTypeInternals<LoadStateActionInput, LoadStateActionInput>>;
1346
- type: z.ZodType<"LOAD_STATE", "LOAD_STATE", z.core.$ZodTypeInternals<"LOAD_STATE", "LOAD_STATE">>;
1347
- scope: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1348
- }>, z.core.$strip>, z.ZodObject<Required<{
1349
- id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1350
- timestampUtcMs: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1351
- input: z.ZodType<PruneActionInput, PruneActionInput, z.core.$ZodTypeInternals<PruneActionInput, PruneActionInput>>;
1352
- type: z.ZodType<"PRUNE", "PRUNE", z.core.$ZodTypeInternals<"PRUNE", "PRUNE">>;
1353
- scope: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1354
- }>, z.core.$strip>, z.ZodObject<Required<{
1355
1989
  id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1356
1990
  timestampUtcMs: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1357
1991
  input: z.ZodType<RedoActionInput, RedoActionInput, z.core.$ZodTypeInternals<RedoActionInput, RedoActionInput>>;
@@ -1376,11 +2010,6 @@ declare function DocumentActionSchema(): z.ZodUnion<readonly [z.ZodObject<Requir
1376
2010
  type: z.ZodType<"UNDO", "UNDO", z.core.$ZodTypeInternals<"UNDO", "UNDO">>;
1377
2011
  scope: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1378
2012
  }>, z.core.$strip>]>;
1379
- declare function LoadStateActionSchema(): z.ZodObject<Properties<SchemaLoadStateAction>>;
1380
- declare function LoadStateActionInputSchema(): z.ZodObject<Properties<LoadStateActionInput>>;
1381
- declare function LoadStateActionStateInputSchema(): z.ZodObject<Properties<LoadStateActionStateInput>>;
1382
- declare function PruneActionSchema(): z.ZodObject<Properties<SchemaPruneAction>>;
1383
- declare function PruneActionInputSchema(): z.ZodObject<Properties<PruneActionInput>>;
1384
2013
  declare function RedoActionInputSchema(): z.ZodObject<{
1385
2014
  count: z.ZodNumber;
1386
2015
  }, z.core.$strip>;
@@ -1397,7 +2026,7 @@ declare function UndoActionInputSchema(): z.ZodObject<{
1397
2026
  count: z.ZodNumber;
1398
2027
  }, z.core.$strip>;
1399
2028
  declare function UndoActionSchema(): z.ZodObject<Properties<SchemaUndoAction>>;
1400
- type Properties<T> = Required<{ [K in keyof T]: z.ZodType<T[K], T[K]> }>;
2029
+ type Properties<T> = Required<{ [K in keyof T]: z.ZodType<T[K], T[K]>; }>;
1401
2030
  declare function AddChangeLogItemInputSchema(): z.ZodObject<Properties<AddChangeLogItemInput>>;
1402
2031
  declare function AddModuleInputSchema(): z.ZodObject<Properties<AddModuleInput>>;
1403
2032
  declare function AddOperationErrorInputSchema(): z.ZodObject<Properties<AddOperationErrorInput>>;
@@ -1590,6 +2219,24 @@ declare const PowerhouseModulesSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
1590
2219
  name: z.ZodString;
1591
2220
  documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1592
2221
  }, z.core.$strip>>>;
2222
+ declare const PieceModuleSchema: z.ZodObject<{
2223
+ id: z.ZodString;
2224
+ name: z.ZodString;
2225
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2226
+ version: z.ZodOptional<z.ZodString>;
2227
+ description: z.ZodOptional<z.ZodString>;
2228
+ bundle: z.ZodOptional<z.ZodString>;
2229
+ descriptor: z.ZodOptional<z.ZodString>;
2230
+ }, z.core.$strip>;
2231
+ declare const PieceModulesSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
2232
+ id: z.ZodString;
2233
+ name: z.ZodString;
2234
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2235
+ version: z.ZodOptional<z.ZodString>;
2236
+ description: z.ZodOptional<z.ZodString>;
2237
+ bundle: z.ZodOptional<z.ZodString>;
2238
+ descriptor: z.ZodOptional<z.ZodString>;
2239
+ }, z.core.$strip>>>;
1593
2240
  declare const PublisherSchema: z.ZodObject<{
1594
2241
  name: z.ZodOptional<z.ZodString>;
1595
2242
  url: z.ZodOptional<z.ZodString>;
@@ -1600,7 +2247,7 @@ declare const ConfigEntrySchema: z.ZodObject<{
1600
2247
  type: z.ZodUnion<readonly [z.ZodLiteral<"var">, z.ZodLiteral<"secret">]>;
1601
2248
  description: z.ZodOptional<z.ZodString>;
1602
2249
  required: z.ZodOptional<z.ZodBoolean>;
1603
- default: z.ZodOptional<z.ZodBoolean>;
2250
+ default: z.ZodOptional<z.ZodString>;
1604
2251
  }, z.core.$strip>;
1605
2252
  declare const PwaConfigSchema: z.ZodType<PHConnectPwa>;
1606
2253
  declare const ManifestSchema: z.ZodObject<{
@@ -1637,65 +2284,573 @@ declare const ManifestSchema: z.ZodObject<{
1637
2284
  name: z.ZodString;
1638
2285
  documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1639
2286
  }, z.core.$strip>>>;
2287
+ pieces: z.ZodOptional<z.ZodArray<z.ZodObject<{
2288
+ id: z.ZodString;
2289
+ name: z.ZodString;
2290
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2291
+ version: z.ZodOptional<z.ZodString>;
2292
+ description: z.ZodOptional<z.ZodString>;
2293
+ bundle: z.ZodOptional<z.ZodString>;
2294
+ descriptor: z.ZodOptional<z.ZodString>;
2295
+ }, z.core.$strip>>>;
1640
2296
  config: z.ZodOptional<z.ZodArray<z.ZodObject<{
1641
2297
  name: z.ZodString;
1642
2298
  type: z.ZodUnion<readonly [z.ZodLiteral<"var">, z.ZodLiteral<"secret">]>;
1643
2299
  description: z.ZodOptional<z.ZodString>;
1644
2300
  required: z.ZodOptional<z.ZodBoolean>;
1645
- default: z.ZodOptional<z.ZodBoolean>;
2301
+ default: z.ZodOptional<z.ZodString>;
1646
2302
  }, z.core.$strip>>>;
1647
2303
  pwa: z.ZodOptional<z.ZodType<PHConnectPwa, unknown, z.core.$ZodTypeInternals<PHConnectPwa, unknown>>>;
1648
2304
  }, z.core.$strip>;
1649
2305
  //#endregion
1650
- //#region document-model/upgrades.d.ts
1651
- /** Upgrade reducer transforms a document from one version to another */
1652
- type UpgradeReducer<TFrom extends PHBaseState, TTo extends PHBaseState> = (document: PHDocument<TFrom>, action: Action) => PHDocument<TTo>;
1653
- type ModelVersion = number;
1654
- /** Metadata about a version transition */
1655
- type UpgradeTransition = {
1656
- toVersion: ModelVersion;
1657
- upgradeReducer: UpgradeReducer<any, any>;
1658
- description?: string;
2306
+ //#region document-model/validation.d.ts
2307
+ /**
2308
+ * Reserved operation names from base reducer (core/actions.ts).
2309
+ * These names cannot be used for custom operations.
2310
+ */
2311
+ declare const RESERVED_OPERATION_NAMES: readonly ["UNDO", "REDO", "SET_NAME", "SET_PREFERRED_EDITOR", "NOOP", "PURGE_DOCUMENT"];
2312
+ type ReservedOperationName = (typeof RESERVED_OPERATION_NAMES)[number];
2313
+ /**
2314
+ * Operation names become the literal action `type` string at runtime and the
2315
+ * key for codegen's action union. They must be SCREAMING_SNAKE_CASE so the
2316
+ * generated TypeScript is valid.
2317
+ */
2318
+ declare const OPERATION_NAME_PATTERN: RegExp;
2319
+ declare function isValidOperationNameFormat(name: string): boolean;
2320
+ /**
2321
+ * Check if name conflicts with base reducer actions (case-insensitive).
2322
+ */
2323
+ declare function isReservedOperationName(name: string): boolean;
2324
+ /**
2325
+ * Get all operation names from all modules in the latest specification.
2326
+ * Returns names in uppercase for case-insensitive comparison.
2327
+ */
2328
+ declare function getAllOperationNames(state: DocumentModelGlobalState, excludeOperationId?: string): string[];
2329
+ /**
2330
+ * Validate operation name is not reserved or duplicate. Throws on failure.
2331
+ *
2332
+ * @param name - The operation name to validate
2333
+ * @param state - The document model global state
2334
+ * @param excludeOperationId - Optional operation ID to exclude (for rename validation)
2335
+ * @throws Error if the name is reserved or a duplicate
2336
+ */
2337
+ declare function validateOperationName(name: string, state: DocumentModelGlobalState, excludeOperationId?: string): void;
2338
+ declare function validateInitialState(initialState: string, allowEmptyState?: boolean): ValidationError[];
2339
+ declare function validateStateSchemaName(schema: string, documentName: string, scope?: string, allowEmptySchema?: boolean): ValidationError[];
2340
+ declare function validateModules(modules: ModuleSpecification[]): ValidationError[];
2341
+ declare function validateModule(mod: ModuleSpecification): ValidationError[];
2342
+ declare function validateModuleOperation(operation: OperationSpecification): ValidationError[];
2343
+ /**
2344
+ * Find a module in the latest specification by id, or throw. Reducers that
2345
+ * mutate-by-id should call this up front so an unknown id fails loudly
2346
+ * instead of silently no-opping.
2347
+ */
2348
+ declare function findModuleOrThrow(state: DocumentModelGlobalState, moduleId: string): ModuleSpecification;
2349
+ /**
2350
+ * Find an operation in the latest specification by id, or throw. Same
2351
+ * rationale as findModuleOrThrow — reducers that target an operation must
2352
+ * fail loudly when the operation doesn't exist.
2353
+ */
2354
+ declare function findOperationOrThrow(state: DocumentModelGlobalState, operationId: string): OperationSpecification;
2355
+ /**
2356
+ * Find an operation error by id across all operations in the latest
2357
+ * specification, or throw. Throws on a duplicate id too: setters act on a
2358
+ * single error, so an ambiguous id must fail loudly rather than mutate an
2359
+ * arbitrary match.
2360
+ */
2361
+ declare function findOperationErrorOrThrow(state: DocumentModelGlobalState, errorId: string): OperationErrorSpecification;
2362
+ /**
2363
+ * Find an operation example (code example) by id across all operations in the
2364
+ * latest specification, or throw. Throws on a duplicate id for the same reason
2365
+ * as findOperationErrorOrThrow.
2366
+ */
2367
+ declare function findOperationExampleOrThrow(state: DocumentModelGlobalState, exampleId: string): CodeExample;
2368
+ /**
2369
+ * Assert no module in the latest specification already uses `id`. Modules are
2370
+ * targeted by id by the setter/delete/reorder reducers, so a duplicate id makes
2371
+ * those operations ambiguous.
2372
+ */
2373
+ declare function assertModuleIdUnique(state: DocumentModelGlobalState, id: string): void;
2374
+ /**
2375
+ * Assert no operation in the latest specification already uses `id`. Operations
2376
+ * are targeted by id across all modules, so the id must be unique document-wide.
2377
+ */
2378
+ declare function assertOperationIdUnique(state: DocumentModelGlobalState, id: string): void;
2379
+ /**
2380
+ * Assert no operation error in the latest specification already uses `id`.
2381
+ * Error ids are targeted document-wide by the setter/delete reducers, so the id
2382
+ * must be unique to keep those operations unambiguous.
2383
+ */
2384
+ declare function assertOperationErrorIdUnique(state: DocumentModelGlobalState, id: string): void;
2385
+ /**
2386
+ * Assert no operation example in the latest specification already uses `id`.
2387
+ * Example ids are targeted document-wide by the update/delete reducers, so the
2388
+ * id must be unique to keep those operations unambiguous.
2389
+ */
2390
+ declare function assertOperationExampleIdUnique(state: DocumentModelGlobalState, id: string): void;
2391
+ declare function validateOperations(operations: DocumentOperations): ValidationError[];
2392
+ //#endregion
2393
+ //#region processors/deletion.d.ts
2394
+ /** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */
2395
+ declare function deletedDocumentId(op: OperationWithContext$1): string | undefined;
2396
+ //#endregion
2397
+ //#region processors/http.d.ts
2398
+ /** Methods a package route may bind. OPTIONS belongs to the CORS layer. */
2399
+ type RouteMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
2400
+ interface RouteUser {
2401
+ address: string;
2402
+ chainId: number;
2403
+ networkId: string;
2404
+ appKey: string;
2405
+ }
2406
+ type RouteActor = {
2407
+ user: RouteUser | undefined;
2408
+ authEnabled: boolean;
2409
+ };
2410
+ type AuthorizerResult = {
2411
+ authorized: true;
2412
+ } |
2413
+ /** Refused; the scope answers with its own JSON error envelope. */
2414
+ {
2415
+ authorized: false;
2416
+ status: number;
2417
+ message: string;
2418
+ } | {
2419
+ authorized: false;
2420
+ response: Response;
2421
+ };
2422
+ /** A route-specific gate, for policies the standard modes cannot express. */
2423
+ type RouteAuthorizer = (req: IncomingMessage) => Promise<AuthorizerResult> | AuthorizerResult;
2424
+ /** How a route authenticates. */
2425
+ type RouteAuth =
2426
+ /** Default. A verifiable bearer is required; a caller without one gets 401. */
2427
+ "renown" | "renown-optional" | "public" | RouteAuthorizer;
2428
+ /** How the request body reaches the handler. */
2429
+ type RouteBody =
2430
+ /** Default. Buffered, and readable through the Fetch Request. */
2431
+ "parsed" |
2432
+ /** Buffered and also handed over as `ctx.rawBody`, byte for byte. */
2433
+ "raw" |
2434
+ /** Not buffered; the Fetch Request body is the live request stream. */
2435
+ "stream" |
2436
+ /** The body is not read at all. */
2437
+ "none";
2438
+ interface RouteOptions {
2439
+ auth?: RouteAuth;
2440
+ body?: RouteBody;
2441
+ /** Refuse a body larger than this with 413. Ignored when body is `stream`. */
2442
+ maxBodyBytes?: number;
2443
+ /** Serve sub-paths too, not just an exact match. */
2444
+ prefix?: boolean;
2445
+ }
2446
+ /** Where the request reached the host, resolved through any reverse proxy. */
2447
+ interface RouteTransport {
2448
+ proto: string;
2449
+ host: string;
2450
+ prefix: string;
2451
+ baseUrl: string;
2452
+ }
2453
+ interface RouteContext {
2454
+ /** Decoded path params. */
2455
+ params: Record<string, string>;
2456
+ user: RouteUser | undefined;
2457
+ authEnabled: boolean;
2458
+ /** The exact octets received. Present only when body is `raw`. */
2459
+ rawBody: Buffer | undefined;
2460
+ /** Aborts when the client disconnects. */
2461
+ signal: AbortSignal;
2462
+ transport: RouteTransport;
2463
+ }
2464
+ type RouteHandler = (request: Request, ctx: RouteContext) => Response | Promise<Response>;
2465
+ interface RouteSpec extends RouteOptions {
2466
+ method: RouteMethod | RouteMethod[];
2467
+ /** Relative to the scope: "runs/:id", never "/api/@scope/pkg/runs/:id". */
2468
+ path: string;
2469
+ handler: RouteHandler;
2470
+ }
2471
+ interface NodeRouteSpec extends Omit<RouteOptions, "body" | "maxBodyBytes"> {
2472
+ method: RouteMethod | RouteMethod[];
2473
+ path: string;
2474
+ handler: (req: IncomingMessage, res: ServerResponse, ctx: Omit<RouteContext, "rawBody" | "signal">) => void | Promise<void>;
2475
+ }
2476
+ interface ScopedRouteHandle {
2477
+ /** The absolute public URL this route answers on. */
2478
+ readonly url: string;
2479
+ dispose(): void;
2480
+ }
2481
+ type WebhookScheme = "none" |
2482
+ /** A shared secret presented verbatim. No digest, so no digest options. */
2483
+ "token" |
2484
+ /** The digest of the body, alone. */
2485
+ "hmac" |
2486
+ /** That digest behind a label, `sha256=<digest>`. */
2487
+ "hmac-prefixed" | "hmac-timestamped";
2488
+ /** Hashes a sender may compute the digest with. */
2489
+ type WebhookHashAlgorithm = "sha1" | "sha256" | "sha512";
2490
+ /** How the digest is written into the header. */
2491
+ type WebhookSignatureEncoding = "hex" | "base64";
2492
+ interface WebhookVerification {
2493
+ scheme: WebhookScheme;
2494
+ /** Resolved value, never a reference — the caller resolves refs. */
2495
+ secret?: string;
2496
+ /** Overrides the scheme's conventional header. */
2497
+ header?: string;
2498
+ /** Replay window for timestamped schemes. */
2499
+ toleranceSeconds?: number;
2500
+ algorithm?: WebhookHashAlgorithm;
2501
+ /** Defaults to `hex`. Base64 comparison is case-sensitive; hex is not. */
2502
+ encoding?: WebhookSignatureEncoding;
2503
+ prefix?: string;
2504
+ }
2505
+ type WebhookField = string | {
2506
+ header: string;
2507
+ } |
2508
+ /** Dot-separated path into the parsed body, e.g. `data.object.id`. */
2509
+ {
2510
+ body: string;
2511
+ };
2512
+ interface WebhookRequest {
2513
+ /** The caller's own key for this endpoint, e.g. a document id. */
2514
+ key: string;
2515
+ method: string;
2516
+ path: string;
2517
+ queryParams: Record<string, string>;
2518
+ /** Lowercased, with credentials redacted. */
2519
+ headers: Record<string, string>;
2520
+ /** The exact bytes received. */
2521
+ raw: Buffer;
2522
+ /** JSON and form bodies decoded; anything else as text. */
2523
+ body: unknown;
2524
+ }
2525
+ interface WebhookReply {
2526
+ status: number;
2527
+ body?: string;
2528
+ contentType?: string;
2529
+ }
2530
+ interface WebhookPolicy {
2531
+ verify?: WebhookVerification;
2532
+ /** Uppercase. Undefined accepts every method. */
2533
+ methods?: string[];
2534
+ dedupe?: {
2535
+ field: WebhookField;
2536
+ ttlSeconds?: number;
2537
+ };
2538
+ challengeField?: WebhookField;
2539
+ maxBodyBytes?: number;
2540
+ }
2541
+ interface WebhookSpec {
2542
+ /** Distinguishes several endpoint families within one package. */
2543
+ name: string;
2544
+ defaults?: WebhookPolicy;
2545
+ onRequest: (request: WebhookRequest) => Promise<WebhookReply> | WebhookReply;
2546
+ policyFor?: (key: string) => Promise<WebhookPolicy | undefined> | WebhookPolicy | undefined;
2547
+ }
2548
+ interface WebhookEndpointInfo {
2549
+ key: string;
2550
+ token: string;
2551
+ url: string;
2552
+ createdAt: string;
2553
+ }
2554
+ interface IWebhookEndpoints {
2555
+ endpointFor(key: string): Promise<Omit<WebhookEndpointInfo, "key">>;
2556
+ revoke(key: string): Promise<void>;
2557
+ list(): Promise<WebhookEndpointInfo[]>;
2558
+ }
2559
+ interface IWebhookScope {
2560
+ register(spec: WebhookSpec): Promise<IWebhookEndpoints>;
2561
+ readonly hasPublicOrigin: boolean;
2562
+ }
2563
+ interface IHttpScope {
2564
+ readonly owner: string;
2565
+ readonly baseUrl: string;
2566
+ get(path: string, handler: RouteHandler): ScopedRouteHandle;
2567
+ get(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2568
+ post(path: string, handler: RouteHandler): ScopedRouteHandle;
2569
+ post(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2570
+ put(path: string, handler: RouteHandler): ScopedRouteHandle;
2571
+ put(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2572
+ patch(path: string, handler: RouteHandler): ScopedRouteHandle;
2573
+ patch(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2574
+ delete(path: string, handler: RouteHandler): ScopedRouteHandle;
2575
+ delete(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2576
+ /** Registered independently of GET: a HEAD response is not a bodyless GET. */
2577
+ head(path: string, handler: RouteHandler): ScopedRouteHandle;
2578
+ head(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2579
+ route(spec: RouteSpec): ScopedRouteHandle;
2580
+ nodeRoute(spec: NodeRouteSpec): ScopedRouteHandle;
2581
+ readonly webhooks: IWebhookScope;
2582
+ /** Release every route this scope registered. Called on package teardown. */
2583
+ dispose(): void;
2584
+ }
2585
+ //#endregion
2586
+ //#region processors/types.d.ts
2587
+ type ProcessorDispatchResult = {
2588
+ id: string;
2589
+ status: string;
2590
+ };
2591
+ interface IProcessorDispatch {
2592
+ execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
2593
+ }
2594
+ interface IProcessorHostModuleBase {
2595
+ analyticsStore: IAnalyticsStore;
2596
+ relationalDb: IRelationalDb;
2597
+ processorApp: ProcessorApp;
2598
+ dispatch: IProcessorDispatch;
2599
+ getReadModel<T>(name: string): T;
2600
+ config?: Map<string, unknown>;
2601
+ /**
2602
+ * The package's slice of the HTTP surface, bound to its own namespace.
2603
+ *
2604
+ * Declared on the host-agnostic base rather than on each host's module so
2605
+ * the two cannot drift: codegen types generated processors against
2606
+ * reactor-browser's `IProcessorHostModule`, and the same source has to
2607
+ * compile against reactor-api's.
2608
+ *
2609
+ * Absent whenever the host has no HTTP server — processors also run in the
2610
+ * browser — and on the reactor when the package's name cannot be resolved to
2611
+ * a routable namespace, so a caller must always check before using it.
2612
+ */
2613
+ http?: IHttpScope;
2614
+ }
2615
+ /**
2616
+ * Filter for matching operations to processors.
2617
+ * All fields are optional arrays - when provided, operations must match at least one value in each specified field.
2618
+ * When a field is undefined or empty, it matches all values for that field.
2619
+ */
2620
+ type ProcessorFilter = {
2621
+ documentType?: string[];
2622
+ scope?: string[];
2623
+ branch?: string[];
2624
+ documentId?: string[];
2625
+ };
2626
+ /**
2627
+ * Describes an object that can process operations.
2628
+ */
2629
+ interface IProcessor {
2630
+ /**
2631
+ * Processes a list of operations with context.
2632
+ * Called when operations match this processor's filter.
2633
+ *
2634
+ * Delivery is at-least-once. Within a document's scope and branch, each
2635
+ * call is in ordinal order, and an operation delivered late comes with
2636
+ * every later operation of its stream this processor was already given.
2637
+ * Across documents there is no ordering guarantee. A processor receives one
2638
+ * `onOperations` call at a time; the next call begins after the previous
2639
+ * resolves.
2640
+ *
2641
+ * A drive's processors also receive the drive's own DELETE_DOCUMENT or
2642
+ * PURGE_DOCUMENT, whatever the filter, as the last delivery before
2643
+ * `onDisconnect`. A purged document's operations other than its marker are
2644
+ * not delivered. Erase a document's data on either deletion action.
2645
+ */
2646
+ onOperations(operations: OperationWithContext[]): Promise<void>;
2647
+ /**
2648
+ * Called when the processor is disconnected.
2649
+ * Used to clean up any resources allocated during processor creation.
2650
+ * Also runs when the factory is unregistered, so it is not a deletion signal.
2651
+ */
2652
+ onDisconnect(): Promise<void>;
2653
+ }
2654
+ /**
2655
+ * Relates a processor to its filter configuration.
2656
+ */
2657
+ type ProcessorRecord = {
2658
+ processor: IProcessor;
2659
+ filter: ProcessorFilter;
2660
+ startFrom?: "beginning" | "current";
2661
+ id?: string;
2662
+ };
2663
+ /**
2664
+ * A factory function that creates processor records for a given drive.
2665
+ * Called once per drive when the drive is first detected or when the factory is registered.
2666
+ * The header is the drive's header at creation. For a purged drive it is
2667
+ * minimal: only `id` and `documentType` are set, and `slug` and `name` are
2668
+ * empty, so a factory that selects drives by slug or name makes no processor
2669
+ * for it and the deletion stays owed.
2670
+ */
2671
+ type ProcessorFactory = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => Promise<ProcessorRecord[]> | ProcessorRecord[];
2672
+ /** Takes a processor host module and builds processor factories using its context. */
2673
+ type ProcessorFactoryBuilder<TModule extends IProcessorHostModuleBase = IProcessorHostModuleBase> = {
2674
+ bivarianceHack(module: TModule): Promise<ProcessorFactory> | ProcessorFactory;
2675
+ }["bivarianceHack"];
2676
+ type ProcessorStatus = "active" | "errored";
2677
+ type TrackedProcessor = {
2678
+ processorId: string;
2679
+ factoryId: string;
2680
+ driveId: string;
2681
+ processorIndex: number;
2682
+ record: ProcessorRecord;
2683
+ lastOrdinal: number;
2684
+ status: ProcessorStatus;
2685
+ lastError: string | undefined;
2686
+ lastErrorTimestamp: Date | undefined;
2687
+ /**
2688
+ * Clears the error and resolves once the replay from the cursor completes.
2689
+ * Safe from anywhere, but awaiting it from this processor's own
2690
+ * `onOperations` waits on itself: the replay runs after that call returns.
2691
+ * A no-op once the processor has been removed.
2692
+ */
2693
+ retry: () => Promise<void>;
2694
+ };
2695
+ /**
2696
+ * Manages processor creation and destruction based on drive operations.
2697
+ */
2698
+ interface IProcessorManager {
2699
+ /**
2700
+ * Registers a processor factory.
2701
+ * Immediately creates processors for all existing drives and resolves once
2702
+ * every factory run has completed and its processors are bound. Their
2703
+ * backfills run afterwards, on each processor's own queue. A deleted drive
2704
+ * whose deletion one of the factory's processors never received (it was not
2705
+ * running, or its delivery threw) gets a processor too: it receives only the
2706
+ * drive's `DELETE_DOCUMENT`, or its `PURGE_DOCUMENT` once purged, and is
2707
+ * disconnected. That delivery is not awaited: it runs after this resolves,
2708
+ * so a processor that hangs on it does not hold the registration, nor a
2709
+ * later one: a drive whose deletion is still being delivered gets it from
2710
+ * the new registration only if that delivery leaves it owed. If processors
2711
+ * from an earlier registration under the same identifier are still
2712
+ * draining, or a call of the previous factory is still in flight, the
2713
+ * factory runs after they have settled, so awaiting a re-registration of
2714
+ * a factory from inside that factory or one of its processors'
2715
+ * `onOperations` waits on itself.
2716
+ */
2717
+ registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
2718
+ /**
2719
+ * Unregisters a processor factory. Resolves once its processors receive no
2720
+ * new deliveries and their cursors are released; each one's in-flight
2721
+ * delivery finishes first, then `onDisconnect` runs. A released cursor no
2722
+ * longer positions a processor: a re-registration starts each one afresh,
2723
+ * per `startFrom`. It only records that the factory held a drive's data, so
2724
+ * that a drive deleted before the factory registers again still gets its
2725
+ * deletion delivered then. Safe to call from
2726
+ * inside a processor's own `onOperations`.
2727
+ */
2728
+ unregisterFactory(identifier: string): Promise<void>;
2729
+ /**
2730
+ * Gets a tracked processor by its ID.
2731
+ */
2732
+ get(processorId: string): TrackedProcessor | undefined;
2733
+ /**
2734
+ * Gets all tracked processors, including an errored entry for each
2735
+ * processor whose drive's deletion threw; its `retry()` delivers the
2736
+ * deletion again.
2737
+ */
2738
+ getAll(): TrackedProcessor[];
2739
+ }
2740
+ type ProcessorApp = (typeof PROCESSOR_APPS)[number];
2741
+ type ProcessorApps = readonly ProcessorApp[];
2742
+ //#endregion
2743
+ //#region processors/relational/types.d.ts
2744
+ /** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */
2745
+ declare const DOCUMENT_ID_COLUMNS: readonly ["document_id", "documentId"];
2746
+ type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
2747
+ type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
2748
+ withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
1659
2749
  };
1660
- type TupleMember<T extends readonly unknown[]> = T[number];
1661
- /** Manifest declaring all supported versions and upgrade paths */
1662
- type UpgradeManifest<TVersions extends readonly number[]> = {
1663
- documentType: string;
1664
- latestVersion: TupleMember<TVersions>;
1665
- supportedVersions: TVersions;
1666
- upgrades: { [V in Exclude<TupleMember<TVersions>, 1> as `v${V}`]: UpgradeTransition };
2750
+ type HashAlgorithms = "fnv1a";
2751
+ type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
2752
+ /**
2753
+ * The standardized relational database interface for relational db processors.
2754
+ * This abstraction provides type-safe database operations while hiding the underlying
2755
+ * database framework implementation details.
2756
+ **/
2757
+ type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {
2758
+ createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
2759
+ queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
1667
2760
  };
2761
+ type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
2762
+ type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
2763
+ interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
2764
+ namespace: string;
2765
+ query: IRelationalQueryBuilder<TDatabaseSchema>;
2766
+ filter: ProcessorFilter;
2767
+ initAndUpgrade(): Promise<void>;
2768
+ }
2769
+ declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
1668
2770
  /**
1669
- * Canonical document-model version normalization: documents stamped with 0
1670
- * or nothing at all predate versioning and are treated as version 1, the
1671
- * same version the registry assigns unversioned modules. Every consumer
1672
- * that resolves a module or compares versions must use this rule; resolving
1673
- * 0 to "latest" instead re-pins a legacy document's history to whichever
1674
- * module happens to be newest.
2771
+ * Base class for relational db processors that require a relational database storage.
2772
+ * This class abstracts database initialization, migration management, and resource cleanup,
2773
+ * allowing derived classes to focus on business logic.
1675
2774
  */
1676
- declare function normalizeDocumentModelVersion(version: number | undefined | null): number;
2775
+ declare abstract class RelationalDbProcessor<TDatabaseSchema = unknown> implements IRelationalDbProcessor<TDatabaseSchema> {
2776
+ protected _namespace: string;
2777
+ protected _filter: ProcessorFilter;
2778
+ protected relationalDb: IRelationalDb<TDatabaseSchema>;
2779
+ /** The drive the factory created this processor for. */
2780
+ protected _driveId?: string | undefined;
2781
+ constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>,
2782
+ /** The drive the factory created this processor for. */
2783
+ _driveId?: string | undefined);
2784
+ static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
2785
+ /**
2786
+ * Returns the namespace for a given drive id.
2787
+ * This method can be overridden by derived classes to provide a custom namespace.
2788
+ */
2789
+ static getNamespace(driveId: string): string;
2790
+ static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
2791
+ /**
2792
+ * Processes a list of operations with context.
2793
+ * Called when operations match this processor's filter.
2794
+ */
2795
+ abstract onOperations(operations: OperationWithContext[]): Promise<void>;
2796
+ /**
2797
+ * Returns the filter for the processor.
2798
+ * This method can be overridden by derived classes to provide a custom filter.
2799
+ */
2800
+ get filter(): ProcessorFilter;
2801
+ /**
2802
+ * Returns the namespace used by the processor.
2803
+ */
2804
+ get namespace(): string;
2805
+ get query(): IRelationalQueryBuilder<TDatabaseSchema>;
2806
+ /** True for this processor's drive when its namespace is that drive's alone. */
2807
+ protected isNamespaceDrive(documentId: string): boolean;
2808
+ /** Deletes a document's rows from every table with a document-id column. */
2809
+ protected deleteDocumentRows(documentId: string): Promise<void>;
2810
+ /** Drops this processor's namespace and every table in it. */
2811
+ protected dropNamespace(): Promise<void>;
2812
+ private namespaceSchema;
2813
+ /**
2814
+ * Abstract method that derived classes must implement.
2815
+ * This method is meant to be called on subclasses to initialize and upgrade the database.
2816
+ */
2817
+ abstract initAndUpgrade(): Promise<void>;
2818
+ /**
2819
+ * Called when the processor is disconnected.
2820
+ * This method is meant to be overridden by subclasses to clean up resources.
2821
+ */
2822
+ abstract onDisconnect(): Promise<void>;
2823
+ }
2824
+ //#endregion
2825
+ //#region processors/relational/utils.d.ts
1677
2826
  /**
1678
- * Applies an UPGRADE_DOCUMENT action to a document.
1679
- * Handles all upgrade scenarios including initial upgrades, no-ops, and multi-step upgrades.
1680
- *
1681
- * Behavior based on fromVersion/toVersion:
1682
- * - fromVersion === toVersion (and fromVersion > 0): No-op - return unchanged document
1683
- * - fromVersion > toVersion: Throw DowngradeNotSupportedError
1684
- * - All other cases: Apply upgradePath transitions (if provided), then apply initialState, set version
2827
+ * Hashes a string to a lowercase base-26 string.
2828
+ * @param str The string to hash.
2829
+ * @param length The length of the hash. Defaults to 10.
2830
+ * @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
2831
+ * @returns The hashed string.
1685
2832
  */
1686
- declare function applyUpgradeDocumentAction(document: PHDocument, action: UpgradeDocumentAction, upgradePath?: UpgradeTransition[]): PHDocument;
2833
+ declare function hashNamespace(str: string, length?: number): string;
1687
2834
  /**
1688
- * Applies a DELETE_DOCUMENT action to a document.
1689
- * Marks the document as deleted in the document scope state.
2835
+ * Creates a RelationalDb instance with namespace support.
2836
+ * @param baseDb The base RelationalDb instance to enhance.
2837
+ * @param baseOptions The default options for namespace creation. Hashes namespace by default.
2838
+ * @returns The enhanced RelationalDb instance.
1690
2839
  */
1691
- declare function applyDeleteDocumentAction(document: PHDocument, action: DeleteDocumentAction): PHDocument;
2840
+ declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
2841
+ type NamespaceOptions = {
2842
+ hashNamespace?: boolean;
2843
+ };
2844
+ declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
2845
+ /** The schema behind a handle from `createNamespace`; undefined otherwise. */
2846
+ declare function namespaceSchemaOf(db: object): string | undefined;
2847
+ declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
1692
2848
  /**
1693
- * Computes the ordered list of upgrade transitions needed to move from
1694
- * fromVersion to toVersion using the provided manifest.
1695
- * Walks keys v(fromVersion+1)..v(toVersion) and throws a descriptive Error
1696
- * if the manifest is absent or any step is missing.
2849
+ * Returns a query builder for a RelationalDb instance.
2850
+ * @param query The RelationalDb instance to convert.
2851
+ * @returns The IRelationalQueryBuilder instance.
1697
2852
  */
1698
- declare function computeUpgradeTransitions(manifest: UpgradeManifest<readonly number[]> | undefined, fromVersion: number, toVersion: number): UpgradeTransition[];
2853
+ declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
1699
2854
  //#endregion
1700
2855
  //#region document-model/types.d.ts
1701
2856
  type State = {
@@ -2342,11 +3497,11 @@ interface DocumentModelVersioningOperations {
2342
3497
  }
2343
3498
  type Maybe<T> = T | null;
2344
3499
  type InputMaybe<T> = T | null | undefined;
2345
- type Exact<T extends Record<string, unknown>> = { [K in keyof T]: T[K] };
2346
- type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
2347
- type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
2348
- type MakeEmpty<T extends Record<string, unknown>, K extends keyof T> = { [_ in K]?: never };
2349
- type Incremental<T> = T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never };
3500
+ type Exact<T extends Record<string, unknown>> = { [K in keyof T]: T[K]; };
3501
+ type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]>; };
3502
+ type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]>; };
3503
+ type MakeEmpty<T extends Record<string, unknown>, K extends keyof T> = { [_ in K]?: never; };
3504
+ type Incremental<T> = T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never; };
2350
3505
  /** All built-in and custom scalars, mapped to their actual values */
2351
3506
  type Scalars = {
2352
3507
  ID: {
@@ -2407,28 +3562,6 @@ type IOperation = {
2407
3562
  timestampUtcMs: Scalars["DateTime"]["output"];
2408
3563
  type: Scalars["String"]["output"];
2409
3564
  };
2410
- type Load_State = "LOAD_STATE";
2411
- type SchemaLoadStateAction = {
2412
- id: Scalars["String"]["output"];
2413
- timestampUtcMs: Scalars["DateTime"]["output"];
2414
- input: LoadStateActionInput;
2415
- type: Load_State;
2416
- scope: string;
2417
- };
2418
- type LoadStateActionInput = {
2419
- operations: Scalars["Int"]["input"];
2420
- state: LoadStateActionStateInput;
2421
- };
2422
- type LoadStateActionStateInput = {
2423
- data?: InputMaybe<Scalars["Unknown"]["input"]>;
2424
- name: Scalars["String"]["input"];
2425
- };
2426
- type MutationLoadStateArgs = {
2427
- input: SchemaLoadStateAction;
2428
- };
2429
- type MutationPruneArgs = {
2430
- input: SchemaPruneAction;
2431
- };
2432
3565
  type MutationRedoArgs = {
2433
3566
  input: SchemaRedoAction;
2434
3567
  };
@@ -2438,18 +3571,6 @@ type MutationSetNameArgs = {
2438
3571
  type MutationUndoArgs = {
2439
3572
  input: SchemaUndoAction;
2440
3573
  };
2441
- type Prune = "PRUNE";
2442
- type SchemaPruneAction = {
2443
- id: Scalars["String"]["output"];
2444
- timestampUtcMs: Scalars["DateTime"]["output"];
2445
- input: PruneActionInput;
2446
- type: Prune;
2447
- scope: string;
2448
- };
2449
- type PruneActionInput = {
2450
- end?: InputMaybe<Scalars["Int"]["input"]>;
2451
- start?: InputMaybe<Scalars["Int"]["input"]>;
2452
- };
2453
3574
  type Query = {
2454
3575
  __typename?: "Query";
2455
3576
  document: Maybe<IDocument>;
@@ -2521,14 +3642,6 @@ type SchemaNOOPAction = {
2521
3642
  timestampUtcMs: Scalars["DateTime"]["output"];
2522
3643
  type: "NOOP";
2523
3644
  };
2524
- type LoadStateAction = Action & {
2525
- type: "LOAD_STATE";
2526
- input: LoadStateActionInput;
2527
- };
2528
- type PruneAction = Action & {
2529
- type: "PRUNE";
2530
- input: PruneActionInput;
2531
- };
2532
3645
  type RedoAction = Action & {
2533
3646
  type: "REDO";
2534
3647
  input: SchemaRedoAction["input"];
@@ -2585,6 +3698,13 @@ type DeleteDocumentActionInput = {
2585
3698
  documentId: string;
2586
3699
  propagate?: "none" | "cascade";
2587
3700
  };
3701
+ type PurgeDocumentActionInput = {
3702
+ documentId: string;
3703
+ documentType: string;
3704
+ /** The same instant as the action's timestampUtcMs. */
3705
+ purgedAtUtcIso: string;
3706
+ requestId: string;
3707
+ };
2588
3708
  type AddRelationshipActionInput = {
2589
3709
  sourceId: string;
2590
3710
  targetId: string;
@@ -2614,6 +3734,12 @@ type DeleteDocumentAction = Action & {
2614
3734
  type: "DELETE_DOCUMENT";
2615
3735
  input: DeleteDocumentActionInput;
2616
3736
  };
3737
+ /** Reserved document-scope marker; a purged document's only operation. */
3738
+ type PurgeDocumentAction = Action & {
3739
+ type: "PURGE_DOCUMENT";
3740
+ scope: "document";
3741
+ input: PurgeDocumentActionInput;
3742
+ };
2617
3743
  type AddRelationshipAction = Action & {
2618
3744
  type: "ADD_RELATIONSHIP";
2619
3745
  input: AddRelationshipActionInput;
@@ -2626,7 +3752,7 @@ type UpdateRelationshipAction = Action & {
2626
3752
  type: "UPDATE_RELATIONSHIP";
2627
3753
  input: UpdateRelationshipActionInput;
2628
3754
  };
2629
- type DocumentAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
3755
+ type DocumentAction = RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
2630
3756
  interface ISignal<TType extends string, TInput> {
2631
3757
  type: TType;
2632
3758
  input: TInput;
@@ -2663,19 +3789,27 @@ type SignalResults = {
2663
3789
  type SignalType<T extends Signal> = T["type"];
2664
3790
  type FileInput = string | number[] | Uint8Array | ArrayBuffer | Blob;
2665
3791
  type ReducerOptions = {
2666
- /** The number of operations to skip before this new action is applied. This overrides the skip count in the operation. */skip?: number; /** When true the skip count is ignored and the action is applied regardless of the skip count */
2667
- ignoreSkipOperations?: boolean; /** if true reuses the provided action resulting state instead of replaying it */
2668
- reuseOperationResultingState?: boolean; /** if true checks the hashes of the operations */
2669
- checkHashes?: boolean; /** Options for performing a replay. */
3792
+ /** The number of operations to skip before this new action is applied. This overrides the skip count in the operation. */
3793
+ skip?: number;
3794
+ /** When true the skip count is ignored and the action is applied regardless of the skip count */
3795
+ ignoreSkipOperations?: boolean;
3796
+ /** if true reuses the provided action resulting state instead of replaying it */
3797
+ reuseOperationResultingState?: boolean;
3798
+ /** if true checks the hashes of the operations */
3799
+ checkHashes?: boolean;
3800
+ /** Options for performing a replay. */
2670
3801
  replayOptions?: {
2671
- /** The previously created operation to verify against. */operation: Operation;
2672
- }; /** Optional parser for the operation resulting state, uses JSON.parse by default */
3802
+ /** The previously created operation to verify against. */
3803
+ operation: Operation;
3804
+ };
3805
+ /** Optional parser for the operation resulting state, uses JSON.parse by default */
2673
3806
  operationResultingStateParser?: <TState>(state: string | null | undefined) => TState;
2674
3807
  /**
2675
3808
  * When true (default), the reducer will prune operations (garbage collect) when processing a skip.
2676
3809
  * When false, it will recompute state for the skip but preserve the existing operations history.
2677
3810
  */
2678
- pruneOnSkip?: boolean; /** The branch being operated on. Defaults to "main". */
3811
+ pruneOnSkip?: boolean;
3812
+ /** The branch being operated on. Defaults to "main". */
2679
3813
  branch?: string;
2680
3814
  /**
2681
3815
  * Protocol version controlling undo/redo behavior.
@@ -2726,7 +3860,7 @@ type User = {
2726
3860
  chainId: number;
2727
3861
  ens?: ENSInfo;
2728
3862
  };
2729
- type PartialRecord<K extends keyof any, T> = { [P in K]?: T };
3863
+ type PartialRecord<K extends keyof any, T> = { [P in K]?: T; };
2730
3864
  type RevisionsFilter = PartialRecord<string, number>;
2731
3865
  type GetDocumentOptions = ReducerOptions & {
2732
3866
  revisions?: RevisionsFilter;
@@ -2806,13 +3940,14 @@ interface ISigner {
2806
3940
  */
2807
3941
  verify: (data: Uint8Array, signature: Uint8Array) => Promise<void>;
2808
3942
  /**
2809
- * Signs an action (used for operation signing).
3943
+ * Signs an action for the log it is written to.
2810
3944
  *
2811
3945
  * @param action - The action to sign.
3946
+ * @param target - The document and branch whose log stores the action.
2812
3947
  * @param abortSignal - Optional abort signal to cancel the signing.
2813
3948
  * @returns The signature tuple.
2814
3949
  */
2815
- signAction: (action: Action, abortSignal?: AbortSignal) => Promise<Signature>;
3950
+ signAction: (action: Action, target: ActionSigningTarget, abortSignal?: AbortSignal) => Promise<Signature>;
2816
3951
  }
2817
3952
  type IsStateOfType<TState> = (state: unknown) => state is TState;
2818
3953
  type AssertIsStateOfType<TState> = (state: unknown) => asserts state is TState;
@@ -2831,6 +3966,9 @@ type MinimalBackupData = {
2831
3966
  branch: string;
2832
3967
  state: PHBaseState;
2833
3968
  name: string;
3969
+ protocolVersions?: {
3970
+ [key: string]: number;
3971
+ };
2834
3972
  };
2835
3973
  type DocumentModelUtils<TState extends PHBaseState = PHBaseState> = {
2836
3974
  fileExtension: string;
@@ -2870,7 +4008,8 @@ type PhAiToolDescriptor = {
2870
4008
  callback: (args: never) => Promise<unknown>;
2871
4009
  };
2872
4010
  type DocumentModelModule<TState extends PHBaseState = PHBaseState> = {
2873
- /** optional version field, should be made required */version?: number;
4011
+ /** optional version field, should be made required */
4012
+ version?: number;
2874
4013
  reducer: Reducer<TState>;
2875
4014
  actions: Actions;
2876
4015
  utils: DocumentModelUtils<TState>;
@@ -2893,6 +4032,7 @@ type DocumentModelDocumentModelModule = DocumentModelModule<DocumentModelPHState
2893
4032
  type ConfigEntryType = z.infer<typeof ConfigEntryTypeSchema>;
2894
4033
  type ConfigEntry = z.infer<typeof ConfigEntrySchema>;
2895
4034
  type PowerhouseModule = z.infer<typeof PowerhouseModuleSchema>;
4035
+ type PieceModule = z.infer<typeof PieceModuleSchema>;
2896
4036
  type Publisher = z.infer<typeof PublisherSchema>;
2897
4037
  type Manifest = z.infer<typeof ManifestSchema>;
2898
4038
  //#endregion
@@ -2929,10 +4069,13 @@ type PHConnectDefaultDriveRemote = {
2929
4069
  icon?: string | null;
2930
4070
  };
2931
4071
  type PHConnectDefaultDriveLocal = {
2932
- /** Discriminator: this entry is a local drive created on first boot. */local: true; /** Stable drive id; the drive is not re-created on later boots. */
4072
+ /** Discriminator: this entry is a local drive created on first boot. */
4073
+ local: true;
4074
+ /** Stable drive id; the drive is not re-created on later boots. */
2933
4075
  id: string;
2934
4076
  name?: string | null;
2935
- icon?: string | null; /** Drive app (preferred editor) to open on the drive. */
4077
+ icon?: string | null;
4078
+ /** Drive app (preferred editor) to open on the drive. */
2936
4079
  app?: string;
2937
4080
  };
2938
4081
  type PHConnectDefaultDrive = PHConnectDefaultDriveRemote | PHConnectDefaultDriveLocal;
@@ -2956,21 +4099,29 @@ type PHConnectApp = {
2956
4099
  basePath?: string;
2957
4100
  offline?: boolean;
2958
4101
  studioMode?: boolean;
4102
+ workflowsEnabled?: boolean;
2959
4103
  };
2960
4104
  type PHConnectAi = {
2961
- /** Enables the in-browser AI assistant (chat FAB + window). Off by default. */assistantEnabled?: boolean;
4105
+ /** Enables the in-browser AI assistant (chat FAB + window). Off by default. */
4106
+ assistantEnabled?: boolean;
2962
4107
  };
2963
4108
  type PHConnectPackages = {
2964
- externalEnabled?: boolean; /** Subscribe to the static-mode `/__packages` SSE channel for live reload. */
4109
+ externalEnabled?: boolean;
4110
+ /** Subscribe to the static-mode `/__packages` SSE channel for live reload. */
2965
4111
  liveReload?: boolean;
2966
4112
  };
2967
4113
  type PHRenownRainbowAdapterConfig = {
2968
- /** WalletConnect project id; required for the rainbow adapter to function. */walletConnectProjectId?: string; /** Optional Infura project id used to build RPC transports. */
4114
+ /** WalletConnect project id; required for the rainbow adapter to function. */
4115
+ walletConnectProjectId?: string;
4116
+ /** Optional Infura project id used to build RPC transports. */
2969
4117
  infuraProjectId?: string;
2970
4118
  };
2971
4119
  type PHRenownPrivyAdapterConfig = {
2972
- /** Privy application id; required for the privy adapter to function. */appId?: string; /** Optional Privy client id. */
2973
- clientId?: string; /** Login methods this adapter offers; defaults per adapter when omitted. */
4120
+ /** Privy application id; required for the privy adapter to function. */
4121
+ appId?: string;
4122
+ /** Optional Privy client id. */
4123
+ clientId?: string;
4124
+ /** Login methods this adapter offers; defaults per adapter when omitted. */
2974
4125
  methods?: string[];
2975
4126
  };
2976
4127
  type PHConnectRenownAdapters = {
@@ -2980,16 +4131,32 @@ type PHConnectRenownAdapters = {
2980
4131
  type PHConnectRenown = {
2981
4132
  url?: string;
2982
4133
  networkId?: string;
2983
- chainId?: number; /** Renown localStorage namespace; share it across Connects to share login. */
2984
- namespace?: string; /** Switchboard GraphQL URL; when set, enables in-page (no-redirect) auth. */
2985
- switchboardUrl?: string; /** Per-adapter wallet config; presence of a key enables that adapter. */
4134
+ chainId?: number;
4135
+ /** Renown localStorage namespace; share it across Connects to share login. */
4136
+ namespace?: string;
4137
+ /** Switchboard GraphQL URL; when set, enables in-page (no-redirect) auth. */
4138
+ switchboardUrl?: string;
4139
+ /** Per-adapter wallet config; presence of a key enables that adapter. */
2986
4140
  adapters?: PHConnectRenownAdapters;
2987
4141
  };
2988
4142
  type PHConnectSentry = {
2989
- /** Sentry DSN URL. `null` disables Sentry entirely. */dsn?: string | null; /** Sentry environment label. */
2990
- env?: string; /** Enable Sentry performance tracing. */
4143
+ /** Sentry DSN URL. `null` disables Sentry entirely. */
4144
+ dsn?: string | null;
4145
+ /** Sentry environment label. */
4146
+ env?: string;
4147
+ /** Enable Sentry performance tracing. */
2991
4148
  tracing?: boolean;
2992
4149
  };
4150
+ type PHConnectOpenPanel = {
4151
+ /** OpenPanel client id. Empty string (the default) disables OpenPanel. */
4152
+ clientId?: string;
4153
+ /** OpenPanel API URL, for self-hosted instances. */
4154
+ apiUrl?: string;
4155
+ /** Track UI events. */
4156
+ trackUiEvents?: boolean;
4157
+ /** Track document operations. */
4158
+ trackOperations?: boolean;
4159
+ };
2993
4160
  type PHConnectInstance = {
2994
4161
  namespace: string | null;
2995
4162
  reactorWorker: boolean;
@@ -2997,13 +4164,21 @@ type PHConnectInstance = {
2997
4164
  /** Each flag implies its predecessors, and must match the fleet Connect syncs
2998
4165
  * with or the two compute different replay outcomes. */
2999
4166
  type PHConnectReactorFeatureFlags = {
3000
- /** Decide writes from the document stream instead of the meta cache. */documentDecisions?: boolean; /** Enforce the auth scope's policy at admission, replay, and read. */
3001
- authEnforcement?: boolean; /** Let `{ group }` principals match, via the group documents' rosters. */
3002
- authGroups?: boolean; /** Evaluate `where` / `match` conditions on grants. */
4167
+ /** Decide writes from the document stream instead of the meta cache. */
4168
+ documentDecisions?: boolean;
4169
+ /** Enforce the auth scope's policy at admission, replay, and read. */
4170
+ authEnforcement?: boolean;
4171
+ /** Let `{ group }` principals match, via the group documents' rosters. */
4172
+ authGroups?: boolean;
4173
+ /** Evaluate `where` / `match` conditions on grants. */
3003
4174
  authConditions?: boolean;
3004
4175
  };
3005
4176
  type PHConnectReactor = {
3006
4177
  featureFlags?: PHConnectReactorFeatureFlags;
4178
+ /** What new documents are created as; `legacy` while peers predate v2-required documents. */
4179
+ createSignaturePolicy?: "legacy" | "v2-required";
4180
+ /** Stored documents at protocol versions this build does not run: refuse to boot, or keep them read-only. */
4181
+ unsupportedStoredDocuments?: "refuse" | "read-only";
3007
4182
  };
3008
4183
  /**
3009
4184
  * A URL-matching pattern for a service-worker runtime-caching rule, in
@@ -3052,7 +4227,9 @@ type PHConnectPwaIcon = {
3052
4227
  * at Connect's app root, injected at build time.
3053
4228
  */
3054
4229
  type PHConnectPwaFileHandler = {
3055
- /** MIME type → file extensions (each must start with "."). */accept: Record<string, string[]>; /** OS-level file-type icons. */
4230
+ /** MIME type → file extensions (each must start with "."). */
4231
+ accept: Record<string, string[]>;
4232
+ /** OS-level file-type icons. */
3056
4233
  icons?: PHConnectPwaIcon[];
3057
4234
  launch_type?: "single-client" | "multiple-clients";
3058
4235
  };
@@ -3066,8 +4243,10 @@ type PHConnectPwaManifest = {
3066
4243
  display?: "fullscreen" | "standalone" | "minimal-ui" | "browser";
3067
4244
  start_url?: string;
3068
4245
  scope?: string;
3069
- icons?: PHConnectPwaIcon[]; /** Extra file associations, appended after Connect's built-in `.phd`/`.phdm` handler. */
3070
- file_handlers?: PHConnectPwaFileHandler[]; /** How the OS launches the app for handled files/links. */
4246
+ icons?: PHConnectPwaIcon[];
4247
+ /** Extra file associations, appended after Connect's built-in `.phd`/`.phdm` handler. */
4248
+ file_handlers?: PHConnectPwaFileHandler[];
4249
+ /** How the OS launches the app for handled files/links. */
3071
4250
  launch_handler?: {
3072
4251
  client_mode: "auto" | "focus-existing" | "navigate-existing" | "navigate-new";
3073
4252
  };
@@ -3087,11 +4266,16 @@ type PHConnectPwaManifest = {
3087
4266
  * Precedence: defaults < package fragments < project config.
3088
4267
  */
3089
4268
  type PHConnectPwa = {
3090
- manifest?: PHConnectPwaManifest; /** Extra Workbox precache globs, unioned with the built-in patterns. */
3091
- globPatterns?: string[]; /** Extra Workbox precache ignore globs, unioned with the built-in list. */
3092
- globIgnores?: string[]; /** Raise the precache file-size ceiling; the max across contributors wins. */
3093
- maximumFileSizeToCacheInBytes?: number; /** Additional runtime-caching rules, appended after the built-in rules. */
3094
- runtimeCaching?: PHConnectPwaRuntimeCaching[]; /** Extra SPA-fallback denylist patterns, unioned with the built-in list. */
4269
+ manifest?: PHConnectPwaManifest;
4270
+ /** Extra Workbox precache globs, unioned with the built-in patterns. */
4271
+ globPatterns?: string[];
4272
+ /** Extra Workbox precache ignore globs, unioned with the built-in list. */
4273
+ globIgnores?: string[];
4274
+ /** Raise the precache file-size ceiling; the max across contributors wins. */
4275
+ maximumFileSizeToCacheInBytes?: number;
4276
+ /** Additional runtime-caching rules, appended after the built-in rules. */
4277
+ runtimeCaching?: PHConnectPwaRuntimeCaching[];
4278
+ /** Extra SPA-fallback denylist patterns, unioned with the built-in list. */
3095
4279
  navigateFallbackDenylist?: PHConnectPwaUrlPattern[];
3096
4280
  };
3097
4281
  type PHConnectRuntimeConfig = {
@@ -3102,6 +4286,7 @@ type PHConnectRuntimeConfig = {
3102
4286
  drives?: PHConnectDrives;
3103
4287
  renown?: PHConnectRenown;
3104
4288
  sentry?: PHConnectSentry;
4289
+ openPanel?: PHConnectOpenPanel;
3105
4290
  instance?: PHConnectInstance;
3106
4291
  reactor?: PHConnectReactor;
3107
4292
  pwa?: PHConnectPwa;
@@ -3110,8 +4295,10 @@ type PHConnectRuntimeConfig = {
3110
4295
  type PHReactorRenown = {
3111
4296
  /** "self" reads this reactor's own renown read model; "remote" (default)
3112
4297
  * queries a Renown or Switchboard instance. */
3113
- source?: "remote" | "self"; /** Renown base URL; also the instance this reactor's own identity uses. */
3114
- url?: string; /** Switchboard GraphQL endpoint to read credentials from directly. */
4298
+ source?: "remote" | "self";
4299
+ /** Renown base URL; also the instance this reactor's own identity uses. */
4300
+ url?: string;
4301
+ /** Switchboard GraphQL endpoint to read credentials from directly. */
3115
4302
  switchboardUrl?: string;
3116
4303
  };
3117
4304
  type PowerhouseConfig = {
@@ -3159,9 +4346,13 @@ type PowerhouseConfig = {
3159
4346
  driveUrl?: string;
3160
4347
  connectPort?: number;
3161
4348
  };
4349
+ workflows?: {
4350
+ enabled?: boolean;
4351
+ };
3162
4352
  packageRegistryUrl?: string;
3163
4353
  connect?: PHConnectRuntimeConfig;
3164
4354
  };
3165
4355
  //#endregion
3166
- export { AddOperationExampleAction as $, UpgradeReducer as $a, deleteOperationExample as $c, SetOperationErrorCodeAction as $i, baseCreateDocument as $l, MutationDeleteOperationErrorArgs as $n, SetAuthorWebsiteInputSchema as $o, RedoActionInput as $r, ProcessorDispatchResult as $s, DocumentModelOperationExampleOperations as $t, PHDocumentState as $u, PHReactorRenown as A, SigningParameters as Aa, WebhookSignatureEncoding as Ac, SetAuthorNameAction as Ai, setOperationErrorDescription as Al, LoadStateActionInput as An, ModuleSchema as Ao, MutationSetOperationTemplateArgs as Ar, UpdateStateExampleInputSchema as As, DeleteOperationErrorInput as At, sortMappedOperations as Au, DEFAULT_REGISTRY_URL as B, UpdateChangeLogItemAction as Ba, addModule as Bc, SetModelIdAction as Bi, undo as Bl, ModuleSpecification as Bn, PublisherSchema as Bo, OperationsByScope as Br, IBaseRelationalDb as Bs, DocumentModelGlobalState as Bt, operationOutcome as Bu, PHConnectReactor as C, Set_PreferredEditor as Ca, WebhookEndpointInfo as Cc, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Cd, SchemaNOOPAction as Ci, setModelId as Cl, Incremental as Cn, DocumentModelInputSchema as Co, MutationSetOperationErrorCodeArgs as Cr, Set_PreferredEditorSchema as Cs, DeleteChildDocumentSignal as Ct, prepareOperations as Cu, PHConnectRuntimeConfig as D, SignalResults as Da, WebhookReply as Dc, SchemaSetPreferredEditorAction as Di, setName as Dl, LoadFromFile as Dn, LoadStateActionStateInputSchema as Do, MutationSetOperationNameArgs as Dr, UndoSchema as Ds, DeleteModuleInput as Dt, reshuffleByTimestamp as Du, PHConnectRenownAdapters as E, SignalResult as Ea, WebhookPolicy as Ec, SchemaSetNameAction as Ei, setModuleName as El, IsStateOfType as En, LoadStateActionSchema as Eo, MutationSetOperationErrorTemplateArgs as Er, UndoActionSchema as Es, DeleteModuleAction as Et, replayDocument as Eu, PathValidation as F, SubgraphModule as Fa, actionContext as Fc, SetInitialStateInput as Fi, setOperationSchema as Fl, MakeOptional as Fn, PowerhouseModuleSchema as Fo, MutationUpdateStateExampleArgs as Fr, createRelationalDb as Fs, DeleteStateExampleInput as Ft, Operation as Fu, Actions as G, UpdateRelationshipActionInput as Ga, baseActions as Gc, SetModuleDescriptionInput as Gi, IntegrityIssueSubType as Gl, MutationAddModuleArgs as Gn, ReorderChangeLogItemsInputSchema as Go, PowerhouseModule as Gr, RelationalDbProcessor as Gs, DocumentModelLocalState as Gt, undoOperationV2 as Gu, ActionSignatureContext as H, UpdateOperationExampleAction as Ha, addOperationError as Hc, SetModelNameAction as Hi, updateOperationExample as Hl, MoveOperationInput as Hn, RedoActionInputSchema as Ho, PartialState as Hr, IRelationalDbProcessor as Hs, DocumentModelHeaderOperations as Ht, setNameOperation as Hu, PowerhouseConfig as I, Undo as Ia, actionFromAction as Ic, SetModelDescriptionAction as Ii, setOperationScope as Il, Manifest as In, PowerhouseModulesSchema as Io, NOOPAction as Ir, hashNamespace as Is, DocumentAction as It, OperationContext as Iu, AddModuleAction as J, UpgradeDocumentAction as Ja, createAction as Jc, SetNameAction as Ji, PHDocumentHeader as Jl, MutationAddOperationExampleArgs as Jn, ReorderOperationErrorsInputSchema as Jo, PruneActionInput as Jr, IProcessorDispatch as Js, DocumentModelModuleOperations as Jt, Condition as Ju, AddChangeLogItemAction as K, UpdateStateExampleAction as Ka, buildOperationSignature as Kc, SetModuleNameAction as Ki, IntegrityIssueType as Kl, MutationAddOperationArgs as Kn, ReorderModuleOperationsInputSchema as Ko, Prune as Kr, RelationalDbProcessorClass as Ks, DocumentModelModule as Kt, AuthGroups as Ku, PowerhousePackage as L, UndoAction as La, actionSigner as Lc, SetModelDescriptionInput as Li, setOperationTemplate as Ll, MappedOperation as Ln, PruneActionInputSchema as Lo, OperationErrorSpecification as Lr, relationalDbToQueryBuilder as Ls, DocumentModelAction as Lt, OperationOutcome as Lu, PHRenownRainbowAdapterConfig as M, SkipHeaderOperations as Ma, WebhookVerification as Mc, SetAuthorWebsiteAction as Mi, setOperationErrorTemplate as Ml, Load_State as Mn, OperationErrorSchema as Mo, MutationUndoArgs as Mr, isDefinedNonNullAny as Ms, DeleteOperationExampleInput as Mt, split as Mu, PackageManagerArgs as N, State as Na, Action as Nc, SetAuthorWebsiteInput as Ni, setOperationName as Nl, MakeEmpty as Nn, OperationScopeSchema as No, MutationUpdateChangeLogItemInputArgs as Nr, createNamespacedDb as Ns, DeleteOperationInput as Nt, updateHeaderRevision as Nu, PHConnectSentry as O, SignalType as Oa, WebhookRequest as Oc, SchemaUndoAction as Oi, setOperationDescription as Ol, LoadFromInput as On, Load_StateSchema as Oo, MutationSetOperationReducerArgs as Or, UpdateChangeLogItemInputSchema as Os, DeleteOperationAction as Ot, reshuffleByTimestampAndIndex as Ou, ParsedCmdResult as P, StateReducer as Pa, ActionContext as Pc, SetInitialStateAction as Pi, setOperationReducer as Pl, MakeMaybe as Pn, OperationSpecificationSchema as Po, MutationUpdateOperationExampleArgs as Pr, createNamespacedQueryBuilder as Ps, DeleteStateExampleAction as Pt, DocumentOperations as Pu, AddOperationErrorInput as Q, UpgradeManifest as Qa, deleteOperationError as Qc, SetOperationDescriptionInput as Qi, attachBranch as Ql, MutationDeleteOperationArgs as Qn, SetAuthorNameInputSchema as Qo, RedoAction as Qr, ProcessorApps as Qs, DocumentModelOperationExampleAction as Qt, PHBaseState as Qu, ServiceAction as R, UndoActionInput as Ra, actions as Rc, SetModelExtensionAction as Ri, setPreferredEditor as Rl, Maybe as Rn, PruneActionSchema as Ro, OperationIndex as Rr, ExtractProcessorSchemaOrSelf as Rs, DocumentModelDocument as Rt, OperationWithContext$1 as Ru, PHConnectPwaUrlPattern as S, Set_Name as Sa, ScopedRouteHandle as Sc, serializeSignature as Sd, SchemaLoadStateAction as Si, setModelExtension as Sl, ISigner as Sn, DocumentModelGlobalStateSchema as So, MutationSetOperationDescriptionArgs as Sr, Set_NameSchema as Ss, DeleteChildDocumentInput as St, precedes as Su, PHConnectRenown as T, SignalDispatch as Ta, WebhookHashAlgorithm as Tc, PROCESSOR_APPS as Td, SchemaRedoAction as Ti, setModuleDescription as Tl, IsDocumentOfType as Tn, LoadStateActionInputSchema as To, MutationSetOperationErrorNameArgs as Tr, UndoActionInputSchema as Ts, DeleteDocumentActionInput as Tt, removeExistingOperations as Tu, ActionSigningHandler as U, UpdateOperationExampleInput as Ua, addOperationExample as Uc, SetModelNameInput as Ui, updateStateExample as Ul, Mutation as Un, RedoActionSchema as Uo, PhAiToolAnnotations as Ur, IRelationalQueryBuilder as Us, DocumentModelInput as Ut, setPreferredEditorOperation as Uu, ActionErrorCallback as V, UpdateChangeLogItemInput as Va, addOperation as Vc, SetModelIdInput as Vi, updateChangeLogItem as Vl, MoveOperationAction as Vn, PwaConfigSchema as Vo, PartialRecord as Vr, IRelationalDb as Vs, DocumentModelHeaderAction as Vt, redoOperation as Vu, ActionVerificationHandler as W, UpdateRelationshipAction as Wa, addStateExample as Wc, SetModuleDescriptionAction as Wi, verifyOperationSignature as Wl, MutationAddChangeLogItemInputArgs as Wn, RedoSchema as Wo, PhAiToolDescriptor as Wr, IRelationalQueryMethods as Ws, DocumentModelLib as Wt, undoOperation as Wu, AddOperationAction as X, User as Xa, deleteModule as Xc, SetNameOperation as Xi, addUndo as Xl, MutationDeleteChangeLogItemInputArgs as Xn, ReorderStateExamplesInputSchema as Xo, Query as Xr, IProcessorManager as Xs, DocumentModelOperationErrorAction as Xt, Operand as Xu, AddModuleInput as Y, UpgradeDocumentActionInput as Ya, deleteChangeLogItem as Yc, SetNameActionInput as Yi, PHDocumentMeta as Yl, MutationAddStateExampleArgs as Yn, ReorderOperationExamplesInputSchema as Yo, Publisher as Yr, IProcessorHostModuleBase as Ys, DocumentModelOperationAction as Yt, Grant as Yu, AddOperationErrorAction as Z, ValidationError as Za, deleteOperation as Zc, SetOperationDescriptionAction as Zi, appendWithoutApplying as Zl, MutationDeleteModuleArgs as Zn, ScopeStateSchema as Zo, Redo as Zr, ProcessorApp as Zs, DocumentModelOperationErrorOperations as Zt, PHAuthState as Zu, PHConnectPwaCacheStrategy as _, SetPreferredEditorAction as _a, RouteMethod as _c, HashConfig as _d, ReplayDocumentOptions as _i, reorderStateExamples as _l, ID as _n, DeleteOperationErrorInputSchema as _o, MutationSetModelIdArgs as _r, SetOperationScopeInputSchema as _s, CreateDocumentAction as _t, mapSkippedOperationsV2 as _u, PHConnectAi as a, SetOperationErrorTemplateAction as aa, TrackedProcessor as ac, createDocumentState as ad, ReorderChangeLogItemsAction as ai, operationExampleCreators as al, DocumentModelVersioningAction as an, AddChangeLogItemInputSchema as ao, MutationRedoArgs as ar, SetModuleDescriptionInputSchema as as, AddStateExampleInput as at, filterDuplicatedOperations as au, PHConnectPwaManifest as b, SetStateSchemaAction as ba, RouteTransport as bc, UserActionSigner as bd, SaveToFileHandle as bi, setInitialState as bl, ISignal as bn, DeleteStateExampleInputSchema as bo, MutationSetModuleNameArgs as br, SetPreferredEditorActionSchema as bs, DeleteChangeLogItemAction as bt, operationsAreEqual as bu, PHConnectDefaultDrive as c, SetOperationNameInput as ca, IWebhookEndpoints as cc, createState as cd, ReorderModuleOperationsInput as ci, operationWithContext as cl, DocumentSpecification as cn, AddOperationExampleInputSchema as co, MutationReorderModulesArgs as cr, SetNameActionSchema as cs, Author as ct, garbageCollectV2 as cu, PHConnectDriveSection as d, SetOperationSchemaAction as da, RouteActor as dc, defaultDocumentState as dd, ReorderOperationErrorsAction as di, releaseNewVersion as dl, EditorModule as dn, AuthorSchema as do, MutationReorderStateExamplesArgs as dr, SetOperationErrorDescriptionInputSchema as ds, ConfigEntryType as dt, hashDocumentStateForScope as du, SetOperationErrorCodeInput as ea, ProcessorFactory as ec, PHGroupState as ed, Reducer as ei, deleteStateExample as el, DocumentModelOperationOperations as en, UpgradeTransition as eo, MutationDeleteOperationExampleArgs as er, SetInitialStateInputSchema as es, AddOperationExampleInput as et, baseReducerVersion as eu, PHConnectDriveSections as f, SetOperationSchemaInput as fa, RouteAuth as fc, defaultGlobalState as fd, ReorderOperationErrorsInput as fi, reorderChangeLogItems as fl, EditorProps as fn, CodeExampleSchema as fo, MutationSetAuthorNameArgs as fr, SetOperationErrorNameInputSchema as fs, CopyChildDocumentInput as ft, isDocumentAction as fu, PHConnectPwa as g, SetOperationTemplateInput as ga, RouteHandler as gc, AppActionSigner as gd, ReorderStateExamplesInput as gi, reorderOperationExamples as gl, IAction as gn, DeleteModuleInputSchema as go, MutationSetModelExtensionArgs as gr, SetOperationSchemaInputSchema as gs, CreateDocument as gt, mapSkippedOperations as gu, PHConnectPackages as h, SetOperationTemplateAction as ha, RouteContext as hc, ActionSigner as hd, ReorderStateExamplesAction as hi, reorderOperationErrors as hl, GetDocumentOptions as hn, DeleteChangeLogItemInputSchema as ho, MutationSetModelDescriptionArgs as hr, SetOperationReducerInputSchema as hs, CreateChildDocumentSignal as ht, isUndoRedo as hu, LogLevels as i, SetOperationErrorNameInput as ia, ProcessorStatus as ic, createBaseState as id, RemoveRelationshipActionInput as ii, noop as il, DocumentModelUtils as in, normalizeDocumentModelVersion as io, MutationPruneArgs as ir, SetModelNameInputSchema as is, AddStateExampleAction as it, filterDocumentOperationsResultingState as iu, PHRenownPrivyAdapterConfig as j, SkipHeaderOperationIndex as ja, WebhookSpec as jc, SetAuthorNameInput as ji, setOperationErrorName as jl, LoadStateActionStateInput as jn, MoveOperationInputSchema as jo, MutationSetStateSchemaArgs as jr, definedNonNullAnySchema as js, DeleteOperationExampleAction as jt, sortOperations as ju, PHPackageProvider as k, SignatureVerificationHandler as ka, WebhookScheme as kc, ScopeState as ki, setOperationErrorCode as kl, LoadStateAction as kn, ManifestSchema as ko, MutationSetOperationSchemaArgs as kr, UpdateOperationExampleInputSchema as ks, DeleteOperationErrorAction as kt, skipHeaderOperations as ku, PHConnectDefaultDriveLocal as l, SetOperationReducerAction as la, IWebhookScope as lc, defaultAuthState as ld, ReorderModulesAction as li, prune as ll, ENSInfo as ln, AddOperationInputSchema as lo, MutationReorderOperationErrorsArgs as lr, SetOperationDescriptionInputSchema as ls, CodeExample as lt, getDocumentLastModified as lu, PHConnectInstance as m, SetOperationScopeInput as ma, RouteBody as mc, defaultPHState as md, ReorderOperationExamplesInput as mi, reorderModules as ml, FileInput as mn, ConfigEntryTypeSchema as mo, MutationSetInitialStateArgs as mr, SetOperationNameInputSchema as ms, CreateChildDocumentInput as mt, isUndo as mu, DrivePreserveStrategy as n, SetOperationErrorDescriptionInput as na, ProcessorFilter as nc, backfillAuthState as nd, ReleaseNewVersionAction as ni, loadState as nl, DocumentModelStateAction as nn, applyUpgradeDocumentAction as no, MutationLoadStateArgs as nr, SetModelExtensionInputSchema as ns, AddRelationshipAction as nt, checkOperationsIntegrity as nu, PHConnectApp as o, SetOperationErrorTemplateInput as oa, AuthorizerResult as oc, createGlobalState as od, ReorderChangeLogItemsInput as oi, operationFromAction as ol, DocumentModelVersioningOperations as on, AddModuleInputSchema as oo, MutationReorderChangeLogItemsInputArgs as or, SetModuleNameInputSchema as os, AssertIsDocumentOfType as ot, garbageCollect as ou, PHConnectDrives as p, SetOperationScopeAction as pa, RouteAuthorizer as pc, defaultLocalState as pd, ReorderOperationExamplesAction as pi, reorderModuleOperations as pl, Exact as pn, ConfigEntrySchema as po, MutationSetAuthorWebsiteArgs as pr, SetOperationErrorTemplateInputSchema as ps, CopyChildDocumentSignal as pt, isNoopOperation as pu, AddChangeLogItemInput as q, UpdateStateExampleInput as qa, buildSignedAction as qc, SetModuleNameInput as qi, PHDocument as ql, MutationAddOperationErrorArgs as qn, ReorderModulesInputSchema as qo, PruneAction as qr, IProcessor as qs, DocumentModelModuleAction as qt, Capability as qu, LogLevel as r, SetOperationErrorNameAction as ra, ProcessorRecord as rc, createAuthState as rd, RemoveRelationshipAction as ri, moveOperation as rl, DocumentModelStateOperations as rn, computeUpgradeTransitions as ro, MutationMoveOperationArgs as rr, SetModelIdInputSchema as rs, AddRelationshipActionInput as rt, diffOperations as ru, PHConnectBranding as s, SetOperationNameAction as sa, IHttpScope as sc, createLocalState as sd, ReorderModuleOperationsAction as si, operationFromOperation as sl, DocumentOperationsIgnoreMap as sn, AddOperationErrorInputSchema as so, MutationReorderModuleOperationsArgs as sr, SetNameActionInputSchema as ss, AssertIsStateOfType as st, garbageCollectDocumentOperations as su, DrivePreserveStrategies as t, SetOperationErrorDescriptionAction as ta, ProcessorFactoryBuilder as tc, Principal as td, ReducerOptions as ti, documentModelActions as tl, DocumentModelPHState as tn, applyDeleteDocumentAction as to, MutationDeleteStateExampleArgs as tr, SetModelDescriptionInputSchema as ts, AddOperationInput as tt, checkCleanedOperationsIntegrity as tu, PHConnectDefaultDriveRemote as u, SetOperationReducerInput as ua, NodeRouteSpec as uc, defaultBaseState as ud, ReorderModulesInput as ui, redo as ul, EditorDispatch as un, AddStateExampleInputSchema as uo, MutationReorderOperationExamplesArgs as ur, SetOperationErrorCodeInputSchema as us, ConfigEntry as ut, groupOperationsByScope as uu, PHConnectPwaFileHandler as v, SetPreferredEditorActionInput as va, RouteOptions as vc, PHDocumentSignatureInfo as vd, RevisionsFilter as vi, setAuthorName as vl, IDocument as vn, DeleteOperationExampleInputSchema as vo, MutationSetModelNameArgs as vr, SetOperationTemplateInputSchema as vs, CreateDocumentActionInput as vt, merge as vu, PHConnectReactorFeatureFlags as w, Signal as wa, WebhookField as wc, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as wd, SchemaPruneAction as wi, setModelName as wl, InputMaybe as wn, DocumentSpecificationSchema as wo, MutationSetOperationErrorDescriptionArgs as wr, StateSchema as ws, DeleteDocumentAction as wt, readOnly as wu, PHConnectPwaRuntimeCaching as x, SetStateSchemaInput as xa, RouteUser as xc, deserializeSignature as xd, Scalars as xi, setModelDescription as xl, ISignalResult as xn, DocumentActionSchema as xo, MutationSetNameArgs as xr, SetStateSchemaInputSchema as xs, DeleteChangeLogItemInput as xt, parseResultingState as xu, PHConnectPwaIcon as y, SetPreferredEditorOperation as ya, RouteSpec as yc, Signature as yd, SaveToFile as yi, setAuthorWebsite as yl, IOperation as yn, DeleteOperationInputSchema as yo, MutationSetModuleDescriptionArgs as yr, SetPreferredEditorActionInputSchema as ys, CreateState as yt, nextSkipNumber as yu, ServiceActions as z, UndoRedoAction as za, addChangeLogItem as zc, SetModelExtensionInput as zi, setStateSchema as zl, MinimalBackupData as zn, PruneSchema as zo, OperationSpecification as zr, HashAlgorithms as zs, DocumentModelDocumentModelModule as zt, loadStateOperation as zu };
3167
- //# sourceMappingURL=types-CpnWmiFY.d.ts.map
4356
+ export { AddOperationErrorInput as $, HashAlgorithms as $a, PurgeMarkerOperation as $c, mentionedGroupIds as $d, reorderChangeLogItems as $f, SetOperationErrorTemplateInput as $i, UpgradeManifest as $l, isSignaturePolicy as $m, MutationMoveOperationArgs as $n, assertOperationExampleIdUnique as $o, isDocumentAction as $p, RemoveRelationshipActionInput as $r, ReorderOperationErrorsInputSchema as $s, DocumentModelOperationExampleAction as $t, documentModelInitialLocalState as $u, PHPackageProvider as A, UndoAction as Aa, UndoActionInputSchema as Ac, InitializeAuthActionInputSchema as Ad, addOperation as Af, SetModelDescriptionInput as Ai, createVerificationSigner as Al, PHGroupState as Am, MakeEmpty as An, RouteHandler as Ao, updateStateExample as Ap, MutationUpdateStateExampleArgs as Ar, DeleteStateExampleInputSchema as As, DeleteOperationErrorAction as At, isDocumentModelState as Au, ServiceActions as B, UpdateStateExampleInput as Ba, documentModelOperationErrorReducer as Bc, SetGrantActionInputSchema as Bd, deleteOperation as Bf, SetModuleNameInput as Bi, createZip as Bl, defaultBaseState as Bm, Mutation as Bn, WebhookPolicy as Bo, baseCreateDocument as Bp, PieceModule as Br, OperationSpecificationSchema as Bs, DocumentModelDocumentModelModule as Bt, buildOperationSignatureParams as Bu, PHConnectPwaUrlPattern as C, SigningParameters as Ca, SetOperationTemplateInputSchema as Cc, AuthRefusal as Cd, ActionContext as Cf, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Ch, SetAuthorNameAction as Ci, peerSupports as Cl, Capability as Cm, ISigner as Cn, IWebhookScope as Co, setOperationScope as Cp, MutationSetOperationReducerArgs as Cr, ConfigEntrySchema as Cs, DeleteChildDocumentInput as Ct, BaseDocumentStateSchema as Cu, PHConnectRenownAdapters as D, StateReducer as Da, Set_NameSchema as Dc, ConditionContext as Dd, actions as Df, SetInitialStateAction as Di, createPresignedHeader as Dl, PHAuthState as Dm, IsStateOfType as Dn, RouteAuthorizer as Do, undo as Dp, MutationUndoArgs as Dr, DeleteOperationErrorInputSchema as Ds, DeleteModuleAction as Dt, assertIsDocumentModelDocument as Du, PHConnectRenown as E, State as Ea, SetStateSchemaInputSchema as Ec, AuthVerb as Ed, actionSigner as Ef, SetAuthorWebsiteInput as Ei, createCopyHeader as El, Operand as Em, IsDocumentOfType as En, RouteAuth as Eo, setStateSchema as Ep, MutationSetStateSchemaArgs as Er, DeleteModuleInputSchema as Es, DeleteDocumentActionInput as Et, DocumentModelSchema as Eu, ParsedCmdResult as F, UpdateOperationExampleAction as Fa, UpdateStateExampleInputSchema as Fc, RemoveGrantAction as Fd, buildOperationSignature as Ff, SetModelNameAction as Fi, BulkArchiveEntry as Fl, createDocumentState as Fm, Maybe as Fn, RouteUser as Fo, PHDocumentHeader as Fp, OperationsByScope as Fr, ManifestSchema as Fs, DeleteStateExampleAction as Ft, isDenied as Fu, ActionVerificationHandler as G, createNamespacedDb as Ga, documentModelStateSchemaReducer as Gc, applySetGrantAction as Gd, moveOperation as Gf, SetOperationDescriptionInput as Gi, isDocumentZip as Gl, DEFAULT_SIGNATURE_POLICY as Gm, MutationAddOperationExampleArgs as Gn, WebhookSpec as Go, filterDocumentOperationsResultingState as Gp, Query as Gr, PublisherSchema as Gs, DocumentModelLib as Gt, HASH_ALGORITHM_SHA1 as Gu, ActionErrorCallback as H, UpgradeDocumentActionInput as Ha, documentModelOperationReducer as Hc, applyInitializeAuthAction as Hd, deleteOperationExample as Hf, SetNameActionInput as Hi, documentModelSaveToFileHandle as Hl, defaultGlobalState as Hm, MutationAddModuleArgs as Hn, WebhookRequest as Ho, checkCleanedOperationsIntegrity as Hp, Publisher as Hr, PieceModulesSchema as Hs, DocumentModelHeaderAction as Ht, getUnixTimestamp as Hu, PathValidation as I, UpdateOperationExampleInput as Ia, definedNonNullAnySchema as Ic, RemoveGrantActionInput as Id, buildSignedAction as If, SetModelNameInput as Ii, baseLoadFromInput as Il, createGlobalState as Im, MinimalBackupData as In, ScopedRouteHandle as Io, PHDocumentMeta as Ip, PartialRecord as Ir, ModuleSchema as Is, DeleteStateExampleInput as It, ab2hex as Iu, AddChangeLogItemInput as J, hashNamespace as Ja, createReducer as Jc, decide as Jd, operationFromAction as Jf, SetOperationErrorDescriptionAction as Ji, writeFileBrowser as Jl, SIGNATURE_PROTOCOL as Jm, MutationDeleteModuleArgs as Jn, OPERATION_NAME_PATTERN as Jo, garbageCollectDocumentOperations as Jp, RedoActionInput as Jr, RedoActionSchema as Js, DocumentModelModuleAction as Jt, HASH_ENCODING_BASE64 as Ju, Actions as K, createNamespacedQueryBuilder as Ka, documentModelVersioningReducer as Kc, assertAuthPreservedOnDuplicate as Kd, noop as Kf, SetOperationErrorCodeAction as Ki, parseBulkArchive as Kl, DocumentIdParams as Km, MutationAddStateExampleArgs as Kn, WebhookVerification as Ko, filterDuplicatedOperations as Kp, Redo as Kr, PwaConfigSchema as Ks, DocumentModelLocalState as Kt, HASH_ALGORITHM_SHA256 as Ku, PowerhouseConfig as L, UpdateRelationshipAction as La, isDefinedNonNullAny as Lc, RemoveGrantActionInputSchema as Ld, createAction as Lf, SetModuleDescriptionAction as Li, baseLoadFromInputVersioned as Ll, createLocalState as Lm, ModuleSpecification as Ln, WebhookEndpointInfo as Lo, addUndo as Lp, PartialState as Lr, MoveOperationInputSchema as Ls, DocumentAction as Lt, base58Decode as Lu, PHRenownPrivyAdapterConfig as M, UndoRedoAction as Ma, UndoSchema as Mc, MoveGrantAction as Md, addOperationExample as Mf, SetModelExtensionInput as Mi, sign as Ml, backfillAuthState as Mm, MakeOptional as Mn, RouteOptions as Mo, IntegrityIssueSubType as Mp, OperationErrorSpecification as Mr, DocumentModelGlobalStateSchema as Ms, DeleteOperationExampleAction as Mt, AUTH_NO_GRANT_REASON as Mu, PHRenownRainbowAdapterConfig as N, UpdateChangeLogItemAction as Na, UpdateChangeLogItemInputSchema as Nc, MoveGrantActionInput as Nd, addStateExample as Nf, SetModelIdAction as Ni, validateHeader as Nl, createAuthState as Nm, Manifest as Nn, RouteSpec as No, IntegrityIssueType as Np, OperationIndex as Nr, DocumentModelInputSchema as Ns, DeleteOperationExampleInput as Nt, AUTH_VERSION_UNSUPPORTED_REASON as Nu, PHConnectRuntimeConfig as O, SubgraphModule as Oa, Set_PreferredEditorSchema as Oc, InitializeAuthAction as Od, addChangeLogItem as Of, SetInitialStateInput as Oi, createSignedHeader as Ol, PHBaseState as Om, LoadFromFile as On, RouteBody as Oo, updateChangeLogItem as Op, MutationUpdateChangeLogItemInputArgs as Or, DeleteOperationExampleInputSchema as Os, DeleteModuleInput as Ot, assertIsDocumentModelState as Ou, PackageManagerArgs as P, UpdateChangeLogItemInput as Pa, UpdateOperationExampleInputSchema as Pc, MoveGrantActionInputSchema as Pd, baseActions as Pf, SetModelIdInput as Pi, verify as Pl, createBaseState as Pm, MappedOperation as Pn, RouteTransport as Po, PHDocument as Pp, OperationSpecification as Pr, DocumentSpecificationSchema as Ps, DeleteOperationInput as Pt, DOCUMENT_DELETED_REASON as Pu, AddOperationErrorAction as Q, ExtractProcessorSchemaOrSelf as Qa, PURGE_DOCUMENT as Qc, isDocumentCreator as Qd, releaseNewVersion as Qf, SetOperationErrorTemplateAction as Qi, replayDocumentVersioned as Ql, isDerivedDocumentId as Qm, MutationDeleteStateExampleArgs as Qn, assertOperationErrorIdUnique as Qo, hashDocumentStateForScope as Qp, RemoveRelationshipAction as Qr, ReorderModulesInputSchema as Qs, DocumentModelOperationErrorOperations as Qt, documentModelInitialGlobalState as Qu, PowerhousePackage as R, UpdateRelationshipActionInput as Ra, documentModelHeaderReducer as Rc, SetGrantAction as Rd, deleteChangeLogItem as Rf, SetModuleDescriptionInput as Ri, baseSaveToFileHandle as Rl, createState as Rm, MoveOperationAction as Rn, WebhookField as Ro, appendWithoutApplying as Rp, PhAiToolAnnotations as Rr, OperationErrorSchema as Rs, DocumentModelAction as Rt, base64UrlToBytes as Ru, PHConnectPwaRuntimeCaching as S, SignatureVerificationHandler as Sa, SetOperationScopeInputSchema as Sc, AuthEvaluation as Sd, Action as Sf, serializeSignature as Sh, ScopeState as Si, mergePeerCapabilities as Sl, AuthGroups as Sm, ISignalResult as Sn, IWebhookEndpoints as So, setOperationSchema as Sp, MutationSetOperationNameArgs as Sr, CodeExampleSchema as Ss, DeleteChangeLogItemInput as St, BaseDocumentHeaderSchema as Su, PHConnectReactorFeatureFlags as T, SkipHeaderOperations as Ta, SetPreferredEditorActionSchema as Tc, AuthSubject as Td, actionFromAction as Tf, PROCESSOR_APPS as Th, SetAuthorWebsiteAction as Ti, selectProtocolVersions as Tl, Grant as Tm, InputMaybe as Tn, RouteActor as To, setPreferredEditor as Tp, MutationSetOperationTemplateArgs as Tr, DeleteChangeLogItemInputSchema as Ts, DeleteDocumentAction as Tt, DocumentModelPHStateSchema as Tu, ActionSignatureContext as U, User as Ua, documentModelReducer as Uc, applyMoveGrantAction as Ud, deleteStateExample as Uf, SetNameOperation as Ui, fetchFileBrowser as Ul, defaultLocalState as Um, MutationAddOperationArgs as Un, WebhookScheme as Uo, checkOperationsIntegrity as Up, PurgeDocumentAction as Ur, PowerhouseModuleSchema as Us, DocumentModelHeaderOperations as Ut, hashBrowser as Uu, DEFAULT_REGISTRY_URL as V, UpgradeDocumentAction as Va, documentModelOperationExampleReducer as Vc, applyAuthAction as Vd, deleteOperationError as Vf, SetNameAction as Vi, documentModelLoadFromInput as Vl, defaultDocumentState as Vm, MutationAddChangeLogItemInputArgs as Vn, WebhookReply as Vo, baseReducerVersion as Vp, PowerhouseModule as Vr, PieceModuleSchema as Vs, DocumentModelGlobalState as Vt, bytesToBase64Url as Vu, ActionSigningHandler as W, ValidationError as Wa, documentModelStateReducer as Wc, applyRemoveGrantAction as Wd, documentModelActions as Wf, SetOperationDescriptionAction as Wi, getFileBrowser as Wl, defaultPHState as Wm, MutationAddOperationErrorArgs as Wn, WebhookSignatureEncoding as Wo, diffOperations as Wp, PurgeDocumentActionInput as Wr, PowerhouseModulesSchema as Ws, DocumentModelInput as Wt, hex2ab as Wu, AddModuleInput as X, relationalDbToQueryBuilder as Xa, replayOperations as Xc, initializeAuth as Xd, operationWithContext as Xf, SetOperationErrorNameAction as Xi, VersionedReducers as Xl, SignaturePolicy$1 as Xm, MutationDeleteOperationErrorArgs as Xn, ReservedOperationName as Xo, getDocumentLastModified as Xp, ReducerOptions as Xr, ReorderChangeLogItemsInputSchema as Xs, DocumentModelOperationAction as Xt, documentModelFileExtension as Xu, AddModuleAction as Y, namespaceSchemaOf as Ya, processUndoRedo as Yc, evaluate as Yd, operationFromOperation as Yf, SetOperationErrorDescriptionInput as Yi, zipEntries as Yl, SIGNATURE_PROTOCOL_V2 as Ym, MutationDeleteOperationArgs as Yn, RESERVED_OPERATION_NAMES as Yo, garbageCollectV2 as Yp, Reducer as Yr, RedoSchema as Ys, DocumentModelModuleOperations as Yt, HASH_ENCODING_HEX as Yu, AddOperationAction as Z, DOCUMENT_ID_COLUMNS as Za, updateDocument as Zc, isAuthAction as Zd, redo as Zf, SetOperationErrorNameInput as Zi, VersionedReplayConfig as Zl, deriveDocumentId as Zm, MutationDeleteOperationExampleArgs as Zn, assertModuleIdUnique as Zo, groupOperationsByScope as Zp, ReleaseNewVersionAction as Zr, ReorderModuleOperationsInputSchema as Zs, DocumentModelOperationErrorAction as Zt, documentModelGlobalState as Zu, PHConnectPwa as _, Signal as _a, SetOperationErrorNameInputSchema as _c, isPlainValue as _d, hashActionV2 as _f, HashConfig as _h, SchemaNOOPAction as _i, isOlderManifest as _l, sortMappedOperations as _m, IAction as _n, ProcessorRecord as _o, setOperationErrorDescription as _p, MutationSetOperationDescriptionArgs as _r, AddOperationErrorInputSchema as _s, CreateDocument as _t, InvalidAuthVersionError as _u, PHConnectAi as a, SetOperationSchemaInput as aa, SetInitialStateInputSchema as ac, MAX_AUTH_GRANTS as ad, TransportActionContext as af, Operation as ah, ReorderModulesInput as ai, FeatureCapability as al, merge as am, DocumentModelUtils as an, RelationalDbProcessor as ao, setAuthorName as ap, MutationReorderOperationExamplesArgs as ar, getAllOperationNames as as, AddStateExampleAction as at, normalizeDocumentModelVersion as au, PHConnectPwaIcon as b, SignalResults as ba, SetOperationReducerInputSchema as bc, AuthAction as bd, targetDocumentId as bf, UserActionSigner as bh, SchemaSetPreferredEditorAction as bi, localSupports as bl, updateHeaderRevision as bm, IOperation as bn, AuthorizerResult as bo, setOperationName as bp, MutationSetOperationErrorNameArgs as br, AddStateExampleInputSchema as bs, CreateState as bt, groupDocumentType as bu, PHConnectDefaultDrive as c, SetOperationTemplateAction as ca, SetModelIdInputSchema as cc, MAX_CONDITION_NODES as cd, ACTION_SIGNATURE_V2_PREFIX as cf, OperationWithContext$1 as ch, ReorderOperationExamplesAction as ci, PEER_CAPABILITIES as cl, parseResultingState as cm, DocumentOperationsIgnoreMap as cn, IProcessorDispatch as co, setModelDescription as cp, MutationSetAuthorWebsiteArgs as cr, validateInitialState as cs, AssertIsStateOfType as ct, AuthAlreadyInitializedError as cu, PHConnectDriveSection as d, SetPreferredEditorActionInput as da, SetModuleNameInputSchema as dc, assertValidGrantUpsert as dd, CanonicalJsonError as df, setNameOperation as dh, ReorderStateExamplesInput as di, PeerCapabilityFlags as dl, readOnly as dm, EditorDispatch as dn, ProcessorApp as do, setModelName as dp, MutationSetModelExtensionArgs as dr, validateModules as ds, ConfigEntry as dt, DowngradeNotSupportedError as du, SetOperationNameAction as ea, ReorderOperationExamplesInputSchema as ec, AuthAdministrationLockoutError as ed, moveGrant as ef, protocolVersionsFor as eh, ReorderChangeLogItemsAction as ei, isPurgeMarker as el, isNoopOperation as em, DocumentModelOperationExampleOperations as en, IBaseRelationalDb as eo, reorderModuleOperations as ep, MutationRedoArgs as er, assertOperationIdUnique as es, AddOperationExampleAction as et, UpgradeReducer as eu, PHConnectDriveSections as f, SetPreferredEditorOperation as fa, SetNameActionInputSchema as fc, assertValidInitialGrants as fd, DOCUMENT_SCOPE_ACTION_TYPES as ff, setPreferredEditorOperation as fh, ReplayDocumentOptions as fi, PeerManifest as fl, removeExistingOperations as fm, EditorModule as fn, ProcessorApps as fo, setModuleDescription as fp, MutationSetModelIdArgs as fr, validateOperationName as fs, ConfigEntryType as ft, FileSystemError as fu, PHConnectPackages as g, Set_PreferredEditor as ga, SetOperationErrorDescriptionInputSchema as gc, grantProblem as gd, canonicalJson as gf, AppActionSigner as gh, Scalars as gi, holdReason as gl, skipHeaderOperations as gm, GetDocumentOptions as gn, ProcessorFilter as go, setOperationErrorCode as gp, MutationSetNameArgs as gr, AddModuleInputSchema as gs, CreateChildDocumentSignal as gt, InvalidActionInputZodError as gu, PHConnectOpenPanel as h, Set_Name as ha, SetOperationErrorCodeInputSchema as hc, evaluateGrants as hd, actionSigningTarget as hf, ActionSigner as hh, SaveToFileHandle as hi, coversLocal as hl, reshuffleByTimestampAndIndex as hm, FileInput as hn, ProcessorFactoryBuilder as ho, setOperationDescription as hp, MutationSetModuleNameArgs as hr, AddChangeLogItemInputSchema as hs, CreateChildDocumentInput as ht, InvalidActionInputError as hu, LogLevels as i, SetOperationSchemaAction as ia, SetAuthorWebsiteInputSchema as ic, InvalidGrantError as id, TransportAction as if, DocumentOperations as ih, ReorderModulesAction as ii, DOCUMENT_PURGE_PROTOCOL as il, mapSkippedOperationsV2 as im, DocumentModelStateOperations as in, IRelationalQueryMethods as io, reorderStateExamples as ip, MutationReorderOperationErrorsArgs as ir, findOperationOrThrow as is, AddRelationshipActionInput as it, computeUpgradeTransitions as iu, PHReactorRenown as j, UndoActionInput as ja, UndoActionSchema as jc, MAX_SUPPORTED_AUTH_VERSION as jd, addOperationError as jf, SetModelExtensionAction as ji, hasDerivedDocumentId as jl, Principal as jm, MakeMaybe as jn, RouteMethod as jo, verifyOperationSignature as jp, NOOPAction as jr, DocumentActionSchema as js, DeleteOperationErrorInput as jt, AUTH_DENIED_BY_GRANT_REASON as ju, PHConnectSentry as k, Undo as ka, StateSchema as kc, InitializeAuthActionInput as kd, addModule as kf, SetModelDescriptionAction as ki, createSignedHeaderForSigner as kl, PHDocumentState as km, LoadFromInput as kn, RouteContext as ko, updateOperationExample as kp, MutationUpdateOperationExampleArgs as kr, DeleteOperationInputSchema as ks, DeleteOperationAction as kt, isDocumentModelDocument as ku, PHConnectDefaultDriveLocal as l, SetOperationTemplateInput as la, SetModelNameInputSchema as lc, assertAuthAdministrationRetained as ld, ActionSignerIdentity as lf, operationOutcome as lh, ReorderOperationExamplesInput as li, PEER_MANIFEST_FORMAT as ll, precedes as lm, DocumentSpecification as ln, IProcessorHostModuleBase as lo, setModelExtension as lp, MutationSetInitialStateArgs as lr, validateModule as ls, Author as lt, AuthInitializerNotCreatorError as lu, PHConnectInstance as m, SetStateSchemaInput as ma, SetOperationDescriptionInputSchema as mc, evaluateGrantStack as md, actionSignerIdentity as mf, undoOperationV2 as mh, SaveToFile as mi, Supports as ml, reshuffleByTimestamp as mm, Exact as mn, ProcessorFactory as mo, setName as mp, MutationSetModuleDescriptionArgs as mr, validateStateSchemaName as ms, CopyChildDocumentSignal as mt, HashMismatchError as mu, DrivePreserveStrategy as n, SetOperationReducerAction as na, ScopeStateSchema as nc, GrantSchema as nd, resolveSnapshotAuth as nf, signaturePolicyOf as nh, ReorderModuleOperationsAction as ni, purgeMarkerOperation as nl, isUndoRedo as nm, DocumentModelPHState as nn, IRelationalDbProcessor as no, reorderOperationErrors as np, MutationReorderModuleOperationsArgs as nr, findOperationErrorOrThrow as ns, AddOperationInput as nt, applyDeleteDocumentAction as nu, PHConnectApp as o, SetOperationScopeAction as oa, SetModelDescriptionInputSchema as oc, MAX_CAPABILITY_OPERATIONS as od, TransportSigner as of, OperationContext as oh, ReorderOperationErrorsAction as oi, HoldReason as ol, nextSkipNumber as om, DocumentModelVersioningAction as on, RelationalDbProcessorClass as oo, setAuthorWebsite as op, MutationReorderStateExamplesArgs as or, isReservedOperationName as os, AddStateExampleInput as ot, withProtocolVersions as ou, PHConnectDrives as p, SetStateSchemaAction as pa, SetNameActionSchema as pc, evaluateCondition as pd, actionPreimageV2 as pf, undoOperation as ph, RevisionsFilter as pi, ProtocolCapability as pl, replayDocument as pm, EditorProps as pn, ProcessorDispatchResult as po, setModuleName as pp, MutationSetModelNameArgs as pr, validateOperations as ps, CopyChildDocumentInput as pt, GrantNotFoundError as pu, AddChangeLogItemAction as q, createRelationalDb as qa, baseReducer as qc, assertAuthScopeActionAllowed as qd, operationExampleCreators as qf, SetOperationErrorCodeInput as qi, readFileBrowser as ql, ProtocolVersions as qm, MutationDeleteChangeLogItemInputArgs as qn, deletedDocumentId as qo, garbageCollect as qp, RedoAction as qr, RedoActionInputSchema as qs, DocumentModelModule as qt, HASH_ALGORITHM_SHA512 as qu, LogLevel as r, SetOperationReducerInput as ra, SetAuthorNameInputSchema as rc, GroupPrincipalNotAllowedError as rd, setGrant as rf, v2RequiredProtocolVersions as rh, ReorderModuleOperationsInput as ri, purgedProtocolVersions as rl, mapSkippedOperations as rm, DocumentModelStateAction as rn, IRelationalQueryBuilder as ro, reorderOperationExamples as rp, MutationReorderModulesArgs as rr, findOperationExampleOrThrow as rs, AddRelationshipAction as rt, applyUpgradeDocumentAction as ru, PHConnectBranding as s, SetOperationScopeInput as sa, SetModelExtensionInputSchema as sc, MAX_CONDITION_DEPTH as sd, toTransportAction as sf, OperationOutcome as sh, ReorderOperationErrorsInput as si, MARKER_REFUSAL_FEATURE as sl, operationsAreEqual as sm, DocumentModelVersioningOperations as sn, IProcessor as so, setInitialState as sp, MutationSetAuthorNameArgs as sr, isValidOperationNameFormat as ss, AssertIsDocumentOfType as st, AuthActionNotAllowedError as su, DrivePreserveStrategies as t, SetOperationNameInput as ta, ReorderStateExamplesInputSchema as tc, AuthAdministrationMissingError as td, removeGrant as tf, requestedSignaturePolicy as th, ReorderChangeLogItemsInput as ti, purgeDocumentAction as tl, isUndo as tm, DocumentModelOperationOperations as tn, IRelationalDb as to, reorderModules as tp, MutationReorderChangeLogItemsInputArgs as tr, findModuleOrThrow as ts, AddOperationExampleInput as tt, UpgradeTransition as tu, PHConnectDefaultDriveRemote as u, SetPreferredEditorAction as ua, SetModuleDescriptionInputSchema as uc, assertValidGrant as ud, ActionSigningTarget as uf, redoOperation as uh, ReorderStateExamplesAction as ui, PeerCapability as ul, prepareOperations as um, ENSInfo as un, IProcessorManager as uo, setModelId as up, MutationSetModelDescriptionArgs as ur, validateModuleOperation as us, CodeExample as ut, AuthPolicyNotPreservedError as uu, PHConnectPwaCacheStrategy as v, SignalDispatch as va, SetOperationErrorTemplateInputSchema as vc, referencedGroupIds as vd, isV2ActionHash as vf, PHDocumentSignatureInfo as vh, SchemaRedoAction as vi, legacySupports as vl, sortOperations as vm, ID as vn, ProcessorStatus as vo, setOperationErrorName as vp, MutationSetOperationErrorCodeArgs as vr, AddOperationExampleInputSchema as vs, CreateDocumentAction as vt, UnsupportedDocumentModelVersionError as vu, PHConnectReactor as w, SkipHeaderOperationIndex as wa, SetPreferredEditorActionInputSchema as wc, AuthRequest as wd, actionContext as wf, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as wh, SetAuthorNameInput as wi, readPeerManifest as wl, Condition as wm, Incremental as wn, NodeRouteSpec as wo, setOperationTemplate as wp, MutationSetOperationSchemaArgs as wr, ConfigEntryTypeSchema as ws, DeleteChildDocumentSignal as wt, DocumentModelHeaderSchema as wu, PHConnectPwaManifest as x, SignalType as xa, SetOperationSchemaInputSchema as xc, AuthDecision as xd, v2TupleProblem as xf, deserializeSignature as xh, SchemaUndoAction as xi, manifestRevision as xl, withSignaturePolicy as xm, ISignal as xn, IHttpScope as xo, setOperationReducer as xp, MutationSetOperationErrorTemplateArgs as xr, AuthorSchema as xs, DeleteChangeLogItemAction as xt, groupMembershipActionTypes as xu, PHConnectPwaFileHandler as y, SignalResult as ya, SetOperationNameInputSchema as yc, AUTH_ACTION_TYPES as yd, signActionV2 as yf, Signature as yh, SchemaSetNameAction as yi, localPeerManifest as yl, split as ym, IDocument as yn, TrackedProcessor as yo, setOperationErrorTemplate as yp, MutationSetOperationErrorDescriptionArgs as yr, AddOperationInputSchema as ys, CreateDocumentActionInput as yt, documentModelDocumentType as yu, ServiceAction as z, UpdateStateExampleAction as za, documentModelModuleReducer as zc, SetGrantActionInput as zd, deleteModule as zf, SetModuleNameAction as zi, createMinimalZip as zl, defaultAuthState as zm, MoveOperationInput as zn, WebhookHashAlgorithm as zo, attachBranch as zp, PhAiToolDescriptor as zr, OperationScopeSchema as zs, DocumentModelDocument as zt, buildOperationSignatureMessage as zu };
4357
+ export {};
4358
+ //# sourceMappingURL=types-CFbd2nan.d.ts.map