@ovok/native 1.17.0-dev.2213 → 1.17.0-dev.2219
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.
- package/lib/commonjs/modules/next/bluetooth/adapters/android-foreground-service.js +58 -5
- package/lib/commonjs/modules/next/bluetooth/adapters/android-foreground-service.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/ble-plx-central.js +45 -24
- package/lib/commonjs/modules/next/bluetooth/adapters/ble-plx-central.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/ecg-measurements.js +25 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ecg-measurements.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js +62 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/live-supersession.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js +42 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js +97 -96
- package/lib/commonjs/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-source-id.js +33 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-source-id.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js +38 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/reading-values.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js +101 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/series-saving.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-database.js +24 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-database.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-rows.js +65 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-rows.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-schema.js +53 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-schema.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-store.js +82 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/sqlite-outbox-store.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/storage-paired-devices.js +1 -0
- package/lib/commonjs/modules/next/bluetooth/adapters/storage-paired-devices.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/web-bluetooth-central.js +9 -1
- package/lib/commonjs/modules/next/bluetooth/adapters/web-bluetooth-central.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/bluetooth.js +9 -3
- package/lib/commonjs/modules/next/bluetooth/core/bluetooth.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-deps.js +6 -0
- package/lib/commonjs/modules/next/bluetooth/core/device-deps.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/device-link.js +2 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-link.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js +3 -1
- package/lib/commonjs/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/device.js +19 -6
- package/lib/commonjs/modules/next/bluetooth/core/device.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/live-ledger.js +54 -0
- package/lib/commonjs/modules/next/bluetooth/core/live-ledger.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/measuring-watch.js +45 -0
- package/lib/commonjs/modules/next/bluetooth/core/measuring-watch.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/outbox-watch.js +17 -0
- package/lib/commonjs/modules/next/bluetooth/core/outbox-watch.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/paired-device.js +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/paired-device.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/ports.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/reading-log.js +89 -7
- package/lib/commonjs/modules/next/bluetooth/core/reading-log.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/core/series-slots.js +94 -0
- package/lib/commonjs/modules/next/bluetooth/core/series-slots.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/stream-recorder.js +219 -0
- package/lib/commonjs/modules/next/bluetooth/core/stream-recorder.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/core/waveform-segments.js +110 -0
- package/lib/commonjs/modules/next/bluetooth/core/waveform-segments.js.map +1 -0
- package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js +19 -11
- package/lib/commonjs/modules/next/bluetooth/create-bluetooth.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/index.js +9 -1
- package/lib/commonjs/modules/next/bluetooth/index.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/shared.js +14 -0
- package/lib/commonjs/modules/next/bluetooth/shared.js.map +1 -1
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js +2 -0
- package/lib/commonjs/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/android-foreground-service.js +59 -6
- package/lib/module/modules/next/bluetooth/adapters/android-foreground-service.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/ble-plx-central.js +45 -24
- package/lib/module/modules/next/bluetooth/adapters/ble-plx-central.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/ecg-measurements.js +22 -0
- package/lib/module/modules/next/bluetooth/adapters/ecg-measurements.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/live-supersession.js +59 -0
- package/lib/module/modules/next/bluetooth/adapters/live-supersession.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js +38 -0
- package/lib/module/modules/next/bluetooth/adapters/ovok-outbox-watch.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js +76 -75
- package/lib/module/modules/next/bluetooth/adapters/ovok-reading-sink.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/reading-source-id.js +27 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-source-id.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-values.js +33 -0
- package/lib/module/modules/next/bluetooth/adapters/reading-values.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js +94 -0
- package/lib/module/modules/next/bluetooth/adapters/series-saving.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-database.js +20 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-database.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-rows.js +59 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-rows.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-schema.js +49 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-schema.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-store.js +79 -0
- package/lib/module/modules/next/bluetooth/adapters/sqlite-outbox-store.js.map +1 -0
- package/lib/module/modules/next/bluetooth/adapters/storage-paired-devices.js +1 -0
- package/lib/module/modules/next/bluetooth/adapters/storage-paired-devices.js.map +1 -1
- package/lib/module/modules/next/bluetooth/adapters/web-bluetooth-central.js +9 -1
- package/lib/module/modules/next/bluetooth/adapters/web-bluetooth-central.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/bluetooth.js +9 -3
- package/lib/module/modules/next/bluetooth/core/bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/device-deps.js +4 -0
- package/lib/module/modules/next/bluetooth/core/device-deps.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/device-link.js +2 -1
- package/lib/module/modules/next/bluetooth/core/device-link.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/device-snapshot.js +3 -1
- package/lib/module/modules/next/bluetooth/core/device-snapshot.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/device.js +19 -6
- package/lib/module/modules/next/bluetooth/core/device.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/live-ledger.js +50 -0
- package/lib/module/modules/next/bluetooth/core/live-ledger.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/measuring-watch.js +41 -0
- package/lib/module/modules/next/bluetooth/core/measuring-watch.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/outbox-watch.js +14 -0
- package/lib/module/modules/next/bluetooth/core/outbox-watch.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/paired-device.js +1 -0
- package/lib/module/modules/next/bluetooth/core/paired-device.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/ports.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/reading-log.js +89 -7
- package/lib/module/modules/next/bluetooth/core/reading-log.js.map +1 -1
- package/lib/module/modules/next/bluetooth/core/series-slots.js +90 -0
- package/lib/module/modules/next/bluetooth/core/series-slots.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/stream-recorder.js +215 -0
- package/lib/module/modules/next/bluetooth/core/stream-recorder.js.map +1 -0
- package/lib/module/modules/next/bluetooth/core/waveform-segments.js +106 -0
- package/lib/module/modules/next/bluetooth/core/waveform-segments.js.map +1 -0
- package/lib/module/modules/next/bluetooth/create-bluetooth.js +19 -11
- package/lib/module/modules/next/bluetooth/create-bluetooth.js.map +1 -1
- package/lib/module/modules/next/bluetooth/index.js +1 -0
- package/lib/module/modules/next/bluetooth/index.js.map +1 -1
- package/lib/module/modules/next/bluetooth/shared.js +2 -0
- package/lib/module/modules/next/bluetooth/shared.js.map +1 -1
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js +2 -0
- package/lib/module/modules/next/bluetooth/web/create-web-bluetooth.js.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts +17 -4
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ble-plx-central.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +9 -3
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-source-id.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-source-id.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-values.d.ts +9 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts +28 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-database.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-database.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts +29 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts +6 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts +38 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/storage-paired-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth-options.d.ts +3 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth-options.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/bluetooth.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-deps.d.ts +16 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-deps.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts +5 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts +6 -13
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-ledger.d.ts +13 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/live-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/measuring-watch.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/measuring-watch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/outbox-watch.d.ts +27 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/outbox-watch.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/paired-device.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/paired-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/ports.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/ports.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading-log.d.ts +25 -6
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading-log.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts +16 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/series-slots.d.ts +35 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/series-slots.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/stream-recorder.d.ts +58 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/stream-recorder.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/waveform-segments.d.ts +26 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/core/waveform-segments.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts +4 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts +5 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/shared.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts +17 -4
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/android-foreground-service.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ble-plx-central.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ecg-measurements.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/live-supersession.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts +8 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-outbox-watch.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts +9 -3
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/ovok-reading-sink.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-source-id.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-source-id.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-values.d.ts +9 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/reading-values.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts +28 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/series-saving.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-database.d.ts +23 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-database.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts +29 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-rows.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts +6 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-schema.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts +38 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/sqlite-outbox-store.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/storage-paired-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts +4 -0
- package/lib/typescript/module/src/modules/next/bluetooth/adapters/web-bluetooth-central.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth-options.d.ts +3 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth-options.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-deps.d.ts +16 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-deps.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts +5 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/device-snapshot.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts +6 -13
- package/lib/typescript/module/src/modules/next/bluetooth/core/device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/live-ledger.d.ts +13 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/live-ledger.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/measuring-watch.d.ts +17 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/measuring-watch.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/outbox-watch.d.ts +27 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/outbox-watch.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/paired-device.d.ts +3 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/paired-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/ports.d.ts +3 -2
- package/lib/typescript/module/src/modules/next/bluetooth/core/ports.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading-log.d.ts +25 -6
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading-log.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts +16 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/reading.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/core/series-slots.d.ts +35 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/series-slots.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/stream-recorder.d.ts +58 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/stream-recorder.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/waveform-segments.d.ts +26 -0
- package/lib/typescript/module/src/modules/next/bluetooth/core/waveform-segments.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts +3 -2
- package/lib/typescript/module/src/modules/next/bluetooth/create-bluetooth.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts +4 -1
- package/lib/typescript/module/src/modules/next/bluetooth/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts +5 -1
- package/lib/typescript/module/src/modules/next/bluetooth/shared.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts +3 -2
- package/lib/typescript/module/src/modules/next/bluetooth/web/create-web-bluetooth.d.ts.map +1 -1
- package/package.json +7 -3
|
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.androidForegroundService = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
+
var _outboxWatch = require("../core/outbox-watch.js");
|
|
8
9
|
var _ports = require("../core/ports.js");
|
|
9
10
|
/** The notification Android shows while the service runs. */
|
|
10
11
|
|
|
12
|
+
/** What the service watches and reports besides its text. */
|
|
13
|
+
|
|
11
14
|
const nativeService = () => {
|
|
12
15
|
const service = _reactNative.NativeModules.OvokBackgroundSync;
|
|
13
16
|
if (!service) {
|
|
@@ -15,11 +18,61 @@ const nativeService = () => {
|
|
|
15
18
|
}
|
|
16
19
|
return service;
|
|
17
20
|
};
|
|
21
|
+
const describeUnsent = unsent => `${unsent} ${unsent === 1 ? "reading" : "readings"} waiting to upload`;
|
|
22
|
+
|
|
23
|
+
/** The text for the native module: the function is dropped, and the body names the unsent count while there is one. */
|
|
24
|
+
const textFor = ({
|
|
25
|
+
unsentBody = describeUnsent,
|
|
26
|
+
...text
|
|
27
|
+
}, unsent) => unsent > 0 ? {
|
|
28
|
+
...text,
|
|
29
|
+
notificationBody: unsentBody(unsent)
|
|
30
|
+
} : text;
|
|
31
|
+
|
|
32
|
+
/** Android re-posts the same notification when the service is started again, which is how the text changes. */
|
|
33
|
+
class AndroidForegroundService {
|
|
34
|
+
stopWatching = null;
|
|
35
|
+
shownUnsent = 0;
|
|
36
|
+
constructor(text, outbox, logger) {
|
|
37
|
+
this.text = text;
|
|
38
|
+
this.outbox = outbox;
|
|
39
|
+
this.logger = logger;
|
|
40
|
+
}
|
|
41
|
+
start = async () => {
|
|
42
|
+
this.stopWatching?.();
|
|
43
|
+
this.shownUnsent = 0;
|
|
44
|
+
|
|
45
|
+
// Watch before the first await, so a stop that follows at once also ends the watching.
|
|
46
|
+
this.stopWatching = this.outbox.subscribe(({
|
|
47
|
+
waiting
|
|
48
|
+
}) => this.showCount(waiting.size));
|
|
49
|
+
await this.show();
|
|
50
|
+
};
|
|
51
|
+
stop = async () => {
|
|
52
|
+
this.stopWatching?.();
|
|
53
|
+
this.stopWatching = null;
|
|
54
|
+
await nativeService().stopBluetoothForegroundService();
|
|
55
|
+
};
|
|
56
|
+
showCount(unsent) {
|
|
57
|
+
if (unsent !== this.shownUnsent) {
|
|
58
|
+
this.shownUnsent = unsent;
|
|
59
|
+
this.show().catch(() => this.logger.error("bluetooth.keep-alive.notification-failed", {
|
|
60
|
+
unsent
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
show() {
|
|
65
|
+
return nativeService().startBluetoothForegroundService(textFor(this.text, this.shownUnsent));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
18
68
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
69
|
+
/**
|
|
70
|
+
* Android's connected-device foreground service, which keeps the process alive for background sync; nothing elsewhere.
|
|
71
|
+
* With an `outbox`, its notification says how many readings wait to upload.
|
|
72
|
+
*/
|
|
73
|
+
const androidForegroundService = (text = {}, {
|
|
74
|
+
outbox = _outboxWatch.noOutboxWatch,
|
|
75
|
+
logger = _ports.silentLogger
|
|
76
|
+
} = {}) => _reactNative.Platform.OS === "android" ? new AndroidForegroundService(text, outbox, logger) : _ports.noKeepAlive;
|
|
24
77
|
exports.androidForegroundService = androidForegroundService;
|
|
25
78
|
//# sourceMappingURL=android-foreground-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_ports","nativeService","service","NativeModules","OvokBackgroundSync","Error","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_outboxWatch","_ports","nativeService","service","NativeModules","OvokBackgroundSync","Error","describeUnsent","unsent","textFor","unsentBody","text","notificationBody","AndroidForegroundService","stopWatching","shownUnsent","constructor","outbox","logger","start","subscribe","waiting","showCount","size","show","stop","stopBluetoothForegroundService","catch","error","startBluetoothForegroundService","androidForegroundService","noOutboxWatch","silentLogger","Platform","OS","noKeepAlive","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next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,MAAM,IAAI,CAACC,IAAI,CAAC,CAAC;EACnB,CAAC;EAEMC,IAAI,GAAG,MAAAA,CAAA,KAA2B;IACvC,IAAI,CAACX,YAAY,GAAG,CAAC;IACrB,IAAI,CAACA,YAAY,GAAG,IAAI;IACxB,MAAMZ,aAAa,CAAC,CAAC,CAACwB,8BAA8B,CAAC,CAAC;EACxD,CAAC;EAEOJ,SAASA,CAACd,MAAc,EAAQ;IACtC,IAAIA,MAAM,KAAK,IAAI,CAACO,WAAW,EAAE;MAC/B,IAAI,CAACA,WAAW,GAAGP,MAAM;MACzB,IAAI,CAACgB,IAAI,CAAC,CAAC,CAACG,KAAK,CAAC,MAAM,IAAI,CAACT,MAAM,CAACU,KAAK,CAAC,0CAA0C,EAAE;QAAEpB;MAAO,CAAC,CAAC,CAAC;IACpG;EACF;EAEQgB,IAAIA,CAAA,EAAkB;IAC5B,OAAOtB,aAAa,CAAC,CAAC,CAAC2B,+BAA+B,CAACpB,OAAO,CAAC,IAAI,CAACE,IAAI,EAAE,IAAI,CAACI,WAAW,CAAC,CAAC;EAC9F;AACF;;AAEA;AACA;AACA;AACA;AACA,MAAMe,wBAAwB,GAAGA,CAC/BnB,IAA2B,GAAG,CAAC,CAAC,EAChC;EAAEM,MAAM,GAAGc,0BAAa;EAAEb,MAAM,GAAGc;AAAuC,CAAC,GAAG,CAAC,CAAC,KACjEC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GAAG,IAAIrB,wBAAwB,CAACF,IAAI,EAAEM,MAAM,EAAEC,MAAM,CAAC,GAAGiB,kBAAY;AAACC,OAAA,CAAAN,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
|
@@ -37,30 +37,51 @@ const advertisementOf = device => ({
|
|
|
37
37
|
serviceData: new Map(Object.entries(device.serviceData ?? {}).map(([uuid, data]) => [(0, _advertisement.fullUuid)(uuid), (0, _base.fromBase64)(data)])),
|
|
38
38
|
rssi: device.rssi ?? null
|
|
39
39
|
});
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
40
|
+
|
|
41
|
+
/** Whether a discovered characteristic refuses a write with response but takes one without, as the vendor apps check. */
|
|
42
|
+
const takesOnlyWritesWithoutResponse = async (device, service, characteristic) => {
|
|
43
|
+
const found = (await device.characteristicsForService(service)).find(({
|
|
44
|
+
uuid
|
|
45
|
+
}) => lower(uuid) === characteristic);
|
|
46
|
+
return found !== undefined && !found.isWritableWithResponse && found.isWritableWithoutResponse;
|
|
47
|
+
};
|
|
48
|
+
const gattLinkOf = (manager, device) => {
|
|
49
|
+
const writeTypes = new Map();
|
|
50
|
+
|
|
51
|
+
/** Looks a characteristic's write type up once per link. */
|
|
52
|
+
const writesWithoutResponse = (service, characteristic) => {
|
|
53
|
+
const key = `${service}/${characteristic}`;
|
|
54
|
+
const known = writeTypes.get(key) ?? takesOnlyWritesWithoutResponse(device, service, characteristic);
|
|
55
|
+
writeTypes.set(key, known);
|
|
56
|
+
return known;
|
|
57
|
+
};
|
|
58
|
+
return {
|
|
59
|
+
read: async (service, characteristic) => (0, _base.fromBase64)((await device.readCharacteristicForService(lower(service), lower(characteristic))).value ?? ""),
|
|
60
|
+
write: async (service, characteristic, bytes) => {
|
|
61
|
+
const [serviceUuid, characteristicUuid] = [lower(service), lower(characteristic)];
|
|
62
|
+
const value = (0, _base.toBase64)(bytes);
|
|
63
|
+
await ((await writesWithoutResponse(serviceUuid, characteristicUuid)) ? device.writeCharacteristicWithoutResponseForService(serviceUuid, characteristicUuid, value) : device.writeCharacteristicWithResponseForService(serviceUuid, characteristicUuid, value));
|
|
64
|
+
},
|
|
65
|
+
writeWithoutResponse: async (service, characteristic, bytes) => {
|
|
66
|
+
await device.writeCharacteristicWithoutResponseForService(lower(service), lower(characteristic), (0, _base.toBase64)(bytes));
|
|
67
|
+
},
|
|
68
|
+
subscribe: async (service, characteristic, onValue) => {
|
|
69
|
+
const subscription = device.monitorCharacteristicForService(lower(service), lower(characteristic), (error, value) => {
|
|
70
|
+
if (!error && value?.value) {
|
|
71
|
+
onValue((0, _base.fromBase64)(value.value));
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return () => subscription.remove();
|
|
75
|
+
},
|
|
76
|
+
onDisconnect: listener => {
|
|
77
|
+
const subscription = manager.onDeviceDisconnected(device.id, () => listener());
|
|
78
|
+
return () => subscription.remove();
|
|
79
|
+
},
|
|
80
|
+
close: async () => {
|
|
81
|
+
await manager.cancelDeviceConnection(device.id).catch(() => undefined);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
};
|
|
64
85
|
|
|
65
86
|
/** The device's Bluetooth LE radio through `react-native-ble-plx`. */
|
|
66
87
|
const blePlxCentral = manager => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNativeBlePlx","require","_base","_bytes","_advertisement","_errors","STATES","State","Unknown","Resetting","Unsupported","Unauthorized","PoweredOff","PoweredOn","ERROR_CODES","BleErrorCode","BluetoothPoweredOff","BluetoothUnauthorized","BluetoothUnsupported","deviceErrorOf","error","DeviceError","errorCode","message","lower","uuid","toLowerCase","manufacturerDataOf","base64","bytes","fromBase64","Uint8Array","length","Map","u16le","subarray","advertisementOf","device","transport","address","id","name","localName","services","serviceUUIDs","map","fullUuid","manufacturerData","serviceData","Object","entries","data","rssi","gattLinkOf","manager","
|
|
1
|
+
{"version":3,"names":["_reactNativeBlePlx","require","_base","_bytes","_advertisement","_errors","STATES","State","Unknown","Resetting","Unsupported","Unauthorized","PoweredOff","PoweredOn","ERROR_CODES","BleErrorCode","BluetoothPoweredOff","BluetoothUnauthorized","BluetoothUnsupported","deviceErrorOf","error","DeviceError","errorCode","message","lower","uuid","toLowerCase","manufacturerDataOf","base64","bytes","fromBase64","Uint8Array","length","Map","u16le","subarray","advertisementOf","device","transport","address","id","name","localName","services","serviceUUIDs","map","fullUuid","manufacturerData","serviceData","Object","entries","data","rssi","takesOnlyWritesWithoutResponse","service","characteristic","found","characteristicsForService","find","undefined","isWritableWithResponse","isWritableWithoutResponse","gattLinkOf","manager","writeTypes","writesWithoutResponse","key","known","get","set","read","readCharacteristicForService","value","write","serviceUuid","characteristicUuid","toBase64","writeCharacteristicWithoutResponseForService","writeCharacteristicWithResponseForService","writeWithoutResponse","subscribe","onValue","subscription","monitorCharacteristicForService","remove","onDisconnect","listener","onDeviceDisconnected","close","cancelDeviceConnection","catch","blePlxCentral","watchState","onStateChange","state","scan","filter","onAdvertisement","onError","startDeviceScan","allowDuplicates","stopDeviceScan","connect","connectToDevice","Promise","reject","discoverAllServicesAndCharacteristics","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ble-plx-central.ts"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAGA,MAAMK,MAAmC,GAAG;EAC1C,CAACC,wBAAK,CAACC,OAAO,GAAG,SAAS;EAC1B,CAACD,wBAAK,CAACE,SAAS,GAAG,SAAS;EAC5B,CAACF,wBAAK,CAACG,WAAW,GAAG,aAAa;EAClC,CAACH,wBAAK,CAACI,YAAY,GAAG,cAAc;EACpC,CAACJ,wBAAK,CAACK,UAAU,GAAG,KAAK;EACzB,CAACL,wBAAK,CAACM,SAAS,GAAG;AACrB,CAAC;AAED,MAAMC,WAA2D,GAAG;EAClE,CAACC,+BAAY,CAACC,mBAAmB,GAAG,aAAa;EACjD,CAACD,+BAAY,CAACE,qBAAqB,GAAG,YAAY;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K,CAAEtE,KAAe,IAAKoF,OAAO,CAACC,MAAM,CAACtF,aAAa,CAACC,KAAK,CAAC,CAAC,CAAC;IAEtH,MAAMiB,MAAM,CAACqE,qCAAqC,CAAC,CAAC;IAEpD,OAAO5C,UAAU,CAACC,OAAO,EAAE1B,MAAM,CAAC;EACpC;AACF,CAAC,CAAC;AAACsE,OAAA,CAAAhB,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ecgMeasurements = void 0;
|
|
7
|
+
var _next = require("@ovok/core/next");
|
|
8
|
+
var _readingValues = require("./reading-values.js");
|
|
9
|
+
/** Ovok stores ECG points in millivolts; a trace in any other unit is left out rather than mislabelled. */
|
|
10
|
+
const ECG_POINT_UNIT = "mV";
|
|
11
|
+
|
|
12
|
+
/** One ECG recording per channel, each in millivolts at the waveform's sample rate; the heart rate goes with the first. */
|
|
13
|
+
const ecgMeasurements = reading => {
|
|
14
|
+
const waveform = reading.waveform?.unit === ECG_POINT_UNIT ? reading.waveform : undefined;
|
|
15
|
+
const channels = waveform?.samples ?? [new Int16Array(0)];
|
|
16
|
+
return channels.map((samples, index) => ({
|
|
17
|
+
measurementTypeKey: _next.MeasurementTypeKey.ecg,
|
|
18
|
+
heartRate: index === 0 ? (0, _readingValues.valueOf)(reading, "heart_rate") : undefined,
|
|
19
|
+
diagramPoints: Array.from(samples, sample => sample * (waveform?.scale ?? 1)),
|
|
20
|
+
duration: waveform ? samples.length / waveform.sampleRateHz : undefined,
|
|
21
|
+
recordedAt: reading.takenAt ?? undefined
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
exports.ecgMeasurements = ecgMeasurements;
|
|
25
|
+
//# sourceMappingURL=ecg-measurements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_next","require","_readingValues","ECG_POINT_UNIT","ecgMeasurements","reading","waveform","unit","undefined","channels","samples","Int16Array","map","index","measurementTypeKey","MeasurementTypeKey","ecg","heartRate","valueOf","diagramPoints","Array","from","sample","scale","duration","length","sampleRateHz","recordedAt","takenAt","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ecg-measurements.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAIA,IAAAC,cAAA,GAAAD,OAAA;AAEA;AACA,MAAME,cAAc,GAAG,IAAI;;AAE3B;AACA,MAAMC,eAAe,GAAIC,OAAgB,IAAuB;EAC9D,MAAMC,QAAQ,GAAGD,OAAO,CAACC,QAAQ,EAAEC,IAAI,KAAKJ,cAAc,GAAGE,OAAO,CAACC,QAAQ,GAAGE,SAAS;EACzF,MAAMC,QAAQ,GAAGH,QAAQ,EAAEI,OAAO,IAAI,CAAC,IAAIC,UAAU,CAAC,CAAC,CAAC,CAAC;EAEzD,OAAOF,QAAQ,CAACG,GAAG,CAAC,CAACF,OAAO,EAAEG,KAAK,MAAM;IACvCC,kBAAkB,EAAEC,wBAAkB,CAACC,GAAG;IAC1CC,SAAS,EAAEJ,KAAK,KAAK,CAAC,GAAG,IAAAK,sBAAO,EAACb,OAAO,EAAE,YAAY,CAAC,GAAGG,SAAS;IACnEW,aAAa,EAAEC,KAAK,CAACC,IAAI,CAACX,OAAO,EAAGY,MAAM,IAAKA,MAAM,IAAIhB,QAAQ,EAAEiB,KAAK,IAAI,CAAC,CAAC,CAAC;IAC/EC,QAAQ,EAAElB,QAAQ,GAAGI,OAAO,CAACe,MAAM,GAAGnB,QAAQ,CAACoB,YAAY,GAAGlB,SAAS;IACvEmB,UAAU,EAAEtB,OAAO,CAACuB,OAAO,IAAIpB;EACjC,CAAC,CAAC,CAAC;AACL,CAAC;AAACqB,OAAA,CAAAzB,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.replaceLiveRecordings = void 0;
|
|
7
|
+
var _next = require("@ovok/core/next");
|
|
8
|
+
var _readingSourceId = require("./reading-source-id.js");
|
|
9
|
+
var _seriesSaving = require("./series-saving.js");
|
|
10
|
+
/** What queues the deletions: the outbox, with the measurements API and the session that name what to delete. */
|
|
11
|
+
|
|
12
|
+
const LIVE_SLOT_MS = 1_000;
|
|
13
|
+
|
|
14
|
+
/** The observations a live recording was saved as, rebuilt from its span alone; a single stand-in value gives each its identifiers. */
|
|
15
|
+
const observationsOfSpan = async (client, address, span) => {
|
|
16
|
+
const patientId = await (0, _seriesSaving.signedInPatientId)(client);
|
|
17
|
+
const sourceId = (0, _readingSourceId.liveSourceId)(address, span);
|
|
18
|
+
if (span.channel === null) {
|
|
19
|
+
const field = (0, _seriesSaving.seriesFieldOf)(span.metric);
|
|
20
|
+
return field ? (0, _seriesSaving.seriesObservationsOf)(field, {
|
|
21
|
+
start: span.from,
|
|
22
|
+
intervalMs: LIVE_SLOT_MS,
|
|
23
|
+
values: [0]
|
|
24
|
+
}, {
|
|
25
|
+
patientId,
|
|
26
|
+
sourceId
|
|
27
|
+
}) : [];
|
|
28
|
+
}
|
|
29
|
+
const measurement = {
|
|
30
|
+
measurementTypeKey: _next.MeasurementTypeKey.ecg,
|
|
31
|
+
diagramPoints: [0],
|
|
32
|
+
duration: 1,
|
|
33
|
+
recordedAt: span.from
|
|
34
|
+
};
|
|
35
|
+
return client.measurements.build({
|
|
36
|
+
measurement,
|
|
37
|
+
sourceId,
|
|
38
|
+
patientId
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** The identifiers that name an observation for good; a segment's own depends on its sample count, which a span does not carry. */
|
|
43
|
+
const deleteTargetsOf = observations => observations.flatMap(({
|
|
44
|
+
identifier = []
|
|
45
|
+
}) => identifier.flatMap(({
|
|
46
|
+
system,
|
|
47
|
+
value
|
|
48
|
+
}) => system && value && system !== _next.SEGMENT_IDENTIFIER_SYSTEM ? [{
|
|
49
|
+
system,
|
|
50
|
+
value
|
|
51
|
+
}] : []));
|
|
52
|
+
|
|
53
|
+
/** Queues the deletion of the live recordings a stored record replaces, so the outbox holds them before it holds the record. */
|
|
54
|
+
const replaceLiveRecordings = async (client, reading) => {
|
|
55
|
+
for (const span of reading.supersedes ?? []) {
|
|
56
|
+
for (const target of deleteTargetsOf(await observationsOfSpan(client, reading.source.address, span))) {
|
|
57
|
+
await client.outbox.enqueueDelete(target);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.replaceLiveRecordings = replaceLiveRecordings;
|
|
62
|
+
//# sourceMappingURL=live-supersession.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_next","require","_readingSourceId","_seriesSaving","LIVE_SLOT_MS","observationsOfSpan","client","address","span","patientId","signedInPatientId","sourceId","liveSourceId","channel","field","seriesFieldOf","metric","seriesObservationsOf","start","from","intervalMs","values","measurement","measurementTypeKey","MeasurementTypeKey","ecg","diagramPoints","duration","recordedAt","measurements","build","deleteTargetsOf","observations","flatMap","identifier","system","value","SEGMENT_IDENTIFIER_SYSTEM","replaceLiveRecordings","reading","supersedes","target","source","outbox","enqueueDelete","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/live-supersession.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEA;;AAGA,MAAMG,YAAY,GAAG,KAAK;;AAE1B;AACA,MAAMC,kBAAkB,GAAG,MAAAA,CAAOC,MAA0B,EAAEC,OAAe,EAAEC,IAAc,KAA6B;EACxH,MAAMC,SAAS,GAAG,MAAM,IAAAC,+BAAiB,EAACJ,MAAM,CAAC;EACjD,MAAMK,QAAQ,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,EAAEiC,OAAO,CAACG,MAAM,CAACnC,OAAO,EAAEC,IAAI,CAAC,CAAC,EAAE;MACpG,MAAMF,MAAM,CAACqC,MAAM,CAACC,aAAa,CAACH,MAAM,CAAC;IAC3C;EACF;AACF,CAAC;AAACI,OAAA,CAAAP,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ovokOutboxWatch = void 0;
|
|
7
|
+
var _ports = require("../core/ports.js");
|
|
8
|
+
const idsOf = items => new Set(items.map(({
|
|
9
|
+
id
|
|
10
|
+
}) => id));
|
|
11
|
+
const itemsIn = (items, state) => idsOf(items.filter(item => item.state === state));
|
|
12
|
+
const viewOf = (items, sent) => ({
|
|
13
|
+
waiting: itemsIn(items, "pending"),
|
|
14
|
+
rejected: itemsIn(items, "rejected"),
|
|
15
|
+
sent: idsOf(sent)
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/** Watches the signed-in account's Ovok outbox, so the reading log and the notification follow what it sends. */
|
|
19
|
+
const ovokOutboxWatch = (outbox, logger = _ports.silentLogger) => ({
|
|
20
|
+
subscribe: listener => {
|
|
21
|
+
let requests = 0;
|
|
22
|
+
let watching = true;
|
|
23
|
+
|
|
24
|
+
// The outbox's snapshot only says something changed; the items say what.
|
|
25
|
+
const stop = outbox.subscribe(() => {
|
|
26
|
+
const request = ++requests;
|
|
27
|
+
void outbox.items().then(items => {
|
|
28
|
+
if (watching && request === requests) {
|
|
29
|
+
listener(viewOf(items, outbox.recentlySent()));
|
|
30
|
+
}
|
|
31
|
+
}, error => logger.error("bluetooth.outbox-watch.failed", {
|
|
32
|
+
error: error.name
|
|
33
|
+
}));
|
|
34
|
+
});
|
|
35
|
+
return () => {
|
|
36
|
+
watching = false;
|
|
37
|
+
stop();
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
exports.ovokOutboxWatch = ovokOutboxWatch;
|
|
42
|
+
//# sourceMappingURL=ovok-outbox-watch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_ports","require","idsOf","items","Set","map","id","itemsIn","state","filter","item","viewOf","sent","waiting","rejected","ovokOutboxWatch","outbox","logger","silentLogger","subscribe","listener","requests","watching","stop","request","then","recentlySent","error","name","exports"],"sourceRoot":"../../../../../../src","sources":["modules/next/bluetooth/adapters/ovok-outbox-watch.ts"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAIA,MAAMC,KAAK,GAAIC,KAAoC,IAAkB,IAAIC,GAAG,CAACD,KAAK,CAACE,GAAG,CAAC,CAAC;EAAEC;AAAG,CAAC,KAAKA,EAAE,CAAC,CAAC;AAEvG,MAAMC,OAAO,GAAGA,CAACJ,KAA0B,EAAEK,KAAkB,KAC7DN,KAAK,CAACC,KAAK,CAACM,MAAM,CAAEC,IAAI,IAAKA,IAAI,CAACF,KAAK,KAAKA,KAAK,CAAC,CAAC;AAErD,MAAMG,MAAM,GAAGA,CAACR,KAA0B,EAAES,IAAsB,MAAkB;EAClFC,OAAO,EAAEN,OAAO,CAACJ,KAAK,EAAE,SAAS,CAAC;EAClCW,QAAQ,EAAEP,OAAO,CAACJ,KAAK,EAAE,UAAU,CAAC;EACpCS,IAAI,EAAEV,KAAK,CAACU,IAAI;AAClB,CAAC,CAAC;;AAEF;AACA,MAAMG,eAAe,GAAGA,CAACC,MAAqB,EAAEC,MAAc,GAAGC,mBAAY,MAAmB;EAC9FC,SAAS,EAAGC,QAAQ,IAAK;IACvB,IAAIC,QAAQ,GAAG,CAAC;IAChB,IAAIC,QAAQ,GAAG,IAAI;;IAEnB;IACA,MAAMC,IAAI,GAAGP,MAAM,CAACG,SAAS,CAAC,MAAM;MAClC,MAAMK,OAAO,GAAG,EAAEH,QAAQ;MAE1B,KAAKL,MAAM,CAACb,KAAK,CAAC,CAAC,CAACsB,IAAI,CACrBtB,KAAK,IAAK;QACT,IAAImB,QAAQ,IAAIE,OAAO,KAAKH,QAAQ,EAAE;UACpCD,QAAQ,CAACT,MAAM,CAACR,KAAK,EAAEa,MAAM,CAACU,YAAY,CAAC,CAAC,CAAC,CAAC;QAChD;MACF,CAAC,EACAC,KAAc,IAAKV,MAAM,CAACU,KAAK,CAAC,+BAA+B,EAAE;QAAEA,KAAK,EAAGA,KAAK,CAAWC;MAAK,CAAC,CACpG,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,MAAM;MACXN,QAAQ,GAAG,KAAK;MAChBC,IAAI,CAAC,CAAC;IACR,CAAC;EACH;AACF,CAAC,CAAC;AAACM,OAAA,CAAAd,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -6,48 +6,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ovokReadingSink = void 0;
|
|
7
7
|
var _next = require("@ovok/core/next");
|
|
8
8
|
var _errors = require("../core/errors.js");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** A device's UCUM unit to the unit Ovok stores the value in: mg/dL, kg, °C, mmHg, L, L/s or %. */
|
|
16
|
-
const TO_OVOK_UNIT = {
|
|
17
|
-
"mg/dL": value => value,
|
|
18
|
-
"mmol/L": value => value * MG_PER_DL_PER_MMOL_PER_L,
|
|
19
|
-
kg: value => value,
|
|
20
|
-
"[lb_av]": value => value * KG_PER_POUND,
|
|
21
|
-
"[stone_av]": value => value * KG_PER_STONE,
|
|
22
|
-
Cel: value => value,
|
|
23
|
-
"[degF]": value => (value - FAHRENHEIT_ZERO_IN_CELSIUS_STEPS) * 5 / 9,
|
|
24
|
-
"mm[Hg]": value => value,
|
|
25
|
-
kPa: value => value * MMHG_PER_KPA,
|
|
26
|
-
L: value => value,
|
|
27
|
-
"L/s": value => value,
|
|
28
|
-
"%": value => value
|
|
29
|
-
};
|
|
30
|
-
const valueOf = (reading, metric) => reading.values[metric]?.value;
|
|
31
|
-
|
|
32
|
-
/** The value in Ovok's unit; `undefined` when the reading lacks it or uses a unit Ovok has no conversion for. */
|
|
33
|
-
const ovokValueOf = (reading, metric) => {
|
|
34
|
-
const quantity = reading.values[metric];
|
|
35
|
-
return quantity && TO_OVOK_UNIT[quantity.unit]?.(quantity.value);
|
|
36
|
-
};
|
|
9
|
+
var _ecgMeasurements = require("./ecg-measurements.js");
|
|
10
|
+
var _liveSupersession = require("./live-supersession.js");
|
|
11
|
+
var _readingSourceId = require("./reading-source-id.js");
|
|
12
|
+
var _readingValues = require("./reading-values.js");
|
|
13
|
+
var _seriesSaving = require("./series-saving.js");
|
|
37
14
|
const flagSet = (reading, code) => reading.deviceFlags.some(flag => flag.code === code && flag.raw !== 0) ? true : undefined;
|
|
38
15
|
const bloodPressure = reading => ({
|
|
39
16
|
measurementTypeKey: _next.MeasurementTypeKey.bloodPressure,
|
|
40
|
-
systolic: ovokValueOf(reading, "systolic"),
|
|
41
|
-
diastolic: ovokValueOf(reading, "diastolic"),
|
|
42
|
-
meanArterialPressure: ovokValueOf(reading, "mean_arterial_pressure"),
|
|
43
|
-
heartRate: valueOf(reading, "pulse_rate"),
|
|
17
|
+
systolic: (0, _readingValues.ovokValueOf)(reading, "systolic"),
|
|
18
|
+
diastolic: (0, _readingValues.ovokValueOf)(reading, "diastolic"),
|
|
19
|
+
meanArterialPressure: (0, _readingValues.ovokValueOf)(reading, "mean_arterial_pressure"),
|
|
20
|
+
heartRate: (0, _readingValues.valueOf)(reading, "pulse_rate"),
|
|
44
21
|
irregularHeartbeat: flagSet(reading, "irregular_pulse"),
|
|
45
22
|
recordedAt: reading.takenAt ?? undefined
|
|
46
23
|
});
|
|
47
24
|
|
|
48
25
|
/** A reading without its main value, or with it in an unconvertible unit, cannot be saved. */
|
|
49
26
|
const bloodGlucose = reading => {
|
|
50
|
-
const bloodGlucoseValue = ovokValueOf(reading, "blood_glucose");
|
|
27
|
+
const bloodGlucoseValue = (0, _readingValues.ovokValueOf)(reading, "blood_glucose");
|
|
51
28
|
return bloodGlucoseValue === undefined ? undefined : {
|
|
52
29
|
measurementTypeKey: _next.MeasurementTypeKey.bloodGlucose,
|
|
53
30
|
bloodGlucose: bloodGlucoseValue,
|
|
@@ -55,7 +32,7 @@ const bloodGlucose = reading => {
|
|
|
55
32
|
};
|
|
56
33
|
};
|
|
57
34
|
const bodyWeight = reading => {
|
|
58
|
-
const weight = ovokValueOf(reading, "body_weight");
|
|
35
|
+
const weight = (0, _readingValues.ovokValueOf)(reading, "body_weight");
|
|
59
36
|
return weight === undefined ? undefined : {
|
|
60
37
|
measurementTypeKey: _next.MeasurementTypeKey.bodyWeight,
|
|
61
38
|
bodyWeight: weight,
|
|
@@ -63,7 +40,7 @@ const bodyWeight = reading => {
|
|
|
63
40
|
};
|
|
64
41
|
};
|
|
65
42
|
const bodyTemperature = reading => {
|
|
66
|
-
const temperature = ovokValueOf(reading, "body_temperature");
|
|
43
|
+
const temperature = (0, _readingValues.ovokValueOf)(reading, "body_temperature");
|
|
67
44
|
return temperature === undefined ? undefined : {
|
|
68
45
|
measurementTypeKey: _next.MeasurementTypeKey.temperature,
|
|
69
46
|
bodyTemp: temperature,
|
|
@@ -72,37 +49,21 @@ const bodyTemperature = reading => {
|
|
|
72
49
|
};
|
|
73
50
|
const pulseOximetry = reading => ({
|
|
74
51
|
measurementTypeKey: _next.MeasurementTypeKey.bloodOxygenPulseRate,
|
|
75
|
-
bloodOxygen: valueOf(reading, "spo2"),
|
|
76
|
-
pulseRate: valueOf(reading, "pulse_rate"),
|
|
77
|
-
perfusionIndex: valueOf(reading, "perfusion_index"),
|
|
52
|
+
bloodOxygen: (0, _readingValues.valueOf)(reading, "spo2"),
|
|
53
|
+
pulseRate: (0, _readingValues.valueOf)(reading, "pulse_rate"),
|
|
54
|
+
perfusionIndex: (0, _readingValues.valueOf)(reading, "perfusion_index"),
|
|
78
55
|
recordedAt: reading.takenAt ?? undefined
|
|
79
56
|
});
|
|
80
|
-
|
|
81
|
-
/** Ovok stores ECG points in millivolts; a trace in any other unit is left out rather than mislabelled. */
|
|
82
|
-
const ECG_POINT_UNIT = "mV";
|
|
83
|
-
const ecg = reading => {
|
|
84
|
-
const waveform = reading.waveform?.unit === ECG_POINT_UNIT ? reading.waveform : undefined;
|
|
85
|
-
const samples = waveform?.samples[0] ?? new Int16Array(0);
|
|
86
|
-
return {
|
|
87
|
-
measurementTypeKey: _next.MeasurementTypeKey.ecg,
|
|
88
|
-
heartRate: valueOf(reading, "heart_rate"),
|
|
89
|
-
diagramPoints: Array.from(samples, sample => sample * (waveform?.scale ?? 1)),
|
|
90
|
-
duration: waveform ? samples.length / waveform.sampleRateHz : undefined,
|
|
91
|
-
recordedAt: reading.takenAt ?? undefined
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/** A per-second series, such as an ER1 trend, has no single-value measurement; it waits for series saving in core. */
|
|
96
|
-
const heartRate = reading => reading.series ? undefined : {
|
|
57
|
+
const heartRate = reading => ({
|
|
97
58
|
measurementTypeKey: _next.MeasurementTypeKey.heartRate,
|
|
98
|
-
heartRate: valueOf(reading, "heart_rate"),
|
|
59
|
+
heartRate: (0, _readingValues.valueOf)(reading, "heart_rate"),
|
|
99
60
|
recordedAt: reading.takenAt ?? undefined
|
|
100
|
-
};
|
|
101
|
-
const respiratoryRate = reading =>
|
|
61
|
+
});
|
|
62
|
+
const respiratoryRate = reading => ({
|
|
102
63
|
measurementTypeKey: _next.MeasurementTypeKey.respiratoryRate,
|
|
103
|
-
respiratoryRate: valueOf(reading, "respiration_rate"),
|
|
64
|
+
respiratoryRate: (0, _readingValues.valueOf)(reading, "respiration_rate"),
|
|
104
65
|
recordedAt: reading.takenAt ?? undefined
|
|
105
|
-
};
|
|
66
|
+
});
|
|
106
67
|
const LIPID_METRICS = ["blood_cholesterol", "hdl_cholesterol", "ldl_cholesterol", "triglycerides"];
|
|
107
68
|
const LIPID_UNITS = ["mg/dL", "mmol/L"];
|
|
108
69
|
const isLipidUnit = unit => LIPID_UNITS.some(lipidUnit => lipidUnit === unit);
|
|
@@ -113,10 +74,10 @@ const lipidPanel = reading => {
|
|
|
113
74
|
const [unit] = units;
|
|
114
75
|
return units.size === 1 && isLipidUnit(unit) ? {
|
|
115
76
|
measurementTypeKey: _next.MeasurementTypeKey.lipidPanel,
|
|
116
|
-
totalCholesterol: valueOf(reading, "blood_cholesterol"),
|
|
117
|
-
hdlCholesterol: valueOf(reading, "hdl_cholesterol"),
|
|
118
|
-
ldlCholesterol: valueOf(reading, "ldl_cholesterol"),
|
|
119
|
-
triglycerides: valueOf(reading, "triglycerides"),
|
|
77
|
+
totalCholesterol: (0, _readingValues.valueOf)(reading, "blood_cholesterol"),
|
|
78
|
+
hdlCholesterol: (0, _readingValues.valueOf)(reading, "hdl_cholesterol"),
|
|
79
|
+
ldlCholesterol: (0, _readingValues.valueOf)(reading, "ldl_cholesterol"),
|
|
80
|
+
triglycerides: (0, _readingValues.valueOf)(reading, "triglycerides"),
|
|
120
81
|
unit,
|
|
121
82
|
recordedAt: reading.takenAt ?? undefined
|
|
122
83
|
} : undefined;
|
|
@@ -125,11 +86,11 @@ const lipidPanel = reading => {
|
|
|
125
86
|
/** A spirometry test without any value in Ovok's units cannot be saved. */
|
|
126
87
|
const spirometry = reading => {
|
|
127
88
|
const values = {
|
|
128
|
-
fvc: ovokValueOf(reading, "fvc"),
|
|
129
|
-
fev1: ovokValueOf(reading, "fev1"),
|
|
130
|
-
"fev1/fvc": ovokValueOf(reading, "fev1_fvc_ratio"),
|
|
131
|
-
pef: ovokValueOf(reading, "pef"),
|
|
132
|
-
fef2575: ovokValueOf(reading, "fef25_75")
|
|
89
|
+
fvc: (0, _readingValues.ovokValueOf)(reading, "fvc"),
|
|
90
|
+
fev1: (0, _readingValues.ovokValueOf)(reading, "fev1"),
|
|
91
|
+
"fev1/fvc": (0, _readingValues.ovokValueOf)(reading, "fev1_fvc_ratio"),
|
|
92
|
+
pef: (0, _readingValues.ovokValueOf)(reading, "pef"),
|
|
93
|
+
fef2575: (0, _readingValues.ovokValueOf)(reading, "fef25_75")
|
|
133
94
|
};
|
|
134
95
|
return Object.values(values).some(value => value !== undefined) ? {
|
|
135
96
|
measurementTypeKey: _next.MeasurementTypeKey.spirometryPanel,
|
|
@@ -137,20 +98,24 @@ const spirometry = reading => {
|
|
|
137
98
|
recordedAt: reading.takenAt ?? undefined
|
|
138
99
|
} : undefined;
|
|
139
100
|
};
|
|
101
|
+
const single = measure => reading => {
|
|
102
|
+
const measurement = measure(reading);
|
|
103
|
+
return measurement ? [measurement] : [];
|
|
104
|
+
};
|
|
140
105
|
|
|
141
|
-
/** How each reading type becomes an
|
|
106
|
+
/** How each reading type becomes Ovok measurements, one for most and one per channel for an ECG; a type missing here cannot be saved yet. */
|
|
142
107
|
const MEASUREMENTS = {
|
|
143
|
-
blood_pressure: bloodPressure,
|
|
144
|
-
blood_glucose: bloodGlucose,
|
|
145
|
-
blood_cholesterol: lipidPanel,
|
|
146
|
-
ecg,
|
|
147
|
-
heart_rate: heartRate,
|
|
148
|
-
oxygen_saturation: pulseOximetry,
|
|
149
|
-
respiration_rate: respiratoryRate,
|
|
150
|
-
spirometry,
|
|
151
|
-
temperature: bodyTemperature,
|
|
152
|
-
triglycerides: lipidPanel,
|
|
153
|
-
weight: bodyWeight
|
|
108
|
+
blood_pressure: single(bloodPressure),
|
|
109
|
+
blood_glucose: single(bloodGlucose),
|
|
110
|
+
blood_cholesterol: single(lipidPanel),
|
|
111
|
+
ecg: _ecgMeasurements.ecgMeasurements,
|
|
112
|
+
heart_rate: single(heartRate),
|
|
113
|
+
oxygen_saturation: single(pulseOximetry),
|
|
114
|
+
respiration_rate: single(respiratoryRate),
|
|
115
|
+
spirometry: single(spirometry),
|
|
116
|
+
temperature: single(bodyTemperature),
|
|
117
|
+
triglycerides: single(lipidPanel),
|
|
118
|
+
weight: single(bodyWeight)
|
|
154
119
|
};
|
|
155
120
|
const deviceOf = (reading, device) => ({
|
|
156
121
|
id: reading.source.address,
|
|
@@ -167,24 +132,60 @@ const deviceOf = (reading, device) => ({
|
|
|
167
132
|
batteryPercentage: device.battery?.percent
|
|
168
133
|
});
|
|
169
134
|
|
|
170
|
-
/**
|
|
135
|
+
/** What the sink saves with: the measurements API, the outbox that deletes, and the session that names the patient. */
|
|
136
|
+
|
|
137
|
+
const unsupported = what => new _errors.DeviceError("unsupported", `Ovok cannot save ${what} yet`);
|
|
138
|
+
|
|
139
|
+
/** Live numbers are saved as series and a live ECG as a recording; any other live trace has no place in Ovok yet. */
|
|
140
|
+
const isUnsavableLive = reading => reading.live !== undefined && reading.series === undefined && reading.type !== "ecg";
|
|
141
|
+
const hasValues = reading => Object.keys(reading.values).length > 0;
|
|
142
|
+
const saveMeasurements = async (client, reading, device) => {
|
|
143
|
+
const measurements = MEASUREMENTS[reading.type]?.(reading) ?? [];
|
|
144
|
+
if (measurements.length === 0) {
|
|
145
|
+
throw unsupported(`a ${reading.type} reading of this shape`);
|
|
146
|
+
}
|
|
147
|
+
const results = [];
|
|
148
|
+
for (const [index, measurement] of measurements.entries()) {
|
|
149
|
+
results.push(await client.measurements.save({
|
|
150
|
+
measurement,
|
|
151
|
+
sourceId: (0, _readingSourceId.partSourceId)((0, _readingSourceId.sourceIdOf)(reading), index),
|
|
152
|
+
effectiveDateTime: reading.takenAt ?? undefined,
|
|
153
|
+
device
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
return results;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/** Queued when any part of the reading is, with the outbox item of each queued part. */
|
|
160
|
+
const receiptOf = results => {
|
|
161
|
+
const queueIds = results.flatMap(result => result.status === "queued" ? [result.queueId] : []);
|
|
162
|
+
return queueIds.length > 0 ? {
|
|
163
|
+
status: "queued",
|
|
164
|
+
queueIds
|
|
165
|
+
} : {
|
|
166
|
+
status: "saved"
|
|
167
|
+
};
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Saves readings for the signed-in account through the Ovok measurements API, queueing them offline. A reading with a
|
|
172
|
+
* series also saves it; a stored record then removes the live recordings it replaces, once it is saved.
|
|
173
|
+
*/
|
|
171
174
|
const ovokReadingSink = client => ({
|
|
172
175
|
save: async (reading, device) => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
throw new _errors.DeviceError("unsupported", `Ovok cannot save a ${reading.type} reading of this shape yet`);
|
|
176
|
+
if (isUnsavableLive(reading)) {
|
|
177
|
+
throw unsupported(`a live ${reading.live?.metric} recording`);
|
|
176
178
|
}
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return result.status;
|
|
179
|
+
const target = deviceOf(reading, device);
|
|
180
|
+
const results = [];
|
|
181
|
+
if ((0, _seriesSaving.isSeriesReading)(reading)) {
|
|
182
|
+
results.push(await (0, _seriesSaving.saveSeries)(client, reading, target));
|
|
183
|
+
}
|
|
184
|
+
if (!(0, _seriesSaving.isSeriesReading)(reading) || hasValues(reading)) {
|
|
185
|
+
results.push(...(await saveMeasurements(client, reading, target)));
|
|
186
|
+
}
|
|
187
|
+
await (0, _liveSupersession.replaceLiveRecordings)(client, reading);
|
|
188
|
+
return receiptOf(results);
|
|
188
189
|
}
|
|
189
190
|
});
|
|
190
191
|
exports.ovokReadingSink = ovokReadingSink;
|