rivetkit 2.0.2 → 2.0.4-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (403) hide show
  1. package/README.md +3 -5
  2. package/dist/browser/client.d.ts +2485 -0
  3. package/dist/browser/client.js +5182 -0
  4. package/dist/browser/client.js.map +1 -0
  5. package/dist/browser/inspector/client.d.ts +130 -0
  6. package/dist/browser/inspector/client.js +2854 -0
  7. package/dist/browser/inspector/client.js.map +1 -0
  8. package/dist/browser/v3-DnYObHH3.d.ts +279 -0
  9. package/dist/inspector.tar.gz +0 -0
  10. package/dist/schemas/actor-inspector/v1.ts +784 -0
  11. package/dist/schemas/actor-inspector/v2.ts +796 -0
  12. package/dist/schemas/actor-inspector/v3.ts +899 -0
  13. package/dist/schemas/actor-persist/v1.ts +225 -0
  14. package/dist/schemas/actor-persist/v2.ts +268 -0
  15. package/dist/schemas/actor-persist/v3.ts +280 -0
  16. package/dist/schemas/actor-persist/v4.ts +406 -0
  17. package/dist/schemas/client-protocol/v1.ts +441 -0
  18. package/dist/schemas/client-protocol/v2.ts +438 -0
  19. package/dist/schemas/client-protocol/v3.ts +554 -0
  20. package/dist/schemas/file-system-driver/v1.ts +108 -0
  21. package/dist/schemas/file-system-driver/v2.ts +142 -0
  22. package/dist/schemas/file-system-driver/v3.ts +167 -0
  23. package/dist/schemas/persist/v1.ts +781 -0
  24. package/dist/schemas/transport/v1.ts +697 -0
  25. package/dist/tsup/actor/errors.cjs +106 -0
  26. package/dist/tsup/actor/errors.cjs.map +1 -0
  27. package/dist/tsup/actor/errors.d.cts +188 -0
  28. package/dist/tsup/actor/errors.d.ts +188 -0
  29. package/dist/tsup/actor/errors.js +106 -0
  30. package/dist/tsup/actor/errors.js.map +1 -0
  31. package/dist/tsup/actor-router-consts-D29T1Z-K.d.cts +24 -0
  32. package/dist/tsup/actor-router-consts-D29T1Z-K.d.ts +24 -0
  33. package/dist/tsup/chunk-325TLXJT.js +1060 -0
  34. package/dist/tsup/chunk-325TLXJT.js.map +1 -0
  35. package/dist/tsup/chunk-424PT5DM.js +23 -0
  36. package/dist/tsup/chunk-424PT5DM.js.map +1 -0
  37. package/dist/tsup/chunk-4JVIG3SS.cjs +6289 -0
  38. package/dist/tsup/chunk-4JVIG3SS.cjs.map +1 -0
  39. package/dist/tsup/chunk-6LJAZ5R4.cjs +96 -0
  40. package/dist/tsup/chunk-6LJAZ5R4.cjs.map +1 -0
  41. package/dist/tsup/chunk-6XU3FMCB.cjs +534 -0
  42. package/dist/tsup/chunk-6XU3FMCB.cjs.map +1 -0
  43. package/dist/tsup/chunk-7HTNH26M.js +509 -0
  44. package/dist/tsup/chunk-7HTNH26M.js.map +1 -0
  45. package/dist/tsup/chunk-AUVH72RE.cjs +5977 -0
  46. package/dist/tsup/chunk-AUVH72RE.cjs.map +1 -0
  47. package/dist/tsup/chunk-D4BYUPNQ.js +645 -0
  48. package/dist/tsup/chunk-D4BYUPNQ.js.map +1 -0
  49. package/dist/tsup/chunk-HDQ2JUQT.cjs +23 -0
  50. package/dist/tsup/chunk-HDQ2JUQT.cjs.map +1 -0
  51. package/dist/tsup/chunk-HHXX2VRM.js +6289 -0
  52. package/dist/tsup/chunk-HHXX2VRM.js.map +1 -0
  53. package/dist/tsup/chunk-JEAEA2PB.js +49 -0
  54. package/dist/tsup/chunk-JEAEA2PB.js.map +1 -0
  55. package/dist/tsup/chunk-JYSEG3VF.cjs +642 -0
  56. package/dist/tsup/chunk-JYSEG3VF.cjs.map +1 -0
  57. package/dist/tsup/chunk-K6DGYILQ.js +2657 -0
  58. package/dist/tsup/chunk-K6DGYILQ.js.map +1 -0
  59. package/dist/tsup/chunk-KJSYAUOM.js +96 -0
  60. package/dist/tsup/chunk-KJSYAUOM.js.map +1 -0
  61. package/dist/tsup/chunk-L47L3ZWJ.cjs +509 -0
  62. package/dist/tsup/chunk-L47L3ZWJ.cjs.map +1 -0
  63. package/dist/tsup/chunk-LXUQ667X.js +2006 -0
  64. package/dist/tsup/chunk-LXUQ667X.js.map +1 -0
  65. package/dist/tsup/chunk-MXNPAB5W.js +5977 -0
  66. package/dist/tsup/chunk-MXNPAB5W.js.map +1 -0
  67. package/dist/tsup/chunk-N4KRDJ56.js +72 -0
  68. package/dist/tsup/chunk-N4KRDJ56.js.map +1 -0
  69. package/dist/tsup/chunk-NIYZDWMW.cjs +2006 -0
  70. package/dist/tsup/chunk-NIYZDWMW.cjs.map +1 -0
  71. package/dist/tsup/chunk-PQZHDKRW.cjs +1060 -0
  72. package/dist/tsup/chunk-PQZHDKRW.cjs.map +1 -0
  73. package/dist/tsup/chunk-PVOE6BU7.cjs +1050 -0
  74. package/dist/tsup/chunk-PVOE6BU7.cjs.map +1 -0
  75. package/dist/tsup/chunk-Q4UD2GA4.cjs +1810 -0
  76. package/dist/tsup/chunk-Q4UD2GA4.cjs.map +1 -0
  77. package/dist/tsup/chunk-QUD664YZ.js +1810 -0
  78. package/dist/tsup/chunk-QUD664YZ.js.map +1 -0
  79. package/dist/tsup/chunk-RTOCTWME.js +1050 -0
  80. package/dist/tsup/chunk-RTOCTWME.js.map +1 -0
  81. package/dist/tsup/chunk-SAZZ4SB2.cjs +2657 -0
  82. package/dist/tsup/chunk-SAZZ4SB2.cjs.map +1 -0
  83. package/dist/tsup/chunk-SR3KQE7Q.cjs +72 -0
  84. package/dist/tsup/chunk-SR3KQE7Q.cjs.map +1 -0
  85. package/dist/tsup/chunk-V2GHLYC6.cjs +49 -0
  86. package/dist/tsup/chunk-V2GHLYC6.cjs.map +1 -0
  87. package/dist/tsup/chunk-V3WG7XTW.cjs +645 -0
  88. package/dist/tsup/chunk-V3WG7XTW.cjs.map +1 -0
  89. package/dist/tsup/chunk-VKVNIQRQ.js +257 -0
  90. package/dist/tsup/chunk-VKVNIQRQ.js.map +1 -0
  91. package/dist/tsup/chunk-WMPW7JYC.js +642 -0
  92. package/dist/tsup/chunk-WMPW7JYC.js.map +1 -0
  93. package/dist/tsup/chunk-Z7HNQ2WF.js +534 -0
  94. package/dist/tsup/chunk-Z7HNQ2WF.js.map +1 -0
  95. package/dist/tsup/chunk-ZFY5J2EP.cjs +257 -0
  96. package/dist/tsup/chunk-ZFY5J2EP.cjs.map +1 -0
  97. package/dist/tsup/client/mod.cjs +33 -0
  98. package/dist/tsup/client/mod.cjs.map +1 -0
  99. package/dist/tsup/client/mod.d.cts +64 -0
  100. package/dist/tsup/client/mod.d.ts +64 -0
  101. package/dist/tsup/client/mod.js +33 -0
  102. package/dist/tsup/client/mod.js.map +1 -0
  103. package/dist/tsup/common/log.cjs +21 -0
  104. package/dist/tsup/common/log.cjs.map +1 -0
  105. package/dist/tsup/common/log.d.cts +34 -0
  106. package/dist/tsup/common/log.d.ts +34 -0
  107. package/dist/tsup/common/log.js +21 -0
  108. package/dist/tsup/common/log.js.map +1 -0
  109. package/dist/tsup/common/websocket.cjs +10 -0
  110. package/dist/tsup/common/websocket.cjs.map +1 -0
  111. package/dist/tsup/common/websocket.d.cts +3 -0
  112. package/dist/tsup/common/websocket.d.ts +3 -0
  113. package/dist/tsup/common/websocket.js +10 -0
  114. package/dist/tsup/common/websocket.js.map +1 -0
  115. package/dist/tsup/config-BiNoIHRs.d.cts +80 -0
  116. package/dist/tsup/config-BiNoIHRs.d.ts +80 -0
  117. package/dist/tsup/config-P3XujgRr.d.ts +2594 -0
  118. package/dist/tsup/config-_gfywqqI.d.cts +2594 -0
  119. package/dist/tsup/context-Bxd8Cx4H.d.cts +75 -0
  120. package/dist/tsup/context-uNA4TRn3.d.ts +75 -0
  121. package/dist/tsup/db/drizzle/mod.cjs +49 -0
  122. package/dist/tsup/db/drizzle/mod.cjs.map +1 -0
  123. package/dist/tsup/db/drizzle/mod.d.cts +17 -0
  124. package/dist/tsup/db/drizzle/mod.d.ts +17 -0
  125. package/dist/tsup/db/drizzle/mod.js +49 -0
  126. package/dist/tsup/db/drizzle/mod.js.map +1 -0
  127. package/dist/tsup/db/mod.cjs +9 -0
  128. package/dist/tsup/db/mod.cjs.map +1 -0
  129. package/dist/tsup/db/mod.d.cts +9 -0
  130. package/dist/tsup/db/mod.d.ts +9 -0
  131. package/dist/tsup/db/mod.js +9 -0
  132. package/dist/tsup/db/mod.js.map +1 -0
  133. package/dist/tsup/driver-BcLvZcKl.d.cts +13 -0
  134. package/dist/tsup/driver-CPGHKXyh.d.ts +13 -0
  135. package/dist/tsup/driver-helpers/mod.cjs +53 -0
  136. package/dist/tsup/driver-helpers/mod.cjs.map +1 -0
  137. package/dist/tsup/driver-helpers/mod.d.cts +47 -0
  138. package/dist/tsup/driver-helpers/mod.d.ts +47 -0
  139. package/dist/tsup/driver-helpers/mod.js +53 -0
  140. package/dist/tsup/driver-helpers/mod.js.map +1 -0
  141. package/dist/tsup/driver-test-suite/mod.cjs +4974 -0
  142. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -0
  143. package/dist/tsup/driver-test-suite/mod.d.cts +73 -0
  144. package/dist/tsup/driver-test-suite/mod.d.ts +73 -0
  145. package/dist/tsup/driver-test-suite/mod.js +4974 -0
  146. package/dist/tsup/driver-test-suite/mod.js.map +1 -0
  147. package/dist/tsup/inspector/mod.cjs +164 -0
  148. package/dist/tsup/inspector/mod.cjs.map +1 -0
  149. package/dist/tsup/inspector/mod.d.cts +130 -0
  150. package/dist/tsup/inspector/mod.d.ts +130 -0
  151. package/dist/tsup/inspector/mod.js +164 -0
  152. package/dist/tsup/inspector/mod.js.map +1 -0
  153. package/dist/tsup/keys-CydblqMh.d.cts +13 -0
  154. package/dist/tsup/keys-CydblqMh.d.ts +13 -0
  155. package/dist/tsup/mod.cjs +82 -0
  156. package/dist/tsup/mod.cjs.map +1 -0
  157. package/dist/tsup/mod.d.cts +126 -0
  158. package/dist/tsup/mod.d.ts +126 -0
  159. package/dist/tsup/mod.js +82 -0
  160. package/dist/tsup/mod.js.map +1 -0
  161. package/dist/tsup/serve-test-suite/mod.cjs +2601 -0
  162. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -0
  163. package/dist/tsup/serve-test-suite/mod.d.cts +9 -0
  164. package/dist/tsup/serve-test-suite/mod.d.ts +9 -0
  165. package/dist/tsup/serve-test-suite/mod.js +2601 -0
  166. package/dist/tsup/serve-test-suite/mod.js.map +1 -0
  167. package/dist/tsup/test/mod.cjs +90 -0
  168. package/dist/tsup/test/mod.cjs.map +1 -0
  169. package/dist/tsup/test/mod.d.cts +26 -0
  170. package/dist/tsup/test/mod.d.ts +26 -0
  171. package/dist/tsup/test/mod.js +90 -0
  172. package/dist/tsup/test/mod.js.map +1 -0
  173. package/dist/tsup/utils-fwx3o3K9.d.cts +18 -0
  174. package/dist/tsup/utils-fwx3o3K9.d.ts +18 -0
  175. package/dist/tsup/utils.cjs +43 -0
  176. package/dist/tsup/utils.cjs.map +1 -0
  177. package/dist/tsup/utils.d.cts +148 -0
  178. package/dist/tsup/utils.d.ts +148 -0
  179. package/dist/tsup/utils.js +43 -0
  180. package/dist/tsup/utils.js.map +1 -0
  181. package/dist/tsup/v3-DnYObHH3.d.cts +279 -0
  182. package/dist/tsup/v3-DnYObHH3.d.ts +279 -0
  183. package/dist/tsup/workflow/mod.cjs +16 -0
  184. package/dist/tsup/workflow/mod.cjs.map +1 -0
  185. package/dist/tsup/workflow/mod.d.cts +25 -0
  186. package/dist/tsup/workflow/mod.d.ts +25 -0
  187. package/dist/tsup/workflow/mod.js +16 -0
  188. package/dist/tsup/workflow/mod.js.map +1 -0
  189. package/package.json +293 -5
  190. package/src/actor/config.ts +1221 -0
  191. package/src/actor/conn/driver.ts +61 -0
  192. package/src/actor/conn/drivers/http.ts +17 -0
  193. package/src/actor/conn/drivers/raw-request.ts +24 -0
  194. package/src/actor/conn/drivers/raw-websocket.ts +65 -0
  195. package/src/actor/conn/drivers/websocket.ts +144 -0
  196. package/src/actor/conn/mod.ts +288 -0
  197. package/src/actor/conn/persisted.ts +81 -0
  198. package/src/actor/conn/state-manager.ts +196 -0
  199. package/src/actor/contexts/action.ts +47 -0
  200. package/src/actor/contexts/base/actor.ts +347 -0
  201. package/src/actor/contexts/base/conn-init.ts +68 -0
  202. package/src/actor/contexts/base/conn.ts +73 -0
  203. package/src/actor/contexts/before-action-response.ts +42 -0
  204. package/src/actor/contexts/before-connect.ts +31 -0
  205. package/src/actor/contexts/connect.ts +42 -0
  206. package/src/actor/contexts/create-conn-state.ts +32 -0
  207. package/src/actor/contexts/create-vars.ts +39 -0
  208. package/src/actor/contexts/create.ts +39 -0
  209. package/src/actor/contexts/destroy.ts +42 -0
  210. package/src/actor/contexts/disconnect.ts +43 -0
  211. package/src/actor/contexts/index.ts +33 -0
  212. package/src/actor/contexts/request.ts +80 -0
  213. package/src/actor/contexts/run.ts +47 -0
  214. package/src/actor/contexts/sleep.ts +42 -0
  215. package/src/actor/contexts/state-change.ts +42 -0
  216. package/src/actor/contexts/wake.ts +42 -0
  217. package/src/actor/contexts/websocket.ts +80 -0
  218. package/src/actor/database.ts +13 -0
  219. package/src/actor/definition.ts +64 -0
  220. package/src/actor/driver.ts +114 -0
  221. package/src/actor/errors.ts +556 -0
  222. package/src/actor/instance/connection-manager.ts +574 -0
  223. package/src/actor/instance/event-manager.ts +314 -0
  224. package/src/actor/instance/keys.ts +146 -0
  225. package/src/actor/instance/kv.ts +241 -0
  226. package/src/actor/instance/mod.ts +1658 -0
  227. package/src/actor/instance/persisted.ts +67 -0
  228. package/src/actor/instance/queue-manager.ts +603 -0
  229. package/src/actor/instance/queue.ts +345 -0
  230. package/src/actor/instance/schedule-manager.ts +392 -0
  231. package/src/actor/instance/state-manager.ts +542 -0
  232. package/src/actor/instance/traces-driver.ts +128 -0
  233. package/src/actor/keys.test.ts +275 -0
  234. package/src/actor/keys.ts +89 -0
  235. package/src/actor/log.ts +6 -0
  236. package/src/actor/mod.ts +110 -0
  237. package/src/actor/protocol/old.ts +416 -0
  238. package/src/actor/protocol/serde.ts +222 -0
  239. package/src/actor/router-endpoints.ts +400 -0
  240. package/src/actor/router-websocket-endpoints.test.ts +54 -0
  241. package/src/actor/router-websocket-endpoints.ts +405 -0
  242. package/src/actor/router.ts +380 -0
  243. package/src/actor/schedule.ts +17 -0
  244. package/src/actor/schema.ts +291 -0
  245. package/src/actor/utils.test.ts +48 -0
  246. package/src/actor/utils.ts +158 -0
  247. package/src/client/actor-common.ts +32 -0
  248. package/src/client/actor-conn.ts +1262 -0
  249. package/src/client/actor-handle.ts +344 -0
  250. package/src/client/actor-query.ts +112 -0
  251. package/src/client/client.ts +558 -0
  252. package/src/client/config.ts +151 -0
  253. package/src/client/errors.ts +76 -0
  254. package/src/client/log.ts +5 -0
  255. package/src/client/mod.browser.ts +2 -0
  256. package/src/client/mod.ts +70 -0
  257. package/src/client/queue.ts +146 -0
  258. package/src/client/raw-utils.ts +149 -0
  259. package/src/client/test.ts +44 -0
  260. package/src/client/utils.ts +252 -0
  261. package/src/common/actor-router-consts.ts +59 -0
  262. package/src/common/cors.ts +57 -0
  263. package/src/common/eventsource-interface.ts +47 -0
  264. package/src/common/eventsource.ts +44 -0
  265. package/src/common/inline-websocket-adapter.ts +154 -0
  266. package/src/common/log-levels.ts +27 -0
  267. package/src/common/log.ts +229 -0
  268. package/src/common/logfmt.ts +221 -0
  269. package/src/common/network.ts +2 -0
  270. package/src/common/router.ts +174 -0
  271. package/src/common/utils.ts +339 -0
  272. package/src/common/websocket-interface.ts +7 -0
  273. package/src/common/websocket.ts +43 -0
  274. package/src/db/config.ts +100 -0
  275. package/src/db/drizzle/mod.ts +226 -0
  276. package/src/db/drizzle/sqlite-core.ts +22 -0
  277. package/src/db/mod.ts +125 -0
  278. package/src/db/shared.ts +92 -0
  279. package/src/db/sqlite-vfs.ts +12 -0
  280. package/src/devtools-loader/index.ts +33 -0
  281. package/src/devtools-loader/log.ts +5 -0
  282. package/src/driver-helpers/mod.ts +33 -0
  283. package/src/driver-helpers/utils.ts +54 -0
  284. package/src/driver-test-suite/log.ts +5 -0
  285. package/src/driver-test-suite/mod.ts +293 -0
  286. package/src/driver-test-suite/test-inline-client-driver.ts +307 -0
  287. package/src/driver-test-suite/tests/access-control.ts +218 -0
  288. package/src/driver-test-suite/tests/action-features.ts +203 -0
  289. package/src/driver-test-suite/tests/actor-conn-hibernation.ts +152 -0
  290. package/src/driver-test-suite/tests/actor-conn-state.ts +300 -0
  291. package/src/driver-test-suite/tests/actor-conn.ts +596 -0
  292. package/src/driver-test-suite/tests/actor-db-raw.ts +73 -0
  293. package/src/driver-test-suite/tests/actor-db.ts +477 -0
  294. package/src/driver-test-suite/tests/actor-destroy.ts +294 -0
  295. package/src/driver-test-suite/tests/actor-driver.ts +18 -0
  296. package/src/driver-test-suite/tests/actor-error-handling.ts +150 -0
  297. package/src/driver-test-suite/tests/actor-handle.ts +312 -0
  298. package/src/driver-test-suite/tests/actor-inline-client.ts +163 -0
  299. package/src/driver-test-suite/tests/actor-inspector.ts +264 -0
  300. package/src/driver-test-suite/tests/actor-kv.ts +65 -0
  301. package/src/driver-test-suite/tests/actor-metadata.ts +116 -0
  302. package/src/driver-test-suite/tests/actor-onstatechange.ts +95 -0
  303. package/src/driver-test-suite/tests/actor-queue.ts +325 -0
  304. package/src/driver-test-suite/tests/actor-run.ts +181 -0
  305. package/src/driver-test-suite/tests/actor-schedule.ts +97 -0
  306. package/src/driver-test-suite/tests/actor-sleep.ts +415 -0
  307. package/src/driver-test-suite/tests/actor-state.ts +54 -0
  308. package/src/driver-test-suite/tests/actor-stateless.ts +70 -0
  309. package/src/driver-test-suite/tests/actor-vars.ts +97 -0
  310. package/src/driver-test-suite/tests/actor-workflow.ts +118 -0
  311. package/src/driver-test-suite/tests/manager-driver.ts +388 -0
  312. package/src/driver-test-suite/tests/raw-http-direct-registry.ts +227 -0
  313. package/src/driver-test-suite/tests/raw-http-request-properties.ts +454 -0
  314. package/src/driver-test-suite/tests/raw-http.ts +359 -0
  315. package/src/driver-test-suite/tests/raw-websocket-direct-registry.ts +393 -0
  316. package/src/driver-test-suite/tests/raw-websocket.ts +513 -0
  317. package/src/driver-test-suite/tests/request-access.ts +240 -0
  318. package/src/driver-test-suite/utils.ts +80 -0
  319. package/src/drivers/default.ts +38 -0
  320. package/src/drivers/engine/actor-driver.ts +1027 -0
  321. package/src/drivers/engine/config.ts +43 -0
  322. package/src/drivers/engine/log.ts +5 -0
  323. package/src/drivers/engine/mod.ts +36 -0
  324. package/src/drivers/file-system/actor.ts +102 -0
  325. package/src/drivers/file-system/global-state.ts +1445 -0
  326. package/src/drivers/file-system/kv-limits.ts +70 -0
  327. package/src/drivers/file-system/log.ts +5 -0
  328. package/src/drivers/file-system/manager.ts +300 -0
  329. package/src/drivers/file-system/mod.ts +78 -0
  330. package/src/drivers/file-system/sqlite-runtime.ts +210 -0
  331. package/src/drivers/file-system/utils.ts +125 -0
  332. package/src/engine-process/constants.ts +2 -0
  333. package/src/engine-process/log.ts +5 -0
  334. package/src/engine-process/mod.ts +464 -0
  335. package/src/globals.d.ts +35 -0
  336. package/src/inspector/actor-inspector.ts +352 -0
  337. package/src/inspector/config.ts +49 -0
  338. package/src/inspector/handler.ts +273 -0
  339. package/src/inspector/log.ts +5 -0
  340. package/src/inspector/mod.browser.ts +8 -0
  341. package/src/inspector/mod.ts +4 -0
  342. package/src/inspector/serve-ui.ts +40 -0
  343. package/src/inspector/transport.ts +18 -0
  344. package/src/inspector/utils.ts +32 -0
  345. package/src/manager/driver.ts +106 -0
  346. package/src/manager/gateway.ts +668 -0
  347. package/src/manager/log.ts +5 -0
  348. package/src/manager/mod.ts +2 -0
  349. package/src/manager/protocol/mod.ts +22 -0
  350. package/src/manager/protocol/query.ts +85 -0
  351. package/src/manager/router-schema.ts +22 -0
  352. package/src/manager/router.ts +660 -0
  353. package/src/manager-api/actors.ts +83 -0
  354. package/src/manager-api/common.ts +4 -0
  355. package/src/mod.ts +24 -0
  356. package/src/registry/config/driver.ts +21 -0
  357. package/src/registry/config/index.ts +510 -0
  358. package/src/registry/config/legacy-runner.ts +157 -0
  359. package/src/registry/config/runner.ts +21 -0
  360. package/src/registry/config/serverless.ts +94 -0
  361. package/src/registry/index.ts +194 -0
  362. package/src/registry/log.ts +5 -0
  363. package/src/remote-manager-driver/actor-http-client.ts +84 -0
  364. package/src/remote-manager-driver/actor-websocket-client.ts +81 -0
  365. package/src/remote-manager-driver/api-endpoints.ts +159 -0
  366. package/src/remote-manager-driver/api-utils.ts +69 -0
  367. package/src/remote-manager-driver/log.ts +5 -0
  368. package/src/remote-manager-driver/metadata.ts +64 -0
  369. package/src/remote-manager-driver/mod.ts +414 -0
  370. package/src/remote-manager-driver/ws-proxy.ts +189 -0
  371. package/src/schemas/actor-inspector/mod.ts +1 -0
  372. package/src/schemas/actor-inspector/versioned.ts +233 -0
  373. package/src/schemas/actor-persist/mod.ts +1 -0
  374. package/src/schemas/actor-persist/versioned.ts +217 -0
  375. package/src/schemas/client-protocol/mod.ts +1 -0
  376. package/src/schemas/client-protocol/versioned.ts +330 -0
  377. package/src/schemas/client-protocol-zod/mod.ts +118 -0
  378. package/src/schemas/file-system-driver/mod.ts +1 -0
  379. package/src/schemas/file-system-driver/versioned.ts +135 -0
  380. package/src/schemas/persist/mod.ts +1 -0
  381. package/src/schemas/transport/mod.ts +1 -0
  382. package/src/serde.ts +138 -0
  383. package/src/serve-test-suite/mod.ts +148 -0
  384. package/src/serverless/configure.ts +82 -0
  385. package/src/serverless/log.ts +5 -0
  386. package/src/serverless/router.test.ts +299 -0
  387. package/src/serverless/router.ts +215 -0
  388. package/src/test/log.ts +5 -0
  389. package/src/test/mod.ts +99 -0
  390. package/src/utils/crypto.ts +24 -0
  391. package/src/utils/endpoint-parser.test.ts +202 -0
  392. package/src/utils/endpoint-parser.ts +124 -0
  393. package/src/utils/env-vars.ts +78 -0
  394. package/src/utils/node.ts +178 -0
  395. package/src/utils/router.ts +83 -0
  396. package/src/utils/serve.ts +212 -0
  397. package/src/utils.test.ts +34 -0
  398. package/src/utils.ts +437 -0
  399. package/src/workflow/constants.ts +2 -0
  400. package/src/workflow/context.ts +597 -0
  401. package/src/workflow/driver.ts +194 -0
  402. package/src/workflow/inspector.ts +268 -0
  403. package/src/workflow/mod.ts +128 -0
@@ -0,0 +1,227 @@
1
+ // TODO: re-expose this once we can have actor queries on the gateway
2
+ // import { describe, expect, test } from "vitest";
3
+ // import {
4
+ // HEADER_ACTOR_QUERY,
5
+ // HEADER_CONN_PARAMS,
6
+ // } from "@/actor/router-endpoints";
7
+ // import type { ActorQuery } from "@/manager/protocol/query";
8
+ // import type { DriverTestConfig } from "../mod";
9
+ // import { setupDriverTest } from "../utils";
10
+ //
11
+ // export function runRawHttpDirectRegistryTests(
12
+ // driverTestConfig: DriverTestConfig,
13
+ // ) {
14
+ // describe("raw http - direct registry access", () => {
15
+ // test("should handle direct fetch requests to registry with proper headers", async (c) => {
16
+ // const { endpoint } = await setupDriverTest(c, driverTestConfig);
17
+ //
18
+ // // Build the actor query
19
+ // const actorQuery: ActorQuery = {
20
+ // getOrCreateForKey: {
21
+ // name: "rawHttpActor",
22
+ // key: ["direct-test"],
23
+ // },
24
+ // };
25
+ //
26
+ // // Make a direct fetch request to the registry
27
+ // const response = await fetch(
28
+ // `${endpoint}/registry/actors/request/api/hello`,
29
+ // {
30
+ // method: "GET",
31
+ // headers: {
32
+ // [HEADER_ACTOR_QUERY]: JSON.stringify(actorQuery),
33
+ // },
34
+ // },
35
+ // );
36
+ //
37
+ // expect(response.ok).toBe(true);
38
+ // expect(response.status).toBe(200);
39
+ // const data = await response.json();
40
+ // expect(data).toEqual({ message: "Hello from actor!" });
41
+ // });
42
+ //
43
+ // test("should handle POST requests with body to registry", async (c) => {
44
+ // const { endpoint } = await setupDriverTest(c, driverTestConfig);
45
+ //
46
+ // const actorQuery: ActorQuery = {
47
+ // getOrCreateForKey: {
48
+ // name: "rawHttpActor",
49
+ // key: ["direct-post-test"],
50
+ // },
51
+ // };
52
+ //
53
+ // const testData = { test: "direct", number: 456 };
54
+ // const response = await fetch(
55
+ // `${endpoint}/registry/actors/request/api/echo`,
56
+ // {
57
+ // method: "POST",
58
+ // headers: {
59
+ // [HEADER_ACTOR_QUERY]: JSON.stringify(actorQuery),
60
+ // "Content-Type": "application/json",
61
+ // },
62
+ // body: JSON.stringify(testData),
63
+ // },
64
+ // );
65
+ //
66
+ // expect(response.ok).toBe(true);
67
+ // expect(response.status).toBe(200);
68
+ // const data = await response.json();
69
+ // expect(data).toEqual(testData);
70
+ // });
71
+ //
72
+ // test("should pass custom headers through to actor", async (c) => {
73
+ // const { endpoint } = await setupDriverTest(c, driverTestConfig);
74
+ //
75
+ // const actorQuery: ActorQuery = {
76
+ // getOrCreateForKey: {
77
+ // name: "rawHttpActor",
78
+ // key: ["direct-headers-test"],
79
+ // },
80
+ // };
81
+ //
82
+ // const customHeaders = {
83
+ // "X-Custom-Header": "direct-test-value",
84
+ // "X-Another-Header": "another-direct-value",
85
+ // };
86
+ //
87
+ // const response = await fetch(
88
+ // `${endpoint}/registry/actors/request/api/headers`,
89
+ // {
90
+ // method: "GET",
91
+ // headers: {
92
+ // [HEADER_ACTOR_QUERY]: JSON.stringify(actorQuery),
93
+ // ...customHeaders,
94
+ // },
95
+ // },
96
+ // );
97
+ //
98
+ // expect(response.ok).toBe(true);
99
+ // const headers = (await response.json()) as Record<string, string>;
100
+ // expect(headers["x-custom-header"]).toBe("direct-test-value");
101
+ // expect(headers["x-another-header"]).toBe("another-direct-value");
102
+ // });
103
+ //
104
+ // test("should handle connection parameters for authentication", async (c) => {
105
+ // const { endpoint } = await setupDriverTest(c, driverTestConfig);
106
+ //
107
+ // const actorQuery: ActorQuery = {
108
+ // getOrCreateForKey: {
109
+ // name: "rawHttpActor",
110
+ // key: ["direct-auth-test"],
111
+ // },
112
+ // };
113
+ //
114
+ // const connParams = { token: "test-auth-token", userId: "user123" };
115
+ //
116
+ // const response = await fetch(
117
+ // `${endpoint}/registry/actors/request/api/hello`,
118
+ // {
119
+ // method: "GET",
120
+ // headers: {
121
+ // [HEADER_ACTOR_QUERY]: JSON.stringify(actorQuery),
122
+ // [HEADER_CONN_PARAMS]: JSON.stringify(connParams),
123
+ // },
124
+ // },
125
+ // );
126
+ //
127
+ // expect(response.ok).toBe(true);
128
+ // const data = await response.json();
129
+ // expect(data).toEqual({ message: "Hello from actor!" });
130
+ // });
131
+ //
132
+ // test("should return 404 for actors without onRequest handler", async (c) => {
133
+ // const { endpoint } = await setupDriverTest(c, driverTestConfig);
134
+ //
135
+ // const actorQuery: ActorQuery = {
136
+ // getOrCreateForKey: {
137
+ // name: "rawHttpNoHandlerActor",
138
+ // key: ["direct-no-handler"],
139
+ // },
140
+ // };
141
+ //
142
+ // const response = await fetch(
143
+ // `${endpoint}/registry/actors/request/api/anything`,
144
+ // {
145
+ // method: "GET",
146
+ // headers: {
147
+ // [HEADER_ACTOR_QUERY]: JSON.stringify(actorQuery),
148
+ // },
149
+ // },
150
+ // );
151
+ //
152
+ // expect(response.ok).toBe(false);
153
+ // expect(response.status).toBe(404);
154
+ // });
155
+ //
156
+ // test("should handle different HTTP methods", async (c) => {
157
+ // const { endpoint } = await setupDriverTest(c, driverTestConfig);
158
+ //
159
+ // const actorQuery: ActorQuery = {
160
+ // getOrCreateForKey: {
161
+ // name: "rawHttpActor",
162
+ // key: ["direct-methods-test"],
163
+ // },
164
+ // };
165
+ //
166
+ // // Test various HTTP methods
167
+ // const methods = ["GET", "POST", "PUT", "DELETE", "PATCH"] as const;
168
+ //
169
+ // for (const method of methods) {
170
+ // const response = await fetch(
171
+ // `${endpoint}/registry/actors/request/api/echo`,
172
+ // {
173
+ // method,
174
+ // headers: {
175
+ // [HEADER_ACTOR_QUERY]: JSON.stringify(actorQuery),
176
+ // ...(method !== "GET"
177
+ // ? { "Content-Type": "application/json" }
178
+ // : {}),
179
+ // },
180
+ // body: ["POST", "PUT", "PATCH"].includes(method)
181
+ // ? JSON.stringify({ method })
182
+ // : undefined,
183
+ // },
184
+ // );
185
+ //
186
+ // // Echo endpoint only handles POST, others should fall through to 404
187
+ // if (method === "POST") {
188
+ // expect(response.ok).toBe(true);
189
+ // const data = await response.json();
190
+ // expect(data).toEqual({ method });
191
+ // } else {
192
+ // expect(response.status).toBe(404);
193
+ // }
194
+ // }
195
+ // });
196
+ //
197
+ // test("should handle binary data", async (c) => {
198
+ // const { endpoint } = await setupDriverTest(c, driverTestConfig);
199
+ //
200
+ // const actorQuery: ActorQuery = {
201
+ // getOrCreateForKey: {
202
+ // name: "rawHttpActor",
203
+ // key: ["direct-binary-test"],
204
+ // },
205
+ // };
206
+ //
207
+ // // Send binary data
208
+ // const binaryData = new Uint8Array([1, 2, 3, 4, 5]);
209
+ // const response = await fetch(
210
+ // `${endpoint}/registry/actors/request/api/echo`,
211
+ // {
212
+ // method: "POST",
213
+ // headers: {
214
+ // [HEADER_ACTOR_QUERY]: JSON.stringify(actorQuery),
215
+ // "Content-Type": "application/octet-stream",
216
+ // },
217
+ // body: binaryData,
218
+ // },
219
+ // );
220
+ //
221
+ // expect(response.ok).toBe(true);
222
+ // const responseBuffer = await response.arrayBuffer();
223
+ // const responseArray = new Uint8Array(responseBuffer);
224
+ // expect(Array.from(responseArray)).toEqual([1, 2, 3, 4, 5]);
225
+ // });
226
+ // });
227
+ // }
@@ -0,0 +1,454 @@
1
+ import { describe, expect, test } from "vitest";
2
+ import { z } from "zod/v4";
3
+ import { registry } from "../../../fixtures/driver-test-suite/registry";
4
+ import type { DriverTestConfig } from "../mod";
5
+ import { setupDriverTest } from "../utils";
6
+
7
+ export function runRawHttpRequestPropertiesTests(
8
+ driverTestConfig: DriverTestConfig,
9
+ ) {
10
+ describe("raw http request properties", () => {
11
+ test("should pass all Request properties correctly to onRequest", async (c) => {
12
+ const { client } = await setupDriverTest(c, driverTestConfig);
13
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
14
+ "test",
15
+ ]);
16
+
17
+ // Test basic request properties
18
+ const response = await actor.fetch("test/path?foo=bar&baz=qux", {
19
+ method: "POST",
20
+ headers: {
21
+ "Content-Type": "application/json",
22
+ "X-Custom-Header": "custom-value",
23
+ Authorization: "Bearer test-token",
24
+ },
25
+ body: JSON.stringify({ test: "data" }),
26
+ });
27
+
28
+ expect(response.ok).toBe(true);
29
+ const data = (await response.json()) as any;
30
+
31
+ // Verify URL properties
32
+ expect(data.url).toContain("/test/path?foo=bar&baz=qux");
33
+ expect(data.pathname).toBe("/test/path");
34
+ expect(data.search).toBe("?foo=bar&baz=qux");
35
+ expect(data.searchParams).toEqual({
36
+ foo: "bar",
37
+ baz: "qux",
38
+ });
39
+
40
+ // Verify method
41
+ expect(data.method).toBe("POST");
42
+
43
+ // Verify headers
44
+ expect(data.headers["content-type"]).toBe("application/json");
45
+ expect(data.headers["x-custom-header"]).toBe("custom-value");
46
+ expect(data.headers["authorization"]).toBe("Bearer test-token");
47
+
48
+ // Verify body
49
+ expect(data.body).toEqual({ test: "data" });
50
+ });
51
+
52
+ test("should handle GET requests with no body", async (c) => {
53
+ const { client } = await setupDriverTest(c, driverTestConfig);
54
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
55
+ "test",
56
+ ]);
57
+
58
+ const response = await actor.fetch("test/get", {
59
+ method: "GET",
60
+ });
61
+
62
+ expect(response.ok).toBe(true);
63
+ const data = (await response.json()) as any;
64
+
65
+ expect(data.method).toBe("GET");
66
+ expect(data.body).toBeNull();
67
+ });
68
+
69
+ test("should handle different content types", async (c) => {
70
+ const { client } = await setupDriverTest(c, driverTestConfig);
71
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
72
+ "test",
73
+ ]);
74
+
75
+ // Test form data
76
+ const formData = new URLSearchParams();
77
+ formData.append("field1", "value1");
78
+ formData.append("field2", "value2");
79
+
80
+ const formResponse = await actor.fetch("test/form", {
81
+ method: "POST",
82
+ headers: {
83
+ "Content-Type": "application/x-www-form-urlencoded",
84
+ },
85
+ body: formData.toString(),
86
+ });
87
+
88
+ expect(formResponse.ok).toBe(true);
89
+ const formResult = (await formResponse.json()) as any;
90
+ expect(formResult.headers["content-type"]).toBe(
91
+ "application/x-www-form-urlencoded",
92
+ );
93
+ expect(formResult.bodyText).toBe("field1=value1&field2=value2");
94
+
95
+ // Test plain text
96
+ const textResponse = await actor.fetch("test/text", {
97
+ method: "POST",
98
+ headers: {
99
+ "Content-Type": "text/plain",
100
+ },
101
+ body: "Hello, World!",
102
+ });
103
+
104
+ expect(textResponse.ok).toBe(true);
105
+ const textResult = (await textResponse.json()) as any;
106
+ expect(textResult.headers["content-type"]).toBe("text/plain");
107
+ expect(textResult.bodyText).toBe("Hello, World!");
108
+ });
109
+
110
+ test("should preserve all header casing and values", async (c) => {
111
+ const { client } = await setupDriverTest(c, driverTestConfig);
112
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
113
+ "test",
114
+ ]);
115
+
116
+ const response = await actor.fetch("test/headers", {
117
+ headers: {
118
+ Accept: "application/json",
119
+ "Accept-Language": "en-US,en;q=0.9",
120
+ "Cache-Control": "no-cache",
121
+ "User-Agent": "RivetKit-Test/1.0",
122
+ "X-Request-ID": "12345",
123
+ },
124
+ });
125
+
126
+ expect(response.ok).toBe(true);
127
+ const data = (await response.json()) as any;
128
+
129
+ // Headers should be normalized to lowercase
130
+ expect(data.headers["accept"]).toBe("application/json");
131
+ expect(data.headers["accept-language"]).toBe("en-US,en;q=0.9");
132
+ expect(data.headers["cache-control"]).toBe("no-cache");
133
+ // User-Agent might be overwritten by the HTTP client, so just check it exists
134
+ expect(data.headers["user-agent"]).toBeTruthy();
135
+ expect(data.headers["x-request-id"]).toBe("12345");
136
+ });
137
+
138
+ test("should handle empty and special URL paths", async (c) => {
139
+ const { client } = await setupDriverTest(c, driverTestConfig);
140
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
141
+ "test",
142
+ ]);
143
+
144
+ // Test root path
145
+ const rootResponse = await actor.fetch("");
146
+ expect(rootResponse.ok).toBe(true);
147
+ const rootData = (await rootResponse.json()) as any;
148
+ expect(rootData.pathname).toBe("/");
149
+
150
+ // Test path with special characters
151
+ const specialResponse = await actor.fetch(
152
+ "test/path%20with%20spaces/and%2Fslashes",
153
+ );
154
+ expect(specialResponse.ok).toBe(true);
155
+ const specialData = (await specialResponse.json()) as any;
156
+ // Note: The URL path may or may not be decoded depending on the HTTP client/server
157
+ // Just verify it contains the expected segments
158
+ expect(specialData.pathname).toMatch(
159
+ /path.*with.*spaces.*and.*slashes/,
160
+ );
161
+
162
+ // Test path with fragment (should be ignored in server-side)
163
+ const fragmentResponse = await actor.fetch("test/path#fragment");
164
+ expect(fragmentResponse.ok).toBe(true);
165
+ const fragmentData = (await fragmentResponse.json()) as any;
166
+ expect(fragmentData.pathname).toBe("/test/path");
167
+ expect(fragmentData.hash).toBe(""); // Fragments are not sent to server
168
+ });
169
+
170
+ test("should handle request properties for all HTTP methods", async (c) => {
171
+ const { client } = await setupDriverTest(c, driverTestConfig);
172
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
173
+ "test",
174
+ ]);
175
+
176
+ const methods = [
177
+ "GET",
178
+ "POST",
179
+ "PUT",
180
+ "DELETE",
181
+ "PATCH",
182
+ "HEAD",
183
+ "OPTIONS",
184
+ ];
185
+
186
+ for (const method of methods) {
187
+ const response = await actor.fetch(
188
+ `test/${method.toLowerCase()}`,
189
+ {
190
+ method,
191
+ // Only include body for methods that support it
192
+ body: ["POST", "PUT", "PATCH"].includes(method)
193
+ ? JSON.stringify({ method })
194
+ : undefined,
195
+ },
196
+ );
197
+
198
+ // HEAD responses have no body
199
+ if (method === "HEAD") {
200
+ expect(response.status).toBe(200);
201
+ const text = await response.text();
202
+ expect(text).toBe("");
203
+ } else if (method === "OPTIONS") {
204
+ expect(response.status).toBe(204);
205
+ const text = await response.text();
206
+ expect(text).toBe("");
207
+ } else {
208
+ expect(response.ok).toBe(true);
209
+ const data = (await response.json()) as any;
210
+ expect(data.method).toBe(method);
211
+ }
212
+ }
213
+ });
214
+
215
+ test("should handle complex query parameters", async (c) => {
216
+ const { client } = await setupDriverTest(c, driverTestConfig);
217
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
218
+ "test",
219
+ ]);
220
+
221
+ // Test multiple values for same key
222
+ const response = await actor.fetch(
223
+ "test?key=value1&key=value2&array[]=1&array[]=2&nested[prop]=val",
224
+ );
225
+ expect(response.ok).toBe(true);
226
+ const data = (await response.json()) as any;
227
+
228
+ // Note: URLSearchParams only keeps the last value for duplicate keys
229
+ expect(data.searchParams.key).toBe("value2");
230
+ expect(data.searchParams["array[]"]).toBe("2");
231
+ expect(data.searchParams["nested[prop]"]).toBe("val");
232
+ });
233
+
234
+ test("should handle multipart form data", async (c) => {
235
+ const { client } = await setupDriverTest(c, driverTestConfig);
236
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
237
+ "test",
238
+ ]);
239
+
240
+ // Create multipart boundary
241
+ const boundary = "----RivetKitBoundary";
242
+ const body = [
243
+ `------${boundary}`,
244
+ 'Content-Disposition: form-data; name="field1"',
245
+ "",
246
+ "value1",
247
+ `------${boundary}`,
248
+ 'Content-Disposition: form-data; name="field2"',
249
+ "",
250
+ "value2",
251
+ `------${boundary}--`,
252
+ ].join("\r\n");
253
+
254
+ const response = await actor.fetch("test/multipart", {
255
+ method: "POST",
256
+ headers: {
257
+ "Content-Type": `multipart/form-data; boundary=----${boundary}`,
258
+ },
259
+ body: body,
260
+ });
261
+
262
+ expect(response.ok).toBe(true);
263
+ const data = (await response.json()) as any;
264
+ expect(data.headers["content-type"]).toContain(
265
+ "multipart/form-data",
266
+ );
267
+ expect(data.bodyText).toContain("field1");
268
+ expect(data.bodyText).toContain("value1");
269
+ });
270
+
271
+ test("should handle very long URLs", async (c) => {
272
+ const { client } = await setupDriverTest(c, driverTestConfig);
273
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
274
+ "test",
275
+ ]);
276
+
277
+ // Create a very long query string
278
+ const longValue = "x".repeat(1000);
279
+ const response = await actor.fetch(`test/long?param=${longValue}`);
280
+
281
+ expect(response.ok).toBe(true);
282
+ const data = (await response.json()) as any;
283
+ expect(data.searchParams.param).toBe(longValue);
284
+ expect(data.search.length).toBeGreaterThan(1000);
285
+ });
286
+
287
+ test.skip("should handle large request bodies", async (c) => {
288
+ const { client } = await setupDriverTest(c, driverTestConfig);
289
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
290
+ "test",
291
+ ]);
292
+
293
+ // Create a large JSON body (1MB+)
294
+ const largeArray = new Array(10000).fill({
295
+ id: 1,
296
+ name: "Test",
297
+ description: "This is a test object with some data",
298
+ });
299
+
300
+ const response = await actor.fetch("test/large", {
301
+ method: "POST",
302
+ headers: {
303
+ "Content-Type": "application/json",
304
+ },
305
+ body: JSON.stringify(largeArray),
306
+ });
307
+
308
+ expect(response.ok).toBe(true);
309
+ const data = (await response.json()) as any;
310
+ expect(data.body).toHaveLength(10000);
311
+ });
312
+
313
+ test("should handle missing content-type header", async (c) => {
314
+ const { client } = await setupDriverTest(c, driverTestConfig);
315
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
316
+ "test",
317
+ ]);
318
+
319
+ const response = await actor.fetch("test/no-content-type", {
320
+ method: "POST",
321
+ body: "plain text without content-type",
322
+ });
323
+
324
+ expect(response.ok).toBe(true);
325
+ const data = (await response.json()) as any;
326
+ expect(data.bodyText).toBe("plain text without content-type");
327
+ });
328
+
329
+ test("should handle empty request body", async (c) => {
330
+ const { client } = await setupDriverTest(c, driverTestConfig);
331
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
332
+ "test",
333
+ ]);
334
+
335
+ const response = await actor.fetch("test/empty", {
336
+ method: "POST",
337
+ headers: {
338
+ "Content-Type": "application/json",
339
+ },
340
+ body: "",
341
+ });
342
+
343
+ expect(response.ok).toBe(true);
344
+ // TODO: This is inconsistent between engine & file system driver
345
+ // const data = (await response.json()) as any;
346
+ // expect(data.body).toBeNull();
347
+ // expect(data.bodyText).toBe("");
348
+ });
349
+
350
+ test("should handle custom HTTP methods", async (c) => {
351
+ const { client } = await setupDriverTest(c, driverTestConfig);
352
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
353
+ "test",
354
+ ]);
355
+
356
+ // Test a custom method (though most HTTP clients may not support this)
357
+ try {
358
+ const response = await actor.fetch("test/custom", {
359
+ method: "CUSTOM",
360
+ });
361
+
362
+ // If the request succeeds, verify the method
363
+ if (response.ok) {
364
+ const data = (await response.json()) as any;
365
+ expect(data.method).toBe("CUSTOM");
366
+ }
367
+ } catch (error) {
368
+ // Some HTTP clients may reject custom methods
369
+ // This is expected behavior
370
+ }
371
+ });
372
+
373
+ test("should handle cookies in headers", async (c) => {
374
+ const { client } = await setupDriverTest(c, driverTestConfig);
375
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
376
+ "test",
377
+ ]);
378
+
379
+ const response = await actor.fetch("test/cookies", {
380
+ headers: {
381
+ Cookie: "session=abc123; user=test; preferences=dark_mode",
382
+ },
383
+ });
384
+
385
+ expect(response.ok).toBe(true);
386
+ const data = (await response.json()) as any;
387
+ expect(data.headers.cookie).toBe(
388
+ "session=abc123; user=test; preferences=dark_mode",
389
+ );
390
+ });
391
+
392
+ test("should handle URL encoding properly", async (c) => {
393
+ const { client } = await setupDriverTest(c, driverTestConfig);
394
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
395
+ "test",
396
+ ]);
397
+
398
+ // Test various encoded characters
399
+ const response = await actor.fetch(
400
+ "test/encoded?special=%20%21%40%23%24%25%5E%26&unicode=%E2%9C%93&email=test%40example.com",
401
+ );
402
+
403
+ expect(response.ok).toBe(true);
404
+ const data = (await response.json()) as any;
405
+
406
+ // Verify URL decoding
407
+ expect(data.searchParams.special).toBe(" !@#$%^&");
408
+ expect(data.searchParams.unicode).toBe("✓");
409
+ expect(data.searchParams.email).toBe("test@example.com");
410
+ });
411
+
412
+ test("should handle concurrent requests maintaining separate contexts", async (c) => {
413
+ const { client } = await setupDriverTest(c, driverTestConfig);
414
+ const actor = client.rawHttpRequestPropertiesActor.getOrCreate([
415
+ "test",
416
+ ]);
417
+
418
+ // Send multiple concurrent requests with different data
419
+ const requests = [
420
+ actor.fetch("test/concurrent?id=1", {
421
+ method: "POST",
422
+ headers: { "Content-Type": "application/json" },
423
+ body: JSON.stringify({ request: 1 }),
424
+ }),
425
+ actor.fetch("test/concurrent?id=2", {
426
+ method: "PUT",
427
+ headers: { "Content-Type": "application/json" },
428
+ body: JSON.stringify({ request: 2 }),
429
+ }),
430
+ actor.fetch("test/concurrent?id=3", {
431
+ method: "DELETE",
432
+ }),
433
+ ];
434
+
435
+ const responses = await Promise.all(requests);
436
+ const results = (await Promise.all(
437
+ responses.map((r) => r.json()),
438
+ )) as any[];
439
+
440
+ // Verify each request maintained its own context
441
+ expect(results[0].searchParams.id).toBe("1");
442
+ expect(results[0].method).toBe("POST");
443
+ expect(results[0].body).toEqual({ request: 1 });
444
+
445
+ expect(results[1].searchParams.id).toBe("2");
446
+ expect(results[1].method).toBe("PUT");
447
+ expect(results[1].body).toEqual({ request: 2 });
448
+
449
+ expect(results[2].searchParams.id).toBe("3");
450
+ expect(results[2].method).toBe("DELETE");
451
+ expect(results[2].body).toBeNull();
452
+ });
453
+ });
454
+ }