rivetkit 2.1.5 → 2.1.6-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.d.ts +593 -588
- package/dist/browser/client.js +215 -35
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +109 -10
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/inspector.tar.gz +0 -0
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/{actor-router-consts-D29T1Z-K.d.cts → actor-router-consts-DU-1IdQj.d.cts} +1 -1
- package/dist/tsup/{actor-router-consts-D29T1Z-K.d.ts → actor-router-consts-DU-1IdQj.d.ts} +1 -1
- package/dist/tsup/chunk-2ELYUO6C.cjs +112 -0
- package/dist/tsup/chunk-2ELYUO6C.cjs.map +1 -0
- package/dist/tsup/chunk-2LY7RW3Y.cjs +2316 -0
- package/dist/tsup/chunk-2LY7RW3Y.cjs.map +1 -0
- package/dist/tsup/{chunk-L47L3ZWJ.cjs → chunk-6G7ZNM27.cjs} +11 -6
- package/dist/tsup/chunk-6G7ZNM27.cjs.map +1 -0
- package/dist/tsup/{chunk-PB5AEMKQ.cjs → chunk-A4KEUCB6.cjs} +84 -34
- package/dist/tsup/chunk-A4KEUCB6.cjs.map +1 -0
- package/dist/tsup/{chunk-7HTNH26M.js → chunk-AKUJ5OTO.js} +11 -6
- package/dist/tsup/chunk-AKUJ5OTO.js.map +1 -0
- package/dist/tsup/{chunk-TADUYCHF.js → chunk-C22JYHVT.js} +77 -27
- package/dist/tsup/chunk-C22JYHVT.js.map +1 -0
- package/dist/tsup/chunk-C4EB42ET.js +1459 -0
- package/dist/tsup/chunk-C4EB42ET.js.map +1 -0
- package/dist/tsup/chunk-CGGGBIDP.cjs +1459 -0
- package/dist/tsup/chunk-CGGGBIDP.cjs.map +1 -0
- package/dist/tsup/chunk-CMQPDBBR.cjs +1486 -0
- package/dist/tsup/chunk-CMQPDBBR.cjs.map +1 -0
- package/dist/tsup/{chunk-GQGRQDRL.cjs → chunk-DH6UINWA.cjs} +4 -4
- package/dist/tsup/{chunk-GQGRQDRL.cjs.map → chunk-DH6UINWA.cjs.map} +1 -1
- package/dist/tsup/chunk-DK46YYCJ.js +1486 -0
- package/dist/tsup/chunk-DK46YYCJ.js.map +1 -0
- package/dist/tsup/chunk-EGWXXBZV.js +2316 -0
- package/dist/tsup/chunk-EGWXXBZV.js.map +1 -0
- package/dist/tsup/{chunk-S662Y6ZU.js → chunk-EONWXYMN.js} +2 -2
- package/dist/tsup/{chunk-N4KRDJ56.js → chunk-GFGRBYO2.js} +35 -6
- package/dist/tsup/chunk-GFGRBYO2.js.map +1 -0
- package/dist/tsup/{chunk-IIJNPVPQ.cjs → chunk-GUHXWPGB.cjs} +1515 -1479
- package/dist/tsup/chunk-GUHXWPGB.cjs.map +1 -0
- package/dist/tsup/{chunk-TI5PXQGG.cjs → chunk-HNE2AK6C.cjs} +2375 -3713
- package/dist/tsup/chunk-HNE2AK6C.cjs.map +1 -0
- package/dist/tsup/{chunk-2OK7S6QF.js → chunk-I5I6OALK.js} +2 -2
- package/dist/tsup/chunk-IHQAF2HV.cjs +23 -0
- package/dist/tsup/chunk-IHQAF2HV.cjs.map +1 -0
- package/dist/tsup/{chunk-U5SMSA27.cjs → chunk-JJNZQDUN.cjs} +667 -2517
- package/dist/tsup/chunk-JJNZQDUN.cjs.map +1 -0
- package/dist/tsup/{chunk-ZPWOYQHN.js → chunk-JJSPHLJN.js} +219 -287
- package/dist/tsup/chunk-JJSPHLJN.js.map +1 -0
- package/dist/tsup/chunk-JRKPV5NJ.js +481 -0
- package/dist/tsup/chunk-JRKPV5NJ.js.map +1 -0
- package/dist/tsup/{chunk-VKVNIQRQ.js → chunk-K7MVU5SI.js} +36 -41
- package/dist/tsup/chunk-K7MVU5SI.js.map +1 -0
- package/dist/tsup/{chunk-KJSYAUOM.js → chunk-MLK3GY6P.js} +43 -27
- package/dist/tsup/chunk-MLK3GY6P.js.map +1 -0
- package/dist/tsup/{chunk-HYPIHCDT.cjs → chunk-MPLMTJY5.cjs} +123 -23
- package/dist/tsup/chunk-MPLMTJY5.cjs.map +1 -0
- package/dist/tsup/{chunk-MIX2KB6U.js → chunk-PQWI44WD.js} +1755 -3093
- package/dist/tsup/chunk-PQWI44WD.js.map +1 -0
- package/dist/tsup/{chunk-SR3KQE7Q.cjs → chunk-SQFCIDCG.cjs} +35 -6
- package/dist/tsup/chunk-SQFCIDCG.cjs.map +1 -0
- package/dist/tsup/{chunk-WY2SHWXQ.js → chunk-SVHJSM2E.js} +110 -24
- package/dist/tsup/chunk-SVHJSM2E.js.map +1 -0
- package/dist/tsup/chunk-T5KYKM6R.js +49 -0
- package/dist/tsup/chunk-T5KYKM6R.js.map +1 -0
- package/dist/tsup/{chunk-7WF2QSIC.cjs → chunk-TJ7DKW6F.cjs} +123 -37
- package/dist/tsup/chunk-TJ7DKW6F.cjs.map +1 -0
- package/dist/tsup/chunk-UQZRMTM3.js +23 -0
- package/dist/tsup/chunk-UQZRMTM3.js.map +1 -0
- package/dist/tsup/{chunk-JC6BEPE7.cjs → chunk-V3JSZR5P.cjs} +3 -3
- package/dist/tsup/{chunk-JC6BEPE7.cjs.map → chunk-V3JSZR5P.cjs.map} +1 -1
- package/dist/tsup/{chunk-OAXJWGMU.cjs → chunk-VBR35EQF.cjs} +271 -339
- package/dist/tsup/chunk-VBR35EQF.cjs.map +1 -0
- package/dist/tsup/{chunk-EIATSBYZ.js → chunk-VWYO36X4.js} +117 -17
- package/dist/tsup/chunk-VWYO36X4.js.map +1 -0
- package/dist/tsup/{chunk-JPXO2H55.js → chunk-WW27B6DM.js} +1452 -1416
- package/dist/tsup/chunk-WW27B6DM.js.map +1 -0
- package/dist/tsup/chunk-YAE3MEJM.cjs +49 -0
- package/dist/tsup/chunk-YAE3MEJM.cjs.map +1 -0
- package/dist/tsup/{chunk-SRIM3GHD.js → chunk-YGYGANCA.js} +473 -2323
- package/dist/tsup/chunk-YGYGANCA.js.map +1 -0
- package/dist/tsup/chunk-YZJWZBY5.cjs +481 -0
- package/dist/tsup/chunk-YZJWZBY5.cjs.map +1 -0
- package/dist/tsup/{chunk-ZFY5J2EP.cjs → chunk-ZZLJ5TSM.cjs} +39 -44
- package/dist/tsup/chunk-ZZLJ5TSM.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +10 -7
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +6 -6
- package/dist/tsup/client/mod.d.ts +6 -6
- package/dist/tsup/client/mod.js +11 -8
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Qj-zLJPc.d.ts → config-C2Wwnc69.d.ts} +142 -208
- package/dist/tsup/{config-BiNoIHRs.d.ts → config-DROwzBLT.d.cts} +82 -6
- package/dist/tsup/{config-BiNoIHRs.d.cts → config-DROwzBLT.d.ts} +82 -6
- package/dist/tsup/{config-iPj5l1bL.d.cts → config-ehT-_3BB.d.cts} +142 -208
- package/dist/tsup/{context-DzvH1PBK.d.cts → context-DGMJuAyc.d.ts} +16 -3
- package/dist/tsup/{context-CQCMuHND.d.ts → context-Dpp2RJbW.d.cts} +16 -3
- package/dist/tsup/db/drizzle/mod.cjs +3 -3
- package/dist/tsup/db/drizzle/mod.d.cts +1 -1
- package/dist/tsup/db/drizzle/mod.d.ts +1 -1
- package/dist/tsup/db/drizzle/mod.js +2 -2
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.d.cts +1 -1
- package/dist/tsup/db/mod.d.ts +1 -1
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/{driver-Jo8v-kbU.d.ts → driver-CYZP9QYo.d.ts} +1 -1
- package/dist/tsup/{driver-iV8J-WMv.d.cts → driver-CoTFpipv.d.cts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +7 -5
- package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
- package/dist/tsup/driver-helpers/mod.d.cts +17 -18
- package/dist/tsup/driver-helpers/mod.d.ts +17 -18
- package/dist/tsup/driver-helpers/mod.js +11 -9
- package/dist/tsup/driver-test-suite/mod.cjs +1275 -228
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +6 -5
- package/dist/tsup/driver-test-suite/mod.d.ts +6 -5
- package/dist/tsup/driver-test-suite/mod.js +1581 -534
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +4 -4
- package/dist/tsup/inspector/mod.js +3 -3
- package/dist/tsup/mod.cjs +15 -9
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +9 -9
- package/dist/tsup/mod.d.ts +9 -9
- package/dist/tsup/mod.js +19 -13
- package/dist/tsup/sandbox/client.cjs +28 -0
- package/dist/tsup/sandbox/client.cjs.map +1 -0
- package/dist/tsup/sandbox/client.d.cts +88 -0
- package/dist/tsup/sandbox/client.d.ts +88 -0
- package/dist/tsup/sandbox/client.js +28 -0
- package/dist/tsup/sandbox/client.js.map +1 -0
- package/dist/tsup/sandbox/index.cjs +761 -0
- package/dist/tsup/sandbox/index.cjs.map +1 -0
- package/dist/tsup/sandbox/index.d.cts +120 -0
- package/dist/tsup/sandbox/index.d.ts +120 -0
- package/dist/tsup/sandbox/index.js +761 -0
- package/dist/tsup/sandbox/index.js.map +1 -0
- package/dist/tsup/sandbox/providers/computesdk.cjs +3 -0
- package/dist/tsup/sandbox/providers/computesdk.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/computesdk.d.cts +7 -0
- package/dist/tsup/sandbox/providers/computesdk.d.ts +7 -0
- package/dist/tsup/sandbox/providers/computesdk.js +3 -0
- package/dist/tsup/sandbox/providers/computesdk.js.map +1 -0
- package/dist/tsup/sandbox/providers/daytona.cjs +3 -0
- package/dist/tsup/sandbox/providers/daytona.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/daytona.d.cts +1 -0
- package/dist/tsup/sandbox/providers/daytona.d.ts +1 -0
- package/dist/tsup/sandbox/providers/daytona.js +3 -0
- package/dist/tsup/sandbox/providers/daytona.js.map +1 -0
- package/dist/tsup/sandbox/providers/docker.cjs +3 -0
- package/dist/tsup/sandbox/providers/docker.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/docker.d.cts +1 -0
- package/dist/tsup/sandbox/providers/docker.d.ts +1 -0
- package/dist/tsup/sandbox/providers/docker.js +3 -0
- package/dist/tsup/sandbox/providers/docker.js.map +1 -0
- package/dist/tsup/sandbox/providers/e2b.cjs +3 -0
- package/dist/tsup/sandbox/providers/e2b.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/e2b.d.cts +1 -0
- package/dist/tsup/sandbox/providers/e2b.d.ts +1 -0
- package/dist/tsup/sandbox/providers/e2b.js +3 -0
- package/dist/tsup/sandbox/providers/e2b.js.map +1 -0
- package/dist/tsup/sandbox/providers/local.cjs +3 -0
- package/dist/tsup/sandbox/providers/local.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/local.d.cts +1 -0
- package/dist/tsup/sandbox/providers/local.d.ts +1 -0
- package/dist/tsup/sandbox/providers/local.js +3 -0
- package/dist/tsup/sandbox/providers/local.js.map +1 -0
- package/dist/tsup/sandbox/providers/modal.cjs +3 -0
- package/dist/tsup/sandbox/providers/modal.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/modal.d.cts +1 -0
- package/dist/tsup/sandbox/providers/modal.d.ts +1 -0
- package/dist/tsup/sandbox/providers/modal.js +3 -0
- package/dist/tsup/sandbox/providers/modal.js.map +1 -0
- package/dist/tsup/sandbox/providers/vercel.cjs +3 -0
- package/dist/tsup/sandbox/providers/vercel.cjs.map +1 -0
- package/dist/tsup/sandbox/providers/vercel.d.cts +1 -0
- package/dist/tsup/sandbox/providers/vercel.d.ts +1 -0
- package/dist/tsup/sandbox/providers/vercel.js +3 -0
- package/dist/tsup/sandbox/providers/vercel.js.map +1 -0
- package/dist/tsup/serve-test-suite/mod.cjs +451 -327
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/serve-test-suite/mod.js +362 -238
- package/dist/tsup/serve-test-suite/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +17 -14
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -4
- package/dist/tsup/test/mod.d.ts +4 -4
- package/dist/tsup/test/mod.js +14 -11
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +6 -6
- package/dist/tsup/workflow/mod.d.cts +13 -9
- package/dist/tsup/workflow/mod.d.ts +13 -9
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +114 -15
- package/src/actor/config.ts +94 -88
- package/src/actor/conn/drivers/websocket.ts +2 -1
- package/src/actor/contexts/base/actor.ts +27 -4
- package/src/actor/database.ts +6 -1
- package/src/actor/driver.ts +27 -8
- package/src/actor/errors.ts +10 -5
- package/src/actor/instance/connection-manager.ts +4 -3
- package/src/actor/instance/kv.ts +52 -9
- package/src/actor/instance/mod.ts +135 -84
- package/src/actor/instance/queue-manager.ts +2 -5
- package/src/actor/instance/queue.ts +31 -29
- package/src/actor/instance/state-manager.ts +7 -1
- package/src/actor/instance/traces-driver.ts +34 -36
- package/src/actor/metrics.ts +137 -0
- package/src/actor/protocol/old.ts +9 -12
- package/src/actor/router-websocket-endpoints.ts +12 -6
- package/src/actor/router.ts +46 -9
- package/src/actor/schema.ts +14 -22
- package/src/client/actor-common.ts +65 -0
- package/src/client/actor-conn.ts +71 -9
- package/src/client/actor-handle.ts +22 -5
- package/src/client/client.ts +32 -6
- package/src/client/config.ts +18 -21
- package/src/client/mod.ts +1 -0
- package/src/client/queue.ts +8 -6
- package/src/common/inline-websocket-adapter.ts +8 -2
- package/src/common/router.ts +1 -4
- package/src/common/utils.ts +2 -5
- package/src/db/config.ts +10 -5
- package/src/db/drizzle/mod.ts +51 -41
- package/src/db/mod.ts +54 -29
- package/src/db/shared.ts +42 -8
- package/src/driver-helpers/mod.ts +2 -1
- package/src/driver-helpers/sqlite-pool.ts +42 -0
- package/src/driver-helpers/utils.ts +0 -20
- package/src/driver-test-suite/mod.ts +11 -1
- package/src/driver-test-suite/tests/access-control.ts +19 -12
- package/src/driver-test-suite/tests/action-features.ts +20 -8
- package/src/driver-test-suite/tests/actor-conn.ts +94 -8
- package/src/driver-test-suite/tests/actor-db-kv-stats.ts +282 -0
- package/src/driver-test-suite/tests/actor-db-raw.ts +6 -2
- package/src/driver-test-suite/tests/actor-db.ts +101 -31
- package/src/driver-test-suite/tests/actor-inspector.ts +174 -32
- package/src/driver-test-suite/tests/actor-kv.ts +79 -33
- package/src/driver-test-suite/tests/actor-lifecycle.ts +4 -12
- package/src/driver-test-suite/tests/actor-queue.ts +125 -17
- package/src/driver-test-suite/tests/actor-run.ts +59 -55
- package/src/driver-test-suite/tests/actor-sandbox.ts +78 -0
- package/src/driver-test-suite/tests/actor-schedule.ts +1 -4
- package/src/driver-test-suite/tests/actor-sleep.ts +111 -0
- package/src/driver-test-suite/tests/actor-workflow.ts +387 -3
- package/src/driver-test-suite/tests/conn-error-serialization.ts +3 -1
- package/src/driver-test-suite/tests/raw-websocket.ts +5 -1
- package/src/drivers/default.ts +1 -3
- package/src/drivers/engine/actor-driver.ts +94 -21
- package/src/drivers/engine/config.ts +4 -12
- package/src/drivers/engine/mod.ts +1 -5
- package/src/drivers/file-system/actor.ts +43 -8
- package/src/drivers/file-system/global-state.ts +180 -64
- package/src/drivers/file-system/kv-limits.ts +1 -1
- package/src/drivers/file-system/sqlite-runtime.ts +13 -4
- package/src/engine-process/mod.ts +5 -1
- package/src/inspector/actor-inspector.ts +47 -21
- package/src/inspector/config.ts +1 -4
- package/src/inspector/mod.browser.ts +2 -2
- package/src/inspector/mod.ts +4 -1
- package/src/inspector/serve-ui.ts +0 -1
- package/src/inspector/workflow-history-json.ts +309 -0
- package/src/manager/gateway.ts +6 -2
- package/src/manager/router.ts +3 -3
- package/src/registry/config/index.ts +65 -12
- package/src/registry/config/runner.ts +19 -4
- package/src/registry/index.ts +42 -89
- package/src/sandbox/actor/db.ts +36 -0
- package/src/sandbox/actor/index.ts +476 -0
- package/src/sandbox/actor/session.ts +350 -0
- package/src/sandbox/actor.test.ts +36 -0
- package/src/sandbox/client.test.ts +484 -0
- package/src/sandbox/client.ts +707 -0
- package/src/sandbox/config.ts +151 -0
- package/src/sandbox/index.ts +41 -0
- package/src/sandbox/providers/computesdk.ts +1 -0
- package/src/sandbox/providers/daytona.ts +1 -0
- package/src/sandbox/providers/docker.ts +1 -0
- package/src/sandbox/providers/e2b.ts +1 -0
- package/src/sandbox/providers/local.ts +1 -0
- package/src/sandbox/providers/modal.ts +1 -0
- package/src/sandbox/providers/vercel.ts +1 -0
- package/src/sandbox/session-persist-driver.ts +180 -0
- package/src/sandbox/types.ts +138 -0
- package/src/serverless/configure.ts +5 -3
- package/src/serverless/router.test.ts +17 -9
- package/src/serverless/router.ts +20 -13
- package/src/test/mod.ts +3 -4
- package/src/utils/endpoint-parser.test.ts +6 -2
- package/src/utils/endpoint-parser.ts +6 -2
- package/src/utils/env-vars.ts +0 -2
- package/src/utils/node.ts +1 -1
- package/src/utils/serve.ts +10 -5
- package/src/utils.ts +6 -1
- package/src/workflow/constants.ts +1 -2
- package/src/workflow/context.ts +42 -9
- package/src/workflow/driver.ts +57 -23
- package/src/workflow/inspector.ts +7 -13
- package/src/workflow/mod.ts +91 -4
- package/dist/tsup/chunk-6LJAZ5R4.cjs +0 -96
- package/dist/tsup/chunk-6LJAZ5R4.cjs.map +0 -1
- package/dist/tsup/chunk-7HTNH26M.js.map +0 -1
- package/dist/tsup/chunk-7WF2QSIC.cjs.map +0 -1
- package/dist/tsup/chunk-D2SPAJVT.cjs +0 -645
- package/dist/tsup/chunk-D2SPAJVT.cjs.map +0 -1
- package/dist/tsup/chunk-EIATSBYZ.js.map +0 -1
- package/dist/tsup/chunk-HYPIHCDT.cjs.map +0 -1
- package/dist/tsup/chunk-IIJNPVPQ.cjs.map +0 -1
- package/dist/tsup/chunk-JPXO2H55.js.map +0 -1
- package/dist/tsup/chunk-KJSYAUOM.js.map +0 -1
- package/dist/tsup/chunk-L47L3ZWJ.cjs.map +0 -1
- package/dist/tsup/chunk-MIX2KB6U.js.map +0 -1
- package/dist/tsup/chunk-N4KRDJ56.js.map +0 -1
- package/dist/tsup/chunk-OAXJWGMU.cjs.map +0 -1
- package/dist/tsup/chunk-PB5AEMKQ.cjs.map +0 -1
- package/dist/tsup/chunk-R5OQUSLN.js +0 -645
- package/dist/tsup/chunk-R5OQUSLN.js.map +0 -1
- package/dist/tsup/chunk-SR3KQE7Q.cjs.map +0 -1
- package/dist/tsup/chunk-SRIM3GHD.js.map +0 -1
- package/dist/tsup/chunk-TADUYCHF.js.map +0 -1
- package/dist/tsup/chunk-TI5PXQGG.cjs.map +0 -1
- package/dist/tsup/chunk-U5SMSA27.cjs.map +0 -1
- package/dist/tsup/chunk-VKVNIQRQ.js.map +0 -1
- package/dist/tsup/chunk-WY2SHWXQ.js.map +0 -1
- package/dist/tsup/chunk-ZFY5J2EP.cjs.map +0 -1
- package/dist/tsup/chunk-ZPWOYQHN.js.map +0 -1
- package/src/db/sqlite-vfs.ts +0 -12
- /package/dist/tsup/{chunk-S662Y6ZU.js.map → chunk-EONWXYMN.js.map} +0 -0
- /package/dist/tsup/{chunk-2OK7S6QF.js.map → chunk-I5I6OALK.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest";
|
|
2
2
|
import type { DriverTestConfig } from "../mod";
|
|
3
|
-
import { setupDriverTest } from "../utils";
|
|
3
|
+
import { setupDriverTest, waitFor } from "../utils";
|
|
4
4
|
|
|
5
5
|
export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
|
|
6
6
|
describe("Actor Inspector HTTP API", () => {
|
|
@@ -17,31 +17,29 @@ export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
|
|
|
17
17
|
});
|
|
18
18
|
expect(response.status).toBe(200);
|
|
19
19
|
const data = await response.json();
|
|
20
|
-
expect(data).toEqual({
|
|
20
|
+
expect(data).toEqual({
|
|
21
|
+
state: { count: 5 },
|
|
22
|
+
isStateEnabled: true,
|
|
23
|
+
});
|
|
21
24
|
});
|
|
22
25
|
|
|
23
26
|
test("PATCH /inspector/state updates actor state", async (c) => {
|
|
24
27
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
25
|
-
const handle = client.counter.getOrCreate([
|
|
26
|
-
"inspector-set-state",
|
|
27
|
-
]);
|
|
28
|
+
const handle = client.counter.getOrCreate(["inspector-set-state"]);
|
|
28
29
|
|
|
29
30
|
await handle.increment(5);
|
|
30
31
|
|
|
31
32
|
const gatewayUrl = await handle.getGatewayUrl();
|
|
32
33
|
|
|
33
34
|
// Replace state
|
|
34
|
-
const patchResponse = await fetch(
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"Content-Type": "application/json",
|
|
40
|
-
Authorization: "Bearer token",
|
|
41
|
-
},
|
|
42
|
-
body: JSON.stringify({ state: { count: 42 } }),
|
|
35
|
+
const patchResponse = await fetch(`${gatewayUrl}/inspector/state`, {
|
|
36
|
+
method: "PATCH",
|
|
37
|
+
headers: {
|
|
38
|
+
"Content-Type": "application/json",
|
|
39
|
+
Authorization: "Bearer token",
|
|
43
40
|
},
|
|
44
|
-
|
|
41
|
+
body: JSON.stringify({ state: { count: 42 } }),
|
|
42
|
+
});
|
|
45
43
|
expect(patchResponse.status).toBe(200);
|
|
46
44
|
const patchData = await patchResponse.json();
|
|
47
45
|
expect(patchData).toEqual({ ok: true });
|
|
@@ -96,9 +94,7 @@ export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
|
|
|
96
94
|
|
|
97
95
|
test("POST /inspector/action/:name executes an action", async (c) => {
|
|
98
96
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
99
|
-
const handle = client.counter.getOrCreate([
|
|
100
|
-
"inspector-action",
|
|
101
|
-
]);
|
|
97
|
+
const handle = client.counter.getOrCreate(["inspector-action"]);
|
|
102
98
|
|
|
103
99
|
await handle.increment(10);
|
|
104
100
|
|
|
@@ -156,9 +152,7 @@ export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
|
|
|
156
152
|
|
|
157
153
|
test("GET /inspector/traces returns trace data", async (c) => {
|
|
158
154
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
159
|
-
const handle = client.counter.getOrCreate([
|
|
160
|
-
"inspector-traces",
|
|
161
|
-
]);
|
|
155
|
+
const handle = client.counter.getOrCreate(["inspector-traces"]);
|
|
162
156
|
|
|
163
157
|
// Perform an action to generate traces
|
|
164
158
|
await handle.increment(1);
|
|
@@ -182,9 +176,7 @@ export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
|
|
|
182
176
|
|
|
183
177
|
test("GET /inspector/workflow-history returns workflow status", async (c) => {
|
|
184
178
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
185
|
-
const handle = client.counter.getOrCreate([
|
|
186
|
-
"inspector-workflow",
|
|
187
|
-
]);
|
|
179
|
+
const handle = client.counter.getOrCreate(["inspector-workflow"]);
|
|
188
180
|
|
|
189
181
|
// Ensure actor exists
|
|
190
182
|
await handle.increment(0);
|
|
@@ -208,22 +200,135 @@ export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
|
|
|
208
200
|
expect(data.history).toBeNull();
|
|
209
201
|
});
|
|
210
202
|
|
|
211
|
-
test("GET /inspector/
|
|
203
|
+
test("GET /inspector/database/schema returns SQLite schema", async (c) => {
|
|
212
204
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
213
|
-
const handle = client.
|
|
214
|
-
|
|
205
|
+
const handle = client.dbActorRaw.getOrCreate([
|
|
206
|
+
`inspector-database-schema-${crypto.randomUUID()}`,
|
|
215
207
|
]);
|
|
216
208
|
|
|
217
|
-
await handle.
|
|
209
|
+
await handle.insertValue("Alice");
|
|
210
|
+
await handle.insertValue("Bob");
|
|
211
|
+
|
|
212
|
+
const gatewayUrl = await handle.getGatewayUrl();
|
|
213
|
+
const response = await fetch(
|
|
214
|
+
`${gatewayUrl}/inspector/database/schema`,
|
|
215
|
+
{
|
|
216
|
+
headers: { Authorization: "Bearer token" },
|
|
217
|
+
},
|
|
218
|
+
);
|
|
219
|
+
expect(response.status).toBe(200);
|
|
220
|
+
const data = (await response.json()) as {
|
|
221
|
+
schema: {
|
|
222
|
+
tables: Array<{
|
|
223
|
+
table: { schema: string; name: string; type: string };
|
|
224
|
+
columns: Array<{ name: string }>;
|
|
225
|
+
records: number;
|
|
226
|
+
}>;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
expect(Array.isArray(data.schema.tables)).toBe(true);
|
|
231
|
+
const testDataTable = data.schema.tables.find(
|
|
232
|
+
(table) => table.table.name === "test_data",
|
|
233
|
+
);
|
|
234
|
+
expect(testDataTable).toBeDefined();
|
|
235
|
+
expect(testDataTable?.table.schema).toBe("main");
|
|
236
|
+
expect(testDataTable?.table.type).toBe("table");
|
|
237
|
+
expect(testDataTable?.records).toBe(2);
|
|
238
|
+
expect(testDataTable?.columns.map((column) => column.name)).toEqual(
|
|
239
|
+
["id", "value", "payload", "created_at"],
|
|
240
|
+
);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("GET /inspector/workflow-history returns populated history for active workflows", async (c) => {
|
|
244
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
245
|
+
const handle = client.workflowCounterActor.getOrCreate([
|
|
246
|
+
"inspector-workflow-active",
|
|
247
|
+
]);
|
|
248
|
+
|
|
249
|
+
let state = await handle.getState();
|
|
250
|
+
for (
|
|
251
|
+
let i = 0;
|
|
252
|
+
i < 40 &&
|
|
253
|
+
(state.runCount === 0 || state.history.length === 0);
|
|
254
|
+
i++
|
|
255
|
+
) {
|
|
256
|
+
await waitFor(driverTestConfig, 50);
|
|
257
|
+
state = await handle.getState();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
expect(state.runCount).toBeGreaterThan(0);
|
|
261
|
+
expect(state.history.length).toBeGreaterThan(0);
|
|
262
|
+
|
|
263
|
+
const gatewayUrl = await handle.getGatewayUrl();
|
|
264
|
+
const response = await fetch(
|
|
265
|
+
`${gatewayUrl}/inspector/workflow-history`,
|
|
266
|
+
{
|
|
267
|
+
headers: { Authorization: "Bearer token" },
|
|
268
|
+
},
|
|
269
|
+
);
|
|
270
|
+
expect(response.status).toBe(200);
|
|
271
|
+
const data = (await response.json()) as {
|
|
272
|
+
history: {
|
|
273
|
+
nameRegistry: string[];
|
|
274
|
+
entries: unknown[];
|
|
275
|
+
entryMetadata: Record<string, unknown>;
|
|
276
|
+
} | null;
|
|
277
|
+
isWorkflowEnabled: boolean;
|
|
278
|
+
};
|
|
279
|
+
expect(data.isWorkflowEnabled).toBe(true);
|
|
280
|
+
expect(data.history).not.toBeNull();
|
|
281
|
+
expect(data.history?.nameRegistry.length).toBeGreaterThan(0);
|
|
282
|
+
expect(data.history?.entries.length).toBeGreaterThan(0);
|
|
283
|
+
expect(
|
|
284
|
+
Object.keys(data.history?.entryMetadata ?? {}).length,
|
|
285
|
+
).toBeGreaterThan(0);
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
test("GET /inspector/database/rows returns SQLite rows", async (c) => {
|
|
289
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
290
|
+
const handle = client.dbActorRaw.getOrCreate([
|
|
291
|
+
`inspector-database-rows-${crypto.randomUUID()}`,
|
|
292
|
+
]);
|
|
293
|
+
|
|
294
|
+
await handle.insertValue("Alice");
|
|
295
|
+
await handle.insertValue("Bob");
|
|
218
296
|
|
|
219
297
|
const gatewayUrl = await handle.getGatewayUrl();
|
|
220
298
|
const response = await fetch(
|
|
221
|
-
`${gatewayUrl}/inspector/
|
|
299
|
+
`${gatewayUrl}/inspector/database/rows?table=test_data&limit=1&offset=1`,
|
|
222
300
|
{
|
|
223
301
|
headers: { Authorization: "Bearer token" },
|
|
224
302
|
},
|
|
225
303
|
);
|
|
226
304
|
expect(response.status).toBe(200);
|
|
305
|
+
const data = (await response.json()) as {
|
|
306
|
+
rows: Array<{
|
|
307
|
+
id: number;
|
|
308
|
+
value: string;
|
|
309
|
+
payload: string;
|
|
310
|
+
created_at: number;
|
|
311
|
+
}>;
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
expect(data.rows).toHaveLength(1);
|
|
315
|
+
expect(data.rows[0]?.id).toBe(2);
|
|
316
|
+
expect(data.rows[0]?.value).toBe("Bob");
|
|
317
|
+
expect(data.rows[0]?.payload).toBe("");
|
|
318
|
+
expect(typeof data.rows[0]?.created_at).toBe("number");
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
test("GET /inspector/summary returns full actor snapshot", async (c) => {
|
|
322
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
323
|
+
const handle = client.counter.getOrCreate(["inspector-summary"]);
|
|
324
|
+
|
|
325
|
+
await handle.increment(7);
|
|
326
|
+
|
|
327
|
+
const gatewayUrl = await handle.getGatewayUrl();
|
|
328
|
+
const response = await fetch(`${gatewayUrl}/inspector/summary`, {
|
|
329
|
+
headers: { Authorization: "Bearer token" },
|
|
330
|
+
});
|
|
331
|
+
expect(response.status).toBe(200);
|
|
227
332
|
const data = (await response.json()) as {
|
|
228
333
|
state: { count: number };
|
|
229
334
|
connections: unknown[];
|
|
@@ -244,12 +349,49 @@ export function runActorInspectorTests(driverTestConfig: DriverTestConfig) {
|
|
|
244
349
|
expect(data.workflowHistory).toBeNull();
|
|
245
350
|
});
|
|
246
351
|
|
|
247
|
-
test("inspector
|
|
352
|
+
test("GET /inspector/summary returns populated workflow history for active workflows", async (c) => {
|
|
248
353
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
249
|
-
const handle = client.
|
|
250
|
-
"inspector-
|
|
354
|
+
const handle = client.workflowCounterActor.getOrCreate([
|
|
355
|
+
"inspector-summary-workflow",
|
|
251
356
|
]);
|
|
252
357
|
|
|
358
|
+
let state = await handle.getState();
|
|
359
|
+
for (
|
|
360
|
+
let i = 0;
|
|
361
|
+
i < 40 &&
|
|
362
|
+
(state.runCount === 0 || state.history.length === 0);
|
|
363
|
+
i++
|
|
364
|
+
) {
|
|
365
|
+
await waitFor(driverTestConfig, 50);
|
|
366
|
+
state = await handle.getState();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
const gatewayUrl = await handle.getGatewayUrl();
|
|
370
|
+
const response = await fetch(`${gatewayUrl}/inspector/summary`, {
|
|
371
|
+
headers: { Authorization: "Bearer token" },
|
|
372
|
+
});
|
|
373
|
+
expect(response.status).toBe(200);
|
|
374
|
+
const data = (await response.json()) as {
|
|
375
|
+
isWorkflowEnabled: boolean;
|
|
376
|
+
workflowHistory: {
|
|
377
|
+
nameRegistry: string[];
|
|
378
|
+
entries: unknown[];
|
|
379
|
+
entryMetadata: Record<string, unknown>;
|
|
380
|
+
} | null;
|
|
381
|
+
};
|
|
382
|
+
expect(data.isWorkflowEnabled).toBe(true);
|
|
383
|
+
expect(data.workflowHistory).not.toBeNull();
|
|
384
|
+
expect(data.workflowHistory?.nameRegistry.length).toBeGreaterThan(0);
|
|
385
|
+
expect(data.workflowHistory?.entries.length).toBeGreaterThan(0);
|
|
386
|
+
expect(
|
|
387
|
+
Object.keys(data.workflowHistory?.entryMetadata ?? {}).length,
|
|
388
|
+
).toBeGreaterThan(0);
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
test("inspector endpoints require auth in non-dev mode", async (c) => {
|
|
392
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
393
|
+
const handle = client.counter.getOrCreate(["inspector-auth"]);
|
|
394
|
+
|
|
253
395
|
await handle.increment(0);
|
|
254
396
|
|
|
255
397
|
const gatewayUrl = await handle.getGatewayUrl();
|
|
@@ -6,22 +6,37 @@ export function runActorKvTests(driverTestConfig: DriverTestConfig) {
|
|
|
6
6
|
type KvTextHandle = {
|
|
7
7
|
putText: (key: string, value: string) => Promise<unknown>;
|
|
8
8
|
getText: (key: string) => Promise<string | null>;
|
|
9
|
-
listText: (
|
|
9
|
+
listText: (
|
|
10
|
+
prefix: string,
|
|
11
|
+
) => Promise<Array<{ key: string; value: string }>>;
|
|
12
|
+
listTextRange: (
|
|
13
|
+
start: string,
|
|
14
|
+
end: string,
|
|
15
|
+
options?: {
|
|
16
|
+
reverse?: boolean;
|
|
17
|
+
limit?: number;
|
|
18
|
+
},
|
|
19
|
+
) => Promise<Array<{ key: string; value: string }>>;
|
|
20
|
+
deleteTextRange: (start: string, end: string) => Promise<unknown>;
|
|
10
21
|
};
|
|
11
22
|
|
|
12
23
|
type KvArrayBufferHandle = {
|
|
13
|
-
roundtripArrayBuffer: (
|
|
24
|
+
roundtripArrayBuffer: (
|
|
25
|
+
key: string,
|
|
26
|
+
bytes: number[],
|
|
27
|
+
) => Promise<number[]>;
|
|
14
28
|
};
|
|
15
29
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
describe("Actor KV Tests", () => {
|
|
31
|
+
test("supports text encoding and decoding", async (c: TestContext) => {
|
|
32
|
+
const { client: rawClient } = await setupDriverTest(
|
|
33
|
+
c,
|
|
34
|
+
driverTestConfig,
|
|
35
|
+
);
|
|
36
|
+
const client = rawClient as any;
|
|
37
|
+
const kvHandle = client.kvActor.getOrCreate([
|
|
38
|
+
"kv-text",
|
|
39
|
+
]) as unknown as KvTextHandle;
|
|
25
40
|
|
|
26
41
|
await kvHandle.putText("greeting", "hello");
|
|
27
42
|
const value = await kvHandle.getText("greeting");
|
|
@@ -38,28 +53,59 @@ export function runActorKvTests(driverTestConfig: DriverTestConfig) {
|
|
|
38
53
|
]);
|
|
39
54
|
});
|
|
40
55
|
|
|
41
|
-
test(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"kv-array-buffer",
|
|
51
|
-
]) as unknown as KvArrayBufferHandle;
|
|
56
|
+
test("supports range scans and range deletes", async (c: TestContext) => {
|
|
57
|
+
const { client: rawClient } = await setupDriverTest(
|
|
58
|
+
c,
|
|
59
|
+
driverTestConfig,
|
|
60
|
+
);
|
|
61
|
+
const client = rawClient as any;
|
|
62
|
+
const kvHandle = client.kvActor.getOrCreate([
|
|
63
|
+
"kv-range",
|
|
64
|
+
]) as unknown as KvTextHandle;
|
|
52
65
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
await kvHandle.putText("a", "alpha");
|
|
67
|
+
await kvHandle.putText("b", "bravo");
|
|
68
|
+
await kvHandle.putText("c", "charlie");
|
|
69
|
+
await kvHandle.putText("d", "delta");
|
|
70
|
+
|
|
71
|
+
const range = await kvHandle.listTextRange("b", "d");
|
|
72
|
+
expect(range).toEqual([
|
|
73
|
+
{ key: "b", value: "bravo" },
|
|
74
|
+
{ key: "c", value: "charlie" },
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
const reversed = await kvHandle.listTextRange("a", "d", {
|
|
78
|
+
reverse: true,
|
|
79
|
+
limit: 2,
|
|
80
|
+
});
|
|
81
|
+
expect(reversed).toEqual([
|
|
82
|
+
{ key: "c", value: "charlie" },
|
|
83
|
+
{ key: "b", value: "bravo" },
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
await kvHandle.deleteTextRange("b", "d");
|
|
87
|
+
const remaining = await kvHandle.listText("");
|
|
88
|
+
expect(remaining).toEqual([
|
|
89
|
+
{ key: "a", value: "alpha" },
|
|
90
|
+
{ key: "d", value: "delta" },
|
|
91
|
+
]);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("supports arrayBuffer encoding and decoding", async (c: TestContext) => {
|
|
95
|
+
const { client: rawClient } = await setupDriverTest(
|
|
96
|
+
c,
|
|
97
|
+
driverTestConfig,
|
|
98
|
+
);
|
|
99
|
+
const client = rawClient as any;
|
|
100
|
+
const kvHandle = client.kvActor.getOrCreate([
|
|
101
|
+
"kv-array-buffer",
|
|
102
|
+
]) as unknown as KvArrayBufferHandle;
|
|
103
|
+
|
|
104
|
+
const values = await kvHandle.roundtripArrayBuffer(
|
|
105
|
+
"bytes",
|
|
106
|
+
[4, 8, 15, 16, 23, 42],
|
|
63
107
|
);
|
|
108
|
+
expect(values).toEqual([4, 8, 15, 16, 23, 42]);
|
|
64
109
|
});
|
|
65
|
-
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
@@ -45,9 +45,7 @@ export function runActorLifecycleTests(driverTestConfig: DriverTestConfig) {
|
|
|
45
45
|
|
|
46
46
|
// Create multiple actors rapidly to increase chance of race
|
|
47
47
|
const actors = Array.from({ length: 5 }, (_, i) =>
|
|
48
|
-
client.startStopRaceActor.getOrCreate([
|
|
49
|
-
`${actorKey}-${i}`,
|
|
50
|
-
]),
|
|
48
|
+
client.startStopRaceActor.getOrCreate([`${actorKey}-${i}`]),
|
|
51
49
|
);
|
|
52
50
|
|
|
53
51
|
// Resolve all actor IDs (this triggers start)
|
|
@@ -66,9 +64,7 @@ export function runActorLifecycleTests(driverTestConfig: DriverTestConfig) {
|
|
|
66
64
|
expect(err.group).toBe("actor");
|
|
67
65
|
expect(err.code).toBe("not_found");
|
|
68
66
|
}
|
|
69
|
-
expect(destroyed, `actor ${id} should be destroyed`).toBe(
|
|
70
|
-
true,
|
|
71
|
-
);
|
|
67
|
+
expect(destroyed, `actor ${id} should be destroyed`).toBe(true);
|
|
72
68
|
}
|
|
73
69
|
});
|
|
74
70
|
|
|
@@ -98,9 +94,7 @@ export function runActorLifecycleTests(driverTestConfig: DriverTestConfig) {
|
|
|
98
94
|
// Perform multiple rapid create/destroy cycles
|
|
99
95
|
for (let i = 0; i < 10; i++) {
|
|
100
96
|
const actorKey = `test-rapid-cycle-${Date.now()}-${i}`;
|
|
101
|
-
const actor = client.startStopRaceActor.getOrCreate([
|
|
102
|
-
actorKey,
|
|
103
|
-
]);
|
|
97
|
+
const actor = client.startStopRaceActor.getOrCreate([actorKey]);
|
|
104
98
|
|
|
105
99
|
// Trigger start
|
|
106
100
|
const resolvePromise = actor.resolve();
|
|
@@ -127,9 +121,7 @@ export function runActorLifecycleTests(driverTestConfig: DriverTestConfig) {
|
|
|
127
121
|
await actor.destroy();
|
|
128
122
|
|
|
129
123
|
// Try to recreate with same key - should work without issues
|
|
130
|
-
const newActor = client.startStopRaceActor.getOrCreate([
|
|
131
|
-
actorKey,
|
|
132
|
-
]);
|
|
124
|
+
const newActor = client.startStopRaceActor.getOrCreate([actorKey]);
|
|
133
125
|
const result = await newActor.ping();
|
|
134
126
|
expect(result).toBe("pong");
|
|
135
127
|
|
|
@@ -1,10 +1,67 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
import { describe, expect, test } from "vitest";
|
|
2
3
|
import type { ActorError } from "@/client/mod";
|
|
4
|
+
import { MANY_QUEUE_NAMES } from "../../../fixtures/driver-test-suite/queue";
|
|
3
5
|
import type { DriverTestConfig } from "../mod";
|
|
4
6
|
import { setupDriverTest, waitFor } from "../utils";
|
|
5
7
|
|
|
6
8
|
export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
|
|
7
9
|
describe("Actor Queue Tests", () => {
|
|
10
|
+
async function expectManyQueueChildToDrain(
|
|
11
|
+
handle: Awaited<ReturnType<typeof setupDriverTest>>["client"]["manyQueueChildActor"],
|
|
12
|
+
key: string,
|
|
13
|
+
) {
|
|
14
|
+
const child = handle.getOrCreate([key]);
|
|
15
|
+
const conn = child.connect();
|
|
16
|
+
const messageCount = MANY_QUEUE_NAMES.length * 4;
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
expect(await conn.ping()).toEqual(
|
|
20
|
+
expect.objectContaining({
|
|
21
|
+
pong: true,
|
|
22
|
+
}),
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
await Promise.all(
|
|
26
|
+
Array.from({ length: messageCount }, (_, index) =>
|
|
27
|
+
child.send(
|
|
28
|
+
MANY_QUEUE_NAMES[index % MANY_QUEUE_NAMES.length],
|
|
29
|
+
{ index },
|
|
30
|
+
),
|
|
31
|
+
),
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
let snapshot = await child.getSnapshot();
|
|
35
|
+
for (
|
|
36
|
+
let i = 0;
|
|
37
|
+
i < 60 && snapshot.processed.length < messageCount;
|
|
38
|
+
i++
|
|
39
|
+
) {
|
|
40
|
+
await waitFor(driverTestConfig, 100);
|
|
41
|
+
snapshot = await child.getSnapshot();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
expect(snapshot.started).toBe(true);
|
|
45
|
+
expect(snapshot.processed).toHaveLength(messageCount);
|
|
46
|
+
expect(new Set(snapshot.processed)).toEqual(
|
|
47
|
+
new Set(MANY_QUEUE_NAMES),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
expect(
|
|
51
|
+
await child.send(
|
|
52
|
+
MANY_QUEUE_NAMES[0],
|
|
53
|
+
{ index: messageCount },
|
|
54
|
+
{ wait: true, timeout: 1_000 },
|
|
55
|
+
),
|
|
56
|
+
).toEqual({
|
|
57
|
+
status: "completed",
|
|
58
|
+
response: { ok: true, index: messageCount },
|
|
59
|
+
});
|
|
60
|
+
} finally {
|
|
61
|
+
await conn.dispose().catch(() => undefined);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
8
65
|
test("client can send to actor queue", async (c) => {
|
|
9
66
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
10
67
|
const handle = client.queueActor.getOrCreate(["client-send"]);
|
|
@@ -182,16 +239,17 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
|
|
|
182
239
|
}
|
|
183
240
|
});
|
|
184
241
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
242
|
+
test("wait send returns completion response", async (c) => {
|
|
243
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
244
|
+
const handle = client.queueActor.getOrCreate(["wait-complete"]);
|
|
245
|
+
const waitTimeout = driverTestConfig.useRealTimers ? 5_000 : 1_000;
|
|
189
246
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
247
|
+
const actionPromise = handle.receiveAndComplete("tasks");
|
|
248
|
+
const result = await handle.send(
|
|
249
|
+
"tasks",
|
|
250
|
+
{ value: 123 },
|
|
251
|
+
{ wait: true, timeout: waitTimeout },
|
|
252
|
+
);
|
|
195
253
|
|
|
196
254
|
await actionPromise;
|
|
197
255
|
expect(result).toEqual({
|
|
@@ -204,7 +262,8 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
|
|
|
204
262
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
205
263
|
const handle = client.queueActor.getOrCreate(["wait-timeout"]);
|
|
206
264
|
|
|
207
|
-
const resultPromise = handle.send(
|
|
265
|
+
const resultPromise = handle.send(
|
|
266
|
+
"timeout",
|
|
208
267
|
{ value: 456 },
|
|
209
268
|
{ wait: true, timeout: 50 },
|
|
210
269
|
);
|
|
@@ -215,6 +274,56 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
|
|
|
215
274
|
expect(result.status).toBe("timedOut");
|
|
216
275
|
});
|
|
217
276
|
|
|
277
|
+
test(
|
|
278
|
+
"drains many-queue child actors created from actions while connected",
|
|
279
|
+
async (c) => {
|
|
280
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
281
|
+
const parent = client.manyQueueActionParentActor.getOrCreate([
|
|
282
|
+
"many-action-parent",
|
|
283
|
+
]);
|
|
284
|
+
|
|
285
|
+
expect(await parent.spawnChild("many-action-child")).toEqual({
|
|
286
|
+
key: "many-action-child",
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
await expectManyQueueChildToDrain(
|
|
290
|
+
client.manyQueueChildActor,
|
|
291
|
+
"many-action-child",
|
|
292
|
+
);
|
|
293
|
+
},
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
test(
|
|
297
|
+
"drains many-queue child actors created from run handlers while connected",
|
|
298
|
+
async (c) => {
|
|
299
|
+
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
300
|
+
const parent = client.manyQueueRunParentActor.getOrCreate([
|
|
301
|
+
"many-run-parent",
|
|
302
|
+
]);
|
|
303
|
+
|
|
304
|
+
expect(await parent.queueSpawn("many-run-child")).toEqual({
|
|
305
|
+
queued: true,
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
let spawned = await parent.getSpawned();
|
|
309
|
+
for (
|
|
310
|
+
let i = 0;
|
|
311
|
+
i < 30 && !spawned.includes("many-run-child");
|
|
312
|
+
i++
|
|
313
|
+
) {
|
|
314
|
+
await waitFor(driverTestConfig, 100);
|
|
315
|
+
spawned = await parent.getSpawned();
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
expect(spawned).toContain("many-run-child");
|
|
319
|
+
|
|
320
|
+
await expectManyQueueChildToDrain(
|
|
321
|
+
client.manyQueueChildActor,
|
|
322
|
+
"many-run-child",
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
);
|
|
326
|
+
|
|
218
327
|
test("manual receive retries message when not completed", async (c) => {
|
|
219
328
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
220
329
|
const handle = client.queueActor.getOrCreate([
|
|
@@ -225,7 +334,9 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
|
|
|
225
334
|
const first = await handle.receiveWithoutComplete("tasks");
|
|
226
335
|
expect(first).toEqual({ name: "tasks", body: { value: 789 } });
|
|
227
336
|
|
|
228
|
-
const retried = await handle.receiveOne("tasks", {
|
|
337
|
+
const retried = await handle.receiveOne("tasks", {
|
|
338
|
+
timeout: 1_000,
|
|
339
|
+
});
|
|
229
340
|
expect(retried).toEqual({ name: "tasks", body: { value: 789 } });
|
|
230
341
|
});
|
|
231
342
|
|
|
@@ -236,9 +347,8 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
|
|
|
236
347
|
]);
|
|
237
348
|
|
|
238
349
|
await handle.send("tasks", { value: 111 });
|
|
239
|
-
const result =
|
|
240
|
-
"tasks"
|
|
241
|
-
);
|
|
350
|
+
const result =
|
|
351
|
+
await handle.receiveManualThenNextWithoutComplete("tasks");
|
|
242
352
|
expect(result).toEqual({
|
|
243
353
|
group: "queue",
|
|
244
354
|
code: "previous_message_not_completed",
|
|
@@ -275,9 +385,7 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
|
|
|
275
385
|
|
|
276
386
|
test("complete throws when called twice", async (c) => {
|
|
277
387
|
const { client } = await setupDriverTest(c, driverTestConfig);
|
|
278
|
-
const handle = client.queueActor.getOrCreate([
|
|
279
|
-
"complete-twice",
|
|
280
|
-
]);
|
|
388
|
+
const handle = client.queueActor.getOrCreate(["complete-twice"]);
|
|
281
389
|
|
|
282
390
|
await handle.send("twice", { value: "test" });
|
|
283
391
|
const result = await handle.receiveAndCompleteTwice("twice");
|