@ovok/native 1.16.1-rc.6 → 1.16.1-rc.7

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 (545) hide show
  1. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  2. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  3. package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
  4. package/lib/commonjs/modules/bt-management/index.js +12 -0
  5. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  6. package/lib/commonjs/modules/bt-management/services/bt-manager.js +27 -1
  7. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  8. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +39 -0
  9. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  10. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js +36 -10
  11. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  12. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -2
  13. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  14. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +69 -25
  15. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  16. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  17. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  18. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +1 -1
  19. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  20. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  21. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  22. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  23. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  24. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +113 -24
  25. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  26. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js +19 -2
  27. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  28. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +32 -0
  29. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  30. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +73 -0
  31. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  32. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +130 -30
  33. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  34. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +103 -0
  35. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  37. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  38. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  39. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  40. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  41. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  42. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +75 -0
  43. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  44. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +113 -0
  45. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  46. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +67 -0
  47. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  48. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js +55 -0
  49. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  50. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +57 -0
  51. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  52. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js +49 -0
  53. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  54. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js +46 -0
  55. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  56. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  57. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  58. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js +27 -0
  59. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  60. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  61. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  62. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +3 -5
  63. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  64. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +17 -8
  65. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  66. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +47 -0
  67. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  68. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  69. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  70. package/lib/commonjs/modules/bt-management/services/series-recorder.js +27 -5
  71. package/lib/commonjs/modules/bt-management/services/series-recorder.js.map +1 -1
  72. package/lib/commonjs/modules/bt-management/types/device-waveform.js +6 -0
  73. package/lib/commonjs/modules/bt-management/types/device-waveform.js.map +1 -0
  74. package/lib/commonjs/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  75. package/lib/commonjs/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  76. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js +15 -8
  77. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  78. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js +1 -1
  79. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  80. package/lib/commonjs/modules/data-sync/constants.js +4 -1
  81. package/lib/commonjs/modules/data-sync/constants.js.map +1 -1
  82. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js +6 -9
  83. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  84. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +1 -0
  85. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
  86. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js +13 -0
  87. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js.map +1 -1
  88. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js +47 -0
  89. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  90. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js +6 -3
  91. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  92. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  93. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  94. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js +25 -4
  95. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js.map +1 -1
  96. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  97. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  98. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js +43 -86
  99. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  100. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js +6 -5
  101. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  102. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js +15 -15
  103. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  104. package/lib/commonjs/modules/data-sync/utils/health-units.js +6 -1
  105. package/lib/commonjs/modules/data-sync/utils/health-units.js.map +1 -1
  106. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js +64 -0
  107. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  108. package/lib/commonjs/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  109. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js +20 -0
  110. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  111. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js +21 -0
  112. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  113. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js +59 -0
  114. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  115. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js +20 -11
  116. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js.map +1 -1
  117. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  118. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  119. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  120. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  121. package/lib/commonjs/modules/next/bluetooth/connections.js +45 -2
  122. package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -1
  123. package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
  124. package/lib/commonjs/modules/next/bluetooth/errors.js.map +1 -1
  125. package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
  126. package/lib/commonjs/modules/next/bluetooth/readings.js +10 -2
  127. package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -1
  128. package/lib/commonjs/modules/next/bluetooth/runtime.js +37 -1
  129. package/lib/commonjs/modules/next/bluetooth/runtime.js.map +1 -1
  130. package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -1
  131. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  132. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  133. package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
  134. package/lib/module/modules/bt-management/index.js +1 -0
  135. package/lib/module/modules/bt-management/index.js.map +1 -1
  136. package/lib/module/modules/bt-management/services/bt-manager.js +27 -1
  137. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  138. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +39 -0
  139. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  140. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js +36 -10
  141. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  142. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -3
  143. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  144. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +68 -25
  145. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  146. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  147. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  148. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +1 -1
  149. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  150. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  151. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  152. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  153. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  154. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +113 -24
  155. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  156. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js +17 -1
  157. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  158. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +28 -0
  159. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  160. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +69 -0
  161. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  162. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +129 -30
  163. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  164. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +99 -0
  165. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  166. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  167. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  168. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  169. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  170. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  171. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  172. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +72 -0
  173. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  174. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +109 -0
  175. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  176. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +64 -0
  177. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  178. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js +51 -0
  179. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  180. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +53 -0
  181. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  182. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js +45 -0
  183. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  184. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js +42 -0
  185. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  186. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  187. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  188. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js +22 -0
  189. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  190. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  191. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  192. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +3 -6
  193. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  194. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +17 -8
  195. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  196. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +44 -0
  197. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  198. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  199. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  200. package/lib/module/modules/bt-management/services/series-recorder.js +27 -5
  201. package/lib/module/modules/bt-management/services/series-recorder.js.map +1 -1
  202. package/lib/module/modules/bt-management/types/device-waveform.js +4 -0
  203. package/lib/module/modules/bt-management/types/device-waveform.js.map +1 -0
  204. package/lib/module/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  205. package/lib/module/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  206. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js +16 -9
  207. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  208. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js +2 -2
  209. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  210. package/lib/module/modules/data-sync/constants.js +4 -1
  211. package/lib/module/modules/data-sync/constants.js.map +1 -1
  212. package/lib/module/modules/data-sync/hooks/use-listen-changes.js +7 -10
  213. package/lib/module/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  214. package/lib/module/modules/data-sync/services/managers/data-processor.js +1 -0
  215. package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
  216. package/lib/module/modules/data-sync/types/health-sync-keys.js +13 -0
  217. package/lib/module/modules/data-sync/types/health-sync-keys.js.map +1 -1
  218. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js +43 -0
  219. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  220. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js +6 -3
  221. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  222. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  223. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  224. package/lib/module/modules/data-sync/utils/default-health-coding.js +25 -4
  225. package/lib/module/modules/data-sync/utils/default-health-coding.js.map +1 -1
  226. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  227. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  228. package/lib/module/modules/data-sync/utils/get-samples-from-health.js +44 -87
  229. package/lib/module/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  230. package/lib/module/modules/data-sync/utils/get-total-samples-count.js +5 -4
  231. package/lib/module/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  232. package/lib/module/modules/data-sync/utils/health-data-catalog.js +15 -15
  233. package/lib/module/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  234. package/lib/module/modules/data-sync/utils/health-units.js +6 -1
  235. package/lib/module/modules/data-sync/utils/health-units.js.map +1 -1
  236. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js +59 -0
  237. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  238. package/lib/module/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  239. package/lib/module/modules/data-sync/utils/healthkit-query-options.js +16 -0
  240. package/lib/module/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  241. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js +17 -0
  242. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  243. package/lib/module/modules/data-sync/utils/healthkit-samples.js +52 -0
  244. package/lib/module/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  245. package/lib/module/modules/data-sync/utils/healthkit-series.js +19 -10
  246. package/lib/module/modules/data-sync/utils/healthkit-series.js.map +1 -1
  247. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  248. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  249. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  250. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  251. package/lib/module/modules/next/bluetooth/connections.js +45 -2
  252. package/lib/module/modules/next/bluetooth/connections.js.map +1 -1
  253. package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
  254. package/lib/module/modules/next/bluetooth/errors.js.map +1 -1
  255. package/lib/module/modules/next/bluetooth/index.js.map +1 -1
  256. package/lib/module/modules/next/bluetooth/readings.js +10 -2
  257. package/lib/module/modules/next/bluetooth/readings.js.map +1 -1
  258. package/lib/module/modules/next/bluetooth/runtime.js +37 -1
  259. package/lib/module/modules/next/bluetooth/runtime.js.map +1 -1
  260. package/lib/module/modules/next/bluetooth/web/index.js.map +1 -1
  261. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  262. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  263. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  264. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
  265. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  266. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  267. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  268. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  269. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  270. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  271. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  272. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  273. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +24 -4
  274. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  275. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  276. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  277. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  278. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  279. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  280. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  281. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  282. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  283. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  284. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  285. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  286. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  287. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  288. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  289. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  290. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  291. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  292. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  293. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  294. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  295. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  296. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  297. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  298. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  299. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  300. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  301. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  302. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  303. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  304. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  305. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  306. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  307. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  308. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  309. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  310. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  311. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  312. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  313. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +4 -0
  314. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  315. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  316. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  317. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  318. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +1 -1
  319. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  320. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  321. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  322. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  323. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  324. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  325. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  326. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  327. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  328. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +42 -1
  329. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  330. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  331. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  332. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  333. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  334. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  335. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  336. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  337. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  338. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  339. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  340. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  341. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts +3 -1
  342. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts.map +1 -1
  343. package/lib/typescript/commonjs/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  345. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  346. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  347. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  348. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  349. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  350. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  351. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  352. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  353. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  354. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  356. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  357. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  358. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  359. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  360. package/lib/typescript/commonjs/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -1
  361. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  362. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  363. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  364. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  365. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  366. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  367. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts +2 -2
  368. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  369. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  370. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  371. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  372. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  373. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  374. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  375. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  376. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  377. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  378. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  379. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  380. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  381. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  382. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  383. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  384. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  385. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  386. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  387. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts +13 -1
  388. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  389. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +20 -0
  390. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  391. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts +1 -1
  392. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  393. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +2 -1
  394. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
  395. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts +3 -2
  396. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  397. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts +19 -1
  398. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  399. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  400. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  401. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
  402. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  403. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  404. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  405. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  406. package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
  407. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  408. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  409. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  410. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  411. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  412. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  413. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  414. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  415. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +24 -4
  416. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  417. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  418. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  419. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  420. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  421. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  422. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  423. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  424. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  425. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  426. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  427. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  428. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  429. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  430. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  431. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  432. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  433. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  434. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  435. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  436. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  437. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  438. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  439. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  440. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  441. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  442. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  443. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  444. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  445. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  446. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  447. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  448. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  449. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  450. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  451. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  452. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  453. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  454. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  455. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +4 -0
  456. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  457. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  458. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  459. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  460. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +1 -1
  461. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  462. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  463. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  464. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  465. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  466. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  467. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  468. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  469. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  470. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +42 -1
  471. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  472. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  473. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  474. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  475. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  476. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  477. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  478. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  479. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  480. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  481. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  482. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  483. package/lib/typescript/module/src/modules/data-sync/constants.d.ts +3 -1
  484. package/lib/typescript/module/src/modules/data-sync/constants.d.ts.map +1 -1
  485. package/lib/typescript/module/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  486. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  487. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  488. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  489. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  490. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  491. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  492. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  493. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  494. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  495. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  496. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  497. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  498. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  499. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  500. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  501. package/lib/typescript/module/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  502. package/lib/typescript/module/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -1
  503. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  504. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  505. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  506. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  507. package/lib/typescript/module/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  508. package/lib/typescript/module/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  509. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts +2 -2
  510. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  511. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  512. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  513. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  514. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  515. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  516. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  517. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  518. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  519. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  520. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  521. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  522. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  523. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  524. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  525. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  526. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  527. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  528. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  529. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts +13 -1
  530. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  531. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +20 -0
  532. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  533. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts +1 -1
  534. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  535. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +2 -1
  536. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
  537. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts +3 -2
  538. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  539. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts +19 -1
  540. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  541. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  542. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  543. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
  544. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  545. package/package.json +8 -3
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import { ObservationServiceCreator } from "@ovok/core/dist/client/observation/services/creator";
4
+ import { MeasurementTypeKey } from "@ovok/core/next";
5
+ import { convertEcgSamplesToObservation } from "./convert-ecg-samples-to-observation.js";
4
6
  import { convertGenericHealthDataToObservation } from "./convert-generic-health-data.js";
5
- import { getHealthObservationDevice } from "./health-observation-device.js";
7
+ import { getHealthKitSampleSource } from "./healthkit-sample-source.js";
6
8
  import { hasConfiguredNonLoincCoding } from "./normalize-core-health-observation.js";
7
9
  import { isCoreMeasurementTypeKey, toCoreHealthObservations } from "./to-core-health-observations.js";
8
10
  export const convertSamplesToObservation = async props => {
@@ -33,6 +35,9 @@ export const convertSamplesToObservation = async props => {
33
35
  mode
34
36
  });
35
37
  }
38
+ if (measurementTypeKey === MeasurementTypeKey.ecg) {
39
+ return convertEcgSamplesToObservation(props);
40
+ }
36
41
  const service = ObservationServiceCreator.getInstance().getService(measurementTypeKey);
37
42
  const measurement = service.convertSamplesToMeasurement(data);
38
43
  if (!measurement) {
@@ -41,19 +46,6 @@ export const convertSamplesToObservation = async props => {
41
46
  const observationBody = await client.measurements.build({
42
47
  measurement
43
48
  });
44
- return toCoreHealthObservations(observationBody, props, index => {
45
- const sample = data?.[index];
46
- return {
47
- device: sample ? getHealthObservationDevice({
48
- manufacturer: sample.device?.manufacturer,
49
- model: sample.device?.model,
50
- sourceApp: sample.sourceRevision?.source?.name
51
- }) : undefined,
52
- timing: {
53
- start: sample?.startDate,
54
- end: sample?.endDate
55
- }
56
- };
57
- });
49
+ return toCoreHealthObservations(observationBody, props, index => getHealthKitSampleSource(data[index]));
58
50
  };
59
51
  //# sourceMappingURL=convert-samples-to-observation.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ObservationServiceCreator","convertGenericHealthDataToObservation","getHealthObservationDevice","hasConfiguredNonLoincCoding","isCoreMeasurementTypeKey","toCoreHealthObservations","convertSamplesToObservation","props","data","client","measurementTypeKey","mode","length","service","getInstance","getService","measurement","convertSamplesToMeasurement","observationBody","measurements","build","index","sample","device","manufacturer","model","sourceApp","sourceRevision","source","name","undefined","timing","start","startDate","end","endDate"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/convert-samples-to-observation.ts"],"mappings":";;AAKA,SAASA,yBAAyB,QAAQ,qDAAqD;AAM/F,SAASC,qCAAqC,QAAQ,kCAA+B;AACrF,SAASC,0BAA0B,QAAQ,gCAA6B;AACxE,SAASC,2BAA2B,QAAQ,wCAAqC;AACjF,SACEC,wBAAwB,EACxBC,wBAAwB,QACnB,kCAA+B;AAEtC,OA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C5C,CAAC,CAAC,GACFC,SAAS;MACbC,MAAM,EAAE;QAAEC,KAAK,EAAEV,MAAM,EAAEW,SAAS;QAAEC,GAAG,EAAEZ,MAAM,EAAEa;MAAQ;IAC3D,CAAC;EACH,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["ObservationServiceCreator","MeasurementTypeKey","convertEcgSamplesToObservation","convertGenericHealthDataToObservation","getHealthKitSampleSource","hasConfiguredNonLoincCoding","isCoreMeasurementTypeKey","toCoreHealthObservations","convertSamplesToObservation","props","data","client","measurementTypeKey","mode","length","ecg","service","getInstance","getService","measurement","convertSamplesToMeasurement","observationBody","measurements","build","index"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/convert-samples-to-observation.ts"],"mappings":";;AACA,SAASA,yBAAyB,QAAQ,qDAAqD;AAC/F,SAASC,kBAAkB,QAAQ,iBAAiB;AAMpD,SAASC,8BAA8B,QAAQ,yCAAsC;AACrF,SAASC,qCAAqC,QAAQ,kCAA+B;AACrF,SACEC,wBAAwB,QAEnB,8BAA2B;AAClC,SAASC,2BAA2B,QAAQ,wCAAqC;AACjF,SACEC,wBAAwB,EACxBC,wBAAwB,QACnB,kCAA+B;AAEtC,OAAO,MAAMC,2BAA2B,GAAG,MACzCC,KAAgC,IACL;EAC3B,MAAM;IAAEC,IAAI;IAAEC,MAAM;IAAEC,kBAAkB;IAAEC,IAAI,GAAG;EAAQ,CAAC,GAAGJ,KAAK;EAElE,IAAII,IAAI,KAAK,OAAO,EAAE;IACpB,OAAOV,qCAAqC,CAAC;MAAE,GAAGM,KAAK;MAAEI;IAAK,CAAC,CAAC;EAClE;EAEA,IAAIH,IAAI,CAACI,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,EAAE;EACX;EAEA,IAAIT,2BAA2B,CAACI,KAAK,CAAC,EAAE;IACtC,OAAON,qCAAqC,CAAC;MAAE,GAAGM,KAAK;MAAEI;IAAK,CAAC,CAAC;EAClE;EAEA,IAAI,CAACP,wBAAwB,CAACM,kBAAkB,CAAC,EAAE;IACjD,OAAOT,qCAAqC,CAAC;MAAE,GAAGM,KAAK;MAAEI;IAAK,CAAC,CAAC;EAClE;EAEA,IAAID,kBAAkB,KAAKX,kBAAkB,CAACc,GAAG,EAAE;IACjD,OAAOb,8BAA8B,CAACO,KAAK,CAAC;EAC9C;EAEA,MAAMO,OAAO,GAAGhB,yBAAyB,CAACiB,WAAW,CAAC,CAAC,CAACC,UAAU,CAChEN,kBACF,CAAC;EAED,MAAMO,WAAW,GAAGH,OAAO,CAACI,2BAA2B,CACrDV,IACF,CAAC;EAED,IAAI,CAACS,WAAW,EAAE;IAChB,OAAO,EAAE;EACX;EAEA,MAAME,eAAe,GAAG,MAAMV,MAAM,CAACW,YAAY,CAACC,KAAK,CAAC;IACtDJ;EACF,CAAC,CAAC;EAEF,OAAOZ,wBAAwB,CAACc,eAAe,EAAEZ,KAAK,EAAGe,KAAK,IAC5DpB,wBAAwB,CAACM,IAAI,CAACc,KAAK,CAAsC,CAC3E,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { ObservationCode } from "@ovok/core/next";
4
+ import { HealthDataType } from "../types/health-sync-keys.js";
4
5
  import { LOINC_SYSTEM } from "./fhir-systems.js";
5
6
  import { getHealthDataCoding } from "./health-data-catalog.js";
6
7
  import { isCoreMeasurementTypeKey } from "./to-core-health-observations.js";
@@ -20,6 +21,7 @@ const CORE_MEASUREMENT_CODES = {
20
21
  HKQuantityTypeIdentifierRestingHeartRate: ObservationCode.RESTING_HEART_RATE,
21
22
  HKQuantityTypeIdentifierWalkingHeartRateAverage: ObservationCode.WALKING_HEART_RATE_AVERAGE,
22
23
  HKQuantityTypeIdentifierVO2Max: ObservationCode.VO2_MAX,
24
+ HKElectrocardiogramType: ObservationCode.ECG,
23
25
  BloodPressure: ObservationCode.SYSTOLIC_BLOOD_PRESSURE,
24
26
  HeartRate: ObservationCode.HEART_RATE,
25
27
  BloodGlucose: ObservationCode.BLOOD_GLUCOSE,
@@ -32,13 +34,32 @@ const CORE_MEASUREMENT_CODES = {
32
34
  Vo2Max: ObservationCode.VO2_MAX
33
35
  };
34
36
 
37
+ /** Health Connect records that feed more than one data type: each type is coded by the record field it reads. */
38
+ const SHARED_RECORD_FIELDS = {
39
+ Nutrition: {
40
+ [HealthDataType.carbohydrates]: "totalCarbohydrate",
41
+ [HealthDataType.caloriesEaten]: "energy"
42
+ },
43
+ ExerciseSession: {
44
+ [HealthDataType.exerciseMinutes]: "duration"
45
+ }
46
+ };
47
+
35
48
  /** The coding a type is saved under when the app names none: core's own code for a core measurement, else the catalog's. */
36
49
  const getDefaultHealthCoding = (provider, key, identifier, mode) => {
37
50
  const coreCode = isCoreMeasurementTypeKey(key) ? CORE_MEASUREMENT_CODES[identifier] : undefined;
38
- return coreCode ? {
39
- code: coreCode,
40
- system: LOINC_SYSTEM
41
- } : getHealthDataCoding(provider, identifier, mode);
51
+ if (coreCode) {
52
+ return {
53
+ code: coreCode,
54
+ system: LOINC_SYSTEM
55
+ };
56
+ }
57
+ const coding = getHealthDataCoding(provider, identifier, mode);
58
+ const field = SHARED_RECORD_FIELDS[identifier]?.[key];
59
+ return field ? {
60
+ code: `${coding.code}.${field}`,
61
+ system: coding.system
62
+ } : coding;
42
63
  };
43
64
  export { getDefaultHealthCoding };
44
65
  //# sourceMappingURL=default-health-coding.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ObservationCode","LOINC_SYSTEM","getHealthDataCoding","isCoreMeasurementTypeKey","CORE_MEASUREMENT_CODES","HKQuantityTypeIdentifierBloodPressureSystolic","SYSTOLIC_BLOOD_PRESSURE","HKQuantityTypeIdentifierBloodPressureDiastolic","DIASTOLIC_BLOOD_PRESSURE","HKQuantityTypeIdentifierHeartRate","HEART_RATE","HKQuantityTypeIdentifierBloodGlucose","BLOOD_GLUCOSE","HKQuantityTypeIdentifierBodyMass","BODY_WEIGHT","HKQuantityTypeIdentifierOxygenSaturation","OXYGEN_SATURATION","HKQuantityTypeIdentifierRespiratoryRate","RESPIRATORY_RATE","HKQuantityTypeIdentifierBodyTemperature","BODY_TEMPERATURE","HKQuantityTypeIdentifierStepCount","STEPS","HKQuantityTypeIdentifierHeartRateVariabilitySDNN","HEART_RATE_VARIABILITY","HKQuantityTypeIdentifierRestingHeartRate","RESTING_HEART_RATE","HKQuantityTypeIdentifierWalkingHeartRateAverage","WALKING_HEART_RATE_AVERAGE","HKQuantityTypeIdentifierVO2Max","VO2_MAX","BloodPressure","HeartRate","BloodGlucose","Weight","OxygenSaturation","RespiratoryRate","BodyTemperature","Steps","RestingHeartRate","Vo2Max","getDefaultHealthCoding","provider","key","identifier","mode","coreCode","undefined","code","system"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/default-health-coding.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,iBAAiB;AAKjD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,wBAAwB,QAAQ,kCAA+B;;AAExE;AACA,MAAMC,sBAA0E,GAAG;EACjFC,6CAA6C,EAAEL,eAAe,CAACM,uBAAuB;EACtFC,8CAA8C,EAAEP,eAAe,CAACQ,wBAAwB;EACxFC,iCAAiC,EAAET,eAAe,CAACU,UAAU;EAC7DC,oCAAoC,EAAEX,eAAe,CAACY,aAAa;EACnEC,gCAAgC,EAAEb,eAAe,CAACc,WAAW;EAC7DC,wCAAwC,EAAEf,eAAe,CAACgB,iBAAiB;EAC3EC,uCAAuC,EAAEjB,eAAe,CAACkB,gBAAgB;EACzEC,uCAAuC,EAAEnB,eAAe,CAACoB,gBAAgB;EACzEC,iCAAiC,EAAErB,eAAe,CAACsB,KAAK;EACxDC,gDAAgD,EAAEvB,eAAe,CAACwB,sBAAsB;EACxFC,wCAAwC,EAAEzB,eAAe,CAAC0B,kBAAkB;EAC5EC,+CAA+C,EAAE3B,eAAe,CAAC4B,0BAA0B;EAC3FC,8BAA8B,EAAE7B,eAAe,CAAC8B,OAAO;EACvDC,aAAa,EAAE/B,eAAe,CAACM,uBAAuB;EACtD0B,SAAS,EAAEhC,eAAe,CAACU,UAAU;EACrCuB,YAAY,EAAEjC,eAAe,CAACY,aAAa;EAC3CsB,MAAM,EAAElC,eAAe,CAACc,WAAW;EACnCqB,gBAAgB,EAAEnC,eAAe,CAACgB,iBAAiB;EACnDoB,eAAe,EAAEpC,eAAe,CAACkB,gBAAgB;EACjDmB,eAAe,EAAErC,eAAe,CAACoB,gBAAgB;EACjDkB,KAAK,EAAEtC,eAAe,CAACsB,KAAK;EAC5BiB,gBAAgB,EAAEvC,eAAe,CAAC0B,kBAAkB;EACpDc,MAAM,EAAExC,eAAe,CAAC8B;AAC1B,CAAC;;AAED;AACA,MAAMW,sBAAsB,GAAGA,CAC7BC,QAAwB,EACxBC,GAAkB,EAClBC,UAAkB,EAClBC,IAAoB,KACmC;EACvD,MAAMC,QAAQ,GAAG3C,wBAAwB,CAACwC,GAAG,CAAC,GAAGvC,sBAAsB,CAACwC,UAAU,CAAC,GAAGG,SAAS;EAE/F,OAAOD,QAAQ,GAAG;IAAEE,IAAI,EAAEF,QAAQ;IAAEG,MAAM,EAAEhD;EAAa,CAAC,GAAGC,mBAAmB,CAACwC,QAAQ,EAAEE,UAAU,EAAEC,IAAI,CAAC;AAC9G,CAAC;AAED,SAASJ,sBAAsB","ignoreList":[]}
1
+ {"version":3,"names":["ObservationCode","HealthDataType","LOINC_SYSTEM","getHealthDataCoding","isCoreMeasurementTypeKey","CORE_MEASUREMENT_CODES","HKQuantityTypeIdentifierBloodPressureSystolic","SYSTOLIC_BLOOD_PRESSURE","HKQuantityTypeIdentifierBloodPressureDiastolic","DIASTOLIC_BLOOD_PRESSURE","HKQuantityTypeIdentifierHeartRate","HEART_RATE","HKQuantityTypeIdentifierBloodGlucose","BLOOD_GLUCOSE","HKQuantityTypeIdentifierBodyMass","BODY_WEIGHT","HKQuantityTypeIdentifierOxygenSaturation","OXYGEN_SATURATION","HKQuantityTypeIdentifierRespiratoryRate","RESPIRATORY_RATE","HKQuantityTypeIdentifierBodyTemperature","BODY_TEMPERATURE","HKQuantityTypeIdentifierStepCount","STEPS","HKQuantityTypeIdentifierHeartRateVariabilitySDNN","HEART_RATE_VARIABILITY","HKQuantityTypeIdentifierRestingHeartRate","RESTING_HEART_RATE","HKQuantityTypeIdentifierWalkingHeartRateAverage","WALKING_HEART_RATE_AVERAGE","HKQuantityTypeIdentifierVO2Max","VO2_MAX","HKElectrocardiogramType","ECG","BloodPressure","HeartRate","BloodGlucose","Weight","OxygenSaturation","RespiratoryRate","BodyTemperature","Steps","RestingHeartRate","Vo2Max","SHARED_RECORD_FIELDS","Nutrition","carbohydrates","caloriesEaten","ExerciseSession","exerciseMinutes","getDefaultHealthCoding","provider","key","identifier","mode","coreCode","undefined","code","system","coding","field"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/default-health-coding.ts"],"mappings":";;AAAA,SAASA,eAAe,QAAQ,iBAAiB;AAGjD,SAAyBC,cAAc,QAAuB,8BAA2B;AAEzF,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,mBAAmB,QAAQ,0BAAuB;AAC3D,SAASC,wBAAwB,QAAQ,kCAA+B;;AAExE;AACA,MAAMC,sBAA0E,GAAG;EACjFC,6CAA6C,EAAEN,eAAe,CAACO,uBAAuB;EACtFC,8CAA8C,EAAER,eAAe,CAACS,wBAAwB;EACxFC,iCAAiC,EAAEV,eAAe,CAACW,UAAU;EAC7DC,oCAAoC,EAAEZ,eAAe,CAACa,aAAa;EACnEC,gCAAgC,EAAEd,eAAe,CAACe,WAAW;EAC7DC,wCAAwC,EAAEhB,eAAe,CAACiB,iBAAiB;EAC3EC,uCAAuC,EAAElB,eAAe,CAACmB,gBAAgB;EACzEC,uCAAuC,EAAEpB,eAAe,CAACqB,gBAAgB;EACzEC,iCAAiC,EAAEtB,eAAe,CAACuB,KAAK;EACxDC,gDAAgD,EAAExB,eAAe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EAAEE,UAAU,EAAEC,IAAI,CAAC;EAC9D,MAAMM,KAAK,GAAGhB,oBAAoB,CAACS,UAAU,CAAC,GAAGD,GAAG,CAAC;EAErD,OAAOQ,KAAK,GAAG;IAAEH,IAAI,EAAE,GAAGE,MAAM,CAACF,IAAI,IAAIG,KAAK,EAAE;IAAEF,MAAM,EAAEC,MAAM,CAACD;EAAO,CAAC,GAAGC,MAAM;AACpF,CAAC;AAED,SAAST,sBAAsB","ignoreList":[]}
@@ -5,18 +5,20 @@
5
5
  import { startOfDay, subDays } from "date-fns";
6
6
  import { aggregateGroupByPeriod, getChanges, readRecords } from "react-native-health-connect";
7
7
  import { DEFAULT_HEALTH_SYNC_CHUNK_SIZE, DEFAULT_SYNC_LOOKBACK_DAYS } from "../constants.js";
8
+ import { HealthDataType } from "../types/health-sync-keys.js";
8
9
  import { getHealthConnectSeries } from "./health-connect-series.js";
9
10
  import { isDailyAggregateMode } from "./is-daily-aggregate-mode.js";
10
11
  import { syncWindowStart } from "./sync-window-start.js";
11
12
  export const getRecordsFromHealthConnect = async ({
12
13
  typeIdentifier,
14
+ key,
13
15
  startDate: _startDate,
14
16
  chunkSize = DEFAULT_HEALTH_SYNC_CHUNK_SIZE,
15
17
  anchor,
16
18
  mode = "point"
17
19
  }) => {
18
20
  if (isDailyAggregateMode(mode)) {
19
- return getDailyAggregates(typeIdentifier, mode, _startDate);
21
+ return getDailyAggregates(typeIdentifier, mode, _startDate, key);
20
22
  }
21
23
  if (mode === "series") {
22
24
  return getHealthConnectSeries(typeIdentifier, syncWindowStart(_startDate));
@@ -133,7 +135,7 @@ const decodeAnchor = anchor => {
133
135
  return undefined;
134
136
  }
135
137
  };
136
- const getDailyAggregates = async (typeIdentifier, mode, _startDate) => {
138
+ const getDailyAggregates = async (typeIdentifier, mode, _startDate, key) => {
137
139
  const aggregateType = typeIdentifier;
138
140
  const startDate = _startDate ? startOfDay(new Date(_startDate)) : startOfDay(subDays(new Date(), DEFAULT_SYNC_LOOKBACK_DAYS));
139
141
  const today = startOfDay(new Date());
@@ -155,7 +157,7 @@ const getDailyAggregates = async (typeIdentifier, mode, _startDate) => {
155
157
  return [];
156
158
  }
157
159
  const result = group.result;
158
- const measurement = aggregateMeasurement(typeIdentifier, result, mode);
160
+ const measurement = aggregateMeasurement(typeIdentifier, result, mode, key);
159
161
  if (!measurement) {
160
162
  return [];
161
163
  }
@@ -174,7 +176,7 @@ const getDailyAggregates = async (typeIdentifier, mode, _startDate) => {
174
176
  anchor: undefined
175
177
  };
176
178
  };
177
- const aggregateMeasurement = (typeIdentifier, result, mode) => {
179
+ const aggregateMeasurement = (typeIdentifier, result, mode, key) => {
178
180
  if (mode === "daily-summary" && typeIdentifier === "HeartRate") {
179
181
  const average = numberValue(result.BPM_AVG);
180
182
  return average === undefined ? undefined : {
@@ -195,10 +197,24 @@ const aggregateMeasurement = (typeIdentifier, result, mode) => {
195
197
  return value(numberValue(result.FLOORS_CLIMBED_TOTAL), "count");
196
198
  case "ExerciseSession":
197
199
  return value(scale(nestedNumber(result.EXERCISE_DURATION_TOTAL, "inSeconds"), 1 / 60), "min");
200
+ case "Hydration":
201
+ return value(nestedNumber(result.VOLUME_TOTAL, "inMilliliters"), "mL");
202
+ case "Nutrition":
203
+ return nutrientTotal(result, key);
198
204
  default:
199
205
  return undefined;
200
206
  }
201
207
  };
208
+
209
+ /** The nutrient each data type reads from Health Connect's Nutrition record: its daily total and that total's unit. */
210
+ const NUTRIENT_TOTALS = {
211
+ [HealthDataType.carbohydrates]: ["TOTAL_CARBOHYDRATE_TOTAL", "inGrams", "g"],
212
+ [HealthDataType.caloriesEaten]: ["ENERGY_TOTAL", "inKilocalories", "kcal"]
213
+ };
214
+ const nutrientTotal = (result, key) => {
215
+ const nutrient = key && NUTRIENT_TOTALS[key];
216
+ return nutrient && value(nestedNumber(result[nutrient[0]], nutrient[1]), nutrient[2]);
217
+ };
202
218
  const value = (measurement, unit) => measurement === undefined ? undefined : {
203
219
  unit,
204
220
  value: measurement
@@ -1 +1 @@
1
- {"version":3,"names":["startOfDay","subDays","aggregateGroupByPeriod","getChanges","readRecords","DEFAULT_HEALTH_SYNC_CHUNK_SIZE","DEFAULT_SYNC_LOOKBACK_DAYS","getHealthConnectSeries","isDailyAggregateMode","syncWindowStart","getRecordsFromHealthConnect","typeIdentifier","startDate","_startDate","chunkSize","anchor","mode","getDailyAggregates","savedAnchor","decodeAnchor","phase","changes","changesToken","recordTypes","changesTokenExpired","data","upsertionChanges","map","record","deletionChanges","length","deletedRecordIds","recordId","hasMore","encodeAnchor","version","nextChangesToken","baseline","readSnapshot","pageToken","undefined","snapshotAnchor","endDate","Date","toISOString","resolvedStartDate","result","timeRangeFilter","operator","startTime","endTime","pageSize","nextAnchor","records","Boolean","JSON","stringify","startsWith","parsed","parse","aggregateType","today","groups","recordType","timeRangeSlicer","period","flatMap","group","end","measurement","aggregateMeasurement","dataOrigins","kind","sourceApp","average","numberValue","BPM_AVG","unit","minimum","BPM_MIN","maximum","BPM_MAX","value","COUNT_TOTAL","nestedNumber","DISTANCE","ACTIVE_CALORIES_TOTAL","FLOORS_CLIMBED_TOTAL","scale","EXERCISE_DURATION_TOTAL","Number","isFinite","key","factor"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/get-records-from-health-connect.ts"],"mappings":";;AAAA;;AAEA,SAASA,UAAU,EAAEC,OAAO,QAAQ,UAAU;AAC9C,SACEC,sBAAsB,EAEtBC,UAAU,EACVC,WAAW,QAGN,6BAA6B;AAEpC,SAASC,8BAA8B,EAAEC,0BAA0B,QAAQ,iBAAc;AAMzF,SAASC,sBAAsB,QAAQ,4BAAyB;AAChE,SAASC,oBAAoB,QAAQ,8BAA2B;AAChE,SAASC,eAAe,QAAQ,wBAAqB;AAOrD,OAAO,MAAMC,2BAA2B,GAAG,MAAAA,CAAO;EAChDC,cAAc;EACdC,SAAS,EAAEC,UAAU;EACrBC,SAAS,GAAGT,8BAA8B;EAC1CU,MAAM;EACNC,IAAI,GAAG;AAC6B,CAA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,KAAc,IACjC,OAAOA,KAAK,KAAK,QAAQ,IAAIQ,MAAM,CAACC,QAAQ,CAACT,KAAK,CAAC,GAAGA,KAAK,GAAG1C,SAAS;AAEzE,MAAM4C,YAAY,GAAGA,CAACF,KAAc,EAAEU,GAAW,KAC/CjB,WAAW,CAAEO,KAAK,GAA2CU,GAAG,CAAC,CAAC;AAEpE,MAAMJ,KAAK,GAAGA,CAACN,KAAyB,EAAEW,MAAc,KACtDX,KAAK,KAAK1C,SAAS,GAAGA,SAAS,GAAG0C,KAAK,GAAGW,MAAM","ignoreList":[]}
1
+ {"version":3,"names":["startOfDay","subDays","aggregateGroupByPeriod","getChanges","readRecords","DEFAULT_HEALTH_SYNC_CHUNK_SIZE","DEFAULT_SYNC_LOOKBACK_DAYS","HealthDataType","getHealthConnectSeries","isDailyAggregateMode","syncWindowStart","getRecordsFromHealthConnect","typeIdentifier","key","startDate","_startDate","chunkSize","anchor","mode","getDailyAggregates","savedAnchor","decodeAnchor","phase","changes","changesToken","recordTypes","changesTokenExpired","data","upsertionChanges","map","record","deletionChanges","length","deletedRecordIds","recordId","hasMore","encodeAnchor","version","nextChangesToken","baseline","readSnapshot","pageToken","undefined","snapshotAnchor","endDate","Date","toISOString","resolvedStartDate","result","timeRangeFilter","operator","startTime","endTime","pageSize","nextAnchor","records","Boolean","JSON","stringify","startsWith","parsed","parse","aggregateType","today","groups","recordType","timeRangeSlicer","period","flatMap","group","end","measurement","aggregateMeasurement","dataOrigins","kind","sourceApp","average","numberValue","BPM_AVG","unit","minimum","BPM_MIN","maximum","BPM_MAX","value","COUNT_TOTAL","nestedNumber","DISTANCE","ACTIVE_CALORIES_TOTAL","FLOORS_CLIMBED_TOTAL","scale","EXERCISE_DURATION_TOTAL","VOLUME_TOTAL","nutrientTotal","NUTRIENT_TOTALS","carbohydrates","caloriesEaten","nutrient","Number","isFinite","factor"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/get-records-from-health-connect.ts"],"mappings":";;AAAA;;AAE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IO,KAAc,IACjC,OAAOA,KAAK,KAAK,QAAQ,IAAIc,MAAM,CAACC,QAAQ,CAACf,KAAK,CAAC,GAAGA,KAAK,GAAG1C,SAAS;AAEzE,MAAM4C,YAAY,GAAGA,CAACF,KAAc,EAAEvE,GAAW,KAC/CgE,WAAW,CAAEO,KAAK,GAA2CvE,GAAG,CAAC,CAAC;AAEpE,MAAM6E,KAAK,GAAGA,CAACN,KAAyB,EAAEgB,MAAc,KACtDhB,KAAK,KAAK1C,SAAS,GAAGA,SAAS,GAAG0C,KAAK,GAAGgB,MAAM","ignoreList":[]}
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import Healthkit, { HKStatisticsOptions, HKWorkoutTypeIdentifier, UnitOfEnergy } from "@kingstinct/react-native-healthkit";
4
- import { addDays, startOfDay } from "date-fns";
5
- import { DEFAULT_HEALTH_SYNC_CHUNK_SIZE } from "../constants.js";
3
+ import Healthkit, { ElectrocardiogramTypeIdentifier, WorkoutTypeIdentifier } from "@kingstinct/react-native-healthkit";
4
+ import { DEFAULT_HEALTH_SYNC_CHUNK_SIZE, ECG_PAGE_SIZE } from "../constants.js";
6
5
  import { healthUnitFor } from "./health-units.js";
6
+ import { getDailyStatistics } from "./healthkit-daily-statistics.js";
7
7
  import { isCategoryIdentifier, isCorrelationIdentifier, isQuantityIdentifier, UnsupportedHealthKitDataError, unsupportedHealthKitTypeReason } from "./healthkit-data-types.js";
8
+ import { ALL_SAMPLES, strictDateWindow } from "./healthkit-query-options.js";
9
+ import { toEcgRecord, toPlainCorrelation, toPlainSample, toWorkoutRecord } from "./healthkit-samples.js";
8
10
  import { getHealthKitSeries } from "./healthkit-series.js";
9
11
  import { isDailyAggregateMode } from "./is-daily-aggregate-mode.js";
10
12
  import { syncWindowStart } from "./sync-window-start.js";
@@ -23,61 +25,56 @@ const getSamplesFromHealth = async ({
23
25
  }
24
26
  return mode === "series" ? getHealthKitSeries(typeIdentifier, startDate) : getDailyStatistics(typeIdentifier, mode, startDate, endDate);
25
27
  }
28
+ const filter = strictDateWindow(startDate, endDate);
26
29
  const options = {
27
- from: startDate,
28
- to: endDate,
29
30
  limit: chunkSize,
30
- anchor
31
+ anchor,
32
+ filter
31
33
  };
32
- if (typeIdentifier === HKWorkoutTypeIdentifier && typeof Healthkit.queryWorkoutSamplesWithAnchor === "function") {
33
- const result = await Healthkit.queryWorkoutSamplesWithAnchor({
34
+ if (typeIdentifier === WorkoutTypeIdentifier) {
35
+ const result = await Healthkit.queryWorkoutSamplesWithAnchor(options);
36
+ return toAnchoredResult(typeIdentifier, result.workouts.map(toWorkoutRecord), result);
37
+ }
38
+ if (typeIdentifier === ElectrocardiogramTypeIdentifier) {
39
+ const limit = Math.min(chunkSize, ECG_PAGE_SIZE);
40
+ const result = await Healthkit.queryElectrocardiogramSamplesWithAnchor({
34
41
  ...options,
35
- energyUnit: UnitOfEnergy.Kilocalories,
36
- distanceUnit: "km"
42
+ limit,
43
+ includeVoltages: true
37
44
  });
38
- if (!result) {
39
- return {
40
- data: [],
41
- anchor: undefined
42
- };
43
- }
44
- return toAnchoredResult(typeIdentifier, result);
45
+ return {
46
+ ...toAnchoredResult(typeIdentifier, result.samples.map(toEcgRecord), result),
47
+ hasMore: result.samples.length >= limit
48
+ };
45
49
  }
46
- if (typeIdentifier === "HKDataTypeIdentifierHeartbeatSeries" && typeof Healthkit.queryHeartbeatSeriesSamplesWithAnchor === "function") {
50
+ if (typeIdentifier === "HKDataTypeIdentifierHeartbeatSeries") {
47
51
  const result = await Healthkit.queryHeartbeatSeriesSamplesWithAnchor(options);
48
- return toAnchoredResult(typeIdentifier, result);
52
+ return toAnchoredResult(typeIdentifier, result.samples.map(toPlainSample), result);
49
53
  }
50
- if (isCategoryIdentifier(typeIdentifier) && typeof Healthkit.queryCategorySamplesWithAnchor === "function") {
54
+ if (isCategoryIdentifier(typeIdentifier)) {
51
55
  const result = await Healthkit.queryCategorySamplesWithAnchor(typeIdentifier, options);
52
- if (!result) {
53
- return {
54
- data: [],
55
- anchor: undefined
56
- };
57
- }
58
- return toAnchoredResult(typeIdentifier, result);
56
+ return toAnchoredResult(typeIdentifier, result.samples.map(toPlainSample), result);
59
57
  }
60
58
  if (isCorrelationIdentifier(typeIdentifier)) {
61
- const samples = await Healthkit.queryCorrelationSamples(typeIdentifier, {
62
- from: startDate,
63
- to: endDate
59
+ const correlations = await Healthkit.queryCorrelationSamples(typeIdentifier, {
60
+ limit: ALL_SAMPLES,
61
+ ascending: true,
62
+ filter
64
63
  });
65
64
  return {
66
- data: [...samples],
65
+ data: correlations.map(toPlainCorrelation),
67
66
  anchor: undefined
68
67
  };
69
68
  }
70
69
  if (typeIdentifier === "HKStateOfMindTypeIdentifier") {
70
+ // State of mind is read by window, not by anchor, so an unlimited page keeps the window from being cut short.
71
71
  const samples = await Healthkit.queryStateOfMindSamples({
72
- from: startDate,
73
- to: endDate,
74
- // This wrapper's state-of-mind API is not anchored. A zero limit maps to
75
- // HealthKit's unbounded query and avoids silently truncating the window.
76
- limit: 0,
77
- ascending: false
72
+ limit: ALL_SAMPLES,
73
+ ascending: false,
74
+ filter
78
75
  });
79
76
  return {
80
- data: [...samples],
77
+ data: samples.map(toPlainSample),
81
78
  anchor: undefined
82
79
  };
83
80
  }
@@ -86,13 +83,7 @@ const getSamplesFromHealth = async ({
86
83
  ...options,
87
84
  unit: healthUnitFor(typeIdentifier)
88
85
  });
89
- if (!result) {
90
- return {
91
- data: [],
92
- anchor: undefined
93
- };
94
- }
95
- return toAnchoredResult(typeIdentifier, result);
86
+ return toAnchoredResult(typeIdentifier, result.samples.map(toPlainSample), result);
96
87
  }
97
88
  throw new UnsupportedHealthKitDataError(typeIdentifier, unsupportedHealthKitTypeReason(typeIdentifier));
98
89
  };
@@ -106,50 +97,16 @@ const deletedRecordIds = samples => {
106
97
  };
107
98
 
108
99
  /** Maps one page of an anchored HealthKit query to the provider result shape. */
109
- const toAnchoredResult = (typeIdentifier, result) => ({
110
- data: [...result.samples],
111
- ...deletedRecordIds(result.deletedSamples),
112
- anchor: result.newAnchor ? {
100
+ const toAnchoredResult = (typeIdentifier, data, {
101
+ deletedSamples,
102
+ newAnchor
103
+ }) => ({
104
+ data,
105
+ ...deletedRecordIds(deletedSamples),
106
+ anchor: newAnchor ? {
113
107
  typeIdentifier,
114
- anchor: result.newAnchor
108
+ anchor: newAnchor
115
109
  } : undefined
116
110
  });
117
- const getDailyStatistics = async (typeIdentifier, mode, startDate, endDate) => {
118
- const firstDay = startOfDay(startDate);
119
- const today = startOfDay(endDate);
120
- const options = mode === "daily-total" ? [HKStatisticsOptions.cumulativeSum] : [HKStatisticsOptions.discreteAverage, HKStatisticsOptions.discreteMin, HKStatisticsOptions.discreteMax];
121
- const statistics = await Healthkit.queryStatisticsCollectionForQuantity(typeIdentifier, options, startOfDay(new Date(2001, 0, 1)), {
122
- day: 1
123
- }, firstDay, today, healthUnitFor(typeIdentifier));
124
- const data = statistics.flatMap((statistic, index) => {
125
- const dayStart = addDays(firstDay, index);
126
- const dayEnd = addDays(dayStart, 1);
127
- const total = statistic.sumQuantity?.quantity;
128
- const average = statistic.averageQuantity?.quantity;
129
- const minimum = statistic.minimumQuantity?.quantity;
130
- const maximum = statistic.maximumQuantity?.quantity;
131
- if (dayEnd > today || (mode === "daily-total" ? total === undefined : average === undefined)) {
132
- return [];
133
- }
134
- return [{
135
- kind: mode,
136
- typeIdentifier,
137
- startDate: dayStart,
138
- endDate: dayEnd,
139
- unit: statistic.sumQuantity?.unit ?? statistic.averageQuantity?.unit ?? healthUnitFor(typeIdentifier) ?? "1",
140
- ...(mode === "daily-total" ? {
141
- value: total
142
- } : {
143
- average,
144
- minimum,
145
- maximum
146
- })
147
- }];
148
- });
149
- return {
150
- data,
151
- anchor: undefined
152
- };
153
- };
154
111
  export { getSamplesFromHealth };
155
112
  //# sourceMappingURL=get-samples-from-health.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Healthkit","HKStatisticsOptions","HKWorkoutTypeIdentifier","UnitOfEnergy","addDays","startOfDay","DEFAULT_HEALTH_SYNC_CHUNK_SIZE","healthUnitFor","isCategoryIdentifier","isCorrelationIdentifier","isQuantityIdentifier","UnsupportedHealthKitDataError","unsupportedHealthKitTypeReason","getHealthKitSeries","isDailyAggregateMode","syncWindowStart","getSamplesFromHealth","startDate","_startDate","typeIdentifier","anchor","chunkSize","mode","endDate","Date","getDailyStatistics","options","from","to","limit","queryWorkoutSamplesWithAnchor","result","energyUnit","Kilocalories","distanceUnit","data","undefined","toAnchoredResult","queryHeartbeatSeriesSamplesWithAnchor","queryCategorySamplesWithAnchor","samples","queryCorrelationSamples","queryStateOfMindSamples","ascending","queryQuantitySamplesWithAnchor","unit","deletedRecordIds","recordIds","map","uuid","length","deletedSamples","newAnchor","firstDay","today","cumulativeSum","discreteAverage","discreteMin","discreteMax","statistics","queryStatisticsCollectionForQuantity","day","flatMap","statistic","index","dayStart","dayEnd","total","sumQuantity","quantity","average","averageQuantity","minimum","minimumQuantity","maximum","maximumQuantity","kind","value"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/get-samples-from-health.ts"],"mappings":";;AAAA,OAAOA,SAAS,IAIdC,mBAAmB,EACnBC,uBAAuB,EACvBC,YAAY,QACP,oCAAoC;AAC3C,SAASC,OAAO,EAAEC,UAAU,QAAQ,UAAU;AAE9C,SAASC,8BAA8B,QAAQ,iBAAc;AAM7D,SAASC,aAAa,QAAQ,mBAAgB;AAC9C,SACEC,oBAAoB,EACpBC,uBAAuB,EACvBC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,2BAAwB;AAC/B,SAASC,kBAAkB,QAAQ,uBAAoB;AACvD,SAASC,oBAAoB,QAAQ,8BAA2B;AAChE,SAASC,eAAe,QAAQ,wBAAqB;AAErD,MAAMC,oBAAoB,GAAG,MAAAA,CAAO;EAClCC,SAAS,EAAEC,UAAU;EACrBC,cAAc;EACdC,MAAM;EACNC,SAAS,GAAGf,8BAA8B;EAC1CgB,IAAI,GAAG;AACgD,CAAC,KA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,EAAEgB;EAAU,CAAC;AACpC,CAAC;AAED,SAASpB,oBAAoB","ignoreList":[]}
1
+ {"version":3,"names":["Healthkit","ElectrocardiogramTypeIdentifier","WorkoutTypeIdentifier","DEFAULT_HEALTH_SYNC_CHUNK_SIZE","ECG_PAGE_SIZE","healthUnitFor","getDailyStatistics","isCategoryIdentifier","isCorrelationIdentifier","isQuantityIdentifier","UnsupportedHealthKitDataError","unsupportedHealthKitTypeReason","ALL_SAMPLES","strictDateWindow","toEcgRecord","toPlainCorrelation","toPlainSample","toWorkoutRecord","getHealthKitSeries","isDailyAggregateMode","syncWindowStart","getSamplesFromHealth","startDate","_startDate","typeIdentifier","anchor","chunkSize","mode","endDate","Date","filter","options","limit","result","queryWorkoutSamplesWithAnchor","toAnchoredResult","workouts","map","Math","min","queryElectrocardiogramSamplesWithAnchor","includeVoltages","samples","hasMore","length","queryHeartbeatSeriesSamplesWithAnchor","queryCategorySamplesWithAnchor","correlations","queryCorrelationSamples","ascending","data","undefined","queryStateOfMindSamples","queryQuantitySamplesWithAnchor","unit","deletedRecordIds","recordIds","uuid","deletedSamples","newAnchor"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/get-samples-from-health.ts"],"mappings":";;AAAA,OAAOA,SAAS,IACdC,+BAA+B,EAC/BC,qBAAqB,QAChB,oCAAoC;AAE3C,SAASC,8BAA8B,EAAEC,aAAa,QAAQ,iBAAc;AAI5E,SAASC,aAAa,QAAQ,mBAAgB;AAC9C,SAASC,kBAAkB,QAAQ,iCAA8B;AACjE,SACEC,oBAAoB,EACpBC,uBAAuB,EACvBC,oBAAoB,EACpBC,6BAA6B,EAC7BC,8BAA8B,QACzB,2BAAwB;AAC/B,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,8BAA2B;AACzE,SACEC,WAAW,EACXC,kBAAkB,EAClBC,aAAa,EACbC,eAAe,QACV,wBAAqB;AAC5B,SAASC,kBAAkB,QAAQ,uBAAoB;AACvD,SAASC,oBAAoB,QAAQ,8BAA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MAChBnB;IACF,CAAC,CAAC;IAEF,OAAO;MAAEoB,IAAI,EAAER,OAAO,CAACL,GAAG,CAACrB,aAAa,CAAC;MAAES,MAAM,EAAE0B;IAAU,CAAC;EAChE;EAEA,IAAI1C,oBAAoB,CAACe,cAAc,CAAC,EAAE;IACxC,MAAMS,MAAM,GAAG,MAAMjC,SAAS,CAACqD,8BAA8B,CAC3D7B,cAAc,EACd;MAAE,GAAGO,OAAO;MAAEuB,IAAI,EAAEjD,aAAa,CAACmB,cAAc;IAAE,CACpD,CAAC;IAED,OAAOW,gBAAgB,CACrBX,cAAc,EACdS,MAAM,CAACS,OAAO,CAACL,GAAG,CAACrB,aAAa,CAAC,EACjCiB,MACF,CAAC;EACH;EAEA,MAAM,IAAIvB,6BAA6B,CACrCc,cAAc,EACdb,8BAA8B,CAACa,cAAc,CAC/C,CAAC;AACH,CAAC;AAED,MAAM+B,gBAAgB,GAAIb,OAAoC,IAAK;EACjE,MAAMc,SAAS,GAAGd,OAAO,CAACL,GAAG,CAAC,CAAC;IAAEoB;EAAK,CAAC,KAAKA,IAAI,CAAC;EAEjD,OAAOD,SAAS,CAACZ,MAAM,GAAG,CAAC,GAAG;IAAEW,gBAAgB,EAAEC;EAAU,CAAC,GAAG,CAAC,CAAC;AACpE,CAAC;;AAED;AACA,MAAMrB,gBAAgB,GAAGA,CACvBX,cAA6C,EAC7C0B,IAAe,EACf;EAAEQ,cAAc;EAAEC;AAA6B,CAAC,MAC5C;EACJT,IAAI;EACJ,GAAGK,gBAAgB,CAACG,cAAc,CAAC;EACnCjC,MAAM,EAAEkC,SAAS,GAAG;IAAEnC,cAAc;IAAEC,MAAM,EAAEkC;EAAU,CAAC,GAAGR;AAC9D,CAAC,CAAC;AAEF,SAAS9B,oBAAoB","ignoreList":[]}
@@ -4,6 +4,8 @@ import Healthkit from "@kingstinct/react-native-healthkit";
4
4
  import { addSeconds } from "date-fns";
5
5
  import { getSamplesFromHealth } from "./get-samples-from-health.js";
6
6
  import { healthUnitFor } from "./health-units.js";
7
+ import { isQuantityIdentifier } from "./healthkit-data-types.js";
8
+ import { ALL_SAMPLES, strictDateWindow } from "./healthkit-query-options.js";
7
9
  export const getTotalSamplesCount = async props => {
8
10
  const {
9
11
  typeIdentifier,
@@ -22,15 +24,14 @@ export const getTotalSamplesCount = async props => {
22
24
  const startDate = _startDate ? addSeconds(_startDate, 1) : undefined;
23
25
  try {
24
26
  const result = await Healthkit.queryQuantitySamplesWithAnchor(typeIdentifier, {
25
- from: startDate,
26
- to: new Date(),
27
+ limit: ALL_SAMPLES,
27
28
  anchor,
28
- unit: healthUnitFor(typeIdentifier)
29
+ unit: healthUnitFor(typeIdentifier),
30
+ filter: strictDateWindow(startDate, new Date())
29
31
  });
30
32
  return result?.samples?.length ?? 0;
31
33
  } catch {
32
34
  return 0;
33
35
  }
34
36
  };
35
- const isQuantityIdentifier = typeIdentifier => typeof typeIdentifier === "string" && typeIdentifier.startsWith("HKQuantityTypeIdentifier");
36
37
  //# sourceMappingURL=get-total-samples-count.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Healthkit","addSeconds","getSamplesFromHealth","healthUnitFor","getTotalSamplesCount","props","typeIdentifier","startDate","_startDate","anchor","mode","isQuantityIdentifier","result","data","length","undefined","queryQuantitySamplesWithAnchor","from","to","Date","unit","samples","startsWith"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/get-total-samples-count.ts"],"mappings":";;AAAA,OAAOA,SAAS,MAET,oCAAoC;AAC3C,SAASC,UAAU,QAAQ,UAAU;AAKrC,SAASC,oBAAoB,QAAQ,8BAA2B;AAChE,SAASC,aAAa,QAAQ,mBAAgB;AAE9C,OAAO,MAAMC,oBAAoB,GAAG,MAClCC,KAAwD,IACpC;EACpB,MAAM;IAAEC,cAAc;IAAEC,SAAS,EAAEC,UAAU;IAAEC,MAAM;IAAEC,IAAI,GAAG;EAAQ,CAAC,GAAGL,KAAK;EAE/E,IAAIK,IAAI,KAAK,OAAO,IAAI,CAACC,oBAAoB,CAACL,cAAc,CAAC,EAAE;IAC7D,IAAI;MACF,MAAMM,MAAM,GAAG,MAAMV,oBAAoB,CAACG,KAAK,CAAC;MAEhD,OAAOO,MAAM,CAACC,IAAI,CAACC,MAAM;IAC3B,CAAC,CAAC,MAAM;MACN,OAAO,CAAC;IACV;EACF;EAEA,MAAMP,SAAS,GAAGC,UAAU,GAAGP,UAAU,CAACO,UAAU,EAAE,CAAC,CAAC,GAAGO,SAAS;EAEpE,IAAI;IACF,MAAMH,MAAM,GAAG,MAAMZ,SAAS,CAACgB,8BAA8B,CAC3DV,cAAc,EACd;MACEW,IAAI,EAAEV,SAAS;MACfW,EAAE,EAAE,IAAIC,IAAI,CAAC,CAAC;MACdV,MAAM;MACNW,IAAI,EAAEjB,aAAa,CAACG,cAAc;IACpC,CACF,CAAC;IAED,OAAOM,MAAM,EAAES,OAAO,EAAEP,MAAM,IAAI,CAAC;EACrC,CAAC,CAAC,MAAM;IACN,OAAO,CAAC;EACV;AACF,CAAC;AAED,MAAMH,oBAAoB,GACxBL,cAA6C,IAE7C,OAAOA,cAAc,KAAK,QAAQ,IAClCA,cAAc,CAACgB,UAAU,CAAC,0BAA0B,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Healthkit","addSeconds","getSamplesFromHealth","healthUnitFor","isQuantityIdentifier","ALL_SAMPLES","strictDateWindow","getTotalSamplesCount","props","typeIdentifier","startDate","_startDate","anchor","mode","result","data","length","undefined","queryQuantitySamplesWithAnchor","limit","unit","filter","Date","samples"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/get-total-samples-count.ts"],"mappings":";;AAAA,OAAOA,SAAS,MAAM,oCAAoC;AAC1D,SAASC,UAAU,QAAQ,UAAU;AAKrC,SAASC,oBAAoB,QAAQ,8BAA2B;AAChE,SAASC,aAAa,QAAQ,mBAAgB;AAC9C,SAASC,oBAAoB,QAAQ,2BAAwB;AAC7D,SAASC,WAAW,EAAEC,gBAAgB,QAAQ,8BAA2B;AAEzE,OAAO,MAAMC,oBAAoB,GAAG,MAClCC,KAAwD,IACpC;EACpB,MAAM;IAAEC,cAAc;IAAEC,SAAS,EAAEC,UAAU;IAAEC,MAAM;IAAEC,IAAI,GAAG;EAAQ,CAAC,GAAGL,KAAK;EAE/E,IAAIK,IAAI,KAAK,OAAO,IAAI,CAACT,oBAAoB,CAACK,cAAc,CAAC,EAAE;IAC7D,IAAI;MACF,MAAMK,MAAM,GAAG,MAAMZ,oBAAoB,CAACM,KAAK,CAAC;MAEhD,OAAOM,MAAM,CAACC,IAAI,CAACC,MAAM;IAC3B,CAAC,CAAC,MAAM;MACN,OAAO,CAAC;IACV;EACF;EAEA,MAAMN,SAAS,GAAGC,UAAU,GAAGV,UAAU,CAACU,UAAU,EAAE,CAAC,CAAC,GAAGM,SAAS;EAEpE,IAAI;IACF,MAAMH,MAAM,GAAG,MAAMd,SAAS,CAACkB,8BAA8B,CAC3DT,cAAc,EACd;MACEU,KAAK,EAAEd,WAAW;MAClBO,MAAM;MACNQ,IAAI,EAAEjB,aAAa,CAACM,cAAc,CAAC;MACnCY,MAAM,EAAEf,gBAAgB,CAACI,SAAS,EAAE,IAAIY,IAAI,CAAC,CAAC;IAChD,CACF,CAAC;IAED,OAAOR,MAAM,EAAES,OAAO,EAAEP,MAAM,IAAI,CAAC;EACrC,CAAC,CAAC,MAAM;IACN,OAAO,CAAC;EACV;AACF,CAAC","ignoreList":[]}