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,634 @@
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 EArray from 'effect/Array';
4
+ import * as Context from 'effect/Context';
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Equal from 'effect/Equal';
7
+ import * as EFunction from 'effect/Function';
8
+ import * as Hash from 'effect/Hash';
9
+ import * as Inspectable from 'effect/Inspectable';
10
+ import * as Iterable from 'effect/Iterable';
11
+ import * as Layer from 'effect/Layer';
12
+ import * as Option from 'effect/Option';
13
+ import * as Order from 'effect/Order';
14
+ import * as Pipeable from 'effect/Pipeable';
15
+ import * as Record from 'effect/Record';
16
+ import * as Ref from 'effect/Ref';
17
+ import * as SortedMap from 'effect/SortedMap';
18
+ import * as Unify from 'effect/Unify';
19
+ import * as EMIDIInput from './EMIDIInput.js';
20
+ import * as EMIDIOutput from './EMIDIOutput.js';
21
+ import * as GetPort from './getPortByPortId/getPortByPortIdInContext.js';
22
+ import * as MIDIErrors from './MIDIErrors.js';
23
+ import * as Check from './mutablePropertyTools/doesMutablePortPropertyHaveSpecificValue/doesMutablePortPropertyHaveSpecificValueByPort.js';
24
+ import * as GetProperty from './mutablePropertyTools/getMutablePortProperty/getMutablePortPropertyByPort.js';
25
+ import * as StreamMaker from './StreamMaker.js';
26
+ import * as Util from './Util.js';
27
+ // Todo research in web midi api
28
+ // Focus on Uniqueness: On Windows, MIDI device IDs can be unstable (sometimes just an index). Focusing your library on robustly identifying the same device across reconnections is a much more valuable feature than worrying about memory leaks from too many IDs.
29
+ // TODO: add stream of messages sent from this device to target midi device
30
+ // TODO: fat service APIs, where all the methods are attached to instance and
31
+ // where you don't have to constantly write the prefix
32
+ // TODO: implement scoping of midi access that will clean up all message queues
33
+ // and streams, and remove listeners
34
+ // TODO: implement scope inheritance
35
+ // TODO: make a Ref with a port map that would be automatically updated by
36
+ // listening to the stream of connection events?
37
+ // TODO: add a stream to listen for all messages of all currently
38
+ // connected inputs, all present inputs, specific input
39
+ // TODO: add sinks that will accept command streams to redirect midi commands
40
+ // from something into an actual API
41
+ // TODO: add effect to wait until connected by port ID
42
+ // TODO: reflect sysex and software flags in type-system
43
+ // TODO: make matchers that support returning effects from the callback instead of plain values
44
+ // TODO: utilities to create mock implementations of objects because, all make methods are internal
45
+ // TODO: document that in tests, you need to manually provide the mock access with the tag
46
+ // TODO: export react and atom related stuff
47
+ // TODO: add streams with reactive live port/input/output maps snapshots
48
+ /**
49
+ * Unique symbol used for distinguishing
50
+ * {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance}s from other objects at
51
+ * both runtime and type-level
52
+ * @internal
53
+ */
54
+ const TypeId = Symbol.for('effect-web-midi/EMIDIAccessInstance');
55
+ /**
56
+ * A tag that allows to provide
57
+ * {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance} once with e.g.
58
+ * {@linkcode layer}, {@linkcode layerSystemExclusiveSupported}, etc. and reuse
59
+ * it anywhere, instead of repeatedly {@linkcode request}ing it.
60
+ *
61
+ * The downside of using DI might be that in different places of the app it
62
+ * would be harder to maintain tight MIDI permission scopes.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * import * as EMIDIAccess from 'effect-web-midi/EMIDIAccess';
67
+ * import * as Effect from 'effect/Effect'
68
+ *
69
+ * const program = Effect.gen(function* () {
70
+ * // ^ Effect.Effect<
71
+ * // void,
72
+ * // | AbortError
73
+ * // | UnderlyingSystemError
74
+ * // | MIDIAccessNotAllowedError
75
+ * // | MIDIAccessNotSupportedError
76
+ * // never
77
+ * // >
78
+ *
79
+ * const access = yield* EMIDIAccess.EMIDIAccess
80
+ * // ^ EMIDIAccess.Instance
81
+ *
82
+ * console.log(access.sysexEnabled)
83
+ * // ^ true
84
+ * }).pipe(Effect.provide(EMIDIAccess.layerSystemExclusiveSupported))
85
+ * ```
86
+ *
87
+ * @see `navigator.requestMIDIAccess` {@link https://www.w3.org/TR/webmidi/#dom-navigator-requestmidiaccess|Web MIDI spec}, {@link https://developer.mozilla.org/en-US/docs/Web/API/Navigator/requestMIDIAccess|MDN reference}
88
+ */
89
+ export class EMIDIAccess extends Context.Tag('effect-web-midi/EMIDIAccess')() {
90
+ }
91
+ /**
92
+ * Prototype of all objects satisfying the
93
+ * {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance} type.
94
+ * @internal
95
+ */
96
+ const Proto = {
97
+ _tag: 'EMIDIAccess',
98
+ [TypeId]: TypeId,
99
+ [Hash.symbol]() {
100
+ return Hash.structure(this._config);
101
+ },
102
+ [Equal.symbol](that) {
103
+ return this === that;
104
+ },
105
+ pipe() {
106
+ // biome-ignore lint/complexity/noArguments: Effect's tradition
107
+ return Pipeable.pipeArguments(this, arguments);
108
+ },
109
+ toString() {
110
+ return Inspectable.format(this.toJSON());
111
+ },
112
+ toJSON() {
113
+ return { _id: 'EMIDIAccess', config: this._config };
114
+ },
115
+ [Inspectable.NodeInspectSymbol]() {
116
+ return this.toJSON();
117
+ },
118
+ get sysexEnabled() {
119
+ return assumeImpl(this)._access.sysexEnabled;
120
+ },
121
+ get softwareSynthEnabled() {
122
+ return !!assumeImpl(this)._config.software;
123
+ },
124
+ };
125
+ /**
126
+ * @param rawAccess The raw {@linkcode MIDIAccess} object from the browser's Web
127
+ * MIDI API to be wrapped.
128
+ * @param config Optional configuration options used to acquire the `rawAccess`,
129
+ * to preserve alongside it.
130
+ *
131
+ * @returns An object with private fields like
132
+ * {@linkcode EMIDIAccessImplementationInstance._access|_access} and
133
+ * {@linkcode EMIDIAccessImplementationInstance._config|_config} that are not
134
+ * supposed to be used externally by user-facing code.
135
+ *
136
+ * @internal
137
+ * @example
138
+ * ```ts
139
+ * const config = { sysex: true };
140
+ * const rawAccess = await navigator.requestMIDIAccess(config);
141
+ * const internalInstance = makeImpl(rawAccess, config);
142
+ * ```
143
+ */
144
+ const makeImpl = (rawAccess, config) => {
145
+ const instance = Object.create(Proto);
146
+ instance._access = rawAccess;
147
+ // TODO: set individual software and sysex flags instead
148
+ instance._config = config ?? {};
149
+ return instance;
150
+ };
151
+ /**
152
+ * Asserts that an `unknown` value is a valid
153
+ * {@linkcode EMIDIAccessImplementationInstance} and casts it to the type.
154
+ * Throws an error if the assertion fails.
155
+ *
156
+ * @internal
157
+ * @example
158
+ * ```ts
159
+ * const unknownValue: null | EMIDIAccessInstance = null
160
+ * try {
161
+ * const validatedAccess = assertImpl(unknownValue);
162
+ * // validatedAccess is now known to be EMIDIAccessImplementationInstance
163
+ * } catch (error) {
164
+ * console.error("Assertion failed:", error);
165
+ * }
166
+ * ```
167
+ */
168
+ const assertImpl = (access) => {
169
+ if (!isImpl(access))
170
+ throw new Error('Failed to cast to EMIDIAccess');
171
+ return access;
172
+ };
173
+ /**
174
+ * Asserts that an `unknown` value is a valid {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance}
175
+ * and casts it to the type. Throws an error if the assertion fails.
176
+ *
177
+ * @internal
178
+ * @example
179
+ * ```ts
180
+ * import * as EMIDIAccess from 'effect-web-midi/EMIDIAccess';
181
+ *
182
+ * const unknownValue: null | EMIDIAccess.Instance = null
183
+ *
184
+ * try {
185
+ * const validatedAccess = EMIDIAccess.assert(unknownValue);
186
+ * // validatedAccess is now known to be EMIDIAccess.Instance
187
+ * } catch (error) {
188
+ * console.error("Assertion failed:", error);
189
+ * }
190
+ * ```
191
+ *
192
+ * @see {@linkcode is|EMIDIAccess.is}
193
+ */
194
+ export const assert = assertImpl;
195
+ /**
196
+ * Purely a type-level typecast to expose internal fields. Does no runtime
197
+ * validation and assumes you provided
198
+ * {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance} acquired legitimately
199
+ * from `effect-web-midi`.
200
+ *
201
+ * @internal
202
+ * @example
203
+ * ```ts
204
+ * // Assume `accessInstance` is known to be an internal implementation
205
+ * declare const accessPublic: EMIDIAccessInstance;
206
+ * const accessInternal = assumeImpl(accessPublic);
207
+ * console.log('No type error here: ', accessInternal._config)
208
+ * ```
209
+ */
210
+ export const assumeImpl = (access) => access;
211
+ /**
212
+ * Creates a public-facing {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance}
213
+ * from a raw {@linkcode MIDIAccess} object and optional configuration options
214
+ * used to acquire it. Prevents revealing internal fields set by
215
+ * `effect-web-midi` to the end user.
216
+ *
217
+ * @internal
218
+ * @example
219
+ * ```ts
220
+ * // This is an internal helper, typically not called directly by users.
221
+ * // It's used by the 'request' function to create the instance.
222
+ * const config = { sysex: true }
223
+ * const rawAccess = await navigator.requestMIDIAccess(config);
224
+ * const instance = make(rawAccess, config);
225
+ * ```
226
+ */
227
+ const make = makeImpl;
228
+ /**
229
+ * @internal
230
+ * @example
231
+ * ```ts
232
+ * const accessOrNot: null | EMIDIAccessInstance = null
233
+ *
234
+ * if (isImpl(accessOrNot)) {
235
+ * const accessInternal = accessOrNot;
236
+ * // will not be logged
237
+ * console.log('No type error here: ', accessInternal._config)
238
+ * } else {
239
+ * console.log('This will be logged because null is not EMIDIAccessInstance')
240
+ * }
241
+ * ```
242
+ */
243
+ const isImpl = (access) => typeof access === 'object' &&
244
+ access !== null &&
245
+ Object.getPrototypeOf(access) === Proto &&
246
+ TypeId in access &&
247
+ '_access' in access &&
248
+ typeof access._access === 'object' &&
249
+ '_config' in access &&
250
+ typeof access._config === 'object' &&
251
+ access._config !== null &&
252
+ access._access instanceof MIDIAccess;
253
+ /**
254
+ * @example
255
+ * ```ts
256
+ * import * as EMIDIAccess from 'effect-web-midi/EMIDIAccess';
257
+ *
258
+ * const accessOrNot: null | EMIDIAccess.Instance = null
259
+ *
260
+ * if (EMIDIAccess.is(accessOrNot)) {
261
+ * const accessPublic = accessOrNot;
262
+ * // ts-expect-error You're exposed only to public facing fields
263
+ * console.log(accessPublic._config)
264
+ * // will not be logged
265
+ * } else {
266
+ * console.log('This will be logged because null is not EMIDIAccessInstance')
267
+ * }
268
+ * ```
269
+ *
270
+ * @see {@linkcode assert|EMIDIAccess.assert}
271
+ */
272
+ export const is = isImpl;
273
+ /**
274
+ * This utility function is used internally to handle different ways MIDI access
275
+ * might be provided, ensuring a consistent type for further operations. It uses
276
+ * the public {@linkcode is|EMIDIAccess.is} type guard for validation. If an
277
+ * effect is passed, errors and requirements are passed-through without
278
+ * modifications.
279
+ *
280
+ * @internal
281
+ * @param polymorphicAccess Either just {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance}, or an
282
+ * Effect having it in the success channel.
283
+ * @returns An effect with type-asserted at runtime
284
+ * {@linkcode EMIDIAccessInstance|EMIDIAccess.Instance}.
285
+ *
286
+ * @example
287
+ * ```ts
288
+ * import * as Effect from 'effect/Effect';
289
+ * import * as EMIDIAccess from 'effect-web-midi/EMIDIAccess';
290
+ *
291
+ * const getValidatedAccess = Effect.gen(function* () {
292
+ * // Assume `polymorphicAccess` is obtained elsewhere
293
+ * const polymorphicAccess = {} as EMIDIAccess.PolymorphicInstance;
294
+ * const validatedAccess = yield* EMIDIAccess.simplify(polymorphicAccess);
295
+ * // The operation above will throw a defect, because {} is not an access instance
296
+ * return validatedAccess;
297
+ * });
298
+ * ```
299
+ *
300
+ * @see {@linkcode Util.fromPolymorphic}
301
+ * @see {@linkcode PolymorphicAccessInstance|EMIDIAccess.PolymorphicInstance}
302
+ * @see {@linkcode PolymorphicAccessInstanceClean|EMIDIAccess.PolymorphicCleanInstance}
303
+ */
304
+ export const simplify = (polymorphicAccess) => Util.fromPolymorphic(polymorphicAccess, is);
305
+ /**
306
+ * Higher-order helper function to canonicalize a subset of raw ports from raw access object
307
+ * into their `effect-web-midi` counterparts using the provided `make` function.
308
+ *
309
+ * @internal
310
+ * @param key The property key of {@linkcode MIDIAccess} like {@linkcode MIDIAccess.inputs|inputs} or {@linkcode MIDIAccess.outputs|outputs} to access the map (e.g. {@linkcode MIDIInputMap} or {@linkcode MIDIOutputMap})
311
+ * @param make A function to wrap the raw MIDI port (e.g. {@linkcode MIDIInput}) from that map into a managed by `effect-web-midi` port instance (e.g. {@linkcode EMIDIInput}).
312
+ * @returns A function that, when given a raw {@linkcode MIDIAccess}, returns an iterable of `[ID, effectful port]` pairs.
313
+ * @example
314
+ * ```ts
315
+ * import * as EMIDIInput from 'effect-web-midi/EMIDIInput';
316
+ *
317
+ * declare const rawAccess: MIDIAccess;
318
+ * const getInputs = getPortEntriesFromRawAccess('inputs', EMIDIInput.make);
319
+ * const inputEntries: Iterable<InputRecordEntry> = getInputs(rawAccess);
320
+ * ```
321
+ */
322
+ const getPortEntriesFromRawAccess = (key, make) => (rawAccess) => Iterable.map(rawAccess[key], ([id, raw]) => [id, make(raw)]);
323
+ /**
324
+ * @internal
325
+ * @example
326
+ * ```ts
327
+ * declare const rawAccess: MIDIAccess;
328
+ *
329
+ * for (const [inputId, inputPort] of getInputEntriesFromRaw(rawAccess)) {
330
+ * // ^ ^? EMIDIInput.EMIDIInput
331
+ * // ^? EMIDIInput.Id
332
+ * }
333
+ * ```
334
+ */
335
+ const getInputEntriesFromRaw = getPortEntriesFromRawAccess('inputs', EMIDIInput.make);
336
+ /**
337
+ * @internal
338
+ * @example
339
+ * ```ts
340
+ * declare const rawAccess: MIDIAccess;
341
+ *
342
+ * for (const [outputId, outputPort] of getOutputEntriesFromRaw(rawAccess)) {
343
+ * // ^ ^? EMIDIOutput.EMIDIOutput
344
+ * // ^? EMIDIOutput.Id
345
+ * }
346
+ * ```
347
+ */
348
+ const getOutputEntriesFromRaw = getPortEntriesFromRawAccess('outputs', EMIDIOutput.make);
349
+ /**
350
+ * A single iterable with both inputs and outputs port entries from a raw {@linkcode MIDIAccess} instance.
351
+ *
352
+ * @internal
353
+ * @example
354
+ * ```ts
355
+ * declare const rawAccess: MIDIAccess;
356
+ *
357
+ * for (const entry of getOutputEntriesFromRaw(rawAccess)) {
358
+ * if (entry[1].type === 'input') {
359
+ * const [inputId, inputPort] = entry
360
+ * // ^ ^? EMIDIInput.EMIDIInput
361
+ * // ^? EMIDIInput.Id
362
+ * } else {
363
+ * const [outputId, outputPort] = entry
364
+ * // ^ ^? EMIDIOutput.EMIDIOutput
365
+ * // ^? EMIDIOutput.Id
366
+ * }
367
+ * }
368
+ * ```
369
+ */
370
+ const getAllPortsEntriesFromRaw = raw => Iterable.appendAll(getInputEntriesFromRaw(raw), getOutputEntriesFromRaw(raw));
371
+ /**
372
+ *
373
+ * @param getRecordEntriesFromRawAccess Function taking raw {@linkcode MIDIAccess} and returning `[EMIDIPort.Id, EMIDIPort.EMIDIPort]` tuples
374
+ * @returns Function taking {@linkcode PolymorphicAccessInstance|EMIDIAccess.PolymorphicInstance} and returning `Record<Id, EMIDIPort>`
375
+ * @internal
376
+ * @example
377
+ * ```ts
378
+ * import * as EMIDIAccess from 'effect-web-midi/EMIDIAccess';
379
+ * import * as EMIDIInput from 'effect-web-midi/EMIDIInput';
380
+ * import * as Effect from 'effect/Effect';
381
+ *
382
+ * const decorated = decorateToTakePolymorphicAccessAndReturnRecord(
383
+ * getInputEntriesFromRaw
384
+ * );
385
+ * const inputsEffect = decorated(EMIDIAccess.request());
386
+ * const inputs = await Effect.runPromise(inputsEffect);
387
+ * // ^? EMIDIInput.IdToInstanceMap
388
+ * ```
389
+ */
390
+ const decorateToTakePolymorphicAccessAndReturnRecord = (getRecordEntriesFromRawAccess) => (polymorphicAccess => Effect.map(simplify(polymorphicAccess), EFunction.flow(assumeImpl, impl => impl._access, getRecordEntriesFromRawAccess, Record.fromEntries)));
391
+ /**
392
+ * Because `MIDIInputMap` can potentially be a mutable object, meaning new
393
+ * devices can be added or removed at runtime, it is effectful.
394
+ *
395
+ * The **`inputs`** read-only property of the MIDIAccess interface provides
396
+ * access to any available MIDI input ports.
397
+ *
398
+ * [MDN
399
+ * Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/inputs)
400
+ */
401
+ export const getInputsRecord = decorateToTakePolymorphicAccessAndReturnRecord(getInputEntriesFromRaw);
402
+ /**
403
+ * Because `MIDIOutputMap` can potentially be a mutable object, meaning new
404
+ * devices can be added or removed at runtime, it is effectful.
405
+ *
406
+ * The **`outputs`** read-only property of the MIDIAccess interface provides
407
+ * access to any available MIDI output ports.
408
+ *
409
+ * [MDN
410
+ * Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/outputs)
411
+ */
412
+ export const getOutputsRecord = decorateToTakePolymorphicAccessAndReturnRecord(getOutputEntriesFromRaw);
413
+ /**
414
+ *
415
+ *
416
+ */
417
+ export const getAllPortsRecord = decorateToTakePolymorphicAccessAndReturnRecord(getAllPortsEntriesFromRaw);
418
+ /**
419
+ *
420
+ *
421
+ */
422
+ export const InputsRecord = getInputsRecord(EMIDIAccess);
423
+ /**
424
+ *
425
+ *
426
+ */
427
+ export const OutputsRecord = getOutputsRecord(EMIDIAccess);
428
+ /**
429
+ *
430
+ *
431
+ */
432
+ export const AllPortsRecord = getAllPortsRecord(EMIDIAccess);
433
+ /**
434
+ * Because `MIDIInputMap` can potentially be a mutable object, meaning new
435
+ * devices can be added or removed at runtime, it is effectful.
436
+ *
437
+ * The **`inputs`** read-only property of the MIDIAccess interface provides
438
+ * access to any available MIDI input ports.
439
+ *
440
+ * [MDN
441
+ * Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/inputs)
442
+ */
443
+ export const getInputsArray = EFunction.flow(getInputsRecord, Effect.map(Record.values));
444
+ /**
445
+ * Because `MIDIOutputMap` can potentially be a mutable object, meaning new
446
+ * devices can be added or removed at runtime, it is effectful.
447
+ *
448
+ * The **`outputs`** read-only property of the MIDIAccess interface provides
449
+ * access to any available MIDI output ports.
450
+ *
451
+ * [MDN
452
+ * Reference](https://developer.mozilla.org/docs/Web/API/MIDIAccess/outputs)
453
+ */
454
+ export const getOutputsArray = EFunction.flow(getOutputsRecord, Effect.map(Record.values));
455
+ /**
456
+ *
457
+ *
458
+ */
459
+ export const getAllPortsArray = EFunction.flow(getAllPortsRecord, Effect.map(Record.values));
460
+ /**
461
+ *
462
+ *
463
+ */
464
+ export const InputsArray = getInputsArray(EMIDIAccess);
465
+ /**
466
+ *
467
+ *
468
+ */
469
+ export const OutputsArray = getOutputsArray(EMIDIAccess);
470
+ /**
471
+ *
472
+ *
473
+ */
474
+ export const AllPortsArray = getAllPortsArray(EMIDIAccess);
475
+ /**
476
+ * [MIDIConnectionEvent MDN
477
+ * Reference](https://developer.mozilla.org/docs/Web/API/MIDIConnectionEvent)
478
+ */
479
+ export const makeAllPortsStateChangesStream = StreamMaker.createStreamMakerFrom()(is, access => ({
480
+ tag: 'MIDIPortStateChange',
481
+ eventListener: {
482
+ target: assumeImpl(access)._access,
483
+ type: 'statechange',
484
+ },
485
+ spanAttributes: {
486
+ spanTargetName: 'MIDI access handle',
487
+ requestedAccessConfig: assumeImpl(access)._config,
488
+ },
489
+ nullableFieldName: 'port',
490
+ }), rawPort => ({
491
+ newState: rawPort
492
+ ? {
493
+ ofDevice: rawPort.state,
494
+ ofConnection: rawPort.connection,
495
+ }
496
+ : null,
497
+ port: rawPort instanceof globalThis.MIDIInput
498
+ ? EMIDIInput.make(rawPort)
499
+ : rawPort instanceof globalThis.MIDIOutput
500
+ ? EMIDIOutput.make(rawPort)
501
+ : null,
502
+ }));
503
+ /**
504
+ * beware that it's not possible to ensure the messages will either be all
505
+ * delivered, or all not delivered, as in ACID transactions. There's not even a
506
+ * mechanism to remove a specific message (not all) from the sending queue
507
+ */
508
+ export const send = EFunction.dual(Util.polymorphicCheckInDual(is), Effect.fn('EMIDIAccess.send')(function* (polymorphicAccess, target, midiMessage, timestamp) {
509
+ const access = yield* simplify(polymorphicAccess);
510
+ const outputs = yield* getOutputsRecord(access);
511
+ if (target === 'all existing outputs at effect execution')
512
+ return yield* EFunction.pipe(Record.values(outputs), Effect.forEach(EMIDIOutput.send(midiMessage, timestamp)), Effect.as(access));
513
+ if (target === 'all open connections at effect execution')
514
+ return yield* EFunction.pipe(Record.values(outputs),
515
+ // TODO: maybe also do something about pending?
516
+ Effect.filter(Check.isOutputConnectionOpenByPort), Effect.flatMap(Effect.forEach(EMIDIOutput.send(midiMessage, timestamp))), Effect.as(access));
517
+ // TODO: maybe since deviceState returns always connected devices we can
518
+ // simplify this check by applying intersections and comparing lengths
519
+ const portsIdsToSend = EArray.ensure(target);
520
+ const deviceStatusesEffect = portsIdsToSend.map(id => EFunction.pipe(Record.get(outputs, id), Option.match({
521
+ onNone: () => Effect.succeed('disconnected'),
522
+ onSome: EFunction.flow(GetProperty.getOutputDeviceStateByPort),
523
+ }), effect => Unify.unify(effect), Effect.map(state => ({ id, state }))));
524
+ const disconnectedDevice = EArray.findFirst(yield* Effect.all(deviceStatusesEffect), _ => _.state === 'disconnected');
525
+ if (Option.isSome(disconnectedDevice))
526
+ return yield* new MIDIErrors.CannotSendToDisconnectedPortError({
527
+ portId: disconnectedDevice.value.id,
528
+ cause: new DOMException(
529
+ // TODO: make an experiment and paste the error text here
530
+ 'TODO: imitate there an error thats thrown when the port is disconnected', 'InvalidStateError'),
531
+ });
532
+ const sendToSome = (predicate) => Effect.all(Record.reduce(outputs, [],
533
+ // TODO: investigate what the fuck is going on, why the fuck can't I
534
+ // make it a simple expression without either nesting it in
535
+ // curly-braced function body or adding manual type-annotation
536
+ (acc, port, id) => predicate(id)
537
+ ? [
538
+ ...acc,
539
+ EMIDIOutput.send(port, midiMessage, timestamp),
540
+ ]
541
+ : acc));
542
+ yield* sendToSome(id => portsIdsToSend.includes(id));
543
+ return access;
544
+ }));
545
+ /**
546
+ * @param options Passing a value of a `boolean` type is equivalent to setting
547
+ * `options.capture` property
548
+ */
549
+ export const makeMessagesStreamByInputId = (id, options) => EMIDIInput.makeMessagesStreamByPort(GetPort.getInputByPortIdInContext(id), options);
550
+ // TODO: makeMessagesStreamByInputIdAndAccess
551
+ export const makeMessagesStreamByInputIdAndAccess = () => {
552
+ throw new Error('Not implemented 😿 YET!! 🤩');
553
+ };
554
+ /**
555
+ *
556
+ */
557
+ export const sendToPortById = (id, ...args) => Effect.asVoid(EMIDIOutput.send(GetPort.getOutputByPortIdInContext(id), ...args));
558
+ /**
559
+ *
560
+ */
561
+ export const clearPortById = EFunction.flow(GetPort.getOutputByPortIdInContext, EMIDIOutput.clear, Effect.asVoid);
562
+ /**
563
+ * @param options Passing a value of a `boolean` type is equivalent to setting
564
+ * `options.capture` property
565
+ */
566
+ export const makeAllPortsStateChangesStreamInContext = (options) => makeAllPortsStateChangesStream(EMIDIAccess, options);
567
+ /**
568
+ *
569
+ *
570
+ */
571
+ export const sendInContext = (...args) => Effect.asVoid(send(EMIDIAccess, ...args));
572
+ /**
573
+ * @param options
574
+ *
575
+ * @returns An Effect representing a request for access to MIDI devices on a
576
+ * user's system. Available only in secure contexts.
577
+ */
578
+ export const request = Effect.fn('EMIDIAccess.request')(function* (options) {
579
+ yield* Effect.annotateCurrentSpan({ options });
580
+ const rawAccess = yield* Effect.tryPromise({
581
+ try: () => navigator.requestMIDIAccess(options),
582
+ catch: MIDIErrors.remapErrorByName({
583
+ AbortError: MIDIErrors.AbortError,
584
+ InvalidStateError: MIDIErrors.UnderlyingSystemError,
585
+ NotAllowedError: MIDIErrors.MIDIAccessNotAllowedError,
586
+ // SecurityError is kept for compatibility reason
587
+ // (https://github.com/WebAudio/web-midi-api/pull/267):
588
+ SecurityError: MIDIErrors.MIDIAccessNotAllowedError,
589
+ NotSupportedError: MIDIErrors.MIDIAccessNotSupportedError,
590
+ // For case when navigator doesn't exist
591
+ ReferenceError: MIDIErrors.MIDIAccessNotSupportedError,
592
+ // For case when navigator.requestMIDIAccess is undefined
593
+ TypeError: MIDIErrors.MIDIAccessNotSupportedError,
594
+ }, 'EMIDIAccess.request error handling absurd', { whileAskingForPermissions: options ?? {} }),
595
+ });
596
+ // TODO: finish this
597
+ const _ref = yield* Ref.make(SortedMap.empty(Order.string));
598
+ // return make(rawAccess, options, ref)
599
+ return make(rawAccess, options);
600
+ });
601
+ // TODO: clear all outputs
602
+ /**
603
+ *
604
+ * **Errors:**
605
+ *
606
+ * - {@linkcode MIDIErrors.AbortError} Description
607
+ * - {@linkcode MIDIErrors.UnderlyingSystemError} Description
608
+ * - {@linkcode MIDIErrors.MIDIAccessNotSupportedError} Description
609
+ * - {@linkcode MIDIErrors.MIDIAccessNotAllowedError} Description
610
+ *
611
+ * @param config
612
+ * @returns
613
+ */
614
+ export const layer = (config) => Layer.effect(EMIDIAccess, request(config));
615
+ /**
616
+ *
617
+ */
618
+ export const layerMostRestricted = layer();
619
+ /**
620
+ *
621
+ */
622
+ export const layerSystemExclusiveSupported = layer({ sysex: true });
623
+ /**
624
+ *
625
+ */
626
+ export const layerSoftwareSynthSupported = layer({ software: true });
627
+ /**
628
+ *
629
+ */
630
+ export const layerSystemExclusiveAndSoftwareSynthSupported = layer({
631
+ software: true,
632
+ sysex: true,
633
+ });
634
+ //# sourceMappingURL=EMIDIAccess.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EMIDIAccess.js","sourceRoot":"","sources":["../../../src/internal/EMIDIAccess.ts"],"names":[],"mappings":"AAAA;gEACgE;AAEhE,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAA;AACnC,OAAO,KAAK,WAAW,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