@ovok/native 1.17.0-dev.2215 → 1.17.0-dev.2222

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 (261) hide show
  1. package/lib/commonjs/modules/next/bluetooth/adapters/android-foreground-service.js +58 -5
  2. package/lib/commonjs/modules/next/bluetooth/adapters/android-foreground-service.js.map +1 -1
  3. package/lib/commonjs/modules/next/bluetooth/adapters/ecg-measurements.js +25 -0
  4. package/lib/commonjs/modules/next/bluetooth/adapters/ecg-measurements.js.map +1 -0
  5. package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js +62 -0
  6. package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js.map +1 -0
  7. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js +42 -0
  8. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -0
  9. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js +97 -96
  10. package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
  11. package/lib/commonjs/modules/next/bluetooth/adapters/reading-source-id.js +33 -0
  12. package/lib/commonjs/modules/next/bluetooth/adapters/reading-source-id.js.map +1 -0
  13. package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js +38 -0
  14. package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js.map +1 -0
  15. package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js +101 -0
  16. package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js.map +1 -0
  17. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-database.js +24 -0
  18. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-database.js.map +1 -0
  19. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-rows.js +65 -0
  20. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-rows.js.map +1 -0
  21. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-schema.js +53 -0
  22. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-schema.js.map +1 -0
  23. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-store.js +82 -0
  24. package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-store.js.map +1 -0
  25. package/lib/commonjs/modules/next/bluetooth/adapters/storage-paired-devices.js +1 -0
  26. package/lib/commonjs/modules/next/bluetooth/adapters/storage-paired-devices.js.map +1 -1
  27. package/lib/commonjs/modules/next/bluetooth/core/bluetooth.js +9 -3
  28. package/lib/commonjs/modules/next/bluetooth/core/bluetooth.js.map +1 -1
  29. package/lib/commonjs/modules/next/bluetooth/core/device-deps.js +6 -0
  30. package/lib/commonjs/modules/next/bluetooth/core/device-deps.js.map +1 -0
  31. package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js +3 -1
  32. package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
  33. package/lib/commonjs/modules/next/bluetooth/core/device.js +19 -6
  34. package/lib/commonjs/modules/next/bluetooth/core/device.js.map +1 -1
  35. package/lib/commonjs/modules/next/bluetooth/core/live-ledger.js +54 -0
  36. package/lib/commonjs/modules/next/bluetooth/core/live-ledger.js.map +1 -0
  37. package/lib/commonjs/modules/next/bluetooth/core/measuring-watch.js +59 -0
  38. package/lib/commonjs/modules/next/bluetooth/core/measuring-watch.js.map +1 -0
  39. package/lib/commonjs/modules/next/bluetooth/core/outbox-watch.js +17 -0
  40. package/lib/commonjs/modules/next/bluetooth/core/outbox-watch.js.map +1 -0
  41. package/lib/commonjs/modules/next/bluetooth/core/paired-device.js +1 -0
  42. package/lib/commonjs/modules/next/bluetooth/core/paired-device.js.map +1 -1
  43. package/lib/commonjs/modules/next/bluetooth/core/ports.js.map +1 -1
  44. package/lib/commonjs/modules/next/bluetooth/core/reading-log.js +89 -7
  45. package/lib/commonjs/modules/next/bluetooth/core/reading-log.js.map +1 -1
  46. package/lib/commonjs/modules/next/bluetooth/core/series-slots.js +94 -0
  47. package/lib/commonjs/modules/next/bluetooth/core/series-slots.js.map +1 -0
  48. package/lib/commonjs/modules/next/bluetooth/core/stream-recorder.js +219 -0
  49. package/lib/commonjs/modules/next/bluetooth/core/stream-recorder.js.map +1 -0
  50. package/lib/commonjs/modules/next/bluetooth/core/waveform-segments.js +110 -0
  51. package/lib/commonjs/modules/next/bluetooth/core/waveform-segments.js.map +1 -0
  52. package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js +19 -11
  53. package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js.map +1 -1
  54. package/lib/commonjs/modules/next/bluetooth/families/viatom/bp2-real-time.js +6 -0
  55. package/lib/commonjs/modules/next/bluetooth/families/viatom/bp2-real-time.js.map +1 -1
  56. package/lib/commonjs/modules/next/bluetooth/families/viatom/recorder-real-time.js +12 -4
  57. package/lib/commonjs/modules/next/bluetooth/families/viatom/recorder-real-time.js.map +1 -1
  58. package/lib/commonjs/modules/next/bluetooth/shared.js +14 -0
  59. package/lib/commonjs/modules/next/bluetooth/shared.js.map +1 -1
  60. package/lib/commonjs/modules/next/bluetooth/sqlite/index.js +13 -0
  61. package/lib/commonjs/modules/next/bluetooth/sqlite/index.js.map +1 -0
  62. package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js +2 -0
  63. package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
  64. package/lib/module/modules/next/bluetooth/adapters/android-foreground-service.js +59 -6
  65. package/lib/module/modules/next/bluetooth/adapters/android-foreground-service.js.map +1 -1
  66. package/lib/module/modules/next/bluetooth/adapters/ecg-measurements.js +22 -0
  67. package/lib/module/modules/next/bluetooth/adapters/ecg-measurements.js.map +1 -0
  68. package/lib/module/modules/next/bluetooth/adapters/live-supersession.js +59 -0
  69. package/lib/module/modules/next/bluetooth/adapters/live-supersession.js.map +1 -0
  70. package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js +38 -0
  71. package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -0
  72. package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js +76 -75
  73. package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
  74. package/lib/module/modules/next/bluetooth/adapters/reading-source-id.js +27 -0
  75. package/lib/module/modules/next/bluetooth/adapters/reading-source-id.js.map +1 -0
  76. package/lib/module/modules/next/bluetooth/adapters/reading-values.js +33 -0
  77. package/lib/module/modules/next/bluetooth/adapters/reading-values.js.map +1 -0
  78. package/lib/module/modules/next/bluetooth/adapters/series-saving.js +94 -0
  79. package/lib/module/modules/next/bluetooth/adapters/series-saving.js.map +1 -0
  80. package/lib/module/modules/next/bluetooth/adapters/sqlite-database.js +20 -0
  81. package/lib/module/modules/next/bluetooth/adapters/sqlite-database.js.map +1 -0
  82. package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-rows.js +59 -0
  83. package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-rows.js.map +1 -0
  84. package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-schema.js +49 -0
  85. package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-schema.js.map +1 -0
  86. package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-store.js +79 -0
  87. package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-store.js.map +1 -0
  88. package/lib/module/modules/next/bluetooth/adapters/storage-paired-devices.js +1 -0
  89. package/lib/module/modules/next/bluetooth/adapters/storage-paired-devices.js.map +1 -1
  90. package/lib/module/modules/next/bluetooth/core/bluetooth.js +9 -3
  91. package/lib/module/modules/next/bluetooth/core/bluetooth.js.map +1 -1
  92. package/lib/module/modules/next/bluetooth/core/device-deps.js +4 -0
  93. package/lib/module/modules/next/bluetooth/core/device-deps.js.map +1 -0
  94. package/lib/module/modules/next/bluetooth/core/device-snapshot.js +3 -1
  95. package/lib/module/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
  96. package/lib/module/modules/next/bluetooth/core/device.js +19 -6
  97. package/lib/module/modules/next/bluetooth/core/device.js.map +1 -1
  98. package/lib/module/modules/next/bluetooth/core/live-ledger.js +50 -0
  99. package/lib/module/modules/next/bluetooth/core/live-ledger.js.map +1 -0
  100. package/lib/module/modules/next/bluetooth/core/measuring-watch.js +55 -0
  101. package/lib/module/modules/next/bluetooth/core/measuring-watch.js.map +1 -0
  102. package/lib/module/modules/next/bluetooth/core/outbox-watch.js +14 -0
  103. package/lib/module/modules/next/bluetooth/core/outbox-watch.js.map +1 -0
  104. package/lib/module/modules/next/bluetooth/core/paired-device.js +1 -0
  105. package/lib/module/modules/next/bluetooth/core/paired-device.js.map +1 -1
  106. package/lib/module/modules/next/bluetooth/core/ports.js.map +1 -1
  107. package/lib/module/modules/next/bluetooth/core/reading-log.js +89 -7
  108. package/lib/module/modules/next/bluetooth/core/reading-log.js.map +1 -1
  109. package/lib/module/modules/next/bluetooth/core/series-slots.js +90 -0
  110. package/lib/module/modules/next/bluetooth/core/series-slots.js.map +1 -0
  111. package/lib/module/modules/next/bluetooth/core/stream-recorder.js +215 -0
  112. package/lib/module/modules/next/bluetooth/core/stream-recorder.js.map +1 -0
  113. package/lib/module/modules/next/bluetooth/core/waveform-segments.js +106 -0
  114. package/lib/module/modules/next/bluetooth/core/waveform-segments.js.map +1 -0
  115. package/lib/module/modules/next/bluetooth/create-bluetooth.js +19 -11
  116. package/lib/module/modules/next/bluetooth/create-bluetooth.js.map +1 -1
  117. package/lib/module/modules/next/bluetooth/families/viatom/bp2-real-time.js +6 -0
  118. package/lib/module/modules/next/bluetooth/families/viatom/bp2-real-time.js.map +1 -1
  119. package/lib/module/modules/next/bluetooth/families/viatom/recorder-real-time.js +12 -4
  120. package/lib/module/modules/next/bluetooth/families/viatom/recorder-real-time.js.map +1 -1
  121. package/lib/module/modules/next/bluetooth/shared.js +2 -0
  122. package/lib/module/modules/next/bluetooth/shared.js.map +1 -1
  123. package/lib/module/modules/next/bluetooth/sqlite/index.js +10 -0
  124. package/lib/module/modules/next/bluetooth/sqlite/index.js.map +1 -0
  125. package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js +2 -0
  126. package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
  127. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts +17 -4
  128. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts.map +1 -1
  129. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts +6 -0
  130. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts.map +1 -0
  131. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts +9 -0
  132. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -0
  133. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts +8 -0
  134. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -0
  135. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +9 -3
  136. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
  137. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-source-id.d.ts +9 -0
  138. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-source-id.d.ts.map +1 -0
  139. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-values.d.ts +9 -0
  140. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -0
  141. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts +28 -0
  142. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -0
  143. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-database.d.ts +23 -0
  144. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-database.d.ts.map +1 -0
  145. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts +29 -0
  146. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts.map +1 -0
  147. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts +6 -0
  148. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts.map +1 -0
  149. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts +38 -0
  150. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts.map +1 -0
  151. package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/storage-paired-devices.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth-options.d.ts +3 -0
  153. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth-options.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth.d.ts.map +1 -1
  155. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-deps.d.ts +16 -0
  156. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-deps.d.ts.map +1 -0
  157. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts +5 -0
  158. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
  159. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts +6 -13
  160. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
  161. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-ledger.d.ts +13 -0
  162. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-ledger.d.ts.map +1 -0
  163. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/measuring-watch.d.ts +22 -0
  164. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/measuring-watch.d.ts.map +1 -0
  165. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/outbox-watch.d.ts +27 -0
  166. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/outbox-watch.d.ts.map +1 -0
  167. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/paired-device.d.ts +3 -1
  168. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/paired-device.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/ports.d.ts +3 -2
  170. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/ports.d.ts.map +1 -1
  171. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading-log.d.ts +25 -6
  172. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading-log.d.ts.map +1 -1
  173. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts +18 -1
  174. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/series-slots.d.ts +35 -0
  176. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/series-slots.d.ts.map +1 -0
  177. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/stream-recorder.d.ts +58 -0
  178. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/stream-recorder.d.ts.map +1 -0
  179. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/waveform-segments.d.ts +26 -0
  180. package/lib/typescript/commonjs/src/modules/next/bluetooth/core/waveform-segments.d.ts.map +1 -0
  181. package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts +3 -2
  182. package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
  183. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/viatom/bp2-real-time.d.ts.map +1 -1
  184. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts +1 -1
  185. package/lib/typescript/commonjs/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts.map +1 -1
  186. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +1 -1
  187. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
  188. package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts +5 -1
  189. package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts.map +1 -1
  190. package/lib/typescript/commonjs/src/modules/next/bluetooth/sqlite/index.d.ts +10 -0
  191. package/lib/typescript/commonjs/src/modules/next/bluetooth/sqlite/index.d.ts.map +1 -0
  192. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +3 -2
  193. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
  194. package/lib/typescript/module/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts +17 -4
  195. package/lib/typescript/module/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts.map +1 -1
  196. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts +6 -0
  197. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts.map +1 -0
  198. package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts +9 -0
  199. package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -0
  200. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts +8 -0
  201. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -0
  202. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +9 -3
  203. package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
  204. package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-source-id.d.ts +9 -0
  205. package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-source-id.d.ts.map +1 -0
  206. package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-values.d.ts +9 -0
  207. package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -0
  208. package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts +28 -0
  209. package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -0
  210. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-database.d.ts +23 -0
  211. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-database.d.ts.map +1 -0
  212. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts +29 -0
  213. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts.map +1 -0
  214. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts +6 -0
  215. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts.map +1 -0
  216. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts +38 -0
  217. package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts.map +1 -0
  218. package/lib/typescript/module/src/modules/next/bluetooth/adapters/storage-paired-devices.d.ts.map +1 -1
  219. package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth-options.d.ts +3 -0
  220. package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth-options.d.ts.map +1 -1
  221. package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth.d.ts.map +1 -1
  222. package/lib/typescript/module/src/modules/next/bluetooth/core/device-deps.d.ts +16 -0
  223. package/lib/typescript/module/src/modules/next/bluetooth/core/device-deps.d.ts.map +1 -0
  224. package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts +5 -0
  225. package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
  226. package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts +6 -13
  227. package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
  228. package/lib/typescript/module/src/modules/next/bluetooth/core/live-ledger.d.ts +13 -0
  229. package/lib/typescript/module/src/modules/next/bluetooth/core/live-ledger.d.ts.map +1 -0
  230. package/lib/typescript/module/src/modules/next/bluetooth/core/measuring-watch.d.ts +22 -0
  231. package/lib/typescript/module/src/modules/next/bluetooth/core/measuring-watch.d.ts.map +1 -0
  232. package/lib/typescript/module/src/modules/next/bluetooth/core/outbox-watch.d.ts +27 -0
  233. package/lib/typescript/module/src/modules/next/bluetooth/core/outbox-watch.d.ts.map +1 -0
  234. package/lib/typescript/module/src/modules/next/bluetooth/core/paired-device.d.ts +3 -1
  235. package/lib/typescript/module/src/modules/next/bluetooth/core/paired-device.d.ts.map +1 -1
  236. package/lib/typescript/module/src/modules/next/bluetooth/core/ports.d.ts +3 -2
  237. package/lib/typescript/module/src/modules/next/bluetooth/core/ports.d.ts.map +1 -1
  238. package/lib/typescript/module/src/modules/next/bluetooth/core/reading-log.d.ts +25 -6
  239. package/lib/typescript/module/src/modules/next/bluetooth/core/reading-log.d.ts.map +1 -1
  240. package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts +18 -1
  241. package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
  242. package/lib/typescript/module/src/modules/next/bluetooth/core/series-slots.d.ts +35 -0
  243. package/lib/typescript/module/src/modules/next/bluetooth/core/series-slots.d.ts.map +1 -0
  244. package/lib/typescript/module/src/modules/next/bluetooth/core/stream-recorder.d.ts +58 -0
  245. package/lib/typescript/module/src/modules/next/bluetooth/core/stream-recorder.d.ts.map +1 -0
  246. package/lib/typescript/module/src/modules/next/bluetooth/core/waveform-segments.d.ts +26 -0
  247. package/lib/typescript/module/src/modules/next/bluetooth/core/waveform-segments.d.ts.map +1 -0
  248. package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts +3 -2
  249. package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
  250. package/lib/typescript/module/src/modules/next/bluetooth/families/viatom/bp2-real-time.d.ts.map +1 -1
  251. package/lib/typescript/module/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts +1 -1
  252. package/lib/typescript/module/src/modules/next/bluetooth/families/viatom/recorder-real-time.d.ts.map +1 -1
  253. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +1 -1
  254. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
  255. package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts +5 -1
  256. package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts.map +1 -1
  257. package/lib/typescript/module/src/modules/next/bluetooth/sqlite/index.d.ts +10 -0
  258. package/lib/typescript/module/src/modules/next/bluetooth/sqlite/index.d.ts.map +1 -0
  259. package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +3 -2
  260. package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
  261. package/package.json +7 -3
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  import { NativeModules, Platform } from "react-native";
4
- import { noKeepAlive } from "../core/ports.js";
4
+ import { noOutboxWatch } from "../core/outbox-watch.js";
5
+ import { noKeepAlive, silentLogger } from "../core/ports.js";
5
6
 
6
7
  /** The notification Android shows while the service runs. */
7
8
 
9
+ /** What the service watches and reports besides its text. */
10
+
8
11
  const nativeService = () => {
9
12
  const service = NativeModules.OvokBackgroundSync;
10
13
  if (!service) {
@@ -12,11 +15,61 @@ const nativeService = () => {
12
15
  }
13
16
  return service;
14
17
  };
18
+ const describeUnsent = unsent => `${unsent} ${unsent === 1 ? "reading" : "readings"} waiting to upload`;
19
+
20
+ /** The text for the native module: the function is dropped, and the body names the unsent count while there is one. */
21
+ const textFor = ({
22
+ unsentBody = describeUnsent,
23
+ ...text
24
+ }, unsent) => unsent > 0 ? {
25
+ ...text,
26
+ notificationBody: unsentBody(unsent)
27
+ } : text;
28
+
29
+ /** Android re-posts the same notification when the service is started again, which is how the text changes. */
30
+ class AndroidForegroundService {
31
+ stopWatching = null;
32
+ shownUnsent = 0;
33
+ constructor(text, outbox, logger) {
34
+ this.text = text;
35
+ this.outbox = outbox;
36
+ this.logger = logger;
37
+ }
38
+ start = async () => {
39
+ this.stopWatching?.();
40
+ this.shownUnsent = 0;
41
+
42
+ // Watch before the first await, so a stop that follows at once also ends the watching.
43
+ this.stopWatching = this.outbox.subscribe(({
44
+ waiting
45
+ }) => this.showCount(waiting.size));
46
+ await this.show();
47
+ };
48
+ stop = async () => {
49
+ this.stopWatching?.();
50
+ this.stopWatching = null;
51
+ await nativeService().stopBluetoothForegroundService();
52
+ };
53
+ showCount(unsent) {
54
+ if (unsent !== this.shownUnsent) {
55
+ this.shownUnsent = unsent;
56
+ this.show().catch(() => this.logger.error("bluetooth.keep-alive.notification-failed", {
57
+ unsent
58
+ }));
59
+ }
60
+ }
61
+ show() {
62
+ return nativeService().startBluetoothForegroundService(textFor(this.text, this.shownUnsent));
63
+ }
64
+ }
15
65
 
16
- /** Android's connected-device foreground service, which keeps the process alive for background sync; nothing elsewhere. */
17
- const androidForegroundService = (text = {}) => Platform.OS === "android" ? {
18
- start: async () => nativeService().startBluetoothForegroundService(text),
19
- stop: async () => nativeService().stopBluetoothForegroundService()
20
- } : noKeepAlive;
66
+ /**
67
+ * Android's connected-device foreground service, which keeps the process alive for background sync; nothing elsewhere.
68
+ * With an `outbox`, its notification says how many readings wait to upload.
69
+ */
70
+ const androidForegroundService = (text = {}, {
71
+ outbox = noOutboxWatch,
72
+ logger = silentLogger
73
+ } = {}) => Platform.OS === "android" ? new AndroidForegroundService(text, outbox, logger) : noKeepAlive;
21
74
  export { androidForegroundService };
22
75
  //# sourceMappingURL=android-foreground-service.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","noKeepAlive","nativeService","service","OvokBackgroundSync","Error","androidForegroundService","text","OS","start","startBluetoothForegroundService","stop","stopBluetoothForegroundService"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/android-foreground-service.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,SAAoBC,WAAW,QAAQ,kBAAe;;AAEtD;;AAeA,MAAMC,aAAa,GAAGA,CAAA,KAA+B;EACnD,MAAMC,OAAO,GAAGJ,aAAa,CAACK,kBAAyD;EAEvF,IAAI,CAACD,OAAO,EAAE;IACZ,MAAM,IAAIE,KAAK,CAAC,2FAA2F,CAAC;EAC9G;EAEA,OAAOF,OAAO;AAChB,CAAC;;AAED;AACA,MAAMG,wBAAwB,GAAGA,CAACC,IAA2B,GAAG,CAAC,CAAC,KAChEP,QAAQ,CAACQ,EAAE,KAAK,SAAS,GACrB;EACEC,KAAK,EAAE,MAAAA,CAAA,KAAYP,aAAa,CAAC,CAAC,CAACQ,+BAA+B,CAACH,IAAI,CAAC;EACxEI,IAAI,EAAE,MAAAA,CAAA,KAAYT,aAAa,CAAC,CAAC,CAACU,8BAA8B,CAAC;AACnE,CAAC,GACDX,WAAW;AAEjB,SAASK,wBAAwB","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","Platform","noOutboxWatch","noKeepAlive","silentLogger","nativeService","service","OvokBackgroundSync","Error","describeUnsent","unsent","textFor","unsentBody","text","notificationBody","AndroidForegroundService","stopWatching","shownUnsent","constructor","outbox","logger","start","subscribe","waiting","showCount","size","show","stop","stopBluetoothForegroundService","catch","error","startBluetoothForegroundService","androidForegroundService","OS"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/android-foreground-service.ts"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,SAASC,aAAa,QAAqB,yBAAsB;AACjE,SAA4BC,WAAW,EAAEC,YAAY,QAAQ,kBAAe;;AAE5E;;AAaA;;AAiBA,MAAMC,aAAa,GAAGA,CAAA,KAA+B;EACnD,MAAMC,OAAO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C,CAAC;EACxD,CAAC;EAEOJ,SAASA,CAACd,MAAc,EAAQ;IACtC,IAAIA,MAAM,KAAK,IAAI,CAACO,WAAW,EAAE;MAC/B,IAAI,CAACA,WAAW,GAAGP,MAAM;MACzB,IAAI,CAACgB,IAAI,CAAC,CAAC,CAACG,KAAK,CAAC,MAAM,IAAI,CAACT,MAAM,CAACU,KAAK,CAAC,0CAA0C,EAAE;QAAEpB;MAAO,CAAC,CAAC,CAAC;IACpG;EACF;EAEQgB,IAAIA,CAAA,EAAkB;IAC5B,OAAOrB,aAAa,CAAC,CAAC,CAAC0B,+BAA+B,CAACpB,OAAO,CAAC,IAAI,CAACE,IAAI,EAAE,IAAI,CAACI,WAAW,CAAC,CAAC;EAC9F;AACF;;AAEA;AACA;AACA;AACA;AACA,MAAMe,wBAAwB,GAAGA,CAC/BnB,IAA2B,GAAG,CAAC,CAAC,EAChC;EAAEM,MAAM,GAAGjB,aAAa;EAAEkB,MAAM,GAAGhB;AAAuC,CAAC,GAAG,CAAC,CAAC,KACjEH,QAAQ,CAACgC,EAAE,KAAK,SAAS,GAAG,IAAIlB,wBAAwB,CAACF,IAAI,EAAEM,MAAM,EAAEC,MAAM,CAAC,GAAGjB,WAAY;AAE9G,SAAS6B,wBAAwB","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ import { MeasurementTypeKey } from "@ovok/core/next";
4
+ import { valueOf } from "./reading-values.js";
5
+
6
+ /** Ovok stores ECG points in millivolts; a trace in any other unit is left out rather than mislabelled. */
7
+ const ECG_POINT_UNIT = "mV";
8
+
9
+ /** One ECG recording per channel, each in millivolts at the waveform's sample rate; the heart rate goes with the first. */
10
+ const ecgMeasurements = reading => {
11
+ const waveform = reading.waveform?.unit === ECG_POINT_UNIT ? reading.waveform : undefined;
12
+ const channels = waveform?.samples ?? [new Int16Array(0)];
13
+ return channels.map((samples, index) => ({
14
+ measurementTypeKey: MeasurementTypeKey.ecg,
15
+ heartRate: index === 0 ? valueOf(reading, "heart_rate") : undefined,
16
+ diagramPoints: Array.from(samples, sample => sample * (waveform?.scale ?? 1)),
17
+ duration: waveform ? samples.length / waveform.sampleRateHz : undefined,
18
+ recordedAt: reading.takenAt ?? undefined
19
+ }));
20
+ };
21
+ export { ecgMeasurements };
22
+ //# sourceMappingURL=ecg-measurements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","valueOf","ECG_POINT_UNIT","ecgMeasurements","reading","waveform","unit","undefined","channels","samples","Int16Array","map","index","measurementTypeKey","ecg","heartRate","diagramPoints","Array","from","sample","scale","duration","length","sampleRateHz","recordedAt","takenAt"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ecg-measurements.ts"],"mappings":";;AAAA,SAAyBA,kBAAkB,QAAQ,iBAAiB;AAIpE,SAASC,OAAO,QAAQ,qBAAkB;;AAE1C;AACA,MAAMC,cAAc,GAAG,IAAI;;AAE3B;AACA,MAAMC,eAAe,GAAIC,OAAgB,IAAuB;EAC9D,MAAMC,QAAQ,GAAGD,OAAO,CAACC,QAAQ,EAAEC,IAAI,KAAKJ,cAAc,GAAGE,OAAO,CAACC,QAAQ,GAAGE,SAAS;EACzF,MAAMC,QAAQ,GAAGH,QAAQ,EAAEI,OAAO,IAAI,CAAC,IAAIC,UAAU,CAAC,CAAC,CAAC,CAAC;EAEzD,OAAOF,QAAQ,CAACG,GAAG,CAAC,CAACF,OAAO,EAAEG,KAAK,MAAM;IACvCC,kBAAkB,EAAEb,kBAAkB,CAACc,GAAG;IAC1CC,SAAS,EAAEH,KAAK,KAAK,CAAC,GAAGX,OAAO,CAACG,OAAO,EAAE,YAAY,CAAC,GAAGG,SAAS;IACnES,aAAa,EAAEC,KAAK,CAACC,IAAI,CAACT,OAAO,EAAGU,MAAM,IAAKA,MAAM,IAAId,QAAQ,EAAEe,KAAK,IAAI,CAAC,CAAC,CAAC;IAC/EC,QAAQ,EAAEhB,QAAQ,GAAGI,OAAO,CAACa,MAAM,GAAGjB,QAAQ,CAACkB,YAAY,GAAGhB,SAAS;IACvEiB,UAAU,EAAEpB,OAAO,CAACqB,OAAO,IAAIlB;EACjC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAASJ,eAAe","ignoreList":[]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ import { MeasurementTypeKey, SEGMENT_IDENTIFIER_SYSTEM } from "@ovok/core/next";
4
+ import { liveSourceId } from "./reading-source-id.js";
5
+ import { seriesFieldOf, seriesObservationsOf, signedInPatientId } from "./series-saving.js";
6
+
7
+ /** What queues the deletions: the outbox, with the measurements API and the session that name what to delete. */
8
+
9
+ const LIVE_SLOT_MS = 1_000;
10
+
11
+ /** The observations a live recording was saved as, rebuilt from its span alone; a single stand-in value gives each its identifiers. */
12
+ const observationsOfSpan = async (client, address, span) => {
13
+ const patientId = await signedInPatientId(client);
14
+ const sourceId = liveSourceId(address, span);
15
+ if (span.channel === null) {
16
+ const field = seriesFieldOf(span.metric);
17
+ return field ? seriesObservationsOf(field, {
18
+ start: span.from,
19
+ intervalMs: LIVE_SLOT_MS,
20
+ values: [0]
21
+ }, {
22
+ patientId,
23
+ sourceId
24
+ }) : [];
25
+ }
26
+ const measurement = {
27
+ measurementTypeKey: MeasurementTypeKey.ecg,
28
+ diagramPoints: [0],
29
+ duration: 1,
30
+ recordedAt: span.from
31
+ };
32
+ return client.measurements.build({
33
+ measurement,
34
+ sourceId,
35
+ patientId
36
+ });
37
+ };
38
+
39
+ /** The identifiers that name an observation for good; a segment's own depends on its sample count, which a span does not carry. */
40
+ const deleteTargetsOf = observations => observations.flatMap(({
41
+ identifier = []
42
+ }) => identifier.flatMap(({
43
+ system,
44
+ value
45
+ }) => system && value && system !== SEGMENT_IDENTIFIER_SYSTEM ? [{
46
+ system,
47
+ value
48
+ }] : []));
49
+
50
+ /** Queues the deletion of the live recordings a stored record replaces, so the outbox holds them before it holds the record. */
51
+ const replaceLiveRecordings = async (client, reading) => {
52
+ for (const span of reading.supersedes ?? []) {
53
+ for (const target of deleteTargetsOf(await observationsOfSpan(client, reading.source.address, span))) {
54
+ await client.outbox.enqueueDelete(target);
55
+ }
56
+ }
57
+ };
58
+ export { replaceLiveRecordings };
59
+ //# sourceMappingURL=live-supersession.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MeasurementTypeKey","SEGMENT_IDENTIFIER_SYSTEM","liveSourceId","seriesFieldOf","seriesObservationsOf","signedInPatientId","LIVE_SLOT_MS","observationsOfSpan","client","address","span","patientId","sourceId","channel","field","metric","start","from","intervalMs","values","measurement","measurementTypeKey","ecg","diagramPoints","duration","recordedAt","measurements","build","deleteTargetsOf","observations","flatMap","identifier","system","value","replaceLiveRecordings","reading","supersedes","target","source","outbox","enqueueDelete"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/live-supersession.ts"],"mappings":";;AAAA,SAAyBA,kBAAkB,EAAQC,yBAAyB,QAAQ,iBAAiB;AAMrG,SAASC,YAAY,QAAQ,wBAAqB;AAClD,SAASC,aAAa,EAAEC,oBAAoB,EAAEC,iBAAiB,QAAQ,oBAAiB;;AAExF;;AAGA,MAAMC,YAAY,GAAG,KAAK;;AAE1B;AACA,MAAMC,kBAAkB,GAAG,MAAAA,CAAOC,MAA0B,EAAEC,OAAe,EAAEC,IAAc,KAA6B;EACxH,MAAMC,SAAS,GAAG,MAAMN,iBAAiB,CAACG,MAAM,CAAC;EACjD,MAAMI,QAAQ,GAAGV,YAAY,CAACO,OAAO,EAAEC,IAAI,CAAC;EAE5C,IAAIA,IAAI,CAACG,OAAO,KAAK,IAAI,EAAE;IACzB,MAAMC,KAAK,GAAGX,aAAa,CAACO,IAAI,CAACK,MAAM,CAAC;IAExC,OAAOD,KAAK,GAAGV,oBAAoB,CAACU,KAAK,EAAE;MAAEE,KAAK,EAAEN,IAAI,CAACO,IAAI;MAAEC,UAAU,EAAEZ,YAAY;MAAEa,MAAM,EAAE,CAAC,CAAC;IAAE,CAAC,EAAE;MAAER,SAAS;MAAEC;IAAS,CAAC,CAAC,GAAG,EAAE;EACvI;EAEA,MAAMQ,WAA2B,GAAG;IAAEC,kBAAkB,EAAErB,kBAAkB,CAACsB,GAAG;IAAEC,aAAa,EAAE,CAAC,CAAC,CAAC;IAAEC,QAAQ,EAAE,CAAC;IAAEC,UAAU,EAAEf,IAAI,CAACO;EAAK,CAAC;EAE1I,OAAOT,MAAM,CAACkB,YAAY,CAACC,KAAK,CAAC;IAAEP,WAAW;IAAER,QAAQ;IAAED;EAAU,CAAC,CAAC;AACxE,CAAC;;AAED;AACA,MAAMiB,eAAe,GAAIC,YAAoC,IAC3DA,YAAY,CAACC,OAAO,CAAC,CAAC;EAAEC,UAAU,GAAG;AAAG,CAAC,KACvCA,UAAU,CAACD,OAAO,CAAC,CAAC;EAAEE,MAAM;EAAEC;AAAM,CAAC,KAAMD,MAAM,IAAIC,KAAK,IAAID,MAAM,KAAK/B,yBAAyB,GAAG,CAAC;EAAE+B,MAAM;EAAEC;AAAM,CAAC,CAAC,GAAG,EAAG,CAChI,CAAC;;AAEH;AACA,MAAMC,qBAAqB,GAAG,MAAAA,CAAO1B,MAA0B,EAAE2B,OAAgB,KAAoB;EACnG,KAAK,MAAMzB,IAAI,IAAIyB,OAAO,CAACC,UAAU,IAAI,EAAE,EAAE;IAC3C,KAAK,MAAMC,MAAM,IAAIT,eAAe,CAAC,MAAMrB,kBAAkB,CAACC,MAAM,EAAE2B,OAAO,CAACG,MAAM,CAAC7B,OAAO,EAAEC,IAAI,CAAC,CAAC,EAAE;MACpG,MAAMF,MAAM,CAAC+B,MAAM,CAACC,aAAa,CAACH,MAAM,CAAC;IAC3C;EACF;AACF,CAAC;AAED,SAASH,qBAAqB","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ import { silentLogger } from "../core/ports.js";
4
+ const idsOf = items => new Set(items.map(({
5
+ id
6
+ }) => id));
7
+ const itemsIn = (items, state) => idsOf(items.filter(item => item.state === state));
8
+ const viewOf = (items, sent) => ({
9
+ waiting: itemsIn(items, "pending"),
10
+ rejected: itemsIn(items, "rejected"),
11
+ sent: idsOf(sent)
12
+ });
13
+
14
+ /** Watches the signed-in account's Ovok outbox, so the reading log and the notification follow what it sends. */
15
+ const ovokOutboxWatch = (outbox, logger = silentLogger) => ({
16
+ subscribe: listener => {
17
+ let requests = 0;
18
+ let watching = true;
19
+
20
+ // The outbox's snapshot only says something changed; the items say what.
21
+ const stop = outbox.subscribe(() => {
22
+ const request = ++requests;
23
+ void outbox.items().then(items => {
24
+ if (watching && request === requests) {
25
+ listener(viewOf(items, outbox.recentlySent()));
26
+ }
27
+ }, error => logger.error("bluetooth.outbox-watch.failed", {
28
+ error: error.name
29
+ }));
30
+ });
31
+ return () => {
32
+ watching = false;
33
+ stop();
34
+ };
35
+ }
36
+ });
37
+ export { ovokOutboxWatch };
38
+ //# sourceMappingURL=ovok-outbox-watch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["silentLogger","idsOf","items","Set","map","id","itemsIn","state","filter","item","viewOf","sent","waiting","rejected","ovokOutboxWatch","outbox","logger","subscribe","listener","requests","watching","stop","request","then","recentlySent","error","name"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-outbox-watch.ts"],"mappings":";;AAGA,SAAiBA,YAAY,QAAQ,kBAAe;AAIpD,MAAMC,KAAK,GAAIC,KAAoC,IAAkB,IAAIC,GAAG,CAACD,KAAK,CAACE,GAAG,CAAC,CAAC;EAAEC;AAAG,CAAC,KAAKA,EAAE,CAAC,CAAC;AAEvG,MAAMC,OAAO,GAAGA,CAACJ,KAA0B,EAAEK,KAAkB,KAC7DN,KAAK,CAACC,KAAK,CAACM,MAAM,CAAEC,IAAI,IAAKA,IAAI,CAACF,KAAK,KAAKA,KAAK,CAAC,CAAC;AAErD,MAAMG,MAAM,GAAGA,CAACR,KAA0B,EAAES,IAAsB,MAAkB;EAClFC,OAAO,EAAEN,OAAO,CAACJ,KAAK,EAAE,SAAS,CAAC;EAClCW,QAAQ,EAAEP,OAAO,CAACJ,KAAK,EAAE,UAAU,CAAC;EACpCS,IAAI,EAAEV,KAAK,CAACU,IAAI;AAClB,CAAC,CAAC;;AAEF;AACA,MAAMG,eAAe,GAAGA,CAACC,MAAqB,EAAEC,MAAc,GAAGhB,YAAY,MAAmB;EAC9FiB,SAAS,EAAGC,QAAQ,IAAK;IACvB,IAAIC,QAAQ,GAAG,CAAC;IAChB,IAAIC,QAAQ,GAAG,IAAI;;IAEnB;IACA,MAAMC,IAAI,GAAGN,MAAM,CAACE,SAAS,CAAC,MAAM;MAClC,MAAMK,OAAO,GAAG,EAAEH,QAAQ;MAE1B,KAAKJ,MAAM,CAACb,KAAK,CAAC,CAAC,CAACqB,IAAI,CACrBrB,KAAK,IAAK;QACT,IAAIkB,QAAQ,IAAIE,OAAO,KAAKH,QAAQ,EAAE;UACpCD,QAAQ,CAACR,MAAM,CAACR,KAAK,EAAEa,MAAM,CAACS,YAAY,CAAC,CAAC,CAAC,CAAC;QAChD;MACF,CAAC,EACAC,KAAc,IAAKT,MAAM,CAACS,KAAK,CAAC,+BAA+B,EAAE;QAAEA,KAAK,EAAGA,KAAK,CAAWC;MAAK,CAAC,CACpG,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,MAAM;MACXN,QAAQ,GAAG,KAAK;MAChBC,IAAI,CAAC,CAAC;IACR,CAAC;EACH;AACF,CAAC,CAAC;AAEF,SAASP,eAAe","ignoreList":[]}
@@ -2,34 +2,11 @@
2
2
 
3
3
  import { MeasurementTypeKey } from "@ovok/core/next";
4
4
  import { DeviceError } from "../core/errors.js";
5
- const MG_PER_DL_PER_MMOL_PER_L = 18.0182;
6
- const KG_PER_POUND = 0.45359237;
7
- const KG_PER_STONE = 6.35029318;
8
- const MMHG_PER_KPA = 7.50062;
9
- const FAHRENHEIT_ZERO_IN_CELSIUS_STEPS = 32;
10
-
11
- /** A device's UCUM unit to the unit Ovok stores the value in: mg/dL, kg, °C, mmHg, L, L/s or %. */
12
- const TO_OVOK_UNIT = {
13
- "mg/dL": value => value,
14
- "mmol/L": value => value * MG_PER_DL_PER_MMOL_PER_L,
15
- kg: value => value,
16
- "[lb_av]": value => value * KG_PER_POUND,
17
- "[stone_av]": value => value * KG_PER_STONE,
18
- Cel: value => value,
19
- "[degF]": value => (value - FAHRENHEIT_ZERO_IN_CELSIUS_STEPS) * 5 / 9,
20
- "mm[Hg]": value => value,
21
- kPa: value => value * MMHG_PER_KPA,
22
- L: value => value,
23
- "L/s": value => value,
24
- "%": value => value
25
- };
26
- const valueOf = (reading, metric) => reading.values[metric]?.value;
27
-
28
- /** The value in Ovok's unit; `undefined` when the reading lacks it or uses a unit Ovok has no conversion for. */
29
- const ovokValueOf = (reading, metric) => {
30
- const quantity = reading.values[metric];
31
- return quantity && TO_OVOK_UNIT[quantity.unit]?.(quantity.value);
32
- };
5
+ import { ecgMeasurements } from "./ecg-measurements.js";
6
+ import { replaceLiveRecordings } from "./live-supersession.js";
7
+ import { partSourceId, sourceIdOf } from "./reading-source-id.js";
8
+ import { ovokValueOf, valueOf } from "./reading-values.js";
9
+ import { isSeriesReading, saveSeries } from "./series-saving.js";
33
10
  const flagSet = (reading, code) => reading.deviceFlags.some(flag => flag.code === code && flag.raw !== 0) ? true : undefined;
34
11
  const bloodPressure = reading => ({
35
12
  measurementTypeKey: MeasurementTypeKey.bloodPressure,
@@ -73,32 +50,16 @@ const pulseOximetry = reading => ({
73
50
  perfusionIndex: valueOf(reading, "perfusion_index"),
74
51
  recordedAt: reading.takenAt ?? undefined
75
52
  });
76
-
77
- /** Ovok stores ECG points in millivolts; a trace in any other unit is left out rather than mislabelled. */
78
- const ECG_POINT_UNIT = "mV";
79
- const ecg = reading => {
80
- const waveform = reading.waveform?.unit === ECG_POINT_UNIT ? reading.waveform : undefined;
81
- const samples = waveform?.samples[0] ?? new Int16Array(0);
82
- return {
83
- measurementTypeKey: MeasurementTypeKey.ecg,
84
- heartRate: valueOf(reading, "heart_rate"),
85
- diagramPoints: Array.from(samples, sample => sample * (waveform?.scale ?? 1)),
86
- duration: waveform ? samples.length / waveform.sampleRateHz : undefined,
87
- recordedAt: reading.takenAt ?? undefined
88
- };
89
- };
90
-
91
- /** A per-second series, such as an ER1 trend, has no single-value measurement; it waits for series saving in core. */
92
- const heartRate = reading => reading.series ? undefined : {
53
+ const heartRate = reading => ({
93
54
  measurementTypeKey: MeasurementTypeKey.heartRate,
94
55
  heartRate: valueOf(reading, "heart_rate"),
95
56
  recordedAt: reading.takenAt ?? undefined
96
- };
97
- const respiratoryRate = reading => reading.series ? undefined : {
57
+ });
58
+ const respiratoryRate = reading => ({
98
59
  measurementTypeKey: MeasurementTypeKey.respiratoryRate,
99
60
  respiratoryRate: valueOf(reading, "respiration_rate"),
100
61
  recordedAt: reading.takenAt ?? undefined
101
- };
62
+ });
102
63
  const LIPID_METRICS = ["blood_cholesterol", "hdl_cholesterol", "ldl_cholesterol", "triglycerides"];
103
64
  const LIPID_UNITS = ["mg/dL", "mmol/L"];
104
65
  const isLipidUnit = unit => LIPID_UNITS.some(lipidUnit => lipidUnit === unit);
@@ -133,20 +94,24 @@ const spirometry = reading => {
133
94
  recordedAt: reading.takenAt ?? undefined
134
95
  } : undefined;
135
96
  };
97
+ const single = measure => reading => {
98
+ const measurement = measure(reading);
99
+ return measurement ? [measurement] : [];
100
+ };
136
101
 
137
- /** How each reading type becomes an Ovok measurement; a type missing here cannot be saved yet. */
102
+ /** How each reading type becomes Ovok measurements, one for most and one per channel for an ECG; a type missing here cannot be saved yet. */
138
103
  const MEASUREMENTS = {
139
- blood_pressure: bloodPressure,
140
- blood_glucose: bloodGlucose,
141
- blood_cholesterol: lipidPanel,
142
- ecg,
143
- heart_rate: heartRate,
144
- oxygen_saturation: pulseOximetry,
145
- respiration_rate: respiratoryRate,
146
- spirometry,
147
- temperature: bodyTemperature,
148
- triglycerides: lipidPanel,
149
- weight: bodyWeight
104
+ blood_pressure: single(bloodPressure),
105
+ blood_glucose: single(bloodGlucose),
106
+ blood_cholesterol: single(lipidPanel),
107
+ ecg: ecgMeasurements,
108
+ heart_rate: single(heartRate),
109
+ oxygen_saturation: single(pulseOximetry),
110
+ respiration_rate: single(respiratoryRate),
111
+ spirometry: single(spirometry),
112
+ temperature: single(bodyTemperature),
113
+ triglycerides: single(lipidPanel),
114
+ weight: single(bodyWeight)
150
115
  };
151
116
  const deviceOf = (reading, device) => ({
152
117
  id: reading.source.address,
@@ -163,24 +128,60 @@ const deviceOf = (reading, device) => ({
163
128
  batteryPercentage: device.battery?.percent
164
129
  });
165
130
 
166
- /** Saves readings for the signed-in account through the Ovok measurements API, queueing them offline. */
131
+ /** What the sink saves with: the measurements API, the outbox that deletes, and the session that names the patient. */
132
+
133
+ const unsupported = what => new DeviceError("unsupported", `Ovok cannot save ${what} yet`);
134
+
135
+ /** Live numbers are saved as series and a live ECG as a recording; any other live trace has no place in Ovok yet. */
136
+ const isUnsavableLive = reading => reading.live !== undefined && reading.series === undefined && reading.type !== "ecg";
137
+ const hasValues = reading => Object.keys(reading.values).length > 0;
138
+ const saveMeasurements = async (client, reading, device) => {
139
+ const measurements = MEASUREMENTS[reading.type]?.(reading) ?? [];
140
+ if (measurements.length === 0) {
141
+ throw unsupported(`a ${reading.type} reading of this shape`);
142
+ }
143
+ const results = [];
144
+ for (const [index, measurement] of measurements.entries()) {
145
+ results.push(await client.measurements.save({
146
+ measurement,
147
+ sourceId: partSourceId(sourceIdOf(reading), index),
148
+ effectiveDateTime: reading.takenAt ?? undefined,
149
+ device
150
+ }));
151
+ }
152
+ return results;
153
+ };
154
+
155
+ /** Queued when any part of the reading is, with the outbox item of each queued part. */
156
+ const receiptOf = results => {
157
+ const queueIds = results.flatMap(result => result.status === "queued" ? [result.queueId] : []);
158
+ return queueIds.length > 0 ? {
159
+ status: "queued",
160
+ queueIds
161
+ } : {
162
+ status: "saved"
163
+ };
164
+ };
165
+
166
+ /**
167
+ * Saves readings for the signed-in account through the Ovok measurements API, queueing them offline. A reading with a
168
+ * series also saves it; a stored record then removes the live recordings it replaces, once it is saved.
169
+ */
167
170
  const ovokReadingSink = client => ({
168
171
  save: async (reading, device) => {
169
- const measurement = MEASUREMENTS[reading.type]?.(reading);
170
- if (!measurement) {
171
- throw new DeviceError("unsupported", `Ovok cannot save a ${reading.type} reading of this shape yet`);
172
+ if (isUnsavableLive(reading)) {
173
+ throw unsupported(`a live ${reading.live?.metric} recording`);
172
174
  }
173
- const {
174
- address,
175
- recordId
176
- } = reading.source;
177
- const result = await client.measurements.save({
178
- measurement,
179
- sourceId: recordId === null ? undefined : `bluetooth:${address}:${recordId}`,
180
- effectiveDateTime: reading.takenAt ?? undefined,
181
- device: deviceOf(reading, device)
182
- });
183
- return result.status;
175
+ const target = deviceOf(reading, device);
176
+ const results = [];
177
+ if (isSeriesReading(reading)) {
178
+ results.push(await saveSeries(client, reading, target));
179
+ }
180
+ if (!isSeriesReading(reading) || hasValues(reading)) {
181
+ results.push(...(await saveMeasurements(client, reading, target)));
182
+ }
183
+ await replaceLiveRecordings(client, reading);
184
+ return receiptOf(results);
184
185
  }
185
186
  });
186
187
  export { ovokReadingSink };
@@ -1 +1 @@
1
- {"version":3,"names":["MeasurementTypeKey","DeviceError","MG_PER_DL_PER_MMOL_PER_L","KG_PER_POUND","KG_PER_STONE","MMHG_PER_KPA","FAHRENHEIT_ZERO_IN_CELSIUS_STEPS","TO_OVOK_UNIT","value","kg","Cel","kPa","L","valueOf","reading","metric","values","ovokValueOf","quantity","unit","flagSet","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","systolic","diastolic","meanArterialPressure","heartRate","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","ECG_POINT_UNIT","ecg","waveform","samples","Int16Array","diagramPoints","Array","from","sample","scale","duration","length","sampleRateHz","series","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","lipidUnit","lipidPanel","units","Set","flatMap","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","spirometryPanel","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","heart_rate","oxygen_saturation","respiration_rate","deviceOf","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","sn","serial","variant","vendor","batteryPercentage","battery","percent","ovokReadingSink","client","save","measurement","type","recordId","result","measurements","sourceId","effectiveDateTime","status"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;AAAA,SAUEA,kBAAkB,QAKb,iBAAiB;AAGxB,SAASC,WAAW,QAAQ,mBAAgB;AAO5C,MAAMC,wBAAwB,GAAG,OAAO;AACxC,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,UAAU;AAC/B,MAAMC,YAAY,GAAG,OAAO;AAC5B,MAAMC,gCAAgC,GAAG,EAAE;;AAE3C;AACA,MAAMC,YAAuD,GAAG;EAC9D,OAAO,EAAGC,KAAK,IAAKA,KAAK;EACzB,QAAQ,EAAGA,KAAK,IAAKA,KAAK,GAAGN,wBAAwB;EACrDO,EAAE,EAAGD,KAAK,IAAKA,KAAK;EACpB,SAAS,EAAGA,KAAK,IAAKA,KAAK,GAAGL,YAAY;EAC1C,YAAY,EAAGK,KAAK,IAAKA,KAAK,GAAGJ,YAAY;EAC7CM,GAAG,EAAGF,KAAK,IAAKA,KAAK;EACrB,QAAQ,EAAGA,KAAK,IAAM,CAACA,KAAK,GAAGF,gCAAgC,IAAI,CAAC,GAAI,CAAC;EACzE,QAAQ,EAAGE,KAAK,IAAKA,KAAK;EAC1BG,GAAG,EAAGH,KAAK,IAAKA,KAAK,GAAGH,YAAY;EACpCO,CAAC,EAAGJ,KAAK,IAAKA,KAAK;EACnB,KAAK,EAAGA,KAAK,IAAKA,KAAK;EACvB,GAAG,EAAGA,KAAK,IAAKA;AA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AAmB;EAC5EC,IAAI,EAAE,MAAAA,CAAOjG,OAAO,EAAE6E,MAAM,KAAK;IAC/B,MAAMqB,WAAW,GAAG7B,YAAY,CAACrE,OAAO,CAACmG,IAAI,CAAC,GAAGnG,OAAO,CAAC;IAEzD,IAAI,CAACkG,WAAW,EAAE;MAChB,MAAM,IAAI/G,WAAW,CAAC,aAAa,EAAE,sBAAsBa,OAAO,CAACmG,IAAI,4BAA4B,CAAC;IACtG;IAEA,MAAM;MAAEnB,OAAO;MAAEoB;IAAS,CAAC,GAAGpG,OAAO,CAAC+E,MAAM;IAE5C,MAAMsB,MAAM,GAAG,MAAML,MAAM,CAACM,YAAY,CAACL,IAAI,CAAC;MAC5CC,WAAW;MACXK,QAAQ,EAAEH,QAAQ,KAAK,IAAI,GAAGxF,SAAS,GAAG,aAAaoE,OAAO,IAAIoB,QAAQ,EAAE;MAC5EI,iBAAiB,EAAExG,OAAO,CAACqB,OAAO,IAAIT,SAAS;MAC/CiE,MAAM,EAAED,QAAQ,CAAC5E,OAAO,EAAE6E,MAAM;IAClC,CAAC,CAAC;IAEF,OAAOwB,MAAM,CAACI,MAAM;EACtB;AACF,CAAC,CAAC;AAEF,SAASV,eAAe","ignoreList":[]}
1
+ {"version":3,"names":["MeasurementTypeKey","DeviceError","ecgMeasurements","replaceLiveRecordings","partSourceId","sourceIdOf","ovokValueOf","valueOf","isSeriesReading","saveSeries","flagSet","reading","code","deviceFlags","some","flag","raw","undefined","bloodPressure","measurementTypeKey","systolic","diastolic","meanArterialPressure","heartRate","irregularHeartbeat","recordedAt","takenAt","bloodGlucose","bloodGlucoseValue","bodyWeight","weight","bodyTemperature","temperature","bodyTemp","pulseOximetry","bloodOxygenPulseRate","bloodOxygen","pulseRate","perfusionIndex","respiratoryRate","LIPID_METRICS","LIPID_UNITS","isLipidUnit","unit","lipidUnit","lipidPanel","units","Set","flatMap","metric","values","size","totalCholesterol","hdlCholesterol","ldlCholesterol","triglycerides","spirometry","fvc","fev1","pef","fef2575","Object","value","spirometryPanel","single","measure","measurement","MEASUREMENTS","blood_pressure","blood_glucose","blood_cholesterol","ecg","heart_rate","oxygen_saturation","respiration_rate","deviceOf","device","id","source","address","name","model","localName","manufacturerData","manufacturerName","identity","manufacturer","sn","serial","variant","vendor","batteryPercentage","battery","percent","unsupported","what","isUnsavableLive","live","series","type","hasValues","keys","length","saveMeasurements","client","measurements","results","index","entries","push","save","sourceId","effectiveDateTime","receiptOf","queueIds","result","status","queueId","ovokReadingSink","target"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-reading-sink.ts"],"mappings":";;AAAA,SAQEA,kBAAkB,QAKb,iBAAiB;AAGxB,SAASC,WAAW,QAAQ,mBAAgB;AAM5C,SAASC,eAAe,QAAQ,uBAAoB;AACpD,SAASC,qBAAqB,QAA4B,wBAAqB;AAC/E,SAASC,YAAY,EAAEC,UAAU,QAAQ,wBAAqB;AAC9D,SAASC,WAAW,EAAEC,OAAO,QAAQ,qBAAkB;AACvD,SAASC,eAAe,EAAqBC,UAAU,QAAQ,oBAAiB;AAEhF,MAAMC,OAAO,GAAGA,CAACC,OAAgB,EAAEC,IAAY,KAC7CD,OAAO,CAACE,WAAW,CAACC,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACH,IAAI,KAAKA,IAAI,IAAIG,IAAI,CAACC,GAAG,KAAK,CAAC,CAAC,GAAG,IAAI,GAAGC,SAAS;AAE7F,MAAMC,aAAa,GAAIP,OAAgB,KAAgC;EACrEQ,kBAAkB,EAAEnB,kBAAkB,CAACkB,aAAa;EACpDE,QAAQ,EAAEd,WAAW,CAACK,OAAO,EAAE,UAAU,CAAC;EAC1CU,SAAS,EAAEf,WAAW,CAACK,OAAO,EAAE,WAAW,CAAC;EAC5CW,oBAAoB,EAAEhB,WAAW,CAACK,OAAO,EAAE,wBAAwB,CAAC;EACpEY,SAAS,EAAEhB,OAAO,CAACI,OAAO,EAAE,YAAY,CAAC;EACzCa,kBAAkB,EAAEd,OAAO,CA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E,QAAQ;IAAEF;EAAS,CAAC,GAAG;IAAEE,MAAM,EAAE;EAAQ,CAAC;AACnF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAME,eAAe,GAAId,MAAsB,KAAmB;EAChEM,IAAI,EAAE,MAAAA,CAAOnG,OAAO,EAAEiE,MAAM,KAAK;IAC/B,IAAIoB,eAAe,CAACrF,OAAO,CAAC,EAAE;MAC5B,MAAMmF,WAAW,CAAC,UAAUnF,OAAO,CAACsF,IAAI,EAAEhD,MAAM,YAAY,CAAC;IAC/D;IAEA,MAAMsE,MAAM,GAAG5C,QAAQ,CAAChE,OAAO,EAAEiE,MAAM,CAAC;IACxC,MAAM8B,OAAiC,GAAG,EAAE;IAE5C,IAAIlG,eAAe,CAACG,OAAO,CAAC,EAAE;MAC5B+F,OAAO,CAACG,IAAI,CAAC,MAAMpG,UAAU,CAAC+F,MAAM,EAAE7F,OAAO,EAAE4G,MAAM,CAAC,CAAC;IACzD;IAEA,IAAI,CAAC/G,eAAe,CAACG,OAAO,CAAC,IAAIyF,SAAS,CAACzF,OAAO,CAAC,EAAE;MACnD+F,OAAO,CAACG,IAAI,CAAC,IAAI,MAAMN,gBAAgB,CAACC,MAAM,EAAE7F,OAAO,EAAE4G,MAAM,CAAC,CAAC,CAAC;IACpE;IAEA,MAAMpH,qBAAqB,CAACqG,MAAM,EAAE7F,OAAO,CAAC;IAE5C,OAAOsG,SAAS,CAACP,OAAO,CAAC;EAC3B;AACF,CAAC,CAAC;AAEF,SAASY,eAAe","ignoreList":[]}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ /** The name a live recording is saved under: the device, what it holds, and when it began. */
4
+ const liveSourceId = (address, {
5
+ metric,
6
+ channel,
7
+ from
8
+ }) => ["bluetooth", address, "live", metric, ...(channel === null ? [] : [channel]), from.getTime()].join(":");
9
+
10
+ /** The stable name a reading is saved under, so saving it again writes the same data; `undefined` for a measurement the device does not store. */
11
+ const sourceIdOf = ({
12
+ live,
13
+ source: {
14
+ address,
15
+ recordId
16
+ }
17
+ }) => {
18
+ if (live) {
19
+ return liveSourceId(address, live);
20
+ }
21
+ return recordId === null ? undefined : `bluetooth:${address}:${recordId}`;
22
+ };
23
+
24
+ /** The name of the `index`th recording of a reading with several, such as the channels of an ECG; the first keeps the reading's own. */
25
+ const partSourceId = (sourceId, index) => sourceId !== undefined && index > 0 ? `${sourceId}:${index}` : sourceId;
26
+ export { liveSourceId, partSourceId, sourceIdOf };
27
+ //# sourceMappingURL=reading-source-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["liveSourceId","address","metric","channel","from","getTime","join","sourceIdOf","live","source","recordId","undefined","partSourceId","sourceId","index"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/reading-source-id.ts"],"mappings":";;AAEA;AACA,MAAMA,YAAY,GAAGA,CAACC,OAAe,EAAE;EAAEC,MAAM;EAAEC,OAAO;EAAEC;AAAe,CAAC,KACxE,CAAC,WAAW,EAAEH,OAAO,EAAE,MAAM,EAAEC,MAAM,EAAE,IAAIC,OAAO,KAAK,IAAI,GAAG,EAAE,GAAG,CAACA,OAAO,CAAC,CAAC,EAAEC,IAAI,CAACC,OAAO,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;;AAE1G;AACA,MAAMC,UAAU,GAAGA,CAAC;EAAEC,IAAI;EAAEC,MAAM,EAAE;IAAER,OAAO;IAAES;EAAS;AAAW,CAAC,KAAyB;EAC3F,IAAIF,IAAI,EAAE;IACR,OAAOR,YAAY,CAACC,OAAO,EAAEO,IAAI,CAAC;EACpC;EAEA,OAAOE,QAAQ,KAAK,IAAI,GAAGC,SAAS,GAAG,aAAaV,OAAO,IAAIS,QAAQ,EAAE;AAC3E,CAAC;;AAED;AACA,MAAME,YAAY,GAAGA,CAACC,QAA4B,EAAEC,KAAa,KAC/DD,QAAQ,KAAKF,SAAS,IAAIG,KAAK,GAAG,CAAC,GAAG,GAAGD,QAAQ,IAAIC,KAAK,EAAE,GAAGD,QAAQ;AAEzE,SAASb,YAAY,EAAEY,YAAY,EAAEL,UAAU","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ const MG_PER_DL_PER_MMOL_PER_L = 18.0182;
4
+ const KG_PER_POUND = 0.45359237;
5
+ const KG_PER_STONE = 6.35029318;
6
+ const MMHG_PER_KPA = 7.50062;
7
+ const FAHRENHEIT_ZERO_IN_CELSIUS_STEPS = 32;
8
+
9
+ /** A device's UCUM unit to the unit Ovok stores the value in: mg/dL, kg, °C, mmHg, L, L/s, % or per minute. */
10
+ const TO_OVOK_UNIT = {
11
+ "mg/dL": value => value,
12
+ "mmol/L": value => value * MG_PER_DL_PER_MMOL_PER_L,
13
+ kg: value => value,
14
+ "[lb_av]": value => value * KG_PER_POUND,
15
+ "[stone_av]": value => value * KG_PER_STONE,
16
+ Cel: value => value,
17
+ "[degF]": value => (value - FAHRENHEIT_ZERO_IN_CELSIUS_STEPS) * 5 / 9,
18
+ "mm[Hg]": value => value,
19
+ kPa: value => value * MMHG_PER_KPA,
20
+ L: value => value,
21
+ "L/s": value => value,
22
+ "%": value => value,
23
+ "/min": value => value
24
+ };
25
+ const valueOf = (reading, metric) => reading.values[metric]?.value;
26
+
27
+ /** The value in Ovok's unit; `undefined` when the reading lacks it or uses a unit Ovok has no conversion for. */
28
+ const ovokValueOf = (reading, metric) => {
29
+ const quantity = reading.values[metric];
30
+ return quantity && TO_OVOK_UNIT[quantity.unit]?.(quantity.value);
31
+ };
32
+ export { ovokValueOf, TO_OVOK_UNIT, valueOf };
33
+ //# sourceMappingURL=reading-values.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MG_PER_DL_PER_MMOL_PER_L","KG_PER_POUND","KG_PER_STONE","MMHG_PER_KPA","FAHRENHEIT_ZERO_IN_CELSIUS_STEPS","TO_OVOK_UNIT","value","kg","Cel","kPa","L","valueOf","reading","metric","values","ovokValueOf","quantity","unit"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluet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