@graphrefly/graphrefly 0.27.0 → 0.28.0
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/backoff-HPZMEZNF.js +1 -0
- package/dist/cascading-B-5zmAUv.d.cts +180 -0
- package/dist/cascading-D9WG1-9L.d.ts +180 -0
- package/dist/chunk-2FOAM3OR.js +1 -0
- package/dist/chunk-2PMCKKRK.js +1 -0
- package/dist/chunk-3JXNEPCD.js +2 -0
- package/dist/chunk-3R5HFPX7.js +78 -0
- package/dist/chunk-4GKB4OUJ.js +1 -0
- package/dist/chunk-4VVTGLXJ.js +1 -0
- package/dist/chunk-5QDBSZBV.js +1 -0
- package/dist/chunk-6QZNQS5B.js +1 -0
- package/dist/chunk-6V3SEX2I.js +1 -0
- package/dist/chunk-76A3HVQE.js +9 -0
- package/dist/chunk-7H6LGFUG.js +64 -0
- package/dist/chunk-CK2E7BTU.js +1 -0
- package/dist/chunk-CKCSDI7T.js +6 -0
- package/dist/chunk-CRXTH3SH.js +1 -0
- package/dist/chunk-CWLN3X3N.js +1 -0
- package/dist/chunk-D7A7DBE4.js +1 -0
- package/dist/chunk-DBGGMN3D.js +1 -0
- package/dist/chunk-DQA3UIQ2.js +1 -0
- package/dist/chunk-ERLIRFPA.js +1 -0
- package/dist/chunk-ESMPEKEV.js +1 -0
- package/dist/chunk-ETWTCCJI.js +1 -0
- package/dist/chunk-FNYWM6JC.js +1 -0
- package/dist/chunk-GHJJR5P4.js +1 -0
- package/dist/chunk-GPW2V3RE.js +1 -0
- package/dist/chunk-I6VIH3VA.js +1 -0
- package/dist/chunk-K2GNMCQT.js +1 -0
- package/dist/chunk-LBTDSCCO.js +3 -0
- package/dist/chunk-LQ3Y5NJS.js +1 -0
- package/dist/chunk-MIQTDPY4.js +5 -0
- package/dist/chunk-MTTAAPCK.js +1 -0
- package/dist/chunk-OAWLCNJJ.js +1 -0
- package/dist/chunk-OBKQQA5I.js +1 -0
- package/dist/chunk-OYHGKYQM.js +1 -0
- package/dist/chunk-PIOGHC63.js +1 -0
- package/dist/chunk-QWAPKG3O.js +2 -0
- package/dist/chunk-QYADASLV.js +1 -0
- package/dist/chunk-RHESUC3V.js +43 -0
- package/dist/chunk-S35VARIR.js +1 -0
- package/dist/chunk-SC3U7ETD.js +1 -0
- package/dist/chunk-U3AICJKU.js +1 -0
- package/dist/chunk-UMBIDLJ4.js +1 -0
- package/dist/chunk-UPHHLMHE.js +1 -0
- package/dist/chunk-UPXUCFMX.js +1 -0
- package/dist/chunk-UWJE5FQA.js +18 -0
- package/dist/chunk-V6YQICXZ.js +1 -0
- package/dist/chunk-VIMF6LGM.js +1 -0
- package/dist/chunk-VJLMUKOI.js +1 -0
- package/dist/chunk-VPYBOXVT.js +1 -0
- package/dist/chunk-VTPVOGHH.js +1 -0
- package/dist/chunk-WQ2BN6X6.js +1 -0
- package/dist/chunk-XAUNPIMX.js +1 -0
- package/dist/chunk-Y2EMPB3I.js +1 -0
- package/dist/chunk-Z4HDAS2Q.js +1 -0
- package/dist/chunk-ZB5EHBIO.js +1 -0
- package/dist/chunk-ZV2DXV5A.js +23 -0
- package/dist/compat/index.cjs +14 -7656
- package/dist/compat/index.d.cts +15 -14
- package/dist/compat/index.d.ts +15 -14
- package/dist/compat/index.js +1 -50
- package/dist/compat/jotai/index.cjs +1 -2048
- package/dist/compat/jotai/index.d.cts +2 -2
- package/dist/compat/jotai/index.d.ts +2 -2
- package/dist/compat/jotai/index.js +1 -9
- package/dist/compat/nanostores/index.cjs +1 -2175
- package/dist/compat/nanostores/index.d.cts +2 -2
- package/dist/compat/nanostores/index.d.ts +2 -2
- package/dist/compat/nanostores/index.js +1 -23
- package/dist/compat/nestjs/index.cjs +14 -6782
- package/dist/compat/nestjs/index.d.cts +7 -6
- package/dist/compat/nestjs/index.d.ts +7 -6
- package/dist/compat/nestjs/index.js +1 -83
- package/dist/compat/react/index.cjs +1 -141
- package/dist/compat/react/index.d.cts +2 -2
- package/dist/compat/react/index.d.ts +2 -2
- package/dist/compat/react/index.js +1 -12
- package/dist/compat/solid/index.cjs +1 -128
- package/dist/compat/solid/index.d.cts +2 -2
- package/dist/compat/solid/index.d.ts +2 -2
- package/dist/compat/solid/index.js +1 -12
- package/dist/compat/svelte/index.cjs +1 -131
- package/dist/compat/svelte/index.d.cts +2 -2
- package/dist/compat/svelte/index.d.ts +2 -2
- package/dist/compat/svelte/index.js +1 -12
- package/dist/compat/vue/index.cjs +1 -146
- package/dist/compat/vue/index.d.cts +2 -2
- package/dist/compat/vue/index.d.ts +2 -2
- package/dist/compat/vue/index.js +1 -12
- package/dist/compat/zustand/index.cjs +6 -4931
- package/dist/compat/zustand/index.d.cts +5 -5
- package/dist/compat/zustand/index.d.ts +5 -5
- package/dist/compat/zustand/index.js +1 -12
- package/dist/composite-B-xqw4Kk.d.cts +69 -0
- package/dist/composite-BhbKHbOS.d.ts +69 -0
- package/dist/core/index.cjs +1 -2271
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -110
- package/dist/extra/browser.cjs +1 -0
- package/dist/extra/browser.d.cts +3 -0
- package/dist/extra/browser.d.ts +3 -0
- package/dist/extra/browser.js +1 -0
- package/dist/extra/index.cjs +23 -9971
- package/dist/extra/index.d.cts +13 -6
- package/dist/extra/index.d.ts +13 -6
- package/dist/extra/index.js +1 -381
- package/dist/extra/node.cjs +3 -0
- package/dist/extra/node.d.cts +81 -0
- package/dist/extra/node.d.ts +81 -0
- package/dist/extra/node.js +2 -0
- package/dist/extra/operators.cjs +1 -0
- package/dist/extra/operators.d.cts +910 -0
- package/dist/extra/operators.d.ts +910 -0
- package/dist/extra/operators.js +1 -0
- package/dist/extra/reactive.cjs +1 -0
- package/dist/extra/reactive.d.cts +352 -0
- package/dist/extra/reactive.d.ts +352 -0
- package/dist/extra/reactive.js +1 -0
- package/dist/extra/sources.cjs +1 -2486
- package/dist/extra/sources.d.cts +6 -2
- package/dist/extra/sources.d.ts +6 -2
- package/dist/extra/sources.js +1 -57
- package/dist/extra/storage-browser.cjs +1 -0
- package/dist/extra/storage-browser.d.cts +71 -0
- package/dist/extra/storage-browser.d.ts +71 -0
- package/dist/extra/storage-browser.js +1 -0
- package/dist/extra/storage-core.cjs +1 -0
- package/dist/extra/storage-core.d.cts +98 -0
- package/dist/extra/storage-core.d.ts +98 -0
- package/dist/extra/storage-core.js +1 -0
- package/dist/extra/storage-node.cjs +2 -0
- package/dist/extra/storage-node.d.cts +60 -0
- package/dist/extra/storage-node.d.ts +60 -0
- package/dist/extra/storage-node.js +1 -0
- package/dist/fallback-BaTS7vVY.d.cts +258 -0
- package/dist/fallback-eOm3LNxP.d.ts +258 -0
- package/dist/graph/index.cjs +6 -5030
- package/dist/graph/index.d.cts +6 -5
- package/dist/graph/index.d.ts +6 -5
- package/dist/graph/index.js +1 -50
- package/dist/{graph-CCwGKLCm.d.ts → graph-BZGRXwOm.d.ts} +134 -31
- package/dist/{graph-DNCrvZSn.d.cts → graph-D48Qw9Cg.d.cts} +134 -31
- package/dist/index-8FSVk4Uf.d.ts +135 -0
- package/dist/index-9oDeHH2u.d.cts +291 -0
- package/dist/{messaging-XDoYablx.d.ts → index-B0c4cmIO.d.ts} +31 -93
- package/dist/{index-VdHQMPy1.d.ts → index-B1AmmSlb.d.ts} +1 -1
- package/dist/{index-VHqptjhu.d.cts → index-B2pwesl9.d.cts} +1 -1
- package/dist/index-BHvIquRZ.d.ts +1957 -0
- package/dist/{index-Dzk2hrlR.d.ts → index-BVHOrDwO.d.ts} +1 -1
- package/dist/{index-CxFrXH4m.d.ts → index-BWJV63ti.d.ts} +1 -1
- package/dist/{index-Xi3u0HCQ.d.cts → index-B_agccPe.d.cts} +1 -1
- package/dist/index-BgyGlizc.d.ts +163 -0
- package/dist/index-BpA5c4G9.d.ts +357 -0
- package/dist/index-BpIFjILY.d.cts +357 -0
- package/dist/{index-3lsddbbS.d.ts → index-Bqachn9_.d.ts} +1 -1
- package/dist/index-Btib9rsU.d.ts +607 -0
- package/dist/{index-wEn0eFe8.d.ts → index-BwM9BEkt.d.ts} +1 -1
- package/dist/index-BxJ86YZZ.d.cts +105 -0
- package/dist/{audit-DRlSzBu9.d.ts → index-C73n7lo-.d.cts} +27 -21
- package/dist/index-CEXXwWVH.d.cts +192 -0
- package/dist/index-CHEswufn.d.cts +163 -0
- package/dist/{index-C0svESO4.d.ts → index-CMn8S8Hw.d.ts} +1 -1
- package/dist/{index-ByQxazQJ.d.cts → index-CRO83MmV.d.cts} +1 -1
- package/dist/{index-BuEoe-Qu.d.ts → index-CloUk1kY.d.ts} +9 -9
- package/dist/index-CpgYhnrG.d.ts +291 -0
- package/dist/{index-DO_6JN9Z.d.cts → index-Cyojz0AE.d.cts} +1 -1
- package/dist/{demo-shell-BDkOptd6.d.ts → index-CzobVSMr.d.ts} +14 -14
- package/dist/index-Czq6ynh8.d.ts +143 -0
- package/dist/{index-BaSM3aYt.d.ts → index-D-YB-Vl3.d.ts} +3 -3
- package/dist/index-DAlweici.d.ts +231 -0
- package/dist/index-DEwTb_fm.d.cts +1957 -0
- package/dist/{index-DYme44FM.d.cts → index-DL-rYJrx.d.cts} +1 -1
- package/dist/{memory-li6FL5RM.d.ts → index-DP4ZTkdw.d.ts} +26 -26
- package/dist/{index-BwfLUNw4.d.ts → index-DUqMOlKZ.d.cts} +173 -2040
- package/dist/{index-B1tloyhO.d.cts → index-D_NwnRYS.d.cts} +1 -1
- package/dist/index-DaLJvH8Z.d.ts +105 -0
- package/dist/index-DcXZBF5a.d.cts +135 -0
- package/dist/index-DfyOkTvs.d.ts +321 -0
- package/dist/{index-B9B7_HEY.d.ts → index-DiOXyAwt.d.ts} +1 -1
- package/dist/index-DpHe5e0Q.d.ts +186 -0
- package/dist/index-DraikLjn.d.ts +86 -0
- package/dist/{index-D8wS_PeY.d.cts → index-DxsnAMWD.d.cts} +9 -9
- package/dist/{messaging-Gt4LPbyA.d.cts → index-DyxjtScX.d.cts} +31 -93
- package/dist/{audit-ClmqGOCx.d.cts → index-HDpJe9hX.d.ts} +27 -21
- package/dist/{index-DVGiGFGT.d.cts → index-O6TgGUBV.d.cts} +3 -3
- package/dist/{index-B6EhDnjH.d.cts → index-Oi8d8w4R.d.cts} +1 -1
- package/dist/{index-C8oil6M6.d.ts → index-ROpQmGjE.d.ts} +30 -6
- package/dist/index-RukJ4DLS.d.cts +607 -0
- package/dist/{index-BHlKbUwO.d.cts → index-ZftwfxJM.d.ts} +173 -2040
- package/dist/{index-BPVt8kqc.d.ts → index-cByzxQIC.d.cts} +10 -195
- package/dist/index-dtN7YA2x.d.cts +143 -0
- package/dist/{index-CI3DprxP.d.cts → index-fM6y00vT.d.cts} +30 -6
- package/dist/{index-DlLp-2Xn.d.cts → index-m-yHof5p.d.ts} +10 -195
- package/dist/index-pXrDMpRO.d.cts +231 -0
- package/dist/index-rHJSKsU8.d.cts +186 -0
- package/dist/index-rX8HBM5h.d.cts +321 -0
- package/dist/{index-CO8uBlUh.d.cts → index-rnwQly8X.d.cts} +147 -20
- package/dist/index-sm373fsH.d.ts +192 -0
- package/dist/{memory-C6Z2tGpC.d.cts → index-tbf2gKHd.d.cts} +26 -26
- package/dist/{demo-shell-Crid1WdR.d.cts → index-u15meRxL.d.cts} +14 -14
- package/dist/{index-B6D3QNSA.d.ts → index-umtoWT8K.d.ts} +147 -20
- package/dist/index-vscRDkjW.d.cts +86 -0
- package/dist/index.cjs +150 -24142
- package/dist/index.d.cts +69 -2099
- package/dist/index.d.ts +69 -2099
- package/dist/index.js +1 -3868
- package/dist/{meta-CbznRPYJ.d.ts → meta-Cgj6zeji.d.cts} +5 -5
- package/dist/{meta-BxCA7rcr.d.cts → meta-CwesDrMD.d.ts} +5 -5
- package/dist/{node-BmerH3kS.d.cts → node-Cc1TniY8.d.cts} +36 -9
- package/dist/{node-BmerH3kS.d.ts → node-Cc1TniY8.d.ts} +36 -9
- package/dist/{observable-BgGUwcqp.d.ts → observable-Ct-gJ9jI.d.ts} +1 -1
- package/dist/{observable-DJt_AxzQ.d.cts → observable-glXQoGj2.d.cts} +1 -1
- package/dist/patterns/ai/browser.cjs +25 -0
- package/dist/patterns/ai/browser.d.cts +127 -0
- package/dist/patterns/ai/browser.d.ts +127 -0
- package/dist/patterns/ai/browser.js +3 -0
- package/dist/patterns/ai/index.cjs +91 -0
- package/dist/patterns/ai/index.d.cts +17 -0
- package/dist/patterns/ai/index.d.ts +17 -0
- package/dist/patterns/ai/index.js +1 -0
- package/dist/patterns/ai/node.cjs +2 -0
- package/dist/patterns/ai/node.d.cts +58 -0
- package/dist/patterns/ai/node.d.ts +58 -0
- package/dist/patterns/ai/node.js +1 -0
- package/dist/patterns/audit/index.cjs +6 -0
- package/dist/patterns/audit/index.d.cts +6 -0
- package/dist/patterns/audit/index.d.ts +6 -0
- package/dist/patterns/audit/index.js +1 -0
- package/dist/patterns/cqrs/index.cjs +6 -0
- package/dist/patterns/cqrs/index.d.cts +5 -0
- package/dist/patterns/cqrs/index.d.ts +5 -0
- package/dist/patterns/cqrs/index.js +1 -0
- package/dist/patterns/demo-shell/index.cjs +7 -0
- package/dist/patterns/demo-shell/index.d.cts +6 -0
- package/dist/patterns/demo-shell/index.d.ts +6 -0
- package/dist/patterns/demo-shell/index.js +1 -0
- package/dist/patterns/domain-templates/index.cjs +6 -0
- package/dist/patterns/domain-templates/index.d.cts +5 -0
- package/dist/patterns/domain-templates/index.d.ts +5 -0
- package/dist/patterns/domain-templates/index.js +1 -0
- package/dist/patterns/graphspec/index.cjs +83 -0
- package/dist/patterns/graphspec/index.d.cts +7 -0
- package/dist/patterns/graphspec/index.d.ts +7 -0
- package/dist/patterns/graphspec/index.js +1 -0
- package/dist/patterns/guarded-execution/index.cjs +6 -0
- package/dist/patterns/guarded-execution/index.d.cts +7 -0
- package/dist/patterns/guarded-execution/index.d.ts +7 -0
- package/dist/patterns/guarded-execution/index.js +1 -0
- package/dist/patterns/harness/index.cjs +48 -0
- package/dist/patterns/harness/index.d.cts +8 -0
- package/dist/patterns/harness/index.d.ts +8 -0
- package/dist/patterns/harness/index.js +1 -0
- package/dist/patterns/job-queue/index.cjs +6 -0
- package/dist/patterns/job-queue/index.d.cts +5 -0
- package/dist/patterns/job-queue/index.d.ts +5 -0
- package/dist/patterns/job-queue/index.js +1 -0
- package/dist/patterns/lens/index.cjs +6 -0
- package/dist/patterns/lens/index.d.cts +7 -0
- package/dist/patterns/lens/index.d.ts +7 -0
- package/dist/patterns/lens/index.js +1 -0
- package/dist/patterns/memory/index.cjs +6 -0
- package/dist/patterns/memory/index.d.cts +5 -0
- package/dist/patterns/memory/index.d.ts +5 -0
- package/dist/patterns/memory/index.js +1 -0
- package/dist/patterns/messaging/index.cjs +6 -0
- package/dist/patterns/messaging/index.d.cts +5 -0
- package/dist/patterns/messaging/index.d.ts +5 -0
- package/dist/patterns/messaging/index.js +1 -0
- package/dist/patterns/orchestration/index.cjs +6 -0
- package/dist/patterns/orchestration/index.d.cts +6 -0
- package/dist/patterns/orchestration/index.d.ts +6 -0
- package/dist/patterns/orchestration/index.js +1 -0
- package/dist/patterns/reactive-layout/index.cjs +7 -6444
- package/dist/patterns/reactive-layout/index.d.cts +6 -6
- package/dist/patterns/reactive-layout/index.d.ts +6 -6
- package/dist/patterns/reactive-layout/index.js +1 -56
- package/dist/patterns/reduction/index.cjs +6 -0
- package/dist/patterns/reduction/index.d.cts +5 -0
- package/dist/patterns/reduction/index.d.ts +5 -0
- package/dist/patterns/reduction/index.js +1 -0
- package/dist/patterns/refine-loop/index.cjs +8 -0
- package/dist/patterns/refine-loop/index.d.cts +7 -0
- package/dist/patterns/refine-loop/index.d.ts +7 -0
- package/dist/patterns/refine-loop/index.js +1 -0
- package/dist/patterns/resilient-pipeline/index.cjs +1 -0
- package/dist/patterns/resilient-pipeline/index.d.cts +7 -0
- package/dist/patterns/resilient-pipeline/index.d.ts +7 -0
- package/dist/patterns/resilient-pipeline/index.js +1 -0
- package/dist/patterns/surface/index.cjs +14 -0
- package/dist/patterns/surface/index.d.cts +8 -0
- package/dist/patterns/surface/index.d.ts +8 -0
- package/dist/patterns/surface/index.js +1 -0
- package/dist/{reactive-layout-MQP--J3F.d.cts → reactive-layout-CpYb5qLP.d.cts} +2 -2
- package/dist/{reactive-layout-u5Ulnqag.d.ts → reactive-layout-D8u4wuUR.d.ts} +2 -2
- package/dist/reactive-log-DPzuUDj5.d.cts +190 -0
- package/dist/reactive-log-YuH9VYN8.d.ts +190 -0
- package/dist/{composite-aUCvjZVR.d.ts → reactive-map-CdbNoSgP.d.ts} +2 -67
- package/dist/{composite-C7PcQvcs.d.cts → reactive-map-DUeRmb9d.d.cts} +2 -67
- package/dist/resilience-Ba5-b4WD.d.cts +493 -0
- package/dist/resilience-CGRzhnD3.d.ts +493 -0
- package/dist/resilience-QAHKANT5.js +1 -0
- package/dist/{sugar-D02n5JjF.d.cts → sugar-BV0htudb.d.cts} +8 -4
- package/dist/{sugar-CCOxXK1e.d.ts → sugar-Dtyrq2_q.d.ts} +8 -4
- package/dist/topology-tree-CYHOwQZ_.d.ts +25 -0
- package/dist/topology-tree-DROUdq5B.d.cts +25 -0
- package/dist/types-O3GzJY2U.d.cts +401 -0
- package/dist/types-u64Ose53.d.ts +401 -0
- package/package.json +252 -22
- package/dist/ai-CaR_912Q.d.cts +0 -1033
- package/dist/ai-WlRltJV7.d.ts +0 -1033
- package/dist/chunk-3ZWCKRHX.js +0 -117
- package/dist/chunk-3ZWCKRHX.js.map +0 -1
- package/dist/chunk-7TAQJHQV.js +0 -103
- package/dist/chunk-7TAQJHQV.js.map +0 -1
- package/dist/chunk-APFNLIRG.js +0 -62
- package/dist/chunk-APFNLIRG.js.map +0 -1
- package/dist/chunk-AT5LKYNL.js +0 -395
- package/dist/chunk-AT5LKYNL.js.map +0 -1
- package/dist/chunk-BQ6RQQFF.js +0 -5087
- package/dist/chunk-BQ6RQQFF.js.map +0 -1
- package/dist/chunk-BVZYTZ5H.js +0 -599
- package/dist/chunk-BVZYTZ5H.js.map +0 -1
- package/dist/chunk-DST5DKZS.js +0 -1371
- package/dist/chunk-DST5DKZS.js.map +0 -1
- package/dist/chunk-GTE6PWRZ.js +0 -866
- package/dist/chunk-GTE6PWRZ.js.map +0 -1
- package/dist/chunk-HXZEYDUR.js +0 -94
- package/dist/chunk-HXZEYDUR.js.map +0 -1
- package/dist/chunk-J22W6HV3.js +0 -107
- package/dist/chunk-J22W6HV3.js.map +0 -1
- package/dist/chunk-J2VBW3DZ.js +0 -302
- package/dist/chunk-J2VBW3DZ.js.map +0 -1
- package/dist/chunk-JSCT3CR4.js +0 -38
- package/dist/chunk-JSCT3CR4.js.map +0 -1
- package/dist/chunk-JWBCY4NC.js +0 -330
- package/dist/chunk-JWBCY4NC.js.map +0 -1
- package/dist/chunk-K2AUJHVP.js +0 -2251
- package/dist/chunk-K2AUJHVP.js.map +0 -1
- package/dist/chunk-MJ2NKQQL.js +0 -119
- package/dist/chunk-MJ2NKQQL.js.map +0 -1
- package/dist/chunk-N6UR7YVY.js +0 -198
- package/dist/chunk-N6UR7YVY.js.map +0 -1
- package/dist/chunk-NC6S43JJ.js +0 -456
- package/dist/chunk-NC6S43JJ.js.map +0 -1
- package/dist/chunk-OFVJBJXR.js +0 -98
- package/dist/chunk-OFVJBJXR.js.map +0 -1
- package/dist/chunk-OHISZPOJ.js +0 -97
- package/dist/chunk-OHISZPOJ.js.map +0 -1
- package/dist/chunk-OU5CQKNW.js +0 -102
- package/dist/chunk-OU5CQKNW.js.map +0 -1
- package/dist/chunk-PF7GRZMW.js +0 -2712
- package/dist/chunk-PF7GRZMW.js.map +0 -1
- package/dist/chunk-PHOUUNK7.js +0 -2291
- package/dist/chunk-PHOUUNK7.js.map +0 -1
- package/dist/chunk-RNHBMHKA.js +0 -1665
- package/dist/chunk-RNHBMHKA.js.map +0 -1
- package/dist/chunk-SX52TAR4.js +0 -110
- package/dist/chunk-SX52TAR4.js.map +0 -1
- package/dist/chunk-VYPWMZ6H.js +0 -98
- package/dist/chunk-VYPWMZ6H.js.map +0 -1
- package/dist/chunk-WBZOVTYK.js +0 -171
- package/dist/chunk-WBZOVTYK.js.map +0 -1
- package/dist/chunk-WKNUIZOY.js +0 -354
- package/dist/chunk-WKNUIZOY.js.map +0 -1
- package/dist/chunk-X3VMZYBT.js +0 -713
- package/dist/chunk-X3VMZYBT.js.map +0 -1
- package/dist/chunk-X5R3GL6H.js +0 -525
- package/dist/chunk-X5R3GL6H.js.map +0 -1
- package/dist/chunk-XGPU467M.js +0 -136
- package/dist/chunk-XGPU467M.js.map +0 -1
- package/dist/compat/index.cjs.map +0 -1
- package/dist/compat/index.js.map +0 -1
- package/dist/compat/jotai/index.cjs.map +0 -1
- package/dist/compat/jotai/index.js.map +0 -1
- package/dist/compat/nanostores/index.cjs.map +0 -1
- package/dist/compat/nanostores/index.js.map +0 -1
- package/dist/compat/nestjs/index.cjs.map +0 -1
- package/dist/compat/nestjs/index.js.map +0 -1
- package/dist/compat/react/index.cjs.map +0 -1
- package/dist/compat/react/index.js.map +0 -1
- package/dist/compat/solid/index.cjs.map +0 -1
- package/dist/compat/solid/index.js.map +0 -1
- package/dist/compat/svelte/index.cjs.map +0 -1
- package/dist/compat/svelte/index.js.map +0 -1
- package/dist/compat/vue/index.cjs.map +0 -1
- package/dist/compat/vue/index.js.map +0 -1
- package/dist/compat/zustand/index.cjs.map +0 -1
- package/dist/compat/zustand/index.js.map +0 -1
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/extra/index.cjs.map +0 -1
- package/dist/extra/index.js.map +0 -1
- package/dist/extra/sources.cjs.map +0 -1
- package/dist/extra/sources.js.map +0 -1
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/patterns/ai.cjs +0 -7930
- package/dist/patterns/ai.cjs.map +0 -1
- package/dist/patterns/ai.d.cts +0 -10
- package/dist/patterns/ai.d.ts +0 -10
- package/dist/patterns/ai.js +0 -71
- package/dist/patterns/ai.js.map +0 -1
- package/dist/patterns/audit.cjs +0 -5805
- package/dist/patterns/audit.cjs.map +0 -1
- package/dist/patterns/audit.d.cts +0 -6
- package/dist/patterns/audit.d.ts +0 -6
- package/dist/patterns/audit.js +0 -29
- package/dist/patterns/audit.js.map +0 -1
- package/dist/patterns/demo-shell.cjs +0 -5604
- package/dist/patterns/demo-shell.cjs.map +0 -1
- package/dist/patterns/demo-shell.d.cts +0 -6
- package/dist/patterns/demo-shell.d.ts +0 -6
- package/dist/patterns/demo-shell.js +0 -15
- package/dist/patterns/demo-shell.js.map +0 -1
- package/dist/patterns/memory.cjs +0 -5283
- package/dist/patterns/memory.cjs.map +0 -1
- package/dist/patterns/memory.d.cts +0 -5
- package/dist/patterns/memory.d.ts +0 -5
- package/dist/patterns/memory.js +0 -20
- package/dist/patterns/memory.js.map +0 -1
- package/dist/patterns/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/storage-CMjUUuxn.d.ts +0 -190
- package/dist/storage-DdWlZo6U.d.cts +0 -190
package/dist/chunk-RNHBMHKA.js
DELETED
|
@@ -1,1665 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
reactiveMap
|
|
3
|
-
} from "./chunk-WKNUIZOY.js";
|
|
4
|
-
import {
|
|
5
|
-
forEach,
|
|
6
|
-
fromAny
|
|
7
|
-
} from "./chunk-BVZYTZ5H.js";
|
|
8
|
-
import {
|
|
9
|
-
batch,
|
|
10
|
-
derived,
|
|
11
|
-
monotonicNs,
|
|
12
|
-
node,
|
|
13
|
-
producer,
|
|
14
|
-
state
|
|
15
|
-
} from "./chunk-PHOUUNK7.js";
|
|
16
|
-
import {
|
|
17
|
-
COMPLETE,
|
|
18
|
-
DATA,
|
|
19
|
-
DIRTY,
|
|
20
|
-
ERROR,
|
|
21
|
-
RESOLVED,
|
|
22
|
-
START
|
|
23
|
-
} from "./chunk-SX52TAR4.js";
|
|
24
|
-
|
|
25
|
-
// src/extra/backoff.ts
|
|
26
|
-
var NS_PER_MS = 1e6;
|
|
27
|
-
var NS_PER_SEC = 1e9;
|
|
28
|
-
function clampNonNegative(value) {
|
|
29
|
-
return value < 0 ? 0 : value;
|
|
30
|
-
}
|
|
31
|
-
function applyJitter(delay2, jitter) {
|
|
32
|
-
if (jitter === "none") return delay2;
|
|
33
|
-
if (jitter === "full") return Math.random() * delay2;
|
|
34
|
-
return delay2 / 2 + Math.random() * (delay2 / 2);
|
|
35
|
-
}
|
|
36
|
-
function randomBetween(min, max) {
|
|
37
|
-
return min + Math.random() * (max - min);
|
|
38
|
-
}
|
|
39
|
-
function constant(delayNs) {
|
|
40
|
-
const safe = clampNonNegative(delayNs);
|
|
41
|
-
return () => safe;
|
|
42
|
-
}
|
|
43
|
-
function linear(baseNs, stepNs) {
|
|
44
|
-
const safeBase = clampNonNegative(baseNs);
|
|
45
|
-
const safeStep = stepNs === void 0 ? safeBase : clampNonNegative(stepNs);
|
|
46
|
-
return (attempt) => safeBase + safeStep * Math.max(0, attempt);
|
|
47
|
-
}
|
|
48
|
-
function exponential(options) {
|
|
49
|
-
const baseNs = clampNonNegative(options?.baseNs ?? 100 * NS_PER_MS);
|
|
50
|
-
const factor = options?.factor !== void 0 && options.factor < 1 ? 1 : options?.factor ?? 2;
|
|
51
|
-
const maxDelayNs = clampNonNegative(options?.maxDelayNs ?? 30 * NS_PER_SEC);
|
|
52
|
-
const jitter = options?.jitter ?? "none";
|
|
53
|
-
return (attempt) => {
|
|
54
|
-
let delay2;
|
|
55
|
-
if (baseNs === 0) {
|
|
56
|
-
delay2 = 0;
|
|
57
|
-
} else if (factor === 1) {
|
|
58
|
-
delay2 = baseNs;
|
|
59
|
-
} else {
|
|
60
|
-
const capRatio = maxDelayNs / baseNs;
|
|
61
|
-
let growth = 1;
|
|
62
|
-
for (let i = 0; i < Math.max(0, attempt); i++) {
|
|
63
|
-
if (growth >= capRatio) {
|
|
64
|
-
growth = capRatio;
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
growth *= factor;
|
|
68
|
-
}
|
|
69
|
-
delay2 = baseNs * growth;
|
|
70
|
-
if (delay2 > maxDelayNs) delay2 = maxDelayNs;
|
|
71
|
-
}
|
|
72
|
-
return applyJitter(delay2, jitter);
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
function fibonacci(baseNs = 100 * NS_PER_MS, maxDelayNs = 30 * NS_PER_SEC) {
|
|
76
|
-
const safeBase = clampNonNegative(baseNs);
|
|
77
|
-
const safeMax = clampNonNegative(maxDelayNs);
|
|
78
|
-
function fibUnit(attempt) {
|
|
79
|
-
if (attempt <= 0) return 1;
|
|
80
|
-
let prev = 1;
|
|
81
|
-
let cur = 2;
|
|
82
|
-
for (let i = 1; i < attempt; i++) {
|
|
83
|
-
const next = prev + cur;
|
|
84
|
-
prev = cur;
|
|
85
|
-
cur = next;
|
|
86
|
-
}
|
|
87
|
-
return cur;
|
|
88
|
-
}
|
|
89
|
-
return (attempt) => {
|
|
90
|
-
const raw = fibUnit(attempt) * safeBase;
|
|
91
|
-
return raw <= safeMax ? raw : safeMax;
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function decorrelatedJitter(baseNs = 100 * NS_PER_MS, maxNs = 30 * NS_PER_SEC) {
|
|
95
|
-
return (_attempt, _error, prevDelayNs) => {
|
|
96
|
-
const last2 = prevDelayNs ?? baseNs;
|
|
97
|
-
const ceiling = Math.min(maxNs, last2 * 3);
|
|
98
|
-
return randomBetween(baseNs, ceiling);
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
function withMaxAttempts(strategy, maxAttempts) {
|
|
102
|
-
return (attempt, error, prevDelayNs) => {
|
|
103
|
-
if (attempt >= maxAttempts) return null;
|
|
104
|
-
return strategy(attempt, error, prevDelayNs);
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function resolveBackoffPreset(name) {
|
|
108
|
-
if (name === "constant") return constant(1 * NS_PER_SEC);
|
|
109
|
-
if (name === "linear") return linear(1 * NS_PER_SEC);
|
|
110
|
-
if (name === "exponential") return exponential();
|
|
111
|
-
if (name === "fibonacci") return fibonacci();
|
|
112
|
-
if (name === "decorrelatedJitter") return decorrelatedJitter();
|
|
113
|
-
throw new Error(
|
|
114
|
-
`Unknown backoff preset: "${String(name)}". Use one of: constant, linear, exponential, fibonacci, decorrelatedJitter`
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// src/extra/operators.ts
|
|
119
|
-
function operatorOpts(opts) {
|
|
120
|
-
return { describeKind: "derived", ...opts };
|
|
121
|
-
}
|
|
122
|
-
function map(source, project, opts) {
|
|
123
|
-
return node(
|
|
124
|
-
[source],
|
|
125
|
-
(data, a) => {
|
|
126
|
-
const batch0 = data[0];
|
|
127
|
-
if (batch0 == null || batch0.length === 0) {
|
|
128
|
-
a.down([[RESOLVED]]);
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
for (const v of batch0) {
|
|
132
|
-
a.emit(project(v));
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
operatorOpts(opts)
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
function filter(source, predicate, opts) {
|
|
139
|
-
return node(
|
|
140
|
-
[source],
|
|
141
|
-
(data, a) => {
|
|
142
|
-
const batch0 = data[0];
|
|
143
|
-
if (batch0 == null || batch0.length === 0) {
|
|
144
|
-
a.down([[RESOLVED]]);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
let emitted = false;
|
|
148
|
-
for (const v of batch0) {
|
|
149
|
-
if (predicate(v)) {
|
|
150
|
-
a.emit(v);
|
|
151
|
-
emitted = true;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (!emitted) a.down([[RESOLVED]]);
|
|
155
|
-
},
|
|
156
|
-
operatorOpts(opts)
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
function scan(source, reducer, seed, opts) {
|
|
160
|
-
return node(
|
|
161
|
-
[source],
|
|
162
|
-
(data, a, ctx) => {
|
|
163
|
-
if (!("acc" in ctx.store)) ctx.store.acc = seed;
|
|
164
|
-
const batch0 = data[0];
|
|
165
|
-
if (batch0 == null || batch0.length === 0) {
|
|
166
|
-
a.down([[RESOLVED]]);
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
for (const v of batch0) {
|
|
170
|
-
ctx.store.acc = reducer(ctx.store.acc, v);
|
|
171
|
-
a.emit(ctx.store.acc);
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
{ ...operatorOpts(opts), initial: seed, resetOnTeardown: true }
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
function reduce(source, reducer, seed, opts) {
|
|
178
|
-
return node(
|
|
179
|
-
[source],
|
|
180
|
-
(data, a, ctx) => {
|
|
181
|
-
if (!("acc" in ctx.store)) ctx.store.acc = seed;
|
|
182
|
-
if (ctx.terminalDeps[0] === true) {
|
|
183
|
-
a.emit(ctx.store.acc);
|
|
184
|
-
a.down([[COMPLETE]]);
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const batch0 = data[0];
|
|
188
|
-
if (batch0 == null || batch0.length === 0) {
|
|
189
|
-
a.down([[RESOLVED]]);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
for (const v of batch0) {
|
|
193
|
-
ctx.store.acc = reducer(ctx.store.acc, v);
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
...operatorOpts(opts),
|
|
198
|
-
completeWhenDepsComplete: false
|
|
199
|
-
}
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
function take(source, count, opts) {
|
|
203
|
-
if (count <= 0) {
|
|
204
|
-
return node(
|
|
205
|
-
[source],
|
|
206
|
-
(_d, a, ctx) => {
|
|
207
|
-
if (ctx.store.completed) return;
|
|
208
|
-
ctx.store.completed = true;
|
|
209
|
-
a.down([[COMPLETE]]);
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
...operatorOpts(opts),
|
|
213
|
-
completeWhenDepsComplete: false
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
return node(
|
|
218
|
-
[source],
|
|
219
|
-
(data, a, ctx) => {
|
|
220
|
-
if (!("taken" in ctx.store)) ctx.store.taken = 0;
|
|
221
|
-
if (ctx.store.done) {
|
|
222
|
-
a.down([[RESOLVED]]);
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (ctx.terminalDeps[0] === true) {
|
|
226
|
-
ctx.store.done = true;
|
|
227
|
-
a.down([[COMPLETE]]);
|
|
228
|
-
return;
|
|
229
|
-
}
|
|
230
|
-
const batch0 = data[0];
|
|
231
|
-
if (batch0 == null || batch0.length === 0) {
|
|
232
|
-
a.down([[RESOLVED]]);
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
for (const v of batch0) {
|
|
236
|
-
ctx.store.taken++;
|
|
237
|
-
a.emit(v);
|
|
238
|
-
if (ctx.store.taken >= count) {
|
|
239
|
-
ctx.store.done = true;
|
|
240
|
-
a.down([[COMPLETE]]);
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
...operatorOpts(opts),
|
|
247
|
-
completeWhenDepsComplete: false
|
|
248
|
-
}
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
function skip(source, count, opts) {
|
|
252
|
-
return node(
|
|
253
|
-
[source],
|
|
254
|
-
(data, a, ctx) => {
|
|
255
|
-
if (!("skipped" in ctx.store)) ctx.store.skipped = 0;
|
|
256
|
-
const batch0 = data[0];
|
|
257
|
-
if (batch0 == null || batch0.length === 0) {
|
|
258
|
-
a.down([[RESOLVED]]);
|
|
259
|
-
return;
|
|
260
|
-
}
|
|
261
|
-
let emitted = false;
|
|
262
|
-
for (const v of batch0) {
|
|
263
|
-
ctx.store.skipped++;
|
|
264
|
-
if (ctx.store.skipped <= count) {
|
|
265
|
-
} else {
|
|
266
|
-
a.emit(v);
|
|
267
|
-
emitted = true;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
if (!emitted) a.down([[RESOLVED]]);
|
|
271
|
-
},
|
|
272
|
-
operatorOpts(opts)
|
|
273
|
-
);
|
|
274
|
-
}
|
|
275
|
-
function takeWhile(source, predicate, opts) {
|
|
276
|
-
return node(
|
|
277
|
-
[source],
|
|
278
|
-
(data, a, ctx) => {
|
|
279
|
-
if (ctx.store.done) {
|
|
280
|
-
a.down([[RESOLVED]]);
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
const batch0 = data[0];
|
|
284
|
-
if (batch0 == null || batch0.length === 0) {
|
|
285
|
-
a.down([[RESOLVED]]);
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
for (const v of batch0) {
|
|
289
|
-
if (!predicate(v)) {
|
|
290
|
-
ctx.store.done = true;
|
|
291
|
-
a.down([[COMPLETE]]);
|
|
292
|
-
return;
|
|
293
|
-
}
|
|
294
|
-
a.emit(v);
|
|
295
|
-
}
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
...operatorOpts(opts),
|
|
299
|
-
completeWhenDepsComplete: false
|
|
300
|
-
}
|
|
301
|
-
);
|
|
302
|
-
}
|
|
303
|
-
function takeUntil(source, notifier, opts) {
|
|
304
|
-
const pred = opts?.predicate ?? ((m) => m[0] === DATA);
|
|
305
|
-
const { predicate: _, ...restOpts } = opts ?? {};
|
|
306
|
-
return producer(
|
|
307
|
-
(a) => {
|
|
308
|
-
let stopped = false;
|
|
309
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
310
|
-
if (stopped) return;
|
|
311
|
-
for (const m of msgs) {
|
|
312
|
-
if (stopped) return;
|
|
313
|
-
if (m[0] === DATA) a.emit(m[1]);
|
|
314
|
-
else if (m[0] === COMPLETE || m[0] === ERROR) {
|
|
315
|
-
stopped = true;
|
|
316
|
-
a.down([m]);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
const notUnsub = notifier.subscribe((msgs) => {
|
|
321
|
-
if (stopped) return;
|
|
322
|
-
for (const m of msgs) {
|
|
323
|
-
if (stopped) return;
|
|
324
|
-
if (pred(m)) {
|
|
325
|
-
stopped = true;
|
|
326
|
-
a.down([[COMPLETE]]);
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
});
|
|
331
|
-
return () => {
|
|
332
|
-
srcUnsub();
|
|
333
|
-
notUnsub();
|
|
334
|
-
};
|
|
335
|
-
},
|
|
336
|
-
operatorOpts(restOpts)
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
function first(source, opts) {
|
|
340
|
-
return take(source, 1, opts);
|
|
341
|
-
}
|
|
342
|
-
function last(source, options) {
|
|
343
|
-
const { defaultValue, ...rest } = options ?? {};
|
|
344
|
-
const useDefault = options != null && Object.hasOwn(options, "defaultValue");
|
|
345
|
-
return node(
|
|
346
|
-
[source],
|
|
347
|
-
(data, a, ctx) => {
|
|
348
|
-
if (ctx.terminalDeps[0] === true) {
|
|
349
|
-
if (ctx.store.has) {
|
|
350
|
-
a.emit(ctx.store.latest);
|
|
351
|
-
} else if (useDefault) {
|
|
352
|
-
a.emit(defaultValue);
|
|
353
|
-
}
|
|
354
|
-
a.down([[COMPLETE]]);
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
const batch0 = data[0];
|
|
358
|
-
if (batch0 == null || batch0.length === 0) {
|
|
359
|
-
a.down([[RESOLVED]]);
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
ctx.store.latest = batch0.at(-1);
|
|
363
|
-
ctx.store.has = true;
|
|
364
|
-
},
|
|
365
|
-
{
|
|
366
|
-
...operatorOpts(rest),
|
|
367
|
-
completeWhenDepsComplete: false
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
function find(source, predicate, opts) {
|
|
372
|
-
return take(filter(source, predicate, opts), 1, opts);
|
|
373
|
-
}
|
|
374
|
-
function elementAt(source, index, opts) {
|
|
375
|
-
return take(skip(source, index, opts), 1, opts);
|
|
376
|
-
}
|
|
377
|
-
function tap(source, fnOrObserver, opts) {
|
|
378
|
-
if (typeof fnOrObserver === "function") {
|
|
379
|
-
return node(
|
|
380
|
-
[source],
|
|
381
|
-
(data, a) => {
|
|
382
|
-
const batch0 = data[0];
|
|
383
|
-
if (batch0 == null || batch0.length === 0) {
|
|
384
|
-
a.down([[RESOLVED]]);
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
for (const v of batch0) {
|
|
388
|
-
fnOrObserver(v);
|
|
389
|
-
a.emit(v);
|
|
390
|
-
}
|
|
391
|
-
},
|
|
392
|
-
operatorOpts(opts)
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
const obs = fnOrObserver;
|
|
396
|
-
return node(
|
|
397
|
-
[source],
|
|
398
|
-
(data, a, ctx) => {
|
|
399
|
-
if (ctx.terminalDeps[0] !== void 0) {
|
|
400
|
-
if (ctx.terminalDeps[0] === true) {
|
|
401
|
-
obs.complete?.();
|
|
402
|
-
a.down([[COMPLETE]]);
|
|
403
|
-
} else {
|
|
404
|
-
obs.error?.(ctx.terminalDeps[0]);
|
|
405
|
-
a.down([[ERROR, ctx.terminalDeps[0]]]);
|
|
406
|
-
}
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
const batch0 = data[0];
|
|
410
|
-
if (batch0 == null || batch0.length === 0) {
|
|
411
|
-
a.down([[RESOLVED]]);
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
for (const v of batch0) {
|
|
415
|
-
obs.data?.(v);
|
|
416
|
-
a.emit(v);
|
|
417
|
-
}
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
...operatorOpts(opts),
|
|
421
|
-
completeWhenDepsComplete: false
|
|
422
|
-
}
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
function distinctUntilChanged(source, equals = Object.is, opts) {
|
|
426
|
-
return node(
|
|
427
|
-
[source],
|
|
428
|
-
(data, a, ctx) => {
|
|
429
|
-
const batch0 = data[0];
|
|
430
|
-
if (batch0 == null || batch0.length === 0) {
|
|
431
|
-
a.down([[RESOLVED]]);
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
let emitted = false;
|
|
435
|
-
for (const val of batch0) {
|
|
436
|
-
if (ctx.store.hasPrev && equals(ctx.store.prev, val)) {
|
|
437
|
-
} else {
|
|
438
|
-
ctx.store.prev = val;
|
|
439
|
-
ctx.store.hasPrev = true;
|
|
440
|
-
a.emit(val);
|
|
441
|
-
emitted = true;
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
if (!emitted) a.down([[RESOLVED]]);
|
|
445
|
-
},
|
|
446
|
-
operatorOpts(opts)
|
|
447
|
-
);
|
|
448
|
-
}
|
|
449
|
-
function pairwise(source, opts) {
|
|
450
|
-
return node(
|
|
451
|
-
[source],
|
|
452
|
-
(data, a, ctx) => {
|
|
453
|
-
const batch0 = data[0];
|
|
454
|
-
if (batch0 == null || batch0.length === 0) {
|
|
455
|
-
a.down([[RESOLVED]]);
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
let emitted = false;
|
|
459
|
-
for (const x of batch0) {
|
|
460
|
-
if (!ctx.store.hasPrev) {
|
|
461
|
-
ctx.store.prev = x;
|
|
462
|
-
ctx.store.hasPrev = true;
|
|
463
|
-
} else {
|
|
464
|
-
const pair = [ctx.store.prev, x];
|
|
465
|
-
ctx.store.prev = x;
|
|
466
|
-
a.emit(pair);
|
|
467
|
-
emitted = true;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
if (!emitted) a.down([[RESOLVED]]);
|
|
471
|
-
},
|
|
472
|
-
operatorOpts(opts)
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
function combine(...sources) {
|
|
476
|
-
const deps = [...sources];
|
|
477
|
-
return derived(deps, (vals) => vals, {
|
|
478
|
-
...operatorOpts(),
|
|
479
|
-
equals: (a, b) => {
|
|
480
|
-
if (a.length !== b.length) return false;
|
|
481
|
-
for (let i = 0; i < a.length; i++) {
|
|
482
|
-
if (!Object.is(a[i], b[i])) return false;
|
|
483
|
-
}
|
|
484
|
-
return true;
|
|
485
|
-
}
|
|
486
|
-
});
|
|
487
|
-
}
|
|
488
|
-
function withLatestFrom(primary, secondary, opts) {
|
|
489
|
-
return node(
|
|
490
|
-
[primary, secondary],
|
|
491
|
-
(data, a, ctx) => {
|
|
492
|
-
const batch0 = data[0];
|
|
493
|
-
const batch1 = data[1];
|
|
494
|
-
const secondaryVal = batch1 != null && batch1.length > 0 ? batch1.at(-1) : ctx.prevData[1];
|
|
495
|
-
if (batch0 != null && batch0.length > 0) {
|
|
496
|
-
if (!(batch1 != null && batch1.length > 0) && ctx.prevData[1] === void 0) {
|
|
497
|
-
a.down([[RESOLVED]]);
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
for (const v of batch0) {
|
|
501
|
-
a.emit([v, secondaryVal]);
|
|
502
|
-
}
|
|
503
|
-
} else {
|
|
504
|
-
a.down([[RESOLVED]]);
|
|
505
|
-
}
|
|
506
|
-
},
|
|
507
|
-
operatorOpts(opts)
|
|
508
|
-
);
|
|
509
|
-
}
|
|
510
|
-
function merge(...sources) {
|
|
511
|
-
if (sources.length === 0) {
|
|
512
|
-
return producer((a) => {
|
|
513
|
-
a.down([[COMPLETE]]);
|
|
514
|
-
}, operatorOpts());
|
|
515
|
-
}
|
|
516
|
-
return producer((a) => {
|
|
517
|
-
const n = sources.length;
|
|
518
|
-
let completed = 0;
|
|
519
|
-
const unsubs = [];
|
|
520
|
-
for (const src of sources) {
|
|
521
|
-
const u = src.subscribe((msgs) => {
|
|
522
|
-
for (const m of msgs) {
|
|
523
|
-
if (m[0] === DATA) {
|
|
524
|
-
a.emit(m[1]);
|
|
525
|
-
} else if (m[0] === COMPLETE) {
|
|
526
|
-
completed += 1;
|
|
527
|
-
if (completed >= n) {
|
|
528
|
-
a.down([[COMPLETE]]);
|
|
529
|
-
}
|
|
530
|
-
} else if (m[0] === ERROR) {
|
|
531
|
-
a.down([m]);
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
unsubs.push(u);
|
|
536
|
-
}
|
|
537
|
-
return () => {
|
|
538
|
-
for (const u of unsubs) u();
|
|
539
|
-
};
|
|
540
|
-
}, operatorOpts());
|
|
541
|
-
}
|
|
542
|
-
function zip(...sources) {
|
|
543
|
-
const n = sources.length;
|
|
544
|
-
if (n === 0) {
|
|
545
|
-
return producer((a) => {
|
|
546
|
-
a.emit([]);
|
|
547
|
-
a.down([[COMPLETE]]);
|
|
548
|
-
}, operatorOpts());
|
|
549
|
-
}
|
|
550
|
-
return producer((a) => {
|
|
551
|
-
const queues = Array.from({ length: n }, () => []);
|
|
552
|
-
let active = n;
|
|
553
|
-
function tryEmit() {
|
|
554
|
-
while (queues.every((q) => q.length > 0)) {
|
|
555
|
-
const tuple = queues.map((q) => q.shift());
|
|
556
|
-
a.emit(tuple);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
const unsubs = [];
|
|
560
|
-
for (let i = 0; i < n; i++) {
|
|
561
|
-
const idx = i;
|
|
562
|
-
const u = sources[i].subscribe((msgs) => {
|
|
563
|
-
for (const m of msgs) {
|
|
564
|
-
if (m[0] === DATA) {
|
|
565
|
-
queues[idx].push(m[1]);
|
|
566
|
-
tryEmit();
|
|
567
|
-
} else if (m[0] === COMPLETE) {
|
|
568
|
-
active -= 1;
|
|
569
|
-
if (active === 0 || queues[idx].length === 0) {
|
|
570
|
-
a.down([[COMPLETE]]);
|
|
571
|
-
}
|
|
572
|
-
} else if (m[0] === ERROR) {
|
|
573
|
-
a.down([m]);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
});
|
|
577
|
-
unsubs.push(u);
|
|
578
|
-
}
|
|
579
|
-
return () => {
|
|
580
|
-
for (const u of unsubs) u();
|
|
581
|
-
};
|
|
582
|
-
}, operatorOpts());
|
|
583
|
-
}
|
|
584
|
-
function concat(firstSrc, secondSrc, opts) {
|
|
585
|
-
return producer((a) => {
|
|
586
|
-
let phase = 0;
|
|
587
|
-
const pending = [];
|
|
588
|
-
let firstUnsub;
|
|
589
|
-
let secondUnsub;
|
|
590
|
-
secondUnsub = secondSrc.subscribe((msgs) => {
|
|
591
|
-
for (const m of msgs) {
|
|
592
|
-
if (phase === 0) {
|
|
593
|
-
if (m[0] === DATA) pending.push(m[1]);
|
|
594
|
-
else if (m[0] === ERROR) a.down([m]);
|
|
595
|
-
} else {
|
|
596
|
-
if (m[0] === DATA) a.emit(m[1]);
|
|
597
|
-
else if (m[0] === COMPLETE || m[0] === ERROR) a.down([m]);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
});
|
|
601
|
-
firstUnsub = firstSrc.subscribe((msgs) => {
|
|
602
|
-
for (const m of msgs) {
|
|
603
|
-
if (phase === 0) {
|
|
604
|
-
if (m[0] === DATA) {
|
|
605
|
-
a.emit(m[1]);
|
|
606
|
-
} else if (m[0] === COMPLETE) {
|
|
607
|
-
phase = 1;
|
|
608
|
-
for (const v of pending) {
|
|
609
|
-
a.emit(v);
|
|
610
|
-
}
|
|
611
|
-
pending.length = 0;
|
|
612
|
-
} else if (m[0] === ERROR) {
|
|
613
|
-
a.down([m]);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
return () => {
|
|
619
|
-
firstUnsub?.();
|
|
620
|
-
secondUnsub?.();
|
|
621
|
-
};
|
|
622
|
-
}, operatorOpts(opts));
|
|
623
|
-
}
|
|
624
|
-
function race(...sources) {
|
|
625
|
-
if (sources.length === 0) {
|
|
626
|
-
return producer((a) => {
|
|
627
|
-
a.down([[COMPLETE]]);
|
|
628
|
-
}, operatorOpts());
|
|
629
|
-
}
|
|
630
|
-
if (sources.length === 1) {
|
|
631
|
-
return node(
|
|
632
|
-
[sources[0]],
|
|
633
|
-
(data, a) => {
|
|
634
|
-
const batch0 = data[0];
|
|
635
|
-
if (batch0 == null || batch0.length === 0) {
|
|
636
|
-
a.down([[RESOLVED]]);
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
for (const v of batch0) a.emit(v);
|
|
640
|
-
},
|
|
641
|
-
operatorOpts()
|
|
642
|
-
);
|
|
643
|
-
}
|
|
644
|
-
return producer((a) => {
|
|
645
|
-
let winner = null;
|
|
646
|
-
const unsubs = [];
|
|
647
|
-
for (let i = 0; i < sources.length; i++) {
|
|
648
|
-
const idx = i;
|
|
649
|
-
const u = sources[i].subscribe((msgs) => {
|
|
650
|
-
for (const m of msgs) {
|
|
651
|
-
if (winner !== null && idx !== winner) return;
|
|
652
|
-
if (m[0] === DATA) {
|
|
653
|
-
if (winner === null) winner = idx;
|
|
654
|
-
a.emit(m[1]);
|
|
655
|
-
} else if (m[0] === COMPLETE || m[0] === ERROR) {
|
|
656
|
-
if (winner === null || idx === winner) {
|
|
657
|
-
a.down([m]);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
unsubs.push(u);
|
|
663
|
-
}
|
|
664
|
-
return () => {
|
|
665
|
-
for (const u of unsubs) u();
|
|
666
|
-
};
|
|
667
|
-
}, operatorOpts());
|
|
668
|
-
}
|
|
669
|
-
function forwardInner(inner, a, onInnerComplete) {
|
|
670
|
-
let unsub;
|
|
671
|
-
let finished = false;
|
|
672
|
-
const finish = () => {
|
|
673
|
-
if (finished) return;
|
|
674
|
-
finished = true;
|
|
675
|
-
onInnerComplete();
|
|
676
|
-
};
|
|
677
|
-
unsub = inner.subscribe((msgs) => {
|
|
678
|
-
let sawComplete = false;
|
|
679
|
-
let sawError = false;
|
|
680
|
-
for (const m of msgs) {
|
|
681
|
-
if (m[0] === START) continue;
|
|
682
|
-
if (m[0] === DATA) {
|
|
683
|
-
a.emit(m[1]);
|
|
684
|
-
} else if (m[0] === COMPLETE) {
|
|
685
|
-
sawComplete = true;
|
|
686
|
-
} else if (m[0] === ERROR) {
|
|
687
|
-
sawError = true;
|
|
688
|
-
a.down([m]);
|
|
689
|
-
} else if (m[0] === DIRTY || m[0] === RESOLVED) {
|
|
690
|
-
a.down([m]);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
if (sawError) {
|
|
694
|
-
unsub?.();
|
|
695
|
-
unsub = void 0;
|
|
696
|
-
finish();
|
|
697
|
-
} else if (sawComplete) {
|
|
698
|
-
finish();
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
return () => {
|
|
702
|
-
unsub?.();
|
|
703
|
-
unsub = void 0;
|
|
704
|
-
};
|
|
705
|
-
}
|
|
706
|
-
function switchMap(source, project, opts) {
|
|
707
|
-
let innerUnsub;
|
|
708
|
-
let sourceDone = false;
|
|
709
|
-
function clearInner() {
|
|
710
|
-
innerUnsub?.();
|
|
711
|
-
innerUnsub = void 0;
|
|
712
|
-
}
|
|
713
|
-
return node(
|
|
714
|
-
[source],
|
|
715
|
-
(data, a, ctx) => {
|
|
716
|
-
if (ctx.terminalDeps[0] != null && ctx.terminalDeps[0] !== true) {
|
|
717
|
-
clearInner();
|
|
718
|
-
return;
|
|
719
|
-
}
|
|
720
|
-
if (ctx.terminalDeps[0] === true) {
|
|
721
|
-
sourceDone = true;
|
|
722
|
-
if (!innerUnsub) a.down([[COMPLETE]]);
|
|
723
|
-
return;
|
|
724
|
-
}
|
|
725
|
-
const batch0 = data[0];
|
|
726
|
-
if (batch0 == null || batch0.length === 0) return;
|
|
727
|
-
clearInner();
|
|
728
|
-
innerUnsub = forwardInner(fromAny(project(batch0[batch0.length - 1])), a, () => {
|
|
729
|
-
clearInner();
|
|
730
|
-
if (sourceDone) a.down([[COMPLETE]]);
|
|
731
|
-
});
|
|
732
|
-
return {
|
|
733
|
-
deactivation: () => {
|
|
734
|
-
clearInner();
|
|
735
|
-
sourceDone = false;
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
},
|
|
739
|
-
{ ...operatorOpts(opts), completeWhenDepsComplete: false }
|
|
740
|
-
);
|
|
741
|
-
}
|
|
742
|
-
function exhaustMap(source, project, opts) {
|
|
743
|
-
let innerUnsub;
|
|
744
|
-
let sourceDone = false;
|
|
745
|
-
function clearInner() {
|
|
746
|
-
innerUnsub?.();
|
|
747
|
-
innerUnsub = void 0;
|
|
748
|
-
}
|
|
749
|
-
return node(
|
|
750
|
-
[source],
|
|
751
|
-
(data, a, ctx) => {
|
|
752
|
-
if (ctx.terminalDeps[0] != null && ctx.terminalDeps[0] !== true) {
|
|
753
|
-
clearInner();
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
if (ctx.terminalDeps[0] === true) {
|
|
757
|
-
sourceDone = true;
|
|
758
|
-
if (!innerUnsub) a.down([[COMPLETE]]);
|
|
759
|
-
return;
|
|
760
|
-
}
|
|
761
|
-
const batch0 = data[0];
|
|
762
|
-
if (batch0 == null || batch0.length === 0) return;
|
|
763
|
-
if (innerUnsub === void 0) {
|
|
764
|
-
innerUnsub = forwardInner(fromAny(project(batch0[0])), a, () => {
|
|
765
|
-
clearInner();
|
|
766
|
-
if (sourceDone) a.down([[COMPLETE]]);
|
|
767
|
-
});
|
|
768
|
-
} else {
|
|
769
|
-
a.down([[RESOLVED]]);
|
|
770
|
-
}
|
|
771
|
-
return {
|
|
772
|
-
deactivation: () => {
|
|
773
|
-
clearInner();
|
|
774
|
-
sourceDone = false;
|
|
775
|
-
}
|
|
776
|
-
};
|
|
777
|
-
},
|
|
778
|
-
{ ...operatorOpts(opts), completeWhenDepsComplete: false }
|
|
779
|
-
);
|
|
780
|
-
}
|
|
781
|
-
function concatMap(source, project, opts) {
|
|
782
|
-
const { maxBuffer: maxBuf, ...concatNodeOpts } = opts ?? {};
|
|
783
|
-
const queue = [];
|
|
784
|
-
let innerUnsub;
|
|
785
|
-
let sourceDone = false;
|
|
786
|
-
let actions;
|
|
787
|
-
function clearInner() {
|
|
788
|
-
innerUnsub?.();
|
|
789
|
-
innerUnsub = void 0;
|
|
790
|
-
}
|
|
791
|
-
function tryPump() {
|
|
792
|
-
if (!actions || innerUnsub !== void 0) return;
|
|
793
|
-
if (queue.length === 0) {
|
|
794
|
-
if (sourceDone) actions.down([[COMPLETE]]);
|
|
795
|
-
return;
|
|
796
|
-
}
|
|
797
|
-
const v = queue.shift();
|
|
798
|
-
innerUnsub = forwardInner(fromAny(project(v)), actions, () => {
|
|
799
|
-
clearInner();
|
|
800
|
-
tryPump();
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
function enqueue(v) {
|
|
804
|
-
if (maxBuf && maxBuf > 0 && queue.length >= maxBuf) queue.shift();
|
|
805
|
-
queue.push(v);
|
|
806
|
-
tryPump();
|
|
807
|
-
}
|
|
808
|
-
return node(
|
|
809
|
-
[source],
|
|
810
|
-
(data, a, ctx) => {
|
|
811
|
-
actions = a;
|
|
812
|
-
if (ctx.terminalDeps[0] != null && ctx.terminalDeps[0] !== true) {
|
|
813
|
-
clearInner();
|
|
814
|
-
queue.length = 0;
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
if (ctx.terminalDeps[0] === true) {
|
|
818
|
-
sourceDone = true;
|
|
819
|
-
tryPump();
|
|
820
|
-
return;
|
|
821
|
-
}
|
|
822
|
-
const batch0 = data[0];
|
|
823
|
-
if (batch0 == null || batch0.length === 0) return;
|
|
824
|
-
for (const v of batch0) {
|
|
825
|
-
enqueue(v);
|
|
826
|
-
}
|
|
827
|
-
return {
|
|
828
|
-
deactivation: () => {
|
|
829
|
-
clearInner();
|
|
830
|
-
queue.length = 0;
|
|
831
|
-
sourceDone = false;
|
|
832
|
-
}
|
|
833
|
-
};
|
|
834
|
-
},
|
|
835
|
-
{ ...operatorOpts(concatNodeOpts), completeWhenDepsComplete: false }
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
function mergeMap(source, project, opts) {
|
|
839
|
-
const { concurrent: concurrentOpt, ...mergeNodeOpts } = opts ?? {};
|
|
840
|
-
const maxConcurrent = concurrentOpt != null && concurrentOpt > 0 ? concurrentOpt : Number.POSITIVE_INFINITY;
|
|
841
|
-
let active = 0;
|
|
842
|
-
let sourceDone = false;
|
|
843
|
-
const innerStops = /* @__PURE__ */ new Set();
|
|
844
|
-
const buffer2 = [];
|
|
845
|
-
let actions;
|
|
846
|
-
function tryComplete() {
|
|
847
|
-
if (sourceDone && active === 0 && buffer2.length === 0 && actions) {
|
|
848
|
-
actions.down([[COMPLETE]]);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
function spawn(v) {
|
|
852
|
-
if (!actions) return;
|
|
853
|
-
active++;
|
|
854
|
-
let stop;
|
|
855
|
-
stop = forwardInner(fromAny(project(v)), actions, () => {
|
|
856
|
-
if (stop) innerStops.delete(stop);
|
|
857
|
-
active--;
|
|
858
|
-
drainBuffer();
|
|
859
|
-
tryComplete();
|
|
860
|
-
});
|
|
861
|
-
innerStops.add(stop);
|
|
862
|
-
}
|
|
863
|
-
function drainBuffer() {
|
|
864
|
-
while (buffer2.length > 0 && active < maxConcurrent) {
|
|
865
|
-
spawn(buffer2.shift());
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
function enqueue(v) {
|
|
869
|
-
if (active < maxConcurrent) spawn(v);
|
|
870
|
-
else buffer2.push(v);
|
|
871
|
-
}
|
|
872
|
-
function clearAll() {
|
|
873
|
-
for (const u of innerStops) u();
|
|
874
|
-
innerStops.clear();
|
|
875
|
-
active = 0;
|
|
876
|
-
buffer2.length = 0;
|
|
877
|
-
}
|
|
878
|
-
return node(
|
|
879
|
-
[source],
|
|
880
|
-
(data, a, ctx) => {
|
|
881
|
-
actions = a;
|
|
882
|
-
if (ctx.terminalDeps[0] != null && ctx.terminalDeps[0] !== true) {
|
|
883
|
-
clearAll();
|
|
884
|
-
return;
|
|
885
|
-
}
|
|
886
|
-
if (ctx.terminalDeps[0] === true) {
|
|
887
|
-
sourceDone = true;
|
|
888
|
-
tryComplete();
|
|
889
|
-
return;
|
|
890
|
-
}
|
|
891
|
-
const batch0 = data[0];
|
|
892
|
-
if (batch0 == null || batch0.length === 0) return;
|
|
893
|
-
for (const v of batch0) {
|
|
894
|
-
enqueue(v);
|
|
895
|
-
}
|
|
896
|
-
return {
|
|
897
|
-
deactivation: () => {
|
|
898
|
-
clearAll();
|
|
899
|
-
sourceDone = false;
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
},
|
|
903
|
-
{ ...operatorOpts(mergeNodeOpts), completeWhenDepsComplete: false }
|
|
904
|
-
);
|
|
905
|
-
}
|
|
906
|
-
var flatMap = mergeMap;
|
|
907
|
-
function delay(source, ms, opts) {
|
|
908
|
-
return producer((a) => {
|
|
909
|
-
const timers = /* @__PURE__ */ new Set();
|
|
910
|
-
function clearAll() {
|
|
911
|
-
for (const id of timers) clearTimeout(id);
|
|
912
|
-
timers.clear();
|
|
913
|
-
}
|
|
914
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
915
|
-
for (const m of msgs) {
|
|
916
|
-
if (m[0] === DATA) {
|
|
917
|
-
const id = setTimeout(() => {
|
|
918
|
-
timers.delete(id);
|
|
919
|
-
a.emit(m[1]);
|
|
920
|
-
}, ms);
|
|
921
|
-
timers.add(id);
|
|
922
|
-
} else if (m[0] === COMPLETE) {
|
|
923
|
-
const id = setTimeout(() => {
|
|
924
|
-
timers.delete(id);
|
|
925
|
-
a.down([[COMPLETE]]);
|
|
926
|
-
}, ms);
|
|
927
|
-
timers.add(id);
|
|
928
|
-
} else if (m[0] === ERROR) {
|
|
929
|
-
clearAll();
|
|
930
|
-
a.down([m]);
|
|
931
|
-
}
|
|
932
|
-
}
|
|
933
|
-
});
|
|
934
|
-
return () => {
|
|
935
|
-
srcUnsub();
|
|
936
|
-
clearAll();
|
|
937
|
-
};
|
|
938
|
-
}, operatorOpts(opts));
|
|
939
|
-
}
|
|
940
|
-
function debounce(source, ms, opts) {
|
|
941
|
-
return producer((a) => {
|
|
942
|
-
let timer;
|
|
943
|
-
let pending;
|
|
944
|
-
function clearTimer() {
|
|
945
|
-
if (timer !== void 0) {
|
|
946
|
-
clearTimeout(timer);
|
|
947
|
-
timer = void 0;
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
951
|
-
for (const m of msgs) {
|
|
952
|
-
if (m[0] === DATA) {
|
|
953
|
-
clearTimer();
|
|
954
|
-
pending = m[1];
|
|
955
|
-
timer = setTimeout(() => {
|
|
956
|
-
timer = void 0;
|
|
957
|
-
a.emit(pending);
|
|
958
|
-
}, ms);
|
|
959
|
-
} else if (m[0] === COMPLETE) {
|
|
960
|
-
if (timer !== void 0) {
|
|
961
|
-
clearTimer();
|
|
962
|
-
a.emit(pending);
|
|
963
|
-
}
|
|
964
|
-
a.down([[COMPLETE]]);
|
|
965
|
-
} else if (m[0] === ERROR) {
|
|
966
|
-
clearTimer();
|
|
967
|
-
a.down([m]);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
});
|
|
971
|
-
return () => {
|
|
972
|
-
srcUnsub();
|
|
973
|
-
clearTimer();
|
|
974
|
-
};
|
|
975
|
-
}, operatorOpts(opts));
|
|
976
|
-
}
|
|
977
|
-
function throttle(source, ms, opts) {
|
|
978
|
-
const { leading: leadingOpt, trailing: trailingOpt, ...throttleNodeOpts } = opts ?? {};
|
|
979
|
-
const leading = leadingOpt !== false;
|
|
980
|
-
const trailing = trailingOpt === true;
|
|
981
|
-
const windowNs = ms * NS_PER_MS;
|
|
982
|
-
return producer((a) => {
|
|
983
|
-
let timer;
|
|
984
|
-
let lastEmitNs = -Infinity;
|
|
985
|
-
let pending;
|
|
986
|
-
let hasPending = false;
|
|
987
|
-
function clearTimer() {
|
|
988
|
-
if (timer !== void 0) {
|
|
989
|
-
clearTimeout(timer);
|
|
990
|
-
timer = void 0;
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
994
|
-
for (const m of msgs) {
|
|
995
|
-
if (m[0] === DATA) {
|
|
996
|
-
const v = m[1];
|
|
997
|
-
const nowNs = monotonicNs();
|
|
998
|
-
if (leading && nowNs - lastEmitNs >= windowNs) {
|
|
999
|
-
lastEmitNs = nowNs;
|
|
1000
|
-
a.emit(v);
|
|
1001
|
-
clearTimer();
|
|
1002
|
-
if (trailing) {
|
|
1003
|
-
timer = setTimeout(() => {
|
|
1004
|
-
timer = void 0;
|
|
1005
|
-
if (hasPending) {
|
|
1006
|
-
lastEmitNs = monotonicNs();
|
|
1007
|
-
a.emit(pending);
|
|
1008
|
-
hasPending = false;
|
|
1009
|
-
}
|
|
1010
|
-
}, ms);
|
|
1011
|
-
}
|
|
1012
|
-
} else if (trailing) {
|
|
1013
|
-
pending = v;
|
|
1014
|
-
hasPending = true;
|
|
1015
|
-
if (timer === void 0) {
|
|
1016
|
-
const elapsedMs = (nowNs - lastEmitNs) / NS_PER_MS;
|
|
1017
|
-
timer = setTimeout(
|
|
1018
|
-
() => {
|
|
1019
|
-
timer = void 0;
|
|
1020
|
-
if (hasPending) {
|
|
1021
|
-
lastEmitNs = monotonicNs();
|
|
1022
|
-
a.emit(pending);
|
|
1023
|
-
hasPending = false;
|
|
1024
|
-
}
|
|
1025
|
-
},
|
|
1026
|
-
Math.max(0, ms - elapsedMs)
|
|
1027
|
-
);
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
} else if (m[0] === COMPLETE || m[0] === ERROR) {
|
|
1031
|
-
clearTimer();
|
|
1032
|
-
a.down([m]);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
});
|
|
1036
|
-
return () => {
|
|
1037
|
-
srcUnsub();
|
|
1038
|
-
clearTimer();
|
|
1039
|
-
};
|
|
1040
|
-
}, operatorOpts(throttleNodeOpts));
|
|
1041
|
-
}
|
|
1042
|
-
function sample(source, notifier, opts) {
|
|
1043
|
-
return producer((a) => {
|
|
1044
|
-
let lastSourceValue;
|
|
1045
|
-
let terminated = false;
|
|
1046
|
-
let sourceCompleted = false;
|
|
1047
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1048
|
-
if (terminated) return;
|
|
1049
|
-
for (const m of msgs) {
|
|
1050
|
-
if (terminated) return;
|
|
1051
|
-
if (m[0] === DATA) {
|
|
1052
|
-
lastSourceValue = { v: m[1] };
|
|
1053
|
-
} else if (m[0] === ERROR) {
|
|
1054
|
-
terminated = true;
|
|
1055
|
-
a.down([m]);
|
|
1056
|
-
} else if (m[0] === COMPLETE) {
|
|
1057
|
-
sourceCompleted = true;
|
|
1058
|
-
lastSourceValue = void 0;
|
|
1059
|
-
}
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1062
|
-
const notUnsub = notifier.subscribe((msgs) => {
|
|
1063
|
-
if (terminated) return;
|
|
1064
|
-
for (const m of msgs) {
|
|
1065
|
-
if (terminated) return;
|
|
1066
|
-
if (m[0] === DATA) {
|
|
1067
|
-
if (lastSourceValue !== void 0 && !sourceCompleted) {
|
|
1068
|
-
a.emit(lastSourceValue.v);
|
|
1069
|
-
}
|
|
1070
|
-
} else if (m[0] === ERROR) {
|
|
1071
|
-
terminated = true;
|
|
1072
|
-
a.down([m]);
|
|
1073
|
-
} else if (m[0] === COMPLETE) {
|
|
1074
|
-
terminated = true;
|
|
1075
|
-
a.down([[COMPLETE]]);
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
});
|
|
1079
|
-
return () => {
|
|
1080
|
-
srcUnsub();
|
|
1081
|
-
notUnsub();
|
|
1082
|
-
};
|
|
1083
|
-
}, operatorOpts(opts));
|
|
1084
|
-
}
|
|
1085
|
-
function audit(source, ms, opts) {
|
|
1086
|
-
return producer((a) => {
|
|
1087
|
-
let timer;
|
|
1088
|
-
let latest;
|
|
1089
|
-
let has = false;
|
|
1090
|
-
function clearTimer() {
|
|
1091
|
-
if (timer !== void 0) {
|
|
1092
|
-
clearTimeout(timer);
|
|
1093
|
-
timer = void 0;
|
|
1094
|
-
}
|
|
1095
|
-
}
|
|
1096
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1097
|
-
for (const m of msgs) {
|
|
1098
|
-
if (m[0] === DATA) {
|
|
1099
|
-
latest = m[1];
|
|
1100
|
-
has = true;
|
|
1101
|
-
clearTimer();
|
|
1102
|
-
timer = setTimeout(() => {
|
|
1103
|
-
timer = void 0;
|
|
1104
|
-
if (has) {
|
|
1105
|
-
has = false;
|
|
1106
|
-
a.emit(latest);
|
|
1107
|
-
}
|
|
1108
|
-
}, ms);
|
|
1109
|
-
} else if (m[0] === COMPLETE || m[0] === ERROR) {
|
|
1110
|
-
clearTimer();
|
|
1111
|
-
a.down([m]);
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
});
|
|
1115
|
-
return () => {
|
|
1116
|
-
srcUnsub();
|
|
1117
|
-
clearTimer();
|
|
1118
|
-
};
|
|
1119
|
-
}, operatorOpts(opts));
|
|
1120
|
-
}
|
|
1121
|
-
function buffer(source, notifier, opts) {
|
|
1122
|
-
return producer((a) => {
|
|
1123
|
-
const buf = [];
|
|
1124
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1125
|
-
for (const m of msgs) {
|
|
1126
|
-
if (m[0] === DATA) {
|
|
1127
|
-
buf.push(m[1]);
|
|
1128
|
-
} else if (m[0] === COMPLETE) {
|
|
1129
|
-
if (buf.length > 0) a.emit([...buf]);
|
|
1130
|
-
buf.length = 0;
|
|
1131
|
-
a.down([[COMPLETE]]);
|
|
1132
|
-
} else if (m[0] === ERROR) {
|
|
1133
|
-
a.down([m]);
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
});
|
|
1137
|
-
const notUnsub = notifier.subscribe((msgs) => {
|
|
1138
|
-
for (const m of msgs) {
|
|
1139
|
-
if (m[0] === DATA) {
|
|
1140
|
-
if (buf.length > 0) {
|
|
1141
|
-
a.emit([...buf]);
|
|
1142
|
-
buf.length = 0;
|
|
1143
|
-
}
|
|
1144
|
-
} else if (m[0] === COMPLETE) {
|
|
1145
|
-
a.down([[COMPLETE]]);
|
|
1146
|
-
} else if (m[0] === ERROR) {
|
|
1147
|
-
a.down([m]);
|
|
1148
|
-
}
|
|
1149
|
-
}
|
|
1150
|
-
});
|
|
1151
|
-
return () => {
|
|
1152
|
-
srcUnsub();
|
|
1153
|
-
notUnsub();
|
|
1154
|
-
buf.length = 0;
|
|
1155
|
-
};
|
|
1156
|
-
}, operatorOpts(opts));
|
|
1157
|
-
}
|
|
1158
|
-
function bufferCount(source, count, opts) {
|
|
1159
|
-
if (count <= 0) throw new RangeError("bufferCount expects count > 0");
|
|
1160
|
-
return producer((a) => {
|
|
1161
|
-
const buf = [];
|
|
1162
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1163
|
-
for (const m of msgs) {
|
|
1164
|
-
if (m[0] === DATA) {
|
|
1165
|
-
buf.push(m[1]);
|
|
1166
|
-
if (buf.length >= count) {
|
|
1167
|
-
a.emit(buf.splice(0, buf.length));
|
|
1168
|
-
}
|
|
1169
|
-
} else if (m[0] === COMPLETE) {
|
|
1170
|
-
if (buf.length > 0) a.emit([...buf]);
|
|
1171
|
-
buf.length = 0;
|
|
1172
|
-
a.down([[COMPLETE]]);
|
|
1173
|
-
} else if (m[0] === ERROR) {
|
|
1174
|
-
a.down([m]);
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
});
|
|
1178
|
-
return () => {
|
|
1179
|
-
srcUnsub();
|
|
1180
|
-
buf.length = 0;
|
|
1181
|
-
};
|
|
1182
|
-
}, operatorOpts(opts));
|
|
1183
|
-
}
|
|
1184
|
-
function windowCount(source, count, opts) {
|
|
1185
|
-
if (count <= 0) throw new RangeError("windowCount expects count > 0");
|
|
1186
|
-
return producer((a) => {
|
|
1187
|
-
let winDown;
|
|
1188
|
-
let n = 0;
|
|
1189
|
-
function openWindow() {
|
|
1190
|
-
const s = producer((actions) => {
|
|
1191
|
-
winDown = actions.down.bind(actions);
|
|
1192
|
-
return () => {
|
|
1193
|
-
winDown = void 0;
|
|
1194
|
-
};
|
|
1195
|
-
}, operatorOpts());
|
|
1196
|
-
n = 0;
|
|
1197
|
-
a.emit(s);
|
|
1198
|
-
}
|
|
1199
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1200
|
-
for (const m of msgs) {
|
|
1201
|
-
if (m[0] === DATA) {
|
|
1202
|
-
if (!winDown) openWindow();
|
|
1203
|
-
winDown?.([[DATA, m[1]]]);
|
|
1204
|
-
n += 1;
|
|
1205
|
-
if (n >= count) {
|
|
1206
|
-
winDown?.([[COMPLETE]]);
|
|
1207
|
-
winDown = void 0;
|
|
1208
|
-
}
|
|
1209
|
-
} else if (m[0] === COMPLETE) {
|
|
1210
|
-
winDown?.([[COMPLETE]]);
|
|
1211
|
-
winDown = void 0;
|
|
1212
|
-
a.down([[COMPLETE]]);
|
|
1213
|
-
} else if (m[0] === ERROR) {
|
|
1214
|
-
winDown?.([m]);
|
|
1215
|
-
winDown = void 0;
|
|
1216
|
-
a.down([m]);
|
|
1217
|
-
}
|
|
1218
|
-
}
|
|
1219
|
-
});
|
|
1220
|
-
return () => {
|
|
1221
|
-
srcUnsub();
|
|
1222
|
-
winDown?.([[COMPLETE]]);
|
|
1223
|
-
winDown = void 0;
|
|
1224
|
-
};
|
|
1225
|
-
}, operatorOpts(opts));
|
|
1226
|
-
}
|
|
1227
|
-
function bufferTime(source, ms, opts) {
|
|
1228
|
-
return producer((a) => {
|
|
1229
|
-
const buf = [];
|
|
1230
|
-
const iv = setInterval(() => {
|
|
1231
|
-
if (buf.length > 0) {
|
|
1232
|
-
a.emit([...buf]);
|
|
1233
|
-
buf.length = 0;
|
|
1234
|
-
}
|
|
1235
|
-
}, ms);
|
|
1236
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1237
|
-
for (const m of msgs) {
|
|
1238
|
-
if (m[0] === DATA) {
|
|
1239
|
-
buf.push(m[1]);
|
|
1240
|
-
} else if (m[0] === COMPLETE) {
|
|
1241
|
-
clearInterval(iv);
|
|
1242
|
-
if (buf.length > 0) a.emit([...buf]);
|
|
1243
|
-
buf.length = 0;
|
|
1244
|
-
a.down([[COMPLETE]]);
|
|
1245
|
-
} else if (m[0] === ERROR) {
|
|
1246
|
-
clearInterval(iv);
|
|
1247
|
-
a.down([m]);
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
});
|
|
1251
|
-
return () => {
|
|
1252
|
-
srcUnsub();
|
|
1253
|
-
clearInterval(iv);
|
|
1254
|
-
buf.length = 0;
|
|
1255
|
-
};
|
|
1256
|
-
}, operatorOpts(opts));
|
|
1257
|
-
}
|
|
1258
|
-
function windowTime(source, ms, opts) {
|
|
1259
|
-
return producer((a) => {
|
|
1260
|
-
let winDown;
|
|
1261
|
-
function closeWindow() {
|
|
1262
|
-
winDown?.([[COMPLETE]]);
|
|
1263
|
-
winDown = void 0;
|
|
1264
|
-
}
|
|
1265
|
-
function openWindow() {
|
|
1266
|
-
const s = producer((actions) => {
|
|
1267
|
-
winDown = actions.down.bind(actions);
|
|
1268
|
-
return () => {
|
|
1269
|
-
winDown = void 0;
|
|
1270
|
-
};
|
|
1271
|
-
}, operatorOpts());
|
|
1272
|
-
a.emit(s);
|
|
1273
|
-
}
|
|
1274
|
-
openWindow();
|
|
1275
|
-
const iv = setInterval(() => {
|
|
1276
|
-
closeWindow();
|
|
1277
|
-
openWindow();
|
|
1278
|
-
}, ms);
|
|
1279
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1280
|
-
for (const m of msgs) {
|
|
1281
|
-
if (m[0] === DATA) {
|
|
1282
|
-
winDown?.([[DATA, m[1]]]);
|
|
1283
|
-
} else if (m[0] === COMPLETE) {
|
|
1284
|
-
clearInterval(iv);
|
|
1285
|
-
closeWindow();
|
|
1286
|
-
a.down([[COMPLETE]]);
|
|
1287
|
-
} else if (m[0] === ERROR) {
|
|
1288
|
-
clearInterval(iv);
|
|
1289
|
-
winDown?.([m]);
|
|
1290
|
-
closeWindow();
|
|
1291
|
-
a.down([m]);
|
|
1292
|
-
}
|
|
1293
|
-
}
|
|
1294
|
-
});
|
|
1295
|
-
return () => {
|
|
1296
|
-
srcUnsub();
|
|
1297
|
-
clearInterval(iv);
|
|
1298
|
-
closeWindow();
|
|
1299
|
-
};
|
|
1300
|
-
}, operatorOpts(opts));
|
|
1301
|
-
}
|
|
1302
|
-
function window(source, notifier, opts) {
|
|
1303
|
-
return producer((a) => {
|
|
1304
|
-
let winDown;
|
|
1305
|
-
function closeWindow() {
|
|
1306
|
-
winDown?.([[COMPLETE]]);
|
|
1307
|
-
winDown = void 0;
|
|
1308
|
-
}
|
|
1309
|
-
function openWindow() {
|
|
1310
|
-
const s = producer((actions) => {
|
|
1311
|
-
winDown = actions.down.bind(actions);
|
|
1312
|
-
return () => {
|
|
1313
|
-
winDown = void 0;
|
|
1314
|
-
};
|
|
1315
|
-
}, operatorOpts());
|
|
1316
|
-
a.emit(s);
|
|
1317
|
-
}
|
|
1318
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1319
|
-
for (const m of msgs) {
|
|
1320
|
-
if (m[0] === DATA) {
|
|
1321
|
-
if (!winDown) openWindow();
|
|
1322
|
-
winDown?.([[DATA, m[1]]]);
|
|
1323
|
-
} else if (m[0] === COMPLETE) {
|
|
1324
|
-
closeWindow();
|
|
1325
|
-
a.down([[COMPLETE]]);
|
|
1326
|
-
} else if (m[0] === ERROR) {
|
|
1327
|
-
winDown?.([m]);
|
|
1328
|
-
winDown = void 0;
|
|
1329
|
-
a.down([m]);
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
});
|
|
1333
|
-
const notUnsub = notifier.subscribe((msgs) => {
|
|
1334
|
-
for (const m of msgs) {
|
|
1335
|
-
if (m[0] === DATA) {
|
|
1336
|
-
closeWindow();
|
|
1337
|
-
openWindow();
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
});
|
|
1341
|
-
return () => {
|
|
1342
|
-
srcUnsub();
|
|
1343
|
-
notUnsub();
|
|
1344
|
-
closeWindow();
|
|
1345
|
-
};
|
|
1346
|
-
}, operatorOpts(opts));
|
|
1347
|
-
}
|
|
1348
|
-
function interval(periodMs, opts) {
|
|
1349
|
-
return producer((a, ctx) => {
|
|
1350
|
-
if (!("n" in ctx.store)) ctx.store.n = 0;
|
|
1351
|
-
const id = setInterval(() => {
|
|
1352
|
-
a.emit(ctx.store.n);
|
|
1353
|
-
ctx.store.n = ctx.store.n + 1;
|
|
1354
|
-
}, periodMs);
|
|
1355
|
-
return () => clearInterval(id);
|
|
1356
|
-
}, operatorOpts(opts));
|
|
1357
|
-
}
|
|
1358
|
-
function repeat(source, count, opts) {
|
|
1359
|
-
if (count <= 0) throw new RangeError("repeat expects count > 0");
|
|
1360
|
-
return producer((a) => {
|
|
1361
|
-
let remaining = count;
|
|
1362
|
-
let innerU;
|
|
1363
|
-
const start = () => {
|
|
1364
|
-
innerU?.();
|
|
1365
|
-
innerU = source.subscribe((msgs) => {
|
|
1366
|
-
let completed = false;
|
|
1367
|
-
const fwd = [];
|
|
1368
|
-
for (const m of msgs) {
|
|
1369
|
-
if (m[0] === COMPLETE) completed = true;
|
|
1370
|
-
else fwd.push(m);
|
|
1371
|
-
}
|
|
1372
|
-
if (fwd.length > 0) a.down(fwd);
|
|
1373
|
-
if (completed) {
|
|
1374
|
-
innerU?.();
|
|
1375
|
-
innerU = void 0;
|
|
1376
|
-
remaining -= 1;
|
|
1377
|
-
if (remaining > 0) start();
|
|
1378
|
-
else a.down([[COMPLETE]]);
|
|
1379
|
-
}
|
|
1380
|
-
});
|
|
1381
|
-
};
|
|
1382
|
-
start();
|
|
1383
|
-
return () => {
|
|
1384
|
-
innerU?.();
|
|
1385
|
-
};
|
|
1386
|
-
}, operatorOpts(opts));
|
|
1387
|
-
}
|
|
1388
|
-
function pausable(source, opts) {
|
|
1389
|
-
return node(
|
|
1390
|
-
[source],
|
|
1391
|
-
(data, a) => {
|
|
1392
|
-
const batch0 = data[0];
|
|
1393
|
-
if (batch0 == null || batch0.length === 0) {
|
|
1394
|
-
a.down([[RESOLVED]]);
|
|
1395
|
-
return;
|
|
1396
|
-
}
|
|
1397
|
-
for (const v of batch0) a.emit(v);
|
|
1398
|
-
},
|
|
1399
|
-
operatorOpts(opts)
|
|
1400
|
-
);
|
|
1401
|
-
}
|
|
1402
|
-
function rescue(source, recover, opts) {
|
|
1403
|
-
return producer((a) => {
|
|
1404
|
-
const srcUnsub = source.subscribe((msgs) => {
|
|
1405
|
-
for (const m of msgs) {
|
|
1406
|
-
if (m[0] === DATA) {
|
|
1407
|
-
a.emit(m[1]);
|
|
1408
|
-
} else if (m[0] === ERROR) {
|
|
1409
|
-
try {
|
|
1410
|
-
a.emit(recover(m[1]));
|
|
1411
|
-
} catch (recoverErr) {
|
|
1412
|
-
a.down([[ERROR, recoverErr]]);
|
|
1413
|
-
}
|
|
1414
|
-
} else if (m[0] === COMPLETE) {
|
|
1415
|
-
a.down([[COMPLETE]]);
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
});
|
|
1419
|
-
return () => {
|
|
1420
|
-
srcUnsub();
|
|
1421
|
-
};
|
|
1422
|
-
}, operatorOpts(opts));
|
|
1423
|
-
}
|
|
1424
|
-
function valve(source, control, opts) {
|
|
1425
|
-
return node(
|
|
1426
|
-
[source, control],
|
|
1427
|
-
(data, a, ctx) => {
|
|
1428
|
-
const batch1 = data[1];
|
|
1429
|
-
const controlValue = batch1 != null && batch1.length > 0 ? batch1.at(-1) : ctx.prevData[1];
|
|
1430
|
-
if (!controlValue) {
|
|
1431
|
-
a.down([[RESOLVED]]);
|
|
1432
|
-
return;
|
|
1433
|
-
}
|
|
1434
|
-
const batch0 = data[0];
|
|
1435
|
-
if (batch0 != null && batch0.length > 0) {
|
|
1436
|
-
for (const v of batch0) a.emit(v);
|
|
1437
|
-
return;
|
|
1438
|
-
}
|
|
1439
|
-
if (batch1 != null && batch1.length > 0 && ctx.prevData[0] !== void 0) {
|
|
1440
|
-
a.emit(ctx.prevData[0]);
|
|
1441
|
-
return;
|
|
1442
|
-
}
|
|
1443
|
-
a.down([[RESOLVED]]);
|
|
1444
|
-
},
|
|
1445
|
-
operatorOpts(opts)
|
|
1446
|
-
);
|
|
1447
|
-
}
|
|
1448
|
-
var combineLatest = combine;
|
|
1449
|
-
var debounceTime = debounce;
|
|
1450
|
-
var throttleTime = throttle;
|
|
1451
|
-
var catchError = rescue;
|
|
1452
|
-
|
|
1453
|
-
// src/extra/composite.ts
|
|
1454
|
-
function isNodeLike(value) {
|
|
1455
|
-
return typeof value === "object" && value !== null && "cache" in value && typeof value.subscribe === "function";
|
|
1456
|
-
}
|
|
1457
|
-
function verifiable(source, verifyFn, opts) {
|
|
1458
|
-
const sourceNode = fromAny(source);
|
|
1459
|
-
const hasSourceVersioning = sourceNode.v != null;
|
|
1460
|
-
const verified = state(opts?.initialVerified ?? null, {
|
|
1461
|
-
...hasSourceVersioning ? { meta: { sourceVersion: null } } : {}
|
|
1462
|
-
});
|
|
1463
|
-
const hasTrigger = opts?.trigger !== void 0 && opts.trigger !== null;
|
|
1464
|
-
let triggerNode = null;
|
|
1465
|
-
if (hasTrigger && opts?.autoVerify) {
|
|
1466
|
-
triggerNode = merge(fromAny(opts.trigger), sourceNode);
|
|
1467
|
-
} else if (hasTrigger) {
|
|
1468
|
-
triggerNode = fromAny(opts.trigger);
|
|
1469
|
-
} else if (opts?.autoVerify) {
|
|
1470
|
-
triggerNode = sourceNode;
|
|
1471
|
-
}
|
|
1472
|
-
if (triggerNode !== null) {
|
|
1473
|
-
let verifyStream;
|
|
1474
|
-
if (triggerNode === sourceNode) {
|
|
1475
|
-
verifyStream = switchMap(sourceNode, (src) => verifyFn(src));
|
|
1476
|
-
} else {
|
|
1477
|
-
let latestSource = sourceNode.cache;
|
|
1478
|
-
sourceNode.subscribe((msgs) => {
|
|
1479
|
-
for (const m of msgs) {
|
|
1480
|
-
if (m[0] === DATA) latestSource = m[1];
|
|
1481
|
-
}
|
|
1482
|
-
});
|
|
1483
|
-
verifyStream = switchMap(triggerNode, () => verifyFn(latestSource));
|
|
1484
|
-
}
|
|
1485
|
-
forEach(verifyStream, (value) => {
|
|
1486
|
-
batch(() => {
|
|
1487
|
-
verified.down([[DATA, value]]);
|
|
1488
|
-
if (hasSourceVersioning) {
|
|
1489
|
-
const sv = sourceNode.v;
|
|
1490
|
-
if (sv != null) {
|
|
1491
|
-
verified.meta.sourceVersion.down([[DATA, { id: sv.id, version: sv.version }]]);
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
});
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
return { node: sourceNode, verified, trigger: triggerNode };
|
|
1498
|
-
}
|
|
1499
|
-
function keepalive(node2) {
|
|
1500
|
-
node2.subscribe(() => void 0);
|
|
1501
|
-
}
|
|
1502
|
-
function mapFromSnapshot(snapshot) {
|
|
1503
|
-
if (snapshot instanceof Map) return snapshot;
|
|
1504
|
-
return /* @__PURE__ */ new Map();
|
|
1505
|
-
}
|
|
1506
|
-
function applyExtraction(store, extraction) {
|
|
1507
|
-
if (!Array.isArray(extraction.upsert)) {
|
|
1508
|
-
throw new TypeError("distill extraction requires upsert: Array<{ key, value }>");
|
|
1509
|
-
}
|
|
1510
|
-
batch(() => {
|
|
1511
|
-
for (const { key, value } of extraction.upsert) {
|
|
1512
|
-
store.set(key, value);
|
|
1513
|
-
}
|
|
1514
|
-
for (const key of extraction.remove ?? []) {
|
|
1515
|
-
store.delete(key);
|
|
1516
|
-
}
|
|
1517
|
-
});
|
|
1518
|
-
}
|
|
1519
|
-
function distill(source, extractFn, opts) {
|
|
1520
|
-
const sourceNode = fromAny(source);
|
|
1521
|
-
const store = reactiveMap(opts.mapOptions ?? {});
|
|
1522
|
-
const budget = opts.budget ?? 2e3;
|
|
1523
|
-
const hasContext = opts.context !== void 0 && opts.context !== null;
|
|
1524
|
-
const contextNode = hasContext ? fromAny(opts.context) : state(null);
|
|
1525
|
-
let latestStore = mapFromSnapshot(store.entries.cache);
|
|
1526
|
-
store.entries.subscribe((msgs) => {
|
|
1527
|
-
for (const m of msgs) {
|
|
1528
|
-
if (m[0] === DATA) latestStore = mapFromSnapshot(m[1]);
|
|
1529
|
-
}
|
|
1530
|
-
});
|
|
1531
|
-
const extractionStream = switchMap(sourceNode, (raw) => extractFn(raw, latestStore));
|
|
1532
|
-
forEach(extractionStream, (extraction) => {
|
|
1533
|
-
applyExtraction(store, extraction);
|
|
1534
|
-
});
|
|
1535
|
-
if (opts.evict) {
|
|
1536
|
-
const verdictUnsubs = /* @__PURE__ */ new Map();
|
|
1537
|
-
const evictionKeys = derived([store.entries], ([snapshot]) => {
|
|
1538
|
-
const out = [];
|
|
1539
|
-
const entries = mapFromSnapshot(snapshot);
|
|
1540
|
-
for (const key of verdictUnsubs.keys()) {
|
|
1541
|
-
if (!entries.has(key)) {
|
|
1542
|
-
verdictUnsubs.get(key)();
|
|
1543
|
-
verdictUnsubs.delete(key);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
for (const [key, mem] of entries) {
|
|
1547
|
-
const verdict = opts.evict(key, mem);
|
|
1548
|
-
if (isNodeLike(verdict)) {
|
|
1549
|
-
if (!verdictUnsubs.has(key)) {
|
|
1550
|
-
const unsub = forEach(verdict, (val) => {
|
|
1551
|
-
if (val === true && store.has(key)) {
|
|
1552
|
-
store.delete(key);
|
|
1553
|
-
}
|
|
1554
|
-
});
|
|
1555
|
-
verdictUnsubs.set(key, unsub);
|
|
1556
|
-
}
|
|
1557
|
-
continue;
|
|
1558
|
-
}
|
|
1559
|
-
if (typeof verdict === "boolean") {
|
|
1560
|
-
if (verdict) out.push(key);
|
|
1561
|
-
continue;
|
|
1562
|
-
}
|
|
1563
|
-
throw new TypeError("distill evict() must return boolean or Node<boolean>");
|
|
1564
|
-
}
|
|
1565
|
-
return out;
|
|
1566
|
-
});
|
|
1567
|
-
forEach(evictionKeys, (keys) => {
|
|
1568
|
-
for (const key of keys) store.delete(key);
|
|
1569
|
-
});
|
|
1570
|
-
}
|
|
1571
|
-
const hasConsolidateTrigger = opts.consolidateTrigger !== void 0 && opts.consolidateTrigger !== null;
|
|
1572
|
-
if (opts.consolidate && hasConsolidateTrigger) {
|
|
1573
|
-
const consolidateTriggerNode = fromAny(opts.consolidateTrigger);
|
|
1574
|
-
const consolidationStream = switchMap(
|
|
1575
|
-
consolidateTriggerNode,
|
|
1576
|
-
() => opts.consolidate(latestStore)
|
|
1577
|
-
);
|
|
1578
|
-
forEach(consolidationStream, (extraction) => {
|
|
1579
|
-
applyExtraction(store, extraction);
|
|
1580
|
-
});
|
|
1581
|
-
}
|
|
1582
|
-
const compact = derived([store.entries, contextNode], ([snapshot, context]) => {
|
|
1583
|
-
const entries = [...mapFromSnapshot(snapshot).entries()].map(([key, value]) => ({
|
|
1584
|
-
key,
|
|
1585
|
-
value,
|
|
1586
|
-
score: opts.score(value, context),
|
|
1587
|
-
cost: opts.cost(value)
|
|
1588
|
-
}));
|
|
1589
|
-
entries.sort((a, b) => b.score - a.score);
|
|
1590
|
-
const packed = [];
|
|
1591
|
-
let remaining = budget;
|
|
1592
|
-
for (const item of entries) {
|
|
1593
|
-
if (item.cost <= remaining) {
|
|
1594
|
-
packed.push({ key: item.key, value: item.value, score: item.score });
|
|
1595
|
-
remaining -= item.cost;
|
|
1596
|
-
}
|
|
1597
|
-
}
|
|
1598
|
-
return packed;
|
|
1599
|
-
});
|
|
1600
|
-
const size = derived([store.entries], ([snapshot]) => mapFromSnapshot(snapshot).size);
|
|
1601
|
-
keepalive(compact);
|
|
1602
|
-
keepalive(size);
|
|
1603
|
-
return { store, compact, size };
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
export {
|
|
1607
|
-
NS_PER_MS,
|
|
1608
|
-
NS_PER_SEC,
|
|
1609
|
-
constant,
|
|
1610
|
-
linear,
|
|
1611
|
-
exponential,
|
|
1612
|
-
fibonacci,
|
|
1613
|
-
decorrelatedJitter,
|
|
1614
|
-
withMaxAttempts,
|
|
1615
|
-
resolveBackoffPreset,
|
|
1616
|
-
map,
|
|
1617
|
-
filter,
|
|
1618
|
-
scan,
|
|
1619
|
-
reduce,
|
|
1620
|
-
take,
|
|
1621
|
-
skip,
|
|
1622
|
-
takeWhile,
|
|
1623
|
-
takeUntil,
|
|
1624
|
-
first,
|
|
1625
|
-
last,
|
|
1626
|
-
find,
|
|
1627
|
-
elementAt,
|
|
1628
|
-
tap,
|
|
1629
|
-
distinctUntilChanged,
|
|
1630
|
-
pairwise,
|
|
1631
|
-
combine,
|
|
1632
|
-
withLatestFrom,
|
|
1633
|
-
merge,
|
|
1634
|
-
zip,
|
|
1635
|
-
concat,
|
|
1636
|
-
race,
|
|
1637
|
-
switchMap,
|
|
1638
|
-
exhaustMap,
|
|
1639
|
-
concatMap,
|
|
1640
|
-
mergeMap,
|
|
1641
|
-
flatMap,
|
|
1642
|
-
delay,
|
|
1643
|
-
debounce,
|
|
1644
|
-
throttle,
|
|
1645
|
-
sample,
|
|
1646
|
-
audit,
|
|
1647
|
-
buffer,
|
|
1648
|
-
bufferCount,
|
|
1649
|
-
windowCount,
|
|
1650
|
-
bufferTime,
|
|
1651
|
-
windowTime,
|
|
1652
|
-
window,
|
|
1653
|
-
interval,
|
|
1654
|
-
repeat,
|
|
1655
|
-
pausable,
|
|
1656
|
-
rescue,
|
|
1657
|
-
valve,
|
|
1658
|
-
combineLatest,
|
|
1659
|
-
debounceTime,
|
|
1660
|
-
throttleTime,
|
|
1661
|
-
catchError,
|
|
1662
|
-
verifiable,
|
|
1663
|
-
distill
|
|
1664
|
-
};
|
|
1665
|
-
//# sourceMappingURL=chunk-RNHBMHKA.js.map
|