rivetkit 2.0.42 → 2.1.0-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 (322) hide show
  1. package/dist/{tsup/config-CLnylLYY.d.ts → browser/client.d.ts} +2127 -1910
  2. package/dist/browser/client.js +5182 -0
  3. package/dist/browser/client.js.map +1 -0
  4. package/dist/browser/inspector/client.d.ts +130 -0
  5. package/dist/browser/inspector/client.js +2854 -0
  6. package/dist/browser/inspector/client.js.map +1 -0
  7. package/dist/browser/v3-DnYObHH3.d.ts +279 -0
  8. package/dist/schemas/actor-inspector/v2.ts +796 -0
  9. package/dist/schemas/actor-inspector/v3.ts +899 -0
  10. package/dist/schemas/actor-persist/v4.ts +406 -0
  11. package/dist/schemas/client-protocol/v3.ts +554 -0
  12. package/dist/schemas/persist/v1.ts +781 -0
  13. package/dist/schemas/transport/v1.ts +697 -0
  14. package/dist/tsup/actor/errors.cjs +27 -3
  15. package/dist/tsup/actor/errors.cjs.map +1 -1
  16. package/dist/tsup/actor/errors.d.cts +37 -1
  17. package/dist/tsup/actor/errors.d.ts +37 -1
  18. package/dist/tsup/actor/errors.js +26 -1
  19. package/dist/tsup/{actor-router-consts-DzI2szci.d.cts → actor-router-consts-D29T1Z-K.d.cts} +1 -1
  20. package/dist/tsup/{actor-router-consts-DzI2szci.d.ts → actor-router-consts-D29T1Z-K.d.ts} +1 -1
  21. package/dist/tsup/chunk-424PT5DM.js +23 -0
  22. package/dist/tsup/chunk-424PT5DM.js.map +1 -0
  23. package/dist/tsup/{chunk-JDAD2YFA.js → chunk-5ESWDTHJ.js} +148 -273
  24. package/dist/tsup/chunk-5ESWDTHJ.js.map +1 -0
  25. package/dist/tsup/{chunk-FJ3KTN4V.js → chunk-6LIBPELE.js} +119 -11
  26. package/dist/tsup/chunk-6LIBPELE.js.map +1 -0
  27. package/dist/tsup/chunk-6LJAZ5R4.cjs +96 -0
  28. package/dist/tsup/chunk-6LJAZ5R4.cjs.map +1 -0
  29. package/dist/tsup/{chunk-LFVF5SCU.js → chunk-7HTNH26M.js} +126 -1
  30. package/dist/tsup/chunk-7HTNH26M.js.map +1 -0
  31. package/dist/tsup/chunk-7K4CYDGD.js +630 -0
  32. package/dist/tsup/chunk-7K4CYDGD.js.map +1 -0
  33. package/dist/tsup/{chunk-XXGJCOL6.js → chunk-A6YIZWTK.js} +2 -2
  34. package/dist/tsup/chunk-AIYEYMX5.cjs +630 -0
  35. package/dist/tsup/chunk-AIYEYMX5.cjs.map +1 -0
  36. package/dist/tsup/{chunk-Q6W7RJJP.js → chunk-DIGBC2VI.js} +211 -2316
  37. package/dist/tsup/chunk-DIGBC2VI.js.map +1 -0
  38. package/dist/tsup/{chunk-RZW2DNND.cjs → chunk-F6JYU5IK.cjs} +1957 -1039
  39. package/dist/tsup/chunk-F6JYU5IK.cjs.map +1 -0
  40. package/dist/tsup/chunk-HAZL2EPK.cjs +534 -0
  41. package/dist/tsup/chunk-HAZL2EPK.cjs.map +1 -0
  42. package/dist/tsup/chunk-HDQ2JUQT.cjs +23 -0
  43. package/dist/tsup/chunk-HDQ2JUQT.cjs.map +1 -0
  44. package/dist/tsup/chunk-HIDX4C5Y.cjs +1036 -0
  45. package/dist/tsup/chunk-HIDX4C5Y.cjs.map +1 -0
  46. package/dist/tsup/chunk-IVG73YCW.js +534 -0
  47. package/dist/tsup/chunk-IVG73YCW.js.map +1 -0
  48. package/dist/tsup/chunk-KJSYAUOM.js +96 -0
  49. package/dist/tsup/chunk-KJSYAUOM.js.map +1 -0
  50. package/dist/tsup/{chunk-2XQS746M.cjs → chunk-L47L3ZWJ.cjs} +127 -2
  51. package/dist/tsup/chunk-L47L3ZWJ.cjs.map +1 -0
  52. package/dist/tsup/{chunk-H4TB4X25.cjs → chunk-LW6KLR7A.cjs} +126 -18
  53. package/dist/tsup/chunk-LW6KLR7A.cjs.map +1 -0
  54. package/dist/tsup/chunk-LXUQ667X.js +2006 -0
  55. package/dist/tsup/chunk-LXUQ667X.js.map +1 -0
  56. package/dist/tsup/{chunk-GMAVRZSF.js → chunk-M2T62AZQ.js} +1790 -872
  57. package/dist/tsup/chunk-M2T62AZQ.js.map +1 -0
  58. package/dist/tsup/chunk-MZ37VV3P.js +5974 -0
  59. package/dist/tsup/chunk-MZ37VV3P.js.map +1 -0
  60. package/dist/tsup/chunk-N4KRDJ56.js +72 -0
  61. package/dist/tsup/chunk-N4KRDJ56.js.map +1 -0
  62. package/dist/tsup/chunk-NIYZDWMW.cjs +2006 -0
  63. package/dist/tsup/chunk-NIYZDWMW.cjs.map +1 -0
  64. package/dist/tsup/chunk-OMEPCQK2.js +649 -0
  65. package/dist/tsup/chunk-OMEPCQK2.js.map +1 -0
  66. package/dist/tsup/chunk-SR3KQE7Q.cjs +72 -0
  67. package/dist/tsup/chunk-SR3KQE7Q.cjs.map +1 -0
  68. package/dist/tsup/chunk-SSEP6DHP.cjs +2657 -0
  69. package/dist/tsup/chunk-SSEP6DHP.cjs.map +1 -0
  70. package/dist/tsup/chunk-T5YCUGVS.js +1036 -0
  71. package/dist/tsup/chunk-T5YCUGVS.js.map +1 -0
  72. package/dist/tsup/{chunk-EJVBH5VF.cjs → chunk-TPGXWFQT.cjs} +3 -3
  73. package/dist/tsup/{chunk-EJVBH5VF.cjs.map → chunk-TPGXWFQT.cjs.map} +1 -1
  74. package/dist/tsup/{chunk-X35U3YNX.cjs → chunk-TYLXNCA5.cjs} +214 -339
  75. package/dist/tsup/chunk-TYLXNCA5.cjs.map +1 -0
  76. package/dist/tsup/chunk-VKVNIQRQ.js +257 -0
  77. package/dist/tsup/chunk-VKVNIQRQ.js.map +1 -0
  78. package/dist/tsup/chunk-XWBAQO5H.cjs +649 -0
  79. package/dist/tsup/chunk-XWBAQO5H.cjs.map +1 -0
  80. package/dist/tsup/chunk-YQ4LDVD6.cjs +5974 -0
  81. package/dist/tsup/chunk-YQ4LDVD6.cjs.map +1 -0
  82. package/dist/tsup/chunk-ZFY5J2EP.cjs +257 -0
  83. package/dist/tsup/chunk-ZFY5J2EP.cjs.map +1 -0
  84. package/dist/tsup/client/mod.cjs +9 -10
  85. package/dist/tsup/client/mod.cjs.map +1 -1
  86. package/dist/tsup/client/mod.d.cts +11 -5
  87. package/dist/tsup/client/mod.d.ts +11 -5
  88. package/dist/tsup/client/mod.js +8 -8
  89. package/dist/tsup/common/log.cjs +4 -4
  90. package/dist/tsup/common/log.d.cts +2 -2
  91. package/dist/tsup/common/log.d.ts +2 -2
  92. package/dist/tsup/common/log.js +3 -2
  93. package/dist/tsup/common/websocket.cjs +5 -5
  94. package/dist/tsup/common/websocket.js +4 -3
  95. package/dist/tsup/config-BFqid9Gr.d.ts +2574 -0
  96. package/dist/tsup/config-BiNoIHRs.d.cts +80 -0
  97. package/dist/tsup/config-BiNoIHRs.d.ts +80 -0
  98. package/dist/tsup/{config-CZB2-W8x.d.cts → config-CAZphOS1.d.cts} +681 -355
  99. package/dist/tsup/db/drizzle/mod.cjs +49 -0
  100. package/dist/tsup/db/drizzle/mod.cjs.map +1 -0
  101. package/dist/tsup/db/drizzle/mod.d.cts +17 -0
  102. package/dist/tsup/db/drizzle/mod.d.ts +17 -0
  103. package/dist/tsup/db/drizzle/mod.js +49 -0
  104. package/dist/tsup/db/drizzle/mod.js.map +1 -0
  105. package/dist/tsup/db/mod.cjs +9 -0
  106. package/dist/tsup/db/mod.cjs.map +1 -0
  107. package/dist/tsup/db/mod.d.cts +9 -0
  108. package/dist/tsup/db/mod.d.ts +9 -0
  109. package/dist/tsup/db/mod.js +9 -0
  110. package/dist/tsup/db/mod.js.map +1 -0
  111. package/dist/tsup/{driver-D0QX9M11.d.ts → driver-Bxv62E2p.d.ts} +2 -2
  112. package/dist/tsup/{driver-q-zqG7fc.d.cts → driver-DYXwJR5D.d.cts} +2 -2
  113. package/dist/tsup/driver-helpers/mod.cjs +12 -6
  114. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  115. package/dist/tsup/driver-helpers/mod.d.cts +12 -5
  116. package/dist/tsup/driver-helpers/mod.d.ts +12 -5
  117. package/dist/tsup/driver-helpers/mod.js +12 -5
  118. package/dist/tsup/driver-test-suite/mod.cjs +1370 -116
  119. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  120. package/dist/tsup/driver-test-suite/mod.d.cts +10 -4
  121. package/dist/tsup/driver-test-suite/mod.d.ts +10 -4
  122. package/dist/tsup/driver-test-suite/mod.js +2093 -838
  123. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  124. package/dist/tsup/inspector/mod.cjs +29 -3
  125. package/dist/tsup/inspector/mod.cjs.map +1 -1
  126. package/dist/tsup/inspector/mod.d.cts +124 -3
  127. package/dist/tsup/inspector/mod.d.ts +124 -3
  128. package/dist/tsup/inspector/mod.js +72 -45
  129. package/dist/tsup/keys-CydblqMh.d.cts +13 -0
  130. package/dist/tsup/keys-CydblqMh.d.ts +13 -0
  131. package/dist/tsup/mod.cjs +16 -10
  132. package/dist/tsup/mod.cjs.map +1 -1
  133. package/dist/tsup/mod.d.cts +26 -14
  134. package/dist/tsup/mod.d.ts +26 -14
  135. package/dist/tsup/mod.js +20 -13
  136. package/dist/tsup/serve-test-suite/mod.cjs +1165 -83
  137. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
  138. package/dist/tsup/serve-test-suite/mod.js +1114 -29
  139. package/dist/tsup/serve-test-suite/mod.js.map +1 -1
  140. package/dist/tsup/test/mod.cjs +84 -11
  141. package/dist/tsup/test/mod.cjs.map +1 -1
  142. package/dist/tsup/test/mod.d.cts +10 -5
  143. package/dist/tsup/test/mod.d.ts +10 -5
  144. package/dist/tsup/test/mod.js +85 -11
  145. package/dist/tsup/test/mod.js.map +1 -1
  146. package/dist/tsup/utils.cjs +10 -4
  147. package/dist/tsup/utils.cjs.map +1 -1
  148. package/dist/tsup/utils.d.cts +72 -2
  149. package/dist/tsup/utils.d.ts +72 -2
  150. package/dist/tsup/utils.js +9 -2
  151. package/dist/tsup/v3-DnYObHH3.d.cts +279 -0
  152. package/dist/tsup/v3-DnYObHH3.d.ts +279 -0
  153. package/dist/tsup/workflow/mod.cjs +16 -0
  154. package/dist/tsup/workflow/mod.cjs.map +1 -0
  155. package/dist/tsup/workflow/mod.d.cts +83 -0
  156. package/dist/tsup/workflow/mod.d.ts +83 -0
  157. package/dist/tsup/workflow/mod.js +16 -0
  158. package/dist/tsup/workflow/mod.js.map +1 -0
  159. package/package.json +62 -5
  160. package/src/actor/config.ts +478 -68
  161. package/src/actor/conn/mod.ts +68 -16
  162. package/src/actor/conn/state-manager.ts +2 -2
  163. package/src/actor/contexts/action.ts +20 -12
  164. package/src/actor/contexts/base/actor.ts +137 -7
  165. package/src/actor/contexts/base/conn-init.ts +27 -7
  166. package/src/actor/contexts/base/conn.ts +27 -18
  167. package/src/actor/contexts/before-action-response.ts +9 -2
  168. package/src/actor/contexts/before-connect.ts +7 -2
  169. package/src/actor/contexts/connect.ts +9 -2
  170. package/src/actor/contexts/create-conn-state.ts +7 -2
  171. package/src/actor/contexts/create-vars.ts +16 -3
  172. package/src/actor/contexts/create.ts +16 -3
  173. package/src/actor/contexts/destroy.ts +9 -3
  174. package/src/actor/contexts/disconnect.ts +10 -4
  175. package/src/actor/contexts/index.ts +4 -3
  176. package/src/actor/contexts/request.ts +23 -6
  177. package/src/actor/contexts/run.ts +47 -0
  178. package/src/actor/contexts/sleep.ts +9 -3
  179. package/src/actor/contexts/state-change.ts +9 -3
  180. package/src/actor/contexts/wake.ts +9 -3
  181. package/src/actor/contexts/websocket.ts +23 -6
  182. package/src/actor/database.ts +8 -18
  183. package/src/actor/definition.ts +20 -6
  184. package/src/actor/driver.ts +32 -3
  185. package/src/actor/errors.ts +127 -0
  186. package/src/actor/instance/connection-manager.ts +183 -80
  187. package/src/actor/instance/event-manager.ts +26 -15
  188. package/src/actor/instance/keys.ts +117 -0
  189. package/src/actor/instance/mod.ts +784 -174
  190. package/src/actor/instance/queue-manager.ts +603 -0
  191. package/src/actor/instance/queue.ts +287 -0
  192. package/src/actor/instance/schedule-manager.ts +49 -7
  193. package/src/actor/instance/state-manager.ts +35 -11
  194. package/src/actor/instance/traces-driver.ts +128 -0
  195. package/src/actor/mod.ts +26 -2
  196. package/src/actor/protocol/old.ts +28 -13
  197. package/src/actor/protocol/serde.ts +1 -1
  198. package/src/actor/router-endpoints.ts +177 -21
  199. package/src/actor/router-websocket-endpoints.ts +18 -29
  200. package/src/actor/router.ts +177 -0
  201. package/src/actor/schema.ts +291 -0
  202. package/src/actor/utils.ts +40 -0
  203. package/src/client/actor-common.ts +1 -1
  204. package/src/client/actor-conn.ts +100 -33
  205. package/src/client/actor-handle.ts +61 -33
  206. package/src/client/client.ts +2 -4
  207. package/src/client/config.ts +1 -1
  208. package/src/client/mod.browser.ts +2 -0
  209. package/src/client/mod.ts +1 -4
  210. package/src/client/queue.ts +146 -0
  211. package/src/client/utils.ts +1 -1
  212. package/src/common/log.ts +1 -1
  213. package/src/common/utils.ts +3 -3
  214. package/src/db/config.ts +100 -0
  215. package/src/db/drizzle/mod.ts +226 -0
  216. package/src/db/drizzle/sqlite-core.ts +22 -0
  217. package/src/db/mod.ts +125 -0
  218. package/src/db/shared.ts +92 -0
  219. package/src/db/sqlite-vfs.ts +12 -0
  220. package/src/driver-helpers/mod.ts +1 -0
  221. package/src/driver-test-suite/mod.ts +69 -43
  222. package/src/driver-test-suite/tests/access-control.ts +218 -0
  223. package/src/driver-test-suite/tests/actor-db-raw.ts +73 -0
  224. package/src/driver-test-suite/tests/actor-db.ts +394 -0
  225. package/src/driver-test-suite/tests/actor-inspector.ts +259 -358
  226. package/src/driver-test-suite/tests/actor-kv.ts +41 -20
  227. package/src/driver-test-suite/tests/actor-queue.ts +324 -0
  228. package/src/driver-test-suite/tests/actor-run.ts +181 -0
  229. package/src/driver-test-suite/tests/actor-schedule.ts +5 -2
  230. package/src/driver-test-suite/tests/actor-sleep.ts +3 -3
  231. package/src/driver-test-suite/tests/actor-stateless.ts +70 -0
  232. package/src/driver-test-suite/tests/actor-workflow.ts +108 -0
  233. package/src/driver-test-suite/tests/manager-driver.ts +11 -0
  234. package/src/driver-test-suite/tests/raw-http-request-properties.ts +1 -1
  235. package/src/driver-test-suite/tests/raw-websocket.ts +12 -12
  236. package/src/drivers/default.ts +7 -2
  237. package/src/drivers/engine/actor-driver.ts +45 -37
  238. package/src/drivers/engine/config.ts +1 -1
  239. package/src/drivers/file-system/actor.ts +20 -2
  240. package/src/drivers/file-system/global-state.ts +569 -258
  241. package/src/drivers/file-system/kv-limits.ts +70 -0
  242. package/src/drivers/file-system/manager.ts +22 -6
  243. package/src/drivers/file-system/mod.ts +39 -16
  244. package/src/drivers/file-system/sqlite-runtime.ts +210 -0
  245. package/src/inspector/actor-inspector.ts +224 -102
  246. package/src/inspector/config.ts +1 -1
  247. package/src/inspector/handler.ts +102 -20
  248. package/src/inspector/mod.browser.ts +8 -0
  249. package/src/inspector/mod.ts +2 -0
  250. package/src/inspector/serve-ui.ts +40 -0
  251. package/src/inspector/transport.ts +18 -0
  252. package/src/inspector/utils.ts +5 -39
  253. package/src/manager/gateway.ts +1 -1
  254. package/src/manager/protocol/mod.ts +1 -1
  255. package/src/manager/protocol/query.ts +1 -1
  256. package/src/manager/router-schema.ts +1 -1
  257. package/src/manager/router.ts +38 -12
  258. package/src/manager-api/actors.ts +1 -1
  259. package/src/manager-api/common.ts +1 -1
  260. package/src/registry/config/driver.ts +1 -1
  261. package/src/registry/config/index.ts +212 -43
  262. package/src/registry/config/legacy-runner.ts +1 -1
  263. package/src/registry/config/runner.ts +1 -1
  264. package/src/registry/config/serverless.ts +1 -1
  265. package/src/registry/index.ts +7 -5
  266. package/src/remote-manager-driver/api-utils.ts +1 -1
  267. package/src/schemas/actor-inspector/mod.ts +1 -1
  268. package/src/schemas/actor-inspector/versioned.ts +195 -8
  269. package/src/schemas/actor-persist/versioned.ts +87 -7
  270. package/src/schemas/client-protocol/mod.ts +1 -1
  271. package/src/schemas/client-protocol/versioned.ts +127 -11
  272. package/src/schemas/client-protocol-zod/mod.ts +16 -1
  273. package/src/schemas/persist/mod.ts +1 -0
  274. package/src/schemas/transport/mod.ts +1 -0
  275. package/src/serde.ts +1 -1
  276. package/src/serve-test-suite/mod.ts +10 -9
  277. package/src/test/mod.ts +15 -56
  278. package/src/utils/endpoint-parser.test.ts +1 -1
  279. package/src/utils/endpoint-parser.ts +1 -1
  280. package/src/utils/env-vars.ts +12 -1
  281. package/src/utils/node.ts +15 -2
  282. package/src/utils.test.ts +34 -0
  283. package/src/utils.ts +140 -6
  284. package/src/workflow/constants.ts +2 -0
  285. package/src/workflow/context.ts +532 -0
  286. package/src/workflow/driver.ts +191 -0
  287. package/src/workflow/inspector.ts +268 -0
  288. package/src/workflow/mod.ts +122 -0
  289. package/dist/tsup/chunk-2IJTYN6K.cjs +0 -278
  290. package/dist/tsup/chunk-2IJTYN6K.cjs.map +0 -1
  291. package/dist/tsup/chunk-2XQS746M.cjs.map +0 -1
  292. package/dist/tsup/chunk-3VP5CSHV.cjs +0 -114
  293. package/dist/tsup/chunk-3VP5CSHV.cjs.map +0 -1
  294. package/dist/tsup/chunk-AQFSQMBG.js +0 -114
  295. package/dist/tsup/chunk-AQFSQMBG.js.map +0 -1
  296. package/dist/tsup/chunk-E6ZE2YEA.js +0 -664
  297. package/dist/tsup/chunk-E6ZE2YEA.js.map +0 -1
  298. package/dist/tsup/chunk-FJ3KTN4V.js.map +0 -1
  299. package/dist/tsup/chunk-GBENOENJ.cjs +0 -8
  300. package/dist/tsup/chunk-GBENOENJ.cjs.map +0 -1
  301. package/dist/tsup/chunk-GD7UXGOE.cjs +0 -4762
  302. package/dist/tsup/chunk-GD7UXGOE.cjs.map +0 -1
  303. package/dist/tsup/chunk-GMAVRZSF.js.map +0 -1
  304. package/dist/tsup/chunk-H4TB4X25.cjs.map +0 -1
  305. package/dist/tsup/chunk-JDAD2YFA.js.map +0 -1
  306. package/dist/tsup/chunk-KCOVZOPS.js +0 -1946
  307. package/dist/tsup/chunk-KCOVZOPS.js.map +0 -1
  308. package/dist/tsup/chunk-KDFWJKMJ.cjs +0 -664
  309. package/dist/tsup/chunk-KDFWJKMJ.cjs.map +0 -1
  310. package/dist/tsup/chunk-LFVF5SCU.js.map +0 -1
  311. package/dist/tsup/chunk-Q6W7RJJP.js.map +0 -1
  312. package/dist/tsup/chunk-RUW5CZ5Z.cjs +0 -1949
  313. package/dist/tsup/chunk-RUW5CZ5Z.cjs.map +0 -1
  314. package/dist/tsup/chunk-RZW2DNND.cjs.map +0 -1
  315. package/dist/tsup/chunk-TCOEBUUE.js +0 -278
  316. package/dist/tsup/chunk-TCOEBUUE.js.map +0 -1
  317. package/dist/tsup/chunk-X35U3YNX.cjs.map +0 -1
  318. package/dist/tsup/keys-Chhy4ylv.d.cts +0 -8
  319. package/dist/tsup/keys-Chhy4ylv.d.ts +0 -8
  320. package/dist/tsup/v1-Gq4avTK3.d.cts +0 -240
  321. package/dist/tsup/v1-Gq4avTK3.d.ts +0 -240
  322. /package/dist/tsup/{chunk-XXGJCOL6.js.map → chunk-A6YIZWTK.js.map} +0 -0
@@ -188,6 +188,111 @@ export class Unsupported extends ActorError {
188
188
  }
189
189
  }
190
190
 
191
+ export class QueueFull extends ActorError {
192
+ constructor(limit: number) {
193
+ super("queue", "full", `Queue is full. Limit is ${limit} messages.`, {
194
+ public: true,
195
+ metadata: { limit },
196
+ });
197
+ }
198
+ }
199
+
200
+ export class QueueMessageTooLarge extends ActorError {
201
+ constructor(size: number, limit: number) {
202
+ super(
203
+ "queue",
204
+ "message_too_large",
205
+ `Queue message too large (${size} bytes). Limit is ${limit} bytes.`,
206
+ { public: true, metadata: { size, limit } },
207
+ );
208
+ }
209
+ }
210
+
211
+ export class QueueMessageInvalid extends ActorError {
212
+ constructor(path?: string) {
213
+ super(
214
+ "queue",
215
+ "message_invalid",
216
+ path
217
+ ? `Queue message body contains unsupported type at ${path}.`
218
+ : "Queue message body contains unsupported type.",
219
+ { public: true, metadata: path ? { path } : undefined },
220
+ );
221
+ }
222
+ }
223
+
224
+ export class EventPayloadInvalid extends ActorError {
225
+ constructor(name: string, issues?: unknown[]) {
226
+ super(
227
+ "event",
228
+ "invalid_payload",
229
+ `Event payload failed validation for '${name}'.`,
230
+ { public: true, metadata: { name, issues } },
231
+ );
232
+ }
233
+ }
234
+
235
+ export class QueuePayloadInvalid extends ActorError {
236
+ constructor(name: string, issues?: unknown[]) {
237
+ super(
238
+ "queue",
239
+ "invalid_payload",
240
+ `Queue payload failed validation for '${name}'.`,
241
+ { public: true, metadata: { name, issues } },
242
+ );
243
+ }
244
+ }
245
+
246
+ export class QueueCompletionPayloadInvalid extends ActorError {
247
+ constructor(name: string, issues?: unknown[]) {
248
+ super(
249
+ "queue",
250
+ "invalid_completion_payload",
251
+ `Queue completion payload failed validation for '${name}'.`,
252
+ { public: true, metadata: { name, issues } },
253
+ );
254
+ }
255
+ }
256
+
257
+ export class QueueAlreadyCompleted extends ActorError {
258
+ constructor() {
259
+ super("queue", "already_completed", "Queue message was already completed.", {
260
+ public: true,
261
+ });
262
+ }
263
+ }
264
+
265
+ export class QueuePreviousMessageNotCompleted extends ActorError {
266
+ constructor() {
267
+ super(
268
+ "queue",
269
+ "previous_message_not_completed",
270
+ "Previous completable queue message is not completed. Call `message.complete(...)` before receiving the next message.",
271
+ { public: true },
272
+ );
273
+ }
274
+ }
275
+
276
+ export class QueueCompleteNotConfigured extends ActorError {
277
+ constructor(name: string) {
278
+ super(
279
+ "queue",
280
+ "complete_not_configured",
281
+ `Queue '${name}' does not support completion responses.`,
282
+ {
283
+ public: true,
284
+ metadata: { name },
285
+ },
286
+ );
287
+ }
288
+ }
289
+
290
+ export class ActorAborted extends ActorError {
291
+ constructor() {
292
+ super("actor", "aborted", "Actor aborted.", { public: true });
293
+ }
294
+ }
295
+
191
296
  /**
192
297
  * Options for the UserError class.
193
298
  */
@@ -344,6 +449,28 @@ export class InvalidRequestHandlerResponse extends ActorError {
344
449
  }
345
450
  }
346
451
 
452
+ export class InvalidCanSubscribeResponse extends ActorError {
453
+ constructor() {
454
+ super(
455
+ "handler",
456
+ "invalid_can_subscribe_response",
457
+ "Event canSubscribe hook must return a boolean value.",
458
+ );
459
+ this.statusCode = 500;
460
+ }
461
+ }
462
+
463
+ export class InvalidCanPublishResponse extends ActorError {
464
+ constructor() {
465
+ super(
466
+ "handler",
467
+ "invalid_can_publish_response",
468
+ "Queue canPublish hook must return a boolean value.",
469
+ );
470
+ this.statusCode = 500;
471
+ }
472
+ }
473
+
347
474
  // Manager-specific errors
348
475
  export class MissingActorHeader extends ActorError {
349
476
  constructor() {
@@ -30,6 +30,7 @@ import {
30
30
  } from "../contexts";
31
31
  import type { AnyDatabaseProvider } from "../database";
32
32
  import { CachedSerializer } from "../protocol/serde";
33
+ import type { EventSchemaConfig, QueueSchemaConfig } from "../schema";
33
34
  import { deadline } from "../utils";
34
35
  import { makeConnKey } from "./keys";
35
36
  import type { ActorInstance } from "./mod";
@@ -44,22 +45,25 @@ export class ConnectionManager<
44
45
  V,
45
46
  I,
46
47
  DB extends AnyDatabaseProvider,
48
+ E extends EventSchemaConfig = Record<never, never>,
49
+ Q extends QueueSchemaConfig = Record<never, never>,
47
50
  > {
48
- #actor: ActorInstance<S, CP, CS, V, I, DB>;
49
- #connections = new Map<ConnId, Conn<S, CP, CS, V, I, DB>>();
51
+ #actor: ActorInstance<S, CP, CS, V, I, DB, E, Q>;
52
+ #connections = new Map<ConnId, Conn<S, CP, CS, V, I, DB, E, Q>>();
53
+ #pendingDisconnectCount = 0;
50
54
 
51
55
  /** Connections that have had their state changed and need to be persisted. */
52
56
  #connsWithPersistChanged = new Set<ConnId>();
53
57
 
54
- constructor(actor: ActorInstance<S, CP, CS, V, I, DB>) {
58
+ constructor(actor: ActorInstance<S, CP, CS, V, I, DB, E, Q>) {
55
59
  this.#actor = actor;
56
60
  }
57
61
 
58
- get connections(): Map<ConnId, Conn<S, CP, CS, V, I, DB>> {
62
+ get connections(): Map<ConnId, Conn<S, CP, CS, V, I, DB, E, Q>> {
59
63
  return this.#connections;
60
64
  }
61
65
 
62
- getConnForId(id: string): Conn<S, CP, CS, V, I, DB> | undefined {
66
+ getConnForId(id: string): Conn<S, CP, CS, V, I, DB, E, Q> | undefined {
63
67
  return this.#connections.get(id);
64
68
  }
65
69
 
@@ -67,11 +71,15 @@ export class ConnectionManager<
67
71
  return this.#connsWithPersistChanged;
68
72
  }
69
73
 
74
+ get pendingDisconnectCount(): number {
75
+ return this.#pendingDisconnectCount;
76
+ }
77
+
70
78
  clearConnWithPersistChanged() {
71
79
  this.#connsWithPersistChanged.clear();
72
80
  }
73
81
 
74
- markConnWithPersistChanged(conn: Conn<S, CP, CS, V, I, DB>) {
82
+ markConnWithPersistChanged(conn: Conn<S, CP, CS, V, I, DB, E, Q>) {
75
83
  invariant(
76
84
  conn.isHibernatable,
77
85
  "cannot mark non-hibernatable conn for persist",
@@ -100,7 +108,7 @@ export class ConnectionManager<
100
108
  requestHeaders: Record<string, string> | undefined,
101
109
  isHibernatable: boolean,
102
110
  isRestoringHibernatable: boolean,
103
- ): Promise<Conn<S, CP, CS, V, I, DB>> {
111
+ ): Promise<Conn<S, CP, CS, V, I, DB, E, Q>> {
104
112
  this.#actor.assertReady();
105
113
 
106
114
  // TODO: Add back
@@ -118,7 +126,13 @@ export class ConnectionManager<
118
126
  // Create new connection
119
127
  if (this.#actor.config.onBeforeConnect) {
120
128
  const ctx = new BeforeConnectContext(this.#actor, request);
121
- await this.#actor.config.onBeforeConnect(ctx, params);
129
+ await this.#actor.runInTraceSpan(
130
+ "actor.onBeforeConnect",
131
+ {
132
+ "rivet.conn.type": driver.type,
133
+ },
134
+ () => this.#actor.config.onBeforeConnect!(ctx, params),
135
+ );
122
136
  }
123
137
 
124
138
  // Create connection state if enabled
@@ -163,7 +177,7 @@ export class ConnectionManager<
163
177
  }
164
178
 
165
179
  // Create connection instance
166
- const conn = new Conn<S, CP, CS, V, I, DB>(this.#actor, connData);
180
+ const conn = new Conn<S, CP, CS, V, I, DB, E, Q>(this.#actor, connData);
167
181
  conn[CONN_DRIVER_SYMBOL] = driver;
168
182
 
169
183
  return conn;
@@ -177,7 +191,7 @@ export class ConnectionManager<
177
191
  * be messed up and cause race conditions that can drop WebSocket messages.
178
192
  * So all async work in prepareConn.
179
193
  */
180
- connectConn(conn: Conn<S, CP, CS, V, I, DB>) {
194
+ connectConn(conn: Conn<S, CP, CS, V, I, DB, E, Q>) {
181
195
  invariant(!this.#connections.has(conn.id), "conn already connected");
182
196
 
183
197
  this.#connections.set(conn.id, conn);
@@ -230,7 +244,9 @@ export class ConnectionManager<
230
244
  }
231
245
  }
232
246
 
233
- #reconnectHibernatableConn(driver: ConnDriver): Conn<S, CP, CS, V, I, DB> {
247
+ #reconnectHibernatableConn(
248
+ driver: ConnDriver,
249
+ ): Conn<S, CP, CS, V, I, DB, E, Q> {
234
250
  invariant(driver.hibernatable, "missing requestIdBuf");
235
251
  const existingConn = this.findHibernatableConn(
236
252
  driver.hibernatable.gatewayId,
@@ -265,7 +281,7 @@ export class ConnectionManager<
265
281
  return existingConn;
266
282
  }
267
283
 
268
- #disconnectExistingDriver(conn: Conn<S, CP, CS, V, I, DB>) {
284
+ #disconnectExistingDriver(conn: Conn<S, CP, CS, V, I, DB, E, Q>) {
269
285
  const driver = conn[CONN_DRIVER_SYMBOL];
270
286
  if (driver?.disconnect) {
271
287
  driver.disconnect(
@@ -281,7 +297,7 @@ export class ConnectionManager<
281
297
  *
282
298
  * This is called by `Conn.disconnect`. This should not call `Conn.disconnect.`
283
299
  */
284
- async connDisconnected(conn: Conn<S, CP, CS, V, I, DB>) {
300
+ async connDisconnected(conn: Conn<S, CP, CS, V, I, DB, E, Q>) {
285
301
  // Remove from tracking
286
302
  this.#connections.delete(conn.id);
287
303
 
@@ -296,55 +312,108 @@ export class ConnectionManager<
296
312
  this.#actor.eventManager.removeSubscription(eventName, conn, true);
297
313
  }
298
314
 
299
- this.#actor.resetSleepTimer();
300
-
301
315
  this.#actor.inspector.emitter.emit("connectionsUpdated");
316
+ this.#pendingDisconnectCount += 1;
317
+
318
+ const attributes = {
319
+ "rivet.conn.id": conn.id,
320
+ "rivet.conn.type": conn[CONN_DRIVER_SYMBOL]?.type,
321
+ "rivet.conn.hibernatable": conn.isHibernatable,
322
+ };
323
+ const span = this.#actor.startTraceSpan(
324
+ "actor.onDisconnect",
325
+ attributes,
326
+ );
302
327
 
303
- // Trigger disconnect
304
- if (this.#actor.config.onDisconnect) {
305
- try {
306
- const result = this.#actor.config.onDisconnect(
307
- this.#actor.actorContext,
308
- conn,
328
+ try {
329
+ if (this.#actor.config.onDisconnect) {
330
+ const result = this.#actor.traces.withSpan(span, () =>
331
+ this.#actor.config.onDisconnect!(
332
+ this.#actor.actorContext,
333
+ conn,
334
+ ),
335
+ );
336
+ this.#actor.emitTraceEvent(
337
+ "connection.disconnect",
338
+ attributes,
339
+ span,
309
340
  );
310
341
  if (result instanceof Promise) {
311
- result.catch((error) => {
312
- this.#actor.rLog.error({
313
- msg: "error in `onDisconnect`",
314
- error: stringifyError(error),
315
- });
342
+ await result;
343
+ }
344
+ this.#actor.endTraceSpan(span, { code: "OK" });
345
+ } else {
346
+ this.#actor.emitTraceEvent(
347
+ "connection.disconnect",
348
+ attributes,
349
+ span,
350
+ );
351
+ this.#actor.endTraceSpan(span, { code: "OK" });
352
+ }
353
+ } catch (error) {
354
+ this.#actor.endTraceSpan(span, {
355
+ code: "ERROR",
356
+ message: stringifyError(error),
357
+ });
358
+ this.#actor.rLog.error({
359
+ msg: "error in `onDisconnect`",
360
+ error: stringifyError(error),
361
+ });
362
+ } finally {
363
+ // Remove from connsWithPersistChanged after onDisconnect to handle any
364
+ // state changes made during the disconnect callback. Disconnected connections
365
+ // are removed from KV storage via kvBatchDelete below, not through the
366
+ // normal persist save flow, so they should not trigger persist saves.
367
+ this.#connsWithPersistChanged.delete(conn.id);
368
+
369
+ // Remove from KV storage.
370
+ if (conn.isHibernatable) {
371
+ const key = makeConnKey(conn.id);
372
+ try {
373
+ await this.#actor.driver.kvBatchDelete(this.#actor.id, [key]);
374
+ this.#actor.rLog.debug({
375
+ msg: "removed connection from KV",
376
+ connId: conn.id,
377
+ });
378
+ } catch (err) {
379
+ this.#actor.rLog.error({
380
+ msg: "kvBatchDelete failed for conn",
381
+ err: stringifyError(err),
316
382
  });
317
383
  }
318
- } catch (error) {
319
- this.#actor.rLog.error({
320
- msg: "error in `onDisconnect`",
321
- error: stringifyError(error),
322
- });
323
384
  }
385
+
386
+ this.#pendingDisconnectCount = Math.max(
387
+ 0,
388
+ this.#pendingDisconnectCount - 1,
389
+ );
390
+ this.#actor.resetSleepTimer();
324
391
  }
392
+ }
325
393
 
326
- // Remove from connsWithPersistChanged after onDisconnect to handle any
327
- // state changes made during the disconnect callback. Disconnected connections
328
- // are removed from KV storage via kvBatchDelete below, not through the
329
- // normal persist save flow, so they should not trigger persist saves.
330
- this.#connsWithPersistChanged.delete(conn.id);
394
+ async cleanupPersistedHibernatableConnections(
395
+ reason?: string,
396
+ ): Promise<number> {
397
+ const staleConnections = Array.from(this.#connections.values()).filter(
398
+ (conn) =>
399
+ conn.isHibernatable &&
400
+ conn[CONN_DRIVER_SYMBOL] === undefined,
401
+ );
402
+ if (staleConnections.length === 0) {
403
+ return 0;
404
+ }
331
405
 
332
- // Remove from KV storage
333
- if (conn.isHibernatable) {
334
- const key = makeConnKey(conn.id);
335
- try {
336
- await this.#actor.driver.kvBatchDelete(this.#actor.id, [key]);
337
- this.#actor.rLog.debug({
338
- msg: "removed connection from KV",
339
- connId: conn.id,
340
- });
341
- } catch (err) {
342
- this.#actor.rLog.error({
343
- msg: "kvBatchDelete failed for conn",
344
- err: stringifyError(err),
345
- });
346
- }
406
+ this.#actor.rLog.info({
407
+ msg: "cleaning up persisted hibernatable connections",
408
+ reason: reason ?? "unknown",
409
+ count: staleConnections.length,
410
+ });
411
+
412
+ for (const conn of staleConnections) {
413
+ await this.connDisconnected(conn);
347
414
  }
415
+
416
+ return staleConnections.length;
348
417
  }
349
418
 
350
419
  /**
@@ -356,7 +425,7 @@ export class ConnectionManager<
356
425
  request: Request | undefined,
357
426
  requestPath: string | undefined,
358
427
  requestHeaders: Record<string, string> | undefined,
359
- ): Promise<Conn<S, CP, CS, V, I, DB>> {
428
+ ): Promise<Conn<S, CP, CS, V, I, DB, E, Q>> {
360
429
  const conn = await this.prepareConn(
361
430
  driver,
362
431
  params,
@@ -378,7 +447,7 @@ export class ConnectionManager<
378
447
  restoreConnections(connections: PersistedConn<CP, CS>[]) {
379
448
  for (const connPersist of connections) {
380
449
  // Create connection instance
381
- const conn = new Conn<S, CP, CS, V, I, DB>(this.#actor, {
450
+ const conn = new Conn<S, CP, CS, V, I, DB, E, Q>(this.#actor, {
382
451
  hibernatable: connPersist,
383
452
  });
384
453
  this.#connections.set(conn.id, conn);
@@ -404,7 +473,7 @@ export class ConnectionManager<
404
473
  findHibernatableConn(
405
474
  gatewayIdBuf: ArrayBuffer,
406
475
  requestIdBuf: ArrayBuffer,
407
- ): Conn<S, CP, CS, V, I, DB> | undefined {
476
+ ): Conn<S, CP, CS, V, I, DB, E, Q> | undefined {
408
477
  return Array.from(this.#connections.values()).find((conn) => {
409
478
  const connStateManager = conn[CONN_STATE_MANAGER_SYMBOL];
410
479
  const h = connStateManager.hibernatableDataRaw;
@@ -421,18 +490,22 @@ export class ConnectionManager<
421
490
  request: Request | undefined,
422
491
  ): Promise<CS | undefined> {
423
492
  if ("createConnState" in this.#actor.config) {
493
+ const createConnState = this.#actor.config.createConnState;
424
494
  const ctx = new CreateConnStateContext(this.#actor, request);
425
- const dataOrPromise = this.#actor.config.createConnState(
426
- ctx,
427
- params,
495
+ return await this.#actor.runInTraceSpan(
496
+ "actor.createConnState",
497
+ undefined,
498
+ () => {
499
+ const dataOrPromise = createConnState!(ctx, params);
500
+ if (dataOrPromise instanceof Promise) {
501
+ return deadline(
502
+ dataOrPromise,
503
+ this.#actor.config.options.createConnStateTimeout,
504
+ );
505
+ }
506
+ return dataOrPromise;
507
+ },
428
508
  );
429
- if (dataOrPromise instanceof Promise) {
430
- return await deadline(
431
- dataOrPromise,
432
- this.#actor.config.options.createConnStateTimeout,
433
- );
434
- }
435
- return dataOrPromise;
436
509
  } else if ("connState" in this.#actor.config) {
437
510
  return structuredClone(this.#actor.config.connState);
438
511
  }
@@ -442,30 +515,60 @@ export class ConnectionManager<
442
515
  );
443
516
  }
444
517
 
445
- #callOnConnect(conn: Conn<S, CP, CS, V, I, DB>) {
446
- if (this.#actor.config.onConnect) {
447
- try {
518
+ #callOnConnect(conn: Conn<S, CP, CS, V, I, DB, E, Q>) {
519
+ const attributes = {
520
+ "rivet.conn.id": conn.id,
521
+ "rivet.conn.type": conn[CONN_DRIVER_SYMBOL]?.type,
522
+ "rivet.conn.hibernatable": conn.isHibernatable,
523
+ };
524
+ const span = this.#actor.startTraceSpan("actor.onConnect", attributes);
525
+
526
+ try {
527
+ if (this.#actor.config.onConnect) {
448
528
  const ctx = new ConnectContext(this.#actor, conn);
449
- const result = this.#actor.config.onConnect(ctx, conn);
529
+ const result = this.#actor.traces.withSpan(span, () =>
530
+ this.#actor.config.onConnect!(ctx, conn),
531
+ );
532
+ this.#actor.emitTraceEvent(
533
+ "connection.connect",
534
+ attributes,
535
+ span,
536
+ );
450
537
  if (result instanceof Promise) {
451
538
  deadline(
452
539
  result,
453
540
  this.#actor.config.options.onConnectTimeout,
454
- ).catch((error) => {
455
- this.#actor.rLog.error({
456
- msg: "error in `onConnect`, closing socket",
457
- error,
541
+ )
542
+ .then(() => {
543
+ this.#actor.endTraceSpan(span, { code: "OK" });
544
+ })
545
+ .catch((error) => {
546
+ this.#actor.endTraceSpan(span, {
547
+ code: "ERROR",
548
+ message: stringifyError(error),
549
+ });
550
+ this.#actor.rLog.error({
551
+ msg: "error in `onConnect`, closing socket",
552
+ error,
553
+ });
554
+ conn?.disconnect("`onConnect` failed");
458
555
  });
459
- conn?.disconnect("`onConnect` failed");
460
- });
556
+ return;
461
557
  }
462
- } catch (error) {
463
- this.#actor.rLog.error({
464
- msg: "error in `onConnect`",
465
- error: stringifyError(error),
466
- });
467
- conn?.disconnect("`onConnect` failed");
468
558
  }
559
+
560
+ this.#actor.emitTraceEvent("connection.connect", attributes, span);
561
+ this.#actor.endTraceSpan(span, { code: "OK" });
562
+ } catch (error) {
563
+ this.#actor.endTraceSpan(span, {
564
+ code: "ERROR",
565
+ message: stringifyError(error),
566
+ });
567
+ this.#actor.rLog.error({
568
+ msg: "error in `onConnect`",
569
+ error: stringifyError(error),
570
+ });
571
+ conn?.disconnect("`onConnect` failed");
469
572
  }
470
573
  }
471
574
  }
@@ -18,17 +18,30 @@ import {
18
18
  import type { AnyDatabaseProvider } from "../database";
19
19
  import * as errors from "../errors";
20
20
  import { CachedSerializer } from "../protocol/serde";
21
+ import type { EventSchemaConfig, QueueSchemaConfig } from "../schema";
21
22
  import type { ActorInstance } from "./mod";
22
23
 
23
24
  /**
24
25
  * Manages event subscriptions and broadcasting for actor instances.
25
26
  * Handles subscription tracking and efficient message distribution to connected clients.
26
27
  */
27
- export class EventManager<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
28
- #actor: ActorInstance<S, CP, CS, V, I, DB>;
29
- #subscriptionIndex = new Map<string, Set<Conn<S, CP, CS, V, I, DB>>>();
28
+ export class EventManager<
29
+ S,
30
+ CP,
31
+ CS,
32
+ V,
33
+ I,
34
+ DB extends AnyDatabaseProvider,
35
+ E extends EventSchemaConfig = Record<never, never>,
36
+ Q extends QueueSchemaConfig = Record<never, never>,
37
+ > {
38
+ #actor: ActorInstance<S, CP, CS, V, I, DB, E, Q>;
39
+ #subscriptionIndex = new Map<
40
+ string,
41
+ Set<Conn<S, CP, CS, V, I, DB, E, Q>>
42
+ >();
30
43
 
31
- constructor(actor: ActorInstance<S, CP, CS, V, I, DB>) {
44
+ constructor(actor: ActorInstance<S, CP, CS, V, I, DB, E, Q>) {
32
45
  this.#actor = actor;
33
46
  }
34
47
 
@@ -43,7 +56,7 @@ export class EventManager<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
43
56
  */
44
57
  addSubscription(
45
58
  eventName: string,
46
- connection: Conn<S, CP, CS, V, I, DB>,
59
+ connection: Conn<S, CP, CS, V, I, DB, E, Q>,
47
60
  fromPersist: boolean,
48
61
  ) {
49
62
  // Check if already subscribed
@@ -94,7 +107,7 @@ export class EventManager<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
94
107
  */
95
108
  removeSubscription(
96
109
  eventName: string,
97
- connection: Conn<S, CP, CS, V, I, DB>,
110
+ connection: Conn<S, CP, CS, V, I, DB, E, Q>,
98
111
  fromRemoveConn: boolean,
99
112
  ) {
100
113
  // Check if subscription exists
@@ -154,13 +167,6 @@ export class EventManager<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
154
167
  broadcast<Args extends Array<unknown>>(name: string, ...args: Args) {
155
168
  this.#actor.assertReady();
156
169
 
157
- // Emit to inspector
158
- this.#actor.inspector.emitter.emit("eventFired", {
159
- type: "broadcast",
160
- eventName: name,
161
- args,
162
- });
163
-
164
170
  // Get subscribers for this event
165
171
  const subscribers = this.#subscriptionIndex.get(name);
166
172
  if (!subscribers || subscribers.size === 0) {
@@ -171,6 +177,11 @@ export class EventManager<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
171
177
  return;
172
178
  }
173
179
 
180
+ this.#actor.emitTraceEvent("message.broadcast", {
181
+ "rivet.event.name": name,
182
+ "rivet.broadcast.subscribers": subscribers.size,
183
+ });
184
+
174
185
  // Create serialized message
175
186
  const eventData = { name, args };
176
187
  const toClientSerializer = new CachedSerializer(
@@ -243,7 +254,7 @@ export class EventManager<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
243
254
  */
244
255
  getSubscribers(
245
256
  eventName: string,
246
- ): Set<Conn<S, CP, CS, V, I, DB>> | undefined {
257
+ ): Set<Conn<S, CP, CS, V, I, DB, E, Q>> | undefined {
247
258
  return this.#subscriptionIndex.get(eventName);
248
259
  }
249
260
 
@@ -266,7 +277,7 @@ export class EventManager<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
266
277
  *
267
278
  * @param connection - The connection to clear subscriptions for
268
279
  */
269
- clearConnectionSubscriptions(connection: Conn<S, CP, CS, V, I, DB>) {
280
+ clearConnectionSubscriptions(connection: Conn<S, CP, CS, V, I, DB, E, Q>) {
270
281
  for (const eventName of [...connection.subscriptions.values()]) {
271
282
  this.removeSubscription(eventName, connection, true);
272
283
  }