rivetkit 2.0.20 → 2.0.21

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 (169) hide show
  1. package/dist/tsup/actor/errors.cjs.map +1 -1
  2. package/dist/tsup/{chunk-L3YPHXPE.js → chunk-2POQCWMA.js} +481 -100
  3. package/dist/tsup/chunk-2POQCWMA.js.map +1 -0
  4. package/dist/tsup/{chunk-5F6X4AFU.js → chunk-3UIGKLZW.js} +6 -6
  5. package/dist/tsup/chunk-3UIGKLZW.js.map +1 -0
  6. package/dist/tsup/{chunk-M6LIJ6BK.js → chunk-4OINFQBR.js} +3 -3
  7. package/dist/tsup/{chunk-ZODINJWN.cjs → chunk-65SAIRRY.cjs} +12 -12
  8. package/dist/tsup/chunk-65SAIRRY.cjs.map +1 -0
  9. package/dist/tsup/{chunk-RI4YHZZW.js → chunk-6G76WIWL.js} +2 -2
  10. package/dist/tsup/{chunk-RI4YHZZW.js.map → chunk-6G76WIWL.js.map} +1 -1
  11. package/dist/tsup/{chunk-YFFCPYHY.js → chunk-D2LS4X6E.js} +11 -5
  12. package/dist/tsup/chunk-D2LS4X6E.js.map +1 -0
  13. package/dist/tsup/{chunk-QRUGCDA5.js → chunk-DYA34FHW.js} +2 -2
  14. package/dist/tsup/{chunk-KUZWEM23.cjs → chunk-ELDFBXDV.cjs} +8 -4
  15. package/dist/tsup/chunk-ELDFBXDV.cjs.map +1 -0
  16. package/dist/tsup/{chunk-FYP3TZXD.cjs → chunk-FDJ3AVNB.cjs} +32 -26
  17. package/dist/tsup/chunk-FDJ3AVNB.cjs.map +1 -0
  18. package/dist/tsup/{chunk-ER5OT3SQ.js → chunk-FUX6U6TL.js} +2 -2
  19. package/dist/tsup/chunk-FUX6U6TL.js.map +1 -0
  20. package/dist/tsup/{chunk-RJVSNJO7.cjs → chunk-HN7UXCYQ.cjs} +7 -7
  21. package/dist/tsup/chunk-HN7UXCYQ.cjs.map +1 -0
  22. package/dist/tsup/{chunk-QMVCFQ37.js → chunk-HUGSRAGL.js} +8 -4
  23. package/dist/tsup/chunk-HUGSRAGL.js.map +1 -0
  24. package/dist/tsup/{chunk-PV22ZBDE.cjs → chunk-JKOUXDK6.cjs} +16 -10
  25. package/dist/tsup/chunk-JKOUXDK6.cjs.map +1 -0
  26. package/dist/tsup/{chunk-2I6L3VRO.cjs → chunk-JTIBPF7N.cjs} +14 -14
  27. package/dist/tsup/chunk-JTIBPF7N.cjs.map +1 -0
  28. package/dist/tsup/chunk-KSRXX3Z4.cjs.map +1 -1
  29. package/dist/tsup/{chunk-JZD6FEOE.cjs → chunk-LMJHBF26.cjs} +455 -289
  30. package/dist/tsup/chunk-LMJHBF26.cjs.map +1 -0
  31. package/dist/tsup/{chunk-KKRR7DSG.cjs → chunk-LWGCMELP.cjs} +3 -3
  32. package/dist/tsup/chunk-LWGCMELP.cjs.map +1 -0
  33. package/dist/tsup/{chunk-2S7HJMMY.cjs → chunk-M5BHNJHB.cjs} +630 -249
  34. package/dist/tsup/chunk-M5BHNJHB.cjs.map +1 -0
  35. package/dist/tsup/{chunk-G6JGHCG4.cjs → chunk-O4GUKGK4.cjs} +6 -6
  36. package/dist/tsup/chunk-O4GUKGK4.cjs.map +1 -0
  37. package/dist/tsup/{chunk-7ACKZS3T.js → chunk-RZZDFDB6.js} +13 -7
  38. package/dist/tsup/chunk-RZZDFDB6.js.map +1 -0
  39. package/dist/tsup/{chunk-MGHPBNWB.js → chunk-VLR3TDHT.js} +2 -2
  40. package/dist/tsup/{chunk-GQ5WTE64.js → chunk-Y2QONT7B.js} +263 -97
  41. package/dist/tsup/chunk-Y2QONT7B.js.map +1 -0
  42. package/dist/tsup/{chunk-DUOTOMP7.cjs → chunk-ZNWE3XBT.cjs} +3 -3
  43. package/dist/tsup/chunk-ZNWE3XBT.cjs.map +1 -0
  44. package/dist/tsup/client/mod.cjs +9 -9
  45. package/dist/tsup/client/mod.cjs.map +1 -1
  46. package/dist/tsup/client/mod.d.cts +2 -2
  47. package/dist/tsup/client/mod.d.ts +2 -2
  48. package/dist/tsup/client/mod.js +8 -8
  49. package/dist/tsup/common/log.cjs +3 -3
  50. package/dist/tsup/common/log.cjs.map +1 -1
  51. package/dist/tsup/common/log.js +2 -2
  52. package/dist/tsup/common/websocket.cjs +4 -4
  53. package/dist/tsup/common/websocket.cjs.map +1 -1
  54. package/dist/tsup/common/websocket.js +3 -3
  55. package/dist/tsup/{conn-CmPcqOCF.d.ts → conn-Clu655RU.d.ts} +72 -71
  56. package/dist/tsup/{conn-DU5EbfCu.d.cts → conn-lUvFLo_q.d.cts} +72 -71
  57. package/dist/tsup/driver-helpers/mod.cjs +5 -5
  58. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  59. package/dist/tsup/driver-helpers/mod.d.cts +1 -1
  60. package/dist/tsup/driver-helpers/mod.d.ts +1 -1
  61. package/dist/tsup/driver-helpers/mod.js +4 -4
  62. package/dist/tsup/driver-test-suite/mod.cjs +603 -294
  63. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  64. package/dist/tsup/driver-test-suite/mod.d.cts +1 -1
  65. package/dist/tsup/driver-test-suite/mod.d.ts +1 -1
  66. package/dist/tsup/driver-test-suite/mod.js +574 -265
  67. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  68. package/dist/tsup/inspector/mod.cjs +6 -6
  69. package/dist/tsup/inspector/mod.cjs.map +1 -1
  70. package/dist/tsup/inspector/mod.d.cts +68 -7
  71. package/dist/tsup/inspector/mod.d.ts +68 -7
  72. package/dist/tsup/inspector/mod.js +5 -5
  73. package/dist/tsup/mod.cjs +10 -10
  74. package/dist/tsup/mod.cjs.map +1 -1
  75. package/dist/tsup/mod.d.cts +2 -2
  76. package/dist/tsup/mod.d.ts +2 -2
  77. package/dist/tsup/mod.js +9 -9
  78. package/dist/tsup/test/mod.cjs +11 -11
  79. package/dist/tsup/test/mod.cjs.map +1 -1
  80. package/dist/tsup/test/mod.d.cts +1 -1
  81. package/dist/tsup/test/mod.d.ts +1 -1
  82. package/dist/tsup/test/mod.js +10 -10
  83. package/dist/tsup/utils.cjs +2 -2
  84. package/dist/tsup/utils.cjs.map +1 -1
  85. package/dist/tsup/utils.js +1 -1
  86. package/package.json +4 -3
  87. package/src/actor/config.ts +108 -15
  88. package/src/actor/conn-drivers.ts +2 -1
  89. package/src/actor/instance.ts +119 -35
  90. package/src/actor/keys.test.ts +13 -4
  91. package/src/actor/protocol/old.ts +10 -3
  92. package/src/actor/router-endpoints.ts +26 -16
  93. package/src/actor/router.ts +41 -13
  94. package/src/actor/unstable-react.ts +1 -1
  95. package/src/client/actor-common.ts +3 -1
  96. package/src/client/actor-conn.ts +44 -12
  97. package/src/client/actor-handle.ts +4 -1
  98. package/src/client/client.ts +32 -18
  99. package/src/client/utils.ts +21 -8
  100. package/src/common/actor-router-consts.ts +2 -0
  101. package/src/common/inline-websocket-adapter2.ts +24 -6
  102. package/src/common/log.ts +6 -2
  103. package/src/common/logfmt.ts +3 -1
  104. package/src/common/router.ts +3 -1
  105. package/src/common/utils.ts +6 -2
  106. package/src/driver-helpers/utils.ts +4 -1
  107. package/src/driver-test-suite/mod.ts +15 -4
  108. package/src/driver-test-suite/test-inline-client-driver.ts +35 -13
  109. package/src/driver-test-suite/tests/action-features.ts +6 -2
  110. package/src/driver-test-suite/tests/actor-conn-state.ts +18 -8
  111. package/src/driver-test-suite/tests/actor-conn.ts +35 -13
  112. package/src/driver-test-suite/tests/actor-handle.ts +35 -15
  113. package/src/driver-test-suite/tests/actor-inline-client.ts +34 -23
  114. package/src/driver-test-suite/tests/actor-inspector.ts +241 -131
  115. package/src/driver-test-suite/tests/actor-reconnect.ts +14 -4
  116. package/src/driver-test-suite/tests/actor-schedule.ts +12 -3
  117. package/src/driver-test-suite/tests/actor-sleep.ts +6 -3
  118. package/src/driver-test-suite/tests/actor-vars.ts +6 -2
  119. package/src/driver-test-suite/tests/manager-driver.ts +16 -6
  120. package/src/driver-test-suite/tests/raw-http-request-properties.ts +64 -25
  121. package/src/driver-test-suite/tests/raw-http.ts +17 -5
  122. package/src/driver-test-suite/tests/raw-websocket.ts +36 -12
  123. package/src/driver-test-suite/tests/request-access.ts +18 -8
  124. package/src/drivers/engine/actor-driver.ts +46 -25
  125. package/src/drivers/engine/config.ts +2 -1
  126. package/src/drivers/file-system/global-state.ts +58 -16
  127. package/src/drivers/file-system/manager.ts +35 -12
  128. package/src/drivers/file-system/mod.ts +6 -1
  129. package/src/drivers/file-system/utils.ts +8 -2
  130. package/src/engine-process/mod.ts +15 -4
  131. package/src/inspector/actor.ts +63 -23
  132. package/src/inspector/config.ts +2 -1
  133. package/src/inspector/manager.ts +10 -3
  134. package/src/inspector/utils.ts +2 -1
  135. package/src/manager/driver.ts +4 -1
  136. package/src/manager/gateway.ts +278 -8
  137. package/src/manager/hono-websocket-adapter.ts +33 -10
  138. package/src/manager/router-schema.ts +4 -2
  139. package/src/manager/router.ts +78 -12
  140. package/src/manager-api/actors.ts +2 -0
  141. package/src/registry/mod.ts +31 -9
  142. package/src/registry/run-config.ts +3 -1
  143. package/src/remote-manager-driver/api-endpoints.ts +2 -2
  144. package/src/remote-manager-driver/mod.ts +23 -7
  145. package/src/remote-manager-driver/ws-proxy.ts +21 -5
  146. package/src/serde.ts +6 -2
  147. package/src/test/mod.ts +2 -1
  148. package/src/utils.ts +6 -2
  149. package/dist/tsup/chunk-2I6L3VRO.cjs.map +0 -1
  150. package/dist/tsup/chunk-2S7HJMMY.cjs.map +0 -1
  151. package/dist/tsup/chunk-5F6X4AFU.js.map +0 -1
  152. package/dist/tsup/chunk-7ACKZS3T.js.map +0 -1
  153. package/dist/tsup/chunk-DUOTOMP7.cjs.map +0 -1
  154. package/dist/tsup/chunk-ER5OT3SQ.js.map +0 -1
  155. package/dist/tsup/chunk-FYP3TZXD.cjs.map +0 -1
  156. package/dist/tsup/chunk-G6JGHCG4.cjs.map +0 -1
  157. package/dist/tsup/chunk-GQ5WTE64.js.map +0 -1
  158. package/dist/tsup/chunk-JZD6FEOE.cjs.map +0 -1
  159. package/dist/tsup/chunk-KKRR7DSG.cjs.map +0 -1
  160. package/dist/tsup/chunk-KUZWEM23.cjs.map +0 -1
  161. package/dist/tsup/chunk-L3YPHXPE.js.map +0 -1
  162. package/dist/tsup/chunk-PV22ZBDE.cjs.map +0 -1
  163. package/dist/tsup/chunk-QMVCFQ37.js.map +0 -1
  164. package/dist/tsup/chunk-RJVSNJO7.cjs.map +0 -1
  165. package/dist/tsup/chunk-YFFCPYHY.js.map +0 -1
  166. package/dist/tsup/chunk-ZODINJWN.cjs.map +0 -1
  167. /package/dist/tsup/{chunk-M6LIJ6BK.js.map → chunk-4OINFQBR.js.map} +0 -0
  168. /package/dist/tsup/{chunk-QRUGCDA5.js.map → chunk-DYA34FHW.js.map} +0 -0
  169. /package/dist/tsup/{chunk-MGHPBNWB.js.map → chunk-VLR3TDHT.js.map} +0 -0
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  getPort
3
- } from "../chunk-5F6X4AFU.js";
3
+ } from "../chunk-3UIGKLZW.js";
4
4
  import {
5
5
  actor,
6
6
  createManagerRouter
7
- } from "../chunk-L3YPHXPE.js";
7
+ } from "../chunk-2POQCWMA.js";
8
8
  import {
9
9
  configureInspectorAccessToken,
10
10
  createActorInspectorClient,
11
11
  createManagerInspectorClient
12
- } from "../chunk-RI4YHZZW.js";
12
+ } from "../chunk-6G76WIWL.js";
13
13
  import {
14
14
  createClient
15
- } from "../chunk-M6LIJ6BK.js";
15
+ } from "../chunk-4OINFQBR.js";
16
16
  import {
17
17
  ActorError,
18
18
  createClientWithDriver
19
- } from "../chunk-GQ5WTE64.js";
20
- import "../chunk-QRUGCDA5.js";
19
+ } from "../chunk-Y2QONT7B.js";
20
+ import "../chunk-DYA34FHW.js";
21
21
  import {
22
22
  importWebSocket
23
- } from "../chunk-MGHPBNWB.js";
23
+ } from "../chunk-VLR3TDHT.js";
24
24
  import {
25
25
  ClientConfigSchema,
26
26
  RunnerConfigSchema
27
- } from "../chunk-7ACKZS3T.js";
27
+ } from "../chunk-RZZDFDB6.js";
28
28
  import {
29
29
  HEADER_ACTOR_ID,
30
30
  HEADER_ACTOR_QUERY,
@@ -35,13 +35,13 @@ import {
35
35
  WS_PROTOCOL_TARGET,
36
36
  WS_PROTOCOL_TRANSPORT,
37
37
  assertUnreachable
38
- } from "../chunk-YFFCPYHY.js";
38
+ } from "../chunk-D2LS4X6E.js";
39
39
  import {
40
40
  getLogger
41
- } from "../chunk-ER5OT3SQ.js";
41
+ } from "../chunk-FUX6U6TL.js";
42
42
  import {
43
43
  promiseWithResolvers
44
- } from "../chunk-QMVCFQ37.js";
44
+ } from "../chunk-HUGSRAGL.js";
45
45
  import {
46
46
  INTERNAL_ERROR_CODE,
47
47
  INTERNAL_ERROR_DESCRIPTION
@@ -70,14 +70,22 @@ import * as cbor from "cbor-x";
70
70
  function createTestInlineClientDriver(endpoint, encoding, transport) {
71
71
  return {
72
72
  getForId(input) {
73
- return makeInlineRequest(endpoint, encoding, transport, "getForId", [
74
- input
75
- ]);
73
+ return makeInlineRequest(
74
+ endpoint,
75
+ encoding,
76
+ transport,
77
+ "getForId",
78
+ [input]
79
+ );
76
80
  },
77
81
  getWithKey(input) {
78
- return makeInlineRequest(endpoint, encoding, transport, "getWithKey", [
79
- input
80
- ]);
82
+ return makeInlineRequest(
83
+ endpoint,
84
+ encoding,
85
+ transport,
86
+ "getWithKey",
87
+ [input]
88
+ );
81
89
  },
82
90
  getOrCreateWithKey(input) {
83
91
  return makeInlineRequest(
@@ -89,9 +97,13 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
89
97
  );
90
98
  },
91
99
  createActor(input) {
92
- return makeInlineRequest(endpoint, encoding, transport, "createActor", [
93
- input
94
- ]);
100
+ return makeInlineRequest(
101
+ endpoint,
102
+ encoding,
103
+ transport,
104
+ "createActor",
105
+ [input]
106
+ );
95
107
  },
96
108
  async sendRequest(actorId, actorRequest) {
97
109
  var _a;
@@ -105,7 +117,11 @@ function createTestInlineClientDriver(endpoint, encoding, transport) {
105
117
  path: pathWithQuery
106
118
  });
107
119
  const url = `${endpoint}/.test/inline-driver/send-request/${pathWithQuery}`;
108
- logger().debug({ msg: "rewriting http url", from: oldUrl, to: url });
120
+ logger().debug({
121
+ msg: "rewriting http url",
122
+ from: oldUrl,
123
+ to: url
124
+ });
109
125
  const headers = new Headers(actorRequest.headers);
110
126
  headers.set(HEADER_ACTOR_ID, actorId);
111
127
  const response = await fetch(
@@ -518,7 +534,9 @@ async function makeInlineRequest(endpoint, encoding, transport, method, args) {
518
534
  duplex: "half"
519
535
  });
520
536
  if (!response.ok) {
521
- throw new Error(`Failed to call inline ${method}: ${response.statusText}`);
537
+ throw new Error(
538
+ `Failed to call inline ${method}: ${response.statusText}`
539
+ );
522
540
  }
523
541
  const buffer = await response.arrayBuffer();
524
542
  const callResponse = cbor.decode(
@@ -650,7 +668,9 @@ function runActionFeaturesTests(driverTestConfig) {
650
668
  await instance.asyncWithError(true);
651
669
  expect.fail("did not error");
652
670
  } catch (error) {
653
- expect(error.message).toBe("Intentional error");
671
+ expect(error.message).toBe(
672
+ "Intentional error"
673
+ );
654
674
  }
655
675
  });
656
676
  test("should handle promises returned from actions correctly", async (c) => {
@@ -697,7 +717,9 @@ function runActorConnTests(driverTestConfig) {
697
717
  });
698
718
  test2("should connect using .getOrCreate().connect()", async (c) => {
699
719
  const { client } = await setupDriverTest(c, driverTestConfig);
700
- const handle = client.counter.getOrCreate(["test-get-or-create"]);
720
+ const handle = client.counter.getOrCreate([
721
+ "test-get-or-create"
722
+ ]);
701
723
  const connection = handle.connect();
702
724
  const count = await connection.increment(7);
703
725
  expect2(count).toBe(7);
@@ -715,7 +737,9 @@ function runActorConnTests(driverTestConfig) {
715
737
  describe2("Event Communication", () => {
716
738
  test2("should mix RPC calls and WebSocket events", async (c) => {
717
739
  const { client } = await setupDriverTest(c, driverTestConfig);
718
- const handle = client.counter.getOrCreate(["test-mixed-rpc-ws"]);
740
+ const handle = client.counter.getOrCreate([
741
+ "test-mixed-rpc-ws"
742
+ ]);
719
743
  const connection = handle.connect();
720
744
  const receivedEvents = [];
721
745
  connection.on("newCount", (count) => {
@@ -773,9 +797,12 @@ function runActorConnTests(driverTestConfig) {
773
797
  const handle = client.counter.getOrCreate(["test-unsubscribe"]);
774
798
  const connection = handle.connect();
775
799
  const receivedEvents = [];
776
- const unsubscribe = connection.on("newCount", (count) => {
777
- receivedEvents.push(count);
778
- });
800
+ const unsubscribe = connection.on(
801
+ "newCount",
802
+ (count) => {
803
+ receivedEvents.push(count);
804
+ }
805
+ );
779
806
  await vi2.waitFor(async () => {
780
807
  await connection.setCount(5);
781
808
  expect2(receivedEvents).toEqual([5]);
@@ -789,12 +816,18 @@ function runActorConnTests(driverTestConfig) {
789
816
  describe2("Connection Parameters", () => {
790
817
  test2("should pass connection parameters", async (c) => {
791
818
  const { client } = await setupDriverTest(c, driverTestConfig);
792
- const handle1 = client.counterWithParams.getOrCreate(["test-params"], {
793
- params: { name: "user1" }
794
- });
795
- const handle2 = client.counterWithParams.getOrCreate(["test-params"], {
796
- params: { name: "user2" }
797
- });
819
+ const handle1 = client.counterWithParams.getOrCreate(
820
+ ["test-params"],
821
+ {
822
+ params: { name: "user1" }
823
+ }
824
+ );
825
+ const handle2 = client.counterWithParams.getOrCreate(
826
+ ["test-params"],
827
+ {
828
+ params: { name: "user2" }
829
+ }
830
+ );
798
831
  const conn1 = handle1.connect();
799
832
  const conn2 = handle2.connect();
800
833
  await conn1.getInitializers();
@@ -819,7 +852,11 @@ function runActorConnTests(driverTestConfig) {
819
852
  );
820
853
  const connection = connHandle.connect();
821
854
  const events = await connection.getEvents();
822
- expect2(events).toEqual(["onStart", "onBeforeConnect", "onConnect"]);
855
+ expect2(events).toEqual([
856
+ "onStart",
857
+ "onBeforeConnect",
858
+ "onConnect"
859
+ ]);
823
860
  await connection.dispose();
824
861
  await vi2.waitFor(
825
862
  async () => {
@@ -829,7 +866,12 @@ function runActorConnTests(driverTestConfig) {
829
866
  const finalEvents = await handle.getEvents();
830
867
  expect2(finalEvents).toBeOneOf([
831
868
  // Still active
832
- ["onStart", "onBeforeConnect", "onConnect", "onDisconnect"],
869
+ [
870
+ "onStart",
871
+ "onBeforeConnect",
872
+ "onConnect",
873
+ "onDisconnect"
874
+ ],
833
875
  // Went to sleep and woke back up
834
876
  [
835
877
  "onStart",
@@ -936,9 +978,12 @@ function runActorConnStateTests(driverTestConfig) {
936
978
  driverTestConfig.transport === "sse" && driverTestConfig.clientType === "inline"
937
979
  )("should track connection and disconnection events", async (c) => {
938
980
  const { client } = await setupDriverTest(c, driverTestConfig);
939
- const debugHandle = client.connStateActor.getOrCreate(void 0, {
940
- params: { noCount: true }
941
- });
981
+ const debugHandle = client.connStateActor.getOrCreate(
982
+ void 0,
983
+ {
984
+ params: { noCount: true }
985
+ }
986
+ );
942
987
  const conn = client.connStateActor.getOrCreate().connect();
943
988
  const connState = await conn.getConnectionState();
944
989
  await vi3.waitFor(async () => {
@@ -1021,7 +1066,9 @@ function runActorConnStateTests(driverTestConfig) {
1021
1066
  expect3(success).toBe(true);
1022
1067
  expect3(receivedMessages.length).toBe(1);
1023
1068
  expect3(receivedMessages[0].from).toBe(state1.id);
1024
- expect3(receivedMessages[0].message).toBe("Hello from conn1");
1069
+ expect3(receivedMessages[0].message).toBe(
1070
+ "Hello from conn1"
1071
+ );
1025
1072
  });
1026
1073
  await conn1.dispose();
1027
1074
  await conn2.dispose();
@@ -1042,7 +1089,10 @@ function runActorScheduleTests(driverTestConfig) {
1042
1089
  () => {
1043
1090
  describe4("Scheduled Alarms", () => {
1044
1091
  test4("executes c.schedule.at() with specific timestamp", async (c) => {
1045
- const { client } = await setupDriverTest(c, driverTestConfig);
1092
+ const { client } = await setupDriverTest(
1093
+ c,
1094
+ driverTestConfig
1095
+ );
1046
1096
  const scheduled = client.scheduled.getOrCreate();
1047
1097
  const timestamp = Date.now() + 250;
1048
1098
  await scheduled.scheduleTaskAt(timestamp);
@@ -1053,7 +1103,10 @@ function runActorScheduleTests(driverTestConfig) {
1053
1103
  expect4(scheduledCount).toBe(1);
1054
1104
  });
1055
1105
  test4("executes c.schedule.after() with delay", async (c) => {
1056
- const { client } = await setupDriverTest(c, driverTestConfig);
1106
+ const { client } = await setupDriverTest(
1107
+ c,
1108
+ driverTestConfig
1109
+ );
1057
1110
  const scheduled = client.scheduled.getOrCreate();
1058
1111
  await scheduled.scheduleTaskAfter(250);
1059
1112
  await waitFor(driverTestConfig, 500);
@@ -1063,7 +1116,10 @@ function runActorScheduleTests(driverTestConfig) {
1063
1116
  expect4(scheduledCount).toBe(1);
1064
1117
  });
1065
1118
  test4("multiple scheduled tasks execute in order", async (c) => {
1066
- const { client } = await setupDriverTest(c, driverTestConfig);
1119
+ const { client } = await setupDriverTest(
1120
+ c,
1121
+ driverTestConfig
1122
+ );
1067
1123
  const scheduled = client.scheduled.getOrCreate();
1068
1124
  await scheduled.clearHistory();
1069
1125
  await scheduled.scheduleTaskAfterWithId("first", 250);
@@ -1102,7 +1158,10 @@ var sleep = actor({
1102
1158
  c.sleep();
1103
1159
  },
1104
1160
  getCounts: (c) => {
1105
- return { startCount: c.state.startCount, sleepCount: c.state.sleepCount };
1161
+ return {
1162
+ startCount: c.state.startCount,
1163
+ sleepCount: c.state.sleepCount
1164
+ };
1106
1165
  },
1107
1166
  setAlarm: async (c, duration) => {
1108
1167
  await c.schedule.after(duration, "onAlarm");
@@ -1126,7 +1185,10 @@ var sleepWithLongRpc = actor({
1126
1185
  },
1127
1186
  actions: {
1128
1187
  getCounts: (c) => {
1129
- return { startCount: c.state.startCount, sleepCount: c.state.sleepCount };
1188
+ return {
1189
+ startCount: c.state.startCount,
1190
+ sleepCount: c.state.sleepCount
1191
+ };
1130
1192
  },
1131
1193
  longRunningRpc: async (c) => {
1132
1194
  c.log.info("starting long running rpc");
@@ -1156,7 +1218,9 @@ var sleepWithRawHttp = actor({
1156
1218
  c.state.requestCount += 1;
1157
1219
  const url = new URL(request.url);
1158
1220
  if (url.pathname === "/long-request") {
1159
- const duration = parseInt(url.searchParams.get("duration") || "1000");
1221
+ const duration = parseInt(
1222
+ url.searchParams.get("duration") || "1000"
1223
+ );
1160
1224
  c.log.info({ msg: "starting long fetch request", duration });
1161
1225
  await new Promise((resolve) => setTimeout(resolve, duration));
1162
1226
  c.log.info("finished long fetch request");
@@ -1252,7 +1316,10 @@ var sleepWithNoSleepOption = actor({
1252
1316
  },
1253
1317
  actions: {
1254
1318
  getCounts: (c) => {
1255
- return { startCount: c.state.startCount, sleepCount: c.state.sleepCount };
1319
+ return {
1320
+ startCount: c.state.startCount,
1321
+ sleepCount: c.state.sleepCount
1322
+ };
1256
1323
  }
1257
1324
  },
1258
1325
  options: {
@@ -1675,7 +1742,9 @@ function runActorHandleTests(driverTestConfig) {
1675
1742
  });
1676
1743
  test8("should use .getForId() to access a actor by ID", async (c) => {
1677
1744
  const { client } = await setupDriverTest(c, driverTestConfig);
1678
- const handle = client.counter.getOrCreate(["test-get-for-id-handle"]);
1745
+ const handle = client.counter.getOrCreate([
1746
+ "test-get-for-id-handle"
1747
+ ]);
1679
1748
  await handle.increment(3);
1680
1749
  const actorId = await handle.resolve();
1681
1750
  const idHandle = client.counter.getForId(actorId);
@@ -1699,7 +1768,9 @@ function runActorHandleTests(driverTestConfig) {
1699
1768
  });
1700
1769
  test8("should use (await create()) to create and return a handle", async (c) => {
1701
1770
  const { client } = await setupDriverTest(c, driverTestConfig);
1702
- const handle = await client.counter.create(["test-create-handle"]);
1771
+ const handle = await client.counter.create([
1772
+ "test-create-handle"
1773
+ ]);
1703
1774
  const count = await handle.increment(9);
1704
1775
  expect8(count).toBe(9);
1705
1776
  const retrievedCount = await handle.getCount();
@@ -1722,7 +1793,9 @@ function runActorHandleTests(driverTestConfig) {
1722
1793
  const missingId = `nonexistent-${crypto.randomUUID()}`;
1723
1794
  try {
1724
1795
  await client.counter.get([missingId]).resolve();
1725
- expect8.fail("did not error for get().resolve() on missing actor");
1796
+ expect8.fail(
1797
+ "did not error for get().resolve() on missing actor"
1798
+ );
1726
1799
  } catch (err) {
1727
1800
  expect8(err.group).toBe("actor");
1728
1801
  expect8(err.code).toBe("not_found");
@@ -1732,7 +1805,9 @@ function runActorHandleTests(driverTestConfig) {
1732
1805
  describe9("Action Functionality", () => {
1733
1806
  test8("should call actions directly on the handle", async (c) => {
1734
1807
  const { client } = await setupDriverTest(c, driverTestConfig);
1735
- const handle = client.counter.getOrCreate(["test-action-handle"]);
1808
+ const handle = client.counter.getOrCreate([
1809
+ "test-action-handle"
1810
+ ]);
1736
1811
  const count1 = await handle.increment(3);
1737
1812
  expect8(count1).toBe(3);
1738
1813
  const count2 = await handle.increment(5);
@@ -1742,7 +1817,9 @@ function runActorHandleTests(driverTestConfig) {
1742
1817
  });
1743
1818
  test8("should handle independent handles to the same actor", async (c) => {
1744
1819
  const { client } = await setupDriverTest(c, driverTestConfig);
1745
- const handle1 = client.counter.getOrCreate(["test-multiple-handles"]);
1820
+ const handle1 = client.counter.getOrCreate([
1821
+ "test-multiple-handles"
1822
+ ]);
1746
1823
  const handle2 = client.counter.get(["test-multiple-handles"]);
1747
1824
  await handle1.increment(3);
1748
1825
  const count = await handle2.getCount();
@@ -1801,16 +1878,18 @@ function runActorHandleTests(driverTestConfig) {
1801
1878
  expect8(
1802
1879
  eventsAfterAction.filter((e) => e === "onBeforeConnect").length
1803
1880
  ).toBe(1);
1804
- expect8(eventsAfterAction.filter((e) => e === "onConnect").length).toBe(
1805
- 1
1806
- );
1881
+ expect8(
1882
+ eventsAfterAction.filter((e) => e === "onConnect").length
1883
+ ).toBe(1);
1807
1884
  expect8(
1808
1885
  eventsAfterAction.filter((e) => e === "onDisconnect").length
1809
1886
  ).toBe(1);
1810
1887
  await trackingHandle.increment(10);
1811
1888
  const eventsAfterSecondAction = await viewHandle.getEvents();
1812
1889
  expect8(
1813
- eventsAfterSecondAction.filter((e) => e === "onBeforeConnect").length
1890
+ eventsAfterSecondAction.filter(
1891
+ (e) => e === "onBeforeConnect"
1892
+ ).length
1814
1893
  ).toBe(2);
1815
1894
  expect8(
1816
1895
  eventsAfterSecondAction.filter((e) => e === "onConnect").length
@@ -1836,9 +1915,13 @@ function runActorHandleTests(driverTestConfig) {
1836
1915
  await trackingHandle2.increment(10);
1837
1916
  const events = await viewHandle.getEvents();
1838
1917
  expect8(events.filter((e) => e === "onStart").length).toBe(1);
1839
- expect8(events.filter((e) => e === "onBeforeConnect").length).toBe(2);
1918
+ expect8(
1919
+ events.filter((e) => e === "onBeforeConnect").length
1920
+ ).toBe(2);
1840
1921
  expect8(events.filter((e) => e === "onConnect").length).toBe(2);
1841
- expect8(events.filter((e) => e === "onDisconnect").length).toBe(2);
1922
+ expect8(events.filter((e) => e === "onDisconnect").length).toBe(
1923
+ 2
1924
+ );
1842
1925
  });
1843
1926
  });
1844
1927
  });
@@ -1851,23 +1934,25 @@ function runActorInlineClientTests(driverTestConfig) {
1851
1934
  describe10("Stateless Client Calls", () => {
1852
1935
  test9("should make stateless calls to other actors", async (c) => {
1853
1936
  const { client } = await setupDriverTest(c, driverTestConfig);
1854
- const inlineClientHandle = client.inlineClientActor.getOrCreate([
1855
- "inline-client-test"
1856
- ]);
1937
+ const inlineClientHandle = client.inlineClientActor.getOrCreate(
1938
+ ["inline-client-test"]
1939
+ );
1857
1940
  const result = await inlineClientHandle.callCounterIncrement(5);
1858
1941
  expect9(result).toBe(5);
1859
1942
  const counterState = await inlineClientHandle.getCounterState();
1860
1943
  expect9(counterState).toBe(5);
1861
1944
  const messages = await inlineClientHandle.getMessages();
1862
1945
  expect9(messages).toHaveLength(2);
1863
- expect9(messages[0]).toContain("Called counter.increment(5), result: 5");
1946
+ expect9(messages[0]).toContain(
1947
+ "Called counter.increment(5), result: 5"
1948
+ );
1864
1949
  expect9(messages[1]).toContain("Got counter state: 5");
1865
1950
  });
1866
1951
  test9("should handle multiple stateless calls", async (c) => {
1867
1952
  const { client } = await setupDriverTest(c, driverTestConfig);
1868
- const inlineClientHandle = client.inlineClientActor.getOrCreate([
1869
- "inline-client-multi"
1870
- ]);
1953
+ const inlineClientHandle = client.inlineClientActor.getOrCreate(
1954
+ ["inline-client-multi"]
1955
+ );
1871
1956
  await inlineClientHandle.clearMessages();
1872
1957
  const result1 = await inlineClientHandle.callCounterIncrement(3);
1873
1958
  const result2 = await inlineClientHandle.callCounterIncrement(7);
@@ -1877,7 +1962,9 @@ function runActorInlineClientTests(driverTestConfig) {
1877
1962
  expect9(finalState).toBe(10);
1878
1963
  const messages = await inlineClientHandle.getMessages();
1879
1964
  expect9(messages).toHaveLength(3);
1880
- expect9(messages[0]).toContain("Called counter.increment(3), result: 3");
1965
+ expect9(messages[0]).toContain(
1966
+ "Called counter.increment(3), result: 3"
1967
+ );
1881
1968
  expect9(messages[1]).toContain(
1882
1969
  "Called counter.increment(7), result: 10"
1883
1970
  );
@@ -1887,9 +1974,9 @@ function runActorInlineClientTests(driverTestConfig) {
1887
1974
  describe10("Stateful Client Calls", () => {
1888
1975
  test9("should connect to other actors and receive events", async (c) => {
1889
1976
  const { client } = await setupDriverTest(c, driverTestConfig);
1890
- const inlineClientHandle = client.inlineClientActor.getOrCreate([
1891
- "inline-client-stateful"
1892
- ]);
1977
+ const inlineClientHandle = client.inlineClientActor.getOrCreate(
1978
+ ["inline-client-stateful"]
1979
+ );
1893
1980
  await inlineClientHandle.clearMessages();
1894
1981
  const result = await inlineClientHandle.connectToCounterAndIncrement(4);
1895
1982
  expect9(result.result1).toBe(4);
@@ -1905,9 +1992,9 @@ function runActorInlineClientTests(driverTestConfig) {
1905
1992
  });
1906
1993
  test9("should handle stateful connection independently", async (c) => {
1907
1994
  const { client } = await setupDriverTest(c, driverTestConfig);
1908
- const inlineClientHandle = client.inlineClientActor.getOrCreate([
1909
- "inline-client-independent"
1910
- ]);
1995
+ const inlineClientHandle = client.inlineClientActor.getOrCreate(
1996
+ ["inline-client-independent"]
1997
+ );
1911
1998
  await inlineClientHandle.clearMessages();
1912
1999
  const result = await inlineClientHandle.connectToCounterAndIncrement(2);
1913
2000
  expect9(result.result1).toBe(2);
@@ -1923,9 +2010,9 @@ function runActorInlineClientTests(driverTestConfig) {
1923
2010
  describe10("Mixed Client Usage", () => {
1924
2011
  test9("should handle both stateless and stateful calls", async (c) => {
1925
2012
  const { client } = await setupDriverTest(c, driverTestConfig);
1926
- const inlineClientHandle = client.inlineClientActor.getOrCreate([
1927
- "inline-client-mixed"
1928
- ]);
2013
+ const inlineClientHandle = client.inlineClientActor.getOrCreate(
2014
+ ["inline-client-mixed"]
2015
+ );
1929
2016
  await inlineClientHandle.clearMessages();
1930
2017
  await inlineClientHandle.callCounterIncrement(1);
1931
2018
  const statelessResult = await inlineClientHandle.getCounterState();
@@ -1935,7 +2022,9 @@ function runActorInlineClientTests(driverTestConfig) {
1935
2022
  expect9(statefulResult.result2).toBe(9);
1936
2023
  const messages = await inlineClientHandle.getMessages();
1937
2024
  expect9(messages).toHaveLength(3);
1938
- expect9(messages[0]).toContain("Called counter.increment(1), result: 1");
2025
+ expect9(messages[0]).toContain(
2026
+ "Called counter.increment(1), result: 1"
2027
+ );
1939
2028
  expect9(messages[1]).toContain("Got counter state: 1");
1940
2029
  expect9(messages[2]).toContain(
1941
2030
  "Connected to counter, incremented by 3 and 6"
@@ -1952,25 +2041,34 @@ function runActorInspectorTests(driverTestConfig) {
1952
2041
  describe11("Manager Inspector", () => {
1953
2042
  test10("should respond to ping", async (c) => {
1954
2043
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
1955
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
1956
- headers: {
1957
- Authorization: `Bearer token`
2044
+ const http = createManagerInspectorClient(
2045
+ `${endpoint}/inspect`,
2046
+ {
2047
+ headers: {
2048
+ Authorization: `Bearer token`
2049
+ }
1958
2050
  }
1959
- });
2051
+ );
1960
2052
  const response = await http.ping.$get();
1961
2053
  expect10(response.status).toBe(200);
1962
2054
  const data = await response.json();
1963
2055
  expect10(data).toEqual({ message: "pong" });
1964
2056
  });
1965
2057
  test10("should get actors with pagination", async (c) => {
1966
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2058
+ const { client, endpoint } = await setupDriverTest(
2059
+ c,
2060
+ driverTestConfig
2061
+ );
1967
2062
  await client.counter.create(["test-actor-1"]);
1968
2063
  await client.counter.create(["test-actor-2"]);
1969
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
1970
- headers: {
1971
- Authorization: `Bearer token`
2064
+ const http = createManagerInspectorClient(
2065
+ `${endpoint}/inspect`,
2066
+ {
2067
+ headers: {
2068
+ Authorization: `Bearer token`
2069
+ }
1972
2070
  }
1973
- });
2071
+ );
1974
2072
  const response = await http.actors.$get({
1975
2073
  query: { limit: "1" }
1976
2074
  });
@@ -1984,16 +2082,22 @@ function runActorInspectorTests(driverTestConfig) {
1984
2082
  expect10(data.length).toBe(1);
1985
2083
  });
1986
2084
  test10("should get all actors with pagination", async (c) => {
1987
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2085
+ const { client, endpoint } = await setupDriverTest(
2086
+ c,
2087
+ driverTestConfig
2088
+ );
1988
2089
  const actorKey1 = ["test-cursor-1"];
1989
2090
  const actorKey2 = ["test-cursor-2"];
1990
2091
  await client.counter.create(actorKey1);
1991
2092
  await client.counter.create(actorKey2);
1992
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
1993
- headers: {
1994
- Authorization: `Bearer token`
2093
+ const http = createManagerInspectorClient(
2094
+ `${endpoint}/inspect`,
2095
+ {
2096
+ headers: {
2097
+ Authorization: `Bearer token`
2098
+ }
1995
2099
  }
1996
- });
2100
+ );
1997
2101
  const response = await http.actors.$get({
1998
2102
  query: { limit: "5" }
1999
2103
  });
@@ -2014,11 +2118,14 @@ function runActorInspectorTests(driverTestConfig) {
2014
2118
  });
2015
2119
  test10("should handle invalid limit parameter", async (c) => {
2016
2120
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2017
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
2018
- headers: {
2019
- Authorization: `Bearer token`
2121
+ const http = createManagerInspectorClient(
2122
+ `${endpoint}/inspect`,
2123
+ {
2124
+ headers: {
2125
+ Authorization: `Bearer token`
2126
+ }
2020
2127
  }
2021
- });
2128
+ );
2022
2129
  const response = await http.actors.$get({
2023
2130
  query: { limit: "0" }
2024
2131
  });
@@ -2026,11 +2133,14 @@ function runActorInspectorTests(driverTestConfig) {
2026
2133
  });
2027
2134
  test10("should create a new actor", async (c) => {
2028
2135
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2029
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
2030
- headers: {
2031
- Authorization: `Bearer token`
2136
+ const http = createManagerInspectorClient(
2137
+ `${endpoint}/inspect`,
2138
+ {
2139
+ headers: {
2140
+ Authorization: `Bearer token`
2141
+ }
2032
2142
  }
2033
- });
2143
+ );
2034
2144
  const response = await http.actors.$post({
2035
2145
  json: {
2036
2146
  name: "default",
@@ -2050,11 +2160,14 @@ function runActorInspectorTests(driverTestConfig) {
2050
2160
  });
2051
2161
  test10("should get builds", async (c) => {
2052
2162
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2053
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
2054
- headers: {
2055
- Authorization: `Bearer token`
2163
+ const http = createManagerInspectorClient(
2164
+ `${endpoint}/inspect`,
2165
+ {
2166
+ headers: {
2167
+ Authorization: `Bearer token`
2168
+ }
2056
2169
  }
2057
- });
2170
+ );
2058
2171
  const response = await http.builds.$get();
2059
2172
  expect10(response.status).toBe(200);
2060
2173
  const data = await response.json();
@@ -2065,14 +2178,20 @@ function runActorInspectorTests(driverTestConfig) {
2065
2178
  );
2066
2179
  });
2067
2180
  test10("should get actor by id", async (c) => {
2068
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2181
+ const { client, endpoint } = await setupDriverTest(
2182
+ c,
2183
+ driverTestConfig
2184
+ );
2069
2185
  const handle = await client.counter.create(["test-get-by-id"]);
2070
2186
  const actorId = await handle.resolve();
2071
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
2072
- headers: {
2073
- Authorization: `Bearer token`
2187
+ const http = createManagerInspectorClient(
2188
+ `${endpoint}/inspect`,
2189
+ {
2190
+ headers: {
2191
+ Authorization: `Bearer token`
2192
+ }
2074
2193
  }
2075
- });
2194
+ );
2076
2195
  const response = await http.actor[":id"].$get({
2077
2196
  param: { id: actorId }
2078
2197
  });
@@ -2082,11 +2201,14 @@ function runActorInspectorTests(driverTestConfig) {
2082
2201
  });
2083
2202
  test10("should return 404 for non-existent actor", async (c) => {
2084
2203
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2085
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
2086
- headers: {
2087
- Authorization: `Bearer token`
2204
+ const http = createManagerInspectorClient(
2205
+ `${endpoint}/inspect`,
2206
+ {
2207
+ headers: {
2208
+ Authorization: `Bearer token`
2209
+ }
2088
2210
  }
2089
- });
2211
+ );
2090
2212
  const response = await http.actor[":id"].$get({
2091
2213
  param: { id: "non-existent-id" }
2092
2214
  });
@@ -2095,14 +2217,20 @@ function runActorInspectorTests(driverTestConfig) {
2095
2217
  expect10(data).toEqual({ error: "Actor not found" });
2096
2218
  });
2097
2219
  test10("should get bootstrap data", async (c) => {
2098
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2220
+ const { client, endpoint } = await setupDriverTest(
2221
+ c,
2222
+ driverTestConfig
2223
+ );
2099
2224
  const handle = await client.counter.create(["test-bootstrap"]);
2100
2225
  await handle.resolve();
2101
- const http = createManagerInspectorClient(`${endpoint}/inspect`, {
2102
- headers: {
2103
- Authorization: `Bearer token`
2226
+ const http = createManagerInspectorClient(
2227
+ `${endpoint}/inspect`,
2228
+ {
2229
+ headers: {
2230
+ Authorization: `Bearer token`
2231
+ }
2104
2232
  }
2105
- });
2233
+ );
2106
2234
  const response = await http.bootstrap.$get();
2107
2235
  expect10(response.status).toBe(200);
2108
2236
  const data = await response.json();
@@ -2120,47 +2248,62 @@ function runActorInspectorTests(driverTestConfig) {
2120
2248
  test10("should handle actor not found", async (c) => {
2121
2249
  const { endpoint } = await setupDriverTest(c, driverTestConfig);
2122
2250
  const actorId = "non-existing";
2123
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2124
- headers: {
2125
- Authorization: `Bearer token`,
2126
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2127
- getForId: { name: "counter", actorId }
2128
- })
2251
+ const http = createActorInspectorClient(
2252
+ `${endpoint}/actors/inspect`,
2253
+ {
2254
+ headers: {
2255
+ Authorization: `Bearer token`,
2256
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2257
+ getForId: { name: "counter", actorId }
2258
+ })
2259
+ }
2129
2260
  }
2130
- });
2261
+ );
2131
2262
  const response = await http.ping.$get();
2132
2263
  expect10(response.ok).toBe(false);
2133
2264
  });
2134
2265
  test10("should respond to ping", async (c) => {
2135
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2266
+ const { client, endpoint } = await setupDriverTest(
2267
+ c,
2268
+ driverTestConfig
2269
+ );
2136
2270
  const handle = await client.counter.create(["test-ping"]);
2137
2271
  const actorId = await handle.resolve();
2138
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2139
- headers: {
2140
- Authorization: `Bearer token`,
2141
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2142
- getForId: { name: "counter", actorId }
2143
- })
2272
+ const http = createActorInspectorClient(
2273
+ `${endpoint}/actors/inspect`,
2274
+ {
2275
+ headers: {
2276
+ Authorization: `Bearer token`,
2277
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2278
+ getForId: { name: "counter", actorId }
2279
+ })
2280
+ }
2144
2281
  }
2145
- });
2282
+ );
2146
2283
  const response = await http.ping.$get();
2147
2284
  expect10(response.status).toBe(200);
2148
2285
  const data = await response.json();
2149
2286
  expect10(data).toEqual({ message: "pong" });
2150
2287
  });
2151
2288
  test10("should get actor state", async (c) => {
2152
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2289
+ const { client, endpoint } = await setupDriverTest(
2290
+ c,
2291
+ driverTestConfig
2292
+ );
2153
2293
  const handle = await client.counter.create(["test-state"]);
2154
2294
  const actorId = await handle.resolve();
2155
2295
  await handle.increment(5);
2156
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2157
- headers: {
2158
- Authorization: `Bearer token`,
2159
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2160
- getForId: { name: "counter", actorId }
2161
- })
2296
+ const http = createActorInspectorClient(
2297
+ `${endpoint}/actors/inspect`,
2298
+ {
2299
+ headers: {
2300
+ Authorization: `Bearer token`,
2301
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2302
+ getForId: { name: "counter", actorId }
2303
+ })
2304
+ }
2162
2305
  }
2163
- });
2306
+ );
2164
2307
  const response = await http.state.$get();
2165
2308
  expect10(response.status).toBe(200);
2166
2309
  const data = await response.json();
@@ -2172,17 +2315,25 @@ function runActorInspectorTests(driverTestConfig) {
2172
2315
  });
2173
2316
  });
2174
2317
  test10("should update actor state with replace", async (c) => {
2175
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2176
- const handle = await client.counter.create(["test-state-replace"]);
2318
+ const { client, endpoint } = await setupDriverTest(
2319
+ c,
2320
+ driverTestConfig
2321
+ );
2322
+ const handle = await client.counter.create([
2323
+ "test-state-replace"
2324
+ ]);
2177
2325
  const actorId = await handle.resolve();
2178
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2179
- headers: {
2180
- Authorization: `Bearer token`,
2181
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2182
- getForId: { name: "counter", actorId }
2183
- })
2326
+ const http = createActorInspectorClient(
2327
+ `${endpoint}/actors/inspect`,
2328
+ {
2329
+ headers: {
2330
+ Authorization: `Bearer token`,
2331
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2332
+ getForId: { name: "counter", actorId }
2333
+ })
2334
+ }
2184
2335
  }
2185
- });
2336
+ );
2186
2337
  const response = await http.state.$patch({
2187
2338
  json: {
2188
2339
  replace: { count: 10 }
@@ -2196,18 +2347,26 @@ function runActorInspectorTests(driverTestConfig) {
2196
2347
  });
2197
2348
  });
2198
2349
  test10("should update actor state with patch", async (c) => {
2199
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2200
- const handle = await client.counter.create(["test-state-patch"]);
2350
+ const { client, endpoint } = await setupDriverTest(
2351
+ c,
2352
+ driverTestConfig
2353
+ );
2354
+ const handle = await client.counter.create([
2355
+ "test-state-patch"
2356
+ ]);
2201
2357
  const actorId = await handle.resolve();
2202
2358
  await handle.increment(3);
2203
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2204
- headers: {
2205
- Authorization: `Bearer token`,
2206
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2207
- getForId: { name: "counter", actorId }
2208
- })
2359
+ const http = createActorInspectorClient(
2360
+ `${endpoint}/actors/inspect`,
2361
+ {
2362
+ headers: {
2363
+ Authorization: `Bearer token`,
2364
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2365
+ getForId: { name: "counter", actorId }
2366
+ })
2367
+ }
2209
2368
  }
2210
- });
2369
+ );
2211
2370
  const response = await http.state.$patch({
2212
2371
  json: {
2213
2372
  patch: [
@@ -2229,19 +2388,27 @@ function runActorInspectorTests(driverTestConfig) {
2229
2388
  });
2230
2389
  });
2231
2390
  test10("should get actor connections", async (c) => {
2232
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2233
- const handle = await client.counter.create(["test-connections"]);
2391
+ const { client, endpoint } = await setupDriverTest(
2392
+ c,
2393
+ driverTestConfig
2394
+ );
2395
+ const handle = await client.counter.create([
2396
+ "test-connections"
2397
+ ]);
2234
2398
  const actorId = await handle.resolve();
2235
2399
  handle.connect();
2236
2400
  await handle.increment(10);
2237
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2238
- headers: {
2239
- Authorization: `Bearer token`,
2240
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2241
- getForId: { name: "counter", actorId }
2242
- })
2401
+ const http = createActorInspectorClient(
2402
+ `${endpoint}/actors/inspect`,
2403
+ {
2404
+ headers: {
2405
+ Authorization: `Bearer token`,
2406
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2407
+ getForId: { name: "counter", actorId }
2408
+ })
2409
+ }
2243
2410
  }
2244
- });
2411
+ );
2245
2412
  const response = await http.connections.$get();
2246
2413
  expect10(response.status).toBe(200);
2247
2414
  const data = await response.json();
@@ -2254,19 +2421,25 @@ function runActorInspectorTests(driverTestConfig) {
2254
2421
  );
2255
2422
  });
2256
2423
  test10("should get actor events", async (c) => {
2257
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2424
+ const { client, endpoint } = await setupDriverTest(
2425
+ c,
2426
+ driverTestConfig
2427
+ );
2258
2428
  const handle = await client.counter.create(["test-events"]);
2259
2429
  const actorId = await handle.resolve();
2260
2430
  handle.connect();
2261
2431
  await handle.increment(10);
2262
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2263
- headers: {
2264
- Authorization: `Bearer token`,
2265
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2266
- getForId: { name: "counter", actorId }
2267
- })
2432
+ const http = createActorInspectorClient(
2433
+ `${endpoint}/actors/inspect`,
2434
+ {
2435
+ headers: {
2436
+ Authorization: `Bearer token`,
2437
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2438
+ getForId: { name: "counter", actorId }
2439
+ })
2440
+ }
2268
2441
  }
2269
- });
2442
+ );
2270
2443
  const response = await http.events.$get();
2271
2444
  expect10(response.status).toBe(200);
2272
2445
  const data = await response.json();
@@ -2280,19 +2453,27 @@ function runActorInspectorTests(driverTestConfig) {
2280
2453
  );
2281
2454
  });
2282
2455
  test10("should clear actor events", async (c) => {
2283
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2284
- const handle = await client.counter.create(["test-events-clear"]);
2456
+ const { client, endpoint } = await setupDriverTest(
2457
+ c,
2458
+ driverTestConfig
2459
+ );
2460
+ const handle = await client.counter.create([
2461
+ "test-events-clear"
2462
+ ]);
2285
2463
  const actorId = await handle.resolve();
2286
2464
  handle.connect();
2287
2465
  await handle.increment(10);
2288
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2289
- headers: {
2290
- Authorization: `Bearer token`,
2291
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2292
- getForId: { name: "counter", actorId }
2293
- })
2466
+ const http = createActorInspectorClient(
2467
+ `${endpoint}/actors/inspect`,
2468
+ {
2469
+ headers: {
2470
+ Authorization: `Bearer token`,
2471
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2472
+ getForId: { name: "counter", actorId }
2473
+ })
2474
+ }
2294
2475
  }
2295
- });
2476
+ );
2296
2477
  {
2297
2478
  const response2 = await http.events.$get();
2298
2479
  expect10(response2.status).toBe(200);
@@ -2310,17 +2491,23 @@ function runActorInspectorTests(driverTestConfig) {
2310
2491
  expect10(response.status).toBe(200);
2311
2492
  });
2312
2493
  test10("should get actor rpcs", async (c) => {
2313
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2494
+ const { client, endpoint } = await setupDriverTest(
2495
+ c,
2496
+ driverTestConfig
2497
+ );
2314
2498
  const handle = await client.counter.create(["test-rpcs"]);
2315
2499
  const actorId = await handle.resolve();
2316
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2317
- headers: {
2318
- Authorization: `Bearer token`,
2319
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2320
- getForId: { name: "counter", actorId }
2321
- })
2500
+ const http = createActorInspectorClient(
2501
+ `${endpoint}/actors/inspect`,
2502
+ {
2503
+ headers: {
2504
+ Authorization: `Bearer token`,
2505
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2506
+ getForId: { name: "counter", actorId }
2507
+ })
2508
+ }
2322
2509
  }
2323
- });
2510
+ );
2324
2511
  const response = await http.rpcs.$get();
2325
2512
  expect10(response.status).toBe(200);
2326
2513
  const data = await response.json();
@@ -2331,17 +2518,23 @@ function runActorInspectorTests(driverTestConfig) {
2331
2518
  );
2332
2519
  });
2333
2520
  test10.skip("should get actor database info", async (c) => {
2334
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2521
+ const { client, endpoint } = await setupDriverTest(
2522
+ c,
2523
+ driverTestConfig
2524
+ );
2335
2525
  const handle = await client.counter.create(["test-db"]);
2336
2526
  const actorId = await handle.resolve();
2337
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2338
- headers: {
2339
- Authorization: `Bearer token`,
2340
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2341
- getForId: { name: "counter", actorId }
2342
- })
2527
+ const http = createActorInspectorClient(
2528
+ `${endpoint}/actors/inspect`,
2529
+ {
2530
+ headers: {
2531
+ Authorization: `Bearer token`,
2532
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2533
+ getForId: { name: "counter", actorId }
2534
+ })
2535
+ }
2343
2536
  }
2344
- });
2537
+ );
2345
2538
  const response = await http.db.$get();
2346
2539
  expect10(response.status).toBe(200);
2347
2540
  const data = await response.json();
@@ -2355,17 +2548,23 @@ function runActorInspectorTests(driverTestConfig) {
2355
2548
  }
2356
2549
  });
2357
2550
  test10.skip("should execute database query when database is enabled", async (c) => {
2358
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2551
+ const { client, endpoint } = await setupDriverTest(
2552
+ c,
2553
+ driverTestConfig
2554
+ );
2359
2555
  const handle = await client.counter.create(["test-db-query"]);
2360
2556
  const actorId = await handle.resolve();
2361
- const http = createActorInspectorClient(`${endpoint}/actors/inspect`, {
2362
- headers: {
2363
- Authorization: `Bearer token`,
2364
- [HEADER_ACTOR_QUERY]: JSON.stringify({
2365
- getForId: { name: "counter", actorId }
2366
- })
2557
+ const http = createActorInspectorClient(
2558
+ `${endpoint}/actors/inspect`,
2559
+ {
2560
+ headers: {
2561
+ Authorization: `Bearer token`,
2562
+ [HEADER_ACTOR_QUERY]: JSON.stringify({
2563
+ getForId: { name: "counter", actorId }
2564
+ })
2565
+ }
2367
2566
  }
2368
- });
2567
+ );
2369
2568
  const dbInfoResponse = await http.db.$get();
2370
2569
  const dbInfo = await dbInfoResponse.json();
2371
2570
  if (dbInfo.enabled) {
@@ -2529,7 +2728,10 @@ import { describe as describe14, expect as expect13, test as test13, vi as vi4 }
2529
2728
  function runActorReconnectTests(driverTestConfig) {
2530
2729
  describe14("Actor Reconnection Tests", () => {
2531
2730
  test13("should reconnect and preserve connection state after non-clean disconnect", async (c) => {
2532
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2731
+ const { client, endpoint } = await setupDriverTest(
2732
+ c,
2733
+ driverTestConfig
2734
+ );
2533
2735
  const handle = client.counterConn.getOrCreate(["test-reconnect"]);
2534
2736
  const connection = handle.connect();
2535
2737
  await connection.increment(5);
@@ -2556,7 +2758,9 @@ function runActorReconnectTests(driverTestConfig) {
2556
2758
  });
2557
2759
  test13("should not preserve connection state after clean disconnect", async (c) => {
2558
2760
  const { client } = await setupDriverTest(c, driverTestConfig);
2559
- const handle = client.counterConn.getOrCreate(["test-clean-disconnect"]);
2761
+ const handle = client.counterConn.getOrCreate([
2762
+ "test-clean-disconnect"
2763
+ ]);
2560
2764
  const connection = handle.connect();
2561
2765
  await connection.increment(10);
2562
2766
  const connCount1 = await connection.getConnectionCount();
@@ -2564,7 +2768,9 @@ function runActorReconnectTests(driverTestConfig) {
2564
2768
  await connection.dispose();
2565
2769
  await vi4.waitFor(
2566
2770
  async () => {
2567
- const handle2 = client.counterConn.get(["test-clean-disconnect"]);
2771
+ const handle2 = client.counterConn.get([
2772
+ "test-clean-disconnect"
2773
+ ]);
2568
2774
  const connCount = await handle2.getConnectionCount();
2569
2775
  expect13(connCount).toBe(1);
2570
2776
  },
@@ -2578,7 +2784,10 @@ function runActorReconnectTests(driverTestConfig) {
2578
2784
  await connection2.dispose();
2579
2785
  });
2580
2786
  test13("should handle multiple non-clean disconnects and reconnects", async (c) => {
2581
- const { client, endpoint } = await setupDriverTest(c, driverTestConfig);
2787
+ const { client, endpoint } = await setupDriverTest(
2788
+ c,
2789
+ driverTestConfig
2790
+ );
2582
2791
  const handle = client.counterConn.getOrCreate([
2583
2792
  "test-multiple-reconnect"
2584
2793
  ]);
@@ -2638,8 +2847,12 @@ function runActorVarsTests(driverTestConfig) {
2638
2847
  describe15("Deep cloning of static vars", () => {
2639
2848
  test14("should deep clone static vars between actor instances", async (c) => {
2640
2849
  const { client } = await setupDriverTest(c, driverTestConfig);
2641
- const instance1 = client.nestedVarActor.getOrCreate(["instance1"]);
2642
- const instance2 = client.nestedVarActor.getOrCreate(["instance2"]);
2850
+ const instance1 = client.nestedVarActor.getOrCreate([
2851
+ "instance1"
2852
+ ]);
2853
+ const instance2 = client.nestedVarActor.getOrCreate([
2854
+ "instance2"
2855
+ ]);
2643
2856
  const modifiedVars = await instance1.modifyNested();
2644
2857
  expect14(modifiedVars.nested.value).toBe("modified");
2645
2858
  expect14(modifiedVars.nested.array).toContain(4);
@@ -2693,7 +2906,10 @@ function runManagerDriverTests(driverTestConfig) {
2693
2906
  const counterAAgain = client.counter.getOrCreate();
2694
2907
  const count = await counterAAgain.increment(0);
2695
2908
  expect15(count).toBe(5);
2696
- const counterB = client.counter.getOrCreate(["counter-b", "testing"]);
2909
+ const counterB = client.counter.getOrCreate([
2910
+ "counter-b",
2911
+ "testing"
2912
+ ]);
2697
2913
  await counterB.increment(10);
2698
2914
  const countB = await counterB.increment(0);
2699
2915
  expect15(countB).toBe(10);
@@ -2818,7 +3034,9 @@ function runManagerDriverTests(driverTestConfig) {
2818
3034
  ]);
2819
3035
  const subsetMatchCount = await subsetMatchCounter.increment(0);
2820
3036
  expect15(subsetMatchCount).toBe(0);
2821
- const singleKeyCounter = client.counter.getOrCreate(["counter-match"]);
3037
+ const singleKeyCounter = client.counter.getOrCreate([
3038
+ "counter-match"
3039
+ ]);
2822
3040
  const singleKeyCount = await singleKeyCounter.increment(0);
2823
3041
  expect15(singleKeyCount).toBe(0);
2824
3042
  });
@@ -2826,7 +3044,9 @@ function runManagerDriverTests(driverTestConfig) {
2826
3044
  const { client } = await setupDriverTest(c, driverTestConfig);
2827
3045
  const stringKeyCounter = client.counter.getOrCreate("string-key-test");
2828
3046
  await stringKeyCounter.increment(7);
2829
- const arrayKeyCounter = client.counter.getOrCreate(["string-key-test"]);
3047
+ const arrayKeyCounter = client.counter.getOrCreate([
3048
+ "string-key-test"
3049
+ ]);
2830
3050
  const count = await arrayKeyCounter.increment(0);
2831
3051
  expect15(count).toBe(7);
2832
3052
  });
@@ -2954,14 +3174,18 @@ function runRawHttpTests(driverTestConfig) {
2954
3174
  });
2955
3175
  test16("should return 404 when no onFetch handler defined", async (c) => {
2956
3176
  const { client } = await setupDriverTest(c, driverTestConfig);
2957
- const actor2 = client.rawHttpNoHandlerActor.getOrCreate(["no-handler"]);
3177
+ const actor2 = client.rawHttpNoHandlerActor.getOrCreate([
3178
+ "no-handler"
3179
+ ]);
2958
3180
  const response = await actor2.fetch("api/anything");
2959
3181
  expect16(response.ok).toBe(false);
2960
3182
  expect16(response.status).toBe(404);
2961
3183
  });
2962
3184
  test16("should return 500 error when onFetch returns void", async (c) => {
2963
3185
  const { client } = await setupDriverTest(c, driverTestConfig);
2964
- const actor2 = client.rawHttpVoidReturnActor.getOrCreate(["void-return"]);
3186
+ const actor2 = client.rawHttpVoidReturnActor.getOrCreate([
3187
+ "void-return"
3188
+ ]);
2965
3189
  const response = await actor2.fetch("api/anything");
2966
3190
  expect16(response.ok).toBe(false);
2967
3191
  expect16(response.status).toBe(500);
@@ -3087,7 +3311,10 @@ function runRawHttpTests(driverTestConfig) {
3087
3311
  const newRequest = new Request(url, {
3088
3312
  method: "GET"
3089
3313
  });
3090
- const response = await actor2.fetch(truncatedPath, newRequest);
3314
+ const response = await actor2.fetch(
3315
+ truncatedPath,
3316
+ newRequest
3317
+ );
3091
3318
  expect16(response.ok).toBe(true);
3092
3319
  const users = await response.json();
3093
3320
  expect16(users).toEqual([
@@ -3150,7 +3377,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3150
3377
  describe18("raw http request properties", () => {
3151
3378
  test17("should pass all Request properties correctly to onFetch", async (c) => {
3152
3379
  const { client } = await setupDriverTest(c, driverTestConfig);
3153
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3380
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3381
+ "test"
3382
+ ]);
3154
3383
  const response = await actor2.fetch("test/path?foo=bar&baz=qux", {
3155
3384
  method: "POST",
3156
3385
  headers: {
@@ -3177,7 +3406,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3177
3406
  });
3178
3407
  test17("should handle GET requests with no body", async (c) => {
3179
3408
  const { client } = await setupDriverTest(c, driverTestConfig);
3180
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3409
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3410
+ "test"
3411
+ ]);
3181
3412
  const response = await actor2.fetch("test/get", {
3182
3413
  method: "GET"
3183
3414
  });
@@ -3188,7 +3419,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3188
3419
  });
3189
3420
  test17("should handle different content types", async (c) => {
3190
3421
  const { client } = await setupDriverTest(c, driverTestConfig);
3191
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3422
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3423
+ "test"
3424
+ ]);
3192
3425
  const formData = new URLSearchParams();
3193
3426
  formData.append("field1", "value1");
3194
3427
  formData.append("field2", "value2");
@@ -3219,7 +3452,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3219
3452
  });
3220
3453
  test17("should preserve all header casing and values", async (c) => {
3221
3454
  const { client } = await setupDriverTest(c, driverTestConfig);
3222
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3455
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3456
+ "test"
3457
+ ]);
3223
3458
  const response = await actor2.fetch("test/headers", {
3224
3459
  headers: {
3225
3460
  Accept: "application/json",
@@ -3239,7 +3474,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3239
3474
  });
3240
3475
  test17("should handle empty and special URL paths", async (c) => {
3241
3476
  const { client } = await setupDriverTest(c, driverTestConfig);
3242
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3477
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3478
+ "test"
3479
+ ]);
3243
3480
  const rootResponse = await actor2.fetch("");
3244
3481
  expect17(rootResponse.ok).toBe(true);
3245
3482
  const rootData = await rootResponse.json();
@@ -3249,7 +3486,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3249
3486
  );
3250
3487
  expect17(specialResponse.ok).toBe(true);
3251
3488
  const specialData = await specialResponse.json();
3252
- expect17(specialData.pathname).toMatch(/path.*with.*spaces.*and.*slashes/);
3489
+ expect17(specialData.pathname).toMatch(
3490
+ /path.*with.*spaces.*and.*slashes/
3491
+ );
3253
3492
  const fragmentResponse = await actor2.fetch("test/path#fragment");
3254
3493
  expect17(fragmentResponse.ok).toBe(true);
3255
3494
  const fragmentData = await fragmentResponse.json();
@@ -3258,7 +3497,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3258
3497
  });
3259
3498
  test17("should handle request properties for all HTTP methods", async (c) => {
3260
3499
  const { client } = await setupDriverTest(c, driverTestConfig);
3261
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3500
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3501
+ "test"
3502
+ ]);
3262
3503
  const methods = [
3263
3504
  "GET",
3264
3505
  "POST",
@@ -3269,11 +3510,14 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3269
3510
  "OPTIONS"
3270
3511
  ];
3271
3512
  for (const method of methods) {
3272
- const response = await actor2.fetch(`test/${method.toLowerCase()}`, {
3273
- method,
3274
- // Only include body for methods that support it
3275
- body: ["POST", "PUT", "PATCH"].includes(method) ? JSON.stringify({ method }) : void 0
3276
- });
3513
+ const response = await actor2.fetch(
3514
+ `test/${method.toLowerCase()}`,
3515
+ {
3516
+ method,
3517
+ // Only include body for methods that support it
3518
+ body: ["POST", "PUT", "PATCH"].includes(method) ? JSON.stringify({ method }) : void 0
3519
+ }
3520
+ );
3277
3521
  if (method === "HEAD") {
3278
3522
  expect17(response.status).toBe(200);
3279
3523
  const text = await response.text();
@@ -3291,7 +3535,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3291
3535
  });
3292
3536
  test17("should handle complex query parameters", async (c) => {
3293
3537
  const { client } = await setupDriverTest(c, driverTestConfig);
3294
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3538
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3539
+ "test"
3540
+ ]);
3295
3541
  const response = await actor2.fetch(
3296
3542
  "test?key=value1&key=value2&array[]=1&array[]=2&nested[prop]=val"
3297
3543
  );
@@ -3303,7 +3549,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3303
3549
  });
3304
3550
  test17("should handle multipart form data", async (c) => {
3305
3551
  const { client } = await setupDriverTest(c, driverTestConfig);
3306
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3552
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3553
+ "test"
3554
+ ]);
3307
3555
  const boundary = "----RivetKitBoundary";
3308
3556
  const body = [
3309
3557
  `------${boundary}`,
@@ -3325,13 +3573,17 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3325
3573
  });
3326
3574
  expect17(response.ok).toBe(true);
3327
3575
  const data = await response.json();
3328
- expect17(data.headers["content-type"]).toContain("multipart/form-data");
3576
+ expect17(data.headers["content-type"]).toContain(
3577
+ "multipart/form-data"
3578
+ );
3329
3579
  expect17(data.bodyText).toContain("field1");
3330
3580
  expect17(data.bodyText).toContain("value1");
3331
3581
  });
3332
3582
  test17("should handle very long URLs", async (c) => {
3333
3583
  const { client } = await setupDriverTest(c, driverTestConfig);
3334
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3584
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3585
+ "test"
3586
+ ]);
3335
3587
  const longValue = "x".repeat(1e3);
3336
3588
  const response = await actor2.fetch(`test/long?param=${longValue}`);
3337
3589
  expect17(response.ok).toBe(true);
@@ -3341,7 +3593,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3341
3593
  });
3342
3594
  test17("should handle large request bodies", async (c) => {
3343
3595
  const { client } = await setupDriverTest(c, driverTestConfig);
3344
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3596
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3597
+ "test"
3598
+ ]);
3345
3599
  const largeArray = new Array(1e4).fill({
3346
3600
  id: 1,
3347
3601
  name: "Test",
@@ -3360,7 +3614,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3360
3614
  });
3361
3615
  test17("should handle missing content-type header", async (c) => {
3362
3616
  const { client } = await setupDriverTest(c, driverTestConfig);
3363
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3617
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3618
+ "test"
3619
+ ]);
3364
3620
  const response = await actor2.fetch("test/no-content-type", {
3365
3621
  method: "POST",
3366
3622
  body: "plain text without content-type"
@@ -3371,7 +3627,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3371
3627
  });
3372
3628
  test17("should handle empty request body", async (c) => {
3373
3629
  const { client } = await setupDriverTest(c, driverTestConfig);
3374
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3630
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3631
+ "test"
3632
+ ]);
3375
3633
  const response = await actor2.fetch("test/empty", {
3376
3634
  method: "POST",
3377
3635
  headers: {
@@ -3386,7 +3644,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3386
3644
  });
3387
3645
  test17("should handle custom HTTP methods", async (c) => {
3388
3646
  const { client } = await setupDriverTest(c, driverTestConfig);
3389
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3647
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3648
+ "test"
3649
+ ]);
3390
3650
  try {
3391
3651
  const response = await actor2.fetch("test/custom", {
3392
3652
  method: "CUSTOM"
@@ -3400,7 +3660,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3400
3660
  });
3401
3661
  test17("should handle cookies in headers", async (c) => {
3402
3662
  const { client } = await setupDriverTest(c, driverTestConfig);
3403
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3663
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3664
+ "test"
3665
+ ]);
3404
3666
  const response = await actor2.fetch("test/cookies", {
3405
3667
  headers: {
3406
3668
  Cookie: "session=abc123; user=test; preferences=dark_mode"
@@ -3414,7 +3676,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3414
3676
  });
3415
3677
  test17("should handle URL encoding properly", async (c) => {
3416
3678
  const { client } = await setupDriverTest(c, driverTestConfig);
3417
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3679
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3680
+ "test"
3681
+ ]);
3418
3682
  const response = await actor2.fetch(
3419
3683
  "test/encoded?special=%20%21%40%23%24%25%5E%26&unicode=%E2%9C%93&email=test%40example.com"
3420
3684
  );
@@ -3426,7 +3690,9 @@ function runRawHttpRequestPropertiesTests(driverTestConfig) {
3426
3690
  });
3427
3691
  test17("should handle concurrent requests maintaining separate contexts", async (c) => {
3428
3692
  const { client } = await setupDriverTest(c, driverTestConfig);
3429
- const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate(["test"]);
3693
+ const actor2 = client.rawHttpRequestPropertiesActor.getOrCreate([
3694
+ "test"
3695
+ ]);
3430
3696
  const requests = [
3431
3697
  actor2.fetch("test/concurrent?id=1", {
3432
3698
  method: "POST",
@@ -3500,7 +3766,9 @@ function runRawWebSocketTests(driverTestConfig) {
3500
3766
  const ws = await actor2.websocket();
3501
3767
  if (ws.readyState !== WebSocket.OPEN) {
3502
3768
  await new Promise((resolve, reject) => {
3503
- ws.addEventListener("open", () => resolve(), { once: true });
3769
+ ws.addEventListener("open", () => resolve(), {
3770
+ once: true
3771
+ });
3504
3772
  ws.addEventListener("close", reject);
3505
3773
  });
3506
3774
  }
@@ -3529,7 +3797,9 @@ function runRawWebSocketTests(driverTestConfig) {
3529
3797
  const ws = await actor2.websocket();
3530
3798
  if (ws.readyState !== WebSocket.OPEN) {
3531
3799
  await new Promise((resolve, reject) => {
3532
- ws.addEventListener("open", () => resolve(), { once: true });
3800
+ ws.addEventListener("open", () => resolve(), {
3801
+ once: true
3802
+ });
3533
3803
  ws.addEventListener("close", reject);
3534
3804
  });
3535
3805
  }
@@ -3556,14 +3826,18 @@ function runRawWebSocketTests(driverTestConfig) {
3556
3826
  const actor1 = client.rawWebSocketActor.getOrCreate(["stats"]);
3557
3827
  const ws1 = await actor1.websocket();
3558
3828
  const ws1MessagePromise = new Promise((resolve, reject) => {
3559
- ws1.addEventListener("message", () => resolve(), { once: true });
3829
+ ws1.addEventListener("message", () => resolve(), {
3830
+ once: true
3831
+ });
3560
3832
  ws1.addEventListener("close", reject);
3561
3833
  });
3562
3834
  await ws1MessagePromise;
3563
3835
  const actor2 = client.rawWebSocketActor.get(["stats"]);
3564
3836
  const ws2 = await actor2.websocket();
3565
3837
  const ws2MessagePromise = new Promise((resolve, reject) => {
3566
- ws2.addEventListener("message", () => resolve(), { once: true });
3838
+ ws2.addEventListener("message", () => resolve(), {
3839
+ once: true
3840
+ });
3567
3841
  ws2.addEventListener("close", reject);
3568
3842
  });
3569
3843
  await Promise.all([ws1MessagePromise, ws2MessagePromise]);
@@ -3601,11 +3875,15 @@ function runRawWebSocketTests(driverTestConfig) {
3601
3875
  });
3602
3876
  test18("should handle binary data", async (c) => {
3603
3877
  const { client } = await setupDriverTest(c, driverTestConfig);
3604
- const actor2 = client.rawWebSocketBinaryActor.getOrCreate(["binary"]);
3878
+ const actor2 = client.rawWebSocketBinaryActor.getOrCreate([
3879
+ "binary"
3880
+ ]);
3605
3881
  const ws = await actor2.websocket();
3606
3882
  if (ws.readyState !== WebSocket.OPEN) {
3607
3883
  await new Promise((resolve, reject) => {
3608
- ws.addEventListener("open", () => resolve(), { once: true });
3884
+ ws.addEventListener("open", () => resolve(), {
3885
+ once: true
3886
+ });
3609
3887
  ws.addEventListener("close", reject);
3610
3888
  });
3611
3889
  }
@@ -3636,7 +3914,9 @@ function runRawWebSocketTests(driverTestConfig) {
3636
3914
  ws.send(largeData);
3637
3915
  const largeReversed = await receiveBinaryMessage();
3638
3916
  for (let i = 0; i < largeData.length; i++) {
3639
- expect18(largeReversed[i]).toBe(largeData[largeData.length - 1 - i]);
3917
+ expect18(largeReversed[i]).toBe(
3918
+ largeData[largeData.length - 1 - i]
3919
+ );
3640
3920
  }
3641
3921
  ws.close();
3642
3922
  });
@@ -3669,7 +3949,9 @@ function runRawWebSocketTests(driverTestConfig) {
3669
3949
  const ws = await actor2.websocket();
3670
3950
  if (ws.readyState !== WebSocket.OPEN) {
3671
3951
  await new Promise((resolve, reject) => {
3672
- ws.addEventListener("open", () => resolve(), { once: true });
3952
+ ws.addEventListener("open", () => resolve(), {
3953
+ once: true
3954
+ });
3673
3955
  ws.addEventListener("close", reject);
3674
3956
  });
3675
3957
  }
@@ -3692,7 +3974,9 @@ function runRawWebSocketTests(driverTestConfig) {
3692
3974
  });
3693
3975
  test18("should properly handle onWebSocket open and close events", async (c) => {
3694
3976
  const { client } = await setupDriverTest(c, driverTestConfig);
3695
- const actor2 = client.rawWebSocketActor.getOrCreate(["open-close-test"]);
3977
+ const actor2 = client.rawWebSocketActor.getOrCreate([
3978
+ "open-close-test"
3979
+ ]);
3696
3980
  const ws1 = await actor2.websocket();
3697
3981
  await new Promise((resolve, reject) => {
3698
3982
  ws1.addEventListener("open", () => resolve(), { once: true });
@@ -3758,8 +4042,12 @@ function runRawWebSocketTests(driverTestConfig) {
3758
4042
  });
3759
4043
  test18("should handle query parameters in websocket paths", async (c) => {
3760
4044
  const { client } = await setupDriverTest(c, driverTestConfig);
3761
- const actor2 = client.rawWebSocketActor.getOrCreate(["query-params"]);
3762
- const ws = await actor2.websocket("api/v1/stream?token=abc123&user=test");
4045
+ const actor2 = client.rawWebSocketActor.getOrCreate([
4046
+ "query-params"
4047
+ ]);
4048
+ const ws = await actor2.websocket(
4049
+ "api/v1/stream?token=abc123&user=test"
4050
+ );
3763
4051
  await new Promise((resolve, reject) => {
3764
4052
  ws.addEventListener("open", () => resolve(), { once: true });
3765
4053
  ws.addEventListener("error", reject);
@@ -3789,20 +4077,27 @@ function runRequestAccessTests(driverTestConfig) {
3789
4077
  describe20("Request Access in Lifecycle Hooks", () => {
3790
4078
  test19("should have access to request object in onBeforeConnect and createConnState", async (c) => {
3791
4079
  const { client } = await setupDriverTest(c, driverTestConfig);
3792
- const handle = client.requestAccessActor.getOrCreate(["test-request"], {
3793
- params: { trackRequest: true }
3794
- });
4080
+ const handle = client.requestAccessActor.getOrCreate(
4081
+ ["test-request"],
4082
+ {
4083
+ params: { trackRequest: true }
4084
+ }
4085
+ );
3795
4086
  const connection = handle.connect();
3796
4087
  const requestInfo = await connection.getRequestInfo();
3797
4088
  if (driverTestConfig.clientType === "http") {
3798
4089
  expect19(requestInfo.onBeforeConnect.hasRequest).toBe(true);
3799
4090
  expect19(requestInfo.onBeforeConnect.requestUrl).toBeDefined();
3800
4091
  expect19(requestInfo.onBeforeConnect.requestMethod).toBeDefined();
3801
- expect19(requestInfo.onBeforeConnect.requestHeaders).toBeDefined();
4092
+ expect19(
4093
+ requestInfo.onBeforeConnect.requestHeaders
4094
+ ).toBeDefined();
3802
4095
  expect19(requestInfo.createConnState.hasRequest).toBe(true);
3803
4096
  expect19(requestInfo.createConnState.requestUrl).toBeDefined();
3804
4097
  expect19(requestInfo.createConnState.requestMethod).toBeDefined();
3805
- expect19(requestInfo.createConnState.requestHeaders).toBeDefined();
4098
+ expect19(
4099
+ requestInfo.createConnState.requestHeaders
4100
+ ).toBeDefined();
3806
4101
  } else {
3807
4102
  }
3808
4103
  await connection.dispose();
@@ -3833,9 +4128,12 @@ function runRequestAccessTests(driverTestConfig) {
3833
4128
  });
3834
4129
  test19("should capture request headers and method", async (c) => {
3835
4130
  const { client } = await setupDriverTest(c, driverTestConfig);
3836
- const handle = client.requestAccessActor.getOrCreate(["test-headers"], {
3837
- params: { trackRequest: true }
3838
- });
4131
+ const handle = client.requestAccessActor.getOrCreate(
4132
+ ["test-headers"],
4133
+ {
4134
+ params: { trackRequest: true }
4135
+ }
4136
+ );
3839
4137
  const connection = handle.connect();
3840
4138
  const requestInfo = await connection.getRequestInfo();
3841
4139
  if (driverTestConfig.clientType === "http") {
@@ -3884,9 +4182,18 @@ function runDriverTests(driverTestConfigPartial) {
3884
4182
  ...driverTestConfig,
3885
4183
  transport
3886
4184
  });
3887
- runActorConnStateTests({ ...driverTestConfig, transport });
3888
- runActorReconnectTests({ ...driverTestConfig, transport });
3889
- runRequestAccessTests({ ...driverTestConfig, transport });
4185
+ runActorConnStateTests({
4186
+ ...driverTestConfig,
4187
+ transport
4188
+ });
4189
+ runActorReconnectTests({
4190
+ ...driverTestConfig,
4191
+ transport
4192
+ });
4193
+ runRequestAccessTests({
4194
+ ...driverTestConfig,
4195
+ transport
4196
+ });
3890
4197
  runActorDriverTestsWithTransport({
3891
4198
  ...driverTestConfig,
3892
4199
  transport
@@ -3970,7 +4277,9 @@ async function createTestRuntime(registryPath, driverFactory) {
3970
4277
  const serverEndpoint = `http://127.0.0.1:${port}`;
3971
4278
  logger().info({ msg: "test serer listening", port });
3972
4279
  const cleanup = async () => {
3973
- await new Promise((resolve) => server.close(() => resolve(void 0)));
4280
+ await new Promise(
4281
+ (resolve) => server.close(() => resolve(void 0))
4282
+ );
3974
4283
  await (driverCleanup == null ? void 0 : driverCleanup());
3975
4284
  };
3976
4285
  return {