rivetkit 2.0.23 → 2.0.24

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 (228) hide show
  1. package/dist/schemas/actor-persist/v2.ts +3 -3
  2. package/dist/schemas/actor-persist/v3.ts +274 -0
  3. package/dist/schemas/client-protocol/v2.ts +432 -0
  4. package/dist/schemas/file-system-driver/v2.ts +136 -0
  5. package/dist/tsup/actor/errors.cjs +2 -4
  6. package/dist/tsup/actor/errors.cjs.map +1 -1
  7. package/dist/tsup/actor/errors.d.cts +7 -10
  8. package/dist/tsup/actor/errors.d.ts +7 -10
  9. package/dist/tsup/actor/errors.js +9 -11
  10. package/dist/tsup/{actor-router-consts-B3Lu87yJ.d.cts → actor-router-consts-DzI2szci.d.cts} +5 -9
  11. package/dist/tsup/{actor-router-consts-B3Lu87yJ.d.ts → actor-router-consts-DzI2szci.d.ts} +5 -9
  12. package/dist/tsup/{chunk-3JYSUFET.cjs → chunk-3543NCSN.cjs} +45 -57
  13. package/dist/tsup/chunk-3543NCSN.cjs.map +1 -0
  14. package/dist/tsup/chunk-4SHILYS5.cjs +5694 -0
  15. package/dist/tsup/chunk-4SHILYS5.cjs.map +1 -0
  16. package/dist/tsup/{chunk-NCUALX2Q.cjs → chunk-5BZO5XPS.cjs} +3 -3
  17. package/dist/tsup/{chunk-NCUALX2Q.cjs.map → chunk-5BZO5XPS.cjs.map} +1 -1
  18. package/dist/tsup/{chunk-5PKKNNNS.js → chunk-BAIGSF64.js} +189 -187
  19. package/dist/tsup/chunk-BAIGSF64.js.map +1 -0
  20. package/dist/tsup/{chunk-HNYF4T36.cjs → chunk-CHLZBSI2.cjs} +17 -17
  21. package/dist/tsup/chunk-CHLZBSI2.cjs.map +1 -0
  22. package/dist/tsup/chunk-D3SLADUD.cjs +512 -0
  23. package/dist/tsup/chunk-D3SLADUD.cjs.map +1 -0
  24. package/dist/tsup/{chunk-KSRXX3Z4.cjs → chunk-D6762AOA.cjs} +20 -25
  25. package/dist/tsup/chunk-D6762AOA.cjs.map +1 -0
  26. package/dist/tsup/{chunk-C56XVVV4.cjs → chunk-DLK5YCTN.cjs} +187 -185
  27. package/dist/tsup/chunk-DLK5YCTN.cjs.map +1 -0
  28. package/dist/tsup/{chunk-DLYZKFRY.js → chunk-DUJQWGYD.js} +3 -7
  29. package/dist/tsup/chunk-DUJQWGYD.js.map +1 -0
  30. package/dist/tsup/{chunk-5UJQWWO3.js → chunk-EIPANQMF.js} +2 -2
  31. package/dist/tsup/{chunk-54DVMQPT.cjs → chunk-ESMTDP7G.cjs} +6 -6
  32. package/dist/tsup/chunk-ESMTDP7G.cjs.map +1 -0
  33. package/dist/tsup/{chunk-XYK5PY3B.cjs → chunk-FVAKREFB.cjs} +1900 -1737
  34. package/dist/tsup/chunk-FVAKREFB.cjs.map +1 -0
  35. package/dist/tsup/{chunk-PHNIVSG5.js → chunk-I3XT7WOF.js} +44 -56
  36. package/dist/tsup/chunk-I3XT7WOF.js.map +1 -0
  37. package/dist/tsup/{chunk-3I6ZIJVJ.js → chunk-IMDS5T42.js} +3 -3
  38. package/dist/tsup/chunk-IMDS5T42.js.map +1 -0
  39. package/dist/tsup/{chunk-SN4KWTRA.cjs → chunk-J3HZJF2P.cjs} +10 -14
  40. package/dist/tsup/chunk-J3HZJF2P.cjs.map +1 -0
  41. package/dist/tsup/{chunk-NOZSCUPQ.js → chunk-MBBJUHSP.js} +1844 -1681
  42. package/dist/tsup/chunk-MBBJUHSP.js.map +1 -0
  43. package/dist/tsup/{chunk-RVVUS4X6.js → chunk-MO5CB6MD.js} +9 -9
  44. package/dist/tsup/chunk-MO5CB6MD.js.map +1 -0
  45. package/dist/tsup/chunk-OFOTPKAH.js +512 -0
  46. package/dist/tsup/chunk-OFOTPKAH.js.map +1 -0
  47. package/dist/tsup/{chunk-G64QUEDJ.js → chunk-W6RDS6NW.js} +23 -28
  48. package/dist/tsup/chunk-W6RDS6NW.js.map +1 -0
  49. package/dist/tsup/{chunk-XSDSNHSE.cjs → chunk-YC5DUHPM.cjs} +4 -8
  50. package/dist/tsup/chunk-YC5DUHPM.cjs.map +1 -0
  51. package/dist/tsup/{chunk-YAYNBR37.js → chunk-YC7YPM2T.js} +2 -6
  52. package/dist/tsup/chunk-YC7YPM2T.js.map +1 -0
  53. package/dist/tsup/{chunk-FTQ62XTN.js → chunk-ZSPU5R4C.js} +3322 -2251
  54. package/dist/tsup/chunk-ZSPU5R4C.js.map +1 -0
  55. package/dist/tsup/client/mod.cjs +9 -9
  56. package/dist/tsup/client/mod.d.cts +5 -7
  57. package/dist/tsup/client/mod.d.ts +5 -7
  58. package/dist/tsup/client/mod.js +8 -8
  59. package/dist/tsup/common/log.cjs +3 -3
  60. package/dist/tsup/common/log.js +2 -2
  61. package/dist/tsup/common/websocket.cjs +4 -4
  62. package/dist/tsup/common/websocket.js +3 -3
  63. package/dist/tsup/{conn-B3Vhbgnd.d.ts → config-BRDYDraU.d.cts} +1119 -1047
  64. package/dist/tsup/{conn-DJWL3nGx.d.cts → config-Bo-blHpJ.d.ts} +1119 -1047
  65. package/dist/tsup/driver-helpers/mod.cjs +5 -13
  66. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  67. package/dist/tsup/driver-helpers/mod.d.cts +11 -9
  68. package/dist/tsup/driver-helpers/mod.d.ts +11 -9
  69. package/dist/tsup/driver-helpers/mod.js +14 -22
  70. package/dist/tsup/driver-test-suite/mod.cjs +474 -303
  71. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  72. package/dist/tsup/driver-test-suite/mod.d.cts +6 -9
  73. package/dist/tsup/driver-test-suite/mod.d.ts +6 -9
  74. package/dist/tsup/driver-test-suite/mod.js +1085 -914
  75. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  76. package/dist/tsup/inspector/mod.cjs +6 -6
  77. package/dist/tsup/inspector/mod.d.cts +5 -7
  78. package/dist/tsup/inspector/mod.d.ts +5 -7
  79. package/dist/tsup/inspector/mod.js +5 -5
  80. package/dist/tsup/mod.cjs +10 -16
  81. package/dist/tsup/mod.cjs.map +1 -1
  82. package/dist/tsup/mod.d.cts +23 -25
  83. package/dist/tsup/mod.d.ts +23 -25
  84. package/dist/tsup/mod.js +17 -23
  85. package/dist/tsup/test/mod.cjs +11 -11
  86. package/dist/tsup/test/mod.d.cts +4 -6
  87. package/dist/tsup/test/mod.d.ts +4 -6
  88. package/dist/tsup/test/mod.js +10 -10
  89. package/dist/tsup/utils.cjs +3 -5
  90. package/dist/tsup/utils.cjs.map +1 -1
  91. package/dist/tsup/utils.d.cts +1 -2
  92. package/dist/tsup/utils.d.ts +1 -2
  93. package/dist/tsup/utils.js +2 -4
  94. package/package.json +13 -6
  95. package/src/actor/config.ts +56 -44
  96. package/src/actor/conn/driver.ts +61 -0
  97. package/src/actor/conn/drivers/http.ts +17 -0
  98. package/src/actor/conn/drivers/raw-request.ts +24 -0
  99. package/src/actor/conn/drivers/raw-websocket.ts +65 -0
  100. package/src/actor/conn/drivers/websocket.ts +129 -0
  101. package/src/actor/conn/mod.ts +232 -0
  102. package/src/actor/conn/persisted.ts +81 -0
  103. package/src/actor/conn/state-manager.ts +196 -0
  104. package/src/actor/contexts/action.ts +23 -0
  105. package/src/actor/{context.ts → contexts/actor.ts} +19 -8
  106. package/src/actor/contexts/conn-init.ts +31 -0
  107. package/src/actor/contexts/conn.ts +48 -0
  108. package/src/actor/contexts/create-conn-state.ts +13 -0
  109. package/src/actor/contexts/on-before-connect.ts +13 -0
  110. package/src/actor/contexts/on-connect.ts +22 -0
  111. package/src/actor/contexts/request.ts +48 -0
  112. package/src/actor/contexts/websocket.ts +48 -0
  113. package/src/actor/definition.ts +3 -3
  114. package/src/actor/driver.ts +36 -5
  115. package/src/actor/errors.ts +19 -24
  116. package/src/actor/instance/connection-manager.ts +465 -0
  117. package/src/actor/instance/event-manager.ts +292 -0
  118. package/src/actor/instance/kv.ts +15 -0
  119. package/src/actor/instance/mod.ts +1107 -0
  120. package/src/actor/instance/persisted.ts +67 -0
  121. package/src/actor/instance/schedule-manager.ts +349 -0
  122. package/src/actor/instance/state-manager.ts +502 -0
  123. package/src/actor/mod.ts +13 -16
  124. package/src/actor/protocol/old.ts +131 -43
  125. package/src/actor/protocol/serde.ts +19 -4
  126. package/src/actor/router-endpoints.ts +61 -586
  127. package/src/actor/router-websocket-endpoints.ts +408 -0
  128. package/src/actor/router.ts +63 -197
  129. package/src/actor/schedule.ts +1 -1
  130. package/src/client/actor-conn.ts +183 -249
  131. package/src/client/actor-handle.ts +29 -6
  132. package/src/client/client.ts +0 -4
  133. package/src/client/config.ts +1 -4
  134. package/src/client/mod.ts +0 -1
  135. package/src/client/raw-utils.ts +3 -3
  136. package/src/client/utils.ts +85 -39
  137. package/src/common/actor-router-consts.ts +5 -12
  138. package/src/common/{inline-websocket-adapter2.ts → inline-websocket-adapter.ts} +26 -48
  139. package/src/common/log.ts +1 -1
  140. package/src/common/router.ts +28 -17
  141. package/src/common/utils.ts +2 -0
  142. package/src/driver-helpers/mod.ts +7 -10
  143. package/src/driver-helpers/utils.ts +18 -9
  144. package/src/driver-test-suite/mod.ts +26 -50
  145. package/src/driver-test-suite/test-inline-client-driver.ts +27 -51
  146. package/src/driver-test-suite/tests/actor-conn-hibernation.ts +150 -0
  147. package/src/driver-test-suite/tests/actor-conn-state.ts +1 -4
  148. package/src/driver-test-suite/tests/actor-conn.ts +5 -9
  149. package/src/driver-test-suite/tests/actor-destroy.ts +294 -0
  150. package/src/driver-test-suite/tests/actor-driver.ts +0 -7
  151. package/src/driver-test-suite/tests/actor-handle.ts +12 -12
  152. package/src/driver-test-suite/tests/actor-metadata.ts +1 -1
  153. package/src/driver-test-suite/tests/manager-driver.ts +1 -1
  154. package/src/driver-test-suite/tests/raw-http-direct-registry.ts +8 -8
  155. package/src/driver-test-suite/tests/raw-http-request-properties.ts +6 -5
  156. package/src/driver-test-suite/tests/raw-http.ts +5 -5
  157. package/src/driver-test-suite/tests/raw-websocket-direct-registry.ts +7 -7
  158. package/src/driver-test-suite/tests/request-access.ts +4 -4
  159. package/src/driver-test-suite/utils.ts +6 -10
  160. package/src/drivers/engine/actor-driver.ts +614 -424
  161. package/src/drivers/engine/mod.ts +0 -1
  162. package/src/drivers/file-system/actor.ts +24 -12
  163. package/src/drivers/file-system/global-state.ts +427 -37
  164. package/src/drivers/file-system/manager.ts +71 -83
  165. package/src/drivers/file-system/mod.ts +3 -0
  166. package/src/drivers/file-system/utils.ts +18 -8
  167. package/src/engine-process/mod.ts +38 -38
  168. package/src/inspector/utils.ts +7 -5
  169. package/src/manager/driver.ts +11 -4
  170. package/src/manager/gateway.ts +4 -29
  171. package/src/manager/protocol/mod.ts +0 -2
  172. package/src/manager/protocol/query.ts +0 -4
  173. package/src/manager/router.ts +67 -64
  174. package/src/manager-api/actors.ts +13 -0
  175. package/src/mod.ts +1 -3
  176. package/src/registry/mod.ts +20 -20
  177. package/src/registry/serve.ts +9 -14
  178. package/src/remote-manager-driver/actor-websocket-client.ts +1 -16
  179. package/src/remote-manager-driver/api-endpoints.ts +13 -1
  180. package/src/remote-manager-driver/api-utils.ts +8 -0
  181. package/src/remote-manager-driver/metadata.ts +58 -0
  182. package/src/remote-manager-driver/mod.ts +47 -62
  183. package/src/remote-manager-driver/ws-proxy.ts +1 -1
  184. package/src/schemas/actor-persist/mod.ts +1 -1
  185. package/src/schemas/actor-persist/versioned.ts +56 -31
  186. package/src/schemas/client-protocol/mod.ts +1 -1
  187. package/src/schemas/client-protocol/versioned.ts +41 -21
  188. package/src/schemas/client-protocol-zod/mod.ts +103 -0
  189. package/src/schemas/file-system-driver/mod.ts +1 -1
  190. package/src/schemas/file-system-driver/versioned.ts +42 -19
  191. package/src/serde.ts +33 -11
  192. package/src/test/mod.ts +7 -3
  193. package/src/utils/node.ts +173 -0
  194. package/src/utils.ts +0 -4
  195. package/dist/tsup/chunk-3I6ZIJVJ.js.map +0 -1
  196. package/dist/tsup/chunk-3JYSUFET.cjs.map +0 -1
  197. package/dist/tsup/chunk-54DVMQPT.cjs.map +0 -1
  198. package/dist/tsup/chunk-5PKKNNNS.js.map +0 -1
  199. package/dist/tsup/chunk-C56XVVV4.cjs.map +0 -1
  200. package/dist/tsup/chunk-D6PCH7FR.cjs +0 -4623
  201. package/dist/tsup/chunk-D6PCH7FR.cjs.map +0 -1
  202. package/dist/tsup/chunk-DLYZKFRY.js.map +0 -1
  203. package/dist/tsup/chunk-FTQ62XTN.js.map +0 -1
  204. package/dist/tsup/chunk-G64QUEDJ.js.map +0 -1
  205. package/dist/tsup/chunk-HNYF4T36.cjs.map +0 -1
  206. package/dist/tsup/chunk-JMLTKMJ7.cjs +0 -1119
  207. package/dist/tsup/chunk-JMLTKMJ7.cjs.map +0 -1
  208. package/dist/tsup/chunk-KSRXX3Z4.cjs.map +0 -1
  209. package/dist/tsup/chunk-NOZSCUPQ.js.map +0 -1
  210. package/dist/tsup/chunk-PHNIVSG5.js.map +0 -1
  211. package/dist/tsup/chunk-RUTBXBRR.js +0 -1119
  212. package/dist/tsup/chunk-RUTBXBRR.js.map +0 -1
  213. package/dist/tsup/chunk-RVVUS4X6.js.map +0 -1
  214. package/dist/tsup/chunk-SN4KWTRA.cjs.map +0 -1
  215. package/dist/tsup/chunk-XSDSNHSE.cjs.map +0 -1
  216. package/dist/tsup/chunk-XYK5PY3B.cjs.map +0 -1
  217. package/dist/tsup/chunk-YAYNBR37.js.map +0 -1
  218. package/src/actor/action.ts +0 -178
  219. package/src/actor/conn-drivers.ts +0 -216
  220. package/src/actor/conn-socket.ts +0 -8
  221. package/src/actor/conn.ts +0 -272
  222. package/src/actor/instance.ts +0 -2336
  223. package/src/actor/persisted.ts +0 -49
  224. package/src/actor/unstable-react.ts +0 -110
  225. package/src/driver-test-suite/tests/actor-reconnect.ts +0 -170
  226. package/src/drivers/engine/kv.ts +0 -3
  227. package/src/manager/hono-websocket-adapter.ts +0 -393
  228. /package/dist/tsup/{chunk-5UJQWWO3.js.map → chunk-EIPANQMF.js.map} +0 -0
@@ -1,30 +1,30 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkHNYF4T36cjs = require('../chunk-HNYF4T36.cjs');
3
+ var _chunkCHLZBSI2cjs = require('../chunk-CHLZBSI2.cjs');
4
4
 
5
5
 
6
6
 
7
- var _chunkXYK5PY3Bcjs = require('../chunk-XYK5PY3B.cjs');
7
+ var _chunkFVAKREFBcjs = require('../chunk-FVAKREFB.cjs');
8
8
 
9
9
 
10
10
 
11
11
 
12
- var _chunkXSDSNHSEcjs = require('../chunk-XSDSNHSE.cjs');
12
+ var _chunkYC5DUHPMcjs = require('../chunk-YC5DUHPM.cjs');
13
13
 
14
14
 
15
- var _chunk54DVMQPTcjs = require('../chunk-54DVMQPT.cjs');
15
+ var _chunkESMTDP7Gcjs = require('../chunk-ESMTDP7G.cjs');
16
16
 
17
17
 
18
18
 
19
- var _chunkD6PCH7FRcjs = require('../chunk-D6PCH7FR.cjs');
20
- require('../chunk-SN4KWTRA.cjs');
19
+ var _chunk4SHILYS5cjs = require('../chunk-4SHILYS5.cjs');
20
+ require('../chunk-J3HZJF2P.cjs');
21
21
 
22
22
 
23
- var _chunkNCUALX2Qcjs = require('../chunk-NCUALX2Q.cjs');
23
+ var _chunk5BZO5XPScjs = require('../chunk-5BZO5XPS.cjs');
24
24
 
25
25
 
26
26
 
27
- var _chunkJMLTKMJ7cjs = require('../chunk-JMLTKMJ7.cjs');
27
+ var _chunkD3SLADUDcjs = require('../chunk-D3SLADUD.cjs');
28
28
 
29
29
 
30
30
 
@@ -35,26 +35,25 @@ var _chunkJMLTKMJ7cjs = require('../chunk-JMLTKMJ7.cjs');
35
35
 
36
36
 
37
37
 
38
- var _chunk3JYSUFETcjs = require('../chunk-3JYSUFET.cjs');
38
+ var _chunk3543NCSNcjs = require('../chunk-3543NCSN.cjs');
39
39
 
40
40
 
41
41
 
42
- var _chunkC56XVVV4cjs = require('../chunk-C56XVVV4.cjs');
42
+ var _chunkDLK5YCTNcjs = require('../chunk-DLK5YCTN.cjs');
43
43
 
44
44
 
45
45
 
46
- var _chunkKSRXX3Z4cjs = require('../chunk-KSRXX3Z4.cjs');
46
+ var _chunkD6762AOAcjs = require('../chunk-D6762AOA.cjs');
47
47
 
48
48
  // src/driver-test-suite/mod.ts
49
49
  var _nodeserver = require('@hono/node-server');
50
50
  var _nodews = require('@hono/node-ws');
51
- var _bundlerequire = require('bundle-require');
52
51
  var _invariant = require('invariant'); var _invariant2 = _interopRequireDefault(_invariant);
53
52
  var _vitest = require('vitest');
54
53
 
55
54
  // src/driver-test-suite/log.ts
56
55
  function logger() {
57
- return _chunkC56XVVV4cjs.getLogger.call(void 0, "test-suite");
56
+ return _chunkDLK5YCTNcjs.getLogger.call(void 0, "test-suite");
58
57
  }
59
58
 
60
59
  // src/driver-test-suite/tests/action-features.ts
@@ -65,43 +64,26 @@ function logger() {
65
64
 
66
65
  // src/driver-test-suite/test-inline-client-driver.ts
67
66
  var _cborx = require('cbor-x'); var cbor = _interopRequireWildcard(_cborx);
68
- function createTestInlineClientDriver(endpoint, encoding, transport) {
67
+ function createTestInlineClientDriver(endpoint, encoding) {
69
68
  return {
70
69
  getForId(input) {
71
- return makeInlineRequest(
72
- endpoint,
73
- encoding,
74
- transport,
75
- "getForId",
76
- [input]
77
- );
70
+ return makeInlineRequest(endpoint, encoding, "getForId", [input]);
78
71
  },
79
72
  getWithKey(input) {
80
- return makeInlineRequest(
81
- endpoint,
82
- encoding,
83
- transport,
84
- "getWithKey",
85
- [input]
86
- );
73
+ return makeInlineRequest(endpoint, encoding, "getWithKey", [input]);
87
74
  },
88
75
  getOrCreateWithKey(input) {
89
- return makeInlineRequest(
90
- endpoint,
91
- encoding,
92
- transport,
93
- "getOrCreateWithKey",
94
- [input]
95
- );
76
+ return makeInlineRequest(endpoint, encoding, "getOrCreateWithKey", [
77
+ input
78
+ ]);
96
79
  },
97
80
  createActor(input) {
98
- return makeInlineRequest(
99
- endpoint,
100
- encoding,
101
- transport,
102
- "createActor",
103
- [input]
104
- );
81
+ return makeInlineRequest(endpoint, encoding, "createActor", [
82
+ input
83
+ ]);
84
+ },
85
+ listActors(input) {
86
+ return makeInlineRequest(endpoint, encoding, "listActors", [input]);
105
87
  },
106
88
  async sendRequest(actorId, actorRequest) {
107
89
  var _a;
@@ -121,7 +103,7 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
121
103
  to: url
122
104
  });
123
105
  const headers = new Headers(actorRequest.headers);
124
- headers.set(_chunk3JYSUFETcjs.HEADER_ACTOR_ID, actorId);
106
+ headers.set(_chunk3543NCSNcjs.HEADER_ACTOR_ID, actorId);
125
107
  const response = await fetch(
126
108
  new Request(url, {
127
109
  method: actorRequest.method,
@@ -137,7 +119,7 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
137
119
  const errorData = await clonedResponse.json();
138
120
  if (errorData.error) {
139
121
  if (typeof errorData.error === "object") {
140
- throw new (0, _chunkD6PCH7FRcjs.ActorError)(
122
+ throw new (0, _chunk4SHILYS5cjs.ActorError)(
141
123
  errorData.error.code,
142
124
  errorData.error.message,
143
125
  errorData.error.metadata
@@ -145,7 +127,7 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
145
127
  }
146
128
  }
147
129
  } catch (e) {
148
- if (!(e instanceof _chunkD6PCH7FRcjs.ActorError)) {
130
+ if (!(e instanceof _chunk4SHILYS5cjs.ActorError)) {
149
131
  return response;
150
132
  }
151
133
  throw e;
@@ -153,8 +135,8 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
153
135
  }
154
136
  return response;
155
137
  },
156
- async openWebSocket(path, actorId, encoding2, params, connId, connToken) {
157
- const WebSocket2 = await _chunkNCUALX2Qcjs.importWebSocket.call(void 0, );
138
+ async openWebSocket(path, actorId, encoding2, params) {
139
+ const WebSocket2 = await _chunk5BZO5XPScjs.importWebSocket.call(void 0, );
158
140
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
159
141
  const wsUrl = new URL(
160
142
  `${endpoint}/.test/inline-driver/connect-websocket/ws`
@@ -165,20 +147,24 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
165
147
  });
166
148
  const wsProtocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
167
149
  const finalWsUrl = `${wsProtocol}//${wsUrl.host}${wsUrl.pathname}`;
168
- logger().debug({ msg: "connecting to websocket", url: finalWsUrl });
169
150
  const protocols = [];
170
- protocols.push(`${_chunk3JYSUFETcjs.WS_PROTOCOL_TARGET}actor`);
171
- protocols.push(`${_chunk3JYSUFETcjs.WS_PROTOCOL_ACTOR}${actorId}`);
172
- protocols.push(`${_chunk3JYSUFETcjs.WS_PROTOCOL_ENCODING}${encoding2}`);
173
- protocols.push(`${_chunk3JYSUFETcjs.WS_PROTOCOL_TRANSPORT}${transport}`);
151
+ protocols.push(_chunk3543NCSNcjs.WS_PROTOCOL_STANDARD);
152
+ protocols.push(`${_chunk3543NCSNcjs.WS_PROTOCOL_TARGET}actor`);
153
+ protocols.push(`${_chunk3543NCSNcjs.WS_PROTOCOL_ACTOR}${encodeURIComponent(actorId)}`);
154
+ protocols.push(`${_chunk3543NCSNcjs.WS_PROTOCOL_ENCODING}${encoding2}`);
174
155
  protocols.push(
175
- `${_chunk3JYSUFETcjs.WS_PROTOCOL_PATH}${encodeURIComponent(normalizedPath)}`
156
+ `${_chunk3543NCSNcjs.WS_TEST_PROTOCOL_PATH}${encodeURIComponent(normalizedPath)}`
176
157
  );
177
158
  if (params !== void 0) {
178
159
  protocols.push(
179
- `${_chunk3JYSUFETcjs.WS_PROTOCOL_CONN_PARAMS}${encodeURIComponent(JSON.stringify(params))}`
160
+ `${_chunk3543NCSNcjs.WS_PROTOCOL_CONN_PARAMS}${encodeURIComponent(JSON.stringify(params))}`
180
161
  );
181
162
  }
163
+ logger().debug({
164
+ msg: "connecting to websocket",
165
+ url: finalWsUrl,
166
+ protocols
167
+ });
182
168
  const ws = new WebSocket2(finalWsUrl, protocols);
183
169
  return ws;
184
170
  },
@@ -204,7 +190,6 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
204
190
  // return makeInlineRequest<Response>(
205
191
  // endpoint,
206
192
  // encoding,
207
- // transport,
208
193
  // "action",
209
194
  // [undefined, actorQuery, encoding, params, name, args],
210
195
  // );
@@ -219,7 +204,6 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
219
204
  // return makeInlineRequest<string>(
220
205
  // endpoint,
221
206
  // encodingKind,
222
- // transport,
223
207
  // "resolveActorId",
224
208
  // [undefined, actorQuery, encodingKind, params],
225
209
  // );
@@ -341,7 +325,6 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
341
325
  // actorId,
342
326
  // encoding,
343
327
  // connectionId,
344
- // transport,
345
328
  // });
346
329
  //
347
330
  // const result = await fetch(
@@ -353,7 +336,6 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
353
336
  // },
354
337
  // body: JSON.stringify({
355
338
  // encoding,
356
- // transport,
357
339
  // method: "sendHttpMessage",
358
340
  // args: [
359
341
  // undefined,
@@ -424,7 +406,7 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
424
406
  // if (errorData.error) {
425
407
  // // Handle both error formats:
426
408
  // // 1. { error: { code, message, metadata } } - structured format
427
- // // 2. { error: "message" } - simple string format (from custom onFetch handlers)
409
+ // // 2. { error: "message" } - simple string format (from custom onRequest handlers)
428
410
  // if (typeof errorData.error === "object") {
429
411
  // throw new ClientActorError(
430
412
  // errorData.error.code,
@@ -433,7 +415,7 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
433
415
  // );
434
416
  // }
435
417
  // // For simple string errors, just return the response as-is
436
- // // This allows custom onFetch handlers to return their own error formats
418
+ // // This allows custom onRequest handlers to return their own error formats
437
419
  // }
438
420
  // } catch (e) {
439
421
  // // If it's not our error format, just return the response as-is
@@ -510,11 +492,10 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
510
492
  // },
511
493
  };
512
494
  }
513
- async function makeInlineRequest(endpoint, encoding, transport, method, args) {
495
+ async function makeInlineRequest(endpoint, encoding, method, args) {
514
496
  logger().debug({
515
497
  msg: "sending inline request",
516
498
  encoding,
517
- transport,
518
499
  method,
519
500
  args
520
501
  });
@@ -525,7 +506,6 @@ async function makeInlineRequest(endpoint, encoding, transport, method, args) {
525
506
  },
526
507
  body: cbor.encode({
527
508
  encoding,
528
- transport,
529
509
  method,
530
510
  args
531
511
  }),
@@ -543,14 +523,14 @@ async function makeInlineRequest(endpoint, encoding, transport, method, args) {
543
523
  if ("ok" in callResponse) {
544
524
  return callResponse.ok;
545
525
  } else if ("err" in callResponse) {
546
- throw new (0, _chunkD6PCH7FRcjs.ActorError)(
526
+ throw new (0, _chunk4SHILYS5cjs.ActorError)(
547
527
  callResponse.err.group,
548
528
  callResponse.err.code,
549
529
  callResponse.err.message,
550
530
  callResponse.err.metadata
551
531
  );
552
532
  } else {
553
- _chunk3JYSUFETcjs.assertUnreachable.call(void 0, callResponse);
533
+ _chunk3543NCSNcjs.assertUnreachable.call(void 0, callResponse);
554
534
  }
555
535
  }
556
536
 
@@ -562,31 +542,27 @@ async function setupDriverTest(c, driverTestConfig) {
562
542
  _vitest.vi.setSystemTime(FAKE_TIME);
563
543
  }
564
544
  const { endpoint, namespace, runnerName, cleanup } = await driverTestConfig.start();
565
- c.onTestFinished(cleanup);
545
+ c.onTestFinished(() => {
546
+ logger().info("cleaning up test");
547
+ cleanup();
548
+ });
566
549
  let client;
567
550
  if (driverTestConfig.clientType === "http") {
568
- client = _chunk54DVMQPTcjs.createClient.call(void 0, {
551
+ client = _chunkESMTDP7Gcjs.createClient.call(void 0, {
569
552
  endpoint,
570
553
  namespace,
571
554
  runnerName,
572
- transport: driverTestConfig.transport,
573
555
  encoding: driverTestConfig.encoding
574
556
  });
575
557
  } else if (driverTestConfig.clientType === "inline") {
576
- const transport = _nullishCoalesce(driverTestConfig.transport, () => ( "websocket"));
577
558
  const encoding = _nullishCoalesce(driverTestConfig.encoding, () => ( "bare"));
578
- const managerDriver = createTestInlineClientDriver(
579
- endpoint,
580
- encoding,
581
- transport
582
- );
583
- const runConfig = _chunkJMLTKMJ7cjs.RunnerConfigSchema.parse({
584
- transport,
559
+ const managerDriver = createTestInlineClientDriver(endpoint, encoding);
560
+ const runConfig = _chunkD3SLADUDcjs.RunnerConfigSchema.parse({
585
561
  encoding
586
562
  });
587
- client = _chunkD6PCH7FRcjs.createClientWithDriver.call(void 0, managerDriver, runConfig);
563
+ client = _chunk4SHILYS5cjs.createClientWithDriver.call(void 0, managerDriver, runConfig);
588
564
  } else {
589
- _chunk3JYSUFETcjs.assertUnreachable.call(void 0, driverTestConfig.clientType);
565
+ _chunk3543NCSNcjs.assertUnreachable.call(void 0, driverTestConfig.clientType);
590
566
  }
591
567
  if (!driverTestConfig.HACK_skipCleanupNet) {
592
568
  c.onTestFinished(async () => await client.dispose());
@@ -838,9 +814,7 @@ function runActorConnTests(driverTestConfig) {
838
814
  });
839
815
  });
840
816
  _vitest.describe.call(void 0, "Lifecycle Hooks", () => {
841
- _vitest.test.skipIf(
842
- driverTestConfig.transport === "sse" && driverTestConfig.clientType === "inline"
843
- )("should trigger lifecycle hooks", async (c) => {
817
+ _vitest.test.call(void 0, "should trigger lifecycle hooks", async (c) => {
844
818
  const { client } = await setupDriverTest(c, driverTestConfig);
845
819
  const connHandle = client.counterWithLifecycle.getOrCreate(
846
820
  ["test-lifecycle"],
@@ -851,7 +825,7 @@ function runActorConnTests(driverTestConfig) {
851
825
  const connection = connHandle.connect();
852
826
  const events = await connection.getEvents();
853
827
  _vitest.expect.call(void 0, events).toEqual([
854
- "onStart",
828
+ "onWake",
855
829
  "onBeforeConnect",
856
830
  "onConnect"
857
831
  ]);
@@ -865,18 +839,18 @@ function runActorConnTests(driverTestConfig) {
865
839
  _vitest.expect.call(void 0, finalEvents).toBeOneOf([
866
840
  // Still active
867
841
  [
868
- "onStart",
842
+ "onWake",
869
843
  "onBeforeConnect",
870
844
  "onConnect",
871
845
  "onDisconnect"
872
846
  ],
873
847
  // Went to sleep and woke back up
874
848
  [
875
- "onStart",
849
+ "onWake",
876
850
  "onBeforeConnect",
877
851
  "onConnect",
878
852
  "onDisconnect",
879
- "onStart"
853
+ "onWake"
880
854
  ]
881
855
  ]);
882
856
  },
@@ -972,9 +946,7 @@ function runActorConnStateTests(driverTestConfig) {
972
946
  });
973
947
  });
974
948
  _vitest.describe.call(void 0, "Connection Lifecycle", () => {
975
- _vitest.test.skipIf(
976
- driverTestConfig.transport === "sse" && driverTestConfig.clientType === "inline"
977
- )("should track connection and disconnection events", async (c) => {
949
+ _vitest.test.call(void 0, "should track connection and disconnection events", async (c) => {
978
950
  const { client } = await setupDriverTest(c, driverTestConfig);
979
951
  const debugHandle = client.connStateActor.getOrCreate(
980
952
  void 0,
@@ -1075,6 +1047,191 @@ function runActorConnStateTests(driverTestConfig) {
1075
1047
  });
1076
1048
  }
1077
1049
 
1050
+ // src/driver-test-suite/tests/actor-destroy.ts
1051
+
1052
+ function runActorDestroyTests(driverTestConfig) {
1053
+ _vitest.describe.call(void 0, "Actor Destroy Tests", () => {
1054
+ _vitest.test.call(void 0, "actor destroy clears state (without connect)", async (c) => {
1055
+ const { client } = await setupDriverTest(c, driverTestConfig);
1056
+ const actorKey = "test-destroy-without-connect";
1057
+ const observer = client.destroyObserver.getOrCreate(["observer"]);
1058
+ await observer.reset();
1059
+ const destroyActor = client.destroyActor.getOrCreate([actorKey]);
1060
+ await destroyActor.setValue(42);
1061
+ const value = await destroyActor.getValue();
1062
+ _vitest.expect.call(void 0, value).toBe(42);
1063
+ const actorId = await destroyActor.resolve();
1064
+ await destroyActor.destroy();
1065
+ await _vitest.vi.waitFor(async () => {
1066
+ const wasDestroyed = await observer.wasDestroyed(actorKey);
1067
+ _vitest.expect.call(void 0, wasDestroyed, "actor onDestroy not called").toBeTruthy();
1068
+ });
1069
+ await _vitest.vi.waitFor(async () => {
1070
+ let actorRunning = false;
1071
+ try {
1072
+ await client.destroyActor.getForId(actorId).getValue();
1073
+ actorRunning = true;
1074
+ } catch (err) {
1075
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1076
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1077
+ }
1078
+ _vitest.expect.call(void 0, actorRunning, "actor still running").toBeFalsy();
1079
+ });
1080
+ let existsById = false;
1081
+ try {
1082
+ await client.destroyActor.getForId(actorId).getValue();
1083
+ existsById = true;
1084
+ } catch (err) {
1085
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1086
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1087
+ }
1088
+ _vitest.expect.call(void 0,
1089
+ existsById,
1090
+ "actor should not exist after destroy"
1091
+ ).toBeFalsy();
1092
+ let existsByKey = false;
1093
+ try {
1094
+ await client.destroyActor.get(["test-destroy-without-connect"]).resolve();
1095
+ existsByKey = true;
1096
+ } catch (err) {
1097
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1098
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1099
+ }
1100
+ _vitest.expect.call(void 0,
1101
+ existsByKey,
1102
+ "actor should not exist after destroy"
1103
+ ).toBeFalsy();
1104
+ const newActor = client.destroyActor.getOrCreate([
1105
+ "test-destroy-without-connect"
1106
+ ]);
1107
+ const newValue = await newActor.getValue();
1108
+ _vitest.expect.call(void 0, newValue).toBe(0);
1109
+ });
1110
+ _vitest.test.call(void 0, "actor destroy clears state (with connect)", async (c) => {
1111
+ const { client } = await setupDriverTest(c, driverTestConfig);
1112
+ const actorKey = "test-destroy-with-connect";
1113
+ const observer = client.destroyObserver.getOrCreate(["observer"]);
1114
+ await observer.reset();
1115
+ const destroyActorHandle = client.destroyActor.getOrCreate([
1116
+ actorKey
1117
+ ]);
1118
+ const actorId = await destroyActorHandle.resolve();
1119
+ const destroyActor = destroyActorHandle.connect();
1120
+ await destroyActor.setValue(99);
1121
+ const value = await destroyActor.getValue();
1122
+ _vitest.expect.call(void 0, value).toBe(99);
1123
+ await destroyActor.destroy();
1124
+ await destroyActor.dispose();
1125
+ await _vitest.vi.waitFor(async () => {
1126
+ const wasDestroyed = await observer.wasDestroyed(actorKey);
1127
+ _vitest.expect.call(void 0, wasDestroyed, "actor onDestroy not called").toBeTruthy();
1128
+ });
1129
+ await _vitest.vi.waitFor(async () => {
1130
+ let actorRunning = false;
1131
+ try {
1132
+ await client.destroyActor.getForId(actorId).getValue();
1133
+ actorRunning = true;
1134
+ } catch (err) {
1135
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1136
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1137
+ }
1138
+ _vitest.expect.call(void 0, actorRunning, "actor still running").toBeFalsy();
1139
+ });
1140
+ let existsById = false;
1141
+ try {
1142
+ await client.destroyActor.getForId(actorId).getValue();
1143
+ existsById = true;
1144
+ } catch (err) {
1145
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1146
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1147
+ }
1148
+ _vitest.expect.call(void 0,
1149
+ existsById,
1150
+ "actor should not exist after destroy"
1151
+ ).toBeFalsy();
1152
+ let existsByKey = false;
1153
+ try {
1154
+ await client.destroyActor.get(["test-destroy-with-connect"]).resolve();
1155
+ existsByKey = true;
1156
+ } catch (err) {
1157
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1158
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1159
+ }
1160
+ _vitest.expect.call(void 0,
1161
+ existsByKey,
1162
+ "actor should not exist after destroy"
1163
+ ).toBeFalsy();
1164
+ const newActor = client.destroyActor.getOrCreate([
1165
+ "test-destroy-with-connect"
1166
+ ]);
1167
+ const newValue = await newActor.getValue();
1168
+ _vitest.expect.call(void 0, newValue).toBe(0);
1169
+ });
1170
+ _vitest.test.call(void 0, "actor destroy allows recreation via getOrCreate with resolve", async (c) => {
1171
+ const { client } = await setupDriverTest(c, driverTestConfig);
1172
+ const actorKey = "test-destroy-getorcreate-resolve";
1173
+ const observer = client.destroyObserver.getOrCreate(["observer"]);
1174
+ await observer.reset();
1175
+ const destroyActor = client.destroyActor.getOrCreate([actorKey]);
1176
+ await destroyActor.setValue(123);
1177
+ const value = await destroyActor.getValue();
1178
+ _vitest.expect.call(void 0, value).toBe(123);
1179
+ const actorId = await destroyActor.resolve();
1180
+ await destroyActor.destroy();
1181
+ await _vitest.vi.waitFor(async () => {
1182
+ const wasDestroyed = await observer.wasDestroyed(actorKey);
1183
+ _vitest.expect.call(void 0, wasDestroyed, "actor onDestroy not called").toBeTruthy();
1184
+ });
1185
+ await _vitest.vi.waitFor(async () => {
1186
+ let actorRunning = false;
1187
+ try {
1188
+ await client.destroyActor.getForId(actorId).getValue();
1189
+ actorRunning = true;
1190
+ } catch (err) {
1191
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1192
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1193
+ }
1194
+ _vitest.expect.call(void 0, actorRunning, "actor still running").toBeFalsy();
1195
+ });
1196
+ const newHandle = client.destroyActor.getOrCreate([actorKey]);
1197
+ const newActorId = await newHandle.resolve();
1198
+ const newValue = await newHandle.getValue();
1199
+ _vitest.expect.call(void 0, newValue).toBe(0);
1200
+ });
1201
+ _vitest.test.call(void 0, "actor destroy allows recreation via create", async (c) => {
1202
+ const { client } = await setupDriverTest(c, driverTestConfig);
1203
+ const actorKey = "test-destroy-create";
1204
+ const observer = client.destroyObserver.getOrCreate(["observer"]);
1205
+ await observer.reset();
1206
+ const initialHandle = await client.destroyActor.create([actorKey]);
1207
+ await initialHandle.setValue(456);
1208
+ const value = await initialHandle.getValue();
1209
+ _vitest.expect.call(void 0, value).toBe(456);
1210
+ const actorId = await initialHandle.resolve();
1211
+ await initialHandle.destroy();
1212
+ await _vitest.vi.waitFor(async () => {
1213
+ const wasDestroyed = await observer.wasDestroyed(actorKey);
1214
+ _vitest.expect.call(void 0, wasDestroyed, "actor onDestroy not called").toBeTruthy();
1215
+ });
1216
+ await _vitest.vi.waitFor(async () => {
1217
+ let actorRunning = false;
1218
+ try {
1219
+ await client.destroyActor.getForId(actorId).getValue();
1220
+ actorRunning = true;
1221
+ } catch (err) {
1222
+ _vitest.expect.call(void 0, err.group).toBe("actor");
1223
+ _vitest.expect.call(void 0, err.code).toBe("not_found");
1224
+ }
1225
+ _vitest.expect.call(void 0, actorRunning, "actor still running").toBeFalsy();
1226
+ });
1227
+ const newHandle = await client.destroyActor.create([actorKey]);
1228
+ const newActorId = await newHandle.resolve();
1229
+ const newValue = await newHandle.getValue();
1230
+ _vitest.expect.call(void 0, newValue).toBe(0);
1231
+ });
1232
+ });
1233
+ }
1234
+
1078
1235
  // src/driver-test-suite/tests/actor-driver.ts
1079
1236
 
1080
1237
 
@@ -1143,12 +1300,12 @@ function runActorScheduleTests(driverTestConfig) {
1143
1300
 
1144
1301
  // fixtures/driver-test-suite/sleep.ts
1145
1302
  var SLEEP_TIMEOUT = 1e3;
1146
- var sleep = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1303
+ var sleep = _chunkFVAKREFBcjs.actor.call(void 0, {
1147
1304
  state: { startCount: 0, sleepCount: 0 },
1148
- onStart: (c) => {
1305
+ onWake: (c) => {
1149
1306
  c.state.startCount += 1;
1150
1307
  },
1151
- onStop: (c) => {
1308
+ onSleep: (c) => {
1152
1309
  c.state.sleepCount += 1;
1153
1310
  },
1154
1311
  actions: {
@@ -1172,13 +1329,13 @@ var sleep = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1172
1329
  sleepTimeout: SLEEP_TIMEOUT
1173
1330
  }
1174
1331
  });
1175
- var sleepWithLongRpc = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1332
+ var sleepWithLongRpc = _chunkFVAKREFBcjs.actor.call(void 0, {
1176
1333
  state: { startCount: 0, sleepCount: 0 },
1177
1334
  createVars: () => ({}),
1178
- onStart: (c) => {
1335
+ onWake: (c) => {
1179
1336
  c.state.startCount += 1;
1180
1337
  },
1181
- onStop: (c) => {
1338
+ onSleep: (c) => {
1182
1339
  c.state.sleepCount += 1;
1183
1340
  },
1184
1341
  actions: {
@@ -1190,7 +1347,7 @@ var sleepWithLongRpc = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1190
1347
  },
1191
1348
  longRunningRpc: async (c) => {
1192
1349
  c.log.info("starting long running rpc");
1193
- c.vars.longRunningResolve = _chunkC56XVVV4cjs.promiseWithResolvers.call(void 0, );
1350
+ c.vars.longRunningResolve = _chunkDLK5YCTNcjs.promiseWithResolvers.call(void 0, );
1194
1351
  c.broadcast("waiting");
1195
1352
  await c.vars.longRunningResolve.promise;
1196
1353
  c.log.info("finished long running rpc");
@@ -1204,15 +1361,15 @@ var sleepWithLongRpc = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1204
1361
  sleepTimeout: SLEEP_TIMEOUT
1205
1362
  }
1206
1363
  });
1207
- var sleepWithRawHttp = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1364
+ var sleepWithRawHttp = _chunkFVAKREFBcjs.actor.call(void 0, {
1208
1365
  state: { startCount: 0, sleepCount: 0, requestCount: 0 },
1209
- onStart: (c) => {
1366
+ onWake: (c) => {
1210
1367
  c.state.startCount += 1;
1211
1368
  },
1212
- onStop: (c) => {
1369
+ onSleep: (c) => {
1213
1370
  c.state.sleepCount += 1;
1214
1371
  },
1215
- onFetch: async (c, request) => {
1372
+ onRequest: async (c, request) => {
1216
1373
  c.state.requestCount += 1;
1217
1374
  const url = new URL(request.url);
1218
1375
  if (url.pathname === "/long-request") {
@@ -1241,15 +1398,15 @@ var sleepWithRawHttp = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1241
1398
  sleepTimeout: SLEEP_TIMEOUT
1242
1399
  }
1243
1400
  });
1244
- var sleepWithRawWebSocket = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1401
+ var sleepWithRawWebSocket = _chunkFVAKREFBcjs.actor.call(void 0, {
1245
1402
  state: { startCount: 0, sleepCount: 0, connectionCount: 0 },
1246
- onStart: (c) => {
1403
+ onWake: (c) => {
1247
1404
  c.state.startCount += 1;
1248
1405
  },
1249
- onStop: (c) => {
1406
+ onSleep: (c) => {
1250
1407
  c.state.sleepCount += 1;
1251
1408
  },
1252
- onWebSocket: (c, websocket, opts) => {
1409
+ onWebSocket: (c, websocket) => {
1253
1410
  c.state.connectionCount += 1;
1254
1411
  c.log.info({
1255
1412
  msg: "websocket connected",
@@ -1304,12 +1461,12 @@ var sleepWithRawWebSocket = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1304
1461
  sleepTimeout: SLEEP_TIMEOUT
1305
1462
  }
1306
1463
  });
1307
- var sleepWithNoSleepOption = _chunkXYK5PY3Bcjs.actor.call(void 0, {
1464
+ var sleepWithNoSleepOption = _chunkFVAKREFBcjs.actor.call(void 0, {
1308
1465
  state: { startCount: 0, sleepCount: 0 },
1309
- onStart: (c) => {
1466
+ onWake: (c) => {
1310
1467
  c.state.startCount += 1;
1311
1468
  },
1312
- onStop: (c) => {
1469
+ onSleep: (c) => {
1313
1470
  c.state.sleepCount += 1;
1314
1471
  },
1315
1472
  actions: {
@@ -1626,10 +1783,6 @@ function runActorDriverTests(driverTestConfig) {
1626
1783
  _vitest.describe.call(void 0, "Actor Driver Tests", () => {
1627
1784
  runActorStateTests(driverTestConfig);
1628
1785
  runActorScheduleTests(driverTestConfig);
1629
- });
1630
- }
1631
- function runActorDriverTestsWithTransport(driverTestConfig) {
1632
- _vitest.describe.call(void 0, "Actor Driver Tests", () => {
1633
1786
  runActorSleepTests(driverTestConfig);
1634
1787
  });
1635
1788
  }
@@ -1674,8 +1827,8 @@ function runActorErrorHandlingTests(driverTestConfig) {
1674
1827
  await handle.throwInternalError();
1675
1828
  _vitest.expect.call(void 0, true).toBe(false);
1676
1829
  } catch (error) {
1677
- _vitest.expect.call(void 0, error.code).toBe(_chunkKSRXX3Z4cjs.INTERNAL_ERROR_CODE);
1678
- _vitest.expect.call(void 0, error.message).toBe(_chunkKSRXX3Z4cjs.INTERNAL_ERROR_DESCRIPTION);
1830
+ _vitest.expect.call(void 0, error.code).toBe(_chunkD6762AOAcjs.INTERNAL_ERROR_CODE);
1831
+ _vitest.expect.call(void 0, error.message).toBe(_chunkD6762AOAcjs.INTERNAL_ERROR_DESCRIPTION);
1679
1832
  }
1680
1833
  });
1681
1834
  });
@@ -1783,7 +1936,7 @@ function runActorHandleTests(driverTestConfig) {
1783
1936
  _vitest.expect.fail("did not error on duplicate create");
1784
1937
  } catch (err) {
1785
1938
  _vitest.expect.call(void 0, err.group).toBe("actor");
1786
- _vitest.expect.call(void 0, err.code).toBe("already_exists");
1939
+ _vitest.expect.call(void 0, err.code).toBe("duplicate_key");
1787
1940
  }
1788
1941
  });
1789
1942
  _vitest.test.call(void 0, ".get().resolve() errors for non-existent actor", async (c) => {
@@ -1846,13 +1999,13 @@ function runActorHandleTests(driverTestConfig) {
1846
1999
  "test-lifecycle-handle"
1847
2000
  ]);
1848
2001
  const initialEvents = await handle.getEvents();
1849
- _vitest.expect.call(void 0, initialEvents).toContain("onStart");
2002
+ _vitest.expect.call(void 0, initialEvents).toContain("onWake");
1850
2003
  const sameHandle = client.counterWithLifecycle.getOrCreate([
1851
2004
  "test-lifecycle-handle"
1852
2005
  ]);
1853
2006
  const events = await sameHandle.getEvents();
1854
- _vitest.expect.call(void 0, events).toContain("onStart");
1855
- _vitest.expect.call(void 0, events.filter((e) => e === "onStart").length).toBe(1);
2007
+ _vitest.expect.call(void 0, events).toContain("onWake");
2008
+ _vitest.expect.call(void 0, events.filter((e) => e === "onWake").length).toBe(1);
1856
2009
  });
1857
2010
  _vitest.test.call(void 0, "should trigger lifecycle hooks for each Action call", async (c) => {
1858
2011
  const { client } = await setupDriverTest(c, driverTestConfig);
@@ -1860,7 +2013,7 @@ function runActorHandleTests(driverTestConfig) {
1860
2013
  "test-lifecycle-action"
1861
2014
  ]);
1862
2015
  const initialEvents = await viewHandle.getEvents();
1863
- _vitest.expect.call(void 0, initialEvents).toContain("onStart");
2016
+ _vitest.expect.call(void 0, initialEvents).toContain("onWake");
1864
2017
  _vitest.expect.call(void 0, initialEvents).not.toContain("onBeforeConnect");
1865
2018
  _vitest.expect.call(void 0, initialEvents).not.toContain("onConnect");
1866
2019
  _vitest.expect.call(void 0, initialEvents).not.toContain("onDisconnect");
@@ -1912,7 +2065,7 @@ function runActorHandleTests(driverTestConfig) {
1912
2065
  await trackingHandle1.increment(5);
1913
2066
  await trackingHandle2.increment(10);
1914
2067
  const events = await viewHandle.getEvents();
1915
- _vitest.expect.call(void 0, events.filter((e) => e === "onStart").length).toBe(1);
2068
+ _vitest.expect.call(void 0, events.filter((e) => e === "onWake").length).toBe(1);
1916
2069
  _vitest.expect.call(void 0,
1917
2070
  events.filter((e) => e === "onBeforeConnect").length
1918
2071
  ).toBe(2);
@@ -1925,6 +2078,159 @@ function runActorHandleTests(driverTestConfig) {
1925
2078
  });
1926
2079
  }
1927
2080
 
2081
+ // src/driver-test-suite/tests/actor-conn-hibernation.ts
2082
+
2083
+
2084
+ // fixtures/driver-test-suite/hibernation.ts
2085
+ var HIBERNATION_SLEEP_TIMEOUT = 500;
2086
+ var hibernationActor = _chunkFVAKREFBcjs.actor.call(void 0, {
2087
+ state: {
2088
+ sleepCount: 0,
2089
+ wakeCount: 0
2090
+ },
2091
+ createConnState: (c) => {
2092
+ return {
2093
+ count: 0,
2094
+ connectCount: 0,
2095
+ disconnectCount: 0
2096
+ };
2097
+ },
2098
+ onWake: (c) => {
2099
+ c.state.wakeCount += 1;
2100
+ },
2101
+ onSleep: (c) => {
2102
+ c.state.sleepCount += 1;
2103
+ },
2104
+ onConnect: (c, conn) => {
2105
+ conn.state.connectCount += 1;
2106
+ },
2107
+ onDisconnect: (c, conn) => {
2108
+ conn.state.disconnectCount += 1;
2109
+ },
2110
+ actions: {
2111
+ // Basic RPC that returns a simple value
2112
+ ping: (c) => {
2113
+ return "pong";
2114
+ },
2115
+ // Increment the connection's count
2116
+ connIncrement: (c) => {
2117
+ c.conn.state.count += 1;
2118
+ return c.conn.state.count;
2119
+ },
2120
+ // Get the connection's count
2121
+ getConnCount: (c) => {
2122
+ return c.conn.state.count;
2123
+ },
2124
+ // Get the connection's lifecycle counts
2125
+ getConnLifecycleCounts: (c) => {
2126
+ return {
2127
+ connectCount: c.conn.state.connectCount,
2128
+ disconnectCount: c.conn.state.disconnectCount
2129
+ };
2130
+ },
2131
+ // Get all connection IDs
2132
+ getConnectionIds: (c) => {
2133
+ return c.conns.entries().map((x) => x[0]).toArray();
2134
+ },
2135
+ // Get actor sleep/wake counts
2136
+ getActorCounts: (c) => {
2137
+ return {
2138
+ sleepCount: c.state.sleepCount,
2139
+ wakeCount: c.state.wakeCount
2140
+ };
2141
+ },
2142
+ // Trigger sleep
2143
+ triggerSleep: (c) => {
2144
+ c.sleep();
2145
+ }
2146
+ },
2147
+ options: {
2148
+ sleepTimeout: HIBERNATION_SLEEP_TIMEOUT
2149
+ }
2150
+ });
2151
+
2152
+ // src/driver-test-suite/tests/actor-conn-hibernation.ts
2153
+ function runActorConnHibernationTests(driverTestConfig) {
2154
+ var _a;
2155
+ _vitest.describe.skipIf((_a = driverTestConfig.skip) == null ? void 0 : _a.hibernation)(
2156
+ "Connection Hibernation",
2157
+ () => {
2158
+ _vitest.test.call(void 0, "basic conn hibernation", async (c) => {
2159
+ const { client } = await setupDriverTest(c, driverTestConfig);
2160
+ const hibernatingActor = client.hibernationActor.getOrCreate().connect();
2161
+ const ping1 = await hibernatingActor.ping();
2162
+ _vitest.expect.call(void 0, ping1).toBe("pong");
2163
+ await hibernatingActor.triggerSleep();
2164
+ await waitFor(
2165
+ driverTestConfig,
2166
+ HIBERNATION_SLEEP_TIMEOUT + 100
2167
+ );
2168
+ const ping2 = await hibernatingActor.ping();
2169
+ _vitest.expect.call(void 0, ping2).toBe("pong");
2170
+ await hibernatingActor.dispose();
2171
+ });
2172
+ _vitest.test.call(void 0, "conn state persists through hibernation", async (c) => {
2173
+ const { client } = await setupDriverTest(c, driverTestConfig);
2174
+ const hibernatingActor = client.hibernationActor.getOrCreate().connect();
2175
+ const count1 = await hibernatingActor.connIncrement();
2176
+ _vitest.expect.call(void 0, count1).toBe(1);
2177
+ const count2 = await hibernatingActor.connIncrement();
2178
+ _vitest.expect.call(void 0, count2).toBe(2);
2179
+ const initialLifecycle = await hibernatingActor.getConnLifecycleCounts();
2180
+ _vitest.expect.call(void 0, initialLifecycle.connectCount).toBe(1);
2181
+ _vitest.expect.call(void 0, initialLifecycle.disconnectCount).toBe(0);
2182
+ const initialActorCounts = await hibernatingActor.getActorCounts();
2183
+ _vitest.expect.call(void 0, initialActorCounts.wakeCount).toBe(1);
2184
+ _vitest.expect.call(void 0, initialActorCounts.sleepCount).toBe(0);
2185
+ await hibernatingActor.triggerSleep();
2186
+ await waitFor(
2187
+ driverTestConfig,
2188
+ HIBERNATION_SLEEP_TIMEOUT + 100
2189
+ );
2190
+ const count3 = await hibernatingActor.getConnCount();
2191
+ _vitest.expect.call(void 0, count3).toBe(2);
2192
+ const finalLifecycle = await hibernatingActor.getConnLifecycleCounts();
2193
+ _vitest.expect.call(void 0, finalLifecycle.connectCount).toBe(1);
2194
+ _vitest.expect.call(void 0, finalLifecycle.disconnectCount).toBe(0);
2195
+ const finalActorCounts = await hibernatingActor.getActorCounts();
2196
+ _vitest.expect.call(void 0, finalActorCounts.wakeCount).toBe(2);
2197
+ _vitest.expect.call(void 0, finalActorCounts.sleepCount).toBe(1);
2198
+ await hibernatingActor.dispose();
2199
+ });
2200
+ _vitest.test.call(void 0, "closing connection during hibernation", async (c) => {
2201
+ const { client } = await setupDriverTest(c, driverTestConfig);
2202
+ const conn1 = client.hibernationActor.getOrCreate().connect();
2203
+ await conn1.ping();
2204
+ const connectionIds = await conn1.getConnectionIds();
2205
+ _vitest.expect.call(void 0, connectionIds.length).toBe(1);
2206
+ const conn1Id = connectionIds[0];
2207
+ await conn1.triggerSleep();
2208
+ await waitFor(
2209
+ driverTestConfig,
2210
+ HIBERNATION_SLEEP_TIMEOUT + 100
2211
+ );
2212
+ await conn1.dispose();
2213
+ await waitFor(driverTestConfig, 250);
2214
+ const conn2 = client.hibernationActor.getOrCreate().connect();
2215
+ await _vitest.vi.waitFor(
2216
+ async () => {
2217
+ const newConnectionIds = await conn2.getConnectionIds();
2218
+ _vitest.expect.call(void 0, newConnectionIds.length).toBe(1);
2219
+ _vitest.expect.call(void 0, newConnectionIds[0]).not.toBe(conn1Id);
2220
+ },
2221
+ {
2222
+ timeout: 5e3,
2223
+ interval: 100
2224
+ }
2225
+ );
2226
+ const lifecycle = await conn2.getConnLifecycleCounts();
2227
+ _vitest.expect.call(void 0, lifecycle.disconnectCount).toBe(0);
2228
+ await conn2.dispose();
2229
+ });
2230
+ }
2231
+ );
2232
+ }
2233
+
1928
2234
  // src/driver-test-suite/tests/actor-inline-client.ts
1929
2235
 
1930
2236
  function runActorInlineClientTests(driverTestConfig) {
@@ -2039,7 +2345,7 @@ function runActorInspectorTests(driverTestConfig) {
2039
2345
  _vitest.describe.call(void 0, "Manager Inspector", () => {
2040
2346
  _vitest.test.call(void 0, "should respond to ping", async (c) => {
2041
2347
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2042
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2348
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2043
2349
  `${endpoint}/inspect`,
2044
2350
  {
2045
2351
  headers: {
@@ -2059,7 +2365,7 @@ function runActorInspectorTests(driverTestConfig) {
2059
2365
  );
2060
2366
  await client.counter.create(["test-actor-1"]);
2061
2367
  await client.counter.create(["test-actor-2"]);
2062
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2368
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2063
2369
  `${endpoint}/inspect`,
2064
2370
  {
2065
2371
  headers: {
@@ -2088,7 +2394,7 @@ function runActorInspectorTests(driverTestConfig) {
2088
2394
  const actorKey2 = ["test-cursor-2"];
2089
2395
  await client.counter.create(actorKey1);
2090
2396
  await client.counter.create(actorKey2);
2091
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2397
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2092
2398
  `${endpoint}/inspect`,
2093
2399
  {
2094
2400
  headers: {
@@ -2116,7 +2422,7 @@ function runActorInspectorTests(driverTestConfig) {
2116
2422
  });
2117
2423
  _vitest.test.call(void 0, "should handle invalid limit parameter", async (c) => {
2118
2424
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2119
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2425
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2120
2426
  `${endpoint}/inspect`,
2121
2427
  {
2122
2428
  headers: {
@@ -2131,7 +2437,7 @@ function runActorInspectorTests(driverTestConfig) {
2131
2437
  });
2132
2438
  _vitest.test.call(void 0, "should create a new actor", async (c) => {
2133
2439
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2134
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2440
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2135
2441
  `${endpoint}/inspect`,
2136
2442
  {
2137
2443
  headers: {
@@ -2158,7 +2464,7 @@ function runActorInspectorTests(driverTestConfig) {
2158
2464
  });
2159
2465
  _vitest.test.call(void 0, "should get builds", async (c) => {
2160
2466
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2161
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2467
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2162
2468
  `${endpoint}/inspect`,
2163
2469
  {
2164
2470
  headers: {
@@ -2182,7 +2488,7 @@ function runActorInspectorTests(driverTestConfig) {
2182
2488
  );
2183
2489
  const handle = await client.counter.create(["test-get-by-id"]);
2184
2490
  const actorId = await handle.resolve();
2185
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2491
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2186
2492
  `${endpoint}/inspect`,
2187
2493
  {
2188
2494
  headers: {
@@ -2199,7 +2505,7 @@ function runActorInspectorTests(driverTestConfig) {
2199
2505
  });
2200
2506
  _vitest.test.call(void 0, "should return 404 for non-existent actor", async (c) => {
2201
2507
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2202
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2508
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2203
2509
  `${endpoint}/inspect`,
2204
2510
  {
2205
2511
  headers: {
@@ -2221,7 +2527,7 @@ function runActorInspectorTests(driverTestConfig) {
2221
2527
  );
2222
2528
  const handle = await client.counter.create(["test-bootstrap"]);
2223
2529
  await handle.resolve();
2224
- const http = _chunkXSDSNHSEcjs.createManagerInspectorClient.call(void 0,
2530
+ const http = _chunkYC5DUHPMcjs.createManagerInspectorClient.call(void 0,
2225
2531
  `${endpoint}/inspect`,
2226
2532
  {
2227
2533
  headers: {
@@ -2246,12 +2552,12 @@ function runActorInspectorTests(driverTestConfig) {
2246
2552
  _vitest.test.call(void 0, "should handle actor not found", async (c) => {
2247
2553
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2248
2554
  const actorId = "non-existing";
2249
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2555
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2250
2556
  `${endpoint}/actors/inspect`,
2251
2557
  {
2252
2558
  headers: {
2253
2559
  Authorization: `Bearer token`,
2254
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2560
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2255
2561
  getForId: { name: "counter", actorId }
2256
2562
  })
2257
2563
  }
@@ -2267,12 +2573,12 @@ function runActorInspectorTests(driverTestConfig) {
2267
2573
  );
2268
2574
  const handle = await client.counter.create(["test-ping"]);
2269
2575
  const actorId = await handle.resolve();
2270
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2576
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2271
2577
  `${endpoint}/actors/inspect`,
2272
2578
  {
2273
2579
  headers: {
2274
2580
  Authorization: `Bearer token`,
2275
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2581
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2276
2582
  getForId: { name: "counter", actorId }
2277
2583
  })
2278
2584
  }
@@ -2291,12 +2597,12 @@ function runActorInspectorTests(driverTestConfig) {
2291
2597
  const handle = await client.counter.create(["test-state"]);
2292
2598
  const actorId = await handle.resolve();
2293
2599
  await handle.increment(5);
2294
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2600
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2295
2601
  `${endpoint}/actors/inspect`,
2296
2602
  {
2297
2603
  headers: {
2298
2604
  Authorization: `Bearer token`,
2299
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2605
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2300
2606
  getForId: { name: "counter", actorId }
2301
2607
  })
2302
2608
  }
@@ -2321,12 +2627,12 @@ function runActorInspectorTests(driverTestConfig) {
2321
2627
  "test-state-replace"
2322
2628
  ]);
2323
2629
  const actorId = await handle.resolve();
2324
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2630
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2325
2631
  `${endpoint}/actors/inspect`,
2326
2632
  {
2327
2633
  headers: {
2328
2634
  Authorization: `Bearer token`,
2329
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2635
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2330
2636
  getForId: { name: "counter", actorId }
2331
2637
  })
2332
2638
  }
@@ -2354,12 +2660,12 @@ function runActorInspectorTests(driverTestConfig) {
2354
2660
  ]);
2355
2661
  const actorId = await handle.resolve();
2356
2662
  await handle.increment(3);
2357
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2663
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2358
2664
  `${endpoint}/actors/inspect`,
2359
2665
  {
2360
2666
  headers: {
2361
2667
  Authorization: `Bearer token`,
2362
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2668
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2363
2669
  getForId: { name: "counter", actorId }
2364
2670
  })
2365
2671
  }
@@ -2396,12 +2702,12 @@ function runActorInspectorTests(driverTestConfig) {
2396
2702
  const actorId = await handle.resolve();
2397
2703
  handle.connect();
2398
2704
  await handle.increment(10);
2399
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2705
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2400
2706
  `${endpoint}/actors/inspect`,
2401
2707
  {
2402
2708
  headers: {
2403
2709
  Authorization: `Bearer token`,
2404
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2710
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2405
2711
  getForId: { name: "counter", actorId }
2406
2712
  })
2407
2713
  }
@@ -2427,12 +2733,12 @@ function runActorInspectorTests(driverTestConfig) {
2427
2733
  const actorId = await handle.resolve();
2428
2734
  handle.connect();
2429
2735
  await handle.increment(10);
2430
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2736
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2431
2737
  `${endpoint}/actors/inspect`,
2432
2738
  {
2433
2739
  headers: {
2434
2740
  Authorization: `Bearer token`,
2435
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2741
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2436
2742
  getForId: { name: "counter", actorId }
2437
2743
  })
2438
2744
  }
@@ -2461,12 +2767,12 @@ function runActorInspectorTests(driverTestConfig) {
2461
2767
  const actorId = await handle.resolve();
2462
2768
  handle.connect();
2463
2769
  await handle.increment(10);
2464
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2770
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2465
2771
  `${endpoint}/actors/inspect`,
2466
2772
  {
2467
2773
  headers: {
2468
2774
  Authorization: `Bearer token`,
2469
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2775
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2470
2776
  getForId: { name: "counter", actorId }
2471
2777
  })
2472
2778
  }
@@ -2495,12 +2801,12 @@ function runActorInspectorTests(driverTestConfig) {
2495
2801
  );
2496
2802
  const handle = await client.counter.create(["test-rpcs"]);
2497
2803
  const actorId = await handle.resolve();
2498
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2804
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2499
2805
  `${endpoint}/actors/inspect`,
2500
2806
  {
2501
2807
  headers: {
2502
2808
  Authorization: `Bearer token`,
2503
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2809
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2504
2810
  getForId: { name: "counter", actorId }
2505
2811
  })
2506
2812
  }
@@ -2522,12 +2828,12 @@ function runActorInspectorTests(driverTestConfig) {
2522
2828
  );
2523
2829
  const handle = await client.counter.create(["test-db"]);
2524
2830
  const actorId = await handle.resolve();
2525
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2831
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2526
2832
  `${endpoint}/actors/inspect`,
2527
2833
  {
2528
2834
  headers: {
2529
2835
  Authorization: `Bearer token`,
2530
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2836
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2531
2837
  getForId: { name: "counter", actorId }
2532
2838
  })
2533
2839
  }
@@ -2552,12 +2858,12 @@ function runActorInspectorTests(driverTestConfig) {
2552
2858
  );
2553
2859
  const handle = await client.counter.create(["test-db-query"]);
2554
2860
  const actorId = await handle.resolve();
2555
- const http = _chunkXSDSNHSEcjs.createActorInspectorClient.call(void 0,
2861
+ const http = _chunkYC5DUHPMcjs.createActorInspectorClient.call(void 0,
2556
2862
  `${endpoint}/actors/inspect`,
2557
2863
  {
2558
2864
  headers: {
2559
2865
  Authorization: `Bearer token`,
2560
- [_chunk3JYSUFETcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2866
+ [_chunk3543NCSNcjs.HEADER_ACTOR_QUERY]: JSON.stringify({
2561
2867
  getForId: { name: "counter", actorId }
2562
2868
  })
2563
2869
  }
@@ -2602,7 +2908,7 @@ function runActorMetadataTests(driverTestConfig) {
2602
2908
  const actorName = await handle.getActorName();
2603
2909
  _vitest.expect.call(void 0, actorName).toBe("metadataActor");
2604
2910
  });
2605
- _vitest.test.call(void 0, "should preserve actor name in state during onStart", async (c) => {
2911
+ _vitest.test.call(void 0, "should preserve actor name in state during onWake", async (c) => {
2606
2912
  const { client } = await setupDriverTest(c, driverTestConfig);
2607
2913
  const handle = client.metadataActor.getOrCreate();
2608
2914
  const storedName = await handle.getStoredActorName();
@@ -2721,113 +3027,6 @@ function runActorOnStateChangeTests(driverTestConfig) {
2721
3027
  });
2722
3028
  }
2723
3029
 
2724
- // src/driver-test-suite/tests/actor-reconnect.ts
2725
-
2726
- function runActorReconnectTests(driverTestConfig) {
2727
- _vitest.describe.call(void 0, "Actor Reconnection Tests", () => {
2728
- _vitest.test.call(void 0, "should reconnect and preserve connection state after non-clean disconnect", async (c) => {
2729
- const { client, endpoint } = await setupDriverTest(
2730
- c,
2731
- driverTestConfig
2732
- );
2733
- const handle = client.counterConn.getOrCreate(["test-reconnect"]);
2734
- const connection = handle.connect();
2735
- await connection.increment(5);
2736
- const connCount1 = await connection.getConnectionCount();
2737
- _vitest.expect.call(void 0, connCount1).toBe(1);
2738
- const connRaw = connection;
2739
- await forceUncleanDisconnect(
2740
- endpoint,
2741
- connRaw.actorId,
2742
- connRaw.connectionId
2743
- );
2744
- await _vitest.vi.waitFor(
2745
- async () => {
2746
- const countAfterReconnect = await connection.getCount();
2747
- _vitest.expect.call(void 0, countAfterReconnect).toBe(5);
2748
- },
2749
- { timeout: 5e3, interval: 100 }
2750
- );
2751
- const connCount2 = await connection.getConnectionCount();
2752
- _vitest.expect.call(void 0, connCount2).toBe(1);
2753
- const newCount = await connection.getCount();
2754
- _vitest.expect.call(void 0, newCount).toBe(5);
2755
- await connection.dispose();
2756
- });
2757
- _vitest.test.call(void 0, "should not preserve connection state after clean disconnect", async (c) => {
2758
- const { client } = await setupDriverTest(c, driverTestConfig);
2759
- const handle = client.counterConn.getOrCreate([
2760
- "test-clean-disconnect"
2761
- ]);
2762
- const connection = handle.connect();
2763
- await connection.increment(10);
2764
- const connCount1 = await connection.getConnectionCount();
2765
- _vitest.expect.call(void 0, connCount1).toBe(1);
2766
- await connection.dispose();
2767
- await _vitest.vi.waitFor(
2768
- async () => {
2769
- const handle2 = client.counterConn.get([
2770
- "test-clean-disconnect"
2771
- ]);
2772
- const connCount = await handle2.getConnectionCount();
2773
- _vitest.expect.call(void 0, connCount).toBe(1);
2774
- },
2775
- { timeout: 5e3 }
2776
- );
2777
- const connection2 = handle.connect();
2778
- const countNewConnection = await connection2.getCount();
2779
- _vitest.expect.call(void 0, countNewConnection).toBe(0);
2780
- const connCount3 = await connection2.getConnectionCount();
2781
- _vitest.expect.call(void 0, connCount3).toBe(1);
2782
- await connection2.dispose();
2783
- });
2784
- _vitest.test.call(void 0, "should handle multiple non-clean disconnects and reconnects", async (c) => {
2785
- const { client, endpoint } = await setupDriverTest(
2786
- c,
2787
- driverTestConfig
2788
- );
2789
- const handle = client.counterConn.getOrCreate([
2790
- "test-multiple-reconnect"
2791
- ]);
2792
- const connection = handle.connect();
2793
- await connection.setCount(100);
2794
- for (let i = 0; i < 3; i++) {
2795
- await connection.increment(1);
2796
- const connRaw = connection;
2797
- await forceUncleanDisconnect(
2798
- endpoint,
2799
- connRaw.actorId,
2800
- connRaw.connectionId
2801
- );
2802
- await _vitest.vi.waitFor(
2803
- async () => {
2804
- const countAfter = await connection.getCount();
2805
- _vitest.expect.call(void 0, countAfter).toBe(101 + i);
2806
- },
2807
- { timeout: 5e3 }
2808
- );
2809
- const connCount = await connection.getConnectionCount();
2810
- _vitest.expect.call(void 0, connCount).toBe(1);
2811
- }
2812
- const finalCount = await connection.getCount();
2813
- _vitest.expect.call(void 0, finalCount).toBe(103);
2814
- await connection.dispose();
2815
- });
2816
- });
2817
- }
2818
- async function forceUncleanDisconnect(endpoint, actorId, connId) {
2819
- const response = await fetch(
2820
- `${endpoint}/.test/force-disconnect?actor=${actorId}&conn=${connId}`,
2821
- {
2822
- method: "POST"
2823
- }
2824
- );
2825
- if (!response.ok) {
2826
- const text = await response.text();
2827
- throw new Error(`Failed to force disconnect: ${text}`);
2828
- }
2829
- }
2830
-
2831
3030
  // src/driver-test-suite/tests/actor-vars.ts
2832
3031
 
2833
3032
  function runActorVarsTests(driverTestConfig) {
@@ -2922,7 +3121,7 @@ function runManagerDriverTests(driverTestConfig) {
2922
3121
  _vitest.expect.fail("did not error on duplicate create");
2923
3122
  } catch (err) {
2924
3123
  _vitest.expect.call(void 0, err.group).toBe("actor");
2925
- _vitest.expect.call(void 0, err.code).toBe("already_exists");
3124
+ _vitest.expect.call(void 0, err.code).toBe("duplicate_key");
2926
3125
  }
2927
3126
  const count = await counter.increment(0);
2928
3127
  _vitest.expect.call(void 0, count).toBe(5);
@@ -3170,7 +3369,7 @@ function runRawHttpTests(driverTestConfig) {
3170
3369
  _vitest.expect.call(void 0, response.ok).toBe(false);
3171
3370
  _vitest.expect.call(void 0, response.status).toBe(404);
3172
3371
  });
3173
- _vitest.test.call(void 0, "should return 404 when no onFetch handler defined", async (c) => {
3372
+ _vitest.test.call(void 0, "should return 404 when no onRequest handler defined", async (c) => {
3174
3373
  const { client } = await setupDriverTest(c, driverTestConfig);
3175
3374
  const actor2 = client.rawHttpNoHandlerActor.getOrCreate([
3176
3375
  "no-handler"
@@ -3179,7 +3378,7 @@ function runRawHttpTests(driverTestConfig) {
3179
3378
  _vitest.expect.call(void 0, response.ok).toBe(false);
3180
3379
  _vitest.expect.call(void 0, response.status).toBe(404);
3181
3380
  });
3182
- _vitest.test.call(void 0, "should return 500 error when onFetch returns void", async (c) => {
3381
+ _vitest.test.call(void 0, "should return 500 error when onRequest returns void", async (c) => {
3183
3382
  const { client } = await setupDriverTest(c, driverTestConfig);
3184
3383
  const actor2 = client.rawHttpVoidReturnActor.getOrCreate([
3185
3384
  "void-return"
@@ -3190,7 +3389,7 @@ function runRawHttpTests(driverTestConfig) {
3190
3389
  try {
3191
3390
  const errorData = await response.json();
3192
3391
  _vitest.expect.call(void 0, errorData.message).toContain(
3193
- "onFetch handler must return a Response"
3392
+ "onRequest handler must return a Response"
3194
3393
  );
3195
3394
  } catch (e3) {
3196
3395
  }
@@ -3373,7 +3572,7 @@ function runRawHttpTests(driverTestConfig) {
3373
3572
 
3374
3573
  function runRawHttpRequestPropertiesTests(driverTestConfig) {
3375
3574
  _vitest.describe.call(void 0, "raw http request properties", () => {
3376
- _vitest.test.call(void 0, "should pass all Request properties correctly to onFetch", async (c) => {
3575
+ _vitest.test.call(void 0, "should pass all Request properties correctly to onRequest", async (c) => {
3377
3576
  const { client } = await setupDriverTest(c, driverTestConfig);
3378
3577
  const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3379
3578
  "test"
@@ -3589,7 +3788,7 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3589
3788
  _vitest.expect.call(void 0, data.searchParams.param).toBe(longValue);
3590
3789
  _vitest.expect.call(void 0, data.search.length).toBeGreaterThan(1e3);
3591
3790
  });
3592
- _vitest.test.call(void 0, "should handle large request bodies", async (c) => {
3791
+ _vitest.test.skip("should handle large request bodies", async (c) => {
3593
3792
  const { client } = await setupDriverTest(c, driverTestConfig);
3594
3793
  const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3595
3794
  "test"
@@ -3636,9 +3835,6 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3636
3835
  body: ""
3637
3836
  });
3638
3837
  _vitest.expect.call(void 0, response.ok).toBe(true);
3639
- const data = await response.json();
3640
- _vitest.expect.call(void 0, data.body).toBeNull();
3641
- _vitest.expect.call(void 0, data.bodyText).toBe("");
3642
3838
  });
3643
3839
  _vitest.test.call(void 0, "should handle custom HTTP methods", async (c) => {
3644
3840
  const { client } = await setupDriverTest(c, driverTestConfig);
@@ -4165,7 +4361,6 @@ function runDriverTests(driverTestConfigPartial) {
4165
4361
  const encodings = ["bare", "cbor", "json"];
4166
4362
  for (const encoding of encodings) {
4167
4363
  _vitest.describe.call(void 0, `encoding (${encoding})`, () => {
4168
- var _a2;
4169
4364
  const driverTestConfig = {
4170
4365
  ...driverTestConfigPartial,
4171
4366
  clientType,
@@ -4173,31 +4368,11 @@ function runDriverTests(driverTestConfigPartial) {
4173
4368
  };
4174
4369
  runActorDriverTests(driverTestConfig);
4175
4370
  runManagerDriverTests(driverTestConfig);
4176
- const transports = ((_a2 = driverTestConfig.skip) == null ? void 0 : _a2.sse) ? ["websocket"] : ["websocket", "sse"];
4177
- for (const transport of transports) {
4178
- _vitest.describe.call(void 0, `transport (${transport})`, () => {
4179
- runActorConnTests({
4180
- ...driverTestConfig,
4181
- transport
4182
- });
4183
- runActorConnStateTests({
4184
- ...driverTestConfig,
4185
- transport
4186
- });
4187
- runActorReconnectTests({
4188
- ...driverTestConfig,
4189
- transport
4190
- });
4191
- runRequestAccessTests({
4192
- ...driverTestConfig,
4193
- transport
4194
- });
4195
- runActorDriverTestsWithTransport({
4196
- ...driverTestConfig,
4197
- transport
4198
- });
4199
- });
4200
- }
4371
+ runActorConnTests(driverTestConfig);
4372
+ runActorConnStateTests(driverTestConfig);
4373
+ runActorConnHibernationTests(driverTestConfig);
4374
+ runActorDestroyTests(driverTestConfig);
4375
+ runRequestAccessTests(driverTestConfig);
4201
4376
  runActorHandleTests(driverTestConfig);
4202
4377
  runActionFeaturesTests(driverTestConfig);
4203
4378
  runActorVarsTests(driverTestConfig);
@@ -4215,11 +4390,7 @@ function runDriverTests(driverTestConfigPartial) {
4215
4390
  }
4216
4391
  }
4217
4392
  async function createTestRuntime(registryPath, driverFactory) {
4218
- const {
4219
- mod: { registry }
4220
- } = await _bundlerequire.bundleRequire.call(void 0, {
4221
- filepath: registryPath
4222
- });
4393
+ const { registry } = await Promise.resolve().then(() => _interopRequireWildcard(require(registryPath)));
4223
4394
  registry.config.test.enabled = true;
4224
4395
  const {
4225
4396
  driver,
@@ -4238,7 +4409,7 @@ async function createTestRuntime(registryPath, driverFactory) {
4238
4409
  };
4239
4410
  } else {
4240
4411
  let upgradeWebSocket;
4241
- const config = _chunkJMLTKMJ7cjs.RunnerConfigSchema.parse({
4412
+ const config = _chunkD3SLADUDcjs.RunnerConfigSchema.parse({
4242
4413
  driver,
4243
4414
  getUpgradeWebSocket: () => upgradeWebSocket,
4244
4415
  inspector: {
@@ -4247,12 +4418,12 @@ async function createTestRuntime(registryPath, driverFactory) {
4247
4418
  }
4248
4419
  });
4249
4420
  const managerDriver = driver.manager(registry.config, config);
4250
- const client = _chunkD6PCH7FRcjs.createClientWithDriver.call(void 0,
4421
+ const client = _chunk4SHILYS5cjs.createClientWithDriver.call(void 0,
4251
4422
  managerDriver,
4252
- _chunkJMLTKMJ7cjs.ClientConfigSchema.parse({})
4423
+ _chunkD3SLADUDcjs.ClientConfigSchema.parse({})
4253
4424
  );
4254
- _chunkXSDSNHSEcjs.configureInspectorAccessToken.call(void 0, config, managerDriver);
4255
- const { router } = _chunkXYK5PY3Bcjs.createManagerRouter.call(void 0,
4425
+ _chunkYC5DUHPMcjs.configureInspectorAccessToken.call(void 0, config, managerDriver);
4426
+ const { router } = _chunkFVAKREFBcjs.createManagerRouter.call(void 0,
4256
4427
  registry.config,
4257
4428
  config,
4258
4429
  managerDriver,
@@ -4261,7 +4432,7 @@ async function createTestRuntime(registryPath, driverFactory) {
4261
4432
  );
4262
4433
  const nodeWebSocket = _nodews.createNodeWebSocket.call(void 0, { app: router });
4263
4434
  upgradeWebSocket = nodeWebSocket.upgradeWebSocket;
4264
- const port = await _chunkHNYF4T36cjs.getPort.call(void 0, );
4435
+ const port = await _chunkCHLZBSI2cjs.getPort.call(void 0, );
4265
4436
  const server = _nodeserver.serve.call(void 0, {
4266
4437
  fetch: router.fetch,
4267
4438
  hostname: "127.0.0.1",