rivetkit 2.1.4 → 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.
Files changed (333) hide show
  1. package/dist/browser/client.d.ts +593 -588
  2. package/dist/browser/client.js +215 -35
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +109 -10
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/inspector.tar.gz +0 -0
  7. package/dist/tsup/actor/errors.cjs +2 -2
  8. package/dist/tsup/actor/errors.js +1 -1
  9. package/dist/tsup/{actor-router-consts-D29T1Z-K.d.cts → actor-router-consts-DU-1IdQj.d.cts} +1 -1
  10. package/dist/tsup/{actor-router-consts-D29T1Z-K.d.ts → actor-router-consts-DU-1IdQj.d.ts} +1 -1
  11. package/dist/tsup/chunk-2ELYUO6C.cjs +112 -0
  12. package/dist/tsup/chunk-2ELYUO6C.cjs.map +1 -0
  13. package/dist/tsup/chunk-2LY7RW3Y.cjs +2316 -0
  14. package/dist/tsup/chunk-2LY7RW3Y.cjs.map +1 -0
  15. package/dist/tsup/{chunk-L47L3ZWJ.cjs → chunk-6G7ZNM27.cjs} +11 -6
  16. package/dist/tsup/chunk-6G7ZNM27.cjs.map +1 -0
  17. package/dist/tsup/{chunk-LK36OGGO.cjs → chunk-A4KEUCB6.cjs} +84 -34
  18. package/dist/tsup/chunk-A4KEUCB6.cjs.map +1 -0
  19. package/dist/tsup/{chunk-7HTNH26M.js → chunk-AKUJ5OTO.js} +11 -6
  20. package/dist/tsup/chunk-AKUJ5OTO.js.map +1 -0
  21. package/dist/tsup/{chunk-ANKZ2FS6.js → chunk-C22JYHVT.js} +77 -27
  22. package/dist/tsup/chunk-C22JYHVT.js.map +1 -0
  23. package/dist/tsup/chunk-C4EB42ET.js +1459 -0
  24. package/dist/tsup/chunk-C4EB42ET.js.map +1 -0
  25. package/dist/tsup/chunk-CGGGBIDP.cjs +1459 -0
  26. package/dist/tsup/chunk-CGGGBIDP.cjs.map +1 -0
  27. package/dist/tsup/chunk-CMQPDBBR.cjs +1486 -0
  28. package/dist/tsup/chunk-CMQPDBBR.cjs.map +1 -0
  29. package/dist/tsup/{chunk-AQD4CBZ2.cjs → chunk-DH6UINWA.cjs} +4 -4
  30. package/dist/tsup/{chunk-AQD4CBZ2.cjs.map → chunk-DH6UINWA.cjs.map} +1 -1
  31. package/dist/tsup/chunk-DK46YYCJ.js +1486 -0
  32. package/dist/tsup/chunk-DK46YYCJ.js.map +1 -0
  33. package/dist/tsup/chunk-EGWXXBZV.js +2316 -0
  34. package/dist/tsup/chunk-EGWXXBZV.js.map +1 -0
  35. package/dist/tsup/{chunk-HBYEYBIC.js → chunk-EONWXYMN.js} +2 -2
  36. package/dist/tsup/{chunk-N4KRDJ56.js → chunk-GFGRBYO2.js} +35 -6
  37. package/dist/tsup/chunk-GFGRBYO2.js.map +1 -0
  38. package/dist/tsup/{chunk-TEUL4UYN.cjs → chunk-GUHXWPGB.cjs} +1515 -1479
  39. package/dist/tsup/chunk-GUHXWPGB.cjs.map +1 -0
  40. package/dist/tsup/{chunk-3B6PCYJB.cjs → chunk-HNE2AK6C.cjs} +2375 -3713
  41. package/dist/tsup/chunk-HNE2AK6C.cjs.map +1 -0
  42. package/dist/tsup/{chunk-5UEFNG7P.js → chunk-I5I6OALK.js} +2 -2
  43. package/dist/tsup/chunk-IHQAF2HV.cjs +23 -0
  44. package/dist/tsup/chunk-IHQAF2HV.cjs.map +1 -0
  45. package/dist/tsup/{chunk-UWAGLDT6.cjs → chunk-JJNZQDUN.cjs} +667 -2517
  46. package/dist/tsup/chunk-JJNZQDUN.cjs.map +1 -0
  47. package/dist/tsup/{chunk-M6H4XIF4.js → chunk-JJSPHLJN.js} +219 -287
  48. package/dist/tsup/chunk-JJSPHLJN.js.map +1 -0
  49. package/dist/tsup/chunk-JRKPV5NJ.js +481 -0
  50. package/dist/tsup/chunk-JRKPV5NJ.js.map +1 -0
  51. package/dist/tsup/{chunk-VKVNIQRQ.js → chunk-K7MVU5SI.js} +36 -41
  52. package/dist/tsup/chunk-K7MVU5SI.js.map +1 -0
  53. package/dist/tsup/{chunk-KJSYAUOM.js → chunk-MLK3GY6P.js} +43 -27
  54. package/dist/tsup/chunk-MLK3GY6P.js.map +1 -0
  55. package/dist/tsup/{chunk-4KSHPFXF.cjs → chunk-MPLMTJY5.cjs} +123 -23
  56. package/dist/tsup/chunk-MPLMTJY5.cjs.map +1 -0
  57. package/dist/tsup/{chunk-UDMRZR6A.js → chunk-PQWI44WD.js} +1755 -3093
  58. package/dist/tsup/chunk-PQWI44WD.js.map +1 -0
  59. package/dist/tsup/{chunk-SR3KQE7Q.cjs → chunk-SQFCIDCG.cjs} +35 -6
  60. package/dist/tsup/chunk-SQFCIDCG.cjs.map +1 -0
  61. package/dist/tsup/{chunk-3GTO6H3E.js → chunk-SVHJSM2E.js} +110 -24
  62. package/dist/tsup/chunk-SVHJSM2E.js.map +1 -0
  63. package/dist/tsup/chunk-T5KYKM6R.js +49 -0
  64. package/dist/tsup/chunk-T5KYKM6R.js.map +1 -0
  65. package/dist/tsup/{chunk-GXRVSSVD.cjs → chunk-TJ7DKW6F.cjs} +123 -37
  66. package/dist/tsup/chunk-TJ7DKW6F.cjs.map +1 -0
  67. package/dist/tsup/chunk-UQZRMTM3.js +23 -0
  68. package/dist/tsup/chunk-UQZRMTM3.js.map +1 -0
  69. package/dist/tsup/{chunk-QPADHLDU.cjs → chunk-V3JSZR5P.cjs} +3 -3
  70. package/dist/tsup/{chunk-QPADHLDU.cjs.map → chunk-V3JSZR5P.cjs.map} +1 -1
  71. package/dist/tsup/{chunk-HKOSZKKZ.cjs → chunk-VBR35EQF.cjs} +271 -339
  72. package/dist/tsup/chunk-VBR35EQF.cjs.map +1 -0
  73. package/dist/tsup/{chunk-DZXDUGLL.js → chunk-VWYO36X4.js} +117 -17
  74. package/dist/tsup/chunk-VWYO36X4.js.map +1 -0
  75. package/dist/tsup/{chunk-I6PL6QIY.js → chunk-WW27B6DM.js} +1452 -1416
  76. package/dist/tsup/chunk-WW27B6DM.js.map +1 -0
  77. package/dist/tsup/chunk-YAE3MEJM.cjs +49 -0
  78. package/dist/tsup/chunk-YAE3MEJM.cjs.map +1 -0
  79. package/dist/tsup/{chunk-KTWY3K6Z.js → chunk-YGYGANCA.js} +473 -2323
  80. package/dist/tsup/chunk-YGYGANCA.js.map +1 -0
  81. package/dist/tsup/chunk-YZJWZBY5.cjs +481 -0
  82. package/dist/tsup/chunk-YZJWZBY5.cjs.map +1 -0
  83. package/dist/tsup/{chunk-ZFY5J2EP.cjs → chunk-ZZLJ5TSM.cjs} +39 -44
  84. package/dist/tsup/chunk-ZZLJ5TSM.cjs.map +1 -0
  85. package/dist/tsup/client/mod.cjs +10 -7
  86. package/dist/tsup/client/mod.cjs.map +1 -1
  87. package/dist/tsup/client/mod.d.cts +6 -6
  88. package/dist/tsup/client/mod.d.ts +6 -6
  89. package/dist/tsup/client/mod.js +11 -8
  90. package/dist/tsup/common/log.cjs +3 -3
  91. package/dist/tsup/common/log.js +2 -2
  92. package/dist/tsup/common/websocket.cjs +4 -4
  93. package/dist/tsup/common/websocket.js +3 -3
  94. package/dist/tsup/{config-Qj-zLJPc.d.ts → config-C2Wwnc69.d.ts} +142 -208
  95. package/dist/tsup/{config-BiNoIHRs.d.ts → config-DROwzBLT.d.cts} +82 -6
  96. package/dist/tsup/{config-BiNoIHRs.d.cts → config-DROwzBLT.d.ts} +82 -6
  97. package/dist/tsup/{config-iPj5l1bL.d.cts → config-ehT-_3BB.d.cts} +142 -208
  98. package/dist/tsup/{context-DzvH1PBK.d.cts → context-DGMJuAyc.d.ts} +16 -3
  99. package/dist/tsup/{context-CQCMuHND.d.ts → context-Dpp2RJbW.d.cts} +16 -3
  100. package/dist/tsup/db/drizzle/mod.cjs +3 -3
  101. package/dist/tsup/db/drizzle/mod.d.cts +1 -1
  102. package/dist/tsup/db/drizzle/mod.d.ts +1 -1
  103. package/dist/tsup/db/drizzle/mod.js +2 -2
  104. package/dist/tsup/db/mod.cjs +3 -3
  105. package/dist/tsup/db/mod.d.cts +1 -1
  106. package/dist/tsup/db/mod.d.ts +1 -1
  107. package/dist/tsup/db/mod.js +2 -2
  108. package/dist/tsup/{driver-Jo8v-kbU.d.ts → driver-CYZP9QYo.d.ts} +1 -1
  109. package/dist/tsup/{driver-iV8J-WMv.d.cts → driver-CoTFpipv.d.cts} +1 -1
  110. package/dist/tsup/driver-helpers/mod.cjs +7 -5
  111. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  112. package/dist/tsup/driver-helpers/mod.d.cts +17 -18
  113. package/dist/tsup/driver-helpers/mod.d.ts +17 -18
  114. package/dist/tsup/driver-helpers/mod.js +11 -9
  115. package/dist/tsup/driver-test-suite/mod.cjs +1275 -228
  116. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  117. package/dist/tsup/driver-test-suite/mod.d.cts +6 -5
  118. package/dist/tsup/driver-test-suite/mod.d.ts +6 -5
  119. package/dist/tsup/driver-test-suite/mod.js +1581 -534
  120. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  121. package/dist/tsup/inspector/mod.cjs +4 -4
  122. package/dist/tsup/inspector/mod.js +3 -3
  123. package/dist/tsup/mod.cjs +15 -9
  124. package/dist/tsup/mod.cjs.map +1 -1
  125. package/dist/tsup/mod.d.cts +9 -9
  126. package/dist/tsup/mod.d.ts +9 -9
  127. package/dist/tsup/mod.js +19 -13
  128. package/dist/tsup/sandbox/client.cjs +28 -0
  129. package/dist/tsup/sandbox/client.cjs.map +1 -0
  130. package/dist/tsup/sandbox/client.d.cts +88 -0
  131. package/dist/tsup/sandbox/client.d.ts +88 -0
  132. package/dist/tsup/sandbox/client.js +28 -0
  133. package/dist/tsup/sandbox/client.js.map +1 -0
  134. package/dist/tsup/sandbox/index.cjs +761 -0
  135. package/dist/tsup/sandbox/index.cjs.map +1 -0
  136. package/dist/tsup/sandbox/index.d.cts +120 -0
  137. package/dist/tsup/sandbox/index.d.ts +120 -0
  138. package/dist/tsup/sandbox/index.js +761 -0
  139. package/dist/tsup/sandbox/index.js.map +1 -0
  140. package/dist/tsup/sandbox/providers/computesdk.cjs +3 -0
  141. package/dist/tsup/sandbox/providers/computesdk.cjs.map +1 -0
  142. package/dist/tsup/sandbox/providers/computesdk.d.cts +7 -0
  143. package/dist/tsup/sandbox/providers/computesdk.d.ts +7 -0
  144. package/dist/tsup/sandbox/providers/computesdk.js +3 -0
  145. package/dist/tsup/sandbox/providers/computesdk.js.map +1 -0
  146. package/dist/tsup/sandbox/providers/daytona.cjs +3 -0
  147. package/dist/tsup/sandbox/providers/daytona.cjs.map +1 -0
  148. package/dist/tsup/sandbox/providers/daytona.d.cts +1 -0
  149. package/dist/tsup/sandbox/providers/daytona.d.ts +1 -0
  150. package/dist/tsup/sandbox/providers/daytona.js +3 -0
  151. package/dist/tsup/sandbox/providers/daytona.js.map +1 -0
  152. package/dist/tsup/sandbox/providers/docker.cjs +3 -0
  153. package/dist/tsup/sandbox/providers/docker.cjs.map +1 -0
  154. package/dist/tsup/sandbox/providers/docker.d.cts +1 -0
  155. package/dist/tsup/sandbox/providers/docker.d.ts +1 -0
  156. package/dist/tsup/sandbox/providers/docker.js +3 -0
  157. package/dist/tsup/sandbox/providers/docker.js.map +1 -0
  158. package/dist/tsup/sandbox/providers/e2b.cjs +3 -0
  159. package/dist/tsup/sandbox/providers/e2b.cjs.map +1 -0
  160. package/dist/tsup/sandbox/providers/e2b.d.cts +1 -0
  161. package/dist/tsup/sandbox/providers/e2b.d.ts +1 -0
  162. package/dist/tsup/sandbox/providers/e2b.js +3 -0
  163. package/dist/tsup/sandbox/providers/e2b.js.map +1 -0
  164. package/dist/tsup/sandbox/providers/local.cjs +3 -0
  165. package/dist/tsup/sandbox/providers/local.cjs.map +1 -0
  166. package/dist/tsup/sandbox/providers/local.d.cts +1 -0
  167. package/dist/tsup/sandbox/providers/local.d.ts +1 -0
  168. package/dist/tsup/sandbox/providers/local.js +3 -0
  169. package/dist/tsup/sandbox/providers/local.js.map +1 -0
  170. package/dist/tsup/sandbox/providers/modal.cjs +3 -0
  171. package/dist/tsup/sandbox/providers/modal.cjs.map +1 -0
  172. package/dist/tsup/sandbox/providers/modal.d.cts +1 -0
  173. package/dist/tsup/sandbox/providers/modal.d.ts +1 -0
  174. package/dist/tsup/sandbox/providers/modal.js +3 -0
  175. package/dist/tsup/sandbox/providers/modal.js.map +1 -0
  176. package/dist/tsup/sandbox/providers/vercel.cjs +3 -0
  177. package/dist/tsup/sandbox/providers/vercel.cjs.map +1 -0
  178. package/dist/tsup/sandbox/providers/vercel.d.cts +1 -0
  179. package/dist/tsup/sandbox/providers/vercel.d.ts +1 -0
  180. package/dist/tsup/sandbox/providers/vercel.js +3 -0
  181. package/dist/tsup/sandbox/providers/vercel.js.map +1 -0
  182. package/dist/tsup/serve-test-suite/mod.cjs +451 -327
  183. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
  184. package/dist/tsup/serve-test-suite/mod.js +362 -238
  185. package/dist/tsup/serve-test-suite/mod.js.map +1 -1
  186. package/dist/tsup/test/mod.cjs +17 -14
  187. package/dist/tsup/test/mod.cjs.map +1 -1
  188. package/dist/tsup/test/mod.d.cts +4 -4
  189. package/dist/tsup/test/mod.d.ts +4 -4
  190. package/dist/tsup/test/mod.js +14 -11
  191. package/dist/tsup/test/mod.js.map +1 -1
  192. package/dist/tsup/utils.cjs +3 -3
  193. package/dist/tsup/utils.js +2 -2
  194. package/dist/tsup/workflow/mod.cjs +6 -6
  195. package/dist/tsup/workflow/mod.d.cts +13 -9
  196. package/dist/tsup/workflow/mod.d.ts +13 -9
  197. package/dist/tsup/workflow/mod.js +5 -5
  198. package/package.json +113 -14
  199. package/src/actor/config.ts +94 -88
  200. package/src/actor/conn/drivers/websocket.ts +2 -1
  201. package/src/actor/contexts/base/actor.ts +27 -4
  202. package/src/actor/database.ts +6 -1
  203. package/src/actor/driver.ts +27 -8
  204. package/src/actor/errors.ts +10 -5
  205. package/src/actor/instance/connection-manager.ts +4 -3
  206. package/src/actor/instance/kv.ts +52 -9
  207. package/src/actor/instance/mod.ts +135 -84
  208. package/src/actor/instance/queue-manager.ts +2 -5
  209. package/src/actor/instance/queue.ts +31 -29
  210. package/src/actor/instance/state-manager.ts +7 -1
  211. package/src/actor/instance/traces-driver.ts +34 -36
  212. package/src/actor/metrics.ts +137 -0
  213. package/src/actor/protocol/old.ts +9 -12
  214. package/src/actor/router-websocket-endpoints.ts +12 -6
  215. package/src/actor/router.ts +46 -9
  216. package/src/actor/schema.ts +14 -22
  217. package/src/client/actor-common.ts +65 -0
  218. package/src/client/actor-conn.ts +71 -9
  219. package/src/client/actor-handle.ts +22 -5
  220. package/src/client/client.ts +32 -6
  221. package/src/client/config.ts +18 -21
  222. package/src/client/mod.ts +1 -0
  223. package/src/client/queue.ts +8 -6
  224. package/src/common/inline-websocket-adapter.ts +8 -2
  225. package/src/common/router.ts +1 -4
  226. package/src/common/utils.ts +2 -5
  227. package/src/db/config.ts +10 -5
  228. package/src/db/drizzle/mod.ts +51 -41
  229. package/src/db/mod.ts +54 -29
  230. package/src/db/shared.ts +42 -8
  231. package/src/driver-helpers/mod.ts +2 -1
  232. package/src/driver-helpers/sqlite-pool.ts +42 -0
  233. package/src/driver-helpers/utils.ts +0 -20
  234. package/src/driver-test-suite/mod.ts +11 -1
  235. package/src/driver-test-suite/tests/access-control.ts +19 -12
  236. package/src/driver-test-suite/tests/action-features.ts +20 -8
  237. package/src/driver-test-suite/tests/actor-conn.ts +94 -8
  238. package/src/driver-test-suite/tests/actor-db-kv-stats.ts +282 -0
  239. package/src/driver-test-suite/tests/actor-db-raw.ts +6 -2
  240. package/src/driver-test-suite/tests/actor-db.ts +101 -31
  241. package/src/driver-test-suite/tests/actor-inspector.ts +174 -32
  242. package/src/driver-test-suite/tests/actor-kv.ts +79 -33
  243. package/src/driver-test-suite/tests/actor-lifecycle.ts +4 -12
  244. package/src/driver-test-suite/tests/actor-queue.ts +125 -17
  245. package/src/driver-test-suite/tests/actor-run.ts +59 -55
  246. package/src/driver-test-suite/tests/actor-sandbox.ts +78 -0
  247. package/src/driver-test-suite/tests/actor-schedule.ts +1 -4
  248. package/src/driver-test-suite/tests/actor-sleep.ts +111 -0
  249. package/src/driver-test-suite/tests/actor-workflow.ts +387 -3
  250. package/src/driver-test-suite/tests/conn-error-serialization.ts +3 -1
  251. package/src/driver-test-suite/tests/raw-websocket.ts +5 -1
  252. package/src/drivers/default.ts +1 -3
  253. package/src/drivers/engine/actor-driver.ts +94 -21
  254. package/src/drivers/engine/config.ts +4 -12
  255. package/src/drivers/engine/mod.ts +1 -5
  256. package/src/drivers/file-system/actor.ts +43 -8
  257. package/src/drivers/file-system/global-state.ts +180 -64
  258. package/src/drivers/file-system/kv-limits.ts +1 -1
  259. package/src/drivers/file-system/sqlite-runtime.ts +13 -4
  260. package/src/engine-process/mod.ts +5 -1
  261. package/src/inspector/actor-inspector.ts +47 -21
  262. package/src/inspector/config.ts +1 -4
  263. package/src/inspector/mod.browser.ts +2 -2
  264. package/src/inspector/mod.ts +4 -1
  265. package/src/inspector/serve-ui.ts +0 -1
  266. package/src/inspector/workflow-history-json.ts +309 -0
  267. package/src/manager/gateway.ts +6 -2
  268. package/src/manager/router.ts +3 -3
  269. package/src/registry/config/index.ts +65 -12
  270. package/src/registry/config/runner.ts +19 -4
  271. package/src/registry/index.ts +42 -89
  272. package/src/sandbox/actor/db.ts +36 -0
  273. package/src/sandbox/actor/index.ts +476 -0
  274. package/src/sandbox/actor/session.ts +350 -0
  275. package/src/sandbox/actor.test.ts +36 -0
  276. package/src/sandbox/client.test.ts +484 -0
  277. package/src/sandbox/client.ts +707 -0
  278. package/src/sandbox/config.ts +151 -0
  279. package/src/sandbox/index.ts +41 -0
  280. package/src/sandbox/providers/computesdk.ts +1 -0
  281. package/src/sandbox/providers/daytona.ts +1 -0
  282. package/src/sandbox/providers/docker.ts +1 -0
  283. package/src/sandbox/providers/e2b.ts +1 -0
  284. package/src/sandbox/providers/local.ts +1 -0
  285. package/src/sandbox/providers/modal.ts +1 -0
  286. package/src/sandbox/providers/vercel.ts +1 -0
  287. package/src/sandbox/session-persist-driver.ts +180 -0
  288. package/src/sandbox/types.ts +138 -0
  289. package/src/serverless/configure.ts +5 -3
  290. package/src/serverless/router.test.ts +17 -9
  291. package/src/serverless/router.ts +20 -13
  292. package/src/test/mod.ts +3 -4
  293. package/src/utils/endpoint-parser.test.ts +6 -2
  294. package/src/utils/endpoint-parser.ts +6 -2
  295. package/src/utils/env-vars.ts +0 -2
  296. package/src/utils/node.ts +1 -1
  297. package/src/utils/serve.ts +10 -5
  298. package/src/utils.ts +6 -1
  299. package/src/workflow/constants.ts +1 -2
  300. package/src/workflow/context.ts +42 -9
  301. package/src/workflow/driver.ts +57 -23
  302. package/src/workflow/inspector.ts +7 -13
  303. package/src/workflow/mod.ts +91 -4
  304. package/dist/tsup/chunk-3B6PCYJB.cjs.map +0 -1
  305. package/dist/tsup/chunk-3GTO6H3E.js.map +0 -1
  306. package/dist/tsup/chunk-4KSHPFXF.cjs.map +0 -1
  307. package/dist/tsup/chunk-6LJAZ5R4.cjs +0 -96
  308. package/dist/tsup/chunk-6LJAZ5R4.cjs.map +0 -1
  309. package/dist/tsup/chunk-7HTNH26M.js.map +0 -1
  310. package/dist/tsup/chunk-ANKZ2FS6.js.map +0 -1
  311. package/dist/tsup/chunk-DZXDUGLL.js.map +0 -1
  312. package/dist/tsup/chunk-GXRVSSVD.cjs.map +0 -1
  313. package/dist/tsup/chunk-H5TSEPN4.cjs +0 -645
  314. package/dist/tsup/chunk-H5TSEPN4.cjs.map +0 -1
  315. package/dist/tsup/chunk-HKOSZKKZ.cjs.map +0 -1
  316. package/dist/tsup/chunk-I6PL6QIY.js.map +0 -1
  317. package/dist/tsup/chunk-KJSYAUOM.js.map +0 -1
  318. package/dist/tsup/chunk-KTWY3K6Z.js.map +0 -1
  319. package/dist/tsup/chunk-L47L3ZWJ.cjs.map +0 -1
  320. package/dist/tsup/chunk-LK36OGGO.cjs.map +0 -1
  321. package/dist/tsup/chunk-M6H4XIF4.js.map +0 -1
  322. package/dist/tsup/chunk-N4KRDJ56.js.map +0 -1
  323. package/dist/tsup/chunk-SR3KQE7Q.cjs.map +0 -1
  324. package/dist/tsup/chunk-TEFYRRAK.js +0 -645
  325. package/dist/tsup/chunk-TEFYRRAK.js.map +0 -1
  326. package/dist/tsup/chunk-TEUL4UYN.cjs.map +0 -1
  327. package/dist/tsup/chunk-UDMRZR6A.js.map +0 -1
  328. package/dist/tsup/chunk-UWAGLDT6.cjs.map +0 -1
  329. package/dist/tsup/chunk-VKVNIQRQ.js.map +0 -1
  330. package/dist/tsup/chunk-ZFY5J2EP.cjs.map +0 -1
  331. package/src/db/sqlite-vfs.ts +0 -12
  332. /package/dist/tsup/{chunk-HBYEYBIC.js.map → chunk-EONWXYMN.js.map} +0 -0
  333. /package/dist/tsup/{chunk-5UEFNG7P.js.map → chunk-I5I6OALK.js.map} +0 -0
@@ -4,43 +4,51 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkH5TSEPN4cjs = require('../chunk-H5TSEPN4.cjs');
8
- require('../chunk-GXRVSSVD.cjs');
9
- require('../chunk-AQD4CBZ2.cjs');
10
- require('../chunk-HKOSZKKZ.cjs');
11
- require('../chunk-UWAGLDT6.cjs');
12
7
 
13
8
 
9
+ var _chunkCMQPDBBRcjs = require('../chunk-CMQPDBBR.cjs');
10
+ require('../chunk-TJ7DKW6F.cjs');
11
+ require('../chunk-VBR35EQF.cjs');
12
+ require('../chunk-IHQAF2HV.cjs');
13
+ require('../chunk-2LY7RW3Y.cjs');
14
+ require('../chunk-JJNZQDUN.cjs');
15
+ require('../chunk-DH6UINWA.cjs');
14
16
 
15
17
 
18
+ var _chunkYAE3MEJMcjs = require('../chunk-YAE3MEJM.cjs');
16
19
 
17
- var _chunkTEUL4UYNcjs = require('../chunk-TEUL4UYN.cjs');
18
20
 
19
21
 
20
- var _chunkQPADHLDUcjs = require('../chunk-QPADHLDU.cjs');
21
- require('../chunk-6LJAZ5R4.cjs');
22
- require('../chunk-SR3KQE7Q.cjs');
23
22
 
23
+ var _chunkGUHXWPGBcjs = require('../chunk-GUHXWPGB.cjs');
24
24
 
25
25
 
26
+ var _chunkV3JSZR5Pcjs = require('../chunk-V3JSZR5P.cjs');
27
+ require('../chunk-2ELYUO6C.cjs');
28
+ require('../chunk-SQFCIDCG.cjs');
26
29
 
27
30
 
31
+ var _chunkCGGGBIDPcjs = require('../chunk-CGGGBIDP.cjs');
28
32
 
29
33
 
30
34
 
31
35
 
32
- var _chunk3B6PCYJBcjs = require('../chunk-3B6PCYJB.cjs');
36
+
37
+
38
+
39
+
40
+ var _chunkHNE2AK6Ccjs = require('../chunk-HNE2AK6C.cjs');
33
41
  require('../chunk-NIYZDWMW.cjs');
34
42
 
35
43
 
36
- var _chunkLK36OGGOcjs = require('../chunk-LK36OGGO.cjs');
44
+ var _chunkA4KEUCB6cjs = require('../chunk-A4KEUCB6.cjs');
37
45
 
38
46
 
39
- var _chunk4KSHPFXFcjs = require('../chunk-4KSHPFXF.cjs');
47
+ var _chunkMPLMTJY5cjs = require('../chunk-MPLMTJY5.cjs');
40
48
 
41
49
 
42
50
 
43
- var _chunkL47L3ZWJcjs = require('../chunk-L47L3ZWJ.cjs');
51
+ var _chunk6G7ZNM27cjs = require('../chunk-6G7ZNM27.cjs');
44
52
  require('../chunk-HDQ2JUQT.cjs');
45
53
 
46
54
  // src/driver-test-suite/mod.ts
@@ -85,20 +93,20 @@ function createTestInlineClientDriver(endpoint, encoding) {
85
93
  const oldUrl = new URL(actorRequest.url);
86
94
  const normalizedPath = oldUrl.pathname.startsWith("/") ? oldUrl.pathname.slice(1) : oldUrl.pathname;
87
95
  const pathWithQuery = normalizedPath + oldUrl.search;
88
- _chunkH5TSEPN4cjs.logger.call(void 0, ).debug({
96
+ _chunkCMQPDBBRcjs.logger.call(void 0, ).debug({
89
97
  msg: "sending raw http request via test inline driver",
90
98
  actorId,
91
99
  encoding,
92
100
  path: pathWithQuery
93
101
  });
94
102
  const url = `${endpoint}/.test/inline-driver/send-request/${pathWithQuery}`;
95
- _chunkH5TSEPN4cjs.logger.call(void 0, ).debug({
103
+ _chunkCMQPDBBRcjs.logger.call(void 0, ).debug({
96
104
  msg: "rewriting http url",
97
105
  from: oldUrl,
98
106
  to: url
99
107
  });
100
108
  const headers = new Headers(actorRequest.headers);
101
- headers.set(_chunk3B6PCYJBcjs.HEADER_ACTOR_ID, actorId);
109
+ headers.set(_chunkHNE2AK6Ccjs.HEADER_ACTOR_ID, actorId);
102
110
  const response = await fetch(
103
111
  new Request(url, {
104
112
  method: actorRequest.method,
@@ -114,7 +122,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
114
122
  const errorData = await clonedResponse.json();
115
123
  if (errorData.error) {
116
124
  if (typeof errorData.error === "object") {
117
- throw new (0, _chunkTEUL4UYNcjs.ActorError)(
125
+ throw new (0, _chunkGUHXWPGBcjs.ActorError)(
118
126
  errorData.error.code,
119
127
  errorData.error.message,
120
128
  errorData.error.metadata
@@ -122,7 +130,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
122
130
  }
123
131
  }
124
132
  } catch (e) {
125
- if (!(e instanceof _chunkTEUL4UYNcjs.ActorError)) {
133
+ if (!(e instanceof _chunkGUHXWPGBcjs.ActorError)) {
126
134
  return response;
127
135
  }
128
136
  throw e;
@@ -131,33 +139,33 @@ function createTestInlineClientDriver(endpoint, encoding) {
131
139
  return response;
132
140
  },
133
141
  async openWebSocket(path, actorId, encoding2, params) {
134
- const WebSocket2 = await _chunkQPADHLDUcjs.importWebSocket.call(void 0, );
142
+ const WebSocket2 = await _chunkV3JSZR5Pcjs.importWebSocket.call(void 0, );
135
143
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
136
144
  const wsUrl = new URL(
137
145
  `${endpoint}/.test/inline-driver/connect-websocket/ws`
138
146
  );
139
- _chunkH5TSEPN4cjs.logger.call(void 0, ).debug({
147
+ _chunkCMQPDBBRcjs.logger.call(void 0, ).debug({
140
148
  msg: "creating websocket connection via test inline driver",
141
149
  url: wsUrl.toString()
142
150
  });
143
151
  const wsProtocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
144
152
  const finalWsUrl = `${wsProtocol}//${wsUrl.host}${wsUrl.pathname}`;
145
153
  const protocols = [];
146
- protocols.push(_chunk3B6PCYJBcjs.WS_PROTOCOL_STANDARD);
147
- protocols.push(`${_chunk3B6PCYJBcjs.WS_PROTOCOL_TARGET}actor`);
154
+ protocols.push(_chunkHNE2AK6Ccjs.WS_PROTOCOL_STANDARD);
155
+ protocols.push(`${_chunkHNE2AK6Ccjs.WS_PROTOCOL_TARGET}actor`);
148
156
  protocols.push(
149
- `${_chunk3B6PCYJBcjs.WS_PROTOCOL_ACTOR}${encodeURIComponent(actorId)}`
157
+ `${_chunkHNE2AK6Ccjs.WS_PROTOCOL_ACTOR}${encodeURIComponent(actorId)}`
150
158
  );
151
- protocols.push(`${_chunk3B6PCYJBcjs.WS_PROTOCOL_ENCODING}${encoding2}`);
159
+ protocols.push(`${_chunkHNE2AK6Ccjs.WS_PROTOCOL_ENCODING}${encoding2}`);
152
160
  protocols.push(
153
- `${_chunk3B6PCYJBcjs.WS_TEST_PROTOCOL_PATH}${encodeURIComponent(normalizedPath)}`
161
+ `${_chunkHNE2AK6Ccjs.WS_TEST_PROTOCOL_PATH}${encodeURIComponent(normalizedPath)}`
154
162
  );
155
163
  if (params !== void 0) {
156
164
  protocols.push(
157
- `${_chunk3B6PCYJBcjs.WS_PROTOCOL_CONN_PARAMS}${encodeURIComponent(JSON.stringify(params))}`
165
+ `${_chunkHNE2AK6Ccjs.WS_PROTOCOL_CONN_PARAMS}${encodeURIComponent(JSON.stringify(params))}`
158
166
  );
159
167
  }
160
- _chunkH5TSEPN4cjs.logger.call(void 0, ).debug({
168
+ _chunkCMQPDBBRcjs.logger.call(void 0, ).debug({
161
169
  msg: "connecting to websocket",
162
170
  url: finalWsUrl,
163
171
  protocols
@@ -177,7 +185,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
177
185
  encoding2,
178
186
  params
179
187
  );
180
- return upgradeWebSocket(() => wsHandler)(c, _chunk4KSHPFXFcjs.noopNext.call(void 0, ));
188
+ return upgradeWebSocket(() => wsHandler)(c, _chunkMPLMTJY5cjs.noopNext.call(void 0, ));
181
189
  },
182
190
  async buildGatewayUrl(actorId) {
183
191
  return `${endpoint}/gateway/${actorId}`;
@@ -194,7 +202,7 @@ function createTestInlineClientDriver(endpoint, encoding) {
194
202
  };
195
203
  }
196
204
  async function makeInlineRequest(endpoint, encoding, method, args) {
197
- _chunkH5TSEPN4cjs.logger.call(void 0, ).debug({
205
+ _chunkCMQPDBBRcjs.logger.call(void 0, ).debug({
198
206
  msg: "sending inline request",
199
207
  encoding,
200
208
  method,
@@ -224,14 +232,14 @@ async function makeInlineRequest(endpoint, encoding, method, args) {
224
232
  if ("ok" in callResponse) {
225
233
  return callResponse.ok;
226
234
  } else if ("err" in callResponse) {
227
- throw new (0, _chunkTEUL4UYNcjs.ActorError)(
235
+ throw new (0, _chunkGUHXWPGBcjs.ActorError)(
228
236
  callResponse.err.group,
229
237
  callResponse.err.code,
230
238
  callResponse.err.message,
231
239
  callResponse.err.metadata
232
240
  );
233
241
  } else {
234
- _chunkLK36OGGOcjs.assertUnreachable.call(void 0, callResponse);
242
+ _chunkA4KEUCB6cjs.assertUnreachable.call(void 0, callResponse);
235
243
  }
236
244
  }
237
245
 
@@ -245,7 +253,7 @@ async function setupDriverTest(c, driverTestConfig) {
245
253
  const { endpoint, namespace, runnerName, cleanup } = await driverTestConfig.start();
246
254
  let client;
247
255
  if (driverTestConfig.clientType === "http") {
248
- client = _chunkTEUL4UYNcjs.createClient.call(void 0, {
256
+ client = _chunkYAE3MEJMcjs.createClient.call(void 0, {
249
257
  endpoint,
250
258
  namespace,
251
259
  runnerName,
@@ -258,18 +266,18 @@ async function setupDriverTest(c, driverTestConfig) {
258
266
  } else if (driverTestConfig.clientType === "inline") {
259
267
  const encoding = _nullishCoalesce(driverTestConfig.encoding, () => ( "bare"));
260
268
  const managerDriver = createTestInlineClientDriver(endpoint, encoding);
261
- const runConfig = _chunkTEUL4UYNcjs.ClientConfigSchema.parse({
269
+ const runConfig = _chunkGUHXWPGBcjs.ClientConfigSchema.parse({
262
270
  encoding
263
271
  });
264
- client = _chunkTEUL4UYNcjs.createClientWithDriver.call(void 0, managerDriver, runConfig);
272
+ client = _chunkGUHXWPGBcjs.createClientWithDriver.call(void 0, managerDriver, runConfig);
265
273
  } else {
266
- _chunkLK36OGGOcjs.assertUnreachable.call(void 0, driverTestConfig.clientType);
274
+ _chunkA4KEUCB6cjs.assertUnreachable.call(void 0, driverTestConfig.clientType);
267
275
  }
268
276
  c.onTestFinished(async () => {
269
277
  if (!driverTestConfig.HACK_skipCleanupNet) {
270
278
  await client.dispose();
271
279
  }
272
- _chunkH5TSEPN4cjs.logger.call(void 0, ).info("cleaning up test");
280
+ _chunkCMQPDBBRcjs.logger.call(void 0, ).info("cleaning up test");
273
281
  await cleanup();
274
282
  });
275
283
  return {
@@ -372,19 +380,27 @@ function runActionFeaturesTests(driverTestConfig) {
372
380
  const instance = client.largePayloadActor.getOrCreate();
373
381
  const items = [];
374
382
  for (let i = 0; i < 800; i++) {
375
- items.push(`Item ${i} with some additional text to increase size`);
383
+ items.push(
384
+ `Item ${i} with some additional text to increase size`
385
+ );
376
386
  }
377
387
  const result = await instance.processLargeRequest({ items });
378
388
  _vitest.expect.call(void 0, result.itemCount).toBe(800);
379
- _vitest.expect.call(void 0, result.firstItem).toBe("Item 0 with some additional text to increase size");
380
- _vitest.expect.call(void 0, result.lastItem).toBe("Item 799 with some additional text to increase size");
389
+ _vitest.expect.call(void 0, result.firstItem).toBe(
390
+ "Item 0 with some additional text to increase size"
391
+ );
392
+ _vitest.expect.call(void 0, result.lastItem).toBe(
393
+ "Item 799 with some additional text to increase size"
394
+ );
381
395
  });
382
396
  _vitest.test.call(void 0, "should reject request exceeding maxIncomingMessageSize", async (c) => {
383
397
  const { client } = await setupDriverTest(c, driverTestConfig);
384
398
  const instance = client.largePayloadActor.getOrCreate();
385
399
  const items = [];
386
400
  for (let i = 0; i < 1500; i++) {
387
- items.push(`Item ${i} with some additional text to increase size`);
401
+ items.push(
402
+ `Item ${i} with some additional text to increase size`
403
+ );
388
404
  }
389
405
  await _vitest.expect.call(void 0,
390
406
  instance.processLargeRequest({ items })
@@ -395,8 +411,12 @@ function runActionFeaturesTests(driverTestConfig) {
395
411
  const instance = client.largePayloadActor.getOrCreate();
396
412
  const result = await instance.getLargeResponse(800);
397
413
  _vitest.expect.call(void 0, result.items).toHaveLength(800);
398
- _vitest.expect.call(void 0, result.items[0]).toBe("Item 0 with some additional text to increase size");
399
- _vitest.expect.call(void 0, result.items[799]).toBe("Item 799 with some additional text to increase size");
414
+ _vitest.expect.call(void 0, result.items[0]).toBe(
415
+ "Item 0 with some additional text to increase size"
416
+ );
417
+ _vitest.expect.call(void 0, result.items[799]).toBe(
418
+ "Item 799 with some additional text to increase size"
419
+ );
400
420
  });
401
421
  _vitest.test.call(void 0, "should reject response exceeding maxOutgoingMessageSize", async (c) => {
402
422
  const { client } = await setupDriverTest(c, driverTestConfig);
@@ -421,7 +441,9 @@ function runAccessControlTests(driverTestConfig) {
421
441
  });
422
442
  _vitest.test.call(void 0, "passes connection id into canPublish context", async (c) => {
423
443
  const { client } = await setupDriverTest(c, driverTestConfig);
424
- const handle = client.accessControlActor.getOrCreate(["publish-ctx"]);
444
+ const handle = client.accessControlActor.getOrCreate([
445
+ "publish-ctx"
446
+ ]);
425
447
  await handle.send("allowedQueue", { value: "one" });
426
448
  const connId = await handle.allowedGetLastCanPublishConnId();
427
449
  _vitest.expect.call(void 0, typeof connId).toBe("string");
@@ -512,16 +534,21 @@ function runAccessControlTests(driverTestConfig) {
512
534
  "undefined-event"
513
535
  ]);
514
536
  const conn = handle.connect();
515
- const eventPromise = new Promise((resolve, reject) => {
516
- const unsubscribeError = conn.onError((error) => {
517
- reject(error);
518
- });
519
- const unsubscribeEvent = conn.on("undefinedEvent", (payload) => {
520
- unsubscribeError();
521
- unsubscribeEvent();
522
- resolve(payload);
523
- });
524
- });
537
+ const eventPromise = new Promise(
538
+ (resolve, reject) => {
539
+ const unsubscribeError = conn.onError((error) => {
540
+ reject(error);
541
+ });
542
+ const unsubscribeEvent = conn.on(
543
+ "undefinedEvent",
544
+ (payload) => {
545
+ unsubscribeError();
546
+ unsubscribeEvent();
547
+ resolve(payload);
548
+ }
549
+ );
550
+ }
551
+ );
525
552
  await conn.allowedAction("undefined-subscribe-ready");
526
553
  await conn.allowedBroadcastUndefinedEvent("wildcard");
527
554
  _vitest.expect.call(void 0, await eventPromise).toEqual({ value: "wildcard" });
@@ -745,6 +772,65 @@ function runActorConnTests(driverTestConfig) {
745
772
  await conn1.dispose();
746
773
  await conn2.dispose();
747
774
  });
775
+ _vitest.test.call(void 0, "should call getParams for each connection", async (c) => {
776
+ const { client } = await setupDriverTest(c, driverTestConfig);
777
+ let connectionCount = 0;
778
+ const handle = client.counterWithParams.getOrCreate(
779
+ ["test-get-params"],
780
+ {
781
+ getParams: async () => ({
782
+ name: `user${++connectionCount}`
783
+ })
784
+ }
785
+ );
786
+ const conn1 = handle.connect();
787
+ await conn1.getInitializers();
788
+ await conn1.dispose();
789
+ const conn2 = handle.connect();
790
+ const initializers = await conn2.getInitializers();
791
+ _vitest.expect.call(void 0, initializers).toEqual(["user1", "user2"]);
792
+ _vitest.expect.call(void 0, connectionCount).toBe(2);
793
+ await conn2.dispose();
794
+ });
795
+ _vitest.test.call(void 0, "should surface getParams errors and retry connection setup", async (c) => {
796
+ const { client } = await setupDriverTest(c, driverTestConfig);
797
+ let attempts = 0;
798
+ const handle = client.counterWithParams.getOrCreate(
799
+ ["test-get-params-retry"],
800
+ {
801
+ getParams: async () => {
802
+ attempts++;
803
+ if (attempts === 1) {
804
+ throw new Error("token unavailable");
805
+ }
806
+ return { name: "user1" };
807
+ }
808
+ }
809
+ );
810
+ const conn = handle.connect();
811
+ const receivedErrors = [];
812
+ conn.onError((error) => {
813
+ receivedErrors.push({
814
+ group: error.group,
815
+ code: error.code
816
+ });
817
+ });
818
+ await _vitest.expect.call(void 0, conn.getInitializers()).rejects.toMatchObject({
819
+ group: "client",
820
+ code: "get_params_failed"
821
+ });
822
+ await _vitest.vi.waitFor(
823
+ async () => {
824
+ _vitest.expect.call(void 0, await conn.getInitializers()).toEqual(["user1"]);
825
+ },
826
+ { timeout: 1e4 }
827
+ );
828
+ _vitest.expect.call(void 0, receivedErrors).toEqual([
829
+ { group: "client", code: "get_params_failed" }
830
+ ]);
831
+ _vitest.expect.call(void 0, attempts).toBeGreaterThanOrEqual(2);
832
+ await conn.dispose();
833
+ });
748
834
  });
749
835
  _vitest.describe.call(void 0, "Lifecycle Hooks", () => {
750
836
  _vitest.test.call(void 0, "should trigger lifecycle hooks", async (c) => {
@@ -922,12 +1008,18 @@ function runActorConnTests(driverTestConfig) {
922
1008
  const connection = handle.connect();
923
1009
  const items = [];
924
1010
  for (let i = 0; i < 800; i++) {
925
- items.push(`Item ${i} with some additional text to increase size`);
1011
+ items.push(
1012
+ `Item ${i} with some additional text to increase size`
1013
+ );
926
1014
  }
927
1015
  const result = await connection.processLargeRequest({ items });
928
1016
  _vitest.expect.call(void 0, result.itemCount).toBe(800);
929
- _vitest.expect.call(void 0, result.firstItem).toBe("Item 0 with some additional text to increase size");
930
- _vitest.expect.call(void 0, result.lastItem).toBe("Item 799 with some additional text to increase size");
1017
+ _vitest.expect.call(void 0, result.firstItem).toBe(
1018
+ "Item 0 with some additional text to increase size"
1019
+ );
1020
+ _vitest.expect.call(void 0, result.lastItem).toBe(
1021
+ "Item 799 with some additional text to increase size"
1022
+ );
931
1023
  const lastRequestSize = await connection.getLastRequestSize();
932
1024
  _vitest.expect.call(void 0, lastRequestSize).toBe(800);
933
1025
  await connection.dispose();
@@ -940,7 +1032,9 @@ function runActorConnTests(driverTestConfig) {
940
1032
  const connection = handle.connect();
941
1033
  const items = [];
942
1034
  for (let i = 0; i < 1500; i++) {
943
- items.push(`Item ${i} with some additional text to increase size`);
1035
+ items.push(
1036
+ `Item ${i} with some additional text to increase size`
1037
+ );
944
1038
  }
945
1039
  await _vitest.expect.call(void 0,
946
1040
  connection.processLargeRequest({ items })
@@ -955,8 +1049,12 @@ function runActorConnTests(driverTestConfig) {
955
1049
  const connection = handle.connect();
956
1050
  const result = await connection.getLargeResponse(800);
957
1051
  _vitest.expect.call(void 0, result.items).toHaveLength(800);
958
- _vitest.expect.call(void 0, result.items[0]).toBe("Item 0 with some additional text to increase size");
959
- _vitest.expect.call(void 0, result.items[799]).toBe("Item 799 with some additional text to increase size");
1052
+ _vitest.expect.call(void 0, result.items[0]).toBe(
1053
+ "Item 0 with some additional text to increase size"
1054
+ );
1055
+ _vitest.expect.call(void 0, result.items[799]).toBe(
1056
+ "Item 799 with some additional text to increase size"
1057
+ );
960
1058
  await connection.dispose();
961
1059
  });
962
1060
  _vitest.test.call(void 0, "should reject response exceeding maxOutgoingMessageSize", async (c) => {
@@ -989,7 +1087,7 @@ function runActorConnHibernationTests(driverTestConfig) {
989
1087
  await hibernatingActor.triggerSleep();
990
1088
  await waitFor(
991
1089
  driverTestConfig,
992
- _chunkH5TSEPN4cjs.HIBERNATION_SLEEP_TIMEOUT + 100
1090
+ _chunkCMQPDBBRcjs.HIBERNATION_SLEEP_TIMEOUT + 100
993
1091
  );
994
1092
  const ping2 = await hibernatingActor.ping();
995
1093
  _vitest.expect.call(void 0, ping2).toBe("pong");
@@ -1011,7 +1109,7 @@ function runActorConnHibernationTests(driverTestConfig) {
1011
1109
  await hibernatingActor.triggerSleep();
1012
1110
  await waitFor(
1013
1111
  driverTestConfig,
1014
- _chunkH5TSEPN4cjs.HIBERNATION_SLEEP_TIMEOUT + 100
1112
+ _chunkCMQPDBBRcjs.HIBERNATION_SLEEP_TIMEOUT + 100
1015
1113
  );
1016
1114
  const count3 = await hibernatingActor.getConnCount();
1017
1115
  _vitest.expect.call(void 0, count3).toBe(2);
@@ -1033,7 +1131,7 @@ function runActorConnHibernationTests(driverTestConfig) {
1033
1131
  await conn1.triggerSleep();
1034
1132
  await waitFor(
1035
1133
  driverTestConfig,
1036
- _chunkH5TSEPN4cjs.HIBERNATION_SLEEP_TIMEOUT + 100
1134
+ _chunkCMQPDBBRcjs.HIBERNATION_SLEEP_TIMEOUT + 100
1037
1135
  );
1038
1136
  await conn1.dispose();
1039
1137
  await waitFor(driverTestConfig, 250);
@@ -1279,7 +1377,10 @@ function runActorDbTests(driverTestConfig) {
1279
1377
  _vitest.test.call(void 0,
1280
1378
  "bootstraps schema on startup",
1281
1379
  async (c) => {
1282
- const { client } = await setupDriverTest(c, driverTestConfig);
1380
+ const { client } = await setupDriverTest(
1381
+ c,
1382
+ driverTestConfig
1383
+ );
1283
1384
  const actor = getDbActor(client, variant).getOrCreate([
1284
1385
  `db-${variant}-bootstrap-${crypto.randomUUID()}`
1285
1386
  ]);
@@ -1291,7 +1392,10 @@ function runActorDbTests(driverTestConfig) {
1291
1392
  _vitest.test.call(void 0,
1292
1393
  "supports CRUD, raw SQL, and multi-statement exec",
1293
1394
  async (c) => {
1294
- const { client } = await setupDriverTest(c, driverTestConfig);
1395
+ const { client } = await setupDriverTest(
1396
+ c,
1397
+ driverTestConfig
1398
+ );
1295
1399
  const actor = getDbActor(client, variant).getOrCreate([
1296
1400
  `db-${variant}-crud-${crypto.randomUUID()}`
1297
1401
  ]);
@@ -1300,8 +1404,12 @@ function runActorDbTests(driverTestConfig) {
1300
1404
  const second = await actor.insertValue("beta");
1301
1405
  const values = await actor.getValues();
1302
1406
  _vitest.expect.call(void 0, values.length).toBeGreaterThanOrEqual(2);
1303
- _vitest.expect.call(void 0, values.some((row) => row.value === "alpha")).toBeTruthy();
1304
- _vitest.expect.call(void 0, values.some((row) => row.value === "beta")).toBeTruthy();
1407
+ _vitest.expect.call(void 0,
1408
+ values.some((row) => row.value === "alpha")
1409
+ ).toBeTruthy();
1410
+ _vitest.expect.call(void 0,
1411
+ values.some((row) => row.value === "beta")
1412
+ ).toBeTruthy();
1305
1413
  await actor.updateValue(first.id, "alpha-updated");
1306
1414
  const updated = await actor.getValue(first.id);
1307
1415
  _vitest.expect.call(void 0, updated).toBe("alpha-updated");
@@ -1326,7 +1434,10 @@ function runActorDbTests(driverTestConfig) {
1326
1434
  _vitest.test.call(void 0,
1327
1435
  "handles transactions",
1328
1436
  async (c) => {
1329
- const { client } = await setupDriverTest(c, driverTestConfig);
1437
+ const { client } = await setupDriverTest(
1438
+ c,
1439
+ driverTestConfig
1440
+ );
1330
1441
  const actor = getDbActor(client, variant).getOrCreate([
1331
1442
  `db-${variant}-tx-${crypto.randomUUID()}`
1332
1443
  ]);
@@ -1341,7 +1452,10 @@ function runActorDbTests(driverTestConfig) {
1341
1452
  _vitest.test.call(void 0,
1342
1453
  "persists across sleep and wake cycles",
1343
1454
  async (c) => {
1344
- const { client } = await setupDriverTest(c, driverTestConfig);
1455
+ const { client } = await setupDriverTest(
1456
+ c,
1457
+ driverTestConfig
1458
+ );
1345
1459
  const actor = getDbActor(client, variant).getOrCreate([
1346
1460
  `db-${variant}-sleep-${crypto.randomUUID()}`
1347
1461
  ]);
@@ -1360,9 +1474,14 @@ function runActorDbTests(driverTestConfig) {
1360
1474
  _vitest.test.call(void 0,
1361
1475
  "completes onDisconnect DB writes before sleeping",
1362
1476
  async (c) => {
1363
- const { client } = await setupDriverTest(c, driverTestConfig);
1477
+ const { client } = await setupDriverTest(
1478
+ c,
1479
+ driverTestConfig
1480
+ );
1364
1481
  const key = `db-${variant}-disconnect-${crypto.randomUUID()}`;
1365
- const actor = getDbActor(client, variant).getOrCreate([key]);
1482
+ const actor = getDbActor(client, variant).getOrCreate([
1483
+ key
1484
+ ]);
1366
1485
  await actor.reset();
1367
1486
  await actor.configureDisconnectInsert(true, 250);
1368
1487
  await waitFor(driverTestConfig, SLEEP_WAIT_MS + 250);
@@ -1374,7 +1493,10 @@ function runActorDbTests(driverTestConfig) {
1374
1493
  _vitest.test.call(void 0,
1375
1494
  "handles high-volume inserts",
1376
1495
  async (c) => {
1377
- const { client } = await setupDriverTest(c, driverTestConfig);
1496
+ const { client } = await setupDriverTest(
1497
+ c,
1498
+ driverTestConfig
1499
+ );
1378
1500
  const actor = getDbActor(client, variant).getOrCreate([
1379
1501
  `db-${variant}-high-volume-${crypto.randomUUID()}`
1380
1502
  ]);
@@ -1392,7 +1514,10 @@ function runActorDbTests(driverTestConfig) {
1392
1514
  _vitest.test.call(void 0,
1393
1515
  "handles payloads across chunk boundaries",
1394
1516
  async (c) => {
1395
- const { client } = await setupDriverTest(c, driverTestConfig);
1517
+ const { client } = await setupDriverTest(
1518
+ c,
1519
+ driverTestConfig
1520
+ );
1396
1521
  const actor = getDbActor(client, variant).getOrCreate([
1397
1522
  `db-${variant}-chunk-${crypto.randomUUID()}`
1398
1523
  ]);
@@ -1408,7 +1533,10 @@ function runActorDbTests(driverTestConfig) {
1408
1533
  _vitest.test.call(void 0,
1409
1534
  "handles large payloads",
1410
1535
  async (c) => {
1411
- const { client } = await setupDriverTest(c, driverTestConfig);
1536
+ const { client } = await setupDriverTest(
1537
+ c,
1538
+ driverTestConfig
1539
+ );
1412
1540
  const actor = getDbActor(client, variant).getOrCreate([
1413
1541
  `db-${variant}-large-${crypto.randomUUID()}`
1414
1542
  ]);
@@ -1422,7 +1550,10 @@ function runActorDbTests(driverTestConfig) {
1422
1550
  _vitest.test.call(void 0,
1423
1551
  "supports shrink and regrow workloads with vacuum",
1424
1552
  async (c) => {
1425
- const { client } = await setupDriverTest(c, driverTestConfig);
1553
+ const { client } = await setupDriverTest(
1554
+ c,
1555
+ driverTestConfig
1556
+ );
1426
1557
  const actor = getDbActor(client, variant).getOrCreate([
1427
1558
  `db-${variant}-shrink-regrow-${crypto.randomUUID()}`
1428
1559
  ]);
@@ -1451,7 +1582,10 @@ function runActorDbTests(driverTestConfig) {
1451
1582
  _vitest.test.call(void 0,
1452
1583
  "handles repeated updates to the same row",
1453
1584
  async (c) => {
1454
- const { client } = await setupDriverTest(c, driverTestConfig);
1585
+ const { client } = await setupDriverTest(
1586
+ c,
1587
+ driverTestConfig
1588
+ );
1455
1589
  const actor = getDbActor(client, variant).getOrCreate([
1456
1590
  `db-${variant}-updates-${crypto.randomUUID()}`
1457
1591
  ]);
@@ -1480,7 +1614,10 @@ function runActorDbTests(driverTestConfig) {
1480
1614
  _vitest.test.call(void 0,
1481
1615
  "passes integrity checks after mixed workload and sleep",
1482
1616
  async (c) => {
1483
- const { client } = await setupDriverTest(c, driverTestConfig);
1617
+ const { client } = await setupDriverTest(
1618
+ c,
1619
+ driverTestConfig
1620
+ );
1484
1621
  const actor = getDbActor(client, variant).getOrCreate([
1485
1622
  `db-${variant}-integrity-${crypto.randomUUID()}`
1486
1623
  ]);
@@ -1489,10 +1626,14 @@ function runActorDbTests(driverTestConfig) {
1489
1626
  INTEGRITY_SEED_COUNT,
1490
1627
  INTEGRITY_CHURN_COUNT
1491
1628
  );
1492
- _vitest.expect.call(void 0, (await actor.integrityCheck()).toLowerCase()).toBe("ok");
1629
+ _vitest.expect.call(void 0, (await actor.integrityCheck()).toLowerCase()).toBe(
1630
+ "ok"
1631
+ );
1493
1632
  await actor.triggerSleep();
1494
1633
  await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
1495
- _vitest.expect.call(void 0, (await actor.integrityCheck()).toLowerCase()).toBe("ok");
1634
+ _vitest.expect.call(void 0, (await actor.integrityCheck()).toLowerCase()).toBe(
1635
+ "ok"
1636
+ );
1496
1637
  },
1497
1638
  dbTestTimeout
1498
1639
  );
@@ -1503,7 +1644,9 @@ function runActorDbTests(driverTestConfig) {
1503
1644
  "runs db provider cleanup on sleep",
1504
1645
  async (c) => {
1505
1646
  const { client } = await setupDriverTest(c, driverTestConfig);
1506
- const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
1647
+ const observer = client.dbLifecycleObserver.getOrCreate([
1648
+ "observer"
1649
+ ]);
1507
1650
  const lifecycle = client.dbLifecycle.getOrCreate([
1508
1651
  `db-lifecycle-sleep-${crypto.randomUUID()}`
1509
1652
  ]);
@@ -1523,7 +1666,9 @@ function runActorDbTests(driverTestConfig) {
1523
1666
  }
1524
1667
  _vitest.expect.call(void 0, after.create).toBeGreaterThanOrEqual(before.create);
1525
1668
  _vitest.expect.call(void 0, after.migrate).toBeGreaterThanOrEqual(before.migrate);
1526
- _vitest.expect.call(void 0, after.cleanup).toBeGreaterThanOrEqual(before.cleanup + 1);
1669
+ _vitest.expect.call(void 0, after.cleanup).toBeGreaterThanOrEqual(
1670
+ before.cleanup + 1
1671
+ );
1527
1672
  },
1528
1673
  lifecycleTestTimeout
1529
1674
  );
@@ -1531,7 +1676,9 @@ function runActorDbTests(driverTestConfig) {
1531
1676
  "runs db provider cleanup on destroy",
1532
1677
  async (c) => {
1533
1678
  const { client } = await setupDriverTest(c, driverTestConfig);
1534
- const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
1679
+ const observer = client.dbLifecycleObserver.getOrCreate([
1680
+ "observer"
1681
+ ]);
1535
1682
  const lifecycle = client.dbLifecycle.getOrCreate([
1536
1683
  `db-lifecycle-destroy-${crypto.randomUUID()}`
1537
1684
  ]);
@@ -1557,7 +1704,9 @@ function runActorDbTests(driverTestConfig) {
1557
1704
  "runs db provider cleanup when migration fails",
1558
1705
  async (c) => {
1559
1706
  const { client } = await setupDriverTest(c, driverTestConfig);
1560
- const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
1707
+ const observer = client.dbLifecycleObserver.getOrCreate([
1708
+ "observer"
1709
+ ]);
1561
1710
  const beforeTotalCleanup = await observer.getTotalCleanupCount();
1562
1711
  const key = `db-lifecycle-migrate-failure-${crypto.randomUUID()}`;
1563
1712
  const lifecycle = client.dbLifecycleFailing.getOrCreate([key]);
@@ -1576,7 +1725,9 @@ function runActorDbTests(driverTestConfig) {
1576
1725
  }
1577
1726
  await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
1578
1727
  }
1579
- _vitest.expect.call(void 0, cleanupCount).toBeGreaterThanOrEqual(beforeTotalCleanup + 1);
1728
+ _vitest.expect.call(void 0, cleanupCount).toBeGreaterThanOrEqual(
1729
+ beforeTotalCleanup + 1
1730
+ );
1580
1731
  },
1581
1732
  lifecycleTestTimeout
1582
1733
  );
@@ -1584,7 +1735,9 @@ function runActorDbTests(driverTestConfig) {
1584
1735
  "handles parallel actor lifecycle churn",
1585
1736
  async (c) => {
1586
1737
  const { client } = await setupDriverTest(c, driverTestConfig);
1587
- const observer = client.dbLifecycleObserver.getOrCreate(["observer"]);
1738
+ const observer = client.dbLifecycleObserver.getOrCreate([
1739
+ "observer"
1740
+ ]);
1588
1741
  const actorHandles = Array.from(
1589
1742
  { length: 12 },
1590
1743
  (_, i) => client.dbLifecycle.getOrCreate([
@@ -1595,17 +1748,27 @@ function runActorDbTests(driverTestConfig) {
1595
1748
  actorHandles.map((handle) => handle.getActorId())
1596
1749
  );
1597
1750
  await Promise.all(
1598
- actorHandles.map((handle, i) => handle.insertValue(`phase-1-${i}`))
1751
+ actorHandles.map(
1752
+ (handle, i) => handle.insertValue(`phase-1-${i}`)
1753
+ )
1754
+ );
1755
+ await Promise.all(
1756
+ actorHandles.map((handle) => handle.triggerSleep())
1599
1757
  );
1600
- await Promise.all(actorHandles.map((handle) => handle.triggerSleep()));
1601
1758
  await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
1602
1759
  await Promise.all(
1603
- actorHandles.map((handle, i) => handle.insertValue(`phase-2-${i}`))
1760
+ actorHandles.map(
1761
+ (handle, i) => handle.insertValue(`phase-2-${i}`)
1762
+ )
1604
1763
  );
1605
1764
  const survivors = actorHandles.slice(0, 6);
1606
1765
  const destroyed = actorHandles.slice(6);
1607
- await Promise.all(destroyed.map((handle) => handle.triggerDestroy()));
1608
- await Promise.all(survivors.map((handle) => handle.triggerSleep()));
1766
+ await Promise.all(
1767
+ destroyed.map((handle) => handle.triggerDestroy())
1768
+ );
1769
+ await Promise.all(
1770
+ survivors.map((handle) => handle.triggerSleep())
1771
+ );
1609
1772
  await waitFor(driverTestConfig, SLEEP_WAIT_MS + 100);
1610
1773
  await Promise.all(survivors.map((handle) => handle.ping()));
1611
1774
  const survivorCounts = await Promise.all(
@@ -1634,7 +1797,9 @@ function runActorDbTests(driverTestConfig) {
1634
1797
  await waitFor(driverTestConfig, LIFECYCLE_POLL_INTERVAL_MS);
1635
1798
  }
1636
1799
  for (const actorId of actorIds) {
1637
- _vitest.expect.call(void 0, _nullishCoalesce(lifecycleCleanup.get(actorId), () => ( 0))).toBeGreaterThanOrEqual(1);
1800
+ _vitest.expect.call(void 0,
1801
+ _nullishCoalesce(lifecycleCleanup.get(actorId), () => ( 0))
1802
+ ).toBeGreaterThanOrEqual(1);
1638
1803
  }
1639
1804
  },
1640
1805
  lifecycleTestTimeout
@@ -1896,9 +2061,7 @@ function runActorLifecycleTests(driverTestConfig) {
1896
2061
  const actorKey = `test-stop-before-instantiation-${Date.now()}`;
1897
2062
  const actors = Array.from(
1898
2063
  { length: 5 },
1899
- (_, i) => client.startStopRaceActor.getOrCreate([
1900
- `${actorKey}-${i}`
1901
- ])
2064
+ (_, i) => client.startStopRaceActor.getOrCreate([`${actorKey}-${i}`])
1902
2065
  );
1903
2066
  const ids = await Promise.all(actors.map((a) => a.resolve()));
1904
2067
  await Promise.all(actors.map((a) => a.destroy()));
@@ -1911,9 +2074,7 @@ function runActorLifecycleTests(driverTestConfig) {
1911
2074
  _vitest.expect.call(void 0, err.group).toBe("actor");
1912
2075
  _vitest.expect.call(void 0, err.code).toBe("not_found");
1913
2076
  }
1914
- _vitest.expect.call(void 0, destroyed, `actor ${id} should be destroyed`).toBe(
1915
- true
1916
- );
2077
+ _vitest.expect.call(void 0, destroyed, `actor ${id} should be destroyed`).toBe(true);
1917
2078
  }
1918
2079
  });
1919
2080
  _vitest.test.call(void 0, "onBeforeActorStart completes before stop proceeds", async (c) => {
@@ -1930,9 +2091,7 @@ function runActorLifecycleTests(driverTestConfig) {
1930
2091
  const { client } = await setupDriverTest(c, driverTestConfig);
1931
2092
  for (let i = 0; i < 10; i++) {
1932
2093
  const actorKey = `test-rapid-cycle-${Date.now()}-${i}`;
1933
- const actor = client.startStopRaceActor.getOrCreate([
1934
- actorKey
1935
- ]);
2094
+ const actor = client.startStopRaceActor.getOrCreate([actorKey]);
1936
2095
  const resolvePromise = actor.resolve();
1937
2096
  const destroyPromise = actor.destroy();
1938
2097
  await Promise.all([resolvePromise, destroyPromise]);
@@ -1945,9 +2104,7 @@ function runActorLifecycleTests(driverTestConfig) {
1945
2104
  const actor = client.startStopRaceActor.getOrCreate([actorKey]);
1946
2105
  const id = await actor.resolve();
1947
2106
  await actor.destroy();
1948
- const newActor = client.startStopRaceActor.getOrCreate([
1949
- actorKey
1950
- ]);
2107
+ const newActor = client.startStopRaceActor.getOrCreate([actorKey]);
1951
2108
  const result = await newActor.ping();
1952
2109
  _vitest.expect.call(void 0, result).toBe("pong");
1953
2110
  await newActor.destroy();
@@ -2014,10 +2171,7 @@ function runActorScheduleTests(driverTestConfig) {
2014
2171
  _vitest.expect.call(void 0, history1[0]).toBe("first");
2015
2172
  await waitFor(driverTestConfig, 500);
2016
2173
  const history2 = await scheduled.getTaskHistory();
2017
- _vitest.expect.call(void 0, history2.slice(0, 2)).toEqual([
2018
- "first",
2019
- "second"
2020
- ]);
2174
+ _vitest.expect.call(void 0, history2.slice(0, 2)).toEqual(["first", "second"]);
2021
2175
  await waitFor(driverTestConfig, 500);
2022
2176
  const history3 = await scheduled.getTaskHistory();
2023
2177
  _vitest.expect.call(void 0, history3).toEqual(["first", "second", "third"]);
@@ -2058,7 +2212,7 @@ function runActorSleepTests(driverTestConfig) {
2058
2212
  }
2059
2213
  await sleepActor.triggerSleep();
2060
2214
  await sleepActor.dispose();
2061
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2215
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2062
2216
  const sleepActor2 = client.sleep.getOrCreate();
2063
2217
  {
2064
2218
  const { startCount, sleepCount } = await sleepActor2.getCounts();
@@ -2074,7 +2228,7 @@ function runActorSleepTests(driverTestConfig) {
2074
2228
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2075
2229
  _vitest.expect.call(void 0, startCount).toBe(1);
2076
2230
  }
2077
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2231
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2078
2232
  {
2079
2233
  const { startCount, sleepCount } = await sleepActor.getCounts();
2080
2234
  _vitest.expect.call(void 0, sleepCount).toBe(1);
@@ -2090,7 +2244,7 @@ function runActorSleepTests(driverTestConfig) {
2090
2244
  _vitest.expect.call(void 0, startCount).toBe(1);
2091
2245
  }
2092
2246
  await sleepActor.dispose();
2093
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2247
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2094
2248
  const sleepActor2 = client.sleep.getOrCreate();
2095
2249
  {
2096
2250
  const { startCount, sleepCount } = await sleepActor2.getCounts();
@@ -2098,6 +2252,28 @@ function runActorSleepTests(driverTestConfig) {
2098
2252
  _vitest.expect.call(void 0, startCount).toBe(2);
2099
2253
  }
2100
2254
  });
2255
+ _vitest.test.call(void 0, "waitUntil can broadcast before sleep disconnect", async (c) => {
2256
+ var _a2;
2257
+ const { client } = await setupDriverTest(c, driverTestConfig);
2258
+ const sleepActor = client.sleepWithWaitUntilMessage.getOrCreate().connect();
2259
+ const receivedMessages = [];
2260
+ sleepActor.once("sleeping", (message) => {
2261
+ receivedMessages.push(message);
2262
+ });
2263
+ await sleepActor.triggerSleep();
2264
+ await waitFor(driverTestConfig, 250);
2265
+ _vitest.expect.call(void 0, receivedMessages).toHaveLength(1);
2266
+ _vitest.expect.call(void 0, (_a2 = receivedMessages[0]) == null ? void 0 : _a2.startCount).toBe(1);
2267
+ await sleepActor.dispose();
2268
+ await waitFor(driverTestConfig, 250);
2269
+ const sleepActor2 = client.sleepWithWaitUntilMessage.getOrCreate();
2270
+ {
2271
+ const { startCount, sleepCount, waitUntilMessageCount } = await sleepActor2.getCounts();
2272
+ _vitest.expect.call(void 0, waitUntilMessageCount).toBe(1);
2273
+ _vitest.expect.call(void 0, sleepCount).toBe(1);
2274
+ _vitest.expect.call(void 0, startCount).toBe(2);
2275
+ }
2276
+ });
2101
2277
  _vitest.test.call(void 0, "rpc calls keep actor awake", async (c) => {
2102
2278
  const { client } = await setupDriverTest(c, driverTestConfig);
2103
2279
  const sleepActor = client.sleep.getOrCreate();
@@ -2106,19 +2282,19 @@ function runActorSleepTests(driverTestConfig) {
2106
2282
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2107
2283
  _vitest.expect.call(void 0, startCount).toBe(1);
2108
2284
  }
2109
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT - 250);
2285
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT - 250);
2110
2286
  {
2111
2287
  const { startCount, sleepCount } = await sleepActor.getCounts();
2112
2288
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2113
2289
  _vitest.expect.call(void 0, startCount).toBe(1);
2114
2290
  }
2115
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT - 250);
2291
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT - 250);
2116
2292
  {
2117
2293
  const { startCount, sleepCount } = await sleepActor.getCounts();
2118
2294
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2119
2295
  _vitest.expect.call(void 0, startCount).toBe(1);
2120
2296
  }
2121
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2297
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2122
2298
  {
2123
2299
  const { startCount, sleepCount } = await sleepActor.getCounts();
2124
2300
  _vitest.expect.call(void 0, sleepCount).toBe(1);
@@ -2133,8 +2309,8 @@ function runActorSleepTests(driverTestConfig) {
2133
2309
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2134
2310
  _vitest.expect.call(void 0, startCount).toBe(1);
2135
2311
  }
2136
- await sleepActor.setAlarm(_chunkH5TSEPN4cjs.SLEEP_TIMEOUT - 250);
2137
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2312
+ await sleepActor.setAlarm(_chunkCMQPDBBRcjs.SLEEP_TIMEOUT - 250);
2313
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2138
2314
  {
2139
2315
  const { startCount, sleepCount } = await sleepActor.getCounts();
2140
2316
  _vitest.expect.call(void 0, sleepCount).toBe(0);
@@ -2149,8 +2325,8 @@ function runActorSleepTests(driverTestConfig) {
2149
2325
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2150
2326
  _vitest.expect.call(void 0, startCount).toBe(1);
2151
2327
  }
2152
- await sleepActor.setAlarm(_chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2153
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 200);
2328
+ await sleepActor.setAlarm(_chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2329
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 200);
2154
2330
  {
2155
2331
  const { startCount, sleepCount } = await sleepActor.getCounts();
2156
2332
  _vitest.expect.call(void 0, sleepCount).toBe(1);
@@ -2170,7 +2346,7 @@ function runActorSleepTests(driverTestConfig) {
2170
2346
  );
2171
2347
  const longRunningPromise = sleepActor.longRunningRpc();
2172
2348
  await waitPromise;
2173
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2349
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2174
2350
  await sleepActor.finishLongRunningRpc();
2175
2351
  await longRunningPromise;
2176
2352
  {
@@ -2179,7 +2355,7 @@ function runActorSleepTests(driverTestConfig) {
2179
2355
  _vitest.expect.call(void 0, startCount).toBe(1);
2180
2356
  }
2181
2357
  await sleepActor.dispose();
2182
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2358
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2183
2359
  const sleepActor2 = client.sleepWithLongRpc.getOrCreate();
2184
2360
  {
2185
2361
  const { startCount, sleepCount } = await sleepActor2.getCounts();
@@ -2211,7 +2387,7 @@ function runActorSleepTests(driverTestConfig) {
2211
2387
  }
2212
2388
  };
2213
2389
  });
2214
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2390
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2215
2391
  ws.send(JSON.stringify({ type: "getCounts" }));
2216
2392
  const counts = await new Promise((resolve) => {
2217
2393
  ws.onmessage = (event) => {
@@ -2224,7 +2400,7 @@ function runActorSleepTests(driverTestConfig) {
2224
2400
  _vitest.expect.call(void 0, counts.sleepCount).toBe(0);
2225
2401
  _vitest.expect.call(void 0, counts.startCount).toBe(1);
2226
2402
  ws.close();
2227
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2403
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2228
2404
  {
2229
2405
  const { startCount, sleepCount } = await sleepActor.getCounts();
2230
2406
  _vitest.expect.call(void 0, sleepCount).toBe(1);
@@ -2242,7 +2418,7 @@ function runActorSleepTests(driverTestConfig) {
2242
2418
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2243
2419
  _vitest.expect.call(void 0, startCount).toBe(1);
2244
2420
  }
2245
- const fetchDuration = _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250;
2421
+ const fetchDuration = _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250;
2246
2422
  const fetchPromise = sleepActor.fetch(
2247
2423
  `long-request?duration=${fetchDuration}`
2248
2424
  );
@@ -2255,7 +2431,7 @@ function runActorSleepTests(driverTestConfig) {
2255
2431
  _vitest.expect.call(void 0, startCount).toBe(1);
2256
2432
  _vitest.expect.call(void 0, requestCount).toBe(1);
2257
2433
  }
2258
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2434
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2259
2435
  {
2260
2436
  const { startCount, sleepCount } = await sleepActor.getCounts();
2261
2437
  _vitest.expect.call(void 0, sleepCount).toBe(1);
@@ -2270,19 +2446,77 @@ function runActorSleepTests(driverTestConfig) {
2270
2446
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2271
2447
  _vitest.expect.call(void 0, startCount).toBe(1);
2272
2448
  }
2273
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2449
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2274
2450
  {
2275
2451
  const { startCount, sleepCount } = await sleepActor.getCounts();
2276
2452
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2277
2453
  _vitest.expect.call(void 0, startCount).toBe(1);
2278
2454
  }
2279
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.SLEEP_TIMEOUT + 250);
2455
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2280
2456
  {
2281
2457
  const { startCount, sleepCount } = await sleepActor.getCounts();
2282
2458
  _vitest.expect.call(void 0, sleepCount).toBe(0);
2283
2459
  _vitest.expect.call(void 0, startCount).toBe(1);
2284
2460
  }
2285
2461
  });
2462
+ _vitest.test.call(void 0, "preventSleep blocks auto sleep until cleared", async (c) => {
2463
+ const { client } = await setupDriverTest(c, driverTestConfig);
2464
+ const sleepActor = client.sleepWithPreventSleep.getOrCreate();
2465
+ {
2466
+ const status = await sleepActor.getStatus();
2467
+ _vitest.expect.call(void 0, status.sleepCount).toBe(0);
2468
+ _vitest.expect.call(void 0, status.startCount).toBe(1);
2469
+ _vitest.expect.call(void 0, status.preventSleep).toBe(false);
2470
+ _vitest.expect.call(void 0, status.preventSleepOnWake).toBe(false);
2471
+ }
2472
+ _vitest.expect.call(void 0, await sleepActor.setPreventSleep(true)).toBe(true);
2473
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2474
+ {
2475
+ const status = await sleepActor.getStatus();
2476
+ _vitest.expect.call(void 0, status.sleepCount).toBe(0);
2477
+ _vitest.expect.call(void 0, status.startCount).toBe(1);
2478
+ _vitest.expect.call(void 0, status.preventSleep).toBe(true);
2479
+ }
2480
+ _vitest.expect.call(void 0, await sleepActor.setPreventSleep(false)).toBe(false);
2481
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2482
+ {
2483
+ const status = await sleepActor.getStatus();
2484
+ _vitest.expect.call(void 0, status.sleepCount).toBe(1);
2485
+ _vitest.expect.call(void 0, status.startCount).toBe(2);
2486
+ _vitest.expect.call(void 0, status.preventSleep).toBe(false);
2487
+ }
2488
+ });
2489
+ _vitest.test.call(void 0, "preventSleep can be restored during onWake", async (c) => {
2490
+ const { client } = await setupDriverTest(c, driverTestConfig);
2491
+ const sleepActor = client.sleepWithPreventSleep.getOrCreate();
2492
+ _vitest.expect.call(void 0, await sleepActor.setPreventSleepOnWake(true)).toBe(true);
2493
+ await sleepActor.triggerSleep();
2494
+ await waitFor(driverTestConfig, 250);
2495
+ {
2496
+ const status = await sleepActor.getStatus();
2497
+ _vitest.expect.call(void 0, status.sleepCount).toBe(1);
2498
+ _vitest.expect.call(void 0, status.startCount).toBe(2);
2499
+ _vitest.expect.call(void 0, status.preventSleep).toBe(true);
2500
+ _vitest.expect.call(void 0, status.preventSleepOnWake).toBe(true);
2501
+ }
2502
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2503
+ {
2504
+ const status = await sleepActor.getStatus();
2505
+ _vitest.expect.call(void 0, status.sleepCount).toBe(1);
2506
+ _vitest.expect.call(void 0, status.startCount).toBe(2);
2507
+ _vitest.expect.call(void 0, status.preventSleep).toBe(true);
2508
+ }
2509
+ _vitest.expect.call(void 0, await sleepActor.setPreventSleepOnWake(false)).toBe(false);
2510
+ _vitest.expect.call(void 0, await sleepActor.setPreventSleep(false)).toBe(false);
2511
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.SLEEP_TIMEOUT + 250);
2512
+ {
2513
+ const status = await sleepActor.getStatus();
2514
+ _vitest.expect.call(void 0, status.sleepCount).toBe(2);
2515
+ _vitest.expect.call(void 0, status.startCount).toBe(3);
2516
+ _vitest.expect.call(void 0, status.preventSleep).toBe(false);
2517
+ _vitest.expect.call(void 0, status.preventSleepOnWake).toBe(false);
2518
+ }
2519
+ });
2286
2520
  });
2287
2521
  }
2288
2522
 
@@ -2373,8 +2607,8 @@ function runActorErrorHandlingTests(driverTestConfig) {
2373
2607
  await handle.throwInternalError();
2374
2608
  _vitest.expect.call(void 0, true).toBe(false);
2375
2609
  } catch (error) {
2376
- _vitest.expect.call(void 0, error.code).toBe(_chunkL47L3ZWJcjs.INTERNAL_ERROR_CODE);
2377
- _vitest.expect.call(void 0, error.message).toBe(_chunkL47L3ZWJcjs.INTERNAL_ERROR_DESCRIPTION);
2610
+ _vitest.expect.call(void 0, error.code).toBe(_chunk6G7ZNM27cjs.INTERNAL_ERROR_CODE);
2611
+ _vitest.expect.call(void 0, error.message).toBe(_chunk6G7ZNM27cjs.INTERNAL_ERROR_DESCRIPTION);
2378
2612
  }
2379
2613
  });
2380
2614
  });
@@ -2745,26 +2979,24 @@ function runActorInspectorTests(driverTestConfig) {
2745
2979
  });
2746
2980
  _vitest.expect.call(void 0, response.status).toBe(200);
2747
2981
  const data = await response.json();
2748
- _vitest.expect.call(void 0, data).toEqual({ state: { count: 5 } });
2982
+ _vitest.expect.call(void 0, data).toEqual({
2983
+ state: { count: 5 },
2984
+ isStateEnabled: true
2985
+ });
2749
2986
  });
2750
2987
  _vitest.test.call(void 0, "PATCH /inspector/state updates actor state", async (c) => {
2751
2988
  const { client } = await setupDriverTest(c, driverTestConfig);
2752
- const handle = client.counter.getOrCreate([
2753
- "inspector-set-state"
2754
- ]);
2989
+ const handle = client.counter.getOrCreate(["inspector-set-state"]);
2755
2990
  await handle.increment(5);
2756
2991
  const gatewayUrl = await handle.getGatewayUrl();
2757
- const patchResponse = await fetch(
2758
- `${gatewayUrl}/inspector/state`,
2759
- {
2760
- method: "PATCH",
2761
- headers: {
2762
- "Content-Type": "application/json",
2763
- Authorization: "Bearer token"
2764
- },
2765
- body: JSON.stringify({ state: { count: 42 } })
2766
- }
2767
- );
2992
+ const patchResponse = await fetch(`${gatewayUrl}/inspector/state`, {
2993
+ method: "PATCH",
2994
+ headers: {
2995
+ "Content-Type": "application/json",
2996
+ Authorization: "Bearer token"
2997
+ },
2998
+ body: JSON.stringify({ state: { count: 42 } })
2999
+ });
2768
3000
  _vitest.expect.call(void 0, patchResponse.status).toBe(200);
2769
3001
  const patchData = await patchResponse.json();
2770
3002
  _vitest.expect.call(void 0, patchData).toEqual({ ok: true });
@@ -2806,9 +3038,7 @@ function runActorInspectorTests(driverTestConfig) {
2806
3038
  });
2807
3039
  _vitest.test.call(void 0, "POST /inspector/action/:name executes an action", async (c) => {
2808
3040
  const { client } = await setupDriverTest(c, driverTestConfig);
2809
- const handle = client.counter.getOrCreate([
2810
- "inspector-action"
2811
- ]);
3041
+ const handle = client.counter.getOrCreate(["inspector-action"]);
2812
3042
  await handle.increment(10);
2813
3043
  const gatewayUrl = await handle.getGatewayUrl();
2814
3044
  const response = await fetch(
@@ -2852,9 +3082,7 @@ function runActorInspectorTests(driverTestConfig) {
2852
3082
  });
2853
3083
  _vitest.test.call(void 0, "GET /inspector/traces returns trace data", async (c) => {
2854
3084
  const { client } = await setupDriverTest(c, driverTestConfig);
2855
- const handle = client.counter.getOrCreate([
2856
- "inspector-traces"
2857
- ]);
3085
+ const handle = client.counter.getOrCreate(["inspector-traces"]);
2858
3086
  await handle.increment(1);
2859
3087
  const gatewayUrl = await handle.getGatewayUrl();
2860
3088
  const response = await fetch(
@@ -2871,9 +3099,7 @@ function runActorInspectorTests(driverTestConfig) {
2871
3099
  });
2872
3100
  _vitest.test.call(void 0, "GET /inspector/workflow-history returns workflow status", async (c) => {
2873
3101
  const { client } = await setupDriverTest(c, driverTestConfig);
2874
- const handle = client.counter.getOrCreate([
2875
- "inspector-workflow"
2876
- ]);
3102
+ const handle = client.counter.getOrCreate(["inspector-workflow"]);
2877
3103
  await handle.increment(0);
2878
3104
  const gatewayUrl = await handle.getGatewayUrl();
2879
3105
  const response = await fetch(
@@ -2889,21 +3115,97 @@ function runActorInspectorTests(driverTestConfig) {
2889
3115
  _vitest.expect.call(void 0, data.isWorkflowEnabled).toBe(false);
2890
3116
  _vitest.expect.call(void 0, data.history).toBeNull();
2891
3117
  });
2892
- _vitest.test.call(void 0, "GET /inspector/summary returns full actor snapshot", async (c) => {
3118
+ _vitest.test.call(void 0, "GET /inspector/database/schema returns SQLite schema", async (c) => {
2893
3119
  const { client } = await setupDriverTest(c, driverTestConfig);
2894
- const handle = client.counter.getOrCreate([
2895
- "inspector-summary"
3120
+ const handle = client.dbActorRaw.getOrCreate([
3121
+ `inspector-database-schema-${crypto.randomUUID()}`
2896
3122
  ]);
2897
- await handle.increment(7);
3123
+ await handle.insertValue("Alice");
3124
+ await handle.insertValue("Bob");
3125
+ const gatewayUrl = await handle.getGatewayUrl();
3126
+ const response = await fetch(
3127
+ `${gatewayUrl}/inspector/database/schema`,
3128
+ {
3129
+ headers: { Authorization: "Bearer token" }
3130
+ }
3131
+ );
3132
+ _vitest.expect.call(void 0, response.status).toBe(200);
3133
+ const data = await response.json();
3134
+ _vitest.expect.call(void 0, Array.isArray(data.schema.tables)).toBe(true);
3135
+ const testDataTable = data.schema.tables.find(
3136
+ (table) => table.table.name === "test_data"
3137
+ );
3138
+ _vitest.expect.call(void 0, testDataTable).toBeDefined();
3139
+ _vitest.expect.call(void 0, testDataTable == null ? void 0 : testDataTable.table.schema).toBe("main");
3140
+ _vitest.expect.call(void 0, testDataTable == null ? void 0 : testDataTable.table.type).toBe("table");
3141
+ _vitest.expect.call(void 0, testDataTable == null ? void 0 : testDataTable.records).toBe(2);
3142
+ _vitest.expect.call(void 0, testDataTable == null ? void 0 : testDataTable.columns.map((column) => column.name)).toEqual(
3143
+ ["id", "value", "payload", "created_at"]
3144
+ );
3145
+ });
3146
+ _vitest.test.call(void 0, "GET /inspector/workflow-history returns populated history for active workflows", async (c) => {
3147
+ var _a, _b, _c;
3148
+ const { client } = await setupDriverTest(c, driverTestConfig);
3149
+ const handle = client.workflowCounterActor.getOrCreate([
3150
+ "inspector-workflow-active"
3151
+ ]);
3152
+ let state = await handle.getState();
3153
+ for (let i = 0; i < 40 && (state.runCount === 0 || state.history.length === 0); i++) {
3154
+ await waitFor(driverTestConfig, 50);
3155
+ state = await handle.getState();
3156
+ }
3157
+ _vitest.expect.call(void 0, state.runCount).toBeGreaterThan(0);
3158
+ _vitest.expect.call(void 0, state.history.length).toBeGreaterThan(0);
3159
+ const gatewayUrl = await handle.getGatewayUrl();
3160
+ const response = await fetch(
3161
+ `${gatewayUrl}/inspector/workflow-history`,
3162
+ {
3163
+ headers: { Authorization: "Bearer token" }
3164
+ }
3165
+ );
3166
+ _vitest.expect.call(void 0, response.status).toBe(200);
3167
+ const data = await response.json();
3168
+ _vitest.expect.call(void 0, data.isWorkflowEnabled).toBe(true);
3169
+ _vitest.expect.call(void 0, data.history).not.toBeNull();
3170
+ _vitest.expect.call(void 0, (_a = data.history) == null ? void 0 : _a.nameRegistry.length).toBeGreaterThan(0);
3171
+ _vitest.expect.call(void 0, (_b = data.history) == null ? void 0 : _b.entries.length).toBeGreaterThan(0);
3172
+ _vitest.expect.call(void 0,
3173
+ Object.keys(_nullishCoalesce(((_c = data.history) == null ? void 0 : _c.entryMetadata), () => ( {}))).length
3174
+ ).toBeGreaterThan(0);
3175
+ });
3176
+ _vitest.test.call(void 0, "GET /inspector/database/rows returns SQLite rows", async (c) => {
3177
+ var _a, _b, _c, _d;
3178
+ const { client } = await setupDriverTest(c, driverTestConfig);
3179
+ const handle = client.dbActorRaw.getOrCreate([
3180
+ `inspector-database-rows-${crypto.randomUUID()}`
3181
+ ]);
3182
+ await handle.insertValue("Alice");
3183
+ await handle.insertValue("Bob");
2898
3184
  const gatewayUrl = await handle.getGatewayUrl();
2899
3185
  const response = await fetch(
2900
- `${gatewayUrl}/inspector/summary`,
3186
+ `${gatewayUrl}/inspector/database/rows?table=test_data&limit=1&offset=1`,
2901
3187
  {
2902
3188
  headers: { Authorization: "Bearer token" }
2903
3189
  }
2904
3190
  );
2905
3191
  _vitest.expect.call(void 0, response.status).toBe(200);
2906
3192
  const data = await response.json();
3193
+ _vitest.expect.call(void 0, data.rows).toHaveLength(1);
3194
+ _vitest.expect.call(void 0, (_a = data.rows[0]) == null ? void 0 : _a.id).toBe(2);
3195
+ _vitest.expect.call(void 0, (_b = data.rows[0]) == null ? void 0 : _b.value).toBe("Bob");
3196
+ _vitest.expect.call(void 0, (_c = data.rows[0]) == null ? void 0 : _c.payload).toBe("");
3197
+ _vitest.expect.call(void 0, typeof ((_d = data.rows[0]) == null ? void 0 : _d.created_at)).toBe("number");
3198
+ });
3199
+ _vitest.test.call(void 0, "GET /inspector/summary returns full actor snapshot", async (c) => {
3200
+ const { client } = await setupDriverTest(c, driverTestConfig);
3201
+ const handle = client.counter.getOrCreate(["inspector-summary"]);
3202
+ await handle.increment(7);
3203
+ const gatewayUrl = await handle.getGatewayUrl();
3204
+ const response = await fetch(`${gatewayUrl}/inspector/summary`, {
3205
+ headers: { Authorization: "Bearer token" }
3206
+ });
3207
+ _vitest.expect.call(void 0, response.status).toBe(200);
3208
+ const data = await response.json();
2907
3209
  _vitest.expect.call(void 0, data.state).toEqual({ count: 7 });
2908
3210
  _vitest.expect.call(void 0, Array.isArray(data.connections)).toBe(true);
2909
3211
  _vitest.expect.call(void 0, data.rpcs).toContain("increment");
@@ -2913,11 +3215,34 @@ function runActorInspectorTests(driverTestConfig) {
2913
3215
  _vitest.expect.call(void 0, data.isWorkflowEnabled).toBe(false);
2914
3216
  _vitest.expect.call(void 0, data.workflowHistory).toBeNull();
2915
3217
  });
2916
- _vitest.test.call(void 0, "inspector endpoints require auth in non-dev mode", async (c) => {
3218
+ _vitest.test.call(void 0, "GET /inspector/summary returns populated workflow history for active workflows", async (c) => {
3219
+ var _a, _b, _c;
2917
3220
  const { client } = await setupDriverTest(c, driverTestConfig);
2918
- const handle = client.counter.getOrCreate([
2919
- "inspector-auth"
3221
+ const handle = client.workflowCounterActor.getOrCreate([
3222
+ "inspector-summary-workflow"
2920
3223
  ]);
3224
+ let state = await handle.getState();
3225
+ for (let i = 0; i < 40 && (state.runCount === 0 || state.history.length === 0); i++) {
3226
+ await waitFor(driverTestConfig, 50);
3227
+ state = await handle.getState();
3228
+ }
3229
+ const gatewayUrl = await handle.getGatewayUrl();
3230
+ const response = await fetch(`${gatewayUrl}/inspector/summary`, {
3231
+ headers: { Authorization: "Bearer token" }
3232
+ });
3233
+ _vitest.expect.call(void 0, response.status).toBe(200);
3234
+ const data = await response.json();
3235
+ _vitest.expect.call(void 0, data.isWorkflowEnabled).toBe(true);
3236
+ _vitest.expect.call(void 0, data.workflowHistory).not.toBeNull();
3237
+ _vitest.expect.call(void 0, (_a = data.workflowHistory) == null ? void 0 : _a.nameRegistry.length).toBeGreaterThan(0);
3238
+ _vitest.expect.call(void 0, (_b = data.workflowHistory) == null ? void 0 : _b.entries.length).toBeGreaterThan(0);
3239
+ _vitest.expect.call(void 0,
3240
+ Object.keys(_nullishCoalesce(((_c = data.workflowHistory) == null ? void 0 : _c.entryMetadata), () => ( {}))).length
3241
+ ).toBeGreaterThan(0);
3242
+ });
3243
+ _vitest.test.call(void 0, "inspector endpoints require auth in non-dev mode", async (c) => {
3244
+ const { client } = await setupDriverTest(c, driverTestConfig);
3245
+ const handle = client.counter.getOrCreate(["inspector-auth"]);
2921
3246
  await handle.increment(0);
2922
3247
  const gatewayUrl = await handle.getGatewayUrl();
2923
3248
  const response = await fetch(`${gatewayUrl}/inspector/state`, {
@@ -2938,7 +3263,9 @@ function runActorKvTests(driverTestConfig) {
2938
3263
  driverTestConfig
2939
3264
  );
2940
3265
  const client = rawClient;
2941
- const kvHandle = client.kvActor.getOrCreate(["kv-text"]);
3266
+ const kvHandle = client.kvActor.getOrCreate([
3267
+ "kv-text"
3268
+ ]);
2942
3269
  await kvHandle.putText("greeting", "hello");
2943
3270
  const value = await kvHandle.getText("greeting");
2944
3271
  _vitest.expect.call(void 0, value).toBe("hello");
@@ -2951,44 +3278,70 @@ function runActorKvTests(driverTestConfig) {
2951
3278
  { key: "prefix-b", value: "beta" }
2952
3279
  ]);
2953
3280
  });
2954
- _vitest.test.call(void 0,
2955
- "supports arrayBuffer encoding and decoding",
2956
- async (c) => {
2957
- const { client: rawClient } = await setupDriverTest(
2958
- c,
2959
- driverTestConfig
2960
- );
2961
- const client = rawClient;
2962
- const kvHandle = client.kvActor.getOrCreate([
2963
- "kv-array-buffer"
2964
- ]);
2965
- const values = await kvHandle.roundtripArrayBuffer("bytes", [
2966
- 4,
2967
- 8,
2968
- 15,
2969
- 16,
2970
- 23,
2971
- 42
2972
- ]);
2973
- _vitest.expect.call(void 0, values).toEqual([4, 8, 15, 16, 23, 42]);
2974
- }
2975
- );
2976
- });
2977
- }
2978
-
2979
- // src/driver-test-suite/tests/actor-metadata.ts
2980
-
2981
- function runActorMetadataTests(driverTestConfig) {
2982
- _vitest.describe.call(void 0, "Actor Metadata Tests", () => {
2983
- _vitest.describe.call(void 0, "Actor Name", () => {
2984
- _vitest.test.call(void 0, "should provide access to actor name", async (c) => {
2985
- const { client } = await setupDriverTest(c, driverTestConfig);
2986
- const handle = client.metadataActor.getOrCreate();
2987
- const actorName = await handle.getActorName();
2988
- _vitest.expect.call(void 0, actorName).toBe("metadataActor");
2989
- });
2990
- _vitest.test.call(void 0, "should preserve actor name in state during onWake", async (c) => {
2991
- const { client } = await setupDriverTest(c, driverTestConfig);
3281
+ _vitest.test.call(void 0, "supports range scans and range deletes", async (c) => {
3282
+ const { client: rawClient } = await setupDriverTest(
3283
+ c,
3284
+ driverTestConfig
3285
+ );
3286
+ const client = rawClient;
3287
+ const kvHandle = client.kvActor.getOrCreate([
3288
+ "kv-range"
3289
+ ]);
3290
+ await kvHandle.putText("a", "alpha");
3291
+ await kvHandle.putText("b", "bravo");
3292
+ await kvHandle.putText("c", "charlie");
3293
+ await kvHandle.putText("d", "delta");
3294
+ const range = await kvHandle.listTextRange("b", "d");
3295
+ _vitest.expect.call(void 0, range).toEqual([
3296
+ { key: "b", value: "bravo" },
3297
+ { key: "c", value: "charlie" }
3298
+ ]);
3299
+ const reversed = await kvHandle.listTextRange("a", "d", {
3300
+ reverse: true,
3301
+ limit: 2
3302
+ });
3303
+ _vitest.expect.call(void 0, reversed).toEqual([
3304
+ { key: "c", value: "charlie" },
3305
+ { key: "b", value: "bravo" }
3306
+ ]);
3307
+ await kvHandle.deleteTextRange("b", "d");
3308
+ const remaining = await kvHandle.listText("");
3309
+ _vitest.expect.call(void 0, remaining).toEqual([
3310
+ { key: "a", value: "alpha" },
3311
+ { key: "d", value: "delta" }
3312
+ ]);
3313
+ });
3314
+ _vitest.test.call(void 0, "supports arrayBuffer encoding and decoding", async (c) => {
3315
+ const { client: rawClient } = await setupDriverTest(
3316
+ c,
3317
+ driverTestConfig
3318
+ );
3319
+ const client = rawClient;
3320
+ const kvHandle = client.kvActor.getOrCreate([
3321
+ "kv-array-buffer"
3322
+ ]);
3323
+ const values = await kvHandle.roundtripArrayBuffer(
3324
+ "bytes",
3325
+ [4, 8, 15, 16, 23, 42]
3326
+ );
3327
+ _vitest.expect.call(void 0, values).toEqual([4, 8, 15, 16, 23, 42]);
3328
+ });
3329
+ });
3330
+ }
3331
+
3332
+ // src/driver-test-suite/tests/actor-metadata.ts
3333
+
3334
+ function runActorMetadataTests(driverTestConfig) {
3335
+ _vitest.describe.call(void 0, "Actor Metadata Tests", () => {
3336
+ _vitest.describe.call(void 0, "Actor Name", () => {
3337
+ _vitest.test.call(void 0, "should provide access to actor name", async (c) => {
3338
+ const { client } = await setupDriverTest(c, driverTestConfig);
3339
+ const handle = client.metadataActor.getOrCreate();
3340
+ const actorName = await handle.getActorName();
3341
+ _vitest.expect.call(void 0, actorName).toBe("metadataActor");
3342
+ });
3343
+ _vitest.test.call(void 0, "should preserve actor name in state during onWake", async (c) => {
3344
+ const { client } = await setupDriverTest(c, driverTestConfig);
2992
3345
  const handle = client.metadataActor.getOrCreate();
2993
3346
  const storedName = await handle.getStoredActorName();
2994
3347
  _vitest.expect.call(void 0, storedName).toBe("metadataActor");
@@ -3110,6 +3463,49 @@ function runActorOnStateChangeTests(driverTestConfig) {
3110
3463
 
3111
3464
  function runActorQueueTests(driverTestConfig) {
3112
3465
  _vitest.describe.call(void 0, "Actor Queue Tests", () => {
3466
+ async function expectManyQueueChildToDrain(handle, key) {
3467
+ const child = handle.getOrCreate([key]);
3468
+ const conn = child.connect();
3469
+ const messageCount = _chunkCMQPDBBRcjs.MANY_QUEUE_NAMES.length * 4;
3470
+ try {
3471
+ _vitest.expect.call(void 0, await conn.ping()).toEqual(
3472
+ _vitest.expect.objectContaining({
3473
+ pong: true
3474
+ })
3475
+ );
3476
+ await Promise.all(
3477
+ Array.from(
3478
+ { length: messageCount },
3479
+ (_, index) => child.send(
3480
+ _chunkCMQPDBBRcjs.MANY_QUEUE_NAMES[index % _chunkCMQPDBBRcjs.MANY_QUEUE_NAMES.length],
3481
+ { index }
3482
+ )
3483
+ )
3484
+ );
3485
+ let snapshot = await child.getSnapshot();
3486
+ for (let i = 0; i < 60 && snapshot.processed.length < messageCount; i++) {
3487
+ await waitFor(driverTestConfig, 100);
3488
+ snapshot = await child.getSnapshot();
3489
+ }
3490
+ _vitest.expect.call(void 0, snapshot.started).toBe(true);
3491
+ _vitest.expect.call(void 0, snapshot.processed).toHaveLength(messageCount);
3492
+ _vitest.expect.call(void 0, new Set(snapshot.processed)).toEqual(
3493
+ new Set(_chunkCMQPDBBRcjs.MANY_QUEUE_NAMES)
3494
+ );
3495
+ _vitest.expect.call(void 0,
3496
+ await child.send(
3497
+ _chunkCMQPDBBRcjs.MANY_QUEUE_NAMES[0],
3498
+ { index: messageCount },
3499
+ { wait: true, timeout: 1e3 }
3500
+ )
3501
+ ).toEqual({
3502
+ status: "completed",
3503
+ response: { ok: true, index: messageCount }
3504
+ });
3505
+ } finally {
3506
+ await conn.dispose().catch(() => void 0);
3507
+ }
3508
+ }
3113
3509
  _vitest.test.call(void 0, "client can send to actor queue", async (c) => {
3114
3510
  const { client } = await setupDriverTest(c, driverTestConfig);
3115
3511
  const handle = client.queueActor.getOrCreate(["client-send"]);
@@ -3282,6 +3678,44 @@ function runActorQueueTests(driverTestConfig) {
3282
3678
  const result = await resultPromise;
3283
3679
  _vitest.expect.call(void 0, result.status).toBe("timedOut");
3284
3680
  });
3681
+ _vitest.test.call(void 0,
3682
+ "drains many-queue child actors created from actions while connected",
3683
+ async (c) => {
3684
+ const { client } = await setupDriverTest(c, driverTestConfig);
3685
+ const parent = client.manyQueueActionParentActor.getOrCreate([
3686
+ "many-action-parent"
3687
+ ]);
3688
+ _vitest.expect.call(void 0, await parent.spawnChild("many-action-child")).toEqual({
3689
+ key: "many-action-child"
3690
+ });
3691
+ await expectManyQueueChildToDrain(
3692
+ client.manyQueueChildActor,
3693
+ "many-action-child"
3694
+ );
3695
+ }
3696
+ );
3697
+ _vitest.test.call(void 0,
3698
+ "drains many-queue child actors created from run handlers while connected",
3699
+ async (c) => {
3700
+ const { client } = await setupDriverTest(c, driverTestConfig);
3701
+ const parent = client.manyQueueRunParentActor.getOrCreate([
3702
+ "many-run-parent"
3703
+ ]);
3704
+ _vitest.expect.call(void 0, await parent.queueSpawn("many-run-child")).toEqual({
3705
+ queued: true
3706
+ });
3707
+ let spawned = await parent.getSpawned();
3708
+ for (let i = 0; i < 30 && !spawned.includes("many-run-child"); i++) {
3709
+ await waitFor(driverTestConfig, 100);
3710
+ spawned = await parent.getSpawned();
3711
+ }
3712
+ _vitest.expect.call(void 0, spawned).toContain("many-run-child");
3713
+ await expectManyQueueChildToDrain(
3714
+ client.manyQueueChildActor,
3715
+ "many-run-child"
3716
+ );
3717
+ }
3718
+ );
3285
3719
  _vitest.test.call(void 0, "manual receive retries message when not completed", async (c) => {
3286
3720
  const { client } = await setupDriverTest(c, driverTestConfig);
3287
3721
  const handle = client.queueActor.getOrCreate([
@@ -3290,7 +3724,9 @@ function runActorQueueTests(driverTestConfig) {
3290
3724
  await handle.send("tasks", { value: 789 });
3291
3725
  const first = await handle.receiveWithoutComplete("tasks");
3292
3726
  _vitest.expect.call(void 0, first).toEqual({ name: "tasks", body: { value: 789 } });
3293
- const retried = await handle.receiveOne("tasks", { timeout: 1e3 });
3727
+ const retried = await handle.receiveOne("tasks", {
3728
+ timeout: 1e3
3729
+ });
3294
3730
  _vitest.expect.call(void 0, retried).toEqual({ name: "tasks", body: { value: 789 } });
3295
3731
  });
3296
3732
  _vitest.test.call(void 0, "next throws when previous manual message is not completed", async (c) => {
@@ -3299,9 +3735,7 @@ function runActorQueueTests(driverTestConfig) {
3299
3735
  "manual-next-requires-complete"
3300
3736
  ]);
3301
3737
  await handle.send("tasks", { value: 111 });
3302
- const result = await handle.receiveManualThenNextWithoutComplete(
3303
- "tasks"
3304
- );
3738
+ const result = await handle.receiveManualThenNextWithoutComplete("tasks");
3305
3739
  _vitest.expect.call(void 0, result).toEqual({
3306
3740
  group: "queue",
3307
3741
  code: "previous_message_not_completed"
@@ -3331,9 +3765,7 @@ function runActorQueueTests(driverTestConfig) {
3331
3765
  });
3332
3766
  _vitest.test.call(void 0, "complete throws when called twice", async (c) => {
3333
3767
  const { client } = await setupDriverTest(c, driverTestConfig);
3334
- const handle = client.queueActor.getOrCreate([
3335
- "complete-twice"
3336
- ]);
3768
+ const handle = client.queueActor.getOrCreate(["complete-twice"]);
3337
3769
  await handle.send("twice", { value: "test" });
3338
3770
  const result = await handle.receiveAndCompleteTwice("twice");
3339
3771
  _vitest.expect.call(void 0, result).toEqual({
@@ -3398,14 +3830,12 @@ function runActorRunTests(driverTestConfig) {
3398
3830
  });
3399
3831
  _vitest.test.call(void 0, "active run handler keeps actor awake past sleep timeout", async (c) => {
3400
3832
  const { client } = await setupDriverTest(c, driverTestConfig);
3401
- const actor = client.runWithTicks.getOrCreate([
3402
- "run-stays-awake"
3403
- ]);
3833
+ const actor = client.runWithTicks.getOrCreate(["run-stays-awake"]);
3404
3834
  await waitFor(driverTestConfig, 100);
3405
3835
  const state1 = await actor.getState();
3406
3836
  _vitest.expect.call(void 0, state1.runStarted).toBe(true);
3407
3837
  const tickCount1 = state1.tickCount;
3408
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.RUN_SLEEP_TIMEOUT + 300);
3838
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.RUN_SLEEP_TIMEOUT + 300);
3409
3839
  const state2 = await actor.getState();
3410
3840
  _vitest.expect.call(void 0, state2.runStarted).toBe(true);
3411
3841
  _vitest.expect.call(void 0, state2.runExited).toBe(false);
@@ -3418,7 +3848,7 @@ function runActorRunTests(driverTestConfig) {
3418
3848
  ]);
3419
3849
  const state = await actor.getState();
3420
3850
  _vitest.expect.call(void 0, state.wakeCount).toBe(1);
3421
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.RUN_SLEEP_TIMEOUT + 300);
3851
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.RUN_SLEEP_TIMEOUT + 300);
3422
3852
  const state2 = await actor.getState();
3423
3853
  _vitest.expect.call(void 0, state2.wakeCount).toBe(2);
3424
3854
  });
@@ -3456,37 +3886,121 @@ function runActorRunTests(driverTestConfig) {
3456
3886
  await waitFor(driverTestConfig, 100);
3457
3887
  const state1 = await actor.getState();
3458
3888
  _vitest.expect.call(void 0, state1.runStarted).toBe(true);
3459
- await waitFor(driverTestConfig, _chunkH5TSEPN4cjs.RUN_SLEEP_TIMEOUT + 500);
3889
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.RUN_SLEEP_TIMEOUT + 500);
3460
3890
  const state2 = await actor.getState();
3461
3891
  _vitest.expect.call(void 0, state2.wakeCount).toBeGreaterThan(state1.wakeCount);
3462
3892
  });
3463
- _vitest.test.call(void 0, "run handler that exits early triggers destroy", async (c) => {
3893
+ _vitest.test.call(void 0, "run handler that exits early sleeps instead of destroying", async (c) => {
3894
+ var _a2;
3464
3895
  const { client } = await setupDriverTest(c, driverTestConfig);
3465
3896
  const actor = client.runWithEarlyExit.getOrCreate(["early-exit"]);
3466
3897
  await waitFor(driverTestConfig, 100);
3467
3898
  const state1 = await actor.getState();
3468
3899
  _vitest.expect.call(void 0, state1.runStarted).toBe(true);
3469
- await waitFor(driverTestConfig, 300);
3470
- const actor2 = client.runWithEarlyExit.getOrCreate([
3471
- "early-exit-fresh"
3472
- ]);
3473
- const state2 = await actor2.getState();
3900
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.RUN_SLEEP_TIMEOUT + 400);
3901
+ const state2 = await actor.getState();
3474
3902
  _vitest.expect.call(void 0, state2.runStarted).toBe(true);
3903
+ _vitest.expect.call(void 0, state2.destroyCalled).toBe(false);
3904
+ if ((_a2 = driverTestConfig.skip) == null ? void 0 : _a2.sleep) {
3905
+ _vitest.expect.call(void 0, state2.sleepCount).toBe(0);
3906
+ _vitest.expect.call(void 0, state2.wakeCount).toBe(1);
3907
+ } else {
3908
+ _vitest.expect.call(void 0, state2.sleepCount).toBeGreaterThan(0);
3909
+ _vitest.expect.call(void 0, state2.wakeCount).toBeGreaterThan(1);
3910
+ }
3475
3911
  });
3476
- _vitest.test.call(void 0, "run handler that throws error triggers destroy", async (c) => {
3912
+ _vitest.test.call(void 0, "run handler that throws error sleeps instead of destroying", async (c) => {
3913
+ var _a2;
3477
3914
  const { client } = await setupDriverTest(c, driverTestConfig);
3478
3915
  const actor = client.runWithError.getOrCreate(["run-error"]);
3479
3916
  await waitFor(driverTestConfig, 100);
3480
3917
  const state1 = await actor.getState();
3481
3918
  _vitest.expect.call(void 0, state1.runStarted).toBe(true);
3482
- await waitFor(driverTestConfig, 300);
3483
- const actor2 = client.runWithError.getOrCreate(["run-error-fresh"]);
3484
- const state2 = await actor2.getState();
3919
+ await waitFor(driverTestConfig, _chunkCMQPDBBRcjs.RUN_SLEEP_TIMEOUT + 400);
3920
+ const state2 = await actor.getState();
3485
3921
  _vitest.expect.call(void 0, state2.runStarted).toBe(true);
3922
+ _vitest.expect.call(void 0, state2.destroyCalled).toBe(false);
3923
+ if ((_a2 = driverTestConfig.skip) == null ? void 0 : _a2.sleep) {
3924
+ _vitest.expect.call(void 0, state2.sleepCount).toBe(0);
3925
+ _vitest.expect.call(void 0, state2.wakeCount).toBe(1);
3926
+ } else {
3927
+ _vitest.expect.call(void 0, state2.sleepCount).toBeGreaterThan(0);
3928
+ _vitest.expect.call(void 0, state2.wakeCount).toBeGreaterThan(1);
3929
+ }
3486
3930
  });
3487
3931
  });
3488
3932
  }
3489
3933
 
3934
+ // src/driver-test-suite/tests/actor-sandbox.ts
3935
+
3936
+ function runActorSandboxTests(driverTestConfig) {
3937
+ var _a;
3938
+ _vitest.describe.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.sandbox)("Actor Sandbox Tests", () => {
3939
+ _vitest.test.call(void 0, "supports sandbox actions through the actor runtime", async (c) => {
3940
+ const { client } = await setupDriverTest(c, driverTestConfig);
3941
+ const sandbox = client.dockerSandboxActor.getOrCreate([
3942
+ `sandbox-${crypto.randomUUID()}`
3943
+ ]);
3944
+ const decoder = new TextDecoder();
3945
+ const health = await _vitest.vi.waitFor(
3946
+ async () => {
3947
+ return await sandbox.getHealth();
3948
+ },
3949
+ {
3950
+ timeout: 12e4,
3951
+ interval: 500
3952
+ }
3953
+ );
3954
+ _vitest.expect.call(void 0, typeof health.status).toBe("string");
3955
+ const { url } = await sandbox.getSandboxUrl();
3956
+ _vitest.expect.call(void 0, url).toMatch(/^https?:\/\//);
3957
+ await sandbox.mkdirFs({ path: "/root/tmp" });
3958
+ await sandbox.writeFsFile(
3959
+ { path: "/root/tmp/hello.txt" },
3960
+ "sandbox actor driver test"
3961
+ );
3962
+ _vitest.expect.call(void 0,
3963
+ decoder.decode(
3964
+ await sandbox.readFsFile({ path: "/root/tmp/hello.txt" })
3965
+ )
3966
+ ).toBe("sandbox actor driver test");
3967
+ const stat = await sandbox.statFs({ path: "/root/tmp/hello.txt" });
3968
+ _vitest.expect.call(void 0, stat.entryType).toBe("file");
3969
+ await sandbox.moveFs({
3970
+ from: "/root/tmp/hello.txt",
3971
+ to: "/root/tmp/renamed.txt"
3972
+ });
3973
+ _vitest.expect.call(void 0,
3974
+ (await sandbox.listFsEntries({ path: "/root/tmp" })).map(
3975
+ (entry) => entry.name
3976
+ )
3977
+ ).toContain("renamed.txt");
3978
+ await sandbox.dispose();
3979
+ const healthAfterDispose = await _vitest.vi.waitFor(
3980
+ async () => {
3981
+ return await sandbox.getHealth();
3982
+ },
3983
+ {
3984
+ timeout: 12e4,
3985
+ interval: 500
3986
+ }
3987
+ );
3988
+ _vitest.expect.call(void 0, typeof healthAfterDispose.status).toBe("string");
3989
+ _vitest.expect.call(void 0,
3990
+ decoder.decode(
3991
+ await sandbox.readFsFile({ path: "/root/tmp/renamed.txt" })
3992
+ )
3993
+ ).toBe("sandbox actor driver test");
3994
+ await sandbox.deleteFsEntry({ path: "/root/tmp", recursive: true });
3995
+ _vitest.expect.call(void 0, await sandbox.listFsEntries({ path: "/root" })).not.toEqual(
3996
+ _vitest.expect.arrayContaining([
3997
+ _vitest.expect.objectContaining({ name: "tmp" })
3998
+ ])
3999
+ );
4000
+ }, 18e4);
4001
+ });
4002
+ }
4003
+
3490
4004
  // src/driver-test-suite/tests/actor-stateless.ts
3491
4005
 
3492
4006
  function runActorStatelessTests(driverTestConfig) {
@@ -3606,7 +4120,7 @@ function runActorVarsTests(driverTestConfig) {
3606
4120
 
3607
4121
  function runActorWorkflowTests(driverTestConfig) {
3608
4122
  _vitest.describe.call(void 0, "Actor Workflow Tests", () => {
3609
- var _a;
4123
+ var _a, _b, _c, _d;
3610
4124
  _vitest.test.call(void 0, "replays steps and guards state access", async (c) => {
3611
4125
  const { client } = await setupDriverTest(c, driverTestConfig);
3612
4126
  const actor = client.workflowCounterActor.getOrCreate([
@@ -3626,8 +4140,10 @@ function runActorWorkflowTests(driverTestConfig) {
3626
4140
  });
3627
4141
  _vitest.test.call(void 0, "consumes queue messages via workflow queue.next", async (c) => {
3628
4142
  const { client } = await setupDriverTest(c, driverTestConfig);
3629
- const actor = client.workflowQueueActor.getOrCreate(["workflow-queue"]);
3630
- await actor.send(_chunkH5TSEPN4cjs.WORKFLOW_QUEUE_NAME, {
4143
+ const actor = client.workflowQueueActor.getOrCreate([
4144
+ "workflow-queue"
4145
+ ]);
4146
+ await actor.send(_chunkCMQPDBBRcjs.WORKFLOW_QUEUE_NAME, {
3631
4147
  hello: "world"
3632
4148
  });
3633
4149
  await waitFor(driverTestConfig, 200);
@@ -3645,6 +4161,118 @@ function runActorWorkflowTests(driverTestConfig) {
3645
4161
  response: { echo: { value: 123 } }
3646
4162
  });
3647
4163
  });
4164
+ for (const testCase of [
4165
+ {
4166
+ name: "nested loops",
4167
+ key: "loop",
4168
+ getActor: (client) => client.workflowNestedLoopActor,
4169
+ firstItems: ["a", "b"],
4170
+ secondItems: ["c"],
4171
+ expected: ["a", "b", "c"]
4172
+ },
4173
+ {
4174
+ name: "nested joins",
4175
+ key: "join",
4176
+ getActor: (client) => client.workflowNestedJoinActor,
4177
+ firstItems: ["a", "b"],
4178
+ secondItems: ["c"],
4179
+ expected: ["a", "b", "c"]
4180
+ },
4181
+ {
4182
+ name: "nested races",
4183
+ key: "race",
4184
+ getActor: (client) => client.workflowNestedRaceActor,
4185
+ firstItems: ["a"],
4186
+ secondItems: ["b"],
4187
+ expected: ["a", "b"]
4188
+ }
4189
+ ]) {
4190
+ _vitest.test.call(void 0,
4191
+ `replays ${testCase.name} across workflow queue iterations`,
4192
+ async (c) => {
4193
+ const { client } = await setupDriverTest(
4194
+ c,
4195
+ driverTestConfig
4196
+ );
4197
+ const actor = testCase.getActor(client).getOrCreate([
4198
+ `workflow-nested-${testCase.key}`
4199
+ ]);
4200
+ const first = await actor.send(
4201
+ _chunkCMQPDBBRcjs.WORKFLOW_NESTED_QUEUE_NAME,
4202
+ {
4203
+ items: testCase.firstItems
4204
+ },
4205
+ {
4206
+ wait: true,
4207
+ timeout: 1e3
4208
+ }
4209
+ );
4210
+ _vitest.expect.call(void 0, first).toEqual({
4211
+ status: "completed",
4212
+ response: {
4213
+ processed: testCase.firstItems.length
4214
+ }
4215
+ });
4216
+ const second = await actor.send(
4217
+ _chunkCMQPDBBRcjs.WORKFLOW_NESTED_QUEUE_NAME,
4218
+ {
4219
+ items: testCase.secondItems
4220
+ },
4221
+ {
4222
+ wait: true,
4223
+ timeout: 1e3
4224
+ }
4225
+ );
4226
+ _vitest.expect.call(void 0, second).toEqual({
4227
+ status: "completed",
4228
+ response: {
4229
+ processed: testCase.secondItems.length
4230
+ }
4231
+ });
4232
+ const state = await actor.getState();
4233
+ _vitest.expect.call(void 0, state.processed).toEqual(testCase.expected);
4234
+ }
4235
+ );
4236
+ }
4237
+ _vitest.test.call(void 0,
4238
+ "starts child workflows created inside workflow steps",
4239
+ async (c) => {
4240
+ const { client } = await setupDriverTest(
4241
+ c,
4242
+ driverTestConfig
4243
+ );
4244
+ const parent = client.workflowSpawnParentActor.getOrCreate([
4245
+ "workflow-spawn-parent"
4246
+ ]);
4247
+ _vitest.expect.call(void 0, await parent.triggerSpawn("child-1")).toEqual({
4248
+ queued: true
4249
+ });
4250
+ let parentState = await parent.getState();
4251
+ for (let i = 0; i < 30 && parentState.results.length === 0; i++) {
4252
+ await waitFor(driverTestConfig, 100);
4253
+ parentState = await parent.getState();
4254
+ }
4255
+ _vitest.expect.call(void 0, parentState.results).toEqual([
4256
+ {
4257
+ key: "child-1",
4258
+ result: {
4259
+ status: "completed",
4260
+ response: { ok: true }
4261
+ },
4262
+ error: null
4263
+ }
4264
+ ]);
4265
+ const child = client.workflowSpawnChildActor.getOrCreate([
4266
+ "child-1"
4267
+ ]);
4268
+ const childState = await child.getState();
4269
+ _vitest.expect.call(void 0, childState).toEqual({
4270
+ label: "child-1",
4271
+ started: true,
4272
+ processed: ["hello"]
4273
+ });
4274
+ }
4275
+ );
3648
4276
  _vitest.test.call(void 0, "db and client are step-only in workflow context", async (c) => {
3649
4277
  const { client } = await setupDriverTest(c, driverTestConfig);
3650
4278
  const actor = client.workflowAccessActor.getOrCreate([
@@ -3666,13 +4294,204 @@ function runActorWorkflowTests(driverTestConfig) {
3666
4294
  });
3667
4295
  _vitest.test.call(void 0, "sleeps and resumes between ticks", async (c) => {
3668
4296
  const { client } = await setupDriverTest(c, driverTestConfig);
3669
- const actor = client.workflowSleepActor.getOrCreate(["workflow-sleep"]);
4297
+ const actor = client.workflowSleepActor.getOrCreate([
4298
+ "workflow-sleep"
4299
+ ]);
3670
4300
  const initial = await actor.getState();
3671
4301
  await waitFor(driverTestConfig, 200);
3672
4302
  const next = await actor.getState();
3673
4303
  _vitest.expect.call(void 0, next.ticks).toBeGreaterThan(initial.ticks);
3674
4304
  });
4305
+ _vitest.test.call(void 0, "workflow onError reports retry metadata", async (c) => {
4306
+ const { client } = await setupDriverTest(c, driverTestConfig);
4307
+ const actor = client.workflowErrorHookActor.getOrCreate([
4308
+ "workflow-error-hook"
4309
+ ]);
4310
+ let state = await actor.getErrorState();
4311
+ for (let i = 0; i < 80 && (state.attempts < 2 || state.events.length === 0); i++) {
4312
+ await waitFor(driverTestConfig, 50);
4313
+ state = await actor.getErrorState();
4314
+ }
4315
+ _vitest.expect.call(void 0, state.attempts).toBe(2);
4316
+ _vitest.expect.call(void 0, state.events).toHaveLength(1);
4317
+ _vitest.expect.call(void 0, state.events[0]).toEqual(
4318
+ _vitest.expect.objectContaining({
4319
+ step: _vitest.expect.objectContaining({
4320
+ stepName: "flaky",
4321
+ attempt: 1,
4322
+ willRetry: true,
4323
+ retryDelay: 1,
4324
+ error: _vitest.expect.objectContaining({
4325
+ name: "Error",
4326
+ message: "workflow hook failed"
4327
+ })
4328
+ })
4329
+ })
4330
+ );
4331
+ });
4332
+ _vitest.test.call(void 0, "workflow onError can update actor state", async (c) => {
4333
+ const { client } = await setupDriverTest(c, driverTestConfig);
4334
+ const actor = client.workflowErrorHookEffectsActor.getOrCreate([
4335
+ "workflow-error-state"
4336
+ ]);
4337
+ await actor.startWorkflow();
4338
+ let state = await actor.getErrorState();
4339
+ for (let i = 0; i < 80 && (state.attempts < 2 || state.lastError === null || state.errorCount === 0); i++) {
4340
+ await waitFor(driverTestConfig, 50);
4341
+ state = await actor.getErrorState();
4342
+ }
4343
+ _vitest.expect.call(void 0, state.attempts).toBe(2);
4344
+ _vitest.expect.call(void 0, state.errorCount).toBe(1);
4345
+ _vitest.expect.call(void 0, state.lastError).toEqual(
4346
+ _vitest.expect.objectContaining({
4347
+ step: _vitest.expect.objectContaining({
4348
+ stepName: "flaky",
4349
+ attempt: 1,
4350
+ willRetry: true,
4351
+ retryDelay: 1,
4352
+ error: _vitest.expect.objectContaining({
4353
+ name: "Error",
4354
+ message: "workflow hook failed"
4355
+ })
4356
+ })
4357
+ })
4358
+ );
4359
+ });
4360
+ _vitest.test.call(void 0, "workflow onError can broadcast actor events", async (c) => {
4361
+ const { client } = await setupDriverTest(c, driverTestConfig);
4362
+ const actor = client.workflowErrorHookEffectsActor.getOrCreate(["workflow-error-broadcast"]).connect();
4363
+ try {
4364
+ const eventPromise = new Promise((resolve) => {
4365
+ actor.once("workflowError", resolve);
4366
+ });
4367
+ await actor.startWorkflow();
4368
+ const event = await eventPromise;
4369
+ _vitest.expect.call(void 0, event).toEqual(
4370
+ _vitest.expect.objectContaining({
4371
+ step: _vitest.expect.objectContaining({
4372
+ stepName: "flaky",
4373
+ attempt: 1,
4374
+ willRetry: true,
4375
+ retryDelay: 1,
4376
+ error: _vitest.expect.objectContaining({
4377
+ name: "Error",
4378
+ message: "workflow hook failed"
4379
+ })
4380
+ })
4381
+ })
4382
+ );
4383
+ } finally {
4384
+ await actor.dispose();
4385
+ }
4386
+ });
4387
+ _vitest.test.call(void 0, "workflow onError can enqueue actor messages", async (c) => {
4388
+ const { client } = await setupDriverTest(c, driverTestConfig);
4389
+ const actor = client.workflowErrorHookEffectsActor.getOrCreate([
4390
+ "workflow-error-queue"
4391
+ ]);
4392
+ await actor.startWorkflow();
4393
+ const queuedError = await actor.receiveQueuedError();
4394
+ _vitest.expect.call(void 0, queuedError).toEqual(
4395
+ _vitest.expect.objectContaining({
4396
+ step: _vitest.expect.objectContaining({
4397
+ stepName: "flaky",
4398
+ attempt: 1,
4399
+ willRetry: true,
4400
+ retryDelay: 1,
4401
+ error: _vitest.expect.objectContaining({
4402
+ name: "Error",
4403
+ message: "workflow hook failed"
4404
+ })
4405
+ })
4406
+ })
4407
+ );
4408
+ });
3675
4409
  _vitest.test.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.sleep)(
4410
+ "completed workflows sleep instead of destroying the actor",
4411
+ async (c) => {
4412
+ const { client } = await setupDriverTest(c, driverTestConfig);
4413
+ const actor = client.workflowCompleteActor.getOrCreate([
4414
+ "workflow-complete"
4415
+ ]);
4416
+ let state = await actor.getState();
4417
+ for (let i = 0; i < 10 && state.sleepCount === 0; i++) {
4418
+ await waitFor(driverTestConfig, 100);
4419
+ state = await actor.getState();
4420
+ }
4421
+ _vitest.expect.call(void 0, state.runCount).toBeGreaterThan(0);
4422
+ _vitest.expect.call(void 0, state.sleepCount).toBeGreaterThan(0);
4423
+ _vitest.expect.call(void 0, state.startCount).toBeGreaterThan(1);
4424
+ }
4425
+ );
4426
+ _vitest.test.call(void 0, "workflow steps can destroy the actor", async (c) => {
4427
+ const { client } = await setupDriverTest(c, driverTestConfig);
4428
+ const actorKey = "workflow-destroy";
4429
+ const observer = client.destroyObserver.getOrCreate(["observer"]);
4430
+ await observer.reset();
4431
+ const actor = client.workflowDestroyActor.getOrCreate([actorKey]);
4432
+ const actorId = await actor.resolve();
4433
+ await _vitest.vi.waitFor(async () => {
4434
+ const wasDestroyed = await observer.wasDestroyed(actorKey);
4435
+ _vitest.expect.call(void 0, wasDestroyed, "actor onDestroy not called").toBeTruthy();
4436
+ });
4437
+ await _vitest.vi.waitFor(async () => {
4438
+ let actorRunning = false;
4439
+ try {
4440
+ await client.workflowDestroyActor.getForId(actorId).resolve();
4441
+ actorRunning = true;
4442
+ } catch (err) {
4443
+ _vitest.expect.call(void 0, err.group).toBe("actor");
4444
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
4445
+ }
4446
+ _vitest.expect.call(void 0, actorRunning, "actor still running").toBeFalsy();
4447
+ });
4448
+ });
4449
+ _vitest.test.skipIf((_b = driverTestConfig.skip) == null ? void 0 : _b.sleep)(
4450
+ "failed workflow steps sleep instead of surfacing as run errors",
4451
+ async (c) => {
4452
+ const { client } = await setupDriverTest(c, driverTestConfig);
4453
+ const actor = client.workflowFailedStepActor.getOrCreate([
4454
+ "workflow-failed-step"
4455
+ ]);
4456
+ let state = await actor.getState();
4457
+ for (let i = 0; i < 10 && state.sleepCount === 0; i++) {
4458
+ await waitFor(driverTestConfig, 100);
4459
+ state = await actor.getState();
4460
+ }
4461
+ _vitest.expect.call(void 0, state.runCount).toBeGreaterThan(0);
4462
+ _vitest.expect.call(void 0, state.sleepCount).toBeGreaterThan(0);
4463
+ _vitest.expect.call(void 0, state.startCount).toBeGreaterThan(1);
4464
+ }
4465
+ );
4466
+ _vitest.test.skipIf((_c = driverTestConfig.skip) == null ? void 0 : _c.sleep)(
4467
+ "workflow onError is not reported again after sleep and wake",
4468
+ async (c) => {
4469
+ const { client } = await setupDriverTest(c, driverTestConfig);
4470
+ const actor = client.workflowErrorHookSleepActor.getOrCreate([
4471
+ "workflow-error-hook-sleep"
4472
+ ]);
4473
+ let state = await actor.getErrorState();
4474
+ for (let i = 0; i < 80 && (state.attempts < 2 || state.events.length === 0); i++) {
4475
+ await waitFor(driverTestConfig, 50);
4476
+ state = await actor.getErrorState();
4477
+ }
4478
+ _vitest.expect.call(void 0, state.attempts).toBe(2);
4479
+ _vitest.expect.call(void 0, state.events).toHaveLength(1);
4480
+ _vitest.expect.call(void 0, state.wakeCount).toBe(1);
4481
+ await actor.triggerSleep();
4482
+ await waitFor(driverTestConfig, 250);
4483
+ let resumedState = await actor.getErrorState();
4484
+ for (let i = 0; i < 40 && (resumedState.wakeCount < 2 || resumedState.sleepCount < 1); i++) {
4485
+ await waitFor(driverTestConfig, 50);
4486
+ resumedState = await actor.getErrorState();
4487
+ }
4488
+ _vitest.expect.call(void 0, resumedState.sleepCount).toBeGreaterThanOrEqual(1);
4489
+ _vitest.expect.call(void 0, resumedState.wakeCount).toBeGreaterThanOrEqual(2);
4490
+ _vitest.expect.call(void 0, resumedState.attempts).toBe(2);
4491
+ _vitest.expect.call(void 0, resumedState.events).toHaveLength(1);
4492
+ }
4493
+ );
4494
+ _vitest.test.skipIf((_d = driverTestConfig.skip) == null ? void 0 : _d.sleep)(
3676
4495
  "workflow run teardown does not wait for runStopTimeout",
3677
4496
  async (c) => {
3678
4497
  const { client } = await setupDriverTest(c, driverTestConfig);
@@ -4878,7 +5697,11 @@ function runRawWebSocketTests(driverTestConfig) {
4878
5697
  ws.addEventListener("open", () => resolve(), { once: true });
4879
5698
  ws.addEventListener("error", reject);
4880
5699
  ws.addEventListener("close", (evt) => {
4881
- reject(new Error(`WebSocket closed: code=${evt.code} reason=${evt.reason}`));
5700
+ reject(
5701
+ new Error(
5702
+ `WebSocket closed: code=${evt.code} reason=${evt.reason}`
5703
+ )
5704
+ );
4882
5705
  });
4883
5706
  });
4884
5707
  const requestInfoPromise = new Promise((resolve, reject) => {
@@ -4899,6 +5722,225 @@ function runRawWebSocketTests(driverTestConfig) {
4899
5722
  });
4900
5723
  }
4901
5724
 
5725
+ // src/driver-test-suite/tests/actor-db-kv-stats.ts
5726
+
5727
+ function runActorDbKvStatsTests(driverTestConfig) {
5728
+ _vitest.describe.call(void 0, "Actor Database KV Stats Tests", () => {
5729
+ _vitest.test.call(void 0,
5730
+ "warm UPDATE uses BATCH_ATOMIC: exactly 1 putBatch, 0 reads, no journal",
5731
+ async (c) => {
5732
+ const { client } = await setupDriverTest(c, driverTestConfig);
5733
+ const actor = client.dbKvStatsActor.getOrCreate([
5734
+ `kv-stats-ba-${crypto.randomUUID()}`
5735
+ ]);
5736
+ await actor.warmUp();
5737
+ await actor.increment();
5738
+ const stats = await actor.getStats();
5739
+ const log = await actor.getLog();
5740
+ _vitest.expect.call(void 0, stats.putBatchCalls).toBe(1);
5741
+ _vitest.expect.call(void 0, stats.getBatchCalls).toBe(0);
5742
+ const allKeys = log.flatMap((e) => e.keys);
5743
+ const journalKeys = allKeys.filter((k) => k.includes("journal"));
5744
+ _vitest.expect.call(void 0, journalKeys.length).toBe(0);
5745
+ },
5746
+ 3e4
5747
+ );
5748
+ _vitest.test.call(void 0,
5749
+ "warm SELECT uses 0 KV round trips",
5750
+ async (c) => {
5751
+ const { client } = await setupDriverTest(c, driverTestConfig);
5752
+ const actor = client.dbKvStatsActor.getOrCreate([
5753
+ `kv-stats-2-${crypto.randomUUID()}`
5754
+ ]);
5755
+ await actor.warmUp();
5756
+ await actor.getCount();
5757
+ const stats = await actor.getStats();
5758
+ _vitest.expect.call(void 0, stats.getBatchCalls).toBe(0);
5759
+ _vitest.expect.call(void 0, stats.putBatchCalls).toBe(0);
5760
+ },
5761
+ 3e4
5762
+ );
5763
+ _vitest.test.call(void 0,
5764
+ "warm SELECT after UPDATE adds no KV round trips",
5765
+ async (c) => {
5766
+ const { client } = await setupDriverTest(c, driverTestConfig);
5767
+ const actor = client.dbKvStatsActor.getOrCreate([
5768
+ `kv-stats-3-${crypto.randomUUID()}`
5769
+ ]);
5770
+ await actor.warmUp();
5771
+ await actor.increment();
5772
+ const updateStats = await actor.getStats();
5773
+ await actor.resetStats();
5774
+ await actor.incrementAndRead();
5775
+ const combinedStats = await actor.getStats();
5776
+ _vitest.expect.call(void 0, combinedStats.putBatchCalls).toBe(updateStats.putBatchCalls);
5777
+ _vitest.expect.call(void 0, combinedStats.getBatchCalls).toBe(updateStats.getBatchCalls);
5778
+ },
5779
+ 3e4
5780
+ );
5781
+ _vitest.test.call(void 0,
5782
+ "warm multi-page INSERT writes multiple chunk keys",
5783
+ async (c) => {
5784
+ const { client } = await setupDriverTest(c, driverTestConfig);
5785
+ const actor = client.dbKvStatsActor.getOrCreate([
5786
+ `kv-stats-4-${crypto.randomUUID()}`
5787
+ ]);
5788
+ await actor.insertWithIndex();
5789
+ await actor.resetStats();
5790
+ await actor.insertWithIndex();
5791
+ const stats = await actor.getStats();
5792
+ const log = await actor.getLog();
5793
+ _vitest.expect.call(void 0, stats.putBatchCalls).toBeGreaterThanOrEqual(1);
5794
+ _vitest.expect.call(void 0, stats.putBatchEntries).toBeGreaterThan(1);
5795
+ const putOps = log.filter(
5796
+ (e) => e.op === "putBatch" || e.op === "put"
5797
+ );
5798
+ const allKeys = putOps.flatMap((e) => e.keys);
5799
+ const mainChunkKeys = allKeys.filter(
5800
+ (k) => k.startsWith("chunk:main[")
5801
+ );
5802
+ _vitest.expect.call(void 0, mainChunkKeys.length).toBeGreaterThanOrEqual(1);
5803
+ },
5804
+ 3e4
5805
+ );
5806
+ _vitest.test.call(void 0,
5807
+ "warm ROLLBACK produces no data page writes",
5808
+ async (c) => {
5809
+ const { client } = await setupDriverTest(c, driverTestConfig);
5810
+ const actor = client.dbKvStatsActor.getOrCreate([
5811
+ `kv-stats-5-${crypto.randomUUID()}`
5812
+ ]);
5813
+ await actor.rollbackTest();
5814
+ await actor.resetStats();
5815
+ await actor.rollbackTest();
5816
+ const log = await actor.getLog();
5817
+ const putOps = log.filter(
5818
+ (e) => e.op === "putBatch" || e.op === "put"
5819
+ );
5820
+ const mainChunkKeys = putOps.flatMap((e) => e.keys).filter((k) => k.startsWith("chunk:main["));
5821
+ _vitest.expect.call(void 0, mainChunkKeys.length).toBe(0);
5822
+ },
5823
+ 3e4
5824
+ );
5825
+ _vitest.test.call(void 0,
5826
+ "warm multi-statement transaction produces writes",
5827
+ async (c) => {
5828
+ const { client } = await setupDriverTest(c, driverTestConfig);
5829
+ const actor = client.dbKvStatsActor.getOrCreate([
5830
+ `kv-stats-6-${crypto.randomUUID()}`
5831
+ ]);
5832
+ await actor.multiStmtTx();
5833
+ await actor.resetStats();
5834
+ await actor.multiStmtTx();
5835
+ const stats = await actor.getStats();
5836
+ _vitest.expect.call(void 0, stats.putBatchCalls).toBeGreaterThanOrEqual(1);
5837
+ },
5838
+ 3e4
5839
+ );
5840
+ _vitest.test.call(void 0,
5841
+ "no WAL or SHM operations occur",
5842
+ async (c) => {
5843
+ const { client } = await setupDriverTest(c, driverTestConfig);
5844
+ const actor = client.dbKvStatsActor.getOrCreate([
5845
+ `kv-stats-7-${crypto.randomUUID()}`
5846
+ ]);
5847
+ await actor.warmUp();
5848
+ await actor.increment();
5849
+ const log = await actor.getLog();
5850
+ const allKeys = log.flatMap((e) => e.keys);
5851
+ const walOrShmKeys = allKeys.filter(
5852
+ (k) => k.includes("wal") || k.includes("shm")
5853
+ );
5854
+ _vitest.expect.call(void 0, walOrShmKeys.length).toBe(0);
5855
+ },
5856
+ 3e4
5857
+ );
5858
+ _vitest.test.call(void 0,
5859
+ "every putBatch has at most 128 keys",
5860
+ async (c) => {
5861
+ const { client } = await setupDriverTest(c, driverTestConfig);
5862
+ const actor = client.dbKvStatsActor.getOrCreate([
5863
+ `kv-stats-8-${crypto.randomUUID()}`
5864
+ ]);
5865
+ await actor.warmUp();
5866
+ await actor.increment();
5867
+ const log = await actor.getLog();
5868
+ const putBatchOps = log.filter(
5869
+ (e) => e.op === "putBatch"
5870
+ );
5871
+ for (const entry of putBatchOps) {
5872
+ _vitest.expect.call(void 0,
5873
+ entry.keys.length
5874
+ ).toBeLessThanOrEqual(128);
5875
+ }
5876
+ },
5877
+ 3e4
5878
+ );
5879
+ _vitest.test.call(void 0,
5880
+ "large transaction falls back to journal when exceeding 127 dirty pages",
5881
+ async (c) => {
5882
+ const { client } = await setupDriverTest(c, driverTestConfig);
5883
+ const actor = client.dbKvStatsActor.getOrCreate([
5884
+ `kv-stats-9-${crypto.randomUUID()}`
5885
+ ]);
5886
+ await actor.warmUp();
5887
+ await actor.bulkInsertLarge();
5888
+ const stats = await actor.getStats();
5889
+ const log = await actor.getLog();
5890
+ _vitest.expect.call(void 0, stats.putBatchCalls).toBeGreaterThan(1);
5891
+ const allKeys = log.flatMap((e) => e.keys);
5892
+ const journalKeys = allKeys.filter(
5893
+ (k) => k.includes("journal")
5894
+ );
5895
+ _vitest.expect.call(void 0, journalKeys.length).toBeGreaterThan(0);
5896
+ const putBatchOps = log.filter(
5897
+ (e) => e.op === "putBatch"
5898
+ );
5899
+ for (const entry of putBatchOps) {
5900
+ _vitest.expect.call(void 0,
5901
+ entry.keys.length
5902
+ ).toBeLessThanOrEqual(128);
5903
+ }
5904
+ },
5905
+ 6e4
5906
+ );
5907
+ _vitest.test.call(void 0,
5908
+ "large transaction data integrity: 200 rows and integrity check pass",
5909
+ async (c) => {
5910
+ const { client } = await setupDriverTest(c, driverTestConfig);
5911
+ const actor = client.dbKvStatsActor.getOrCreate([
5912
+ `kv-stats-10-${crypto.randomUUID()}`
5913
+ ]);
5914
+ await actor.bulkInsertLarge();
5915
+ const count = await actor.getRowCount();
5916
+ _vitest.expect.call(void 0, count).toBe(200);
5917
+ const integrity = await actor.runIntegrityCheck();
5918
+ _vitest.expect.call(void 0, integrity).toBe("ok");
5919
+ },
5920
+ 6e4
5921
+ );
5922
+ _vitest.test.call(void 0,
5923
+ "large transaction survives actor sleep and wake",
5924
+ async (c) => {
5925
+ const { client } = await setupDriverTest(c, driverTestConfig);
5926
+ const actor = client.dbKvStatsActor.getOrCreate([
5927
+ `kv-stats-11-${crypto.randomUUID()}`
5928
+ ]);
5929
+ await actor.bulkInsertLarge();
5930
+ const countBefore = await actor.getRowCount();
5931
+ _vitest.expect.call(void 0, countBefore).toBe(200);
5932
+ await actor.triggerSleep();
5933
+ await waitFor(driverTestConfig, 250);
5934
+ const countAfter = await actor.getRowCount();
5935
+ _vitest.expect.call(void 0, countAfter).toBe(200);
5936
+ const integrity = await actor.runIntegrityCheck();
5937
+ _vitest.expect.call(void 0, integrity).toBe("ok");
5938
+ },
5939
+ 6e4
5940
+ );
5941
+ });
5942
+ }
5943
+
4902
5944
  // src/driver-test-suite/tests/request-access.ts
4903
5945
 
4904
5946
  function runRequestAccessTests(driverTestConfig) {
@@ -5019,6 +6061,7 @@ function runDriverTests(driverTestConfigPartial) {
5019
6061
  runActorErrorHandlingTests(driverTestConfig);
5020
6062
  runActorQueueTests(driverTestConfig);
5021
6063
  runActorRunTests(driverTestConfig);
6064
+ runActorSandboxTests(driverTestConfig);
5022
6065
  runActorInlineClientTests(driverTestConfig);
5023
6066
  runActorKvTests(driverTestConfig);
5024
6067
  runActorWorkflowTests(driverTestConfig);
@@ -5027,6 +6070,7 @@ function runDriverTests(driverTestConfigPartial) {
5027
6070
  runRawHttpRequestPropertiesTests(driverTestConfig);
5028
6071
  runRawWebSocketTests(driverTestConfig);
5029
6072
  runActorInspectorTests(driverTestConfig);
6073
+ runActorDbKvStatsTests(driverTestConfig);
5030
6074
  });
5031
6075
  }
5032
6076
  });
@@ -5061,7 +6105,7 @@ async function createTestRuntime(registryPath, driverFactory) {
5061
6105
  const parsedConfig = registry.parseConfig();
5062
6106
  const managerDriver = (_a = driver.manager) == null ? void 0 : _a.call(driver, parsedConfig);
5063
6107
  _invariant2.default.call(void 0, managerDriver, "missing manager driver");
5064
- const { router } = _chunk3B6PCYJBcjs.buildManagerRouter.call(void 0,
6108
+ const { router } = _chunkCGGGBIDPcjs.buildManagerRouter.call(void 0,
5065
6109
  parsedConfig,
5066
6110
  managerDriver,
5067
6111
  () => upgradeWebSocket
@@ -5085,10 +6129,13 @@ async function createTestRuntime(registryPath, driverFactory) {
5085
6129
  );
5086
6130
  nodeWebSocket.injectWebSocket(server);
5087
6131
  const address = server.address();
5088
- _invariant2.default.call(void 0, address && typeof address !== "string", "missing server address");
6132
+ _invariant2.default.call(void 0,
6133
+ address && typeof address !== "string",
6134
+ "missing server address"
6135
+ );
5089
6136
  const port = address.port;
5090
6137
  const serverEndpoint = `http://127.0.0.1:${port}`;
5091
- _chunkH5TSEPN4cjs.logger.call(void 0, ).info({ msg: "test serer listening", port });
6138
+ _chunkCMQPDBBRcjs.logger.call(void 0, ).info({ msg: "test serer listening", port });
5092
6139
  const cleanup = async () => {
5093
6140
  await new Promise(
5094
6141
  (resolve) => server.close(() => resolve(void 0))