@graphrefly/ts 0.0.1 → 0.0.3
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 +197 -117
- package/dist/actions-types-CH-XCU9O.d.cts +657 -0
- package/dist/actions-types-w2iPQTkv.d.ts +657 -0
- package/dist/adapters/index.cjs +5157 -2951
- package/dist/adapters/index.cjs.map +1 -1
- package/dist/adapters/index.d.cts +207 -70
- package/dist/adapters/index.d.ts +207 -70
- package/dist/adapters/index.js +3738 -1688
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/nestjs/microservices.cjs +841 -0
- package/dist/adapters/nestjs/microservices.cjs.map +1 -0
- package/dist/adapters/nestjs/microservices.d.cts +45 -0
- package/dist/adapters/nestjs/microservices.d.ts +45 -0
- package/dist/adapters/nestjs/microservices.js +206 -0
- package/dist/adapters/nestjs/microservices.js.map +1 -0
- package/dist/adapters/nestjs/native.cjs +1391 -0
- package/dist/adapters/nestjs/native.cjs.map +1 -0
- package/dist/adapters/nestjs/native.d.cts +111 -0
- package/dist/adapters/nestjs/native.d.ts +111 -0
- package/dist/adapters/nestjs/native.js +577 -0
- package/dist/adapters/nestjs/native.js.map +1 -0
- package/dist/adapters/nestjs/websockets.cjs +924 -0
- package/dist/adapters/nestjs/websockets.cjs.map +1 -0
- package/dist/adapters/nestjs/websockets.d.cts +47 -0
- package/dist/adapters/nestjs/websockets.d.ts +47 -0
- package/dist/adapters/nestjs/websockets.js +286 -0
- package/dist/adapters/nestjs/websockets.js.map +1 -0
- package/dist/adapters/nestjs.cjs +1085 -0
- package/dist/adapters/nestjs.cjs.map +1 -0
- package/dist/adapters/nestjs.d.cts +385 -0
- package/dist/adapters/nestjs.d.ts +385 -0
- package/dist/adapters/nestjs.js +112 -0
- package/dist/adapters/nestjs.js.map +1 -0
- package/dist/adapters/observe-storage.d.cts +3 -3
- package/dist/adapters/observe-storage.d.ts +3 -3
- package/dist/adapters/observe-storage.js +4 -4
- package/dist/adapters/react.cjs.map +1 -1
- package/dist/adapters/react.d.cts +2 -2
- package/dist/adapters/react.d.ts +2 -2
- package/dist/adapters/react.js +1 -1
- package/dist/adapters/solid.cjs.map +1 -1
- package/dist/adapters/solid.d.cts +2 -2
- package/dist/adapters/solid.d.ts +2 -2
- package/dist/adapters/solid.js +1 -1
- package/dist/adapters/svelte.cjs.map +1 -1
- package/dist/adapters/svelte.d.cts +2 -2
- package/dist/adapters/svelte.d.ts +2 -2
- package/dist/adapters/svelte.js +1 -1
- package/dist/adapters/vue.cjs.map +1 -1
- package/dist/adapters/vue.d.cts +2 -2
- package/dist/adapters/vue.d.ts +2 -2
- package/dist/adapters/vue.js +1 -1
- package/dist/{agent-runtime-BesGDZcB.d.ts → agent-runtime-types-core-CKwrBDyi.d.ts} +171 -320
- package/dist/{agent-runtime-DZTJ3C-p.d.cts → agent-runtime-types-core-bfl4m0vM.d.cts} +171 -320
- package/dist/agent-runtime-types-tool-BLPV3azj.d.cts +695 -0
- package/dist/agent-runtime-types-tool-hwqvVqNt.d.ts +695 -0
- package/dist/agentic-memory-retention-CLwI76JK.d.ts +14 -0
- package/dist/agentic-memory-retention-Cz8GR6ie.d.cts +14 -0
- package/dist/{agentic-memory-DfuVZ-lY.d.cts → agentic-memory-types-JDr7MPhh.d.cts} +13 -57
- package/dist/{agentic-memory-BmRCvh0d.d.ts → agentic-memory-types-khYJgzKL.d.ts} +13 -57
- package/dist/{capability-admission-B0BzqAm5.d.cts → capability-admission-B8RNFyaZ.d.cts} +3 -3
- package/dist/{capability-admission-g0mn9hpq.d.ts → capability-admission-Dkw1Xz3r.d.ts} +3 -3
- package/dist/chunk-2KUAG2GZ.js +9693 -0
- package/dist/chunk-2KUAG2GZ.js.map +1 -0
- package/dist/{chunk-CZNV3VXM.js → chunk-3J7UPZL5.js} +11 -11
- package/dist/{chunk-HKK2JD7Z.js → chunk-3LYI6ADX.js} +12 -125
- package/dist/chunk-3LYI6ADX.js.map +1 -0
- package/dist/{chunk-YXMZ2N6J.js → chunk-4M37FH2I.js} +1071 -1025
- package/dist/chunk-4M37FH2I.js.map +1 -0
- package/dist/{chunk-YDSIVHRR.js → chunk-4NWSNI4K.js} +1598 -1584
- package/dist/chunk-4NWSNI4K.js.map +1 -0
- package/dist/{chunk-Z2ANQ6JW.js → chunk-4Q77MMJY.js} +2 -2
- package/dist/{chunk-SS2A464I.js → chunk-54WPEODM.js} +3 -3
- package/dist/chunk-54WPEODM.js.map +1 -0
- package/dist/chunk-6E76H4OU.js +132 -0
- package/dist/chunk-6E76H4OU.js.map +1 -0
- package/dist/chunk-7GOTIIQ7.js +819 -0
- package/dist/chunk-7GOTIIQ7.js.map +1 -0
- package/dist/{chunk-V7CIJE4B.js → chunk-DKFWDTVY.js} +92 -9
- package/dist/chunk-DKFWDTVY.js.map +1 -0
- package/dist/{chunk-FBUU43PM.js → chunk-E4QCH32M.js} +448 -446
- package/dist/chunk-E4QCH32M.js.map +1 -0
- package/dist/{chunk-XKXWK2KP.js → chunk-GXU6WFEJ.js} +1157 -1021
- package/dist/chunk-GXU6WFEJ.js.map +1 -0
- package/dist/{chunk-K3FXTC3I.js → chunk-HJACH5PU.js} +3 -3
- package/dist/{chunk-GTPCOEOZ.js → chunk-IDMLXLLG.js} +3 -3
- package/dist/{chunk-DKP56CSW.js → chunk-JKAYLDQV.js} +2 -2
- package/dist/{chunk-4VLAQHZI.js → chunk-K7FB3JTD.js} +17 -1
- package/dist/chunk-K7FB3JTD.js.map +1 -0
- package/dist/{chunk-43BKLFZU.js → chunk-KFURM6FM.js} +10 -10
- package/dist/{chunk-H75VXTGT.js → chunk-L6LDXRWE.js} +3 -3
- package/dist/{chunk-H75VXTGT.js.map → chunk-L6LDXRWE.js.map} +1 -1
- package/dist/chunk-MCOFHMUU.js +4131 -0
- package/dist/chunk-MCOFHMUU.js.map +1 -0
- package/dist/chunk-MQEQMS7B.js +1009 -0
- package/dist/chunk-MQEQMS7B.js.map +1 -0
- package/dist/chunk-MTELVIYR.js +1421 -0
- package/dist/chunk-MTELVIYR.js.map +1 -0
- package/dist/{chunk-3JR3EDB2.js → chunk-NNDIFUKX.js} +121 -115
- package/dist/chunk-NNDIFUKX.js.map +1 -0
- package/dist/{chunk-2747WN4Y.js → chunk-PUSRRALM.js} +3 -3
- package/dist/{chunk-QFY4AFY4.js → chunk-PVC7WDKI.js} +58 -52
- package/dist/chunk-PVC7WDKI.js.map +1 -0
- package/dist/{chunk-VTHLCFN4.js → chunk-RAHNUYA5.js} +2 -2
- package/dist/chunk-TQPCAIQI.js +612 -0
- package/dist/chunk-TQPCAIQI.js.map +1 -0
- package/dist/{chunk-IXZBUWSP.js → chunk-UEMN5URK.js} +2 -2
- package/dist/chunk-WOS7RJYZ.js +1320 -0
- package/dist/chunk-WOS7RJYZ.js.map +1 -0
- package/dist/{chunk-6PHB5CJS.js → chunk-ZLFRB6FI.js} +2 -2
- package/dist/composition/index.cjs +1228 -1076
- package/dist/composition/index.cjs.map +1 -1
- package/dist/composition/index.d.cts +3 -3
- package/dist/composition/index.d.ts +3 -3
- package/dist/composition/index.js +4 -4
- package/dist/core/index.cjs +1198 -1046
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +23 -2
- package/dist/core/index.d.ts +23 -2
- package/dist/core/index.js +2 -2
- package/dist/cqrs/index.d.cts +3 -3
- package/dist/cqrs/index.d.ts +3 -3
- package/dist/cqrs/messaging.d.cts +4 -4
- package/dist/cqrs/messaging.d.ts +4 -4
- package/dist/cqrs/work-queue.d.cts +5 -5
- package/dist/cqrs/work-queue.d.ts +5 -5
- package/dist/data-structures/index.cjs +1226 -1074
- package/dist/data-structures/index.cjs.map +1 -1
- package/dist/data-structures/index.d.cts +8 -7
- package/dist/data-structures/index.d.ts +8 -7
- package/dist/data-structures/index.js +6 -5
- package/dist/{describe-DYMw_l1C.d.cts → describe-BumQ-3_0.d.cts} +1 -1
- package/dist/{describe-BpyJuWkw.d.ts → describe-cYr_Z5zm.d.ts} +1 -1
- package/dist/executors/tool-provider-adapters.cjs +3091 -0
- package/dist/executors/tool-provider-adapters.cjs.map +1 -0
- package/dist/executors/tool-provider-adapters.d.cts +174 -0
- package/dist/executors/tool-provider-adapters.d.ts +174 -0
- package/dist/executors/tool-provider-adapters.js +1336 -0
- package/dist/executors/tool-provider-adapters.js.map +1 -0
- package/dist/executors/tool-provider-runtime.cjs +5178 -0
- package/dist/executors/tool-provider-runtime.cjs.map +1 -0
- package/dist/executors/tool-provider-runtime.d.cts +17 -0
- package/dist/executors/tool-provider-runtime.d.ts +17 -0
- package/dist/executors/tool-provider-runtime.js +15 -0
- package/dist/executors/tool-provider-runtime.js.map +1 -0
- package/dist/executors/tool-provider.cjs +6392 -0
- package/dist/executors/tool-provider.cjs.map +1 -0
- package/dist/executors/tool-provider.d.cts +60 -0
- package/dist/executors/tool-provider.d.ts +60 -0
- package/dist/executors/tool-provider.js +89 -0
- package/dist/executors/tool-provider.js.map +1 -0
- package/dist/executors/work-queue.d.cts +6 -6
- package/dist/executors/work-queue.d.ts +6 -6
- package/dist/graph/index.cjs +1499 -1341
- package/dist/graph/index.cjs.map +1 -1
- package/dist/graph/index.d.cts +9 -8
- package/dist/graph/index.d.ts +9 -8
- package/dist/graph/index.js +23 -22
- package/dist/{graph-DCEWh4T2.d.cts → graph-C1C-wb0L.d.cts} +266 -137
- package/dist/{graph-D-1-SQeC.d.ts → graph-CS0b4V9B.d.ts} +266 -137
- package/dist/{index-72VZC0-E.d.cts → index-DLrNopda.d.cts} +151 -10
- package/dist/{index-Bmxeu0nK.d.ts → index-DzJni3_6.d.ts} +151 -10
- package/dist/index.cjs +3397 -3140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -9
- package/dist/index.d.ts +12 -9
- package/dist/index.js +110 -109
- package/dist/inspection/boundary.d.cts +4 -4
- package/dist/inspection/boundary.d.ts +4 -4
- package/dist/measurements-BWAnochv.d.ts +294 -0
- package/dist/measurements-B_gJfD8h.d.cts +294 -0
- package/dist/messaging/index.cjs +57 -51
- package/dist/messaging/index.cjs.map +1 -1
- package/dist/messaging/index.d.cts +11 -276
- package/dist/messaging/index.d.ts +11 -276
- package/dist/messaging/index.js +1 -1
- package/dist/operators/index.cjs +1228 -1076
- package/dist/operators/index.cjs.map +1 -1
- package/dist/operators/index.d.cts +5 -5
- package/dist/operators/index.d.ts +5 -5
- package/dist/operators/index.js +5 -5
- package/dist/orchestration/index.cjs +8844 -6071
- package/dist/orchestration/index.cjs.map +1 -1
- package/dist/orchestration/index.d.cts +171 -224
- package/dist/orchestration/index.d.ts +171 -224
- package/dist/orchestration/index.js +42 -991
- package/dist/orchestration/index.js.map +1 -1
- package/dist/orchestration/messaging.d.cts +5 -8
- package/dist/orchestration/messaging.d.ts +5 -8
- package/dist/orchestration/work-queue.cjs +1243 -5
- package/dist/orchestration/work-queue.cjs.map +1 -1
- package/dist/orchestration/work-queue.d.cts +121 -10
- package/dist/orchestration/work-queue.d.ts +121 -10
- package/dist/orchestration/work-queue.js +1067 -4
- package/dist/orchestration/work-queue.js.map +1 -1
- package/dist/patterns/event-flow.cjs +6 -20
- package/dist/patterns/event-flow.cjs.map +1 -1
- package/dist/patterns/event-flow.d.cts +4 -4
- package/dist/patterns/event-flow.d.ts +4 -4
- package/dist/patterns/event-flow.js +2 -2
- package/dist/patterns/index.cjs +453 -465
- package/dist/patterns/index.cjs.map +1 -1
- package/dist/patterns/index.d.cts +6 -5
- package/dist/patterns/index.d.ts +6 -5
- package/dist/patterns/index.js +3 -3
- package/dist/process-types-BB7oRhX3.d.cts +200 -0
- package/dist/process-types-QNhyoYJ8.d.ts +200 -0
- package/dist/{reactive-collection-DNV0-gFi.d.cts → reactive-collection-BYlWvtnp.d.cts} +4 -34
- package/dist/{reactive-collection-BAmfrGjd.d.ts → reactive-collection-efOEdGFN.d.ts} +4 -34
- package/dist/{reactive-collection-storage-BNEldDyi.d.cts → reactive-collection-storage-BjoLsoiC.d.cts} +5 -5
- package/dist/{reactive-collection-storage-YZsAQsWK.d.ts → reactive-collection-storage-DwW6UuK_.d.ts} +5 -5
- package/dist/{reactive-map-DRD1LJ2H.d.cts → reactive-map-BHacbIqz.d.cts} +7 -2
- package/dist/{reactive-map-EsDiCmJk.d.ts → reactive-map-DN4Jyqnf.d.ts} +7 -2
- package/dist/render/index.d.cts +2 -2
- package/dist/render/index.d.ts +2 -2
- package/dist/scheduled-readiness-BmqXxnzX.d.ts +91 -0
- package/dist/scheduled-readiness-CYSw7KDE.d.cts +91 -0
- package/dist/semantic-memory-graph-B_LwbM-E.d.cts +30 -0
- package/dist/semantic-memory-graph-rsFNNhwn.d.ts +30 -0
- package/dist/{semantic-memory-graph-DKuNzuWw.d.cts → semantic-memory-graph-types-Y73bbwVI.d.cts} +2 -28
- package/dist/{semantic-memory-graph-uwbwJdhe.d.ts → semantic-memory-graph-types-safmPkuX.d.ts} +2 -28
- package/dist/solutions/index.cjs +6353 -6169
- package/dist/solutions/index.cjs.map +1 -1
- package/dist/solutions/index.d.cts +12 -10
- package/dist/solutions/index.d.ts +12 -10
- package/dist/solutions/index.js +5 -5
- package/dist/solutions/reactive-layout/browser/index.cjs +116 -108
- package/dist/solutions/reactive-layout/browser/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/browser/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/browser/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/browser/index.js +3 -3
- package/dist/solutions/reactive-layout/index.cjs +3578 -3350
- package/dist/solutions/reactive-layout/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/index.d.cts +32 -576
- package/dist/solutions/reactive-layout/index.d.ts +32 -576
- package/dist/solutions/reactive-layout/index.js +65 -5
- package/dist/solutions/reactive-layout/node-canvas/index.cjs +127 -117
- package/dist/solutions/reactive-layout/node-canvas/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/node-canvas/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/node-canvas/index.js +3 -3
- package/dist/solutions/reactive-layout/react-native/index.cjs +127 -117
- package/dist/solutions/reactive-layout/react-native/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/react-native/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/react-native/index.js +3 -3
- package/dist/solutions/reactive-layout/skia/index.cjs +127 -117
- package/dist/solutions/reactive-layout/skia/index.cjs.map +1 -1
- package/dist/solutions/reactive-layout/skia/index.d.cts +4 -4
- package/dist/solutions/reactive-layout/skia/index.d.ts +4 -4
- package/dist/solutions/reactive-layout/skia/index.js +3 -3
- package/dist/solutions/work-item/actions.cjs +1609 -1428
- package/dist/solutions/work-item/actions.cjs.map +1 -1
- package/dist/solutions/work-item/actions.d.cts +23 -184
- package/dist/solutions/work-item/actions.d.ts +23 -184
- package/dist/solutions/work-item/actions.js +1558 -934
- package/dist/solutions/work-item/actions.js.map +1 -1
- package/dist/solutions/work-item/scheduling.cjs +9181 -1838
- package/dist/solutions/work-item/scheduling.cjs.map +1 -1
- package/dist/solutions/work-item/scheduling.d.cts +1763 -328
- package/dist/solutions/work-item/scheduling.d.ts +1763 -328
- package/dist/solutions/work-item/scheduling.js +117 -3
- package/dist/solutions/work-item/work-queue.d.cts +7 -7
- package/dist/solutions/work-item/work-queue.d.ts +7 -7
- package/dist/sources/browser.cjs +1318 -1083
- package/dist/sources/browser.cjs.map +1 -1
- package/dist/sources/browser.d.cts +22 -6
- package/dist/sources/browser.d.ts +22 -6
- package/dist/sources/browser.js +4 -4
- package/dist/sources/browser.js.map +1 -1
- package/dist/sources/index.cjs +1318 -1083
- package/dist/sources/index.cjs.map +1 -1
- package/dist/sources/index.d.cts +4 -4
- package/dist/sources/index.d.ts +4 -4
- package/dist/sources/index.js +4 -4
- package/dist/sources/node.d.cts +3 -3
- package/dist/sources/node.d.ts +3 -3
- package/dist/storage/browser.cjs +16 -0
- package/dist/storage/browser.cjs.map +1 -1
- package/dist/storage/browser.js +3 -3
- package/dist/storage/index.cjs +16 -0
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +5 -4
- package/dist/storage/index.d.ts +5 -4
- package/dist/storage/index.js +6 -6
- package/dist/storage/node.cjs +16 -0
- package/dist/storage/node.cjs.map +1 -1
- package/dist/storage/node.js +3 -3
- package/dist/{store-C-joM4gh.d.ts → store-6_CHF6Ge.d.ts} +1 -1
- package/dist/{store-CNJwmT-h.d.cts → store-BljX8RkQ.d.cts} +1 -1
- package/dist/types-BAw2QVVE.d.cts +274 -0
- package/dist/types-BUbbbh4f.d.cts +34 -0
- package/dist/types-CMnzoL54.d.cts +457 -0
- package/dist/{types-CcPIn7sy.d.cts → types-CTN3XoMl.d.cts} +57 -108
- package/dist/types-CV_ohy5T.d.cts +357 -0
- package/dist/{types-BsJvElYZ.d.ts → types-DChxk1vK.d.ts} +57 -108
- package/dist/types-DRu7SnLV.d.ts +274 -0
- package/dist/types-DeID_FRl.d.ts +34 -0
- package/dist/types-IhKH0hGW.d.ts +357 -0
- package/dist/types-ePlD2uyT.d.ts +457 -0
- package/dist/{work-item-runtime-qaVgsL0T.d.cts → work-item-runtime-types-BTxLskN5.d.cts} +3 -93
- package/dist/{work-item-runtime-C3M79vE9.d.ts → work-item-runtime-types-DAsZbb2y.d.ts} +3 -93
- package/dist/work-queue/index.cjs +957 -953
- package/dist/work-queue/index.cjs.map +1 -1
- package/dist/work-queue/index.d.cts +9 -357
- package/dist/work-queue/index.d.ts +9 -357
- package/dist/work-queue/index.js +957 -953
- package/dist/work-queue/index.js.map +1 -1
- package/package.json +611 -513
- package/dist/chunk-3JR3EDB2.js.map +0 -1
- package/dist/chunk-4VLAQHZI.js.map +0 -1
- package/dist/chunk-6XAIOL3X.js +0 -2407
- package/dist/chunk-6XAIOL3X.js.map +0 -1
- package/dist/chunk-FBUU43PM.js.map +0 -1
- package/dist/chunk-HKK2JD7Z.js.map +0 -1
- package/dist/chunk-PC3BTTBE.js +0 -3217
- package/dist/chunk-PC3BTTBE.js.map +0 -1
- package/dist/chunk-QFY4AFY4.js.map +0 -1
- package/dist/chunk-SS2A464I.js.map +0 -1
- package/dist/chunk-V7CIJE4B.js.map +0 -1
- package/dist/chunk-XKXWK2KP.js.map +0 -1
- package/dist/chunk-YDSIVHRR.js.map +0 -1
- package/dist/chunk-YXMZ2N6J.js.map +0 -1
- /package/dist/{chunk-CZNV3VXM.js.map → chunk-3J7UPZL5.js.map} +0 -0
- /package/dist/{chunk-Z2ANQ6JW.js.map → chunk-4Q77MMJY.js.map} +0 -0
- /package/dist/{chunk-K3FXTC3I.js.map → chunk-HJACH5PU.js.map} +0 -0
- /package/dist/{chunk-GTPCOEOZ.js.map → chunk-IDMLXLLG.js.map} +0 -0
- /package/dist/{chunk-DKP56CSW.js.map → chunk-JKAYLDQV.js.map} +0 -0
- /package/dist/{chunk-43BKLFZU.js.map → chunk-KFURM6FM.js.map} +0 -0
- /package/dist/{chunk-2747WN4Y.js.map → chunk-PUSRRALM.js.map} +0 -0
- /package/dist/{chunk-VTHLCFN4.js.map → chunk-RAHNUYA5.js.map} +0 -0
- /package/dist/{chunk-IXZBUWSP.js.map → chunk-UEMN5URK.js.map} +0 -0
- /package/dist/{chunk-6PHB5CJS.js.map → chunk-ZLFRB6FI.js.map} +0 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
import { DataIssue } from '../data/index.js';
|
|
2
|
+
import { d as Graph } from '../graph-CS0b4V9B.js';
|
|
3
|
+
import { N as Node } from '../types-DChxk1vK.js';
|
|
4
|
+
import '../core/index.js';
|
|
5
|
+
import '../messages-CAzUPPJM.js';
|
|
6
|
+
import '../codec-BB7p8fJc.js';
|
|
7
|
+
import '../describe-cYr_Z5zm.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Focused NestJS boundary bindings for GraphReFly (D474/D478).
|
|
11
|
+
*
|
|
12
|
+
* This subpath stays dependency-light: it exposes graph boundary primitives,
|
|
13
|
+
* token/provider shapes, and decorator metadata without importing Nest itself.
|
|
14
|
+
* User-land Nest modules/controllers bind these helpers to real decorators and
|
|
15
|
+
* host lifecycle objects at the framework edge.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
declare const NEST_BOUNDARY_ENVELOPE_VERSION = 1;
|
|
19
|
+
declare const NEST_BOUNDARY_PAYLOAD_MAX_BYTES: number;
|
|
20
|
+
declare const NEST_HTTP_DIAGNOSTICS_MAX_RETAINED = 100;
|
|
21
|
+
/** D478 minimal graph-visible transport envelope. Payload must be data-only. */
|
|
22
|
+
interface NestBoundaryEnvelope<T = unknown> {
|
|
23
|
+
readonly bindingId: string;
|
|
24
|
+
readonly version: number;
|
|
25
|
+
readonly payload: T;
|
|
26
|
+
readonly requestId?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Reply-capable egress must carry host-private request correlation (D478). */
|
|
29
|
+
type NestReplyEnvelope<T = unknown> = NestBoundaryEnvelope<T> & {
|
|
30
|
+
readonly requestId: string;
|
|
31
|
+
};
|
|
32
|
+
type NestBoundaryKind = "request" | "guard" | "interceptor" | "error" | "lifecycle" | "cron" | "diagnostics" | "ws" | "message";
|
|
33
|
+
type NestEgressKind = "http" | "guard-decision" | "ws-ack" | "ws-reply" | "message-reply";
|
|
34
|
+
type NestFilterMode = "handle" | "observe";
|
|
35
|
+
type NestDiagnosticPhase = "adapter" | "http" | "guard" | "filter" | "cron" | "lifecycle" | "ws" | "message" | NestBoundaryKind | NestEgressKind;
|
|
36
|
+
interface NestHttpResponsePayload<TBody = unknown> {
|
|
37
|
+
readonly status: number;
|
|
38
|
+
readonly body?: TBody;
|
|
39
|
+
readonly headers?: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
interface HttpDataIssue extends DataIssue {
|
|
42
|
+
readonly status: number;
|
|
43
|
+
readonly body?: unknown;
|
|
44
|
+
readonly headers?: Record<string, string>;
|
|
45
|
+
}
|
|
46
|
+
type NestIssueResponse<THost = unknown> = (issue: DataIssue, host: THost) => NestHttpResponsePayload;
|
|
47
|
+
type NestProtocolErrorResponse<THost = unknown> = (errorPayload: unknown, host: THost) => NestHttpResponsePayload;
|
|
48
|
+
interface NestBoundaryDiagnostic {
|
|
49
|
+
readonly kind: "binding-mismatch" | "dispose-pending" | "malformed-egress" | "stale-egress" | "terminal-egress" | "timeout" | "resolve-threw" | "reject-threw";
|
|
50
|
+
readonly phase?: NestDiagnosticPhase;
|
|
51
|
+
readonly requestId?: string;
|
|
52
|
+
readonly bindingId?: string;
|
|
53
|
+
readonly expectedBindingId?: string;
|
|
54
|
+
readonly message: string;
|
|
55
|
+
readonly error?: unknown;
|
|
56
|
+
}
|
|
57
|
+
interface NestDiagnosticErrorPayload {
|
|
58
|
+
readonly name?: string;
|
|
59
|
+
readonly message: string;
|
|
60
|
+
}
|
|
61
|
+
interface NestDiagnosticPayload {
|
|
62
|
+
readonly kind: NestBoundaryDiagnostic["kind"];
|
|
63
|
+
readonly phase: NestDiagnosticPhase;
|
|
64
|
+
readonly requestId?: string;
|
|
65
|
+
readonly bindingId?: string;
|
|
66
|
+
readonly expectedBindingId?: string;
|
|
67
|
+
readonly message: string;
|
|
68
|
+
readonly error?: NestDiagnosticErrorPayload;
|
|
69
|
+
}
|
|
70
|
+
interface NestDiagnosticInput extends NestBoundaryDiagnostic {
|
|
71
|
+
readonly phase?: NestDiagnosticPhase;
|
|
72
|
+
}
|
|
73
|
+
interface NestDiagnosticsOptions extends Omit<NestIngressOptions<NestDiagnosticInput, NestDiagnosticPayload>, "payload"> {
|
|
74
|
+
readonly phase?: NestDiagnosticPhase;
|
|
75
|
+
}
|
|
76
|
+
type NestDiagnosticIngressBoundary = NestIngressBoundary<NestDiagnosticInput, NestDiagnosticPayload>;
|
|
77
|
+
interface NestIngressBoundary<THost = unknown, TPayload = THost> {
|
|
78
|
+
readonly kind: NestBoundaryKind;
|
|
79
|
+
readonly bindingId: string;
|
|
80
|
+
readonly version: number;
|
|
81
|
+
readonly node: Node<NestBoundaryEnvelope<TPayload>>;
|
|
82
|
+
envelope(host: THost, opts?: NestIngressEmitOptions<TPayload>): NestBoundaryEnvelope<TPayload>;
|
|
83
|
+
emit(host: THost, opts?: NestIngressEmitOptions<TPayload>): NestBoundaryEnvelope<TPayload>;
|
|
84
|
+
}
|
|
85
|
+
interface NestIngressOptions<THost, TPayload> {
|
|
86
|
+
readonly bindingId?: string;
|
|
87
|
+
readonly name?: string;
|
|
88
|
+
readonly version?: number;
|
|
89
|
+
readonly maxPayloadBytes?: number;
|
|
90
|
+
readonly requestId?: string | ((host: THost) => string | undefined);
|
|
91
|
+
readonly requireRequestId?: boolean;
|
|
92
|
+
readonly payload?: (host: THost) => TPayload;
|
|
93
|
+
}
|
|
94
|
+
interface NestIngressEmitOptions<TPayload> {
|
|
95
|
+
readonly requestId?: string;
|
|
96
|
+
readonly bindingId?: string;
|
|
97
|
+
readonly version?: number;
|
|
98
|
+
readonly payload?: TPayload;
|
|
99
|
+
readonly requireRequestId?: boolean;
|
|
100
|
+
}
|
|
101
|
+
interface NestReplyResponseHandle<TPayload> {
|
|
102
|
+
resolve(payload: TPayload, envelope: NestReplyEnvelope<TPayload>): void;
|
|
103
|
+
reject(error: unknown, envelope?: NestReplyEnvelope<TPayload>): void;
|
|
104
|
+
}
|
|
105
|
+
interface NestReplyPendingRegistration<TPayload> {
|
|
106
|
+
readonly requestId: string;
|
|
107
|
+
readonly handle: NestReplyResponseHandle<TPayload>;
|
|
108
|
+
readonly bindingId?: string;
|
|
109
|
+
}
|
|
110
|
+
interface NestReplyBoundary<TPayload = unknown> {
|
|
111
|
+
readonly kind: NestEgressKind;
|
|
112
|
+
readonly bindingId: string;
|
|
113
|
+
attach(registration: NestReplyPendingRegistration<TPayload>): () => boolean;
|
|
114
|
+
pendingCount(): number;
|
|
115
|
+
diagnostics(): readonly NestBoundaryDiagnostic[];
|
|
116
|
+
dispose(): void;
|
|
117
|
+
}
|
|
118
|
+
interface NestHttpResponseHandle<TPayload> extends NestReplyResponseHandle<TPayload> {
|
|
119
|
+
}
|
|
120
|
+
interface NestHttpPendingRegistration<TPayload> extends NestReplyPendingRegistration<TPayload> {
|
|
121
|
+
}
|
|
122
|
+
interface NestHttpBoundary<TPayload = unknown> extends NestReplyBoundary<TPayload> {
|
|
123
|
+
readonly kind: "http";
|
|
124
|
+
}
|
|
125
|
+
interface ToNestHttpOptions<TPayload> {
|
|
126
|
+
readonly bindingId?: string;
|
|
127
|
+
readonly diagnosticBoundary?: NestDiagnosticIngressBoundary;
|
|
128
|
+
readonly diagnosticPhase?: NestDiagnosticPhase;
|
|
129
|
+
readonly maxDiagnostics?: number;
|
|
130
|
+
readonly maxPayloadBytes?: number;
|
|
131
|
+
readonly name?: string;
|
|
132
|
+
readonly transform?: (payload: TPayload, envelope: NestReplyEnvelope<TPayload>) => TPayload;
|
|
133
|
+
readonly label?: string;
|
|
134
|
+
}
|
|
135
|
+
interface NestBoundaryDecoratorOptions<THost = unknown, TPayload = unknown> {
|
|
136
|
+
readonly bindingId?: string;
|
|
137
|
+
readonly payload?: (host: THost) => TPayload;
|
|
138
|
+
readonly requestId?: string | ((host: THost) => string | undefined);
|
|
139
|
+
readonly order?: number;
|
|
140
|
+
}
|
|
141
|
+
interface NestFilterDecoratorOptions<THost = unknown, TPayload = unknown> extends NestBoundaryDecoratorOptions<THost, TPayload> {
|
|
142
|
+
readonly mode?: NestFilterMode;
|
|
143
|
+
readonly issueResponse?: NestIssueResponse<THost>;
|
|
144
|
+
readonly protocolError?: NestProtocolErrorResponse<THost>;
|
|
145
|
+
}
|
|
146
|
+
interface NestHttpReplyDecoratorOptions<THost = unknown> {
|
|
147
|
+
readonly bindingId: string;
|
|
148
|
+
readonly order?: number;
|
|
149
|
+
readonly issueResponse?: NestIssueResponse<THost>;
|
|
150
|
+
readonly protocolError?: NestProtocolErrorResponse<THost>;
|
|
151
|
+
}
|
|
152
|
+
interface NestGuardDecisionDecoratorOptions<THost = unknown> {
|
|
153
|
+
readonly bindingId: string;
|
|
154
|
+
readonly order?: number;
|
|
155
|
+
readonly issueResponse?: NestIssueResponse<THost>;
|
|
156
|
+
readonly protocolError?: NestProtocolErrorResponse<THost>;
|
|
157
|
+
}
|
|
158
|
+
interface NestGraphRunOptions<THost = unknown> {
|
|
159
|
+
readonly requestId?: string | ((host: THost) => string | undefined);
|
|
160
|
+
}
|
|
161
|
+
interface NestGraphBoundaryRunnerOptions {
|
|
162
|
+
readonly diagnosticBoundary?: NestDiagnosticIngressBoundary;
|
|
163
|
+
readonly diagnosticPhase?: NestDiagnosticPhase;
|
|
164
|
+
}
|
|
165
|
+
interface NestGraphBoundaryRunner {
|
|
166
|
+
run<THost = unknown>(target: DecoratorHostConstructor | object, methodKey: string | symbol, host: THost, opts?: NestGraphRunOptions<THost>): Promise<unknown> | undefined;
|
|
167
|
+
dispose(): void;
|
|
168
|
+
}
|
|
169
|
+
interface NestExecutionContextLike {
|
|
170
|
+
getClass(): DecoratorHostConstructor;
|
|
171
|
+
getHandler(): DecoratorBoundMethod;
|
|
172
|
+
switchToHttp?(): {
|
|
173
|
+
getRequest<T = unknown>(): T;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
interface NestCallHandlerLike {
|
|
177
|
+
handle(): unknown;
|
|
178
|
+
}
|
|
179
|
+
interface NestGraphBoundaryInterceptorOptions<THost = unknown> extends NestGraphRunOptions<THost>, NestGraphBoundaryRunnerOptions {
|
|
180
|
+
readonly host?: (context: NestExecutionContextLike) => THost;
|
|
181
|
+
readonly runner?: NestGraphBoundaryRunner;
|
|
182
|
+
}
|
|
183
|
+
interface NestGraphBoundaryInterceptor {
|
|
184
|
+
intercept(context: NestExecutionContextLike, next?: NestCallHandlerLike): Promise<unknown> | unknown;
|
|
185
|
+
dispose(): void;
|
|
186
|
+
}
|
|
187
|
+
/** Injection token for a root graph singleton. */
|
|
188
|
+
declare const GRAPHREFLY_ROOT_GRAPH: unique symbol;
|
|
189
|
+
/** Injection token for adapter module options. */
|
|
190
|
+
declare const GRAPHREFLY_MODULE_OPTIONS: unique symbol;
|
|
191
|
+
/** Injection token for a request-scoped graph. */
|
|
192
|
+
declare const GRAPHREFLY_REQUEST_GRAPH: unique symbol;
|
|
193
|
+
type DecoratorHostConstructor = abstract new (...args: unknown[]) => unknown;
|
|
194
|
+
type DecoratorBoundMethod = (...args: unknown[]) => unknown;
|
|
195
|
+
interface OnGraphEventMeta {
|
|
196
|
+
nodeName: string;
|
|
197
|
+
methodKey: string | symbol;
|
|
198
|
+
}
|
|
199
|
+
interface GraphIntervalMeta {
|
|
200
|
+
ms: number;
|
|
201
|
+
methodKey: string | symbol;
|
|
202
|
+
}
|
|
203
|
+
interface GraphCronMeta {
|
|
204
|
+
expr: string;
|
|
205
|
+
methodKey: string | symbol;
|
|
206
|
+
}
|
|
207
|
+
type NestBoundaryBindingDirection = "ingress" | "egress";
|
|
208
|
+
interface NestIngressBindingMeta {
|
|
209
|
+
readonly direction: "ingress";
|
|
210
|
+
kind: NestBoundaryKind;
|
|
211
|
+
bindingId: string;
|
|
212
|
+
methodKey: string | symbol;
|
|
213
|
+
readonly boundary: NestIngressBoundary<unknown, unknown>;
|
|
214
|
+
readonly payload?: (host: unknown) => unknown;
|
|
215
|
+
readonly requestId?: string | ((host: unknown) => string | undefined);
|
|
216
|
+
readonly order?: number;
|
|
217
|
+
readonly mode?: NestFilterMode;
|
|
218
|
+
readonly issueResponse?: NestIssueResponse<unknown>;
|
|
219
|
+
readonly protocolError?: NestProtocolErrorResponse<unknown>;
|
|
220
|
+
}
|
|
221
|
+
interface NestHttpReplyBindingMeta {
|
|
222
|
+
readonly direction: "egress";
|
|
223
|
+
readonly kind: "http";
|
|
224
|
+
readonly bindingId: string;
|
|
225
|
+
readonly methodKey: string | symbol;
|
|
226
|
+
readonly replyNode: Node<NestReplyEnvelope<unknown>>;
|
|
227
|
+
readonly order?: number;
|
|
228
|
+
readonly issueResponse?: NestIssueResponse<unknown>;
|
|
229
|
+
readonly protocolError?: NestProtocolErrorResponse<unknown>;
|
|
230
|
+
}
|
|
231
|
+
interface NestGuardDecisionBindingMeta {
|
|
232
|
+
readonly direction: "egress";
|
|
233
|
+
readonly kind: "guard-decision";
|
|
234
|
+
readonly bindingId: string;
|
|
235
|
+
readonly methodKey: string | symbol;
|
|
236
|
+
readonly decisionNode: Node<NestReplyEnvelope<GraphGuardDecision>>;
|
|
237
|
+
readonly order?: number;
|
|
238
|
+
readonly issueResponse?: NestIssueResponse<unknown>;
|
|
239
|
+
readonly protocolError?: NestProtocolErrorResponse<unknown>;
|
|
240
|
+
}
|
|
241
|
+
interface NestWsAckBindingMeta {
|
|
242
|
+
readonly direction: "egress";
|
|
243
|
+
readonly kind: "ws-ack";
|
|
244
|
+
readonly bindingId: string;
|
|
245
|
+
readonly methodKey: string | symbol;
|
|
246
|
+
readonly ackNode: Node<NestReplyEnvelope<unknown>>;
|
|
247
|
+
readonly order?: number;
|
|
248
|
+
}
|
|
249
|
+
interface NestWsReplyBindingMeta {
|
|
250
|
+
readonly direction: "egress";
|
|
251
|
+
readonly kind: "ws-reply";
|
|
252
|
+
readonly bindingId: string;
|
|
253
|
+
readonly methodKey: string | symbol;
|
|
254
|
+
readonly replyNode: Node<NestReplyEnvelope<unknown>>;
|
|
255
|
+
readonly order?: number;
|
|
256
|
+
}
|
|
257
|
+
interface NestMessageReplyBindingMeta {
|
|
258
|
+
readonly direction: "egress";
|
|
259
|
+
readonly kind: "message-reply";
|
|
260
|
+
readonly bindingId: string;
|
|
261
|
+
readonly methodKey: string | symbol;
|
|
262
|
+
readonly replyNode: Node<NestReplyEnvelope<unknown>>;
|
|
263
|
+
readonly order?: number;
|
|
264
|
+
}
|
|
265
|
+
type NestBoundaryBindingMeta = NestIngressBindingMeta | NestHttpReplyBindingMeta | NestGuardDecisionBindingMeta | NestWsAckBindingMeta | NestWsReplyBindingMeta | NestMessageReplyBindingMeta;
|
|
266
|
+
declare const EVENT_HANDLERS: WeakMap<DecoratorHostConstructor, OnGraphEventMeta[]>;
|
|
267
|
+
declare const INTERVAL_HANDLERS: WeakMap<DecoratorHostConstructor, GraphIntervalMeta[]>;
|
|
268
|
+
declare const CRON_HANDLERS: WeakMap<DecoratorHostConstructor, GraphCronMeta[]>;
|
|
269
|
+
declare const NEST_BOUNDARY_BINDINGS: WeakMap<DecoratorHostConstructor, NestBoundaryBindingMeta[]>;
|
|
270
|
+
type GraphMethodDecorator = MethodDecorator & ((value: DecoratorBoundMethod, context: ClassMethodDecoratorContext) => void);
|
|
271
|
+
/** Minimal Nest provider object shape without importing @nestjs/common. */
|
|
272
|
+
type NestProviderBinding<T = unknown> = {
|
|
273
|
+
readonly provide: string | symbol;
|
|
274
|
+
readonly useValue: T;
|
|
275
|
+
} | {
|
|
276
|
+
readonly provide: string | symbol;
|
|
277
|
+
readonly useFactory: (...args: unknown[]) => T;
|
|
278
|
+
};
|
|
279
|
+
/** Get the injection token for a named feature graph. */
|
|
280
|
+
declare function getGraphToken(name: string): symbol;
|
|
281
|
+
/** Get the injection token for a node at a qualified path. */
|
|
282
|
+
declare function getNodeToken(path: string): symbol;
|
|
283
|
+
/** Get the injection token for a named Nest boundary binding. */
|
|
284
|
+
declare function getNestBoundaryToken(bindingId: string): symbol;
|
|
285
|
+
/** Build a dependency-free provider binding shape for user-land Nest modules. */
|
|
286
|
+
declare function nestProvider<T>(provide: string | symbol, useValue: T): NestProviderBinding<T>;
|
|
287
|
+
/** D474 P0 HTTP request ingress. */
|
|
288
|
+
declare function fromNestReq<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
289
|
+
/** D474 P0 guard/admission ingress. */
|
|
290
|
+
declare function fromNestGuard<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
291
|
+
/** D474 P1 interceptor ingress. */
|
|
292
|
+
declare function fromNestIntercept<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
293
|
+
/** D474 P0 error/filter ingress. */
|
|
294
|
+
declare function fromNestError<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
295
|
+
/** D474 P1 Nest lifecycle hook ingress. */
|
|
296
|
+
declare function fromNestLifecycle<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
297
|
+
/** D474 P1 schedule/cron ingress. */
|
|
298
|
+
declare function fromNestCron<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
299
|
+
/** D494 explicit graph-visible diagnostics ingress. Emits sanitized data-only payloads. */
|
|
300
|
+
declare function fromNestDiagnostics(graph: Graph, opts?: NestDiagnosticsOptions): NestDiagnosticIngressBoundary;
|
|
301
|
+
/** D474 later/optional WebSocket ingress. Kept thin for first-slice experiments. */
|
|
302
|
+
declare function fromNestWs<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
303
|
+
/** D474 later/optional microservice/message ingress. */
|
|
304
|
+
declare function fromNestMessage<THost = unknown, TPayload = THost>(graph: Graph, opts?: NestIngressOptions<THost, TPayload>): NestIngressBoundary<THost, TPayload>;
|
|
305
|
+
/**
|
|
306
|
+
* D474 HTTP egress resolver.
|
|
307
|
+
*
|
|
308
|
+
* The returned boundary owns only a host-private pending map. It never stores
|
|
309
|
+
* response/socket/ack handles in graph DATA and only resolves handles whose
|
|
310
|
+
* requestId (and optional bindingId) match an egress envelope.
|
|
311
|
+
*/
|
|
312
|
+
declare function toNestHttp<TPayload = unknown>(egress: Node<NestReplyEnvelope<TPayload>>, opts?: ToNestHttpOptions<TPayload>): NestHttpBoundary<TPayload>;
|
|
313
|
+
/** D478 route-request decorator over an existing ingress boundary. */
|
|
314
|
+
declare function GraphReq<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestBoundaryDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
315
|
+
/** D478 route-guard decorator over an existing ingress boundary. */
|
|
316
|
+
declare function GraphGuard<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestBoundaryDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
317
|
+
/** D478 route-interceptor decorator over an existing ingress boundary. */
|
|
318
|
+
declare function GraphIntercept<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestBoundaryDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
319
|
+
/** D484 generic filter decorator over an existing ingress boundary. */
|
|
320
|
+
declare function GraphFilter<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestFilterDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
321
|
+
/** D484 exception-oriented sugar over GraphFilter. */
|
|
322
|
+
declare function GraphError<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestFilterDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
323
|
+
/** D478 lifecycle decorator over an existing ingress boundary. */
|
|
324
|
+
declare function GraphLifecycle<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestBoundaryDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
325
|
+
/** D478 cron/schedule decorator over an existing ingress boundary. */
|
|
326
|
+
declare function GraphCron<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestBoundaryDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
327
|
+
/** D488 WebSocket message ingress decorator over an existing boundary. */
|
|
328
|
+
declare function GraphWs<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestBoundaryDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
329
|
+
/** D488 microservice/message ingress decorator over an existing boundary. */
|
|
330
|
+
declare function GraphMessage<THost = unknown, TPayload = unknown>(boundary: NestIngressBoundary<THost, TPayload>, opts?: NestBoundaryDecoratorOptions<THost, TPayload>): GraphMethodDecorator;
|
|
331
|
+
/** D478 HTTP reply decorator over an existing reply node. */
|
|
332
|
+
declare function GraphHttpReply<THost = unknown, TPayload = unknown>(replyNode: Node<NestReplyEnvelope<TPayload>>, opts: NestHttpReplyDecoratorOptions<THost>): GraphMethodDecorator;
|
|
333
|
+
type GraphGuardDecision = {
|
|
334
|
+
readonly kind: "allow";
|
|
335
|
+
readonly reason?: string;
|
|
336
|
+
readonly metadata?: Record<string, unknown>;
|
|
337
|
+
} | {
|
|
338
|
+
readonly kind: "deny";
|
|
339
|
+
readonly reason?: string;
|
|
340
|
+
readonly status?: number;
|
|
341
|
+
readonly body?: unknown;
|
|
342
|
+
readonly headers?: Record<string, string>;
|
|
343
|
+
readonly issue?: DataIssue | HttpDataIssue;
|
|
344
|
+
readonly metadata?: Record<string, unknown>;
|
|
345
|
+
};
|
|
346
|
+
/** D484 guard decision egress decorator over an existing reply-correlated decision node. */
|
|
347
|
+
declare function GraphGuardDecision<THost = unknown>(decisionNode: Node<NestReplyEnvelope<GraphGuardDecision>>, opts: NestGuardDecisionDecoratorOptions<THost>): GraphMethodDecorator;
|
|
348
|
+
/** D488 WebSocket acknowledgement egress decorator over an existing reply-correlated node. */
|
|
349
|
+
declare function GraphWsAck<TPayload = unknown>(ackNode: Node<NestReplyEnvelope<TPayload>>, opts: {
|
|
350
|
+
readonly bindingId: string;
|
|
351
|
+
readonly order?: number;
|
|
352
|
+
}): GraphMethodDecorator;
|
|
353
|
+
/** D488 WebSocket reply egress decorator over an existing reply-correlated node. */
|
|
354
|
+
declare function GraphWsReply<TPayload = unknown>(replyNode: Node<NestReplyEnvelope<TPayload>>, opts: {
|
|
355
|
+
readonly bindingId: string;
|
|
356
|
+
readonly order?: number;
|
|
357
|
+
}): GraphMethodDecorator;
|
|
358
|
+
/** D488 microservice/message reply egress decorator over an existing reply-correlated node. */
|
|
359
|
+
declare function GraphMessageReply<TPayload = unknown>(replyNode: Node<NestReplyEnvelope<TPayload>>, opts: {
|
|
360
|
+
readonly bindingId: string;
|
|
361
|
+
readonly order?: number;
|
|
362
|
+
}): GraphMethodDecorator;
|
|
363
|
+
declare function createNestGraphBoundaryRunner(opts?: NestGraphBoundaryRunnerOptions): NestGraphBoundaryRunner;
|
|
364
|
+
declare function createNestGraphBoundaryInterceptor<THost = unknown>(opts?: NestGraphBoundaryInterceptorOptions<THost>): NestGraphBoundaryInterceptor;
|
|
365
|
+
declare function getNestBoundaryBindings(target: DecoratorHostConstructor | object, methodKey?: string | symbol): readonly NestBoundaryBindingMeta[];
|
|
366
|
+
declare function resolveNestMethodKey(ctor: DecoratorHostConstructor, handler: DecoratorBoundMethod): string | symbol | undefined;
|
|
367
|
+
declare function bindingRequestId<THost>(host: THost, binding: NestBoundaryBindingMeta, fallback?: string | ((host: THost) => string | undefined)): string | undefined;
|
|
368
|
+
declare function bindingEmitOptions<THost>(host: THost, binding: NestIngressBindingMeta, requestId?: string): NestIngressEmitOptions<unknown>;
|
|
369
|
+
declare function isDataIssue(value: unknown): value is DataIssue;
|
|
370
|
+
declare function isHttpDataIssue(value: unknown): value is HttpDataIssue;
|
|
371
|
+
declare function issueResponse<THost = unknown>(issue: DataIssue, _host?: THost): NestHttpResponsePayload;
|
|
372
|
+
declare function protocolError<THost = unknown>(_errorPayload: unknown, _host?: THost): NestHttpResponsePayload;
|
|
373
|
+
declare function lowerHttpReplyPayload<THost = unknown>(payload: unknown, host: THost, opts?: {
|
|
374
|
+
readonly issueResponse?: NestIssueResponse<THost>;
|
|
375
|
+
}): NestHttpResponsePayload;
|
|
376
|
+
declare function lowerProtocolError<THost = unknown>(errorPayload: unknown, host: THost, opts?: {
|
|
377
|
+
readonly protocolError?: NestProtocolErrorResponse<THost>;
|
|
378
|
+
}): NestHttpResponsePayload;
|
|
379
|
+
declare function sanitizeNestDiagnostic(diagnostic: NestDiagnosticInput, defaultPhase?: NestDiagnosticPhase): NestDiagnosticPayload;
|
|
380
|
+
/** Register a method as a DATA-event handler for a graph observe path. */
|
|
381
|
+
declare function OnGraphEvent(nodeName: string): GraphMethodDecorator;
|
|
382
|
+
/** Register fixed-interval metadata for a user-land NestJS scheduler bridge. */
|
|
383
|
+
declare function GraphInterval(ms: number): GraphMethodDecorator;
|
|
384
|
+
|
|
385
|
+
export { CRON_HANDLERS, type DecoratorBoundMethod, type DecoratorHostConstructor, EVENT_HANDLERS, GRAPHREFLY_MODULE_OPTIONS, GRAPHREFLY_REQUEST_GRAPH, GRAPHREFLY_ROOT_GRAPH, GraphCron, type GraphCronMeta, GraphError, GraphFilter, GraphGuard, GraphGuardDecision, GraphHttpReply, GraphIntercept, GraphInterval, type GraphIntervalMeta, GraphLifecycle, GraphMessage, GraphMessageReply, type GraphMethodDecorator, GraphReq, GraphWs, GraphWsAck, GraphWsReply, type HttpDataIssue, INTERVAL_HANDLERS, NEST_BOUNDARY_BINDINGS, NEST_BOUNDARY_ENVELOPE_VERSION, NEST_BOUNDARY_PAYLOAD_MAX_BYTES, NEST_HTTP_DIAGNOSTICS_MAX_RETAINED, type NestBoundaryBindingDirection, type NestBoundaryBindingMeta, type NestBoundaryDecoratorOptions, type NestBoundaryDiagnostic, type NestBoundaryEnvelope, type NestBoundaryKind, type NestCallHandlerLike, type NestDiagnosticErrorPayload, type NestDiagnosticIngressBoundary, type NestDiagnosticInput, type NestDiagnosticPayload, type NestDiagnosticPhase, type NestDiagnosticsOptions, type NestEgressKind, type NestExecutionContextLike, type NestFilterDecoratorOptions, type NestFilterMode, type NestGraphBoundaryInterceptor, type NestGraphBoundaryInterceptorOptions, type NestGraphBoundaryRunner, type NestGraphBoundaryRunnerOptions, type NestGraphRunOptions, type NestGuardDecisionBindingMeta, type NestGuardDecisionDecoratorOptions, type NestHttpBoundary, type NestHttpPendingRegistration, type NestHttpReplyBindingMeta, type NestHttpReplyDecoratorOptions, type NestHttpResponseHandle, type NestHttpResponsePayload, type NestIngressBindingMeta, type NestIngressBoundary, type NestIngressEmitOptions, type NestIngressOptions, type NestIssueResponse, type NestMessageReplyBindingMeta, type NestProtocolErrorResponse, type NestProviderBinding, type NestReplyBoundary, type NestReplyEnvelope, type NestReplyPendingRegistration, type NestReplyResponseHandle, type NestWsAckBindingMeta, type NestWsReplyBindingMeta, OnGraphEvent, type OnGraphEventMeta, type ToNestHttpOptions, bindingEmitOptions, bindingRequestId, createNestGraphBoundaryInterceptor, createNestGraphBoundaryRunner, fromNestCron, fromNestDiagnostics, fromNestError, fromNestGuard, fromNestIntercept, fromNestLifecycle, fromNestMessage, fromNestReq, fromNestWs, getGraphToken, getNestBoundaryBindings, getNestBoundaryToken, getNodeToken, isDataIssue, isHttpDataIssue, issueResponse, lowerHttpReplyPayload, lowerProtocolError, nestProvider, protocolError, resolveNestMethodKey, sanitizeNestDiagnostic, toNestHttp };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CRON_HANDLERS,
|
|
3
|
+
EVENT_HANDLERS,
|
|
4
|
+
GRAPHREFLY_MODULE_OPTIONS,
|
|
5
|
+
GRAPHREFLY_REQUEST_GRAPH,
|
|
6
|
+
GRAPHREFLY_ROOT_GRAPH,
|
|
7
|
+
GraphCron,
|
|
8
|
+
GraphError,
|
|
9
|
+
GraphFilter,
|
|
10
|
+
GraphGuard,
|
|
11
|
+
GraphGuardDecision,
|
|
12
|
+
GraphHttpReply,
|
|
13
|
+
GraphIntercept,
|
|
14
|
+
GraphInterval,
|
|
15
|
+
GraphLifecycle,
|
|
16
|
+
GraphMessage,
|
|
17
|
+
GraphMessageReply,
|
|
18
|
+
GraphReq,
|
|
19
|
+
GraphWs,
|
|
20
|
+
GraphWsAck,
|
|
21
|
+
GraphWsReply,
|
|
22
|
+
INTERVAL_HANDLERS,
|
|
23
|
+
NEST_BOUNDARY_BINDINGS,
|
|
24
|
+
NEST_BOUNDARY_ENVELOPE_VERSION,
|
|
25
|
+
NEST_BOUNDARY_PAYLOAD_MAX_BYTES,
|
|
26
|
+
NEST_HTTP_DIAGNOSTICS_MAX_RETAINED,
|
|
27
|
+
OnGraphEvent,
|
|
28
|
+
bindingEmitOptions,
|
|
29
|
+
bindingRequestId,
|
|
30
|
+
createNestGraphBoundaryInterceptor,
|
|
31
|
+
createNestGraphBoundaryRunner,
|
|
32
|
+
fromNestCron,
|
|
33
|
+
fromNestDiagnostics,
|
|
34
|
+
fromNestError,
|
|
35
|
+
fromNestGuard,
|
|
36
|
+
fromNestIntercept,
|
|
37
|
+
fromNestLifecycle,
|
|
38
|
+
fromNestMessage,
|
|
39
|
+
fromNestReq,
|
|
40
|
+
fromNestWs,
|
|
41
|
+
getGraphToken,
|
|
42
|
+
getNestBoundaryBindings,
|
|
43
|
+
getNestBoundaryToken,
|
|
44
|
+
getNodeToken,
|
|
45
|
+
isDataIssue,
|
|
46
|
+
isHttpDataIssue,
|
|
47
|
+
issueResponse,
|
|
48
|
+
lowerHttpReplyPayload,
|
|
49
|
+
lowerProtocolError,
|
|
50
|
+
nestProvider,
|
|
51
|
+
protocolError,
|
|
52
|
+
resolveNestMethodKey,
|
|
53
|
+
sanitizeNestDiagnostic,
|
|
54
|
+
toNestHttp
|
|
55
|
+
} from "../chunk-MQEQMS7B.js";
|
|
56
|
+
import "../chunk-DGUM43GV.js";
|
|
57
|
+
export {
|
|
58
|
+
CRON_HANDLERS,
|
|
59
|
+
EVENT_HANDLERS,
|
|
60
|
+
GRAPHREFLY_MODULE_OPTIONS,
|
|
61
|
+
GRAPHREFLY_REQUEST_GRAPH,
|
|
62
|
+
GRAPHREFLY_ROOT_GRAPH,
|
|
63
|
+
GraphCron,
|
|
64
|
+
GraphError,
|
|
65
|
+
GraphFilter,
|
|
66
|
+
GraphGuard,
|
|
67
|
+
GraphGuardDecision,
|
|
68
|
+
GraphHttpReply,
|
|
69
|
+
GraphIntercept,
|
|
70
|
+
GraphInterval,
|
|
71
|
+
GraphLifecycle,
|
|
72
|
+
GraphMessage,
|
|
73
|
+
GraphMessageReply,
|
|
74
|
+
GraphReq,
|
|
75
|
+
GraphWs,
|
|
76
|
+
GraphWsAck,
|
|
77
|
+
GraphWsReply,
|
|
78
|
+
INTERVAL_HANDLERS,
|
|
79
|
+
NEST_BOUNDARY_BINDINGS,
|
|
80
|
+
NEST_BOUNDARY_ENVELOPE_VERSION,
|
|
81
|
+
NEST_BOUNDARY_PAYLOAD_MAX_BYTES,
|
|
82
|
+
NEST_HTTP_DIAGNOSTICS_MAX_RETAINED,
|
|
83
|
+
OnGraphEvent,
|
|
84
|
+
bindingEmitOptions,
|
|
85
|
+
bindingRequestId,
|
|
86
|
+
createNestGraphBoundaryInterceptor,
|
|
87
|
+
createNestGraphBoundaryRunner,
|
|
88
|
+
fromNestCron,
|
|
89
|
+
fromNestDiagnostics,
|
|
90
|
+
fromNestError,
|
|
91
|
+
fromNestGuard,
|
|
92
|
+
fromNestIntercept,
|
|
93
|
+
fromNestLifecycle,
|
|
94
|
+
fromNestMessage,
|
|
95
|
+
fromNestReq,
|
|
96
|
+
fromNestWs,
|
|
97
|
+
getGraphToken,
|
|
98
|
+
getNestBoundaryBindings,
|
|
99
|
+
getNestBoundaryToken,
|
|
100
|
+
getNodeToken,
|
|
101
|
+
isDataIssue,
|
|
102
|
+
isHttpDataIssue,
|
|
103
|
+
issueResponse,
|
|
104
|
+
lowerHttpReplyPayload,
|
|
105
|
+
lowerProtocolError,
|
|
106
|
+
nestProvider,
|
|
107
|
+
protocolError,
|
|
108
|
+
resolveNestMethodKey,
|
|
109
|
+
sanitizeNestDiagnostic,
|
|
110
|
+
toNestHttp
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=nestjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { O as ObserveEvent, d as Graph } from '../graph-
|
|
1
|
+
import { O as ObserveEvent, d as Graph } from '../graph-C1C-wb0L.cjs';
|
|
2
2
|
import { d as AppendLogStorageTier } from '../append-log-DisvEReb.cjs';
|
|
3
3
|
import { O as ObserveEventFrame } from '../observe-event-log-0SVsx7JG.cjs';
|
|
4
4
|
export { c as ObserveEventLogPage } from '../observe-event-log-0SVsx7JG.cjs';
|
|
5
5
|
import '../core/index.cjs';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-CTN3XoMl.cjs';
|
|
7
7
|
import '../messages-CAzUPPJM.cjs';
|
|
8
8
|
import '../codec-BB7p8fJc.cjs';
|
|
9
|
-
import '../describe-
|
|
9
|
+
import '../describe-BumQ-3_0.cjs';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Graph-bound observe storage adapters.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { O as ObserveEvent, d as Graph } from '../graph-
|
|
1
|
+
import { O as ObserveEvent, d as Graph } from '../graph-CS0b4V9B.js';
|
|
2
2
|
import { d as AppendLogStorageTier } from '../append-log-DzKMmjxx.js';
|
|
3
3
|
import { O as ObserveEventFrame } from '../observe-event-log-Dnm76owp.js';
|
|
4
4
|
export { c as ObserveEventLogPage } from '../observe-event-log-Dnm76owp.js';
|
|
5
5
|
import '../core/index.js';
|
|
6
|
-
import '../types-
|
|
6
|
+
import '../types-DChxk1vK.js';
|
|
7
7
|
import '../messages-CAzUPPJM.js';
|
|
8
8
|
import '../codec-BB7p8fJc.js';
|
|
9
|
-
import '../describe-
|
|
9
|
+
import '../describe-cYr_Z5zm.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Graph-bound observe storage adapters.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
observeEventFrame
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-HJACH5PU.js";
|
|
4
|
+
import "../chunk-ZLFRB6FI.js";
|
|
5
|
+
import "../chunk-JKAYLDQV.js";
|
|
6
|
+
import "../chunk-K7FB3JTD.js";
|
|
7
7
|
import "../chunk-DGUM43GV.js";
|
|
8
8
|
|
|
9
9
|
// src/adapters/observe-storage.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/adapters/react.ts","../../src/adapters/store.ts"],"sourcesContent":["/**\n * React node bindings for GraphReFly (D238).\n *\n * React is imported only from this focused subpath. The dependency-free\n * `@graphrefly/ts/adapters` barrel keeps the framework-neutral store contract.\n */\n\nimport { useCallback, useMemo, useSyncExternalStore } from \"react\";\nimport type { Node } from \"../node/node.js\";\nimport { externalStore, recordReadableStore, type WritableNode } from \"./store.js\";\n\nfunction assertDataValue(value: unknown): void {\n\tif (value === undefined) {\n\t\tthrow new TypeError(\"useNodeInput: undefined is SENTINEL/no DATA, not a writable DATA value\");\n\t}\n}\n\n/** Read a GraphReFly node through React's useSyncExternalStore contract. */\nexport function useNodeValue<T>(node: Node<T>): T | undefined {\n\tconst store = useMemo(() => externalStore(node), [node]);\n\treturn useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);\n}\n\n/**\n * Bind a writable GraphReFly node as `[value, setValue]`.\n *\n * The setter identity is stable for a stable node identity, and writes through\n * the node's reactive DATA boundary rather than a presentation-owned trigger.\n */\nexport function useNodeInput<T>(\n\tnode: WritableNode<T>,\n): readonly [T | undefined, (value: T) => void] {\n\tconst value = useNodeValue(node);\n\tconst setValue = useCallback(\n\t\t(next: T) => {\n\t\t\tassertDataValue(next);\n\t\t\tnode.set(next);\n\t\t},\n\t\t[node],\n\t);\n\treturn [value, setValue] as const;\n}\n\n/**\n * Read a keyed record of nodes.\n *\n * `factory` must have stable identity. Recreating it on every render forces the\n * record subscription graph to rebuild on every render.\n */\nexport function useNodeRecord<K extends string, R extends Record<string, unknown>>(\n\tkeysNode: Node<readonly K[]>,\n\tfactory: (key: K) => { [P in keyof R]: Node<R[P]> },\n): Record<K, R> {\n\tconst store = useMemo(() => {\n\t\tconst recordStore = recordReadableStore(keysNode, factory);\n\t\tlet current = recordStore.get() ?? ({} as Record<K, R>);\n\t\treturn {\n\t\t\tgetSnapshot: () => current,\n\t\t\tsubscribe(onStoreChange: () => void) {\n\t\t\t\treturn recordStore.subscribe((next) => {\n\t\t\t\t\tcurrent = next ?? ({} as Record<K, R>);\n\t\t\t\t\tonStoreChange();\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t}, [keysNode, factory]);\n\tconst getSnapshot = useCallback(() => store.getSnapshot(), [store]);\n\treturn useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);\n}\n","/**\n * Framework-neutral store adapters.\n *\n * Focused framework bindings build on this tiny Node-facing layer without\n * importing framework packages into the dependency-free adapters barrel\n * (D125/D238).\n */\n\nimport type { DeliveryMeta, Sink } from \"../ctx/types.js\";\nimport type { Node } from \"../node/node.js\";\n\n/** A minimal readable store contract shared by Svelte/Nanostores-style adapters. */\nexport interface ReadableStore<T> {\n\tget(): T | undefined;\n\tsubscribe(run: (value: T | undefined) => void): () => void;\n}\n\n/** A minimal writable store contract over a clean-slate writable node. */\nexport interface WritableStore<T> extends ReadableStore<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\n/** React `useSyncExternalStore`-compatible shape, without importing React. */\nexport interface ExternalStore<T> {\n\tgetSnapshot(): T | undefined;\n\tgetServerSnapshot(): T | undefined;\n\tsubscribe(onStoreChange: () => void): () => void;\n}\n\n/** Object-of-nodes factory used by record subscription adapters. */\nexport type NodeRecordFactory<K extends string, R extends Record<string, unknown>> = (key: K) => {\n\t[P in keyof R]: Node<R[P]>;\n};\n\n/** Zustand-compatible store API over a caller-owned clean-slate state node. */\nexport interface ZustandStoreApi<T extends object> {\n\tgetState(): T;\n\tsetState(partial: T | Partial<T> | ((state: T) => T | Partial<T>), replace?: boolean): void;\n\tgetInitialState(): T;\n\tsubscribe(listener: (state: T, prevState: T) => void): () => void;\n\tdestroy(): void;\n}\n\n/** Jotai-style atom facade over a caller-owned node. */\nexport interface JotaiAtom<T> {\n\tget(): T | undefined;\n\tsubscribe(callback: (value: T | undefined) => void): () => void;\n\treadonly _node: Node<T>;\n}\n\n/** Writable Jotai-style atom facade over a caller-owned writable node. */\nexport interface WritableJotaiAtom<T> extends JotaiAtom<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\n/** Nanostores-style atom facade over a caller-owned node. */\nexport interface NanoAtom<T> {\n\tget(): T | undefined;\n\tsubscribe(callback: (value: T | undefined) => void): () => void;\n\tlisten(callback: (value: T | undefined) => void): () => void;\n\treadonly _node: Node<T>;\n}\n\n/** Writable Nanostores-style atom facade over a caller-owned writable node. */\nexport interface WritableNanoAtom<T> extends NanoAtom<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\n/** TC39-Signals-style facade over a caller-owned node. */\nexport interface SignalLike<T> {\n\tget(): T | undefined;\n\tsubscribe(callback: (value: T | undefined) => void): () => void;\n\treadonly _node: Node<T>;\n}\n\n/** Writable TC39-Signals-style facade over a caller-owned writable node. */\nexport interface WritableSignalLike<T> extends SignalLike<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\nexport interface SubscribeValuesOptions<T> {\n\t/** Emit the current cache snapshot immediately. `undefined` means SENTINEL/no DATA. */\n\timmediate?: boolean;\n\t/** Suppress synchronous push-on-subscribe/replay DATA. Useful for change-only store listeners. */\n\tchangesOnly?: boolean;\n\tonError?: (error: unknown) => void;\n\tonComplete?: () => void;\n\t/** Custom cache reader for wrappers that keep their own snapshot object. */\n\tgetSnapshot?: () => T | undefined;\n}\n\nexport interface WritableNode<T> extends Node<T> {\n\tset(value: T): void;\n}\n\nexport interface WritableStoreOptions<T> extends SubscribeValuesOptions<T> {\n\t/** Override writes for adapters that need a framework-owned reducer. */\n\twrite?: (node: WritableNode<T>, value: T) => void;\n}\n\n/** Read a node cache without activating it. */\nexport function nodeSnapshot<T>(node: Node<T>): T | undefined {\n\treturn node.cache as T | undefined;\n}\n\n/**\n * Subscribe to DATA values from a Node. Protocol internals stay below the adapter boundary:\n * DATA drives value listeners, ERROR/COMPLETE route to optional lifecycle callbacks.\n */\nexport function subscribeNodeValues<T>(\n\tnode: Node<T>,\n\trun: (value: T | undefined) => void,\n\topts: SubscribeValuesOptions<T> = {},\n): () => void {\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\tif (opts.immediate) run(read());\n\n\tlet subscribing = true;\n\tconst skipSynchronousHandshakeData = opts.changesOnly || opts.immediate;\n\tconst sink: Sink = (msg, delivery?: DeliveryMeta) => {\n\t\tswitch (msg[0]) {\n\t\t\tcase \"DATA\":\n\t\t\t\tif (skipSynchronousHandshakeData && subscribing && delivery === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\trun(msg[1] as T);\n\t\t\t\treturn;\n\t\t\tcase \"ERROR\":\n\t\t\t\topts.onError?.(msg[1]);\n\t\t\t\treturn;\n\t\t\tcase \"COMPLETE\":\n\t\t\t\topts.onComplete?.();\n\t\t\t\treturn;\n\t\t}\n\t};\n\tconst unsubscribe = node.subscribe(sink);\n\tsubscribing = false;\n\treturn unsubscribe;\n}\n\n/** Build a Svelte/Nanostores-style readable store from a clean-slate Node. */\nexport function readableStore<T>(\n\tnode: Node<T>,\n\topts: SubscribeValuesOptions<T> = {},\n): ReadableStore<T> {\n\treturn {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (run) => subscribeNodeValues(node, run, { immediate: true, ...opts }),\n\t};\n}\n\nfunction hasWritableSet<T>(node: Node<T>): node is WritableNode<T> {\n\treturn typeof (node as { set?: unknown }).set === \"function\";\n}\n\nfunction defaultWrite<T>(node: WritableNode<T>, value: T): void {\n\tnode.set(value);\n}\n\n/** Build a writable store over a StateNode or compatible clean-slate writable Node. */\nexport function writableStore<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableStore<T>;\nexport function writableStore<T>(\n\tnode: Node<T>,\n\topts: WritableStoreOptions<T> & { write: (node: WritableNode<T>, value: T) => void },\n): WritableStore<T>;\nexport function writableStore<T>(\n\tnode: Node<T>,\n\topts: WritableStoreOptions<T> = {},\n): WritableStore<T> {\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\tconst write = opts.write ?? (hasWritableSet(node) ? defaultWrite : undefined);\n\tif (!write) {\n\t\tthrow new TypeError(\"writableStore: node must expose set(value) or opts.write\");\n\t}\n\tconst writable = node as WritableNode<T>;\n\treturn {\n\t\tget: read,\n\t\tsubscribe: (run) => subscribeNodeValues(node, run, { immediate: true, ...opts }),\n\t\tset: (value) => write(writable, value),\n\t\tupdate: (fn) => write(writable, fn(read())),\n\t};\n}\n\n/** Build the tiny shape React's `useSyncExternalStore` expects, without importing React. */\nexport function externalStore<T>(\n\tnode: Node<T>,\n\topts: Pick<SubscribeValuesOptions<T>, \"getSnapshot\" | \"onError\" | \"onComplete\"> = {},\n): ExternalStore<T> {\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\treturn {\n\t\tgetSnapshot: read,\n\t\tgetServerSnapshot: read,\n\t\tsubscribe: (onStoreChange) =>\n\t\t\tsubscribeNodeValues(node, () => onStoreChange(), {\n\t\t\t\tchangesOnly: true,\n\t\t\t\tonError: opts.onError,\n\t\t\t\tonComplete: opts.onComplete,\n\t\t\t}),\n\t};\n}\n\n/** Build a framework-neutral keyed record store for focused framework record bindings. */\nexport function recordReadableStore<K extends string, R extends Record<string, unknown>>(\n\tkeysNode: Node<readonly K[]>,\n\tfactory: NodeRecordFactory<K, R>,\n\topts: SubscribeValuesOptions<Record<K, R>> = {},\n): ReadableStore<Record<K, R>> {\n\tconst read = () => {\n\t\tconst keys = keysNode.cache ?? [];\n\t\tconst out = {} as Record<K, R>;\n\t\tfor (const key of keys) {\n\t\t\tconst nodes = factory(key);\n\t\t\tconst values = {} as R;\n\t\t\tfor (const field of Object.keys(nodes) as Array<keyof R>) {\n\t\t\t\tvalues[field] = nodes[field].cache as R[keyof R];\n\t\t\t}\n\t\t\tout[key] = values;\n\t\t}\n\t\treturn out;\n\t};\n\n\treturn {\n\t\tget: read,\n\t\tsubscribe(run) {\n\t\t\tconst entryUnsubs: Array<() => void> = [];\n\t\t\tconst cleanupEntries = () => {\n\t\t\t\tfor (const unsub of entryUnsubs.splice(0)) unsub();\n\t\t\t};\n\t\t\tconst sync = () => {\n\t\t\t\tcleanupEntries();\n\t\t\t\tfor (const key of keysNode.cache ?? []) {\n\t\t\t\t\tconst nodes = factory(key);\n\t\t\t\t\tfor (const field of Object.keys(nodes) as Array<keyof R>) {\n\t\t\t\t\t\tentryUnsubs.push(\n\t\t\t\t\t\t\tsubscribeNodeValues(nodes[field], () => run(read()), {\n\t\t\t\t\t\t\t\tchangesOnly: true,\n\t\t\t\t\t\t\t\tonError: opts.onError,\n\t\t\t\t\t\t\t\tonComplete: opts.onComplete,\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\t\t\t\trun(read());\n\t\t\t};\n\t\t\tconst keysUnsub = subscribeNodeValues(keysNode, sync, {\n\t\t\t\tchangesOnly: true,\n\t\t\t\tonError: opts.onError,\n\t\t\t\tonComplete: opts.onComplete,\n\t\t\t});\n\t\t\tsync();\n\t\t\treturn () => {\n\t\t\t\tkeysUnsub();\n\t\t\t\tcleanupEntries();\n\t\t\t};\n\t\t},\n\t};\n}\n\n/** Build a Zustand-compatible StoreApi over a caller-owned clean-slate state node. */\nexport function zustandStore<T extends object>(\n\tnode: WritableNode<T>,\n\tinitialState?: T,\n\topts?: WritableStoreOptions<T>,\n): ZustandStoreApi<T>;\nexport function zustandStore<T extends object>(\n\tnode: Node<T>,\n\tinitialState: T | undefined,\n\topts: WritableStoreOptions<T> & { write: (node: WritableNode<T>, value: T) => void },\n): ZustandStoreApi<T>;\nexport function zustandStore<T extends object>(\n\tnode: Node<T>,\n\tinitialState: T = nodeSnapshot(node) as T,\n\topts: WritableStoreOptions<T> = {},\n): ZustandStoreApi<T> {\n\tconst listeners = new Set<() => void>();\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\tconst write = opts.write ?? (hasWritableSet(node) ? defaultWrite : undefined);\n\tif (!write) {\n\t\tthrow new TypeError(\"zustandStore: node must expose set(value) or opts.write\");\n\t}\n\tconst writable = node as WritableNode<T>;\n\tconst api: ZustandStoreApi<T> = {\n\t\tgetState: () => read() as T,\n\t\tsetState(partial, replace) {\n\t\t\tconst prev = api.getState();\n\t\t\tconst next = typeof partial === \"function\" ? partial(prev) : partial;\n\t\t\twrite(writable, replace ? (next as T) : ({ ...prev, ...next } as T));\n\t\t},\n\t\tgetInitialState: () => initialState,\n\t\tsubscribe(listener) {\n\t\t\tlet prev = api.getState();\n\t\t\tconst unsub = subscribeNodeValues(\n\t\t\t\tnode,\n\t\t\t\t(value) => {\n\t\t\t\t\tconst next = value as T;\n\t\t\t\t\tlistener(next, prev);\n\t\t\t\t\tprev = next;\n\t\t\t\t},\n\t\t\t\t{ changesOnly: true, onError: opts.onError, onComplete: opts.onComplete },\n\t\t\t);\n\t\t\tlisteners.add(unsub);\n\t\t\treturn () => {\n\t\t\t\tif (!listeners.delete(unsub)) return;\n\t\t\t\tunsub();\n\t\t\t};\n\t\t},\n\t\tdestroy() {\n\t\t\tfor (const unsub of [...listeners]) {\n\t\t\t\tlisteners.delete(unsub);\n\t\t\t\tunsub();\n\t\t\t}\n\t\t},\n\t};\n\treturn api;\n}\n\n/** Build a Jotai-style atom facade over a caller-owned node. */\nexport function jotaiAtom<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableJotaiAtom<T>;\nexport function jotaiAtom<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): JotaiAtom<T>;\nexport function jotaiAtom<T>(\n\tnode: Node<T> | WritableNode<T>,\n\topts: SubscribeValuesOptions<T> | WritableStoreOptions<T> = {},\n): JotaiAtom<T> | WritableJotaiAtom<T> {\n\tconst base: JotaiAtom<T> = {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (callback) => subscribeNodeValues(node, callback, { changesOnly: true, ...opts }),\n\t\t_node: node,\n\t};\n\tif (hasWritableSet(node) || typeof (opts as WritableStoreOptions<T>).write === \"function\") {\n\t\tconst writable = writableStore(\n\t\t\tnode,\n\t\t\topts as WritableStoreOptions<T> & {\n\t\t\t\twrite: (node: WritableNode<T>, value: T) => void;\n\t\t\t},\n\t\t);\n\t\treturn { ...base, set: writable.set, update: writable.update };\n\t}\n\treturn base;\n}\n\n/** Build a Nanostores-style atom facade over a caller-owned node. */\nexport function nanoAtom<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableNanoAtom<T>;\nexport function nanoAtom<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): NanoAtom<T>;\nexport function nanoAtom<T>(\n\tnode: Node<T> | WritableNode<T>,\n\topts: SubscribeValuesOptions<T> | WritableStoreOptions<T> = {},\n): NanoAtom<T> | WritableNanoAtom<T> {\n\tconst base: NanoAtom<T> = {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (callback) => subscribeNodeValues(node, callback, { immediate: true, ...opts }),\n\t\tlisten: (callback) => subscribeNodeValues(node, callback, { changesOnly: true, ...opts }),\n\t\t_node: node,\n\t};\n\tif (hasWritableSet(node) || typeof (opts as WritableStoreOptions<T>).write === \"function\") {\n\t\tconst writable = writableStore(\n\t\t\tnode,\n\t\t\topts as WritableStoreOptions<T> & {\n\t\t\t\twrite: (node: WritableNode<T>, value: T) => void;\n\t\t\t},\n\t\t);\n\t\treturn { ...base, set: writable.set, update: writable.update };\n\t}\n\treturn base;\n}\n\n/** Build a TC39-Signals-style facade over a caller-owned node. */\nexport function signalFromNode<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableSignalLike<T>;\nexport function signalFromNode<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): SignalLike<T>;\nexport function signalFromNode<T>(\n\tnode: Node<T> | WritableNode<T>,\n\topts: SubscribeValuesOptions<T> | WritableStoreOptions<T> = {},\n): SignalLike<T> | WritableSignalLike<T> {\n\tconst base: SignalLike<T> = {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (callback) => subscribeNodeValues(node, callback, { changesOnly: true, ...opts }),\n\t\t_node: node,\n\t};\n\tif (hasWritableSet(node) || typeof (opts as WritableStoreOptions<T>).write === \"function\") {\n\t\tconst writable = writableStore(\n\t\t\tnode,\n\t\t\topts as WritableStoreOptions<T> & {\n\t\t\t\twrite: (node: WritableNode<T>, value: T) => void;\n\t\t\t},\n\t\t);\n\t\treturn { ...base, set: writable.set, update: writable.update };\n\t}\n\treturn base;\n}\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/react.ts","../../src/adapters/store.ts"],"sourcesContent":["/**\n * React node bindings for GraphReFly (D238).\n *\n * React is imported only from this focused subpath. The dependency-free\n * `@graphrefly/ts/adapters` barrel keeps the framework-neutral store contract.\n */\n\nimport { useCallback, useMemo, useSyncExternalStore } from \"react\";\nimport type { Node } from \"../node/node.js\";\nimport { externalStore, recordReadableStore, type WritableNode } from \"./store.js\";\n\nfunction assertDataValue(value: unknown): void {\n\tif (value === undefined) {\n\t\tthrow new TypeError(\"useNodeInput: undefined is SENTINEL/no DATA, not a writable DATA value\");\n\t}\n}\n\n/** Read a GraphReFly node through React's useSyncExternalStore contract. */\nexport function useNodeValue<T>(node: Node<T>): T | undefined {\n\tconst store = useMemo(() => externalStore(node), [node]);\n\treturn useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);\n}\n\n/**\n * Bind a writable GraphReFly node as `[value, setValue]`.\n *\n * The setter identity is stable for a stable node identity, and writes through\n * the node's reactive DATA boundary rather than a presentation-owned trigger.\n */\nexport function useNodeInput<T>(\n\tnode: WritableNode<T>,\n): readonly [T | undefined, (value: T) => void] {\n\tconst value = useNodeValue(node);\n\tconst setValue = useCallback(\n\t\t(next: T) => {\n\t\t\tassertDataValue(next);\n\t\t\tnode.set(next);\n\t\t},\n\t\t[node],\n\t);\n\treturn [value, setValue] as const;\n}\n\n/**\n * Read a keyed record of nodes.\n *\n * `factory` must have stable identity. Recreating it on every render forces the\n * record subscription graph to rebuild on every render.\n */\nexport function useNodeRecord<K extends string, R extends Record<string, unknown>>(\n\tkeysNode: Node<readonly K[]>,\n\tfactory: (key: K) => { [P in keyof R]: Node<R[P]> },\n): Record<K, R> {\n\tconst store = useMemo(() => {\n\t\tconst recordStore = recordReadableStore(keysNode, factory);\n\t\tlet current = recordStore.get() ?? ({} as Record<K, R>);\n\t\treturn {\n\t\t\tgetSnapshot: () => current,\n\t\t\tsubscribe(onStoreChange: () => void) {\n\t\t\t\treturn recordStore.subscribe((next) => {\n\t\t\t\t\tcurrent = next ?? ({} as Record<K, R>);\n\t\t\t\t\tonStoreChange();\n\t\t\t\t});\n\t\t\t},\n\t\t};\n\t}, [keysNode, factory]);\n\tconst getSnapshot = useCallback(() => store.getSnapshot(), [store]);\n\treturn useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);\n}\n","/**\n * Framework-neutral store adapters.\n *\n * Focused framework bindings build on this tiny Node-facing layer without\n * importing framework packages into the dependency-free adapters barrel\n * (D125/D238).\n */\n\nimport type { DeliveryMeta, Sink } from \"../ctx/types.js\";\nimport type { Node } from \"../node/node.js\";\n\n/** A minimal readable store contract shared by Svelte/Nanostores-style adapters. */\nexport interface ReadableStore<T> {\n\tget(): T | undefined;\n\tsubscribe(run: (value: T | undefined) => void): () => void;\n}\n\n/** A minimal writable store contract over a clean-slate writable node. */\nexport interface WritableStore<T> extends ReadableStore<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\n/** React `useSyncExternalStore`-compatible shape, without importing React. */\nexport interface ExternalStore<T> {\n\tgetSnapshot(): T | undefined;\n\tgetServerSnapshot(): T | undefined;\n\tsubscribe(onStoreChange: () => void): () => void;\n}\n\n/** Object-of-nodes factory used by record subscription adapters. */\nexport type NodeRecordFactory<K extends string, R extends Record<string, unknown>> = (key: K) => {\n\t[P in keyof R]: Node<R[P]>;\n};\n\n/** Zustand-compatible store API over a caller-owned clean-slate state node. */\nexport interface ZustandStoreApi<T extends object> {\n\tgetState(): T;\n\tsetState(partial: T | Partial<T> | ((state: T) => T | Partial<T>), replace?: boolean): void;\n\tgetInitialState(): T;\n\tsubscribe(listener: (state: T, prevState: T) => void): () => void;\n\tdestroy(): void;\n}\n\n/** Jotai-style atom facade over a caller-owned node. */\nexport interface JotaiAtom<T> {\n\tget(): T | undefined;\n\tsubscribe(callback: (value: T | undefined) => void): () => void;\n\treadonly _node: Node<T>;\n}\n\n/** Writable Jotai-style atom facade over a caller-owned writable node. */\nexport interface WritableJotaiAtom<T> extends JotaiAtom<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\n/** Nanostores-style atom facade over a caller-owned node. */\nexport interface NanoAtom<T> {\n\tget(): T | undefined;\n\tsubscribe(callback: (value: T | undefined) => void): () => void;\n\tlisten(callback: (value: T | undefined) => void): () => void;\n\treadonly _node: Node<T>;\n}\n\n/** Writable Nanostores-style atom facade over a caller-owned writable node. */\nexport interface WritableNanoAtom<T> extends NanoAtom<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\n/** TC39-Signals-style facade over a caller-owned node. */\nexport interface SignalLike<T> {\n\tget(): T | undefined;\n\tsubscribe(callback: (value: T | undefined) => void): () => void;\n\treadonly _node: Node<T>;\n}\n\n/** Writable TC39-Signals-style facade over a caller-owned writable node. */\nexport interface WritableSignalLike<T> extends SignalLike<T> {\n\tset(value: T): void;\n\tupdate(fn: (value: T | undefined) => T): void;\n}\n\nexport interface SubscribeValuesOptions<T> {\n\t/** Emit the current cache snapshot immediately. `undefined` means SENTINEL/no DATA. */\n\timmediate?: boolean;\n\t/** Suppress synchronous push-on-subscribe/replay DATA. Useful for change-only store listeners. */\n\tchangesOnly?: boolean;\n\tonError?: (error: unknown) => void;\n\tonComplete?: () => void;\n\t/** Custom cache reader for wrappers that keep their own snapshot object. */\n\tgetSnapshot?: () => T | undefined;\n}\n\nexport interface WritableNode<T> extends Node<T> {\n\tset(value: T): void;\n}\n\nexport interface WritableStoreOptions<T> extends SubscribeValuesOptions<T> {\n\t/** Override writes for adapters that need a framework-owned reducer. */\n\twrite?: (node: WritableNode<T>, value: T) => void;\n}\n\n/** Read a node cache without activating it. */\nexport function nodeSnapshot<T>(node: Node<T>): T | undefined {\n\treturn node.cache as T | undefined;\n}\n\n/**\n * Subscribe to DATA values from a Node. Protocol internals stay below the adapter boundary:\n * DATA drives value listeners, ERROR/COMPLETE route to optional lifecycle callbacks.\n */\nexport function subscribeNodeValues<T>(\n\tnode: Node<T>,\n\trun: (value: T | undefined) => void,\n\topts: SubscribeValuesOptions<T> = {},\n): () => void {\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\tif (opts.immediate) run(read());\n\n\tlet subscribing = true;\n\tconst skipSynchronousHandshakeData = opts.changesOnly || opts.immediate;\n\tconst sink: Sink = (msg, delivery?: DeliveryMeta) => {\n\t\tswitch (msg[0]) {\n\t\t\tcase \"DATA\":\n\t\t\t\tif (skipSynchronousHandshakeData && subscribing && delivery === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\trun(msg[1] as T);\n\t\t\t\treturn;\n\t\t\tcase \"ERROR\":\n\t\t\t\topts.onError?.(msg[1]);\n\t\t\t\treturn;\n\t\t\tcase \"COMPLETE\":\n\t\t\t\topts.onComplete?.();\n\t\t\t\treturn;\n\t\t}\n\t};\n\tconst unsubscribe = node.subscribe(sink);\n\tsubscribing = false;\n\treturn unsubscribe;\n}\n\n/** Build a Svelte/Nanostores-style readable store from a clean-slate Node. */\nexport function readableStore<T>(\n\tnode: Node<T>,\n\topts: SubscribeValuesOptions<T> = {},\n): ReadableStore<T> {\n\treturn {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (run) => subscribeNodeValues(node, run, { immediate: true, ...opts }),\n\t};\n}\n\nfunction hasWritableSet<T>(node: Node<T>): node is WritableNode<T> {\n\treturn typeof (node as { set?: unknown }).set === \"function\";\n}\n\nfunction defaultWrite<T>(node: WritableNode<T>, value: T): void {\n\tnode.set(value);\n}\n\n/** Build a writable store over a StateNode or compatible clean-slate writable Node. */\nexport function writableStore<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableStore<T>;\nexport function writableStore<T>(\n\tnode: Node<T>,\n\topts: WritableStoreOptions<T> & { write: (node: WritableNode<T>, value: T) => void },\n): WritableStore<T>;\nexport function writableStore<T>(\n\tnode: Node<T>,\n\topts: WritableStoreOptions<T> = {},\n): WritableStore<T> {\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\tconst write = opts.write ?? (hasWritableSet(node) ? defaultWrite : undefined);\n\tif (!write) {\n\t\tthrow new TypeError(\"writableStore: node must expose set(value) or opts.write\");\n\t}\n\tconst writable = node as WritableNode<T>;\n\treturn {\n\t\tget: read,\n\t\tsubscribe: (run) => subscribeNodeValues(node, run, { immediate: true, ...opts }),\n\t\tset: (value) => write(writable, value),\n\t\tupdate: (fn) => write(writable, fn(read())),\n\t};\n}\n\n/** Build the tiny shape React's `useSyncExternalStore` expects, without importing React. */\nexport function externalStore<T>(\n\tnode: Node<T>,\n\topts: Pick<SubscribeValuesOptions<T>, \"getSnapshot\" | \"onError\" | \"onComplete\"> = {},\n): ExternalStore<T> {\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\treturn {\n\t\tgetSnapshot: read,\n\t\tgetServerSnapshot: read,\n\t\tsubscribe: (onStoreChange) =>\n\t\t\tsubscribeNodeValues(node, () => onStoreChange(), {\n\t\t\t\tchangesOnly: true,\n\t\t\t\tonError: opts.onError,\n\t\t\t\tonComplete: opts.onComplete,\n\t\t\t}),\n\t};\n}\n\n/** Build a framework-neutral keyed record store for focused framework record bindings. */\nexport function recordReadableStore<K extends string, R extends Record<string, unknown>>(\n\tkeysNode: Node<readonly K[]>,\n\tfactory: NodeRecordFactory<K, R>,\n\topts: SubscribeValuesOptions<Record<K, R>> = {},\n): ReadableStore<Record<K, R>> {\n\tconst read = () => {\n\t\tconst keys = keysNode.cache ?? [];\n\t\tconst out = {} as Record<K, R>;\n\t\tfor (const key of keys) {\n\t\t\tconst nodes = factory(key);\n\t\t\tconst values = {} as R;\n\t\t\tfor (const field of Object.keys(nodes) as Array<keyof R>) {\n\t\t\t\tvalues[field] = nodes[field].cache as R[keyof R];\n\t\t\t}\n\t\t\tout[key] = values;\n\t\t}\n\t\treturn out;\n\t};\n\n\treturn {\n\t\tget: read,\n\t\tsubscribe(run) {\n\t\t\tconst entryUnsubs: Array<() => void> = [];\n\t\t\tconst cleanupEntries = () => {\n\t\t\t\tfor (const unsub of entryUnsubs.splice(0)) unsub();\n\t\t\t};\n\t\t\tconst sync = () => {\n\t\t\t\tcleanupEntries();\n\t\t\t\tfor (const key of keysNode.cache ?? []) {\n\t\t\t\t\tconst nodes = factory(key);\n\t\t\t\t\tfor (const field of Object.keys(nodes) as Array<keyof R>) {\n\t\t\t\t\t\tentryUnsubs.push(\n\t\t\t\t\t\t\tsubscribeNodeValues(nodes[field], () => run(read()), {\n\t\t\t\t\t\t\t\tchangesOnly: true,\n\t\t\t\t\t\t\t\tonError: opts.onError,\n\t\t\t\t\t\t\t\tonComplete: opts.onComplete,\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\t\t\t\trun(read());\n\t\t\t};\n\t\t\tconst keysUnsub = subscribeNodeValues(keysNode, sync, {\n\t\t\t\tchangesOnly: true,\n\t\t\t\tonError: opts.onError,\n\t\t\t\tonComplete: opts.onComplete,\n\t\t\t});\n\t\t\tsync();\n\t\t\treturn () => {\n\t\t\t\tkeysUnsub();\n\t\t\t\tcleanupEntries();\n\t\t\t};\n\t\t},\n\t};\n}\n\n/** Build a Zustand-compatible StoreApi over a caller-owned clean-slate state node. */\nexport function zustandStore<T extends object>(\n\tnode: WritableNode<T>,\n\tinitialState?: T,\n\topts?: WritableStoreOptions<T>,\n): ZustandStoreApi<T>;\nexport function zustandStore<T extends object>(\n\tnode: Node<T>,\n\tinitialState: T | undefined,\n\topts: WritableStoreOptions<T> & { write: (node: WritableNode<T>, value: T) => void },\n): ZustandStoreApi<T>;\nexport function zustandStore<T extends object>(\n\tnode: Node<T>,\n\tinitialState: T = nodeSnapshot(node) as T,\n\topts: WritableStoreOptions<T> = {},\n): ZustandStoreApi<T> {\n\tconst listeners = new Set<() => void>();\n\tconst read = opts.getSnapshot ?? (() => nodeSnapshot(node));\n\tconst write = opts.write ?? (hasWritableSet(node) ? defaultWrite : undefined);\n\tif (!write) {\n\t\tthrow new TypeError(\"zustandStore: node must expose set(value) or opts.write\");\n\t}\n\tconst writable = node as WritableNode<T>;\n\tconst api: ZustandStoreApi<T> = {\n\t\tgetState: () => read() as T,\n\t\tsetState(partial, replace) {\n\t\t\tconst prev = api.getState();\n\t\t\tconst next = typeof partial === \"function\" ? partial(prev) : partial;\n\t\t\twrite(writable, replace ? (next as T) : ({ ...prev, ...next } as T));\n\t\t},\n\t\tgetInitialState: () => initialState,\n\t\tsubscribe(listener) {\n\t\t\tlet prev = api.getState();\n\t\t\tconst unsub = subscribeNodeValues(\n\t\t\t\tnode,\n\t\t\t\t() => {\n\t\t\t\t\tconst next = api.getState();\n\t\t\t\t\tlistener(next, prev);\n\t\t\t\t\tprev = next;\n\t\t\t\t},\n\t\t\t\t{ changesOnly: true, onError: opts.onError, onComplete: opts.onComplete },\n\t\t\t);\n\t\t\tlisteners.add(unsub);\n\t\t\treturn () => {\n\t\t\t\tif (!listeners.delete(unsub)) return;\n\t\t\t\tunsub();\n\t\t\t};\n\t\t},\n\t\tdestroy() {\n\t\t\tfor (const unsub of [...listeners]) {\n\t\t\t\tlisteners.delete(unsub);\n\t\t\t\tunsub();\n\t\t\t}\n\t\t},\n\t};\n\treturn api;\n}\n\n/** Build a Jotai-style atom facade over a caller-owned node. */\nexport function jotaiAtom<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableJotaiAtom<T>;\nexport function jotaiAtom<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): JotaiAtom<T>;\nexport function jotaiAtom<T>(\n\tnode: Node<T> | WritableNode<T>,\n\topts: SubscribeValuesOptions<T> | WritableStoreOptions<T> = {},\n): JotaiAtom<T> | WritableJotaiAtom<T> {\n\tconst base: JotaiAtom<T> = {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (callback) => subscribeNodeValues(node, callback, { changesOnly: true, ...opts }),\n\t\t_node: node,\n\t};\n\tif (hasWritableSet(node) || typeof (opts as WritableStoreOptions<T>).write === \"function\") {\n\t\tconst writable = writableStore(\n\t\t\tnode,\n\t\t\topts as WritableStoreOptions<T> & {\n\t\t\t\twrite: (node: WritableNode<T>, value: T) => void;\n\t\t\t},\n\t\t);\n\t\treturn { ...base, set: writable.set, update: writable.update };\n\t}\n\treturn base;\n}\n\n/** Build a Nanostores-style atom facade over a caller-owned node. */\nexport function nanoAtom<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableNanoAtom<T>;\nexport function nanoAtom<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): NanoAtom<T>;\nexport function nanoAtom<T>(\n\tnode: Node<T> | WritableNode<T>,\n\topts: SubscribeValuesOptions<T> | WritableStoreOptions<T> = {},\n): NanoAtom<T> | WritableNanoAtom<T> {\n\tconst base: NanoAtom<T> = {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (callback) => subscribeNodeValues(node, callback, { immediate: true, ...opts }),\n\t\tlisten: (callback) => subscribeNodeValues(node, callback, { changesOnly: true, ...opts }),\n\t\t_node: node,\n\t};\n\tif (hasWritableSet(node) || typeof (opts as WritableStoreOptions<T>).write === \"function\") {\n\t\tconst writable = writableStore(\n\t\t\tnode,\n\t\t\topts as WritableStoreOptions<T> & {\n\t\t\t\twrite: (node: WritableNode<T>, value: T) => void;\n\t\t\t},\n\t\t);\n\t\treturn { ...base, set: writable.set, update: writable.update };\n\t}\n\treturn base;\n}\n\n/** Build a TC39-Signals-style facade over a caller-owned node. */\nexport function signalFromNode<T>(\n\tnode: WritableNode<T>,\n\topts?: WritableStoreOptions<T>,\n): WritableSignalLike<T>;\nexport function signalFromNode<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): SignalLike<T>;\nexport function signalFromNode<T>(\n\tnode: Node<T> | WritableNode<T>,\n\topts: SubscribeValuesOptions<T> | WritableStoreOptions<T> = {},\n): SignalLike<T> | WritableSignalLike<T> {\n\tconst base: SignalLike<T> = {\n\t\tget: () => (opts.getSnapshot ?? (() => nodeSnapshot(node)))(),\n\t\tsubscribe: (callback) => subscribeNodeValues(node, callback, { changesOnly: true, ...opts }),\n\t\t_node: node,\n\t};\n\tif (hasWritableSet(node) || typeof (opts as WritableStoreOptions<T>).write === \"function\") {\n\t\tconst writable = writableStore(\n\t\t\tnode,\n\t\t\topts as WritableStoreOptions<T> & {\n\t\t\t\twrite: (node: WritableNode<T>, value: T) => void;\n\t\t\t},\n\t\t);\n\t\treturn { ...base, set: writable.set, update: writable.update };\n\t}\n\treturn base;\n}\n"],"mappings":"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","names":[]}
|