@powerhousedao/shared 6.2.3-dev.7 → 6.2.3-dev.71
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.
- package/dist/analytics/index.d.ts +4 -4
- package/dist/analytics/index.d.ts.map +1 -1
- package/dist/analytics/index.js +25 -24
- package/dist/analytics/index.js.map +1 -1
- package/dist/clis/args/{access-token-To5LaIfL.mjs → access-token-3Hqv_U8I.mjs} +2 -2
- package/dist/clis/args/{access-token-To5LaIfL.mjs.map → access-token-3Hqv_U8I.mjs.map} +1 -1
- package/dist/clis/args/access-token-C5sKsH2O.d.mts +16 -0
- package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +1 -0
- package/dist/clis/args/access-token.d.mts +3 -2
- package/dist/clis/args/access-token.mjs +1 -1
- package/dist/clis/args/{common-CcYbXrBx.mjs → common-BXabdhiO.mjs} +30 -7
- package/dist/clis/args/common-BXabdhiO.mjs.map +1 -0
- package/dist/clis/args/common-Bnm859xU.d.mts +186 -0
- package/dist/clis/args/common-Bnm859xU.d.mts.map +1 -0
- package/dist/clis/args/common.d.mts +3 -2
- package/dist/clis/args/common.mjs +1 -1
- package/dist/clis/args/{connect-BVVvCmL9.mjs → connect-BLAht4dO.mjs} +9 -4
- package/dist/clis/args/connect-BLAht4dO.mjs.map +1 -0
- package/dist/clis/args/connect-DjeiqXus.d.mts +450 -0
- package/dist/clis/args/connect-DjeiqXus.d.mts.map +1 -0
- package/dist/clis/args/connect.d.mts +3 -2
- package/dist/clis/args/connect.mjs +1 -1
- package/dist/clis/args/dist-CorQTQL-.mjs +1533 -0
- package/dist/clis/args/dist-CorQTQL-.mjs.map +1 -0
- package/dist/clis/args/{generate-CA916Fvj.mjs → generate-BOItUNvP.mjs} +40 -2
- package/dist/clis/args/generate-BOItUNvP.mjs.map +1 -0
- package/dist/clis/args/generate-BPBBLeUD.d.mts +103 -0
- package/dist/clis/args/generate-BPBBLeUD.d.mts.map +1 -0
- package/dist/clis/args/generate.d.mts +3 -2
- package/dist/clis/args/generate.mjs +1 -1
- package/dist/clis/args/{help-Bqbgbalu.mjs → help-Dejwe6Bz.mjs} +43 -16
- package/dist/clis/args/help-Dejwe6Bz.mjs.map +1 -0
- package/dist/clis/args/help-KuqI-EEG.d.mts +203 -0
- package/dist/clis/args/help-KuqI-EEG.d.mts.map +1 -0
- package/dist/clis/args/help.d.mts +3 -2
- package/dist/clis/args/help.mjs +1 -1
- package/dist/clis/args/index.d.mts +20 -19
- package/dist/clis/args/index.mjs +18 -18
- package/dist/clis/args/init-CTaK80wE.d.mts +55 -0
- package/dist/clis/args/init-CTaK80wE.d.mts.map +1 -0
- package/dist/clis/args/{init-rz9Ei7nq.mjs → init-xlCNZ8Oe.mjs} +7 -2
- package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-xlCNZ8Oe.mjs.map} +1 -1
- package/dist/clis/args/init.d.mts +3 -2
- package/dist/clis/args/init.mjs +1 -1
- package/dist/clis/args/inspect-BjRmtB86.d.mts +13 -0
- package/dist/clis/args/inspect-BjRmtB86.d.mts.map +1 -0
- package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-UNQgtuR0.mjs} +2 -2
- package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-UNQgtuR0.mjs.map} +1 -1
- package/dist/clis/args/inspect.d.mts +3 -2
- package/dist/clis/args/inspect.mjs +1 -1
- package/dist/clis/args/install-B0tMyUMw.d.mts +37 -0
- package/dist/clis/args/install-B0tMyUMw.d.mts.map +1 -0
- package/dist/clis/args/{install-Sz2DlCHh.mjs → install-F-27kF6m.mjs} +2 -2
- package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-F-27kF6m.mjs.map} +1 -1
- package/dist/clis/args/install.d.mts +3 -2
- package/dist/clis/args/install.mjs +1 -1
- package/dist/clis/args/{list-DM2d6f1m.mjs → list-Bkfn8Yuo.mjs} +2 -2
- package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-Bkfn8Yuo.mjs.map} +1 -1
- package/dist/clis/args/list-DrbxA7JJ.d.mts +10 -0
- package/dist/clis/args/list-DrbxA7JJ.d.mts.map +1 -0
- package/dist/clis/args/list.d.mts +3 -2
- package/dist/clis/args/list.mjs +1 -1
- package/dist/clis/args/{login-DiKT5Jfu.mjs → login-CIFkQExi.mjs} +2 -2
- package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-CIFkQExi.mjs.map} +1 -1
- package/dist/clis/args/login-CXRJXg71.d.mts +25 -0
- package/dist/clis/args/login-CXRJXg71.d.mts.map +1 -0
- package/dist/clis/args/login.d.mts +3 -2
- package/dist/clis/args/login.mjs +1 -1
- package/dist/clis/args/migrate-DkCQRL2D.d.mts +19 -0
- package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +1 -0
- package/dist/clis/args/{migrate-CG_gWc4k.mjs → migrate-DwJGhc2d.mjs} +2 -2
- package/dist/clis/args/{migrate-CG_gWc4k.mjs.map → migrate-DwJGhc2d.mjs.map} +1 -1
- package/dist/clis/args/migrate.d.mts +3 -2
- package/dist/clis/args/migrate.mjs +1 -1
- package/dist/clis/args/publish-CeW4bOrl.d.mts +16 -0
- package/dist/clis/args/publish-CeW4bOrl.d.mts.map +1 -0
- package/dist/clis/args/{publish-DDZYsUfV.mjs → publish-DHqlGWmL.mjs} +2 -2
- package/dist/clis/args/{publish-DDZYsUfV.mjs.map → publish-DHqlGWmL.mjs.map} +1 -1
- package/dist/clis/args/publish.d.mts +3 -2
- package/dist/clis/args/publish.mjs +1 -1
- package/dist/clis/args/{registry-C_OVFQmI.mjs → registry-DIwES3l2.mjs} +2 -2
- package/dist/clis/args/{registry-C_OVFQmI.mjs.map → registry-DIwES3l2.mjs.map} +1 -1
- package/dist/clis/args/registry-DNH8xuaE.d.mts +17 -0
- package/dist/clis/args/registry-DNH8xuaE.d.mts.map +1 -0
- package/dist/clis/args/registry.d.mts +3 -2
- package/dist/clis/args/registry.mjs +1 -1
- package/dist/clis/args/run-l_LiMplO.mjs +28 -0
- package/dist/clis/args/run-l_LiMplO.mjs.map +1 -0
- package/dist/clis/args/run.d.mts +18 -0
- package/dist/clis/args/run.d.mts.map +1 -0
- package/dist/clis/args/run.mjs +2 -0
- package/dist/clis/args/{service-CHOOr0Gg.mjs → service-Cpjlyeu5.mjs} +2 -2
- package/dist/clis/args/{service-CHOOr0Gg.mjs.map → service-Cpjlyeu5.mjs.map} +1 -1
- package/dist/clis/args/service-DiTFThbn.d.mts +27 -0
- package/dist/clis/args/service-DiTFThbn.d.mts.map +1 -0
- package/dist/clis/args/service.d.mts +3 -2
- package/dist/clis/args/service.mjs +1 -1
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs → switchboard-CCaAtU56.mjs} +2 -2
- package/dist/clis/args/{switchboard-Dsp7nosi.mjs.map → switchboard-CCaAtU56.mjs.map} +1 -1
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts +70 -0
- package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +1 -0
- package/dist/clis/args/switchboard.d.mts +3 -2
- package/dist/clis/args/switchboard.mjs +1 -1
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs → uninstall-3U0B8g5c.mjs} +2 -2
- package/dist/clis/args/{uninstall-CTwTX0u_.mjs.map → uninstall-3U0B8g5c.mjs.map} +1 -1
- package/dist/clis/args/uninstall-CDx7lwxn.d.mts +28 -0
- package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +1 -0
- package/dist/clis/args/uninstall.d.mts +3 -2
- package/dist/clis/args/uninstall.mjs +1 -1
- package/dist/clis/args/unpublish-CEDsk6uv.d.mts +22 -0
- package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +1 -0
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs → unpublish-s9zUh6Gw.mjs} +2 -2
- package/dist/clis/args/{unpublish-BPMkGEg5.mjs.map → unpublish-s9zUh6Gw.mjs.map} +1 -1
- package/dist/clis/args/unpublish.d.mts +3 -2
- package/dist/clis/args/unpublish.mjs +1 -1
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs → vetra-BUNlAAPp.mjs} +2 -2
- package/dist/clis/args/{vetra-b4KUu1Ax.mjs.map → vetra-BUNlAAPp.mjs.map} +1 -1
- package/dist/clis/args/vetra-DkDaWFPi.d.mts +111 -0
- package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +1 -0
- package/dist/clis/args/vetra-ports.test.d.mts +2 -1
- package/dist/clis/args/vetra-ports.test.mjs +7366 -5728
- package/dist/clis/args/vetra-ports.test.mjs.map +1 -1
- package/dist/clis/args/vetra.d.mts +3 -2
- package/dist/clis/args/vetra.mjs +1 -1
- package/dist/clis/build-config-tJhHVdPm.mjs +277 -0
- package/dist/clis/build-config-tJhHVdPm.mjs.map +1 -0
- package/dist/clis/build-config.d.mts +56 -10616
- package/dist/clis/build-config.d.mts.map +1 -1
- package/dist/clis/build-config.mjs +2 -88
- package/dist/clis/build-pieces.d.mts +160 -0
- package/dist/clis/build-pieces.d.mts.map +1 -0
- package/dist/clis/build-pieces.mjs +549 -0
- package/dist/clis/build-pieces.mjs.map +1 -0
- package/dist/clis/command-names.d.mts +2 -2
- package/dist/clis/command-names.d.mts.map +1 -1
- package/dist/clis/command-names.mjs +1 -0
- package/dist/clis/command-names.mjs.map +1 -1
- package/dist/clis/constants.d.mts +3 -462
- package/dist/clis/constants.mjs +46 -13
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/feature-flags.d.mts +17 -0
- package/dist/clis/feature-flags.d.mts.map +1 -0
- package/dist/clis/feature-flags.mjs +21 -0
- package/dist/clis/feature-flags.mjs.map +1 -0
- package/dist/clis/index-DnZYG-8g.d.mts +11154 -0
- package/dist/clis/index-DnZYG-8g.d.mts.map +1 -0
- package/dist/clis/index.d.mts +3390 -1963
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +1052 -854
- package/dist/clis/index.mjs.map +1 -1
- package/dist/clis/package-style.d.mts +32 -0
- package/dist/clis/package-style.d.mts.map +1 -0
- package/dist/clis/package-style.mjs +102 -0
- package/dist/clis/package-style.mjs.map +1 -0
- package/dist/clis/ph-dir.d.mts +26 -0
- package/dist/clis/ph-dir.d.mts.map +1 -0
- package/dist/clis/ph-dir.mjs +37 -0
- package/dist/clis/ph-dir.mjs.map +1 -0
- package/dist/clis/project-env.d.mts +4 -4
- package/dist/clis/project-env.d.mts.map +1 -1
- package/dist/clis/project-env.mjs.map +1 -1
- package/dist/clis/project-ports.d.mts +5 -5
- package/dist/clis/project-ports.d.mts.map +1 -1
- package/dist/clis/project-ports.mjs +1 -1
- package/dist/clis/project-ports.mjs.map +1 -1
- package/dist/clis/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/clis/services/telemetry.d.mts +7 -7
- package/dist/clis/services/telemetry.d.mts.map +1 -1
- package/dist/clis/services/telemetry.mjs.map +1 -1
- package/dist/clis/types-DT6KawYx.d.mts +2317 -0
- package/dist/clis/types-DT6KawYx.d.mts.map +1 -0
- package/dist/clis/utils.d.mts +4 -4
- package/dist/clis/utils.d.mts.map +1 -1
- package/dist/clis/utils.mjs.map +1 -1
- package/dist/{config-loader-B845Hidf.js → config-loader-BWt0c0eU.js} +48 -11
- package/dist/config-loader-BWt0c0eU.js.map +1 -0
- package/dist/connect/config-loader.d.ts +21 -8
- package/dist/connect/config-loader.d.ts.map +1 -1
- package/dist/connect/config-loader.js +2 -2
- package/dist/connect/connect-config-schema.d.ts +3 -0
- package/dist/connect/connect-config-schema.js +445 -0
- package/dist/connect/connect-config-schema.js.map +1 -0
- package/dist/connect/image-ref.d.ts +32 -0
- package/dist/connect/image-ref.d.ts.map +1 -0
- package/dist/connect/image-ref.js +80 -0
- package/dist/connect/image-ref.js.map +1 -0
- package/dist/connect/index.d.ts +220 -643
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +432 -507
- package/dist/connect/index.js.map +1 -1
- package/dist/connect/json-adapter.d.ts +3 -4
- package/dist/connect/json-adapter.d.ts.map +1 -1
- package/dist/connect/json-adapter.js.map +1 -1
- package/dist/connect-config-schema-1-O1CQ4v.d.ts +1731 -0
- package/dist/connect-config-schema-1-O1CQ4v.d.ts.map +1 -0
- package/dist/constants-CcaK3k1D.d.ts +9 -0
- package/dist/constants-CcaK3k1D.d.ts.map +1 -0
- package/dist/constants.d.ts +3 -2
- package/dist/constants.js +15 -5
- package/dist/constants.js.map +1 -1
- package/dist/document-drive/index.d.ts +103 -101
- package/dist/document-drive/index.d.ts.map +1 -1
- package/dist/document-drive/index.js +40 -31
- package/dist/document-drive/index.js.map +1 -1
- package/dist/document-model/errors.d.ts +3 -0
- package/dist/document-model/errors.js +152 -0
- package/dist/document-model/errors.js.map +1 -0
- package/dist/document-model/index.d.ts +5 -4
- package/dist/document-model/index.js +298 -391
- package/dist/document-model/index.js.map +1 -1
- package/dist/document-model/mock.d.ts +2 -3
- package/dist/document-model/mock.d.ts.map +1 -1
- package/dist/document-model/mock.js +2 -1
- package/dist/document-model/mock.js.map +1 -1
- package/dist/document-model/utils.d.ts +3 -2
- package/dist/document-model/utils.js +1 -1
- package/dist/document-model/version.d.ts +3 -0
- package/dist/document-model/version.js +8 -0
- package/dist/document-model/version.js.map +1 -0
- package/dist/host-tokens/index.d.ts +3 -0
- package/dist/host-tokens/index.js +278 -0
- package/dist/host-tokens/index.js.map +1 -0
- package/dist/index-DIM6qtzj.d.ts +227 -0
- package/dist/index-DIM6qtzj.d.ts.map +1 -0
- package/dist/index-DvbhwImT.d.ts +36 -0
- package/dist/index-DvbhwImT.d.ts.map +1 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js.map +1 -1
- package/dist/processors/index.d.ts +3 -2
- package/dist/processors/index.js +63 -4
- package/dist/processors/index.js.map +1 -1
- package/dist/purge-v06m_oGz.js +381 -0
- package/dist/purge-v06m_oGz.js.map +1 -0
- package/dist/registry/index.d.ts +15 -15
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +25 -7
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +4 -3
- package/dist/registry/manifest-slim.d.ts.map +1 -1
- package/dist/registry/manifest-slim.js +21 -0
- package/dist/registry/manifest-slim.js.map +1 -1
- package/dist/registry/updates.d.ts +3 -3
- package/dist/registry/updates.d.ts.map +1 -1
- package/dist/registry/updates.js.map +1 -1
- package/dist/registry/urls.d.ts +2 -2
- package/dist/registry/urls.d.ts.map +1 -1
- package/dist/registry/urls.js.map +1 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/{types-CpnWmiFY.d.ts → types-BpO4LIKj.d.ts} +2149 -985
- package/dist/types-BpO4LIKj.d.ts.map +1 -0
- package/dist/{types-C1in4fl3.d.ts → types-Bsp8VL2y.d.ts} +2 -2
- package/dist/types-Bsp8VL2y.d.ts.map +1 -0
- package/dist/{types-YqLqb0Zb.d.ts → types-OXIqeH8W.d.ts} +39 -43
- package/dist/types-OXIqeH8W.d.ts.map +1 -0
- package/dist/{utils-DP122OSS.d.ts → utils-BrKxCmKx.d.ts} +2 -2
- package/dist/utils-BrKxCmKx.d.ts.map +1 -0
- package/dist/{utils-aaTmfxFW.js → utils-CSF716ux.js} +10 -3
- package/dist/utils-CSF716ux.js.map +1 -0
- package/dist/version-BxLITo9P.d.ts +6 -0
- package/dist/version-BxLITo9P.d.ts.map +1 -0
- package/package.json +28 -7
- package/dist/clis/args/access-token--9H57y8J.d.mts +0 -18
- package/dist/clis/args/access-token--9H57y8J.d.mts.map +0 -1
- package/dist/clis/args/common-CcYbXrBx.mjs.map +0 -1
- package/dist/clis/args/common-zPBoTNJF.d.mts +0 -183
- package/dist/clis/args/common-zPBoTNJF.d.mts.map +0 -1
- package/dist/clis/args/connect-BVVvCmL9.mjs.map +0 -1
- package/dist/clis/args/connect-BtU0MTTc.d.mts +0 -443
- package/dist/clis/args/connect-BtU0MTTc.d.mts.map +0 -1
- package/dist/clis/args/generate-CA916Fvj.mjs.map +0 -1
- package/dist/clis/args/generate-DnV-bfXt.d.mts +0 -87
- package/dist/clis/args/generate-DnV-bfXt.d.mts.map +0 -1
- package/dist/clis/args/help-Bqbgbalu.mjs.map +0 -1
- package/dist/clis/args/help-CjAsudUn.d.mts +0 -193
- package/dist/clis/args/help-CjAsudUn.d.mts.map +0 -1
- package/dist/clis/args/init-CUXyfquF.d.mts +0 -55
- package/dist/clis/args/init-CUXyfquF.d.mts.map +0 -1
- package/dist/clis/args/inspect-DtZeoA5c.d.mts +0 -15
- package/dist/clis/args/inspect-DtZeoA5c.d.mts.map +0 -1
- package/dist/clis/args/install-CkP8zcHb.d.mts +0 -40
- package/dist/clis/args/install-CkP8zcHb.d.mts.map +0 -1
- package/dist/clis/args/list-BGf8s_gj.d.mts +0 -12
- package/dist/clis/args/list-BGf8s_gj.d.mts.map +0 -1
- package/dist/clis/args/login-DNsHwvqk.d.mts +0 -27
- package/dist/clis/args/login-DNsHwvqk.d.mts.map +0 -1
- package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs +0 -1013
- package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs.map +0 -1
- package/dist/clis/args/migrate-sixkWhxm.d.mts +0 -21
- package/dist/clis/args/migrate-sixkWhxm.d.mts.map +0 -1
- package/dist/clis/args/publish-Dqe5DUst.d.mts +0 -18
- package/dist/clis/args/publish-Dqe5DUst.d.mts.map +0 -1
- package/dist/clis/args/registry-C_RfTsKB.d.mts +0 -19
- package/dist/clis/args/registry-C_RfTsKB.d.mts.map +0 -1
- package/dist/clis/args/service-DhIkf8-O.d.mts +0 -22
- package/dist/clis/args/service-DhIkf8-O.d.mts.map +0 -1
- package/dist/clis/args/switchboard-BlPaq2at.d.mts +0 -72
- package/dist/clis/args/switchboard-BlPaq2at.d.mts.map +0 -1
- package/dist/clis/args/uninstall-BpA3YYbw.d.mts +0 -31
- package/dist/clis/args/uninstall-BpA3YYbw.d.mts.map +0 -1
- package/dist/clis/args/unpublish-CvwaIimG.d.mts +0 -24
- package/dist/clis/args/unpublish-CvwaIimG.d.mts.map +0 -1
- package/dist/clis/args/vetra-CoMvTJK7.d.mts +0 -113
- package/dist/clis/args/vetra-CoMvTJK7.d.mts.map +0 -1
- package/dist/clis/build-config.mjs.map +0 -1
- package/dist/clis/constants.d.mts.map +0 -1
- package/dist/config-loader-B845Hidf.js.map +0 -1
- package/dist/constants-BP_gjn8g.d.ts +0 -8
- package/dist/constants-BP_gjn8g.d.ts.map +0 -1
- package/dist/index-C_iVZe7f.d.ts +0 -7
- package/dist/index-C_iVZe7f.d.ts.map +0 -1
- package/dist/index-DyYIJtVy.d.ts +0 -836
- package/dist/index-DyYIJtVy.d.ts.map +0 -1
- package/dist/types-C1in4fl3.d.ts.map +0 -1
- package/dist/types-CpnWmiFY.d.ts.map +0 -1
- package/dist/types-YqLqb0Zb.d.ts.map +0 -1
- package/dist/utils-DP122OSS.d.ts.map +0 -1
- package/dist/utils-aaTmfxFW.js.map +0 -1
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { a as base58Decode, c as buildOperationSignatureParams, d as hex2ab, i as ab2hex, l as
|
|
1
|
+
import { a as base58Decode, c as buildOperationSignatureParams, d as hashBrowser, f as hex2ab, i as ab2hex, l as bytesToBase64Url, n as generateId, o as base64UrlToBytes, r as generateMock, s as buildOperationSignatureMessage, t as deriveOperationId, u as getUnixTimestamp } from "../utils-CSF716ux.js";
|
|
2
|
+
import { A as signActionV2, C as DOCUMENT_SCOPE_ACTION_TYPES, D as canonicalJson, E as actionSigningTarget, M as v2TupleProblem, O as hashActionV2, S as CanonicalJsonError, T as actionSignerIdentity, _ as mergePeerCapabilities, a as purgedProtocolVersions, b as selectProtocolVersions, c as PEER_CAPABILITIES, d as holdReason, f as isOlderManifest, g as manifestRevision, h as localSupports, i as purgeMarkerOperation, j as targetDocumentId, k as isV2ActionHash, l as PEER_MANIFEST_FORMAT, m as localPeerManifest, n as isPurgeMarker, o as DOCUMENT_PURGE_PROTOCOL, p as legacySupports, r as purgeDocumentAction, s as MARKER_REFUSAL_FEATURE, t as PURGE_DOCUMENT, u as coversLocal, v as peerSupports, w as actionPreimageV2, x as ACTION_SIGNATURE_V2_PREFIX, y as readPeerManifest } from "../purge-v06m_oGz.js";
|
|
3
|
+
import { AuthActionNotAllowedError, AuthAlreadyInitializedError, AuthInitializerNotCreatorError, AuthPolicyNotPreservedError, DowngradeNotSupportedError, FileSystemError, GrantNotFoundError, HashMismatchError, InvalidActionInputError, InvalidActionInputZodError, InvalidAuthVersionError, UnsupportedDocumentModelVersionError } from "./errors.js";
|
|
4
|
+
import { normalizeDocumentModelVersion } from "./version.js";
|
|
2
5
|
import { ZodError, z } from "zod";
|
|
3
6
|
import { stringify } from "safe-stable-stringify";
|
|
7
|
+
import { sha256 } from "@noble/hashes/sha2.js";
|
|
4
8
|
import { strFromU8, strToU8, unzip, zip } from "fflate";
|
|
5
|
-
import { castDraft, create, unsafe } from "mutative";
|
|
9
|
+
import { castDraft, create, isDraft, original, unsafe } from "mutative";
|
|
6
10
|
import { constantCase, pascalCase } from "change-case";
|
|
7
11
|
//#region document-model/signatures.ts
|
|
8
12
|
/**
|
|
@@ -105,160 +109,9 @@ function toTransportSignerApp(app) {
|
|
|
105
109
|
};
|
|
106
110
|
}
|
|
107
111
|
//#endregion
|
|
108
|
-
//#region document-model/errors.ts
|
|
109
|
-
const FileSystemError = /* @__PURE__ */ new Error("File system not available.");
|
|
110
|
-
var InvalidActionInputError = class extends Error {
|
|
111
|
-
data;
|
|
112
|
-
constructor(data) {
|
|
113
|
-
super();
|
|
114
|
-
this.name = "InvalidActionInputError";
|
|
115
|
-
this.data = data;
|
|
116
|
-
this.message = this.message || `Invalid action input: ${JSON.stringify(data, null, 2)}`;
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
var InvalidActionInputZodError = class extends InvalidActionInputError {
|
|
120
|
-
issues;
|
|
121
|
-
constructor(issues) {
|
|
122
|
-
super(issues);
|
|
123
|
-
this.issues = issues;
|
|
124
|
-
this.name = "InvalidActionInputZodError";
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Error thrown when attempting to downgrade a document version.
|
|
129
|
-
*/
|
|
130
|
-
var DowngradeNotSupportedError = class extends Error {
|
|
131
|
-
documentType;
|
|
132
|
-
fromVersion;
|
|
133
|
-
toVersion;
|
|
134
|
-
constructor(documentType, fromVersion, toVersion) {
|
|
135
|
-
super(`Downgrade not supported for ${documentType}: cannot upgrade from version ${fromVersion} to ${toVersion}`);
|
|
136
|
-
this.name = "DowngradeNotSupportedError";
|
|
137
|
-
this.documentType = documentType;
|
|
138
|
-
this.fromVersion = fromVersion;
|
|
139
|
-
this.toVersion = toVersion;
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Thrown when INITIALIZE_AUTH is applied to an already-initialized auth scope.
|
|
144
|
-
* The genesis action is valid only at auth revision zero.
|
|
145
|
-
*/
|
|
146
|
-
var AuthAlreadyInitializedError = class extends Error {
|
|
147
|
-
documentId;
|
|
148
|
-
constructor(documentId) {
|
|
149
|
-
super(`Auth scope already initialized for document ${documentId}: INITIALIZE_AUTH is valid only at auth revision zero`);
|
|
150
|
-
this.name = "AuthAlreadyInitializedError";
|
|
151
|
-
this.documentId = documentId;
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Thrown when INITIALIZE_AUTH is not signed by the document creator (its signer
|
|
156
|
-
* does not match `header.sig.publicKey`), so it cannot set the auth policy.
|
|
157
|
-
*/
|
|
158
|
-
var AuthInitializerNotCreatorError = class extends Error {
|
|
159
|
-
documentId;
|
|
160
|
-
constructor(documentId) {
|
|
161
|
-
super(`INITIALIZE_AUTH for document ${documentId} must be signed by the document creator`);
|
|
162
|
-
this.name = "AuthInitializerNotCreatorError";
|
|
163
|
-
this.documentId = documentId;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* Thrown when INITIALIZE_AUTH carries a version below 1. Version 0 is reserved
|
|
168
|
-
* for the uninitialized auth scope.
|
|
169
|
-
*/
|
|
170
|
-
var InvalidAuthVersionError = class extends Error {
|
|
171
|
-
documentId;
|
|
172
|
-
version;
|
|
173
|
-
constructor(documentId, version) {
|
|
174
|
-
super(`Invalid auth policy version ${version} for document ${documentId}: INITIALIZE_AUTH requires an integer version >= 1`);
|
|
175
|
-
this.name = "InvalidAuthVersionError";
|
|
176
|
-
this.documentId = documentId;
|
|
177
|
-
this.version = version;
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
/** Thrown when a duplicate would lose the source policy's version or creator binding. */
|
|
181
|
-
var AuthPolicyNotPreservedError = class extends Error {
|
|
182
|
-
documentId;
|
|
183
|
-
constructor(documentId) {
|
|
184
|
-
super(`Duplicating document ${documentId} would not preserve its auth policy: the copy loses the policy version or its creator binding`);
|
|
185
|
-
this.name = "AuthPolicyNotPreservedError";
|
|
186
|
-
this.documentId = documentId;
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
/**
|
|
190
|
-
* Thrown when a grant referenced by REMOVE_GRANT or MOVE_GRANT does not exist.
|
|
191
|
-
*/
|
|
192
|
-
var GrantNotFoundError = class extends Error {
|
|
193
|
-
grantId;
|
|
194
|
-
constructor(grantId) {
|
|
195
|
-
super(`Grant not found in auth scope: ${grantId}`);
|
|
196
|
-
this.name = "GrantNotFoundError";
|
|
197
|
-
this.grantId = grantId;
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
/**
|
|
201
|
-
* Thrown when a disallowed action (UNDO, REDO, PRUNE) targets the auth scope.
|
|
202
|
-
*/
|
|
203
|
-
var AuthActionNotAllowedError = class extends Error {
|
|
204
|
-
actionType;
|
|
205
|
-
constructor(actionType) {
|
|
206
|
-
super(`${actionType} is not permitted on the auth scope`);
|
|
207
|
-
this.name = "AuthActionNotAllowedError";
|
|
208
|
-
this.actionType = actionType;
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
var HashMismatchError = class extends Error {
|
|
212
|
-
_scope;
|
|
213
|
-
_document;
|
|
214
|
-
_operation;
|
|
215
|
-
constructor(scope, document, operation) {
|
|
216
|
-
super();
|
|
217
|
-
this.name = "HashMismatchError";
|
|
218
|
-
this._document = document;
|
|
219
|
-
this._scope = scope;
|
|
220
|
-
this._operation = operation;
|
|
221
|
-
this.message = JSON.stringify({
|
|
222
|
-
error: `Hash mismatch on document ${document.header.id}, scope ${scope}, index ${operation.index}`,
|
|
223
|
-
document,
|
|
224
|
-
operation
|
|
225
|
-
}, null, 1);
|
|
226
|
-
}
|
|
227
|
-
get document() {
|
|
228
|
-
return this._document;
|
|
229
|
-
}
|
|
230
|
-
get scope() {
|
|
231
|
-
return this._scope;
|
|
232
|
-
}
|
|
233
|
-
get operation() {
|
|
234
|
-
return this._operation;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* Thrown when replay or import requires a document model version that is not
|
|
239
|
-
* registered. Carries the data the UI needs to explain the mismatch.
|
|
240
|
-
*/
|
|
241
|
-
var UnsupportedDocumentModelVersionError = class extends Error {
|
|
242
|
-
documentType;
|
|
243
|
-
requiredVersion;
|
|
244
|
-
availableVersions;
|
|
245
|
-
constructor(documentType, requiredVersion, availableVersions) {
|
|
246
|
-
super(`No reducer registered for document version ${requiredVersion}. Available versions: ${availableVersions.join(", ")}`);
|
|
247
|
-
this.name = "UnsupportedDocumentModelVersionError";
|
|
248
|
-
this.documentType = documentType;
|
|
249
|
-
this.requiredVersion = requiredVersion;
|
|
250
|
-
this.availableVersions = availableVersions;
|
|
251
|
-
}
|
|
252
|
-
static isError(error) {
|
|
253
|
-
return Error.isError(error) && error.name === "UnsupportedDocumentModelVersionError";
|
|
254
|
-
}
|
|
255
|
-
};
|
|
256
|
-
//#endregion
|
|
257
112
|
//#region document-model/schemas.ts
|
|
258
113
|
const isDefinedNonNullAny = (v) => v !== void 0 && v !== null;
|
|
259
114
|
const definedNonNullAnySchema = z.any().refine((v) => isDefinedNonNullAny(v));
|
|
260
|
-
const Load_StateSchema = z.enum(["LOAD_STATE"]);
|
|
261
|
-
const PruneSchema = z.enum(["PRUNE"]);
|
|
262
115
|
const RedoSchema = z.enum(["REDO"]);
|
|
263
116
|
const Set_NameSchema = z.enum(["SET_NAME"]);
|
|
264
117
|
const Set_PreferredEditorSchema = z.enum(["SET_PREFERRED_EDITOR"]);
|
|
@@ -268,50 +121,12 @@ function OperationScopeSchema() {
|
|
|
268
121
|
}
|
|
269
122
|
function DocumentActionSchema() {
|
|
270
123
|
return z.union([
|
|
271
|
-
LoadStateActionSchema(),
|
|
272
|
-
PruneActionSchema(),
|
|
273
124
|
RedoActionSchema(),
|
|
274
125
|
SetNameActionSchema(),
|
|
275
126
|
SetPreferredEditorActionSchema(),
|
|
276
127
|
UndoActionSchema()
|
|
277
128
|
]);
|
|
278
129
|
}
|
|
279
|
-
function LoadStateActionSchema() {
|
|
280
|
-
return z.object({
|
|
281
|
-
id: z.string(),
|
|
282
|
-
timestampUtcMs: z.string(),
|
|
283
|
-
input: z.lazy(() => LoadStateActionInputSchema()),
|
|
284
|
-
type: Load_StateSchema,
|
|
285
|
-
scope: OperationScopeSchema()
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
function LoadStateActionInputSchema() {
|
|
289
|
-
return z.object({
|
|
290
|
-
operations: z.number(),
|
|
291
|
-
state: z.lazy(() => LoadStateActionStateInputSchema())
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
function LoadStateActionStateInputSchema() {
|
|
295
|
-
return z.object({
|
|
296
|
-
data: z.unknown().nullish(),
|
|
297
|
-
name: z.string()
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
function PruneActionSchema() {
|
|
301
|
-
return z.object({
|
|
302
|
-
id: z.string(),
|
|
303
|
-
timestampUtcMs: z.string(),
|
|
304
|
-
input: z.lazy(() => PruneActionInputSchema()),
|
|
305
|
-
type: PruneSchema,
|
|
306
|
-
scope: OperationScopeSchema()
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
function PruneActionInputSchema() {
|
|
310
|
-
return z.object({
|
|
311
|
-
end: z.number().nullish(),
|
|
312
|
-
start: z.number().nullish()
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
130
|
function RedoActionInputSchema() {
|
|
316
131
|
return z.object({ count: z.number() });
|
|
317
132
|
}
|
|
@@ -729,6 +544,13 @@ const PowerhouseModuleSchema = z.object({
|
|
|
729
544
|
documentTypes: z.array(z.string()).optional()
|
|
730
545
|
});
|
|
731
546
|
const PowerhouseModulesSchema = z.array(PowerhouseModuleSchema).optional();
|
|
547
|
+
const PieceModuleSchema = PowerhouseModuleSchema.extend({
|
|
548
|
+
version: z.string().optional(),
|
|
549
|
+
description: z.string().optional(),
|
|
550
|
+
bundle: z.string().optional(),
|
|
551
|
+
descriptor: z.string().optional()
|
|
552
|
+
});
|
|
553
|
+
const PieceModulesSchema = z.array(PieceModuleSchema).optional();
|
|
732
554
|
const PublisherSchema = z.object({
|
|
733
555
|
name: z.string().optional(),
|
|
734
556
|
url: z.string().optional()
|
|
@@ -739,7 +561,7 @@ const ConfigEntrySchema = z.object({
|
|
|
739
561
|
type: ConfigEntryTypeSchema,
|
|
740
562
|
description: z.string().optional(),
|
|
741
563
|
required: z.boolean().optional(),
|
|
742
|
-
default: z.
|
|
564
|
+
default: z.string().optional()
|
|
743
565
|
});
|
|
744
566
|
const PwaUrlPatternSchema = z.union([z.string(), z.strictObject({
|
|
745
567
|
source: z.string(),
|
|
@@ -835,8 +657,11 @@ const ManifestSchema = z.object({
|
|
|
835
657
|
editors: PowerhouseModulesSchema,
|
|
836
658
|
processors: PowerhouseModulesSchema,
|
|
837
659
|
subgraphs: PowerhouseModulesSchema,
|
|
660
|
+
pieces: PieceModulesSchema,
|
|
661
|
+
externalDependencies: z.record(z.string(), z.string()).optional(),
|
|
838
662
|
config: z.array(ConfigEntrySchema).optional(),
|
|
839
|
-
pwa: PwaConfigSchema.optional()
|
|
663
|
+
pwa: PwaConfigSchema.optional(),
|
|
664
|
+
connectRoutes: z.boolean().optional()
|
|
840
665
|
});
|
|
841
666
|
//#endregion
|
|
842
667
|
//#region document-model/actions.ts
|
|
@@ -854,35 +679,6 @@ const undo = (count = 1, scope = "global") => createAction("UNDO", { count }, vo
|
|
|
854
679
|
* @category Actions
|
|
855
680
|
*/
|
|
856
681
|
const redo = (count = 1, scope = "global") => createAction("REDO", { count }, void 0, RedoActionInputSchema, scope);
|
|
857
|
-
/**
|
|
858
|
-
* Joins multiple operations into a single {@link loadState | LOAD_STATE} operation.
|
|
859
|
-
*
|
|
860
|
-
* @remarks
|
|
861
|
-
* Useful to keep operations history smaller. Operations to prune are selected by index,
|
|
862
|
-
* similar to the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | slice} method in Arrays.
|
|
863
|
-
*
|
|
864
|
-
* @param start - Index of the first operation to prune
|
|
865
|
-
* @param end - Index of the last operation to prune
|
|
866
|
-
* @category Actions
|
|
867
|
-
*/
|
|
868
|
-
const prune = (start, end, scope = "global") => createAction("PRUNE", {
|
|
869
|
-
start,
|
|
870
|
-
end
|
|
871
|
-
}, void 0, PruneActionInputSchema, scope);
|
|
872
|
-
/**
|
|
873
|
-
* Replaces the state of the document.
|
|
874
|
-
*
|
|
875
|
-
* @remarks
|
|
876
|
-
* This action shouldn't be used directly. It is dispatched by the {@link prune} action.
|
|
877
|
-
*
|
|
878
|
-
* @param state - State to be set in the document.
|
|
879
|
-
* @param operations - Number of operations that were removed from the previous state.
|
|
880
|
-
* @category Actions
|
|
881
|
-
*/
|
|
882
|
-
const loadState = (state, operations) => createAction("LOAD_STATE", {
|
|
883
|
-
state,
|
|
884
|
-
operations
|
|
885
|
-
}, void 0, LoadStateActionInputSchema);
|
|
886
682
|
const noop = (scope = "global") => createAction("NOOP", {}, void 0, void 0, scope);
|
|
887
683
|
/**
|
|
888
684
|
* Helper function to be used by action creators.
|
|
@@ -980,6 +776,7 @@ async function buildOperationSignature(context, signMethod) {
|
|
|
980
776
|
const signature = await signMethod(buildOperationSignatureMessage(params));
|
|
981
777
|
return [...params, `0x${ab2hex(signature)}`];
|
|
982
778
|
}
|
|
779
|
+
/** @deprecated Emits a legacy SHA-1 tuple; sign through `ISigner.signAction`. */
|
|
983
780
|
async function buildSignedAction(action, reducer, document, signer, signHandler) {
|
|
984
781
|
const scopeOperations = reducer(document, action, void 0, { reuseOperationResultingState: true }).operations[action.scope];
|
|
985
782
|
if (!scopeOperations) throw new Error(`No operations found for scope: ${action.scope}`);
|
|
@@ -992,8 +789,10 @@ async function buildSignedAction(action, reducer, document, signer, signHandler)
|
|
|
992
789
|
action,
|
|
993
790
|
previousStateHash
|
|
994
791
|
}, signHandler);
|
|
995
|
-
|
|
792
|
+
const actionContext = { signer: actionSigner(signer.user, signer.app, [...signer.signatures, signature]) };
|
|
793
|
+
return operationWithContext(operation, actionContext);
|
|
996
794
|
}
|
|
795
|
+
/** @deprecated Use `verifyActionSignature` from `@powerhousedao/reactor`. */
|
|
997
796
|
async function verifyOperationSignature(signature, signer, verifyHandler) {
|
|
998
797
|
const publicKey = signer.app.key;
|
|
999
798
|
const params = signature.slice(0, 4);
|
|
@@ -1068,8 +867,6 @@ const baseActions = {
|
|
|
1068
867
|
setPreferredEditor,
|
|
1069
868
|
undo,
|
|
1070
869
|
redo,
|
|
1071
|
-
prune,
|
|
1072
|
-
loadState,
|
|
1073
870
|
noop
|
|
1074
871
|
};
|
|
1075
872
|
const documentModelActions = {
|
|
@@ -1187,7 +984,7 @@ var AuthAdministrationMissingError = class extends Error {
|
|
|
1187
984
|
this.name = "AuthAdministrationMissingError";
|
|
1188
985
|
}
|
|
1189
986
|
};
|
|
1190
|
-
const GRANT_KEYS = new Set([
|
|
987
|
+
const GRANT_KEYS = /* @__PURE__ */ new Set([
|
|
1191
988
|
"id",
|
|
1192
989
|
"description",
|
|
1193
990
|
"effect",
|
|
@@ -1195,13 +992,13 @@ const GRANT_KEYS = new Set([
|
|
|
1195
992
|
"capability",
|
|
1196
993
|
"where"
|
|
1197
994
|
]);
|
|
1198
|
-
const PRINCIPAL_KINDS = new Set([
|
|
995
|
+
const PRINCIPAL_KINDS = /* @__PURE__ */ new Set([
|
|
1199
996
|
"anyone",
|
|
1200
997
|
"address",
|
|
1201
998
|
"group",
|
|
1202
999
|
"match"
|
|
1203
1000
|
]);
|
|
1204
|
-
const COMPARISON_CONDITION_KINDS = new Set([
|
|
1001
|
+
const COMPARISON_CONDITION_KINDS = /* @__PURE__ */ new Set([
|
|
1205
1002
|
"eq",
|
|
1206
1003
|
"ne",
|
|
1207
1004
|
"lt",
|
|
@@ -2530,12 +2327,12 @@ function assertAuthPreservedOnDuplicate(documentId, source, duplicated) {
|
|
|
2530
2327
|
* The auth scope a state snapshot may install, given the policy already there.
|
|
2531
2328
|
*
|
|
2532
2329
|
* `applyAuthAction` is the validated door onto `state.auth`, but a whole-state
|
|
2533
|
-
* snapshot (UPGRADE_DOCUMENT's `initialState
|
|
2534
|
-
*
|
|
2535
|
-
*
|
|
2536
|
-
*
|
|
2537
|
-
*
|
|
2538
|
-
*
|
|
2330
|
+
* snapshot (UPGRADE_DOCUMENT's `initialState`) replaces the scope wholesale and
|
|
2331
|
+
* is authorized as a `document`-scope write. Without this, a subject holding
|
|
2332
|
+
* `execute` on `document` and no auth grant at all can install a policy of its
|
|
2333
|
+
* choosing, name itself `creator` (which exempts the policy from the retention
|
|
2334
|
+
* rule for good), or wipe an existing policy by carrying the default
|
|
2335
|
+
* uninitialized one.
|
|
2539
2336
|
*
|
|
2540
2337
|
* Three cases:
|
|
2541
2338
|
*
|
|
@@ -2562,13 +2359,9 @@ function resolveSnapshotAuth(documentId, documentType, current, incoming) {
|
|
|
2562
2359
|
assertValidInitialGrants(incoming.grants, documentType, incoming.creator);
|
|
2563
2360
|
return incoming;
|
|
2564
2361
|
}
|
|
2565
|
-
/** UNDO
|
|
2362
|
+
/** UNDO and REDO are rejected on the auth scope. */
|
|
2566
2363
|
function assertAuthScopeActionAllowed(action) {
|
|
2567
|
-
if (action.scope === "auth" && [
|
|
2568
|
-
"UNDO",
|
|
2569
|
-
"REDO",
|
|
2570
|
-
"PRUNE"
|
|
2571
|
-
].includes(action.type)) throw new AuthActionNotAllowedError(action.type);
|
|
2364
|
+
if (action.scope === "auth" && ["UNDO", "REDO"].includes(action.type)) throw new AuthActionNotAllowedError(action.type);
|
|
2572
2365
|
}
|
|
2573
2366
|
/**
|
|
2574
2367
|
* Evaluates the auth policy for a single request and reports why it refused.
|
|
@@ -2674,6 +2467,63 @@ function assertIsDocumentModelDocument(document) {
|
|
|
2674
2467
|
DocumentModelSchema.parse(document);
|
|
2675
2468
|
}
|
|
2676
2469
|
//#endregion
|
|
2470
|
+
//#region document-model/signature-policy.ts
|
|
2471
|
+
/** The `protocolVersions` key that fixes a document's signature requirement. */
|
|
2472
|
+
const SIGNATURE_PROTOCOL = "signature";
|
|
2473
|
+
/** `protocolVersions.signature` of a document that requires v2 tuples. */
|
|
2474
|
+
const SIGNATURE_PROTOCOL_V2 = 2;
|
|
2475
|
+
/** What a new document is created as unless the caller or host says otherwise. */
|
|
2476
|
+
const DEFAULT_SIGNATURE_POLICY = "v2-required";
|
|
2477
|
+
function isSignaturePolicy(value) {
|
|
2478
|
+
return value === "legacy" || value === "v2-required";
|
|
2479
|
+
}
|
|
2480
|
+
const DERIVED_ID = /^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/;
|
|
2481
|
+
/** Read from a header, a CREATE_DOCUMENT input or a bare map. */
|
|
2482
|
+
function signaturePolicyOf(source) {
|
|
2483
|
+
const version = (source && "protocolVersions" in source ? source.protocolVersions : source)?.[SIGNATURE_PROTOCOL];
|
|
2484
|
+
return typeof version === "number" && version >= 2 ? "v2-required" : "legacy";
|
|
2485
|
+
}
|
|
2486
|
+
/** `protocolVersions` for a new v2-required document. */
|
|
2487
|
+
function v2RequiredProtocolVersions(base = {}) {
|
|
2488
|
+
return {
|
|
2489
|
+
"base-reducer": 2,
|
|
2490
|
+
...base,
|
|
2491
|
+
[SIGNATURE_PROTOCOL]: 2
|
|
2492
|
+
};
|
|
2493
|
+
}
|
|
2494
|
+
/**
|
|
2495
|
+
* The policy a create call asks for: `signaturePolicy`, else the `signature`
|
|
2496
|
+
* key of its `protocolVersions`, else `fallback`, the host's default.
|
|
2497
|
+
*/
|
|
2498
|
+
function requestedSignaturePolicy(request, fallback) {
|
|
2499
|
+
if (request?.signaturePolicy) return request.signaturePolicy;
|
|
2500
|
+
if (request?.protocolVersions?.["signature"] !== void 0) return signaturePolicyOf(request.protocolVersions);
|
|
2501
|
+
return fallback;
|
|
2502
|
+
}
|
|
2503
|
+
/** `protocolVersions` for a new document under `policy`, over `base`. */
|
|
2504
|
+
function protocolVersionsFor(policy, base = {}) {
|
|
2505
|
+
if (policy === "v2-required") return v2RequiredProtocolVersions(base);
|
|
2506
|
+
const { [SIGNATURE_PROTOCOL]: _signature, ...rest } = base;
|
|
2507
|
+
return {
|
|
2508
|
+
"base-reducer": 2,
|
|
2509
|
+
...rest
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
/** `base64url(sha256(canonicalJson(params)))`, unpadded. */
|
|
2513
|
+
function deriveDocumentId(params) {
|
|
2514
|
+
const preimage = canonicalJson({
|
|
2515
|
+
documentType: params.documentType,
|
|
2516
|
+
createdAtUtcIso: params.createdAtUtcIso,
|
|
2517
|
+
nonce: params.nonce,
|
|
2518
|
+
protocolVersions: params.protocolVersions
|
|
2519
|
+
}, "document id");
|
|
2520
|
+
return bytesToBase64Url(sha256(new TextEncoder().encode(preimage)));
|
|
2521
|
+
}
|
|
2522
|
+
/** Whether `id` has the shape `deriveDocumentId` produces. */
|
|
2523
|
+
function isDerivedDocumentId(id) {
|
|
2524
|
+
return DERIVED_ID.test(id);
|
|
2525
|
+
}
|
|
2526
|
+
//#endregion
|
|
2677
2527
|
//#region document-model/header.ts
|
|
2678
2528
|
/**
|
|
2679
2529
|
* Generates a deterministic payload from signing parameters
|
|
@@ -2693,11 +2543,11 @@ async function createVerificationSigner(pubKey) {
|
|
|
2693
2543
|
}, true, ["verify"]);
|
|
2694
2544
|
return {
|
|
2695
2545
|
publicKey: cryptoKey,
|
|
2696
|
-
|
|
2697
|
-
|
|
2546
|
+
sign(_data) {
|
|
2547
|
+
return Promise.reject(/* @__PURE__ */ new Error("verification-only signer cannot sign data"));
|
|
2698
2548
|
},
|
|
2699
|
-
|
|
2700
|
-
|
|
2549
|
+
signAction(_action, _target, _abortSignal) {
|
|
2550
|
+
return Promise.reject(/* @__PURE__ */ new Error("verification-only signer cannot sign actions"));
|
|
2701
2551
|
},
|
|
2702
2552
|
async verify(data, signature) {
|
|
2703
2553
|
let isValid;
|
|
@@ -2767,26 +2617,68 @@ const validateHeader = async (header) => {
|
|
|
2767
2617
|
* Creates a header that has yet to be signed. This header is not valid, but
|
|
2768
2618
|
* can be input into {@link createSignedHeader} to create a signed header.
|
|
2769
2619
|
*
|
|
2620
|
+
* With `protocolVersions` requiring v2 signatures the header takes a random
|
|
2621
|
+
* nonce and the id {@link deriveDocumentId} gives, so `id` must be omitted.
|
|
2622
|
+
*
|
|
2770
2623
|
* @returns An unsigned header for a document.
|
|
2771
2624
|
*/
|
|
2772
|
-
const createPresignedHeader = (id
|
|
2773
|
-
|
|
2774
|
-
|
|
2625
|
+
const createPresignedHeader = (id, documentType = "", protocolVersions) => {
|
|
2626
|
+
const createdAtUtcIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
2627
|
+
const header = {
|
|
2628
|
+
id: id ?? generateId(),
|
|
2775
2629
|
sig: {
|
|
2776
2630
|
publicKey: {},
|
|
2777
2631
|
nonce: ""
|
|
2778
2632
|
},
|
|
2779
2633
|
documentType,
|
|
2780
|
-
createdAtUtcIso
|
|
2634
|
+
createdAtUtcIso,
|
|
2781
2635
|
slug: "",
|
|
2782
2636
|
name: "",
|
|
2783
2637
|
branch: "main",
|
|
2784
2638
|
revision: { document: 0 },
|
|
2785
|
-
lastModifiedAtUtcIso:
|
|
2639
|
+
lastModifiedAtUtcIso: createdAtUtcIso,
|
|
2786
2640
|
meta: {}
|
|
2787
2641
|
};
|
|
2642
|
+
if (protocolVersions === void 0) return header;
|
|
2643
|
+
header.protocolVersions = { ...protocolVersions };
|
|
2644
|
+
if (signaturePolicyOf(header) === "legacy") return header;
|
|
2645
|
+
if (id !== void 0) throw new Error(`A v2-required document's id is derived from its header; cannot use ${id}`);
|
|
2646
|
+
header.sig.nonce = generateId();
|
|
2647
|
+
header.id = deriveDocumentId({
|
|
2648
|
+
documentType,
|
|
2649
|
+
createdAtUtcIso,
|
|
2650
|
+
nonce: header.sig.nonce,
|
|
2651
|
+
protocolVersions: header.protocolVersions
|
|
2652
|
+
});
|
|
2653
|
+
return header;
|
|
2788
2654
|
};
|
|
2789
2655
|
/**
|
|
2656
|
+
* A header for a copy of a document headed `source`. A copy is v2-required
|
|
2657
|
+
* when its source is or when `policy` asks for it, and then takes a derived id;
|
|
2658
|
+
* otherwise it takes `id`. It keeps the source's other protocol versions.
|
|
2659
|
+
*/
|
|
2660
|
+
function createCopyHeader(source, id, policy = DEFAULT_SIGNATURE_POLICY) {
|
|
2661
|
+
const base = source.protocolVersions ?? {};
|
|
2662
|
+
if (signaturePolicyOf(source) === "v2-required" || policy === "v2-required") return createPresignedHeader(void 0, source.documentType, protocolVersionsFor("v2-required", base));
|
|
2663
|
+
const header = createPresignedHeader(id, source.documentType);
|
|
2664
|
+
if (source.protocolVersions) header.protocolVersions = { ...source.protocolVersions };
|
|
2665
|
+
return header;
|
|
2666
|
+
}
|
|
2667
|
+
/** Whether a v2-required `header` carries the id its params derive. */
|
|
2668
|
+
function hasDerivedDocumentId(header) {
|
|
2669
|
+
if (signaturePolicyOf(header) === "legacy" || !header.protocolVersions) return false;
|
|
2670
|
+
try {
|
|
2671
|
+
return deriveDocumentId({
|
|
2672
|
+
documentType: header.documentType,
|
|
2673
|
+
createdAtUtcIso: header.createdAtUtcIso,
|
|
2674
|
+
nonce: header.sig.nonce,
|
|
2675
|
+
protocolVersions: header.protocolVersions
|
|
2676
|
+
}) === header.id;
|
|
2677
|
+
} catch {
|
|
2678
|
+
return false;
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2790
2682
|
* Creates a new, signed header for a document. This will replace the id of the
|
|
2791
2683
|
* document.
|
|
2792
2684
|
*
|
|
@@ -2829,7 +2721,8 @@ const createSignedHeader = async (unsignedHeader, documentType, signer) => {
|
|
|
2829
2721
|
* some are not. See the PHDocumentHeader type for more information.
|
|
2830
2722
|
*/
|
|
2831
2723
|
const createSignedHeaderForSigner = async (documentType, signer) => {
|
|
2832
|
-
|
|
2724
|
+
const unsignedHeader = createPresignedHeader();
|
|
2725
|
+
return await createSignedHeader(unsignedHeader, documentType, signer);
|
|
2833
2726
|
};
|
|
2834
2727
|
//#endregion
|
|
2835
2728
|
//#region document-model/documents.ts
|
|
@@ -2847,9 +2740,7 @@ function isDocumentAction(action) {
|
|
|
2847
2740
|
"SET_NAME",
|
|
2848
2741
|
"SET_PREFERRED_EDITOR",
|
|
2849
2742
|
"UNDO",
|
|
2850
|
-
"REDO"
|
|
2851
|
-
"PRUNE",
|
|
2852
|
-
"LOAD_STATE"
|
|
2743
|
+
"REDO"
|
|
2853
2744
|
].includes(action.type);
|
|
2854
2745
|
}
|
|
2855
2746
|
/**
|
|
@@ -2905,12 +2796,16 @@ function createDocumentScopeOperations(header, state) {
|
|
|
2905
2796
|
}
|
|
2906
2797
|
/**
|
|
2907
2798
|
* Creates a new document. When `documentType` is given the header is stamped
|
|
2908
|
-
* with it and the document-scope operations are seeded.
|
|
2799
|
+
* with it and the document-scope operations are seeded. Without
|
|
2800
|
+
* `protocolVersions` the document is v2-required and takes a derived id; with
|
|
2801
|
+
* them it is v2-required only if they say so (see {@link protocolVersionsFor}).
|
|
2909
2802
|
*/
|
|
2910
|
-
function baseCreateDocument(createState, initialState, documentType = "") {
|
|
2803
|
+
function baseCreateDocument(createState, initialState, documentType = "", protocolVersions) {
|
|
2911
2804
|
const state = createState(initialState);
|
|
2912
|
-
const header = createPresignedHeader(
|
|
2913
|
-
|
|
2805
|
+
const header = createPresignedHeader(void 0, documentType, protocolVersions === void 0 ? protocolVersionsFor("v2-required") : {
|
|
2806
|
+
"base-reducer": 2,
|
|
2807
|
+
...protocolVersions
|
|
2808
|
+
});
|
|
2914
2809
|
return {
|
|
2915
2810
|
header,
|
|
2916
2811
|
state,
|
|
@@ -2926,8 +2821,39 @@ function baseCreateDocument(createState, initialState, documentType = "") {
|
|
|
2926
2821
|
clipboard: []
|
|
2927
2822
|
};
|
|
2928
2823
|
}
|
|
2824
|
+
/**
|
|
2825
|
+
* `document`, not yet created, under a fresh header for `policy`. A legacy
|
|
2826
|
+
* header takes `id` when given; a v2-required one ignores `id` and derives its
|
|
2827
|
+
* own, so a caller that needs a fixed id must ask for legacy.
|
|
2828
|
+
* `protocolVersions` are merged over the document's. Name, slug, branch and
|
|
2829
|
+
* meta carry over. A document already under `policy` is returned as is unless
|
|
2830
|
+
* a legacy `id` or `protocolVersions` are given.
|
|
2831
|
+
*/
|
|
2832
|
+
function withSignaturePolicy(document, policy, options = {}) {
|
|
2833
|
+
const id = policy === "legacy" ? options.id : void 0;
|
|
2834
|
+
if (id === void 0 && options.protocolVersions === void 0 && signaturePolicyOf(document.header) === policy) return document;
|
|
2835
|
+
const source = document.header;
|
|
2836
|
+
const header = createPresignedHeader(id, source.documentType, protocolVersionsFor(policy, {
|
|
2837
|
+
...source.protocolVersions,
|
|
2838
|
+
...options.protocolVersions
|
|
2839
|
+
}));
|
|
2840
|
+
header.name = source.name;
|
|
2841
|
+
header.slug = source.slug;
|
|
2842
|
+
header.branch = source.branch;
|
|
2843
|
+
header.meta = source.meta;
|
|
2844
|
+
const operations = document.operations.document ? {
|
|
2845
|
+
...document.operations,
|
|
2846
|
+
document: createDocumentScopeOperations(header, document.state)
|
|
2847
|
+
} : document.operations;
|
|
2848
|
+
return {
|
|
2849
|
+
...document,
|
|
2850
|
+
header,
|
|
2851
|
+
operations
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2929
2854
|
function hashDocumentStateForScope(document, scope = "global") {
|
|
2930
|
-
|
|
2855
|
+
const stateString = stringify(document.state[scope] || "");
|
|
2856
|
+
return hashBrowser(stateString);
|
|
2931
2857
|
}
|
|
2932
2858
|
function readOnly(value) {
|
|
2933
2859
|
return Object.freeze(value);
|
|
@@ -3058,7 +2984,7 @@ function replayDocument(initialState, operations, reducer, header, dispatch, ski
|
|
|
3058
2984
|
const backfilledInitialState = backfillAuthState(initialState);
|
|
3059
2985
|
let documentState = backfilledInitialState;
|
|
3060
2986
|
const operationsToReplay = [];
|
|
3061
|
-
const allScopes = new Set([
|
|
2987
|
+
const allScopes = /* @__PURE__ */ new Set([
|
|
3062
2988
|
...Object.keys(operations),
|
|
3063
2989
|
"global",
|
|
3064
2990
|
"local"
|
|
@@ -3116,7 +3042,7 @@ function replayDocument(initialState, operations, reducer, header, dispatch, ski
|
|
|
3116
3042
|
if (operation.hash !== hashDocumentStateForScope(result, scope)) throw new HashMismatchError(scope, result, operation);
|
|
3117
3043
|
else break;
|
|
3118
3044
|
}
|
|
3119
|
-
const allResultScopes = new Set([
|
|
3045
|
+
const allResultScopes = /* @__PURE__ */ new Set([
|
|
3120
3046
|
...Object.keys(result.operations),
|
|
3121
3047
|
...Object.keys(operations),
|
|
3122
3048
|
"global",
|
|
@@ -3179,8 +3105,8 @@ function checkCleanedOperationsIntegrity(sortedOperations) {
|
|
|
3179
3105
|
index: nextOperation.index,
|
|
3180
3106
|
skip: nextOperation.skip
|
|
3181
3107
|
},
|
|
3182
|
-
issue:
|
|
3183
|
-
category: nextIndex > currentIndex + 1 ?
|
|
3108
|
+
issue: "UNEXPECTED_INDEX",
|
|
3109
|
+
category: nextIndex > currentIndex + 1 ? "MISSING_INDEX" : "DUPLICATED_INDEX",
|
|
3184
3110
|
message: `Expected index ${currentIndex + 1} with skip 0 or equivalent, got index ${nextOperation.index} with skip ${nextOperation.skip}`
|
|
3185
3111
|
});
|
|
3186
3112
|
currentIndex = nextOperation.index;
|
|
@@ -3290,12 +3216,14 @@ function attachBranch(trunk, newBranch) {
|
|
|
3290
3216
|
nextTrunkOperation = trunkCopy.shift();
|
|
3291
3217
|
}
|
|
3292
3218
|
if (!nextTrunkOperation) enteredBranch = true;
|
|
3293
|
-
else if (!enteredBranch)
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3219
|
+
else if (!enteredBranch) {
|
|
3220
|
+
if (operationsAreEqual(nextTrunkOperation, newOperationCandidate)) {
|
|
3221
|
+
newOperations.shift();
|
|
3222
|
+
result.push(nextTrunkOperation);
|
|
3223
|
+
} else {
|
|
3224
|
+
trunkCopy.unshift(nextTrunkOperation);
|
|
3225
|
+
enteredBranch = true;
|
|
3226
|
+
}
|
|
3299
3227
|
}
|
|
3300
3228
|
if (enteredBranch) {
|
|
3301
3229
|
let nextAppend = newOperations.shift();
|
|
@@ -3326,13 +3254,14 @@ function split(sortedTargetOperations, sortedMergeOperations) {
|
|
|
3326
3254
|
for (let i = 0; i < maxLength; i++) {
|
|
3327
3255
|
const targetOperation = sortedTargetOperations[i];
|
|
3328
3256
|
const mergeOperation = sortedMergeOperations[i];
|
|
3329
|
-
if (targetOperation && mergeOperation)
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3257
|
+
if (targetOperation && mergeOperation) {
|
|
3258
|
+
if (!splitHappened && operationsAreEqual(targetOperation, mergeOperation)) commonOperations.push(targetOperation);
|
|
3259
|
+
else {
|
|
3260
|
+
splitHappened = true;
|
|
3261
|
+
targetDiffOperations.push(targetOperation);
|
|
3262
|
+
mergeDiffOperations.push(mergeOperation);
|
|
3263
|
+
}
|
|
3264
|
+
} else if (targetOperation) targetDiffOperations.push(targetOperation);
|
|
3336
3265
|
else if (mergeOperation) mergeDiffOperations.push(mergeOperation);
|
|
3337
3266
|
}
|
|
3338
3267
|
return [
|
|
@@ -3384,14 +3313,14 @@ function prepareOperations(operationsHistory, newOperations) {
|
|
|
3384
3313
|
const sortedOperationsHistory = sortOperations(operationsHistory);
|
|
3385
3314
|
const sortedOperations = sortOperations(newOperations);
|
|
3386
3315
|
const integrityErrors = checkCleanedOperationsIntegrity([...sortedOperationsHistory, ...sortedOperations]);
|
|
3387
|
-
const firstMissingIndexOperation = [...integrityErrors.filter((integrityIssue) => integrityIssue.category ===
|
|
3316
|
+
const firstMissingIndexOperation = [...integrityErrors.filter((integrityIssue) => integrityIssue.category === "MISSING_INDEX")].sort((a, b) => b.operation.index - a.operation.index).pop()?.operation;
|
|
3388
3317
|
for (const newOperation of sortedOperations) {
|
|
3389
3318
|
if (firstMissingIndexOperation && newOperation.index >= firstMissingIndexOperation.index) {
|
|
3390
3319
|
result.invalidOperations.push(newOperation);
|
|
3391
3320
|
continue;
|
|
3392
3321
|
}
|
|
3393
3322
|
if (integrityErrors.some((integrityError) => {
|
|
3394
|
-
return integrityError.operation.index === newOperation.index && integrityError.operation.skip === newOperation.skip && integrityError.category ===
|
|
3323
|
+
return integrityError.operation.index === newOperation.index && integrityError.operation.skip === newOperation.skip && integrityError.category === "DUPLICATED_INDEX";
|
|
3395
3324
|
})) {
|
|
3396
3325
|
result.duplicatedOperations.push(newOperation);
|
|
3397
3326
|
continue;
|
|
@@ -3620,18 +3549,6 @@ function redoOperation(document, action, skip) {
|
|
|
3620
3549
|
});
|
|
3621
3550
|
});
|
|
3622
3551
|
}
|
|
3623
|
-
function loadStateOperation(document, action) {
|
|
3624
|
-
const loaded = backfillAuthState(action.state.data);
|
|
3625
|
-
loaded.auth = resolveSnapshotAuth(document.header.id, document.header.documentType, backfillAuthState({ ...document.state }).auth, loaded.auth);
|
|
3626
|
-
return {
|
|
3627
|
-
...document,
|
|
3628
|
-
header: {
|
|
3629
|
-
...document.header,
|
|
3630
|
-
name: action.state.name
|
|
3631
|
-
},
|
|
3632
|
-
state: loaded
|
|
3633
|
-
};
|
|
3634
|
-
}
|
|
3635
3552
|
/**
|
|
3636
3553
|
* Reads an operation's outcome. A denial takes precedence over a reducer
|
|
3637
3554
|
* error, since a denied operation never reaches its reducer.
|
|
@@ -3664,15 +3581,12 @@ function replayOperations(initialState, clearedOperations, stateReducer, header,
|
|
|
3664
3581
|
* @returns The updated document state.
|
|
3665
3582
|
*/
|
|
3666
3583
|
function updateOperationsForAction(document, action, reuseLastOperationIndex, skip, context) {
|
|
3667
|
-
if ([
|
|
3668
|
-
"UNDO",
|
|
3669
|
-
"REDO",
|
|
3670
|
-
"PRUNE"
|
|
3671
|
-
].includes(action.type)) return document;
|
|
3584
|
+
if (["UNDO", "REDO"].includes(action.type)) return document;
|
|
3672
3585
|
const scope = action.scope;
|
|
3673
3586
|
const existing = document.operations[scope];
|
|
3674
3587
|
const lastOperationIndex = existing?.at(-1)?.index ?? -1;
|
|
3675
|
-
const
|
|
3588
|
+
const index = reuseLastOperationIndex ? lastOperationIndex : lastOperationIndex + 1;
|
|
3589
|
+
const newOperation = operationFromAction(action, index, skip, context);
|
|
3676
3590
|
const operations = [...existing ?? [], newOperation];
|
|
3677
3591
|
return {
|
|
3678
3592
|
...document,
|
|
@@ -3716,20 +3630,17 @@ function updateDocument(document, action, reuseLastOperationIndex, skip, context
|
|
|
3716
3630
|
return newDocument;
|
|
3717
3631
|
}
|
|
3718
3632
|
/**
|
|
3719
|
-
* The base document reducer function
|
|
3633
|
+
* The base document reducer function.
|
|
3720
3634
|
*
|
|
3721
3635
|
* @param state The current state of the document.
|
|
3722
3636
|
* @param action The action being applied to the document.
|
|
3723
|
-
* @param wrappedReducer The custom reducer function being wrapped by the base reducer.
|
|
3724
3637
|
* @returns The updated document state.
|
|
3725
3638
|
*/
|
|
3726
|
-
function _baseReducer(document, action
|
|
3639
|
+
function _baseReducer(document, action) {
|
|
3727
3640
|
const parsedAction = DocumentActionSchema().parse(action);
|
|
3728
3641
|
switch (parsedAction.type) {
|
|
3729
3642
|
case "SET_NAME": return setNameOperation(document, parsedAction.input);
|
|
3730
3643
|
case "SET_PREFERRED_EDITOR": return setPreferredEditorOperation(document, parsedAction.input);
|
|
3731
|
-
case "PRUNE": return pruneOperation(document, parsedAction.input, wrappedReducer);
|
|
3732
|
-
case "LOAD_STATE": return loadStateOperation(document, parsedAction.input);
|
|
3733
3644
|
default: return document;
|
|
3734
3645
|
}
|
|
3735
3646
|
}
|
|
@@ -3807,7 +3718,7 @@ function processUndoOperation(document, scope, customReducer, reuseOperationResu
|
|
|
3807
3718
|
}
|
|
3808
3719
|
/**
|
|
3809
3720
|
* Base document reducer that wraps a custom document reducer and handles
|
|
3810
|
-
* document-level actions such as undo, redo,
|
|
3721
|
+
* document-level actions such as undo, redo, and set name.
|
|
3811
3722
|
*
|
|
3812
3723
|
* @template TGlobalState - The type of the state of the custom reducer.
|
|
3813
3724
|
* @template TAction - The type of the actions of the custom reducer.
|
|
@@ -3835,7 +3746,7 @@ function baseReducer(document, action, customReducer, dispatch, options = {}) {
|
|
|
3835
3746
|
...newDocument,
|
|
3836
3747
|
clipboard: []
|
|
3837
3748
|
};
|
|
3838
|
-
if (isDocumentAction(_action)) newDocument = _baseReducer(newDocument, _action
|
|
3749
|
+
if (isDocumentAction(_action)) newDocument = _baseReducer(newDocument, _action);
|
|
3839
3750
|
const operationContext = {
|
|
3840
3751
|
documentId: document.header.id,
|
|
3841
3752
|
scope: _action.scope,
|
|
@@ -3898,11 +3809,7 @@ function baseReducer(document, action, customReducer, dispatch, options = {}) {
|
|
|
3898
3809
|
}
|
|
3899
3810
|
}
|
|
3900
3811
|
});
|
|
3901
|
-
if ([
|
|
3902
|
-
"UNDO",
|
|
3903
|
-
"REDO",
|
|
3904
|
-
"PRUNE"
|
|
3905
|
-
].includes(_action.type)) return newDocument;
|
|
3812
|
+
if (["UNDO", "REDO"].includes(_action.type)) return newDocument;
|
|
3906
3813
|
const scope = _action.scope || "global";
|
|
3907
3814
|
const replayHash = options.replayOptions?.operation.hash;
|
|
3908
3815
|
const hash = replayHash ? replayHash : hashDocumentStateForScope(newDocument, scope);
|
|
@@ -3922,7 +3829,6 @@ function baseReducer(document, action, customReducer, dispatch, options = {}) {
|
|
|
3922
3829
|
* - `SET_NAME`
|
|
3923
3830
|
* - `UNDO`
|
|
3924
3831
|
* - `REDO`
|
|
3925
|
-
* - `PRUNE`
|
|
3926
3832
|
*
|
|
3927
3833
|
* It also updates the document-related attributes on every operation.
|
|
3928
3834
|
*
|
|
@@ -3937,46 +3843,6 @@ function createReducer(stateReducer, documentReducer = baseReducer) {
|
|
|
3937
3843
|
};
|
|
3938
3844
|
return reducer;
|
|
3939
3845
|
}
|
|
3940
|
-
function pruneOperation(document, input, wrappedReducer) {
|
|
3941
|
-
const operations = document.operations.global;
|
|
3942
|
-
if (!operations) throw new Error("No global operations found");
|
|
3943
|
-
let { start, end } = input;
|
|
3944
|
-
start = start || 0;
|
|
3945
|
-
end = end || operations.length;
|
|
3946
|
-
const actionsToPrune = operations.slice(start, end);
|
|
3947
|
-
const actionsToKeepStart = operations.slice(0, start);
|
|
3948
|
-
const actionsToKeepEnd = operations.slice(end);
|
|
3949
|
-
const newDocument = replayOperations(document.initialState, {
|
|
3950
|
-
...document.operations,
|
|
3951
|
-
global: actionsToKeepStart.concat(actionsToPrune)
|
|
3952
|
-
}, wrappedReducer, document.header);
|
|
3953
|
-
const newState = newDocument.state;
|
|
3954
|
-
const name = newDocument.header.name;
|
|
3955
|
-
const loadStateIndex = actionsToKeepStart.length;
|
|
3956
|
-
const loadStateTimestamp = actionsToKeepStart.length ? actionsToKeepStart[actionsToKeepStart.length - 1].timestampUtcMs : actionsToKeepEnd.length ? actionsToKeepEnd[0].timestampUtcMs : (/* @__PURE__ */ new Date()).toISOString();
|
|
3957
|
-
const action = loadState({
|
|
3958
|
-
name,
|
|
3959
|
-
...newState
|
|
3960
|
-
}, actionsToPrune.length);
|
|
3961
|
-
return replayOperations(document.initialState, {
|
|
3962
|
-
...document.operations,
|
|
3963
|
-
global: [
|
|
3964
|
-
...actionsToKeepStart,
|
|
3965
|
-
{
|
|
3966
|
-
skip: 0,
|
|
3967
|
-
...action,
|
|
3968
|
-
action,
|
|
3969
|
-
timestampUtcMs: loadStateTimestamp,
|
|
3970
|
-
index: loadStateIndex,
|
|
3971
|
-
hash: hashDocumentStateForScope({ state: newState }, "global")
|
|
3972
|
-
},
|
|
3973
|
-
...actionsToKeepEnd.map((action, index) => ({
|
|
3974
|
-
...action,
|
|
3975
|
-
index: loadStateIndex + index + 1
|
|
3976
|
-
}))
|
|
3977
|
-
]
|
|
3978
|
-
}, wrappedReducer, document.header);
|
|
3979
|
-
}
|
|
3980
3846
|
//#endregion
|
|
3981
3847
|
//#region document-model/validation.ts
|
|
3982
3848
|
/**
|
|
@@ -3986,11 +3852,10 @@ function pruneOperation(document, input, wrappedReducer) {
|
|
|
3986
3852
|
const RESERVED_OPERATION_NAMES = [
|
|
3987
3853
|
"UNDO",
|
|
3988
3854
|
"REDO",
|
|
3989
|
-
"PRUNE",
|
|
3990
|
-
"LOAD_STATE",
|
|
3991
3855
|
"SET_NAME",
|
|
3992
3856
|
"SET_PREFERRED_EDITOR",
|
|
3993
|
-
"NOOP"
|
|
3857
|
+
"NOOP",
|
|
3858
|
+
"PURGE_DOCUMENT"
|
|
3994
3859
|
];
|
|
3995
3860
|
/**
|
|
3996
3861
|
* Operation names become the literal action `type` string at runtime and the
|
|
@@ -4226,6 +4091,15 @@ function orderBy(items, order) {
|
|
|
4226
4091
|
return (rank.get(a.item.id) ?? Number.MAX_SAFE_INTEGER) - (rank.get(b.item.id) ?? Number.MAX_SAFE_INTEGER) || a.index - b.index;
|
|
4227
4092
|
}).map(({ item }) => item);
|
|
4228
4093
|
}
|
|
4094
|
+
/**
|
|
4095
|
+
* The untouched base of a mutative draft, or the value itself when it is not a
|
|
4096
|
+
* draft. Build replacement lists from it and freeze them before assigning, as
|
|
4097
|
+
* the drive node reducer does, so finalize skips the walk over the assigned
|
|
4098
|
+
* list. Read before writing: the base does not see this action's mutations.
|
|
4099
|
+
*/
|
|
4100
|
+
function readBase(value) {
|
|
4101
|
+
return isDraft(value) ? original(value) : value;
|
|
4102
|
+
}
|
|
4229
4103
|
const documentModelHeaderReducer = {
|
|
4230
4104
|
setModelNameOperation(state, action) {
|
|
4231
4105
|
state.name = action.input.name;
|
|
@@ -4275,7 +4149,8 @@ const documentModelModuleReducer = {
|
|
|
4275
4149
|
deleteModuleOperation(state, action) {
|
|
4276
4150
|
findModuleOrThrow(state, action.input.id);
|
|
4277
4151
|
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
4278
|
-
|
|
4152
|
+
const modules = readBase(latestSpec).modules.filter((m) => m.id != action.input.id);
|
|
4153
|
+
latestSpec.modules = Object.freeze(modules);
|
|
4279
4154
|
},
|
|
4280
4155
|
reorderModulesOperation(state, action) {
|
|
4281
4156
|
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
@@ -4393,14 +4268,20 @@ const documentModelOperationReducer = {
|
|
|
4393
4268
|
const matches = latestSpec.modules.flatMap((mod) => mod.operations.filter((op) => op.id === action.input.operationId));
|
|
4394
4269
|
if (matches.length === 0) throw new Error(`Operation "${action.input.operationId}" not found in the latest specification`);
|
|
4395
4270
|
if (matches.length > 1) throw new Error(`Operation "${action.input.operationId}" is duplicated in the latest specification`);
|
|
4396
|
-
const moved = matches[0];
|
|
4397
|
-
for (const mod of latestSpec.modules)
|
|
4398
|
-
|
|
4271
|
+
const moved = readBase(matches[0]);
|
|
4272
|
+
for (const mod of latestSpec.modules) {
|
|
4273
|
+
const operations = readBase(mod).operations.filter((op) => op.id !== action.input.operationId);
|
|
4274
|
+
if (mod === targetModule) operations.push(moved);
|
|
4275
|
+
mod.operations = Object.freeze(operations);
|
|
4276
|
+
}
|
|
4399
4277
|
},
|
|
4400
4278
|
deleteOperationOperation(state, action) {
|
|
4401
4279
|
findOperationOrThrow(state, action.input.id);
|
|
4402
4280
|
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
4403
|
-
for (const mod of latestSpec.modules)
|
|
4281
|
+
for (const mod of latestSpec.modules) {
|
|
4282
|
+
const operations = readBase(mod).operations.filter((operation) => operation.id != action.input.id);
|
|
4283
|
+
mod.operations = Object.freeze(operations);
|
|
4284
|
+
}
|
|
4404
4285
|
},
|
|
4405
4286
|
reorderModuleOperationsOperation(state, action) {
|
|
4406
4287
|
const targetModule = findModuleOrThrow(state, action.input.moduleId);
|
|
@@ -4438,7 +4319,8 @@ const documentModelStateSchemaReducer = {
|
|
|
4438
4319
|
if (!Object.keys(latestSpec.state).includes(action.input.scope)) throw new Error(`Invalid scope: ${action.input.scope}`);
|
|
4439
4320
|
const scopeState = latestSpec.state[action.input.scope];
|
|
4440
4321
|
if (!scopeState.examples.some((e) => e.id == action.input.id)) throw new Error(`State example "${action.input.id}" not found in scope "${action.input.scope}"`);
|
|
4441
|
-
|
|
4322
|
+
const examples = readBase(scopeState).examples.filter((e) => e.id != action.input.id);
|
|
4323
|
+
scopeState.examples = Object.freeze(examples);
|
|
4442
4324
|
},
|
|
4443
4325
|
reorderStateExamplesOperation(state, action) {
|
|
4444
4326
|
const latestSpec = state.specifications[state.specifications.length - 1];
|
|
@@ -4670,17 +4552,6 @@ const documentModelStateReducer = (state, action) => {
|
|
|
4670
4552
|
const documentModelReducer = createReducer(documentModelStateReducer);
|
|
4671
4553
|
//#endregion
|
|
4672
4554
|
//#region document-model/upgrades.ts
|
|
4673
|
-
/**
|
|
4674
|
-
* Canonical document-model version normalization: documents stamped with 0
|
|
4675
|
-
* or nothing at all predate versioning and are treated as version 1, the
|
|
4676
|
-
* same version the registry assigns unversioned modules. Every consumer
|
|
4677
|
-
* that resolves a module or compares versions must use this rule; resolving
|
|
4678
|
-
* 0 to "latest" instead re-pins a legacy document's history to whichever
|
|
4679
|
-
* module happens to be newest.
|
|
4680
|
-
*/
|
|
4681
|
-
function normalizeDocumentModelVersion(version) {
|
|
4682
|
-
return version && version > 0 ? version : 1;
|
|
4683
|
-
}
|
|
4684
4555
|
function applyInitialState(document, action) {
|
|
4685
4556
|
const input = action.input;
|
|
4686
4557
|
const newState = input.initialState || input.state;
|
|
@@ -4708,7 +4579,11 @@ function applyUpgradeDocumentAction(document, action, upgradePath) {
|
|
|
4708
4579
|
const toVersion = action.input.toVersion;
|
|
4709
4580
|
if (fromVersion === toVersion && fromVersion > 0) return document;
|
|
4710
4581
|
if (fromVersion > toVersion) throw new DowngradeNotSupportedError(document.header.documentType, fromVersion, toVersion);
|
|
4711
|
-
if (upgradePath)
|
|
4582
|
+
if (upgradePath) {
|
|
4583
|
+
const protocolVersions = document.header.protocolVersions;
|
|
4584
|
+
for (const transition of upgradePath) document = transition.upgradeReducer(document, action);
|
|
4585
|
+
document = withProtocolVersions(document, protocolVersions);
|
|
4586
|
+
}
|
|
4712
4587
|
applyInitialState(document, action);
|
|
4713
4588
|
document.state.document = {
|
|
4714
4589
|
...document.state.document,
|
|
@@ -4716,12 +4591,22 @@ function applyUpgradeDocumentAction(document, action, upgradePath) {
|
|
|
4716
4591
|
};
|
|
4717
4592
|
return document;
|
|
4718
4593
|
}
|
|
4594
|
+
/** CREATE_DOCUMENT fixes `protocolVersions`; this puts them back after a reducer. */
|
|
4595
|
+
function withProtocolVersions(document, protocolVersions) {
|
|
4596
|
+
const header = { ...document.header };
|
|
4597
|
+
if (protocolVersions === void 0) delete header.protocolVersions;
|
|
4598
|
+
else header.protocolVersions = { ...protocolVersions };
|
|
4599
|
+
return {
|
|
4600
|
+
...document,
|
|
4601
|
+
header
|
|
4602
|
+
};
|
|
4603
|
+
}
|
|
4719
4604
|
/**
|
|
4720
|
-
* Applies a DELETE_DOCUMENT action to a document.
|
|
4605
|
+
* Applies a DELETE_DOCUMENT action, or a PURGE_DOCUMENT marker, to a document.
|
|
4721
4606
|
* Marks the document as deleted in the document scope state.
|
|
4722
4607
|
*/
|
|
4723
4608
|
function applyDeleteDocumentAction(document, action) {
|
|
4724
|
-
const deletedAt = action.timestampUtcMs || (/* @__PURE__ */ new Date()).toISOString();
|
|
4609
|
+
const deletedAt = isPurgeMarker(action) ? action.input.purgedAtUtcIso : action.timestampUtcMs || (/* @__PURE__ */ new Date()).toISOString();
|
|
4725
4610
|
document.state = {
|
|
4726
4611
|
...document.state,
|
|
4727
4612
|
document: {
|
|
@@ -4841,7 +4726,7 @@ function replayDocumentVersioned(initialState, operations, config, header, dispa
|
|
|
4841
4726
|
const curr = boundaries[i]?.[s] ?? 0;
|
|
4842
4727
|
if (boundaries[i]) boundaries[i][s] = Math.max(prev, curr);
|
|
4843
4728
|
}
|
|
4844
|
-
const allScopes = new Set([
|
|
4729
|
+
const allScopes = /* @__PURE__ */ new Set([
|
|
4845
4730
|
...Object.keys(operations),
|
|
4846
4731
|
"global",
|
|
4847
4732
|
"local"
|
|
@@ -4886,7 +4771,7 @@ function replayDocumentVersioned(initialState, operations, config, header, dispa
|
|
|
4886
4771
|
const spineActionType = spineOp.action.type;
|
|
4887
4772
|
if (spineActionType === "CREATE_DOCUMENT" || spineActionType === "UPGRADE_DOCUMENT") continue;
|
|
4888
4773
|
if (isDenied(spineOp)) continue;
|
|
4889
|
-
if (spineActionType === "DELETE_DOCUMENT") document = applyDeleteDocumentAction(document, spineOp.action);
|
|
4774
|
+
if (spineActionType === "DELETE_DOCUMENT" || spineActionType === "PURGE_DOCUMENT") document = applyDeleteDocumentAction(document, spineOp.action);
|
|
4890
4775
|
else document = reducer(document, spineOp.action, dispatch, {
|
|
4891
4776
|
ignoreSkipOperations: true,
|
|
4892
4777
|
checkHashes,
|
|
@@ -4928,7 +4813,7 @@ function replayDocumentVersioned(initialState, operations, config, header, dispa
|
|
|
4928
4813
|
}
|
|
4929
4814
|
}
|
|
4930
4815
|
}
|
|
4931
|
-
const allResultScopes = new Set([
|
|
4816
|
+
const allResultScopes = /* @__PURE__ */ new Set([
|
|
4932
4817
|
...Object.keys(document.operations),
|
|
4933
4818
|
...Object.keys(operations),
|
|
4934
4819
|
"global",
|
|
@@ -5012,22 +4897,22 @@ async function createZip(document) {
|
|
|
5012
4897
|
*/
|
|
5013
4898
|
async function createMinimalZip(data) {
|
|
5014
4899
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
5015
|
-
const header = {
|
|
5016
|
-
id: data.documentId,
|
|
5017
|
-
sig: {
|
|
5018
|
-
publicKey: {},
|
|
5019
|
-
nonce: ""
|
|
5020
|
-
},
|
|
5021
|
-
documentType: data.documentType,
|
|
5022
|
-
createdAtUtcIso: now,
|
|
5023
|
-
slug: data.name,
|
|
5024
|
-
name: data.name,
|
|
5025
|
-
branch: data.branch,
|
|
5026
|
-
revision: {},
|
|
5027
|
-
lastModifiedAtUtcIso: now
|
|
5028
|
-
};
|
|
5029
4900
|
return zipAsync({
|
|
5030
|
-
"header.json": jsonEntry(
|
|
4901
|
+
"header.json": jsonEntry({
|
|
4902
|
+
id: data.documentId,
|
|
4903
|
+
sig: {
|
|
4904
|
+
publicKey: {},
|
|
4905
|
+
nonce: ""
|
|
4906
|
+
},
|
|
4907
|
+
documentType: data.documentType,
|
|
4908
|
+
createdAtUtcIso: now,
|
|
4909
|
+
slug: data.name,
|
|
4910
|
+
name: data.name,
|
|
4911
|
+
branch: data.branch,
|
|
4912
|
+
revision: {},
|
|
4913
|
+
lastModifiedAtUtcIso: now,
|
|
4914
|
+
...data.protocolVersions && { protocolVersions: data.protocolVersions }
|
|
4915
|
+
}),
|
|
5031
4916
|
"state.json": jsonEntry(data.state),
|
|
5032
4917
|
"current-state.json": jsonEntry(data.state),
|
|
5033
4918
|
"operations.json": jsonEntry({})
|
|
@@ -5051,7 +4936,10 @@ async function parseZipData(data) {
|
|
|
5051
4936
|
if (!files["header.json"]) throw new Error("Document header not found - file format may be outdated");
|
|
5052
4937
|
const header = JSON.parse(readEntry(files, "header.json"));
|
|
5053
4938
|
if (!files["operations.json"]) throw new Error("Operations history not found");
|
|
5054
|
-
const
|
|
4939
|
+
const operations = JSON.parse(readEntry(files, "operations.json"));
|
|
4940
|
+
const clearedOperations = garbageCollectDocumentOperations(operations);
|
|
4941
|
+
pinProtocolVersionsToCreate(header, operations);
|
|
4942
|
+
backfillBaseReducerVersion(header);
|
|
5055
4943
|
const operationsError = validateOperations(clearedOperations);
|
|
5056
4944
|
if (operationsError.length) {
|
|
5057
4945
|
const errorMessages = operationsError.map((err) => err.message);
|
|
@@ -5063,6 +4951,25 @@ async function parseZipData(data) {
|
|
|
5063
4951
|
clearedOperations
|
|
5064
4952
|
};
|
|
5065
4953
|
}
|
|
4954
|
+
/** header.json is a snapshot; the stored CREATE_DOCUMENT input wins. */
|
|
4955
|
+
function pinProtocolVersionsToCreate(header, operations) {
|
|
4956
|
+
const create = operations.document?.find((operation) => operation.action.type === "CREATE_DOCUMENT");
|
|
4957
|
+
if (!create) return;
|
|
4958
|
+
const input = create.action.input;
|
|
4959
|
+
if (input?.protocolVersions) header.protocolVersions = { ...input.protocolVersions };
|
|
4960
|
+
else if (header.protocolVersions) {
|
|
4961
|
+
const { [SIGNATURE_PROTOCOL]: _dropped, ...rest } = header.protocolVersions;
|
|
4962
|
+
header.protocolVersions = rest;
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4965
|
+
/** A zip with no recorded base-reducer version predates it: replay as v1. */
|
|
4966
|
+
function backfillBaseReducerVersion(header) {
|
|
4967
|
+
if (typeof header.protocolVersions?.["base-reducer"] === "number") return;
|
|
4968
|
+
header.protocolVersions = {
|
|
4969
|
+
...header.protocolVersions,
|
|
4970
|
+
"base-reducer": 1
|
|
4971
|
+
};
|
|
4972
|
+
}
|
|
5066
4973
|
async function loadFromZipData(data, reducer, options) {
|
|
5067
4974
|
const { initialState, header, clearedOperations } = await parseZipData(data);
|
|
5068
4975
|
return {
|
|
@@ -5138,6 +5045,6 @@ const getFileBrowser = (file) => {
|
|
|
5138
5045
|
return Promise.resolve().then(() => readFileBrowser(file));
|
|
5139
5046
|
};
|
|
5140
5047
|
//#endregion
|
|
5141
|
-
export { AUTH_ACTION_TYPES, AUTH_DENIED_BY_GRANT_REASON, AUTH_NO_GRANT_REASON, AUTH_VERSION_UNSUPPORTED_REASON, AddChangeLogItemInputSchema, AddModuleInputSchema, AddOperationErrorInputSchema, AddOperationExampleInputSchema, AddOperationInputSchema, AddStateExampleInputSchema, AuthActionNotAllowedError, AuthAdministrationLockoutError, AuthAdministrationMissingError, AuthAlreadyInitializedError, AuthInitializerNotCreatorError, AuthPolicyNotPreservedError, AuthorSchema, BaseDocumentHeaderSchema, BaseDocumentStateSchema, CodeExampleSchema, ConfigEntrySchema, ConfigEntryTypeSchema, DOCUMENT_DELETED_REASON, DeleteChangeLogItemInputSchema, DeleteModuleInputSchema, DeleteOperationErrorInputSchema, DeleteOperationExampleInputSchema, DeleteOperationInputSchema, DeleteStateExampleInputSchema, DocumentActionSchema, DocumentModelGlobalStateSchema, DocumentModelHeaderSchema, DocumentModelInputSchema, DocumentModelPHStateSchema, DocumentModelSchema, DocumentSpecificationSchema, DowngradeNotSupportedError, FileSystemError, GrantNotFoundError, GrantSchema, GroupPrincipalNotAllowedError, HASH_ALGORITHM_SHA1, HASH_ALGORITHM_SHA256, HASH_ALGORITHM_SHA512, HASH_ENCODING_BASE64, HASH_ENCODING_HEX, HashMismatchError, InitializeAuthActionInputSchema, IntegrityIssueSubType, IntegrityIssueType, InvalidActionInputError, InvalidActionInputZodError, InvalidAuthVersionError, InvalidGrantError,
|
|
5048
|
+
export { ACTION_SIGNATURE_V2_PREFIX, AUTH_ACTION_TYPES, AUTH_DENIED_BY_GRANT_REASON, AUTH_NO_GRANT_REASON, AUTH_VERSION_UNSUPPORTED_REASON, AddChangeLogItemInputSchema, AddModuleInputSchema, AddOperationErrorInputSchema, AddOperationExampleInputSchema, AddOperationInputSchema, AddStateExampleInputSchema, AuthActionNotAllowedError, AuthAdministrationLockoutError, AuthAdministrationMissingError, AuthAlreadyInitializedError, AuthInitializerNotCreatorError, AuthPolicyNotPreservedError, AuthorSchema, BaseDocumentHeaderSchema, BaseDocumentStateSchema, CanonicalJsonError, CodeExampleSchema, ConfigEntrySchema, ConfigEntryTypeSchema, DEFAULT_SIGNATURE_POLICY, DOCUMENT_DELETED_REASON, DOCUMENT_PURGE_PROTOCOL, DOCUMENT_SCOPE_ACTION_TYPES, DeleteChangeLogItemInputSchema, DeleteModuleInputSchema, DeleteOperationErrorInputSchema, DeleteOperationExampleInputSchema, DeleteOperationInputSchema, DeleteStateExampleInputSchema, DocumentActionSchema, DocumentModelGlobalStateSchema, DocumentModelHeaderSchema, DocumentModelInputSchema, DocumentModelPHStateSchema, DocumentModelSchema, DocumentSpecificationSchema, DowngradeNotSupportedError, FileSystemError, GrantNotFoundError, GrantSchema, GroupPrincipalNotAllowedError, HASH_ALGORITHM_SHA1, HASH_ALGORITHM_SHA256, HASH_ALGORITHM_SHA512, HASH_ENCODING_BASE64, HASH_ENCODING_HEX, HashMismatchError, InitializeAuthActionInputSchema, IntegrityIssueSubType, IntegrityIssueType, InvalidActionInputError, InvalidActionInputZodError, InvalidAuthVersionError, InvalidGrantError, MARKER_REFUSAL_FEATURE, MAX_AUTH_GRANTS, MAX_CAPABILITY_OPERATIONS, MAX_CONDITION_DEPTH, MAX_CONDITION_NODES, MAX_SUPPORTED_AUTH_VERSION, ManifestSchema, ModuleSchema, MoveGrantActionInputSchema, MoveOperationInputSchema, OPERATION_NAME_PATTERN, OperationErrorSchema, OperationScopeSchema, OperationSpecificationSchema, PEER_CAPABILITIES, PEER_MANIFEST_FORMAT, PURGE_DOCUMENT, PieceModuleSchema, PieceModulesSchema, PowerhouseModuleSchema, PowerhouseModulesSchema, PublisherSchema, PwaConfigSchema, RESERVED_OPERATION_NAMES, RedoActionInputSchema, RedoActionSchema, RedoSchema, RemoveGrantActionInputSchema, ReorderChangeLogItemsInputSchema, ReorderModuleOperationsInputSchema, ReorderModulesInputSchema, ReorderOperationErrorsInputSchema, ReorderOperationExamplesInputSchema, ReorderStateExamplesInputSchema, SIGNATURE_PROTOCOL, SIGNATURE_PROTOCOL_V2, ScopeStateSchema, SetAuthorNameInputSchema, SetAuthorWebsiteInputSchema, SetGrantActionInputSchema, SetInitialStateInputSchema, SetModelDescriptionInputSchema, SetModelExtensionInputSchema, SetModelIdInputSchema, SetModelNameInputSchema, SetModuleDescriptionInputSchema, SetModuleNameInputSchema, SetNameActionInputSchema, SetNameActionSchema, SetOperationDescriptionInputSchema, SetOperationErrorCodeInputSchema, SetOperationErrorDescriptionInputSchema, SetOperationErrorNameInputSchema, SetOperationErrorTemplateInputSchema, SetOperationNameInputSchema, SetOperationReducerInputSchema, SetOperationSchemaInputSchema, SetOperationScopeInputSchema, SetOperationTemplateInputSchema, SetPreferredEditorActionInputSchema, SetPreferredEditorActionSchema, SetStateSchemaInputSchema, Set_NameSchema, Set_PreferredEditorSchema, StateSchema, UndoActionInputSchema, UndoActionSchema, UndoSchema, UnsupportedDocumentModelVersionError, UpdateChangeLogItemInputSchema, UpdateOperationExampleInputSchema, UpdateStateExampleInputSchema, ab2hex, actionContext, actionFromAction, actionPreimageV2, actionSigner, actionSignerIdentity, actionSigningTarget, actions, addChangeLogItem, addModule, addOperation, addOperationError, addOperationExample, addStateExample, addUndo, appendWithoutApplying, applyAuthAction, applyDeleteDocumentAction, applyInitializeAuthAction, applyMoveGrantAction, applyRemoveGrantAction, applySetGrantAction, applyUpgradeDocumentAction, assertAuthAdministrationRetained, assertAuthPreservedOnDuplicate, assertAuthScopeActionAllowed, assertIsDocumentModelDocument, assertIsDocumentModelState, assertModuleIdUnique, assertOperationErrorIdUnique, assertOperationExampleIdUnique, assertOperationIdUnique, assertValidGrant, assertValidGrantUpsert, assertValidInitialGrants, attachBranch, backfillAuthState, base58Decode, base64UrlToBytes, baseActions, baseCreateDocument, baseLoadFromInput, baseLoadFromInputVersioned, baseReducer, baseReducerVersion, baseSaveToFileHandle, buildOperationSignature, buildOperationSignatureMessage, buildOperationSignatureParams, buildSignedAction, bytesToBase64Url, canonicalJson, checkCleanedOperationsIntegrity, checkOperationsIntegrity, computeUpgradeTransitions, coversLocal, createAction, createAuthState, createBaseState, createCopyHeader, createDocumentState, createGlobalState, createLocalState, createMinimalZip, createPresignedHeader, createReducer, createSignedHeader, createSignedHeaderForSigner, createState, createVerificationSigner, createZip, decide, defaultAuthState, defaultBaseState, defaultDocumentState, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, deleteChangeLogItem, deleteModule, deleteOperation, deleteOperationError, deleteOperationExample, deleteStateExample, deriveDocumentId, deriveOperationId, deserializeSignature, diffOperations, documentModelActions, documentModelDocumentType, documentModelFileExtension, documentModelGlobalState, documentModelHeaderReducer, documentModelInitialGlobalState, documentModelInitialLocalState, documentModelLoadFromInput, documentModelModuleReducer, documentModelOperationErrorReducer, documentModelOperationExampleReducer, documentModelOperationReducer, documentModelReducer, documentModelSaveToFileHandle, documentModelStateReducer, documentModelStateSchemaReducer, documentModelVersioningReducer, evaluate, evaluateCondition, evaluateGrantStack, evaluateGrants, fetchFileBrowser, filterDocumentOperationsResultingState, filterDuplicatedOperations, findModuleOrThrow, findOperationErrorOrThrow, findOperationExampleOrThrow, findOperationOrThrow, garbageCollect, garbageCollectDocumentOperations, garbageCollectV2, generateId, generateMock, getAllOperationNames, getDocumentLastModified, getFileBrowser, getUnixTimestamp, grantProblem, groupDocumentType, groupMembershipActionTypes, groupOperationsByScope, hasDerivedDocumentId, hashActionV2, hashBrowser, hashDocumentStateForScope, hex2ab, holdReason, initializeAuth, isAuthAction, isDefinedNonNullAny, isDenied, isDerivedDocumentId, isDocumentAction, isDocumentCreator, isDocumentModelDocument, isDocumentModelState, isDocumentZip, isNoopOperation, isOlderManifest, isPlainValue, isPurgeMarker, isReservedOperationName, isSignaturePolicy, isUndo, isUndoRedo, isV2ActionHash, isValidOperationNameFormat, legacySupports, localPeerManifest, localSupports, manifestRevision, mapSkippedOperations, mapSkippedOperationsV2, mentionedGroupIds, merge, mergePeerCapabilities, moveGrant, moveOperation, nextSkipNumber, noop, normalizeDocumentModelVersion, operationExampleCreators, operationFromAction, operationFromOperation, operationOutcome, operationWithContext, operationsAreEqual, parseBulkArchive, parseResultingState, peerSupports, precedes, prepareOperations, processUndoRedo, protocolVersionsFor, purgeDocumentAction, purgeMarkerOperation, purgedProtocolVersions, readFileBrowser, readOnly, readPeerManifest, redo, redoOperation, referencedGroupIds, releaseNewVersion, removeExistingOperations, removeGrant, reorderChangeLogItems, reorderModuleOperations, reorderModules, reorderOperationErrors, reorderOperationExamples, reorderStateExamples, replayDocument, replayDocumentVersioned, replayOperations, requestedSignaturePolicy, reshuffleByTimestamp, reshuffleByTimestampAndIndex, resolveSnapshotAuth, selectProtocolVersions, serializeSignature, setAuthorName, setAuthorWebsite, setGrant, setInitialState, setModelDescription, setModelExtension, setModelId, setModelName, setModuleDescription, setModuleName, setName, setNameOperation, setOperationDescription, setOperationErrorCode, setOperationErrorDescription, setOperationErrorName, setOperationErrorTemplate, setOperationName, setOperationReducer, setOperationSchema, setOperationScope, setOperationTemplate, setPreferredEditor, setPreferredEditorOperation, setStateSchema, sign, signActionV2, signaturePolicyOf, skipHeaderOperations, sortMappedOperations, sortOperations, split, targetDocumentId, toTransportAction, undo, undoOperation, undoOperationV2, updateChangeLogItem, updateDocument, updateHeaderRevision, updateOperationExample, updateStateExample, v2RequiredProtocolVersions, v2TupleProblem, validateHeader, validateInitialState, validateModule, validateModuleOperation, validateModules, validateOperationName, validateOperations, validateStateSchemaName, verify, verifyOperationSignature, withProtocolVersions, withSignaturePolicy, writeFileBrowser, zipEntries };
|
|
5142
5049
|
|
|
5143
5050
|
//# sourceMappingURL=index.js.map
|