@graphrefly/graphrefly 0.45.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/dist/_internal-B23BagFd.d.cts +33 -0
- package/dist/_internal-B23BagFd.d.ts +33 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.cts +111 -0
- package/dist/adaptive-rate-limiter-Dch_xYIi.d.ts +111 -0
- package/dist/agents-C0Ji9ldU.d.cts +629 -0
- package/dist/agents-C9zexT7I.d.ts +629 -0
- package/dist/audit-BAXb3VOg.d.ts +246 -0
- package/dist/audit-C_bPfkqS.d.cts +246 -0
- package/dist/backoff-7KIK3WQW.js +24 -0
- package/dist/backoff-7KIK3WQW.js.map +1 -0
- package/dist/backoff-Bnb9OoPh.d.cts +6 -0
- package/dist/backoff-Bnb9OoPh.d.ts +6 -0
- package/dist/base/composition/index.cjs +811 -0
- package/dist/base/composition/index.cjs.map +1 -0
- package/dist/base/composition/index.d.cts +469 -0
- package/dist/base/composition/index.d.ts +469 -0
- package/dist/base/composition/index.js +40 -0
- package/dist/base/composition/index.js.map +1 -0
- package/dist/base/index.cjs +6336 -0
- package/dist/base/index.cjs.map +1 -0
- package/dist/base/index.d.cts +22 -0
- package/dist/base/index.d.ts +22 -0
- package/dist/base/index.js +259 -0
- package/dist/base/index.js.map +1 -0
- package/dist/base/io/index.cjs +3270 -0
- package/dist/base/io/index.cjs.map +1 -0
- package/dist/base/io/index.d.cts +2245 -0
- package/dist/base/io/index.d.ts +2245 -0
- package/dist/base/io/index.js +117 -0
- package/dist/base/io/index.js.map +1 -0
- package/dist/base/meta/index.cjs +43 -0
- package/dist/base/meta/index.cjs.map +1 -0
- package/dist/base/meta/index.d.cts +45 -0
- package/dist/base/meta/index.d.ts +45 -0
- package/dist/base/meta/index.js +13 -0
- package/dist/base/meta/index.js.map +1 -0
- package/dist/base/mutation/index.cjs +200 -0
- package/dist/base/mutation/index.cjs.map +1 -0
- package/dist/base/mutation/index.d.cts +177 -0
- package/dist/base/mutation/index.d.ts +177 -0
- package/dist/base/mutation/index.js +22 -0
- package/dist/base/mutation/index.js.map +1 -0
- package/dist/base/render/index.cjs +1120 -0
- package/dist/base/render/index.cjs.map +1 -0
- package/dist/base/render/index.d.cts +227 -0
- package/dist/base/render/index.d.ts +227 -0
- package/dist/base/render/index.js +24 -0
- package/dist/base/render/index.js.map +1 -0
- package/dist/base/sources/browser/index.cjs +172 -0
- package/dist/base/sources/browser/index.cjs.map +1 -0
- package/dist/base/sources/browser/index.d.cts +84 -0
- package/dist/base/sources/browser/index.d.ts +84 -0
- package/dist/base/sources/browser/index.js +151 -0
- package/dist/base/sources/browser/index.js.map +1 -0
- package/dist/base/sources/event/index.cjs +98 -0
- package/dist/base/sources/event/index.cjs.map +1 -0
- package/dist/base/sources/event/index.d.cts +91 -0
- package/dist/base/sources/event/index.d.ts +91 -0
- package/dist/base/sources/event/index.js +13 -0
- package/dist/base/sources/event/index.js.map +1 -0
- package/dist/base/sources/index.cjs +755 -0
- package/dist/base/sources/index.cjs.map +1 -0
- package/dist/base/sources/index.d.cts +357 -0
- package/dist/base/sources/index.d.ts +357 -0
- package/dist/base/sources/index.js +42 -0
- package/dist/base/sources/index.js.map +1 -0
- package/dist/base/sources/node/index.cjs +320 -0
- package/dist/base/sources/node/index.cjs.map +1 -0
- package/dist/base/sources/node/index.d.cts +185 -0
- package/dist/base/sources/node/index.d.ts +185 -0
- package/dist/base/sources/node/index.js +306 -0
- package/dist/base/sources/node/index.js.map +1 -0
- package/dist/base/utils/index.cjs +37 -0
- package/dist/base/utils/index.cjs.map +1 -0
- package/dist/base/utils/index.d.cts +37 -0
- package/dist/base/utils/index.d.ts +37 -0
- package/dist/base/utils/index.js +11 -0
- package/dist/base/utils/index.js.map +1 -0
- package/dist/base/worker/index.cjs +548 -0
- package/dist/base/worker/index.cjs.map +1 -0
- package/dist/base/worker/index.d.cts +207 -0
- package/dist/base/worker/index.d.ts +207 -0
- package/dist/base/worker/index.js +20 -0
- package/dist/base/worker/index.js.map +1 -0
- package/dist/breaker-C9skL3d8.d.ts +175 -0
- package/dist/breaker-ugSdq54q.d.cts +175 -0
- package/dist/cascading-CSSbKGrJ.d.ts +199 -0
- package/dist/cascading-baGkiihI.d.cts +199 -0
- package/dist/chunk-255UCBG4.js +58 -0
- package/dist/chunk-255UCBG4.js.map +1 -0
- package/dist/chunk-2LO3EL4W.js +1 -0
- package/dist/chunk-2LO3EL4W.js.map +1 -0
- package/dist/chunk-2OB3CEJS.js +1065 -0
- package/dist/chunk-2OB3CEJS.js.map +1 -0
- package/dist/chunk-36NMM65U.js +144 -0
- package/dist/chunk-36NMM65U.js.map +1 -0
- package/dist/chunk-3CEXCBN6.js +1 -0
- package/dist/chunk-3CEXCBN6.js.map +1 -0
- package/dist/chunk-3MUSLI6E.js +105 -0
- package/dist/chunk-3MUSLI6E.js.map +1 -0
- package/dist/chunk-3PSLNJDU.js +884 -0
- package/dist/chunk-3PSLNJDU.js.map +1 -0
- package/dist/chunk-3QZY5BI7.js +92 -0
- package/dist/chunk-3QZY5BI7.js.map +1 -0
- package/dist/chunk-42FQ27MQ.js +594 -0
- package/dist/chunk-42FQ27MQ.js.map +1 -0
- package/dist/chunk-4GYMCUDZ.js +1085 -0
- package/dist/chunk-4GYMCUDZ.js.map +1 -0
- package/dist/chunk-4S53H2KR.js +382 -0
- package/dist/chunk-4S53H2KR.js.map +1 -0
- package/dist/chunk-4XCHZRUJ.js +128 -0
- package/dist/chunk-4XCHZRUJ.js.map +1 -0
- package/dist/chunk-5THCXDWY.js +725 -0
- package/dist/chunk-5THCXDWY.js.map +1 -0
- package/dist/chunk-6XZYT4SW.js +256 -0
- package/dist/chunk-6XZYT4SW.js.map +1 -0
- package/dist/chunk-7EGRP2VX.js +76 -0
- package/dist/chunk-7EGRP2VX.js.map +1 -0
- package/dist/chunk-A7KV5UK4.js +150 -0
- package/dist/chunk-A7KV5UK4.js.map +1 -0
- package/dist/chunk-APY2SS5X.js +156 -0
- package/dist/chunk-APY2SS5X.js.map +1 -0
- package/dist/chunk-AZDQPQ3V.js +66 -0
- package/dist/chunk-AZDQPQ3V.js.map +1 -0
- package/dist/chunk-BU3SEFA5.js +90 -0
- package/dist/chunk-BU3SEFA5.js.map +1 -0
- package/dist/chunk-BXGZFGZ4.js +189 -0
- package/dist/chunk-BXGZFGZ4.js.map +1 -0
- package/dist/chunk-CGHORL6G.js +579 -0
- package/dist/chunk-CGHORL6G.js.map +1 -0
- package/dist/chunk-CXANAIZU.js +530 -0
- package/dist/chunk-CXANAIZU.js.map +1 -0
- package/dist/chunk-CZQHCKKG.js +1 -0
- package/dist/chunk-CZQHCKKG.js.map +1 -0
- package/dist/chunk-DKNHAICT.js +133 -0
- package/dist/chunk-DKNHAICT.js.map +1 -0
- package/dist/chunk-DM4OMPWK.js +584 -0
- package/dist/chunk-DM4OMPWK.js.map +1 -0
- package/dist/chunk-DMSNO6ZB.js +452 -0
- package/dist/chunk-DMSNO6ZB.js.map +1 -0
- package/dist/chunk-E5OZPDIW.js +229 -0
- package/dist/chunk-E5OZPDIW.js.map +1 -0
- package/dist/chunk-EVYY4X5A.js +509 -0
- package/dist/chunk-EVYY4X5A.js.map +1 -0
- package/dist/chunk-FDFD67UO.js +1 -0
- package/dist/chunk-FDFD67UO.js.map +1 -0
- package/dist/chunk-FMPF42Q4.js +13 -0
- package/dist/chunk-FMPF42Q4.js.map +1 -0
- package/dist/chunk-FR6RGA3B.js +1277 -0
- package/dist/chunk-FR6RGA3B.js.map +1 -0
- package/dist/chunk-FW23JYNQ.js +454 -0
- package/dist/chunk-FW23JYNQ.js.map +1 -0
- package/dist/chunk-GBCENOLN.js +1575 -0
- package/dist/chunk-GBCENOLN.js.map +1 -0
- package/dist/chunk-HL7HUJIX.js +1 -0
- package/dist/chunk-HL7HUJIX.js.map +1 -0
- package/dist/chunk-HULCUY35.js +2508 -0
- package/dist/chunk-HULCUY35.js.map +1 -0
- package/dist/chunk-IHTWQEDR.js +169 -0
- package/dist/chunk-IHTWQEDR.js.map +1 -0
- package/dist/chunk-IJRR6YAI.js +128 -0
- package/dist/chunk-IJRR6YAI.js.map +1 -0
- package/dist/chunk-JGFRAFDL.js +221 -0
- package/dist/chunk-JGFRAFDL.js.map +1 -0
- package/dist/chunk-KIIXR252.js +211 -0
- package/dist/chunk-KIIXR252.js.map +1 -0
- package/dist/chunk-KN3H5CNT.js +11 -0
- package/dist/chunk-KN3H5CNT.js.map +1 -0
- package/dist/chunk-KPG3DGLA.js +1 -0
- package/dist/chunk-KPG3DGLA.js.map +1 -0
- package/dist/chunk-KRNQ6RGQ.js +1 -0
- package/dist/chunk-KRNQ6RGQ.js.map +1 -0
- package/dist/chunk-LBAJK24K.js +1071 -0
- package/dist/chunk-LBAJK24K.js.map +1 -0
- package/dist/chunk-MLTPJMH6.js +417 -0
- package/dist/chunk-MLTPJMH6.js.map +1 -0
- package/dist/chunk-N3SZ7BMH.js +95 -0
- package/dist/chunk-N3SZ7BMH.js.map +1 -0
- package/dist/chunk-NDUD3IMO.js +540 -0
- package/dist/chunk-NDUD3IMO.js.map +1 -0
- package/dist/chunk-NY2PYHNC.js +873 -0
- package/dist/chunk-NY2PYHNC.js.map +1 -0
- package/dist/chunk-O3MT7DYI.js +225 -0
- package/dist/chunk-O3MT7DYI.js.map +1 -0
- package/dist/chunk-OCUDSN63.js +2386 -0
- package/dist/chunk-OCUDSN63.js.map +1 -0
- package/dist/chunk-OIWU3NYV.js +199 -0
- package/dist/chunk-OIWU3NYV.js.map +1 -0
- package/dist/chunk-OO5BM6CJ.js +1153 -0
- package/dist/chunk-OO5BM6CJ.js.map +1 -0
- package/dist/chunk-OQUIJT7A.js +1 -0
- package/dist/chunk-OQUIJT7A.js.map +1 -0
- package/dist/chunk-P5LBT622.js +105 -0
- package/dist/chunk-P5LBT622.js.map +1 -0
- package/dist/chunk-PKGQG5QQ.js +519 -0
- package/dist/chunk-PKGQG5QQ.js.map +1 -0
- package/dist/chunk-PKPO3JTZ.js +561 -0
- package/dist/chunk-PKPO3JTZ.js.map +1 -0
- package/dist/chunk-PL5UDIQ5.js +118 -0
- package/dist/chunk-PL5UDIQ5.js.map +1 -0
- package/dist/chunk-PZWISPIQ.js +432 -0
- package/dist/chunk-PZWISPIQ.js.map +1 -0
- package/dist/chunk-Q3EYOCZB.js +510 -0
- package/dist/chunk-Q3EYOCZB.js.map +1 -0
- package/dist/chunk-QMBYUVRL.js +15 -0
- package/dist/chunk-QMBYUVRL.js.map +1 -0
- package/dist/chunk-RAGGHLCV.js +200 -0
- package/dist/chunk-RAGGHLCV.js.map +1 -0
- package/dist/chunk-RGL53X5G.js +574 -0
- package/dist/chunk-RGL53X5G.js.map +1 -0
- package/dist/chunk-RJOG4IJU.js +1039 -0
- package/dist/chunk-RJOG4IJU.js.map +1 -0
- package/dist/chunk-SOOKUYVM.js +403 -0
- package/dist/chunk-SOOKUYVM.js.map +1 -0
- package/dist/chunk-T5BN5KG7.js +1 -0
- package/dist/chunk-T5BN5KG7.js.map +1 -0
- package/dist/chunk-TP7244Y6.js +207 -0
- package/dist/chunk-TP7244Y6.js.map +1 -0
- package/dist/chunk-TSBFTJKM.js +57 -0
- package/dist/chunk-TSBFTJKM.js.map +1 -0
- package/dist/chunk-URQ2CBBF.js +143 -0
- package/dist/chunk-URQ2CBBF.js.map +1 -0
- package/dist/chunk-W2BOPXTI.js +1 -0
- package/dist/chunk-W2BOPXTI.js.map +1 -0
- package/dist/chunk-WKSWLSCX.js +207 -0
- package/dist/chunk-WKSWLSCX.js.map +1 -0
- package/dist/chunk-Y52CS6YA.js +88 -0
- package/dist/chunk-Y52CS6YA.js.map +1 -0
- package/dist/chunk-YCBUWK77.js +92 -0
- package/dist/chunk-YCBUWK77.js.map +1 -0
- package/dist/chunk-YJ4U2D2C.js +314 -0
- package/dist/chunk-YJ4U2D2C.js.map +1 -0
- package/dist/chunk-Z4YXAUDN.js +239 -0
- package/dist/chunk-Z4YXAUDN.js.map +1 -0
- package/dist/chunk-Z6EGP5D7.js +92 -0
- package/dist/chunk-Z6EGP5D7.js.map +1 -0
- package/dist/compat/index.cjs +3083 -2
- package/dist/compat/index.cjs.map +1 -1
- package/dist/compat/index.d.cts +116 -1
- package/dist/compat/index.d.ts +116 -1
- package/dist/compat/index.js +175 -2
- package/dist/compat/index.js.map +1 -1
- package/dist/compat/jotai/index.cjs +130 -2
- package/dist/compat/jotai/index.cjs.map +1 -1
- package/dist/compat/jotai/index.d.cts +2 -1
- package/dist/compat/jotai/index.d.ts +2 -1
- package/dist/compat/jotai/index.js +7 -2
- package/dist/compat/jotai/index.js.map +1 -1
- package/dist/compat/nanostores/index.cjs +186 -2
- package/dist/compat/nanostores/index.cjs.map +1 -1
- package/dist/compat/nanostores/index.d.cts +2 -1
- package/dist/compat/nanostores/index.d.ts +2 -1
- package/dist/compat/nanostores/index.js +21 -2
- package/dist/compat/nanostores/index.js.map +1 -1
- package/dist/compat/nestjs/index.cjs +2224 -2
- package/dist/compat/nestjs/index.cjs.map +1 -1
- package/dist/compat/nestjs/index.d.cts +10 -1
- package/dist/compat/nestjs/index.d.ts +10 -1
- package/dist/compat/nestjs/index.js +77 -2
- package/dist/compat/nestjs/index.js.map +1 -1
- package/dist/compat/react/index.cjs +95 -2
- package/dist/compat/react/index.cjs.map +1 -1
- package/dist/compat/react/index.d.cts +2 -1
- package/dist/compat/react/index.d.ts +2 -1
- package/dist/compat/react/index.js +11 -2
- package/dist/compat/react/index.js.map +1 -1
- package/dist/compat/solid/index.cjs +82 -2
- package/dist/compat/solid/index.cjs.map +1 -1
- package/dist/compat/solid/index.d.cts +2 -1
- package/dist/compat/solid/index.d.ts +2 -1
- package/dist/compat/solid/index.js +11 -2
- package/dist/compat/solid/index.js.map +1 -1
- package/dist/compat/svelte/index.cjs +85 -2
- package/dist/compat/svelte/index.cjs.map +1 -1
- package/dist/compat/svelte/index.d.cts +2 -1
- package/dist/compat/svelte/index.d.ts +2 -1
- package/dist/compat/svelte/index.js +11 -2
- package/dist/compat/svelte/index.js.map +1 -1
- package/dist/compat/vue/index.cjs +100 -2
- package/dist/compat/vue/index.cjs.map +1 -1
- package/dist/compat/vue/index.d.cts +3 -1
- package/dist/compat/vue/index.d.ts +3 -1
- package/dist/compat/vue/index.js +11 -2
- package/dist/compat/vue/index.js.map +1 -1
- package/dist/compat/zustand/index.cjs +50 -2
- package/dist/compat/zustand/index.cjs.map +1 -1
- package/dist/compat/zustand/index.d.cts +2 -1
- package/dist/compat/zustand/index.d.ts +2 -1
- package/dist/compat/zustand/index.js +7 -2
- package/dist/compat/zustand/index.js.map +1 -1
- package/dist/distill-De6Rnn15.d.cts +48 -0
- package/dist/distill-De6Rnn15.d.ts +48 -0
- package/dist/external-register-CWyroXb_.d.cts +138 -0
- package/dist/external-register-CWyroXb_.d.ts +138 -0
- package/dist/fallback-Bx46zqky.d.cts +243 -0
- package/dist/fallback-pIWW8A2d.d.ts +243 -0
- package/dist/guarded-execution-BcdtxeBk.d.ts +207 -0
- package/dist/guarded-execution-C-3hnP6A.d.cts +207 -0
- package/dist/index-5SU_O78r.d.cts +754 -0
- package/dist/index-B6pxYJzO.d.cts +36 -0
- package/dist/index-B6pxYJzO.d.ts +36 -0
- package/dist/index-BFsng6v1.d.cts +44 -0
- package/dist/index-BFsng6v1.d.ts +44 -0
- package/dist/index-Bg-LwEt-.d.cts +45 -0
- package/dist/index-Bg-LwEt-.d.ts +45 -0
- package/dist/index-Brp888t0.d.cts +127 -0
- package/dist/index-Brp888t0.d.ts +127 -0
- package/dist/index-CDfk6jHN.d.cts +37 -0
- package/dist/index-CDfk6jHN.d.ts +37 -0
- package/dist/index-CEXCtYYJ.d.ts +754 -0
- package/dist/index-DLAxYaN5.d.cts +169 -0
- package/dist/index-DLAxYaN5.d.ts +169 -0
- package/dist/index-DeWbQzMe.d.cts +34 -0
- package/dist/index-DeWbQzMe.d.ts +34 -0
- package/dist/index-dX9IzPqj.d.cts +86 -0
- package/dist/index-dX9IzPqj.d.ts +86 -0
- package/dist/index.cjs +25950 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +56 -42
- package/dist/index.d.ts +56 -42
- package/dist/index.js +849 -0
- package/dist/index.js.map +1 -1
- package/dist/layout-types-B5aiHYgk.d.cts +72 -0
- package/dist/layout-types-B5aiHYgk.d.ts +72 -0
- package/dist/memory-composers-BryDrRBX.d.cts +529 -0
- package/dist/memory-composers-CVQqPYEV.d.ts +529 -0
- package/dist/observable-BXQoW1P-.d.cts +36 -0
- package/dist/observable-BXQoW1P-.d.ts +36 -0
- package/dist/pipeline-graph-Ce47CB6Y.d.cts +145 -0
- package/dist/pipeline-graph-DXCwY9vG.d.ts +145 -0
- package/dist/presets/ai/index.cjs +4377 -0
- package/dist/presets/ai/index.cjs.map +1 -0
- package/dist/presets/ai/index.d.cts +98 -0
- package/dist/presets/ai/index.d.ts +98 -0
- package/dist/presets/ai/index.js +54 -0
- package/dist/presets/ai/index.js.map +1 -0
- package/dist/presets/harness/index.cjs +5929 -0
- package/dist/presets/harness/index.cjs.map +1 -0
- package/dist/presets/harness/index.d.cts +566 -0
- package/dist/presets/harness/index.d.ts +566 -0
- package/dist/presets/harness/index.js +71 -0
- package/dist/presets/harness/index.js.map +1 -0
- package/dist/presets/index.cjs +9782 -0
- package/dist/presets/index.cjs.map +1 -0
- package/dist/presets/index.d.cts +28 -0
- package/dist/presets/index.d.ts +28 -0
- package/dist/presets/index.js +129 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/presets/inspect/index.cjs +1087 -0
- package/dist/presets/inspect/index.cjs.map +1 -0
- package/dist/presets/inspect/index.d.cts +172 -0
- package/dist/presets/inspect/index.d.ts +172 -0
- package/dist/presets/inspect/index.js +21 -0
- package/dist/presets/inspect/index.js.map +1 -0
- package/dist/presets/resilience/index.cjs +1593 -0
- package/dist/presets/resilience/index.cjs.map +1 -0
- package/dist/presets/resilience/index.d.cts +205 -0
- package/dist/presets/resilience/index.d.ts +205 -0
- package/dist/presets/resilience/index.js +18 -0
- package/dist/presets/resilience/index.js.map +1 -0
- package/dist/rate-limiter-CEALq4N1.d.ts +559 -0
- package/dist/rate-limiter-DpVbSYdH.d.cts +559 -0
- package/dist/reactive-layout-fswlBUvX.d.cts +195 -0
- package/dist/reactive-layout-fswlBUvX.d.ts +195 -0
- package/dist/retry-BDbRZ_gx.d.ts +125 -0
- package/dist/retry-DWuhjvsA.d.cts +125 -0
- package/dist/solutions/index.cjs +8200 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +23 -0
- package/dist/solutions/index.d.ts +23 -0
- package/dist/solutions/index.js +55 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/spawnable-5mDY501F.d.cts +746 -0
- package/dist/spawnable-D3lR0oQu.d.ts +746 -0
- package/dist/status-U-rUI79b.d.cts +84 -0
- package/dist/status-U-rUI79b.d.ts +84 -0
- package/dist/timeout-U5O4ESK3.js +12 -0
- package/dist/timeout-U5O4ESK3.js.map +1 -0
- package/dist/types-BB5Lw-pB.d.cts +442 -0
- package/dist/types-BB5Lw-pB.d.ts +442 -0
- package/dist/types-CJWIMJiZ.d.ts +548 -0
- package/dist/types-vCq7ShIm.d.cts +548 -0
- package/dist/utils/ai/browser.cjs +2169 -0
- package/dist/utils/ai/browser.cjs.map +1 -0
- package/dist/utils/ai/browser.d.cts +129 -0
- package/dist/utils/ai/browser.d.ts +129 -0
- package/dist/utils/ai/browser.js +255 -0
- package/dist/utils/ai/browser.js.map +1 -0
- package/dist/utils/ai/index.cjs +8468 -0
- package/dist/utils/ai/index.cjs.map +1 -0
- package/dist/utils/ai/index.d.cts +1777 -0
- package/dist/utils/ai/index.d.ts +1777 -0
- package/dist/utils/ai/index.js +173 -0
- package/dist/utils/ai/index.js.map +1 -0
- package/dist/utils/ai/node.cjs +648 -0
- package/dist/utils/ai/node.cjs.map +1 -0
- package/dist/utils/ai/node.d.cts +57 -0
- package/dist/utils/ai/node.d.ts +57 -0
- package/dist/utils/ai/node.js +84 -0
- package/dist/utils/ai/node.js.map +1 -0
- package/dist/utils/cqrs/index.cjs +1036 -0
- package/dist/utils/cqrs/index.cjs.map +1 -0
- package/dist/utils/cqrs/index.d.cts +438 -0
- package/dist/utils/cqrs/index.d.ts +438 -0
- package/dist/utils/cqrs/index.js +18 -0
- package/dist/utils/cqrs/index.js.map +1 -0
- package/dist/utils/demo-shell/index.cjs +865 -0
- package/dist/utils/demo-shell/index.cjs.map +1 -0
- package/dist/utils/demo-shell/index.d.cts +90 -0
- package/dist/utils/demo-shell/index.d.ts +90 -0
- package/dist/utils/demo-shell/index.js +13 -0
- package/dist/utils/demo-shell/index.js.map +1 -0
- package/dist/utils/domain-templates/index.cjs +732 -0
- package/dist/utils/domain-templates/index.cjs.map +1 -0
- package/dist/utils/domain-templates/index.d.cts +214 -0
- package/dist/utils/domain-templates/index.d.ts +214 -0
- package/dist/utils/domain-templates/index.js +17 -0
- package/dist/utils/domain-templates/index.js.map +1 -0
- package/dist/utils/graphspec/index.cjs +1174 -0
- package/dist/utils/graphspec/index.cjs.map +1 -0
- package/dist/utils/graphspec/index.d.cts +449 -0
- package/dist/utils/graphspec/index.d.ts +449 -0
- package/dist/utils/graphspec/index.js +35 -0
- package/dist/utils/graphspec/index.js.map +1 -0
- package/dist/utils/harness/index.cjs +656 -0
- package/dist/utils/harness/index.cjs.map +1 -0
- package/dist/utils/harness/index.d.cts +542 -0
- package/dist/utils/harness/index.d.ts +542 -0
- package/dist/utils/harness/index.js +56 -0
- package/dist/utils/harness/index.js.map +1 -0
- package/dist/utils/index.cjs +17609 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/index.d.cts +96 -0
- package/dist/utils/index.d.ts +96 -0
- package/dist/utils/index.js +514 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/inspect/index.cjs +807 -0
- package/dist/utils/inspect/index.cjs.map +1 -0
- package/dist/utils/inspect/index.d.cts +123 -0
- package/dist/utils/inspect/index.d.ts +123 -0
- package/dist/utils/inspect/index.js +30 -0
- package/dist/utils/inspect/index.js.map +1 -0
- package/dist/utils/job-queue/index.cjs +717 -0
- package/dist/utils/job-queue/index.cjs.map +1 -0
- package/dist/utils/job-queue/index.d.cts +200 -0
- package/dist/utils/job-queue/index.d.ts +200 -0
- package/dist/utils/job-queue/index.js +18 -0
- package/dist/utils/job-queue/index.js.map +1 -0
- package/dist/utils/memory/index.cjs +1451 -0
- package/dist/utils/memory/index.cjs.map +1 -0
- package/dist/utils/memory/index.d.cts +582 -0
- package/dist/utils/memory/index.d.ts +582 -0
- package/dist/utils/memory/index.js +19 -0
- package/dist/utils/memory/index.js.map +1 -0
- package/dist/utils/messaging/index.cjs +666 -0
- package/dist/utils/messaging/index.cjs.map +1 -0
- package/dist/utils/messaging/index.d.cts +562 -0
- package/dist/utils/messaging/index.d.ts +562 -0
- package/dist/utils/messaging/index.js +50 -0
- package/dist/utils/messaging/index.js.map +1 -0
- package/dist/utils/orchestration/index.cjs +876 -0
- package/dist/utils/orchestration/index.cjs.map +1 -0
- package/dist/utils/orchestration/index.d.cts +233 -0
- package/dist/utils/orchestration/index.d.ts +233 -0
- package/dist/utils/orchestration/index.js +19 -0
- package/dist/utils/orchestration/index.js.map +1 -0
- package/dist/utils/process/index.cjs +743 -0
- package/dist/utils/process/index.cjs.map +1 -0
- package/dist/utils/process/index.d.cts +411 -0
- package/dist/utils/process/index.d.ts +411 -0
- package/dist/utils/process/index.js +14 -0
- package/dist/utils/process/index.js.map +1 -0
- package/dist/utils/reactive-layout/index.cjs +1607 -0
- package/dist/utils/reactive-layout/index.cjs.map +1 -0
- package/dist/utils/reactive-layout/index.d.cts +492 -0
- package/dist/utils/reactive-layout/index.d.ts +492 -0
- package/dist/utils/reactive-layout/index.js +52 -0
- package/dist/utils/reactive-layout/index.js.map +1 -0
- package/dist/utils/reduction/index.cjs +203 -0
- package/dist/utils/reduction/index.cjs.map +1 -0
- package/dist/utils/reduction/index.d.cts +102 -0
- package/dist/utils/reduction/index.d.ts +102 -0
- package/dist/utils/reduction/index.js +14 -0
- package/dist/utils/reduction/index.js.map +1 -0
- package/dist/utils/resilience/index.cjs +1617 -0
- package/dist/utils/resilience/index.cjs.map +1 -0
- package/dist/utils/resilience/index.d.cts +9 -0
- package/dist/utils/resilience/index.d.ts +9 -0
- package/dist/utils/resilience/index.js +44 -0
- package/dist/utils/resilience/index.js.map +1 -0
- package/dist/utils/surface/index.cjs +1070 -0
- package/dist/utils/surface/index.cjs.map +1 -0
- package/dist/utils/surface/index.d.cts +240 -0
- package/dist/utils/surface/index.d.ts +240 -0
- package/dist/utils/surface/index.js +30 -0
- package/dist/utils/surface/index.js.map +1 -0
- package/dist/utils/topology-view/index.cjs +620 -0
- package/dist/utils/topology-view/index.cjs.map +1 -0
- package/dist/utils/topology-view/index.d.cts +68 -0
- package/dist/utils/topology-view/index.d.ts +68 -0
- package/dist/utils/topology-view/index.js +11 -0
- package/dist/utils/topology-view/index.js.map +1 -0
- package/package.json +293 -237
- package/dist/core/index.cjs +0 -21
- package/dist/core/index.cjs.map +0 -1
- package/dist/core/index.d.cts +0 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.js +0 -3
- package/dist/core/index.js.map +0 -1
- package/dist/extra/browser.cjs +0 -21
- package/dist/extra/browser.cjs.map +0 -1
- package/dist/extra/browser.d.cts +0 -1
- package/dist/extra/browser.d.ts +0 -1
- package/dist/extra/browser.js +0 -3
- package/dist/extra/browser.js.map +0 -1
- package/dist/extra/index.cjs +0 -21
- package/dist/extra/index.cjs.map +0 -1
- package/dist/extra/index.d.cts +0 -1
- package/dist/extra/index.d.ts +0 -1
- package/dist/extra/index.js +0 -3
- package/dist/extra/index.js.map +0 -1
- package/dist/extra/node.cjs +0 -21
- package/dist/extra/node.cjs.map +0 -1
- package/dist/extra/node.d.cts +0 -1
- package/dist/extra/node.d.ts +0 -1
- package/dist/extra/node.js +0 -3
- package/dist/extra/node.js.map +0 -1
- package/dist/extra/operators.cjs +0 -21
- package/dist/extra/operators.cjs.map +0 -1
- package/dist/extra/operators.d.cts +0 -1
- package/dist/extra/operators.d.ts +0 -1
- package/dist/extra/operators.js +0 -3
- package/dist/extra/operators.js.map +0 -1
- package/dist/extra/reactive.cjs +0 -21
- package/dist/extra/reactive.cjs.map +0 -1
- package/dist/extra/reactive.d.cts +0 -1
- package/dist/extra/reactive.d.ts +0 -1
- package/dist/extra/reactive.js +0 -3
- package/dist/extra/reactive.js.map +0 -1
- package/dist/extra/render/index.cjs +0 -21
- package/dist/extra/render/index.cjs.map +0 -1
- package/dist/extra/render/index.d.cts +0 -1
- package/dist/extra/render/index.d.ts +0 -1
- package/dist/extra/render/index.js +0 -3
- package/dist/extra/render/index.js.map +0 -1
- package/dist/extra/sources.cjs +0 -21
- package/dist/extra/sources.cjs.map +0 -1
- package/dist/extra/sources.d.cts +0 -1
- package/dist/extra/sources.d.ts +0 -1
- package/dist/extra/sources.js +0 -3
- package/dist/extra/sources.js.map +0 -1
- package/dist/extra/storage-browser.cjs +0 -21
- package/dist/extra/storage-browser.cjs.map +0 -1
- package/dist/extra/storage-browser.d.cts +0 -1
- package/dist/extra/storage-browser.d.ts +0 -1
- package/dist/extra/storage-browser.js +0 -3
- package/dist/extra/storage-browser.js.map +0 -1
- package/dist/extra/storage-core.cjs +0 -21
- package/dist/extra/storage-core.cjs.map +0 -1
- package/dist/extra/storage-core.d.cts +0 -1
- package/dist/extra/storage-core.d.ts +0 -1
- package/dist/extra/storage-core.js +0 -3
- package/dist/extra/storage-core.js.map +0 -1
- package/dist/extra/storage-node.cjs +0 -21
- package/dist/extra/storage-node.cjs.map +0 -1
- package/dist/extra/storage-node.d.cts +0 -1
- package/dist/extra/storage-node.d.ts +0 -1
- package/dist/extra/storage-node.js +0 -3
- package/dist/extra/storage-node.js.map +0 -1
- package/dist/extra/storage-tiers-browser.cjs +0 -21
- package/dist/extra/storage-tiers-browser.cjs.map +0 -1
- package/dist/extra/storage-tiers-browser.d.cts +0 -1
- package/dist/extra/storage-tiers-browser.d.ts +0 -1
- package/dist/extra/storage-tiers-browser.js +0 -3
- package/dist/extra/storage-tiers-browser.js.map +0 -1
- package/dist/extra/storage-tiers-node.cjs +0 -21
- package/dist/extra/storage-tiers-node.cjs.map +0 -1
- package/dist/extra/storage-tiers-node.d.cts +0 -1
- package/dist/extra/storage-tiers-node.d.ts +0 -1
- package/dist/extra/storage-tiers-node.js +0 -3
- package/dist/extra/storage-tiers-node.js.map +0 -1
- package/dist/extra/storage-tiers.cjs +0 -21
- package/dist/extra/storage-tiers.cjs.map +0 -1
- package/dist/extra/storage-tiers.d.cts +0 -1
- package/dist/extra/storage-tiers.d.ts +0 -1
- package/dist/extra/storage-tiers.js +0 -3
- package/dist/extra/storage-tiers.js.map +0 -1
- package/dist/extra/storage-wal.cjs +0 -21
- package/dist/extra/storage-wal.cjs.map +0 -1
- package/dist/extra/storage-wal.d.cts +0 -1
- package/dist/extra/storage-wal.d.ts +0 -1
- package/dist/extra/storage-wal.js +0 -3
- package/dist/extra/storage-wal.js.map +0 -1
- package/dist/graph/index.cjs +0 -21
- package/dist/graph/index.cjs.map +0 -1
- package/dist/graph/index.d.cts +0 -1
- package/dist/graph/index.d.ts +0 -1
- package/dist/graph/index.js +0 -3
- package/dist/graph/index.js.map +0 -1
- package/dist/patterns/ai/browser.cjs +0 -21
- package/dist/patterns/ai/browser.cjs.map +0 -1
- package/dist/patterns/ai/browser.d.cts +0 -1
- package/dist/patterns/ai/browser.d.ts +0 -1
- package/dist/patterns/ai/browser.js +0 -3
- package/dist/patterns/ai/browser.js.map +0 -1
- package/dist/patterns/ai/index.cjs +0 -21
- package/dist/patterns/ai/index.cjs.map +0 -1
- package/dist/patterns/ai/index.d.cts +0 -1
- package/dist/patterns/ai/index.d.ts +0 -1
- package/dist/patterns/ai/index.js +0 -3
- package/dist/patterns/ai/index.js.map +0 -1
- package/dist/patterns/ai/node.cjs +0 -21
- package/dist/patterns/ai/node.cjs.map +0 -1
- package/dist/patterns/ai/node.d.cts +0 -1
- package/dist/patterns/ai/node.d.ts +0 -1
- package/dist/patterns/ai/node.js +0 -3
- package/dist/patterns/ai/node.js.map +0 -1
- package/dist/patterns/cqrs/index.cjs +0 -21
- package/dist/patterns/cqrs/index.cjs.map +0 -1
- package/dist/patterns/cqrs/index.d.cts +0 -1
- package/dist/patterns/cqrs/index.d.ts +0 -1
- package/dist/patterns/cqrs/index.js +0 -3
- package/dist/patterns/cqrs/index.js.map +0 -1
- package/dist/patterns/demo-shell/index.cjs +0 -21
- package/dist/patterns/demo-shell/index.cjs.map +0 -1
- package/dist/patterns/demo-shell/index.d.cts +0 -1
- package/dist/patterns/demo-shell/index.d.ts +0 -1
- package/dist/patterns/demo-shell/index.js +0 -3
- package/dist/patterns/demo-shell/index.js.map +0 -1
- package/dist/patterns/domain-templates/index.cjs +0 -21
- package/dist/patterns/domain-templates/index.cjs.map +0 -1
- package/dist/patterns/domain-templates/index.d.cts +0 -1
- package/dist/patterns/domain-templates/index.d.ts +0 -1
- package/dist/patterns/domain-templates/index.js +0 -3
- package/dist/patterns/domain-templates/index.js.map +0 -1
- package/dist/patterns/graphspec/index.cjs +0 -21
- package/dist/patterns/graphspec/index.cjs.map +0 -1
- package/dist/patterns/graphspec/index.d.cts +0 -1
- package/dist/patterns/graphspec/index.d.ts +0 -1
- package/dist/patterns/graphspec/index.js +0 -3
- package/dist/patterns/graphspec/index.js.map +0 -1
- package/dist/patterns/harness/index.cjs +0 -21
- package/dist/patterns/harness/index.cjs.map +0 -1
- package/dist/patterns/harness/index.d.cts +0 -1
- package/dist/patterns/harness/index.d.ts +0 -1
- package/dist/patterns/harness/index.js +0 -3
- package/dist/patterns/harness/index.js.map +0 -1
- package/dist/patterns/inspect/index.cjs +0 -21
- package/dist/patterns/inspect/index.cjs.map +0 -1
- package/dist/patterns/inspect/index.d.cts +0 -1
- package/dist/patterns/inspect/index.d.ts +0 -1
- package/dist/patterns/inspect/index.js +0 -3
- package/dist/patterns/inspect/index.js.map +0 -1
- package/dist/patterns/job-queue/index.cjs +0 -21
- package/dist/patterns/job-queue/index.cjs.map +0 -1
- package/dist/patterns/job-queue/index.d.cts +0 -1
- package/dist/patterns/job-queue/index.d.ts +0 -1
- package/dist/patterns/job-queue/index.js +0 -3
- package/dist/patterns/job-queue/index.js.map +0 -1
- package/dist/patterns/memory/index.cjs +0 -21
- package/dist/patterns/memory/index.cjs.map +0 -1
- package/dist/patterns/memory/index.d.cts +0 -1
- package/dist/patterns/memory/index.d.ts +0 -1
- package/dist/patterns/memory/index.js +0 -3
- package/dist/patterns/memory/index.js.map +0 -1
- package/dist/patterns/messaging/index.cjs +0 -21
- package/dist/patterns/messaging/index.cjs.map +0 -1
- package/dist/patterns/messaging/index.d.cts +0 -1
- package/dist/patterns/messaging/index.d.ts +0 -1
- package/dist/patterns/messaging/index.js +0 -3
- package/dist/patterns/messaging/index.js.map +0 -1
- package/dist/patterns/orchestration/index.cjs +0 -21
- package/dist/patterns/orchestration/index.cjs.map +0 -1
- package/dist/patterns/orchestration/index.d.cts +0 -1
- package/dist/patterns/orchestration/index.d.ts +0 -1
- package/dist/patterns/orchestration/index.js +0 -3
- package/dist/patterns/orchestration/index.js.map +0 -1
- package/dist/patterns/process/index.cjs +0 -21
- package/dist/patterns/process/index.cjs.map +0 -1
- package/dist/patterns/process/index.d.cts +0 -1
- package/dist/patterns/process/index.d.ts +0 -1
- package/dist/patterns/process/index.js +0 -3
- package/dist/patterns/process/index.js.map +0 -1
- package/dist/patterns/reactive-layout/index.cjs +0 -21
- package/dist/patterns/reactive-layout/index.cjs.map +0 -1
- package/dist/patterns/reactive-layout/index.d.cts +0 -1
- package/dist/patterns/reactive-layout/index.d.ts +0 -1
- package/dist/patterns/reactive-layout/index.js +0 -3
- package/dist/patterns/reactive-layout/index.js.map +0 -1
- package/dist/patterns/reduction/index.cjs +0 -21
- package/dist/patterns/reduction/index.cjs.map +0 -1
- package/dist/patterns/reduction/index.d.cts +0 -1
- package/dist/patterns/reduction/index.d.ts +0 -1
- package/dist/patterns/reduction/index.js +0 -3
- package/dist/patterns/reduction/index.js.map +0 -1
- package/dist/patterns/surface/index.cjs +0 -21
- package/dist/patterns/surface/index.cjs.map +0 -1
- package/dist/patterns/surface/index.d.cts +0 -1
- package/dist/patterns/surface/index.d.ts +0 -1
- package/dist/patterns/surface/index.js +0 -3
- package/dist/patterns/surface/index.js.map +0 -1
- package/dist/patterns/topology-view/index.cjs +0 -21
- package/dist/patterns/topology-view/index.cjs.map +0 -1
- package/dist/patterns/topology-view/index.d.cts +0 -1
- package/dist/patterns/topology-view/index.d.ts +0 -1
- package/dist/patterns/topology-view/index.js +0 -3
- package/dist/patterns/topology-view/index.js.map +0 -1
- package/dist/testing/index.cjs +0 -21
- package/dist/testing/index.cjs.map +0 -1
- package/dist/testing/index.d.cts +0 -1
- package/dist/testing/index.d.ts +0 -1
- package/dist/testing/index.js +0 -3
- package/dist/testing/index.js.map +0 -1
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/process/index.ts
|
|
21
|
+
var process_exports = {};
|
|
22
|
+
__export(process_exports, {
|
|
23
|
+
processInstanceKeyOf: () => processInstanceKeyOf,
|
|
24
|
+
processManager: () => processManager,
|
|
25
|
+
processStateKeyOf: () => processStateKeyOf
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(process_exports);
|
|
28
|
+
var import_core3 = require("@graphrefly/pure-ts/core");
|
|
29
|
+
var import_extra2 = require("@graphrefly/pure-ts/extra");
|
|
30
|
+
var import_graph2 = require("@graphrefly/pure-ts/graph");
|
|
31
|
+
|
|
32
|
+
// src/base/mutation/index.ts
|
|
33
|
+
var import_core = require("@graphrefly/pure-ts/core");
|
|
34
|
+
var import_extra = require("@graphrefly/pure-ts/extra");
|
|
35
|
+
var import_graph = require("@graphrefly/pure-ts/graph");
|
|
36
|
+
var DEFAULT_AUDIT_GUARD = (0, import_core.policy)((allow, deny) => {
|
|
37
|
+
allow("observe");
|
|
38
|
+
allow("signal");
|
|
39
|
+
deny("write");
|
|
40
|
+
});
|
|
41
|
+
function createAuditLog(opts) {
|
|
42
|
+
const log = (0, import_extra.reactiveLog)([], {
|
|
43
|
+
name: opts.name,
|
|
44
|
+
maxSize: opts.retainedLimit ?? 1024,
|
|
45
|
+
guard: opts.guard ?? DEFAULT_AUDIT_GUARD,
|
|
46
|
+
...opts.versioning != null ? { versioning: opts.versioning } : {}
|
|
47
|
+
});
|
|
48
|
+
log.withLatest();
|
|
49
|
+
if (opts.graph) {
|
|
50
|
+
opts.graph.add(log.entries, { name: opts.name });
|
|
51
|
+
}
|
|
52
|
+
return log;
|
|
53
|
+
}
|
|
54
|
+
function deepFreeze(value) {
|
|
55
|
+
if (value === null || typeof value !== "object" || Object.isFrozen(value)) return value;
|
|
56
|
+
for (const k of Object.keys(value)) {
|
|
57
|
+
deepFreeze(value[k]);
|
|
58
|
+
}
|
|
59
|
+
return Object.freeze(value);
|
|
60
|
+
}
|
|
61
|
+
function mutate(act, opts) {
|
|
62
|
+
const { up, down } = typeof act === "function" ? { up: act, down: void 0 } : act;
|
|
63
|
+
const freeze = opts.freeze ?? true;
|
|
64
|
+
if (opts.frame === "inline") {
|
|
65
|
+
return function wrapped(...args) {
|
|
66
|
+
const sealed = freeze ? args.map(deepFreeze) : args;
|
|
67
|
+
const t_ns = (0, import_core.wallClockNs)();
|
|
68
|
+
const seq = opts.seq ? bumpCursor(opts.seq) : void 0;
|
|
69
|
+
try {
|
|
70
|
+
const result = up(...sealed);
|
|
71
|
+
if (opts.log && opts.onSuccessRecord) {
|
|
72
|
+
appendAudit(
|
|
73
|
+
opts.log,
|
|
74
|
+
opts.onSuccessRecord,
|
|
75
|
+
sealed,
|
|
76
|
+
result,
|
|
77
|
+
{ t_ns, seq },
|
|
78
|
+
opts.handlerVersion
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
} catch (err) {
|
|
83
|
+
if (opts.log && opts.onFailureRecord) {
|
|
84
|
+
const errorType = err instanceof Error ? err.name : typeof err;
|
|
85
|
+
appendAudit(
|
|
86
|
+
opts.log,
|
|
87
|
+
opts.onFailureRecord,
|
|
88
|
+
sealed,
|
|
89
|
+
err,
|
|
90
|
+
{ t_ns, seq, errorType },
|
|
91
|
+
opts.handlerVersion
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
throw err;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
return function wrapped(...args) {
|
|
99
|
+
const sealed = freeze ? args.map(deepFreeze) : args;
|
|
100
|
+
const t_ns = (0, import_core.wallClockNs)();
|
|
101
|
+
let result;
|
|
102
|
+
let captured;
|
|
103
|
+
let captureSet = false;
|
|
104
|
+
let seq;
|
|
105
|
+
try {
|
|
106
|
+
(0, import_core.batch)(() => {
|
|
107
|
+
if (opts.seq) seq = bumpCursor(opts.seq);
|
|
108
|
+
try {
|
|
109
|
+
result = up(...sealed);
|
|
110
|
+
if (opts.log && opts.onSuccessRecord) {
|
|
111
|
+
appendAudit(
|
|
112
|
+
opts.log,
|
|
113
|
+
opts.onSuccessRecord,
|
|
114
|
+
sealed,
|
|
115
|
+
result,
|
|
116
|
+
{ t_ns, seq },
|
|
117
|
+
opts.handlerVersion
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
} catch (err) {
|
|
121
|
+
captured = err;
|
|
122
|
+
captureSet = true;
|
|
123
|
+
throw err;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
} catch (outerErr) {
|
|
127
|
+
if (captureSet && down) {
|
|
128
|
+
try {
|
|
129
|
+
down(...sealed);
|
|
130
|
+
} catch (downErr) {
|
|
131
|
+
console.error(
|
|
132
|
+
`mutate: down hook threw \u2014 original action error preserved (${captured instanceof Error ? captured.name : typeof captured}). Down error:`,
|
|
133
|
+
downErr
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (captureSet && opts.log && opts.onFailureRecord) {
|
|
138
|
+
const errorType = captured instanceof Error ? captured.name : typeof captured;
|
|
139
|
+
appendAudit(
|
|
140
|
+
opts.log,
|
|
141
|
+
opts.onFailureRecord,
|
|
142
|
+
sealed,
|
|
143
|
+
captured,
|
|
144
|
+
{ t_ns, seq, errorType },
|
|
145
|
+
opts.handlerVersion
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
throw captureSet ? captured : outerErr;
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
var _bumpCursorWarned = /* @__PURE__ */ new WeakSet();
|
|
154
|
+
function bumpCursor(seq) {
|
|
155
|
+
const raw = seq.cache;
|
|
156
|
+
const valid = typeof raw === "number" && Number.isFinite(raw);
|
|
157
|
+
if (!valid && raw !== void 0 && !_bumpCursorWarned.has(seq)) {
|
|
158
|
+
_bumpCursorWarned.add(seq);
|
|
159
|
+
console.warn(
|
|
160
|
+
`bumpCursor: cursor cache held a non-numeric value (${String(raw)}); resetting to 0. Causes include: a snapshot codec round-tripping the cursor as a string / null / NaN, OR a malformed initial seed (e.g. state<number>(NaN)). Audit consumers may see colliding seq values after this point.`
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
const cur = valid ? raw : 0;
|
|
164
|
+
const next = cur + 1;
|
|
165
|
+
seq.down([[import_core.DIRTY], [import_core.DATA, next]]);
|
|
166
|
+
return next;
|
|
167
|
+
}
|
|
168
|
+
function appendAudit(audit, builder, args, value, meta, handlerVersion) {
|
|
169
|
+
const record = builder(args, value, meta);
|
|
170
|
+
if (record === void 0) return;
|
|
171
|
+
const stamped = handlerVersion != null ? { ...record, handlerVersion } : record;
|
|
172
|
+
audit.append(stamped);
|
|
173
|
+
}
|
|
174
|
+
function registerCursor(graph, name, initial = 0) {
|
|
175
|
+
const cursor = (0, import_core.node)([], { initial, name, describeKind: "state" });
|
|
176
|
+
graph.add(cursor, { name });
|
|
177
|
+
return cursor;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// src/base/sources/settled.ts
|
|
181
|
+
var import_core2 = require("@graphrefly/pure-ts/core");
|
|
182
|
+
function firstWhere(source, predicate, opts) {
|
|
183
|
+
let pending;
|
|
184
|
+
let resolveFn;
|
|
185
|
+
let rejectFn;
|
|
186
|
+
let settled = false;
|
|
187
|
+
let shouldUnsub = false;
|
|
188
|
+
let unsub;
|
|
189
|
+
let inInitialSyncPhase = opts?.skipCurrent === true;
|
|
190
|
+
const settleData = (v) => {
|
|
191
|
+
if (settled) return;
|
|
192
|
+
settled = true;
|
|
193
|
+
if (resolveFn != null) resolveFn(v);
|
|
194
|
+
else pending = { kind: "data", value: v };
|
|
195
|
+
};
|
|
196
|
+
const settleError = (err) => {
|
|
197
|
+
if (settled) return;
|
|
198
|
+
settled = true;
|
|
199
|
+
if (rejectFn != null) rejectFn(err);
|
|
200
|
+
else pending = { kind: "error", err };
|
|
201
|
+
};
|
|
202
|
+
const settleComplete = () => {
|
|
203
|
+
if (settled) return;
|
|
204
|
+
settled = true;
|
|
205
|
+
const err = new Error("completed without matching value");
|
|
206
|
+
if (rejectFn != null) rejectFn(err);
|
|
207
|
+
else pending = { kind: "complete" };
|
|
208
|
+
};
|
|
209
|
+
const detach = () => {
|
|
210
|
+
if (unsub) {
|
|
211
|
+
unsub();
|
|
212
|
+
unsub = void 0;
|
|
213
|
+
} else shouldUnsub = true;
|
|
214
|
+
};
|
|
215
|
+
const sink = (msgs) => {
|
|
216
|
+
if (settled) return;
|
|
217
|
+
for (const m of msgs) {
|
|
218
|
+
if (settled) return;
|
|
219
|
+
if (inInitialSyncPhase && m[0] === import_core2.DATA) continue;
|
|
220
|
+
if (m[0] === import_core2.DATA) {
|
|
221
|
+
const v = m[1];
|
|
222
|
+
if (predicate(v)) {
|
|
223
|
+
settleData(v);
|
|
224
|
+
detach();
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (m[0] === import_core2.ERROR) {
|
|
229
|
+
settleError(m[1]);
|
|
230
|
+
detach();
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if (m[0] === import_core2.COMPLETE) {
|
|
234
|
+
settleComplete();
|
|
235
|
+
detach();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
unsub = source.subscribe(sink);
|
|
241
|
+
inInitialSyncPhase = false;
|
|
242
|
+
if (opts?.kick != null && !settled) {
|
|
243
|
+
try {
|
|
244
|
+
opts.kick();
|
|
245
|
+
} catch (err) {
|
|
246
|
+
settleError(err);
|
|
247
|
+
detach();
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (shouldUnsub) {
|
|
251
|
+
unsub?.();
|
|
252
|
+
unsub = void 0;
|
|
253
|
+
}
|
|
254
|
+
return new Promise((resolve, reject) => {
|
|
255
|
+
if (pending != null) {
|
|
256
|
+
if (pending.kind === "data") resolve(pending.value);
|
|
257
|
+
else if (pending.kind === "error") reject(pending.err);
|
|
258
|
+
else reject(new Error("completed without matching value"));
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
resolveFn = resolve;
|
|
262
|
+
rejectFn = reject;
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// src/utils/process/index.ts
|
|
267
|
+
var processInstanceKeyOf = (i) => i.correlationId;
|
|
268
|
+
var processStateKeyOf = (s) => s.correlationId;
|
|
269
|
+
function toPromise(input) {
|
|
270
|
+
if (input == null) return Promise.resolve(void 0);
|
|
271
|
+
const n = (0, import_extra2.fromAny)(input);
|
|
272
|
+
return new Promise((resolve, reject) => {
|
|
273
|
+
let settled = false;
|
|
274
|
+
let unsub;
|
|
275
|
+
const cleanup = () => {
|
|
276
|
+
if (unsub) {
|
|
277
|
+
unsub();
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
unsub = n.subscribe((msgs) => {
|
|
281
|
+
if (settled) return;
|
|
282
|
+
for (const m of msgs) {
|
|
283
|
+
if (m[0] === import_core3.DATA) {
|
|
284
|
+
settled = true;
|
|
285
|
+
Promise.resolve().then(cleanup);
|
|
286
|
+
resolve(m[1]);
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (m[0] === import_core3.ERROR) {
|
|
290
|
+
settled = true;
|
|
291
|
+
Promise.resolve().then(cleanup);
|
|
292
|
+
reject(m[1]);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (m[0] === import_core3.COMPLETE) {
|
|
296
|
+
settled = true;
|
|
297
|
+
Promise.resolve().then(cleanup);
|
|
298
|
+
resolve(void 0);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
async function runWithRetry(step, state, event, retryMax, backoffMs) {
|
|
306
|
+
let lastError;
|
|
307
|
+
for (let attempt = 0; attempt <= retryMax; attempt++) {
|
|
308
|
+
if (attempt > 0) {
|
|
309
|
+
const delayMs = backoffMs[Math.min(attempt - 1, backoffMs.length - 1)] ?? 0;
|
|
310
|
+
if (delayMs > 0) {
|
|
311
|
+
await new Promise((r) => setTimeout(r, delayMs));
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
const result = await toPromise(step(state, event));
|
|
316
|
+
return result;
|
|
317
|
+
} catch (err) {
|
|
318
|
+
lastError = err;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
return { outcome: "failure", error: lastError };
|
|
322
|
+
}
|
|
323
|
+
function processManager(cqrsGraph, name, opts) {
|
|
324
|
+
const retryMax = opts.retryMax ?? 0;
|
|
325
|
+
const backoffMs = opts.backoffMs ?? [0];
|
|
326
|
+
const retainedLimit = 1024;
|
|
327
|
+
const instanceStates = /* @__PURE__ */ new Map();
|
|
328
|
+
const activeInstances = /* @__PURE__ */ new Set();
|
|
329
|
+
const startedAt = /* @__PURE__ */ new Map();
|
|
330
|
+
const mountName = `__processManagers__/${name}`;
|
|
331
|
+
const subgraph = new import_graph2.Graph(name);
|
|
332
|
+
try {
|
|
333
|
+
cqrsGraph.mount(mountName, subgraph);
|
|
334
|
+
} catch (err) {
|
|
335
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
336
|
+
throw new Error(
|
|
337
|
+
`processManager: name "${name}" is already in use on this CQRS graph (mount path "${mountName}" collides). Call .dispose() on the prior manager OR pick a different name before re-creating. (${detail})`
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
const instances = createAuditLog({
|
|
341
|
+
name: "instances",
|
|
342
|
+
retainedLimit,
|
|
343
|
+
graph: subgraph
|
|
344
|
+
});
|
|
345
|
+
const seqCursor = registerCursor(subgraph, "seq", 0);
|
|
346
|
+
const appendRecord = mutate(
|
|
347
|
+
// No closure-state mutation in the action — the audit-record append IS
|
|
348
|
+
// the effect, performed by the framework via `onSuccessRecord`.
|
|
349
|
+
() => void 0,
|
|
350
|
+
{
|
|
351
|
+
frame: "transactional",
|
|
352
|
+
log: instances,
|
|
353
|
+
seq: seqCursor,
|
|
354
|
+
freeze: true,
|
|
355
|
+
...opts.handlerVersion !== void 0 ? { handlerVersion: opts.handlerVersion } : {},
|
|
356
|
+
onSuccessRecord: ([correlationId, state, status, reason], _r, { t_ns, seq }) => ({
|
|
357
|
+
correlationId,
|
|
358
|
+
state,
|
|
359
|
+
status,
|
|
360
|
+
startedAt: startedAt.get(correlationId) ?? t_ns,
|
|
361
|
+
updatedAt: t_ns,
|
|
362
|
+
t_ns,
|
|
363
|
+
seq: seq ?? 0,
|
|
364
|
+
...reason !== void 0 ? { reason } : {}
|
|
365
|
+
})
|
|
366
|
+
}
|
|
367
|
+
);
|
|
368
|
+
const stateStorageTiers = opts.persistence?.stateStorage ?? [];
|
|
369
|
+
const buildSnapshot = (correlationId, status) => {
|
|
370
|
+
const stateValue = instanceStates.get(correlationId);
|
|
371
|
+
if (stateValue === void 0) return void 0;
|
|
372
|
+
return {
|
|
373
|
+
correlationId,
|
|
374
|
+
state: stateValue,
|
|
375
|
+
status,
|
|
376
|
+
startedAt: startedAt.get(correlationId) ?? (0, import_core3.wallClockNs)(),
|
|
377
|
+
updatedAt: (0, import_core3.wallClockNs)(),
|
|
378
|
+
...opts.handlerVersion !== void 0 ? { handlerVersion: opts.handlerVersion } : {}
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
const persistState = (correlationId, status) => {
|
|
382
|
+
if (stateStorageTiers.length === 0) return;
|
|
383
|
+
const snapshot = buildSnapshot(correlationId, status);
|
|
384
|
+
if (snapshot === void 0) return;
|
|
385
|
+
for (const tier of stateStorageTiers) {
|
|
386
|
+
try {
|
|
387
|
+
const r = tier.save(correlationId, snapshot);
|
|
388
|
+
if (r != null && typeof r.then === "function") {
|
|
389
|
+
r.catch(() => void 0);
|
|
390
|
+
}
|
|
391
|
+
} catch {
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
const persistStateThrowing = (correlationId, status) => {
|
|
396
|
+
if (stateStorageTiers.length === 0) return;
|
|
397
|
+
const snapshot = buildSnapshot(correlationId, status);
|
|
398
|
+
if (snapshot === void 0) return;
|
|
399
|
+
for (const tier of stateStorageTiers) {
|
|
400
|
+
const r = tier.save(correlationId, snapshot);
|
|
401
|
+
if (r != null && typeof r.then === "function") {
|
|
402
|
+
r.catch(() => void 0);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
const removeState = (correlationId) => {
|
|
407
|
+
if (stateStorageTiers.length === 0) return;
|
|
408
|
+
for (const tier of stateStorageTiers) {
|
|
409
|
+
if (!tier.delete) continue;
|
|
410
|
+
try {
|
|
411
|
+
const r = tier.delete(correlationId);
|
|
412
|
+
if (r != null && typeof r.then === "function") {
|
|
413
|
+
r.catch(() => void 0);
|
|
414
|
+
}
|
|
415
|
+
} catch {
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
const startedEventType = `_process_${name}_started`;
|
|
420
|
+
cqrsGraph.event(startedEventType);
|
|
421
|
+
if (opts.persistence?.eventStorage) {
|
|
422
|
+
cqrsGraph.attachEventStorage(opts.persistence.eventStorage);
|
|
423
|
+
}
|
|
424
|
+
async function runCompensate(correlationId, state, error, reason) {
|
|
425
|
+
activeInstances.delete(correlationId);
|
|
426
|
+
instanceStates.delete(correlationId);
|
|
427
|
+
startedAt.delete(correlationId);
|
|
428
|
+
if (opts.compensate) {
|
|
429
|
+
try {
|
|
430
|
+
await toPromise(opts.compensate(state, error));
|
|
431
|
+
appendRecord(correlationId, state, "cancelled", reason);
|
|
432
|
+
removeState(correlationId);
|
|
433
|
+
} catch (_compErr) {
|
|
434
|
+
appendRecord(correlationId, state, "errored", void 0);
|
|
435
|
+
removeState(correlationId);
|
|
436
|
+
}
|
|
437
|
+
} else {
|
|
438
|
+
appendRecord(correlationId, state, "errored", void 0);
|
|
439
|
+
removeState(correlationId);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
async function handleStepResult(correlationId, result) {
|
|
443
|
+
if (!activeInstances.has(correlationId)) return;
|
|
444
|
+
if (result.outcome === "failure") {
|
|
445
|
+
const state = instanceStates.get(correlationId) ?? opts.initial;
|
|
446
|
+
await runCompensate(correlationId, state, result.error);
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
if (result.outcome === "success") {
|
|
450
|
+
instanceStates.set(correlationId, result.state);
|
|
451
|
+
if (result.emit) {
|
|
452
|
+
for (const ev of result.emit) {
|
|
453
|
+
try {
|
|
454
|
+
cqrsGraph._appendEvent(ev.type, ev.payload, {
|
|
455
|
+
correlationId,
|
|
456
|
+
aggregateId: correlationId
|
|
457
|
+
});
|
|
458
|
+
} catch (_emitErr) {
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
appendRecord(correlationId, result.state, "running", void 0);
|
|
463
|
+
persistState(correlationId, "running");
|
|
464
|
+
if (opts.isTerminal?.(result.state)) {
|
|
465
|
+
activeInstances.delete(correlationId);
|
|
466
|
+
instanceStates.delete(correlationId);
|
|
467
|
+
startedAt.delete(correlationId);
|
|
468
|
+
appendRecord(correlationId, result.state, "completed", void 0);
|
|
469
|
+
removeState(correlationId);
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
if (result.schedule) {
|
|
473
|
+
const { afterMs, eventType } = result.schedule;
|
|
474
|
+
let timerUnsub;
|
|
475
|
+
const timerNode = (0, import_extra2.fromTimer)(afterMs);
|
|
476
|
+
const timerCb = (msgs) => {
|
|
477
|
+
for (const m of msgs) {
|
|
478
|
+
if (m[0] === import_core3.DATA) {
|
|
479
|
+
if (timerUnsub) {
|
|
480
|
+
timerUnsub();
|
|
481
|
+
} else {
|
|
482
|
+
queueMicrotask(() => timerUnsub?.());
|
|
483
|
+
}
|
|
484
|
+
if (!activeInstances.has(correlationId)) return;
|
|
485
|
+
const currentState = instanceStates.get(correlationId);
|
|
486
|
+
if (currentState === void 0) return;
|
|
487
|
+
const step = opts.steps[eventType];
|
|
488
|
+
if (!step) return;
|
|
489
|
+
const syntheticEvent = {
|
|
490
|
+
type: eventType,
|
|
491
|
+
// m5: null payload (not undefined) to avoid soft §1.2 risk.
|
|
492
|
+
// seq: Number.NaN — sentinel for synthetic events that do not
|
|
493
|
+
// participate in cross-event ordering.
|
|
494
|
+
payload: null,
|
|
495
|
+
timestampNs: (0, import_core3.wallClockNs)(),
|
|
496
|
+
seq: Number.NaN,
|
|
497
|
+
correlationId,
|
|
498
|
+
aggregateId: correlationId
|
|
499
|
+
};
|
|
500
|
+
dispatchStep(correlationId, step, currentState, syntheticEvent);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
timerUnsub = timerNode.subscribe(timerCb);
|
|
505
|
+
}
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
if (result.outcome === "terminate") {
|
|
509
|
+
instanceStates.set(correlationId, result.state);
|
|
510
|
+
if (result.emit) {
|
|
511
|
+
for (const ev of result.emit) {
|
|
512
|
+
try {
|
|
513
|
+
cqrsGraph._appendEvent(ev.type, ev.payload, {
|
|
514
|
+
correlationId,
|
|
515
|
+
aggregateId: correlationId
|
|
516
|
+
});
|
|
517
|
+
} catch (_emitErr) {
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
activeInstances.delete(correlationId);
|
|
522
|
+
instanceStates.delete(correlationId);
|
|
523
|
+
startedAt.delete(correlationId);
|
|
524
|
+
appendRecord(correlationId, result.state, "completed", void 0);
|
|
525
|
+
removeState(correlationId);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
529
|
+
function dispatchStep(correlationId, step, _state, event) {
|
|
530
|
+
const prior = inFlight.get(correlationId) ?? Promise.resolve();
|
|
531
|
+
const next = prior.then(async () => {
|
|
532
|
+
const currentState = instanceStates.get(correlationId);
|
|
533
|
+
if (currentState === void 0) return;
|
|
534
|
+
if (!activeInstances.has(correlationId)) return;
|
|
535
|
+
let result;
|
|
536
|
+
try {
|
|
537
|
+
result = await runWithRetry(
|
|
538
|
+
step,
|
|
539
|
+
currentState,
|
|
540
|
+
event,
|
|
541
|
+
retryMax,
|
|
542
|
+
backoffMs
|
|
543
|
+
);
|
|
544
|
+
} catch (err) {
|
|
545
|
+
await runCompensate(correlationId, instanceStates.get(correlationId) ?? opts.initial, err);
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
await handleStepResult(correlationId, result);
|
|
549
|
+
});
|
|
550
|
+
inFlight.set(correlationId, next);
|
|
551
|
+
next.finally(() => {
|
|
552
|
+
if (inFlight.get(correlationId) === next) inFlight.delete(correlationId);
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
let _disposed = false;
|
|
556
|
+
const restoreState = (0, import_core3.node)([], {
|
|
557
|
+
initial: "pending",
|
|
558
|
+
name: "restoreState",
|
|
559
|
+
describeKind: "state"
|
|
560
|
+
});
|
|
561
|
+
subgraph.add(restoreState, { name: "restoreState" });
|
|
562
|
+
const gateOpen = (0, import_core3.node)(
|
|
563
|
+
[restoreState],
|
|
564
|
+
(data, a, ctx) => {
|
|
565
|
+
const batch0 = data[0];
|
|
566
|
+
const v = batch0 != null && batch0.length > 0 ? batch0.at(-1) : ctx.prevData[0];
|
|
567
|
+
a.emit(v === "completed");
|
|
568
|
+
},
|
|
569
|
+
{ name: "gateOpen", describeKind: "derived" }
|
|
570
|
+
);
|
|
571
|
+
subgraph.add(gateOpen, { name: "gateOpen" });
|
|
572
|
+
const watchDisposers = [];
|
|
573
|
+
for (const eventType of opts.watching) {
|
|
574
|
+
const eventNode = cqrsGraph.event(eventType);
|
|
575
|
+
const gated = (0, import_extra2.valve)(eventNode, gateOpen, { name: `gatedEvent:${eventType}` });
|
|
576
|
+
let lastCount = 0;
|
|
577
|
+
const unsub = gated.subscribe((msgs) => {
|
|
578
|
+
for (const m of msgs) {
|
|
579
|
+
if (m[0] !== import_core3.DATA) continue;
|
|
580
|
+
const events = m[1];
|
|
581
|
+
if (events.length <= lastCount) continue;
|
|
582
|
+
const newEvents = events.slice(lastCount);
|
|
583
|
+
lastCount = events.length;
|
|
584
|
+
for (const ev of newEvents) {
|
|
585
|
+
const corrId = ev.correlationId;
|
|
586
|
+
if (corrId === void 0) continue;
|
|
587
|
+
if (!activeInstances.has(corrId)) continue;
|
|
588
|
+
const step = opts.steps[eventType];
|
|
589
|
+
if (!step) continue;
|
|
590
|
+
const state = instanceStates.get(corrId);
|
|
591
|
+
if (state === void 0) continue;
|
|
592
|
+
dispatchStep(corrId, step, state, ev);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
watchDisposers.push(unsub);
|
|
597
|
+
}
|
|
598
|
+
const startInternal = mutate(
|
|
599
|
+
(correlationId, initialPayload) => {
|
|
600
|
+
cqrsGraph._appendEvent(startedEventType, initialPayload ?? null, {
|
|
601
|
+
correlationId,
|
|
602
|
+
aggregateId: correlationId
|
|
603
|
+
});
|
|
604
|
+
startedAt.set(correlationId, (0, import_core3.wallClockNs)());
|
|
605
|
+
instanceStates.set(correlationId, opts.initial);
|
|
606
|
+
activeInstances.add(correlationId);
|
|
607
|
+
persistStateThrowing(correlationId, "running");
|
|
608
|
+
},
|
|
609
|
+
{
|
|
610
|
+
frame: "transactional",
|
|
611
|
+
log: instances,
|
|
612
|
+
seq: seqCursor,
|
|
613
|
+
freeze: true,
|
|
614
|
+
...opts.handlerVersion !== void 0 ? { handlerVersion: opts.handlerVersion } : {},
|
|
615
|
+
onSuccessRecord: ([correlationId], _r, { t_ns, seq }) => ({
|
|
616
|
+
correlationId,
|
|
617
|
+
state: opts.initial,
|
|
618
|
+
status: "running",
|
|
619
|
+
startedAt: startedAt.get(correlationId) ?? t_ns,
|
|
620
|
+
updatedAt: t_ns,
|
|
621
|
+
t_ns,
|
|
622
|
+
seq: seq ?? 0
|
|
623
|
+
})
|
|
624
|
+
}
|
|
625
|
+
);
|
|
626
|
+
function start(correlationId, initialPayload) {
|
|
627
|
+
if (_disposed) return;
|
|
628
|
+
if (activeInstances.has(correlationId)) return;
|
|
629
|
+
startInternal(correlationId, initialPayload);
|
|
630
|
+
}
|
|
631
|
+
function cancel(correlationId, reason) {
|
|
632
|
+
if (_disposed) return;
|
|
633
|
+
if (!activeInstances.has(correlationId)) return;
|
|
634
|
+
const state = instanceStates.get(correlationId) ?? opts.initial;
|
|
635
|
+
runCompensate(
|
|
636
|
+
correlationId,
|
|
637
|
+
state,
|
|
638
|
+
new Error(`cancelled: ${reason ?? "no reason given"}`),
|
|
639
|
+
reason
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
function getState(correlationId) {
|
|
643
|
+
return instanceStates.get(correlationId);
|
|
644
|
+
}
|
|
645
|
+
let restoreSubscription;
|
|
646
|
+
function startRestorePipeline() {
|
|
647
|
+
if (restoreSubscription !== void 0) return;
|
|
648
|
+
const tier = stateStorageTiers[0];
|
|
649
|
+
if (tier == null || tier.list == null || tier.load == null) {
|
|
650
|
+
if (!_disposed) restoreState.emit("completed");
|
|
651
|
+
restoreSubscription = () => void 0;
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
const tierLoad = tier.load.bind(tier);
|
|
655
|
+
const tierList = tier.list.bind(tier);
|
|
656
|
+
const listSource = (0, import_extra2.fromAny)(tierList());
|
|
657
|
+
const flattened = (0, import_extra2.mergeMap)(listSource, (keys) => {
|
|
658
|
+
if (keys.length === 0) {
|
|
659
|
+
return (0, import_extra2.fromIter)([]);
|
|
660
|
+
}
|
|
661
|
+
return (0, import_extra2.mergeMap)(
|
|
662
|
+
(0, import_extra2.fromIter)(keys),
|
|
663
|
+
(key) => (0, import_extra2.fromAny)(tierLoad(key)),
|
|
664
|
+
// Bound concurrent in-flight loads (D2, 2026-05-01) so a
|
|
665
|
+
// large persisted-instance count doesn't exhaust file
|
|
666
|
+
// handles / connection pools on the storage backend.
|
|
667
|
+
{ concurrent: opts.restoreConcurrency ?? 8 }
|
|
668
|
+
);
|
|
669
|
+
});
|
|
670
|
+
const restoreEffect = (0, import_core3.node)(
|
|
671
|
+
[flattened],
|
|
672
|
+
(data, _a, ctx) => {
|
|
673
|
+
if (_disposed) return;
|
|
674
|
+
const batch0 = data[0];
|
|
675
|
+
const hasSnapshots = batch0 != null && batch0.length > 0;
|
|
676
|
+
const allDone = ctx.terminalDeps[0] === true;
|
|
677
|
+
if (!hasSnapshots && !allDone) return;
|
|
678
|
+
(0, import_core3.batch)(() => {
|
|
679
|
+
if (hasSnapshots) {
|
|
680
|
+
for (const snap of batch0) {
|
|
681
|
+
if (snap == null) continue;
|
|
682
|
+
if (snap.status !== "running") continue;
|
|
683
|
+
instanceStates.set(snap.correlationId, snap.state);
|
|
684
|
+
activeInstances.add(snap.correlationId);
|
|
685
|
+
startedAt.set(snap.correlationId, snap.startedAt);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
if (allDone) restoreState.emit("completed");
|
|
689
|
+
});
|
|
690
|
+
},
|
|
691
|
+
{ name: "restoreEffect", describeKind: "effect" }
|
|
692
|
+
);
|
|
693
|
+
subgraph.add(restoreEffect, { name: "restoreEffect" });
|
|
694
|
+
restoreSubscription = restoreEffect.subscribe(() => void 0);
|
|
695
|
+
}
|
|
696
|
+
function restore() {
|
|
697
|
+
startRestorePipeline();
|
|
698
|
+
if (_disposed) return Promise.resolve();
|
|
699
|
+
if (restoreState.cache === "completed") return Promise.resolve();
|
|
700
|
+
return firstWhere(restoreState, (s) => s === "completed").then(() => void 0).catch((err) => {
|
|
701
|
+
if (err instanceof Error && err.message === "completed without matching value") {
|
|
702
|
+
return void 0;
|
|
703
|
+
}
|
|
704
|
+
throw err;
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
function dispose() {
|
|
708
|
+
if (_disposed) return;
|
|
709
|
+
_disposed = true;
|
|
710
|
+
if (restoreSubscription) {
|
|
711
|
+
try {
|
|
712
|
+
restoreSubscription();
|
|
713
|
+
} catch {
|
|
714
|
+
}
|
|
715
|
+
restoreSubscription = void 0;
|
|
716
|
+
}
|
|
717
|
+
for (const unsub of watchDisposers) {
|
|
718
|
+
try {
|
|
719
|
+
unsub();
|
|
720
|
+
} catch (_err) {
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
watchDisposers.length = 0;
|
|
724
|
+
try {
|
|
725
|
+
cqrsGraph.remove(mountName);
|
|
726
|
+
} catch (_err) {
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
if (opts.deferRestore !== true) {
|
|
730
|
+
startRestorePipeline();
|
|
731
|
+
}
|
|
732
|
+
return {
|
|
733
|
+
instances,
|
|
734
|
+
audit: instances,
|
|
735
|
+
restoreState,
|
|
736
|
+
start,
|
|
737
|
+
cancel,
|
|
738
|
+
getState,
|
|
739
|
+
restore,
|
|
740
|
+
dispose
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
//# sourceMappingURL=index.cjs.map
|