@noy-db/hub 0.2.0-pre.17 → 0.2.0-pre.19
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/aggregate/index.cjs +227 -3
- package/dist/aggregate/index.cjs.map +1 -1
- package/dist/aggregate/index.d.cts +3 -3
- package/dist/aggregate/index.d.ts +3 -3
- package/dist/aggregate/index.js +5 -4
- package/dist/aggregate/index.js.map +1 -1
- package/dist/attestation/index.cjs.map +1 -1
- package/dist/attestation/index.d.cts +5 -5
- package/dist/attestation/index.d.ts +5 -5
- package/dist/attestation/index.js +6 -6
- package/dist/blobs/index.cjs +4 -10
- package/dist/blobs/index.cjs.map +1 -1
- package/dist/blobs/index.d.cts +6 -6
- package/dist/blobs/index.d.ts +6 -6
- package/dist/blobs/index.js +6 -6
- package/dist/bundle/index.cjs +1587 -392
- package/dist/bundle/index.cjs.map +1 -1
- package/dist/bundle/index.d.cts +7 -7
- package/dist/bundle/index.d.ts +7 -7
- package/dist/bundle/index.js +10 -10
- package/dist/{chunk-NBBMMJ2H.js → chunk-3FSMVWBN.js} +4 -4
- package/dist/{chunk-HGVSHKZW.js → chunk-3Q2AOPLT.js} +100 -29
- package/dist/chunk-3Q2AOPLT.js.map +1 -0
- package/dist/{chunk-SHX5QBCI.js → chunk-4ULLGYPA.js} +3 -3
- package/dist/{chunk-CD2AVTEM.js → chunk-5IGWRMEC.js} +5 -5
- package/dist/{chunk-QO6RGLLD.js → chunk-6KESZO5D.js} +35 -7
- package/dist/chunk-6KESZO5D.js.map +1 -0
- package/dist/{chunk-GP3SDSH2.js → chunk-6OSOE6BY.js} +15 -2
- package/dist/chunk-6OSOE6BY.js.map +1 -0
- package/dist/{chunk-F4G63NTZ.js → chunk-7C6VFNIY.js} +2 -2
- package/dist/{chunk-XJV6OB4D.js → chunk-7HD67R6U.js} +2 -2
- package/dist/{chunk-UMLVJTYV.js → chunk-ADB7GPM3.js} +7 -4
- package/dist/chunk-ADB7GPM3.js.map +1 -0
- package/dist/{chunk-NYSYPFXJ.js → chunk-B6E5IRPJ.js} +3 -3
- package/dist/chunk-CYNTFU2D.js +129 -0
- package/dist/chunk-CYNTFU2D.js.map +1 -0
- package/dist/{chunk-ZEGSDPB7.js → chunk-DJF3FXW5.js} +35 -1
- package/dist/chunk-DJF3FXW5.js.map +1 -0
- package/dist/{chunk-3G3W65EQ.js → chunk-DY3EOJEN.js} +2 -2
- package/dist/{chunk-YYVZYTWW.js → chunk-E66DSTJP.js} +3 -3
- package/dist/{chunk-5LIROIDM.js → chunk-FBLAWK6A.js} +2 -2
- package/dist/{chunk-E77UKJYL.js → chunk-FPHRTW2Z.js} +5 -5
- package/dist/{state-vault-W2OEABNO.js → chunk-G4PYA575.js} +24 -7
- package/dist/chunk-G4PYA575.js.map +1 -0
- package/dist/{chunk-U5QCMH3W.js → chunk-GKQAU52M.js} +4 -4
- package/dist/{chunk-2FU2FTXD.js → chunk-GYAWXHFO.js} +2 -2
- package/dist/{chunk-ROPJVUG3.js → chunk-H42KZXNV.js} +5 -210
- package/dist/chunk-H42KZXNV.js.map +1 -0
- package/dist/{chunk-XPIHJ34I.js → chunk-IBVTH4JR.js} +4 -4
- package/dist/{chunk-C3HYQPV4.js → chunk-IVP5IVON.js} +2 -2
- package/dist/{chunk-BL5GYANC.js → chunk-KEDJDWWQ.js} +3 -3
- package/dist/{chunk-I5IUYN7B.js → chunk-KNKNOJFS.js} +3 -3
- package/dist/chunk-KNKNOJFS.js.map +1 -0
- package/dist/{chunk-D77ZQSQQ.js → chunk-KYGGXXT6.js} +829 -170
- package/dist/chunk-KYGGXXT6.js.map +1 -0
- package/dist/{chunk-J7RWBXFY.js → chunk-LSIIPKYT.js} +2 -2
- package/dist/{chunk-BSZOCSDZ.js → chunk-M3FPNTO2.js} +4 -4
- package/dist/{chunk-XMVHEWF6.js → chunk-MI36HL5G.js} +4 -4
- package/dist/{chunk-ROVO6NPJ.js → chunk-NN6IISZO.js} +58 -3
- package/dist/chunk-NN6IISZO.js.map +1 -0
- package/dist/{chunk-7H2GEJ3O.js → chunk-OBMYMKGO.js} +29 -6
- package/dist/{chunk-7H2GEJ3O.js.map → chunk-OBMYMKGO.js.map} +1 -1
- package/dist/{chunk-UNTGHX5A.js → chunk-OKOKPYWH.js} +2 -2
- package/dist/{chunk-WV7WV6JO.js → chunk-OY7RX2VL.js} +9 -15
- package/dist/chunk-OY7RX2VL.js.map +1 -0
- package/dist/{chunk-H2MRGONI.js → chunk-PTGQPWMV.js} +2 -2
- package/dist/{chunk-BJSLBUJ7.js → chunk-PWFTQHYX.js} +2 -2
- package/dist/{chunk-5AXTH4QZ.js → chunk-Q5MCHUXZ.js} +2 -2
- package/dist/{chunk-QHM6XEAH.js → chunk-S22UOMHM.js} +6 -6
- package/dist/{chunk-WIAOUFFB.js → chunk-S3XA7G35.js} +2 -2
- package/dist/{chunk-SISBMAPO.js → chunk-SHIUFIPW.js} +1 -1
- package/dist/chunk-SHIUFIPW.js.map +1 -0
- package/dist/{chunk-KCEHMDZF.js → chunk-U7JNBSS3.js} +3 -3
- package/dist/{chunk-ZNGPEV5J.js → chunk-V3VIRTTE.js} +3 -3
- package/dist/{chunk-TIDXB5DF.js → chunk-V5FZWQNN.js} +4 -4
- package/dist/chunk-VEIVAYJ7.js +361 -0
- package/dist/chunk-VEIVAYJ7.js.map +1 -0
- package/dist/{chunk-AEIKD3PP.js → chunk-VNUE6FHP.js} +3 -3
- package/dist/{chunk-DYYYUW5D.js → chunk-WFK2EVYU.js} +10 -2
- package/dist/chunk-WFK2EVYU.js.map +1 -0
- package/dist/{chunk-XMHUK5PN.js → chunk-X7FJMKT3.js} +2 -2
- package/dist/{chunk-FEJDVE3Z.js → chunk-XPH3FWME.js} +7 -2
- package/dist/{chunk-FEJDVE3Z.js.map → chunk-XPH3FWME.js.map} +1 -1
- package/dist/{chunk-SNMJ7SB3.js → chunk-Y5J63SMF.js} +5 -5
- package/dist/{chunk-M476FOQ7.js → chunk-YLRRU72W.js} +2 -2
- package/dist/{chunk-DWEBTE2W.js → chunk-YX333DPS.js} +4 -4
- package/dist/{chunk-BH3X5L6A.js → chunk-YZE6C3TQ.js} +3 -3
- package/dist/consent/index.cjs.map +1 -1
- package/dist/consent/index.d.cts +6 -6
- package/dist/consent/index.d.ts +6 -6
- package/dist/consent/index.js +3 -3
- package/dist/{crypto-7BN2HDWG.js → crypto-B46VNH6X.js} +3 -3
- package/dist/{delegation-MGH5SODX.js → delegation-5HON72PV.js} +5 -5
- package/dist/derivations/index.cjs +82 -2
- package/dist/derivations/index.cjs.map +1 -1
- package/dist/derivations/index.d.cts +7 -7
- package/dist/derivations/index.d.ts +7 -7
- package/dist/derivations/index.js +8 -6
- package/dist/{dev-unlock-iXbYFAWl.d.cts → dev-unlock-BR1rMOS-.d.cts} +1 -1
- package/dist/{dev-unlock-CI1ijTML.d.ts → dev-unlock-whL49sxV.d.ts} +1 -1
- package/dist/{errors-Dz64FA65.d.cts → errors-DL-zTrrF.d.cts} +29 -1
- package/dist/{errors-Dz64FA65.d.ts → errors-DL-zTrrF.d.ts} +29 -1
- package/dist/executor-44R5CUS2.js +12 -0
- package/dist/executor-AOACUK7Z.js +8 -0
- package/dist/executor-OKFLQCDW.js +8 -0
- package/dist/{fanout-sidecar-FIJJ46YG.js → fanout-sidecar-DCQWJQ6S.js} +2 -2
- package/dist/forget/index.cjs.map +1 -1
- package/dist/forget/index.d.cts +1 -1
- package/dist/forget/index.d.ts +1 -1
- package/dist/forget/index.js +4 -4
- package/dist/guards/index.cjs +80 -3
- package/dist/guards/index.cjs.map +1 -1
- package/dist/guards/index.d.cts +7 -7
- package/dist/guards/index.d.ts +7 -7
- package/dist/guards/index.js +8 -4
- package/dist/{hash-tEcM5fnv.d.cts → hash-BEUBmmI4.d.cts} +1 -1
- package/dist/{hash-blk7Bkes.d.ts → hash-Dtb7FwWd.d.ts} +1 -1
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +7 -7
- package/dist/history/index.d.ts +7 -7
- package/dist/history/index.js +5 -5
- package/dist/i18n/index.cjs +149 -132
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +6 -6
- package/dist/i18n/index.d.ts +6 -6
- package/dist/i18n/index.js +14 -14
- package/dist/{index-u-kWzSrL.d.cts → index-BM7O48Ur.d.cts} +85 -9
- package/dist/{index-C-SSRIxP.d.cts → index-BMmajblo.d.cts} +14 -0
- package/dist/{index-C-SSRIxP.d.ts → index-BMmajblo.d.ts} +14 -0
- package/dist/{index-DpU6KWof.d.ts → index-BelbyUwz.d.ts} +85 -9
- package/dist/index.cjs +2206 -992
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -16
- package/dist/index.d.ts +29 -16
- package/dist/index.js +76 -54
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.cjs.map +1 -1
- package/dist/indexing/index.js +4 -4
- package/dist/issue-EPA2PSWP.js +12 -0
- package/dist/{ledger-LFVLHE5H.js → ledger-LS6GXCBP.js} +5 -5
- package/dist/materialized-views/index.cjs +257 -4
- package/dist/materialized-views/index.cjs.map +1 -1
- package/dist/materialized-views/index.d.cts +7 -7
- package/dist/materialized-views/index.d.ts +7 -7
- package/dist/materialized-views/index.js +8 -7
- package/dist/noydb-BVKFP74P.js +38 -0
- package/dist/overlay-views/index.cjs.map +1 -1
- package/dist/overlay-views/index.d.cts +7 -7
- package/dist/overlay-views/index.d.ts +7 -7
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.cjs.map +1 -1
- package/dist/periods/index.d.cts +6 -6
- package/dist/periods/index.d.ts +6 -6
- package/dist/periods/index.js +5 -5
- package/dist/{public-envelope-RXZNP3V6.js → public-envelope-AGU6SS4Z.js} +4 -4
- package/dist/query/index.cjs +320 -28
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +3 -3
- package/dist/query/index.d.ts +3 -3
- package/dist/query/index.js +7 -6
- package/dist/read-only-facade-EX6WZZBP.js +7 -0
- package/dist/registry-ERNAMRDE.js +8 -0
- package/dist/registry-EXTHSXQW.js +8 -0
- package/dist/{registry-SECUWSGY.js → registry-RDPTFXQ7.js} +3 -3
- package/dist/{revoke-B54H2S2W.js → revoke-IFLXEZA5.js} +6 -6
- package/dist/sealed-record/index.cjs.map +1 -1
- package/dist/sealed-record/index.d.cts +1 -1
- package/dist/sealed-record/index.d.ts +1 -1
- package/dist/sealed-record/index.js +2 -2
- package/dist/session/index.cjs.map +1 -1
- package/dist/session/index.d.cts +7 -7
- package/dist/session/index.d.ts +7 -7
- package/dist/session/index.js +3 -3
- package/dist/shadow/index.cjs.map +1 -1
- package/dist/shadow/index.d.cts +6 -6
- package/dist/shadow/index.d.ts +6 -6
- package/dist/shadow/index.js +2 -2
- package/dist/{signer-YSXZT574.js → signer-UNWOUJAK.js} +5 -5
- package/dist/snapshots/index.cjs.map +1 -1
- package/dist/snapshots/index.d.cts +6 -6
- package/dist/snapshots/index.d.ts +6 -6
- package/dist/snapshots/index.js +4 -4
- package/dist/{stale-TOA36SRK.js → stale-NTEV5SLX.js} +2 -2
- package/dist/state-vault-TUTFRTOA.js +14 -0
- package/dist/state-vault-TUTFRTOA.js.map +1 -0
- package/dist/store/index.cjs +8 -0
- package/dist/store/index.cjs.map +1 -1
- package/dist/store/index.d.cts +13 -6
- package/dist/store/index.d.ts +13 -6
- package/dist/store/index.js +2 -2
- package/dist/{strategy-4M9jo172.d.ts → strategy-BDxQnnTX.d.ts} +315 -4
- package/dist/{strategy-CLC1j79g.d.cts → strategy-C5ol6NdV.d.cts} +315 -4
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +5 -5
- package/dist/sync/index.d.ts +5 -5
- package/dist/sync/index.js +4 -4
- package/dist/team/index.cjs.map +1 -1
- package/dist/team/index.d.cts +6 -6
- package/dist/team/index.d.ts +6 -6
- package/dist/team/index.js +8 -8
- package/dist/transition-guard-B1N82hMf.d.cts +165 -0
- package/dist/transition-guard-C__YeF3_.d.ts +165 -0
- package/dist/tx/index.cjs.map +1 -1
- package/dist/tx/index.d.cts +6 -6
- package/dist/tx/index.d.ts +6 -6
- package/dist/tx/index.js +3 -3
- package/dist/{types-CljIHm_J.d.ts → types-CraiZOyO.d.ts} +609 -305
- package/dist/{types-CrSpRDuG.d.cts → types-D-gr5t0G.d.cts} +609 -305
- package/dist/{ulid-CrI7PPbA.d.cts → ulid-DQnSAP5W.d.cts} +1 -1
- package/dist/{ulid-CWfL2Vfv.d.ts → ulid-FFRRHkVf.d.ts} +1 -1
- package/dist/util/index.cjs.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{vault-group-DHAHFX2A.js → vault-group-27EV7KB4.js} +205 -8
- package/dist/vault-group-27EV7KB4.js.map +1 -0
- package/dist/{with-materialized-view-NzF71cG_.d.cts → with-materialized-view-BboqxyV3.d.cts} +1 -1
- package/dist/{with-materialized-view-B892zYZV.d.ts → with-materialized-view-CguCeVcT.d.ts} +1 -1
- package/dist/{with-overlayed-view-CR6m7CHe.d.ts → with-overlayed-view-DO08u_tx.d.ts} +1 -1
- package/dist/{with-overlayed-view-UI8qSGL4.d.cts → with-overlayed-view-mmsg5Of3.d.cts} +1 -1
- package/dist/with-rollup-_TyBzz3T.d.ts +47 -0
- package/dist/with-rollup-aaxOZcIb.d.cts +47 -0
- package/package.json +3 -3
- package/dist/chunk-D77ZQSQQ.js.map +0 -1
- package/dist/chunk-DYYYUW5D.js.map +0 -1
- package/dist/chunk-GP3SDSH2.js.map +0 -1
- package/dist/chunk-HGVSHKZW.js.map +0 -1
- package/dist/chunk-I5IUYN7B.js.map +0 -1
- package/dist/chunk-JDWE6JMX.js +0 -139
- package/dist/chunk-JDWE6JMX.js.map +0 -1
- package/dist/chunk-PDULVIBY.js +0 -63
- package/dist/chunk-PDULVIBY.js.map +0 -1
- package/dist/chunk-QO6RGLLD.js.map +0 -1
- package/dist/chunk-ROPJVUG3.js.map +0 -1
- package/dist/chunk-ROVO6NPJ.js.map +0 -1
- package/dist/chunk-SISBMAPO.js.map +0 -1
- package/dist/chunk-UMLVJTYV.js.map +0 -1
- package/dist/chunk-WV7WV6JO.js.map +0 -1
- package/dist/chunk-ZEGSDPB7.js.map +0 -1
- package/dist/executor-3W63Y44O.js +0 -11
- package/dist/executor-CFFWPWBJ.js +0 -8
- package/dist/executor-VDQQOR4F.js +0 -8
- package/dist/immutable-guard-B5M95nbq.d.ts +0 -82
- package/dist/immutable-guard-qN3zF8o1.d.cts +0 -82
- package/dist/issue-TTMGHQ2J.js +0 -12
- package/dist/noydb-36S6GQNC.js +0 -37
- package/dist/read-only-facade-ITU6L7BL.js +0 -7
- package/dist/registry-3YFLZ7WD.js +0 -8
- package/dist/registry-TGZISEWC.js +0 -8
- package/dist/state-vault-W2OEABNO.js.map +0 -1
- package/dist/vault-group-DHAHFX2A.js.map +0 -1
- package/dist/with-derivation-BZ2y4bzF.d.ts +0 -13
- package/dist/with-derivation-Bozs8DmD.d.cts +0 -13
- /package/dist/{chunk-NBBMMJ2H.js.map → chunk-3FSMVWBN.js.map} +0 -0
- /package/dist/{chunk-SHX5QBCI.js.map → chunk-4ULLGYPA.js.map} +0 -0
- /package/dist/{chunk-CD2AVTEM.js.map → chunk-5IGWRMEC.js.map} +0 -0
- /package/dist/{chunk-F4G63NTZ.js.map → chunk-7C6VFNIY.js.map} +0 -0
- /package/dist/{chunk-XJV6OB4D.js.map → chunk-7HD67R6U.js.map} +0 -0
- /package/dist/{chunk-NYSYPFXJ.js.map → chunk-B6E5IRPJ.js.map} +0 -0
- /package/dist/{chunk-3G3W65EQ.js.map → chunk-DY3EOJEN.js.map} +0 -0
- /package/dist/{chunk-YYVZYTWW.js.map → chunk-E66DSTJP.js.map} +0 -0
- /package/dist/{chunk-5LIROIDM.js.map → chunk-FBLAWK6A.js.map} +0 -0
- /package/dist/{chunk-E77UKJYL.js.map → chunk-FPHRTW2Z.js.map} +0 -0
- /package/dist/{chunk-U5QCMH3W.js.map → chunk-GKQAU52M.js.map} +0 -0
- /package/dist/{chunk-2FU2FTXD.js.map → chunk-GYAWXHFO.js.map} +0 -0
- /package/dist/{chunk-XPIHJ34I.js.map → chunk-IBVTH4JR.js.map} +0 -0
- /package/dist/{chunk-C3HYQPV4.js.map → chunk-IVP5IVON.js.map} +0 -0
- /package/dist/{chunk-BL5GYANC.js.map → chunk-KEDJDWWQ.js.map} +0 -0
- /package/dist/{chunk-J7RWBXFY.js.map → chunk-LSIIPKYT.js.map} +0 -0
- /package/dist/{chunk-BSZOCSDZ.js.map → chunk-M3FPNTO2.js.map} +0 -0
- /package/dist/{chunk-XMVHEWF6.js.map → chunk-MI36HL5G.js.map} +0 -0
- /package/dist/{chunk-UNTGHX5A.js.map → chunk-OKOKPYWH.js.map} +0 -0
- /package/dist/{chunk-H2MRGONI.js.map → chunk-PTGQPWMV.js.map} +0 -0
- /package/dist/{chunk-BJSLBUJ7.js.map → chunk-PWFTQHYX.js.map} +0 -0
- /package/dist/{chunk-5AXTH4QZ.js.map → chunk-Q5MCHUXZ.js.map} +0 -0
- /package/dist/{chunk-QHM6XEAH.js.map → chunk-S22UOMHM.js.map} +0 -0
- /package/dist/{chunk-WIAOUFFB.js.map → chunk-S3XA7G35.js.map} +0 -0
- /package/dist/{chunk-KCEHMDZF.js.map → chunk-U7JNBSS3.js.map} +0 -0
- /package/dist/{chunk-ZNGPEV5J.js.map → chunk-V3VIRTTE.js.map} +0 -0
- /package/dist/{chunk-TIDXB5DF.js.map → chunk-V5FZWQNN.js.map} +0 -0
- /package/dist/{chunk-AEIKD3PP.js.map → chunk-VNUE6FHP.js.map} +0 -0
- /package/dist/{chunk-XMHUK5PN.js.map → chunk-X7FJMKT3.js.map} +0 -0
- /package/dist/{chunk-SNMJ7SB3.js.map → chunk-Y5J63SMF.js.map} +0 -0
- /package/dist/{chunk-M476FOQ7.js.map → chunk-YLRRU72W.js.map} +0 -0
- /package/dist/{chunk-DWEBTE2W.js.map → chunk-YX333DPS.js.map} +0 -0
- /package/dist/{chunk-BH3X5L6A.js.map → chunk-YZE6C3TQ.js.map} +0 -0
- /package/dist/{crypto-7BN2HDWG.js.map → crypto-B46VNH6X.js.map} +0 -0
- /package/dist/{delegation-MGH5SODX.js.map → delegation-5HON72PV.js.map} +0 -0
- /package/dist/{executor-3W63Y44O.js.map → executor-44R5CUS2.js.map} +0 -0
- /package/dist/{executor-CFFWPWBJ.js.map → executor-AOACUK7Z.js.map} +0 -0
- /package/dist/{executor-VDQQOR4F.js.map → executor-OKFLQCDW.js.map} +0 -0
- /package/dist/{fanout-sidecar-FIJJ46YG.js.map → fanout-sidecar-DCQWJQ6S.js.map} +0 -0
- /package/dist/{issue-TTMGHQ2J.js.map → issue-EPA2PSWP.js.map} +0 -0
- /package/dist/{ledger-LFVLHE5H.js.map → ledger-LS6GXCBP.js.map} +0 -0
- /package/dist/{noydb-36S6GQNC.js.map → noydb-BVKFP74P.js.map} +0 -0
- /package/dist/{public-envelope-RXZNP3V6.js.map → public-envelope-AGU6SS4Z.js.map} +0 -0
- /package/dist/{read-only-facade-ITU6L7BL.js.map → read-only-facade-EX6WZZBP.js.map} +0 -0
- /package/dist/{registry-3YFLZ7WD.js.map → registry-ERNAMRDE.js.map} +0 -0
- /package/dist/{registry-SECUWSGY.js.map → registry-EXTHSXQW.js.map} +0 -0
- /package/dist/{registry-TGZISEWC.js.map → registry-RDPTFXQ7.js.map} +0 -0
- /package/dist/{revoke-B54H2S2W.js.map → revoke-IFLXEZA5.js.map} +0 -0
- /package/dist/{signer-YSXZT574.js.map → signer-UNWOUJAK.js.map} +0 -0
- /package/dist/{stale-TOA36SRK.js.map → stale-NTEV5SLX.js.map} +0 -0
package/dist/team/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aP as NoydbStore, aN as UnlockedKeyring } from '../types-D-gr5t0G.cjs';
|
|
2
|
+
export { b7 as BundleRecipient, cd as EnrollAuthenticatorOptions, ce as EnrollAuthenticatorWrappingDEKsOptions, cf as EnrollAuthenticatorWrappingKEKOptions, cU as ListUsersOptions, dk as PaperRecoveryEntry, dt as PresenceHandle, dO as RecoverPassphraseInput, dP as RecoverPassphraseResult, dQ as RecoverUserOptions, dR as RecoveryProof, dV as RotatePassphraseInput, eh as SlotRewrapCeremony, ei as SlotRewrapContext, er as SyncEngine, ez as SyncTransaction, eP as UpdateAuthenticatorOptions, f7 as WrappedDeksBlob, fe as buildRecipientKeyringFile, ff as burnPaperRecoveryEntry, g7 as changeSecret, g8 as createOwnerKeyring, fj as deriveMagicLinkContentKey, fk as enrollAuthenticator, g9 as ensureCollectionDEK, fn as evaluateExportCapability, fo as evaluateImportCapability, fp as findAuthenticator, ga as grant, fq as hasExportCapability, fr as hasImportCapability, fu as isMagicLinkGrantExpired, fz as listMagicLinkGrants, fA as listUsers, fB as listUsersWithEnvelopes, gb as loadKeyring, fD as loadPaperRecoveryEntries, fG as magicLinkGrantRecordId, fH as mintPaperRecoveryEntry, fJ as mintWrappedDeksBlob, gc as persistKeyring, fM as readMagicLinkGrantRecord, fx as recoverPassphrase, fN as recoverUser, fO as removeAuthenticator, gd as revoke, fS as revokeMagicLinkGrant, fy as rotatePassphrase, fU as savePaperRecoveryEntries, fY as unwrapDeksFromBlob, fZ as unwrapDeksFromPaperEntry, f$ as unwrapMagicLinkGrant, ge as updateAuthenticator, gf as updateKeyringIdentity, g6 as writeMagicLinkGrant } from '../types-D-gr5t0G.cjs';
|
|
3
3
|
import '../lazy-builder-eYZzLEL1.cjs';
|
|
4
4
|
import '../predicate-BmhBSPCH.cjs';
|
|
5
|
-
import '../strategy-
|
|
6
|
-
import '../errors-
|
|
5
|
+
import '../strategy-C5ol6NdV.cjs';
|
|
6
|
+
import '../errors-DL-zTrrF.cjs';
|
|
7
7
|
import '../strategy-BSxFXGzb.cjs';
|
|
8
|
-
import '../index-
|
|
9
|
-
import '../index-
|
|
8
|
+
import '../index-BMmajblo.cjs';
|
|
9
|
+
import '../index-BM7O48Ur.cjs';
|
|
10
10
|
import '@noy-db/attestation';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/team/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { aP as NoydbStore, aN as UnlockedKeyring } from '../types-CraiZOyO.js';
|
|
2
|
+
export { b7 as BundleRecipient, cd as EnrollAuthenticatorOptions, ce as EnrollAuthenticatorWrappingDEKsOptions, cf as EnrollAuthenticatorWrappingKEKOptions, cU as ListUsersOptions, dk as PaperRecoveryEntry, dt as PresenceHandle, dO as RecoverPassphraseInput, dP as RecoverPassphraseResult, dQ as RecoverUserOptions, dR as RecoveryProof, dV as RotatePassphraseInput, eh as SlotRewrapCeremony, ei as SlotRewrapContext, er as SyncEngine, ez as SyncTransaction, eP as UpdateAuthenticatorOptions, f7 as WrappedDeksBlob, fe as buildRecipientKeyringFile, ff as burnPaperRecoveryEntry, g7 as changeSecret, g8 as createOwnerKeyring, fj as deriveMagicLinkContentKey, fk as enrollAuthenticator, g9 as ensureCollectionDEK, fn as evaluateExportCapability, fo as evaluateImportCapability, fp as findAuthenticator, ga as grant, fq as hasExportCapability, fr as hasImportCapability, fu as isMagicLinkGrantExpired, fz as listMagicLinkGrants, fA as listUsers, fB as listUsersWithEnvelopes, gb as loadKeyring, fD as loadPaperRecoveryEntries, fG as magicLinkGrantRecordId, fH as mintPaperRecoveryEntry, fJ as mintWrappedDeksBlob, gc as persistKeyring, fM as readMagicLinkGrantRecord, fx as recoverPassphrase, fN as recoverUser, fO as removeAuthenticator, gd as revoke, fS as revokeMagicLinkGrant, fy as rotatePassphrase, fU as savePaperRecoveryEntries, fY as unwrapDeksFromBlob, fZ as unwrapDeksFromPaperEntry, f$ as unwrapMagicLinkGrant, ge as updateAuthenticator, gf as updateKeyringIdentity, g6 as writeMagicLinkGrant } from '../types-CraiZOyO.js';
|
|
3
3
|
import '../lazy-builder-ChSqcF5t.js';
|
|
4
4
|
import '../predicate-BmhBSPCH.js';
|
|
5
|
-
import '../strategy-
|
|
6
|
-
import '../errors-
|
|
5
|
+
import '../strategy-BDxQnnTX.js';
|
|
6
|
+
import '../errors-DL-zTrrF.js';
|
|
7
7
|
import '../strategy-BSxFXGzb.js';
|
|
8
|
-
import '../index-
|
|
9
|
-
import '../index-
|
|
8
|
+
import '../index-BMmajblo.js';
|
|
9
|
+
import '../index-BelbyUwz.js';
|
|
10
10
|
import '@noy-db/attestation';
|
|
11
11
|
|
|
12
12
|
/**
|
package/dist/team/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getCredential,
|
|
6
6
|
listCredentials,
|
|
7
7
|
putCredential
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-FPHRTW2Z.js";
|
|
9
9
|
import {
|
|
10
10
|
burnPaperRecoveryEntry,
|
|
11
11
|
deriveMagicLinkContentKey,
|
|
@@ -29,13 +29,13 @@ import {
|
|
|
29
29
|
unwrapMagicLinkGrant,
|
|
30
30
|
updateAuthenticator,
|
|
31
31
|
writeMagicLinkGrant
|
|
32
|
-
} from "../chunk-
|
|
33
|
-
import "../chunk-
|
|
32
|
+
} from "../chunk-S22UOMHM.js";
|
|
33
|
+
import "../chunk-FBLAWK6A.js";
|
|
34
34
|
import {
|
|
35
35
|
PresenceHandle,
|
|
36
36
|
SyncEngine,
|
|
37
37
|
SyncTransaction
|
|
38
|
-
} from "../chunk-
|
|
38
|
+
} from "../chunk-MI36HL5G.js";
|
|
39
39
|
import {
|
|
40
40
|
buildRecipientKeyringFile,
|
|
41
41
|
changeSecret,
|
|
@@ -52,11 +52,11 @@ import {
|
|
|
52
52
|
persistKeyring,
|
|
53
53
|
revoke,
|
|
54
54
|
updateKeyringIdentity
|
|
55
|
-
} from "../chunk-
|
|
55
|
+
} from "../chunk-M3FPNTO2.js";
|
|
56
56
|
import "../chunk-2QR2PQTT.js";
|
|
57
|
-
import "../chunk-
|
|
58
|
-
import "../chunk-
|
|
59
|
-
import "../chunk-
|
|
57
|
+
import "../chunk-SHIUFIPW.js";
|
|
58
|
+
import "../chunk-OKOKPYWH.js";
|
|
59
|
+
import "../chunk-DJF3FXW5.js";
|
|
60
60
|
export {
|
|
61
61
|
PresenceHandle,
|
|
62
62
|
SYNC_CREDENTIALS_COLLECTION,
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { ag as GuardStrategy, ak as GuardStrategyHandle, ah as GuardChange, ai as GuardContext } from './types-D-gr5t0G.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Register a guard for a collection. Guards run on every `put()` /
|
|
5
|
+
* `delete()` for the named collection (after permissions, before
|
|
6
|
+
* encryption) and may:
|
|
7
|
+
*
|
|
8
|
+
* - `check` — block writes by throwing (typically `RecordLockedError`)
|
|
9
|
+
* - `frozenFields` — freeze specific fields once a condition is true
|
|
10
|
+
* - `amendment` — declare an authorized-override path with invariant
|
|
11
|
+
*
|
|
12
|
+
* Pass the returned handle to `createNoydb({ strategies: [...] })`.
|
|
13
|
+
*
|
|
14
|
+
* @see docs/superpowers/specs/2026-05-18-guards-design.md
|
|
15
|
+
*/
|
|
16
|
+
declare function withGuard<T extends Record<string, unknown>>(strategy: GuardStrategy<T>): GuardStrategyHandle<T>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `immutableGuard` — declarative WORM / append-only sugar over the guard
|
|
20
|
+
* subsystem.
|
|
21
|
+
*
|
|
22
|
+
* Issued fiscal documents (invoices, DDTs) must be immutable after issue.
|
|
23
|
+
* That is expressible today with a hand-rolled `withGuard` (block on
|
|
24
|
+
* `check`/`onDelete`, allow an admin `amendment`), but the boilerplate is
|
|
25
|
+
* repetitive and easy to get subtly wrong. `immutableGuard` generates
|
|
26
|
+
* exactly that guard from a declarative config, reusing the guard
|
|
27
|
+
* machinery wholesale — `check`/`onDelete` rejection, the ledgered
|
|
28
|
+
* `amendment` override, and composition with `periods`/`history`.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* createNoydb({ guardStrategies: [
|
|
32
|
+
* immutableGuard({
|
|
33
|
+
* collection: 'invoices',
|
|
34
|
+
* after: (r) => r.status === 'issued', // immutable once issued
|
|
35
|
+
* }),
|
|
36
|
+
* ] })
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* A record is mutable until `after(record)` holds; from then on, updates
|
|
40
|
+
* and deletes throw `RecordLockedError` unless performed inside an
|
|
41
|
+
* `amendment` transaction by an authorized role (the override is
|
|
42
|
+
* ledgered by the guard amendment mechanism). `appendOnly: true` is
|
|
43
|
+
* shorthand for `after: () => true` — immutable from creation.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
interface ImmutableGuardConfig<T extends Record<string, unknown>> {
|
|
47
|
+
/** The collection to make WORM. */
|
|
48
|
+
collection: string;
|
|
49
|
+
/**
|
|
50
|
+
* A record becomes immutable once this predicate holds. Evaluated on
|
|
51
|
+
* the *existing* (already-persisted) record, so the write that first
|
|
52
|
+
* makes it true is still allowed; subsequent writes are blocked.
|
|
53
|
+
* Mutually exclusive with `appendOnly`.
|
|
54
|
+
*/
|
|
55
|
+
after?: (record: T) => boolean;
|
|
56
|
+
/** Shorthand for `after: () => true` — immutable from creation. */
|
|
57
|
+
appendOnly?: boolean;
|
|
58
|
+
/** Roles permitted to override via an amendment transaction. Default `['admin', 'owner']`. */
|
|
59
|
+
amendmentRoles?: ReadonlyArray<'admin' | 'owner'>;
|
|
60
|
+
/**
|
|
61
|
+
* Optional set-level invariant run over the amendment change-set after
|
|
62
|
+
* the writes execute. Signature matches `GuardStrategy.amendment.invariant`
|
|
63
|
+
* exactly: it receives every {before, after} pair touching this
|
|
64
|
+
* collection in the amendment plus the guard context; throwing reverts
|
|
65
|
+
* the whole amendment and surfaces as `InvariantError`.
|
|
66
|
+
*
|
|
67
|
+
* Use this to keep a constraint inviolable EVEN under amendment — e.g.
|
|
68
|
+
* forbid deleting an issued document by re-throwing on any
|
|
69
|
+
* `before !== null && after === null` change, or assert a cross-record
|
|
70
|
+
* sum is preserved. When omitted the amendment is unconditionally
|
|
71
|
+
* allowed (the amendment itself is the sanctioned, ledgered override) —
|
|
72
|
+
* this is the backward-compatible default.
|
|
73
|
+
*/
|
|
74
|
+
amendmentInvariant?: (changes: ReadonlyArray<GuardChange<T>>, ctx: GuardContext<T>) => Promise<void> | void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build an immutability guard. Pass the returned handle to
|
|
78
|
+
* `createNoydb({ guardStrategies: [...] })`.
|
|
79
|
+
*/
|
|
80
|
+
declare function immutableGuard<T extends Record<string, unknown>>(config: ImmutableGuardConfig<T>): GuardStrategyHandle<T>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* `transitionGuard` — declarative state-machine sugar over the guard
|
|
84
|
+
* subsystem.
|
|
85
|
+
*
|
|
86
|
+
* Any record with a lifecycle field (invoice `status`, order state,
|
|
87
|
+
* ticket workflow, subscription phase) needs transition validation: a
|
|
88
|
+
* write may only move the field along a declared arc. That is expressible
|
|
89
|
+
* with a hand-rolled `withGuard({ check })`, but every consumer
|
|
90
|
+
* re-implements the same graph lookup + error. `transitionGuard`
|
|
91
|
+
* generates exactly that guard from a state graph, reusing the guard
|
|
92
|
+
* machinery wholesale — `check` rejection, the ledgered `amendment`
|
|
93
|
+
* override, and composition with `periods`/`history`.
|
|
94
|
+
*
|
|
95
|
+
* It generalizes {@link immutableGuard}: WORM is the special case "every
|
|
96
|
+
* state has no outgoing arcs", i.e. `transitions` mapping each state to `[]`.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* createNoydb({ guardStrategies: [
|
|
100
|
+
* transitionGuard<Sale>({
|
|
101
|
+
* collection: 'sales', field: 'status',
|
|
102
|
+
* transitions: { // absence of an arc = forbidden
|
|
103
|
+
* draft: ['to_verify', 'cancelled'],
|
|
104
|
+
* to_verify: ['proforma', 'draft', 'cancelled'],
|
|
105
|
+
* proforma: ['invoiced', 'cancelled'],
|
|
106
|
+
* invoiced: ['paid'], paid: [], cancelled: [],
|
|
107
|
+
* },
|
|
108
|
+
* initial: ['draft', 'to_verify'], // allowed status on insert
|
|
109
|
+
* }),
|
|
110
|
+
* ] })
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* Semantics:
|
|
114
|
+
* - **Insert** (`ctx.existing === null`): `incoming[field]` must be in
|
|
115
|
+
* `initial`. When `initial` is omitted, any value is allowed on insert.
|
|
116
|
+
* - **Update**: the arc `(existing[field] → incoming[field])` must be
|
|
117
|
+
* listed in `transitions[from]`, else `IllegalTransitionError`. A
|
|
118
|
+
* same-value write (`from === to`) is allowed when `allowIdempotent`
|
|
119
|
+
* (default `true`) — so writes that touch other fields without moving
|
|
120
|
+
* state pass.
|
|
121
|
+
* - **Override**: inside an `amendment` transaction by an authorized role
|
|
122
|
+
* the check is skipped and the change is ledgered (mirrors every guard).
|
|
123
|
+
*
|
|
124
|
+
* The status graph is caller-supplied data — no UI, no domain logic.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
interface TransitionGuardConfig<T extends Record<string, unknown>> {
|
|
128
|
+
/** The collection whose state field is governed. */
|
|
129
|
+
collection: string;
|
|
130
|
+
/** The state field on the record (e.g. `'status'`). */
|
|
131
|
+
field: keyof T & string;
|
|
132
|
+
/**
|
|
133
|
+
* The transition graph: each state maps to the states it may move to.
|
|
134
|
+
* A state absent from the map (or mapped to `[]`) is terminal — no
|
|
135
|
+
* outgoing arc, so any non-idempotent write from it is rejected.
|
|
136
|
+
*/
|
|
137
|
+
transitions: Readonly<Record<string, readonly string[]>>;
|
|
138
|
+
/**
|
|
139
|
+
* States allowed as the initial value on insert (`existing === null`).
|
|
140
|
+
* Omit to allow any value on insert.
|
|
141
|
+
*/
|
|
142
|
+
initial?: readonly string[];
|
|
143
|
+
/**
|
|
144
|
+
* Allow a same-value write (`from === to`) on update. Default `true` —
|
|
145
|
+
* lets a put that changes other fields, but not the state, through.
|
|
146
|
+
*/
|
|
147
|
+
allowIdempotent?: boolean;
|
|
148
|
+
/** Roles permitted to override via an amendment transaction. Default `['admin', 'owner']`. */
|
|
149
|
+
amendmentRoles?: ReadonlyArray<'admin' | 'owner'>;
|
|
150
|
+
/**
|
|
151
|
+
* Optional set-level invariant run over the amendment change-set after
|
|
152
|
+
* the writes execute. Signature matches `GuardStrategy.amendment.invariant`
|
|
153
|
+
* exactly. When omitted the amendment is unconditionally allowed (the
|
|
154
|
+
* amendment itself is the sanctioned, ledgered override) — the
|
|
155
|
+
* backward-compatible default. Mirrors {@link immutableGuard}.
|
|
156
|
+
*/
|
|
157
|
+
amendmentInvariant?: (changes: ReadonlyArray<GuardChange<T>>, ctx: GuardContext<T>) => Promise<void> | void;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Build a state-machine transition guard. Pass the returned handle to
|
|
161
|
+
* `createNoydb({ guardStrategies: [...] })`.
|
|
162
|
+
*/
|
|
163
|
+
declare function transitionGuard<T extends Record<string, unknown>>(config: TransitionGuardConfig<T>): GuardStrategyHandle<T>;
|
|
164
|
+
|
|
165
|
+
export { type ImmutableGuardConfig as I, type TransitionGuardConfig as T, immutableGuard as i, transitionGuard as t, withGuard as w };
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { ag as GuardStrategy, ak as GuardStrategyHandle, ah as GuardChange, ai as GuardContext } from './types-CraiZOyO.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Register a guard for a collection. Guards run on every `put()` /
|
|
5
|
+
* `delete()` for the named collection (after permissions, before
|
|
6
|
+
* encryption) and may:
|
|
7
|
+
*
|
|
8
|
+
* - `check` — block writes by throwing (typically `RecordLockedError`)
|
|
9
|
+
* - `frozenFields` — freeze specific fields once a condition is true
|
|
10
|
+
* - `amendment` — declare an authorized-override path with invariant
|
|
11
|
+
*
|
|
12
|
+
* Pass the returned handle to `createNoydb({ strategies: [...] })`.
|
|
13
|
+
*
|
|
14
|
+
* @see docs/superpowers/specs/2026-05-18-guards-design.md
|
|
15
|
+
*/
|
|
16
|
+
declare function withGuard<T extends Record<string, unknown>>(strategy: GuardStrategy<T>): GuardStrategyHandle<T>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* `immutableGuard` — declarative WORM / append-only sugar over the guard
|
|
20
|
+
* subsystem.
|
|
21
|
+
*
|
|
22
|
+
* Issued fiscal documents (invoices, DDTs) must be immutable after issue.
|
|
23
|
+
* That is expressible today with a hand-rolled `withGuard` (block on
|
|
24
|
+
* `check`/`onDelete`, allow an admin `amendment`), but the boilerplate is
|
|
25
|
+
* repetitive and easy to get subtly wrong. `immutableGuard` generates
|
|
26
|
+
* exactly that guard from a declarative config, reusing the guard
|
|
27
|
+
* machinery wholesale — `check`/`onDelete` rejection, the ledgered
|
|
28
|
+
* `amendment` override, and composition with `periods`/`history`.
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* createNoydb({ guardStrategies: [
|
|
32
|
+
* immutableGuard({
|
|
33
|
+
* collection: 'invoices',
|
|
34
|
+
* after: (r) => r.status === 'issued', // immutable once issued
|
|
35
|
+
* }),
|
|
36
|
+
* ] })
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* A record is mutable until `after(record)` holds; from then on, updates
|
|
40
|
+
* and deletes throw `RecordLockedError` unless performed inside an
|
|
41
|
+
* `amendment` transaction by an authorized role (the override is
|
|
42
|
+
* ledgered by the guard amendment mechanism). `appendOnly: true` is
|
|
43
|
+
* shorthand for `after: () => true` — immutable from creation.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
interface ImmutableGuardConfig<T extends Record<string, unknown>> {
|
|
47
|
+
/** The collection to make WORM. */
|
|
48
|
+
collection: string;
|
|
49
|
+
/**
|
|
50
|
+
* A record becomes immutable once this predicate holds. Evaluated on
|
|
51
|
+
* the *existing* (already-persisted) record, so the write that first
|
|
52
|
+
* makes it true is still allowed; subsequent writes are blocked.
|
|
53
|
+
* Mutually exclusive with `appendOnly`.
|
|
54
|
+
*/
|
|
55
|
+
after?: (record: T) => boolean;
|
|
56
|
+
/** Shorthand for `after: () => true` — immutable from creation. */
|
|
57
|
+
appendOnly?: boolean;
|
|
58
|
+
/** Roles permitted to override via an amendment transaction. Default `['admin', 'owner']`. */
|
|
59
|
+
amendmentRoles?: ReadonlyArray<'admin' | 'owner'>;
|
|
60
|
+
/**
|
|
61
|
+
* Optional set-level invariant run over the amendment change-set after
|
|
62
|
+
* the writes execute. Signature matches `GuardStrategy.amendment.invariant`
|
|
63
|
+
* exactly: it receives every {before, after} pair touching this
|
|
64
|
+
* collection in the amendment plus the guard context; throwing reverts
|
|
65
|
+
* the whole amendment and surfaces as `InvariantError`.
|
|
66
|
+
*
|
|
67
|
+
* Use this to keep a constraint inviolable EVEN under amendment — e.g.
|
|
68
|
+
* forbid deleting an issued document by re-throwing on any
|
|
69
|
+
* `before !== null && after === null` change, or assert a cross-record
|
|
70
|
+
* sum is preserved. When omitted the amendment is unconditionally
|
|
71
|
+
* allowed (the amendment itself is the sanctioned, ledgered override) —
|
|
72
|
+
* this is the backward-compatible default.
|
|
73
|
+
*/
|
|
74
|
+
amendmentInvariant?: (changes: ReadonlyArray<GuardChange<T>>, ctx: GuardContext<T>) => Promise<void> | void;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Build an immutability guard. Pass the returned handle to
|
|
78
|
+
* `createNoydb({ guardStrategies: [...] })`.
|
|
79
|
+
*/
|
|
80
|
+
declare function immutableGuard<T extends Record<string, unknown>>(config: ImmutableGuardConfig<T>): GuardStrategyHandle<T>;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* `transitionGuard` — declarative state-machine sugar over the guard
|
|
84
|
+
* subsystem.
|
|
85
|
+
*
|
|
86
|
+
* Any record with a lifecycle field (invoice `status`, order state,
|
|
87
|
+
* ticket workflow, subscription phase) needs transition validation: a
|
|
88
|
+
* write may only move the field along a declared arc. That is expressible
|
|
89
|
+
* with a hand-rolled `withGuard({ check })`, but every consumer
|
|
90
|
+
* re-implements the same graph lookup + error. `transitionGuard`
|
|
91
|
+
* generates exactly that guard from a state graph, reusing the guard
|
|
92
|
+
* machinery wholesale — `check` rejection, the ledgered `amendment`
|
|
93
|
+
* override, and composition with `periods`/`history`.
|
|
94
|
+
*
|
|
95
|
+
* It generalizes {@link immutableGuard}: WORM is the special case "every
|
|
96
|
+
* state has no outgoing arcs", i.e. `transitions` mapping each state to `[]`.
|
|
97
|
+
*
|
|
98
|
+
* ```ts
|
|
99
|
+
* createNoydb({ guardStrategies: [
|
|
100
|
+
* transitionGuard<Sale>({
|
|
101
|
+
* collection: 'sales', field: 'status',
|
|
102
|
+
* transitions: { // absence of an arc = forbidden
|
|
103
|
+
* draft: ['to_verify', 'cancelled'],
|
|
104
|
+
* to_verify: ['proforma', 'draft', 'cancelled'],
|
|
105
|
+
* proforma: ['invoiced', 'cancelled'],
|
|
106
|
+
* invoiced: ['paid'], paid: [], cancelled: [],
|
|
107
|
+
* },
|
|
108
|
+
* initial: ['draft', 'to_verify'], // allowed status on insert
|
|
109
|
+
* }),
|
|
110
|
+
* ] })
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* Semantics:
|
|
114
|
+
* - **Insert** (`ctx.existing === null`): `incoming[field]` must be in
|
|
115
|
+
* `initial`. When `initial` is omitted, any value is allowed on insert.
|
|
116
|
+
* - **Update**: the arc `(existing[field] → incoming[field])` must be
|
|
117
|
+
* listed in `transitions[from]`, else `IllegalTransitionError`. A
|
|
118
|
+
* same-value write (`from === to`) is allowed when `allowIdempotent`
|
|
119
|
+
* (default `true`) — so writes that touch other fields without moving
|
|
120
|
+
* state pass.
|
|
121
|
+
* - **Override**: inside an `amendment` transaction by an authorized role
|
|
122
|
+
* the check is skipped and the change is ledgered (mirrors every guard).
|
|
123
|
+
*
|
|
124
|
+
* The status graph is caller-supplied data — no UI, no domain logic.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
interface TransitionGuardConfig<T extends Record<string, unknown>> {
|
|
128
|
+
/** The collection whose state field is governed. */
|
|
129
|
+
collection: string;
|
|
130
|
+
/** The state field on the record (e.g. `'status'`). */
|
|
131
|
+
field: keyof T & string;
|
|
132
|
+
/**
|
|
133
|
+
* The transition graph: each state maps to the states it may move to.
|
|
134
|
+
* A state absent from the map (or mapped to `[]`) is terminal — no
|
|
135
|
+
* outgoing arc, so any non-idempotent write from it is rejected.
|
|
136
|
+
*/
|
|
137
|
+
transitions: Readonly<Record<string, readonly string[]>>;
|
|
138
|
+
/**
|
|
139
|
+
* States allowed as the initial value on insert (`existing === null`).
|
|
140
|
+
* Omit to allow any value on insert.
|
|
141
|
+
*/
|
|
142
|
+
initial?: readonly string[];
|
|
143
|
+
/**
|
|
144
|
+
* Allow a same-value write (`from === to`) on update. Default `true` —
|
|
145
|
+
* lets a put that changes other fields, but not the state, through.
|
|
146
|
+
*/
|
|
147
|
+
allowIdempotent?: boolean;
|
|
148
|
+
/** Roles permitted to override via an amendment transaction. Default `['admin', 'owner']`. */
|
|
149
|
+
amendmentRoles?: ReadonlyArray<'admin' | 'owner'>;
|
|
150
|
+
/**
|
|
151
|
+
* Optional set-level invariant run over the amendment change-set after
|
|
152
|
+
* the writes execute. Signature matches `GuardStrategy.amendment.invariant`
|
|
153
|
+
* exactly. When omitted the amendment is unconditionally allowed (the
|
|
154
|
+
* amendment itself is the sanctioned, ledgered override) — the
|
|
155
|
+
* backward-compatible default. Mirrors {@link immutableGuard}.
|
|
156
|
+
*/
|
|
157
|
+
amendmentInvariant?: (changes: ReadonlyArray<GuardChange<T>>, ctx: GuardContext<T>) => Promise<void> | void;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Build a state-machine transition guard. Pass the returned handle to
|
|
161
|
+
* `createNoydb({ guardStrategies: [...] })`.
|
|
162
|
+
*/
|
|
163
|
+
declare function transitionGuard<T extends Record<string, unknown>>(config: TransitionGuardConfig<T>): GuardStrategyHandle<T>;
|
|
164
|
+
|
|
165
|
+
export { type ImmutableGuardConfig as I, type TransitionGuardConfig as T, immutableGuard as i, transitionGuard as t, withGuard as w };
|