@ovok/native 1.16.1-rc.5 → 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 (712) hide show
  1. package/lib/commonjs/modules/auth/google-return-page/index.js +24 -0
  2. package/lib/commonjs/modules/auth/google-return-page/index.js.map +1 -0
  3. package/lib/commonjs/modules/auth/hooks/use-social-sign-in.web.js +15 -0
  4. package/lib/commonjs/modules/auth/hooks/use-social-sign-in.web.js.map +1 -0
  5. package/lib/commonjs/modules/auth/index.js +21 -10
  6. package/lib/commonjs/modules/auth/index.js.map +1 -1
  7. package/lib/commonjs/modules/auth/session/logout-session.js +1 -1
  8. package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.web.js +73 -0
  9. package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login-button.web.js.map +1 -0
  10. package/lib/commonjs/modules/auth/sign-in/components/social-logins/apple-login.js +1 -1
  11. package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.web.js +73 -0
  12. package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login-button.web.js.map +1 -0
  13. package/lib/commonjs/modules/auth/sign-in/components/social-logins/google-login.js +1 -1
  14. package/lib/commonjs/modules/auth/sign-in/index.js +24 -0
  15. package/lib/commonjs/modules/auth/sign-in/index.js.map +1 -1
  16. package/lib/commonjs/modules/auth/sign-in/utils/apple-web-sign-in.js +90 -0
  17. package/lib/commonjs/modules/auth/sign-in/utils/apple-web-sign-in.js.map +1 -0
  18. package/lib/commonjs/modules/auth/sign-in/utils/google-redirect-sign-in.js +89 -0
  19. package/lib/commonjs/modules/auth/sign-in/utils/google-redirect-sign-in.js.map +1 -0
  20. package/lib/commonjs/modules/auth/sign-in/utils/jwt-claims.js +21 -0
  21. package/lib/commonjs/modules/auth/sign-in/utils/jwt-claims.js.map +1 -0
  22. package/lib/commonjs/modules/auth/utils/sign-out-google.web.js +10 -0
  23. package/lib/commonjs/modules/auth/utils/sign-out-google.web.js.map +1 -0
  24. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  25. package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  26. package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
  27. package/lib/commonjs/modules/bt-management/index.js +12 -0
  28. package/lib/commonjs/modules/bt-management/index.js.map +1 -1
  29. package/lib/commonjs/modules/bt-management/services/bt-manager.js +27 -1
  30. package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
  31. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js +42 -2
  32. package/lib/commonjs/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  33. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +64 -44
  34. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -1
  35. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js +98 -0
  36. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js.map +1 -0
  37. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js +127 -0
  38. package/lib/commonjs/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js.map +1 -0
  39. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js +48 -17
  40. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  41. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -2
  42. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  43. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +78 -19
  44. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  45. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  46. package/lib/commonjs/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  47. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +11 -3
  48. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  49. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  50. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  51. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.records.js +2 -7
  52. package/lib/commonjs/modules/bt-management/services/devices/cofoe/cofoe.records.js.map +1 -1
  53. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  54. package/lib/commonjs/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  55. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +115 -26
  56. package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  57. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js +19 -2
  58. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  59. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +32 -0
  60. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  61. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +73 -0
  62. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  63. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +130 -30
  64. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  65. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +103 -0
  66. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  67. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  68. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  69. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  70. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  71. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  72. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  73. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +75 -0
  74. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  75. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +113 -0
  76. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  77. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +67 -0
  78. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  79. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js +55 -0
  80. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  81. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +57 -0
  82. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  83. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js +49 -0
  84. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  85. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js +46 -0
  86. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  87. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  88. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  89. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js +27 -0
  90. package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  91. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  92. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  93. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +75 -20
  94. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  95. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +21 -12
  96. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  97. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +47 -0
  98. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  99. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  100. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  101. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js +3 -7
  102. package/lib/commonjs/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js.map +1 -1
  103. package/lib/commonjs/modules/bt-management/services/series-recorder.js +27 -5
  104. package/lib/commonjs/modules/bt-management/services/series-recorder.js.map +1 -1
  105. package/lib/commonjs/modules/bt-management/types/device-waveform.js +6 -0
  106. package/lib/commonjs/modules/bt-management/types/device-waveform.js.map +1 -0
  107. package/lib/commonjs/modules/bt-management/utils/calculate-crc-16-modbus.js +23 -0
  108. package/lib/commonjs/modules/bt-management/utils/calculate-crc-16-modbus.js.map +1 -0
  109. package/lib/commonjs/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  110. package/lib/commonjs/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  111. package/lib/commonjs/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js +13 -0
  112. package/lib/commonjs/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js.map +1 -0
  113. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js +15 -8
  114. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  115. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js +1 -1
  116. package/lib/commonjs/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  117. package/lib/commonjs/modules/data-sync/constants.js +4 -1
  118. package/lib/commonjs/modules/data-sync/constants.js.map +1 -1
  119. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js +6 -9
  120. package/lib/commonjs/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  121. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js +8 -7
  122. package/lib/commonjs/modules/data-sync/services/managers/data-processor.js.map +1 -1
  123. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js +13 -0
  124. package/lib/commonjs/modules/data-sync/types/health-sync-keys.js.map +1 -1
  125. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js +47 -0
  126. package/lib/commonjs/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  127. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js +14 -6
  128. package/lib/commonjs/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  129. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  130. package/lib/commonjs/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  131. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js +68 -0
  132. package/lib/commonjs/modules/data-sync/utils/default-health-coding.js.map +1 -0
  133. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  134. package/lib/commonjs/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  135. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js +43 -86
  136. package/lib/commonjs/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  137. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js +6 -5
  138. package/lib/commonjs/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  139. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js +15 -15
  140. package/lib/commonjs/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  141. package/lib/commonjs/modules/data-sync/utils/health-units.js +11 -1
  142. package/lib/commonjs/modules/data-sync/utils/health-units.js.map +1 -1
  143. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js +64 -0
  144. package/lib/commonjs/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  145. package/lib/commonjs/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  146. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js +20 -0
  147. package/lib/commonjs/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  148. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js +21 -0
  149. package/lib/commonjs/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  150. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js +59 -0
  151. package/lib/commonjs/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  152. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js +20 -11
  153. package/lib/commonjs/modules/data-sync/utils/healthkit-series.js.map +1 -1
  154. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  155. package/lib/commonjs/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  156. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  157. package/lib/commonjs/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  158. package/lib/commonjs/modules/next/bluetooth/connections.js +45 -2
  159. package/lib/commonjs/modules/next/bluetooth/connections.js.map +1 -1
  160. package/lib/commonjs/modules/next/bluetooth/driver.js.map +1 -1
  161. package/lib/commonjs/modules/next/bluetooth/errors.js.map +1 -1
  162. package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
  163. package/lib/commonjs/modules/next/bluetooth/readings.js +10 -2
  164. package/lib/commonjs/modules/next/bluetooth/readings.js.map +1 -1
  165. package/lib/commonjs/modules/next/bluetooth/runtime.js +37 -1
  166. package/lib/commonjs/modules/next/bluetooth/runtime.js.map +1 -1
  167. package/lib/commonjs/modules/next/bluetooth/web/index.js.map +1 -1
  168. package/lib/module/modules/auth/google-return-page/index.js +21 -0
  169. package/lib/module/modules/auth/google-return-page/index.js.map +1 -0
  170. package/lib/module/modules/auth/hooks/use-social-sign-in.web.js +10 -0
  171. package/lib/module/modules/auth/hooks/use-social-sign-in.web.js.map +1 -0
  172. package/lib/module/modules/auth/index.js +2 -1
  173. package/lib/module/modules/auth/index.js.map +1 -1
  174. package/lib/module/modules/auth/session/logout-session.js +1 -1
  175. package/lib/module/modules/auth/session/logout-session.js.map +1 -1
  176. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.web.js +67 -0
  177. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login-button.web.js.map +1 -0
  178. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login.js +1 -1
  179. package/lib/module/modules/auth/sign-in/components/social-logins/apple-login.js.map +1 -1
  180. package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.web.js +68 -0
  181. package/lib/module/modules/auth/sign-in/components/social-logins/google-login-button.web.js.map +1 -0
  182. package/lib/module/modules/auth/sign-in/components/social-logins/google-login.js +1 -1
  183. package/lib/module/modules/auth/sign-in/components/social-logins/google-login.js.map +1 -1
  184. package/lib/module/modules/auth/sign-in/index.js +2 -0
  185. package/lib/module/modules/auth/sign-in/index.js.map +1 -1
  186. package/lib/module/modules/auth/sign-in/utils/apple-web-sign-in.js +84 -0
  187. package/lib/module/modules/auth/sign-in/utils/apple-web-sign-in.js.map +1 -0
  188. package/lib/module/modules/auth/sign-in/utils/google-redirect-sign-in.js +84 -0
  189. package/lib/module/modules/auth/sign-in/utils/google-redirect-sign-in.js.map +1 -0
  190. package/lib/module/modules/auth/sign-in/utils/jwt-claims.js +17 -0
  191. package/lib/module/modules/auth/sign-in/utils/jwt-claims.js.map +1 -0
  192. package/lib/module/modules/auth/utils/sign-out-google.web.js +5 -0
  193. package/lib/module/modules/auth/utils/sign-out-google.web.js.map +1 -0
  194. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +19 -7
  195. package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
  196. package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
  197. package/lib/module/modules/bt-management/index.js +1 -0
  198. package/lib/module/modules/bt-management/index.js.map +1 -1
  199. package/lib/module/modules/bt-management/services/bt-manager.js +27 -1
  200. package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
  201. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js +42 -2
  202. package/lib/module/modules/bt-management/services/custom/compile-custom-lepu.js.map +1 -1
  203. package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js +64 -44
  204. package/lib/module/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.js.map +1 -1
  205. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js +91 -0
  206. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.js.map +1 -0
  207. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js +123 -0
  208. package/lib/module/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.js.map +1 -0
  209. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js +48 -17
  210. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  211. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +2 -3
  212. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -1
  213. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js +77 -19
  214. package/lib/module/modules/bt-management/services/devices/bp2/bp2.history-sequencer.js.map +1 -1
  215. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js +30 -2
  216. package/lib/module/modules/bt-management/services/devices/bt-command-writer.js.map +1 -1
  217. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +11 -3
  218. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  219. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +48 -3
  220. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  221. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.records.js +2 -7
  222. package/lib/module/modules/bt-management/services/devices/cofoe/cofoe.records.js.map +1 -1
  223. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js +6 -2
  224. package/lib/module/modules/bt-management/services/devices/custom/custom-lepu-sequencer.js.map +1 -1
  225. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +115 -26
  226. package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
  227. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js +17 -1
  228. package/lib/module/modules/bt-management/services/devices/lepu/lepu.advertisement.js.map +1 -1
  229. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js +28 -0
  230. package/lib/module/modules/bt-management/services/devices/lepu/lepu.connect-retry.js.map +1 -0
  231. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js +69 -0
  232. package/lib/module/modules/bt-management/services/devices/lepu/lepu.delivered-files.js.map +1 -0
  233. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js +129 -30
  234. package/lib/module/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.js.map +1 -1
  235. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js +99 -0
  236. package/lib/module/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.js.map +1 -0
  237. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +20 -14
  238. package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
  239. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js +4 -2
  240. package/lib/module/modules/bt-management/services/devices/lepu/lepu.frame-reader.js.map +1 -1
  241. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js +94 -10
  242. package/lib/module/modules/bt-management/services/devices/lepu/lepu.identity-gate.js.map +1 -1
  243. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js +72 -0
  244. package/lib/module/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.js.map +1 -0
  245. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js +109 -0
  246. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.js.map +1 -0
  247. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js +64 -0
  248. package/lib/module/modules/bt-management/services/devices/lepu/lepu.pulse-wave.js.map +1 -0
  249. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js +51 -0
  250. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recorder.js.map +1 -0
  251. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js +53 -0
  252. package/lib/module/modules/bt-management/services/devices/lepu/lepu.recording-watch.js.map +1 -0
  253. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js +45 -0
  254. package/lib/module/modules/bt-management/services/devices/lepu/lepu.session.js.map +1 -0
  255. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js +42 -0
  256. package/lib/module/modules/bt-management/services/devices/lepu/lepu.stored-files.js.map +1 -0
  257. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js +10 -4
  258. package/lib/module/modules/bt-management/services/devices/lepu/lepu.transports.js.map +1 -1
  259. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js +22 -0
  260. package/lib/module/modules/bt-management/services/devices/lepu/lepu.waveform.js.map +1 -0
  261. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js +0 -1
  262. package/lib/module/modules/bt-management/services/devices/viatom/viatom.bp-monitors.js.map +1 -1
  263. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js +75 -21
  264. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-files.js.map +1 -1
  265. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js +21 -12
  266. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.js.map +1 -1
  267. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js +44 -0
  268. package/lib/module/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.js.map +1 -0
  269. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js +58 -32
  270. package/lib/module/modules/bt-management/services/devices/viatom/viatom.oximeters.js.map +1 -1
  271. package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js +3 -7
  272. package/lib/module/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.js.map +1 -1
  273. package/lib/module/modules/bt-management/services/series-recorder.js +27 -5
  274. package/lib/module/modules/bt-management/services/series-recorder.js.map +1 -1
  275. package/lib/module/modules/bt-management/types/device-waveform.js +4 -0
  276. package/lib/module/modules/bt-management/types/device-waveform.js.map +1 -0
  277. package/lib/module/modules/bt-management/utils/calculate-crc-16-modbus.js +18 -0
  278. package/lib/module/modules/bt-management/utils/calculate-crc-16-modbus.js.map +1 -0
  279. package/lib/module/modules/bt-management/utils/i-16-from-hex.js.map +1 -1
  280. package/lib/module/modules/bt-management/utils/le-32-from-hex.js.map +1 -1
  281. package/lib/module/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js +8 -0
  282. package/lib/module/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.js.map +1 -0
  283. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js +16 -9
  284. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-provider.js.map +1 -1
  285. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js +2 -2
  286. package/lib/module/modules/data-sync/components/apple/apple-health-authorization-utils.js.map +1 -1
  287. package/lib/module/modules/data-sync/constants.js +4 -1
  288. package/lib/module/modules/data-sync/constants.js.map +1 -1
  289. package/lib/module/modules/data-sync/hooks/use-listen-changes.js +7 -10
  290. package/lib/module/modules/data-sync/hooks/use-listen-changes.js.map +1 -1
  291. package/lib/module/modules/data-sync/services/managers/data-processor.js +8 -7
  292. package/lib/module/modules/data-sync/services/managers/data-processor.js.map +1 -1
  293. package/lib/module/modules/data-sync/types/health-sync-keys.js +13 -0
  294. package/lib/module/modules/data-sync/types/health-sync-keys.js.map +1 -1
  295. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js +43 -0
  296. package/lib/module/modules/data-sync/utils/convert-ecg-samples-to-observation.js.map +1 -0
  297. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js +14 -6
  298. package/lib/module/modules/data-sync/utils/convert-generic-health-data.js.map +1 -1
  299. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js +7 -15
  300. package/lib/module/modules/data-sync/utils/convert-samples-to-observation.js.map +1 -1
  301. package/lib/module/modules/data-sync/utils/default-health-coding.js +65 -0
  302. package/lib/module/modules/data-sync/utils/default-health-coding.js.map +1 -0
  303. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js +20 -4
  304. package/lib/module/modules/data-sync/utils/get-records-from-health-connect.js.map +1 -1
  305. package/lib/module/modules/data-sync/utils/get-samples-from-health.js +44 -87
  306. package/lib/module/modules/data-sync/utils/get-samples-from-health.js.map +1 -1
  307. package/lib/module/modules/data-sync/utils/get-total-samples-count.js +5 -4
  308. package/lib/module/modules/data-sync/utils/get-total-samples-count.js.map +1 -1
  309. package/lib/module/modules/data-sync/utils/health-data-catalog.js +15 -15
  310. package/lib/module/modules/data-sync/utils/health-data-catalog.js.map +1 -1
  311. package/lib/module/modules/data-sync/utils/health-units.js +11 -1
  312. package/lib/module/modules/data-sync/utils/health-units.js.map +1 -1
  313. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js +59 -0
  314. package/lib/module/modules/data-sync/utils/healthkit-daily-statistics.js.map +1 -0
  315. package/lib/module/modules/data-sync/utils/healthkit-data-types.js.map +1 -1
  316. package/lib/module/modules/data-sync/utils/healthkit-query-options.js +16 -0
  317. package/lib/module/modules/data-sync/utils/healthkit-query-options.js.map +1 -0
  318. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js +17 -0
  319. package/lib/module/modules/data-sync/utils/healthkit-sample-source.js.map +1 -0
  320. package/lib/module/modules/data-sync/utils/healthkit-samples.js +52 -0
  321. package/lib/module/modules/data-sync/utils/healthkit-samples.js.map +1 -0
  322. package/lib/module/modules/data-sync/utils/healthkit-series.js +19 -10
  323. package/lib/module/modules/data-sync/utils/healthkit-series.js.map +1 -1
  324. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js +12 -2
  325. package/lib/module/modules/next/bluetooth/ble-plx/built-in-devices.js.map +1 -1
  326. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js +39 -5
  327. package/lib/module/modules/next/bluetooth/ble-plx/legacy-driver.js.map +1 -1
  328. package/lib/module/modules/next/bluetooth/connections.js +45 -2
  329. package/lib/module/modules/next/bluetooth/connections.js.map +1 -1
  330. package/lib/module/modules/next/bluetooth/driver.js.map +1 -1
  331. package/lib/module/modules/next/bluetooth/errors.js.map +1 -1
  332. package/lib/module/modules/next/bluetooth/index.js.map +1 -1
  333. package/lib/module/modules/next/bluetooth/readings.js +10 -2
  334. package/lib/module/modules/next/bluetooth/readings.js.map +1 -1
  335. package/lib/module/modules/next/bluetooth/runtime.js +37 -1
  336. package/lib/module/modules/next/bluetooth/runtime.js.map +1 -1
  337. package/lib/module/modules/next/bluetooth/web/index.js.map +1 -1
  338. package/lib/typescript/commonjs/src/modules/auth/google-return-page/index.d.ts +8 -0
  339. package/lib/typescript/commonjs/src/modules/auth/google-return-page/index.d.ts.map +1 -0
  340. package/lib/typescript/commonjs/src/modules/auth/hooks/use-social-sign-in.web.d.ts +7 -0
  341. package/lib/typescript/commonjs/src/modules/auth/hooks/use-social-sign-in.web.d.ts.map +1 -0
  342. package/lib/typescript/commonjs/src/modules/auth/index.d.ts +1 -0
  343. package/lib/typescript/commonjs/src/modules/auth/index.d.ts.map +1 -1
  344. package/lib/typescript/commonjs/src/modules/auth/register/components/register.d.ts +2 -2
  345. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/sign-in.d.ts +2 -2
  346. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts +5 -0
  347. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts.map +1 -0
  348. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/apple-login.d.ts +1 -1
  349. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts +5 -0
  350. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts.map +1 -0
  351. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/google-login.d.ts +1 -1
  352. package/lib/typescript/commonjs/src/modules/auth/sign-in/components/social-logins/social-logins.d.ts +2 -2
  353. package/lib/typescript/commonjs/src/modules/auth/sign-in/index.d.ts +2 -0
  354. package/lib/typescript/commonjs/src/modules/auth/sign-in/index.d.ts.map +1 -1
  355. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/apple-login-props.d.ts +13 -0
  356. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/apple-login-props.d.ts.map +1 -1
  357. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/google-login-props.d.ts +13 -0
  358. package/lib/typescript/commonjs/src/modules/auth/sign-in/types/google-login-props.d.ts.map +1 -1
  359. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts +17 -0
  360. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts.map +1 -0
  361. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts +14 -0
  362. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts.map +1 -0
  363. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/jwt-claims.d.ts +9 -0
  364. package/lib/typescript/commonjs/src/modules/auth/sign-in/utils/jwt-claims.d.ts.map +1 -0
  365. package/lib/typescript/commonjs/src/modules/auth/utils/sign-out-google.web.d.ts +3 -0
  366. package/lib/typescript/commonjs/src/modules/auth/utils/sign-out-google.web.d.ts.map +1 -0
  367. package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  368. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  369. package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  370. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
  371. package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
  372. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  373. package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  374. package/lib/typescript/commonjs/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  375. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -1
  376. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts +34 -0
  377. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts.map +1 -0
  378. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts +32 -0
  379. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts.map +1 -0
  380. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  381. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  382. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  383. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  384. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +29 -3
  385. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  386. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  387. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  388. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +2 -0
  389. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  390. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  391. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  392. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts.map +1 -1
  393. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  394. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  395. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  396. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  397. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  398. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  399. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  400. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  401. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  402. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  403. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  404. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  405. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  406. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  407. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  408. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  409. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  410. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  411. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  412. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  413. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  414. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  415. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  416. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  417. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  418. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  419. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  420. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  421. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  422. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  423. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  424. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  425. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  426. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  427. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +6 -1
  428. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  429. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  430. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  431. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  432. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +9 -3
  433. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  434. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  435. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  436. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  437. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  438. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts.map +1 -1
  439. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  440. package/lib/typescript/commonjs/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  441. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  442. package/lib/typescript/commonjs/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  443. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts +47 -3
  444. package/lib/typescript/commonjs/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  445. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  446. package/lib/typescript/commonjs/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  447. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  448. package/lib/typescript/commonjs/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  449. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts +3 -0
  450. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts.map +1 -0
  451. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  452. package/lib/typescript/commonjs/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  453. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  454. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  455. package/lib/typescript/commonjs/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts +3 -0
  456. package/lib/typescript/commonjs/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts.map +1 -0
  457. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  458. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  459. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  460. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts +3 -1
  461. package/lib/typescript/commonjs/src/modules/data-sync/constants.d.ts.map +1 -1
  462. package/lib/typescript/commonjs/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  463. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  464. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  465. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  466. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  467. package/lib/typescript/commonjs/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  468. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  469. package/lib/typescript/commonjs/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  470. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  471. package/lib/typescript/commonjs/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  472. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  473. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  474. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-props.d.ts +1 -1
  475. package/lib/typescript/commonjs/src/modules/data-sync/types/health-sync-props.d.ts.map +1 -1
  476. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  477. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  478. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  479. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  480. package/lib/typescript/commonjs/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  481. package/lib/typescript/commonjs/src/modules/data-sync/utils/default-health-coding.d.ts +10 -0
  482. package/lib/typescript/commonjs/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -0
  483. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  484. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  485. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  486. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  487. package/lib/typescript/commonjs/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  488. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  489. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts +2 -2
  490. package/lib/typescript/commonjs/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  491. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  492. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  493. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  494. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  495. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  496. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  497. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  498. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  499. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  500. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  501. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  502. package/lib/typescript/commonjs/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  503. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  504. package/lib/typescript/commonjs/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  505. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  506. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  507. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  508. package/lib/typescript/commonjs/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  509. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts +13 -1
  510. package/lib/typescript/commonjs/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  511. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts +20 -0
  512. package/lib/typescript/commonjs/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  513. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts +1 -1
  514. package/lib/typescript/commonjs/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  515. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +2 -1
  516. package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
  517. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts +3 -2
  518. package/lib/typescript/commonjs/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  519. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts +19 -1
  520. package/lib/typescript/commonjs/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  521. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  522. package/lib/typescript/commonjs/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  523. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts +1 -0
  524. package/lib/typescript/commonjs/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  525. package/lib/typescript/module/src/modules/auth/google-return-page/index.d.ts +8 -0
  526. package/lib/typescript/module/src/modules/auth/google-return-page/index.d.ts.map +1 -0
  527. package/lib/typescript/module/src/modules/auth/hooks/use-social-sign-in.web.d.ts +7 -0
  528. package/lib/typescript/module/src/modules/auth/hooks/use-social-sign-in.web.d.ts.map +1 -0
  529. package/lib/typescript/module/src/modules/auth/index.d.ts +1 -0
  530. package/lib/typescript/module/src/modules/auth/index.d.ts.map +1 -1
  531. package/lib/typescript/module/src/modules/auth/register/components/register.d.ts +2 -2
  532. package/lib/typescript/module/src/modules/auth/sign-in/components/sign-in.d.ts +2 -2
  533. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts +5 -0
  534. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login-button.web.d.ts.map +1 -0
  535. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/apple-login.d.ts +1 -1
  536. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts +5 -0
  537. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login-button.web.d.ts.map +1 -0
  538. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/google-login.d.ts +1 -1
  539. package/lib/typescript/module/src/modules/auth/sign-in/components/social-logins/social-logins.d.ts +2 -2
  540. package/lib/typescript/module/src/modules/auth/sign-in/index.d.ts +2 -0
  541. package/lib/typescript/module/src/modules/auth/sign-in/index.d.ts.map +1 -1
  542. package/lib/typescript/module/src/modules/auth/sign-in/types/apple-login-props.d.ts +13 -0
  543. package/lib/typescript/module/src/modules/auth/sign-in/types/apple-login-props.d.ts.map +1 -1
  544. package/lib/typescript/module/src/modules/auth/sign-in/types/google-login-props.d.ts +13 -0
  545. package/lib/typescript/module/src/modules/auth/sign-in/types/google-login-props.d.ts.map +1 -1
  546. package/lib/typescript/module/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts +17 -0
  547. package/lib/typescript/module/src/modules/auth/sign-in/utils/apple-web-sign-in.d.ts.map +1 -0
  548. package/lib/typescript/module/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts +14 -0
  549. package/lib/typescript/module/src/modules/auth/sign-in/utils/google-redirect-sign-in.d.ts.map +1 -0
  550. package/lib/typescript/module/src/modules/auth/sign-in/utils/jwt-claims.d.ts +9 -0
  551. package/lib/typescript/module/src/modules/auth/sign-in/utils/jwt-claims.d.ts.map +1 -0
  552. package/lib/typescript/module/src/modules/auth/utils/sign-out-google.web.d.ts +3 -0
  553. package/lib/typescript/module/src/modules/auth/utils/sign-out-google.web.d.ts.map +1 -0
  554. package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
  555. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +4 -1
  556. package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
  557. package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
  558. package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
  559. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts +21 -5
  560. package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
  561. package/lib/typescript/module/src/modules/bt-management/services/custom/compile-custom-lepu.d.ts.map +1 -1
  562. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/blood-glucose.device.d.ts.map +1 -1
  563. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts +34 -0
  564. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.protocol.d.ts.map +1 -0
  565. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts +32 -0
  566. package/lib/typescript/module/src/modules/bt-management/services/devices/blood-glucose/telebgm.sequencer.d.ts.map +1 -0
  567. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +4 -0
  568. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  569. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +2 -1
  570. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -1
  571. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts +29 -3
  572. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.history-sequencer.d.ts.map +1 -1
  573. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts +6 -1
  574. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-command-writer.d.ts.map +1 -1
  575. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +2 -0
  576. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  577. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -3
  578. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  579. package/lib/typescript/module/src/modules/bt-management/services/devices/cofoe/cofoe.records.d.ts.map +1 -1
  580. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts +6 -3
  581. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom-lepu-sequencer.d.ts.map +1 -1
  582. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts +20 -0
  583. package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
  584. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts +8 -1
  585. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.advertisement.d.ts.map +1 -1
  586. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts +12 -0
  587. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.connect-retry.d.ts.map +1 -0
  588. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts +24 -0
  589. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.delivered-files.d.ts.map +1 -0
  590. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts +40 -5
  591. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.ecg-transfer.d.ts.map +1 -1
  592. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts +20 -0
  593. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.encryption-handshake.d.ts.map +1 -0
  594. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +6 -3
  595. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
  596. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts +3 -1
  597. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.frame-reader.d.ts.map +1 -1
  598. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts +26 -1
  599. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.identity-gate.d.ts.map +1 -1
  600. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts +42 -0
  601. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.live-ecg-chunks.d.ts.map +1 -0
  602. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts +28 -0
  603. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave-chunks.d.ts.map +1 -0
  604. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts +16 -0
  605. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.pulse-wave.d.ts.map +1 -0
  606. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts +32 -0
  607. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recorder.d.ts.map +1 -0
  608. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts +28 -0
  609. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.recording-watch.d.ts.map +1 -0
  610. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts +17 -0
  611. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.session.d.ts.map +1 -0
  612. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts +33 -0
  613. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.stored-files.d.ts.map +1 -0
  614. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts +6 -1
  615. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.transports.d.ts.map +1 -1
  616. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts +9 -0
  617. package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.waveform.d.ts.map +1 -0
  618. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.bp-monitors.d.ts.map +1 -1
  619. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts +9 -3
  620. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-files.d.ts.map +1 -1
  621. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recorders.d.ts.map +1 -1
  622. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts +8 -0
  623. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.ecg-recording-status.d.ts.map +1 -0
  624. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.oximeters.d.ts.map +1 -1
  625. package/lib/typescript/module/src/modules/bt-management/services/devices/viatom/viatom.wbp02.protocol.d.ts.map +1 -1
  626. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts +6 -1
  627. package/lib/typescript/module/src/modules/bt-management/services/series-recorder.d.ts.map +1 -1
  628. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts +7 -1
  629. package/lib/typescript/module/src/modules/bt-management/types/create-device-params.d.ts.map +1 -1
  630. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts +47 -3
  631. package/lib/typescript/module/src/modules/bt-management/types/custom-lepu-spec.d.ts.map +1 -1
  632. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts +17 -1
  633. package/lib/typescript/module/src/modules/bt-management/types/device-connection-event.d.ts.map +1 -1
  634. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts +15 -0
  635. package/lib/typescript/module/src/modules/bt-management/types/device-waveform.d.ts.map +1 -0
  636. package/lib/typescript/module/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts +3 -0
  637. package/lib/typescript/module/src/modules/bt-management/utils/calculate-crc-16-modbus.d.ts.map +1 -0
  638. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts +1 -1
  639. package/lib/typescript/module/src/modules/bt-management/utils/i-16-from-hex.d.ts.map +1 -1
  640. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts +1 -1
  641. package/lib/typescript/module/src/modules/bt-management/utils/le-32-from-hex.d.ts.map +1 -1
  642. package/lib/typescript/module/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts +3 -0
  643. package/lib/typescript/module/src/modules/bt-management/utils/tenths-mmol-to-mg-per-dl.d.ts.map +1 -0
  644. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-provider.d.ts.map +1 -1
  645. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts +2 -2
  646. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-authorization-utils.d.ts.map +1 -1
  647. package/lib/typescript/module/src/modules/data-sync/constants.d.ts +3 -1
  648. package/lib/typescript/module/src/modules/data-sync/constants.d.ts.map +1 -1
  649. package/lib/typescript/module/src/modules/data-sync/hooks/use-listen-changes.d.ts.map +1 -1
  650. package/lib/typescript/module/src/modules/data-sync/services/managers/data-processor.d.ts.map +1 -1
  651. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts +2 -2
  652. package/lib/typescript/module/src/modules/data-sync/types/apple-health-authorization-provider-props.d.ts.map +1 -1
  653. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts +4 -7
  654. package/lib/typescript/module/src/modules/data-sync/types/apple-health-sync-props.d.ts.map +1 -1
  655. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts +3 -1
  656. package/lib/typescript/module/src/modules/data-sync/types/get-data-from-provider-props.d.ts.map +1 -1
  657. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts +2 -2
  658. package/lib/typescript/module/src/modules/data-sync/types/health-authorization-status.d.ts.map +1 -1
  659. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts +11 -1
  660. package/lib/typescript/module/src/modules/data-sync/types/health-sync-keys.d.ts.map +1 -1
  661. package/lib/typescript/module/src/modules/data-sync/types/health-sync-props.d.ts +1 -1
  662. package/lib/typescript/module/src/modules/data-sync/types/health-sync-props.d.ts.map +1 -1
  663. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts +6 -0
  664. package/lib/typescript/module/src/modules/data-sync/utils/convert-ecg-samples-to-observation.d.ts.map +1 -0
  665. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts +1 -1
  666. package/lib/typescript/module/src/modules/data-sync/utils/convert-generic-health-data.d.ts.map +1 -1
  667. package/lib/typescript/module/src/modules/data-sync/utils/convert-samples-to-observation.d.ts.map +1 -1
  668. package/lib/typescript/module/src/modules/data-sync/utils/default-health-coding.d.ts +10 -0
  669. package/lib/typescript/module/src/modules/data-sync/utils/default-health-coding.d.ts.map +1 -0
  670. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts +1 -1
  671. package/lib/typescript/module/src/modules/data-sync/utils/get-records-from-health-connect.d.ts.map +1 -1
  672. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts +12 -46
  673. package/lib/typescript/module/src/modules/data-sync/utils/get-samples-from-health.d.ts.map +1 -1
  674. package/lib/typescript/module/src/modules/data-sync/utils/get-total-samples-count.d.ts.map +1 -1
  675. package/lib/typescript/module/src/modules/data-sync/utils/health-data-catalog.d.ts.map +1 -1
  676. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts +2 -2
  677. package/lib/typescript/module/src/modules/data-sync/utils/health-units.d.ts.map +1 -1
  678. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts +10 -0
  679. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-daily-statistics.d.ts.map +1 -0
  680. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts +5 -5
  681. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-data-types.d.ts.map +1 -1
  682. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts +7 -0
  683. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-query-options.d.ts.map +1 -0
  684. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts +8 -0
  685. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-sample-source.d.ts.map +1 -0
  686. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts +30 -0
  687. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-samples.d.ts.map +1 -0
  688. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts +2 -2
  689. package/lib/typescript/module/src/modules/data-sync/utils/healthkit-series.d.ts.map +1 -1
  690. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts +1 -0
  691. package/lib/typescript/module/src/modules/data-sync/utils/to-core-health-observations.d.ts.map +1 -1
  692. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts +12 -1
  693. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/built-in-devices.d.ts.map +1 -1
  694. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts +2 -1
  695. package/lib/typescript/module/src/modules/next/bluetooth/ble-plx/legacy-driver.d.ts.map +1 -1
  696. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts +13 -1
  697. package/lib/typescript/module/src/modules/next/bluetooth/connections.d.ts.map +1 -1
  698. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts +20 -0
  699. package/lib/typescript/module/src/modules/next/bluetooth/driver.d.ts.map +1 -1
  700. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts +1 -1
  701. package/lib/typescript/module/src/modules/next/bluetooth/errors.d.ts.map +1 -1
  702. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +2 -1
  703. package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
  704. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts +3 -2
  705. package/lib/typescript/module/src/modules/next/bluetooth/readings.d.ts.map +1 -1
  706. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts +19 -1
  707. package/lib/typescript/module/src/modules/next/bluetooth/runtime.d.ts.map +1 -1
  708. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts +33 -1
  709. package/lib/typescript/module/src/modules/next/bluetooth/snapshot.d.ts.map +1 -1
  710. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts +1 -0
  711. package/lib/typescript/module/src/modules/next/bluetooth/web/index.d.ts.map +1 -1
  712. package/package.json +8 -3
@@ -4,8 +4,12 @@ import { base64ToHex } from "../../../utils/base-64-to-hex.js";
4
4
  import { hexToByte } from "../../../utils/hex-to-byte.js";
5
5
  const PROTOCOL_MASK = 0x0f;
6
6
  const ENCRYPTION_MASK = 0xf0;
7
+ const ENCRYPTION_OPTIONAL = 0x10;
7
8
  const ENCRYPTION_REQUIRED = 0x20;
8
9
  const VIATOM_OXYGEN_V2_BYTES = [3, 4];
10
+ const LEPU_FLAG_BYTES = [4, 3];
11
+ const LEPU_PROTOCOLS = [1, 2];
12
+ const ENCRYPTION_LEVELS = [ENCRYPTION_OPTIONAL, ENCRYPTION_REQUIRED];
9
13
  const manufacturerBytes = manufacturerData => {
10
14
  if (!manufacturerData) {
11
15
  return [];
@@ -21,7 +25,19 @@ const manufacturerByte = (manufacturerData, index) => manufacturerBytes(manufact
21
25
  /** Returns true when the advertised byte says that only encrypted traffic is accepted. */
22
26
  const advertisementRequiresEncryption = (manufacturerData, byteIndexes = []) => byteIndexes.some(index => ((manufacturerByte(manufacturerData, index) ?? 0) & ENCRYPTION_MASK) === ENCRYPTION_REQUIRED);
23
27
 
28
+ /**
29
+ * True when the advertisement offers or requires the encryption handshake.
30
+ *
31
+ * Byte 4 describes the second service and wins when it names a protocol; otherwise byte 3
32
+ * does. A level of 1 (optional) or 2 (required) is a handshake for the vendor's own client.
33
+ */
34
+ const advertisesLepuEncryption = manufacturerData => {
35
+ const bytes = manufacturerBytes(manufacturerData);
36
+ const flag = LEPU_FLAG_BYTES.map(index => bytes[index] ?? 0).find(value => LEPU_PROTOCOLS.includes(value & PROTOCOL_MASK));
37
+ return flag !== undefined && ENCRYPTION_LEVELS.includes(flag & ENCRYPTION_MASK);
38
+ };
39
+
24
40
  /** The vendor uses the low nibble of byte 3 or 4 to select the OxyII service. */
25
41
  const viatomOxygenUsesV2 = manufacturerData => VIATOM_OXYGEN_V2_BYTES.some(index => ((manufacturerByte(manufacturerData, index) ?? 0) & PROTOCOL_MASK) === 2);
26
- export { advertisementRequiresEncryption, manufacturerBytes, viatomOxygenUsesV2 };
42
+ export { advertisementRequiresEncryption, advertisesLepuEncryption, manufacturerBytes, viatomOxygenUsesV2 };
27
43
  //# sourceMappingURL=lepu.advertisement.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["base64ToHex","hexToByte","PROTOCOL_MASK","ENCRYPTION_MASK","ENCRYPTION_REQUIRED","VIATOM_OXYGEN_V2_BYTES","manufacturerBytes","manufacturerData","map","manufacturerByte","index","advertisementRequiresEncryption","byteIndexes","some","viatomOxygenUsesV2"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.advertisement.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,aAAa,GAAG,IAAI;AAC1B,MAAMC,eAAe,GAAG,IAAI;AAC5B,MAAMC,mBAAmB,GAAG,IAAI;AAChC,MAAMC,sBAAsB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAU;AAE9C,MAAMC,iBAAiB,GAAIC,gBAAyB,IAAe;EACjE,IAAI,CAACA,gBAAgB,EAAE;IACrB,OAAO,EAAE;EACX;EAEA,IAAI;IACF,OAAOP,WAAW,CAACO,gBAAgB,CAAC,CAACC,GAAG,CAACP,SAAS,CAAC;EACrD,CAAC,CAAC,MAAM;IACN,OAAO,EAAE;EACX;AACF,CAAC;AAED,MAAMQ,gBAAgB,GAAGA,CACvBF,gBAAoC,EACpCG,KAAa,KACUJ,iBAAiB,CAACC,gBAAgB,CAAC,CAACG,KAAK,CAAC;;AAEnE;AACA,MAAMC,+BAA+B,GAAGA,CACtCJ,gBAAoC,EACpCK,WAA8B,GAAG,EAAE,KAEnCA,WAAW,CAACC,IAAI,CACbH,KAAK,IACJ,CAAC,CAACD,gBAAgB,CAACF,gBAAgB,EAAEG,KAAK,CAAC,IAAI,CAAC,IAAIP,eAAe,MACnEC,mBACJ,CAAC;;AAEH;AACA,MAAMU,kBAAkB,GAAIP,gBAAyB,IACnDF,sBAAsB,CAACQ,IAAI,CACxBH,KAAK,IACJ,CAAC,CAACD,gBAAgB,CAACF,gBAAgB,EAAEG,KAAK,CAAC,IAAI,CAAC,IAAIR,aAAa,MAAM,CAC3E,CAAC;AAEH,SACES,+BAA+B,EAC/BL,iBAAiB,EACjBQ,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["base64ToHex","hexToByte","PROTOCOL_MASK","ENCRYPTION_MASK","ENCRYPTION_OPTIONAL","ENCRYPTION_REQUIRED","VIATOM_OXYGEN_V2_BYTES","LEPU_FLAG_BYTES","LEPU_PROTOCOLS","ENCRYPTION_LEVELS","manufacturerBytes","manufacturerData","map","manufacturerByte","index","advertisementRequiresEncryption","byteIndexes","some","advertisesLepuEncryption","bytes","flag","find","value","includes","undefined","viatomOxygenUsesV2"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.advertisement.ts"],"mappings":";;AAAA,SAASA,WAAW,QAAQ,kCAA+B;AAC3D,SAASC,SAAS,QAAQ,+BAA4B;AAEtD,MAAMC,aAAa,GAAG,IAAI;AAC1B,MAAMC,eAAe,GAAG,IAAI;AAC5B,MAAMC,mBAAmB,GAAG,IAAI;AAChC,MAAMC,mBAAmB,GAAG,IAAI;AAChC,MAAMC,sBAAsB,GAAG,CAAC,CAAC,EAAE,CAAC,CAAU;AAC9C,MAAMC,eAAe,GAAG,CAAC,CAAC,EAAE,CAAC,CAAU;AACvC,MAAMC,cA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gB,EAAEG,KAAK,CAAC,IAAI,CAAC,IAAIZ,aAAa,MAAM,CAC3E,CAAC;AAEH,SACEa,+BAA+B,EAC/BG,wBAAwB,EACxBR,iBAAiB,EACjBe,kBAAkB","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ /** How long a connect-time command may go unanswered before it is sent again. */
4
+ const LEPU_CONNECT_REPLY_TIMEOUT_MS = 1_000;
5
+
6
+ /** A device just woken can drop its first command, so each connect step gets one more try. */
7
+ const LEPU_CONNECT_ATTEMPTS = 2;
8
+
9
+ /** Counts the tries of one connect-time command. */
10
+ class LepuConnectRetry {
11
+ attempts = 0;
12
+
13
+ /** Marks the first send of the command. */
14
+ started = () => {
15
+ this.attempts = 1;
16
+ };
17
+
18
+ /** Whether the command may be sent again; counts that send when it may. */
19
+ mayRetry = () => {
20
+ if (this.attempts >= LEPU_CONNECT_ATTEMPTS) {
21
+ return false;
22
+ }
23
+ this.attempts++;
24
+ return true;
25
+ };
26
+ }
27
+ export { LEPU_CONNECT_REPLY_TIMEOUT_MS, LepuConnectRetry };
28
+ //# sourceMappingURL=lepu.connect-retry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LEPU_CONNECT_REPLY_TIMEOUT_MS","LEPU_CONNECT_ATTEMPTS","LepuConnectRetry","attempts","started","mayRetry"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.connect-retry.ts"],"mappings":";;AAAA;AACA,MAAMA,6BAA6B,GAAG,KAAK;;AAE3C;AACA,MAAMC,qBAAqB,GAAG,CAAC;;AAE/B;AACA,MAAMC,gBAAgB,CAAC;EACbC,QAAQ,GAAG,CAAC;;EAEpB;EACOC,OAAO,GAAGA,CAAA,KAAY;IAC3B,IAAI,CAACD,QAAQ,GAAG,CAAC;EACnB,CAAC;;EAED;EACOE,QAAQ,GAAGA,CAAA,KAAe;IAC/B,IAAI,IAAI,CAACF,QAAQ,IAAIF,qBAAqB,EAAE;MAC1C,OAAO,KAAK;IACd;IAEA,IAAI,CAACE,QAAQ,EAAE;IAEf,OAAO,IAAI;EACb,CAAC;AACH;AAEA,SAASH,6BAA6B,EAAEE,gBAAgB","ignoreList":[]}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ import { sentryLogger } from "../../../../helpers/utils/sentry-logger.js";
4
+ import { toBluetoothError } from "../../../types/bluetooth-error.js";
5
+ const KEY_PREFIX = "@ovok/native/lepu-delivered-files";
6
+ const parseNames = stored => {
7
+ try {
8
+ const parsed = JSON.parse(stored ?? "[]");
9
+ return Array.isArray(parsed) ? parsed.filter(name => typeof name === "string") : [];
10
+ } catch {
11
+ return [];
12
+ }
13
+ };
14
+
15
+ /**
16
+ * The names of a device's stored files whose readings the app took (queued or saved), kept in
17
+ * `storage` so a later connection skips them, as the vendor app skips the files it saved. Without
18
+ * storage it forgets on disconnect.
19
+ */
20
+ class LepuDeliveredFiles {
21
+ names = new Set();
22
+ constructor(storage, deviceId) {
23
+ this.storage = storage;
24
+ this.key = `${KEY_PREFIX}/${deviceId}`;
25
+ this.writes = this.load();
26
+ }
27
+ has = name => this.names.has(name);
28
+
29
+ /** Remembers a file whose reading the app took. */
30
+ add = name => {
31
+ this.names.add(name);
32
+ this.persist();
33
+ };
34
+
35
+ /** Forgets the files the device no longer lists, so no more names are kept than it holds. */
36
+ keepListed = listed => {
37
+ const kept = [...this.names].filter(name => listed.includes(name));
38
+ if (kept.length < this.names.size) {
39
+ this.names = new Set(kept);
40
+ this.persist();
41
+ }
42
+ };
43
+ load = async () => {
44
+ try {
45
+ const stored = parseNames(await this.storage?.getItem(this.key));
46
+ this.names = new Set([...stored, ...this.names]);
47
+ } catch (error) {
48
+ sentryLogger("error", "LEPU_DELIVERED_FILES: Could not read the stored names", {
49
+ errorCode: toBluetoothError(error).code
50
+ });
51
+ }
52
+ };
53
+
54
+ /** Writes in order, each after the stored names were read, so none overwrites names not read yet. */
55
+ persist = () => {
56
+ this.writes = this.writes.then(this.store);
57
+ };
58
+ store = async () => {
59
+ try {
60
+ await this.storage?.setItem(this.key, JSON.stringify([...this.names]));
61
+ } catch (error) {
62
+ sentryLogger("error", "LEPU_DELIVERED_FILES: Could not store the names", {
63
+ errorCode: toBluetoothError(error).code
64
+ });
65
+ }
66
+ };
67
+ }
68
+ export { LepuDeliveredFiles };
69
+ //# sourceMappingURL=lepu.delivered-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sentryLogger","toBluetoothError","KEY_PREFIX","parseNames","stored","parsed","JSON","parse","Array","isArray","filter","name","LepuDeliveredFiles","names","Set","constructor","storage","deviceId","key","writes","load","has","add","persist","keepListed","listed","kept","includes","length","size","getItem","error","errorCode","code","then","store","setItem","stringify"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.delivered-files.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4CAAyC;AAEtE,SAASC,gBAAgB,QAAQ,mCAAgC;AAEjE,MAAMC,UAAU,GAAG,mCAAmC;AAEtD,MAAMC,UAAU,GAAIC,MAAiC,IAAe;EAClE,IAAI;IACF,MAAMC,MAAe,GAAGC,IAAI,CAACC,KAAK,CAACH,MAAM,IAAI,IAAI,CAAC;IAElD,OAAOI,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,GACxBA,MAAM,CAACK,MAAM,CAAEC,IAAI,IAAqB,OAAOA,IAAI,KAAK,QAAQ,CAAC,GACjE,EAAE;EACR,CAAC,CAAC,MAAM;IACN,OAAO,EAAE;EACX;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMC,kBAAkB,CAAC;EACfC,KAAK,GAAG,IAAIC,GAAG,CAAS,CAAC;EAI1BC,WAAWA,CACCC,OAA0C,EAC3DC,QAAgB,EAChB;IAAA,KAFiBD,OAA0C,GAA1CA,OAA0C;IAG3D,IAAI,CAACE,GAAG,GAAG,GAAGhB,UAAU,IAAIe,QAAQ,EAAE;IACtC,IAAI,CAACE,MAAM,GAAG,IAAI,CAAC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GAAG,MAAAA,CAAA,KAA2B;IACzC,IAAI;MACF,MAAM,IAAI,CAACnB,OAAO,EAAEoB,OAAO,CAAC,IAAI,CAAClB,GAAG,EAAEZ,IAAI,CAAC+B,SAAS,CAAC,CAAC,GAAG,IAAI,CAACxB,KAAK,CAAC,CAAC,CAAC;IACxE,CAAC,CAAC,OAAOkB,KAAK,EAAE;MACd/B,YAAY,CAAC,OAAO,EAAE,iDAAiD,EAAE;QACvEgC,SAAS,EAAE/B,gBAAgB,CAAC8B,KAAK,CAAC,CAACE;MACrC,CAAC,CAAC;IACJ;EACF,CAAC;AACH;AAEA,SAASrB,kBAAkB","ignoreList":[]}
@@ -1,16 +1,41 @@
1
1
  "use strict";
2
2
 
3
+ /* eslint-disable max-lines */
3
4
  import { getClockParts, isClockSyncEnabled } from "../../../types/clock-sync.js";
4
5
  import { LepuCommand } from "./lepu.commands.js";
5
- import { LepuFileTransfer } from "./lepu.file-transfer.js";
6
+ import { LEPU_CONNECT_REPLY_TIMEOUT_MS, LepuConnectRetry } from "./lepu.connect-retry.js";
6
7
  import { lepuCommandOf } from "./lepu.frame.js";
7
8
  import { LepuIdentityGate } from "./lepu.identity-gate.js";
8
9
  import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js";
9
- /** Identifies a recorder, sets its local clock, then downloads its stored files. */
10
+ import { LepuStoredFiles } from "./lepu.stored-files.js";
11
+ /** How long past its delay a poll may go unanswered before it is sent again. */
12
+ const POLL_ANSWER_GRACE_MS = 1_000;
13
+
14
+ /** Lets a device finish writing a record before its file list is read. */
15
+ const FILE_LIST_DELAY_MS = 3_000;
16
+ const hexOf = opcode => `0x${(opcode ?? 0).toString(16).padStart(2, "0")}`;
17
+
18
+ /**
19
+ * Identifies a recorder, sets its local clock, then polls it live. Its stored files are only
20
+ * listed on connect: they are read when the app asks (`takeHistorySync`), and a record the
21
+ * device stores while connected is read as it is saved. A device that does not poll reads its
22
+ * files on connect, as nothing else would ever ask for them.
23
+ */
10
24
  class LepuEcgTransferSequencer {
11
25
  phase = "identity";
26
+ clockRetry = new LepuConnectRetry();
12
27
  constructor(params) {
13
28
  this.params = params;
29
+ this.storedFiles = new LepuStoredFiles({
30
+ write: params.write,
31
+ builder: params.builder,
32
+ onFile: params.onFile,
33
+ onError: params.onError,
34
+ skipFiles: params.skipFiles,
35
+ deliveredFiles: params.deliveredFiles,
36
+ acceptFile: params.acceptFile,
37
+ onProgress: params.onProgress
38
+ });
14
39
  this.identity = new LepuIdentityGate({
15
40
  write: params.write,
16
41
  builder: params.builder,
@@ -19,11 +44,51 @@ class LepuEcgTransferSequencer {
19
44
  rejectEncryptionAtBytes: params.rejectEncryptionAtBytes,
20
45
  onIdentified: params.onIdentified,
21
46
  onRefused: params.onRefused,
22
- onAdmitted: this.startClockOrTransfer
47
+ onAdmitted: this.startClockOrFiles
23
48
  });
24
49
  }
25
50
  initialCommands = () => this.identity.initialCommands();
26
51
  isHistoryTransfer = () => true;
52
+ commandTimeoutMs = () => {
53
+ if (this.phase === "identity") {
54
+ return this.identity.commandTimeoutMs();
55
+ }
56
+ if (this.phase === "polling" && this.params.pollIntervalMs !== undefined) {
57
+ return this.params.pollIntervalMs + POLL_ANSWER_GRACE_MS;
58
+ }
59
+ if (this.phase === "requested") {
60
+ return LEPU_CONNECT_REPLY_TIMEOUT_MS;
61
+ }
62
+ return this.phase === "clock" ? LEPU_CONNECT_REPLY_TIMEOUT_MS : undefined;
63
+ };
64
+
65
+ /** An unanswered clock is sent once more, then skipped; nothing after it needs it. */
66
+ onCommandTimeout = () => {
67
+ if (this.phase === "identity") {
68
+ return this.identity.onCommandTimeout();
69
+ }
70
+ if (this.phase === "requested") {
71
+ this.params.onError(`the device did not answer command ${hexOf(this.requestedCommand)}`);
72
+ }
73
+ if (this.phase === "polling" || this.phase === "requested") {
74
+ return {
75
+ commands: this.resumePolling()
76
+ };
77
+ }
78
+ if (this.phase !== "clock") {
79
+ return {};
80
+ }
81
+ return {
82
+ commands: this.clockRetry.mayRetry() ? [this.setTimeCommand()] : this.startFiles()
83
+ };
84
+ };
85
+ commandProgress = frame => {
86
+ if (this.phase === "identity") {
87
+ return this.identity.commandProgress(frame);
88
+ }
89
+ const awaited = this.phase === "clock" ? LepuCommand.SET_TIME : this.phase === "polling" ? this.params.pollCommand : this.phase === "requested" ? this.requestedCommand : undefined;
90
+ return awaited !== undefined && lepuCommandOf(frame) !== awaited ? "ignored" : "complete";
91
+ };
27
92
  nextCommand = frame => {
28
93
  if (this.phase === "identity") {
29
94
  return this.identity.nextCommand(frame);
@@ -35,20 +100,60 @@ class LepuEcgTransferSequencer {
35
100
  if (this.params.pollCommand === undefined || lepuCommandOf(frame) !== this.params.pollCommand) {
36
101
  return undefined;
37
102
  }
38
- return this.startTransfer(3_000);
103
+ return this.afterPollAnswer(frame);
104
+ }
105
+ if (this.phase === "requested") {
106
+ return this.finishRequested(frame);
39
107
  }
40
108
  return this.transfer?.nextCommand(frame);
41
109
  };
42
- startClockOrTransfer = () => {
110
+ afterPollAnswer = frame => {
111
+ const stored = this.params.shouldStartTransfer?.(frame) ?? true;
112
+ const delayBeforeWriteMs = stored ? FILE_LIST_DELAY_MS : undefined;
113
+ if (this.params.takeHistorySync?.()) {
114
+ return this.startTransfer(this.storedFiles.readAll, delayBeforeWriteMs);
115
+ }
116
+ return stored ? this.startTransfer(this.storedFiles.readNew, delayBeforeWriteMs) : this.requestedOrPoll();
117
+ };
118
+ requestedOrPoll = () => {
119
+ const requested = this.params.takeRequestedCommand?.();
120
+ if (requested === undefined) {
121
+ return [this.pollCommand()];
122
+ }
123
+ this.phase = "requested";
124
+ this.requestedCommand = requested;
125
+ return [{
126
+ ...this.params.write,
127
+ frame: this.params.builder.build(requested)
128
+ }];
129
+ };
130
+ finishRequested = frame => {
131
+ if (lepuCommandOf(frame) !== this.requestedCommand) {
132
+ return undefined;
133
+ }
134
+ if (!isLepuSuccess(frame)) {
135
+ this.params.onError(`the device refused command ${hexOf(this.requestedCommand)}: ${describeLepuResponseType(frame)}`);
136
+ }
137
+ return this.resumePolling();
138
+ };
139
+ resumePolling = () => {
140
+ this.phase = "polling";
141
+ this.requestedCommand = undefined;
142
+ return [this.pollCommand()];
143
+ };
144
+ startClockOrFiles = () => {
43
145
  if (isClockSyncEnabled(this.params.clockSync)) {
44
146
  this.phase = "clock";
45
- return [{
46
- ...this.params.write,
47
- frame: this.params.builder.build(LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
48
- }];
147
+ this.clockRetry.started();
148
+ return [this.setTimeCommand()];
49
149
  }
50
- return this.startTransfer();
150
+ return this.startFiles();
51
151
  };
152
+ startFiles = () => this.params.pollCommand === undefined || this.params.takeHistorySync?.() ? this.startTransfer(this.storedFiles.readAll) : this.startTransfer(this.storedFiles.listExisting);
153
+ setTimeCommand = () => ({
154
+ ...this.params.write,
155
+ frame: this.params.builder.build(LepuCommand.SET_TIME, clockPayload(this.params.clockSync))
156
+ });
52
157
  finishClock = frame => {
53
158
  if (lepuCommandOf(frame) !== LepuCommand.SET_TIME) {
54
159
  return undefined;
@@ -56,20 +161,11 @@ class LepuEcgTransferSequencer {
56
161
  if (!isLepuSuccess(frame)) {
57
162
  this.params.onError(`the device refused SET_TIME: ${describeLepuResponseType(frame)}`);
58
163
  }
59
- return this.startTransfer();
164
+ return this.startFiles();
60
165
  };
61
- startTransfer = delayBeforeWriteMs => {
166
+ startTransfer = (files, delayBeforeWriteMs) => {
62
167
  this.phase = "files";
63
- this.transfer = new LepuFileTransfer({
64
- write: this.params.write,
65
- builder: this.params.builder,
66
- onFile: this.params.onFile,
67
- onError: this.params.onError,
68
- skipFiles: this.params.skipFiles,
69
- acceptFile: this.params.acceptFile,
70
- afterTransfer: this.finishTransfer,
71
- onProgress: this.params.onProgress
72
- });
168
+ this.transfer = files(this.finishTransfer);
73
169
  return this.transfer.initialCommands(delayBeforeWriteMs);
74
170
  };
75
171
  finishTransfer = () => {
@@ -78,15 +174,18 @@ class LepuEcgTransferSequencer {
78
174
  this.phase = "polling";
79
175
  return [this.pollCommand()];
80
176
  }
81
- return this.params.afterTransfer?.() ?? [];
177
+ return [];
178
+ };
179
+ pollCommand = () => {
180
+ const delayBeforeWriteMs = this.params.pollsOnAnswer?.() ? undefined : this.params.pollIntervalMs;
181
+ return {
182
+ ...this.params.write,
183
+ frame: this.params.builder.build(this.params.pollCommand),
184
+ ...(delayBeforeWriteMs === undefined ? {} : {
185
+ delayBeforeWriteMs
186
+ })
187
+ };
82
188
  };
83
- pollCommand = () => ({
84
- ...this.params.write,
85
- frame: this.params.builder.build(this.params.pollCommand),
86
- ...(this.params.pollIntervalMs === undefined ? {} : {
87
- delayBeforeWriteMs: this.params.pollIntervalMs
88
- })
89
- });
90
189
  }
91
190
  const clockPayload = clockSync => {
92
191
  const parts = getClockParts(clockSync?.now?.() ?? new Date(), clockSync?.timezone);
@@ -1 +1 @@
1
- {"version":3,"names":["getClockParts","isClockSyncEnabled","LepuCommand","LepuFileTransfer","lepuCommandOf","LepuIdentityGate","describeLepuResponseType","isLepuSuccess","LepuEcgTransferSequencer","phase","constructor","params","identity","write","builder","expectedDeviceTypes","manufacturerData","rejectEncryptionAtBytes","onIdentified","onRefused","onAdmitted","startClockOrTransfer","initialCommands","isHistoryTransfer","nextCommand","frame","finishClock","pollCommand","undefined","startTransfer","transfer","clockSync","build","SET_TIME","clockPayload","onError","delayBeforeWriteMs","onFile","skipFiles","acceptFile","afterTransfer","finishTransfer","onProgress","pollIntervalMs","parts","now","Date","timezone","year","month","day","hours","minutes","seconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.ecg-transfer.ts"],"mappings":";;AAAA,SAEEA,aAAa,EACbC,kBAAkB,QACb,8BAA2B;AAKlC,SAASC,WAAW,QAAQ,oBAAiB;AAE7C,SAAmBC,gBAAgB,QAAQ,yBAAsB;AACjE,SAASC,aAAa,QAAQ,iBAAc;AAC5C,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBA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ACQ,OAAO,EACbR,KAAK,CAACS,OAAO,CACd;AACH,CAAC;AAED,SAAS7C,wBAAwB,EAAE0B,YAAY","ignoreList":[]}
1
+ {"version":3,"names":["getClockParts","isClockSyncEnabled","LepuCommand","LEPU_CONNECT_REPLY_TIMEOUT_MS","LepuConnectRetry","lepuCommandOf","LepuIdentityGate","describeLepuResponseType","isLepuSuccess","LepuStoredFiles","POLL_ANSWER_GRACE_MS","FILE_LIST_DELAY_MS","hexOf","opcode","toString","padStart","LepuEcgTransferSequencer","phase","clockRetry","constructor","params","storedFiles","write","builder","onFile","onError","skipFiles","deliveredFiles","acceptFile","onProgress","identity","expectedDeviceTypes","manufacturerData","rejectEncryptionAtBytes","onIdentified","onRefused","onAdmitted","startClockOrFiles","initialCommands","isHistoryTransfer","commandTimeoutMs","pollIntervalMs","undefined","onCommandTimeout","requestedCommand","commands","resumePolling","mayRetry","setTimeCommand","startFiles","commandProgress","frame","awaited","SET_TIME","pollCommand","nextCommand","finishClock","afterPollAnswer","finishRequested","transfer","stored","shouldStartTransfer","delayBeforeWriteMs","takeHistorySync","startTransfer","readAll","readNew","requestedOrPoll","requested","takeRequestedCommand","build","clockSync","started","listExisting","clockPayload","files","finishTransfer","pollsOnAnswer","parts","now","Date","timezone","year","month","day","hours","minutes","seconds"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.ecg-transfer.ts"],"mappings":";;AAAA;AACA,SAEEA,aAAa,EACbC,kBAAkB,QACb,8BAA2B;AAQlC,SAASC,WAAW,QAAQ,oBAAiB;AAC7C,SAASC,6BAA6B,EAAEC,gBAAgB,QAAQ,yBAAsB;AAItF,SAASC,aAAa,QAAQ,iBAAc;AAC5C,SAASC,gBAAgB,QAAQ,yBAAsB;AACvD,SAASC,wBAAwB,EAAEC,aAAa,QAAQ,yBAAsB;AAC9E,SAASC,eAAe,QAAQ,wBAAqB;AAgDrD;AACA,MAAMC,oBAAoB,GAAG,KAAK;;AAElC;AACA,MAAMC,kB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IACpE,CAAC;EACH,CAAC;AACH;AAEA,MAAMY,YAAY,GAAIH,SAA4B,IAAe;EAC/D,MAAMO,KAAK,GAAG9E,aAAa,CACzBuE,SAAS,EAAEQ,GAAG,GAAG,CAAC,IAAI,IAAIC,IAAI,CAAC,CAAC,EAChCT,SAAS,EAAEU,QACb,CAAC;EAED,OAAO,CACLH,KAAK,CAACI,IAAI,GAAG,IAAI,EAChBJ,KAAK,CAACI,IAAI,IAAI,CAAC,GAAI,IAAI,EACxBJ,KAAK,CAACK,KAAK,EACXL,KAAK,CAACM,GAAG,EACTN,KAAK,CAACO,KAAK,EACXP,KAAK,CAACQ,OAAO,EACbR,KAAK,CAACS,OAAO,CACd;AACH,CAAC;AAED,SAASvE,wBAAwB,EAAE0D,YAAY","ignoreList":[]}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
4
+ import { createLepuAccessToken, decryptLepuHandshake, parseLepuSessionKey } from "../viatom/viatom-lepu-crypto.js";
5
+ import { advertisesLepuEncryption } from "./lepu.advertisement.js";
6
+ import { LepuCommandBuilder } from "./lepu.command-builder.js";
7
+ import { LEPU_CONNECT_REPLY_TIMEOUT_MS, LepuConnectRetry } from "./lepu.connect-retry.js";
8
+ import { lepuCommandOf, lepuPayloadOf } from "./lepu.frame.js";
9
+ import { isLepuSuccess } from "./lepu.response-type.js";
10
+ const LEPU_ENCRYPT_COMMAND = 0xff;
11
+ /**
12
+ * Runs the vendor's encryption handshake before a standard Lepu exchange, when the
13
+ * advertisement asks for one.
14
+ *
15
+ * The access token goes out in plain text; the reply carries the session key, and from then
16
+ * on every request is encrypted here and every reply is decrypted by the frame reader that
17
+ * shares the session. Without the flag the exchange runs exactly as it did before.
18
+ */
19
+ class LepuEncryptionHandshake {
20
+ state = "awaiting-key";
21
+ retry = new LepuConnectRetry();
22
+ constructor(inner, params) {
23
+ this.inner = inner;
24
+ this.params = params;
25
+ }
26
+ initialCommands = () => {
27
+ this.retry.started();
28
+ return [this.tokenCommand()];
29
+ };
30
+ nextCommand = (frame, characteristicUuid) => {
31
+ if (this.state === "done") {
32
+ return this.encrypted(this.inner.nextCommand(frame, characteristicUuid));
33
+ }
34
+ if (this.state === "refused" || lepuCommandOf(frame) !== LEPU_ENCRYPT_COMMAND) {
35
+ return undefined;
36
+ }
37
+ return this.acceptKey(frame);
38
+ };
39
+ commandTimeoutMs = () => this.state === "awaiting-key" ? LEPU_CONNECT_REPLY_TIMEOUT_MS : this.state === "done" ? this.inner.commandTimeoutMs?.() : undefined;
40
+
41
+ /** A device just woken can drop the token, so it is sent once more before giving up. */
42
+ onCommandTimeout = () => {
43
+ if (this.state === "done") {
44
+ const result = this.inner.onCommandTimeout?.() ?? {};
45
+ return {
46
+ ...result,
47
+ commands: this.encrypted(result.commands)
48
+ };
49
+ }
50
+ if (this.state === "refused") {
51
+ return {};
52
+ }
53
+ return this.retry.mayRetry() ? {
54
+ commands: [this.tokenCommand()]
55
+ } : {
56
+ terminal: true
57
+ };
58
+ };
59
+ commandProgress = frame => {
60
+ if (this.state === "done") {
61
+ return this.inner.commandProgress?.(frame) ?? "complete";
62
+ }
63
+ return lepuCommandOf(frame) === LEPU_ENCRYPT_COMMAND ? "complete" : "ignored";
64
+ };
65
+ onServicesDiscovered = serviceUuids => this.inner.onServicesDiscovered?.(serviceUuids);
66
+ isNormalDisconnect = () => this.inner.isNormalDisconnect?.() ?? false;
67
+ isHistoryTransfer = () => this.inner.isHistoryTransfer?.() ?? false;
68
+ acceptKey = frame => {
69
+ const reply = lepuPayloadOf(frame).map(hexToByte);
70
+ const key = isLepuSuccess(frame) ? parseLepuSessionKey(decryptLepuHandshake(reply)) : undefined;
71
+ if (!key) {
72
+ this.state = "refused";
73
+ this.params.onRefused("the device refused the encryption handshake");
74
+ return undefined;
75
+ }
76
+ this.params.session.begin(key);
77
+ this.state = "done";
78
+ return this.encrypted(this.inner.initialCommands());
79
+ };
80
+ tokenCommand = () => ({
81
+ ...this.params.write,
82
+ frame: new LepuCommandBuilder(this.params.startByte).build(LEPU_ENCRYPT_COMMAND, createLepuAccessToken())
83
+ });
84
+ encrypted = commands => commands?.map(command => ({
85
+ ...command,
86
+ frame: this.params.session.encryptFrame(command.frame)
87
+ }));
88
+ }
89
+
90
+ /**
91
+ * The sequencer for one connection: wrapped in the handshake when the advertisement asks
92
+ * for encryption, unchanged otherwise. Either way the session starts without a key.
93
+ */
94
+ const withLepuEncryption = (inner, params) => {
95
+ params.session.end();
96
+ return advertisesLepuEncryption(params.manufacturerData) ? new LepuEncryptionHandshake(inner, params) : inner;
97
+ };
98
+ export { withLepuEncryption };
99
+ //# sourceMappingURL=lepu.encryption-handshake.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["hexToByte","createLepuAccessToken","decryptLepuHandshake","parseLepuSessionKey","advertisesLepuEncryption","LepuCommandBuilder","LEPU_CONNECT_REPLY_TIMEOUT_MS","LepuConnectRetry","lepuCommandOf","lepuPayloadOf","isLepuSuccess","LEPU_ENCRYPT_COMMAND","LepuEncryptionHandshake","state","retry","constructor","inner","params","initialCommands","started","tokenCommand","nextCommand","frame","characteristicUuid","encrypted","undefined","acceptKey","commandTimeoutMs","onCommandTimeout","result","commands","mayRetry","terminal","commandProgress","onServicesDiscovered","serviceUuids","isNormalDisconnect","isHistoryTransfer","reply","map","key","onRefused","session","begin","write","startByte","build","command","encryptFrame","withLepuEncryption","end","manufacturerData"],"sourceRoot":"../../../../../../../src","sources":["modules/bt-management/services/devices/lepu/lepu.encryption-handshake.ts"],"mappings":";;AAKA,SAASA,SAAS,QAAQ,+BAA4B;AACtD,SACEC,qBAAqB,EACrBC,oBAAoB,EACpBC,mBAAmB,QACd,iCAA8B;AAErC,SAASC,wBAAwB,QAAQ,yBAAsB;AAC/D,SAASC,kBAAkB,QAAQ,2BAAwB;AAC3D,SAASC,6BAA6B,EAAEC,gBAAgB,QAAQ,yBAAsB;AACtF,SAASC,aAAa,EAAEC,aAAa,QAAQ,iBAAc;A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B,KAAK,GAAG,SAAS;MACtB,IAAI,CAACI,MAAM,CAACwB,SAAS,CAAC,6CAA6C,CAAC;MAEpE,OAAOhB,SAAS;IAClB;IAEA,IAAI,CAACR,MAAM,CAACyB,OAAO,CAACC,KAAK,CAACH,GAAG,CAAC;IAC9B,IAAI,CAAC3B,KAAK,GAAG,MAAM;IAEnB,OAAO,IAAI,CAACW,SAAS,CAAC,IAAI,CAACR,KAAK,CAACE,eAAe,CAAC,CAAC,CAAC;EACrD,CAAC;EAEOE,YAAY,GAAGA,CAAA,MAAsB;IAC3C,GAAG,IAAI,CAACH,MAAM,CAAC2B,KAAK;IACpBtB,KAAK,EAAE,IAAIjB,kBAAkB,CAAC,IAAI,CAACY,MAAM,CAAC4B,SAAS,CAAC,CAACC,KAAK,CACxDnC,oBAAoB,EACpBV,qBAAqB,CAAC,CACxB;EACF,CAAC,CAAC;EAEMuB,SAAS,GACfM,QAA8C,IAE9CA,QAAQ,EAAES,GAAG,CAAEQ,OAAO,KAAM;IAC1B,GAAGA,OAAO;IACVzB,KAAK,EAAE,IAAI,CAACL,MAAM,CAACyB,OAAO,CAACM,YAAY,CAACD,OAAO,CAACzB,KAAK;EACvD,CAAC,CAAC,CAAC;AACP;;AAEA;AACA;AACA;AACA;AACA,MAAM2B,kBAAkB,GAAGA,CACzBjC,KAA2B,EAC3BC,MAA4B,KACP;EACrBA,MAAM,CAACyB,OAAO,CAACQ,GAAG,CAAC,CAAC;EAEpB,OAAO9C,wBAAwB,CAACa,MAAM,CAACkC,gBAAgB,CAAC,GACpD,IAAIvC,uBAAuB,CAACI,KAAK,EAAEC,MAAM,CAAC,GAC1CD,KAAK;AACX,CAAC;AAED,SAASiC,kBAAkB","ignoreList":[]}
@@ -2,6 +2,7 @@
2
2
 
3
3
  /* eslint-disable max-lines */
4
4
 
5
+ import { hexToByte } from "../../../utils/hex-to-byte.js";
5
6
  import { le32FromHex } from "../../../utils/le-32-from-hex.js";
6
7
  import { le32ToBytes } from "../../../utils/le-32-to-bytes.js";
7
8
  import { LepuCommand } from "./lepu.commands.js";
@@ -11,11 +12,10 @@ import { describeLepuResponseType, isLepuSuccess } from "./lepu.response-type.js
11
12
  const FILE_SIZE_OFFSET = 0;
12
13
 
13
14
  /**
14
- * A hex-byte array costs far more memory than the file it describes, so the cap sits well
15
- * below what a device could offer. A stored ECG is tens of kilobytes; a length near this one
16
- * is a length to refuse rather than try to hold on a low-memory tablet.
15
+ * A size beyond this is a corrupt length field rather than a recording. A holter ECG takes about
16
+ * a byte per sample at 125 Hz, so this holds about 140 hours.
17
17
  */
18
- const MAX_FILE_BYTES = 262_144;
18
+ const MAX_FILE_BYTES = 64 * 1_024 * 1_024;
19
19
  const TRANSFER_COMMANDS = [LepuCommand.GET_FILE_LIST, LepuCommand.READ_FILE_START, LepuCommand.READ_FILE_DATA, LepuCommand.READ_FILE_END];
20
20
 
21
21
  /** A file read from a Lepu device. */
@@ -44,7 +44,8 @@ class LepuFileTransfer {
44
44
  fileIndex = 0;
45
45
  name = "";
46
46
  totalBytes = 0;
47
- content = [];
47
+ bytes = new Uint8Array(0);
48
+ received = 0;
48
49
  isSessionOpen = false;
49
50
  isDone = false;
50
51
  constructor(params) {
@@ -66,6 +67,7 @@ class LepuFileTransfer {
66
67
  if (command === LepuCommand.GET_FILE_LIST) {
67
68
  this.files = lepuNamesFrom(lepuPayloadOf(frame));
68
69
  this.fileIndex = 0;
70
+ this.params.onFileList?.(this.files);
69
71
  return this.openNextFile();
70
72
  }
71
73
  if (command === LepuCommand.READ_FILE_START) {
@@ -88,7 +90,8 @@ class LepuFileTransfer {
88
90
  }
89
91
  this.name = name;
90
92
  this.totalBytes = 0;
91
- this.content = [];
93
+ this.bytes = new Uint8Array(0);
94
+ this.received = 0;
92
95
  return [this.commandFor(LepuCommand.READ_FILE_START, [...lepuNameBytes(name), ...le32ToBytes(0)])];
93
96
  };
94
97
 
@@ -103,6 +106,7 @@ class LepuFileTransfer {
103
106
  if (this.totalBytes === 0) {
104
107
  return this.closeFile();
105
108
  }
109
+ this.bytes = new Uint8Array(this.totalBytes);
106
110
  return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(0))];
107
111
  };
108
112
 
@@ -113,28 +117,30 @@ class LepuFileTransfer {
113
117
  */
114
118
  appendChunk = payload => {
115
119
  if (payload.length === 0) {
116
- return this.fail(`"${this.name}" stopped sending at ${this.content.length} of ${this.totalBytes} bytes`);
120
+ return this.fail(`"${this.name}" stopped sending at ${this.received} of ${this.totalBytes} bytes`);
117
121
  }
118
- this.content.push(...payload);
122
+ const fits = payload.slice(0, this.totalBytes - this.received);
123
+ this.bytes.set(fits.map(hexToByte), this.received);
124
+ this.received += fits.length;
119
125
  this.params.onProgress?.({
120
126
  name: this.name,
121
- receivedBytes: this.content.length,
127
+ receivedBytes: this.received,
122
128
  totalBytes: this.totalBytes
123
129
  });
124
- if (this.content.length >= this.totalBytes) {
130
+ if (this.received >= this.totalBytes) {
125
131
  return this.closeFile();
126
132
  }
127
- return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(this.content.length))];
133
+ return [this.commandFor(LepuCommand.READ_FILE_DATA, le32ToBytes(this.received))];
128
134
  };
129
135
  closedFile = () => {
130
136
  this.isSessionOpen = false;
131
- if (this.totalBytes > 0 && this.content.length !== this.totalBytes) {
132
- return this.fail(`"${this.name}" ended at ${this.content.length} of ${this.totalBytes} bytes`);
137
+ if (this.totalBytes > 0 && this.received !== this.totalBytes) {
138
+ return this.fail(`"${this.name}" ended at ${this.received} of ${this.totalBytes} bytes`);
133
139
  }
134
140
  if (this.totalBytes > 0) {
135
141
  this.params.onFile({
136
142
  name: this.name,
137
- content: this.content
143
+ bytes: this.bytes
138
144
  });
139
145
  }
140
146
  this.fileIndex++;