effect-web-midi 0.2.3

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 (232) hide show
  1. package/README.md +276 -0
  2. package/dist/index.js +2 -0
  3. package/dist/index.js.map +1 -0
  4. package/dist/src/EMIDIAccess.js +129 -0
  5. package/dist/src/EMIDIAccess.js.map +1 -0
  6. package/dist/src/EMIDIInput.js +226 -0
  7. package/dist/src/EMIDIInput.js.map +1 -0
  8. package/dist/src/EMIDIOutput.js +227 -0
  9. package/dist/src/EMIDIOutput.js.map +1 -0
  10. package/dist/src/EMIDIPort.js +218 -0
  11. package/dist/src/EMIDIPort.js.map +1 -0
  12. package/dist/src/MIDIErrors.js +4 -0
  13. package/dist/src/MIDIErrors.js.map +1 -0
  14. package/dist/src/MIDIEventStreams.js +2 -0
  15. package/dist/src/MIDIEventStreams.js.map +1 -0
  16. package/dist/src/Parsing.js +2 -0
  17. package/dist/src/Parsing.js.map +1 -0
  18. package/dist/src/StreamMaker.js +1 -0
  19. package/dist/src/StreamMaker.js.map +1 -0
  20. package/dist/src/Util.js +2 -0
  21. package/dist/src/Util.js.map +1 -0
  22. package/dist/src/index.js +10 -0
  23. package/dist/src/index.js.map +1 -0
  24. package/dist/src/internal/EMIDIAccess.js +634 -0
  25. package/dist/src/internal/EMIDIAccess.js.map +1 -0
  26. package/dist/src/internal/EMIDIInput.js +66 -0
  27. package/dist/src/internal/EMIDIInput.js.map +1 -0
  28. package/dist/src/internal/EMIDIOutput.js +120 -0
  29. package/dist/src/internal/EMIDIOutput.js.map +1 -0
  30. package/dist/src/internal/EMIDIPort.js +125 -0
  31. package/dist/src/internal/EMIDIPort.js.map +1 -0
  32. package/dist/src/internal/MIDIErrors.js +190 -0
  33. package/dist/src/internal/MIDIErrors.js.map +1 -0
  34. package/dist/src/internal/MIDIEventStreams.js +41 -0
  35. package/dist/src/internal/MIDIEventStreams.js.map +1 -0
  36. package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.js +27 -0
  37. package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.js.map +1 -0
  38. package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.js +19 -0
  39. package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.js.map +1 -0
  40. package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.js +16 -0
  41. package/dist/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.js.map +1 -0
  42. package/dist/src/internal/MIDIPortMethodCalls/actOnPort.js +17 -0
  43. package/dist/src/internal/MIDIPortMethodCalls/actOnPort.js.map +1 -0
  44. package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.js +27 -0
  45. package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.js.map +1 -0
  46. package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.js +18 -0
  47. package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.js.map +1 -0
  48. package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.js +16 -0
  49. package/dist/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.js.map +1 -0
  50. package/dist/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.js +21 -0
  51. package/dist/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.js.map +1 -0
  52. package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.js +34 -0
  53. package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.js.map +1 -0
  54. package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.js +18 -0
  55. package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.js.map +1 -0
  56. package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.js +16 -0
  57. package/dist/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.js.map +1 -0
  58. package/dist/src/internal/Parsing.js +119 -0
  59. package/dist/src/internal/Parsing.js.map +1 -0
  60. package/dist/src/internal/StreamMaker.js +105 -0
  61. package/dist/src/internal/StreamMaker.js.map +1 -0
  62. package/dist/src/internal/Util.js +59 -0
  63. package/dist/src/internal/Util.js.map +1 -0
  64. package/dist/src/internal/getPortByPortId/getPortByPortIdAndAccess.js +53 -0
  65. package/dist/src/internal/getPortByPortId/getPortByPortIdAndAccess.js.map +1 -0
  66. package/dist/src/internal/getPortByPortId/getPortByPortIdInContext.js +18 -0
  67. package/dist/src/internal/getPortByPortId/getPortByPortIdInContext.js.map +1 -0
  68. package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.js +52 -0
  69. package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.js.map +1 -0
  70. package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.js +21 -0
  71. package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.js.map +1 -0
  72. package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.js +21 -0
  73. package/dist/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.js.map +1 -0
  74. package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.js +66 -0
  75. package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.js.map +1 -0
  76. package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.js +61 -0
  77. package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.js.map +1 -0
  78. package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.js +68 -0
  79. package/dist/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.js.map +1 -0
  80. package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.js +42 -0
  81. package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.js.map +1 -0
  82. package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.js +43 -0
  83. package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.js.map +1 -0
  84. package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.js +33 -0
  85. package/dist/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.js.map +1 -0
  86. package/dist/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.js +6 -0
  87. package/dist/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.js.map +1 -0
  88. package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.js +46 -0
  89. package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.js.map +1 -0
  90. package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.js +25 -0
  91. package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.js.map +1 -0
  92. package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.js +31 -0
  93. package/dist/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.js.map +1 -0
  94. package/dist-types/index.d.ts +2 -0
  95. package/dist-types/index.d.ts.map +1 -0
  96. package/dist-types/src/EMIDIAccess.d.ts +18 -0
  97. package/dist-types/src/EMIDIAccess.d.ts.map +1 -0
  98. package/dist-types/src/EMIDIInput.d.ts +26 -0
  99. package/dist-types/src/EMIDIInput.d.ts.map +1 -0
  100. package/dist-types/src/EMIDIOutput.d.ts +26 -0
  101. package/dist-types/src/EMIDIOutput.d.ts.map +1 -0
  102. package/dist-types/src/EMIDIPort.d.ts +26 -0
  103. package/dist-types/src/EMIDIPort.d.ts.map +1 -0
  104. package/dist-types/src/MIDIErrors.d.ts +2 -0
  105. package/dist-types/src/MIDIErrors.d.ts.map +1 -0
  106. package/dist-types/src/MIDIEventStreams.d.ts +2 -0
  107. package/dist-types/src/MIDIEventStreams.d.ts.map +1 -0
  108. package/dist-types/src/Parsing.d.ts +2 -0
  109. package/dist-types/src/Parsing.d.ts.map +1 -0
  110. package/dist-types/src/StreamMaker.d.ts +2 -0
  111. package/dist-types/src/StreamMaker.d.ts.map +1 -0
  112. package/dist-types/src/Util.d.ts +2 -0
  113. package/dist-types/src/Util.d.ts.map +1 -0
  114. package/dist-types/src/index.d.ts +10 -0
  115. package/dist-types/src/index.d.ts.map +1 -0
  116. package/dist-types/src/internal/EMIDIAccess.d.ts +551 -0
  117. package/dist-types/src/internal/EMIDIAccess.d.ts.map +1 -0
  118. package/dist-types/src/internal/EMIDIInput.d.ts +50 -0
  119. package/dist-types/src/internal/EMIDIInput.d.ts.map +1 -0
  120. package/dist-types/src/internal/EMIDIOutput.d.ts +95 -0
  121. package/dist-types/src/internal/EMIDIOutput.d.ts.map +1 -0
  122. package/dist-types/src/internal/EMIDIPort.d.ts +90 -0
  123. package/dist-types/src/internal/EMIDIPort.d.ts.map +1 -0
  124. package/dist-types/src/internal/MIDIErrors.d.ts +270 -0
  125. package/dist-types/src/internal/MIDIErrors.d.ts.map +1 -0
  126. package/dist-types/src/internal/MIDIEventStreams.d.ts +74 -0
  127. package/dist-types/src/internal/MIDIEventStreams.d.ts.map +1 -0
  128. package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.d.ts +16 -0
  129. package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.d.ts.map +1 -0
  130. package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.d.ts +15 -0
  131. package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.d.ts.map +1 -0
  132. package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.d.ts +13 -0
  133. package/dist-types/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.d.ts.map +1 -0
  134. package/dist-types/src/internal/MIDIPortMethodCalls/actOnPort.d.ts +11 -0
  135. package/dist-types/src/internal/MIDIPortMethodCalls/actOnPort.d.ts.map +1 -0
  136. package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.d.ts +23 -0
  137. package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.d.ts.map +1 -0
  138. package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.d.ts +15 -0
  139. package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.d.ts.map +1 -0
  140. package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.d.ts +13 -0
  141. package/dist-types/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.d.ts.map +1 -0
  142. package/dist-types/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.d.ts +15 -0
  143. package/dist-types/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.d.ts.map +1 -0
  144. package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.d.ts +21 -0
  145. package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.d.ts.map +1 -0
  146. package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.d.ts +15 -0
  147. package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.d.ts.map +1 -0
  148. package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.d.ts +13 -0
  149. package/dist-types/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.d.ts.map +1 -0
  150. package/dist-types/src/internal/Parsing.d.ts +110 -0
  151. package/dist-types/src/internal/Parsing.d.ts.map +1 -0
  152. package/dist-types/src/internal/StreamMaker.d.ts +204 -0
  153. package/dist-types/src/internal/StreamMaker.d.ts.map +1 -0
  154. package/dist-types/src/internal/Util.d.ts +33 -0
  155. package/dist-types/src/internal/Util.d.ts.map +1 -0
  156. package/dist-types/src/internal/getPortByPortId/getPortByPortIdAndAccess.d.ts +27 -0
  157. package/dist-types/src/internal/getPortByPortId/getPortByPortIdAndAccess.d.ts.map +1 -0
  158. package/dist-types/src/internal/getPortByPortId/getPortByPortIdInContext.d.ts +20 -0
  159. package/dist-types/src/internal/getPortByPortId/getPortByPortIdInContext.d.ts.map +1 -0
  160. package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.d.ts +76 -0
  161. package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.d.ts.map +1 -0
  162. package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.d.ts +39 -0
  163. package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.d.ts.map +1 -0
  164. package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.d.ts +29 -0
  165. package/dist-types/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.d.ts.map +1 -0
  166. package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.d.ts +62 -0
  167. package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.d.ts.map +1 -0
  168. package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.d.ts +16 -0
  169. package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.d.ts.map +1 -0
  170. package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.d.ts +65 -0
  171. package/dist-types/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.d.ts.map +1 -0
  172. package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.d.ts +36 -0
  173. package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.d.ts.map +1 -0
  174. package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.d.ts +23 -0
  175. package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.d.ts.map +1 -0
  176. package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.d.ts +35 -0
  177. package/dist-types/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.d.ts.map +1 -0
  178. package/dist-types/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.d.ts +7 -0
  179. package/dist-types/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.d.ts.map +1 -0
  180. package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.d.ts +71 -0
  181. package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.d.ts.map +1 -0
  182. package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.d.ts +7 -0
  183. package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.d.ts.map +1 -0
  184. package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.d.ts +28 -0
  185. package/dist-types/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.d.ts.map +1 -0
  186. package/index.ts +1 -0
  187. package/package.json +87 -0
  188. package/src/EMIDIAccess.ts +285 -0
  189. package/src/EMIDIInput.ts +273 -0
  190. package/src/EMIDIOutput.ts +272 -0
  191. package/src/EMIDIPort.ts +270 -0
  192. package/src/MIDIErrors.ts +13 -0
  193. package/src/MIDIEventStreams.ts +36 -0
  194. package/src/Parsing.ts +32 -0
  195. package/src/StreamMaker.ts +12 -0
  196. package/src/Util.ts +19 -0
  197. package/src/index.ts +9 -0
  198. package/src/internal/EMIDIAccess.ts +1280 -0
  199. package/src/internal/EMIDIInput.ts +114 -0
  200. package/src/internal/EMIDIOutput.ts +231 -0
  201. package/src/internal/EMIDIPort.ts +239 -0
  202. package/src/internal/MIDIErrors.ts +260 -0
  203. package/src/internal/MIDIEventStreams.ts +255 -0
  204. package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.ts +48 -0
  205. package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.ts +31 -0
  206. package/src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdInContext.ts +28 -0
  207. package/src/internal/MIDIPortMethodCalls/actOnPort.ts +66 -0
  208. package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPort.ts +38 -0
  209. package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdAndAccess.ts +38 -0
  210. package/src/internal/MIDIPortMethodCalls/closePortConnection/closePortConnectionByPortIdInContext.ts +28 -0
  211. package/src/internal/MIDIPortMethodCalls/makeMIDIPortMethodCallerFactory.ts +68 -0
  212. package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPort.ts +48 -0
  213. package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdAndAccess.ts +38 -0
  214. package/src/internal/MIDIPortMethodCalls/openPortConnection/openPortConnectionByPortIdInContext.ts +28 -0
  215. package/src/internal/Parsing.ts +304 -0
  216. package/src/internal/StreamMaker.ts +416 -0
  217. package/src/internal/Util.ts +152 -0
  218. package/src/internal/getPortByPortId/getPortByPortIdAndAccess.ts +117 -0
  219. package/src/internal/getPortByPortId/getPortByPortIdInContext.ts +26 -0
  220. package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPort.ts +148 -0
  221. package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdAndAccess.ts +135 -0
  222. package/src/internal/makePortStateChangesStream/makePortStateChangesStreamByPortIdInContext.ts +70 -0
  223. package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.ts +128 -0
  224. package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdAndAccess.ts +74 -0
  225. package/src/internal/mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPortIdInContext.ts +132 -0
  226. package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.ts +64 -0
  227. package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdAndAccess.ts +114 -0
  228. package/src/internal/mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPortIdInContext.ts +47 -0
  229. package/src/internal/mutablePropertyTools/getValueInRawPortFieldUnsafe.ts +12 -0
  230. package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPort.ts +182 -0
  231. package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdAndAccess.ts +29 -0
  232. package/src/internal/mutablePropertyTools/matchMutablePortProperty/matchMutablePortPropertyByPortIdInContext.ts +87 -0
@@ -0,0 +1,66 @@
1
+ import * as Brand from 'effect/Brand';
2
+ import * as EMIDIPort from './EMIDIPort.js';
3
+ import * as StreamMaker from './StreamMaker.js';
4
+ import * as Util from './Util.js';
5
+ /**
6
+ * Validates the raw MIDI input port, and puts it into a field hidden from the
7
+ * client's code
8
+ *
9
+ * @internal
10
+ */
11
+ const makeImpl = (rawInput) => EMIDIPort.makeImpl(rawInput, 'input', globalThis.MIDIInput);
12
+ /**
13
+ * Asserts an object to be valid EMIDIInput and casts it to internal
14
+ * implementation type
15
+ *
16
+ * @internal
17
+ */
18
+ const assertImpl = (input) => {
19
+ if (!isImpl(input))
20
+ throw new Error('Failed to cast to EMIDIInputImpl');
21
+ return input;
22
+ };
23
+ /**
24
+ * Asserts an object to be valid EMIDIInput
25
+ */
26
+ export const assert = assertImpl;
27
+ /**
28
+ * @internal
29
+ */
30
+ const assumeImpl = (input) => input;
31
+ /**
32
+ *
33
+ *
34
+ * @internal
35
+ */
36
+ export const make = makeImpl;
37
+ /**
38
+ *
39
+ *
40
+ * @internal
41
+ */
42
+ const isImpl = EMIDIPort.isImplOfSpecificType('input', globalThis.MIDIInput);
43
+ /**
44
+ *
45
+ *
46
+ */
47
+ export const is = isImpl;
48
+ /**
49
+ * [MIDIMessageEvent MDN
50
+ * Reference](https://developer.mozilla.org/docs/Web/API/MIDIMessageEvent)
51
+ *
52
+ * MIDI spec says that synthetically built `MIDIMessageEvent`s can have `data`
53
+ * field equal to `null`, but when coming from the browser, they won't. The
54
+ * default behavior is to defect on `null`.
55
+ */
56
+ export const makeMessagesStreamByPort = StreamMaker.createStreamMakerFrom()(is, input => ({
57
+ tag: 'MIDIMessage',
58
+ eventListener: { target: assumeImpl(input)._port, type: 'midimessage' },
59
+ spanAttributes: {
60
+ spanTargetName: 'MIDI port',
61
+ port: Util.getStaticMIDIPortInfo(input),
62
+ },
63
+ nullableFieldName: 'data',
64
+ }), midiMessage => ({ midiMessage }));
65
+ export const Id = Brand.nominal();
66
+ //# sourceMappingURL=EMIDIInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EMIDIInput.js","sourceRoot":"","sources":["../../../src/internal/EMIDIInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAoBjC;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,CAAC,QAAmB,EAAkB,EAAE,CACvD,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;AAE7D;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,EAAE;IACpC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;IACvE,OAAO,KAAK,CAAA;AACd,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAmC,UAAU,CAAA;AAEhE;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,KAAiB,EAAE,EAAE,CAAC,KAAuB,CAAA;AAEjE;;;;GAIG;AACH,MAAM,CAAC,MAAM,IAAI,GAAwC,QAAQ,CAAA;AAEjE;;;;GAIG;AACH,MAAM,MAAM,GACV,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,EAAE,GAA4C,MAAM,CAAA;AAEjE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GACnC,WAAW,CAAC,qBAAqB,EAAqB,CACpD,EAAE,EACF,KAAK,CAAC,EAAE,CAAC,CAAC;IACR,GAAG,EAAE,aAAa;IAClB,aAAa,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE;IACvE,cAAc,EAAE;QACd,cAAc,EAAE,WAAW;QAC3B,IAAI,EAAE,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC;KACxC;IACD,iBAAiB,EAAE,MAAM;CAC1B,CAAC,EACF,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CACjC,CAAA;AAeH,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,EAAM,CAAA"}
@@ -0,0 +1,120 @@
1
+ /** biome-ignore-all lint/style/useShorthandFunctionType: It's a nice way to
2
+ * preserve JSDoc comments attached to the function signature */
3
+ import * as Brand from 'effect/Brand';
4
+ import * as Effect from 'effect/Effect';
5
+ import * as EFunction from 'effect/Function';
6
+ import * as EMIDIPort from './EMIDIPort.js';
7
+ import * as MIDIErrors from './MIDIErrors.js';
8
+ import * as Util from './Util.js';
9
+ /**
10
+ * Validates the raw MIDI output port, and puts it into a field hidden from the
11
+ * client's code
12
+ *
13
+ * @internal
14
+ */
15
+ const makeImpl = (rawOutput) => EMIDIPort.makeImpl(rawOutput, 'output', globalThis.MIDIOutput);
16
+ /**
17
+ * Asserts an object to be valid EMIDIOutput and casts it to
18
+ * internal implementation type
19
+ *
20
+ * @internal
21
+ */
22
+ const assertImpl = (output) => {
23
+ if (!isImpl(output))
24
+ throw new Error('Assertion failed: Not a EMIDIOutputImpl');
25
+ return output;
26
+ };
27
+ /**
28
+ * Asserts an object to be valid EMIDIOutput
29
+ */
30
+ export const assert = assertImpl;
31
+ /**
32
+ * Casts
33
+ * @internal
34
+ */
35
+ const assumeImpl = (output) => output;
36
+ /**
37
+ *
38
+ * @internal
39
+ */
40
+ export const make = makeImpl;
41
+ /**
42
+ *
43
+ * @internal
44
+ */
45
+ const isImpl = EMIDIPort.isImplOfSpecificType('output', globalThis.MIDIOutput);
46
+ /**
47
+ *
48
+ */
49
+ export const is = isImpl;
50
+ /**
51
+ *
52
+ *
53
+ * @internal
54
+ */
55
+ const simplify = (polymorphicPort) => Util.fromPolymorphic(polymorphicPort, is);
56
+ /**
57
+ * If `midiMessage` is a System Exclusive message, and the `MIDIAccess` did not
58
+ * enable System Exclusive access, an `InvalidAccessError` exception will be
59
+ * thrown
60
+ *
61
+ * If the port is `"connected"` and the connection is `"closed"`, asynchronously
62
+ * tries to open the port. It's unclear in the spec if potential error of `open`
63
+ * call would result in an `InvalidAccessError` error coming from the `send`
64
+ * method itself.
65
+ *
66
+ * @returns An effect with the same port for easier chaining of operations
67
+ */
68
+ export const send = EFunction.dual(Util.polymorphicCheckInDual(is), Effect.fn('EMIDIOutput.send')(function* (polymorphicOutput, midiMessage, timestamp) {
69
+ const output = yield* simplify(polymorphicOutput);
70
+ yield* Effect.annotateCurrentSpan({
71
+ midiMessage,
72
+ timestamp,
73
+ port: Util.getStaticMIDIPortInfo(output),
74
+ });
75
+ yield* Effect.try({
76
+ try: () => assumeImpl(output)._port.send(midiMessage, timestamp),
77
+ catch: MIDIErrors.remapErrorByName({
78
+ NotAllowedError: MIDIErrors.CannotSendSysexMessageError,
79
+ // InvalidAccessError is kept for compatibility reason
80
+ // (https://github.com/WebAudio/web-midi-api/pull/278):
81
+ InvalidAccessError: MIDIErrors.CannotSendSysexMessageError,
82
+ InvalidStateError: MIDIErrors.CannotSendToDisconnectedPortError,
83
+ TypeError: MIDIErrors.MalformedMIDIMessageError,
84
+ }, 'EMIDIOutput.send error handling absurd', { portId: output.id, midiMessage: [...midiMessage] }),
85
+ });
86
+ return output;
87
+ }));
88
+ /**
89
+ * Clears any enqueued send data that has not yet been sent from the
90
+ * `MIDIOutput`'s queue. The browser will ensure the MIDI stream is left in a
91
+ * good state, and if the output port is in the middle of a sysex message, a
92
+ * sysex termination byte (`0xf7`) will be sent.
93
+ *
94
+ * @param polymorphicOutput An effectful output port
95
+ *
96
+ * @returns An effect with the same port for easier chaining of operations
97
+ * @experimental Supported only in Firefox. {@link https://caniuse.com/mdn-api_midioutput_clear|Can I use - MIDIOutput API: clear}
98
+ * @see {@link https://www.w3.org/TR/webmidi/#dom-midioutput-clear|Web MIDI spec}, {@link https://developer.mozilla.org/en-US/docs/Web/API/MIDIOutput/clear|MDN reference}
99
+ */
100
+ export const clear = Effect.fn('EMIDIOutput.clear')(function* (polymorphicOutput) {
101
+ const output = yield* simplify(polymorphicOutput);
102
+ yield* Effect.annotateCurrentSpan({
103
+ port: Util.getStaticMIDIPortInfo(output),
104
+ });
105
+ yield* Effect.try({
106
+ // @ts-expect-error even though `.clear` is in spec, the API is not
107
+ // supported in at least 2 major browsers, hence doesn't meet the condition
108
+ // to be included into TS's DOM types
109
+ try: () => assumeImpl(output)._port.clear(),
110
+ catch: MIDIErrors.remapErrorByName({
111
+ // TODO: test this
112
+ // most likely it would be something like `TypeError: Undefined is not a function`
113
+ TypeError: MIDIErrors.ClearingSendingQueueIsNotSupportedError,
114
+ NotSupportedError: MIDIErrors.ClearingSendingQueueIsNotSupportedError,
115
+ }, 'EMIDIOutput.clear error handling absurd', { portId: output.id }),
116
+ });
117
+ return output;
118
+ });
119
+ export const Id = Brand.nominal();
120
+ //# sourceMappingURL=EMIDIOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EMID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AAC,MAAM,CAAC,mBAAmB,CAAC;QAChC,IAAI,EAAE,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC;KACzC,CAAC,CAAA;IAEF,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QAChB,mEAAmE;QACnE,2EAA2E;QAC3E,qCAAqC;QACrC,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE;QAC3C,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAChC;YACE,kBAAkB;YAClB,kFAAkF;YAClF,SAAS,EAAE,UAAU,CAAC,uCAAuC;YAC7D,iBAAiB,EAAE,UAAU,CAAC,uCAAuC;SACtE,EACD,yCAAyC,EACzC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,CACtB;KACF,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC,CAAC,CAAA;AAwDF,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,OAAO,EAAM,CAAA"}
@@ -0,0 +1,125 @@
1
+ /** biome-ignore-all lint/style/useShorthandFunctionType: It's a nice way to
2
+ * preserve JSDoc comments attached to the function signature */
3
+ import * as Brand from 'effect/Brand';
4
+ import * as Equal from 'effect/Equal';
5
+ import * as Hash from 'effect/Hash';
6
+ import * as Inspectable from 'effect/Inspectable';
7
+ import * as Pipeable from 'effect/Pipeable';
8
+ /**
9
+ * Unique symbol used for distinguishing {@linkcode EMIDIPort} instances
10
+ * from other objects at both runtime and type-level
11
+ * @internal
12
+ */
13
+ const TypeId = Symbol.for('effect-web-midi/EMIDIPort');
14
+ /**
15
+ * Prototype of all {@linkcode EMIDIPort} instances
16
+ * @internal
17
+ */
18
+ const CommonProto = {
19
+ _tag: 'EMIDIPort',
20
+ [TypeId]: TypeId,
21
+ [Hash.symbol]() {
22
+ return Hash.string(this.id);
23
+ },
24
+ [Equal.symbol](that) {
25
+ return 'id' in that && this.id === that.id;
26
+ },
27
+ pipe() {
28
+ // biome-ignore lint/complexity/noArguments: Effect's tradition
29
+ return Pipeable.pipeArguments(this, arguments);
30
+ },
31
+ toString() {
32
+ return Inspectable.format(this.toJSON());
33
+ },
34
+ toJSON() {
35
+ return {
36
+ _id: 'EMIDIPort',
37
+ id: this.id,
38
+ name: this.name,
39
+ manufacturer: this.manufacturer,
40
+ version: this.version,
41
+ type: this.type,
42
+ };
43
+ },
44
+ [Inspectable.NodeInspectSymbol]() {
45
+ return this.toJSON();
46
+ },
47
+ get id() {
48
+ return BothId(assumeImpl(this)._port.id);
49
+ },
50
+ get name() {
51
+ return assumeImpl(this)._port.name;
52
+ },
53
+ get manufacturer() {
54
+ return assumeImpl(this)._port.manufacturer;
55
+ },
56
+ get version() {
57
+ return assumeImpl(this)._port.version;
58
+ },
59
+ get type() {
60
+ return assumeImpl(this)._port.type;
61
+ },
62
+ };
63
+ /**
64
+ *
65
+ *
66
+ * @internal
67
+ */
68
+ export const makeImpl = (port, type, ClassToAssertInheritance) => {
69
+ if (port.type !== type || !(port instanceof ClassToAssertInheritance))
70
+ throw new Error(`EMIDIPort constructor accepts only ${type} ports`);
71
+ const instance = Object.create(CommonProto);
72
+ instance._port = port;
73
+ return instance;
74
+ };
75
+ /**
76
+ * Asserts an object to be valid EMIDIPort and casts it to internal
77
+ * implementation type
78
+ *
79
+ * @internal
80
+ */
81
+ const assertImpl = (port) => {
82
+ if (!isGeneralImpl(port))
83
+ throw new Error('Failed to cast to EMIDIPort');
84
+ return port;
85
+ };
86
+ /**
87
+ * Asserts an object to be valid EMIDIPort
88
+ */
89
+ export const assert = assertImpl;
90
+ /**
91
+ * @internal
92
+ */
93
+ export const assumeImpl = (port) => port;
94
+ /**
95
+ *
96
+ *
97
+ * @internal
98
+ */
99
+ const isGeneralImpl = (port) => typeof port === 'object' &&
100
+ port !== null &&
101
+ Object.getPrototypeOf(port) === CommonProto &&
102
+ TypeId in port &&
103
+ 'type' in port &&
104
+ '_port' in port &&
105
+ typeof port._port === 'object' &&
106
+ port._port instanceof MIDIPort;
107
+ /**
108
+ *
109
+ *
110
+ * @internal
111
+ */
112
+ export const isImplOfSpecificType = (type, ClassToAssertInheritance) => (port) => {
113
+ if (!ClassToAssertInheritance)
114
+ throw new Error('Called in a context where ClassToAssertInheritance is falsy, probably on a platform where MIDI APIs are not supported, like node.js or bun');
115
+ return (isGeneralImpl(port) &&
116
+ port.type === type &&
117
+ port._port instanceof ClassToAssertInheritance);
118
+ };
119
+ /**
120
+ *
121
+ *
122
+ */
123
+ export const is = isGeneralImpl;
124
+ export const BothId = Brand.nominal();
125
+ //# sourceMappingURL=EMIDIPort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EMIDIPort.js","sourceRoot":"","sources":["../../../src/internal/EMIDIPort.ts"],"names":[],"mappings":"AAAA;gEACgE;AAEhE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,WAAW,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAM3C;;;;GAIG;AACH,MAAM,MAAM,GAAkB,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;AAQrE;;;GAGG;AACH,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,WAAoB;IAE1B,CAAC,MAAM,CAAC,EAAE,MAAM;IAEhB,CAAC,IAAI,CAAC,MAAM,CAAC;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC;IAED,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAiB;QAC9B,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAA;IAC5C,CAAC;IAED,IAAI;QACF,+DAA+D;QAC/D,OAAO,QAAQ,CAAC,aAAa,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M,EAAE,GAAyC,aAAa,CAAA;AAcrE,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,EAAU,CAAA"}
@@ -0,0 +1,190 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import * as EMIDIPort from './EMIDIPort.js';
3
+ // NOTE: stacks are properly extracted from error instances into structs, while
4
+ // decoding
5
+ const PortId = Schema.fromBrand(EMIDIPort.BothId)(Schema.NonEmptyTrimmedString);
6
+ const ErrorSchema = (nameSchema) => Schema.Struct({
7
+ name: (nameSchema ??
8
+ Schema.NonEmptyTrimmedString),
9
+ message: Schema.NonEmptyTrimmedString,
10
+ stack: Schema.NonEmptyTrimmedString.pipe(Schema.optionalWith({ exact: true })),
11
+ cause: Schema.Unknown.pipe(Schema.optionalWith({ exact: true })),
12
+ });
13
+ const midiAccessFailureFields = {
14
+ whileAskingForPermissions: Schema.Struct({
15
+ sysex: Schema.optional(Schema.Boolean),
16
+ software: Schema.optional(Schema.Boolean),
17
+ }),
18
+ };
19
+ /**
20
+ * Thrown if the document or page is going to be closed due to user navigation.
21
+ *
22
+ * Wraps `DOMException { name: 'AbortError' }`
23
+ *
24
+ * @see {@link https://webidl.spec.whatwg.org/#aborterror|Web IDL spec}
25
+ */
26
+ export class AbortError extends Schema.TaggedError()('AbortError', {
27
+ cause: ErrorSchema(Schema.Literal('AbortError')),
28
+ }) {
29
+ get message() {
30
+ return `MIDI access request was interrupted by user navigation, likely because the page was closed`;
31
+ }
32
+ }
33
+ /**
34
+ * Thrown if the underlying system raises any errors when trying to open the
35
+ * port.
36
+ *
37
+ * Wraps `DOMException { name: 'InvalidStateError' }`
38
+ *
39
+ * @see {@link https://webidl.spec.whatwg.org/#invalidstateerror|Web IDL spec}
40
+ */
41
+ export class UnderlyingSystemError extends Schema.TaggedError()('UnderlyingSystemError', {
42
+ cause: ErrorSchema(Schema.Literal('InvalidStateError')),
43
+ ...midiAccessFailureFields,
44
+ }) {
45
+ get message() {
46
+ return `Underlying system (OS/browser) raised an error when attempting to open the port`;
47
+ }
48
+ }
49
+ /**
50
+ * Thrown if the MIDI API, or a certain configuration of it is not supported by
51
+ * the system.
52
+ *
53
+ * Wraps `ReferenceError | TypeError | DOMException { name: 'NotSupportedError' }`
54
+ *
55
+ * @see {@link https://webidl.spec.whatwg.org/#notsupportederror|Web IDL spec}
56
+ */
57
+ export class MIDIAccessNotSupportedError extends Schema.TaggedError()('MIDIAccessNotSupportedError', {
58
+ cause: ErrorSchema(Schema.Literal('ReferenceError', 'TypeError', 'NotSupportedError')),
59
+ ...midiAccessFailureFields,
60
+ }) {
61
+ get message() {
62
+ return `This platform doesn't support Web MIDI API`;
63
+ }
64
+ }
65
+ /**
66
+ * Thrown on platforms where `.clear()` method of output ports is not supported
67
+ * (currently supported only in Firefox)
68
+ *
69
+ * Wraps `TypeError | DOMException { name: 'NotSupportedError' }`
70
+ *
71
+ * @see {@link https://webidl.spec.whatwg.org/#notsupportederror|Web IDL spec}
72
+ */
73
+ export class ClearingSendingQueueIsNotSupportedError extends Schema.TaggedError()('ClearingSendingQueueIsNotSupportedError', {
74
+ cause: ErrorSchema(Schema.Literal('TypeError', 'NotSupportedError')),
75
+ portId: PortId,
76
+ }) {
77
+ get message() {
78
+ return `This platform doesn't support "MIDIOutput.prototype.clear()" method`;
79
+ }
80
+ }
81
+ /**
82
+ * Thrown when attempt to open the port failed because it is unavailable (e.g.
83
+ * is already in use by another process and cannot be opened, or is
84
+ * disconnected).
85
+ *
86
+ * Wraps `DOMException { name: 'InvalidAccessError' | 'NotAllowedError' | 'InvalidStateError' }`
87
+ *
88
+ * @see Web IDL specs: {@link https://webidl.spec.whatwg.org/#invalidaccesserror|InvalidAccessError}, {@link https://webidl.spec.whatwg.org/#notallowederror|NotAllowedError}, {@link https://webidl.spec.whatwg.org/#invalidstateerror|InvalidStateError}
89
+ */
90
+ export class CannotOpenUnavailablePortError extends Schema.TaggedError()('CannotOpenUnavailablePortError', {
91
+ cause: ErrorSchema(Schema.Literal('InvalidAccessError', 'NotAllowedError', 'InvalidStateError')),
92
+ portId: PortId,
93
+ }) {
94
+ get message() {
95
+ return `Cannot open an unavailable port. This might happen when it's already in use by another process or is disconnected`;
96
+ }
97
+ }
98
+ /**
99
+ * Thrown when `.send` operation was called on a disconnected port.
100
+ *
101
+ * Wraps `DOMException { name: 'InvalidStateError' }`
102
+ *
103
+ * @see {@link https://webidl.spec.whatwg.org/#invalidaccesserror|Web IDL spec}
104
+ */
105
+ export class CannotSendToDisconnectedPortError extends Schema.TaggedError()('CannotSendToDisconnectedPortError', {
106
+ cause: ErrorSchema(Schema.Literal('InvalidStateError')),
107
+ portId: PortId,
108
+ }) {
109
+ get message() {
110
+ return `Cannot send a MIDI message to a disconnected port`;
111
+ }
112
+ }
113
+ /**
114
+ * Thrown when trying to send system exclusive message from the access handle,
115
+ * that doesn't have this permission
116
+ *
117
+ * Wraps `DOMException { name: 'InvalidAccessError' | 'NotAllowedError' }`
118
+ *
119
+ * @see Web IDL specs: {@link https://webidl.spec.whatwg.org/#invalidaccesserror|InvalidAccessError}, {@link https://webidl.spec.whatwg.org/#notallowederror|NotAllowedError}
120
+ */
121
+ export class CannotSendSysexMessageError extends Schema.TaggedError()('CannotSendSysexMessageError', {
122
+ cause: ErrorSchema(Schema.Literal('InvalidAccessError', 'NotAllowedError')),
123
+ portId: PortId,
124
+ }) {
125
+ get message() {
126
+ return `Cannot send a system exclusive MIDI message from a MIDI access handle that wasn't permitted to send such messages`;
127
+ }
128
+ }
129
+ /**
130
+ * Thrown if the user, the system or their security settings denied the
131
+ * application from creating an {@linkcode EMIDIAccess.EMIDIAccessInstance} object
132
+ * with the requested {@linkcode EMIDIAccess.RequestMIDIAccessOptions|options}, or if the
133
+ * document is not allowed to use the feature (for example, because of a
134
+ * Permission Policy, or because the user previously denied a permission
135
+ * request).
136
+ *
137
+ * Wraps `DOMException { name: 'NotAllowedError' | 'SecurityError' }`
138
+ *
139
+ * @see Web IDL specs: {@link https://webidl.spec.whatwg.org/#notallowederror|NotAllowedError}, {@link https://webidl.spec.whatwg.org/#securityerror|SecurityError}
140
+ */
141
+ export class MIDIAccessNotAllowedError extends Schema.TaggedError()('MIDIAccessNotAllowedError', {
142
+ cause: ErrorSchema(Schema.Literal('NotAllowedError', 'SecurityError')),
143
+ ...midiAccessFailureFields,
144
+ }) {
145
+ get message() {
146
+ return `Request to use Web MIDI API with specific options was rejected by the user or their security settings`;
147
+ }
148
+ }
149
+ /**
150
+ * Thrown when data to be sent is not a valid sequence or does not contain a
151
+ * valid MIDI message
152
+ *
153
+ * Wraps `TypeError`
154
+ */
155
+ export class MalformedMIDIMessageError extends Schema.TaggedError()('MalformedMIDIMessageError', {
156
+ cause: ErrorSchema(Schema.Literal('TypeError')),
157
+ portId: PortId,
158
+ midiMessage: Schema.Array(Schema.Int),
159
+ }) {
160
+ get message() {
161
+ return `Attempted to send invalid MIDI message (${this.midiMessage.length} bytes)`;
162
+ }
163
+ }
164
+ /**
165
+ * Keep in mind that if port isn't found, it might not mean it's disconnected.
166
+ * For example, virtual ports created by software won't show up in the list of
167
+ * available inputs/outputs of MIDI Access handle with disabled
168
+ * {@linkcode EMIDIAccess.RequestMIDIAccessOptions.software} flag.
169
+ */
170
+ export class PortNotFoundError extends Schema.TaggedError()('PortNotFound', { portId: PortId }) {
171
+ get message() {
172
+ return `Port with specific ID wasn't found`;
173
+ }
174
+ }
175
+ // TODO: Make so that the function also ensures that cause.name is properly matches the map arg field it's assigned from, so that consistency goes both ways
176
+ /**
177
+ *
178
+ * @internal
179
+ */
180
+ export const remapErrorByName = (map, absurdMessage, rest) => (cause) => {
181
+ if (!(cause instanceof Error && cause.name in map))
182
+ throw new Error(absurdMessage);
183
+ // biome-ignore lint/style/noNonNullAssertion: Because we checked it above with `cause.name in map`
184
+ const Class = map[cause.name];
185
+ return new Class({
186
+ cause,
187
+ ...rest,
188
+ });
189
+ };
190
+ //# sourceMappingURL=MIDIErrors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MIDIErrors.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,4JAA4J;AAC5J;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,CACE,GAAyC,EACzC,aAAqB,EACrB,IAKC,EACD,EAAE,CACJ,CAAC,KAAc,EAAE,EAAE;IACjB,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,GAAG,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;IAChC,mGAAmG;IACnG,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAE,CAAA;IAC9B,OAAO,IAAI,KAAK,CAAC;QACf,KAAK;QACL,GAAG,IAAI;KACR,CAAmC,CAAA;AACtC,CAAC,CAAA"}
@@ -0,0 +1,41 @@
1
+ import * as EFunction from 'effect/Function';
2
+ import * as Stream from 'effect/Stream';
3
+ import * as EMIDIAccess from './EMIDIAccess.js';
4
+ import * as EMIDIInput from './EMIDIInput.js';
5
+ import { getInputByPortIdAndAccess } from './getPortByPortId/getPortByPortIdAndAccess.js';
6
+ import * as Parsing from './Parsing.js';
7
+ import * as Util from './Util.js';
8
+ const buildSpecificEventStreamByInputIdAndAccessMaker = (predicate) => {
9
+ const makeSpecificMessageStreamByInput = buildSpecificMessageStreamByInputMaker(predicate);
10
+ return EFunction.dual(Util.polymorphicCheckInDual(EMIDIAccess.is), (polymorphicAccess, id, options) => makeSpecificMessageStreamByInput(getInputByPortIdAndAccess(polymorphicAccess, id), options));
11
+ };
12
+ const buildSpecificMessagesStreamByInputIdInContextMaker = (predicate) => {
13
+ const makeSpecificMessageStreamByAccess = buildSpecificEventStreamByInputIdAndAccessMaker(predicate);
14
+ return (id, options) => makeSpecificMessageStreamByAccess(EMIDIAccess.EMIDIAccess, id, options);
15
+ };
16
+ const buildSpecificMessageStreamByInputMaker = (predicate) => EFunction.dual(Util.polymorphicCheckInDual(EMIDIInput.is), EFunction.flow(EMIDIInput.makeMessagesStreamByPort, Parsing.withParsedDataField, Stream.filter(predicate)));
17
+ export const makeNoteReleaseStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isNoteRelease);
18
+ export const makeNoteReleaseStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isNoteRelease);
19
+ export const makeNoteReleaseStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isNoteRelease);
20
+ export const makeNotePressStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isNotePress);
21
+ export const makeNotePressStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isNotePress);
22
+ export const makeNotePressStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isNotePress);
23
+ export const makeUnknownReplyStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isUnknownReply);
24
+ export const makeUnknownReplyStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isUnknownReply);
25
+ export const makeUnknownReplyStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isUnknownReply);
26
+ export const makeControlChangeStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isControlChange);
27
+ export const makeControlChangeStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isControlChange);
28
+ export const makeControlChangeStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isControlChange);
29
+ export const makeChannelPressureStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isChannelPressure);
30
+ export const makeChannelPressureStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isChannelPressure);
31
+ export const makeChannelPressureStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isChannelPressure);
32
+ export const makeTouchpadReleaseStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isTouchpadRelease);
33
+ export const makeTouchpadReleaseStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isTouchpadRelease);
34
+ export const makeTouchpadReleaseStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isTouchpadRelease);
35
+ export const makePitchBendChangeStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isPitchBendChange);
36
+ export const makePitchBendChangeStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isPitchBendChange);
37
+ export const makePitchBendChangeStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isPitchBendChange);
38
+ export const makeTouchpadPositionUpdateStreamByInput = buildSpecificMessageStreamByInputMaker(Parsing.isTouchpadPositionUpdate);
39
+ export const makeTouchpadPositionUpdateStreamByInputIdAndAccess = buildSpecificEventStreamByInputIdAndAccessMaker(Parsing.isTouchpadPositionUpdate);
40
+ export const makeTouchpadPositionUpdateStreamByInputIdInContext = buildSpecificMessagesStreamByInputIdInContextMaker(Parsing.isTouchpadPositionUpdate);
41
+ //# sourceMappingURL=MIDIEventStreams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MIDIEventStreams.js","sourceRoot":"","sources":["../../../src/internal/MIDIEventStreams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,+CAA+C,CAAA;AAEzF,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,MAAM,+CAA+C,GAAG,CAGtD,SAA4C,EACM,EAAE;IACpD,MAAM,gCAAgC,GACpC,sCAAsC,CAAC,SAAS,CAAC,CAAA;IAEnD,OAAO,SAAS,CAAC,IAAI,CACnB,IAAI,CAAC,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CAA2C,GACtD,kDAAkD,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAA;AAE/E,MAAM,CAAC,MAAM,uCAAuC,GAClD,sCAAsC,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAA;AAE1E,MAAM,CAAC,MAAM,kDAAkD,GAC7D,+CAA+C,CAC7C,OAAO,CAAC,wBAAwB,CACjC,CAAA;AAEH,MAAM,CAAC,MAAM,kDAAkD,GAC7D,kDAAkD,CAChD,OAAO,CAAC,wBAAwB,CACjC,CAAA"}
@@ -0,0 +1,27 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import * as EMIDIInput from '../../EMIDIInput.js';
3
+ import * as EMIDIOutput from '../../EMIDIOutput.js';
4
+ import * as EMIDIPort from '../../EMIDIPort.js';
5
+ import * as Close from '../closePortConnection/closePortConnectionByPort.js';
6
+ import * as Open from '../openPortConnection/openPortConnectionByPort.js';
7
+ /**
8
+ * @internal
9
+ */
10
+ const makeConnectionAcquirerReleaser = (is) =>
11
+ /**
12
+ * @returns An effect with the same port for easier chaining of operations
13
+ */
14
+ port => Effect.acquireRelease(Open.makePortConnectionOpener(is)(port), Close.makePortConnectionCloser(is));
15
+ /**
16
+ *
17
+ */
18
+ export const acquireReleasePortConnectionByPort = makeConnectionAcquirerReleaser(EMIDIPort.is);
19
+ /**
20
+ *
21
+ */
22
+ export const acquireReleaseInputConnectionByPort = makeConnectionAcquirerReleaser(EMIDIInput.is);
23
+ /**
24
+ *
25
+ */
26
+ export const acquireReleaseOutputConnectionByPort = makeConnectionAcquirerReleaser(EMIDIOutput.is);
27
+ //# sourceMappingURL=acquireReleasePortConnectionByPort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acquireReleasePortConnectionByPort.js","sourceRoot":"","sources":["../../../../../src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,OAAO,KAAK,UAAU,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAA;AAE/C,OAAO,KAAK,KAAK,MAAM,qDAAqD,CAAA;AAE5E,OAAO,KAAK,IAAI,MAAM,mDAAmD,CAAA;AAEzE;;GAEG;AACH,MAAM,8BAA8B,GAClC,CACE,EAAsE,EAKtE,EAAE;AACJ;;GAEG;AACH,IAAI,CAAC,EAAE,CACL,MAAM,CAAC,cAAc,CACnB,IAAI,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EACvC,KAAK,CAAC,wBAAwB,CAAC,EAAE,CAAC,CACnC,CAAA;AAEL;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAC7C,8BAA8B,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAE9C;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAC9C,8BAA8B,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;AAE/C;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAC/C,8BAA8B,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA"}
@@ -0,0 +1,19 @@
1
+ // TODO: acquireReleasePortConnectionByPortIdAndAccess.ts
2
+ /** biome-ignore-all lint/style/useShorthandFunctionType: It's a nice way to
3
+ * preserve JSDoc comments attached to the function signature */
4
+ import * as Get from '../../getPortByPortId/getPortByPortIdAndAccess.js';
5
+ import { actOnPort } from '../actOnPort.js';
6
+ import * as AR from './acquireReleasePortConnectionByPort.js';
7
+ /**
8
+ *
9
+ */
10
+ export const acquireReleasePortConnectionByPortIdAndAccess = actOnPort(Get.getPortByPortIdAndAccess, AR.acquireReleasePortConnectionByPort);
11
+ /**
12
+ *
13
+ */
14
+ export const acquireReleaseInputConnectionByPortIdAndAccess = actOnPort(Get.getInputByPortIdAndAccess, AR.acquireReleaseInputConnectionByPort);
15
+ /**
16
+ *
17
+ */
18
+ export const acquireReleaseOutputConnectionByPortIdAndAccess = actOnPort(Get.getOutputByPortIdAndAccess, AR.acquireReleaseOutputConnectionByPort);
19
+ //# sourceMappingURL=acquireReleasePortConnectionByPortIdAndAccess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"acquireReleasePortConnectionByPortIdAndAccess.js","sourceRoot":"","sources":["../../../../../src/internal/MIDIPortMethodCalls/acquireReleasePortConnection/acquireReleasePortConnectionByPortIdAndAccess.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD;gEACgE;AAEhE,OAAO,KAAK,GAAG,MAAM,mDAAmD,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,MAAM,yCAAyC,CAAA;AAE7D;;GAEG;AACH,MAAM,CAAC,MAAM,6CAA6C,GAAG,SAAS,CACpE,GAAG,CAAC,wBAAwB,EAC5B,EAAE,CAAC,kCAAkC,CACtC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,8CAA8C,GAAG,SAAS,CACrE,GAAG,CAAC,yBAAyB,EAC7B,EAAE,CAAC,mCAAmC,CACvC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,+CAA+C,GAAG,SAAS,CACtE,GAAG,CAAC,0BAA0B,EAC9B,EAAE,CAAC,oCAAoC,CACxC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import { flow } from 'effect/Function';
2
+ import * as Get from '../../getPortByPortId/getPortByPortIdInContext.js';
3
+ import * as Acquire from './acquireReleasePortConnectionByPort.js';
4
+ /**
5
+ *
6
+ */
7
+ export const acquireReleasePortConnectionByPortIdInContext = flow(Get.getPortByPortIdInContext, Acquire.acquireReleasePortConnectionByPort);
8
+ /**
9
+ *
10
+ */
11
+ export const acquireReleaseInputConnectionByPortIdInContext = flow(Get.getInputByPortIdInContext, Acquire.acquireReleaseInputConnectionByPort);
12
+ /**
13
+ *
14
+ */
15
+ export const acquireReleaseOutputConnectionByPortIdInContext = flow(Get.getOutputByPortIdInContext, Acquire.acquireReleaseOutputConnectionByPort);
16
+ //# sourceMappingURL=acquireReleasePortConnectionByPortIdInContext.js.map