@ovok/native 0.4.3 → 0.4.5

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 (145) hide show
  1. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js +8 -23
  2. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  3. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +89 -0
  4. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -0
  5. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.main-services.js +50 -21
  6. package/lib/commonjs/modules/bt-management/services/devices/bp2/bp2.main-services.js.map +1 -1
  7. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +25 -1
  8. package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  9. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js +80 -85
  10. package/lib/commonjs/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  11. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +25 -3
  12. package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  13. package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js +54 -0
  14. package/lib/commonjs/modules/bt-management/services/devices/frame-parser.js.map +1 -0
  15. package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js +63 -0
  16. package/lib/commonjs/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -0
  17. package/lib/commonjs/modules/bt-management/types/frame-read-result.js +6 -0
  18. package/lib/commonjs/modules/bt-management/types/frame-read-result.js.map +1 -0
  19. package/lib/commonjs/modules/bt-management/types/frame-read-status.js +17 -0
  20. package/lib/commonjs/modules/bt-management/types/frame-read-status.js.map +1 -0
  21. package/lib/commonjs/modules/bt-management/types/frame-reader.js +6 -0
  22. package/lib/commonjs/modules/bt-management/types/frame-reader.js.map +1 -0
  23. package/lib/commonjs/modules/bt-management/utils/calculate-crc-8.js +43 -0
  24. package/lib/commonjs/modules/bt-management/utils/calculate-crc-8.js.map +1 -0
  25. package/lib/commonjs/modules/bt-management/utils/convert-bp-state-flag.js +8 -1
  26. package/lib/commonjs/modules/bt-management/utils/convert-bp-state-flag.js.map +1 -1
  27. package/lib/commonjs/modules/bt-management/utils/le-16-from-hex.js.map +1 -1
  28. package/lib/commonjs/modules/data-sync/components/android/android-health-sync.js +11 -1
  29. package/lib/commonjs/modules/data-sync/components/android/android-health-sync.js.map +1 -1
  30. package/lib/commonjs/modules/data-sync/components/apple/apple-health-sync.js +33 -1
  31. package/lib/commonjs/modules/data-sync/components/apple/apple-health-sync.js.map +1 -1
  32. package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js +4 -0
  33. package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js.map +1 -1
  34. package/lib/commonjs/modules/data-sync/services/managers/storage-manager.js +30 -2
  35. package/lib/commonjs/modules/data-sync/services/managers/storage-manager.js.map +1 -1
  36. package/lib/commonjs/modules/data-sync/services/managers/sync-state-manager.js +19 -0
  37. package/lib/commonjs/modules/data-sync/services/managers/sync-state-manager.js.map +1 -1
  38. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js +9 -23
  39. package/lib/module/modules/bt-management/services/devices/bp2/bp2.device.js.map +1 -1
  40. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js +84 -0
  41. package/lib/module/modules/bt-management/services/devices/bp2/bp2.frame-reader.js.map +1 -0
  42. package/lib/module/modules/bt-management/services/devices/bp2/bp2.main-services.js +50 -21
  43. package/lib/module/modules/bt-management/services/devices/bp2/bp2.main-services.js.map +1 -1
  44. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +25 -1
  45. package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
  46. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js +80 -85
  47. package/lib/module/modules/bt-management/services/devices/bt-data-processor.js.map +1 -1
  48. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +25 -3
  49. package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
  50. package/lib/module/modules/bt-management/services/devices/frame-parser.js +50 -0
  51. package/lib/module/modules/bt-management/services/devices/frame-parser.js.map +1 -0
  52. package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js +58 -0
  53. package/lib/module/modules/bt-management/services/devices/measurement-state-machine.js.map +1 -0
  54. package/lib/module/modules/bt-management/types/frame-read-result.js +4 -0
  55. package/lib/module/modules/bt-management/types/frame-read-result.js.map +1 -0
  56. package/lib/module/modules/bt-management/types/frame-read-status.js +13 -0
  57. package/lib/module/modules/bt-management/types/frame-read-status.js.map +1 -0
  58. package/lib/module/modules/bt-management/types/frame-reader.js +4 -0
  59. package/lib/module/modules/bt-management/types/frame-reader.js.map +1 -0
  60. package/lib/module/modules/bt-management/utils/calculate-crc-8.js +38 -0
  61. package/lib/module/modules/bt-management/utils/calculate-crc-8.js.map +1 -0
  62. package/lib/module/modules/bt-management/utils/convert-bp-state-flag.js +9 -1
  63. package/lib/module/modules/bt-management/utils/convert-bp-state-flag.js.map +1 -1
  64. package/lib/module/modules/bt-management/utils/le-16-from-hex.js.map +1 -1
  65. package/lib/module/modules/data-sync/components/android/android-health-sync.js +11 -1
  66. package/lib/module/modules/data-sync/components/android/android-health-sync.js.map +1 -1
  67. package/lib/module/modules/data-sync/components/apple/apple-health-sync.js +33 -1
  68. package/lib/module/modules/data-sync/components/apple/apple-health-sync.js.map +1 -1
  69. package/lib/module/modules/data-sync/services/base-health-sync-service.js +4 -0
  70. package/lib/module/modules/data-sync/services/base-health-sync-service.js.map +1 -1
  71. package/lib/module/modules/data-sync/services/managers/storage-manager.js +30 -2
  72. package/lib/module/modules/data-sync/services/managers/storage-manager.js.map +1 -1
  73. package/lib/module/modules/data-sync/services/managers/sync-state-manager.js +19 -0
  74. package/lib/module/modules/data-sync/services/managers/sync-state-manager.js.map +1 -1
  75. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +3 -1
  76. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  77. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +14 -0
  78. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -0
  79. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bp2/bp2.main-services.d.ts.map +1 -1
  80. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +9 -1
  81. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  82. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts +27 -10
  83. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  84. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -1
  85. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  86. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/frame-parser.d.ts +19 -0
  87. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -0
  88. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +30 -0
  89. package/lib/typescript/commonjs/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -0
  90. package/lib/typescript/commonjs/src/modules/bt-management/types/frame-read-result.d.ts +21 -0
  91. package/lib/typescript/commonjs/src/modules/bt-management/types/frame-read-result.d.ts.map +1 -0
  92. package/lib/typescript/commonjs/src/modules/bt-management/types/frame-read-status.d.ts +10 -0
  93. package/lib/typescript/commonjs/src/modules/bt-management/types/frame-read-status.d.ts.map +1 -0
  94. package/lib/typescript/commonjs/src/modules/bt-management/types/frame-reader.d.ts +13 -0
  95. package/lib/typescript/commonjs/src/modules/bt-management/types/frame-reader.d.ts.map +1 -0
  96. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-crc-8.d.ts +10 -0
  97. package/lib/typescript/commonjs/src/modules/bt-management/utils/calculate-crc-8.d.ts.map +1 -0
  98. package/lib/typescript/commonjs/src/modules/bt-management/utils/convert-bp-state-flag.d.ts +7 -0
  99. package/lib/typescript/commonjs/src/modules/bt-management/utils/convert-bp-state-flag.d.ts.map +1 -1
  100. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-16-from-hex.d.ts +1 -1
  101. package/lib/typescript/commonjs/src/modules/bt-management/utils/le-16-from-hex.d.ts.map +1 -1
  102. package/lib/typescript/commonjs/src/modules/data-sync/components/android/android-health-sync.d.ts.map +1 -1
  103. package/lib/typescript/commonjs/src/modules/data-sync/components/apple/apple-health-sync.d.ts.map +1 -1
  104. package/lib/typescript/commonjs/src/modules/data-sync/services/base-health-sync-service.d.ts +2 -0
  105. package/lib/typescript/commonjs/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
  106. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/storage-manager.d.ts +20 -0
  107. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/storage-manager.d.ts.map +1 -1
  108. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-state-manager.d.ts +13 -0
  109. package/lib/typescript/commonjs/src/modules/data-sync/services/managers/sync-state-manager.d.ts.map +1 -1
  110. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts +3 -1
  111. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.device.d.ts.map +1 -1
  112. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts +14 -0
  113. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.frame-reader.d.ts.map +1 -0
  114. package/lib/typescript/module/src/modules/bt-management/services/devices/bp2/bp2.main-services.d.ts.map +1 -1
  115. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts +9 -1
  116. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
  117. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts +27 -10
  118. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-data-processor.d.ts.map +1 -1
  119. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +23 -1
  120. package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
  121. package/lib/typescript/module/src/modules/bt-management/services/devices/frame-parser.d.ts +19 -0
  122. package/lib/typescript/module/src/modules/bt-management/services/devices/frame-parser.d.ts.map +1 -0
  123. package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts +30 -0
  124. package/lib/typescript/module/src/modules/bt-management/services/devices/measurement-state-machine.d.ts.map +1 -0
  125. package/lib/typescript/module/src/modules/bt-management/types/frame-read-result.d.ts +21 -0
  126. package/lib/typescript/module/src/modules/bt-management/types/frame-read-result.d.ts.map +1 -0
  127. package/lib/typescript/module/src/modules/bt-management/types/frame-read-status.d.ts +10 -0
  128. package/lib/typescript/module/src/modules/bt-management/types/frame-read-status.d.ts.map +1 -0
  129. package/lib/typescript/module/src/modules/bt-management/types/frame-reader.d.ts +13 -0
  130. package/lib/typescript/module/src/modules/bt-management/types/frame-reader.d.ts.map +1 -0
  131. package/lib/typescript/module/src/modules/bt-management/utils/calculate-crc-8.d.ts +10 -0
  132. package/lib/typescript/module/src/modules/bt-management/utils/calculate-crc-8.d.ts.map +1 -0
  133. package/lib/typescript/module/src/modules/bt-management/utils/convert-bp-state-flag.d.ts +7 -0
  134. package/lib/typescript/module/src/modules/bt-management/utils/convert-bp-state-flag.d.ts.map +1 -1
  135. package/lib/typescript/module/src/modules/bt-management/utils/le-16-from-hex.d.ts +1 -1
  136. package/lib/typescript/module/src/modules/bt-management/utils/le-16-from-hex.d.ts.map +1 -1
  137. package/lib/typescript/module/src/modules/data-sync/components/android/android-health-sync.d.ts.map +1 -1
  138. package/lib/typescript/module/src/modules/data-sync/components/apple/apple-health-sync.d.ts.map +1 -1
  139. package/lib/typescript/module/src/modules/data-sync/services/base-health-sync-service.d.ts +2 -0
  140. package/lib/typescript/module/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
  141. package/lib/typescript/module/src/modules/data-sync/services/managers/storage-manager.d.ts +20 -0
  142. package/lib/typescript/module/src/modules/data-sync/services/managers/storage-manager.d.ts.map +1 -1
  143. package/lib/typescript/module/src/modules/data-sync/services/managers/sync-state-manager.d.ts +13 -0
  144. package/lib/typescript/module/src/modules/data-sync/services/managers/sync-state-manager.d.ts.map +1 -1
  145. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"bt-data-processor.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/bt-management/services/devices/bt-data-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAKjF,UAAU,sBAAsB,CAAC,CAAC,SAAS,WAAW;IACpD,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC1D,eAAe,CAAC,EAAE,CAChB,MAAM,EAAE,YAAY,EACpB,kBAAkB,CAAC,EAAE,kBAAkB,KACpC,IAAI,CAAC;IACV,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,CACT,UAAU,EAAE,uBAAuB,CAAC,WAAW,CAAC,EAChD,eAAe,EAAE,MAAM,EAAE,KACtB,OAAO,GAAG,IAAI,CAAC;IACpB,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,qBAAqB,CAAC,EAAE,CACtB,IAAI,EAAE,4BAA4B,CAAC,CAAC,CAAC,KAClC,4BAA4B,CAAC,CAAC,CAAC,CAAC;CACtC;AAED,qBAAa,eAAe,CAAC,CAAC,SAAS,WAAW;IAc9C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAhB5B;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,gBAAgB,CAA4C;gBAEjD,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,cAAc,CAAC,aAAa,CAAC,EAC3C,wBAAwB,EAAE,MAAM,EAChC,SAAS,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAGvD,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,CAAC,WAAW,CAAc;IAE1B,OAAO,aAMZ;IAEK,WAAW,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE,UAoCpD;IAEF,OAAO,CAAC,WAAW;IAmCnB,OAAO,CAAC,gBAAgB;IAiBxB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,mBAAmB;IA2C3B,OAAO,CAAC,+BAA+B,CAGrC;IAEF,OAAO,CAAC,iBAAiB,CAevB;CACH"}
1
+ {"version":3,"file":"bt-data-processor.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/bt-management/services/devices/bt-data-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,E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AO,CAA+B;IAC9C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiB;IAC7C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA6B;IAC9D,OAAO,CAAC,gBAAgB,CAA4C;gBAEjD,MAAM,EAAE,MAAM,EAC/B,YAAY,EAAE,cAAc,CAAC,aAAa,CAAC,EAC1B,wBAAwB,EAAE,MAAM,EAChC,SAAS,EAAE,sBAAsB,CAAC,CAAC,CAAC,EACpC,WAAW,CAAC,EAAE,WAAW,YAAA;IAU5C,OAAO,CAAC,WAAW,CAAc;IAE1B,OAAO,aAMZ;IAEK,WAAW,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE,UAgBpD;IAEF;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB,CAgC1B;IAEF;;OAEG;IACH,OAAO,CAAC,eAAe,CAQrB;IAEF,OAAO,CAAC,WAAW,CAuBjB;IAEF,OAAO,CAAC,kBAAkB,CAQxB;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB,CAevB;CACH"}
@@ -6,6 +6,7 @@ import { DeviceData } from "../../types/device-data";
6
6
  import { DeviceKey } from "../../types/device-key";
7
7
  import { MeasurementTypeForDevices } from "../../types/device-measurement-map";
8
8
  import { DeviceStatus } from "../../types/device-status";
9
+ import { FrameReader } from "../../types/frame-reader";
9
10
  import { IBTManagedDevice } from "../../types/i-bt-managed-device";
10
11
  import { IMedicalDevice } from "../../types/i-medical-device";
11
12
  import { IntegratedDevices } from "../../types/integrated-devices";
@@ -30,7 +31,28 @@ export declare abstract class BTManagedDevice<T extends DeviceKey = IntegratedDe
30
31
  */
31
32
  protected handleDependentResult?: (data: DependentResultHandlerParams<MeasurementTypeForDevices<[T]>>) => DependentResultHandlerParams<MeasurementTypeForDevices<[T]>>;
32
33
  protected abstract mainServices: IMedicalDevice["mainService"];
33
- protected abstract validatePackage: (pkg: string[], uuid: string) => boolean;
34
+ /**
35
+ * Locates frame boundaries inside the notification buffer.
36
+ *
37
+ * A device that leaves this undefined has its whole buffer handed to
38
+ * `validatePackage` and parsed as a single frame, which only holds while a
39
+ * notification can neither split a frame nor carry more than one.
40
+ */
41
+ protected frameReader?: FrameReader;
42
+ /**
43
+ * MTU to ask for once connected.
44
+ *
45
+ * A larger MTU carries a frame in fewer notifications, which matters most for the
46
+ * long payloads. Devices that leave this undefined keep the platform default.
47
+ */
48
+ protected preferredMtu?: number;
49
+ /**
50
+ * Decides whether the buffer holds a parseable frame.
51
+ *
52
+ * Only consulted for devices that declare no frameReader. A device that declares
53
+ * neither parses nothing, so an unknown buffer is never decoded on trust.
54
+ */
55
+ protected validatePackage?: (pkg: string[], uuid: string) => boolean;
34
56
  protected abstract onStreamStart?: () => void;
35
57
  protected abstract handleSuccessResult(successResult: MeasurementWithCaseType<Measurement>, collectedValues: string[]): void | boolean;
36
58
  onError?: (error: BleError | Error | string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"bt-managed-device.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/bt-management/services/devices/bt-managed-device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAA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AAI,EAAE,uBAAuB,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAC1D,IAAI,CAAC;IACH,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;gBAEvB,MAAM,EAAE,MAAM,EAE9B,EACE,UAAU,EACV,OAAO,EAAE,eAAe,EACxB,qBAAqB,EAAE,6BAA6B,EACpD,QAAQ,EAAE,gBAAgB,EAC1B,oBAAoB,EAAE,4BAA4B,GACnD,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAsEnB,OAAO,aAUZ;IAEK,OAAO,sBAgDZ;IAEF,OAAO,CAAC,+BAA+B,CAarC;CACH"}
1
+ {"version":3,"file":"bt-managed-device.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/bt-management/services/devices/bt-managed-device.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAKjF,8BAAsB,eA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AAC;IACH,QAAQ,CAAC,EAAE,CAChB,IAAI,EAAE,uBAAuB,CAAC,yBAAyB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAC1D,IAAI,CAAC;IACH,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;gBAEvB,MAAM,EAAE,MAAM,EAE9B,EACE,UAAU,EACV,OAAO,EAAE,eAAe,EACxB,qBAAqB,EAAE,6BAA6B,EACpD,QAAQ,EAAE,gBAAgB,EAC1B,oBAAoB,EAAE,4BAA4B,GACnD,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAsEnB,OAAO,aAUZ;IAEK,OAAO,sBAkDZ;IAEF,OAAO,CAAC,+BAA+B,CAarC;CACH"}
@@ -0,0 +1,19 @@
1
+ import { Measurement } from "@ovok/core";
2
+ import { DependentResultHandlerParams } from "../../types/dependent-result-handler-params";
3
+ import { IMedicalDevice } from "../../types/i-medical-device";
4
+ /**
5
+ * Turns a verified frame into a measurement, by selecting the parsing case the frame
6
+ * matches and applying that case's field definitions.
7
+ *
8
+ * A frame whose characteristic is unknown, whose selector bytes match no declared case,
9
+ * or whose fields do not parse yields nothing: it is the caller's decision whether that
10
+ * is worth reporting.
11
+ */
12
+ export declare class FrameParser<T extends Measurement> {
13
+ private readonly mainServices;
14
+ constructor(mainServices: IMedicalDevice["mainService"]);
15
+ parse(uuid: string, frame: string[]): DependentResultHandlerParams<T> | undefined;
16
+ private findParsingModel;
17
+ private readCaseValue;
18
+ }
19
+ //# sourceMappingURL=frame-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-parser.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/bt-management/services/devices/frame-parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9D;;;;;;;GAOG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,WAAW;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAAZ,YAAY,EAAE,cAAc,CAAC,aAAa,CAAC;IAEjE,KAAK,CACV,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EAAE,GACd,4BAA4B,CAAC,CAAC,CAAC,GAAG,SAAS;IA8B9C,OAAO,CAAC,gBAAgB;IAcxB,OAAO,CAAC,aAAa;CAMtB"}
@@ -0,0 +1,30 @@
1
+ import { Measurement, MeasurementTypeKey } from "@ovok/core";
2
+ import { DependentResultHandlerParams } from "../../types/dependent-result-handler-params";
3
+ import { DeviceStatus } from "../../types/device-status";
4
+ import { MeasurementWithCaseType } from "../../types/measurement-with-case-type";
5
+ interface MeasurementStateCallbacks {
6
+ onStatusChanged?: (status: DeviceStatus, measurementTypeKey?: MeasurementTypeKey) => void;
7
+ onStreamStart?: () => void;
8
+ onResult?: (parsedData: MeasurementWithCaseType<Measurement>, frame: string[]) => boolean | void;
9
+ }
10
+ /**
11
+ * Moves a device between measuring and connected as parsed frames arrive, and decides
12
+ * which of them is worth reporting.
13
+ *
14
+ * A result is reported whether or not a stream preceded it, because a device already
15
+ * holding a finished measurement when the app connects has a real reading to hand over.
16
+ * Repeats are suppressed on the case transition rather than on the values, so a second
17
+ * measurement that happens to read the same as the first is still reported.
18
+ */
19
+ export declare class MeasurementStateMachine<T extends Measurement> {
20
+ private readonly callbacks;
21
+ private isMeasuring;
22
+ private lastCaseValue;
23
+ constructor(callbacks: MeasurementStateCallbacks);
24
+ reset: () => void;
25
+ advance: ({ parsingCase, measurementTypeKey, parsedData, }: DependentResultHandlerParams<T>, frame: string[]) => void;
26
+ private startMeasuring;
27
+ private stopMeasuring;
28
+ }
29
+ export {};
30
+ //# sourceMappingURL=measurement-state-machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measurement-state-machine.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/bt-management/services/devices/measurement-state-machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAG7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAEjF,UAAU,yBAAyB;IACjC,eAAe,CAAC,EAAE,CAChB,MAAM,EAAE,YAAY,EACpB,kBAAkB,CAAC,EAAE,kBAAkB,KACpC,IAAI,CAAC;IACV,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,QAAQ,CAAC,EAAE,CACT,UAAU,EAAE,uBAAuB,CAAC,WAAW,CAAC,EAChD,KAAK,EAAE,MAAM,EAAE,KACZ,OAAO,GAAG,IAAI,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,qBAAa,uBAAuB,CAAC,CAAC,SAAS,WAAW;IAI5C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAHtC,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,aAAa,CAAqB;gBAEb,SAAS,EAAE,yBAAyB;IAE1D,KAAK,QAAO,IAAI,CAGrB;IAEK,OAAO,GACZ,kDAIG,4BAA4B,CAAC,CAAC,CAAC,EAClC,OAAO,MAAM,EAAE,KACd,IAAI,CA6BL;IAEF,OAAO,CAAC,cAAc,CAIpB;IAEF,OAAO,CAAC,aAAa,CAMnB;CACH"}
@@ -0,0 +1,21 @@
1
+ import { FrameReadStatus } from "./frame-read-status";
2
+ /**
3
+ * What a FrameReader found, and how much of the buffer it has finished with.
4
+ *
5
+ * `consumedBytes` is always the number of leading bytes the caller should drop: bytes
6
+ * before a frame start are junk, a verified frame is spent once parsed, and a corrupt
7
+ * one is skipped far enough to resynchronise on the next start byte. A frame is only
8
+ * present when the read succeeded, so an unverified frame cannot reach a parser.
9
+ */
10
+ export type FrameReadResult = {
11
+ status: FrameReadStatus.INCOMPLETE;
12
+ consumedBytes: number;
13
+ } | {
14
+ status: FrameReadStatus.CORRUPT;
15
+ consumedBytes: number;
16
+ } | {
17
+ status: FrameReadStatus.COMPLETE;
18
+ consumedBytes: number;
19
+ frame: string[];
20
+ };
21
+ //# sourceMappingURL=frame-read-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-read-result.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/types/frame-read-result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GACvB;IACE,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IACE,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC;IAChC,aAAa,EAAE,MAAM,CAAC;CACvB,GACD;IACE,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** Outcome of trying to read one frame from a notification buffer. */
2
+ export declare enum FrameReadStatus {
3
+ /** No complete frame yet. The buffer must keep growing. */
4
+ INCOMPLETE = "incomplete",
5
+ /** A frame was found but failed its integrity check and must not be parsed. */
6
+ CORRUPT = "corrupt",
7
+ /** A complete, verified frame was isolated. */
8
+ COMPLETE = "complete"
9
+ }
10
+ //# sourceMappingURL=frame-read-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-read-status.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/types/frame-read-status.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,oBAAY,eAAe;IAEzB,2DAA2D;IAC3D,UAAU,eAAe;IAEzB,+EAA+E;IAC/E,OAAO,YAAY;IAEnB,+CAA+C;IAC/C,QAAQ,aAAa;CACtB"}
@@ -0,0 +1,13 @@
1
+ import { FrameReadResult } from "./frame-read-result";
2
+ /**
3
+ * Isolates one complete, verified frame from a notification buffer.
4
+ *
5
+ * Notifications do not respect frame boundaries: one frame can arrive across several
6
+ * notifications, and several frames can arrive in one. A device that declares a reader
7
+ * hands the SDK enough knowledge to find frame edges itself instead of assuming a
8
+ * notification is a frame.
9
+ */
10
+ export interface FrameReader {
11
+ readFrame(buffer: readonly string[]): FrameReadResult;
12
+ }
13
+ //# sourceMappingURL=frame-reader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame-reader.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/types/frame-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,eAAe,CAAC;CACvD"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * CRC-8/ATM (polynomial 0x07, initial value 0x00) over the first `byteCount` bytes.
3
+ *
4
+ * Lepu devices store a frame's checksum in its final byte, so a frame is verified by
5
+ * running this over every byte except that one and comparing the result against it.
6
+ * The byte count is explicit rather than implied so the caller states which bytes are
7
+ * covered instead of relying on a convention hidden in here.
8
+ */
9
+ export declare const calculateCrc8: (hex: string[], byteCount: number) => number;
10
+ //# sourceMappingURL=calculate-crc-8.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calculate-crc-8.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/utils/calculate-crc-8.ts"],"names":[],"mappings":"AA8BA;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,EAAE,EAAE,WAAW,MAAM,KAAG,MAQhE,CAAC"}
@@ -1,3 +1,10 @@
1
1
  import { BloodPressureStates } from "../types/blood-pressure-states";
2
+ /**
3
+ * Maps the device's measurement status byte onto a known state.
4
+ *
5
+ * An unrecognised flag reports a device error rather than a regular reading: firmware
6
+ * may report a failure this SDK has not seen, and treating that as a good measurement
7
+ * would publish a reading the device did not vouch for.
8
+ */
2
9
  export declare const convertBpStateFlag: (stateFlag: string) => BloodPressureStates;
3
10
  //# sourceMappingURL=convert-bp-state-flag.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"convert-bp-state-flag.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/utils/convert-bp-state-flag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,KAAG,mBAetD,CAAC"}
1
+ {"version":3,"file":"convert-bp-state-flag.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/utils/convert-bp-state-flag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,KAAG,mBAetD,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const le16FromHex: (hex: string[], i: number) => number;
1
+ export declare const le16FromHex: (hex: readonly string[], i: number) => number;
2
2
  //# sourceMappingURL=le-16-from-hex.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"le-16-from-hex.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/utils/le-16-from-hex.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,EAAE,EAAE,GAAG,MAAM,KAAG,MAKtD,CAAC"}
1
+ {"version":3,"file":"le-16-from-hex.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/bt-management/utils/le-16-from-hex.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,GAAI,KAAK,SAAS,MAAM,EAAE,EAAE,GAAG,MAAM,KAAG,MAK/D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"android-health-sync.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/components/android/android-health-sync.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,eAAO,MAAM,iBAAiB,6EACqB,sBAAsB,UAoExE,CAAC"}
1
+ {"version":3,"file":"android-health-sync.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/components/android/android-health-sync.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAG/E,eAAO,MAAM,iBAAiB,6EACqB,sBAAsB,UA+ExE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"apple-health-sync.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/components/apple/apple-health-sync.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,eAAO,MAAM,eAAe,6EACuB,oBAAoB,UAoEtE,CAAC"}
1
+ {"version":3,"file":"apple-health-sync.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/components/apple/apple-health-sync.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,eAAO,MAAM,eAAe,6EACuB,oBAAoB,UAqGtE,CAAC"}
@@ -23,7 +23,9 @@ export declare abstract class BaseHealthSyncService<TDataToSync extends AndroidH
23
23
  protected abstract getTotalCountsFunction(): (props: GetTotalCountProps<TTypeIdentifier>) => Promise<number>;
24
24
  protected abstract getDataFromProviderFunction(): (props: GetDataFromProviderProps<TTypeIdentifier>) => Promise<DataFromProviderResult<TDataFromProvider, TTypeIdentifier>>;
25
25
  protected abstract getConverterFunction(): (props: ConvertDataProps<TDataFromProvider>) => Promise<Observation[]>;
26
+ /** One run at a time; see `SyncStateManager.once` for why that matters. */
26
27
  startSync(): Promise<void>;
28
+ private runSync;
27
29
  stopSync(): Promise<void>;
28
30
  pauseSync(): Promise<void>;
29
31
  private initializeSync;
@@ -1 +1 @@
1
- {"version":3,"file":"base-health-sync-service.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/data-sync/services/base-health-sync-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAQ1D,8BAAsB,qBAAqB,CACzC,WAAW,SACP,sBAAsB,CAAC,YAAY,CAAC,GACpC,oBAAoB,CAAC,YAAY,CAAC,EACtC,eAAe,SAAS,wBAAwB,GAAG,UAAU,EAC7D,iBAAiB,GAAG,eAAe,SAAS,UAAU,GAClD,YAAY,CAAC,eAAe,CAAC,GAC7B,eAAe,SAAS,wBAAwB,GAC9C,gBAAgB,CAAC,eAAe,CAAC,GACjC,KAAK;IAEX,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAa;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAc;IACzC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyB;IAErD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmC;IACnE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAmB;IAChD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAI5B;gBAEU,KAAK,EAAE,gBAAgB,CAAC,WAAW,CAAC;IA2BhD,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,cAAc;IAEpD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,IAAI,CAC3C,KAAK,EAAE,kBAAkB,CAAC,eAAe,CAAC,KACvC,OAAO,CAAC,MAAM,CAAC;IAEpB,SAAS,CAAC,QAAQ,CAAC,2BAA2B,IAAI,CAChD,KAAK,EAAE,wBAAwB,CAAC,eAAe,CAAC,KAC7C,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;IAExE,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,CACzC,KAAK,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,KACvC,OAAO,CAAC,WAAW,EAAE,CAAC;IAEd,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IA6B1B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;YAIzB,cAAc;YAUd,oBAAoB;YAuBpB,mBAAmB;YAqBnB,cAAc;IAoD5B,OAAO,CAAC,yBAAyB;CAGlC"}
1
+ {"version":3,"file":"base-health-sync-service.d.ts","sourceRoot":"","sources":["../../../../../../../src/modules/data-sync/services/base-health-sync-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,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EAAE,gBAAgB,CAAC,WAAW,CAAC;IA2BhD,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,cAAc;IAEpD,SAAS,CAAC,QAAQ,CAAC,sBAAsB,IAAI,CAC3C,KAAK,EAAE,kBAAkB,CAAC,eAAe,CAAC,KACvC,OAAO,CAAC,MAAM,CAAC;IAEpB,SAAS,CAAC,QAAQ,CAAC,2BAA2B,IAAI,CAChD,KAAK,EAAE,wBAAwB,CAAC,eAAe,CAAC,KAC7C,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;IAExE,SAAS,CAAC,QAAQ,CAAC,oBAAoB,IAAI,CACzC,KAAK,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,KACvC,OAAO,CAAC,WAAW,EAAE,CAAC;IAE3B,2EAA2E;IAC9D,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;YAIzB,OAAO;IA6BR,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAMzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;YAIzB,cAAc;YAUd,oBAAoB;YAuBpB,mBAAmB;YAqBnB,cAAc;IAoD5B,OAAO,CAAC,yBAAyB;CAGlC"}
@@ -5,10 +5,30 @@ import { saveBundleObservations } from "../../utils/save-bundle-observations";
5
5
  export declare class StorageManager {
6
6
  private client;
7
7
  private provider;
8
+ /**
9
+ * Where an anchor goes when the host client has no storage.
10
+ *
11
+ * `clientStorage` is assigned from `OvokClient`'s `storage` option and from
12
+ * nowhere else, so a host that constructs its client without one leaves it
13
+ * `undefined` — and the `?.` below then swallowed every write while
14
+ * `getAnchor` answered `undefined` for ever. That is not a lost
15
+ * optimisation: `getObservationBodiesForType` reports `hasAnchor` from the
16
+ * anchor the provider just returned, and `syncDataByType` loops while it is
17
+ * true. An anchor that never advances means the next read starts from the
18
+ * beginning again, returns the same first chunk and the same anchor, and
19
+ * uploads it — for ever.
20
+ *
21
+ * The sync must not depend on what the host passed. This map keeps the
22
+ * anchor for the life of the service instance, which is what lets the loop
23
+ * end; when the host DOES provide storage the anchor also survives a
24
+ * restart, which is what keeps the next cold start short.
25
+ */
26
+ private readonly inMemoryAnchors;
8
27
  constructor(client: OvokClient, provider: HealthProvider);
9
28
  saveObservations(entries: Parameters<typeof saveBundleObservations>[0]["entries"]): Promise<Bundle<Observation>>;
10
29
  saveAnchor(typeIdentifier: string, anchor: string): void;
11
30
  getAnchor(typeIdentifier: string): string | undefined;
31
+ private anchorKey;
12
32
  saveAnchors(anchors: Array<{
13
33
  typeIdentifier: string;
14
34
  anchor: string;
@@ -1 +1 @@
1
- {"version":3,"file":"storage-manager.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/services/managers/storage-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,qBAAa,cAAc;IAEvB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ;gBADR,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,cAAc;IAG5B,gBAAgB,CACpB,OAAO,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAC/D,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAO/B,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAOxD,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAMrD,WAAW,CACT,OAAO,EAAE,KAAK,CAAC;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GACzD,IAAI;CAKR"}
1
+ {"version":3,"file":"storage-manager.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/services/managers/storage-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,qBAAa,cAAc;IAsBvB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,QAAQ;IAtBlB;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA6B;gBAGnD,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,cAAc;IAG5B,gBAAgB,CACpB,OAAO,EAAE,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAC/D,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IAO/B,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAYxD,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAQrD,OAAO,CAAC,SAAS;IAIjB,WAAW,CACT,OAAO,EAAE,KAAK,CAAC;QAAE,cAAc,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,GACzD,IAAI;CAKR"}
@@ -1,5 +1,16 @@
1
1
  import { Bundle, Observation } from "@medplum/fhirtypes";
2
2
  export declare class SyncStateManager {
3
+ /**
4
+ * A sync in flight, so a second caller joins it rather than starting another.
5
+ *
6
+ * There are three callers and they overlap by construction:
7
+ * `InstanceManager.getInstanceInternal` starts one as a side effect of
8
+ * handing back the instance, the component starts one on mount, and the
9
+ * change subscription starts one whenever the provider reports new samples.
10
+ * Two runs over one data type read the same chunk and upload it twice,
11
+ * because the read cursor only advances once a read has returned.
12
+ */
13
+ private inFlight;
3
14
  shouldStopSync: boolean;
4
15
  initialDataFetched: boolean;
5
16
  latestObservationDates: Array<{
@@ -8,6 +19,8 @@ export declare class SyncStateManager {
8
19
  }>;
9
20
  results: Bundle<Observation>[];
10
21
  addResult(result: Bundle<Observation>): void;
22
+ /** Runs `sync`, or joins the run already under way. */
23
+ once(sync: () => Promise<void>): Promise<void>;
11
24
  reset(): void;
12
25
  pause(): void;
13
26
  resume(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"sync-state-manager.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/services/managers/sync-state-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEzD,qBAAa,gBAAgB;IACpB,cAAc,UAAS;IACvB,kBAAkB,UAAS;IAC3B,sBAAsB,EAAE,KAAK,CAAC;QACnC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;QACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,CAAC,CAAM;IACD,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAM;IAE3C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;IAI5C,KAAK,IAAI,IAAI;IAOb,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;CAGf"}
1
+ {"version":3,"file":"sync-state-manager.d.ts","sourceRoot":"","sources":["../../../../../../../../src/modules/data-sync/services/managers/sync-state-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEzD,qBAAa,gBAAgB;IAC3B;;;;;;;;;OASG;IACH,OAAO,CAAC,QAAQ,CAA4B;IAErC,cAAc,UAAS;IACvB,kBAAkB,UAAS;IAC3B,sBAAsB,EAAE,KAAK,CAAC;QACnC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;QACzB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,CAAC,CAAM;IACD,OAAO,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAM;IAE3C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,IAAI;IAI5C,uDAAuD;IACjD,IAAI,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD,KAAK,IAAI,IAAI;IAOb,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;CAGf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ovok/native",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "React native component sdk for OVOK",
5
5
  "source": "./src/index.tsx",
6
6
  "main": "./lib/commonjs/index.js",