@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
|
@@ -6,7 +6,7 @@ import { L as LockId, W as Wave, P as PullDemand, M as Message } from './message
|
|
|
6
6
|
* Canonical authority: ~/src/graphrefly/spec/rules.jsonl
|
|
7
7
|
* R-handle (D7), R-dispatch-all (D21), R-sync-core (D20/D21).
|
|
8
8
|
*
|
|
9
|
-
* Lifted from the validated handle-dispatch PoC (
|
|
9
|
+
* Lifted from the validated retired handle-dispatch PoC (R8/R9):
|
|
10
10
|
* fn lives in an external pool, indexed by handle; `dispatcher.invoke` is uniformly
|
|
11
11
|
* SYNC void — async/remote behavior lives in the fn body (it kicks off async work
|
|
12
12
|
* and emits later via `ctx.down`), not in a different call mechanism.
|
|
@@ -290,21 +290,6 @@ type NodeVersionJson = NodeVersion;
|
|
|
290
290
|
*/
|
|
291
291
|
declare function defaultNodeVersionHash(bytes: Uint8Array): string;
|
|
292
292
|
|
|
293
|
-
/**
|
|
294
|
-
* The node primitive — the thinnest substrate object (R-node-thin / D5).
|
|
295
|
-
*
|
|
296
|
-
* Holds a fn handle + deps + the wave state machine; ZERO inspection cruft
|
|
297
|
-
* (naming/find/describe are the graph layer, CSP-2). Canonical authority:
|
|
298
|
-
* ~/src/graphrefly/spec/rules.jsonl (R-node-*, R-two-phase, R-diamond, R-resolved-undirty,
|
|
299
|
-
* R-first-run-gate, R-push-subscribe, R-rom-ram, R-fn-contract, R-initial, R-ctx-up).
|
|
300
|
-
*
|
|
301
|
-
* Slice 1 = core wave: state node, compute node, two-phase DIRTY->DATA, diamond
|
|
302
|
-
* pending-counter join, first-run gate, substrate-synthesized undirty RESOLVED
|
|
303
|
-
* (R-resolved-undirty / D49 — no equals-substitution; every occurrence is DATA),
|
|
304
|
-
* push-on-subscribe, lazy activation, ROM/RAM. Lifecycle (terminal/INVALIDATE/cleanup),
|
|
305
|
-
* control (PAUSE/async), batch, and dynamicNode land in later slices.
|
|
306
|
-
*/
|
|
307
|
-
|
|
308
293
|
type Status = "sentinel" | "pending" | "dirty" | "settled" | "resolved" | "completed" | "errored";
|
|
309
294
|
interface NodeOptions<T = unknown> {
|
|
310
295
|
/** Pre-populate cache; source pushes [DATA, initial] on subscribe (R-initial). `null` is valid. */
|
|
@@ -336,8 +321,9 @@ interface NodeOptions<T = unknown> {
|
|
|
336
321
|
* then RE-QUIETS (1:1). Delivery content =
|
|
337
322
|
* the orthogonal `pausable` mode: `true` → coalesced LATEST (one DATA); `'resumeAll'` → buffered
|
|
338
323
|
* BACKLOG. `pullId` + `pausable:false` is REJECTED at construction. A SELF-triggered demand (a
|
|
339
|
-
* consumer demanding a dep it ALSO reads) must defer via {@link Ctx.upNext}
|
|
340
|
-
* D37). Author the pullId as a shared module const used at both this node and
|
|
324
|
+
* consumer demanding a dep it ALSO reads) must defer via {@link import("../ctx/types.js").Ctx.upNext}
|
|
325
|
+
* (R-rewire-deferred / D37). Author the pullId as a shared module const used at both this node and
|
|
326
|
+
* the demander's fn.
|
|
341
327
|
*/
|
|
342
328
|
pullId?: LockId;
|
|
343
329
|
/** Buffer the last N outgoing DATA for late subscribers (R-replay-buffer). */
|
|
@@ -364,6 +350,37 @@ interface NodeOptions<T = unknown> {
|
|
|
364
350
|
*/
|
|
365
351
|
factory?: string;
|
|
366
352
|
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* The node primitive — the thinnest substrate object (R-node-thin / D5).
|
|
356
|
+
*
|
|
357
|
+
* Holds a fn handle + deps + the wave state machine; ZERO inspection cruft
|
|
358
|
+
* (naming/find/describe are the graph layer, CSP-2). Canonical authority:
|
|
359
|
+
* ~/src/graphrefly/spec/rules.jsonl (R-node-*, R-two-phase, R-diamond, R-resolved-undirty,
|
|
360
|
+
* R-first-run-gate, R-push-subscribe, R-rom-ram, R-fn-contract, R-initial, R-ctx-up).
|
|
361
|
+
*
|
|
362
|
+
* Slice 1 = core wave: state node, compute node, two-phase DIRTY->DATA, diamond
|
|
363
|
+
* pending-counter join, first-run gate, substrate-synthesized undirty RESOLVED
|
|
364
|
+
* (R-resolved-undirty / D49 — no equals-substitution; every occurrence is DATA),
|
|
365
|
+
* push-on-subscribe, lazy activation, ROM/RAM. Lifecycle (terminal/INVALIDATE/cleanup),
|
|
366
|
+
* control (PAUSE/async), batch, and dynamicNode land in later slices.
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Reactive substrate node that owns dependencies, wave handling, lifecycle, and subscribers.
|
|
371
|
+
*
|
|
372
|
+
* @example
|
|
373
|
+
* ```ts
|
|
374
|
+
* import { node } from "@graphrefly/ts";
|
|
375
|
+
*
|
|
376
|
+
* const source = node<number>([], null);
|
|
377
|
+
* source.subscribe((value) => console.log(value));
|
|
378
|
+
* source.down([["DATA", 1]]);
|
|
379
|
+
* ```
|
|
380
|
+
* @remarks **Substrate primitive:** `Node` is graph-agnostic; use `graph().node`,
|
|
381
|
+
* `graph().state`, or `graph().derived` when you want inspection and lifecycle ownership.
|
|
382
|
+
* @category core
|
|
383
|
+
*/
|
|
367
384
|
declare class Node<T = unknown> {
|
|
368
385
|
private readonly _core;
|
|
369
386
|
private readonly _id;
|
|
@@ -381,6 +398,7 @@ declare class Node<T = unknown> {
|
|
|
381
398
|
private _released;
|
|
382
399
|
private get _syncCtx();
|
|
383
400
|
private set _syncCtx(value);
|
|
401
|
+
private static _retainIndirectRuntimeMethods;
|
|
384
402
|
constructor(deps: Node<unknown>[], handleOrFn: Handle | NodeFn | null, opts?: NodeOptions<T>);
|
|
385
403
|
/** R-pull (D55/D272): true while a pull node is not serving a PULL demand pulse. */
|
|
386
404
|
private _isPullQuiet;
|
|
@@ -421,23 +439,6 @@ declare class Node<T = unknown> {
|
|
|
421
439
|
* ONE declared edge (R-up-routing directed-up); omitted = broadcast up all deps.
|
|
422
440
|
*/
|
|
423
441
|
up(msgs: Wave, towardDep?: number): void;
|
|
424
|
-
/**
|
|
425
|
-
* Enqueue a deferred self-rewire op (issued from this node's fn via `ctx.rewireNext`).
|
|
426
|
-
* Applied at the committed wave boundary (boundary.ts drain), never in place — the in-fn
|
|
427
|
-
* immediate path (`subscribeDep`/`replaceDeps`/`unsubscribeDep`) still throws mid-run (D37/R-reentrancy).
|
|
428
|
-
*/
|
|
429
|
-
private _requestRewireNext;
|
|
430
|
-
/**
|
|
431
|
-
* Enqueue a deferred up-going control/demand wave (R-up-routing / R-pull / D269): at the committed wave
|
|
432
|
-
* boundary, route `msgs` up from THIS node (broadcast, or up the single `towardDep` edge). The
|
|
433
|
-
* deferred form of `ctx.up` — the SELF-demand path: a consumer issues `ctx.upNext([[PULL,
|
|
434
|
-
* { pullId }]])` to demand a dep it ALSO reads; the demand applies at the boundary (not mid-fn), so
|
|
435
|
-
* the pull node's delivery loops back as a FRESH wave rather than re-entering the consumer (D37 /
|
|
436
|
-
* R-reentrancy). Rides the same R-rewire-deferred (D47) drain as ctx.rewireNext.
|
|
437
|
-
*/
|
|
438
|
-
private _requestUpNext;
|
|
439
|
-
/** Apply one queued self-rewire at the boundary (drain thunk). */
|
|
440
|
-
private _applyRewireNext;
|
|
441
442
|
/**
|
|
442
443
|
* Replace this node's deps atomically (surgical, Option-C). Requires an explicit
|
|
443
444
|
* `fn` (SD-1 fn-deps pairing — user fns read dep input positionally). Kept deps
|
|
@@ -450,57 +451,29 @@ declare class Node<T = unknown> {
|
|
|
450
451
|
subscribeDep(depNode: Node<unknown>, fn: NodeFn): number;
|
|
451
452
|
/** Unsubscribe from one dep (special case of replaceDeps); idempotent if absent (fn swap still applies). */
|
|
452
453
|
unsubscribeDep(depNode: Node<unknown>, fn: NodeFn): void;
|
|
454
|
+
private _requestRewireNext;
|
|
455
|
+
private _requestUpNext;
|
|
456
|
+
private _applyRewireNext;
|
|
453
457
|
private _dedupDeps;
|
|
454
|
-
/** Is `target` reachable upstream from `from` (following deps)? Cycle-prevention DFS. */
|
|
455
458
|
private _reachableUpstream;
|
|
456
459
|
private _assertRewireDepOwner;
|
|
457
460
|
private _rewire;
|
|
458
461
|
private _activate;
|
|
459
|
-
/**
|
|
460
|
-
* Subscribe to a dep. The dispatch callback reads the dep's CURRENT index from a
|
|
461
|
-
* mutable box (O(1)); a surgical rewire that reorders kept deps just updates the box
|
|
462
|
-
* (R-rewire Option-C / D42) — no re-subscribe, no per-message indexOf scan. A removed
|
|
463
|
-
* dep's box is set to -1 so any stale in-flight callback drops (drain).
|
|
464
|
-
*/
|
|
465
|
-
private _subscribeDepAt;
|
|
466
|
-
private _seedRestoredDepAt;
|
|
467
462
|
private _deactivate;
|
|
468
463
|
private _assertNotReleased;
|
|
469
464
|
private _subscriberCount;
|
|
470
465
|
private _isRuntimeQuiescentForRelease;
|
|
471
466
|
private _releaseRuntime;
|
|
472
467
|
private _resetDepState;
|
|
468
|
+
private _subscribeDepAt;
|
|
469
|
+
private _seedRestoredDepAt;
|
|
473
470
|
private _recordDepProjection;
|
|
474
471
|
private _depProjectionHasData;
|
|
475
472
|
private _receiveFromDep;
|
|
476
|
-
/**
|
|
477
|
-
* R-terminal-settles-dirty (B35): release a dep's outstanding in-wave DIRTY contribution.
|
|
478
|
-
* A settle-class event for that dep (DATA/RESOLVED inline above, INVALIDATE, and now
|
|
479
|
-
* COMPLETE/ERROR) clears its dirty flag + decrements _pending. No-op if the dep already
|
|
480
|
-
* settled this wave (DATA/RESOLVED ran first) — so the normal DATA-then-COMPLETE flow is
|
|
481
|
-
* unaffected. This makes the exactly-one-settle invariant a single, shared step.
|
|
482
|
-
*/
|
|
483
473
|
private _releaseDepDirty;
|
|
484
|
-
/**
|
|
485
|
-
* R-terminal-settles-dirty (B35): settle a node whose dirtied dep was released by an ABSORBED
|
|
486
|
-
* terminal that is NOT a real input (a plain derived/effect — the common default-node case when
|
|
487
|
-
* one of several deps completes while others stay live). Runs only when the release drained
|
|
488
|
-
* _pending while the node still owes a downstream settle (it broadcast DIRTY this wave):
|
|
489
|
-
* - if some OTHER dep delivered real DATA this wave (a value occurred) → recompute (→ DATA);
|
|
490
|
-
* - else the terminal's signalled change did not materialise (no value) → one undirty RESOLVED
|
|
491
|
-
* (R-resolved-undirty), keeping the cache (a terminal, unlike INVALIDATE, leaves the value).
|
|
492
|
-
* A terminalAsRealInput node instead recomputes unconditionally (its fn reads the terminal).
|
|
493
|
-
*/
|
|
494
474
|
private _settleAfterAbsorbedTerminal;
|
|
495
475
|
private _markDirty;
|
|
496
476
|
private _maybeRun;
|
|
497
|
-
/**
|
|
498
|
-
* R-rewire atomic settle (after a rewire that warrants a recompute): emit a proper
|
|
499
|
-
* two-phase DIRTY→DATA wave (R-dirty-before-data — a rewire-triggered settle is a wave),
|
|
500
|
-
* once, with every added dep already wired. Mirrors _maybeRun/_tryRun's pause + gate +
|
|
501
|
-
* pending guards, then injects the phase-1 DIRTY the added dep's [START,DATA] handshake
|
|
502
|
-
* did not carry.
|
|
503
|
-
*/
|
|
504
477
|
private _settleRewire;
|
|
505
478
|
private _tryRun;
|
|
506
479
|
private _allDepsSettled;
|
|
@@ -513,14 +486,6 @@ declare class Node<T = unknown> {
|
|
|
513
486
|
private _down;
|
|
514
487
|
private _up;
|
|
515
488
|
private _markDemandRouted;
|
|
516
|
-
/**
|
|
517
|
-
* Forward one up-going control message toward deps (R-up-routing): up the single declared edge
|
|
518
|
-
* `towardDep` (directed — prunes other branches; only meaningful on the issuer's FIRST hop) or
|
|
519
|
-
* broadcast up ALL deps. A depless source has no deps → the message DROPS here (the terminus —
|
|
520
|
-
* e.g. a cone-routed PULL whose pullId no node up this cone holds, R-up-at-source). Recursive
|
|
521
|
-
* forwarding carries the same per-wave route state and no `towardDep` → broadcast beyond the
|
|
522
|
-
* first hop.
|
|
523
|
-
*/
|
|
524
489
|
private _forwardUp;
|
|
525
490
|
private _isPaused;
|
|
526
491
|
private _hasBoundaryPauseLock;
|
|
@@ -528,48 +493,17 @@ declare class Node<T = unknown> {
|
|
|
528
493
|
private _pauseAcquire;
|
|
529
494
|
private _pauseRelease;
|
|
530
495
|
private _onResume;
|
|
531
|
-
/**
|
|
532
|
-
* R-pull (D269): can this pull node fire a demand NOW? — not terminal, settle-ready (_pending===0),
|
|
533
|
-
* and no OTHER (non-pullId) lock holds it paused. The gate that decides fire-now vs OWE.
|
|
534
|
-
*/
|
|
535
496
|
private _canFireDemand;
|
|
536
|
-
/**
|
|
537
|
-
* R-pull (D269/D272): deliver ONE demand pulse — install activePull so the demand wave may
|
|
538
|
-
* emit, fire it, then clear activePull so the node is quiet again (1:1).
|
|
539
|
-
*/
|
|
540
497
|
private _deliverPullDemand;
|
|
541
|
-
/**
|
|
542
|
-
* R-pull (D269): a cone-routed PULL of THIS node's pullId arrived (R-up-routing) = a DEMAND.
|
|
543
|
-
* Fire immediately if able; else OWE it — pin-5 (a dep DIRTY in flight, _pending>0) or F4/F5 (an
|
|
544
|
-
* external PAUSE lock co-holds the node) — and fire when the node next becomes able. A demand
|
|
545
|
-
* arriving WHILE a delivery is in flight (synchronous re-entry) is DROPPED (1:1, QA guard).
|
|
546
|
-
*/
|
|
547
498
|
private _onDemand;
|
|
548
|
-
/**
|
|
549
|
-
* R-pull (D55): service ONE demand. Delivery content = the orthogonal pausable mode:
|
|
550
|
-
* - 'resumeAll' → drain the buffered BACKLOG (each `_down` re-synthesizes a leading DIRTY, so
|
|
551
|
-
* the per-entry replay is DIRTY-before-DATA — R-pause-modes per-entry arrival order);
|
|
552
|
-
* - true → deliver the coalesced LATEST as ONE DIRTY-before-DATA wave (pin 2: the quiet absorb
|
|
553
|
-
* suppressed the dep's original DIRTY, so the demand wave restores it before the value).
|
|
554
|
-
* Neither branch fires when nothing changed since the last demand → the demand is SILENT.
|
|
555
|
-
* Called by `_deliverPullDemand` only when settle-ready; the caller has released the pullId, so
|
|
556
|
-
* `_markDirty` relays the leading DIRTY (not absorbed).
|
|
557
|
-
*/
|
|
558
499
|
private _firePullDemand;
|
|
559
|
-
/**
|
|
560
|
-
* R-pull (D269): fire a demand that was OWED (deferred at demand time) once the node becomes
|
|
561
|
-
* able — called from the dep-settle arms (DATA/RESOLVED/INVALIDATE/terminal drain _pending, pin-5
|
|
562
|
-
* + B1/F6) and from `_pauseRelease` (an external PAUSE lock releases, F4/F5).
|
|
563
|
-
*/
|
|
564
500
|
private _fireOwedDemandIfReady;
|
|
565
|
-
/** Should an outgoing settle slice be deferred into the pause buffer? */
|
|
566
501
|
private _shouldBufferOnPause;
|
|
567
|
-
/** R-invalidate-idempotent: clear cache + flush + cascade; no-op if nothing cached. */
|
|
568
502
|
private _invalidate;
|
|
569
503
|
private _allDepsTerminal;
|
|
504
|
+
private _emitToSubs;
|
|
570
505
|
/** R-terminal: resubscribable reset clears terminal + dep state + re-arms the gate. */
|
|
571
506
|
private _resetLifecycle;
|
|
572
|
-
private _emitToSubs;
|
|
573
507
|
/** Batch commit (R-batch-coalesce): deliver the deferred tier-3 wave now. */
|
|
574
508
|
__commitBatchedWave(wave: Wave): void;
|
|
575
509
|
/** Batch rollback: balance the immediate DIRTY with a RESOLVED so downstream un-dirties. */
|
|
@@ -583,6 +517,21 @@ declare class Node<T = unknown> {
|
|
|
583
517
|
* node([], fn) — producer (runs on activation)
|
|
584
518
|
* node([a, b], fn) — compute / derived
|
|
585
519
|
* node([dep]) — passthrough wire
|
|
520
|
+
*
|
|
521
|
+
* @param deps - Upstream nodes this node reads positionally from `ctx`.
|
|
522
|
+
* @param handleOrFn - Dispatcher handle, node function, or `null` for a manual source/state node.
|
|
523
|
+
* @param opts - Node runtime options such as `initial`, `name`, pool, dispatcher, and restore data.
|
|
524
|
+
* @returns A graph-agnostic `Node`.
|
|
525
|
+
* @example
|
|
526
|
+
* ```ts
|
|
527
|
+
* import { depLatest, node } from "@graphrefly/ts";
|
|
528
|
+
*
|
|
529
|
+
* const source = node<number>([], null, { initial: 1 });
|
|
530
|
+
* const doubled = node<number>([source], (ctx) => {
|
|
531
|
+
* ctx.down([["DATA", Number(depLatest(ctx, 0)) * 2]]);
|
|
532
|
+
* });
|
|
533
|
+
* ```
|
|
534
|
+
* @category core
|
|
586
535
|
*/
|
|
587
536
|
declare function node<T = unknown>(deps?: Node<unknown>[], handleOrFn?: Handle | NodeFn | null, opts?: NodeOptions<T>): Node<T>;
|
|
588
537
|
/**
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { DataIssue } from './data/index.cjs';
|
|
2
|
+
import { L as LockId } from './messages-CAzUPPJM.cjs';
|
|
3
|
+
import { N as Node } from './types-CTN3XoMl.cjs';
|
|
4
|
+
import { d as MessageBus } from './types-BAw2QVVE.cjs';
|
|
5
|
+
|
|
6
|
+
interface WorkQueueOptions<_T = unknown> {
|
|
7
|
+
readonly queueId: string;
|
|
8
|
+
readonly bus: MessageBus;
|
|
9
|
+
readonly topic: string;
|
|
10
|
+
readonly subscriptionId: string;
|
|
11
|
+
readonly from?: "earliest" | "latest" | number;
|
|
12
|
+
readonly name?: string;
|
|
13
|
+
readonly now?: () => number;
|
|
14
|
+
readonly leaseDurationMs?: number;
|
|
15
|
+
readonly retry?: WorkQueueRetryPolicy;
|
|
16
|
+
}
|
|
17
|
+
interface WorkQueueRetryPolicy {
|
|
18
|
+
readonly maxAttempts?: number;
|
|
19
|
+
readonly delayMs?: number;
|
|
20
|
+
}
|
|
21
|
+
interface WorkQueueCommandBase {
|
|
22
|
+
readonly commandId: string;
|
|
23
|
+
readonly queueId?: string;
|
|
24
|
+
readonly idempotencyKey?: string;
|
|
25
|
+
readonly correlationId?: string;
|
|
26
|
+
readonly causationId?: string;
|
|
27
|
+
readonly sourceRefs?: readonly string[];
|
|
28
|
+
readonly policyRefs?: readonly string[];
|
|
29
|
+
readonly actorRefs?: readonly string[];
|
|
30
|
+
readonly auditRefs?: readonly string[];
|
|
31
|
+
readonly nowMs?: number;
|
|
32
|
+
}
|
|
33
|
+
type WorkQueueCommand<T = unknown> = (WorkQueueCommandBase & {
|
|
34
|
+
readonly kind: "submit";
|
|
35
|
+
readonly payload: T;
|
|
36
|
+
readonly workId?: string;
|
|
37
|
+
readonly priority?: number;
|
|
38
|
+
readonly tags?: readonly string[];
|
|
39
|
+
readonly requirements?: readonly string[];
|
|
40
|
+
readonly notBeforeMs?: number;
|
|
41
|
+
readonly deadlineMs?: number;
|
|
42
|
+
}) | (WorkQueueCommandBase & {
|
|
43
|
+
readonly kind: "claim";
|
|
44
|
+
readonly workerId: string;
|
|
45
|
+
readonly requestedWorkIds?: readonly string[];
|
|
46
|
+
readonly limit?: number;
|
|
47
|
+
readonly leaseDurationMs?: number;
|
|
48
|
+
}) | (WorkQueueCommandBase & {
|
|
49
|
+
readonly kind: "renew-lease";
|
|
50
|
+
readonly workId: string;
|
|
51
|
+
readonly leaseId: string;
|
|
52
|
+
readonly attempt: number;
|
|
53
|
+
readonly workerId: string;
|
|
54
|
+
readonly leaseDurationMs?: number;
|
|
55
|
+
readonly leaseExpiresAtMs?: number;
|
|
56
|
+
}) | (WorkQueueCommandBase & {
|
|
57
|
+
readonly kind: "release";
|
|
58
|
+
readonly workId: string;
|
|
59
|
+
readonly leaseId: string;
|
|
60
|
+
readonly attempt: number;
|
|
61
|
+
readonly workerId: string;
|
|
62
|
+
readonly reason?: string;
|
|
63
|
+
}) | (WorkQueueCommandBase & {
|
|
64
|
+
readonly kind: "complete";
|
|
65
|
+
readonly workId: string;
|
|
66
|
+
readonly leaseId: string;
|
|
67
|
+
readonly attempt: number;
|
|
68
|
+
readonly workerId: string;
|
|
69
|
+
readonly result?: unknown;
|
|
70
|
+
}) | (WorkQueueCommandBase & {
|
|
71
|
+
readonly kind: "fail";
|
|
72
|
+
readonly workId: string;
|
|
73
|
+
readonly leaseId: string;
|
|
74
|
+
readonly attempt: number;
|
|
75
|
+
readonly workerId: string;
|
|
76
|
+
readonly error?: unknown;
|
|
77
|
+
readonly retryable?: boolean;
|
|
78
|
+
}) | (WorkQueueCommandBase & {
|
|
79
|
+
readonly kind: "cancel";
|
|
80
|
+
readonly workId: string;
|
|
81
|
+
readonly reason?: string;
|
|
82
|
+
}) | (WorkQueueCommandBase & {
|
|
83
|
+
readonly kind: "schedule";
|
|
84
|
+
readonly workId: string;
|
|
85
|
+
readonly scheduleId?: string;
|
|
86
|
+
readonly scheduleAtMs?: number;
|
|
87
|
+
readonly runAtMs?: number;
|
|
88
|
+
readonly notBeforeMs: number;
|
|
89
|
+
readonly deadlineMs?: number;
|
|
90
|
+
readonly reason?: string;
|
|
91
|
+
}) | (WorkQueueCommandBase & {
|
|
92
|
+
readonly kind: "expire-leases";
|
|
93
|
+
readonly workIds?: readonly string[];
|
|
94
|
+
readonly limit?: number;
|
|
95
|
+
});
|
|
96
|
+
interface WorkQueueRecordBase {
|
|
97
|
+
readonly kind: string;
|
|
98
|
+
readonly recordSeq: number;
|
|
99
|
+
readonly queueId: string;
|
|
100
|
+
readonly workId?: string;
|
|
101
|
+
readonly commandId?: string;
|
|
102
|
+
readonly idempotencyKey?: string;
|
|
103
|
+
readonly correlationId?: string;
|
|
104
|
+
readonly causationId?: string;
|
|
105
|
+
readonly sourceRefs?: readonly string[];
|
|
106
|
+
readonly policyRefs?: readonly string[];
|
|
107
|
+
readonly actorRefs?: readonly string[];
|
|
108
|
+
readonly auditRefs?: readonly string[];
|
|
109
|
+
readonly issueRefs?: readonly string[];
|
|
110
|
+
readonly recordedAtMs: number;
|
|
111
|
+
}
|
|
112
|
+
type WorkQueueRecord<T = unknown> = (WorkQueueRecordBase & {
|
|
113
|
+
readonly kind: "work-admitted";
|
|
114
|
+
readonly workId: string;
|
|
115
|
+
readonly payload: T;
|
|
116
|
+
readonly messageBus: {
|
|
117
|
+
readonly topic: string;
|
|
118
|
+
readonly seq: number;
|
|
119
|
+
readonly subscriptionId: string;
|
|
120
|
+
};
|
|
121
|
+
readonly priority?: number;
|
|
122
|
+
readonly tags?: readonly string[];
|
|
123
|
+
readonly requirements?: readonly string[];
|
|
124
|
+
readonly notBeforeMs?: number;
|
|
125
|
+
readonly deadlineMs?: number;
|
|
126
|
+
}) | (WorkQueueRecordBase & {
|
|
127
|
+
readonly kind: "work-rejected" | "admission-rejected";
|
|
128
|
+
readonly workId?: string;
|
|
129
|
+
readonly messageBus?: {
|
|
130
|
+
readonly topic: string;
|
|
131
|
+
readonly seq: number;
|
|
132
|
+
readonly subscriptionId: string;
|
|
133
|
+
};
|
|
134
|
+
readonly reason: string;
|
|
135
|
+
readonly existingWorkId?: string;
|
|
136
|
+
}) | (WorkQueueRecordBase & {
|
|
137
|
+
readonly kind: "work-scheduled";
|
|
138
|
+
readonly workId: string;
|
|
139
|
+
readonly scheduleId?: string;
|
|
140
|
+
readonly scheduleAtMs?: number;
|
|
141
|
+
readonly runAtMs?: number;
|
|
142
|
+
readonly notBeforeMs: number;
|
|
143
|
+
readonly deadlineMs?: number;
|
|
144
|
+
readonly reason?: string;
|
|
145
|
+
}) | (WorkQueueRecordBase & {
|
|
146
|
+
readonly kind: "work-claimed";
|
|
147
|
+
readonly workId: string;
|
|
148
|
+
readonly leaseId: string;
|
|
149
|
+
readonly attempt: number;
|
|
150
|
+
readonly workerId: string;
|
|
151
|
+
readonly claimedAtMs: number;
|
|
152
|
+
readonly leaseExpiresAtMs: number;
|
|
153
|
+
}) | (WorkQueueRecordBase & {
|
|
154
|
+
readonly kind: "lease-renewed";
|
|
155
|
+
readonly workId: string;
|
|
156
|
+
readonly leaseId: string;
|
|
157
|
+
readonly attempt: number;
|
|
158
|
+
readonly workerId: string;
|
|
159
|
+
readonly previousLeaseExpiresAtMs: number;
|
|
160
|
+
readonly leaseExpiresAtMs: number;
|
|
161
|
+
readonly renewedAtMs: number;
|
|
162
|
+
}) | (WorkQueueRecordBase & {
|
|
163
|
+
readonly kind: "work-released";
|
|
164
|
+
readonly workId: string;
|
|
165
|
+
readonly leaseId: string;
|
|
166
|
+
readonly attempt: number;
|
|
167
|
+
readonly workerId: string;
|
|
168
|
+
readonly releasedAtMs: number;
|
|
169
|
+
readonly reason?: string;
|
|
170
|
+
}) | (WorkQueueRecordBase & {
|
|
171
|
+
readonly kind: "lease-expired";
|
|
172
|
+
readonly workId: string;
|
|
173
|
+
readonly leaseId: string;
|
|
174
|
+
readonly attempt: number;
|
|
175
|
+
readonly workerId: string;
|
|
176
|
+
readonly leaseExpiresAtMs: number;
|
|
177
|
+
readonly expiredAtMs: number;
|
|
178
|
+
}) | (WorkQueueRecordBase & {
|
|
179
|
+
readonly kind: "attempt-completed" | "work-completed";
|
|
180
|
+
readonly workId: string;
|
|
181
|
+
readonly leaseId: string;
|
|
182
|
+
readonly attempt: number;
|
|
183
|
+
readonly workerId: string;
|
|
184
|
+
readonly result?: unknown;
|
|
185
|
+
}) | (WorkQueueRecordBase & {
|
|
186
|
+
readonly kind: "attempt-failed";
|
|
187
|
+
readonly workId: string;
|
|
188
|
+
readonly leaseId: string;
|
|
189
|
+
readonly attempt: number;
|
|
190
|
+
readonly workerId: string;
|
|
191
|
+
readonly error?: unknown;
|
|
192
|
+
readonly retryable?: boolean;
|
|
193
|
+
}) | (WorkQueueRecordBase & {
|
|
194
|
+
readonly kind: "retry-scheduled";
|
|
195
|
+
readonly workId: string;
|
|
196
|
+
readonly retryAtMs: number;
|
|
197
|
+
readonly delayMs: number;
|
|
198
|
+
readonly reason?: string;
|
|
199
|
+
}) | (WorkQueueRecordBase & {
|
|
200
|
+
readonly kind: "work-dead-lettered";
|
|
201
|
+
readonly workId: string;
|
|
202
|
+
readonly reason: string;
|
|
203
|
+
readonly exhaustedAttempts?: number;
|
|
204
|
+
}) | (WorkQueueRecordBase & {
|
|
205
|
+
readonly kind: "work-canceled";
|
|
206
|
+
readonly workId: string;
|
|
207
|
+
readonly reason?: string;
|
|
208
|
+
readonly canceledAtMs: number;
|
|
209
|
+
readonly canceledLeaseId?: string;
|
|
210
|
+
readonly attempt?: number;
|
|
211
|
+
}) | (WorkQueueRecordBase & {
|
|
212
|
+
readonly kind: "lifecycle-rejected" | "admission-deduped";
|
|
213
|
+
readonly workId?: string;
|
|
214
|
+
readonly messageBus?: {
|
|
215
|
+
readonly topic: string;
|
|
216
|
+
readonly seq: number;
|
|
217
|
+
readonly subscriptionId: string;
|
|
218
|
+
};
|
|
219
|
+
readonly reason: string;
|
|
220
|
+
readonly existingWorkId?: string;
|
|
221
|
+
});
|
|
222
|
+
interface WorkQueueStatus {
|
|
223
|
+
readonly kind: "command-accepted" | "command-rejected" | "admission-accepted" | "admission-rejected" | "admission-retryable" | "projection-ready" | "projection-partial" | "projection-stale" | "maintenance-applied" | "maintenance-noop" | "policy-warning";
|
|
224
|
+
readonly queueId: string;
|
|
225
|
+
readonly workId?: string;
|
|
226
|
+
readonly commandId?: string;
|
|
227
|
+
readonly recordSeq?: number;
|
|
228
|
+
readonly asOfRecordSeq?: number;
|
|
229
|
+
readonly issueCode?: string;
|
|
230
|
+
readonly timestampMs: number;
|
|
231
|
+
readonly details?: unknown;
|
|
232
|
+
}
|
|
233
|
+
interface WorkQueueAvailableItem<T = unknown> {
|
|
234
|
+
readonly workId: string;
|
|
235
|
+
readonly state: WorkQueueDerivedState;
|
|
236
|
+
readonly payload: T;
|
|
237
|
+
readonly admissionSeq: number;
|
|
238
|
+
readonly priority?: number;
|
|
239
|
+
readonly tags?: readonly string[];
|
|
240
|
+
readonly requirements?: readonly string[];
|
|
241
|
+
readonly notBeforeMs?: number;
|
|
242
|
+
readonly retryAtMs?: number;
|
|
243
|
+
readonly deadlineMs?: number;
|
|
244
|
+
}
|
|
245
|
+
interface WorkQueueAvailablePage<T = unknown> {
|
|
246
|
+
readonly items: readonly WorkQueueAvailableItem<T>[];
|
|
247
|
+
readonly nextAfterWorkId?: string;
|
|
248
|
+
readonly nextAfterAdmissionSeq?: number;
|
|
249
|
+
readonly hasMore: boolean;
|
|
250
|
+
readonly asOfRecordSeq: number;
|
|
251
|
+
}
|
|
252
|
+
interface WorkQueueWorkSnapshot<T = unknown> {
|
|
253
|
+
readonly workId: string;
|
|
254
|
+
readonly state?: WorkQueueDerivedState;
|
|
255
|
+
readonly payload?: T;
|
|
256
|
+
readonly activeLease?: {
|
|
257
|
+
readonly leaseId: string;
|
|
258
|
+
readonly attempt: number;
|
|
259
|
+
readonly workerId: string;
|
|
260
|
+
readonly leaseExpiresAtMs: number;
|
|
261
|
+
};
|
|
262
|
+
readonly records: readonly WorkQueueRecord<T>[];
|
|
263
|
+
readonly asOfRecordSeq: number;
|
|
264
|
+
}
|
|
265
|
+
interface WorkQueueDeadLetterPage<T = unknown> {
|
|
266
|
+
readonly entries: readonly WorkQueueRecord<T>[];
|
|
267
|
+
readonly nextAfterDeadLetterSeq?: number;
|
|
268
|
+
readonly hasMore: boolean;
|
|
269
|
+
readonly asOfRecordSeq: number;
|
|
270
|
+
}
|
|
271
|
+
interface WorkQueueAvailableParams {
|
|
272
|
+
readonly limit?: number;
|
|
273
|
+
readonly afterWorkId?: string;
|
|
274
|
+
readonly afterAdmissionSeq?: number;
|
|
275
|
+
readonly nowMs?: number;
|
|
276
|
+
readonly includeIssues?: boolean;
|
|
277
|
+
}
|
|
278
|
+
interface WorkQueueDeadLetterParams {
|
|
279
|
+
readonly limit?: number;
|
|
280
|
+
readonly afterDeadLetterSeq?: number;
|
|
281
|
+
readonly afterWorkId?: string;
|
|
282
|
+
}
|
|
283
|
+
type WorkQueueDerivedState = "scheduled" | "ready" | "leased" | "retry-wait" | "completed" | "canceled" | "dead-lettered";
|
|
284
|
+
interface WorkQueueProjection<TPage> {
|
|
285
|
+
readonly snapshot: Node<TPage>;
|
|
286
|
+
readonly snapshotPullId: LockId;
|
|
287
|
+
readonly status: Node<WorkQueueStatus>;
|
|
288
|
+
readonly issues: Node<DataIssue>;
|
|
289
|
+
}
|
|
290
|
+
interface WorkQueueAvailableProjection<T = unknown> {
|
|
291
|
+
readonly available: Node<WorkQueueAvailablePage<T>>;
|
|
292
|
+
readonly availablePullId: LockId;
|
|
293
|
+
readonly status: Node<WorkQueueStatus>;
|
|
294
|
+
readonly issues: Node<DataIssue>;
|
|
295
|
+
}
|
|
296
|
+
interface WorkQueue<T = unknown> {
|
|
297
|
+
readonly commands: Node<WorkQueueCommand<T>>;
|
|
298
|
+
readonly records: Node<WorkQueueRecord<T>>;
|
|
299
|
+
readonly status: Node<WorkQueueStatus>;
|
|
300
|
+
readonly issues: Node<DataIssue>;
|
|
301
|
+
submit(payload: T, opts?: Omit<Partial<Extract<WorkQueueCommand<T>, {
|
|
302
|
+
kind: "submit";
|
|
303
|
+
}>>, "kind" | "payload" | "commandId"> & {
|
|
304
|
+
commandId?: string;
|
|
305
|
+
}): unknown;
|
|
306
|
+
claim(opts: Omit<Extract<WorkQueueCommand<T>, {
|
|
307
|
+
kind: "claim";
|
|
308
|
+
}>, "kind" | "commandId"> & {
|
|
309
|
+
commandId?: string;
|
|
310
|
+
}): WorkQueueCommand<T>;
|
|
311
|
+
renewLease(opts: Omit<Extract<WorkQueueCommand<T>, {
|
|
312
|
+
kind: "renew-lease";
|
|
313
|
+
}>, "kind" | "commandId"> & {
|
|
314
|
+
commandId?: string;
|
|
315
|
+
}): WorkQueueCommand<T>;
|
|
316
|
+
release(opts: Omit<Extract<WorkQueueCommand<T>, {
|
|
317
|
+
kind: "release";
|
|
318
|
+
}>, "kind" | "commandId"> & {
|
|
319
|
+
commandId?: string;
|
|
320
|
+
}): WorkQueueCommand<T>;
|
|
321
|
+
complete(opts: Omit<Extract<WorkQueueCommand<T>, {
|
|
322
|
+
kind: "complete";
|
|
323
|
+
}>, "kind" | "commandId"> & {
|
|
324
|
+
commandId?: string;
|
|
325
|
+
}): WorkQueueCommand<T>;
|
|
326
|
+
fail(opts: Omit<Extract<WorkQueueCommand<T>, {
|
|
327
|
+
kind: "fail";
|
|
328
|
+
}>, "kind" | "commandId"> & {
|
|
329
|
+
commandId?: string;
|
|
330
|
+
}): WorkQueueCommand<T>;
|
|
331
|
+
cancel(opts: Omit<Extract<WorkQueueCommand<T>, {
|
|
332
|
+
kind: "cancel";
|
|
333
|
+
}>, "kind" | "commandId"> & {
|
|
334
|
+
commandId?: string;
|
|
335
|
+
}): WorkQueueCommand<T>;
|
|
336
|
+
schedule(opts: Omit<Extract<WorkQueueCommand<T>, {
|
|
337
|
+
kind: "schedule";
|
|
338
|
+
}>, "kind" | "commandId"> & {
|
|
339
|
+
commandId?: string;
|
|
340
|
+
}): WorkQueueCommand<T>;
|
|
341
|
+
expireLeases(opts?: Omit<Extract<WorkQueueCommand<T>, {
|
|
342
|
+
kind: "expire-leases";
|
|
343
|
+
}>, "kind" | "commandId"> & {
|
|
344
|
+
commandId?: string;
|
|
345
|
+
}): WorkQueueCommand<T>;
|
|
346
|
+
available(opts?: {
|
|
347
|
+
name?: string;
|
|
348
|
+
}): WorkQueueAvailableProjection<T>;
|
|
349
|
+
work(workId: string, opts?: {
|
|
350
|
+
name?: string;
|
|
351
|
+
}): WorkQueueProjection<WorkQueueWorkSnapshot<T>>;
|
|
352
|
+
deadLetter(opts?: {
|
|
353
|
+
name?: string;
|
|
354
|
+
}): WorkQueueProjection<WorkQueueDeadLetterPage<T>>;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export type { WorkQueueCommand as W, WorkQueueRecord as a, WorkQueueOptions as b, WorkQueue as c, WorkQueueAvailableItem as d, WorkQueueAvailablePage as e, WorkQueueAvailableParams as f, WorkQueueAvailableProjection as g, WorkQueueDeadLetterPage as h, WorkQueueDeadLetterParams as i, WorkQueueDerivedState as j, WorkQueueProjection as k, WorkQueueRetryPolicy as l, WorkQueueStatus as m, WorkQueueWorkSnapshot as n };
|