@noy-db/hub 0.4.0-pre.4 → 0.4.0-pre.6
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/README.md +2 -2
- package/dist/api-5QVQX4HG.js +20 -0
- package/dist/attestation/index.js +18 -18
- package/dist/{backup-JL2GOTYQ.js → backup-USYSNCYM.js} +11 -11
- package/dist/blobs/index.js +15 -12
- package/dist/blobs/index.js.map +1 -1
- package/dist/broker/index.js +12 -12
- package/dist/cargo/index.js +34 -36
- package/dist/{chunk-JLHKBAFY.js → chunk-2BVW754E.js} +3 -3
- package/dist/{chunk-T7S4V52L.js → chunk-2PDBYF2O.js} +4 -4
- package/dist/{chunk-YGBIBOCR.js → chunk-2ZSC454H.js} +7 -7
- package/dist/{chunk-IGAIOGCN.js → chunk-32467U5J.js} +4 -4
- package/dist/{chunk-JA5O7UEZ.js → chunk-3GXDB3NQ.js} +6 -6
- package/dist/chunk-3GXDB3NQ.js.map +1 -0
- package/dist/{chunk-U73LHVPF.js → chunk-3S2YNMUS.js} +54 -6
- package/dist/chunk-3S2YNMUS.js.map +1 -0
- package/dist/{chunk-JW3XCZA2.js → chunk-3TZUC4WS.js} +11 -11
- package/dist/{chunk-JA5B3SLH.js → chunk-44Y3P5U6.js} +2 -2
- package/dist/{chunk-25G7U6RD.js → chunk-4B3DL75F.js} +2 -2
- package/dist/{chunk-L4OA7G5T.js → chunk-522MBPE5.js} +2 -2
- package/dist/chunk-5ABOFAHN.js +81 -0
- package/dist/chunk-5ABOFAHN.js.map +1 -0
- package/dist/chunk-5D2ALSM5.js +19 -0
- package/dist/chunk-5D2ALSM5.js.map +1 -0
- package/dist/{chunk-M25ZIEB2.js → chunk-5HSSTOOG.js} +2 -2
- package/dist/{chunk-LLVW4V7R.js → chunk-5WLDZZ6S.js} +3 -3
- package/dist/{chunk-BCOKZC4B.js → chunk-6SSWOUUS.js} +19 -19
- package/dist/chunk-6SSWOUUS.js.map +1 -0
- package/dist/{chunk-IGM563N5.js → chunk-6SYOHUHM.js} +6 -6
- package/dist/chunk-6SYOHUHM.js.map +1 -0
- package/dist/{chunk-7B4GPCX7.js → chunk-7IQWHYL2.js} +5 -5
- package/dist/{chunk-J3VW4J4E.js → chunk-7LP7FFJ2.js} +2 -2
- package/dist/chunk-7LP7FFJ2.js.map +1 -0
- package/dist/{chunk-5P5AAXYA.js → chunk-7U6AB7DZ.js} +7 -7
- package/dist/chunk-7U6AB7DZ.js.map +1 -0
- package/dist/chunk-AFHQATY4.js +47 -0
- package/dist/chunk-AFHQATY4.js.map +1 -0
- package/dist/{chunk-OWE4BNTM.js → chunk-AZXEOEQK.js} +4 -4
- package/dist/{chunk-GBEXTC6Z.js → chunk-BAAUFCJK.js} +3 -3
- package/dist/chunk-BAAUFCJK.js.map +1 -0
- package/dist/{chunk-BZEPJJOK.js → chunk-C2V7AJO2.js} +4 -4
- package/dist/chunk-CADUYBQD.js +151 -0
- package/dist/chunk-CADUYBQD.js.map +1 -0
- package/dist/{chunk-2JZ763FV.js → chunk-D4LAJ737.js} +2 -2
- package/dist/{chunk-5BHNQNBI.js → chunk-DOZFU7OZ.js} +1 -1
- package/dist/chunk-DOZFU7OZ.js.map +1 -0
- package/dist/{chunk-MEKAMERX.js → chunk-E7FSBI6I.js} +29 -29
- package/dist/chunk-E7FSBI6I.js.map +1 -0
- package/dist/{chunk-N4FZ6ITM.js → chunk-EGU4PWQW.js} +2 -2
- package/dist/chunk-EP5L47XV.js +22 -0
- package/dist/chunk-EP5L47XV.js.map +1 -0
- package/dist/{chunk-EW4HFWGJ.js → chunk-EPME33Y4.js} +6 -6
- package/dist/{chunk-W7TCXZWU.js → chunk-EWPS35AR.js} +794 -1045
- package/dist/chunk-EWPS35AR.js.map +1 -0
- package/dist/{chunk-JKWNG3TM.js → chunk-FHHYCBBP.js} +2 -2
- package/dist/{chunk-5BB3N4KU.js → chunk-G4MFQXYX.js} +2 -2
- package/dist/{chunk-KVHWEPT2.js → chunk-GHEMAVTN.js} +2 -2
- package/dist/{chunk-CGPO3ZYB.js → chunk-GQT6J4FJ.js} +15 -2
- package/dist/chunk-GQT6J4FJ.js.map +1 -0
- package/dist/{chunk-XW7NWO4A.js → chunk-GTNRMJYH.js} +2 -2
- package/dist/{chunk-YG2EG6CB.js → chunk-H5GMROCB.js} +4 -4
- package/dist/{chunk-JIMEB4C6.js → chunk-HA7P3BTB.js} +26 -177
- package/dist/chunk-HA7P3BTB.js.map +1 -0
- package/dist/{chunk-5KI3REO3.js → chunk-HDF5R2K6.js} +7 -7
- package/dist/{chunk-V3YB7RGR.js → chunk-HVPW6PCX.js} +3 -3
- package/dist/{chunk-2VUISNGP.js → chunk-HXVRRJBD.js} +5 -5
- package/dist/{chunk-ZJGZDOQO.js → chunk-ICYC5YNI.js} +6 -6
- package/dist/{chunk-KR5EGWI4.js → chunk-IUATR5UE.js} +27 -5
- package/dist/chunk-IUATR5UE.js.map +1 -0
- package/dist/{chunk-AFBJHD55.js → chunk-JGOKAZNB.js} +5 -5
- package/dist/{chunk-XGVDLQJE.js → chunk-JOCMXSR2.js} +3 -3
- package/dist/{chunk-XGVDLQJE.js.map → chunk-JOCMXSR2.js.map} +1 -1
- package/dist/{chunk-HGVFJL63.js → chunk-JTIPVW4J.js} +15 -5
- package/dist/{chunk-HGVFJL63.js.map → chunk-JTIPVW4J.js.map} +1 -1
- package/dist/{chunk-QXPOEAKR.js → chunk-KCZAFDP5.js} +2 -2
- package/dist/{chunk-MSO2C3KG.js → chunk-LC7DSMHR.js} +2 -2
- package/dist/{chunk-OVFCAS7U.js → chunk-LG2GUYRX.js} +9 -9
- package/dist/{chunk-2KL6NDD4.js → chunk-LN3MQFUE.js} +56 -4
- package/dist/chunk-LN3MQFUE.js.map +1 -0
- package/dist/{chunk-QUIG6BZT.js → chunk-M4GO4ZJK.js} +226 -36
- package/dist/chunk-M4GO4ZJK.js.map +1 -0
- package/dist/{chunk-QDNVHA2F.js → chunk-M7W2KYTL.js} +2 -2
- package/dist/{chunk-XULHFSHO.js → chunk-MLCTPWSO.js} +5 -5
- package/dist/chunk-MLCTPWSO.js.map +1 -0
- package/dist/{chunk-PEY6ZTCF.js → chunk-MMVQ3SUO.js} +9 -9
- package/dist/{chunk-PEY6ZTCF.js.map → chunk-MMVQ3SUO.js.map} +1 -1
- package/dist/{chunk-4X6DJZHY.js → chunk-MPPWL64H.js} +26 -43
- package/dist/chunk-MPPWL64H.js.map +1 -0
- package/dist/{chunk-QYJIOWKN.js → chunk-MQBFT2OT.js} +11 -9
- package/dist/chunk-MQBFT2OT.js.map +1 -0
- package/dist/{chunk-IUIVDVXM.js → chunk-MUPZ6IZX.js} +2 -2
- package/dist/{chunk-GZ2GKOF6.js → chunk-NA374QG7.js} +3 -3
- package/dist/chunk-NIKO2BBZ.js +23 -0
- package/dist/chunk-NIKO2BBZ.js.map +1 -0
- package/dist/{chunk-2U7Y7BNJ.js → chunk-ONB627HU.js} +2 -2
- package/dist/{chunk-GYB2QK5H.js → chunk-OWLZONGX.js} +2 -2
- package/dist/{chunk-YHPUDB7Q.js → chunk-OWOT7CFC.js} +2 -2
- package/dist/{chunk-VEX6G3YL.js → chunk-P4NUJVWL.js} +2 -2
- package/dist/chunk-PEOZ34EM.js +13 -0
- package/dist/chunk-PEOZ34EM.js.map +1 -0
- package/dist/{chunk-NM4LVUXH.js → chunk-PTT2NB46.js} +2 -2
- package/dist/chunk-PVEWA2DU.js +23 -0
- package/dist/chunk-PVEWA2DU.js.map +1 -0
- package/dist/{chunk-2ITLQZV5.js → chunk-PWWWMRT7.js} +2 -2
- package/dist/{chunk-FLHOTGOO.js → chunk-QVGEVZ5F.js} +3 -3
- package/dist/{chunk-HKR25MGX.js → chunk-QVIZDLAR.js} +10 -10
- package/dist/chunk-QVIZDLAR.js.map +1 -0
- package/dist/{chunk-OOTTXUNV.js → chunk-RM5EXCFF.js} +2 -2
- package/dist/{chunk-OOTTXUNV.js.map → chunk-RM5EXCFF.js.map} +1 -1
- package/dist/{chunk-OGFPMCSP.js → chunk-SBOHNJUD.js} +2 -2
- package/dist/{chunk-EDC6MLXV.js → chunk-SEU6QHH4.js} +2 -2
- package/dist/chunk-SMY5X46Z.js +14 -0
- package/dist/chunk-SMY5X46Z.js.map +1 -0
- package/dist/{chunk-F4COUZLL.js → chunk-TMR64XPL.js} +2 -2
- package/dist/{chunk-5OZCCLNC.js → chunk-TSNRZSRC.js} +2 -2
- package/dist/{chunk-2RMDVWGB.js → chunk-UNREYBZO.js} +2 -2
- package/dist/{chunk-BLB7P7LS.js → chunk-V2R2VWER.js} +176 -17
- package/dist/chunk-V2R2VWER.js.map +1 -0
- package/dist/{chunk-3XVOLB75.js → chunk-VDTWFN2P.js} +7 -5
- package/dist/chunk-VDTWFN2P.js.map +1 -0
- package/dist/chunk-VKQCVU2Z.js +21 -0
- package/dist/chunk-VKQCVU2Z.js.map +1 -0
- package/dist/{chunk-QCUH2G77.js → chunk-VNJMLOQS.js} +6 -6
- package/dist/{chunk-UEO5CHOP.js → chunk-WCJJQV2D.js} +13 -13
- package/dist/chunk-WCJJQV2D.js.map +1 -0
- package/dist/{chunk-25ZDB25Z.js → chunk-WWBC4KLB.js} +3 -3
- package/dist/chunk-WWBC4KLB.js.map +1 -0
- package/dist/{chunk-V7RGFJ3Z.js → chunk-XG7OZDOS.js} +6 -6
- package/dist/{chunk-GS3Q2KOZ.js → chunk-XONZGK6J.js} +2 -2
- package/dist/{chunk-5SZ24DL5.js → chunk-XSOGLHGY.js} +6 -6
- package/dist/{chunk-CCT4WZI6.js → chunk-XY6MNSAF.js} +5 -5
- package/dist/chunk-XY6MNSAF.js.map +1 -0
- package/dist/chunk-XZHEOSQ2.js +16 -0
- package/dist/chunk-XZHEOSQ2.js.map +1 -0
- package/dist/{chunk-NOT7XA7Q.js → chunk-YGMREQAK.js} +5 -5
- package/dist/{chunk-H4SMS4O2.js → chunk-YJ3TREAC.js} +2 -2
- package/dist/chunk-YMUFFJCO.js +23 -0
- package/dist/chunk-YMUFFJCO.js.map +1 -0
- package/dist/{chunk-E2R5NRZD.js → chunk-Z4D3YGAB.js} +2 -2
- package/dist/{chunk-WJDYZP3U.js → chunk-ZDFU34XY.js} +42 -39
- package/dist/chunk-ZDFU34XY.js.map +1 -0
- package/dist/{chunk-BZK6JEX4.js → chunk-ZF572E2M.js} +5 -5
- package/dist/{chunk-DEQ2JTBR.js → chunk-ZGEFBDPR.js} +4 -4
- package/dist/chunk-ZGEFBDPR.js.map +1 -0
- package/dist/{chunk-QAFWRGVD.js → chunk-ZHMUFYZF.js} +7 -7
- package/dist/{chunk-BVZGNMVM.js → chunk-ZHZ4PET5.js} +3 -3
- package/dist/{chunk-IZX3WZBF.js → chunk-ZM72UO3Y.js} +4 -4
- package/dist/{chunk-STR7WBOB.js → chunk-ZUDAK436.js} +2 -2
- package/dist/{chunk-ITI3SJRB.js → chunk-ZX5FNWH7.js} +2 -2
- package/dist/classified/index.js +5 -5
- package/dist/{classified-marker-7S5IEP6Q.js → classified-marker-SVDRXLD3.js} +3 -3
- package/dist/collection-facade-S5PPKZD5.js +44 -0
- package/dist/{computed-WZNKRLCY.js → computed-33DRJDOC.js} +3 -3
- package/dist/consent/index.js +13 -9
- package/dist/consent/index.js.map +1 -1
- package/dist/{cover-B5MY43CK.js → cover-ADBCTIKN.js} +4 -4
- package/dist/crdt/index.js +4 -0
- package/dist/crdt/index.js.map +1 -1
- package/dist/{dead-filter-KRRD57MR.js → dead-filter-HKDMTMVY.js} +2 -2
- package/dist/delegation-EV7LKJPH.js +25 -0
- package/dist/derivations/index.js +12 -12
- package/dist/derive-5LDJW76F.js +21 -0
- package/dist/dispatch-SPMYNXNW.js +194 -0
- package/dist/dispatch-SPMYNXNW.js.map +1 -0
- package/dist/dispatch-V5MSMQYX.js +72 -0
- package/dist/dispatch-V5MSMQYX.js.map +1 -0
- package/dist/{enclave-YFKA3GJT.js → enclave-ZA7C3H2L.js} +11 -11
- package/dist/executor-FCJEH3FU.js +9 -0
- package/dist/executor-OHET7TF7.js +9 -0
- package/dist/executor-SVHAJZ4A.js +28 -0
- package/dist/export-accessible-S35YKIBL.js +23 -0
- package/dist/extract-partition-UVHAM5WZ.js +38 -0
- package/dist/{fanout-sidecar-HJV3A7PM.js → fanout-sidecar-HRMHC34B.js} +9 -9
- package/dist/find-LEBUXVL7.js +11 -0
- package/dist/forget/index.js +9 -9
- package/dist/guards/index.js +3 -3
- package/dist/history/index.js +16 -12
- package/dist/history/index.js.map +1 -1
- package/dist/i18n/index.js +16 -14
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.d.ts +17 -16
- package/dist/index.js +155 -211
- package/dist/index.js.map +1 -1
- package/dist/indexing/index.js +4 -2
- package/dist/indexing/index.js.map +1 -1
- package/dist/issue-5X3SMCF4.js +19 -0
- package/dist/kernel/collection.d.ts +0 -1
- package/dist/kernel/enclave/crypto.d.ts +8 -8
- package/dist/kernel/enclave/index.d.ts +2 -2
- package/dist/kernel/errors.d.ts +20 -20
- package/dist/kernel/lazy.d.ts +30 -0
- package/dist/kernel/noydb.d.ts +53 -101
- package/dist/kernel/query/builder.d.ts +10 -10
- package/dist/kernel/query/index.d.ts +0 -6
- package/dist/kernel/query/scan-builder.d.ts +4 -4
- package/dist/kernel/types.d.ts +87 -46
- package/dist/kernel/validation.d.ts +33 -33
- package/dist/kernel/vault.d.ts +12 -149
- package/dist/kernel/via/dispatch.d.ts +7 -0
- package/dist/{ledger-SW6QQOAV.js → ledger-K6JBFL3Z.js} +11 -11
- package/dist/liberate-NHTCKBU4.js +24 -0
- package/dist/{link-set-GNGGCFI4.js → link-set-XVZY2ODC.js} +11 -11
- package/dist/materialized-views/index.js +22 -19
- package/dist/noydb-TI3RFU6M.js +78 -0
- package/dist/overlay-views/index.js +4 -4
- package/dist/periods/index.js +15 -13
- package/dist/pod/index.js +11 -12
- package/dist/{policy-EAXSJNOT.js → policy-QWGJB7P7.js} +5 -5
- package/dist/port/with/collection-options.d.ts +171 -0
- package/dist/port/with/collection-registries.d.ts +62 -0
- package/dist/port/with/strategies.d.ts +2 -2
- package/dist/port/with/team-strategy.d.ts +3 -2
- package/dist/portability/index.js +8 -8
- package/dist/{post-register-A7HCFBP5.js → post-register-5VHHVFJY.js} +6 -6
- package/dist/query/index.js +6 -46
- package/dist/{aggregate → reduce}/index.js +24 -17
- package/dist/reduce/index.js.map +1 -0
- package/dist/register-CEX7R7NE.js +23 -0
- package/dist/registry-7CZWF3EQ.js +9 -0
- package/dist/registry-DIKMRXUC.js +19 -0
- package/dist/registry-EWIB5NTI.js +18 -0
- package/dist/request-withdrawal-AAG57QO4.js +31 -0
- package/dist/{reveal-PB3YG544.js → reveal-7OOT5XPD.js} +6 -6
- package/dist/revoke-U5LCIJMF.js +24 -0
- package/dist/satellites/index.js +1 -1
- package/dist/sealed-record/index.js +12 -12
- package/dist/{seed-EKF4DIBB.js → seed-GVOI6QP6.js} +12 -12
- package/dist/seed-GVOI6QP6.js.map +1 -0
- package/dist/session/index.js +13 -9
- package/dist/session/index.js.map +1 -1
- package/dist/shadow/index.js +6 -2
- package/dist/shadow/index.js.map +1 -1
- package/dist/signer-NAA2OX7H.js +25 -0
- package/dist/snapshots/index.js +14 -10
- package/dist/snapshots/index.js.map +1 -1
- package/dist/{stale-4UNPHWOU.js → stale-BJO2WIN7.js} +11 -10
- package/dist/storage-FL7XXZTN.js +23 -0
- package/dist/{store-coordination-provider-3AELCZ4Y.js → store-coordination-provider-DX5HECK3.js} +3 -3
- package/dist/sync/index.js +14 -10
- package/dist/sync/index.js.map +1 -1
- package/dist/team/index.js +26 -28
- package/dist/tiers/index.js +10 -10
- package/dist/to/index.js +1 -1
- package/dist/tx/index.js +7 -3
- package/dist/tx/index.js.map +1 -1
- package/dist/util/index.js +1 -1
- package/dist/{verify-MXN66IIH.js → verify-5X37OXRY.js} +5 -5
- package/dist/via/blob/index.d.ts +2 -0
- package/dist/via/i18n/core.d.ts +1 -1
- package/dist/via/i18n/index.d.ts +2 -0
- package/dist/via/money/money-reducer.d.ts +2 -2
- package/dist/{walk-H4YE52S2.js → walk-JXMWKKQW.js} +11 -11
- package/dist/with-audit/consent/index.d.ts +2 -0
- package/dist/with-audit/periods/index.d.ts +2 -0
- package/dist/with-audit/portability/export-accessible.d.ts +4 -4
- package/dist/with-audit/portability/request-withdrawal.d.ts +3 -3
- package/dist/with-audit/portability/withdraw-accessible.d.ts +2 -2
- package/dist/with-audit/sealed-record/strategy.d.ts +1 -1
- package/dist/with-cargo/adopt-partition.d.ts +7 -7
- package/dist/with-cargo/floor.d.ts +3 -3
- package/dist/with-cargo/index.d.ts +1 -1
- package/dist/with-commit/crdt/index.d.ts +2 -0
- package/dist/with-commit/history/index.d.ts +2 -0
- package/dist/with-commit/history/time-machine.d.ts +2 -2
- package/dist/with-fork/shadow/index.d.ts +2 -0
- package/dist/with-fork/snapshots/index.d.ts +2 -0
- package/dist/with-formula/derivations/dispatch.d.ts +98 -0
- package/dist/with-formula/materialized-views/dispatch.d.ts +75 -0
- package/dist/with-formula/materialized-views/types.d.ts +7 -7
- package/dist/with-lookup/indexing/index.d.ts +2 -0
- package/dist/with-lookup/{aggregate → reduce}/active.d.ts +8 -8
- package/dist/with-lookup/{aggregate → reduce}/groupby.d.ts +21 -21
- package/dist/with-lookup/reduce/index.d.ts +34 -0
- package/dist/with-lookup/{aggregate → reduce}/reducers.d.ts +10 -10
- package/dist/with-lookup/{aggregate/aggregation.d.ts → reduce/reduction.d.ts} +21 -21
- package/dist/with-lookup/{aggregate → reduce}/strategy.d.ts +15 -15
- package/dist/with-party/custody/liberate.d.ts +3 -3
- package/dist/with-party/session/dev-unlock.d.ts +2 -2
- package/dist/with-party/session/index.d.ts +2 -0
- package/dist/with-party/session/session.d.ts +2 -2
- package/dist/with-party/sync/index.d.ts +2 -0
- package/dist/with-party/team/deed.d.ts +8 -8
- package/dist/with-party/team/index.d.ts +2 -2
- package/dist/with-party/team/keyring.d.ts +39 -20
- package/dist/with-party/team/{managed-passphrase.d.ts → managed-secret.d.ts} +27 -27
- package/dist/with-party/team/noydb-facade.d.ts +43 -42
- package/dist/with-party/team/peer-recover.d.ts +13 -13
- package/dist/with-party/team/recovery.d.ts +5 -5
- package/dist/with-party/team/rotate-recover.d.ts +30 -30
- package/dist/with-pod/bundle.d.ts +30 -30
- package/dist/with-pod/format.d.ts +2 -2
- package/dist/withdraw-accessible-GO6KQJVM.js +28 -0
- package/package.json +6 -34
- package/dist/aggregate/index.js.map +0 -1
- package/dist/api-UPAT2O3M.js +0 -20
- package/dist/as/index.js +0 -30
- package/dist/at/index.js +0 -1
- package/dist/by/index.js +0 -11
- package/dist/chunk-25ZDB25Z.js.map +0 -1
- package/dist/chunk-2KL6NDD4.js.map +0 -1
- package/dist/chunk-2YELV6TV.js +0 -1
- package/dist/chunk-3O62PVDW.js +0 -205
- package/dist/chunk-3O62PVDW.js.map +0 -1
- package/dist/chunk-3XVOLB75.js.map +0 -1
- package/dist/chunk-4X6DJZHY.js.map +0 -1
- package/dist/chunk-5BHNQNBI.js.map +0 -1
- package/dist/chunk-5P5AAXYA.js.map +0 -1
- package/dist/chunk-BCOKZC4B.js.map +0 -1
- package/dist/chunk-BLB7P7LS.js.map +0 -1
- package/dist/chunk-CCT4WZI6.js.map +0 -1
- package/dist/chunk-CGPO3ZYB.js.map +0 -1
- package/dist/chunk-DEQ2JTBR.js.map +0 -1
- package/dist/chunk-GBEXTC6Z.js.map +0 -1
- package/dist/chunk-HKR25MGX.js.map +0 -1
- package/dist/chunk-IGM563N5.js.map +0 -1
- package/dist/chunk-J3VW4J4E.js.map +0 -1
- package/dist/chunk-JA5O7UEZ.js.map +0 -1
- package/dist/chunk-JIMEB4C6.js.map +0 -1
- package/dist/chunk-KMONEHDJ.js +0 -54
- package/dist/chunk-KMONEHDJ.js.map +0 -1
- package/dist/chunk-KR5EGWI4.js.map +0 -1
- package/dist/chunk-LB7FD65R.js +0 -163
- package/dist/chunk-LB7FD65R.js.map +0 -1
- package/dist/chunk-MEKAMERX.js.map +0 -1
- package/dist/chunk-QUIG6BZT.js.map +0 -1
- package/dist/chunk-QYJIOWKN.js.map +0 -1
- package/dist/chunk-U73LHVPF.js.map +0 -1
- package/dist/chunk-UEO5CHOP.js.map +0 -1
- package/dist/chunk-W7TCXZWU.js.map +0 -1
- package/dist/chunk-WEC3JGBA.js +0 -255
- package/dist/chunk-WEC3JGBA.js.map +0 -1
- package/dist/chunk-WJDYZP3U.js.map +0 -1
- package/dist/chunk-XULHFSHO.js.map +0 -1
- package/dist/collection-facade-CMZGQ6IS.js +0 -44
- package/dist/delegation-UT76AQIG.js +0 -25
- package/dist/derive-SGRCCKVP.js +0 -21
- package/dist/executor-TEZYRDN3.js +0 -9
- package/dist/executor-WQQRU6DO.js +0 -9
- package/dist/executor-YORMIBWV.js +0 -26
- package/dist/export-accessible-HXMKW5LJ.js +0 -23
- package/dist/extract-partition-QGQ2R42J.js +0 -38
- package/dist/find-VV6PBIHK.js +0 -11
- package/dist/in/index.js +0 -1
- package/dist/issue-7JJ4Z7E2.js +0 -19
- package/dist/liberate-FK7JI2QX.js +0 -24
- package/dist/noydb-N5IW6OFZ.js +0 -70
- package/dist/on/index.js +0 -17
- package/dist/port/as/index.d.ts +0 -26
- package/dist/port/at/index.d.ts +0 -18
- package/dist/port/in/index.d.ts +0 -21
- package/dist/port/on/index.d.ts +0 -27
- package/dist/port/ui/index.d.ts +0 -21
- package/dist/port/with/index.d.ts +0 -18
- package/dist/register-YBMRLZLO.js +0 -23
- package/dist/registry-3LXKNXWI.js +0 -9
- package/dist/registry-4V4YQCXJ.js +0 -19
- package/dist/registry-ZULMLCJK.js +0 -18
- package/dist/request-withdrawal-SEVUEUDG.js +0 -31
- package/dist/request-withdrawal-SEVUEUDG.js.map +0 -1
- package/dist/revoke-5QULL5GT.js +0 -24
- package/dist/revoke-5QULL5GT.js.map +0 -1
- package/dist/seed-EKF4DIBB.js.map +0 -1
- package/dist/signer-ZMH35FT4.js +0 -25
- package/dist/signer-ZMH35FT4.js.map +0 -1
- package/dist/stale-4UNPHWOU.js.map +0 -1
- package/dist/storage-QOZKQMID.js +0 -23
- package/dist/storage-QOZKQMID.js.map +0 -1
- package/dist/ui/index.js +0 -1
- package/dist/ui/index.js.map +0 -1
- package/dist/with/index.js +0 -31
- package/dist/with/index.js.map +0 -1
- package/dist/with-lookup/aggregate/index.d.ts +0 -23
- package/dist/withdraw-accessible-HPOVNG2G.js +0 -28
- package/dist/withdraw-accessible-HPOVNG2G.js.map +0 -1
- /package/dist/{api-UPAT2O3M.js.map → api-5QVQX4HG.js.map} +0 -0
- /package/dist/{backup-JL2GOTYQ.js.map → backup-USYSNCYM.js.map} +0 -0
- /package/dist/{chunk-JLHKBAFY.js.map → chunk-2BVW754E.js.map} +0 -0
- /package/dist/{chunk-T7S4V52L.js.map → chunk-2PDBYF2O.js.map} +0 -0
- /package/dist/{chunk-YGBIBOCR.js.map → chunk-2ZSC454H.js.map} +0 -0
- /package/dist/{chunk-IGAIOGCN.js.map → chunk-32467U5J.js.map} +0 -0
- /package/dist/{chunk-JW3XCZA2.js.map → chunk-3TZUC4WS.js.map} +0 -0
- /package/dist/{chunk-JA5B3SLH.js.map → chunk-44Y3P5U6.js.map} +0 -0
- /package/dist/{chunk-25G7U6RD.js.map → chunk-4B3DL75F.js.map} +0 -0
- /package/dist/{chunk-L4OA7G5T.js.map → chunk-522MBPE5.js.map} +0 -0
- /package/dist/{chunk-M25ZIEB2.js.map → chunk-5HSSTOOG.js.map} +0 -0
- /package/dist/{chunk-LLVW4V7R.js.map → chunk-5WLDZZ6S.js.map} +0 -0
- /package/dist/{chunk-7B4GPCX7.js.map → chunk-7IQWHYL2.js.map} +0 -0
- /package/dist/{chunk-OWE4BNTM.js.map → chunk-AZXEOEQK.js.map} +0 -0
- /package/dist/{chunk-BZEPJJOK.js.map → chunk-C2V7AJO2.js.map} +0 -0
- /package/dist/{chunk-2JZ763FV.js.map → chunk-D4LAJ737.js.map} +0 -0
- /package/dist/{chunk-N4FZ6ITM.js.map → chunk-EGU4PWQW.js.map} +0 -0
- /package/dist/{chunk-EW4HFWGJ.js.map → chunk-EPME33Y4.js.map} +0 -0
- /package/dist/{chunk-JKWNG3TM.js.map → chunk-FHHYCBBP.js.map} +0 -0
- /package/dist/{chunk-5BB3N4KU.js.map → chunk-G4MFQXYX.js.map} +0 -0
- /package/dist/{chunk-KVHWEPT2.js.map → chunk-GHEMAVTN.js.map} +0 -0
- /package/dist/{chunk-XW7NWO4A.js.map → chunk-GTNRMJYH.js.map} +0 -0
- /package/dist/{chunk-YG2EG6CB.js.map → chunk-H5GMROCB.js.map} +0 -0
- /package/dist/{chunk-5KI3REO3.js.map → chunk-HDF5R2K6.js.map} +0 -0
- /package/dist/{chunk-V3YB7RGR.js.map → chunk-HVPW6PCX.js.map} +0 -0
- /package/dist/{chunk-2VUISNGP.js.map → chunk-HXVRRJBD.js.map} +0 -0
- /package/dist/{chunk-ZJGZDOQO.js.map → chunk-ICYC5YNI.js.map} +0 -0
- /package/dist/{chunk-AFBJHD55.js.map → chunk-JGOKAZNB.js.map} +0 -0
- /package/dist/{chunk-QXPOEAKR.js.map → chunk-KCZAFDP5.js.map} +0 -0
- /package/dist/{chunk-MSO2C3KG.js.map → chunk-LC7DSMHR.js.map} +0 -0
- /package/dist/{chunk-OVFCAS7U.js.map → chunk-LG2GUYRX.js.map} +0 -0
- /package/dist/{chunk-QDNVHA2F.js.map → chunk-M7W2KYTL.js.map} +0 -0
- /package/dist/{chunk-IUIVDVXM.js.map → chunk-MUPZ6IZX.js.map} +0 -0
- /package/dist/{chunk-GZ2GKOF6.js.map → chunk-NA374QG7.js.map} +0 -0
- /package/dist/{chunk-2U7Y7BNJ.js.map → chunk-ONB627HU.js.map} +0 -0
- /package/dist/{chunk-GYB2QK5H.js.map → chunk-OWLZONGX.js.map} +0 -0
- /package/dist/{chunk-YHPUDB7Q.js.map → chunk-OWOT7CFC.js.map} +0 -0
- /package/dist/{chunk-VEX6G3YL.js.map → chunk-P4NUJVWL.js.map} +0 -0
- /package/dist/{chunk-NM4LVUXH.js.map → chunk-PTT2NB46.js.map} +0 -0
- /package/dist/{chunk-2ITLQZV5.js.map → chunk-PWWWMRT7.js.map} +0 -0
- /package/dist/{chunk-FLHOTGOO.js.map → chunk-QVGEVZ5F.js.map} +0 -0
- /package/dist/{chunk-OGFPMCSP.js.map → chunk-SBOHNJUD.js.map} +0 -0
- /package/dist/{chunk-EDC6MLXV.js.map → chunk-SEU6QHH4.js.map} +0 -0
- /package/dist/{chunk-F4COUZLL.js.map → chunk-TMR64XPL.js.map} +0 -0
- /package/dist/{chunk-5OZCCLNC.js.map → chunk-TSNRZSRC.js.map} +0 -0
- /package/dist/{chunk-2RMDVWGB.js.map → chunk-UNREYBZO.js.map} +0 -0
- /package/dist/{chunk-QCUH2G77.js.map → chunk-VNJMLOQS.js.map} +0 -0
- /package/dist/{chunk-V7RGFJ3Z.js.map → chunk-XG7OZDOS.js.map} +0 -0
- /package/dist/{chunk-GS3Q2KOZ.js.map → chunk-XONZGK6J.js.map} +0 -0
- /package/dist/{chunk-5SZ24DL5.js.map → chunk-XSOGLHGY.js.map} +0 -0
- /package/dist/{chunk-NOT7XA7Q.js.map → chunk-YGMREQAK.js.map} +0 -0
- /package/dist/{chunk-H4SMS4O2.js.map → chunk-YJ3TREAC.js.map} +0 -0
- /package/dist/{chunk-E2R5NRZD.js.map → chunk-Z4D3YGAB.js.map} +0 -0
- /package/dist/{chunk-BZK6JEX4.js.map → chunk-ZF572E2M.js.map} +0 -0
- /package/dist/{chunk-QAFWRGVD.js.map → chunk-ZHMUFYZF.js.map} +0 -0
- /package/dist/{chunk-BVZGNMVM.js.map → chunk-ZHZ4PET5.js.map} +0 -0
- /package/dist/{chunk-IZX3WZBF.js.map → chunk-ZM72UO3Y.js.map} +0 -0
- /package/dist/{chunk-STR7WBOB.js.map → chunk-ZUDAK436.js.map} +0 -0
- /package/dist/{chunk-ITI3SJRB.js.map → chunk-ZX5FNWH7.js.map} +0 -0
- /package/dist/{classified-marker-7S5IEP6Q.js.map → classified-marker-SVDRXLD3.js.map} +0 -0
- /package/dist/{as/index.js.map → collection-facade-S5PPKZD5.js.map} +0 -0
- /package/dist/{at/index.js.map → computed-33DRJDOC.js.map} +0 -0
- /package/dist/{by/index.js.map → cover-ADBCTIKN.js.map} +0 -0
- /package/dist/{dead-filter-KRRD57MR.js.map → dead-filter-HKDMTMVY.js.map} +0 -0
- /package/dist/{chunk-2YELV6TV.js.map → delegation-EV7LKJPH.js.map} +0 -0
- /package/dist/{collection-facade-CMZGQ6IS.js.map → derive-5LDJW76F.js.map} +0 -0
- /package/dist/{computed-WZNKRLCY.js.map → enclave-ZA7C3H2L.js.map} +0 -0
- /package/dist/{cover-B5MY43CK.js.map → executor-FCJEH3FU.js.map} +0 -0
- /package/dist/{delegation-UT76AQIG.js.map → executor-OHET7TF7.js.map} +0 -0
- /package/dist/{derive-SGRCCKVP.js.map → executor-SVHAJZ4A.js.map} +0 -0
- /package/dist/{enclave-YFKA3GJT.js.map → export-accessible-S35YKIBL.js.map} +0 -0
- /package/dist/{executor-TEZYRDN3.js.map → extract-partition-UVHAM5WZ.js.map} +0 -0
- /package/dist/{fanout-sidecar-HJV3A7PM.js.map → fanout-sidecar-HRMHC34B.js.map} +0 -0
- /package/dist/{executor-WQQRU6DO.js.map → find-LEBUXVL7.js.map} +0 -0
- /package/dist/{executor-YORMIBWV.js.map → issue-5X3SMCF4.js.map} +0 -0
- /package/dist/{export-accessible-HXMKW5LJ.js.map → ledger-K6JBFL3Z.js.map} +0 -0
- /package/dist/{extract-partition-QGQ2R42J.js.map → liberate-NHTCKBU4.js.map} +0 -0
- /package/dist/{find-VV6PBIHK.js.map → link-set-XVZY2ODC.js.map} +0 -0
- /package/dist/{in/index.js.map → noydb-TI3RFU6M.js.map} +0 -0
- /package/dist/{issue-7JJ4Z7E2.js.map → policy-QWGJB7P7.js.map} +0 -0
- /package/dist/{post-register-A7HCFBP5.js.map → post-register-5VHHVFJY.js.map} +0 -0
- /package/dist/{ledger-SW6QQOAV.js.map → register-CEX7R7NE.js.map} +0 -0
- /package/dist/{liberate-FK7JI2QX.js.map → registry-7CZWF3EQ.js.map} +0 -0
- /package/dist/{link-set-GNGGCFI4.js.map → registry-DIKMRXUC.js.map} +0 -0
- /package/dist/{noydb-N5IW6OFZ.js.map → registry-EWIB5NTI.js.map} +0 -0
- /package/dist/{on/index.js.map → request-withdrawal-AAG57QO4.js.map} +0 -0
- /package/dist/{reveal-PB3YG544.js.map → reveal-7OOT5XPD.js.map} +0 -0
- /package/dist/{policy-EAXSJNOT.js.map → revoke-U5LCIJMF.js.map} +0 -0
- /package/dist/{register-YBMRLZLO.js.map → signer-NAA2OX7H.js.map} +0 -0
- /package/dist/{registry-3LXKNXWI.js.map → stale-BJO2WIN7.js.map} +0 -0
- /package/dist/{registry-4V4YQCXJ.js.map → storage-FL7XXZTN.js.map} +0 -0
- /package/dist/{store-coordination-provider-3AELCZ4Y.js.map → store-coordination-provider-DX5HECK3.js.map} +0 -0
- /package/dist/{verify-MXN66IIH.js.map → verify-5X37OXRY.js.map} +0 -0
- /package/dist/{walk-H4YE52S2.js.map → walk-JXMWKKQW.js.map} +0 -0
- /package/dist/with-lookup/{aggregate → reduce}/canonical-key.d.ts +0 -0
- /package/dist/{registry-ZULMLCJK.js.map → withdraw-accessible-GO6KQJVM.js.map} +0 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Derivation dispatch, lifted out of the kernel spine (#842 part b).
|
|
3
|
+
*
|
|
4
|
+
* `Collection` carried ~380 lines of dispatch logic that belongs to the
|
|
5
|
+
* derivation service, not to the always-on kernel. These are free functions
|
|
6
|
+
* taking an explicit context so the spine keeps only a thin delegator.
|
|
7
|
+
*
|
|
8
|
+
* ## How the spine reaches this module
|
|
9
|
+
*
|
|
10
|
+
* By dynamic `import()`, never a static one. `check-architecture.mjs`'s
|
|
11
|
+
* `port-layering` check forbids the spine from statically importing a
|
|
12
|
+
* `with-*` service; `collection.ts` is grandfathered for ten
|
|
13
|
+
* `with-formula/*` specifiers, but that list is frozen per file and a new
|
|
14
|
+
* one is a violation. A dynamic import is the sanctioned S4 gate recipe, and
|
|
15
|
+
* it keeps this chunk out of the floor bundle for consumers who never fire a
|
|
16
|
+
* derivation.
|
|
17
|
+
*
|
|
18
|
+
* The `Collection` type reference below points back at the spine. That is
|
|
19
|
+
* inward (service → kernel) and so allowed, and it is TYPE-ONLY — erased at
|
|
20
|
+
* build, so no runtime cycle exists.
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
*/
|
|
24
|
+
import type { NoydbStore } from '../../kernel/types.js';
|
|
25
|
+
import type { TxContext } from '../../with-commit/tx/transaction.js';
|
|
26
|
+
import type { DerivationRegistry } from './registry.js';
|
|
27
|
+
import type { ReadOnlyVaultFacade } from '../../with-audit/guards/types.js';
|
|
28
|
+
import type { Collection } from '../../kernel/collection.js';
|
|
29
|
+
import type { EnclaveKey } from '../../kernel/enclave/index.js';
|
|
30
|
+
import type { EncryptedEnvelope } from '../../kernel/types.js';
|
|
31
|
+
import type { ledgerAuditHook, WaveContext } from '../../kernel/via/dispatch.js';
|
|
32
|
+
/** The per-write dispatch context threaded into `putDerivedOutput`. */
|
|
33
|
+
interface DispatchCtx {
|
|
34
|
+
emit: (e: string, p: unknown) => void;
|
|
35
|
+
source: {
|
|
36
|
+
readonly collection: string;
|
|
37
|
+
readonly id: string;
|
|
38
|
+
};
|
|
39
|
+
audit: ReturnType<typeof ledgerAuditHook>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What the dispatchers need from the collection that owns them. Passing this
|
|
43
|
+
* explicitly is what lets the logic live outside the class.
|
|
44
|
+
*/
|
|
45
|
+
export interface DerivationDeleteCtx {
|
|
46
|
+
readonly derivationSource: {
|
|
47
|
+
registry(): DerivationRegistry;
|
|
48
|
+
getCollection(name: string): Collection<Record<string, unknown>>;
|
|
49
|
+
getActiveTxContext(): TxContext | null;
|
|
50
|
+
getReadOnlyFacade(): ReadOnlyVaultFacade;
|
|
51
|
+
};
|
|
52
|
+
/** The collection the delete happened in. */
|
|
53
|
+
readonly collectionName: string;
|
|
54
|
+
readonly adapter: NoydbStore;
|
|
55
|
+
readonly vault: string;
|
|
56
|
+
readonly getDEK: (collectionName: string) => Promise<EnclaveKey>;
|
|
57
|
+
readonly storeCiphertext: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Erase the derived rows a deleted source record fanned out to, and drop the
|
|
61
|
+
* fan-out sidecars that recorded them.
|
|
62
|
+
*
|
|
63
|
+
* @param eraseRecordShapeToo also erase same-id `shape: 'record'` outputs.
|
|
64
|
+
* Restricted to a source-triggered strategy writing into a DIFFERENT
|
|
65
|
+
* collection — the self-denorm case would re-delete the record just
|
|
66
|
+
* tombstoned, and triggerBy/sibling strategies derive under a different id.
|
|
67
|
+
* @returns rows ACTUALLY deleted, not edges visited (#622).
|
|
68
|
+
*/
|
|
69
|
+
export declare function dispatchArrayDerivationsOnDelete(ctx: DerivationDeleteCtx, id: string, eraseRecordShapeToo?: boolean): Promise<number>;
|
|
70
|
+
/** Adds what the on-write derivation dispatch needs beyond the delete path. */
|
|
71
|
+
export interface DerivationDispatchCtx extends DerivationDeleteCtx {
|
|
72
|
+
/** Via pipeline, for decoding the stored form back to canonical money shape. */
|
|
73
|
+
readonly via: {
|
|
74
|
+
canonicalizeStored(r: Record<string, unknown>): Record<string, unknown>;
|
|
75
|
+
} | undefined;
|
|
76
|
+
/** Recompute a rollup aggregate onto a parent. Stays on the spine — it walks collections. */
|
|
77
|
+
readonly recomputeRollup: (spec: any, parentId: string, source: {
|
|
78
|
+
readonly collection: string;
|
|
79
|
+
readonly id: string;
|
|
80
|
+
}, wave?: WaveContext) => Promise<unknown>;
|
|
81
|
+
/** Builds the per-write dispatch context threaded into `putDerivedOutput`. */
|
|
82
|
+
readonly dispatchCtx: (source: {
|
|
83
|
+
readonly collection: string;
|
|
84
|
+
readonly id: string;
|
|
85
|
+
}) => DispatchCtx;
|
|
86
|
+
/** Registers a write on the active transaction for rollback. */
|
|
87
|
+
readonly trackPut: (txCtx: TxContext, collectionName: string, id: string, priorEnvelope: EncryptedEnvelope | null) => void;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Fire registered derivation strategies for this source collection.
|
|
91
|
+
*
|
|
92
|
+
* Eager mode runs `derive` inline and writes each output; lazy mode records a
|
|
93
|
+
* stale mark for cold-session recompute. Rollups are handled here rather than
|
|
94
|
+
* by the executor — a write to the child recomputes the parent aggregate, and
|
|
95
|
+
* a write to the parent recomputes its own.
|
|
96
|
+
*/
|
|
97
|
+
export declare function dispatchDerivations(ctx: DerivationDispatchCtx, id: string, record: Record<string, unknown>, version: number, wave?: WaveContext): Promise<void>;
|
|
98
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Materialized-view dispatch, lifted out of the kernel spine (#842 part b).
|
|
3
|
+
*
|
|
4
|
+
* Reached from `Collection` by dynamic `import()` only — `port-layering`
|
|
5
|
+
* forbids a static spine→`with-*` import, and rejects a type-only one too
|
|
6
|
+
* (it scans import statements, not their erasure). See
|
|
7
|
+
* `with-formula/derivations/dispatch.ts` for the same note.
|
|
8
|
+
*
|
|
9
|
+
* The `Collection` reference below is TYPE-ONLY and points inward
|
|
10
|
+
* (service → kernel), so it is both allowed and erased at build.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
import type { TxContext } from '../../with-commit/tx/transaction.js';
|
|
15
|
+
import type { Collection } from '../../kernel/collection.js';
|
|
16
|
+
import type { ledgerAuditHook, WaveContext } from '../../kernel/via/dispatch.js';
|
|
17
|
+
import type { MaterializedViewRegistry } from './registry.js';
|
|
18
|
+
import type { MVQueryContext } from './types.js';
|
|
19
|
+
/** The per-write dispatch context the MV executor threads through. */
|
|
20
|
+
interface DispatchCtx {
|
|
21
|
+
emit: (e: string, p: unknown) => void;
|
|
22
|
+
source: {
|
|
23
|
+
readonly collection: string;
|
|
24
|
+
readonly id: string;
|
|
25
|
+
};
|
|
26
|
+
audit: ReturnType<typeof ledgerAuditHook>;
|
|
27
|
+
}
|
|
28
|
+
/** What the MV dispatchers need from the collection that owns them. */
|
|
29
|
+
export interface MvDispatchCtx {
|
|
30
|
+
readonly materializedViewSource: {
|
|
31
|
+
registry(): MaterializedViewRegistry;
|
|
32
|
+
getCollection(name: string): Collection<any>;
|
|
33
|
+
getActiveTxContext(): TxContext | null;
|
|
34
|
+
getQueryContext(): MVQueryContext;
|
|
35
|
+
};
|
|
36
|
+
/** The collection the delete happened in. */
|
|
37
|
+
readonly collectionName: string;
|
|
38
|
+
/** Builds the per-write dispatch context the executor threads through. */
|
|
39
|
+
readonly dispatchCtx: (source: {
|
|
40
|
+
readonly collection: string;
|
|
41
|
+
readonly id: string;
|
|
42
|
+
}) => DispatchCtx;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Fire every MV whose dependency set includes this collection, on write.
|
|
46
|
+
*
|
|
47
|
+
* Skips entirely when the record being written is itself an MV-emitted row
|
|
48
|
+
* (it carries `_materializedFrom`) — a defensive guard against missed cycle
|
|
49
|
+
* detection.
|
|
50
|
+
*
|
|
51
|
+
* @param wave #638 Task 4 — the sync/cutover/restore dispatch wave. An eager
|
|
52
|
+
* MV already refreshed in this wave is skipped, deduped per target on the
|
|
53
|
+
* spec name.
|
|
54
|
+
*/
|
|
55
|
+
export declare function dispatchMaterializedViews(ctx: MvDispatchCtx, id: string, record: Record<string, unknown>, wave?: WaveContext): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Mirror of {@link dispatchMaterializedViews} for the delete/forget path. There is
|
|
58
|
+
* no `_materializedFrom` skip — the record is gone — and the `internal` gate
|
|
59
|
+
* at `_doDelete` is the recursion guard.
|
|
60
|
+
*
|
|
61
|
+
* @returns rows TOMBSTONED across every MV sourced here (#638 T6). Eager and
|
|
62
|
+
* lazy/manual `invalidateMVAtRest` purges both contribute (#761 item 1,
|
|
63
|
+
* previously eager-only): lazy persists a stale mark for cold-session
|
|
64
|
+
* recompute, manual serves empty until `refreshView()`.
|
|
65
|
+
* `residueUndecodable` / `residueDeclined` (#776/#785) carry
|
|
66
|
+
* `outputCollection:id` entries whose ownership stamp `invalidateMVAtRest`
|
|
67
|
+
* could not decode, respectively decoded and stamp-matched but declined to
|
|
68
|
+
* erase — surfaced, not erased.
|
|
69
|
+
*/
|
|
70
|
+
export declare function dispatchMaterializedViewsOnDelete(ctx: MvDispatchCtx, id: string): Promise<{
|
|
71
|
+
deleted: number;
|
|
72
|
+
residueUndecodable: string[];
|
|
73
|
+
residueDeclined: string[];
|
|
74
|
+
}>;
|
|
75
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Query } from '../../kernel/query/builder.js';
|
|
2
2
|
import type { Collection } from '../../kernel/collection.js';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { ReduceSpec, Reduction } from '../../with-lookup/reduce/reduction.js';
|
|
4
|
+
import type { GroupedReduction } from '../../with-lookup/reduce/groupby.js';
|
|
5
5
|
import type { JoinStrategy } from '../../kernel/query/join.js';
|
|
6
6
|
import type { MoneyDescriptor } from '../../via/money/descriptor.js';
|
|
7
7
|
import type { I18nTextDescriptor } from '../../via/i18n/core.js';
|
|
@@ -207,7 +207,7 @@ export interface MaterializedViewStrategy<TRow extends Record<string, unknown>>
|
|
|
207
207
|
* (multi-source UNION). Registration throws
|
|
208
208
|
* `MaterializedViewConfigError` if both are set or neither is set.
|
|
209
209
|
*/
|
|
210
|
-
query?: (db: MVQueryContext) => Query<TRow> |
|
|
210
|
+
query?: (db: MVQueryContext) => Query<TRow> | Reduction<TRow> | GroupedReduction<TRow>;
|
|
211
211
|
/**
|
|
212
212
|
* UNION-form sources: an explicit list of sibling collections
|
|
213
213
|
* that contribute rows to a single MV. Each arm's `map` projects a
|
|
@@ -261,14 +261,14 @@ export interface MaterializedViewStrategy<TRow extends Record<string, unknown>>
|
|
|
261
261
|
*/
|
|
262
262
|
groupBy?: string | ReadonlyArray<string>;
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
264
|
+
* Reduction spec for UNION mode. Applied per-group after
|
|
265
265
|
* {@link groupBy} buckets the concatenated mapped-row stream from
|
|
266
|
-
* {@link unionSources}. Same shape as the `
|
|
266
|
+
* {@link unionSources}. Same shape as the `ReduceSpec` passed to
|
|
267
267
|
* `Query.aggregate()`.
|
|
268
268
|
*
|
|
269
269
|
* UNION-mode only. Ignored if {@link query} is set.
|
|
270
270
|
*/
|
|
271
|
-
aggregate?:
|
|
271
|
+
aggregate?: ReduceSpec;
|
|
272
272
|
/**
|
|
273
273
|
* Money descriptors for the UNION-mode aggregate, keyed by the
|
|
274
274
|
* OUTPUT/intermediate field name as it appears in the mapped row and
|
|
@@ -325,7 +325,7 @@ export interface MaterializedViewStrategy<TRow extends Record<string, unknown>>
|
|
|
325
325
|
rowKey: (row: TRow) => string;
|
|
326
326
|
/**
|
|
327
327
|
* Explicit source collections. Required when `query()` returns
|
|
328
|
-
* an `
|
|
328
|
+
* an `Reduction` or `GroupedReduction` rather than a `Query<T>`
|
|
329
329
|
* — the dependency analyzer can't introspect through `groupBy().aggregate()`
|
|
330
330
|
* back to the source. Optional for plain `Query<T>` results — the
|
|
331
331
|
* analyzer extracts dependencies automatically from the query plan.
|
|
@@ -25,3 +25,5 @@ export { PersistedCollectionIndex, IDX_PREFIX, COMPOSITE_DELIMITER, encodeIdxId,
|
|
|
25
25
|
export type { OrderedEntry, IngestRow, PersistedIndexDef, } from './persisted-indexes.js';
|
|
26
26
|
export { LazyQuery } from './lazy-builder.js';
|
|
27
27
|
export type { LazyQuerySource, LazyOrderBy } from './lazy-builder.js';
|
|
28
|
+
/** The un-opted-in stub for this service — exported so callers can compare against it (#844). */
|
|
29
|
+
export { NO_INDEXING } from './strategy.js';
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Active aggregate strategy factory. Calling `
|
|
3
|
-
* an `
|
|
2
|
+
* Active aggregate strategy factory. Calling `withReduce()` returns
|
|
3
|
+
* an `ReduceStrategy` whose methods construct real `Reduction` /
|
|
4
4
|
* `GroupedQuery` instances and run the streaming reducer protocol.
|
|
5
5
|
*
|
|
6
|
-
* This module is only reachable through the `@noy-db/hub/
|
|
6
|
+
* This module is only reachable through the `@noy-db/hub/reduce`
|
|
7
7
|
* subpath — a consumer that never imports the subpath ships none of
|
|
8
8
|
* this (ESM tree-shaking + hub's `"sideEffects": false`).
|
|
9
9
|
*/
|
|
10
|
-
import type {
|
|
10
|
+
import type { ReduceStrategy } from './strategy.js';
|
|
11
11
|
/**
|
|
12
12
|
* Build the default aggregate strategy. Pass into
|
|
13
|
-
* `createNoydb({
|
|
13
|
+
* `createNoydb({ reduceStrategy: withReduce() })` to light up
|
|
14
14
|
* `.aggregate()` and `.groupBy()` on `Query` and `ScanBuilder`.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```ts
|
|
18
18
|
* import { createNoydb } from '@noy-db/hub'
|
|
19
|
-
* import {
|
|
19
|
+
* import { withReduce, sum, count } from '@noy-db/hub/reduce'
|
|
20
20
|
*
|
|
21
21
|
* const db = await createNoydb({
|
|
22
22
|
* store, user, secret,
|
|
23
|
-
*
|
|
23
|
+
* reduceStrategy: withReduce(),
|
|
24
24
|
* })
|
|
25
25
|
*
|
|
26
26
|
* const totals = invoices.query()
|
|
@@ -30,4 +30,4 @@ import type { AggregateStrategy } from './strategy.js';
|
|
|
30
30
|
* .run()
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function withReduce(): ReduceStrategy;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
* groupBy doesn't need its own seam for the moment, because it
|
|
59
59
|
* delegates to the reducer protocol for all per-bucket state.
|
|
60
60
|
*/
|
|
61
|
-
import type {
|
|
61
|
+
import type { ReduceSpec, ReduceResult, ReductionUpstream, LiveReduction } from './reduction.js';
|
|
62
62
|
import type { ReducerBuilder } from './reducers.js';
|
|
63
63
|
import type { MoneyDescriptor } from '../../via/money/descriptor.js';
|
|
64
64
|
import type { ViaPipeline } from '../../kernel/via/pipeline.js';
|
|
@@ -78,7 +78,7 @@ export declare const GROUPBY_MAX_CARDINALITY = 100000;
|
|
|
78
78
|
*/
|
|
79
79
|
export declare function resetGroupByWarnings(): void;
|
|
80
80
|
/**
|
|
81
|
-
* Result row shape for a grouped
|
|
81
|
+
* Result row shape for a grouped reduction. Each row carries the
|
|
82
82
|
* group key value under the grouping field name plus every reducer
|
|
83
83
|
* output from the spec.
|
|
84
84
|
*
|
|
@@ -116,7 +116,7 @@ export type GroupedRowN<F extends readonly string[], R> = {
|
|
|
116
116
|
*/
|
|
117
117
|
declare abstract class GroupedQueryBase {
|
|
118
118
|
protected readonly executeRecords: () => readonly unknown[];
|
|
119
|
-
protected readonly upstreams: readonly
|
|
119
|
+
protected readonly upstreams: readonly ReductionUpstream[];
|
|
120
120
|
/**
|
|
121
121
|
* Optional dict label resolver attached by the query builder when
|
|
122
122
|
* the grouping field is a dictKey. Variadic groupings always pass
|
|
@@ -137,7 +137,7 @@ declare abstract class GroupedQueryBase {
|
|
|
137
137
|
* `[field]`.
|
|
138
138
|
*/
|
|
139
139
|
protected readonly fields: readonly string[];
|
|
140
|
-
constructor(executeRecords: () => readonly unknown[], fieldOrFields: string | readonly string[], upstreams: readonly
|
|
140
|
+
constructor(executeRecords: () => readonly unknown[], fieldOrFields: string | readonly string[], upstreams: readonly ReductionUpstream[],
|
|
141
141
|
/**
|
|
142
142
|
* Optional dict label resolver attached by the query builder when
|
|
143
143
|
* the grouping field is a dictKey. Variadic groupings always pass
|
|
@@ -152,21 +152,21 @@ declare abstract class GroupedQueryBase {
|
|
|
152
152
|
*/
|
|
153
153
|
via?: ViaPipeline | undefined);
|
|
154
154
|
/** Apply Via-aware reducer rewriting (e.g. money) when the source declares one. */
|
|
155
|
-
protected wrapSpec<Spec extends
|
|
155
|
+
protected wrapSpec<Spec extends ReduceSpec>(spec: Spec): Spec;
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* Chainable wrapper returned by `Query.groupBy(field)`. Terminates
|
|
159
|
-
* with `.aggregate(spec)` which returns a `
|
|
159
|
+
* with `.aggregate(spec)` which returns a `GroupedReduction`.
|
|
160
160
|
*
|
|
161
161
|
* Kept minimal — the only operation on a grouped query is
|
|
162
|
-
*
|
|
162
|
+
* reduction. Ordering, limiting, and further filtering belong on
|
|
163
163
|
* the underlying `Query` before `.groupBy()` is called; applying
|
|
164
164
|
* them post-group would be a different operation (`having` /
|
|
165
165
|
* `groupOrderBy`), out of scope for.
|
|
166
166
|
*/
|
|
167
167
|
export declare class GroupedQuery<T, F extends string, S extends keyof T = never, M extends keyof T & string = never> extends GroupedQueryBase {
|
|
168
168
|
/**
|
|
169
|
-
* Build a grouped
|
|
169
|
+
* Build a grouped reduction. Returns a `GroupedReduction`
|
|
170
170
|
* with `.run()`, `.runAsync()`, and `.live()` terminals — same shape
|
|
171
171
|
* as the non-grouped `.aggregate()` wrapper, just with an array
|
|
172
172
|
* result (one row per bucket) instead of a single reduced object.
|
|
@@ -178,8 +178,8 @@ export declare class GroupedQuery<T, F extends string, S extends keyof T = never
|
|
|
178
178
|
* declared `moneyFields` (`M`) member return a `MoneyString`. The
|
|
179
179
|
* bare-spec overload is preserved for backward compatibility.
|
|
180
180
|
*/
|
|
181
|
-
aggregate<Spec extends
|
|
182
|
-
aggregate<Spec extends
|
|
181
|
+
aggregate<Spec extends ReduceSpec>(spec: Spec): GroupedReduction<GroupedRow<F, ReduceResult<Spec>>>;
|
|
182
|
+
aggregate<Spec extends ReduceSpec>(build: (b: ReducerBuilder<T, S, M>) => Spec): GroupedReduction<GroupedRow<F, ReduceResult<Spec>>>;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Variadic-keyed sibling of `GroupedQuery<T, F>`. Constructed by the
|
|
@@ -187,12 +187,12 @@ export declare class GroupedQuery<T, F extends string, S extends keyof T = never
|
|
|
187
187
|
* identical — only the type-level result-row narrowing differs.
|
|
188
188
|
*/
|
|
189
189
|
export declare class GroupedQueryN<T, F extends readonly string[], S extends keyof T = never, M extends keyof T & string = never> extends GroupedQueryBase {
|
|
190
|
-
aggregate<Spec extends
|
|
191
|
-
aggregate<Spec extends
|
|
190
|
+
aggregate<Spec extends ReduceSpec>(spec: Spec): GroupedReduction<GroupedRowN<F, ReduceResult<Spec>>>;
|
|
191
|
+
aggregate<Spec extends ReduceSpec>(build: (b: ReducerBuilder<T, S, M>) => Spec): GroupedReduction<GroupedRowN<F, ReduceResult<Spec>>>;
|
|
192
192
|
}
|
|
193
193
|
/**
|
|
194
194
|
* Execute the group-and-reduce pipeline. Pure function over a
|
|
195
|
-
* record array and a spec — shared by `
|
|
195
|
+
* record array and a spec — shared by `GroupedReduction.run()`
|
|
196
196
|
* and the live-mode refresh path. Exported for tests and for any
|
|
197
197
|
* future `scan().groupBy().aggregate()` reuse.
|
|
198
198
|
*
|
|
@@ -201,10 +201,10 @@ export declare class GroupedQueryN<T, F extends readonly string[], S extends key
|
|
|
201
201
|
* bucket would be created — the consumer doesn't have to wait for
|
|
202
202
|
* the full partition to materialize before the error fires.
|
|
203
203
|
*/
|
|
204
|
-
export declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec:
|
|
204
|
+
export declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFields: string | readonly string[], spec: ReduceSpec, moneyFields?: Record<string, MoneyDescriptor>): R[];
|
|
205
205
|
/**
|
|
206
|
-
* Grouped
|
|
207
|
-
* terminal. Shape mirrors `
|
|
206
|
+
* Grouped reduction wrapper — the `.groupBy(field).aggregate(spec)`
|
|
207
|
+
* terminal. Shape mirrors `Reduction<R>` from aggregate.ts: two
|
|
208
208
|
* terminals (`.run()` and `.live()`), spec bound at construction
|
|
209
209
|
* time, upstreams collected for live mode.
|
|
210
210
|
*
|
|
@@ -212,7 +212,7 @@ export declare function groupAndReduce<R>(records: readonly unknown[], fieldOrFi
|
|
|
212
212
|
* grouped row), and the terminals return `R[]` — one row per
|
|
213
213
|
* bucket.
|
|
214
214
|
*/
|
|
215
|
-
export declare class
|
|
215
|
+
export declare class GroupedReduction<R> {
|
|
216
216
|
private readonly executeRecords;
|
|
217
217
|
private readonly spec;
|
|
218
218
|
private readonly upstreams;
|
|
@@ -222,7 +222,7 @@ export declare class GroupedAggregation<R> {
|
|
|
222
222
|
*/
|
|
223
223
|
private readonly dictLabelResolver?;
|
|
224
224
|
private readonly fields;
|
|
225
|
-
constructor(executeRecords: () => readonly unknown[], fields: string | readonly string[], spec:
|
|
225
|
+
constructor(executeRecords: () => readonly unknown[], fields: string | readonly string[], spec: ReduceSpec, upstreams: readonly ReductionUpstream[],
|
|
226
226
|
/**
|
|
227
227
|
* Optional dict label resolver for `<field>Label` projection
|
|
228
228
|
*. Present when the grouping field is a dictKey.
|
|
@@ -260,10 +260,10 @@ export declare class GroupedAggregation<R> {
|
|
|
260
260
|
fallback?: string | readonly string[];
|
|
261
261
|
}): Promise<R[]>;
|
|
262
262
|
/**
|
|
263
|
-
* Build a reactive `
|
|
263
|
+
* Build a reactive `LiveReduction<R[]>` that re-runs the full
|
|
264
264
|
* group-and-reduce pipeline whenever any upstream source notifies
|
|
265
265
|
* of a change. Same error-isolation and idempotent-stop contract
|
|
266
|
-
* as `
|
|
266
|
+
* as `Reduction.live()` — the implementation delegates to the
|
|
267
267
|
* same `LiveAggregationImpl` class by threading a fresh
|
|
268
268
|
* recompute closure through the existing constructor.
|
|
269
269
|
*
|
|
@@ -275,6 +275,6 @@ export declare class GroupedAggregation<R> {
|
|
|
275
275
|
*
|
|
276
276
|
* Always call `live.stop()` when finished.
|
|
277
277
|
*/
|
|
278
|
-
live():
|
|
278
|
+
live(): LiveReduction<R[]>;
|
|
279
279
|
}
|
|
280
280
|
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @noy-db/hub/reduce — opt-in reduction + groupBy service.
|
|
3
|
+
*
|
|
4
|
+
* @category capability
|
|
5
|
+
*
|
|
6
|
+
* Groups every file whose reason-for-existing is record reduction:
|
|
7
|
+
* - `reduction` (`Reduction<R>`, `reduceRecords`, `buildLiveReduction`)
|
|
8
|
+
* - `groupby` (`GroupedQuery`, `GroupedReduction`, cardinality guards)
|
|
9
|
+
* - `reducers` (`count`, `sum`, `avg`, `min`, `max` factories)
|
|
10
|
+
*
|
|
11
|
+
* The root barrel (`@noy-db/hub`) and the `@noy-db/hub/query` subpath
|
|
12
|
+
* continue to re-export the same symbols for backward compatibility
|
|
13
|
+
* with consumers written before the relocation. New code should
|
|
14
|
+
* prefer this subpath.
|
|
15
|
+
*/
|
|
16
|
+
export { withReduce } from './active.js';
|
|
17
|
+
export type { ReduceStrategy } from './strategy.js';
|
|
18
|
+
export { Reduction, reduceRecords, buildLiveReduction } from './reduction.js';
|
|
19
|
+
export type { ReduceSpec, ReduceResult, ReductionUpstream, LiveReduction, } from './reduction.js';
|
|
20
|
+
export { GroupedQuery, GroupedQueryN, GroupedReduction, groupAndReduce, resetGroupByWarnings, GROUPBY_WARN_CARDINALITY, GROUPBY_MAX_CARDINALITY, } from './groupby.js';
|
|
21
|
+
export type { GroupedRow, GroupedRowN } from './groupby.js';
|
|
22
|
+
export { count, sum, avg, min, max, moneySum, moneyMin, moneyMax, reducerBuilder } from './reducers.js';
|
|
23
|
+
export type { Reducer, ReducerOptions, ReducerBuilder } from './reducers.js';
|
|
24
|
+
/** The un-opted-in stub for this service — exported so callers can compare against it (#844). */
|
|
25
|
+
export { NO_REDUCE } from './strategy.js';
|
|
26
|
+
/**
|
|
27
|
+
* Types named by this entry's own signatures (#843a). `min`/`max` return a
|
|
28
|
+
* `MinMaxState`, and the money reducers speak `MoneyString`; both must be
|
|
29
|
+
* nameable from the entry that exports the functions, or a caller can invoke
|
|
30
|
+
* them and cannot annotate the result.
|
|
31
|
+
*/
|
|
32
|
+
export type { MinMaxState } from './reducers.js';
|
|
33
|
+
export type { MoneyString } from '../../via/money/branded.js';
|
|
34
|
+
export type { MoneyDescriptor } from '../../via/money/descriptor.js';
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Reduction reducers for the query DSL.
|
|
3
3
|
*
|
|
4
4
|
* the reducer protocol plus five built-in factories
|
|
5
5
|
* (`count`, `sum`, `avg`, `min`, `max`) consumed by `Query.aggregate()`
|
|
6
6
|
* and, in the future, `Scan.aggregate()`. Every factory accepts
|
|
7
7
|
* an optional `{ seed }` parameter that is plumbed through the
|
|
8
8
|
* protocol but unused by the executor — that's the load-bearing
|
|
9
|
-
* half of constraint #2. When partition-aware
|
|
9
|
+
* half of constraint #2. When partition-aware reduction
|
|
10
10
|
* lands, the seed carries the previous partition's running total into
|
|
11
11
|
* the next partition without requiring a protocol change.
|
|
12
12
|
*
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* Reducers are pure data — `init` / `step` / `finalize` / optional
|
|
20
20
|
* `remove` are stateless functions that receive and return `S`. This
|
|
21
21
|
* is the shape that admits O(1) incremental maintenance in a future
|
|
22
|
-
* optimization (delta-aware `
|
|
22
|
+
* optimization (delta-aware `LiveReduction` applies `step` or
|
|
23
23
|
* `remove` per delta), without blocking the simpler "full re-run on
|
|
24
24
|
* source change" that ships.
|
|
25
25
|
*/
|
|
@@ -30,19 +30,19 @@ import type { QueryField } from '../../kernel/types.js';
|
|
|
30
30
|
* `.aggregate()` spec.
|
|
31
31
|
*
|
|
32
32
|
* Type parameters:
|
|
33
|
-
* - `R` — user-visible result type (what the
|
|
33
|
+
* - `R` — user-visible result type (what the reduction returns
|
|
34
34
|
* for this slot, e.g. `number` for `sum()`)
|
|
35
35
|
* - `S` — internal state type, defaults to `R` for simple reducers
|
|
36
36
|
* that don't need compound bookkeeping
|
|
37
37
|
*
|
|
38
38
|
* A reducer is stateless: every method is pure over `S`. `init()` is
|
|
39
|
-
* called once per
|
|
39
|
+
* called once per reduction run to build the initial state; `step()`
|
|
40
40
|
* folds a record into the state; `remove()` (optional) un-folds a
|
|
41
41
|
* record, enabling incremental live maintenance; `finalize()` reads
|
|
42
42
|
* the final answer out of the state at the end of the run.
|
|
43
43
|
*/
|
|
44
44
|
export interface Reducer<R, S = R> {
|
|
45
|
-
/** Build the initial state for a fresh
|
|
45
|
+
/** Build the initial state for a fresh reduction run. */
|
|
46
46
|
init(): S;
|
|
47
47
|
/** Fold a record into the state. Returns the new state. */
|
|
48
48
|
step(state: S, record: unknown): S;
|
|
@@ -63,7 +63,7 @@ export interface Reducer<R, S = R> {
|
|
|
63
63
|
* Combine two independent partial states into one (then `finalize` once).
|
|
64
64
|
* Optional. MUST be associative + commutative with `init()` as identity.
|
|
65
65
|
* Never merge finalized results — only states. Enables parallel /
|
|
66
|
-
* hierarchical
|
|
66
|
+
* hierarchical reduction (e.g. cross-shard or advisor→firm rollup).
|
|
67
67
|
*/
|
|
68
68
|
merge?(a: S, b: S): S;
|
|
69
69
|
/**
|
|
@@ -94,10 +94,10 @@ export interface Reducer<R, S = R> {
|
|
|
94
94
|
*
|
|
95
95
|
* `seed` — optional initial value for the internal state. **Unused by
|
|
96
96
|
* the executor**, plumbed through the protocol for constraint
|
|
97
|
-
* #2 (partition-aware
|
|
98
|
-
*
|
|
97
|
+
* #2 (partition-aware reduction seam). In, partitioned
|
|
98
|
+
* reductions will pass the previous partition's carry as `seed` so
|
|
99
99
|
* a long time series can be rolled forward one partition at a time
|
|
100
|
-
* without re-
|
|
100
|
+
* without re-reducing closed partitions.
|
|
101
101
|
*
|
|
102
102
|
* always uses `init()` with the factory's zero value, regardless
|
|
103
103
|
* of whether `seed` was passed. Do not remove the parameter — that's
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Aggregate execution — the runtime behind `Query.aggregate()`.
|
|
3
3
|
*
|
|
4
|
-
* takes an `
|
|
4
|
+
* takes an `ReduceSpec` (a record of named reducers
|
|
5
5
|
* built from `reducers.ts`) and runs every reducer over the records
|
|
6
6
|
* produced by the underlying query. Two terminal surfaces:
|
|
7
7
|
*
|
|
8
8
|
* - `.run(): R` — synchronous one-shot reduction. Matches the
|
|
9
9
|
* existing `Query.toArray()` / `.first()` / `.count()` style.
|
|
10
|
-
* - `.live():
|
|
10
|
+
* - `.live(): LiveReduction<R>` — reactive primitive that
|
|
11
11
|
* re-runs the reduction whenever the query's source notifies of
|
|
12
12
|
* a change. uses naive full re-run; incremental delta
|
|
13
13
|
* maintenance is admitted by the reducer protocol (`remove()`)
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* can switch from full re-run to delta-based without breaking
|
|
16
16
|
* the public API. Consumers get correct, reactive values today.
|
|
17
17
|
*
|
|
18
|
-
* The `
|
|
18
|
+
* The `Reduction<R>` wrapper is deliberately tiny — it exists so
|
|
19
19
|
* `.aggregate(spec)` can be chained with either `.run()` or `.live()`
|
|
20
20
|
* without the builder needing two separate terminal methods. It
|
|
21
21
|
* holds the closure over the query execution (produces the current
|
|
@@ -39,9 +39,9 @@ import type { Reducer } from './reducers.js';
|
|
|
39
39
|
* }
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export type
|
|
42
|
+
export type ReduceSpec = Readonly<Record<string, Reducer<unknown, unknown>>>;
|
|
43
43
|
/**
|
|
44
|
-
* Map an `
|
|
44
|
+
* Map an `ReduceSpec` to its reduced result shape — each key
|
|
45
45
|
* carries the finalized result type from its reducer. A spec built
|
|
46
46
|
* from `{ total: sum('amount'), n: count() }` yields a result of
|
|
47
47
|
* `{ total: number, n: number }`.
|
|
@@ -50,26 +50,26 @@ export type AggregateSpec = Readonly<Record<string, Reducer<unknown, unknown>>>;
|
|
|
50
50
|
* each `Reducer<R, _>`. The `infer` captures the user-visible result
|
|
51
51
|
* type, discarding the internal state type `S`.
|
|
52
52
|
*/
|
|
53
|
-
export type
|
|
53
|
+
export type ReduceResult<Spec extends ReduceSpec> = {
|
|
54
54
|
[K in keyof Spec]: Spec[K] extends Reducer<infer R, unknown> ? R : never;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
57
|
* Pure reduction over a record array. Runs every reducer's
|
|
58
58
|
* `init → step* → finalize` pipeline exactly once over the records.
|
|
59
59
|
*
|
|
60
|
-
* Called by `
|
|
60
|
+
* Called by `Reduction.run()` and by the live-mode refresh path.
|
|
61
61
|
* Exported for tests and for future `scan().aggregate()` reuse
|
|
62
62
|
* — the streaming path will call the same reducer protocol with a
|
|
63
63
|
* per-page loop instead of a single array.
|
|
64
64
|
*/
|
|
65
|
-
export declare function reduceRecords<Spec extends
|
|
65
|
+
export declare function reduceRecords<Spec extends ReduceSpec>(records: readonly unknown[], spec: Spec): ReduceResult<Spec>;
|
|
66
66
|
/**
|
|
67
|
-
* A minimal reactive primitive for
|
|
67
|
+
* A minimal reactive primitive for reduction results.
|
|
68
68
|
*
|
|
69
69
|
* Same spirit as the `LiveQuery` in : frame-agnostic, a plain
|
|
70
70
|
* object with `value` / `error` fields and a `subscribe(cb)`
|
|
71
71
|
* notification channel that Vue / React / Solid adapters wrap in
|
|
72
|
-
* their own primitive. Intentionally NOT a Promise —
|
|
72
|
+
* their own primitive. Intentionally NOT a Promise — reductions
|
|
73
73
|
* have a well-defined "current value" at every instant, and the
|
|
74
74
|
* reactive consumer wants to read that value synchronously.
|
|
75
75
|
*
|
|
@@ -86,7 +86,7 @@ export declare function reduceRecords<Spec extends AggregateSpec>(records: reado
|
|
|
86
86
|
* Always call `stop()` when done; Vue's `onUnmounted` is the
|
|
87
87
|
* canonical place. Raw consumers must do it themselves.
|
|
88
88
|
*/
|
|
89
|
-
export interface
|
|
89
|
+
export interface LiveReduction<R> {
|
|
90
90
|
/** Current reduced value. Undefined only if the first compute threw. */
|
|
91
91
|
readonly value: R | undefined;
|
|
92
92
|
/** Last execution error, if any. Cleared on the next successful run. */
|
|
@@ -97,14 +97,14 @@ export interface LiveAggregation<R> {
|
|
|
97
97
|
stop(): void;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
|
-
* Upstream change-notification hook for live
|
|
100
|
+
* Upstream change-notification hook for live reduction.
|
|
101
101
|
*
|
|
102
102
|
* Matches the shape that `QuerySource.subscribe` already uses — a
|
|
103
103
|
* single method that accepts a callback and returns an unsubscribe
|
|
104
|
-
* function. The `
|
|
104
|
+
* function. The `Reduction` wrapper collects upstreams from the
|
|
105
105
|
* query's source and wires them into a single re-run trigger.
|
|
106
106
|
*/
|
|
107
|
-
export interface
|
|
107
|
+
export interface ReductionUpstream {
|
|
108
108
|
subscribe(cb: () => void): () => void;
|
|
109
109
|
}
|
|
110
110
|
/**
|
|
@@ -120,14 +120,14 @@ export interface AggregationUpstream {
|
|
|
120
120
|
* `.aggregate(spec).live()`. Wrapping lets the spec be named once
|
|
121
121
|
* and reused for either terminal, and keeps the `Query` class
|
|
122
122
|
* from growing a pair of near-duplicate method overloads
|
|
123
|
-
* (`
|
|
123
|
+
* (`reduceRun` / `reduceLive`) that would be harder to
|
|
124
124
|
* discover.
|
|
125
125
|
*/
|
|
126
|
-
export declare class
|
|
126
|
+
export declare class Reduction<R> {
|
|
127
127
|
private readonly executeRecords;
|
|
128
128
|
private readonly spec;
|
|
129
129
|
private readonly upstreams;
|
|
130
|
-
constructor(executeRecords: () => readonly unknown[], spec:
|
|
130
|
+
constructor(executeRecords: () => readonly unknown[], spec: ReduceSpec, upstreams: readonly ReductionUpstream[]);
|
|
131
131
|
/**
|
|
132
132
|
* Execute the query and reduce the results synchronously.
|
|
133
133
|
* Returns the reduced shape matching the spec — e.g. a spec of
|
|
@@ -136,7 +136,7 @@ export declare class Aggregation<R> {
|
|
|
136
136
|
*/
|
|
137
137
|
run(): R;
|
|
138
138
|
/**
|
|
139
|
-
* Build a reactive `
|
|
139
|
+
* Build a reactive `LiveReduction<R>` that re-runs the reduction
|
|
140
140
|
* whenever any upstream source notifies of a change. The initial
|
|
141
141
|
* value is computed eagerly in the constructor, so consumers can
|
|
142
142
|
* read `live.value` immediately after calling `.live()`.
|
|
@@ -153,14 +153,14 @@ export declare class Aggregation<R> {
|
|
|
153
153
|
* correct, reactive values today; future PRs can switch to
|
|
154
154
|
* delta-based maintenance without changing this API.
|
|
155
155
|
*/
|
|
156
|
-
live():
|
|
156
|
+
live(): LiveReduction<R>;
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
|
-
* Build a `
|
|
159
|
+
* Build a `LiveReduction<V>` from a recompute closure and a list
|
|
160
160
|
* of upstreams. Exposed so sibling files in the query DSL
|
|
161
161
|
* (currently `groupby.ts`) can reuse the reactive primitive
|
|
162
162
|
* without reaching into `LiveAggregationImpl` directly. This keeps
|
|
163
163
|
* the implementation class private while still allowing planned
|
|
164
164
|
* composition with `.groupBy().aggregate().live()`.
|
|
165
165
|
*/
|
|
166
|
-
export declare function
|
|
166
|
+
export declare function buildLiveReduction<V>(recompute: () => V, upstreams: readonly ReductionUpstream[]): LiveReduction<V>;
|