reactor-effect-client 0.7.0 → 0.8.0

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 (514) hide show
  1. package/NOTICE +7 -2
  2. package/README.md +103 -141
  3. package/dist/Coordinator.d.ts +382 -0
  4. package/dist/Coordinator.d.ts.map +1 -0
  5. package/dist/Coordinator.js +732 -0
  6. package/dist/Coordinator.js.map +1 -0
  7. package/dist/H3.d.ts +159 -0
  8. package/dist/H3.d.ts.map +1 -0
  9. package/dist/H3.js +21 -0
  10. package/dist/H3.js.map +1 -0
  11. package/dist/H3Source.d.ts +93 -0
  12. package/dist/H3Source.d.ts.map +1 -0
  13. package/dist/H3Source.js +401 -0
  14. package/dist/H3Source.js.map +1 -0
  15. package/dist/LocalSource.d.ts +68 -0
  16. package/dist/LocalSource.d.ts.map +1 -0
  17. package/dist/LocalSource.js +354 -0
  18. package/dist/LocalSource.js.map +1 -0
  19. package/dist/Media.d.ts +106 -0
  20. package/dist/Media.d.ts.map +1 -0
  21. package/dist/Media.js +16 -0
  22. package/dist/Media.js.map +1 -0
  23. package/dist/Peer.d.ts +134 -0
  24. package/dist/Peer.d.ts.map +1 -0
  25. package/dist/Peer.js +57 -0
  26. package/dist/Peer.js.map +1 -0
  27. package/dist/Playout.d.ts +724 -0
  28. package/dist/Playout.d.ts.map +1 -0
  29. package/dist/Playout.js +28 -0
  30. package/dist/Playout.js.map +1 -0
  31. package/dist/Reactor.d.ts +135 -0
  32. package/dist/Reactor.d.ts.map +1 -0
  33. package/dist/Reactor.js +158 -0
  34. package/dist/Reactor.js.map +1 -0
  35. package/dist/ReactorError.d.ts +331 -0
  36. package/dist/ReactorError.d.ts.map +1 -0
  37. package/dist/ReactorError.js +316 -0
  38. package/dist/ReactorError.js.map +1 -0
  39. package/dist/ReactorTest.d.ts +383 -0
  40. package/dist/ReactorTest.d.ts.map +1 -0
  41. package/dist/ReactorTest.js +317 -0
  42. package/dist/ReactorTest.js.map +1 -0
  43. package/dist/Session.d.ts +314 -0
  44. package/dist/Session.d.ts.map +1 -0
  45. package/dist/Session.js +51 -0
  46. package/dist/Session.js.map +1 -0
  47. package/dist/index.d.ts +12 -22
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +12 -11
  50. package/dist/index.js.map +1 -1
  51. package/dist/internal/correlator.d.ts +46 -0
  52. package/dist/internal/correlator.d.ts.map +1 -0
  53. package/dist/internal/correlator.js +150 -0
  54. package/dist/internal/correlator.js.map +1 -0
  55. package/dist/internal/deadline.d.ts +24 -0
  56. package/dist/internal/deadline.d.ts.map +1 -0
  57. package/dist/internal/deadline.js +44 -0
  58. package/dist/internal/deadline.js.map +1 -0
  59. package/dist/{h3/_internal/contracts.d.ts → internal/h3/commands.d.ts} +39 -33
  60. package/dist/internal/h3/commands.d.ts.map +1 -0
  61. package/dist/internal/h3/commands.js +128 -0
  62. package/dist/internal/h3/commands.js.map +1 -0
  63. package/dist/{h3 → internal/h3}/messages.d.ts +16 -11
  64. package/dist/internal/h3/messages.d.ts.map +1 -0
  65. package/dist/{h3 → internal/h3}/messages.js +19 -31
  66. package/dist/internal/h3/messages.js.map +1 -0
  67. package/dist/internal/h3/operations.d.ts +145 -0
  68. package/dist/internal/h3/operations.d.ts.map +1 -0
  69. package/dist/internal/h3/operations.js +284 -0
  70. package/dist/internal/h3/operations.js.map +1 -0
  71. package/dist/{h3 → internal/h3}/profile.d.ts +63 -65
  72. package/dist/internal/h3/profile.d.ts.map +1 -0
  73. package/dist/{h3 → internal/h3}/profile.js +39 -39
  74. package/dist/internal/h3/profile.js.map +1 -0
  75. package/dist/internal/h3/provider.d.ts +14 -0
  76. package/dist/internal/h3/provider.d.ts.map +1 -0
  77. package/dist/internal/h3/provider.js +672 -0
  78. package/dist/internal/h3/provider.js.map +1 -0
  79. package/dist/internal/h3/references.d.ts +68 -0
  80. package/dist/internal/h3/references.d.ts.map +1 -0
  81. package/dist/internal/h3/references.js +339 -0
  82. package/dist/internal/h3/references.js.map +1 -0
  83. package/dist/internal/h3/request.d.ts +56 -0
  84. package/dist/internal/h3/request.d.ts.map +1 -0
  85. package/dist/internal/h3/request.js +70 -0
  86. package/dist/internal/h3/request.js.map +1 -0
  87. package/dist/internal/h3/state.d.ts +120 -0
  88. package/dist/internal/h3/state.d.ts.map +1 -0
  89. package/dist/internal/h3/state.js +270 -0
  90. package/dist/internal/h3/state.js.map +1 -0
  91. package/dist/{Submission.d.ts → internal/h3/submission.d.ts} +1 -3
  92. package/dist/internal/h3/submission.d.ts.map +1 -0
  93. package/dist/{Submission.js → internal/h3/submission.js} +1 -9
  94. package/dist/internal/h3/submission.js.map +1 -0
  95. package/dist/internal/hub.d.ts +32 -0
  96. package/dist/internal/hub.d.ts.map +1 -0
  97. package/dist/internal/hub.js +92 -0
  98. package/dist/internal/hub.js.map +1 -0
  99. package/dist/internal/playout/errors.d.ts +51 -0
  100. package/dist/internal/playout/errors.d.ts.map +1 -0
  101. package/dist/internal/playout/errors.js +40 -0
  102. package/dist/internal/playout/errors.js.map +1 -0
  103. package/dist/internal/playout/policy.d.ts +559 -0
  104. package/dist/internal/playout/policy.d.ts.map +1 -0
  105. package/dist/internal/playout/policy.js +2338 -0
  106. package/dist/internal/playout/policy.js.map +1 -0
  107. package/dist/internal/playout/runtime.d.ts +28 -0
  108. package/dist/internal/playout/runtime.d.ts.map +1 -0
  109. package/dist/internal/playout/runtime.js +766 -0
  110. package/dist/internal/playout/runtime.js.map +1 -0
  111. package/dist/internal/playout/tag.d.ts +14 -0
  112. package/dist/internal/playout/tag.d.ts.map +1 -0
  113. package/dist/internal/playout/tag.js +43 -0
  114. package/dist/internal/playout/tag.js.map +1 -0
  115. package/dist/internal/proto/reactor_wire/v1/common_pb.d.ts +55 -0
  116. package/dist/internal/proto/reactor_wire/v1/common_pb.d.ts.map +1 -0
  117. package/dist/internal/proto/reactor_wire/v1/common_pb.js +42 -0
  118. package/dist/internal/proto/reactor_wire/v1/common_pb.js.map +1 -0
  119. package/dist/internal/proto/reactor_wire/v1/control_pb.d.ts +160 -0
  120. package/dist/internal/proto/reactor_wire/v1/control_pb.d.ts.map +1 -0
  121. package/dist/internal/proto/reactor_wire/v1/control_pb.js +21 -0
  122. package/dist/internal/proto/reactor_wire/v1/control_pb.js.map +1 -0
  123. package/dist/internal/proto/reactor_wire/v1/data_pb.d.ts +89 -0
  124. package/dist/internal/proto/reactor_wire/v1/data_pb.d.ts.map +1 -0
  125. package/dist/internal/proto/reactor_wire/v1/data_pb.js +20 -0
  126. package/dist/internal/proto/reactor_wire/v1/data_pb.js.map +1 -0
  127. package/dist/internal/proto/reactor_wire/v1/model_pb.d.ts +85 -0
  128. package/dist/internal/proto/reactor_wire/v1/model_pb.d.ts.map +1 -0
  129. package/dist/internal/proto/reactor_wire/v1/model_pb.js +24 -0
  130. package/dist/internal/proto/reactor_wire/v1/model_pb.js.map +1 -0
  131. package/dist/internal/proto/reactor_wire/v1/platform_pb.d.ts +190 -0
  132. package/dist/internal/proto/reactor_wire/v1/platform_pb.d.ts.map +1 -0
  133. package/dist/internal/proto/reactor_wire/v1/platform_pb.js +54 -0
  134. package/dist/internal/proto/reactor_wire/v1/platform_pb.js.map +1 -0
  135. package/dist/internal/proto/reactor_wire/v1/track_pb.d.ts +88 -0
  136. package/dist/internal/proto/reactor_wire/v1/track_pb.d.ts.map +1 -0
  137. package/dist/internal/proto/reactor_wire/v1/track_pb.js +33 -0
  138. package/dist/internal/proto/reactor_wire/v1/track_pb.js.map +1 -0
  139. package/dist/internal/queue.d.ts +4 -0
  140. package/dist/internal/queue.d.ts.map +1 -0
  141. package/dist/{_internal → internal}/queue.js +0 -9
  142. package/dist/internal/queue.js.map +1 -0
  143. package/dist/internal/reactorTest/coordinator.d.ts +5 -0
  144. package/dist/internal/reactorTest/coordinator.d.ts.map +1 -0
  145. package/dist/internal/reactorTest/coordinator.js +178 -0
  146. package/dist/internal/reactorTest/coordinator.js.map +1 -0
  147. package/dist/internal/reactorTest/faults.d.ts +172 -0
  148. package/dist/internal/reactorTest/faults.d.ts.map +1 -0
  149. package/dist/internal/reactorTest/faults.js +23 -0
  150. package/dist/internal/reactorTest/faults.js.map +1 -0
  151. package/dist/internal/reactorTest/h3.d.ts +431 -0
  152. package/dist/internal/reactorTest/h3.d.ts.map +1 -0
  153. package/dist/internal/reactorTest/h3.js +625 -0
  154. package/dist/internal/reactorTest/h3.js.map +1 -0
  155. package/dist/internal/reactorTest/media.d.ts +22 -0
  156. package/dist/internal/reactorTest/media.d.ts.map +1 -0
  157. package/dist/internal/reactorTest/media.js +34 -0
  158. package/dist/internal/reactorTest/media.js.map +1 -0
  159. package/dist/internal/reactorTest/peer.d.ts +318 -0
  160. package/dist/internal/reactorTest/peer.d.ts.map +1 -0
  161. package/dist/internal/reactorTest/peer.js +206 -0
  162. package/dist/internal/reactorTest/peer.js.map +1 -0
  163. package/dist/internal/reactorTest/playout.d.ts +34 -0
  164. package/dist/internal/reactorTest/playout.d.ts.map +1 -0
  165. package/dist/internal/reactorTest/playout.js +340 -0
  166. package/dist/internal/reactorTest/playout.js.map +1 -0
  167. package/dist/internal/reactorTest/references.d.ts +25 -0
  168. package/dist/internal/reactorTest/references.d.ts.map +1 -0
  169. package/dist/{testing/Png.js → internal/reactorTest/references.js} +50 -12
  170. package/dist/internal/reactorTest/references.js.map +1 -0
  171. package/dist/internal/reactorTest/sessions.d.ts +364 -0
  172. package/dist/internal/reactorTest/sessions.d.ts.map +1 -0
  173. package/dist/internal/reactorTest/sessions.js +592 -0
  174. package/dist/internal/reactorTest/sessions.js.map +1 -0
  175. package/dist/internal/reactorTest/timing.d.ts +13 -0
  176. package/dist/internal/reactorTest/timing.d.ts.map +1 -0
  177. package/dist/internal/reactorTest/timing.js +20 -0
  178. package/dist/internal/reactorTest/timing.js.map +1 -0
  179. package/dist/internal/recording.d.ts +52 -0
  180. package/dist/internal/recording.d.ts.map +1 -0
  181. package/dist/internal/recording.js +141 -0
  182. package/dist/internal/recording.js.map +1 -0
  183. package/dist/internal/session/connect.d.ts +34 -0
  184. package/dist/internal/session/connect.d.ts.map +1 -0
  185. package/dist/internal/session/connect.js +502 -0
  186. package/dist/internal/session/connect.js.map +1 -0
  187. package/dist/internal/session/generation.d.ts +35 -0
  188. package/dist/internal/session/generation.d.ts.map +1 -0
  189. package/dist/internal/session/generation.js +185 -0
  190. package/dist/internal/session/generation.js.map +1 -0
  191. package/dist/internal/session/ice.d.ts +23 -0
  192. package/dist/internal/session/ice.d.ts.map +1 -0
  193. package/dist/internal/session/ice.js +57 -0
  194. package/dist/internal/session/ice.js.map +1 -0
  195. package/dist/internal/session/inbound.d.ts +50 -0
  196. package/dist/internal/session/inbound.d.ts.map +1 -0
  197. package/dist/internal/session/inbound.js +202 -0
  198. package/dist/internal/session/inbound.js.map +1 -0
  199. package/dist/internal/session/model.d.ts +163 -0
  200. package/dist/internal/session/model.d.ts.map +1 -0
  201. package/dist/internal/session/model.js +78 -0
  202. package/dist/internal/session/model.js.map +1 -0
  203. package/dist/internal/session/requests.d.ts +71 -0
  204. package/dist/internal/session/requests.d.ts.map +1 -0
  205. package/dist/internal/session/requests.js +240 -0
  206. package/dist/internal/session/requests.js.map +1 -0
  207. package/dist/internal/session/tracks.d.ts +21 -0
  208. package/dist/internal/session/tracks.d.ts.map +1 -0
  209. package/dist/internal/session/tracks.js +166 -0
  210. package/dist/internal/session/tracks.js.map +1 -0
  211. package/dist/internal/session/upload.d.ts +21 -0
  212. package/dist/internal/session/upload.d.ts.map +1 -0
  213. package/dist/internal/session/upload.js +68 -0
  214. package/dist/internal/session/upload.js.map +1 -0
  215. package/dist/internal/session.d.ts +66 -0
  216. package/dist/internal/session.d.ts.map +1 -0
  217. package/dist/internal/session.js +280 -0
  218. package/dist/internal/session.js.map +1 -0
  219. package/dist/{stats.d.ts → internal/stats.d.ts} +30 -16
  220. package/dist/internal/stats.d.ts.map +1 -0
  221. package/dist/internal/stats.js +201 -0
  222. package/dist/internal/stats.js.map +1 -0
  223. package/dist/internal/token.d.ts +22 -0
  224. package/dist/internal/token.d.ts.map +1 -0
  225. package/dist/internal/token.js +65 -0
  226. package/dist/internal/token.js.map +1 -0
  227. package/dist/internal/wire.d.ts +37 -0
  228. package/dist/internal/wire.d.ts.map +1 -0
  229. package/dist/internal/wire.js +49 -0
  230. package/dist/internal/wire.js.map +1 -0
  231. package/notices/bufbuild-protobuf-LICENSE +201 -0
  232. package/package.json +17 -38
  233. package/dist/FetchHttp.d.ts +0 -9
  234. package/dist/FetchHttp.d.ts.map +0 -1
  235. package/dist/FetchHttp.js +0 -63
  236. package/dist/FetchHttp.js.map +0 -1
  237. package/dist/PeerFactory.d.ts +0 -26
  238. package/dist/PeerFactory.d.ts.map +0 -1
  239. package/dist/PeerFactory.js +0 -4
  240. package/dist/PeerFactory.js.map +0 -1
  241. package/dist/PeerTypes.d.ts +0 -64
  242. package/dist/PeerTypes.d.ts.map +0 -1
  243. package/dist/PeerTypes.js +0 -2
  244. package/dist/PeerTypes.js.map +0 -1
  245. package/dist/Sequence.d.ts +0 -85
  246. package/dist/Sequence.d.ts.map +0 -1
  247. package/dist/Sequence.js +0 -210
  248. package/dist/Sequence.js.map +0 -1
  249. package/dist/SessionTypes.d.ts +0 -312
  250. package/dist/SessionTypes.d.ts.map +0 -1
  251. package/dist/SessionTypes.js +0 -19
  252. package/dist/SessionTypes.js.map +0 -1
  253. package/dist/Submission.d.ts.map +0 -1
  254. package/dist/Submission.js.map +0 -1
  255. package/dist/_internal/queue.d.ts +0 -6
  256. package/dist/_internal/queue.d.ts.map +0 -1
  257. package/dist/_internal/queue.js.map +0 -1
  258. package/dist/bytes.d.ts +0 -6
  259. package/dist/bytes.d.ts.map +0 -1
  260. package/dist/bytes.js +0 -32
  261. package/dist/bytes.js.map +0 -1
  262. package/dist/contract.d.ts +0 -149
  263. package/dist/contract.d.ts.map +0 -1
  264. package/dist/contract.js +0 -119
  265. package/dist/contract.js.map +0 -1
  266. package/dist/coordinator/_internal/client.d.ts +0 -215
  267. package/dist/coordinator/_internal/client.d.ts.map +0 -1
  268. package/dist/coordinator/_internal/client.js +0 -563
  269. package/dist/coordinator/_internal/client.js.map +0 -1
  270. package/dist/coordinator/_internal/recording.d.ts +0 -31
  271. package/dist/coordinator/_internal/recording.d.ts.map +0 -1
  272. package/dist/coordinator/_internal/recording.js +0 -123
  273. package/dist/coordinator/_internal/recording.js.map +0 -1
  274. package/dist/coordinator/_internal/response.d.ts +0 -15
  275. package/dist/coordinator/_internal/response.d.ts.map +0 -1
  276. package/dist/coordinator/_internal/response.js +0 -55
  277. package/dist/coordinator/_internal/response.js.map +0 -1
  278. package/dist/coordinator/_internal/schemas.d.ts +0 -73
  279. package/dist/coordinator/_internal/schemas.d.ts.map +0 -1
  280. package/dist/coordinator/_internal/schemas.js +0 -200
  281. package/dist/coordinator/_internal/schemas.js.map +0 -1
  282. package/dist/coordinator/index.d.ts +0 -40
  283. package/dist/coordinator/index.d.ts.map +0 -1
  284. package/dist/coordinator/index.js +0 -21
  285. package/dist/coordinator/index.js.map +0 -1
  286. package/dist/correlation.d.ts +0 -47
  287. package/dist/correlation.d.ts.map +0 -1
  288. package/dist/correlation.js +0 -131
  289. package/dist/correlation.js.map +0 -1
  290. package/dist/duration.d.ts +0 -27
  291. package/dist/duration.d.ts.map +0 -1
  292. package/dist/duration.js +0 -47
  293. package/dist/duration.js.map +0 -1
  294. package/dist/errors.d.ts +0 -1303
  295. package/dist/errors.d.ts.map +0 -1
  296. package/dist/errors.js +0 -745
  297. package/dist/errors.js.map +0 -1
  298. package/dist/h3/_internal/client.d.ts +0 -9
  299. package/dist/h3/_internal/client.d.ts.map +0 -1
  300. package/dist/h3/_internal/client.js +0 -652
  301. package/dist/h3/_internal/client.js.map +0 -1
  302. package/dist/h3/_internal/contracts.d.ts.map +0 -1
  303. package/dist/h3/_internal/contracts.js +0 -123
  304. package/dist/h3/_internal/contracts.js.map +0 -1
  305. package/dist/h3/_internal/deployment.d.ts +0 -8
  306. package/dist/h3/_internal/deployment.d.ts.map +0 -1
  307. package/dist/h3/_internal/deployment.js +0 -149
  308. package/dist/h3/_internal/deployment.js.map +0 -1
  309. package/dist/h3/_internal/evidence.d.ts +0 -17
  310. package/dist/h3/_internal/evidence.d.ts.map +0 -1
  311. package/dist/h3/_internal/evidence.js +0 -48
  312. package/dist/h3/_internal/evidence.js.map +0 -1
  313. package/dist/h3/_internal/operations.d.ts +0 -58
  314. package/dist/h3/_internal/operations.d.ts.map +0 -1
  315. package/dist/h3/_internal/operations.js +0 -268
  316. package/dist/h3/_internal/operations.js.map +0 -1
  317. package/dist/h3/_internal/references.d.ts +0 -24
  318. package/dist/h3/_internal/references.d.ts.map +0 -1
  319. package/dist/h3/_internal/references.js +0 -309
  320. package/dist/h3/_internal/references.js.map +0 -1
  321. package/dist/h3/_internal/request.d.ts +0 -21
  322. package/dist/h3/_internal/request.d.ts.map +0 -1
  323. package/dist/h3/_internal/request.js +0 -97
  324. package/dist/h3/_internal/request.js.map +0 -1
  325. package/dist/h3/_internal/retained.d.ts +0 -22
  326. package/dist/h3/_internal/retained.d.ts.map +0 -1
  327. package/dist/h3/_internal/retained.js +0 -89
  328. package/dist/h3/_internal/retained.js.map +0 -1
  329. package/dist/h3/_internal/state.d.ts +0 -44
  330. package/dist/h3/_internal/state.d.ts.map +0 -1
  331. package/dist/h3/_internal/state.js +0 -283
  332. package/dist/h3/_internal/state.js.map +0 -1
  333. package/dist/h3/index.d.ts +0 -10
  334. package/dist/h3/index.d.ts.map +0 -1
  335. package/dist/h3/index.js +0 -7
  336. package/dist/h3/index.js.map +0 -1
  337. package/dist/h3/messages.d.ts.map +0 -1
  338. package/dist/h3/messages.js.map +0 -1
  339. package/dist/h3/profile.d.ts.map +0 -1
  340. package/dist/h3/profile.js.map +0 -1
  341. package/dist/h3/types.d.ts +0 -291
  342. package/dist/h3/types.d.ts.map +0 -1
  343. package/dist/h3/types.js +0 -2
  344. package/dist/h3/types.js.map +0 -1
  345. package/dist/host.d.ts +0 -26
  346. package/dist/host.d.ts.map +0 -1
  347. package/dist/host.js +0 -20
  348. package/dist/host.js.map +0 -1
  349. package/dist/json.d.ts +0 -25
  350. package/dist/json.d.ts.map +0 -1
  351. package/dist/json.js +0 -143
  352. package/dist/json.js.map +0 -1
  353. package/dist/media-stream.d.ts +0 -10
  354. package/dist/media-stream.d.ts.map +0 -1
  355. package/dist/media-stream.js +0 -18
  356. package/dist/media-stream.js.map +0 -1
  357. package/dist/observation.d.ts +0 -38
  358. package/dist/observation.d.ts.map +0 -1
  359. package/dist/observation.js +0 -113
  360. package/dist/observation.js.map +0 -1
  361. package/dist/orchestration/elapsed.d.ts +0 -9
  362. package/dist/orchestration/elapsed.d.ts.map +0 -1
  363. package/dist/orchestration/elapsed.js +0 -8
  364. package/dist/orchestration/elapsed.js.map +0 -1
  365. package/dist/orchestration/h3-source.d.ts +0 -58
  366. package/dist/orchestration/h3-source.d.ts.map +0 -1
  367. package/dist/orchestration/h3-source.js +0 -362
  368. package/dist/orchestration/h3-source.js.map +0 -1
  369. package/dist/orchestration/index.d.ts +0 -17
  370. package/dist/orchestration/index.d.ts.map +0 -1
  371. package/dist/orchestration/index.js +0 -12
  372. package/dist/orchestration/index.js.map +0 -1
  373. package/dist/orchestration/media-buffer.d.ts +0 -32
  374. package/dist/orchestration/media-buffer.d.ts.map +0 -1
  375. package/dist/orchestration/media-buffer.js +0 -94
  376. package/dist/orchestration/media-buffer.js.map +0 -1
  377. package/dist/orchestration/open-h3.d.ts +0 -101
  378. package/dist/orchestration/open-h3.d.ts.map +0 -1
  379. package/dist/orchestration/open-h3.js +0 -127
  380. package/dist/orchestration/open-h3.js.map +0 -1
  381. package/dist/orchestration/queries.d.ts +0 -10
  382. package/dist/orchestration/queries.d.ts.map +0 -1
  383. package/dist/orchestration/queries.js +0 -43
  384. package/dist/orchestration/queries.js.map +0 -1
  385. package/dist/orchestration/references.d.ts +0 -18
  386. package/dist/orchestration/references.d.ts.map +0 -1
  387. package/dist/orchestration/references.js +0 -79
  388. package/dist/orchestration/references.js.map +0 -1
  389. package/dist/orchestration/renewal-state.d.ts +0 -84
  390. package/dist/orchestration/renewal-state.d.ts.map +0 -1
  391. package/dist/orchestration/renewal-state.js +0 -95
  392. package/dist/orchestration/renewal-state.js.map +0 -1
  393. package/dist/orchestration/renewal.d.ts +0 -103
  394. package/dist/orchestration/renewal.d.ts.map +0 -1
  395. package/dist/orchestration/renewal.js +0 -1088
  396. package/dist/orchestration/renewal.js.map +0 -1
  397. package/dist/orchestration/request.d.ts +0 -65
  398. package/dist/orchestration/request.d.ts.map +0 -1
  399. package/dist/orchestration/request.js +0 -134
  400. package/dist/orchestration/request.js.map +0 -1
  401. package/dist/orchestration/retention.d.ts +0 -100
  402. package/dist/orchestration/retention.d.ts.map +0 -1
  403. package/dist/orchestration/retention.js +0 -134
  404. package/dist/orchestration/retention.js.map +0 -1
  405. package/dist/orchestration/routing.d.ts +0 -21
  406. package/dist/orchestration/routing.d.ts.map +0 -1
  407. package/dist/orchestration/routing.js +0 -93
  408. package/dist/orchestration/routing.js.map +0 -1
  409. package/dist/orchestration/scheduler-key.d.ts +0 -14
  410. package/dist/orchestration/scheduler-key.d.ts.map +0 -1
  411. package/dist/orchestration/scheduler-key.js +0 -62
  412. package/dist/orchestration/scheduler-key.js.map +0 -1
  413. package/dist/orchestration/scheduler-policy.d.ts +0 -222
  414. package/dist/orchestration/scheduler-policy.d.ts.map +0 -1
  415. package/dist/orchestration/scheduler-policy.js +0 -582
  416. package/dist/orchestration/scheduler-policy.js.map +0 -1
  417. package/dist/orchestration/scheduler.d.ts +0 -383
  418. package/dist/orchestration/scheduler.d.ts.map +0 -1
  419. package/dist/orchestration/scheduler.js +0 -2597
  420. package/dist/orchestration/scheduler.js.map +0 -1
  421. package/dist/orchestration/source-slot.d.ts +0 -124
  422. package/dist/orchestration/source-slot.d.ts.map +0 -1
  423. package/dist/orchestration/source-slot.js +0 -348
  424. package/dist/orchestration/source-slot.js.map +0 -1
  425. package/dist/orchestration/types.d.ts +0 -1462
  426. package/dist/orchestration/types.d.ts.map +0 -1
  427. package/dist/orchestration/types.js +0 -135
  428. package/dist/orchestration/types.js.map +0 -1
  429. package/dist/protobuf.d.ts +0 -63
  430. package/dist/protobuf.d.ts.map +0 -1
  431. package/dist/protobuf.js +0 -252
  432. package/dist/protobuf.js.map +0 -1
  433. package/dist/session/_internal/acquire.d.ts +0 -21
  434. package/dist/session/_internal/acquire.d.ts.map +0 -1
  435. package/dist/session/_internal/acquire.js +0 -168
  436. package/dist/session/_internal/acquire.js.map +0 -1
  437. package/dist/session/_internal/cleanup.d.ts +0 -19
  438. package/dist/session/_internal/cleanup.d.ts.map +0 -1
  439. package/dist/session/_internal/cleanup.js +0 -102
  440. package/dist/session/_internal/cleanup.js.map +0 -1
  441. package/dist/session/_internal/lifecycle.d.ts +0 -67
  442. package/dist/session/_internal/lifecycle.d.ts.map +0 -1
  443. package/dist/session/_internal/lifecycle.js +0 -142
  444. package/dist/session/_internal/lifecycle.js.map +0 -1
  445. package/dist/session/_internal/remote.d.ts +0 -28
  446. package/dist/session/_internal/remote.d.ts.map +0 -1
  447. package/dist/session/_internal/remote.js +0 -71
  448. package/dist/session/_internal/remote.js.map +0 -1
  449. package/dist/session/_internal/uploads.d.ts +0 -7
  450. package/dist/session/_internal/uploads.d.ts.map +0 -1
  451. package/dist/session/_internal/uploads.js +0 -31
  452. package/dist/session/_internal/uploads.js.map +0 -1
  453. package/dist/session/commands.d.ts +0 -2
  454. package/dist/session/commands.d.ts.map +0 -1
  455. package/dist/session/commands.js +0 -2
  456. package/dist/session/commands.js.map +0 -1
  457. package/dist/session/files.d.ts +0 -21
  458. package/dist/session/files.d.ts.map +0 -1
  459. package/dist/session/files.js +0 -49
  460. package/dist/session/files.js.map +0 -1
  461. package/dist/session/index.d.ts +0 -84
  462. package/dist/session/index.d.ts.map +0 -1
  463. package/dist/session/index.js +0 -16
  464. package/dist/session/index.js.map +0 -1
  465. package/dist/session/media.d.ts +0 -114
  466. package/dist/session/media.d.ts.map +0 -1
  467. package/dist/session/media.js +0 -2
  468. package/dist/session/media.js.map +0 -1
  469. package/dist/session/recorder.d.ts +0 -24
  470. package/dist/session/recorder.d.ts.map +0 -1
  471. package/dist/session/recorder.js +0 -19
  472. package/dist/session/recorder.js.map +0 -1
  473. package/dist/session.d.ts +0 -105
  474. package/dist/session.d.ts.map +0 -1
  475. package/dist/session.js +0 -976
  476. package/dist/session.js.map +0 -1
  477. package/dist/simulation/_internal/source.d.ts +0 -12
  478. package/dist/simulation/_internal/source.d.ts.map +0 -1
  479. package/dist/simulation/_internal/source.js +0 -513
  480. package/dist/simulation/_internal/source.js.map +0 -1
  481. package/dist/simulation/index.d.ts +0 -13
  482. package/dist/simulation/index.d.ts.map +0 -1
  483. package/dist/simulation/index.js +0 -12
  484. package/dist/simulation/index.js.map +0 -1
  485. package/dist/simulation/types.d.ts +0 -39
  486. package/dist/simulation/types.d.ts.map +0 -1
  487. package/dist/simulation/types.js +0 -2
  488. package/dist/simulation/types.js.map +0 -1
  489. package/dist/stats.d.ts.map +0 -1
  490. package/dist/stats.js +0 -205
  491. package/dist/stats.js.map +0 -1
  492. package/dist/testing/Faults.d.ts +0 -4
  493. package/dist/testing/Faults.d.ts.map +0 -1
  494. package/dist/testing/Faults.js +0 -7
  495. package/dist/testing/Faults.js.map +0 -1
  496. package/dist/testing/Png.d.ts +0 -3
  497. package/dist/testing/Png.d.ts.map +0 -1
  498. package/dist/testing/Png.js.map +0 -1
  499. package/dist/testing/Wav.d.ts +0 -14
  500. package/dist/testing/Wav.d.ts.map +0 -1
  501. package/dist/testing/Wav.js +0 -37
  502. package/dist/testing/Wav.js.map +0 -1
  503. package/dist/testing/index.d.ts +0 -5
  504. package/dist/testing/index.d.ts.map +0 -1
  505. package/dist/testing/index.js +0 -4
  506. package/dist/testing/index.js.map +0 -1
  507. package/dist/wire.d.ts +0 -7
  508. package/dist/wire.d.ts.map +0 -1
  509. package/dist/wire.generated.d.ts +0 -305
  510. package/dist/wire.generated.d.ts.map +0 -1
  511. package/dist/wire.generated.js +0 -1257
  512. package/dist/wire.generated.js.map +0 -1
  513. package/dist/wire.js +0 -5
  514. package/dist/wire.js.map +0 -1
@@ -0,0 +1,166 @@
1
+ /**
2
+ * A session's tracks: pausing and resuming received ones, publishing to
3
+ * sent ones, the sender bitrate, and the media a host exposes. One operation
4
+ * runs per track at a time, on the generation it started on.
5
+ */
6
+ import * as Cause from "effect/Cause";
7
+ import * as Deferred from "effect/Deferred";
8
+ import * as Duration from "effect/Duration";
9
+ import * as Effect from "effect/Effect";
10
+ import * as Exit from "effect/Exit";
11
+ import * as Ref from "effect/Ref";
12
+ import * as SubscriptionRef from "effect/SubscriptionRef";
13
+ import { ReactorError } from "../../ReactorError.js";
14
+ import * as Wire from "../wire.js";
15
+ import { excluding, failureOr, including, timedOut } from "./model.js";
16
+ import { unexpected } from "./requests.js";
17
+ const unsupported = (message) => ReactorError.fromCode("UnsupportedCapability", message, { outcome: "not-submitted" });
18
+ export const make = ({ core, generation, requests, }) => {
19
+ const { settings, state } = core;
20
+ const { current, currentReady, guard, fail, fenced } = generation;
21
+ const { notification, controlRequest } = requests;
22
+ /** `body` on a negotiated track of `expected`, or of the ready generation; one per track. */
23
+ const trackOperation = (name, body, expected) => Effect.acquireUseRelease(Effect.gen(function* () {
24
+ const c = expected ?? (yield* currentReady).c;
25
+ yield* current(c);
26
+ const link = yield* Ref.get(c.link);
27
+ const track = link.negotiated?.descriptor.capabilities.tracks.find((t) => t.name === name);
28
+ if (track === undefined)
29
+ return yield* ReactorError.fromCode("InvalidState", `unknown track: ${name}`);
30
+ const free = yield* Ref.modify(c.link, (held) => held.busy.has(name)
31
+ ? [false, held]
32
+ : [true, { ...held, busy: including(name)(held.busy) }]);
33
+ if (!free)
34
+ return yield* ReactorError.fromCode("InvalidState", `another track operation is in flight: ${name}`);
35
+ return { c, track };
36
+ }), ({ c, track }) => guard(c, body(c, track)), ({ c }) => Ref.update(c.link, (link) => ({ ...link, busy: excluding(name)(link.busy) })));
37
+ const setTrackActive = (name, active, expected) => trackOperation(name, (c) => c.peer.direction(name, active).pipe(Effect.andThen(Ref.update(c.link, (link) => ({
38
+ ...link,
39
+ paused: (active ? excluding(name) : including(name))(link.paused),
40
+ }))), Effect.andThen(notification(c, active
41
+ ? { case: "resumeTrack", value: { name } }
42
+ : { case: "pauseTrack", value: { name } }))), expected);
43
+ /**
44
+ * A platform track replacement cannot be cancelled. Recording its owner is
45
+ * masked, and an abandoned wait retires the generation so a late
46
+ * replacement cannot race another sender operation.
47
+ */
48
+ const replaceSender = (c, name, source) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
49
+ const media = c.peer.media;
50
+ if (media._tag !== "Tracks")
51
+ return yield* unsupported("this peer publishes no tracks");
52
+ yield* current(c);
53
+ const clone = source === null ? null : source.clone();
54
+ const invoked = yield* Ref.make(false);
55
+ const expired = yield* Ref.make(false);
56
+ yield* restore(current(c).pipe(Effect.andThen(Ref.set(invoked, true)), Effect.andThen(media.replace(name, clone)), Effect.timeoutOrElse({
57
+ duration: settings.replyTimeout,
58
+ orElse: () => Ref.set(expired, true).pipe(Effect.andThen(Effect.fail(ReactorError.fromCode("Timeout", "sender replacement deadline; generation retired", { operation: name, outcome: "unknown" })))),
59
+ }))).pipe(Effect.onExit((exit) => Exit.isSuccess(exit)
60
+ ? Effect.void
61
+ : Effect.gen(function* () {
62
+ clone?.stop();
63
+ const deadlined = yield* Ref.get(expired);
64
+ if ((yield* Ref.get(invoked)) && (deadlined || Cause.hasInterrupts(exit.cause)))
65
+ yield* fail(c, ReactorError.fromCode(deadlined ? "Timeout" : "Disconnected", "sender replacement abandoned; reconnect before reusing the publication", { operation: name, outcome: "unknown" }));
66
+ })));
67
+ const live = yield* Effect.exit(current(c));
68
+ if (Exit.isFailure(live)) {
69
+ clone?.stop();
70
+ return yield* live;
71
+ }
72
+ const previous = yield* Ref.modify(c.link, (link) => {
73
+ const sending = new Map(link.sending);
74
+ const before = sending.get(name);
75
+ if (clone === null)
76
+ sending.delete(name);
77
+ else
78
+ sending.set(name, clone);
79
+ return [before, { ...link, sending }];
80
+ });
81
+ previous?.stop();
82
+ }));
83
+ const publishTrack = (name, source, expected) => trackOperation(name, Effect.fnUntraced(function* (c, track) {
84
+ if (track.direction !== "sendonly" ||
85
+ source.kind !== track.kind ||
86
+ source.readyState !== "live")
87
+ return yield* ReactorError.fromCode("InvalidState", "publish requires a live matching input track");
88
+ if (!(yield* Ref.get(c.link)).claimed.has(name)) {
89
+ const reply = yield* controlRequest("publish_track", { case: "publishTrack", value: { name } }, c);
90
+ if (reply._tag !== "TrackPublished" || reply.name !== name)
91
+ return yield* unexpected("publisher claim reply mismatch");
92
+ yield* Ref.update(c.link, (link) => ({
93
+ ...link,
94
+ claimed: including(name)(link.claimed),
95
+ }));
96
+ }
97
+ yield* replaceSender(c, name, source);
98
+ }), expected);
99
+ const unpublishTrack = (name, expected) => trackOperation(name, (c) => replaceSender(c, name, null).pipe(Effect.andThen(notification(c, { case: "unpublishTrack", value: { name } })), Effect.andThen(Ref.update(c.link, (link) => ({
100
+ ...link,
101
+ claimed: excluding(name)(link.claimed),
102
+ })))), expected);
103
+ const setMaxBitrate = (name, bitsPerSecond, expected) => trackOperation(name, (c) => c.peer.maxBitrate(name, bitsPerSecond).pipe(Effect.andThen(SubscriptionRef.update(state, (session) => ({
104
+ ...session,
105
+ bitrates: new Map(session.bitrates).set(name, bitsPerSecond),
106
+ })))), expected);
107
+ /** Closing's last notifications: an unpublish for every track `c` claimed. */
108
+ const releasePublications = Effect.fnUntraced(function* (c) {
109
+ const submitted = [];
110
+ const errors = [];
111
+ if (c === undefined)
112
+ return { submitted, errors };
113
+ const link = yield* Ref.get(c.link);
114
+ if (link.failure !== undefined)
115
+ return { submitted, errors };
116
+ for (const name of link.claimed) {
117
+ // Closing has fenced ordinary requests; these are the last notifications.
118
+ const sent = yield* Effect.exit(Wire.encode(Wire.ControlClientMessageSchema)({
119
+ kind: Wire.MessageKind.NOTIFICATION,
120
+ payload: { case: "unpublishTrack", value: { name } },
121
+ }).pipe(Effect.flatMap((bytes) => c.peer.send("control", bytes)), Effect.timeoutOrElse({
122
+ duration: Duration.min(Duration.seconds(1), settings.replyTimeout),
123
+ orElse: timedOut("close unpublish"),
124
+ })));
125
+ if (Exit.isSuccess(sent))
126
+ submitted.push(name);
127
+ else
128
+ errors.push(failureOr(() => ReactorError.fromCode("Shutdown", "publication cleanup failed", {
129
+ detail: sent.cause,
130
+ }))(sent.cause));
131
+ }
132
+ return { submitted, errors };
133
+ });
134
+ const decoded = Effect.gen(function* () {
135
+ const { c, negotiated } = yield* currentReady;
136
+ const media = c.peer.media;
137
+ if (media._tag !== "Decoded")
138
+ return yield* unsupported("this peer has no decoded media");
139
+ return {
140
+ generation: c.generation,
141
+ tracks: negotiated.descriptor.capabilities.tracks,
142
+ retired: Deferred.await(c.failed),
143
+ video: (name) => fenced(c, media.video(name)),
144
+ audio: (name) => fenced(c, media.audio(name)),
145
+ pressure: media.pressure,
146
+ };
147
+ });
148
+ const tracks = Effect.gen(function* () {
149
+ const { c, negotiated } = yield* currentReady;
150
+ const media = c.peer.media;
151
+ if (media._tag !== "Tracks")
152
+ return yield* unsupported("this peer has no platform tracks");
153
+ return {
154
+ generation: c.generation,
155
+ tracks: negotiated.descriptor.capabilities.tracks,
156
+ retired: Deferred.await(c.failed),
157
+ track: (name) => current(c).pipe(Effect.andThen(media.lease(name))),
158
+ publish: (name, source) => publishTrack(name, source, c),
159
+ unpublish: (name) => unpublishTrack(name, c),
160
+ setTrackActive: (name, active) => setTrackActive(name, active, c),
161
+ setMaxBitrate: (name, bits) => setMaxBitrate(name, bits, c),
162
+ };
163
+ });
164
+ return { setTrackActive, releasePublications, decoded, tracks };
165
+ };
166
+ //# sourceMappingURL=tracks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tracks.js","sourceRoot":"","sources":["../../../src/internal/session/tracks.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;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CAAC,CAAC;QAC3F,OAAO;YACL,UAAU,EAAE,CAAC,CAAC,UAAU;YACxB,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM;YACjD,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YACjC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YACnE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YACxD,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,CAAC;YAC5C,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YACjE,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;SAC5D,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAClE,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * An upload: a slot from the coordinator, the bytes to its presigned URL,
3
+ * then the notification that names the file to the model. How far it got is
4
+ * the evidence a failure carries and the event observers see.
5
+ */
6
+ import * as Effect from "effect/Effect";
7
+ import { ReactorError } from "../../ReactorError.js";
8
+ import type { UploadOptions, UploadReference } from "../../Session.js";
9
+ import type { Generation } from "./generation.js";
10
+ import type { Core } from "./model.js";
11
+ import type { Requests } from "./requests.js";
12
+ export declare const make: ({ core, generation, requests, }: {
13
+ readonly core: Core;
14
+ readonly generation: Generation;
15
+ readonly requests: Requests;
16
+ }) => (name: string, mimeType: string, bytes: Uint8Array<ArrayBufferLike>, options?: UploadOptions | undefined) => Effect.Effect<{
17
+ file: UploadReference;
18
+ transfer: "confirmed";
19
+ notification: "submitted";
20
+ }, ReactorError, never>;
21
+ //# sourceMappingURL=upload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.d.ts","sourceRoot":"","sources":["../../../src/internal/session/upload.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAA4B,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEjG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,IAAI,oCAId;IACD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;;;;uBA8FA,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * An upload: a slot from the coordinator, the bytes to its presigned URL,
3
+ * then the notification that names the file to the model. How far it got is
4
+ * the evidence a failure carries and the event observers see.
5
+ */
6
+ import * as Effect from "effect/Effect";
7
+ import * as Ref from "effect/Ref";
8
+ import * as SubscriptionRef from "effect/SubscriptionRef";
9
+ import { ReactorError } from "../../ReactorError.js";
10
+ import * as Deadline from "../deadline.js";
11
+ import { isKnown, timedOut } from "./model.js";
12
+ export const make = ({ core, generation, requests, }) => {
13
+ const { settings, signaling, state, publish } = core;
14
+ const { currentReady, guard } = generation;
15
+ return Effect.fnUntraced(function* (name, mimeType, bytes, options = {}) {
16
+ const progress = yield* Ref.make({
17
+ allocation: "not-requested",
18
+ transfer: "not-requested",
19
+ notification: "not-submitted",
20
+ });
21
+ const reach = (patch) => Ref.update(progress, (p) => ({ ...p, ...patch }));
22
+ const operation = Effect.gen(function* () {
23
+ const { c } = yield* currentReady;
24
+ const known = (yield* SubscriptionRef.get(state)).remote;
25
+ if (!isKnown(known))
26
+ return yield* ReactorError.fromCode("InvalidState", "no known session id");
27
+ if (name.length === 0 ||
28
+ mimeType.length === 0 ||
29
+ bytes.byteLength < 1 ||
30
+ bytes.byteLength > settings.maxUploadBytes)
31
+ return yield* ReactorError.fromCode("InvalidInput", `an upload needs a name, a MIME type and 1..${String(settings.maxUploadBytes)} bytes`, { outcome: "not-submitted" });
32
+ const copy = new Uint8Array(bytes);
33
+ yield* reach({ allocation: "unknown" });
34
+ const slot = yield* guard(c, signaling.allocateUpload(known.id, name, mimeType, copy.length));
35
+ const file = {
36
+ uploadId: slot.presigned_id,
37
+ name,
38
+ mimeType,
39
+ size: BigInt(copy.length),
40
+ };
41
+ yield* reach({ allocation: "confirmed", file, transfer: "unknown" });
42
+ yield* guard(c, signaling.putUpload(slot, copy, mimeType));
43
+ yield* reach({ transfer: "confirmed", notification: "unknown" });
44
+ yield* requests
45
+ .notification(c, { case: "fileUploaded", value: file })
46
+ .pipe(Effect.tapError((error) => error.context.outcome === "not-submitted"
47
+ ? reach({ notification: "not-submitted" })
48
+ : Effect.void));
49
+ yield* reach({ notification: "submitted" });
50
+ return { file, transfer: "confirmed", notification: "submitted" };
51
+ });
52
+ const wait = yield* Deadline.decode("uploadTimeout")(options.uploadTimeout ?? settings.uploadTimeout);
53
+ return yield* operation.pipe(Effect.timeoutOrElse({ duration: wait, orElse: timedOut("upload") }), Effect.catch((error) => Ref.get(progress).pipe(Effect.flatMap((reached) => Effect.fail(ReactorError.fromCode("Upload", error.message, {
54
+ ...error.context,
55
+ operation: "upload",
56
+ detail: { cause: error, progress: reached },
57
+ }))))), Effect.ensuring(Ref.get(progress).pipe(Effect.flatMap((reached) => publish({ _tag: "Upload", progress: reached })))));
58
+ },
59
+ // The MIME type and size only: never the name or the bytes.
60
+ Effect.withSpan("Session.upload", (_name, mimeType, bytes) => ({
61
+ kind: "client",
62
+ attributes: {
63
+ "reactor.upload.mime_type": mimeType,
64
+ "reactor.upload.size": bytes.byteLength,
65
+ },
66
+ }), { captureStackTrace: false }));
67
+ };
68
+ //# sourceMappingURL=upload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../src/internal/session/upload.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAClC,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAG3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,IAAI,EACJ,UAAU,EACV,QAAQ,GAKT,EAAE,EAAE;IACH,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IACrD,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC;IAE3C,OAAO,MAAM,CAAC,UAAU,CACtB,QAAQ,CAAC,EAAE,IAAY,EAAE,QAAgB,EAAE,KAAiB,EAAE,OAAO,GAAkB,EAAE;QACvF,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAiB;YAC/C,UAAU,EAAE,eAAe;YAC3B,QAAQ,EAAE,eAAe;YACzB,YAAY,EAAE,eAAe;SAC9B,CAAC,CAAC;QACH,MAAM,KAAK,GA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,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,EACpE,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CACrB,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CACpB,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACzB,MAAM,CAAC,IAAI,CACT,YAAY,CAAC,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE;YAC7C,GAAG,KAAK,CAAC,OAAO;YAChB,SAAS,EAAE,QAAQ;YACnB,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE;SAC5C,CAAC,CACH,CACF,CACF,CACF,EACD,MAAM,CAAC,QAAQ,CACb,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,IAAI,CACpB,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC,CAC5E,CACF,CACF,CAAC;IACJ,CAAC;IACD,4DAA4D;IAC5D,MAAM,CAAC,QAAQ,CACb,gBAAgB,EAChB,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC3B,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,0BAA0B,EAAE,QAAQ;YACpC,qBAAqB,EAAE,KAAK,CAAC,UAAU;SACxC;KACF,CAAC,EACF,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAC7B,CACF,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ import * as Effect from "effect/Effect";
2
+ import type { Coordinator, Tokens } from "../Coordinator.js";
3
+ import type { PeerFactory } from "../Peer.js";
4
+ import { ReactorError } from "../ReactorError.js";
5
+ import type { CloseReport, Session } from "../Session.js";
6
+ import type { Intent, Settings } from "./session/model.js";
7
+ export type { Intent, Settings } from "./session/model.js";
8
+ export interface Handle {
9
+ /** The session's public value, once its id is known. */
10
+ readonly session: (id: string) => Session;
11
+ /** Allocates, or identifies the attached session, without connecting. */
12
+ readonly allocate: Effect.Effect<string, ReactorError>;
13
+ readonly connect: Effect.Effect<void, ReactorError>;
14
+ readonly close: Effect.Effect<CloseReport>;
15
+ }
16
+ export declare const make: (input: {
17
+ readonly intent: Intent;
18
+ readonly coordinator: Coordinator["Service"];
19
+ /** Where the session's tokens come from; none sends no credential. */
20
+ readonly tokens: (Pick<Tokens, "bind"> & Partial<Pick<Tokens, "create">>) | undefined;
21
+ /** Resume receive-only tracks as each connection becomes ready; Reactor sends no media until then. */
22
+ readonly resumeTracks: boolean;
23
+ readonly peers: PeerFactory["Service"];
24
+ readonly settings: Settings;
25
+ }) => Effect.Effect<{
26
+ session: (id: string) => Session;
27
+ allocate: Effect.Effect<string, ReactorError, never>;
28
+ connect: Effect.Effect<void, ReactorError, never>;
29
+ close: Effect.Effect<{
30
+ readonly localClosed: boolean;
31
+ readonly allocation: "known" | "none" | "unknown";
32
+ readonly ownership?: "attached" | "owned";
33
+ readonly sessionId?: string;
34
+ readonly remote: {
35
+ readonly attempted: boolean;
36
+ readonly responseReceived: boolean;
37
+ readonly confirmed: boolean;
38
+ readonly evidence: "absent" | "terminal" | null;
39
+ readonly deleteStatus: number | null;
40
+ readonly state: string | null;
41
+ readonly error?: {
42
+ readonly _tag: string;
43
+ readonly reason: string;
44
+ readonly message: string;
45
+ readonly operation?: string;
46
+ readonly requestId?: string;
47
+ readonly sessionId?: string;
48
+ readonly generation?: string;
49
+ readonly outcome?: "not-submitted" | "replied" | "unknown";
50
+ };
51
+ };
52
+ readonly unpublishSubmitted: readonly string[];
53
+ readonly unresolvedPublications: readonly string[];
54
+ readonly localErrors: readonly {
55
+ readonly _tag: string;
56
+ readonly reason: string;
57
+ readonly message: string;
58
+ readonly operation?: string;
59
+ readonly requestId?: string;
60
+ readonly sessionId?: string;
61
+ readonly generation?: string;
62
+ readonly outcome?: "not-submitted" | "replied" | "unknown";
63
+ }[];
64
+ }, never, never>;
65
+ }, never, never>;
66
+ //# sourceMappingURL=session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/internal/session.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAMxC,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAa,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,WAAW,EAMX,OAAO,EAIR,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAQ,MAAM,EAAiB,QAAQ,EAAS,MAAM,oBAAoB,CAAC;AAQvF,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB,wDAAwD;IACxD,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1C,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;CAC5C;AAmBD,eAAO,MAAM,IAAI;qBACE,MAAM;0BACD,WAAW,CAAC,SAAS,CAAC;IAC5C,sEAAsE;qBACrD,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,SAAS;IACrF,sGAAsG;2BAC/E,OAAO;oBACd,WAAW,CAAC,SAAS,CAAC;uBACnB,QAAQ;;kBAiON,MAAM,KAAG,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA+BrC,CAAC"}
@@ -0,0 +1,280 @@
1
+ /**
2
+ * The session implementation behind `Reactor.create` and `Reactor.attach`,
3
+ * composed from its parts in `internal/session/`: the live generation,
4
+ * inbound events, trickled ICE, requests, tracks, uploads and connection.
5
+ *
6
+ * State lives in a `SubscriptionRef` (the session) and a `Ref` per connection
7
+ * generation. Each generation owns a scope, a peer and one fiber that applies
8
+ * the peer's events in order; retiring a generation closes its scope, so
9
+ * nothing it started outlives it. Commands are correlated before they are
10
+ * sent, and their failures carry the dispatch evidence.
11
+ */
12
+ import * as Cause from "effect/Cause";
13
+ import * as Clock from "effect/Clock";
14
+ import * as Deferred from "effect/Deferred";
15
+ import * as Effect from "effect/Effect";
16
+ import * as Exit from "effect/Exit";
17
+ import * as Ref from "effect/Ref";
18
+ import * as Scope from "effect/Scope";
19
+ import * as Stream from "effect/Stream";
20
+ import * as SubscriptionRef from "effect/SubscriptionRef";
21
+ import { notTerminated, terminationAttributes } from "../Coordinator.js";
22
+ import { ReactorError, summarize } from "../ReactorError.js";
23
+ import * as Correlator from "./correlator.js";
24
+ import * as Hub from "./hub.js";
25
+ import * as Connect from "./session/connect.js";
26
+ import * as Generation from "./session/generation.js";
27
+ import * as Ice from "./session/ice.js";
28
+ import * as Inbound from "./session/inbound.js";
29
+ import { isClosing, isKnown, transitions } from "./session/model.js";
30
+ import * as Requests from "./session/requests.js";
31
+ import * as Tracks from "./session/tracks.js";
32
+ import * as Upload from "./session/upload.js";
33
+ import * as Stats from "./stats.js";
34
+ import * as Token from "./token.js";
35
+ /** What a close report says of the remote session. */
36
+ const allocationOf = (remote) => {
37
+ if (remote === undefined)
38
+ return "none";
39
+ return isKnown(remote) ? "known" : "unknown";
40
+ };
41
+ /** The remote session as a snapshot shows it outside a ready connection. */
42
+ const remoteOf = (remote) => isKnown(remote)
43
+ ? {
44
+ ownership: remote.ownership,
45
+ sessionId: remote.id,
46
+ ...(remote.descriptor === undefined ? {} : { descriptor: remote.descriptor }),
47
+ ...(remote.connectionId === undefined ? {} : { connectionId: remote.connectionId }),
48
+ }
49
+ : { ownership: remote.ownership };
50
+ export const make = Effect.fnUntraced(function* (input) {
51
+ const { intent, coordinator, settings } = input;
52
+ const root = yield* Scope.make();
53
+ const state = yield* SubscriptionRef.make({
54
+ status: "idle",
55
+ moderated: false,
56
+ reconnects: false,
57
+ reconnecting: false,
58
+ generation: 0n,
59
+ remote: undefined,
60
+ connection: undefined,
61
+ lastError: undefined,
62
+ close: undefined,
63
+ received: new Set(),
64
+ bitrates: new Map(),
65
+ sampler: Stats.initialSampler,
66
+ });
67
+ const sequence = yield* Ref.make(0n);
68
+ const hub = yield* Hub.make();
69
+ const data = yield* Correlator.make({
70
+ prefix: "data",
71
+ limit: settings.maxPending,
72
+ namespace: settings.namespace,
73
+ });
74
+ const control = yield* Correlator.make({
75
+ prefix: "ctrl",
76
+ limit: settings.maxPending,
77
+ namespace: settings.namespace,
78
+ });
79
+ const closing = yield* Deferred.make();
80
+ const closed = yield* Deferred.make();
81
+ const closeStarted = yield* Ref.make(false);
82
+ const publish = Effect.fnUntraced(function* (payload, generation) {
83
+ const next = yield* Ref.updateAndGet(sequence, (value) => value + 1n);
84
+ const current = generation ?? (yield* SubscriptionRef.get(state)).generation;
85
+ yield* hub.publish({ ...payload, sequence: next, generation: current });
86
+ });
87
+ const transition = Effect.fnUntraced(function* (status) {
88
+ const from = yield* SubscriptionRef.modify(state, (current) => current.status !== status && transitions[current.status].includes(status)
89
+ ? [
90
+ current.status,
91
+ {
92
+ ...current,
93
+ status,
94
+ // The close ends the session's own reconnect.
95
+ reconnecting: current.reconnecting && status !== "closing",
96
+ },
97
+ ]
98
+ : [current.status, current]);
99
+ if (from === status)
100
+ return true;
101
+ if (!transitions[from].includes(status)) {
102
+ // Once the session closes only its close moves it on: an attempt that raced it is told so.
103
+ if (isClosing(from))
104
+ return false;
105
+ return yield* Effect.die(`illegal session transition ${from} -> ${status}`);
106
+ }
107
+ yield* publish({ _tag: "Status", status });
108
+ return true;
109
+ });
110
+ const token = yield* Token.make({
111
+ tokens: input.tokens,
112
+ sessionId: intent._tag === "Attach" ? intent.sessionId : undefined,
113
+ onRefreshFailure: (error) => publish({ _tag: "Diagnostic", error }),
114
+ });
115
+ const signaling = coordinator.signaling(token.current);
116
+ const core = {
117
+ intent,
118
+ settings,
119
+ signaling,
120
+ state,
121
+ sequence,
122
+ hub,
123
+ data,
124
+ control,
125
+ publish,
126
+ transition,
127
+ };
128
+ const generation = Generation.make(core);
129
+ const ice = Ice.make({ core, generation });
130
+ const inbound = Inbound.make({ core, generation, ice });
131
+ const requests = Requests.make({ core, generation, apiUrl: coordinator.apiUrl });
132
+ const tracks = Tracks.make({ core, generation, requests });
133
+ const upload = Upload.make({ core, generation, requests });
134
+ const connect = Connect.make({
135
+ core,
136
+ generation,
137
+ ice,
138
+ inbound,
139
+ requests,
140
+ tracks,
141
+ peers: input.peers,
142
+ root,
143
+ token,
144
+ closing,
145
+ resumeTracks: input.resumeTracks,
146
+ });
147
+ const terminateOwned = (remote) => isKnown(remote) && remote.ownership === "owned"
148
+ ? signaling.terminate(remote.id)
149
+ : Effect.succeed(notTerminated);
150
+ const shutdown = Effect.gen(function* () {
151
+ yield* transition("closing");
152
+ yield* Deferred.fail(closing, ReactorError.fromCode("Closed", "session closing"));
153
+ const connection = (yield* SubscriptionRef.get(state)).connection;
154
+ const { submitted, errors } = yield* tracks.releasePublications(connection);
155
+ // The host's own failure is the evidence; its message says what did not
156
+ // finish. Anything else is reported as an opaque shutdown. A host effect
157
+ // that cannot carry a typed error dies with it.
158
+ const keep = (cleanup, what) => {
159
+ if (Exit.isSuccess(cleanup))
160
+ return;
161
+ const failure = Cause.squash(cleanup.cause);
162
+ errors.push(ReactorError.is(failure)
163
+ ? failure
164
+ : ReactorError.fromCode("Shutdown", `${what} did not complete cleanly`, {
165
+ detail: cleanup.cause,
166
+ }));
167
+ };
168
+ if (connection !== undefined)
169
+ keep(yield* generation.failUnreported(connection, ReactorError.fromCode("Aborted", "session closed")), "connection teardown");
170
+ keep(yield* Effect.exit(Scope.close(root, Exit.void)), "local cleanup");
171
+ // Ownership is read after local work has joined: an interrupted
172
+ // allocation may have changed its evidence meanwhile.
173
+ const remote = (yield* SubscriptionRef.get(state)).remote;
174
+ const termination = yield* terminateOwned(remote);
175
+ const unresolved = connection === undefined ? [] : [...(yield* Ref.get(connection.link)).claims.values()];
176
+ const report = {
177
+ localClosed: errors.length === 0,
178
+ allocation: allocationOf(remote),
179
+ ...(isKnown(remote) ? { ownership: remote.ownership, sessionId: remote.id } : {}),
180
+ remote: termination,
181
+ unpublishSubmitted: submitted,
182
+ unresolvedPublications: unresolved,
183
+ localErrors: errors.map(summarize),
184
+ };
185
+ yield* SubscriptionRef.update(state, (current) => ({ ...current, close: report }));
186
+ yield* transition("closed");
187
+ yield* hub.end;
188
+ yield* Deferred.succeed(closed, report);
189
+ yield* Effect.annotateCurrentSpan({
190
+ "reactor.close.local_closed": report.localClosed,
191
+ "reactor.close.allocation": report.allocation,
192
+ ...terminationAttributes(report.remote),
193
+ });
194
+ return report;
195
+ }).pipe(Effect.withSpan("Session.close", { kind: "client" }, { captureStackTrace: false }));
196
+ const close = Effect.uninterruptible(Ref.getAndSet(closeStarted, true).pipe(Effect.flatMap((started) => (started ? Deferred.await(closed) : shutdown))));
197
+ /** `session` as its readers see it, with what its connection and queues hold now. */
198
+ const snapshotOf = Effect.fnUntraced(function* (session) {
199
+ const link = session.connection === undefined ? undefined : yield* Ref.get(session.connection.link);
200
+ const details = {
201
+ generation: session.generation,
202
+ reconnecting: session.reconnecting,
203
+ pending: { data: yield* data.size, control: yield* control.size },
204
+ pausedLocally: [...(link?.paused ?? [])],
205
+ claimedTracks: [...(link?.claimed ?? [])],
206
+ receivedTracks: [...session.received],
207
+ unresolvedPublications: [...(link?.claims.values() ?? [])],
208
+ observationOverflows: yield* hub.overflows,
209
+ subscribers: yield* hub.observers,
210
+ ...(session.lastError === undefined ? {} : { lastError: session.lastError }),
211
+ ...(session.close === undefined ? {} : { close: session.close }),
212
+ };
213
+ if (session.status === "ready" && link?.negotiated !== undefined)
214
+ return { ...details, status: "ready", remote: link.negotiated };
215
+ return {
216
+ ...details,
217
+ status: session.status === "ready" ? "waiting" : session.status,
218
+ ...(session.remote === undefined ? {} : { remote: remoteOf(session.remote) }),
219
+ };
220
+ });
221
+ const snapshot = Effect.flatMap(SubscriptionRef.get(state), snapshotOf);
222
+ const observe = Effect.fnUntraced(function* (options = {}) {
223
+ // Subscribe first, so nothing falls between the state and its events.
224
+ const events = yield* hub.subscribe(options.capacity);
225
+ const revision = yield* Ref.get(sequence);
226
+ const initial = yield* snapshot;
227
+ return {
228
+ initial,
229
+ revision,
230
+ events: Stream.filter(events, (event) => event.sequence > revision),
231
+ };
232
+ });
233
+ const stats = Effect.gen(function* () {
234
+ const { c } = yield* generation.currentReady;
235
+ const raw = yield* generation.guard(c, c.peer.stats);
236
+ if (raw.length > 4096)
237
+ return yield* ReactorError.fromCode("Protocol", "statistics exceed their bound");
238
+ const atMs = Number(yield* Clock.monotonicTimeNanos) / 1_000_000;
239
+ return yield* SubscriptionRef.modify(state, (current) => {
240
+ const [statistics, sampler] = Stats.sample({
241
+ state: current.sampler,
242
+ raw,
243
+ generation: c.generation,
244
+ atMs,
245
+ });
246
+ return [statistics, { ...current, sampler }];
247
+ });
248
+ });
249
+ const session = (id) => ({
250
+ id,
251
+ ownership: intent._tag === "Create" || intent.adopt ? "owned" : "attached",
252
+ snapshot,
253
+ // Each change as it was, so a reader that falls behind still sees every status.
254
+ changes: SubscriptionRef.changes(state).pipe(Stream.mapEffect(snapshotOf)),
255
+ ready: Effect.map(generation.currentReady, ({ c, negotiated }) => ({
256
+ status: "ready",
257
+ generation: c.generation,
258
+ remote: negotiated,
259
+ })),
260
+ events: (options) => Stream.unwrap(hub.subscribe(options?.capacity)),
261
+ observe,
262
+ command: requests.command,
263
+ schema: requests.schema,
264
+ upload,
265
+ requestRecordingClip: requests.requestRecordingClip,
266
+ recording: requests.recording,
267
+ stats,
268
+ decoded: tracks.decoded,
269
+ tracks: tracks.tracks,
270
+ reconnect: connect.reconnect,
271
+ close,
272
+ });
273
+ return {
274
+ session,
275
+ allocate: connect.allocate,
276
+ connect: Effect.andThen(connect.connect, connect.arm),
277
+ close,
278
+ };
279
+ });
280
+ //# sourceMappingURL=session.js.map