@callable-recharge/callbag-recharge 0.1.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/README.md +259 -0
- package/dist/backoff-BXsH2Ago.d.cts +25 -0
- package/dist/backoff-BXsH2Ago.d.ts +25 -0
- package/dist/chunk-2BINVZ33.js +2 -0
- package/dist/chunk-2BINVZ33.js.map +1 -0
- package/dist/chunk-2E3ALULW.js +2 -0
- package/dist/chunk-2E3ALULW.js.map +1 -0
- package/dist/chunk-2IM76CX3.js +2 -0
- package/dist/chunk-2IM76CX3.js.map +1 -0
- package/dist/chunk-2KKEBHMR.js +2 -0
- package/dist/chunk-2KKEBHMR.js.map +1 -0
- package/dist/chunk-2P6G236K.js +2 -0
- package/dist/chunk-2P6G236K.js.map +1 -0
- package/dist/chunk-4AANJADQ.js +2 -0
- package/dist/chunk-4AANJADQ.js.map +1 -0
- package/dist/chunk-4WFD6EA7.js +2 -0
- package/dist/chunk-4WFD6EA7.js.map +1 -0
- package/dist/chunk-52WEI2L4.js +2 -0
- package/dist/chunk-52WEI2L4.js.map +1 -0
- package/dist/chunk-52YSBIVX.js +2 -0
- package/dist/chunk-52YSBIVX.js.map +1 -0
- package/dist/chunk-5PJCNPKY.js +2 -0
- package/dist/chunk-5PJCNPKY.js.map +1 -0
- package/dist/chunk-6YHJJXF4.js +2 -0
- package/dist/chunk-6YHJJXF4.js.map +1 -0
- package/dist/chunk-7CQ6XF2G.js +2 -0
- package/dist/chunk-7CQ6XF2G.js.map +1 -0
- package/dist/chunk-7WTS4C5R.js +3 -0
- package/dist/chunk-7WTS4C5R.js.map +1 -0
- package/dist/chunk-A6BNAR7H.js +2 -0
- package/dist/chunk-A6BNAR7H.js.map +1 -0
- package/dist/chunk-BNY43SC2.js +2 -0
- package/dist/chunk-BNY43SC2.js.map +1 -0
- package/dist/chunk-C2BNB3CS.js +2 -0
- package/dist/chunk-C2BNB3CS.js.map +1 -0
- package/dist/chunk-COAIGQ25.js +2 -0
- package/dist/chunk-COAIGQ25.js.map +1 -0
- package/dist/chunk-DBAHFYN4.js +2 -0
- package/dist/chunk-DBAHFYN4.js.map +1 -0
- package/dist/chunk-E63D25PW.js +1 -0
- package/dist/chunk-E63D25PW.js.map +1 -0
- package/dist/chunk-E6EZEFS5.js +2 -0
- package/dist/chunk-E6EZEFS5.js.map +1 -0
- package/dist/chunk-EMNGVHNM.js +2 -0
- package/dist/chunk-EMNGVHNM.js.map +1 -0
- package/dist/chunk-F356J323.js +2 -0
- package/dist/chunk-F356J323.js.map +1 -0
- package/dist/chunk-HKDBOVSA.js +2 -0
- package/dist/chunk-HKDBOVSA.js.map +1 -0
- package/dist/chunk-IJNZ5GDS.js +2 -0
- package/dist/chunk-IJNZ5GDS.js.map +1 -0
- package/dist/chunk-IQUXZNBK.js +2 -0
- package/dist/chunk-IQUXZNBK.js.map +1 -0
- package/dist/chunk-IUHESEXZ.js +2 -0
- package/dist/chunk-IUHESEXZ.js.map +1 -0
- package/dist/chunk-IZ5GFMMK.js +2 -0
- package/dist/chunk-IZ5GFMMK.js.map +1 -0
- package/dist/chunk-JCITTHWJ.js +2 -0
- package/dist/chunk-JCITTHWJ.js.map +1 -0
- package/dist/chunk-JS2FB4B3.js +2 -0
- package/dist/chunk-JS2FB4B3.js.map +1 -0
- package/dist/chunk-K7VPCAZD.js +2 -0
- package/dist/chunk-K7VPCAZD.js.map +1 -0
- package/dist/chunk-KDB2NMLA.js +2 -0
- package/dist/chunk-KDB2NMLA.js.map +1 -0
- package/dist/chunk-LHEWNZ3X.js +2 -0
- package/dist/chunk-LHEWNZ3X.js.map +1 -0
- package/dist/chunk-LM26JNAK.js +2 -0
- package/dist/chunk-LM26JNAK.js.map +1 -0
- package/dist/chunk-M6ZEDHQT.js +2 -0
- package/dist/chunk-M6ZEDHQT.js.map +1 -0
- package/dist/chunk-MJB2RHP4.js +2 -0
- package/dist/chunk-MJB2RHP4.js.map +1 -0
- package/dist/chunk-MKQEMUUJ.js +2 -0
- package/dist/chunk-MKQEMUUJ.js.map +1 -0
- package/dist/chunk-MVAQ5TH7.js +2 -0
- package/dist/chunk-MVAQ5TH7.js.map +1 -0
- package/dist/chunk-NEUWMVR4.js +2 -0
- package/dist/chunk-NEUWMVR4.js.map +1 -0
- package/dist/chunk-NSJJXMWD.js +2 -0
- package/dist/chunk-NSJJXMWD.js.map +1 -0
- package/dist/chunk-NUVYBG4B.js +2 -0
- package/dist/chunk-NUVYBG4B.js.map +1 -0
- package/dist/chunk-O5WOX6C7.js +2 -0
- package/dist/chunk-O5WOX6C7.js.map +1 -0
- package/dist/chunk-O7ITRRPK.js +2 -0
- package/dist/chunk-O7ITRRPK.js.map +1 -0
- package/dist/chunk-OHGZIPRU.js +2 -0
- package/dist/chunk-OHGZIPRU.js.map +1 -0
- package/dist/chunk-PXF7567W.js +2 -0
- package/dist/chunk-PXF7567W.js.map +1 -0
- package/dist/chunk-PYRVYHZG.js +2 -0
- package/dist/chunk-PYRVYHZG.js.map +1 -0
- package/dist/chunk-QECUTAQY.js +2 -0
- package/dist/chunk-QECUTAQY.js.map +1 -0
- package/dist/chunk-QPY7RRUK.js +2 -0
- package/dist/chunk-QPY7RRUK.js.map +1 -0
- package/dist/chunk-QYUTDL4D.js +2 -0
- package/dist/chunk-QYUTDL4D.js.map +1 -0
- package/dist/chunk-UEA4RIP5.js +2 -0
- package/dist/chunk-UEA4RIP5.js.map +1 -0
- package/dist/chunk-UHUNMZJO.js +2 -0
- package/dist/chunk-UHUNMZJO.js.map +1 -0
- package/dist/chunk-W5MQVYXW.js +2 -0
- package/dist/chunk-W5MQVYXW.js.map +1 -0
- package/dist/chunk-WHAGQ74D.js +2 -0
- package/dist/chunk-WHAGQ74D.js.map +1 -0
- package/dist/chunk-WRNNR3U5.js +2 -0
- package/dist/chunk-WRNNR3U5.js.map +1 -0
- package/dist/chunk-X6UCLV7L.js +2 -0
- package/dist/chunk-X6UCLV7L.js.map +1 -0
- package/dist/chunk-XHUZ4TRE.js +2 -0
- package/dist/chunk-XHUZ4TRE.js.map +1 -0
- package/dist/chunk-XISWBEKL.js +2 -0
- package/dist/chunk-XISWBEKL.js.map +1 -0
- package/dist/chunk-YCL7NHHW.js +2 -0
- package/dist/chunk-YCL7NHHW.js.map +1 -0
- package/dist/chunk-YMOLNCDC.js +2 -0
- package/dist/chunk-YMOLNCDC.js.map +1 -0
- package/dist/chunk-ZRKP6HCI.js +2 -0
- package/dist/chunk-ZRKP6HCI.js.map +1 -0
- package/dist/data/index.cjs +3 -0
- package/dist/data/index.cjs.map +1 -0
- package/dist/data/index.d.cts +32 -0
- package/dist/data/index.d.ts +32 -0
- package/dist/data/index.js +2 -0
- package/dist/data/index.js.map +1 -0
- package/dist/eviction-DGPP1vHP.d.cts +21 -0
- package/dist/eviction-DGPP1vHP.d.ts +21 -0
- package/dist/extra/buffer.cjs +3 -0
- package/dist/extra/buffer.cjs.map +1 -0
- package/dist/extra/buffer.d.cts +21 -0
- package/dist/extra/buffer.d.ts +21 -0
- package/dist/extra/buffer.js +2 -0
- package/dist/extra/buffer.js.map +1 -0
- package/dist/extra/bufferTime.cjs +3 -0
- package/dist/extra/bufferTime.cjs.map +1 -0
- package/dist/extra/bufferTime.d.cts +15 -0
- package/dist/extra/bufferTime.d.ts +15 -0
- package/dist/extra/bufferTime.js +2 -0
- package/dist/extra/bufferTime.js.map +1 -0
- package/dist/extra/combine.cjs +3 -0
- package/dist/extra/combine.cjs.map +1 -0
- package/dist/extra/combine.d.cts +19 -0
- package/dist/extra/combine.d.ts +19 -0
- package/dist/extra/combine.js +2 -0
- package/dist/extra/combine.js.map +1 -0
- package/dist/extra/concat.cjs +3 -0
- package/dist/extra/concat.cjs.map +1 -0
- package/dist/extra/concat.d.cts +18 -0
- package/dist/extra/concat.d.ts +18 -0
- package/dist/extra/concat.js +2 -0
- package/dist/extra/concat.js.map +1 -0
- package/dist/extra/concatMap.cjs +3 -0
- package/dist/extra/concatMap.cjs.map +1 -0
- package/dist/extra/concatMap.d.cts +25 -0
- package/dist/extra/concatMap.d.ts +25 -0
- package/dist/extra/concatMap.js +2 -0
- package/dist/extra/concatMap.js.map +1 -0
- package/dist/extra/debounce.cjs +3 -0
- package/dist/extra/debounce.cjs.map +1 -0
- package/dist/extra/debounce.d.cts +17 -0
- package/dist/extra/debounce.d.ts +17 -0
- package/dist/extra/debounce.js +2 -0
- package/dist/extra/debounce.js.map +1 -0
- package/dist/extra/delay.cjs +3 -0
- package/dist/extra/delay.cjs.map +1 -0
- package/dist/extra/delay.d.cts +15 -0
- package/dist/extra/delay.d.ts +15 -0
- package/dist/extra/delay.js +2 -0
- package/dist/extra/delay.js.map +1 -0
- package/dist/extra/distinctUntilChanged.cjs +3 -0
- package/dist/extra/distinctUntilChanged.cjs.map +1 -0
- package/dist/extra/distinctUntilChanged.d.cts +16 -0
- package/dist/extra/distinctUntilChanged.d.ts +16 -0
- package/dist/extra/distinctUntilChanged.js +2 -0
- package/dist/extra/distinctUntilChanged.js.map +1 -0
- package/dist/extra/elementAt.cjs +3 -0
- package/dist/extra/elementAt.cjs.map +1 -0
- package/dist/extra/elementAt.d.cts +17 -0
- package/dist/extra/elementAt.d.ts +17 -0
- package/dist/extra/elementAt.js +2 -0
- package/dist/extra/elementAt.js.map +1 -0
- package/dist/extra/empty.cjs +3 -0
- package/dist/extra/empty.cjs.map +1 -0
- package/dist/extra/empty.d.cts +13 -0
- package/dist/extra/empty.d.ts +13 -0
- package/dist/extra/empty.js +2 -0
- package/dist/extra/empty.js.map +1 -0
- package/dist/extra/exhaustMap.cjs +3 -0
- package/dist/extra/exhaustMap.cjs.map +1 -0
- package/dist/extra/exhaustMap.d.cts +21 -0
- package/dist/extra/exhaustMap.d.ts +21 -0
- package/dist/extra/exhaustMap.js +2 -0
- package/dist/extra/exhaustMap.js.map +1 -0
- package/dist/extra/filter.cjs +3 -0
- package/dist/extra/filter.cjs.map +1 -0
- package/dist/extra/filter.d.cts +16 -0
- package/dist/extra/filter.d.ts +16 -0
- package/dist/extra/filter.js +2 -0
- package/dist/extra/filter.js.map +1 -0
- package/dist/extra/find.cjs +3 -0
- package/dist/extra/find.cjs.map +1 -0
- package/dist/extra/find.d.cts +17 -0
- package/dist/extra/find.d.ts +17 -0
- package/dist/extra/find.js +2 -0
- package/dist/extra/find.js.map +1 -0
- package/dist/extra/first.cjs +3 -0
- package/dist/extra/first.cjs.map +1 -0
- package/dist/extra/first.d.cts +15 -0
- package/dist/extra/first.d.ts +15 -0
- package/dist/extra/first.js +2 -0
- package/dist/extra/first.js.map +1 -0
- package/dist/extra/flat.cjs +3 -0
- package/dist/extra/flat.cjs.map +1 -0
- package/dist/extra/flat.d.cts +21 -0
- package/dist/extra/flat.d.ts +21 -0
- package/dist/extra/flat.js +2 -0
- package/dist/extra/flat.js.map +1 -0
- package/dist/extra/forEach.cjs +2 -0
- package/dist/extra/forEach.cjs.map +1 -0
- package/dist/extra/forEach.d.cts +13 -0
- package/dist/extra/forEach.d.ts +13 -0
- package/dist/extra/forEach.js +2 -0
- package/dist/extra/forEach.js.map +1 -0
- package/dist/extra/fromEvent.cjs +3 -0
- package/dist/extra/fromEvent.cjs.map +1 -0
- package/dist/extra/fromEvent.d.cts +14 -0
- package/dist/extra/fromEvent.d.ts +14 -0
- package/dist/extra/fromEvent.js +2 -0
- package/dist/extra/fromEvent.js.map +1 -0
- package/dist/extra/fromIter.cjs +3 -0
- package/dist/extra/fromIter.cjs.map +1 -0
- package/dist/extra/fromIter.d.cts +15 -0
- package/dist/extra/fromIter.d.ts +15 -0
- package/dist/extra/fromIter.js +2 -0
- package/dist/extra/fromIter.js.map +1 -0
- package/dist/extra/fromObs.cjs +3 -0
- package/dist/extra/fromObs.cjs.map +1 -0
- package/dist/extra/fromObs.d.cts +25 -0
- package/dist/extra/fromObs.d.ts +25 -0
- package/dist/extra/fromObs.js +2 -0
- package/dist/extra/fromObs.js.map +1 -0
- package/dist/extra/fromPromise.cjs +3 -0
- package/dist/extra/fromPromise.cjs.map +1 -0
- package/dist/extra/fromPromise.d.cts +16 -0
- package/dist/extra/fromPromise.d.ts +16 -0
- package/dist/extra/fromPromise.js +2 -0
- package/dist/extra/fromPromise.js.map +1 -0
- package/dist/extra/index.cjs +3 -0
- package/dist/extra/index.cjs.map +1 -0
- package/dist/extra/index.d.cts +220 -0
- package/dist/extra/index.d.ts +220 -0
- package/dist/extra/index.js +2 -0
- package/dist/extra/index.js.map +1 -0
- package/dist/extra/interval.cjs +3 -0
- package/dist/extra/interval.cjs.map +1 -0
- package/dist/extra/interval.d.cts +15 -0
- package/dist/extra/interval.d.ts +15 -0
- package/dist/extra/interval.js +2 -0
- package/dist/extra/interval.js.map +1 -0
- package/dist/extra/last.cjs +3 -0
- package/dist/extra/last.cjs.map +1 -0
- package/dist/extra/last.d.cts +16 -0
- package/dist/extra/last.d.ts +16 -0
- package/dist/extra/last.js +2 -0
- package/dist/extra/last.js.map +1 -0
- package/dist/extra/map.cjs +3 -0
- package/dist/extra/map.cjs.map +1 -0
- package/dist/extra/map.d.cts +15 -0
- package/dist/extra/map.d.ts +15 -0
- package/dist/extra/map.js +2 -0
- package/dist/extra/map.js.map +1 -0
- package/dist/extra/merge.cjs +3 -0
- package/dist/extra/merge.cjs.map +1 -0
- package/dist/extra/merge.d.cts +21 -0
- package/dist/extra/merge.d.ts +21 -0
- package/dist/extra/merge.js +2 -0
- package/dist/extra/merge.js.map +1 -0
- package/dist/extra/never.cjs +3 -0
- package/dist/extra/never.cjs.map +1 -0
- package/dist/extra/never.d.cts +13 -0
- package/dist/extra/never.d.ts +13 -0
- package/dist/extra/never.js +2 -0
- package/dist/extra/never.js.map +1 -0
- package/dist/extra/of.cjs +3 -0
- package/dist/extra/of.cjs.map +1 -0
- package/dist/extra/of.d.cts +14 -0
- package/dist/extra/of.d.ts +14 -0
- package/dist/extra/of.js +2 -0
- package/dist/extra/of.js.map +1 -0
- package/dist/extra/pairwise.cjs +3 -0
- package/dist/extra/pairwise.cjs.map +1 -0
- package/dist/extra/pairwise.d.cts +16 -0
- package/dist/extra/pairwise.d.ts +16 -0
- package/dist/extra/pairwise.js +2 -0
- package/dist/extra/pairwise.js.map +1 -0
- package/dist/extra/partition.cjs +3 -0
- package/dist/extra/partition.cjs.map +1 -0
- package/dist/extra/partition.d.cts +24 -0
- package/dist/extra/partition.d.ts +24 -0
- package/dist/extra/partition.js +2 -0
- package/dist/extra/partition.js.map +1 -0
- package/dist/extra/pipeRaw.cjs +3 -0
- package/dist/extra/pipeRaw.cjs.map +1 -0
- package/dist/extra/pipeRaw.d.cts +22 -0
- package/dist/extra/pipeRaw.d.ts +22 -0
- package/dist/extra/pipeRaw.js +2 -0
- package/dist/extra/pipeRaw.js.map +1 -0
- package/dist/extra/remember.cjs +3 -0
- package/dist/extra/remember.cjs.map +1 -0
- package/dist/extra/remember.d.cts +17 -0
- package/dist/extra/remember.d.ts +17 -0
- package/dist/extra/remember.js +2 -0
- package/dist/extra/remember.js.map +1 -0
- package/dist/extra/repeat.cjs +3 -0
- package/dist/extra/repeat.cjs.map +1 -0
- package/dist/extra/repeat.d.cts +29 -0
- package/dist/extra/repeat.d.ts +29 -0
- package/dist/extra/repeat.js +2 -0
- package/dist/extra/repeat.js.map +1 -0
- package/dist/extra/rescue.cjs +3 -0
- package/dist/extra/rescue.cjs.map +1 -0
- package/dist/extra/rescue.d.cts +16 -0
- package/dist/extra/rescue.d.ts +16 -0
- package/dist/extra/rescue.js +2 -0
- package/dist/extra/rescue.js.map +1 -0
- package/dist/extra/retry.cjs +3 -0
- package/dist/extra/retry.cjs.map +1 -0
- package/dist/extra/retry.d.cts +29 -0
- package/dist/extra/retry.d.ts +29 -0
- package/dist/extra/retry.js +2 -0
- package/dist/extra/retry.js.map +1 -0
- package/dist/extra/sample.cjs +3 -0
- package/dist/extra/sample.cjs.map +1 -0
- package/dist/extra/sample.d.cts +15 -0
- package/dist/extra/sample.d.ts +15 -0
- package/dist/extra/sample.js +2 -0
- package/dist/extra/sample.js.map +1 -0
- package/dist/extra/scan.cjs +3 -0
- package/dist/extra/scan.cjs.map +1 -0
- package/dist/extra/scan.d.cts +16 -0
- package/dist/extra/scan.d.ts +16 -0
- package/dist/extra/scan.js +2 -0
- package/dist/extra/scan.js.map +1 -0
- package/dist/extra/share.cjs +2 -0
- package/dist/extra/share.cjs.map +1 -0
- package/dist/extra/share.d.cts +12 -0
- package/dist/extra/share.d.ts +12 -0
- package/dist/extra/share.js +2 -0
- package/dist/extra/share.js.map +1 -0
- package/dist/extra/skip.cjs +3 -0
- package/dist/extra/skip.cjs.map +1 -0
- package/dist/extra/skip.d.cts +16 -0
- package/dist/extra/skip.d.ts +16 -0
- package/dist/extra/skip.js +2 -0
- package/dist/extra/skip.js.map +1 -0
- package/dist/extra/startWith.cjs +3 -0
- package/dist/extra/startWith.cjs.map +1 -0
- package/dist/extra/startWith.d.cts +15 -0
- package/dist/extra/startWith.d.ts +15 -0
- package/dist/extra/startWith.js +2 -0
- package/dist/extra/startWith.js.map +1 -0
- package/dist/extra/subject.cjs +3 -0
- package/dist/extra/subject.cjs.map +1 -0
- package/dist/extra/subject.d.cts +27 -0
- package/dist/extra/subject.d.ts +27 -0
- package/dist/extra/subject.js +2 -0
- package/dist/extra/subject.js.map +1 -0
- package/dist/extra/subscribe.cjs +2 -0
- package/dist/extra/subscribe.cjs.map +1 -0
- package/dist/extra/subscribe.d.cts +19 -0
- package/dist/extra/subscribe.d.ts +19 -0
- package/dist/extra/subscribe.js +2 -0
- package/dist/extra/subscribe.js.map +1 -0
- package/dist/extra/switchMap.cjs +3 -0
- package/dist/extra/switchMap.cjs.map +1 -0
- package/dist/extra/switchMap.d.cts +21 -0
- package/dist/extra/switchMap.d.ts +21 -0
- package/dist/extra/switchMap.js +2 -0
- package/dist/extra/switchMap.js.map +1 -0
- package/dist/extra/take.cjs +3 -0
- package/dist/extra/take.cjs.map +1 -0
- package/dist/extra/take.d.cts +15 -0
- package/dist/extra/take.d.ts +15 -0
- package/dist/extra/take.js +2 -0
- package/dist/extra/take.js.map +1 -0
- package/dist/extra/takeUntil.cjs +3 -0
- package/dist/extra/takeUntil.cjs.map +1 -0
- package/dist/extra/takeUntil.d.cts +20 -0
- package/dist/extra/takeUntil.d.ts +20 -0
- package/dist/extra/takeUntil.js +2 -0
- package/dist/extra/takeUntil.js.map +1 -0
- package/dist/extra/tap.cjs +3 -0
- package/dist/extra/tap.cjs.map +1 -0
- package/dist/extra/tap.d.cts +15 -0
- package/dist/extra/tap.d.ts +15 -0
- package/dist/extra/tap.js +2 -0
- package/dist/extra/tap.js.map +1 -0
- package/dist/extra/throttle.cjs +3 -0
- package/dist/extra/throttle.cjs.map +1 -0
- package/dist/extra/throttle.d.cts +16 -0
- package/dist/extra/throttle.d.ts +16 -0
- package/dist/extra/throttle.js +2 -0
- package/dist/extra/throttle.js.map +1 -0
- package/dist/extra/throwError.cjs +3 -0
- package/dist/extra/throwError.cjs.map +1 -0
- package/dist/extra/throwError.d.cts +13 -0
- package/dist/extra/throwError.d.ts +13 -0
- package/dist/extra/throwError.js +2 -0
- package/dist/extra/throwError.js.map +1 -0
- package/dist/extra/timeout.cjs +3 -0
- package/dist/extra/timeout.cjs.map +1 -0
- package/dist/extra/timeout.d.cts +19 -0
- package/dist/extra/timeout.d.ts +19 -0
- package/dist/extra/timeout.js +2 -0
- package/dist/extra/timeout.js.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +197 -0
- package/dist/index.d.ts +197 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/memory/index.cjs +3 -0
- package/dist/memory/index.cjs.map +1 -0
- package/dist/memory/index.d.cts +113 -0
- package/dist/memory/index.d.ts +113 -0
- package/dist/memory/index.js +2 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/orchestrate/index.cjs +3 -0
- package/dist/orchestrate/index.cjs.map +1 -0
- package/dist/orchestrate/index.d.cts +101 -0
- package/dist/orchestrate/index.d.ts +101 -0
- package/dist/orchestrate/index.js +2 -0
- package/dist/orchestrate/index.js.map +1 -0
- package/dist/patterns/createStore/index.cjs +3 -0
- package/dist/patterns/createStore/index.cjs.map +1 -0
- package/dist/patterns/createStore/index.d.cts +55 -0
- package/dist/patterns/createStore/index.d.ts +55 -0
- package/dist/patterns/createStore/index.js +2 -0
- package/dist/patterns/createStore/index.js.map +1 -0
- package/dist/types-BiLijSKv.d.cts +192 -0
- package/dist/types-CIITLkgL.d.ts +192 -0
- package/dist/types-DsAN6Hga.d.cts +86 -0
- package/dist/types-DsAN6Hga.d.ts +86 -0
- package/dist/utils/index.cjs +3 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +8 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +141 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/extra/retry.ts","../../src/core/protocol.ts","../../src/core/inspector.ts","../../src/core/producer.ts"],"sourcesContent":["import { Inspector } from \"../core/inspector\";\nimport { producer } from \"../core/producer\";\nimport { END, START } from \"../core/protocol\";\nimport type { Store, StoreOperator } from \"../core/types\";\nimport type { BackoffStrategy } from \"../utils/backoff\";\n\n/**\n * Re-subscribes to the input source on error (END with error).\n *\n * Overloads:\n * retry(3) — instant retry, up to 3 times (backward-compatible)\n * retry({ count: 5, delay: exp() }) — 5 retries with backoff delay\n * retry({ delay: exp(), while: fn }) — unlimited retries with condition + backoff\n *\n * Stateful: maintains last value via producer. get() returns input's initial\n * value before first emission, then the latest value from the source.\n *\n * v3: Tier 2 — dynamic subscription operator. Each emit starts a new\n * DIRTY+value cycle. No built-in dedup. Uses raw callbag for END\n * detection (error triggers reconnect, clean completion propagates).\n */\nexport interface RetryOptions {\n\t/** Maximum number of retries. Default: Infinity when delay is set. */\n\tcount?: number;\n\t/** Backoff strategy — returns ms to wait, or null to stop. */\n\tdelay?: BackoffStrategy;\n\t/** Predicate — retry only if this returns true for the error. */\n\twhile?: (error: unknown) => boolean;\n}\n\nexport function retry<A>(config: number | RetryOptions): StoreOperator<A, A> {\n\tconst opts: RetryOptions = typeof config === \"number\" ? { count: config } : config;\n\n\tconst maxRetries = opts.count ?? (opts.delay ? Infinity : 0);\n\tconst delayFn = opts.delay ?? null;\n\tconst whileFn = opts.while ?? null;\n\n\treturn (input: Store<A>) => {\n\t\tconst store = producer<A>(\n\t\t\t({ emit, complete, error }) => {\n\t\t\t\tlet attempt = 0;\n\t\t\t\tlet lastDelay: number | undefined;\n\t\t\t\tlet inputTalkback: ((type: number) => void) | null = null;\n\t\t\t\tlet initialized = false;\n\t\t\t\tlet timer: ReturnType<typeof setTimeout> | null = null;\n\t\t\t\tlet stopped = false;\n\n\t\t\t\tfunction connectInput() {\n\t\t\t\t\tif (stopped) return;\n\t\t\t\t\tif (inputTalkback) {\n\t\t\t\t\t\tinputTalkback(END);\n\t\t\t\t\t\tinputTalkback = null;\n\t\t\t\t\t}\n\t\t\t\t\tconst initial = input.get();\n\t\t\t\t\t// Skip emit on first connect — producer's { initial } already has the value.\n\t\t\t\t\t// On retry (reconnect after error), emit to update the output value.\n\t\t\t\t\tif (initialized && initial !== undefined) emit(initial as A);\n\t\t\t\t\tinitialized = true;\n\t\t\t\t\tinput.source(START, (type: number, data: unknown) => {\n\t\t\t\t\t\tif (stopped) return;\n\t\t\t\t\t\tif (type === START) inputTalkback = data as (type: number) => void;\n\t\t\t\t\t\tif (type === 1) emit(data as A);\n\t\t\t\t\t\tif (type === END) {\n\t\t\t\t\t\t\tinputTalkback = null;\n\t\t\t\t\t\t\tif (data !== undefined) {\n\t\t\t\t\t\t\t\t// Error — check if we should retry\n\t\t\t\t\t\t\t\tconst shouldRetry = attempt < maxRetries && (whileFn === null || whileFn(data));\n\n\t\t\t\t\t\t\t\tif (shouldRetry) {\n\t\t\t\t\t\t\t\t\tif (!delayFn) {\n\t\t\t\t\t\t\t\t\t\t// No delay — instant retry (backward-compatible path)\n\t\t\t\t\t\t\t\t\t\tattempt++;\n\t\t\t\t\t\t\t\t\t\tconnectInput();\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tconst delayMs = delayFn(attempt, data, lastDelay);\n\t\t\t\t\t\t\t\t\t\tattempt++;\n\t\t\t\t\t\t\t\t\t\tif (delayMs !== null) lastDelay = delayMs;\n\n\t\t\t\t\t\t\t\t\t\tif (delayMs === null || delayMs <= 0) {\n\t\t\t\t\t\t\t\t\t\t\t// Strategy says stop or zero delay\n\t\t\t\t\t\t\t\t\t\t\tif (delayMs === null) {\n\t\t\t\t\t\t\t\t\t\t\t\terror(data);\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tconnectInput();\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t// Delayed retry\n\t\t\t\t\t\t\t\t\t\t\ttimer = setTimeout(() => {\n\t\t\t\t\t\t\t\t\t\t\t\ttimer = null;\n\t\t\t\t\t\t\t\t\t\t\t\tconnectInput();\n\t\t\t\t\t\t\t\t\t\t\t}, delayMs);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\terror(data);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconnectInput();\n\n\t\t\t\treturn () => {\n\t\t\t\t\tstopped = true;\n\t\t\t\t\tif (timer !== null) {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\ttimer = null;\n\t\t\t\t\t}\n\t\t\t\t\tif (inputTalkback) inputTalkback(END);\n\t\t\t\t};\n\t\t\t},\n\t\t\t{ initial: input.get() },\n\t\t);\n\n\t\tInspector.register(store, { kind: \"retry\" });\n\t\treturn store;\n\t};\n}\n","// ---------------------------------------------------------------------------\n// Protocol — v3 type 3 control channel\n// ---------------------------------------------------------------------------\n// Type 3 (STATE) carries control signals: DIRTY, RESOLVED\n// Type 1 (DATA) carries only real values — never sentinels\n// ---------------------------------------------------------------------------\n\n/** Control signal: \"my value is about to change\" */\nexport const DIRTY = Symbol(\"DIRTY\");\n\n/** Control signal: \"I was dirty but my value didn't change\" */\nexport const RESOLVED = Symbol(\"RESOLVED\");\n\nexport type Signal = typeof DIRTY | typeof RESOLVED;\n\n/** Node status — tracks current lifecycle state (v4) */\nexport type NodeStatus =\n\t| \"DISCONNECTED\"\n\t| \"DIRTY\"\n\t| \"SETTLED\"\n\t| \"RESOLVED\"\n\t| \"COMPLETED\"\n\t| \"ERRORED\";\n\n// ---------------------------------------------------------------------------\n// Integer status constants — pack into _flags for hot-path performance.\n// 3 bits (7-9) encode 6 statuses. Use STATUS_MASK to read/write.\n// ---------------------------------------------------------------------------\nexport const S_DISCONNECTED = 0;\nexport const S_DIRTY = 1;\nexport const S_SETTLED = 2;\nexport const S_RESOLVED = 3;\nexport const S_COMPLETED = 4;\nexport const S_ERRORED = 5;\nexport const STATUS_SHIFT = 7;\nexport const STATUS_MASK = 0b111 << STATUS_SHIFT; // bits 7-9\n\nconst STATUS_STRINGS: NodeStatus[] = [\n\t\"DISCONNECTED\",\n\t\"DIRTY\",\n\t\"SETTLED\",\n\t\"RESOLVED\",\n\t\"COMPLETED\",\n\t\"ERRORED\",\n];\n\n/** Decode integer status bits back to string (for Inspector / tests) */\nexport function decodeStatus(flags: number): NodeStatus {\n\treturn STATUS_STRINGS[(flags & STATUS_MASK) >>> STATUS_SHIFT];\n}\n\n/** Callbag signal types */\nexport const START = 0;\nexport const DATA = 1;\nexport const END = 2;\nexport const STATE = 3;\n\n// ---------------------------------------------------------------------------\n// Batch — defers type 1 value emissions; type 3 DIRTY propagates immediately\n// ---------------------------------------------------------------------------\n\nlet batchDepth = 0;\nconst deferredEmissions: Array<() => void> = [];\n\n// `draining` prevents re-entrant drain when a nested batch() call ends while\n// the outer drain loop is already running. Without it, the inner batch's\n// finally block would see batchDepth===0 and start a second drain, racing the\n// outer loop — potentially double-processing items or clearing the array mid-\n// iteration. With draining=true, the inner batch skips its drain; any items it\n// pushes are picked up by the outer loop (the `for` condition re-evaluates\n// `deferredEmissions.length` on every iteration, so appends during drain are\n// naturally included in the same pass).\nlet draining = false;\n\nexport function batch<T>(fn: () => T): T {\n\tbatchDepth++;\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tbatchDepth--;\n\t\tif (batchDepth === 0 && !draining) {\n\t\t\tdraining = true;\n\t\t\tfor (let i = 0; i < deferredEmissions.length; i++) {\n\t\t\t\tdeferredEmissions[i]();\n\t\t\t}\n\t\t\tdeferredEmissions.length = 0;\n\t\t\tdraining = false;\n\t\t}\n\t}\n}\n\nexport function isBatching(): boolean {\n\treturn batchDepth > 0;\n}\n\nexport function deferEmission(fn: () => void): void {\n\tdeferredEmissions.push(fn);\n}\n\n// ---------------------------------------------------------------------------\n// Connection batching (producer start deferral) — unchanged from v2\n// ---------------------------------------------------------------------------\n\nlet connectDepth = 0;\nconst pendingStarts: Array<() => void> = [];\n\nexport function beginDeferredStart(): void {\n\tconnectDepth++;\n}\n\nexport function endDeferredStart(): void {\n\tconnectDepth--;\n\tif (connectDepth === 0) {\n\t\tfor (let i = 0; i < pendingStarts.length; i++) {\n\t\t\tpendingStarts[i]();\n\t\t}\n\t\tpendingStarts.length = 0;\n\t}\n}\n\nexport function deferStart(start: () => void): void {\n\tif (connectDepth > 0) {\n\t\tpendingStarts.push(start);\n\t} else {\n\t\tstart();\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// teardown — protocol-level graph destruction\n// ---------------------------------------------------------------------------\n// Sends END to all downstream sinks of a store node, cascading through the\n// entire subgraph. After teardown, the node is in COMPLETED state and won't\n// accept new values or subscriptions.\n//\n// Works with any node that uses the output slot model:\n// - ProducerImpl / StateImpl / OperatorImpl → calls .complete()\n// - DerivedImpl → calls ._handleEnd() (no public complete() on derived)\n// ---------------------------------------------------------------------------\n\nexport function teardown(store: { source: (type: number, payload?: any) => void }): void {\n\tconst node = store as any;\n\tif (typeof node.complete === \"function\") {\n\t\tnode.complete();\n\t} else if (typeof node._handleEnd === \"function\") {\n\t\tnode._handleEnd(undefined);\n\t}\n}\n","// ---------------------------------------------------------------------------\n// Inspector — static class for observability\n// ---------------------------------------------------------------------------\n// All debug metadata lives here in WeakMaps, not on the store objects.\n// Stores stay lean. Inspector is opt-in overhead.\n//\n// v5: Zero intrusion into primitives. No hooks in hot paths. All methods\n// are static — call directly as Inspector.observe(), Inspector.tap(), etc.\n// - register/registerEdge: metadata collection (called from constructors)\n// - inspect/graph/dumpGraph/snapshot: read-only graph queries\n// - observe/spy/trace: callbag sinks for debugging (subscribe externally)\n// - tap: transparent passthrough wrapper for graph visualization\n// ---------------------------------------------------------------------------\n\nimport type { NodeStatus, Signal } from \"./protocol\";\nimport { DATA, DIRTY, END, RESOLVED, START, STATE } from \"./protocol\";\nimport type { Store } from \"./types\";\n\nexport interface StoreInfo<T = unknown> {\n\tname: string | undefined;\n\tkind: string;\n\tvalue: T;\n\t/** v4: node lifecycle status */\n\tstatus: NodeStatus | undefined;\n}\n\nexport interface ObserveResult<T> {\n\t/** All DATA (type 1) values received, in order */\n\tvalues: T[];\n\t/** All STATE (type 3) payloads received (DIRTY, RESOLVED, or unknown) */\n\tsignals: Signal[];\n\t/** All events in protocol order: { type, data } */\n\tevents: Array<{ type: \"data\" | \"signal\" | \"end\"; data: unknown }>;\n\t/** Whether END (type 2) has been received */\n\tended: boolean;\n\t/** Error payload from END, if any */\n\tendError: unknown;\n\t/** Count of DIRTY signals received */\n\tdirtyCount: number;\n\t/** Count of RESOLVED signals received */\n\tresolvedCount: number;\n\t/** Store name (from Inspector, if registered) */\n\tname: string | undefined;\n\t/** Disconnect the observer */\n\tdispose: () => void;\n}\n\n// Static-only class is intentional API for Inspector namespace\n// biome-ignore lint/complexity/noStaticOnlyClass: public API surface\nexport class Inspector {\n\t// WeakMaps for metadata — keyed by any graph node (stores, effects, etc.)\n\tprivate static _names = new WeakMap<object, string>();\n\tprivate static _kinds = new WeakMap<object, string>();\n\tprivate static _keys = new WeakMap<object, string>();\n\n\t// WeakRef set for graph() — allows GC of unused nodes\n\tprivate static _stores = new Set<WeakRef<object>>();\n\n\t// Dependency edges: parent key → child keys\n\tprivate static _edges = new Map<string, string[]>();\n\n\t// Unique key generation\n\tprivate static _nextId = 0;\n\tprivate static _usedKeys = new Set<string>();\n\n\t// Enabled flag — when false, register/getName are no-ops\n\tprivate static _explicitEnabled: boolean | null = null;\n\tprivate static _cachedDefault: boolean | null = null;\n\n\tstatic get enabled(): boolean {\n\t\tif (Inspector._explicitEnabled !== null) return Inspector._explicitEnabled;\n\t\tif (Inspector._cachedDefault !== null) return Inspector._cachedDefault;\n\t\ttry {\n\t\t\tInspector._cachedDefault = (globalThis as any).process?.env?.NODE_ENV !== \"production\";\n\t\t} catch {\n\t\t\tInspector._cachedDefault = true;\n\t\t}\n\t\treturn Inspector._cachedDefault;\n\t}\n\n\tstatic set enabled(value: boolean) {\n\t\tInspector._explicitEnabled = value;\n\t}\n\n\t/** Compute a dep-name-based suffix for unique key generation */\n\tprivate static _depSuffix(deps?: object[]): string | undefined {\n\t\tif (!deps?.length) return undefined;\n\t\tconst names = deps.map((d) => Inspector._names.get(d) ?? \"?\");\n\t\tconst joined = names.join(\",\");\n\t\treturn joined.length > 40 ? `${joined.slice(0, 37)}...` : joined;\n\t}\n\n\t/** Resolve a node to its unique graph key */\n\tprivate static _resolveKey(node: object): string {\n\t\treturn Inspector._keys.get(node) ?? Inspector._names.get(node) ?? \"anonymous\";\n\t}\n\n\t/** Register a graph node (store, effect, etc.) with the inspector */\n\tstatic register(node: object, opts?: { name?: string; kind?: string; deps?: object[] }): void {\n\t\tif (!Inspector.enabled) return;\n\t\tif (opts?.name) Inspector._names.set(node, opts.name);\n\t\tif (opts?.kind) Inspector._kinds.set(node, opts.kind);\n\n\t\t// Compute unique key\n\t\tconst id = Inspector._nextId++;\n\t\tlet key = opts?.name;\n\t\tif (key && !Inspector._usedKeys.has(key)) {\n\t\t\t// Unique name — use as-is\n\t\t} else if (key) {\n\t\t\t// Name collision — differentiate with dep names or ID\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${key}(${depSuffix})` : `${key}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t} else {\n\t\t\t// Unnamed — use kind + dep names or ID\n\t\t\tconst kind = opts?.kind ?? \"store\";\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${kind}(${depSuffix})` : `${kind}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t}\n\n\t\tInspector._usedKeys.add(key);\n\t\tInspector._keys.set(node, key);\n\t\tInspector._stores.add(new WeakRef(node));\n\t}\n\n\t/** Register a dependency edge between parent and child nodes */\n\tstatic registerEdge(parent: object, child: object): void {\n\t\tif (!Inspector.enabled) return;\n\t\tconst parentKey = Inspector._resolveKey(parent);\n\t\tconst childKey = Inspector._resolveKey(child);\n\t\tconst children = Inspector._edges.get(parentKey);\n\t\tif (children) {\n\t\t\tif (!children.includes(childKey)) children.push(childKey);\n\t\t} else {\n\t\t\tInspector._edges.set(parentKey, [childKey]);\n\t\t}\n\t}\n\n\t/** Get dependency edges: parent → children */\n\tstatic getEdges(): Map<string, string[]> {\n\t\treturn new Map(Inspector._edges);\n\t}\n\n\t/** Get the name of a node */\n\tstatic getName(node: object): string | undefined {\n\t\tif (!Inspector.enabled) return undefined;\n\t\treturn Inspector._names.get(node);\n\t}\n\n\t/** Get the kind of a node */\n\tstatic getKind(node: object): string | undefined {\n\t\treturn Inspector._kinds.get(node);\n\t}\n\n\t/** Inspect a single graph node — includes status and value (if available) */\n\tstatic inspect<T = unknown>(node: object): StoreInfo<T> {\n\t\treturn {\n\t\t\tname: Inspector._names.get(node),\n\t\t\tkind: Inspector._kinds.get(node) ?? \"unknown\",\n\t\t\tvalue: (typeof (node as any).get === \"function\" ? (node as any).get() : undefined) as T,\n\t\t\tstatus: (node as any)._status,\n\t\t};\n\t}\n\n\t/** Get all living nodes as a Map. Also prunes dead edges from GC'd nodes. */\n\tstatic graph(): Map<string, StoreInfo> {\n\t\tconst result = new Map<string, StoreInfo>();\n\t\tconst livingKeys = new Set<string>();\n\t\tfor (const ref of Inspector._stores) {\n\t\t\tconst node = ref.deref();\n\t\t\tif (!node) {\n\t\t\t\tInspector._stores.delete(ref); // cleanup GC'd refs\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = Inspector._resolveKey(node);\n\t\t\tlivingKeys.add(key);\n\t\t\tresult.set(key, Inspector.inspect(node));\n\t\t}\n\t\t// Prune edges referencing GC'd stores\n\t\tfor (const [key, children] of Inspector._edges) {\n\t\t\tif (!livingKeys.has(key)) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t\tInspector._usedKeys.delete(key);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst alive = children.filter((c) => livingKeys.has(c));\n\t\t\tif (alive.length === 0) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t} else if (alive.length !== children.length) {\n\t\t\t\tInspector._edges.set(key, alive);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Trace a specific store's value changes (raw callbag — no extra/ dependency) */\n\tstatic trace<T>(store: Store<T>, cb: (value: T, prev: T | undefined) => void): () => void {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tlet prev: T | undefined = store.get();\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) talkback = data;\n\t\t\tif (type === END) {\n\t\t\t\ttalkback = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === 1) {\n\t\t\t\tconst next = data as T;\n\t\t\t\tif (!Object.is(next, prev)) {\n\t\t\t\t\tconst p = prev;\n\t\t\t\t\tprev = next;\n\t\t\t\t\tcb(next, p);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn () => talkback?.(END);\n\t}\n\n\t/** Pretty-print the entire store graph for console/CLI debugging */\n\tstatic dumpGraph(): string {\n\t\tconst g = Inspector.graph();\n\t\tconst edges = Inspector.getEdges();\n\n\t\t// Build reverse map: child key → parent keys (deps)\n\t\tconst depsMap = new Map<string, string[]>();\n\t\tfor (const [parent, children] of edges) {\n\t\t\tfor (const child of children) {\n\t\t\t\tconst deps = depsMap.get(child);\n\t\t\t\tif (deps) {\n\t\t\t\t\tif (!deps.includes(parent)) deps.push(parent);\n\t\t\t\t} else {\n\t\t\t\t\tdepsMap.set(child, [parent]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines: string[] = [];\n\t\tfor (const [key, info] of g) {\n\t\t\tconst deps = depsMap.get(key);\n\t\t\tconst children = edges.get(key);\n\t\t\tconst depsStr = deps?.length ? ` ← [${deps.join(\", \")}]` : \"\";\n\t\t\tconst childStr = children?.length ? ` → [${children.join(\", \")}]` : \"\";\n\t\t\tlines.push(\n\t\t\t\t` ${key} (${info.kind}) = ${JSON.stringify(info.value)} [${info.status ?? \"?\"}]${depsStr}${childStr}`,\n\t\t\t);\n\t\t}\n\t\tconst header = `Store Graph (${g.size} nodes):`;\n\t\treturn [header, ...lines].join(\"\\n\");\n\t}\n\n\t/**\n\t * Internal observe implementation shared by observe() and spy().\n\t */\n\tprivate static _observe<T>(\n\t\tstore: Store<T>,\n\t\tlabel?: string,\n\t\tlog?: (...args: any[]) => void,\n\t): ObserveResult<T> {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tconst name = label ?? Inspector.getName(store);\n\t\tconst result: ObserveResult<T> = {\n\t\t\tvalues: [],\n\t\t\tsignals: [],\n\t\t\tevents: [],\n\t\t\tended: false,\n\t\t\tendError: undefined,\n\t\t\tdirtyCount: 0,\n\t\t\tresolvedCount: 0,\n\t\t\tname,\n\t\t\tdispose: () => talkback?.(END),\n\t\t};\n\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) {\n\t\t\t\ttalkback = data;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === DATA) {\n\t\t\t\tresult.values.push(data);\n\t\t\t\tresult.events.push({ type: \"data\", data });\n\t\t\t\tif (log) log(`[${name}] DATA:`, data);\n\t\t\t} else if (type === STATE) {\n\t\t\t\tresult.signals.push(data);\n\t\t\t\tresult.events.push({ type: \"signal\", data });\n\t\t\t\tif (data === DIRTY) result.dirtyCount++;\n\t\t\t\telse if (data === RESOLVED) result.resolvedCount++;\n\t\t\t\tif (log) log(`[${name}] STATE:`, data);\n\t\t\t} else if (type === END) {\n\t\t\t\tresult.ended = true;\n\t\t\t\tresult.endError = data;\n\t\t\t\tresult.events.push({ type: \"end\", data });\n\t\t\t\tif (log) log(`[${name}] END`, data !== undefined ? data : \"\");\n\t\t\t\ttalkback = null;\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Observe a store's full callbag protocol — the test-friendly alternative\n\t * to hooks. Captures DATA values, STATE signals, END, and provides\n\t * convenience accessors.\n\t *\n\t * Returns a live observation object — arrays grow as the store emits.\n\t *\n\t * ```ts\n\t * const obs = Inspector.observe(myStore);\n\t * myState.set(5);\n\t * obs.values // [5]\n\t * obs.signals // [DIRTY]\n\t * obs.ended // false\n\t * obs.dirtyCount // 1\n\t * obs.dispose() // stop observing\n\t * ```\n\t */\n\tstatic observe<T>(store: Store<T>): ObserveResult<T> {\n\t\treturn Inspector._observe(store);\n\t}\n\n\t/**\n\t * Create a transparent passthrough wrapper for graph visualization.\n\t * The wrapper delegates `get()` and `source()` to the original store,\n\t * appearing as a distinct node in the Inspector graph. Zero overhead —\n\t * subscribers connect directly to the original store's source.\n\t */\n\tstatic tap<T>(store: Store<T>, name?: string): Store<T> {\n\t\tconst tapName = name ?? `tap(${Inspector.getName(store) ?? \"anon\"})`;\n\t\tconst wrapper: Store<T> = {\n\t\t\tget: () => store.get(),\n\t\t\tsource: store.source,\n\t\t};\n\t\tInspector.register(wrapper, { name: tapName, kind: \"tap\" });\n\t\tInspector.registerEdge(store, wrapper);\n\t\treturn wrapper;\n\t}\n\n\t/**\n\t * Enhanced observe() with logging — for interactive debugging.\n\t * Returns the same observation object as observe(), but also logs each\n\t * event as it happens. Pass a custom logger or defaults to console.log.\n\t */\n\tstatic spy<T>(\n\t\tstore: Store<T>,\n\t\topts?: { name?: string; log?: (...args: any[]) => void },\n\t): ObserveResult<T> {\n\t\tconst label = opts?.name ?? Inspector.getName(store) ?? \"spy\";\n\t\tconst log = opts?.log ?? console.log;\n\t\treturn Inspector._observe(store, label, log);\n\t}\n\n\t/**\n\t * JSON-serializable snapshot of the entire graph — nodes + edges.\n\t * Designed for AI consumption during debugging sessions.\n\t */\n\tstatic snapshot(): {\n\t\tnodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }>;\n\t\tedges: Array<{ from: string; to: string }>;\n\t} {\n\t\tconst g = Inspector.graph();\n\t\tconst edgeMap = Inspector.getEdges();\n\t\tconst nodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }> =\n\t\t\t[];\n\t\tfor (const [key, info] of g) {\n\t\t\tnodes.push({ name: key, kind: info.kind, value: info.value, status: info.status });\n\t\t}\n\t\tconst edges: Array<{ from: string; to: string }> = [];\n\t\tfor (const [parent, children] of edgeMap) {\n\t\t\tfor (const child of children) {\n\t\t\t\tedges.push({ from: parent, to: child });\n\t\t\t}\n\t\t}\n\t\treturn { nodes, edges };\n\t}\n\n\t/** Reset all state (for testing) */\n\tstatic _reset(): void {\n\t\tInspector._names = new WeakMap<object, string>();\n\t\tInspector._kinds = new WeakMap<object, string>();\n\t\tInspector._keys = new WeakMap<object, string>();\n\t\tInspector._stores = new Set<WeakRef<object>>();\n\t\tInspector._edges = new Map();\n\t\tInspector._usedKeys = new Set();\n\t\tInspector._nextId = 0;\n\t\tInspector._explicitEnabled = null;\n\t\tInspector._cachedDefault = null;\n\t}\n}\n","/**\n * General-purpose source primitive. Can emit values, send control signals,\n * complete, and error. Lazy start on first sink, auto-cleanup on last\n * sink disconnect.\n *\n * Stateful: maintains currentValue. get() returns currentValue (or\n * getter(currentValue) when getter option is provided).\n *\n * v4: Output slot model replaces _sinks Set. _output is null (no sinks),\n * a function (single sink — P0 optimization), or a Set (multi sink).\n * _status tracks node lifecycle. autoDirty (default true) sends DIRTY on\n * type 3 before each type 1 DATA. equals option guards emit();\n * resetOnTeardown resets value on stop.\n *\n * v5: _status packed into _flags bits 7-9 for hot-path performance.\n * String status exposed via getter for Inspector/test backward compat.\n *\n * Class-based for V8 hidden class optimization and prototype method sharing.\n * Boolean fields packed into _flags bitmask to reduce hidden class size.\n */\n\nimport { Inspector } from \"./inspector\";\nimport type { Signal } from \"./protocol\";\nimport {\n\tDATA,\n\tDIRTY,\n\tdecodeStatus,\n\tdeferEmission,\n\tdeferStart,\n\tEND,\n\tisBatching,\n\tRESOLVED,\n\tS_COMPLETED,\n\tS_DIRTY,\n\tS_DISCONNECTED,\n\tS_ERRORED,\n\tS_RESOLVED,\n\tS_SETTLED,\n\tSTART,\n\tSTATE,\n\tSTATUS_MASK,\n\tSTATUS_SHIFT,\n} from \"./protocol\";\nimport type { ProducerStore, SourceOptions, Store } from \"./types\";\n\nexport type ProducerFn<T> = (actions: {\n\temit: (value: T) => void;\n\tsignal: (s: Signal) => void;\n\tcomplete: () => void;\n\terror: (e: unknown) => void;\n}) => (() => void) | undefined;\n\nexport type ProducerOpts<T> = SourceOptions<T> & {\n\tautoDirty?: boolean;\n\t_skipInspect?: boolean;\n};\n\n// Flag bits for _flags bitmask (bits 0-6)\nconst P_STARTED = 1;\nconst P_MULTI = 64;\n\n// Exported for subclass fast paths (StateImpl)\nexport const P_COMPLETED = 2;\nexport const P_AUTO_DIRTY = 4;\nconst P_RESET = 8;\nconst P_RESUB = 16;\nexport const P_PENDING = 32;\n\n// Status bits (bits 7-9) — exported for StateImpl fast path\nexport const _STATUS_MASK = STATUS_MASK;\nexport const _S_DIRTY = S_DIRTY << STATUS_SHIFT;\nexport const _S_SETTLED = S_SETTLED << STATUS_SHIFT;\nexport const _S_DISCONNECTED = S_DISCONNECTED << STATUS_SHIFT;\nexport const _S_COMPLETED = S_COMPLETED << STATUS_SHIFT;\nexport const _S_ERRORED = S_ERRORED << STATUS_SHIFT;\nexport const _S_RESOLVED = S_RESOLVED << STATUS_SHIFT;\n\nexport class ProducerImpl<T> {\n\t_value: T | undefined;\n\t_output: ((type: number, data?: any) => void) | Set<any> | null = null;\n\t_flags: number;\n\n\tget _status() {\n\t\treturn decodeStatus(this._flags);\n\t}\n\t_cleanup: (() => void) | undefined;\n\t_fn: ProducerFn<T> | undefined;\n\t_eqFn: ((a: T, b: T) => boolean) | undefined;\n\t_getterFn: ((cached: T | undefined) => T) | undefined;\n\t_initial: T | undefined;\n\n\tconstructor(fn?: ProducerFn<T>, opts?: ProducerOpts<T>) {\n\t\tthis._value = opts?.initial;\n\t\tthis._fn = fn;\n\t\tthis._eqFn = opts?.equals;\n\t\tthis._getterFn = opts?.getter;\n\t\tthis._initial = opts?.initial;\n\n\t\tlet flags = 0;\n\t\tif (opts?.autoDirty !== false) flags |= P_AUTO_DIRTY;\n\t\tif (opts?.resetOnTeardown) flags |= P_RESET;\n\t\tif (opts?.resubscribable) flags |= P_RESUB;\n\t\t// S_DISCONNECTED = 0, so no need to set status bits\n\t\tthis._flags = flags;\n\n\t\t// Bind public API methods so they work when detached (callbag interop,\n\t\t// destructuring, etc.). Replaces per-instance closure functions.\n\t\tthis.source = this.source.bind(this);\n\t\tthis.emit = this.emit.bind(this);\n\t\tthis.signal = this.signal.bind(this);\n\t\tthis.complete = this.complete.bind(this);\n\t\tthis.error = this.error.bind(this);\n\n\t\tif (!opts?._skipInspect) Inspector.register(this as any, { kind: \"producer\", ...opts });\n\t}\n\n\tget(): T | undefined {\n\t\treturn this._getterFn ? this._getterFn(this._value) : this._value;\n\t}\n\n\t/**\n\t * Dispatch a signal to all current subscribers via the output slot.\n\t *\n\t * Safety: P_MULTI flag and _output type are always updated together.\n\t * No reentrancy can occur between the two assignments (source() doesn't\n\t * trigger dispatch, and dispatch doesn't trigger source()). The null-check\n\t * provides an additional guard for the MULTI→null transition path.\n\t */\n\t_dispatch(type: number, data?: any): void {\n\t\tconst output = this._output;\n\t\tif (!output) return;\n\t\tif (this._flags & P_MULTI) {\n\t\t\tfor (const sink of output as Set<any>) sink(type, data);\n\t\t} else {\n\t\t\t(output as (type: number, data?: any) => void)(type, data);\n\t\t}\n\t}\n\n\temit(value: T): void {\n\t\tif (this._flags & P_COMPLETED) return;\n\t\tif (this._eqFn && this._value !== undefined && this._eqFn(this._value as T, value)) return;\n\t\tthis._value = value;\n\t\tif (!this._output) return;\n\t\tif (isBatching()) {\n\t\t\tif (!(this._flags & P_PENDING)) {\n\t\t\t\tthis._flags |= P_PENDING;\n\t\t\t\tif (this._flags & P_AUTO_DIRTY) {\n\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\t\t\t\tthis._dispatch(STATE, DIRTY);\n\t\t\t\t}\n\t\t\t\tdeferEmission(() => {\n\t\t\t\t\tthis._flags &= ~P_PENDING;\n\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_SETTLED;\n\t\t\t\t\tthis._dispatch(DATA, this._value);\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tif (this._flags & P_AUTO_DIRTY) {\n\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\t\t\tthis._dispatch(STATE, DIRTY);\n\t\t\t}\n\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_SETTLED;\n\t\t\tthis._dispatch(DATA, this._value);\n\t\t}\n\t}\n\n\tsignal(s: Signal): void {\n\t\tif (this._flags & P_COMPLETED || !this._output) return;\n\t\tif (s === DIRTY) this._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\telse if (s === RESOLVED) this._flags = (this._flags & ~_STATUS_MASK) | _S_RESOLVED;\n\t\t// Unknown signals: dispatch without _status change (v4 forward-compat)\n\t\tthis._dispatch(STATE, s);\n\t}\n\n\tcomplete(): void {\n\t\tif (this._flags & P_COMPLETED) return;\n\t\tthis._flags = ((this._flags | P_COMPLETED) & ~_STATUS_MASK) | _S_COMPLETED;\n\t\tconst output = this._output;\n\t\tconst wasMulti = this._flags & P_MULTI;\n\t\tthis._output = null;\n\t\tthis._flags &= ~P_MULTI;\n\t\tthis._stop();\n\t\tif (output) {\n\t\t\tif (wasMulti) {\n\t\t\t\tfor (const sink of output as Set<any>) sink(END);\n\t\t\t} else {\n\t\t\t\t(output as (type: number, data?: any) => void)(END);\n\t\t\t}\n\t\t}\n\t}\n\n\terror(e: unknown): void {\n\t\tif (this._flags & P_COMPLETED) return;\n\t\tthis._flags = ((this._flags | P_COMPLETED) & ~_STATUS_MASK) | _S_ERRORED;\n\t\tconst output = this._output;\n\t\tconst wasMulti = this._flags & P_MULTI;\n\t\tthis._output = null;\n\t\tthis._flags &= ~P_MULTI;\n\t\tthis._stop();\n\t\tif (output) {\n\t\t\tif (wasMulti) {\n\t\t\t\tfor (const sink of output as Set<any>) sink(END, e);\n\t\t\t} else {\n\t\t\t\t(output as (type: number, data?: any) => void)(END, e);\n\t\t\t}\n\t\t}\n\t}\n\n\t_start(): void {\n\t\tif (this._flags & P_STARTED || !this._fn) return;\n\t\tthis._flags |= P_STARTED;\n\t\tconst result = this._fn(this as any);\n\t\tthis._cleanup = typeof result === \"function\" ? result : undefined;\n\t}\n\n\t_stop(): void {\n\t\tif (!(this._flags & P_STARTED)) return;\n\t\tthis._flags &= ~P_STARTED;\n\t\tif (this._cleanup) this._cleanup();\n\t\tthis._cleanup = undefined;\n\t\tif (this._flags & P_RESET) this._value = this._initial;\n\t\tif (!(this._flags & P_COMPLETED)) this._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t}\n\n\tsource(type: number, payload?: any): void {\n\t\tif (type === START) {\n\t\t\tconst sink = payload;\n\t\t\tif (this._flags & P_COMPLETED) {\n\t\t\t\tif (this._flags & P_RESUB && this._output === null) {\n\t\t\t\t\tthis._flags = (this._flags & ~(P_COMPLETED | _STATUS_MASK)) | _S_DISCONNECTED;\n\t\t\t\t} else {\n\t\t\t\t\tsink(START, (_t: number) => {});\n\t\t\t\t\tsink(END);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._output === null) {\n\t\t\t\tthis._output = sink;\n\t\t\t} else if (!(this._flags & P_MULTI)) {\n\t\t\t\tconst set = new Set<any>();\n\t\t\t\tset.add(this._output);\n\t\t\t\tset.add(sink);\n\t\t\t\tthis._output = set;\n\t\t\t\tthis._flags |= P_MULTI;\n\t\t\t} else {\n\t\t\t\t(this._output as Set<any>).add(sink);\n\t\t\t}\n\t\t\tsink(START, (t: number) => {\n\t\t\t\tif (t === DATA) sink(DATA, this._value);\n\t\t\t\tif (t === END) {\n\t\t\t\t\tif (this._output === null) return;\n\t\t\t\t\tif (this._flags & P_MULTI) {\n\t\t\t\t\t\tconst set = this._output as Set<any>;\n\t\t\t\t\t\tset.delete(sink);\n\t\t\t\t\t\tif (set.size === 1) {\n\t\t\t\t\t\t\tthis._output = set.values().next().value;\n\t\t\t\t\t\t\tthis._flags &= ~P_MULTI;\n\t\t\t\t\t\t} else if (set.size === 0) {\n\t\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\t\tthis._flags &= ~P_MULTI;\n\t\t\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t\t\t\t\t\t\tthis._stop();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (this._output === sink) {\n\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t\t\t\t\t\tthis._stop();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tdeferStart(() => this._start());\n\t\t}\n\t}\n}\n\nexport function producer<T>(\n\tfn: ProducerFn<T> | undefined,\n\topts: ProducerOpts<T> & { initial: T },\n): ProducerStore<T> & Store<T>;\nexport function producer<T>(fn?: ProducerFn<T>, opts?: ProducerOpts<T>): ProducerStore<T>;\nexport function producer<T>(fn?: ProducerFn<T>, opts?: ProducerOpts<T>): ProducerStore<T> {\n\treturn new ProducerImpl<T>(fn, opts) as any;\n}\n"],"mappings":"mbAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,WAAAE,KAAA,eAAAC,GAAAH,ICQO,IAAMI,EAAQ,OAAO,OAAO,EAGtBC,EAAW,OAAO,UAAU,EAiB5BC,EAAiB,EACjBC,EAAU,EACVC,EAAY,EACZC,EAAa,EACbC,EAAc,EACdC,EAAY,EACZC,EAAe,EACfC,EAAc,GAASD,EAE9BE,GAA+B,CACpC,eACA,QACA,UACA,WACA,YACA,SACD,EAGO,SAASC,EAAaC,EAA2B,CACvD,OAAOF,IAAgBE,EAAQH,KAAiBD,CAAY,CAC7D,CAGO,IAAMK,EAAQ,EACRC,EAAO,EACPC,EAAM,EACNC,EAAQ,EAMjBC,GAAa,EACXC,GAAuC,CAAC,EA6BvC,SAASC,GAAsB,CACrC,OAAOC,GAAa,CACrB,CAEO,SAASC,EAAcC,EAAsB,CACnDC,GAAkB,KAAKD,CAAE,CAC1B,CAMA,IAAIE,GAAe,EACbC,GAAmC,CAAC,EAgBnC,SAASC,EAAWC,EAAyB,CAC/CC,GAAe,EAClBC,GAAc,KAAKF,CAAK,EAExBA,EAAM,CAER,CC7EO,IAAMG,EAAN,MAAMC,CAAU,CAEtB,OAAe,OAAS,IAAI,QAC5B,OAAe,OAAS,IAAI,QAC5B,OAAe,MAAQ,IAAI,QAG3B,OAAe,QAAU,IAAI,IAG7B,OAAe,OAAS,IAAI,IAG5B,OAAe,QAAU,EACzB,OAAe,UAAY,IAAI,IAG/B,OAAe,iBAAmC,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C,EAAiD,KACjDC,EAAc,GACdC,EAA8C,KAC9CC,EAAU,GAEd,SAASC,GAAe,CACvB,GAAID,EAAS,OACTH,IACHA,EAAcK,CAAG,EACjBL,EAAgB,MAEjB,IAAMM,EAAUd,EAAM,IAAI,EAGtBS,GAAeK,IAAY,QAAWX,EAAKW,CAAY,EAC3DL,EAAc,GACdT,EAAM,OAAOe,EAAO,CAACC,EAAcC,IAAkB,CACpD,GAAI,CAAAN,IACAK,IAASD,IAAOP,EAAgBS,GAChCD,IAAS,GAAGb,EAAKc,CAAS,EAC1BD,IAASH,GAEZ,GADAL,EAAgB,KACZS,IAAS,OAIZ,GAFoBX,EAAUT,IAAeE,IAAY,MAAQA,EAAQkB,CAAI,GAG5E,GAAI,CAACnB,EAEJQ,IACAM,EAAa,MACP,CACN,IAAMM,EAAUpB,EAAQQ,EAASW,EAAMV,CAAS,EAChDD,IACIY,IAAY,OAAMX,EAAYW,GAE9BA,IAAY,MAAQA,GAAW,EAE9BA,IAAY,KACfb,EAAMY,CAAI,EAEVL,EAAa,EAIdF,EAAQ,WAAW,IAAM,CACxBA,EAAQ,KACRE,EAAa,CACd,EAAGM,CAAO,CAEZ,MAEAb,EAAMY,CAAI,OAGXb,EAAS,CAGZ,CAAC,CACF,CAEA,OAAAQ,EAAa,EAEN,IAAM,CACZD,EAAU,GACND,IAAU,OACb,aAAaA,CAAK,EAClBA,EAAQ,MAELF,GAAeA,EAAcK,CAAG,CACrC,CACD,EACA,CAAE,QAASb,EAAM,IAAI,CAAE,CACxB,EAEA,OAAAmB,EAAU,SAASlB,EAAO,CAAE,KAAM,OAAQ,CAAC,EACpCA,CACR,CACD","names":["retry_exports","__export","retry","__toCommonJS","DIRTY","RESOLVED","S_DISCONNECTED","S_DIRTY","S_SETTLED","S_RESOLVED","S_COMPLETED","S_ERRORED","STATUS_SHIFT","STATUS_MASK","STATUS_STRINGS","decodeStatus","flags","START","DATA","END","STATE","batchDepth","deferredEmissions","isBatching","batchDepth","deferEmission","fn","deferredEmissions","connectDepth","pendingStarts","deferStart","start","connectDepth","pendingStarts","Inspector","_Inspector","value","deps","joined","d","node","opts","id","key","depSuffix","kind","parent","child","parentKey","childKey","children","result","livingKeys","ref","alive","c","store","cb","talkback","prev","START","type","data","END","next","p","g","edges","depsMap","lines","info","depsStr","childStr","label","log","name","DATA","STATE","DIRTY","RESOLVED","tapName","wrapper","edgeMap","nodes","P_STARTED","P_MULTI","P_COMPLETED","P_AUTO_DIRTY","P_RESET","P_RESUB","P_PENDING","_STATUS_MASK","STATUS_MASK","_S_DIRTY","S_DIRTY","STATUS_SHIFT","_S_SETTLED","S_SETTLED","_S_DISCONNECTED","S_DISCONNECTED","_S_COMPLETED","S_COMPLETED","_S_ERRORED","S_ERRORED","_S_RESOLVED","S_RESOLVED","ProducerImpl","decodeStatus","fn","opts","flags","Inspector","type","data","output","sink","value","isBatching","STATE","DIRTY","deferEmission","DATA","s","RESOLVED","wasMulti","END","result","payload","START","_t","set","t","deferStart","producer","retry","config","opts","maxRetries","delayFn","whileFn","input","store","producer","emit","complete","error","attempt","lastDelay","inputTalkback","initialized","timer","stopped","connectInput","END","initial","START","type","data","delayMs","Inspector"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { a as StoreOperator } from '../types-DsAN6Hga.cjs';
|
|
2
|
+
import { B as BackoffStrategy } from '../backoff-BXsH2Ago.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Re-subscribes to the input source on error (END with error).
|
|
6
|
+
*
|
|
7
|
+
* Overloads:
|
|
8
|
+
* retry(3) — instant retry, up to 3 times (backward-compatible)
|
|
9
|
+
* retry({ count: 5, delay: exp() }) — 5 retries with backoff delay
|
|
10
|
+
* retry({ delay: exp(), while: fn }) — unlimited retries with condition + backoff
|
|
11
|
+
*
|
|
12
|
+
* Stateful: maintains last value via producer. get() returns input's initial
|
|
13
|
+
* value before first emission, then the latest value from the source.
|
|
14
|
+
*
|
|
15
|
+
* v3: Tier 2 — dynamic subscription operator. Each emit starts a new
|
|
16
|
+
* DIRTY+value cycle. No built-in dedup. Uses raw callbag for END
|
|
17
|
+
* detection (error triggers reconnect, clean completion propagates).
|
|
18
|
+
*/
|
|
19
|
+
interface RetryOptions {
|
|
20
|
+
/** Maximum number of retries. Default: Infinity when delay is set. */
|
|
21
|
+
count?: number;
|
|
22
|
+
/** Backoff strategy — returns ms to wait, or null to stop. */
|
|
23
|
+
delay?: BackoffStrategy;
|
|
24
|
+
/** Predicate — retry only if this returns true for the error. */
|
|
25
|
+
while?: (error: unknown) => boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function retry<A>(config: number | RetryOptions): StoreOperator<A, A>;
|
|
28
|
+
|
|
29
|
+
export { type RetryOptions, retry };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { a as StoreOperator } from '../types-DsAN6Hga.js';
|
|
2
|
+
import { B as BackoffStrategy } from '../backoff-BXsH2Ago.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Re-subscribes to the input source on error (END with error).
|
|
6
|
+
*
|
|
7
|
+
* Overloads:
|
|
8
|
+
* retry(3) — instant retry, up to 3 times (backward-compatible)
|
|
9
|
+
* retry({ count: 5, delay: exp() }) — 5 retries with backoff delay
|
|
10
|
+
* retry({ delay: exp(), while: fn }) — unlimited retries with condition + backoff
|
|
11
|
+
*
|
|
12
|
+
* Stateful: maintains last value via producer. get() returns input's initial
|
|
13
|
+
* value before first emission, then the latest value from the source.
|
|
14
|
+
*
|
|
15
|
+
* v3: Tier 2 — dynamic subscription operator. Each emit starts a new
|
|
16
|
+
* DIRTY+value cycle. No built-in dedup. Uses raw callbag for END
|
|
17
|
+
* detection (error triggers reconnect, clean completion propagates).
|
|
18
|
+
*/
|
|
19
|
+
interface RetryOptions {
|
|
20
|
+
/** Maximum number of retries. Default: Infinity when delay is set. */
|
|
21
|
+
count?: number;
|
|
22
|
+
/** Backoff strategy — returns ms to wait, or null to stop. */
|
|
23
|
+
delay?: BackoffStrategy;
|
|
24
|
+
/** Predicate — retry only if this returns true for the error. */
|
|
25
|
+
while?: (error: unknown) => boolean;
|
|
26
|
+
}
|
|
27
|
+
declare function retry<A>(config: number | RetryOptions): StoreOperator<A, A>;
|
|
28
|
+
|
|
29
|
+
export { type RetryOptions, retry };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";var k=Object.defineProperty;var J=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var X=Object.prototype.hasOwnProperty;var Z=(e,t)=>{for(var i in t)k(e,i,{get:t[i],enumerable:!0})},ee=(e,t,i,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Q(t))!X.call(e,n)&&n!==i&&k(e,n,{get:()=>t[n],enumerable:!(s=J(t,n))||s.enumerable});return e};var te=e=>ee(k({},"__esModule",{value:!0}),e);var le={};Z(le,{sample:()=>ue});module.exports=te(le);var T=Symbol("DIRTY"),m=Symbol("RESOLVED"),N=0,P=1,M=2,$=3,j=4,C=5,g=7,R=7<<g,se=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function L(e){return se[(e&R)>>>g]}var f=0,_=1,l=2,S=3,ne=0,ie=[];function K(){return ne>0}function F(e){ie.push(e)}var y=0,E=[];function U(){y++}function V(){if(y--,y===0){for(let e=0;e<E.length;e++)E[e]();E.length=0}}function Y(e){y>0?E.push(e):e()}var v=class e{static _names=new WeakMap;static _kinds=new WeakMap;static _keys=new WeakMap;static _stores=new Set;static _edges=new Map;static _nextId=0;static _usedKeys=new Set;static _explicitEnabled=null;static _cachedDefault=null;static get enabled(){if(e._explicitEnabled!==null)return e._explicitEnabled;if(e._cachedDefault!==null)return e._cachedDefault;try{e._cachedDefault=globalThis.process?.env?.NODE_ENV!=="production"}catch{e._cachedDefault=!0}return e._cachedDefault}static set enabled(t){e._explicitEnabled=t}static _depSuffix(t){if(!t?.length)return;let s=t.map(n=>e._names.get(n)??"?").join(",");return s.length>40?`${s.slice(0,37)}...`:s}static _resolveKey(t){return e._keys.get(t)??e._names.get(t)??"anonymous"}static register(t,i){if(!e.enabled)return;i?.name&&e._names.set(t,i.name),i?.kind&&e._kinds.set(t,i.kind);let s=e._nextId++,n=i?.name;if(!(n&&!e._usedKeys.has(n)))if(n){let r=e._depSuffix(i?.deps);n=r?`${n}(${r})`:`${n}_${s}`,e._usedKeys.has(n)&&(n=`${n}_${s}`)}else{let r=i?.kind??"store",o=e._depSuffix(i?.deps);n=o?`${r}(${o})`:`${r}_${s}`,e._usedKeys.has(n)&&(n=`${n}_${s}`)}e._usedKeys.add(n),e._keys.set(t,n),e._stores.add(new WeakRef(t))}static registerEdge(t,i){if(!e.enabled)return;let s=e._resolveKey(t),n=e._resolveKey(i),r=e._edges.get(s);r?r.includes(n)||r.push(n):e._edges.set(s,[n])}static getEdges(){return new Map(e._edges)}static getName(t){if(e.enabled)return e._names.get(t)}static getKind(t){return e._kinds.get(t)}static inspect(t){return{name:e._names.get(t),kind:e._kinds.get(t)??"unknown",value:typeof t.get=="function"?t.get():void 0,status:t._status}}static graph(){let t=new Map,i=new Set;for(let s of e._stores){let n=s.deref();if(!n){e._stores.delete(s);continue}let r=e._resolveKey(n);i.add(r),t.set(r,e.inspect(n))}for(let[s,n]of e._edges){if(!i.has(s)){e._edges.delete(s),e._usedKeys.delete(s);continue}let r=n.filter(o=>i.has(o));r.length===0?e._edges.delete(s):r.length!==n.length&&e._edges.set(s,r)}return t}static trace(t,i){let s=null,n=t.get();return t.source(f,(r,o)=>{if(r===f&&(s=o),r===l){s=null;return}if(r===1){let u=o;if(!Object.is(u,n)){let a=n;n=u,i(u,a)}}}),()=>s?.(l)}static dumpGraph(){let t=e.graph(),i=e.getEdges(),s=new Map;for(let[o,u]of i)for(let a of u){let d=s.get(a);d?d.includes(o)||d.push(o):s.set(a,[o])}let n=[];for(let[o,u]of t){let a=s.get(o),d=i.get(o),B=a?.length?` \u2190 [${a.join(", ")}]`:"",H=d?.length?` \u2192 [${d.join(", ")}]`:"";n.push(` ${o} (${u.kind}) = ${JSON.stringify(u.value)} [${u.status??"?"}]${B}${H}`)}return[`Store Graph (${t.size} nodes):`,...n].join(`
|
|
2
|
+
`)}static _observe(t,i,s){let n=null,r=i??e.getName(t),o={values:[],signals:[],events:[],ended:!1,endError:void 0,dirtyCount:0,resolvedCount:0,name:r,dispose:()=>n?.(l)};return t.source(f,(u,a)=>{if(u===f){n=a;return}u===_?(o.values.push(a),o.events.push({type:"data",data:a}),s&&s(`[${r}] DATA:`,a)):u===S?(o.signals.push(a),o.events.push({type:"signal",data:a}),a===T?o.dirtyCount++:a===m&&o.resolvedCount++,s&&s(`[${r}] STATE:`,a)):u===l&&(o.ended=!0,o.endError=a,o.events.push({type:"end",data:a}),s&&s(`[${r}] END`,a!==void 0?a:""),n=null)}),o}static observe(t){return e._observe(t)}static tap(t,i){let s=i??`tap(${e.getName(t)??"anon"})`,n={get:()=>t.get(),source:t.source};return e.register(n,{name:s,kind:"tap"}),e.registerEdge(t,n),n}static spy(t,i){let s=i?.name??e.getName(t)??"spy",n=i?.log??console.log;return e._observe(t,s,n)}static snapshot(){let t=e.graph(),i=e.getEdges(),s=[];for(let[r,o]of t)s.push({name:r,kind:o.kind,value:o.value,status:o.status});let n=[];for(let[r,o]of i)for(let u of o)n.push({from:r,to:u});return{nodes:s,edges:n}}static _reset(){e._names=new WeakMap,e._kinds=new WeakMap,e._keys=new WeakMap,e._stores=new Set,e._edges=new Map,e._usedKeys=new Set,e._nextId=0,e._explicitEnabled=null,e._cachedDefault=null}};var b=1,p=64,h=2,O=4,W=8,q=16,A=32,c=R,w=P<<g,G=M<<g,D=N<<g,re=j<<g,oe=C<<g,ae=$<<g,I=class{_value;_output=null;_flags;get _status(){return L(this._flags)}_cleanup;_fn;_eqFn;_getterFn;_initial;constructor(t,i){this._value=i?.initial,this._fn=t,this._eqFn=i?.equals,this._getterFn=i?.getter,this._initial=i?.initial;let s=0;i?.autoDirty!==!1&&(s|=O),i?.resetOnTeardown&&(s|=W),i?.resubscribable&&(s|=q),this._flags=s,this.source=this.source.bind(this),this.emit=this.emit.bind(this),this.signal=this.signal.bind(this),this.complete=this.complete.bind(this),this.error=this.error.bind(this),i?._skipInspect||v.register(this,{kind:"producer",...i})}get(){return this._getterFn?this._getterFn(this._value):this._value}_dispatch(t,i){let s=this._output;if(s)if(this._flags&p)for(let n of s)n(t,i);else s(t,i)}emit(t){this._flags&h||this._eqFn&&this._value!==void 0&&this._eqFn(this._value,t)||(this._value=t,this._output&&(K()?this._flags&A||(this._flags|=A,this._flags&O&&(this._flags=this._flags&~c|w,this._dispatch(S,T)),F(()=>{this._flags&=~A,this._flags=this._flags&~c|G,this._dispatch(_,this._value)})):(this._flags&O&&(this._flags=this._flags&~c|w,this._dispatch(S,T)),this._flags=this._flags&~c|G,this._dispatch(_,this._value))))}signal(t){this._flags&h||!this._output||(t===T?this._flags=this._flags&~c|w:t===m&&(this._flags=this._flags&~c|ae),this._dispatch(S,t))}complete(){if(this._flags&h)return;this._flags=(this._flags|h)&~c|re;let t=this._output,i=this._flags&p;if(this._output=null,this._flags&=~p,this._stop(),t)if(i)for(let s of t)s(l);else t(l)}error(t){if(this._flags&h)return;this._flags=(this._flags|h)&~c|oe;let i=this._output,s=this._flags&p;if(this._output=null,this._flags&=~p,this._stop(),i)if(s)for(let n of i)n(l,t);else i(l,t)}_start(){if(this._flags&b||!this._fn)return;this._flags|=b;let t=this._fn(this);this._cleanup=typeof t=="function"?t:void 0}_stop(){this._flags&b&&(this._flags&=~b,this._cleanup&&this._cleanup(),this._cleanup=void 0,this._flags&W&&(this._value=this._initial),this._flags&h||(this._flags=this._flags&~c|D))}source(t,i){if(t===f){let s=i;if(this._flags&h)if(this._flags&q&&this._output===null)this._flags=this._flags&~(h|c)|D;else{s(f,n=>{}),s(l);return}if(this._output===null)this._output=s;else if(this._flags&p)this._output.add(s);else{let n=new Set;n.add(this._output),n.add(s),this._output=n,this._flags|=p}s(f,n=>{if(n===_&&s(_,this._value),n===l){if(this._output===null)return;if(this._flags&p){let r=this._output;r.delete(s),r.size===1?(this._output=r.values().next().value,this._flags&=~p):r.size===0&&(this._output=null,this._flags&=~p,this._flags=this._flags&~c|D,this._stop())}else this._output===s&&(this._output=null,this._flags=this._flags&~c|D,this._stop())}}),Y(()=>this._start())}}};function z(e,t){return new I(e,t)}function x(e,t,i){let s=null;U(),e.source(f,(r,o)=>{if(r===f&&(s=o),r===l){s=null,i?.onEnd?.(o);return}if(r===1){let u=o,a=n;n=u,t(u,a)}});let n=e.get();return V(),()=>s?.(l)}function ue(e){return t=>{let i=t.get(),s=z(({emit:n,error:r,complete:o})=>{i=t.get();let u=x(t,d=>{i=d},{onEnd:d=>{d!==void 0?r(d):o()}}),a=x(e,()=>{n(i)},{onEnd:d=>{d!==void 0?r(d):o()}});return()=>{u(),a()}},{initial:i,getter:()=>i});return v.register(s,{kind:"sample"}),s}}0&&(module.exports={sample});
|
|
3
|
+
//# sourceMappingURL=sample.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/extra/sample.ts","../../src/core/protocol.ts","../../src/core/inspector.ts","../../src/core/producer.ts","../../src/core/subscribe.ts"],"sourcesContent":["import { Inspector } from \"../core/inspector\";\nimport { producer } from \"../core/producer\";\nimport type { Store, StoreOperator } from \"../core/types\";\nimport { subscribe } from \"./subscribe\";\n\n/**\n * Emits the latest value from the input source whenever the notifier emits.\n *\n * Stateful: maintains latest input value. get() always returns the latest\n * input value (via getter), not just the last sampled emission.\n *\n * v3: Tier 2 — each emit starts a new DIRTY+value cycle (autoDirty: true).\n * No built-in dedup. getter overrides get() to return latest input.\n * Forwards input and notifier completion and errors.\n */\nexport function sample<A>(notifier: Store<unknown>): StoreOperator<A, A> {\n\treturn (input: Store<A>) => {\n\t\tlet latestInput: A = input.get();\n\n\t\tconst store = producer<A>(\n\t\t\t({ emit, error, complete }) => {\n\t\t\t\tlatestInput = input.get();\n\n\t\t\t\tconst inputUnsub = subscribe(\n\t\t\t\t\tinput,\n\t\t\t\t\t(v) => {\n\t\t\t\t\t\tlatestInput = v;\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tonEnd: (err) => {\n\t\t\t\t\t\t\tif (err !== undefined) {\n\t\t\t\t\t\t\t\terror(err);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tconst notifierUnsub = subscribe(\n\t\t\t\t\tnotifier,\n\t\t\t\t\t() => {\n\t\t\t\t\t\temit(latestInput);\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tonEnd: (err) => {\n\t\t\t\t\t\t\tif (err !== undefined) {\n\t\t\t\t\t\t\t\terror(err);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tcomplete();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn () => {\n\t\t\t\t\tinputUnsub();\n\t\t\t\t\tnotifierUnsub();\n\t\t\t\t};\n\t\t\t},\n\t\t\t{\n\t\t\t\tinitial: latestInput,\n\t\t\t\tgetter: () => latestInput,\n\t\t\t},\n\t\t);\n\t\tInspector.register(store, { kind: \"sample\" });\n\t\treturn store;\n\t};\n}\n","// ---------------------------------------------------------------------------\n// Protocol — v3 type 3 control channel\n// ---------------------------------------------------------------------------\n// Type 3 (STATE) carries control signals: DIRTY, RESOLVED\n// Type 1 (DATA) carries only real values — never sentinels\n// ---------------------------------------------------------------------------\n\n/** Control signal: \"my value is about to change\" */\nexport const DIRTY = Symbol(\"DIRTY\");\n\n/** Control signal: \"I was dirty but my value didn't change\" */\nexport const RESOLVED = Symbol(\"RESOLVED\");\n\nexport type Signal = typeof DIRTY | typeof RESOLVED;\n\n/** Node status — tracks current lifecycle state (v4) */\nexport type NodeStatus =\n\t| \"DISCONNECTED\"\n\t| \"DIRTY\"\n\t| \"SETTLED\"\n\t| \"RESOLVED\"\n\t| \"COMPLETED\"\n\t| \"ERRORED\";\n\n// ---------------------------------------------------------------------------\n// Integer status constants — pack into _flags for hot-path performance.\n// 3 bits (7-9) encode 6 statuses. Use STATUS_MASK to read/write.\n// ---------------------------------------------------------------------------\nexport const S_DISCONNECTED = 0;\nexport const S_DIRTY = 1;\nexport const S_SETTLED = 2;\nexport const S_RESOLVED = 3;\nexport const S_COMPLETED = 4;\nexport const S_ERRORED = 5;\nexport const STATUS_SHIFT = 7;\nexport const STATUS_MASK = 0b111 << STATUS_SHIFT; // bits 7-9\n\nconst STATUS_STRINGS: NodeStatus[] = [\n\t\"DISCONNECTED\",\n\t\"DIRTY\",\n\t\"SETTLED\",\n\t\"RESOLVED\",\n\t\"COMPLETED\",\n\t\"ERRORED\",\n];\n\n/** Decode integer status bits back to string (for Inspector / tests) */\nexport function decodeStatus(flags: number): NodeStatus {\n\treturn STATUS_STRINGS[(flags & STATUS_MASK) >>> STATUS_SHIFT];\n}\n\n/** Callbag signal types */\nexport const START = 0;\nexport const DATA = 1;\nexport const END = 2;\nexport const STATE = 3;\n\n// ---------------------------------------------------------------------------\n// Batch — defers type 1 value emissions; type 3 DIRTY propagates immediately\n// ---------------------------------------------------------------------------\n\nlet batchDepth = 0;\nconst deferredEmissions: Array<() => void> = [];\n\n// `draining` prevents re-entrant drain when a nested batch() call ends while\n// the outer drain loop is already running. Without it, the inner batch's\n// finally block would see batchDepth===0 and start a second drain, racing the\n// outer loop — potentially double-processing items or clearing the array mid-\n// iteration. With draining=true, the inner batch skips its drain; any items it\n// pushes are picked up by the outer loop (the `for` condition re-evaluates\n// `deferredEmissions.length` on every iteration, so appends during drain are\n// naturally included in the same pass).\nlet draining = false;\n\nexport function batch<T>(fn: () => T): T {\n\tbatchDepth++;\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tbatchDepth--;\n\t\tif (batchDepth === 0 && !draining) {\n\t\t\tdraining = true;\n\t\t\tfor (let i = 0; i < deferredEmissions.length; i++) {\n\t\t\t\tdeferredEmissions[i]();\n\t\t\t}\n\t\t\tdeferredEmissions.length = 0;\n\t\t\tdraining = false;\n\t\t}\n\t}\n}\n\nexport function isBatching(): boolean {\n\treturn batchDepth > 0;\n}\n\nexport function deferEmission(fn: () => void): void {\n\tdeferredEmissions.push(fn);\n}\n\n// ---------------------------------------------------------------------------\n// Connection batching (producer start deferral) — unchanged from v2\n// ---------------------------------------------------------------------------\n\nlet connectDepth = 0;\nconst pendingStarts: Array<() => void> = [];\n\nexport function beginDeferredStart(): void {\n\tconnectDepth++;\n}\n\nexport function endDeferredStart(): void {\n\tconnectDepth--;\n\tif (connectDepth === 0) {\n\t\tfor (let i = 0; i < pendingStarts.length; i++) {\n\t\t\tpendingStarts[i]();\n\t\t}\n\t\tpendingStarts.length = 0;\n\t}\n}\n\nexport function deferStart(start: () => void): void {\n\tif (connectDepth > 0) {\n\t\tpendingStarts.push(start);\n\t} else {\n\t\tstart();\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// teardown — protocol-level graph destruction\n// ---------------------------------------------------------------------------\n// Sends END to all downstream sinks of a store node, cascading through the\n// entire subgraph. After teardown, the node is in COMPLETED state and won't\n// accept new values or subscriptions.\n//\n// Works with any node that uses the output slot model:\n// - ProducerImpl / StateImpl / OperatorImpl → calls .complete()\n// - DerivedImpl → calls ._handleEnd() (no public complete() on derived)\n// ---------------------------------------------------------------------------\n\nexport function teardown(store: { source: (type: number, payload?: any) => void }): void {\n\tconst node = store as any;\n\tif (typeof node.complete === \"function\") {\n\t\tnode.complete();\n\t} else if (typeof node._handleEnd === \"function\") {\n\t\tnode._handleEnd(undefined);\n\t}\n}\n","// ---------------------------------------------------------------------------\n// Inspector — static class for observability\n// ---------------------------------------------------------------------------\n// All debug metadata lives here in WeakMaps, not on the store objects.\n// Stores stay lean. Inspector is opt-in overhead.\n//\n// v5: Zero intrusion into primitives. No hooks in hot paths. All methods\n// are static — call directly as Inspector.observe(), Inspector.tap(), etc.\n// - register/registerEdge: metadata collection (called from constructors)\n// - inspect/graph/dumpGraph/snapshot: read-only graph queries\n// - observe/spy/trace: callbag sinks for debugging (subscribe externally)\n// - tap: transparent passthrough wrapper for graph visualization\n// ---------------------------------------------------------------------------\n\nimport type { NodeStatus, Signal } from \"./protocol\";\nimport { DATA, DIRTY, END, RESOLVED, START, STATE } from \"./protocol\";\nimport type { Store } from \"./types\";\n\nexport interface StoreInfo<T = unknown> {\n\tname: string | undefined;\n\tkind: string;\n\tvalue: T;\n\t/** v4: node lifecycle status */\n\tstatus: NodeStatus | undefined;\n}\n\nexport interface ObserveResult<T> {\n\t/** All DATA (type 1) values received, in order */\n\tvalues: T[];\n\t/** All STATE (type 3) payloads received (DIRTY, RESOLVED, or unknown) */\n\tsignals: Signal[];\n\t/** All events in protocol order: { type, data } */\n\tevents: Array<{ type: \"data\" | \"signal\" | \"end\"; data: unknown }>;\n\t/** Whether END (type 2) has been received */\n\tended: boolean;\n\t/** Error payload from END, if any */\n\tendError: unknown;\n\t/** Count of DIRTY signals received */\n\tdirtyCount: number;\n\t/** Count of RESOLVED signals received */\n\tresolvedCount: number;\n\t/** Store name (from Inspector, if registered) */\n\tname: string | undefined;\n\t/** Disconnect the observer */\n\tdispose: () => void;\n}\n\n// Static-only class is intentional API for Inspector namespace\n// biome-ignore lint/complexity/noStaticOnlyClass: public API surface\nexport class Inspector {\n\t// WeakMaps for metadata — keyed by any graph node (stores, effects, etc.)\n\tprivate static _names = new WeakMap<object, string>();\n\tprivate static _kinds = new WeakMap<object, string>();\n\tprivate static _keys = new WeakMap<object, string>();\n\n\t// WeakRef set for graph() — allows GC of unused nodes\n\tprivate static _stores = new Set<WeakRef<object>>();\n\n\t// Dependency edges: parent key → child keys\n\tprivate static _edges = new Map<string, string[]>();\n\n\t// Unique key generation\n\tprivate static _nextId = 0;\n\tprivate static _usedKeys = new Set<string>();\n\n\t// Enabled flag — when false, register/getName are no-ops\n\tprivate static _explicitEnabled: boolean | null = null;\n\tprivate static _cachedDefault: boolean | null = null;\n\n\tstatic get enabled(): boolean {\n\t\tif (Inspector._explicitEnabled !== null) return Inspector._explicitEnabled;\n\t\tif (Inspector._cachedDefault !== null) return Inspector._cachedDefault;\n\t\ttry {\n\t\t\tInspector._cachedDefault = (globalThis as any).process?.env?.NODE_ENV !== \"production\";\n\t\t} catch {\n\t\t\tInspector._cachedDefault = true;\n\t\t}\n\t\treturn Inspector._cachedDefault;\n\t}\n\n\tstatic set enabled(value: boolean) {\n\t\tInspector._explicitEnabled = value;\n\t}\n\n\t/** Compute a dep-name-based suffix for unique key generation */\n\tprivate static _depSuffix(deps?: object[]): string | undefined {\n\t\tif (!deps?.length) return undefined;\n\t\tconst names = deps.map((d) => Inspector._names.get(d) ?? \"?\");\n\t\tconst joined = names.join(\",\");\n\t\treturn joined.length > 40 ? `${joined.slice(0, 37)}...` : joined;\n\t}\n\n\t/** Resolve a node to its unique graph key */\n\tprivate static _resolveKey(node: object): string {\n\t\treturn Inspector._keys.get(node) ?? Inspector._names.get(node) ?? \"anonymous\";\n\t}\n\n\t/** Register a graph node (store, effect, etc.) with the inspector */\n\tstatic register(node: object, opts?: { name?: string; kind?: string; deps?: object[] }): void {\n\t\tif (!Inspector.enabled) return;\n\t\tif (opts?.name) Inspector._names.set(node, opts.name);\n\t\tif (opts?.kind) Inspector._kinds.set(node, opts.kind);\n\n\t\t// Compute unique key\n\t\tconst id = Inspector._nextId++;\n\t\tlet key = opts?.name;\n\t\tif (key && !Inspector._usedKeys.has(key)) {\n\t\t\t// Unique name — use as-is\n\t\t} else if (key) {\n\t\t\t// Name collision — differentiate with dep names or ID\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${key}(${depSuffix})` : `${key}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t} else {\n\t\t\t// Unnamed — use kind + dep names or ID\n\t\t\tconst kind = opts?.kind ?? \"store\";\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${kind}(${depSuffix})` : `${kind}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t}\n\n\t\tInspector._usedKeys.add(key);\n\t\tInspector._keys.set(node, key);\n\t\tInspector._stores.add(new WeakRef(node));\n\t}\n\n\t/** Register a dependency edge between parent and child nodes */\n\tstatic registerEdge(parent: object, child: object): void {\n\t\tif (!Inspector.enabled) return;\n\t\tconst parentKey = Inspector._resolveKey(parent);\n\t\tconst childKey = Inspector._resolveKey(child);\n\t\tconst children = Inspector._edges.get(parentKey);\n\t\tif (children) {\n\t\t\tif (!children.includes(childKey)) children.push(childKey);\n\t\t} else {\n\t\t\tInspector._edges.set(parentKey, [childKey]);\n\t\t}\n\t}\n\n\t/** Get dependency edges: parent → children */\n\tstatic getEdges(): Map<string, string[]> {\n\t\treturn new Map(Inspector._edges);\n\t}\n\n\t/** Get the name of a node */\n\tstatic getName(node: object): string | undefined {\n\t\tif (!Inspector.enabled) return undefined;\n\t\treturn Inspector._names.get(node);\n\t}\n\n\t/** Get the kind of a node */\n\tstatic getKind(node: object): string | undefined {\n\t\treturn Inspector._kinds.get(node);\n\t}\n\n\t/** Inspect a single graph node — includes status and value (if available) */\n\tstatic inspect<T = unknown>(node: object): StoreInfo<T> {\n\t\treturn {\n\t\t\tname: Inspector._names.get(node),\n\t\t\tkind: Inspector._kinds.get(node) ?? \"unknown\",\n\t\t\tvalue: (typeof (node as any).get === \"function\" ? (node as any).get() : undefined) as T,\n\t\t\tstatus: (node as any)._status,\n\t\t};\n\t}\n\n\t/** Get all living nodes as a Map. Also prunes dead edges from GC'd nodes. */\n\tstatic graph(): Map<string, StoreInfo> {\n\t\tconst result = new Map<string, StoreInfo>();\n\t\tconst livingKeys = new Set<string>();\n\t\tfor (const ref of Inspector._stores) {\n\t\t\tconst node = ref.deref();\n\t\t\tif (!node) {\n\t\t\t\tInspector._stores.delete(ref); // cleanup GC'd refs\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = Inspector._resolveKey(node);\n\t\t\tlivingKeys.add(key);\n\t\t\tresult.set(key, Inspector.inspect(node));\n\t\t}\n\t\t// Prune edges referencing GC'd stores\n\t\tfor (const [key, children] of Inspector._edges) {\n\t\t\tif (!livingKeys.has(key)) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t\tInspector._usedKeys.delete(key);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst alive = children.filter((c) => livingKeys.has(c));\n\t\t\tif (alive.length === 0) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t} else if (alive.length !== children.length) {\n\t\t\t\tInspector._edges.set(key, alive);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Trace a specific store's value changes (raw callbag — no extra/ dependency) */\n\tstatic trace<T>(store: Store<T>, cb: (value: T, prev: T | undefined) => void): () => void {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tlet prev: T | undefined = store.get();\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) talkback = data;\n\t\t\tif (type === END) {\n\t\t\t\ttalkback = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === 1) {\n\t\t\t\tconst next = data as T;\n\t\t\t\tif (!Object.is(next, prev)) {\n\t\t\t\t\tconst p = prev;\n\t\t\t\t\tprev = next;\n\t\t\t\t\tcb(next, p);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn () => talkback?.(END);\n\t}\n\n\t/** Pretty-print the entire store graph for console/CLI debugging */\n\tstatic dumpGraph(): string {\n\t\tconst g = Inspector.graph();\n\t\tconst edges = Inspector.getEdges();\n\n\t\t// Build reverse map: child key → parent keys (deps)\n\t\tconst depsMap = new Map<string, string[]>();\n\t\tfor (const [parent, children] of edges) {\n\t\t\tfor (const child of children) {\n\t\t\t\tconst deps = depsMap.get(child);\n\t\t\t\tif (deps) {\n\t\t\t\t\tif (!deps.includes(parent)) deps.push(parent);\n\t\t\t\t} else {\n\t\t\t\t\tdepsMap.set(child, [parent]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines: string[] = [];\n\t\tfor (const [key, info] of g) {\n\t\t\tconst deps = depsMap.get(key);\n\t\t\tconst children = edges.get(key);\n\t\t\tconst depsStr = deps?.length ? ` ← [${deps.join(\", \")}]` : \"\";\n\t\t\tconst childStr = children?.length ? ` → [${children.join(\", \")}]` : \"\";\n\t\t\tlines.push(\n\t\t\t\t` ${key} (${info.kind}) = ${JSON.stringify(info.value)} [${info.status ?? \"?\"}]${depsStr}${childStr}`,\n\t\t\t);\n\t\t}\n\t\tconst header = `Store Graph (${g.size} nodes):`;\n\t\treturn [header, ...lines].join(\"\\n\");\n\t}\n\n\t/**\n\t * Internal observe implementation shared by observe() and spy().\n\t */\n\tprivate static _observe<T>(\n\t\tstore: Store<T>,\n\t\tlabel?: string,\n\t\tlog?: (...args: any[]) => void,\n\t): ObserveResult<T> {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tconst name = label ?? Inspector.getName(store);\n\t\tconst result: ObserveResult<T> = {\n\t\t\tvalues: [],\n\t\t\tsignals: [],\n\t\t\tevents: [],\n\t\t\tended: false,\n\t\t\tendError: undefined,\n\t\t\tdirtyCount: 0,\n\t\t\tresolvedCount: 0,\n\t\t\tname,\n\t\t\tdispose: () => talkback?.(END),\n\t\t};\n\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) {\n\t\t\t\ttalkback = data;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === DATA) {\n\t\t\t\tresult.values.push(data);\n\t\t\t\tresult.events.push({ type: \"data\", data });\n\t\t\t\tif (log) log(`[${name}] DATA:`, data);\n\t\t\t} else if (type === STATE) {\n\t\t\t\tresult.signals.push(data);\n\t\t\t\tresult.events.push({ type: \"signal\", data });\n\t\t\t\tif (data === DIRTY) result.dirtyCount++;\n\t\t\t\telse if (data === RESOLVED) result.resolvedCount++;\n\t\t\t\tif (log) log(`[${name}] STATE:`, data);\n\t\t\t} else if (type === END) {\n\t\t\t\tresult.ended = true;\n\t\t\t\tresult.endError = data;\n\t\t\t\tresult.events.push({ type: \"end\", data });\n\t\t\t\tif (log) log(`[${name}] END`, data !== undefined ? data : \"\");\n\t\t\t\ttalkback = null;\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Observe a store's full callbag protocol — the test-friendly alternative\n\t * to hooks. Captures DATA values, STATE signals, END, and provides\n\t * convenience accessors.\n\t *\n\t * Returns a live observation object — arrays grow as the store emits.\n\t *\n\t * ```ts\n\t * const obs = Inspector.observe(myStore);\n\t * myState.set(5);\n\t * obs.values // [5]\n\t * obs.signals // [DIRTY]\n\t * obs.ended // false\n\t * obs.dirtyCount // 1\n\t * obs.dispose() // stop observing\n\t * ```\n\t */\n\tstatic observe<T>(store: Store<T>): ObserveResult<T> {\n\t\treturn Inspector._observe(store);\n\t}\n\n\t/**\n\t * Create a transparent passthrough wrapper for graph visualization.\n\t * The wrapper delegates `get()` and `source()` to the original store,\n\t * appearing as a distinct node in the Inspector graph. Zero overhead —\n\t * subscribers connect directly to the original store's source.\n\t */\n\tstatic tap<T>(store: Store<T>, name?: string): Store<T> {\n\t\tconst tapName = name ?? `tap(${Inspector.getName(store) ?? \"anon\"})`;\n\t\tconst wrapper: Store<T> = {\n\t\t\tget: () => store.get(),\n\t\t\tsource: store.source,\n\t\t};\n\t\tInspector.register(wrapper, { name: tapName, kind: \"tap\" });\n\t\tInspector.registerEdge(store, wrapper);\n\t\treturn wrapper;\n\t}\n\n\t/**\n\t * Enhanced observe() with logging — for interactive debugging.\n\t * Returns the same observation object as observe(), but also logs each\n\t * event as it happens. Pass a custom logger or defaults to console.log.\n\t */\n\tstatic spy<T>(\n\t\tstore: Store<T>,\n\t\topts?: { name?: string; log?: (...args: any[]) => void },\n\t): ObserveResult<T> {\n\t\tconst label = opts?.name ?? Inspector.getName(store) ?? \"spy\";\n\t\tconst log = opts?.log ?? console.log;\n\t\treturn Inspector._observe(store, label, log);\n\t}\n\n\t/**\n\t * JSON-serializable snapshot of the entire graph — nodes + edges.\n\t * Designed for AI consumption during debugging sessions.\n\t */\n\tstatic snapshot(): {\n\t\tnodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }>;\n\t\tedges: Array<{ from: string; to: string }>;\n\t} {\n\t\tconst g = Inspector.graph();\n\t\tconst edgeMap = Inspector.getEdges();\n\t\tconst nodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }> =\n\t\t\t[];\n\t\tfor (const [key, info] of g) {\n\t\t\tnodes.push({ name: key, kind: info.kind, value: info.value, status: info.status });\n\t\t}\n\t\tconst edges: Array<{ from: string; to: string }> = [];\n\t\tfor (const [parent, children] of edgeMap) {\n\t\t\tfor (const child of children) {\n\t\t\t\tedges.push({ from: parent, to: child });\n\t\t\t}\n\t\t}\n\t\treturn { nodes, edges };\n\t}\n\n\t/** Reset all state (for testing) */\n\tstatic _reset(): void {\n\t\tInspector._names = new WeakMap<object, string>();\n\t\tInspector._kinds = new WeakMap<object, string>();\n\t\tInspector._keys = new WeakMap<object, string>();\n\t\tInspector._stores = new Set<WeakRef<object>>();\n\t\tInspector._edges = new Map();\n\t\tInspector._usedKeys = new Set();\n\t\tInspector._nextId = 0;\n\t\tInspector._explicitEnabled = null;\n\t\tInspector._cachedDefault = null;\n\t}\n}\n","/**\n * General-purpose source primitive. Can emit values, send control signals,\n * complete, and error. Lazy start on first sink, auto-cleanup on last\n * sink disconnect.\n *\n * Stateful: maintains currentValue. get() returns currentValue (or\n * getter(currentValue) when getter option is provided).\n *\n * v4: Output slot model replaces _sinks Set. _output is null (no sinks),\n * a function (single sink — P0 optimization), or a Set (multi sink).\n * _status tracks node lifecycle. autoDirty (default true) sends DIRTY on\n * type 3 before each type 1 DATA. equals option guards emit();\n * resetOnTeardown resets value on stop.\n *\n * v5: _status packed into _flags bits 7-9 for hot-path performance.\n * String status exposed via getter for Inspector/test backward compat.\n *\n * Class-based for V8 hidden class optimization and prototype method sharing.\n * Boolean fields packed into _flags bitmask to reduce hidden class size.\n */\n\nimport { Inspector } from \"./inspector\";\nimport type { Signal } from \"./protocol\";\nimport {\n\tDATA,\n\tDIRTY,\n\tdecodeStatus,\n\tdeferEmission,\n\tdeferStart,\n\tEND,\n\tisBatching,\n\tRESOLVED,\n\tS_COMPLETED,\n\tS_DIRTY,\n\tS_DISCONNECTED,\n\tS_ERRORED,\n\tS_RESOLVED,\n\tS_SETTLED,\n\tSTART,\n\tSTATE,\n\tSTATUS_MASK,\n\tSTATUS_SHIFT,\n} from \"./protocol\";\nimport type { ProducerStore, SourceOptions, Store } from \"./types\";\n\nexport type ProducerFn<T> = (actions: {\n\temit: (value: T) => void;\n\tsignal: (s: Signal) => void;\n\tcomplete: () => void;\n\terror: (e: unknown) => void;\n}) => (() => void) | undefined;\n\nexport type ProducerOpts<T> = SourceOptions<T> & {\n\tautoDirty?: boolean;\n\t_skipInspect?: boolean;\n};\n\n// Flag bits for _flags bitmask (bits 0-6)\nconst P_STARTED = 1;\nconst P_MULTI = 64;\n\n// Exported for subclass fast paths (StateImpl)\nexport const P_COMPLETED = 2;\nexport const P_AUTO_DIRTY = 4;\nconst P_RESET = 8;\nconst P_RESUB = 16;\nexport const P_PENDING = 32;\n\n// Status bits (bits 7-9) — exported for StateImpl fast path\nexport const _STATUS_MASK = STATUS_MASK;\nexport const _S_DIRTY = S_DIRTY << STATUS_SHIFT;\nexport const _S_SETTLED = S_SETTLED << STATUS_SHIFT;\nexport const _S_DISCONNECTED = S_DISCONNECTED << STATUS_SHIFT;\nexport const _S_COMPLETED = S_COMPLETED << STATUS_SHIFT;\nexport const _S_ERRORED = S_ERRORED << STATUS_SHIFT;\nexport const _S_RESOLVED = S_RESOLVED << STATUS_SHIFT;\n\nexport class ProducerImpl<T> {\n\t_value: T | undefined;\n\t_output: ((type: number, data?: any) => void) | Set<any> | null = null;\n\t_flags: number;\n\n\tget _status() {\n\t\treturn decodeStatus(this._flags);\n\t}\n\t_cleanup: (() => void) | undefined;\n\t_fn: ProducerFn<T> | undefined;\n\t_eqFn: ((a: T, b: T) => boolean) | undefined;\n\t_getterFn: ((cached: T | undefined) => T) | undefined;\n\t_initial: T | undefined;\n\n\tconstructor(fn?: ProducerFn<T>, opts?: ProducerOpts<T>) {\n\t\tthis._value = opts?.initial;\n\t\tthis._fn = fn;\n\t\tthis._eqFn = opts?.equals;\n\t\tthis._getterFn = opts?.getter;\n\t\tthis._initial = opts?.initial;\n\n\t\tlet flags = 0;\n\t\tif (opts?.autoDirty !== false) flags |= P_AUTO_DIRTY;\n\t\tif (opts?.resetOnTeardown) flags |= P_RESET;\n\t\tif (opts?.resubscribable) flags |= P_RESUB;\n\t\t// S_DISCONNECTED = 0, so no need to set status bits\n\t\tthis._flags = flags;\n\n\t\t// Bind public API methods so they work when detached (callbag interop,\n\t\t// destructuring, etc.). Replaces per-instance closure functions.\n\t\tthis.source = this.source.bind(this);\n\t\tthis.emit = this.emit.bind(this);\n\t\tthis.signal = this.signal.bind(this);\n\t\tthis.complete = this.complete.bind(this);\n\t\tthis.error = this.error.bind(this);\n\n\t\tif (!opts?._skipInspect) Inspector.register(this as any, { kind: \"producer\", ...opts });\n\t}\n\n\tget(): T | undefined {\n\t\treturn this._getterFn ? this._getterFn(this._value) : this._value;\n\t}\n\n\t/**\n\t * Dispatch a signal to all current subscribers via the output slot.\n\t *\n\t * Safety: P_MULTI flag and _output type are always updated together.\n\t * No reentrancy can occur between the two assignments (source() doesn't\n\t * trigger dispatch, and dispatch doesn't trigger source()). The null-check\n\t * provides an additional guard for the MULTI→null transition path.\n\t */\n\t_dispatch(type: number, data?: any): void {\n\t\tconst output = this._output;\n\t\tif (!output) return;\n\t\tif (this._flags & P_MULTI) {\n\t\t\tfor (const sink of output as Set<any>) sink(type, data);\n\t\t} else {\n\t\t\t(output as (type: number, data?: any) => void)(type, data);\n\t\t}\n\t}\n\n\temit(value: T): void {\n\t\tif (this._flags & P_COMPLETED) return;\n\t\tif (this._eqFn && this._value !== undefined && this._eqFn(this._value as T, value)) return;\n\t\tthis._value = value;\n\t\tif (!this._output) return;\n\t\tif (isBatching()) {\n\t\t\tif (!(this._flags & P_PENDING)) {\n\t\t\t\tthis._flags |= P_PENDING;\n\t\t\t\tif (this._flags & P_AUTO_DIRTY) {\n\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\t\t\t\tthis._dispatch(STATE, DIRTY);\n\t\t\t\t}\n\t\t\t\tdeferEmission(() => {\n\t\t\t\t\tthis._flags &= ~P_PENDING;\n\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_SETTLED;\n\t\t\t\t\tthis._dispatch(DATA, this._value);\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\tif (this._flags & P_AUTO_DIRTY) {\n\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\t\t\tthis._dispatch(STATE, DIRTY);\n\t\t\t}\n\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_SETTLED;\n\t\t\tthis._dispatch(DATA, this._value);\n\t\t}\n\t}\n\n\tsignal(s: Signal): void {\n\t\tif (this._flags & P_COMPLETED || !this._output) return;\n\t\tif (s === DIRTY) this._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\telse if (s === RESOLVED) this._flags = (this._flags & ~_STATUS_MASK) | _S_RESOLVED;\n\t\t// Unknown signals: dispatch without _status change (v4 forward-compat)\n\t\tthis._dispatch(STATE, s);\n\t}\n\n\tcomplete(): void {\n\t\tif (this._flags & P_COMPLETED) return;\n\t\tthis._flags = ((this._flags | P_COMPLETED) & ~_STATUS_MASK) | _S_COMPLETED;\n\t\tconst output = this._output;\n\t\tconst wasMulti = this._flags & P_MULTI;\n\t\tthis._output = null;\n\t\tthis._flags &= ~P_MULTI;\n\t\tthis._stop();\n\t\tif (output) {\n\t\t\tif (wasMulti) {\n\t\t\t\tfor (const sink of output as Set<any>) sink(END);\n\t\t\t} else {\n\t\t\t\t(output as (type: number, data?: any) => void)(END);\n\t\t\t}\n\t\t}\n\t}\n\n\terror(e: unknown): void {\n\t\tif (this._flags & P_COMPLETED) return;\n\t\tthis._flags = ((this._flags | P_COMPLETED) & ~_STATUS_MASK) | _S_ERRORED;\n\t\tconst output = this._output;\n\t\tconst wasMulti = this._flags & P_MULTI;\n\t\tthis._output = null;\n\t\tthis._flags &= ~P_MULTI;\n\t\tthis._stop();\n\t\tif (output) {\n\t\t\tif (wasMulti) {\n\t\t\t\tfor (const sink of output as Set<any>) sink(END, e);\n\t\t\t} else {\n\t\t\t\t(output as (type: number, data?: any) => void)(END, e);\n\t\t\t}\n\t\t}\n\t}\n\n\t_start(): void {\n\t\tif (this._flags & P_STARTED || !this._fn) return;\n\t\tthis._flags |= P_STARTED;\n\t\tconst result = this._fn(this as any);\n\t\tthis._cleanup = typeof result === \"function\" ? result : undefined;\n\t}\n\n\t_stop(): void {\n\t\tif (!(this._flags & P_STARTED)) return;\n\t\tthis._flags &= ~P_STARTED;\n\t\tif (this._cleanup) this._cleanup();\n\t\tthis._cleanup = undefined;\n\t\tif (this._flags & P_RESET) this._value = this._initial;\n\t\tif (!(this._flags & P_COMPLETED)) this._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t}\n\n\tsource(type: number, payload?: any): void {\n\t\tif (type === START) {\n\t\t\tconst sink = payload;\n\t\t\tif (this._flags & P_COMPLETED) {\n\t\t\t\tif (this._flags & P_RESUB && this._output === null) {\n\t\t\t\t\tthis._flags = (this._flags & ~(P_COMPLETED | _STATUS_MASK)) | _S_DISCONNECTED;\n\t\t\t\t} else {\n\t\t\t\t\tsink(START, (_t: number) => {});\n\t\t\t\t\tsink(END);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this._output === null) {\n\t\t\t\tthis._output = sink;\n\t\t\t} else if (!(this._flags & P_MULTI)) {\n\t\t\t\tconst set = new Set<any>();\n\t\t\t\tset.add(this._output);\n\t\t\t\tset.add(sink);\n\t\t\t\tthis._output = set;\n\t\t\t\tthis._flags |= P_MULTI;\n\t\t\t} else {\n\t\t\t\t(this._output as Set<any>).add(sink);\n\t\t\t}\n\t\t\tsink(START, (t: number) => {\n\t\t\t\tif (t === DATA) sink(DATA, this._value);\n\t\t\t\tif (t === END) {\n\t\t\t\t\tif (this._output === null) return;\n\t\t\t\t\tif (this._flags & P_MULTI) {\n\t\t\t\t\t\tconst set = this._output as Set<any>;\n\t\t\t\t\t\tset.delete(sink);\n\t\t\t\t\t\tif (set.size === 1) {\n\t\t\t\t\t\t\tthis._output = set.values().next().value;\n\t\t\t\t\t\t\tthis._flags &= ~P_MULTI;\n\t\t\t\t\t\t} else if (set.size === 0) {\n\t\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\t\tthis._flags &= ~P_MULTI;\n\t\t\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t\t\t\t\t\t\tthis._stop();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (this._output === sink) {\n\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t\t\t\t\t\tthis._stop();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tdeferStart(() => this._start());\n\t\t}\n\t}\n}\n\nexport function producer<T>(\n\tfn: ProducerFn<T> | undefined,\n\topts: ProducerOpts<T> & { initial: T },\n): ProducerStore<T> & Store<T>;\nexport function producer<T>(fn?: ProducerFn<T>, opts?: ProducerOpts<T>): ProducerStore<T>;\nexport function producer<T>(fn?: ProducerFn<T>, opts?: ProducerOpts<T>): ProducerStore<T> {\n\treturn new ProducerImpl<T>(fn, opts) as any;\n}\n","/**\n * Core subscribe — reusable callbag sink connector.\n *\n * Used as the base for:\n * - External subscribe (extra/subscribe re-exports this)\n * - Derived's dep connections (STANDALONE mode)\n * - Effect's dep connections\n *\n * v4: Handles callbag START handshake, filters STATE for user callbacks,\n * provides prev-value tracking. Returns unsub function.\n */\n\nimport { beginDeferredStart, END, endDeferredStart, START } from \"./protocol\";\nimport type { Store } from \"./types\";\n\nexport function subscribe<T>(\n\tstore: Store<T>,\n\tcb: (value: T, prev: T | undefined) => void,\n\topts?: { onEnd?: (error?: unknown) => void },\n): () => void {\n\tlet talkback: ((type: number) => void) | null = null;\n\n\tbeginDeferredStart();\n\n\t// `prev` is declared after store.source() but the closure only reads it\n\t// after endDeferredStart() triggers producers. By that point prev is already\n\t// set to store.get(). Order: register sink → read baseline → start producers.\n\tstore.source(START, (type: number, data: any) => {\n\t\tif (type === START) talkback = data;\n\t\tif (type === END) {\n\t\t\ttalkback = null;\n\t\t\topts?.onEnd?.(data);\n\t\t\treturn;\n\t\t}\n\t\t// Transparent sink — forwards every DATA to the callback.\n\t\t// Dedup (if desired) belongs in the source (state's equals) or in\n\t\t// an explicit operator (distinctUntilChanged), not here.\n\t\tif (type === 1 /* DATA */) {\n\t\t\tconst next = data as T;\n\t\t\tconst p = prev;\n\t\t\tprev = next;\n\t\t\tcb(next, p);\n\t\t}\n\t});\n\n\t// Baseline: captures current value before producers start. Aligns with\n\t// RxJS Observable semantics — no initial-value callback on subscribe.\n\tlet prev: T | undefined = store.get();\n\n\tendDeferredStart();\n\n\treturn () => talkback?.(END);\n}\n"],"mappings":"4aAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,YAAAE,KAAA,eAAAC,GAAAH,ICQO,IAAMI,EAAQ,OAAO,OAAO,EAGtBC,EAAW,OAAO,UAAU,EAiB5BC,EAAiB,EACjBC,EAAU,EACVC,EAAY,EACZC,EAAa,EACbC,EAAc,EACdC,EAAY,EACZC,EAAe,EACfC,EAAc,GAASD,EAE9BE,GAA+B,CACpC,eACA,QACA,UACA,WACA,YAC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AAG,EAETJ,EAAS,CAEX,CACD,CACD,EAEMK,EAAgBH,EACrBT,EACA,IAAM,CACLK,EAAKH,CAAW,CACjB,EACA,CACC,MAAQS,GAAQ,CACXA,IAAQ,OACXL,EAAMK,CAAG,EAETJ,EAAS,CAEX,CACD,CACD,EAEA,MAAO,IAAM,CACZC,EAAW,EACXI,EAAc,CACf,CACD,EACA,CACC,QAASV,EACT,OAAQ,IAAMA,CACf,CACD,EACA,OAAAW,EAAU,SAASV,EAAO,CAAE,KAAM,QAAS,CAAC,EACrCA,CACR,CACD","names":["sample_exports","__export","sample","__toCommonJS","DIRTY","RESOLVED","S_DISCONNECTED","S_DIRTY","S_SETTLED","S_RESOLVED","S_COMPLETED","S_ERRORED","STATUS_SHIFT","STATUS_MASK","STATUS_STRINGS","decodeStatus","flags","START","DATA","END","STATE","batchDepth","deferredEmissions","isBatching","batchDepth","deferEmission","fn","deferredEmissions","connectDepth","pendingStarts","beginDeferredStart","endDeferredStart","i","deferStart","start","Inspector","_Inspector","value","deps","joined","d","node","opts","id","key","depSuffix","kind","parent","child","parentKey","childKey","children","result","livingKeys","ref","alive","c","store","cb","talkback","prev","START","type","data","END","next","p","g","edges","depsMap","lines","info","depsStr","childStr","label","log","name","DATA","STATE","DIRTY","RESOLVED","tapName","wrapper","edgeMap","nodes","P_STARTED","P_MULTI","P_COMPLETED","P_AUTO_DIRTY","P_RESET","P_RESUB","P_PENDING","_STATUS_MASK","STATUS_MASK","_S_DIRTY","S_DIRTY","STATUS_SHIFT","_S_SETTLED","S_SETTLED","_S_DISCONNECTED","S_DISCONNECTED","_S_COMPLETED","S_COMPLETED","_S_ERRORED","S_ERRORED","_S_RESOLVED","S_RESOLVED","ProducerImpl","decodeStatus","fn","opts","flags","Inspector","type","data","output","sink","value","isBatching","STATE","DIRTY","deferEmission","DATA","s","RESOLVED","wasMulti","END","e","result","payload","START","_t","set","t","deferStart","producer","subscribe","store","cb","opts","talkback","beginDeferredStart","START","type","data","END","next","p","prev","endDeferredStart","sample","notifier","input","latestInput","store","producer","emit","error","complete","inputUnsub","subscribe","v","err","notifierUnsub","Inspector"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { S as Store, a as StoreOperator } from '../types-DsAN6Hga.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Emits the latest value from the input source whenever the notifier emits.
|
|
5
|
+
*
|
|
6
|
+
* Stateful: maintains latest input value. get() always returns the latest
|
|
7
|
+
* input value (via getter), not just the last sampled emission.
|
|
8
|
+
*
|
|
9
|
+
* v3: Tier 2 — each emit starts a new DIRTY+value cycle (autoDirty: true).
|
|
10
|
+
* No built-in dedup. getter overrides get() to return latest input.
|
|
11
|
+
* Forwards input and notifier completion and errors.
|
|
12
|
+
*/
|
|
13
|
+
declare function sample<A>(notifier: Store<unknown>): StoreOperator<A, A>;
|
|
14
|
+
|
|
15
|
+
export { sample };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { S as Store, a as StoreOperator } from '../types-DsAN6Hga.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Emits the latest value from the input source whenever the notifier emits.
|
|
5
|
+
*
|
|
6
|
+
* Stateful: maintains latest input value. get() always returns the latest
|
|
7
|
+
* input value (via getter), not just the last sampled emission.
|
|
8
|
+
*
|
|
9
|
+
* v3: Tier 2 — each emit starts a new DIRTY+value cycle (autoDirty: true).
|
|
10
|
+
* No built-in dedup. getter overrides get() to return latest input.
|
|
11
|
+
* Forwards input and notifier completion and errors.
|
|
12
|
+
*/
|
|
13
|
+
declare function sample<A>(notifier: Store<unknown>): StoreOperator<A, A>;
|
|
14
|
+
|
|
15
|
+
export { sample };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";var O=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var W=(n,e)=>{for(var r in e)O(n,r,{get:e[r],enumerable:!0})},F=(n,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of V(e))!Y.call(n,t)&&t!==r&&O(n,t,{get:()=>e[t],enumerable:!(s=U(e,t))||s.enumerable});return n};var P=n=>F(O({},"__esModule",{value:!0}),n);var Z={};W(Z,{scan:()=>X});module.exports=P(Z);var y=Symbol("DIRTY"),_=Symbol("RESOLVED"),w=0,I=1,N=2,B=3,M=4,$=5,p=7,x=7<<p,G=["DISCONNECTED","DIRTY","SETTLED","RESOLVED","COMPLETED","ERRORED"];function j(n){return G[(n&x)>>>p]}var c=0,g=1,l=2,S=3;var T=class n{static _names=new WeakMap;static _kinds=new WeakMap;static _keys=new WeakMap;static _stores=new Set;static _edges=new Map;static _nextId=0;static _usedKeys=new Set;static _explicitEnabled=null;static _cachedDefault=null;static get enabled(){if(n._explicitEnabled!==null)return n._explicitEnabled;if(n._cachedDefault!==null)return n._cachedDefault;try{n._cachedDefault=globalThis.process?.env?.NODE_ENV!=="production"}catch{n._cachedDefault=!0}return n._cachedDefault}static set enabled(e){n._explicitEnabled=e}static _depSuffix(e){if(!e?.length)return;let s=e.map(t=>n._names.get(t)??"?").join(",");return s.length>40?`${s.slice(0,37)}...`:s}static _resolveKey(e){return n._keys.get(e)??n._names.get(e)??"anonymous"}static register(e,r){if(!n.enabled)return;r?.name&&n._names.set(e,r.name),r?.kind&&n._kinds.set(e,r.kind);let s=n._nextId++,t=r?.name;if(!(t&&!n._usedKeys.has(t)))if(t){let i=n._depSuffix(r?.deps);t=i?`${t}(${i})`:`${t}_${s}`,n._usedKeys.has(t)&&(t=`${t}_${s}`)}else{let i=r?.kind??"store",o=n._depSuffix(r?.deps);t=o?`${i}(${o})`:`${i}_${s}`,n._usedKeys.has(t)&&(t=`${t}_${s}`)}n._usedKeys.add(t),n._keys.set(e,t),n._stores.add(new WeakRef(e))}static registerEdge(e,r){if(!n.enabled)return;let s=n._resolveKey(e),t=n._resolveKey(r),i=n._edges.get(s);i?i.includes(t)||i.push(t):n._edges.set(s,[t])}static getEdges(){return new Map(n._edges)}static getName(e){if(n.enabled)return n._names.get(e)}static getKind(e){return n._kinds.get(e)}static inspect(e){return{name:n._names.get(e),kind:n._kinds.get(e)??"unknown",value:typeof e.get=="function"?e.get():void 0,status:e._status}}static graph(){let e=new Map,r=new Set;for(let s of n._stores){let t=s.deref();if(!t){n._stores.delete(s);continue}let i=n._resolveKey(t);r.add(i),e.set(i,n.inspect(t))}for(let[s,t]of n._edges){if(!r.has(s)){n._edges.delete(s),n._usedKeys.delete(s);continue}let i=t.filter(o=>r.has(o));i.length===0?n._edges.delete(s):i.length!==t.length&&n._edges.set(s,i)}return e}static trace(e,r){let s=null,t=e.get();return e.source(c,(i,o)=>{if(i===c&&(s=o),i===l){s=null;return}if(i===1){let a=o;if(!Object.is(a,t)){let u=t;t=a,r(a,u)}}}),()=>s?.(l)}static dumpGraph(){let e=n.graph(),r=n.getEdges(),s=new Map;for(let[o,a]of r)for(let u of a){let f=s.get(u);f?f.includes(o)||f.push(o):s.set(u,[o])}let t=[];for(let[o,a]of e){let u=s.get(o),f=r.get(o),b=u?.length?` \u2190 [${u.join(", ")}]`:"",k=f?.length?` \u2192 [${f.join(", ")}]`:"";t.push(` ${o} (${a.kind}) = ${JSON.stringify(a.value)} [${a.status??"?"}]${b}${k}`)}return[`Store Graph (${e.size} nodes):`,...t].join(`
|
|
2
|
+
`)}static _observe(e,r,s){let t=null,i=r??n.getName(e),o={values:[],signals:[],events:[],ended:!1,endError:void 0,dirtyCount:0,resolvedCount:0,name:i,dispose:()=>t?.(l)};return e.source(c,(a,u)=>{if(a===c){t=u;return}a===g?(o.values.push(u),o.events.push({type:"data",data:u}),s&&s(`[${i}] DATA:`,u)):a===S?(o.signals.push(u),o.events.push({type:"signal",data:u}),u===y?o.dirtyCount++:u===_&&o.resolvedCount++,s&&s(`[${i}] STATE:`,u)):a===l&&(o.ended=!0,o.endError=u,o.events.push({type:"end",data:u}),s&&s(`[${i}] END`,u!==void 0?u:""),t=null)}),o}static observe(e){return n._observe(e)}static tap(e,r){let s=r??`tap(${n.getName(e)??"anon"})`,t={get:()=>e.get(),source:e.source};return n.register(t,{name:s,kind:"tap"}),n.registerEdge(e,t),t}static spy(e,r){let s=r?.name??n.getName(e)??"spy",t=r?.log??console.log;return n._observe(e,s,t)}static snapshot(){let e=n.graph(),r=n.getEdges(),s=[];for(let[i,o]of e)s.push({name:i,kind:o.kind,value:o.value,status:o.status});let t=[];for(let[i,o]of r)for(let a of o)t.push({from:i,to:a});return{nodes:s,edges:t}}static _reset(){n._names=new WeakMap,n._kinds=new WeakMap,n._keys=new WeakMap,n._stores=new Set,n._edges=new Map,n._usedKeys=new Set,n._nextId=0,n._explicitEnabled=null,n._cachedDefault=null}};var v=1,E=2,L=4,d=8,C=w<<p,z=I<<p,q=N<<p,H=B<<p,J=M<<p,Q=$<<p,h=x,R=class{_value;_output=null;_upstreamTalkbacks=[];_handler=null;_flags;_deps;_init;_getterFn;_initial;get _status(){return j(this._flags)}constructor(e,r,s){this._value=s?.initial,this._initial=s?.initial,this._deps=e,this._init=r,this._getterFn=s?.getter;let t=0;s?.resetOnTeardown&&(t|=E),s?.resubscribable&&(t|=L),this._flags=t,this.source=this.source.bind(this),T.register(this,{kind:s?.kind??"operator",...s,deps:e});for(let i of e)T.registerEdge(i,this)}_dispatch(e,r){let s=this._output;if(s)if(this._flags&d)for(let t of s)t(e,r);else s(e,r)}_connectUpstream(){let e=new Array(this._deps.length).fill(null);this._upstreamTalkbacks=e;let r=!1,s={seed:t=>{r||(this._value=t)},emit:t=>{r||(this._value=t,this._flags=this._flags&~h|q,this._dispatch(g,t))},signal:t=>{r||(t===y?this._flags=this._flags&~h|z:t===_&&(this._flags=this._flags&~h|H),this._dispatch(S,t))},complete:()=>{if(r)return;r=!0,this._flags=(this._flags|v)&~h|J,this._handler=null;for(let o of e)o?.(l);e.fill(null),this._flags&E&&(this._value=this._initial);let t=this._output,i=this._flags&d;if(this._output=null,this._flags&=~d,t)if(i)for(let o of t)o(l);else t(l)},error:t=>{if(r)return;r=!0,this._flags=(this._flags|v)&~h|Q,this._handler=null;for(let a of e)a?.(l);e.fill(null),this._flags&E&&(this._value=this._initial);let i=this._output,o=this._flags&d;if(this._output=null,this._flags&=~d,i)if(o)for(let a of i)a(l,t);else i(l,t)},disconnect:t=>{if(t!==void 0)e[t]?.(l),e[t]=null;else{for(let i of e)i?.(l);e.fill(null)}}};this._handler=this._init(s);for(let t=0;t<this._deps.length&&!r;t++){let i=t;this._deps[i].source(c,(o,a)=>{if(o===c){e[i]=a;return}this._handler?.(i,o,a)})}}_disconnectUpstream(){for(let e of this._upstreamTalkbacks)e?.(l);this._upstreamTalkbacks=[],this._handler=null,this._flags=this._flags&~h|C,this._flags&E&&(this._value=this._initial)}get(){if(this._getterFn&&!this._output){let e=this._getterFn(this._value);return this._value=e,e}return this._value}source(e,r){if(e===c){let s=r;if(this._flags&v)if(this._flags&L&&this._output===null)this._flags=this._flags&~(v|h)|C;else{s(c,i=>{}),s(l);return}let t=this._output===null;if(this._output===null)this._output=s;else if(this._flags&d)this._output.add(s);else{let i=new Set;i.add(this._output),i.add(s),this._output=i,this._flags|=d}s(c,i=>{if(i===g&&s(g,this._value),i===l){if(this._output===null)return;if(this._flags&d){let o=this._output;o.delete(s),o.size===1?(this._output=o.values().next().value,this._flags&=~d):o.size===0&&(this._output=null,this._flags&=~d,this._disconnectUpstream())}else this._output===s&&(this._output=null,this._disconnectUpstream())}}),t&&this._connectUpstream()}}};function K(n,e,r){return new R(n,e,r)}function X(n,e,r){return s=>{let t=r?.equals,i=e,o,a=!1;return K([s],({emit:u,signal:f,complete:b,error:k})=>(i=e,a=!1,(ee,D,m)=>{if(D===S&&f(m),D===g){let A=n(i,m);if(t?.(i,A)){f(_);return}i=A,u(i)}D===l&&(m!==void 0?k(m):b())}),{kind:"scan",name:r?.name??"scan",initial:e,resetOnTeardown:!0,getter:()=>{let u=s.get();return(!a||!Object.is(u,o))&&(i=n(i,u),o=u,a=!0),i}})}}0&&(module.exports={scan});
|
|
3
|
+
//# sourceMappingURL=scan.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/extra/scan.ts","../../src/core/protocol.ts","../../src/core/inspector.ts","../../src/core/operator.ts"],"sourcesContent":["import { operator } from \"../core/operator\";\nimport { DATA, END, RESOLVED, STATE } from \"../core/protocol\";\nimport type { Store, StoreOperator, StoreOptions } from \"../core/types\";\n\n/**\n * Accumulates upstream values through `reducer`, starting from `seed`.\n *\n * Stateful: maintains accumulated value via operator()'s cache. get()\n * returns the current accumulator.\n *\n * v3: Tier 1 — uses operator() with single dep. Forwards type 3\n * STATE signals; on type 1 DATA applies reducer and emits. Optional equals\n * enables push-phase memoization via RESOLVED. Pull-based get() when\n * disconnected advances the accumulator idempotently (dedup by input value).\n */\nexport function scan<A, B>(\n\treducer: (acc: B, value: A) => B,\n\tseed: B,\n\topts?: StoreOptions,\n): StoreOperator<A, B> {\n\treturn (input) => {\n\t\tconst eqFn = opts?.equals;\n\t\t// Shared accumulator between handler (push) and getter (pull).\n\t\t// Handler owns acc when connected; getter owns it when disconnected.\n\t\tlet acc = seed;\n\t\t// Getter idempotency: track last input seen to avoid double-applying\n\t\t// the reducer when get() is called multiple times with the same dep value.\n\t\tlet lastGetterInput: A | undefined;\n\t\tlet getterSeeded = false;\n\n\t\treturn operator<B>(\n\t\t\t[input] as Store<unknown>[],\n\t\t\t({ emit, signal, complete, error }) => {\n\t\t\t\t// On (re)connect, reset accumulator to seed and getter tracking.\n\t\t\t\t// Matches rxjs semantics: each subscription starts from seed.\n\t\t\t\tacc = seed;\n\t\t\t\tgetterSeeded = false;\n\n\t\t\t\treturn (_dep, type, data) => {\n\t\t\t\t\tif (type === STATE) {\n\t\t\t\t\t\tsignal(data);\n\t\t\t\t\t}\n\t\t\t\t\tif (type === DATA) {\n\t\t\t\t\t\tconst next = reducer(acc, data as A);\n\t\t\t\t\t\tif (eqFn?.(acc, next)) {\n\t\t\t\t\t\t\tsignal(RESOLVED);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tacc = next;\n\t\t\t\t\t\temit(acc);\n\t\t\t\t\t}\n\t\t\t\t\tif (type === END) {\n\t\t\t\t\t\tif (data !== undefined) error(data);\n\t\t\t\t\t\telse complete();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\t\t\t{\n\t\t\t\tkind: \"scan\",\n\t\t\t\tname: opts?.name ?? \"scan\",\n\t\t\t\tinitial: seed,\n\t\t\t\tresetOnTeardown: true,\n\t\t\t\tgetter: () => {\n\t\t\t\t\tconst v = input.get();\n\t\t\t\t\tif (!getterSeeded || !Object.is(v, lastGetterInput)) {\n\t\t\t\t\t\tacc = reducer(acc, v);\n\t\t\t\t\t\tlastGetterInput = v;\n\t\t\t\t\t\tgetterSeeded = true;\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t};\n}\n","// ---------------------------------------------------------------------------\n// Protocol — v3 type 3 control channel\n// ---------------------------------------------------------------------------\n// Type 3 (STATE) carries control signals: DIRTY, RESOLVED\n// Type 1 (DATA) carries only real values — never sentinels\n// ---------------------------------------------------------------------------\n\n/** Control signal: \"my value is about to change\" */\nexport const DIRTY = Symbol(\"DIRTY\");\n\n/** Control signal: \"I was dirty but my value didn't change\" */\nexport const RESOLVED = Symbol(\"RESOLVED\");\n\nexport type Signal = typeof DIRTY | typeof RESOLVED;\n\n/** Node status — tracks current lifecycle state (v4) */\nexport type NodeStatus =\n\t| \"DISCONNECTED\"\n\t| \"DIRTY\"\n\t| \"SETTLED\"\n\t| \"RESOLVED\"\n\t| \"COMPLETED\"\n\t| \"ERRORED\";\n\n// ---------------------------------------------------------------------------\n// Integer status constants — pack into _flags for hot-path performance.\n// 3 bits (7-9) encode 6 statuses. Use STATUS_MASK to read/write.\n// ---------------------------------------------------------------------------\nexport const S_DISCONNECTED = 0;\nexport const S_DIRTY = 1;\nexport const S_SETTLED = 2;\nexport const S_RESOLVED = 3;\nexport const S_COMPLETED = 4;\nexport const S_ERRORED = 5;\nexport const STATUS_SHIFT = 7;\nexport const STATUS_MASK = 0b111 << STATUS_SHIFT; // bits 7-9\n\nconst STATUS_STRINGS: NodeStatus[] = [\n\t\"DISCONNECTED\",\n\t\"DIRTY\",\n\t\"SETTLED\",\n\t\"RESOLVED\",\n\t\"COMPLETED\",\n\t\"ERRORED\",\n];\n\n/** Decode integer status bits back to string (for Inspector / tests) */\nexport function decodeStatus(flags: number): NodeStatus {\n\treturn STATUS_STRINGS[(flags & STATUS_MASK) >>> STATUS_SHIFT];\n}\n\n/** Callbag signal types */\nexport const START = 0;\nexport const DATA = 1;\nexport const END = 2;\nexport const STATE = 3;\n\n// ---------------------------------------------------------------------------\n// Batch — defers type 1 value emissions; type 3 DIRTY propagates immediately\n// ---------------------------------------------------------------------------\n\nlet batchDepth = 0;\nconst deferredEmissions: Array<() => void> = [];\n\n// `draining` prevents re-entrant drain when a nested batch() call ends while\n// the outer drain loop is already running. Without it, the inner batch's\n// finally block would see batchDepth===0 and start a second drain, racing the\n// outer loop — potentially double-processing items or clearing the array mid-\n// iteration. With draining=true, the inner batch skips its drain; any items it\n// pushes are picked up by the outer loop (the `for` condition re-evaluates\n// `deferredEmissions.length` on every iteration, so appends during drain are\n// naturally included in the same pass).\nlet draining = false;\n\nexport function batch<T>(fn: () => T): T {\n\tbatchDepth++;\n\ttry {\n\t\treturn fn();\n\t} finally {\n\t\tbatchDepth--;\n\t\tif (batchDepth === 0 && !draining) {\n\t\t\tdraining = true;\n\t\t\tfor (let i = 0; i < deferredEmissions.length; i++) {\n\t\t\t\tdeferredEmissions[i]();\n\t\t\t}\n\t\t\tdeferredEmissions.length = 0;\n\t\t\tdraining = false;\n\t\t}\n\t}\n}\n\nexport function isBatching(): boolean {\n\treturn batchDepth > 0;\n}\n\nexport function deferEmission(fn: () => void): void {\n\tdeferredEmissions.push(fn);\n}\n\n// ---------------------------------------------------------------------------\n// Connection batching (producer start deferral) — unchanged from v2\n// ---------------------------------------------------------------------------\n\nlet connectDepth = 0;\nconst pendingStarts: Array<() => void> = [];\n\nexport function beginDeferredStart(): void {\n\tconnectDepth++;\n}\n\nexport function endDeferredStart(): void {\n\tconnectDepth--;\n\tif (connectDepth === 0) {\n\t\tfor (let i = 0; i < pendingStarts.length; i++) {\n\t\t\tpendingStarts[i]();\n\t\t}\n\t\tpendingStarts.length = 0;\n\t}\n}\n\nexport function deferStart(start: () => void): void {\n\tif (connectDepth > 0) {\n\t\tpendingStarts.push(start);\n\t} else {\n\t\tstart();\n\t}\n}\n\n// ---------------------------------------------------------------------------\n// teardown — protocol-level graph destruction\n// ---------------------------------------------------------------------------\n// Sends END to all downstream sinks of a store node, cascading through the\n// entire subgraph. After teardown, the node is in COMPLETED state and won't\n// accept new values or subscriptions.\n//\n// Works with any node that uses the output slot model:\n// - ProducerImpl / StateImpl / OperatorImpl → calls .complete()\n// - DerivedImpl → calls ._handleEnd() (no public complete() on derived)\n// ---------------------------------------------------------------------------\n\nexport function teardown(store: { source: (type: number, payload?: any) => void }): void {\n\tconst node = store as any;\n\tif (typeof node.complete === \"function\") {\n\t\tnode.complete();\n\t} else if (typeof node._handleEnd === \"function\") {\n\t\tnode._handleEnd(undefined);\n\t}\n}\n","// ---------------------------------------------------------------------------\n// Inspector — static class for observability\n// ---------------------------------------------------------------------------\n// All debug metadata lives here in WeakMaps, not on the store objects.\n// Stores stay lean. Inspector is opt-in overhead.\n//\n// v5: Zero intrusion into primitives. No hooks in hot paths. All methods\n// are static — call directly as Inspector.observe(), Inspector.tap(), etc.\n// - register/registerEdge: metadata collection (called from constructors)\n// - inspect/graph/dumpGraph/snapshot: read-only graph queries\n// - observe/spy/trace: callbag sinks for debugging (subscribe externally)\n// - tap: transparent passthrough wrapper for graph visualization\n// ---------------------------------------------------------------------------\n\nimport type { NodeStatus, Signal } from \"./protocol\";\nimport { DATA, DIRTY, END, RESOLVED, START, STATE } from \"./protocol\";\nimport type { Store } from \"./types\";\n\nexport interface StoreInfo<T = unknown> {\n\tname: string | undefined;\n\tkind: string;\n\tvalue: T;\n\t/** v4: node lifecycle status */\n\tstatus: NodeStatus | undefined;\n}\n\nexport interface ObserveResult<T> {\n\t/** All DATA (type 1) values received, in order */\n\tvalues: T[];\n\t/** All STATE (type 3) payloads received (DIRTY, RESOLVED, or unknown) */\n\tsignals: Signal[];\n\t/** All events in protocol order: { type, data } */\n\tevents: Array<{ type: \"data\" | \"signal\" | \"end\"; data: unknown }>;\n\t/** Whether END (type 2) has been received */\n\tended: boolean;\n\t/** Error payload from END, if any */\n\tendError: unknown;\n\t/** Count of DIRTY signals received */\n\tdirtyCount: number;\n\t/** Count of RESOLVED signals received */\n\tresolvedCount: number;\n\t/** Store name (from Inspector, if registered) */\n\tname: string | undefined;\n\t/** Disconnect the observer */\n\tdispose: () => void;\n}\n\n// Static-only class is intentional API for Inspector namespace\n// biome-ignore lint/complexity/noStaticOnlyClass: public API surface\nexport class Inspector {\n\t// WeakMaps for metadata — keyed by any graph node (stores, effects, etc.)\n\tprivate static _names = new WeakMap<object, string>();\n\tprivate static _kinds = new WeakMap<object, string>();\n\tprivate static _keys = new WeakMap<object, string>();\n\n\t// WeakRef set for graph() — allows GC of unused nodes\n\tprivate static _stores = new Set<WeakRef<object>>();\n\n\t// Dependency edges: parent key → child keys\n\tprivate static _edges = new Map<string, string[]>();\n\n\t// Unique key generation\n\tprivate static _nextId = 0;\n\tprivate static _usedKeys = new Set<string>();\n\n\t// Enabled flag — when false, register/getName are no-ops\n\tprivate static _explicitEnabled: boolean | null = null;\n\tprivate static _cachedDefault: boolean | null = null;\n\n\tstatic get enabled(): boolean {\n\t\tif (Inspector._explicitEnabled !== null) return Inspector._explicitEnabled;\n\t\tif (Inspector._cachedDefault !== null) return Inspector._cachedDefault;\n\t\ttry {\n\t\t\tInspector._cachedDefault = (globalThis as any).process?.env?.NODE_ENV !== \"production\";\n\t\t} catch {\n\t\t\tInspector._cachedDefault = true;\n\t\t}\n\t\treturn Inspector._cachedDefault;\n\t}\n\n\tstatic set enabled(value: boolean) {\n\t\tInspector._explicitEnabled = value;\n\t}\n\n\t/** Compute a dep-name-based suffix for unique key generation */\n\tprivate static _depSuffix(deps?: object[]): string | undefined {\n\t\tif (!deps?.length) return undefined;\n\t\tconst names = deps.map((d) => Inspector._names.get(d) ?? \"?\");\n\t\tconst joined = names.join(\",\");\n\t\treturn joined.length > 40 ? `${joined.slice(0, 37)}...` : joined;\n\t}\n\n\t/** Resolve a node to its unique graph key */\n\tprivate static _resolveKey(node: object): string {\n\t\treturn Inspector._keys.get(node) ?? Inspector._names.get(node) ?? \"anonymous\";\n\t}\n\n\t/** Register a graph node (store, effect, etc.) with the inspector */\n\tstatic register(node: object, opts?: { name?: string; kind?: string; deps?: object[] }): void {\n\t\tif (!Inspector.enabled) return;\n\t\tif (opts?.name) Inspector._names.set(node, opts.name);\n\t\tif (opts?.kind) Inspector._kinds.set(node, opts.kind);\n\n\t\t// Compute unique key\n\t\tconst id = Inspector._nextId++;\n\t\tlet key = opts?.name;\n\t\tif (key && !Inspector._usedKeys.has(key)) {\n\t\t\t// Unique name — use as-is\n\t\t} else if (key) {\n\t\t\t// Name collision — differentiate with dep names or ID\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${key}(${depSuffix})` : `${key}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t} else {\n\t\t\t// Unnamed — use kind + dep names or ID\n\t\t\tconst kind = opts?.kind ?? \"store\";\n\t\t\tconst depSuffix = Inspector._depSuffix(opts?.deps);\n\t\t\tkey = depSuffix ? `${kind}(${depSuffix})` : `${kind}_${id}`;\n\t\t\tif (Inspector._usedKeys.has(key)) key = `${key}_${id}`;\n\t\t}\n\n\t\tInspector._usedKeys.add(key);\n\t\tInspector._keys.set(node, key);\n\t\tInspector._stores.add(new WeakRef(node));\n\t}\n\n\t/** Register a dependency edge between parent and child nodes */\n\tstatic registerEdge(parent: object, child: object): void {\n\t\tif (!Inspector.enabled) return;\n\t\tconst parentKey = Inspector._resolveKey(parent);\n\t\tconst childKey = Inspector._resolveKey(child);\n\t\tconst children = Inspector._edges.get(parentKey);\n\t\tif (children) {\n\t\t\tif (!children.includes(childKey)) children.push(childKey);\n\t\t} else {\n\t\t\tInspector._edges.set(parentKey, [childKey]);\n\t\t}\n\t}\n\n\t/** Get dependency edges: parent → children */\n\tstatic getEdges(): Map<string, string[]> {\n\t\treturn new Map(Inspector._edges);\n\t}\n\n\t/** Get the name of a node */\n\tstatic getName(node: object): string | undefined {\n\t\tif (!Inspector.enabled) return undefined;\n\t\treturn Inspector._names.get(node);\n\t}\n\n\t/** Get the kind of a node */\n\tstatic getKind(node: object): string | undefined {\n\t\treturn Inspector._kinds.get(node);\n\t}\n\n\t/** Inspect a single graph node — includes status and value (if available) */\n\tstatic inspect<T = unknown>(node: object): StoreInfo<T> {\n\t\treturn {\n\t\t\tname: Inspector._names.get(node),\n\t\t\tkind: Inspector._kinds.get(node) ?? \"unknown\",\n\t\t\tvalue: (typeof (node as any).get === \"function\" ? (node as any).get() : undefined) as T,\n\t\t\tstatus: (node as any)._status,\n\t\t};\n\t}\n\n\t/** Get all living nodes as a Map. Also prunes dead edges from GC'd nodes. */\n\tstatic graph(): Map<string, StoreInfo> {\n\t\tconst result = new Map<string, StoreInfo>();\n\t\tconst livingKeys = new Set<string>();\n\t\tfor (const ref of Inspector._stores) {\n\t\t\tconst node = ref.deref();\n\t\t\tif (!node) {\n\t\t\t\tInspector._stores.delete(ref); // cleanup GC'd refs\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst key = Inspector._resolveKey(node);\n\t\t\tlivingKeys.add(key);\n\t\t\tresult.set(key, Inspector.inspect(node));\n\t\t}\n\t\t// Prune edges referencing GC'd stores\n\t\tfor (const [key, children] of Inspector._edges) {\n\t\t\tif (!livingKeys.has(key)) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t\tInspector._usedKeys.delete(key);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst alive = children.filter((c) => livingKeys.has(c));\n\t\t\tif (alive.length === 0) {\n\t\t\t\tInspector._edges.delete(key);\n\t\t\t} else if (alive.length !== children.length) {\n\t\t\t\tInspector._edges.set(key, alive);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Trace a specific store's value changes (raw callbag — no extra/ dependency) */\n\tstatic trace<T>(store: Store<T>, cb: (value: T, prev: T | undefined) => void): () => void {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tlet prev: T | undefined = store.get();\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) talkback = data;\n\t\t\tif (type === END) {\n\t\t\t\ttalkback = null;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === 1) {\n\t\t\t\tconst next = data as T;\n\t\t\t\tif (!Object.is(next, prev)) {\n\t\t\t\t\tconst p = prev;\n\t\t\t\t\tprev = next;\n\t\t\t\t\tcb(next, p);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\treturn () => talkback?.(END);\n\t}\n\n\t/** Pretty-print the entire store graph for console/CLI debugging */\n\tstatic dumpGraph(): string {\n\t\tconst g = Inspector.graph();\n\t\tconst edges = Inspector.getEdges();\n\n\t\t// Build reverse map: child key → parent keys (deps)\n\t\tconst depsMap = new Map<string, string[]>();\n\t\tfor (const [parent, children] of edges) {\n\t\t\tfor (const child of children) {\n\t\t\t\tconst deps = depsMap.get(child);\n\t\t\t\tif (deps) {\n\t\t\t\t\tif (!deps.includes(parent)) deps.push(parent);\n\t\t\t\t} else {\n\t\t\t\t\tdepsMap.set(child, [parent]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tconst lines: string[] = [];\n\t\tfor (const [key, info] of g) {\n\t\t\tconst deps = depsMap.get(key);\n\t\t\tconst children = edges.get(key);\n\t\t\tconst depsStr = deps?.length ? ` ← [${deps.join(\", \")}]` : \"\";\n\t\t\tconst childStr = children?.length ? ` → [${children.join(\", \")}]` : \"\";\n\t\t\tlines.push(\n\t\t\t\t` ${key} (${info.kind}) = ${JSON.stringify(info.value)} [${info.status ?? \"?\"}]${depsStr}${childStr}`,\n\t\t\t);\n\t\t}\n\t\tconst header = `Store Graph (${g.size} nodes):`;\n\t\treturn [header, ...lines].join(\"\\n\");\n\t}\n\n\t/**\n\t * Internal observe implementation shared by observe() and spy().\n\t */\n\tprivate static _observe<T>(\n\t\tstore: Store<T>,\n\t\tlabel?: string,\n\t\tlog?: (...args: any[]) => void,\n\t): ObserveResult<T> {\n\t\tlet talkback: ((type: number) => void) | null = null;\n\t\tconst name = label ?? Inspector.getName(store);\n\t\tconst result: ObserveResult<T> = {\n\t\t\tvalues: [],\n\t\t\tsignals: [],\n\t\t\tevents: [],\n\t\t\tended: false,\n\t\t\tendError: undefined,\n\t\t\tdirtyCount: 0,\n\t\t\tresolvedCount: 0,\n\t\t\tname,\n\t\t\tdispose: () => talkback?.(END),\n\t\t};\n\n\t\tstore.source(START, (type: number, data: any) => {\n\t\t\tif (type === START) {\n\t\t\t\ttalkback = data;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (type === DATA) {\n\t\t\t\tresult.values.push(data);\n\t\t\t\tresult.events.push({ type: \"data\", data });\n\t\t\t\tif (log) log(`[${name}] DATA:`, data);\n\t\t\t} else if (type === STATE) {\n\t\t\t\tresult.signals.push(data);\n\t\t\t\tresult.events.push({ type: \"signal\", data });\n\t\t\t\tif (data === DIRTY) result.dirtyCount++;\n\t\t\t\telse if (data === RESOLVED) result.resolvedCount++;\n\t\t\t\tif (log) log(`[${name}] STATE:`, data);\n\t\t\t} else if (type === END) {\n\t\t\t\tresult.ended = true;\n\t\t\t\tresult.endError = data;\n\t\t\t\tresult.events.push({ type: \"end\", data });\n\t\t\t\tif (log) log(`[${name}] END`, data !== undefined ? data : \"\");\n\t\t\t\ttalkback = null;\n\t\t\t}\n\t\t});\n\n\t\treturn result;\n\t}\n\n\t/**\n\t * Observe a store's full callbag protocol — the test-friendly alternative\n\t * to hooks. Captures DATA values, STATE signals, END, and provides\n\t * convenience accessors.\n\t *\n\t * Returns a live observation object — arrays grow as the store emits.\n\t *\n\t * ```ts\n\t * const obs = Inspector.observe(myStore);\n\t * myState.set(5);\n\t * obs.values // [5]\n\t * obs.signals // [DIRTY]\n\t * obs.ended // false\n\t * obs.dirtyCount // 1\n\t * obs.dispose() // stop observing\n\t * ```\n\t */\n\tstatic observe<T>(store: Store<T>): ObserveResult<T> {\n\t\treturn Inspector._observe(store);\n\t}\n\n\t/**\n\t * Create a transparent passthrough wrapper for graph visualization.\n\t * The wrapper delegates `get()` and `source()` to the original store,\n\t * appearing as a distinct node in the Inspector graph. Zero overhead —\n\t * subscribers connect directly to the original store's source.\n\t */\n\tstatic tap<T>(store: Store<T>, name?: string): Store<T> {\n\t\tconst tapName = name ?? `tap(${Inspector.getName(store) ?? \"anon\"})`;\n\t\tconst wrapper: Store<T> = {\n\t\t\tget: () => store.get(),\n\t\t\tsource: store.source,\n\t\t};\n\t\tInspector.register(wrapper, { name: tapName, kind: \"tap\" });\n\t\tInspector.registerEdge(store, wrapper);\n\t\treturn wrapper;\n\t}\n\n\t/**\n\t * Enhanced observe() with logging — for interactive debugging.\n\t * Returns the same observation object as observe(), but also logs each\n\t * event as it happens. Pass a custom logger or defaults to console.log.\n\t */\n\tstatic spy<T>(\n\t\tstore: Store<T>,\n\t\topts?: { name?: string; log?: (...args: any[]) => void },\n\t): ObserveResult<T> {\n\t\tconst label = opts?.name ?? Inspector.getName(store) ?? \"spy\";\n\t\tconst log = opts?.log ?? console.log;\n\t\treturn Inspector._observe(store, label, log);\n\t}\n\n\t/**\n\t * JSON-serializable snapshot of the entire graph — nodes + edges.\n\t * Designed for AI consumption during debugging sessions.\n\t */\n\tstatic snapshot(): {\n\t\tnodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }>;\n\t\tedges: Array<{ from: string; to: string }>;\n\t} {\n\t\tconst g = Inspector.graph();\n\t\tconst edgeMap = Inspector.getEdges();\n\t\tconst nodes: Array<{ name: string; kind: string; value: unknown; status: string | undefined }> =\n\t\t\t[];\n\t\tfor (const [key, info] of g) {\n\t\t\tnodes.push({ name: key, kind: info.kind, value: info.value, status: info.status });\n\t\t}\n\t\tconst edges: Array<{ from: string; to: string }> = [];\n\t\tfor (const [parent, children] of edgeMap) {\n\t\t\tfor (const child of children) {\n\t\t\t\tedges.push({ from: parent, to: child });\n\t\t\t}\n\t\t}\n\t\treturn { nodes, edges };\n\t}\n\n\t/** Reset all state (for testing) */\n\tstatic _reset(): void {\n\t\tInspector._names = new WeakMap<object, string>();\n\t\tInspector._kinds = new WeakMap<object, string>();\n\t\tInspector._keys = new WeakMap<object, string>();\n\t\tInspector._stores = new Set<WeakRef<object>>();\n\t\tInspector._edges = new Map();\n\t\tInspector._usedKeys = new Set();\n\t\tInspector._nextId = 0;\n\t\tInspector._explicitEnabled = null;\n\t\tInspector._cachedDefault = null;\n\t}\n}\n","/**\n * General-purpose transform primitive. Receives all signal types from upstream\n * deps and decides what to forward.\n *\n * v5: _status packed into _flags bits 7-9 for hot-path performance.\n * String status exposed via getter for Inspector/test backward compat.\n *\n * Class-based for V8 hidden class optimization and prototype method sharing.\n * Boolean fields packed into _flags bitmask to reduce hidden class size.\n */\n\nimport { Inspector } from \"./inspector\";\nimport type { Signal } from \"./protocol\";\nimport {\n\tDATA,\n\tDIRTY,\n\tdecodeStatus,\n\tEND,\n\tRESOLVED,\n\tS_COMPLETED,\n\tS_DIRTY,\n\tS_DISCONNECTED,\n\tS_ERRORED,\n\tS_RESOLVED,\n\tS_SETTLED,\n\tSTART,\n\tSTATE,\n\tSTATUS_MASK,\n\tSTATUS_SHIFT,\n} from \"./protocol\";\nimport type { Actions, SourceOptions, Store } from \"./types\";\n\nexport type OperatorOpts<B> = SourceOptions<B>;\n\n// Flag bits for _flags bitmask (bits 0-6)\nconst O_COMPLETED = 1;\nconst O_RESET = 2;\nconst O_RESUB = 4;\nconst O_MULTI = 8;\n\n// Pre-shifted status constants for hot-path writes\nconst _S_DISCONNECTED = S_DISCONNECTED << STATUS_SHIFT;\nconst _S_DIRTY = S_DIRTY << STATUS_SHIFT;\nconst _S_SETTLED = S_SETTLED << STATUS_SHIFT;\nconst _S_RESOLVED = S_RESOLVED << STATUS_SHIFT;\nconst _S_COMPLETED = S_COMPLETED << STATUS_SHIFT;\nconst _S_ERRORED = S_ERRORED << STATUS_SHIFT;\nconst _STATUS_MASK = STATUS_MASK;\n\nexport class OperatorImpl<B> {\n\t_value: B | undefined;\n\t_output: ((type: number, data?: any) => void) | Set<any> | null = null;\n\t_upstreamTalkbacks: Array<((type: number) => void) | null> = [];\n\t_handler: ((depIndex: number, type: number, data: any) => void) | null = null;\n\t_flags: number;\n\t_deps: Store<unknown>[];\n\t_init: (actions: Actions<B>) => (depIndex: number, type: number, data: any) => void;\n\t_getterFn: ((cached: B | undefined) => B) | undefined;\n\t_initial: B | undefined;\n\n\tget _status() {\n\t\treturn decodeStatus(this._flags);\n\t}\n\n\tconstructor(\n\t\tdeps: Store<unknown>[],\n\t\tinit: (actions: Actions<B>) => (depIndex: number, type: number, data: any) => void,\n\t\topts?: OperatorOpts<B>,\n\t) {\n\t\tthis._value = opts?.initial;\n\t\tthis._initial = opts?.initial;\n\t\tthis._deps = deps;\n\t\tthis._init = init;\n\t\tthis._getterFn = opts?.getter;\n\n\t\tlet flags = 0;\n\t\tif (opts?.resetOnTeardown) flags |= O_RESET;\n\t\tif (opts?.resubscribable) flags |= O_RESUB;\n\t\t// S_DISCONNECTED = 0, so no status bits needed\n\t\tthis._flags = flags;\n\n\t\tthis.source = this.source.bind(this);\n\n\t\tInspector.register(this as any, { kind: opts?.kind ?? \"operator\", ...opts, deps });\n\t\tfor (const dep of deps) Inspector.registerEdge(dep, this as any);\n\t}\n\n\t_dispatch(type: number, data?: any): void {\n\t\tconst output = this._output;\n\t\tif (!output) return;\n\t\tif (this._flags & O_MULTI) {\n\t\t\tfor (const sink of output as Set<any>) sink(type, data);\n\t\t} else {\n\t\t\t(output as (type: number, data?: any) => void)(type, data);\n\t\t}\n\t}\n\n\t_connectUpstream(): void {\n\t\tconst localTalkbacks: Array<((type: number) => void) | null> = new Array(\n\t\t\tthis._deps.length,\n\t\t).fill(null);\n\t\tthis._upstreamTalkbacks = localTalkbacks;\n\n\t\tlet completed = false;\n\n\t\tconst actions: Actions<B> = {\n\t\t\tseed: (value: B) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tthis._value = value;\n\t\t\t},\n\t\t\temit: (value: B) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tthis._value = value;\n\t\t\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_SETTLED;\n\t\t\t\tthis._dispatch(DATA, value);\n\t\t\t},\n\t\t\tsignal: (s: Signal) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tif (s === DIRTY) this._flags = (this._flags & ~_STATUS_MASK) | _S_DIRTY;\n\t\t\t\telse if (s === RESOLVED) this._flags = (this._flags & ~_STATUS_MASK) | _S_RESOLVED;\n\t\t\t\tthis._dispatch(STATE, s);\n\t\t\t},\n\t\t\tcomplete: () => {\n\t\t\t\tif (completed) return;\n\t\t\t\tcompleted = true;\n\t\t\t\tthis._flags = ((this._flags | O_COMPLETED) & ~_STATUS_MASK) | _S_COMPLETED;\n\t\t\t\tthis._handler = null;\n\t\t\t\tfor (const tb of localTalkbacks) tb?.(END);\n\t\t\t\tlocalTalkbacks.fill(null);\n\t\t\t\tif (this._flags & O_RESET) this._value = this._initial;\n\t\t\t\tconst output = this._output;\n\t\t\t\tconst wasMulti = this._flags & O_MULTI;\n\t\t\t\tthis._output = null;\n\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\tif (output) {\n\t\t\t\t\tif (wasMulti) {\n\t\t\t\t\t\tfor (const sink of output as Set<any>) sink(END);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(output as (type: number, data?: any) => void)(END);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\terror: (e: unknown) => {\n\t\t\t\tif (completed) return;\n\t\t\t\tcompleted = true;\n\t\t\t\tthis._flags = ((this._flags | O_COMPLETED) & ~_STATUS_MASK) | _S_ERRORED;\n\t\t\t\tthis._handler = null;\n\t\t\t\tfor (const tb of localTalkbacks) tb?.(END);\n\t\t\t\tlocalTalkbacks.fill(null);\n\t\t\t\tif (this._flags & O_RESET) this._value = this._initial;\n\t\t\t\tconst output = this._output;\n\t\t\t\tconst wasMulti = this._flags & O_MULTI;\n\t\t\t\tthis._output = null;\n\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\tif (output) {\n\t\t\t\t\tif (wasMulti) {\n\t\t\t\t\t\tfor (const sink of output as Set<any>) sink(END, e);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t(output as (type: number, data?: any) => void)(END, e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\tdisconnect: (dep?: number) => {\n\t\t\t\tif (dep !== undefined) {\n\t\t\t\t\tlocalTalkbacks[dep]?.(END);\n\t\t\t\t\tlocalTalkbacks[dep] = null;\n\t\t\t\t} else {\n\t\t\t\t\tfor (const tb of localTalkbacks) tb?.(END);\n\t\t\t\t\tlocalTalkbacks.fill(null);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\n\t\tthis._handler = this._init(actions);\n\n\t\tfor (let i = 0; i < this._deps.length; i++) {\n\t\t\tif (completed) break;\n\t\t\tconst depIndex = i;\n\t\t\tthis._deps[depIndex].source(START, (type: number, data: any) => {\n\t\t\t\tif (type === START) {\n\t\t\t\t\tlocalTalkbacks[depIndex] = data;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._handler?.(depIndex, type, data);\n\t\t\t});\n\t\t}\n\t}\n\n\t_disconnectUpstream(): void {\n\t\tfor (const tb of this._upstreamTalkbacks) tb?.(END);\n\t\tthis._upstreamTalkbacks = [];\n\t\tthis._handler = null;\n\t\tthis._flags = (this._flags & ~_STATUS_MASK) | _S_DISCONNECTED;\n\t\tif (this._flags & O_RESET) this._value = this._initial;\n\t}\n\n\tget(): B {\n\t\tif (this._getterFn && !this._output) {\n\t\t\tconst v = this._getterFn(this._value);\n\t\t\tthis._value = v;\n\t\t\treturn v;\n\t\t}\n\t\treturn this._value as B;\n\t}\n\n\tsource(type: number, payload?: any): void {\n\t\tif (type === START) {\n\t\t\tconst sink = payload;\n\t\t\tif (this._flags & O_COMPLETED) {\n\t\t\t\tif (this._flags & O_RESUB && this._output === null) {\n\t\t\t\t\tthis._flags = (this._flags & ~(O_COMPLETED | _STATUS_MASK)) | _S_DISCONNECTED;\n\t\t\t\t} else {\n\t\t\t\t\tsink(START, (_t: number) => {});\n\t\t\t\t\tsink(END);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst wasEmpty = this._output === null;\n\t\t\tif (this._output === null) {\n\t\t\t\tthis._output = sink;\n\t\t\t} else if (!(this._flags & O_MULTI)) {\n\t\t\t\tconst set = new Set<any>();\n\t\t\t\tset.add(this._output);\n\t\t\t\tset.add(sink);\n\t\t\t\tthis._output = set;\n\t\t\t\tthis._flags |= O_MULTI;\n\t\t\t} else {\n\t\t\t\t(this._output as Set<any>).add(sink);\n\t\t\t}\n\t\t\tsink(START, (t: number) => {\n\t\t\t\tif (t === DATA) sink(DATA, this._value);\n\t\t\t\tif (t === END) {\n\t\t\t\t\tif (this._output === null) return;\n\t\t\t\t\tif (this._flags & O_MULTI) {\n\t\t\t\t\t\tconst set = this._output as Set<any>;\n\t\t\t\t\t\tset.delete(sink);\n\t\t\t\t\t\tif (set.size === 1) {\n\t\t\t\t\t\t\tthis._output = set.values().next().value;\n\t\t\t\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\t\t\t} else if (set.size === 0) {\n\t\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\t\tthis._flags &= ~O_MULTI;\n\t\t\t\t\t\t\tthis._disconnectUpstream();\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (this._output === sink) {\n\t\t\t\t\t\tthis._output = null;\n\t\t\t\t\t\tthis._disconnectUpstream();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (wasEmpty) {\n\t\t\t\tthis._connectUpstream();\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function operator<B>(\n\tdeps: Store<unknown>[],\n\tinit: (actions: Actions<B>) => (depIndex: number, type: number, data: any) => void,\n\topts?: OperatorOpts<B>,\n): Store<B> {\n\treturn new OperatorImpl<B>(deps, init, opts) as any;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,IAAA,eAAAC,EAAAH,GCQO,IAAMI,EAAQ,OAAO,OAAO,EAGtBC,EAAW,OAAO,UAAU,EAiB5BC,EAAiB,EACjBC,EAAU,EACVC,EAAY,EACZC,EAAa,EACbC,EAAc,EACdC,EAAY,EACZC,EAAe,EACfC,EAAc,GAASD,EAE9BE,EAA+B,CACpC,eACA,QACA,UACA,WACA,YACA,SACD,EAGO,SAASC,EAAaC,EAA2B,CACvD,OAAOF,GAAgBE,EAAQH,KAAiBD,CAAY,CAC7D,CAGO,IAAMK,EAAQ,EACRC,EAAO,EACPC,EAAM,EACNC,EAAQ,ECNd,IAAMC,EAAN,MAAMC,CAAU,CAEtB,OAAe,OAAS,IAAI,QAC5B,OAAe,OAAS,IAAI,QAC5B,OAAe,MAAQ,IAAI,QAG3B,OAAe,QAAU,IAAI,IAG7B,OAAe,OAAS,IAAI,IAG5B,OAAe,QAAU,EACzB,OAAe,UAAY,IAAI,IAG/B,OAAe,iBAAmC,KAClD,OAAe,eAAiC,KAEhD,WAAW,SAAmB,CAC7B,GAAIA,EAAU,mBAAqB,KAAM,OAAOA,EAAU,iBAC1D,GAAIA,EAAU,iBAAmB,KAAM,OAAOA,EAAU,eACxD,GAAI,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KU,CAAS,EACnC,GAAIX,IAAOC,EAAKa,CAAI,EAAG,CACtBR,EAAOS,CAAQ,EACf,MACD,CACAd,EAAMa,EACNT,EAAKJ,CAAG,CACT,CACIS,IAASM,IACRL,IAAS,OAAWH,EAAMG,CAAI,EAC7BJ,EAAS,EAEhB,GAED,CACC,KAAM,OACN,KAAMT,GAAM,MAAQ,OACpB,QAASD,EACT,gBAAiB,GACjB,OAAQ,IAAM,CACb,IAAMoB,EAAIlB,EAAM,IAAI,EACpB,OAAI,CAACI,GAAgB,CAAC,OAAO,GAAGc,EAAGf,CAAe,KACjDD,EAAML,EAAQK,EAAKgB,CAAC,EACpBf,EAAkBe,EAClBd,EAAe,IAETF,CACR,CACD,CACD,CACD,CACD","names":["scan_exports","__export","scan","__toCommonJS","DIRTY","RESOLVED","S_DISCONNECTED","S_DIRTY","S_SETTLED","S_RESOLVED","S_COMPLETED","S_ERRORED","STATUS_SHIFT","STATUS_MASK","STATUS_STRINGS","decodeStatus","flags","START","DATA","END","STATE","Inspector","_Inspector","value","deps","joined","d","node","opts","id","key","depSuffix","kind","parent","child","parentKey","childKey","children","result","livingKeys","ref","alive","c","store","cb","talkback","prev","START","type","data","END","next","p","g","edges","depsMap","lines","info","depsStr","childStr","label","log","name","DATA","STATE","DIRTY","RESOLVED","tapName","wrapper","edgeMap","nodes","O_COMPLETED","O_RESET","O_RESUB","O_MULTI","_S_DISCONNECTED","S_DISCONNECTED","STATUS_SHIFT","_S_DIRTY","S_DIRTY","_S_SETTLED","S_SETTLED","_S_RESOLVED","S_RESOLVED","_S_COMPLETED","S_COMPLETED","_S_ERRORED","S_ERRORED","_STATUS_MASK","STATUS_MASK","OperatorImpl","decodeStatus","deps","init","opts","flags","Inspector","dep","type","data","output","sink","localTalkbacks","completed","actions","value","DATA","s","DIRTY","RESOLVED","STATE","tb","END","wasMulti","e","i","depIndex","START","v","payload","_t","wasEmpty","set","t","operator","scan","reducer","seed","opts","input","eqFn","acc","lastGetterInput","getterSeeded","operator","emit","signal","complete","error","_dep","type","data","STATE","DATA","next","RESOLVED","END","v"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { b as StoreOptions, a as StoreOperator } from '../types-DsAN6Hga.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Accumulates upstream values through `reducer`, starting from `seed`.
|
|
5
|
+
*
|
|
6
|
+
* Stateful: maintains accumulated value via operator()'s cache. get()
|
|
7
|
+
* returns the current accumulator.
|
|
8
|
+
*
|
|
9
|
+
* v3: Tier 1 — uses operator() with single dep. Forwards type 3
|
|
10
|
+
* STATE signals; on type 1 DATA applies reducer and emits. Optional equals
|
|
11
|
+
* enables push-phase memoization via RESOLVED. Pull-based get() when
|
|
12
|
+
* disconnected advances the accumulator idempotently (dedup by input value).
|
|
13
|
+
*/
|
|
14
|
+
declare function scan<A, B>(reducer: (acc: B, value: A) => B, seed: B, opts?: StoreOptions): StoreOperator<A, B>;
|
|
15
|
+
|
|
16
|
+
export { scan };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { b as StoreOptions, a as StoreOperator } from '../types-DsAN6Hga.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Accumulates upstream values through `reducer`, starting from `seed`.
|
|
5
|
+
*
|
|
6
|
+
* Stateful: maintains accumulated value via operator()'s cache. get()
|
|
7
|
+
* returns the current accumulator.
|
|
8
|
+
*
|
|
9
|
+
* v3: Tier 1 — uses operator() with single dep. Forwards type 3
|
|
10
|
+
* STATE signals; on type 1 DATA applies reducer and emits. Optional equals
|
|
11
|
+
* enables push-phase memoization via RESOLVED. Pull-based get() when
|
|
12
|
+
* disconnected advances the accumulator idempotently (dedup by input value).
|
|
13
|
+
*/
|
|
14
|
+
declare function scan<A, B>(reducer: (acc: B, value: A) => B, seed: B, opts?: StoreOptions): StoreOperator<A, B>;
|
|
15
|
+
|
|
16
|
+
export { scan };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var p=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var c=(r,e)=>{for(var o in e)p(r,o,{get:e[o],enumerable:!0})},f=(r,e,o,A)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of a(e))!n.call(r,t)&&t!==o&&p(r,t,{get:()=>e[t],enumerable:!(A=S(e,t))||A.enumerable});return r};var i=r=>f(p({},"__esModule",{value:!0}),r);var s={};c(s,{share:()=>m});module.exports=i(s);function m(){return r=>r}0&&(module.exports={share});
|
|
2
|
+
//# sourceMappingURL=share.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/extra/share.ts"],"sourcesContent":["import type { Store, StoreOperator } from \"../core/types\";\n\n/**\n * No-op in callbag-recharge — stores are inherently shared (multicast).\n * Multiple subscribers connect to the same store instance.\n * Provided for API compatibility with callbag-basics.\n *\n * Stateless: returns input unchanged. No own state.\n */\nexport function share<A>(): StoreOperator<A, A> {\n\treturn (input: Store<A>) => input;\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GASO,SAASE,GAAgC,CAC/C,OAAQE,GAAoBA,CAC7B","names":["share_exports","__export","share","__toCommonJS","input"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as StoreOperator } from '../types-DsAN6Hga.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* No-op in callbag-recharge — stores are inherently shared (multicast).
|
|
5
|
+
* Multiple subscribers connect to the same store instance.
|
|
6
|
+
* Provided for API compatibility with callbag-basics.
|
|
7
|
+
*
|
|
8
|
+
* Stateless: returns input unchanged. No own state.
|
|
9
|
+
*/
|
|
10
|
+
declare function share<A>(): StoreOperator<A, A>;
|
|
11
|
+
|
|
12
|
+
export { share };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { a as StoreOperator } from '../types-DsAN6Hga.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* No-op in callbag-recharge — stores are inherently shared (multicast).
|
|
5
|
+
* Multiple subscribers connect to the same store instance.
|
|
6
|
+
* Provided for API compatibility with callbag-basics.
|
|
7
|
+
*
|
|
8
|
+
* Stateless: returns input unchanged. No own state.
|
|
9
|
+
*/
|
|
10
|
+
declare function share<A>(): StoreOperator<A, A>;
|
|
11
|
+
|
|
12
|
+
export { share };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|