@powerhousedao/shared 6.2.3-dev.5 → 6.2.3-dev.51

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 (282) 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/dist-CorQTQL-.mjs +1533 -0
  24. package/dist/clis/args/dist-CorQTQL-.mjs.map +1 -0
  25. package/dist/clis/args/{generate-CA916Fvj.mjs → generate-BOItUNvP.mjs} +40 -2
  26. package/dist/clis/args/generate-BOItUNvP.mjs.map +1 -0
  27. package/dist/clis/args/generate-BPBBLeUD.d.mts +103 -0
  28. package/dist/clis/args/generate-BPBBLeUD.d.mts.map +1 -0
  29. package/dist/clis/args/generate.d.mts +3 -2
  30. package/dist/clis/args/generate.mjs +1 -1
  31. package/dist/clis/args/{help-Bqbgbalu.mjs → help-DS1NlcJQ.mjs} +15 -15
  32. package/dist/clis/args/{help-Bqbgbalu.mjs.map → help-DS1NlcJQ.mjs.map} +1 -1
  33. package/dist/clis/args/help-DVPTARGn.d.mts +190 -0
  34. package/dist/clis/args/help-DVPTARGn.d.mts.map +1 -0
  35. package/dist/clis/args/help.d.mts +3 -2
  36. package/dist/clis/args/help.mjs +1 -1
  37. package/dist/clis/args/index.d.mts +20 -19
  38. package/dist/clis/args/index.mjs +18 -18
  39. package/dist/clis/args/init-CFeTq4Cq.d.mts +52 -0
  40. package/dist/clis/args/init-CFeTq4Cq.d.mts.map +1 -0
  41. package/dist/clis/args/{init-rz9Ei7nq.mjs → init-Dvb42Y87.mjs} +2 -2
  42. package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-Dvb42Y87.mjs.map} +1 -1
  43. package/dist/clis/args/init.d.mts +3 -2
  44. package/dist/clis/args/init.mjs +1 -1
  45. package/dist/clis/args/inspect-BjRmtB86.d.mts +13 -0
  46. package/dist/clis/args/inspect-BjRmtB86.d.mts.map +1 -0
  47. package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-UNQgtuR0.mjs} +2 -2
  48. package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-UNQgtuR0.mjs.map} +1 -1
  49. package/dist/clis/args/inspect.d.mts +3 -2
  50. package/dist/clis/args/inspect.mjs +1 -1
  51. package/dist/clis/args/install-B0tMyUMw.d.mts +37 -0
  52. package/dist/clis/args/install-B0tMyUMw.d.mts.map +1 -0
  53. package/dist/clis/args/{install-Sz2DlCHh.mjs → install-F-27kF6m.mjs} +2 -2
  54. package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-F-27kF6m.mjs.map} +1 -1
  55. package/dist/clis/args/install.d.mts +3 -2
  56. package/dist/clis/args/install.mjs +1 -1
  57. package/dist/clis/args/{list-DM2d6f1m.mjs → list-Bkfn8Yuo.mjs} +2 -2
  58. package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-Bkfn8Yuo.mjs.map} +1 -1
  59. package/dist/clis/args/list-DrbxA7JJ.d.mts +10 -0
  60. package/dist/clis/args/list-DrbxA7JJ.d.mts.map +1 -0
  61. package/dist/clis/args/list.d.mts +3 -2
  62. package/dist/clis/args/list.mjs +1 -1
  63. package/dist/clis/args/{login-DiKT5Jfu.mjs → login-CIFkQExi.mjs} +2 -2
  64. package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-CIFkQExi.mjs.map} +1 -1
  65. package/dist/clis/args/login-CXRJXg71.d.mts +25 -0
  66. package/dist/clis/args/login-CXRJXg71.d.mts.map +1 -0
  67. package/dist/clis/args/login.d.mts +3 -2
  68. package/dist/clis/args/login.mjs +1 -1
  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 +7366 -5728
  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-HbYUSZS1.mjs +252 -0
  121. package/dist/clis/build-config-HbYUSZS1.mjs.map +1 -0
  122. package/dist/clis/build-config.d.mts +52 -10616
  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 +160 -0
  126. package/dist/clis/build-pieces.d.mts.map +1 -0
  127. package/dist/clis/build-pieces.mjs +549 -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 +27 -11
  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 +1393 -1225
  138. package/dist/clis/index.d.mts.map +1 -1
  139. package/dist/clis/index.mjs +265 -75
  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-DB_YPc3t.d.mts +543 -0
  152. package/dist/clis/types-DB_YPc3t.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-DpeoExZO.js} +35 -9
  157. package/dist/config-loader-DpeoExZO.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 +203 -57
  162. package/dist/connect/index.d.ts.map +1 -1
  163. package/dist/connect/index.js +318 -31
  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-C6ket9Bn.d.ts +9 -0
  169. package/dist/constants-C6ket9Bn.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/errors.d.ts +3 -0
  178. package/dist/document-model/errors.js +152 -0
  179. package/dist/document-model/errors.js.map +1 -0
  180. package/dist/document-model/index.d.ts +5 -4
  181. package/dist/document-model/index.js +296 -390
  182. package/dist/document-model/index.js.map +1 -1
  183. package/dist/document-model/mock.d.ts +2 -3
  184. package/dist/document-model/mock.d.ts.map +1 -1
  185. package/dist/document-model/mock.js +2 -1
  186. package/dist/document-model/mock.js.map +1 -1
  187. package/dist/document-model/utils.d.ts +3 -2
  188. package/dist/document-model/utils.js +1 -1
  189. package/dist/document-model/version.d.ts +3 -0
  190. package/dist/document-model/version.js +8 -0
  191. package/dist/document-model/version.js.map +1 -0
  192. package/dist/index-C3fD6cad.d.ts +36 -0
  193. package/dist/index-C3fD6cad.d.ts.map +1 -0
  194. package/dist/index.d.ts +7 -6
  195. package/dist/index.js.map +1 -1
  196. package/dist/processors/index.d.ts +3 -2
  197. package/dist/processors/index.js +63 -4
  198. package/dist/processors/index.js.map +1 -1
  199. package/dist/purge-v06m_oGz.js +381 -0
  200. package/dist/purge-v06m_oGz.js.map +1 -0
  201. package/dist/registry/index.d.ts +15 -15
  202. package/dist/registry/index.d.ts.map +1 -1
  203. package/dist/registry/index.js +24 -6
  204. package/dist/registry/index.js.map +1 -1
  205. package/dist/registry/manifest-slim.d.ts +4 -3
  206. package/dist/registry/manifest-slim.d.ts.map +1 -1
  207. package/dist/registry/manifest-slim.js +21 -0
  208. package/dist/registry/manifest-slim.js.map +1 -1
  209. package/dist/registry/updates.d.ts +3 -3
  210. package/dist/registry/updates.d.ts.map +1 -1
  211. package/dist/registry/updates.js.map +1 -1
  212. package/dist/registry/urls.d.ts +2 -2
  213. package/dist/registry/urls.d.ts.map +1 -1
  214. package/dist/registry/urls.js.map +1 -1
  215. package/dist/{types-C1in4fl3.d.ts → types-Bsp8VL2y.d.ts} +2 -2
  216. package/dist/types-Bsp8VL2y.d.ts.map +1 -0
  217. package/dist/{types-YqLqb0Zb.d.ts → types-CywupGpk.d.ts} +39 -43
  218. package/dist/types-CywupGpk.d.ts.map +1 -0
  219. package/dist/{types-CpnWmiFY.d.ts → types-DDH6v2BE.d.ts} +2010 -821
  220. package/dist/types-DDH6v2BE.d.ts.map +1 -0
  221. package/dist/{utils-DP122OSS.d.ts → utils-BrKxCmKx.d.ts} +2 -2
  222. package/dist/utils-BrKxCmKx.d.ts.map +1 -0
  223. package/dist/{utils-aaTmfxFW.js → utils-CSF716ux.js} +10 -3
  224. package/dist/utils-CSF716ux.js.map +1 -0
  225. package/dist/version-BxLITo9P.d.ts +6 -0
  226. package/dist/version-BxLITo9P.d.ts.map +1 -0
  227. package/package.json +11 -6
  228. package/dist/clis/args/access-token--9H57y8J.d.mts +0 -18
  229. package/dist/clis/args/access-token--9H57y8J.d.mts.map +0 -1
  230. package/dist/clis/args/common-CcYbXrBx.mjs.map +0 -1
  231. package/dist/clis/args/common-Y8yh4ax1.d.mts +0 -183
  232. package/dist/clis/args/common-Y8yh4ax1.d.mts.map +0 -1
  233. package/dist/clis/args/connect-BUwHSfdh.d.mts +0 -443
  234. package/dist/clis/args/connect-BUwHSfdh.d.mts.map +0 -1
  235. package/dist/clis/args/connect-BVVvCmL9.mjs.map +0 -1
  236. package/dist/clis/args/generate-CA916Fvj.mjs.map +0 -1
  237. package/dist/clis/args/generate-DnV-bfXt.d.mts +0 -87
  238. package/dist/clis/args/generate-DnV-bfXt.d.mts.map +0 -1
  239. package/dist/clis/args/help-CjAsudUn.d.mts +0 -193
  240. package/dist/clis/args/help-CjAsudUn.d.mts.map +0 -1
  241. package/dist/clis/args/init-CUXyfquF.d.mts +0 -55
  242. package/dist/clis/args/init-CUXyfquF.d.mts.map +0 -1
  243. package/dist/clis/args/inspect-DtZeoA5c.d.mts +0 -15
  244. package/dist/clis/args/inspect-DtZeoA5c.d.mts.map +0 -1
  245. package/dist/clis/args/install-CkP8zcHb.d.mts +0 -40
  246. package/dist/clis/args/install-CkP8zcHb.d.mts.map +0 -1
  247. package/dist/clis/args/list-BGf8s_gj.d.mts +0 -12
  248. package/dist/clis/args/list-BGf8s_gj.d.mts.map +0 -1
  249. package/dist/clis/args/login-DNsHwvqk.d.mts +0 -27
  250. package/dist/clis/args/login-DNsHwvqk.d.mts.map +0 -1
  251. package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs +0 -1013
  252. package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs.map +0 -1
  253. package/dist/clis/args/migrate-sixkWhxm.d.mts +0 -21
  254. package/dist/clis/args/migrate-sixkWhxm.d.mts.map +0 -1
  255. package/dist/clis/args/publish-Dqe5DUst.d.mts +0 -18
  256. package/dist/clis/args/publish-Dqe5DUst.d.mts.map +0 -1
  257. package/dist/clis/args/registry-C_RfTsKB.d.mts +0 -19
  258. package/dist/clis/args/registry-C_RfTsKB.d.mts.map +0 -1
  259. package/dist/clis/args/service-DhIkf8-O.d.mts +0 -22
  260. package/dist/clis/args/service-DhIkf8-O.d.mts.map +0 -1
  261. package/dist/clis/args/switchboard-BlPaq2at.d.mts +0 -72
  262. package/dist/clis/args/switchboard-BlPaq2at.d.mts.map +0 -1
  263. package/dist/clis/args/uninstall-BpA3YYbw.d.mts +0 -31
  264. package/dist/clis/args/uninstall-BpA3YYbw.d.mts.map +0 -1
  265. package/dist/clis/args/unpublish-CvwaIimG.d.mts +0 -24
  266. package/dist/clis/args/unpublish-CvwaIimG.d.mts.map +0 -1
  267. package/dist/clis/args/vetra-DUhIB7Zk.d.mts +0 -113
  268. package/dist/clis/args/vetra-DUhIB7Zk.d.mts.map +0 -1
  269. package/dist/clis/build-config.mjs.map +0 -1
  270. package/dist/clis/constants.d.mts.map +0 -1
  271. package/dist/config-loader-B845Hidf.js.map +0 -1
  272. package/dist/constants-BP_gjn8g.d.ts +0 -8
  273. package/dist/constants-BP_gjn8g.d.ts.map +0 -1
  274. package/dist/index-C_iVZe7f.d.ts +0 -7
  275. package/dist/index-C_iVZe7f.d.ts.map +0 -1
  276. package/dist/index-DyYIJtVy.d.ts +0 -836
  277. package/dist/index-DyYIJtVy.d.ts.map +0 -1
  278. package/dist/types-C1in4fl3.d.ts.map +0 -1
  279. package/dist/types-CpnWmiFY.d.ts.map +0 -1
  280. package/dist/types-YqLqb0Zb.d.ts.map +0 -1
  281. package/dist/utils-DP122OSS.d.ts.map +0 -1
  282. 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,1115 @@ 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
+ * Applies an UPGRADE_DOCUMENT action to a document.
1603
+ * Handles all upgrade scenarios including initial upgrades, no-ops, and multi-step upgrades.
1604
+ *
1605
+ * Behavior based on fromVersion/toVersion:
1606
+ * - fromVersion === toVersion (and fromVersion > 0): No-op - return unchanged document
1607
+ * - fromVersion > toVersion: Throw DowngradeNotSupportedError
1608
+ * - All other cases: Apply upgradePath transitions (if provided), then apply initialState, set version
1153
1609
  */
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
- }
1610
+ declare function applyUpgradeDocumentAction(document: PHDocument, action: UpgradeDocumentAction, upgradePath?: UpgradeTransition[]): PHDocument;
1611
+ /** CREATE_DOCUMENT fixes `protocolVersions`; this puts them back after a reducer. */
1612
+ declare function withProtocolVersions<TDocument extends PHDocument>(document: TDocument, protocolVersions: PHDocument["header"]["protocolVersions"]): TDocument;
1166
1613
  /**
1167
- * Relates a processor to its filter configuration.
1614
+ * Applies a DELETE_DOCUMENT action, or a PURGE_DOCUMENT marker, to a document.
1615
+ * Marks the document as deleted in the document scope state.
1168
1616
  */
1169
- type ProcessorRecord = {
1170
- processor: IProcessor;
1171
- filter: ProcessorFilter;
1172
- startFrom?: "beginning" | "current";
1173
- id?: string;
1174
- };
1617
+ declare function applyDeleteDocumentAction(document: PHDocument, action: DeleteDocumentAction | PurgeDocumentAction): PHDocument;
1175
1618
  /**
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.
1619
+ * Computes the ordered list of upgrade transitions needed to move from
1620
+ * fromVersion to toVersion using the provided manifest.
1621
+ * Walks keys v(fromVersion+1)..v(toVersion) and throws a descriptive Error
1622
+ * if the manifest is absent or any step is missing.
1178
1623
  */
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>;
1624
+ declare function computeUpgradeTransitions(manifest: UpgradeManifest<readonly number[]> | undefined, fromVersion: number, toVersion: number): UpgradeTransition[];
1625
+ //#endregion
1626
+ //#region document-model/versioned-replay.d.ts
1627
+ type VersionedReducers = Record<number, Reducer<PHBaseState>>;
1628
+ type VersionedReplayConfig = {
1629
+ reducers: VersionedReducers;
1630
+ upgradeManifest?: UpgradeManifest<readonly number[]>;
1196
1631
  };
1197
1632
  /**
1198
- * Manages processor creation and destruction based on drive operations.
1633
+ * Version-aware document replay. Replays a versioned document through per-version
1634
+ * reducers, applying upgrade transitions at segment boundaries.
1635
+ *
1636
+ * Algorithm (D5):
1637
+ * a. Build spine from operations["document"]. Empty spine or no upgrades → legacy fallback.
1638
+ * b. Collect UPGRADE_DOCUMENT ops from the spine.
1639
+ * c. Seed state from the creation upgrade (fromVersion===0). Missing seed with validated
1640
+ * upgrades throws; otherwise falls back to legacy.
1641
+ * d. Identify validated upgrades (fromVersion > 0, version increases). Compute per-scope
1642
+ * boundaries using revision snapshot (preferred) or timestamp fallback.
1643
+ * e. Loop over version segments, replaying each scope's ops through the matching reducer,
1644
+ * then applying the upgrade transition before the next segment.
1645
+ * f. Set header.revision["document"], verify per-scope hashes against state at op-time
1646
+ * (not post-upgrade state) when checkHashes is false, and map timestamps from input.
1647
+ *
1648
+ * operations must include ALL scopes (document scope is NOT stripped).
1649
+ * reuseOperationResultingState is ignored by this function — zip operations never carry
1650
+ * resultingState.
1199
1651
  */
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[];
1652
+ declare function replayDocumentVersioned<TState extends PHBaseState>(initialState: TState, operations: DocumentOperations, config: VersionedReplayConfig, header: PHDocumentHeader, dispatch?: SignalDispatch, options?: ReplayDocumentOptions): PHDocument<TState>;
1221
1653
  //#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>;
1654
+ //#region document-model/files.d.ts
1655
+ declare function createZip(document: PHDocument): Promise<Uint8Array>;
1656
+ /**
1657
+ * Creates a minimal ZIP backup from strand data.
1658
+ * Used when the full document is not available (e.g., in onOperations handler).
1659
+ * Creates a ZIP with minimal header and empty operations.
1660
+ */
1661
+ declare function createMinimalZip(data: MinimalBackupData): Promise<Uint8Array>;
1662
+ declare function baseSaveToFileHandle(document: PHDocument, input: FileSystemFileHandle): Promise<void>;
1663
+ declare function baseLoadFromInput<TState extends PHBaseState>(input: FileInput, reducer: Reducer<TState>, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
1664
+ declare function baseLoadFromInputVersioned<TState extends PHBaseState>(input: FileInput, config: VersionedReplayConfig, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
1665
+ type BulkArchiveEntry = {
1666
+ /** "/"-separated zip path of a file entry (no trailing slash). */
1667
+ path: string;
1668
+ data: Uint8Array;
1226
1669
  };
1227
- type HashAlgorithms = "fnv1a";
1228
- type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
1229
1670
  /**
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>;
1671
+ * Whether this zip is a single Powerhouse document: the document's four JSON
1672
+ * entries (header/state/current-state/operations) at the archive root. A
1673
+ * bulk archive has a folder tree instead. Returns false for any input that
1674
+ * is not a readable zip.
1675
+ */
1676
+ declare function isDocumentZip(data: Uint8Array): Promise<boolean>;
1677
+ /**
1678
+ * The file entries of a zip (directory entries excluded). Used for bulk
1679
+ * archives; throws when the archive holds no files. Note this does NOT
1680
+ * validate that the entries are document zips — pair with isDocumentZip.
1681
+ */
1682
+ declare function parseBulkArchive(data: Uint8Array): Promise<BulkArchiveEntry[]>;
1683
+ /**
1684
+ * Assemble a zip from raw entries. A key ending in "/" with empty data is a
1685
+ * directory entry, so an archive's folder structure survives a round-trip.
1686
+ */
1687
+ declare function zipEntries(entries: Record<string, Uint8Array>): Promise<Uint8Array>;
1688
+ declare const documentModelLoadFromInput: LoadFromInput<DocumentModelPHState>;
1689
+ declare const documentModelSaveToFileHandle: SaveToFileHandle;
1690
+ declare function writeFileBrowser(path: string, name: string, stream: Uint8Array): Promise<string>;
1691
+ declare function readFileBrowser(path: string): void;
1692
+ declare function fetchFileBrowser(url: string): Promise<{
1693
+ data: Buffer;
1694
+ mimeType?: string;
1695
+ }>;
1696
+ declare const getFileBrowser: (file: string) => Promise<void>;
1697
+ //#endregion
1698
+ //#region document-model/header.d.ts
1699
+ /**
1700
+ * Creates a verification-only signer from a public key.
1701
+ * This signer can only verify signatures, not sign data.
1702
+ *
1703
+ * @param pubKey - The public key to use for verification.
1704
+ * @returns An ISigner that can only verify signatures.
1705
+ */
1706
+ declare function createVerificationSigner(pubKey: JsonWebKey): Promise<ISigner>;
1707
+ /**
1708
+ * Signs a header. Generally, this is not called directly, but rather through
1709
+ * {@link createSignedHeader}.
1710
+ *
1711
+ * @param parameters - The parameters used to sign the header.
1712
+ * @param signer - The signer of the document.
1713
+ *
1714
+ * @returns The signature of the header.
1715
+ */
1716
+ declare const sign: (parameters: SigningParameters, signer: ISigner) => Promise<string>;
1717
+ /**
1718
+ * Verifies a header signature. Generally, this is not called directly, but
1719
+ * rather through {@link validateHeader}.
1720
+ *
1721
+ * @param parameters - The parameters used to sign the header.
1722
+ * @param signature - The signature to verify.
1723
+ * @param signer - The signer of the document.
1724
+ */
1725
+ declare const verify: (parameters: SigningParameters, signature: string, signer: ISigner) => Promise<void>;
1726
+ /**
1727
+ * Validates a header signature.
1728
+ */
1729
+ declare const validateHeader: (header: PHDocumentHeader) => Promise<void>;
1730
+ /**
1731
+ * Creates a header that has yet to be signed. This header is not valid, but
1732
+ * can be input into {@link createSignedHeader} to create a signed header.
1733
+ *
1734
+ * With `protocolVersions` requiring v2 signatures the header takes a random
1735
+ * nonce and the id {@link deriveDocumentId} gives, so `id` must be omitted.
1736
+ *
1737
+ * @returns An unsigned header for a document.
1738
+ */
1739
+ declare const createPresignedHeader: (id?: string, documentType?: string, protocolVersions?: ProtocolVersions) => PHDocumentHeader;
1740
+ /**
1741
+ * A header for a copy of a document headed `source`. A copy is v2-required
1742
+ * when its source is or when `policy` asks for it, and then takes a derived id;
1743
+ * otherwise it takes `id`. It keeps the source's other protocol versions.
1744
+ */
1745
+ declare function createCopyHeader(source: Pick<PHDocumentHeader, "documentType" | "protocolVersions">, id?: string, policy?: SignaturePolicy$1): PHDocumentHeader;
1746
+ /** Whether a v2-required `header` carries the id its params derive. */
1747
+ declare function hasDerivedDocumentId(header: PHDocumentHeader): boolean;
1748
+ /**
1749
+ * Creates a new, signed header for a document. This will replace the id of the
1750
+ * document.
1751
+ *
1752
+ * @param unsignedHeader - The unsigned header to created the signed header from.
1753
+ * @param signer - The signer of the document.
1754
+ *
1755
+ * @returns A new signed header for a document. Some fields are mutable and
1756
+ * some are not. See the PHDocumentHeader type for more information.
1757
+ */
1758
+ declare const createSignedHeader: (unsignedHeader: PHDocumentHeader, documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
1759
+ /**
1760
+ * Creates a signed header for a document. The document header requires a signer
1761
+ * as the document id is a cryptographic signature.
1762
+ *
1763
+ * @param documentType - The type of the document.
1764
+ * @param signer - The signer of the document.
1765
+ *
1766
+ * @returns The signed header for a document. Some fields are mutable and
1767
+ * some are not. See the PHDocumentHeader type for more information.
1768
+ */
1769
+ declare const createSignedHeaderForSigner: (documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
1770
+ //#endregion
1771
+ //#region document-model/peer-agreement.d.ts
1772
+ /** The reactor feature flags a capability's support is a function of. */
1773
+ type PeerCapabilityFlags = {
1774
+ readonly [flag: string]: boolean | undefined;
1775
+ };
1776
+ /** A document protocol, named by its `protocolVersions` key. */
1777
+ type ProtocolCapability = {
1778
+ kind: "protocol";
1779
+ name: string;
1780
+ /** What a peer that announces nothing is assumed to support. */
1781
+ baseline: readonly number[];
1782
+ supported(flags: PeerCapabilityFlags): readonly number[];
1783
+ /** The version new documents take when peers agree. Absent: not negotiated. */
1784
+ preferred?(flags: PeerCapabilityFlags): number;
1785
+ /** A header may omit the key. */
1786
+ optional: boolean;
1787
+ };
1788
+ /** A feature that changes what a peer sends or expects on the wire. */
1789
+ type FeatureCapability = {
1790
+ kind: "feature";
1791
+ name: string;
1792
+ baseline: readonly number[];
1793
+ supported(flags: PeerCapabilityFlags): readonly number[];
1794
+ };
1795
+ type PeerCapability = ProtocolCapability | FeatureCapability;
1796
+ /** A purged document's protocol; never preferred, so creation never selects it. */
1797
+ declare const DOCUMENT_PURGE_PROTOCOL = "document-purge";
1798
+ /** A peer that takes refusals of polled purge markers on the poll. */
1799
+ declare const MARKER_REFUSAL_FEATURE = "marker-refusal";
1800
+ declare const PEER_CAPABILITIES: readonly PeerCapability[];
1801
+ /** `base` plus `extra`; an extra replaces a base entry of the same name. */
1802
+ declare function mergePeerCapabilities(base: readonly PeerCapability[], extra: readonly PeerCapability[]): PeerCapability[];
1803
+ declare const PEER_MANIFEST_FORMAT = 1;
1804
+ type Supports = {
1805
+ protocols: {
1806
+ [protocol: string]: readonly number[];
1807
+ };
1808
+ features: {
1809
+ [feature: string]: readonly number[];
1810
+ };
1237
1811
  };
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;
1812
+ type PeerManifest = Supports & {
1813
+ format: 1;
1814
+ /** The signer's did:key, when configured; informational. */
1815
+ appKey?: string;
1816
+ /** Grows with every start of the reactor; a peer ignores an older one. */
1817
+ sequence: number;
1818
+ /** base64url(sha256(canonicalJson(Supports & { sequence }))) */
1819
+ revision: string;
1820
+ };
1821
+ /** What this reactor supports, for every capability it registers. */
1822
+ declare function localSupports(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags): Supports;
1823
+ /** What a peer that announces nothing supports. */
1824
+ declare function legacySupports(capabilities: readonly PeerCapability[]): Supports;
1825
+ declare function manifestRevision(supports: Supports, sequence?: number): string;
1826
+ declare function localPeerManifest(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags, appKey?: string, sequence?: number): PeerManifest;
1827
+ /** A manifest sent before the one already held; silence carries no sequence. */
1828
+ declare function isOlderManifest(next: PeerManifest | null, held: PeerManifest | null | undefined): boolean;
1829
+ /** A peer's manifest, or the baselines for a peer that announced none. */
1830
+ declare function peerSupports(manifest: PeerManifest | null, capabilities: readonly PeerCapability[]): Supports;
1247
1831
  /**
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.
1832
+ * A manifest as received from a peer, or null when it is not one. Formats only
1833
+ * add fields, so one of an unknown format is read as its two maps.
1251
1834
  */
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
- }
1835
+ declare function readPeerManifest(value: unknown): PeerManifest | null;
1836
+ /** Why a document may not go to a peer. */
1837
+ type HoldReason = {
1838
+ protocol: string;
1839
+ version: number;
1840
+ peerSupports: readonly number[];
1841
+ };
1842
+ /** Only keys this reactor registers are judged; an absent key agrees. */
1843
+ declare function holdReason(peer: Supports, versions: {
1844
+ readonly [protocol: string]: number;
1845
+ }, capabilities: readonly PeerCapability[]): HoldReason | undefined;
1846
+ /** Whether a peer runs every version this reactor does, so nothing is held. */
1847
+ declare function coversLocal(peer: Supports, local: Supports, capabilities: readonly PeerCapability[]): boolean;
1848
+ /**
1849
+ * protocolVersions for a new document: per negotiated protocol, the highest
1850
+ * version up to the local preference that every member supports, else the
1851
+ * lowest local one. `requested` wins over what is selected.
1852
+ */
1853
+ declare function selectProtocolVersions(input: {
1854
+ capabilities: readonly PeerCapability[];
1855
+ flags: PeerCapabilityFlags;
1856
+ members: Iterable<Supports>;
1857
+ requested?: {
1858
+ readonly [protocol: string]: number;
1859
+ };
1860
+ }): {
1861
+ [protocol: string]: number;
1862
+ };
1290
1863
  //#endregion
1291
- //#region processors/relational/utils.d.ts
1864
+ //#region document-model/purge.d.ts
1865
+ declare const PURGE_DOCUMENT = "PURGE_DOCUMENT";
1866
+ type PurgeMarkerOperation = Operation & {
1867
+ action: PurgeDocumentAction;
1868
+ };
1869
+ type ActionLike = Pick<Action, "type">;
1870
+ declare function isPurgeMarker(value: Action): value is PurgeDocumentAction;
1871
+ declare function isPurgeMarker(value: Operation): value is PurgeMarkerOperation;
1872
+ declare function isPurgeMarker(value: OperationWithContext$1): value is OperationWithContext$1 & {
1873
+ operation: PurgeMarkerOperation;
1874
+ };
1875
+ declare function isPurgeMarker(value: ActionLike | {
1876
+ action?: ActionLike;
1877
+ } | {
1878
+ operation: Operation;
1879
+ }): boolean;
1880
+ /** An unsigned marker; `purgedAtUtcIso` is the action's own timestamp. */
1881
+ declare function purgeDocumentAction(input: Omit<PurgeDocumentActionInput, "purgedAtUtcIso">, options?: {
1882
+ id?: string;
1883
+ timestampUtcMs?: string;
1884
+ }): PurgeDocumentAction;
1885
+ /** The sole row of a purged stream: document/main, index 0, skip 0, hash "". */
1886
+ declare function purgeMarkerOperation(action: PurgeDocumentAction): PurgeMarkerOperation;
1887
+ /** Protocol versions of a purged id; derived, never stored. */
1888
+ declare function purgedProtocolVersions(): {
1889
+ [protocol: string]: number;
1890
+ };
1891
+ //#endregion
1892
+ //#region document-model/reducer.d.ts
1893
+ 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
1894
  /**
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.
1895
+ * Updates the document state based on the provided action.
1896
+ *
1897
+ * @param state The current state of the document.
1898
+ * @param action The action being applied to the document.
1899
+ * @param skip The number of operations to skip before applying the action.
1900
+ * @param reuseLastOperationIndex Whether to reuse the last operation index (used when a an UNDO operation is performed after an existing one).
1901
+ * @param context The operation context for deterministic ID generation.
1902
+ * @returns The updated document state.
1298
1903
  */
1299
- declare function hashNamespace(str: string, length?: number): string;
1904
+ declare function updateDocument<TDocument extends PHDocument>(document: TDocument, action: Action, reuseLastOperationIndex: boolean, skip: number, context: OperationContext, operation?: Operation, skipIndexValidation?: boolean): TDocument;
1300
1905
  /**
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.
1906
+ * Processes an UNDO or REDO action.
1907
+ *
1908
+ * @param document The current state of the document.
1909
+ * @param action The action being applied to the document.
1910
+ * @param skip The number of operations to skip before applying the action.
1911
+ * @returns The updated document, calculated skip value and transformed action (if applied).
1305
1912
  */
1306
- declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
1307
- type NamespaceOptions = {
1308
- hashNamespace?: boolean;
1913
+ declare function processUndoRedo<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, skip: number, protocolVersion?: number): {
1914
+ document: PHDocument<TState>;
1915
+ action: Action;
1916
+ skip: number;
1917
+ reuseLastOperationIndex: boolean;
1309
1918
  };
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
1919
  /**
1313
- * Returns a query builder for a RelationalDb instance.
1314
- * @param query The RelationalDb instance to convert.
1315
- * @returns The IRelationalQueryBuilder instance.
1920
+ * Base document reducer that wraps a custom document reducer and handles
1921
+ * document-level actions such as undo, redo, and set name.
1922
+ *
1923
+ * @template TGlobalState - The type of the state of the custom reducer.
1924
+ * @template TAction - The type of the actions of the custom reducer.
1925
+ * @param state - The current state of the document.
1926
+ * @param action - The action object to apply to the state.
1927
+ * @param customReducer - The custom reducer that implements the application logic
1928
+ * specific to the document's state.
1929
+ * @returns The new state of the document.
1316
1930
  */
1317
- declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
1931
+ declare function baseReducer<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, customReducer: StateReducer<TState>, dispatch?: SignalDispatch, options?: ReducerOptions): PHDocument<TState>;
1932
+ /**
1933
+ * Helper function to create a document model reducer.
1934
+ *
1935
+ * @remarks
1936
+ * This function creates a new reducer that wraps the provided `reducer` with
1937
+ * `documentReducer`, adding support for document actions:
1938
+ * - `SET_NAME`
1939
+ * - `UNDO`
1940
+ * - `REDO`
1941
+ *
1942
+ * It also updates the document-related attributes on every operation.
1943
+ *
1944
+ * @param reducer - The custom reducer to wrap.
1945
+ * @param documentReducer - The document reducer to use.
1946
+ *
1947
+ * @returns The new reducer.
1948
+ */
1949
+ declare function createReducer<TState extends PHBaseState = PHBaseState>(stateReducer: StateReducer<TState>, documentReducer?: typeof baseReducer): Reducer<TState>;
1950
+ //#endregion
1951
+ //#region document-model/reducers.d.ts
1952
+ declare const documentModelHeaderReducer: DocumentModelHeaderOperations;
1953
+ declare const documentModelModuleReducer: DocumentModelModuleOperations;
1954
+ declare const documentModelOperationErrorReducer: DocumentModelOperationErrorOperations;
1955
+ declare const documentModelOperationExampleReducer: DocumentModelOperationExampleOperations;
1956
+ declare const documentModelOperationReducer: DocumentModelOperationOperations;
1957
+ declare const documentModelStateSchemaReducer: DocumentModelStateOperations;
1958
+ declare const documentModelVersioningReducer: DocumentModelVersioningOperations;
1959
+ declare const documentModelStateReducer: StateReducer<DocumentModelPHState>;
1960
+ declare const documentModelReducer: Reducer<DocumentModelPHState>;
1318
1961
  //#endregion
1319
1962
  //#region document-model/schemas.d.ts
1320
1963
  type definedNonNullAny = {};
1321
1964
  declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
1322
1965
  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
1966
  declare const RedoSchema: z.ZodEnum<{
1330
1967
  REDO: "REDO";
1331
1968
  }>;
@@ -1340,18 +1977,6 @@ declare const UndoSchema: z.ZodEnum<{
1340
1977
  }>;
1341
1978
  declare function OperationScopeSchema(): z.ZodString;
1342
1979
  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
1980
  id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1356
1981
  timestampUtcMs: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1357
1982
  input: z.ZodType<RedoActionInput, RedoActionInput, z.core.$ZodTypeInternals<RedoActionInput, RedoActionInput>>;
@@ -1376,11 +2001,6 @@ declare function DocumentActionSchema(): z.ZodUnion<readonly [z.ZodObject<Requir
1376
2001
  type: z.ZodType<"UNDO", "UNDO", z.core.$ZodTypeInternals<"UNDO", "UNDO">>;
1377
2002
  scope: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1378
2003
  }>, 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
2004
  declare function RedoActionInputSchema(): z.ZodObject<{
1385
2005
  count: z.ZodNumber;
1386
2006
  }, z.core.$strip>;
@@ -1397,7 +2017,7 @@ declare function UndoActionInputSchema(): z.ZodObject<{
1397
2017
  count: z.ZodNumber;
1398
2018
  }, z.core.$strip>;
1399
2019
  declare function UndoActionSchema(): z.ZodObject<Properties<SchemaUndoAction>>;
1400
- type Properties<T> = Required<{ [K in keyof T]: z.ZodType<T[K], T[K]> }>;
2020
+ type Properties<T> = Required<{ [K in keyof T]: z.ZodType<T[K], T[K]>; }>;
1401
2021
  declare function AddChangeLogItemInputSchema(): z.ZodObject<Properties<AddChangeLogItemInput>>;
1402
2022
  declare function AddModuleInputSchema(): z.ZodObject<Properties<AddModuleInput>>;
1403
2023
  declare function AddOperationErrorInputSchema(): z.ZodObject<Properties<AddOperationErrorInput>>;
@@ -1590,6 +2210,24 @@ declare const PowerhouseModulesSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
1590
2210
  name: z.ZodString;
1591
2211
  documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1592
2212
  }, z.core.$strip>>>;
2213
+ declare const PieceModuleSchema: z.ZodObject<{
2214
+ id: z.ZodString;
2215
+ name: z.ZodString;
2216
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2217
+ version: z.ZodOptional<z.ZodString>;
2218
+ description: z.ZodOptional<z.ZodString>;
2219
+ bundle: z.ZodOptional<z.ZodString>;
2220
+ descriptor: z.ZodOptional<z.ZodString>;
2221
+ }, z.core.$strip>;
2222
+ declare const PieceModulesSchema: z.ZodOptional<z.ZodArray<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>>>;
1593
2231
  declare const PublisherSchema: z.ZodObject<{
1594
2232
  name: z.ZodOptional<z.ZodString>;
1595
2233
  url: z.ZodOptional<z.ZodString>;
@@ -1600,7 +2238,7 @@ declare const ConfigEntrySchema: z.ZodObject<{
1600
2238
  type: z.ZodUnion<readonly [z.ZodLiteral<"var">, z.ZodLiteral<"secret">]>;
1601
2239
  description: z.ZodOptional<z.ZodString>;
1602
2240
  required: z.ZodOptional<z.ZodBoolean>;
1603
- default: z.ZodOptional<z.ZodBoolean>;
2241
+ default: z.ZodOptional<z.ZodString>;
1604
2242
  }, z.core.$strip>;
1605
2243
  declare const PwaConfigSchema: z.ZodType<PHConnectPwa>;
1606
2244
  declare const ManifestSchema: z.ZodObject<{
@@ -1637,65 +2275,578 @@ declare const ManifestSchema: z.ZodObject<{
1637
2275
  name: z.ZodString;
1638
2276
  documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1639
2277
  }, z.core.$strip>>>;
2278
+ pieces: z.ZodOptional<z.ZodArray<z.ZodObject<{
2279
+ id: z.ZodString;
2280
+ name: z.ZodString;
2281
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2282
+ version: z.ZodOptional<z.ZodString>;
2283
+ description: z.ZodOptional<z.ZodString>;
2284
+ bundle: z.ZodOptional<z.ZodString>;
2285
+ descriptor: z.ZodOptional<z.ZodString>;
2286
+ }, z.core.$strip>>>;
2287
+ externalDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1640
2288
  config: z.ZodOptional<z.ZodArray<z.ZodObject<{
1641
2289
  name: z.ZodString;
1642
2290
  type: z.ZodUnion<readonly [z.ZodLiteral<"var">, z.ZodLiteral<"secret">]>;
1643
2291
  description: z.ZodOptional<z.ZodString>;
1644
2292
  required: z.ZodOptional<z.ZodBoolean>;
1645
- default: z.ZodOptional<z.ZodBoolean>;
2293
+ default: z.ZodOptional<z.ZodString>;
1646
2294
  }, z.core.$strip>>>;
1647
2295
  pwa: z.ZodOptional<z.ZodType<PHConnectPwa, unknown, z.core.$ZodTypeInternals<PHConnectPwa, unknown>>>;
1648
2296
  }, z.core.$strip>;
1649
2297
  //#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;
2298
+ //#region document-model/validation.d.ts
2299
+ /**
2300
+ * Reserved operation names from base reducer (core/actions.ts).
2301
+ * These names cannot be used for custom operations.
2302
+ */
2303
+ declare const RESERVED_OPERATION_NAMES: readonly ["UNDO", "REDO", "SET_NAME", "SET_PREFERRED_EDITOR", "NOOP", "PURGE_DOCUMENT"];
2304
+ type ReservedOperationName = (typeof RESERVED_OPERATION_NAMES)[number];
2305
+ /**
2306
+ * Operation names become the literal action `type` string at runtime and the
2307
+ * key for codegen's action union. They must be SCREAMING_SNAKE_CASE so the
2308
+ * generated TypeScript is valid.
2309
+ */
2310
+ declare const OPERATION_NAME_PATTERN: RegExp;
2311
+ declare function isValidOperationNameFormat(name: string): boolean;
2312
+ /**
2313
+ * Check if name conflicts with base reducer actions (case-insensitive).
2314
+ */
2315
+ declare function isReservedOperationName(name: string): boolean;
2316
+ /**
2317
+ * Get all operation names from all modules in the latest specification.
2318
+ * Returns names in uppercase for case-insensitive comparison.
2319
+ */
2320
+ declare function getAllOperationNames(state: DocumentModelGlobalState, excludeOperationId?: string): string[];
2321
+ /**
2322
+ * Validate operation name is not reserved or duplicate. Throws on failure.
2323
+ *
2324
+ * @param name - The operation name to validate
2325
+ * @param state - The document model global state
2326
+ * @param excludeOperationId - Optional operation ID to exclude (for rename validation)
2327
+ * @throws Error if the name is reserved or a duplicate
2328
+ */
2329
+ declare function validateOperationName(name: string, state: DocumentModelGlobalState, excludeOperationId?: string): void;
2330
+ declare function validateInitialState(initialState: string, allowEmptyState?: boolean): ValidationError[];
2331
+ declare function validateStateSchemaName(schema: string, documentName: string, scope?: string, allowEmptySchema?: boolean): ValidationError[];
2332
+ declare function validateModules(modules: ModuleSpecification[]): ValidationError[];
2333
+ declare function validateModule(mod: ModuleSpecification): ValidationError[];
2334
+ declare function validateModuleOperation(operation: OperationSpecification): ValidationError[];
2335
+ /**
2336
+ * Find a module in the latest specification by id, or throw. Reducers that
2337
+ * mutate-by-id should call this up front so an unknown id fails loudly
2338
+ * instead of silently no-opping.
2339
+ */
2340
+ declare function findModuleOrThrow(state: DocumentModelGlobalState, moduleId: string): ModuleSpecification;
2341
+ /**
2342
+ * Find an operation in the latest specification by id, or throw. Same
2343
+ * rationale as findModuleOrThrow — reducers that target an operation must
2344
+ * fail loudly when the operation doesn't exist.
2345
+ */
2346
+ declare function findOperationOrThrow(state: DocumentModelGlobalState, operationId: string): OperationSpecification;
2347
+ /**
2348
+ * Find an operation error by id across all operations in the latest
2349
+ * specification, or throw. Throws on a duplicate id too: setters act on a
2350
+ * single error, so an ambiguous id must fail loudly rather than mutate an
2351
+ * arbitrary match.
2352
+ */
2353
+ declare function findOperationErrorOrThrow(state: DocumentModelGlobalState, errorId: string): OperationErrorSpecification;
2354
+ /**
2355
+ * Find an operation example (code example) by id across all operations in the
2356
+ * latest specification, or throw. Throws on a duplicate id for the same reason
2357
+ * as findOperationErrorOrThrow.
2358
+ */
2359
+ declare function findOperationExampleOrThrow(state: DocumentModelGlobalState, exampleId: string): CodeExample;
2360
+ /**
2361
+ * Assert no module in the latest specification already uses `id`. Modules are
2362
+ * targeted by id by the setter/delete/reorder reducers, so a duplicate id makes
2363
+ * those operations ambiguous.
2364
+ */
2365
+ declare function assertModuleIdUnique(state: DocumentModelGlobalState, id: string): void;
2366
+ /**
2367
+ * Assert no operation in the latest specification already uses `id`. Operations
2368
+ * are targeted by id across all modules, so the id must be unique document-wide.
2369
+ */
2370
+ declare function assertOperationIdUnique(state: DocumentModelGlobalState, id: string): void;
2371
+ /**
2372
+ * Assert no operation error in the latest specification already uses `id`.
2373
+ * Error ids are targeted document-wide by the setter/delete reducers, so the id
2374
+ * must be unique to keep those operations unambiguous.
2375
+ */
2376
+ declare function assertOperationErrorIdUnique(state: DocumentModelGlobalState, id: string): void;
2377
+ /**
2378
+ * Assert no operation example in the latest specification already uses `id`.
2379
+ * Example ids are targeted document-wide by the update/delete reducers, so the
2380
+ * id must be unique to keep those operations unambiguous.
2381
+ */
2382
+ declare function assertOperationExampleIdUnique(state: DocumentModelGlobalState, id: string): void;
2383
+ declare function validateOperations(operations: DocumentOperations): ValidationError[];
2384
+ //#endregion
2385
+ //#region processors/deletion.d.ts
2386
+ /** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */
2387
+ declare function deletedDocumentId(op: OperationWithContext$1): string | undefined;
2388
+ //#endregion
2389
+ //#region processors/http.d.ts
2390
+ /** Methods a package route may bind. OPTIONS belongs to the CORS layer. */
2391
+ type RouteMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
2392
+ interface RouteUser {
2393
+ address: string;
2394
+ chainId: number;
2395
+ networkId: string;
2396
+ appKey: string;
2397
+ }
2398
+ type RouteActor = {
2399
+ user: RouteUser | undefined;
2400
+ authEnabled: boolean;
2401
+ };
2402
+ type AuthorizerResult = {
2403
+ authorized: true;
2404
+ } |
2405
+ /** Refused; the scope answers with its own JSON error envelope. */
2406
+ {
2407
+ authorized: false;
2408
+ status: number;
2409
+ message: string;
2410
+ } | {
2411
+ authorized: false;
2412
+ response: Response;
2413
+ };
2414
+ /** A route-specific gate, for policies the standard modes cannot express. */
2415
+ type RouteAuthorizer = (req: IncomingMessage) => Promise<AuthorizerResult> | AuthorizerResult;
2416
+ /** How a route authenticates. */
2417
+ type RouteAuth =
2418
+ /** Default. A verifiable bearer is required; a caller without one gets 401. */
2419
+ "renown" | "renown-optional" | "public" | RouteAuthorizer;
2420
+ /** How the request body reaches the handler. */
2421
+ type RouteBody =
2422
+ /** Default. Buffered, and readable through the Fetch Request. */
2423
+ "parsed" |
2424
+ /** Buffered and also handed over as `ctx.rawBody`, byte for byte. */
2425
+ "raw" |
2426
+ /** Not buffered; the Fetch Request body is the live request stream. */
2427
+ "stream" |
2428
+ /** The body is not read at all. */
2429
+ "none";
2430
+ interface RouteOptions {
2431
+ auth?: RouteAuth;
2432
+ body?: RouteBody;
2433
+ /** Refuse a body larger than this with 413. Ignored when body is `stream`. */
2434
+ maxBodyBytes?: number;
2435
+ /** Serve sub-paths too, not just an exact match. */
2436
+ prefix?: boolean;
2437
+ }
2438
+ /** Where the request reached the host, resolved through any reverse proxy. */
2439
+ interface RouteTransport {
2440
+ proto: string;
2441
+ host: string;
2442
+ prefix: string;
2443
+ baseUrl: string;
2444
+ }
2445
+ interface RouteContext {
2446
+ /** Decoded path params. */
2447
+ params: Record<string, string>;
2448
+ user: RouteUser | undefined;
2449
+ authEnabled: boolean;
2450
+ /** The exact octets received. Present only when body is `raw`. */
2451
+ rawBody: Buffer | undefined;
2452
+ /** Aborts when the client disconnects. */
2453
+ signal: AbortSignal;
2454
+ transport: RouteTransport;
2455
+ }
2456
+ type RouteHandler = (request: Request, ctx: RouteContext) => Response | Promise<Response>;
2457
+ interface RouteSpec extends RouteOptions {
2458
+ method: RouteMethod | RouteMethod[];
2459
+ /** Relative to the scope: "runs/:id", never "/api/@scope/pkg/runs/:id". */
2460
+ path: string;
2461
+ handler: RouteHandler;
2462
+ }
2463
+ interface NodeRouteSpec extends Omit<RouteOptions, "body" | "maxBodyBytes"> {
2464
+ method: RouteMethod | RouteMethod[];
2465
+ path: string;
2466
+ handler: (req: IncomingMessage, res: ServerResponse, ctx: Omit<RouteContext, "rawBody" | "signal">) => void | Promise<void>;
2467
+ }
2468
+ interface ScopedRouteHandle {
2469
+ /** The absolute public URL this route answers on. */
2470
+ readonly url: string;
2471
+ dispose(): void;
2472
+ }
2473
+ type WebhookScheme = "none" |
2474
+ /** A shared secret presented verbatim. No digest, so no digest options. */
2475
+ "token" |
2476
+ /** The digest of the body, alone. */
2477
+ "hmac" |
2478
+ /** That digest behind a label, `sha256=<digest>`. */
2479
+ "hmac-prefixed" | "hmac-timestamped";
2480
+ /** Hashes a sender may compute the digest with. */
2481
+ type WebhookHashAlgorithm = "sha1" | "sha256" | "sha512";
2482
+ /** How the digest is written into the header. */
2483
+ type WebhookSignatureEncoding = "hex" | "base64";
2484
+ interface WebhookVerification {
2485
+ scheme: WebhookScheme;
2486
+ /** Resolved value, never a reference — the caller resolves refs. */
2487
+ secret?: string;
2488
+ /** Overrides the scheme's conventional header. */
2489
+ header?: string;
2490
+ /** Replay window for timestamped schemes. */
2491
+ toleranceSeconds?: number;
2492
+ algorithm?: WebhookHashAlgorithm;
2493
+ /** Defaults to `hex`. Base64 comparison is case-sensitive; hex is not. */
2494
+ encoding?: WebhookSignatureEncoding;
2495
+ prefix?: string;
2496
+ }
2497
+ type WebhookField = string | {
2498
+ header: string;
2499
+ } |
2500
+ /** Dot-separated path into the parsed body, e.g. `data.object.id`. */
2501
+ {
2502
+ body: string;
2503
+ };
2504
+ interface WebhookRequest {
2505
+ /** The caller's own key for this endpoint, e.g. a document id. */
2506
+ key: string;
2507
+ method: string;
2508
+ path: string;
2509
+ queryParams: Record<string, string>;
2510
+ /** Lowercased, with credentials redacted. */
2511
+ headers: Record<string, string>;
2512
+ /** The exact bytes received. */
2513
+ raw: Buffer;
2514
+ /** JSON and form bodies decoded; anything else as text. */
2515
+ body: unknown;
2516
+ }
2517
+ interface WebhookReply {
2518
+ status: number;
2519
+ body?: string;
2520
+ contentType?: string;
2521
+ /** The handler did not process this delivery (its owner is shutting down),
2522
+ * so its dedupe key is dropped and the sender's retry is delivered again.
2523
+ * Unset, a delivery counts as seen whatever the status. */
2524
+ unprocessed?: boolean;
2525
+ }
2526
+ interface WebhookPolicy {
2527
+ verify?: WebhookVerification;
2528
+ /** Uppercase. Undefined accepts every method. */
2529
+ methods?: string[];
2530
+ dedupe?: {
2531
+ field: WebhookField;
2532
+ ttlSeconds?: number;
2533
+ };
2534
+ challengeField?: WebhookField;
2535
+ maxBodyBytes?: number;
2536
+ }
2537
+ interface WebhookSpec {
2538
+ /** Distinguishes several endpoint families within one package. */
2539
+ name: string;
2540
+ defaults?: WebhookPolicy;
2541
+ onRequest: (request: WebhookRequest) => Promise<WebhookReply> | WebhookReply;
2542
+ policyFor?: (key: string) => Promise<WebhookPolicy | undefined> | WebhookPolicy | undefined;
2543
+ }
2544
+ interface WebhookEndpointInfo {
2545
+ key: string;
2546
+ token: string;
2547
+ url: string;
2548
+ createdAt: string;
2549
+ }
2550
+ interface IWebhookEndpoints {
2551
+ endpointFor(key: string): Promise<Omit<WebhookEndpointInfo, "key">>;
2552
+ revoke(key: string): Promise<void>;
2553
+ list(): Promise<WebhookEndpointInfo[]>;
2554
+ }
2555
+ interface IWebhookScope {
2556
+ register(spec: WebhookSpec): Promise<IWebhookEndpoints>;
2557
+ readonly hasPublicOrigin: boolean;
2558
+ }
2559
+ interface IHttpScope {
2560
+ readonly owner: string;
2561
+ readonly baseUrl: string;
2562
+ get(path: string, handler: RouteHandler): ScopedRouteHandle;
2563
+ get(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2564
+ post(path: string, handler: RouteHandler): ScopedRouteHandle;
2565
+ post(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2566
+ put(path: string, handler: RouteHandler): ScopedRouteHandle;
2567
+ put(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2568
+ patch(path: string, handler: RouteHandler): ScopedRouteHandle;
2569
+ patch(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2570
+ delete(path: string, handler: RouteHandler): ScopedRouteHandle;
2571
+ delete(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2572
+ /** Registered independently of GET: a HEAD response is not a bodyless GET. */
2573
+ head(path: string, handler: RouteHandler): ScopedRouteHandle;
2574
+ head(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2575
+ route(spec: RouteSpec): ScopedRouteHandle;
2576
+ nodeRoute(spec: NodeRouteSpec): ScopedRouteHandle;
2577
+ readonly webhooks: IWebhookScope;
2578
+ /** Release every route this scope registered. Called on package teardown. */
2579
+ dispose(): void;
2580
+ }
2581
+ //#endregion
2582
+ //#region processors/types.d.ts
2583
+ type ProcessorDispatchResult = {
2584
+ id: string;
2585
+ status: string;
2586
+ };
2587
+ interface IProcessorDispatch {
2588
+ execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
2589
+ }
2590
+ interface IProcessorHostModuleBase {
2591
+ analyticsStore: IAnalyticsStore;
2592
+ relationalDb: IRelationalDb;
2593
+ processorApp: ProcessorApp;
2594
+ dispatch: IProcessorDispatch;
2595
+ getReadModel<T>(name: string): T;
2596
+ config?: Map<string, unknown>;
2597
+ /**
2598
+ * The package's slice of the HTTP surface, bound to its own namespace.
2599
+ *
2600
+ * Declared on the host-agnostic base rather than on each host's module so
2601
+ * the two cannot drift: codegen types generated processors against
2602
+ * reactor-browser's `IProcessorHostModule`, and the same source has to
2603
+ * compile against reactor-api's.
2604
+ *
2605
+ * Absent whenever the host has no HTTP server — processors also run in the
2606
+ * browser — and on the reactor when the package's name cannot be resolved to
2607
+ * a routable namespace, so a caller must always check before using it.
2608
+ */
2609
+ http?: IHttpScope;
2610
+ }
2611
+ /**
2612
+ * Filter for matching operations to processors.
2613
+ * All fields are optional arrays - when provided, operations must match at least one value in each specified field.
2614
+ * When a field is undefined or empty, it matches all values for that field.
2615
+ */
2616
+ type ProcessorFilter = {
2617
+ documentType?: string[];
2618
+ scope?: string[];
2619
+ branch?: string[];
2620
+ documentId?: string[];
2621
+ };
2622
+ /**
2623
+ * Describes an object that can process operations.
2624
+ */
2625
+ interface IProcessor {
2626
+ /**
2627
+ * Processes a list of operations with context.
2628
+ * Called when operations match this processor's filter.
2629
+ *
2630
+ * Delivery is at-least-once. Within a document's scope and branch, each
2631
+ * call is in ordinal order, and an operation delivered late comes with
2632
+ * every later operation of its stream this processor was already given.
2633
+ * Across documents there is no ordering guarantee. A processor receives one
2634
+ * `onOperations` call at a time; the next call begins after the previous
2635
+ * resolves.
2636
+ *
2637
+ * A drive's processors also receive the drive's own DELETE_DOCUMENT or
2638
+ * PURGE_DOCUMENT, whatever the filter, as the last delivery before
2639
+ * `onDisconnect`. A purged document's operations other than its marker are
2640
+ * not delivered. Erase a document's data on either deletion action.
2641
+ */
2642
+ onOperations(operations: OperationWithContext[]): Promise<void>;
2643
+ /**
2644
+ * Called when the processor is disconnected.
2645
+ * Used to clean up any resources allocated during processor creation.
2646
+ * Also runs when the factory is unregistered, so it is not a deletion signal.
2647
+ */
2648
+ onDisconnect(): Promise<void>;
2649
+ }
2650
+ /**
2651
+ * Relates a processor to its filter configuration.
2652
+ */
2653
+ type ProcessorRecord = {
2654
+ processor: IProcessor;
2655
+ filter: ProcessorFilter;
2656
+ startFrom?: "beginning" | "current";
2657
+ id?: string;
2658
+ };
2659
+ /**
2660
+ * A factory function that creates processor records for a given drive.
2661
+ * Called once per drive when the drive is first detected or when the factory is registered.
2662
+ * The header is the drive's header at creation. For a purged drive it is
2663
+ * minimal: only `id` and `documentType` are set, and `slug` and `name` are
2664
+ * empty, so a factory that selects drives by slug or name makes no processor
2665
+ * for it and the deletion stays owed.
2666
+ */
2667
+ type ProcessorFactory = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => Promise<ProcessorRecord[]> | ProcessorRecord[];
2668
+ /** Takes a processor host module and builds processor factories using its context. */
2669
+ type ProcessorFactoryBuilder<TModule extends IProcessorHostModuleBase = IProcessorHostModuleBase> = {
2670
+ bivarianceHack(module: TModule): Promise<ProcessorFactory> | ProcessorFactory;
2671
+ }["bivarianceHack"];
2672
+ type ProcessorStatus = "active" | "errored";
2673
+ type TrackedProcessor = {
2674
+ processorId: string;
2675
+ factoryId: string;
2676
+ driveId: string;
2677
+ processorIndex: number;
2678
+ record: ProcessorRecord;
2679
+ lastOrdinal: number;
2680
+ status: ProcessorStatus;
2681
+ lastError: string | undefined;
2682
+ lastErrorTimestamp: Date | undefined;
2683
+ /**
2684
+ * Clears the error and resolves once the replay from the cursor completes.
2685
+ * Safe from anywhere, but awaiting it from this processor's own
2686
+ * `onOperations` waits on itself: the replay runs after that call returns.
2687
+ * A no-op once the processor has been removed.
2688
+ */
2689
+ retry: () => Promise<void>;
2690
+ };
2691
+ /**
2692
+ * Manages processor creation and destruction based on drive operations.
2693
+ */
2694
+ interface IProcessorManager {
2695
+ /**
2696
+ * Registers a processor factory.
2697
+ * Immediately creates processors for all existing drives and resolves once
2698
+ * every factory run has completed and its processors are bound. Their
2699
+ * backfills run afterwards, on each processor's own queue. A deleted drive
2700
+ * whose deletion one of the factory's processors never received (it was not
2701
+ * running, or its delivery threw) gets a processor too: it receives only the
2702
+ * drive's `DELETE_DOCUMENT`, or its `PURGE_DOCUMENT` once purged, and is
2703
+ * disconnected. That delivery is not awaited: it runs after this resolves,
2704
+ * so a processor that hangs on it does not hold the registration, nor a
2705
+ * later one: a drive whose deletion is still being delivered gets it from
2706
+ * the new registration only if that delivery leaves it owed. If processors
2707
+ * from an earlier registration under the same identifier are still
2708
+ * draining, or a call of the previous factory is still in flight, the
2709
+ * factory runs after they have settled, so awaiting a re-registration of
2710
+ * a factory from inside that factory or one of its processors'
2711
+ * `onOperations` waits on itself.
2712
+ */
2713
+ registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
2714
+ /**
2715
+ * Unregisters a processor factory. Resolves once its processors receive no
2716
+ * new deliveries and their cursors are released; each one's in-flight
2717
+ * delivery finishes first, then `onDisconnect` runs. A released cursor no
2718
+ * longer positions a processor: a re-registration starts each one afresh,
2719
+ * per `startFrom`. It only records that the factory held a drive's data, so
2720
+ * that a drive deleted before the factory registers again still gets its
2721
+ * deletion delivered then. Safe to call from
2722
+ * inside a processor's own `onOperations`.
2723
+ */
2724
+ unregisterFactory(identifier: string): Promise<void>;
2725
+ /**
2726
+ * Gets a tracked processor by its ID.
2727
+ */
2728
+ get(processorId: string): TrackedProcessor | undefined;
2729
+ /**
2730
+ * Gets all tracked processors, including an errored entry for each
2731
+ * processor whose drive's deletion threw; its `retry()` delivers the
2732
+ * deletion again.
2733
+ */
2734
+ getAll(): TrackedProcessor[];
2735
+ }
2736
+ type ProcessorApp = (typeof PROCESSOR_APPS)[number];
2737
+ type ProcessorApps = readonly ProcessorApp[];
2738
+ //#endregion
2739
+ //#region processors/relational/types.d.ts
2740
+ /** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */
2741
+ declare const DOCUMENT_ID_COLUMNS: readonly ["document_id", "documentId"];
2742
+ type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
2743
+ type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
2744
+ withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
1659
2745
  };
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 };
2746
+ type HashAlgorithms = "fnv1a";
2747
+ type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
2748
+ /**
2749
+ * The standardized relational database interface for relational db processors.
2750
+ * This abstraction provides type-safe database operations while hiding the underlying
2751
+ * database framework implementation details.
2752
+ **/
2753
+ type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {
2754
+ createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
2755
+ queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
1667
2756
  };
2757
+ type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
2758
+ type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
2759
+ interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
2760
+ namespace: string;
2761
+ query: IRelationalQueryBuilder<TDatabaseSchema>;
2762
+ filter: ProcessorFilter;
2763
+ initAndUpgrade(): Promise<void>;
2764
+ }
2765
+ declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
1668
2766
  /**
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.
2767
+ * Base class for relational db processors that require a relational database storage.
2768
+ * This class abstracts database initialization, migration management, and resource cleanup,
2769
+ * allowing derived classes to focus on business logic.
1675
2770
  */
1676
- declare function normalizeDocumentModelVersion(version: number | undefined | null): number;
2771
+ declare abstract class RelationalDbProcessor<TDatabaseSchema = unknown> implements IRelationalDbProcessor<TDatabaseSchema> {
2772
+ protected _namespace: string;
2773
+ protected _filter: ProcessorFilter;
2774
+ protected relationalDb: IRelationalDb<TDatabaseSchema>;
2775
+ /** The drive the factory created this processor for. */
2776
+ protected _driveId?: string | undefined;
2777
+ constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>,
2778
+ /** The drive the factory created this processor for. */
2779
+ _driveId?: string | undefined);
2780
+ static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
2781
+ /**
2782
+ * Returns the namespace for a given drive id.
2783
+ * This method can be overridden by derived classes to provide a custom namespace.
2784
+ */
2785
+ static getNamespace(driveId: string): string;
2786
+ static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
2787
+ /**
2788
+ * Processes a list of operations with context.
2789
+ * Called when operations match this processor's filter.
2790
+ */
2791
+ abstract onOperations(operations: OperationWithContext[]): Promise<void>;
2792
+ /**
2793
+ * Returns the filter for the processor.
2794
+ * This method can be overridden by derived classes to provide a custom filter.
2795
+ */
2796
+ get filter(): ProcessorFilter;
2797
+ /**
2798
+ * Returns the namespace used by the processor.
2799
+ */
2800
+ get namespace(): string;
2801
+ get query(): IRelationalQueryBuilder<TDatabaseSchema>;
2802
+ /** True for this processor's drive when its namespace is that drive's alone. */
2803
+ protected isNamespaceDrive(documentId: string): boolean;
2804
+ /** Deletes a document's rows from every table with a document-id column. */
2805
+ protected deleteDocumentRows(documentId: string): Promise<void>;
2806
+ /** Drops this processor's namespace and every table in it. */
2807
+ protected dropNamespace(): Promise<void>;
2808
+ private namespaceSchema;
2809
+ /**
2810
+ * Abstract method that derived classes must implement.
2811
+ * This method is meant to be called on subclasses to initialize and upgrade the database.
2812
+ */
2813
+ abstract initAndUpgrade(): Promise<void>;
2814
+ /**
2815
+ * Called when the processor is disconnected.
2816
+ * This method is meant to be overridden by subclasses to clean up resources.
2817
+ */
2818
+ abstract onDisconnect(): Promise<void>;
2819
+ }
2820
+ //#endregion
2821
+ //#region processors/relational/utils.d.ts
1677
2822
  /**
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
2823
+ * Hashes a string to a lowercase base-26 string.
2824
+ * @param str The string to hash.
2825
+ * @param length The length of the hash. Defaults to 10.
2826
+ * @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
2827
+ * @returns The hashed string.
1685
2828
  */
1686
- declare function applyUpgradeDocumentAction(document: PHDocument, action: UpgradeDocumentAction, upgradePath?: UpgradeTransition[]): PHDocument;
2829
+ declare function hashNamespace(str: string, length?: number): string;
1687
2830
  /**
1688
- * Applies a DELETE_DOCUMENT action to a document.
1689
- * Marks the document as deleted in the document scope state.
2831
+ * Creates a RelationalDb instance with namespace support.
2832
+ * @param baseDb The base RelationalDb instance to enhance.
2833
+ * @param baseOptions The default options for namespace creation. Hashes namespace by default.
2834
+ * @returns The enhanced RelationalDb instance.
1690
2835
  */
1691
- declare function applyDeleteDocumentAction(document: PHDocument, action: DeleteDocumentAction): PHDocument;
2836
+ declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
2837
+ type NamespaceOptions = {
2838
+ hashNamespace?: boolean;
2839
+ };
2840
+ declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
2841
+ /** The schema behind a handle from `createNamespace`; undefined otherwise. */
2842
+ declare function namespaceSchemaOf(db: object): string | undefined;
2843
+ declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
1692
2844
  /**
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.
2845
+ * Returns a query builder for a RelationalDb instance.
2846
+ * @param query The RelationalDb instance to convert.
2847
+ * @returns The IRelationalQueryBuilder instance.
1697
2848
  */
1698
- declare function computeUpgradeTransitions(manifest: UpgradeManifest<readonly number[]> | undefined, fromVersion: number, toVersion: number): UpgradeTransition[];
2849
+ declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
1699
2850
  //#endregion
1700
2851
  //#region document-model/types.d.ts
1701
2852
  type State = {
@@ -2342,11 +3493,11 @@ interface DocumentModelVersioningOperations {
2342
3493
  }
2343
3494
  type Maybe<T> = T | null;
2344
3495
  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 };
3496
+ type Exact<T extends Record<string, unknown>> = { [K in keyof T]: T[K]; };
3497
+ type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]>; };
3498
+ type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]>; };
3499
+ type MakeEmpty<T extends Record<string, unknown>, K extends keyof T> = { [_ in K]?: never; };
3500
+ type Incremental<T> = T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never; };
2350
3501
  /** All built-in and custom scalars, mapped to their actual values */
2351
3502
  type Scalars = {
2352
3503
  ID: {
@@ -2407,28 +3558,6 @@ type IOperation = {
2407
3558
  timestampUtcMs: Scalars["DateTime"]["output"];
2408
3559
  type: Scalars["String"]["output"];
2409
3560
  };
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
3561
  type MutationRedoArgs = {
2433
3562
  input: SchemaRedoAction;
2434
3563
  };
@@ -2438,18 +3567,6 @@ type MutationSetNameArgs = {
2438
3567
  type MutationUndoArgs = {
2439
3568
  input: SchemaUndoAction;
2440
3569
  };
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
3570
  type Query = {
2454
3571
  __typename?: "Query";
2455
3572
  document: Maybe<IDocument>;
@@ -2521,14 +3638,6 @@ type SchemaNOOPAction = {
2521
3638
  timestampUtcMs: Scalars["DateTime"]["output"];
2522
3639
  type: "NOOP";
2523
3640
  };
2524
- type LoadStateAction = Action & {
2525
- type: "LOAD_STATE";
2526
- input: LoadStateActionInput;
2527
- };
2528
- type PruneAction = Action & {
2529
- type: "PRUNE";
2530
- input: PruneActionInput;
2531
- };
2532
3641
  type RedoAction = Action & {
2533
3642
  type: "REDO";
2534
3643
  input: SchemaRedoAction["input"];
@@ -2585,6 +3694,13 @@ type DeleteDocumentActionInput = {
2585
3694
  documentId: string;
2586
3695
  propagate?: "none" | "cascade";
2587
3696
  };
3697
+ type PurgeDocumentActionInput = {
3698
+ documentId: string;
3699
+ documentType: string;
3700
+ /** The same instant as the action's timestampUtcMs. */
3701
+ purgedAtUtcIso: string;
3702
+ requestId: string;
3703
+ };
2588
3704
  type AddRelationshipActionInput = {
2589
3705
  sourceId: string;
2590
3706
  targetId: string;
@@ -2614,6 +3730,12 @@ type DeleteDocumentAction = Action & {
2614
3730
  type: "DELETE_DOCUMENT";
2615
3731
  input: DeleteDocumentActionInput;
2616
3732
  };
3733
+ /** Reserved document-scope marker; a purged document's only operation. */
3734
+ type PurgeDocumentAction = Action & {
3735
+ type: "PURGE_DOCUMENT";
3736
+ scope: "document";
3737
+ input: PurgeDocumentActionInput;
3738
+ };
2617
3739
  type AddRelationshipAction = Action & {
2618
3740
  type: "ADD_RELATIONSHIP";
2619
3741
  input: AddRelationshipActionInput;
@@ -2626,7 +3748,7 @@ type UpdateRelationshipAction = Action & {
2626
3748
  type: "UPDATE_RELATIONSHIP";
2627
3749
  input: UpdateRelationshipActionInput;
2628
3750
  };
2629
- type DocumentAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
3751
+ type DocumentAction = RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
2630
3752
  interface ISignal<TType extends string, TInput> {
2631
3753
  type: TType;
2632
3754
  input: TInput;
@@ -2663,19 +3785,27 @@ type SignalResults = {
2663
3785
  type SignalType<T extends Signal> = T["type"];
2664
3786
  type FileInput = string | number[] | Uint8Array | ArrayBuffer | Blob;
2665
3787
  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. */
3788
+ /** The number of operations to skip before this new action is applied. This overrides the skip count in the operation. */
3789
+ skip?: number;
3790
+ /** When true the skip count is ignored and the action is applied regardless of the skip count */
3791
+ ignoreSkipOperations?: boolean;
3792
+ /** if true reuses the provided action resulting state instead of replaying it */
3793
+ reuseOperationResultingState?: boolean;
3794
+ /** if true checks the hashes of the operations */
3795
+ checkHashes?: boolean;
3796
+ /** Options for performing a replay. */
2670
3797
  replayOptions?: {
2671
- /** The previously created operation to verify against. */operation: Operation;
2672
- }; /** Optional parser for the operation resulting state, uses JSON.parse by default */
3798
+ /** The previously created operation to verify against. */
3799
+ operation: Operation;
3800
+ };
3801
+ /** Optional parser for the operation resulting state, uses JSON.parse by default */
2673
3802
  operationResultingStateParser?: <TState>(state: string | null | undefined) => TState;
2674
3803
  /**
2675
3804
  * When true (default), the reducer will prune operations (garbage collect) when processing a skip.
2676
3805
  * When false, it will recompute state for the skip but preserve the existing operations history.
2677
3806
  */
2678
- pruneOnSkip?: boolean; /** The branch being operated on. Defaults to "main". */
3807
+ pruneOnSkip?: boolean;
3808
+ /** The branch being operated on. Defaults to "main". */
2679
3809
  branch?: string;
2680
3810
  /**
2681
3811
  * Protocol version controlling undo/redo behavior.
@@ -2726,7 +3856,7 @@ type User = {
2726
3856
  chainId: number;
2727
3857
  ens?: ENSInfo;
2728
3858
  };
2729
- type PartialRecord<K extends keyof any, T> = { [P in K]?: T };
3859
+ type PartialRecord<K extends keyof any, T> = { [P in K]?: T; };
2730
3860
  type RevisionsFilter = PartialRecord<string, number>;
2731
3861
  type GetDocumentOptions = ReducerOptions & {
2732
3862
  revisions?: RevisionsFilter;
@@ -2806,13 +3936,14 @@ interface ISigner {
2806
3936
  */
2807
3937
  verify: (data: Uint8Array, signature: Uint8Array) => Promise<void>;
2808
3938
  /**
2809
- * Signs an action (used for operation signing).
3939
+ * Signs an action for the log it is written to.
2810
3940
  *
2811
3941
  * @param action - The action to sign.
3942
+ * @param target - The document and branch whose log stores the action.
2812
3943
  * @param abortSignal - Optional abort signal to cancel the signing.
2813
3944
  * @returns The signature tuple.
2814
3945
  */
2815
- signAction: (action: Action, abortSignal?: AbortSignal) => Promise<Signature>;
3946
+ signAction: (action: Action, target: ActionSigningTarget, abortSignal?: AbortSignal) => Promise<Signature>;
2816
3947
  }
2817
3948
  type IsStateOfType<TState> = (state: unknown) => state is TState;
2818
3949
  type AssertIsStateOfType<TState> = (state: unknown) => asserts state is TState;
@@ -2831,6 +3962,9 @@ type MinimalBackupData = {
2831
3962
  branch: string;
2832
3963
  state: PHBaseState;
2833
3964
  name: string;
3965
+ protocolVersions?: {
3966
+ [key: string]: number;
3967
+ };
2834
3968
  };
2835
3969
  type DocumentModelUtils<TState extends PHBaseState = PHBaseState> = {
2836
3970
  fileExtension: string;
@@ -2870,7 +4004,8 @@ type PhAiToolDescriptor = {
2870
4004
  callback: (args: never) => Promise<unknown>;
2871
4005
  };
2872
4006
  type DocumentModelModule<TState extends PHBaseState = PHBaseState> = {
2873
- /** optional version field, should be made required */version?: number;
4007
+ /** optional version field, should be made required */
4008
+ version?: number;
2874
4009
  reducer: Reducer<TState>;
2875
4010
  actions: Actions;
2876
4011
  utils: DocumentModelUtils<TState>;
@@ -2893,6 +4028,7 @@ type DocumentModelDocumentModelModule = DocumentModelModule<DocumentModelPHState
2893
4028
  type ConfigEntryType = z.infer<typeof ConfigEntryTypeSchema>;
2894
4029
  type ConfigEntry = z.infer<typeof ConfigEntrySchema>;
2895
4030
  type PowerhouseModule = z.infer<typeof PowerhouseModuleSchema>;
4031
+ type PieceModule = z.infer<typeof PieceModuleSchema>;
2896
4032
  type Publisher = z.infer<typeof PublisherSchema>;
2897
4033
  type Manifest = z.infer<typeof ManifestSchema>;
2898
4034
  //#endregion
@@ -2929,10 +4065,13 @@ type PHConnectDefaultDriveRemote = {
2929
4065
  icon?: string | null;
2930
4066
  };
2931
4067
  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. */
4068
+ /** Discriminator: this entry is a local drive created on first boot. */
4069
+ local: true;
4070
+ /** Stable drive id; the drive is not re-created on later boots. */
2933
4071
  id: string;
2934
4072
  name?: string | null;
2935
- icon?: string | null; /** Drive app (preferred editor) to open on the drive. */
4073
+ icon?: string | null;
4074
+ /** Drive app (preferred editor) to open on the drive. */
2936
4075
  app?: string;
2937
4076
  };
2938
4077
  type PHConnectDefaultDrive = PHConnectDefaultDriveRemote | PHConnectDefaultDriveLocal;
@@ -2956,21 +4095,29 @@ type PHConnectApp = {
2956
4095
  basePath?: string;
2957
4096
  offline?: boolean;
2958
4097
  studioMode?: boolean;
4098
+ workflowsEnabled?: boolean;
2959
4099
  };
2960
4100
  type PHConnectAi = {
2961
- /** Enables the in-browser AI assistant (chat FAB + window). Off by default. */assistantEnabled?: boolean;
4101
+ /** Enables the in-browser AI assistant (chat FAB + window). Off by default. */
4102
+ assistantEnabled?: boolean;
2962
4103
  };
2963
4104
  type PHConnectPackages = {
2964
- externalEnabled?: boolean; /** Subscribe to the static-mode `/__packages` SSE channel for live reload. */
4105
+ externalEnabled?: boolean;
4106
+ /** Subscribe to the static-mode `/__packages` SSE channel for live reload. */
2965
4107
  liveReload?: boolean;
2966
4108
  };
2967
4109
  type PHRenownRainbowAdapterConfig = {
2968
- /** WalletConnect project id; required for the rainbow adapter to function. */walletConnectProjectId?: string; /** Optional Infura project id used to build RPC transports. */
4110
+ /** WalletConnect project id; required for the rainbow adapter to function. */
4111
+ walletConnectProjectId?: string;
4112
+ /** Optional Infura project id used to build RPC transports. */
2969
4113
  infuraProjectId?: string;
2970
4114
  };
2971
4115
  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. */
4116
+ /** Privy application id; required for the privy adapter to function. */
4117
+ appId?: string;
4118
+ /** Optional Privy client id. */
4119
+ clientId?: string;
4120
+ /** Login methods this adapter offers; defaults per adapter when omitted. */
2974
4121
  methods?: string[];
2975
4122
  };
2976
4123
  type PHConnectRenownAdapters = {
@@ -2980,30 +4127,56 @@ type PHConnectRenownAdapters = {
2980
4127
  type PHConnectRenown = {
2981
4128
  url?: string;
2982
4129
  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. */
4130
+ chainId?: number;
4131
+ /** Renown localStorage namespace; share it across Connects to share login. */
4132
+ namespace?: string;
4133
+ /** Switchboard GraphQL URL; when set, enables in-page (no-redirect) auth. */
4134
+ switchboardUrl?: string;
4135
+ /** Per-adapter wallet config; presence of a key enables that adapter. */
2986
4136
  adapters?: PHConnectRenownAdapters;
2987
4137
  };
2988
4138
  type PHConnectSentry = {
2989
- /** Sentry DSN URL. `null` disables Sentry entirely. */dsn?: string | null; /** Sentry environment label. */
2990
- env?: string; /** Enable Sentry performance tracing. */
4139
+ /** Sentry DSN URL. `null` disables Sentry entirely. */
4140
+ dsn?: string | null;
4141
+ /** Sentry environment label. */
4142
+ env?: string;
4143
+ /** Enable Sentry performance tracing. */
2991
4144
  tracing?: boolean;
2992
4145
  };
4146
+ type PHConnectOpenPanel = {
4147
+ /** OpenPanel client id. Empty string (the default) disables OpenPanel. */
4148
+ clientId?: string;
4149
+ /** OpenPanel API URL, for self-hosted instances. */
4150
+ apiUrl?: string;
4151
+ /** Track UI events. */
4152
+ trackUiEvents?: boolean;
4153
+ /** Track document operations. */
4154
+ trackOperations?: boolean;
4155
+ };
2993
4156
  type PHConnectInstance = {
2994
4157
  namespace: string | null;
2995
4158
  reactorWorker: boolean;
4159
+ /** Routes through the in-browser reactor plus remote backends. Off by default. */
4160
+ multiReactor?: boolean;
2996
4161
  };
2997
4162
  /** Each flag implies its predecessors, and must match the fleet Connect syncs
2998
4163
  * with or the two compute different replay outcomes. */
2999
4164
  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. */
4165
+ /** Decide writes from the document stream instead of the meta cache. */
4166
+ documentDecisions?: boolean;
4167
+ /** Enforce the auth scope's policy at admission, replay, and read. */
4168
+ authEnforcement?: boolean;
4169
+ /** Let `{ group }` principals match, via the group documents' rosters. */
4170
+ authGroups?: boolean;
4171
+ /** Evaluate `where` / `match` conditions on grants. */
3003
4172
  authConditions?: boolean;
3004
4173
  };
3005
4174
  type PHConnectReactor = {
3006
4175
  featureFlags?: PHConnectReactorFeatureFlags;
4176
+ /** What new documents are created as; `legacy` while peers predate v2-required documents. */
4177
+ createSignaturePolicy?: "legacy" | "v2-required";
4178
+ /** Stored documents at protocol versions this build does not run: refuse to boot, or keep them read-only. */
4179
+ unsupportedStoredDocuments?: "refuse" | "read-only";
3007
4180
  };
3008
4181
  /**
3009
4182
  * A URL-matching pattern for a service-worker runtime-caching rule, in
@@ -3052,7 +4225,9 @@ type PHConnectPwaIcon = {
3052
4225
  * at Connect's app root, injected at build time.
3053
4226
  */
3054
4227
  type PHConnectPwaFileHandler = {
3055
- /** MIME type → file extensions (each must start with "."). */accept: Record<string, string[]>; /** OS-level file-type icons. */
4228
+ /** MIME type → file extensions (each must start with "."). */
4229
+ accept: Record<string, string[]>;
4230
+ /** OS-level file-type icons. */
3056
4231
  icons?: PHConnectPwaIcon[];
3057
4232
  launch_type?: "single-client" | "multiple-clients";
3058
4233
  };
@@ -3066,8 +4241,10 @@ type PHConnectPwaManifest = {
3066
4241
  display?: "fullscreen" | "standalone" | "minimal-ui" | "browser";
3067
4242
  start_url?: string;
3068
4243
  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. */
4244
+ icons?: PHConnectPwaIcon[];
4245
+ /** Extra file associations, appended after Connect's built-in `.phd`/`.phdm` handler. */
4246
+ file_handlers?: PHConnectPwaFileHandler[];
4247
+ /** How the OS launches the app for handled files/links. */
3071
4248
  launch_handler?: {
3072
4249
  client_mode: "auto" | "focus-existing" | "navigate-existing" | "navigate-new";
3073
4250
  };
@@ -3087,11 +4264,16 @@ type PHConnectPwaManifest = {
3087
4264
  * Precedence: defaults < package fragments < project config.
3088
4265
  */
3089
4266
  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. */
4267
+ manifest?: PHConnectPwaManifest;
4268
+ /** Extra Workbox precache globs, unioned with the built-in patterns. */
4269
+ globPatterns?: string[];
4270
+ /** Extra Workbox precache ignore globs, unioned with the built-in list. */
4271
+ globIgnores?: string[];
4272
+ /** Raise the precache file-size ceiling; the max across contributors wins. */
4273
+ maximumFileSizeToCacheInBytes?: number;
4274
+ /** Additional runtime-caching rules, appended after the built-in rules. */
4275
+ runtimeCaching?: PHConnectPwaRuntimeCaching[];
4276
+ /** Extra SPA-fallback denylist patterns, unioned with the built-in list. */
3095
4277
  navigateFallbackDenylist?: PHConnectPwaUrlPattern[];
3096
4278
  };
3097
4279
  type PHConnectRuntimeConfig = {
@@ -3102,6 +4284,7 @@ type PHConnectRuntimeConfig = {
3102
4284
  drives?: PHConnectDrives;
3103
4285
  renown?: PHConnectRenown;
3104
4286
  sentry?: PHConnectSentry;
4287
+ openPanel?: PHConnectOpenPanel;
3105
4288
  instance?: PHConnectInstance;
3106
4289
  reactor?: PHConnectReactor;
3107
4290
  pwa?: PHConnectPwa;
@@ -3110,8 +4293,10 @@ type PHConnectRuntimeConfig = {
3110
4293
  type PHReactorRenown = {
3111
4294
  /** "self" reads this reactor's own renown read model; "remote" (default)
3112
4295
  * 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. */
4296
+ source?: "remote" | "self";
4297
+ /** Renown base URL; also the instance this reactor's own identity uses. */
4298
+ url?: string;
4299
+ /** Switchboard GraphQL endpoint to read credentials from directly. */
3115
4300
  switchboardUrl?: string;
3116
4301
  };
3117
4302
  type PowerhouseConfig = {
@@ -3159,9 +4344,13 @@ type PowerhouseConfig = {
3159
4344
  driveUrl?: string;
3160
4345
  connectPort?: number;
3161
4346
  };
4347
+ workflows?: {
4348
+ enabled?: boolean;
4349
+ };
3162
4350
  packageRegistryUrl?: string;
3163
4351
  connect?: PHConnectRuntimeConfig;
3164
4352
  };
3165
4353
  //#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
4354
+ export { AddOperationErrorInput as $, HashAlgorithms as $a, PurgeMarkerOperation as $c, moveGrant as $d, reorderModuleOperations as $f, SetOperationErrorTemplateInput as $i, UpgradeManifest as $l, protocolVersionsFor as $m, MutationMoveOperationArgs as $n, assertOperationExampleIdUnique as $o, isNoopOperation as $p, RemoveRelationshipActionInput as $r, ReorderOperationErrorsInputSchema as $s, DocumentModelOperationExampleAction as $t, AuthAdministrationLockoutError as $u, PHPackageProvider as A, UndoAction as Aa, UndoActionInputSchema as Ac, MAX_SUPPORTED_AUTH_VERSION as Ad, addOperationError as Af, SetModelDescriptionInput as Ai, createVerificationSigner as Al, Principal as Am, MakeEmpty as An, RouteHandler as Ao, verifyOperationSignature as Ap, MutationUpdateStateExampleArgs as Ar, DeleteStateExampleInputSchema as As, DeleteOperationErrorAction as At, AUTH_DENIED_BY_GRANT_REASON as Au, ServiceActions as B, UpdateStateExampleInput as Ba, documentModelOperationErrorReducer as Bc, applyAuthAction as Bd, deleteOperationError as Bf, SetModuleNameInput as Bi, createZip as Bl, defaultDocumentState as Bm, Mutation as Bn, WebhookPolicy as Bo, baseReducerVersion as Bp, PieceModule as Br, OperationSpecificationSchema as Bs, DocumentModelDocumentModelModule as Bt, bytesToBase64Url as Bu, PHConnectPwaUrlPattern as C, SigningParameters as Ca, SetOperationTemplateInputSchema as Cc, AuthRequest as Cd, actionContext as Cf, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as Ch, SetAuthorNameAction as Ci, peerSupports as Cl, Condition as Cm, ISigner as Cn, IWebhookScope as Co, setOperationTemplate as Cp, MutationSetOperationReducerArgs as Cr, ConfigEntrySchema as Cs, DeleteChildDocumentInput as Ct, DocumentModelHeaderSchema as Cu, PHConnectRenownAdapters as D, StateReducer as Da, Set_NameSchema as Dc, InitializeAuthAction as Dd, addChangeLogItem as Df, SetInitialStateAction as Di, createPresignedHeader as Dl, PHBaseState as Dm, IsStateOfType as Dn, RouteAuthorizer as Do, updateChangeLogItem as Dp, MutationUndoArgs as Dr, DeleteOperationErrorInputSchema as Ds, DeleteModuleAction as Dt, assertIsDocumentModelState as Du, PHConnectRenown as E, State as Ea, SetStateSchemaInputSchema as Ec, ConditionContext as Ed, actions as Ef, SetAuthorWebsiteInput as Ei, createCopyHeader as El, PHAuthState as Em, IsDocumentOfType as En, RouteAuth as Eo, undo as Ep, MutationSetStateSchemaArgs as Er, DeleteModuleInputSchema as Es, DeleteDocumentActionInput as Et, assertIsDocumentModelDocument as Eu, ParsedCmdResult as F, UpdateOperationExampleAction as Fa, UpdateStateExampleInputSchema as Fc, RemoveGrantActionInput as Fd, buildSignedAction as Ff, SetModelNameAction as Fi, BulkArchiveEntry as Fl, createGlobalState as Fm, Maybe as Fn, RouteUser as Fo, PHDocumentMeta as Fp, OperationsByScope as Fr, ManifestSchema as Fs, DeleteStateExampleAction as Ft, ab2hex as Fu, ActionVerificationHandler as G, createNamespacedDb as Ga, documentModelStateSchemaReducer as Gc, assertAuthPreservedOnDuplicate as Gd, noop as Gf, SetOperationDescriptionInput as Gi, isDocumentZip as Gl, DocumentIdParams as Gm, MutationAddOperationExampleArgs as Gn, WebhookSpec as Go, filterDuplicatedOperations as Gp, Query as Gr, PublisherSchema as Gs, DocumentModelLib as Gt, HASH_ALGORITHM_SHA256 as Gu, ActionErrorCallback as H, UpgradeDocumentActionInput as Ha, documentModelOperationReducer as Hc, applyMoveGrantAction as Hd, deleteStateExample as Hf, SetNameActionInput as Hi, documentModelSaveToFileHandle as Hl, defaultLocalState as Hm, MutationAddModuleArgs as Hn, WebhookRequest as Ho, checkOperationsIntegrity as Hp, Publisher as Hr, PieceModulesSchema as Hs, DocumentModelHeaderAction as Ht, hashBrowser as Hu, PathValidation as I, UpdateOperationExampleInput as Ia, definedNonNullAnySchema as Ic, RemoveGrantActionInputSchema as Id, createAction as If, SetModelNameInput as Ii, baseLoadFromInput as Il, createLocalState as Im, MinimalBackupData as In, ScopedRouteHandle as Io, addUndo as Ip, PartialRecord as Ir, ModuleSchema as Is, DeleteStateExampleInput as It, base58Decode as Iu, AddChangeLogItemInput as J, hashNamespace as Ja, createReducer as Jc, evaluate as Jd, operationFromOperation as Jf, SetOperationErrorDescriptionAction as Ji, writeFileBrowser as Jl, SIGNATURE_PROTOCOL_V2 as Jm, MutationDeleteModuleArgs as Jn, OPERATION_NAME_PATTERN as Jo, garbageCollectV2 as Jp, RedoActionInput as Jr, RedoActionSchema as Js, DocumentModelModuleAction as Jt, HASH_ENCODING_HEX as Ju, Actions as K, createNamespacedQueryBuilder as Ka, documentModelVersioningReducer as Kc, assertAuthScopeActionAllowed as Kd, operationExampleCreators as Kf, SetOperationErrorCodeAction as Ki, parseBulkArchive as Kl, ProtocolVersions as Km, MutationAddStateExampleArgs as Kn, WebhookVerification as Ko, garbageCollect as Kp, Redo as Kr, PwaConfigSchema as Ks, DocumentModelLocalState as Kt, HASH_ALGORITHM_SHA512 as Ku, PowerhouseConfig as L, UpdateRelationshipAction as La, isDefinedNonNullAny as Lc, SetGrantAction as Ld, deleteChangeLogItem as Lf, SetModuleDescriptionAction as Li, baseLoadFromInputVersioned as Ll, createState as Lm, ModuleSpecification as Ln, WebhookEndpointInfo as Lo, appendWithoutApplying as Lp, PartialState as Lr, MoveOperationInputSchema as Ls, DocumentAction as Lt, base64UrlToBytes as Lu, PHRenownPrivyAdapterConfig as M, UndoRedoAction as Ma, UndoSchema as Mc, MoveGrantActionInput as Md, addStateExample as Mf, SetModelExtensionInput as Mi, sign as Ml, createAuthState as Mm, MakeOptional as Mn, RouteOptions as Mo, IntegrityIssueType as Mp, OperationErrorSpecification as Mr, DocumentModelGlobalStateSchema as Ms, DeleteOperationExampleAction as Mt, AUTH_VERSION_UNSUPPORTED_REASON as Mu, PHRenownRainbowAdapterConfig as N, UpdateChangeLogItemAction as Na, UpdateChangeLogItemInputSchema as Nc, MoveGrantActionInputSchema as Nd, baseActions as Nf, SetModelIdAction as Ni, validateHeader as Nl, createBaseState as Nm, Manifest as Nn, RouteSpec as No, PHDocument as Np, OperationIndex as Nr, DocumentModelInputSchema as Ns, DeleteOperationExampleInput as Nt, DOCUMENT_DELETED_REASON as Nu, PHConnectRuntimeConfig as O, SubgraphModule as Oa, Set_PreferredEditorSchema as Oc, InitializeAuthActionInput as Od, addModule as Of, SetInitialStateInput as Oi, createSignedHeader as Ol, PHDocumentState as Om, LoadFromFile as On, RouteBody as Oo, updateOperationExample as Op, MutationUpdateChangeLogItemInputArgs as Or, DeleteOperationExampleInputSchema as Os, DeleteModuleInput as Ot, isDocumentModelDocument as Ou, PackageManagerArgs as P, UpdateChangeLogItemInput as Pa, UpdateOperationExampleInputSchema as Pc, RemoveGrantAction as Pd, buildOperationSignature as Pf, SetModelIdInput as Pi, verify as Pl, createDocumentState as Pm, MappedOperation as Pn, RouteTransport as Po, PHDocumentHeader as Pp, OperationSpecification as Pr, DocumentSpecificationSchema as Ps, DeleteOperationInput as Pt, isDenied as Pu, AddOperationErrorAction as Q, ExtractProcessorSchemaOrSelf as Qa, PURGE_DOCUMENT as Qc, mentionedGroupIds as Qd, reorderChangeLogItems as Qf, SetOperationErrorTemplateAction as Qi, replayDocumentVersioned as Ql, isSignaturePolicy as Qm, MutationDeleteStateExampleArgs as Qn, assertOperationErrorIdUnique as Qo, isDocumentAction as Qp, RemoveRelationshipAction as Qr, ReorderModulesInputSchema as Qs, DocumentModelOperationErrorOperations as Qt, documentModelInitialLocalState as Qu, PowerhousePackage as R, UpdateRelationshipActionInput as Ra, documentModelHeaderReducer as Rc, SetGrantActionInput as Rd, deleteModule as Rf, SetModuleDescriptionInput as Ri, baseSaveToFileHandle as Rl, defaultAuthState as Rm, MoveOperationAction as Rn, WebhookField as Ro, attachBranch as Rp, PhAiToolAnnotations as Rr, OperationErrorSchema as Rs, DocumentModelAction as Rt, buildOperationSignatureMessage as Ru, PHConnectPwaRuntimeCaching as S, SignatureVerificationHandler as Sa, SetOperationScopeInputSchema as Sc, AuthRefusal as Sd, ActionContext as Sf, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Sh, ScopeState as Si, mergePeerCapabilities as Sl, Capability as Sm, ISignalResult as Sn, IWebhookEndpoints as So, setOperationScope as Sp, MutationSetOperationNameArgs as Sr, CodeExampleSchema as Ss, DeleteChangeLogItemInput as St, BaseDocumentStateSchema as Su, PHConnectReactorFeatureFlags as T, SkipHeaderOperations as Ta, SetPreferredEditorActionSchema as Tc, AuthVerb as Td, actionSigner as Tf, SetAuthorWebsiteAction as Ti, selectProtocolVersions as Tl, Operand as Tm, InputMaybe as Tn, RouteActor as To, setStateSchema as Tp, MutationSetOperationTemplateArgs as Tr, DeleteChangeLogItemInputSchema as Ts, DeleteDocumentAction as Tt, DocumentModelSchema as Tu, ActionSignatureContext as U, User as Ua, documentModelReducer as Uc, applyRemoveGrantAction as Ud, documentModelActions as Uf, SetNameOperation as Ui, fetchFileBrowser as Ul, defaultPHState as Um, MutationAddOperationArgs as Un, WebhookScheme as Uo, diffOperations as Up, PurgeDocumentAction as Ur, PowerhouseModuleSchema as Us, DocumentModelHeaderOperations as Ut, hex2ab as Uu, DEFAULT_REGISTRY_URL as V, UpgradeDocumentAction as Va, documentModelOperationExampleReducer as Vc, applyInitializeAuthAction as Vd, deleteOperationExample as Vf, SetNameAction as Vi, documentModelLoadFromInput as Vl, defaultGlobalState as Vm, MutationAddChangeLogItemInputArgs as Vn, WebhookReply as Vo, checkCleanedOperationsIntegrity as Vp, PowerhouseModule as Vr, PieceModuleSchema as Vs, DocumentModelGlobalState as Vt, getUnixTimestamp as Vu, ActionSigningHandler as W, ValidationError as Wa, documentModelStateReducer as Wc, applySetGrantAction as Wd, moveOperation as Wf, SetOperationDescriptionAction as Wi, getFileBrowser as Wl, DEFAULT_SIGNATURE_POLICY as Wm, MutationAddOperationErrorArgs as Wn, WebhookSignatureEncoding as Wo, filterDocumentOperationsResultingState as Wp, PurgeDocumentActionInput as Wr, PowerhouseModulesSchema as Ws, DocumentModelInput as Wt, HASH_ALGORITHM_SHA1 as Wu, AddModuleInput as X, relationalDbToQueryBuilder as Xa, replayOperations as Xc, isAuthAction as Xd, redo as Xf, SetOperationErrorNameAction as Xi, VersionedReducers as Xl, deriveDocumentId as Xm, MutationDeleteOperationErrorArgs as Xn, ReservedOperationName as Xo, groupOperationsByScope as Xp, ReducerOptions as Xr, ReorderChangeLogItemsInputSchema as Xs, DocumentModelOperationAction as Xt, documentModelGlobalState as Xu, AddModuleAction as Y, namespaceSchemaOf as Ya, processUndoRedo as Yc, initializeAuth as Yd, operationWithContext as Yf, SetOperationErrorDescriptionInput as Yi, zipEntries as Yl, SignaturePolicy$1 as Ym, MutationDeleteOperationArgs as Yn, RESERVED_OPERATION_NAMES as Yo, getDocumentLastModified as Yp, Reducer as Yr, RedoSchema as Ys, DocumentModelModuleOperations as Yt, documentModelFileExtension as Yu, AddOperationAction as Z, DOCUMENT_ID_COLUMNS as Za, updateDocument as Zc, isDocumentCreator as Zd, releaseNewVersion as Zf, SetOperationErrorNameInput as Zi, VersionedReplayConfig as Zl, isDerivedDocumentId as Zm, MutationDeleteOperationExampleArgs as Zn, assertModuleIdUnique as Zo, hashDocumentStateForScope as Zp, ReleaseNewVersionAction as Zr, ReorderModuleOperationsInputSchema as Zs, DocumentModelOperationErrorAction as Zt, documentModelInitialGlobalState as Zu, PHConnectPwa as _, Signal as _a, SetOperationErrorNameInputSchema as _c, referencedGroupIds as _d, isV2ActionHash as _f, PHDocumentSignatureInfo as _h, SchemaNOOPAction as _i, isOlderManifest as _l, sortOperations as _m, IAction as _n, ProcessorRecord as _o, setOperationErrorName as _p, MutationSetOperationDescriptionArgs as _r, AddOperationErrorInputSchema as _s, CreateDocument as _t, UnsupportedDocumentModelVersionError as _u, PHConnectAi as a, SetOperationSchemaInput as aa, SetInitialStateInputSchema as ac, MAX_CAPABILITY_OPERATIONS as ad, TransportSigner as af, OperationContext as ah, ReorderModulesInput as ai, FeatureCapability as al, nextSkipNumber as am, DocumentModelUtils as an, RelationalDbProcessor as ao, setAuthorWebsite as ap, MutationReorderOperationExamplesArgs as ar, getAllOperationNames as as, AddStateExampleAction as at, withProtocolVersions as au, PHConnectPwaIcon as b, SignalResults as ba, SetOperationReducerInputSchema as bc, AuthDecision as bd, v2TupleProblem as bf, deserializeSignature as bh, SchemaSetPreferredEditorAction as bi, localSupports as bl, withSignaturePolicy as bm, IOperation as bn, AuthorizerResult as bo, setOperationReducer as bp, MutationSetOperationErrorNameArgs as br, AddStateExampleInputSchema as bs, CreateState as bt, groupMembershipActionTypes as bu, PHConnectDefaultDrive as c, SetOperationTemplateAction as ca, SetModelIdInputSchema as cc, assertAuthAdministrationRetained as cd, ActionSignerIdentity as cf, operationOutcome as ch, ReorderOperationExamplesAction as ci, PEER_CAPABILITIES as cl, precedes as cm, DocumentOperationsIgnoreMap as cn, IProcessorDispatch as co, setModelExtension as cp, MutationSetAuthorWebsiteArgs as cr, validateInitialState as cs, AssertIsStateOfType as ct, AuthInitializerNotCreatorError as cu, PHConnectDriveSection as d, SetPreferredEditorActionInput as da, SetModuleNameInputSchema as dc, assertValidInitialGrants as dd, DOCUMENT_SCOPE_ACTION_TYPES as df, setPreferredEditorOperation as dh, ReorderStateExamplesInput as di, PeerCapabilityFlags as dl, removeExistingOperations as dm, EditorDispatch as dn, ProcessorApp as do, setModuleDescription as dp, MutationSetModelExtensionArgs as dr, validateModules as ds, ConfigEntry as dt, FileSystemError as du, SetOperationNameAction as ea, ReorderOperationExamplesInputSchema as ec, AuthAdministrationMissingError as ed, removeGrant as ef, requestedSignaturePolicy as eh, ReorderChangeLogItemsAction as ei, isPurgeMarker as el, isUndo as em, DocumentModelOperationExampleOperations as en, IBaseRelationalDb as eo, reorderModules as ep, MutationRedoArgs as er, assertOperationIdUnique as es, AddOperationExampleAction as et, UpgradeReducer as eu, PHConnectDriveSections as f, SetPreferredEditorOperation as fa, SetNameActionInputSchema as fc, evaluateCondition as fd, actionPreimageV2 as ff, undoOperation as fh, ReplayDocumentOptions as fi, PeerManifest as fl, replayDocument as fm, EditorModule as fn, ProcessorApps as fo, setModuleName as fp, MutationSetModelIdArgs as fr, validateOperationName as fs, ConfigEntryType as ft, GrantNotFoundError as fu, PHConnectPackages as g, Set_PreferredEditor as ga, SetOperationErrorDescriptionInputSchema as gc, isPlainValue as gd, hashActionV2 as gf, HashConfig as gh, Scalars as gi, holdReason as gl, sortMappedOperations as gm, GetDocumentOptions as gn, ProcessorFilter as go, setOperationErrorDescription as gp, MutationSetNameArgs as gr, AddModuleInputSchema as gs, CreateChildDocumentSignal as gt, InvalidAuthVersionError as gu, PHConnectOpenPanel as h, Set_Name as ha, SetOperationErrorCodeInputSchema as hc, grantProblem as hd, canonicalJson as hf, AppActionSigner as hh, SaveToFileHandle as hi, coversLocal as hl, skipHeaderOperations as hm, FileInput as hn, ProcessorFactoryBuilder as ho, setOperationErrorCode as hp, MutationSetModuleNameArgs as hr, AddChangeLogItemInputSchema as hs, CreateChildDocumentInput as ht, InvalidActionInputZodError as hu, LogLevels as i, SetOperationSchemaAction as ia, SetAuthorWebsiteInputSchema as ic, MAX_AUTH_GRANTS as id, TransportActionContext as if, Operation as ih, ReorderModulesAction as ii, DOCUMENT_PURGE_PROTOCOL as il, merge as im, DocumentModelStateOperations as in, IRelationalQueryMethods as io, setAuthorName as ip, MutationReorderOperationErrorsArgs as ir, findOperationOrThrow as is, AddRelationshipActionInput as it, computeUpgradeTransitions as iu, PHReactorRenown as j, UndoActionInput as ja, UndoActionSchema as jc, MoveGrantAction as jd, addOperationExample as jf, SetModelExtensionAction as ji, hasDerivedDocumentId as jl, backfillAuthState as jm, MakeMaybe as jn, RouteMethod as jo, IntegrityIssueSubType as jp, NOOPAction as jr, DocumentActionSchema as js, DeleteOperationErrorInput as jt, AUTH_NO_GRANT_REASON as ju, PHConnectSentry as k, Undo as ka, StateSchema as kc, InitializeAuthActionInputSchema as kd, addOperation as kf, SetModelDescriptionAction as ki, createSignedHeaderForSigner as kl, PHGroupState as km, LoadFromInput as kn, RouteContext as ko, updateStateExample as kp, MutationUpdateOperationExampleArgs as kr, DeleteOperationInputSchema as ks, DeleteOperationAction as kt, isDocumentModelState as ku, PHConnectDefaultDriveLocal as l, SetOperationTemplateInput as la, SetModelNameInputSchema as lc, assertValidGrant as ld, ActionSigningTarget as lf, redoOperation as lh, ReorderOperationExamplesInput as li, PEER_MANIFEST_FORMAT as ll, prepareOperations as lm, DocumentSpecification as ln, IProcessorHostModuleBase as lo, setModelId as lp, MutationSetInitialStateArgs as lr, validateModule as ls, Author as lt, AuthPolicyNotPreservedError as lu, PHConnectInstance as m, SetStateSchemaInput as ma, SetOperationDescriptionInputSchema as mc, evaluateGrants as md, actionSigningTarget as mf, ActionSigner as mh, SaveToFile as mi, Supports as ml, reshuffleByTimestampAndIndex as mm, Exact as mn, ProcessorFactory as mo, setOperationDescription as mp, MutationSetModuleDescriptionArgs as mr, validateStateSchemaName as ms, CopyChildDocumentSignal as mt, InvalidActionInputError as mu, DrivePreserveStrategy as n, SetOperationReducerAction as na, ScopeStateSchema as nc, GroupPrincipalNotAllowedError as nd, setGrant as nf, v2RequiredProtocolVersions as nh, ReorderModuleOperationsAction as ni, purgeMarkerOperation as nl, mapSkippedOperations as nm, DocumentModelPHState as nn, IRelationalDbProcessor as no, reorderOperationExamples as np, MutationReorderModuleOperationsArgs as nr, findOperationErrorOrThrow as ns, AddOperationInput as nt, applyDeleteDocumentAction as nu, PHConnectApp as o, SetOperationScopeAction as oa, SetModelDescriptionInputSchema as oc, MAX_CONDITION_DEPTH as od, toTransportAction as of, OperationOutcome as oh, ReorderOperationErrorsAction as oi, HoldReason as ol, operationsAreEqual as om, DocumentModelVersioningAction as on, RelationalDbProcessorClass as oo, setInitialState as op, MutationReorderStateExamplesArgs as or, isReservedOperationName as os, AddStateExampleInput as ot, AuthActionNotAllowedError as ou, PHConnectDrives as p, SetStateSchemaAction as pa, SetNameActionSchema as pc, evaluateGrantStack as pd, actionSignerIdentity as pf, undoOperationV2 as ph, RevisionsFilter as pi, ProtocolCapability as pl, reshuffleByTimestamp as pm, EditorProps as pn, ProcessorDispatchResult as po, setName as pp, MutationSetModelNameArgs as pr, validateOperations as ps, CopyChildDocumentInput as pt, HashMismatchError as pu, AddChangeLogItemAction as q, createRelationalDb as qa, baseReducer as qc, decide as qd, operationFromAction as qf, SetOperationErrorCodeInput as qi, readFileBrowser as ql, SIGNATURE_PROTOCOL as qm, MutationDeleteChangeLogItemInputArgs as qn, deletedDocumentId as qo, garbageCollectDocumentOperations as qp, RedoAction as qr, RedoActionInputSchema as qs, DocumentModelModule as qt, HASH_ENCODING_BASE64 as qu, LogLevel as r, SetOperationReducerInput as ra, SetAuthorNameInputSchema as rc, InvalidGrantError as rd, TransportAction as rf, DocumentOperations as rh, ReorderModuleOperationsInput as ri, purgedProtocolVersions as rl, mapSkippedOperationsV2 as rm, DocumentModelStateAction as rn, IRelationalQueryBuilder as ro, reorderStateExamples 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_NODES as sd, ACTION_SIGNATURE_V2_PREFIX as sf, OperationWithContext$1 as sh, ReorderOperationErrorsInput as si, MARKER_REFUSAL_FEATURE as sl, parseResultingState as sm, DocumentModelVersioningOperations as sn, IProcessor as so, setModelDescription as sp, MutationSetAuthorNameArgs as sr, isValidOperationNameFormat as ss, AssertIsDocumentOfType as st, AuthAlreadyInitializedError as su, DrivePreserveStrategies as t, SetOperationNameInput as ta, ReorderStateExamplesInputSchema as tc, GrantSchema as td, resolveSnapshotAuth as tf, signaturePolicyOf as th, ReorderChangeLogItemsInput as ti, purgeDocumentAction as tl, isUndoRedo as tm, DocumentModelOperationOperations as tn, IRelationalDb as to, reorderOperationErrors as tp, MutationReorderChangeLogItemsInputArgs as tr, findModuleOrThrow as ts, AddOperationExampleInput as tt, UpgradeTransition as tu, PHConnectDefaultDriveRemote as u, SetPreferredEditorAction as ua, SetModuleDescriptionInputSchema as uc, assertValidGrantUpsert as ud, CanonicalJsonError as uf, setNameOperation as uh, ReorderStateExamplesAction as ui, PeerCapability as ul, readOnly as um, ENSInfo as un, IProcessorManager as uo, setModelName as up, MutationSetModelDescriptionArgs as ur, validateModuleOperation as us, CodeExample as ut, DowngradeNotSupportedError as uu, PHConnectPwaCacheStrategy as v, SignalDispatch as va, SetOperationErrorTemplateInputSchema as vc, AUTH_ACTION_TYPES as vd, signActionV2 as vf, Signature as vh, SchemaRedoAction as vi, legacySupports as vl, split as vm, ID as vn, ProcessorStatus as vo, setOperationErrorTemplate as vp, MutationSetOperationErrorCodeArgs as vr, AddOperationExampleInputSchema as vs, CreateDocumentAction as vt, documentModelDocumentType as vu, PHConnectReactor as w, SkipHeaderOperationIndex as wa, SetPreferredEditorActionInputSchema as wc, AuthSubject as wd, actionFromAction as wf, PROCESSOR_APPS as wh, SetAuthorNameInput as wi, readPeerManifest as wl, Grant as wm, Incremental as wn, NodeRouteSpec as wo, setPreferredEditor as wp, MutationSetOperationSchemaArgs as wr, ConfigEntryTypeSchema as ws, DeleteChildDocumentSignal as wt, DocumentModelPHStateSchema as wu, PHConnectPwaManifest as x, SignalType as xa, SetOperationSchemaInputSchema as xc, AuthEvaluation as xd, Action as xf, serializeSignature as xh, SchemaUndoAction as xi, manifestRevision as xl, AuthGroups as xm, ISignal as xn, IHttpScope as xo, setOperationSchema as xp, MutationSetOperationErrorTemplateArgs as xr, AuthorSchema as xs, DeleteChangeLogItemAction as xt, BaseDocumentHeaderSchema as xu, PHConnectPwaFileHandler as y, SignalResult as ya, SetOperationNameInputSchema as yc, AuthAction as yd, targetDocumentId as yf, UserActionSigner as yh, SchemaSetNameAction as yi, localPeerManifest as yl, updateHeaderRevision as ym, IDocument as yn, TrackedProcessor as yo, setOperationName as yp, MutationSetOperationErrorDescriptionArgs as yr, AddOperationInputSchema as ys, CreateDocumentActionInput as yt, groupDocumentType as yu, ServiceAction as z, UpdateStateExampleAction as za, documentModelModuleReducer as zc, SetGrantActionInputSchema as zd, deleteOperation as zf, SetModuleNameAction as zi, createMinimalZip as zl, defaultBaseState as zm, MoveOperationInput as zn, WebhookHashAlgorithm as zo, baseCreateDocument as zp, PhAiToolDescriptor as zr, OperationScopeSchema as zs, DocumentModelDocument as zt, buildOperationSignatureParams as zu };
4355
+ export {};
4356
+ //# sourceMappingURL=types-DDH6v2BE.d.ts.map