@ovok/native 1.6.0 → 1.6.1
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/README.md +8 -2
- package/android/src/main/AndroidManifest.xml +1 -20
- package/app.plugin.js +84 -7
- package/lib/commonjs/index.js +5 -115
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/modules/auth/hooks/use-session.js +25 -11
- package/lib/commonjs/modules/auth/hooks/use-session.js.map +1 -1
- package/lib/commonjs/modules/auth/logout-button/components/logout-button.js +3 -2
- package/lib/commonjs/modules/auth/logout-button/components/logout-button.js.map +1 -1
- package/lib/commonjs/modules/auth/register/components/form/inputs.js +10 -8
- package/lib/commonjs/modules/auth/register/components/form/inputs.js.map +1 -1
- package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js +2 -2
- package/lib/commonjs/modules/auth/reset-password/components/form/inputs.js.map +1 -1
- package/lib/commonjs/modules/auth/session/components/session-list.js +3 -3
- package/lib/commonjs/modules/auth/session/components/session-list.js.map +1 -1
- package/lib/commonjs/modules/auth/sign-in/components/form/inputs.js +4 -3
- package/lib/commonjs/modules/auth/sign-in/components/form/inputs.js.map +1 -1
- package/lib/commonjs/modules/background-sync/background-safe-storage.js +3 -6
- package/lib/commonjs/modules/background-sync/background-safe-storage.js.map +1 -1
- package/lib/commonjs/modules/bt-device/index.js +0 -22
- package/lib/commonjs/modules/bt-device/index.js.map +1 -1
- package/lib/commonjs/modules/bt-device-instructions/index.js +39 -0
- package/lib/commonjs/modules/bt-device-instructions/index.js.map +1 -0
- package/lib/commonjs/modules/bt-management/components/android-bluetooth-foreground-service.js +64 -0
- package/lib/commonjs/modules/bt-management/components/android-bluetooth-foreground-service.js.map +1 -0
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js +7 -41
- package/lib/commonjs/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/commonjs/modules/bt-management/constants/measurement-field-catalog.js +1 -0
- package/lib/commonjs/modules/bt-management/constants/measurement-field-catalog.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js +4 -0
- package/lib/commonjs/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js +8 -4
- package/lib/commonjs/modules/bt-management/hooks/use-background-sync.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js +5 -1
- package/lib/commonjs/modules/bt-management/hooks/use-device-connection.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-health-import.js +48 -12
- package/lib/commonjs/modules/bt-management/hooks/use-health-import.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js +40 -18
- package/lib/commonjs/modules/bt-management/hooks/use-measurements.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js +8 -1
- package/lib/commonjs/modules/bt-management/hooks/use-nearby-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js +13 -4
- package/lib/commonjs/modules/bt-management/hooks/use-paired-devices.js.map +1 -1
- package/lib/commonjs/modules/bt-management/hooks/use-scan-control.js +21 -0
- package/lib/commonjs/modules/bt-management/hooks/use-scan-control.js.map +1 -0
- package/lib/commonjs/modules/bt-management/index.js +11 -0
- package/lib/commonjs/modules/bt-management/index.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js +0 -1
- package/lib/commonjs/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/bt-manager.js +19 -21
- package/lib/commonjs/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js +5 -3
- package/lib/commonjs/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js +21 -26
- package/lib/commonjs/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js +9 -1
- package/lib/commonjs/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +1 -0
- package/lib/commonjs/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
- package/lib/commonjs/modules/bt-management/services/push-notification.js +39 -0
- package/lib/commonjs/modules/bt-management/services/push-notification.js.map +1 -0
- package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js +81 -1
- package/lib/commonjs/modules/bt-management/testing/fake-ble-manager.js.map +1 -1
- package/lib/commonjs/modules/bt-management/types/bluetooth-error.js +4 -2
- package/lib/commonjs/modules/bt-management/types/bluetooth-error.js.map +1 -1
- package/lib/commonjs/modules/bt-management/utils/result-identity.js +1 -1
- package/lib/commonjs/modules/bt-management/utils/result-identity.js.map +1 -1
- package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js +12 -3
- package/lib/commonjs/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
- package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js +7 -1
- package/lib/commonjs/modules/data-sync/services/base-health-sync-service.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/generate-observation-entry.js +29 -21
- package/lib/commonjs/modules/data-sync/utils/generate-observation-entry.js.map +1 -1
- package/lib/commonjs/modules/data-sync/utils/retry-save.js +40 -6
- package/lib/commonjs/modules/data-sync/utils/retry-save.js.map +1 -1
- package/lib/commonjs/modules/helpers/index.js +11 -4
- package/lib/commonjs/modules/helpers/index.js.map +1 -1
- package/lib/commonjs/modules/helpers/utils/sentry-logger.js +2 -3
- package/lib/commonjs/modules/helpers/utils/sentry-logger.js.map +1 -1
- package/lib/commonjs/modules/helpers/utils/telemetry.js +133 -46
- package/lib/commonjs/modules/helpers/utils/telemetry.js.map +1 -1
- package/lib/commonjs/modules/image/components/optimized-image.js +11 -8
- package/lib/commonjs/modules/image/components/optimized-image.js.map +1 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js +3 -1
- package/lib/commonjs/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
- package/lib/commonjs/modules/tile/constants/measurement-icon-svg.js +4 -1
- package/lib/commonjs/modules/tile/constants/measurement-icon-svg.js.map +1 -1
- package/lib/commonjs/modules/ui/components/background-sync-setting.js +11 -1
- package/lib/commonjs/modules/ui/components/background-sync-setting.js.map +1 -1
- package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js +14 -0
- package/lib/commonjs/modules/ui/components/bluetooth-state-notice.js.map +1 -1
- package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js +10 -0
- package/lib/commonjs/modules/ui/components/ecg-strip-viewer.js.map +1 -1
- package/lib/commonjs/modules/ui/components/health-import-card.js +12 -1
- package/lib/commonjs/modules/ui/components/health-import-card.js.map +1 -1
- package/lib/commonjs/modules/ui/components/manual-entry-form.js +14 -1
- package/lib/commonjs/modules/ui/components/manual-entry-form.js.map +1 -1
- package/lib/commonjs/modules/ui/components/pairing-flow.js +31 -6
- package/lib/commonjs/modules/ui/components/pairing-flow.js.map +1 -1
- package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js +8 -0
- package/lib/commonjs/modules/ui/components/supported-devices-catalog-list.js.map +1 -1
- package/lib/commonjs/modules/ui/components/urine-test-result.js +7 -2
- package/lib/commonjs/modules/ui/components/urine-test-result.js.map +1 -1
- package/lib/commonjs/modules/ui/use-ovok-ui.js +2 -2
- package/lib/commonjs/modules/ui/use-ovok-ui.js.map +1 -1
- package/lib/module/index.js +3 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/auth/hooks/use-session.js +25 -11
- package/lib/module/modules/auth/hooks/use-session.js.map +1 -1
- package/lib/module/modules/auth/logout-button/components/logout-button.js +3 -2
- package/lib/module/modules/auth/logout-button/components/logout-button.js.map +1 -1
- package/lib/module/modules/auth/register/components/form/inputs.js +10 -8
- package/lib/module/modules/auth/register/components/form/inputs.js.map +1 -1
- package/lib/module/modules/auth/reset-password/components/form/inputs.js +2 -2
- package/lib/module/modules/auth/reset-password/components/form/inputs.js.map +1 -1
- package/lib/module/modules/auth/session/components/session-list.js +3 -3
- package/lib/module/modules/auth/session/components/session-list.js.map +1 -1
- package/lib/module/modules/auth/sign-in/components/form/inputs.js +4 -3
- package/lib/module/modules/auth/sign-in/components/form/inputs.js.map +1 -1
- package/lib/module/modules/background-sync/background-safe-storage.js +3 -6
- package/lib/module/modules/background-sync/background-safe-storage.js.map +1 -1
- package/lib/module/modules/bt-device/index.js +0 -2
- package/lib/module/modules/bt-device/index.js.map +1 -1
- package/lib/module/modules/bt-device-instructions/index.js +6 -0
- package/lib/module/modules/bt-device-instructions/index.js.map +1 -0
- package/lib/module/modules/bt-management/components/android-bluetooth-foreground-service.js +58 -0
- package/lib/module/modules/bt-management/components/android-bluetooth-foreground-service.js.map +1 -0
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js +6 -40
- package/lib/module/modules/bt-management/components/bt-provider-child-wrapper.js.map +1 -1
- package/lib/module/modules/bt-management/constants/measurement-field-catalog.js +1 -0
- package/lib/module/modules/bt-management/constants/measurement-field-catalog.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/runtime-context.js +4 -0
- package/lib/module/modules/bt-management/hooks/runtime-context.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-background-sync.js +8 -4
- package/lib/module/modules/bt-management/hooks/use-background-sync.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-device-connection.js +5 -1
- package/lib/module/modules/bt-management/hooks/use-device-connection.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-health-import.js +48 -12
- package/lib/module/modules/bt-management/hooks/use-health-import.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-measurements.js +40 -18
- package/lib/module/modules/bt-management/hooks/use-measurements.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-nearby-devices.js +8 -1
- package/lib/module/modules/bt-management/hooks/use-nearby-devices.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-paired-devices.js +13 -4
- package/lib/module/modules/bt-management/hooks/use-paired-devices.js.map +1 -1
- package/lib/module/modules/bt-management/hooks/use-scan-control.js +16 -0
- package/lib/module/modules/bt-management/hooks/use-scan-control.js.map +1 -0
- package/lib/module/modules/bt-management/index.js +1 -0
- package/lib/module/modules/bt-management/index.js.map +1 -1
- package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js +0 -1
- package/lib/module/modules/bt-management/services/background-sync/background-sync-coordinator.js.map +1 -1
- package/lib/module/modules/bt-management/services/bt-manager.js +19 -21
- package/lib/module/modules/bt-management/services/bt-manager.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js +5 -3
- package/lib/module/modules/bt-management/services/devices/bt-connection-handler.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js +22 -27
- package/lib/module/modules/bt-management/services/devices/bt-managed-device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js +9 -1
- package/lib/module/modules/bt-management/services/devices/custom/custom.device.js.map +1 -1
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js +1 -0
- package/lib/module/modules/bt-management/services/devices/lepu/lepu.file-transfer.js.map +1 -1
- package/lib/module/modules/bt-management/services/push-notification.js +34 -0
- package/lib/module/modules/bt-management/services/push-notification.js.map +1 -0
- package/lib/module/modules/bt-management/testing/fake-ble-manager.js +79 -0
- package/lib/module/modules/bt-management/testing/fake-ble-manager.js.map +1 -1
- package/lib/module/modules/bt-management/types/bluetooth-error.js +4 -2
- package/lib/module/modules/bt-management/types/bluetooth-error.js.map +1 -1
- package/lib/module/modules/bt-management/utils/result-identity.js +1 -1
- package/lib/module/modules/bt-management/utils/result-identity.js.map +1 -1
- package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js +12 -3
- package/lib/module/modules/data-sync/components/android/android-health-connect-authorization-provider.js.map +1 -1
- package/lib/module/modules/data-sync/services/base-health-sync-service.js +8 -2
- package/lib/module/modules/data-sync/services/base-health-sync-service.js.map +1 -1
- package/lib/module/modules/data-sync/utils/generate-observation-entry.js +29 -21
- package/lib/module/modules/data-sync/utils/generate-observation-entry.js.map +1 -1
- package/lib/module/modules/data-sync/utils/retry-save.js +39 -7
- package/lib/module/modules/data-sync/utils/retry-save.js.map +1 -1
- package/lib/module/modules/helpers/index.js +1 -1
- package/lib/module/modules/helpers/index.js.map +1 -1
- package/lib/module/modules/helpers/utils/sentry-logger.js +3 -4
- package/lib/module/modules/helpers/utils/sentry-logger.js.map +1 -1
- package/lib/module/modules/helpers/utils/telemetry.js +133 -46
- package/lib/module/modules/helpers/utils/telemetry.js.map +1 -1
- package/lib/module/modules/image/components/optimized-image.js +11 -8
- package/lib/module/modules/image/components/optimized-image.js.map +1 -1
- package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js +3 -1
- package/lib/module/modules/questionnaire-response-form/components/questionnaire-form-provider.js.map +1 -1
- package/lib/module/modules/tile/constants/measurement-icon-svg.js +4 -1
- package/lib/module/modules/tile/constants/measurement-icon-svg.js.map +1 -1
- package/lib/module/modules/ui/components/background-sync-setting.js +11 -1
- package/lib/module/modules/ui/components/background-sync-setting.js.map +1 -1
- package/lib/module/modules/ui/components/bluetooth-state-notice.js +14 -0
- package/lib/module/modules/ui/components/bluetooth-state-notice.js.map +1 -1
- package/lib/module/modules/ui/components/ecg-strip-viewer.js +10 -0
- package/lib/module/modules/ui/components/ecg-strip-viewer.js.map +1 -1
- package/lib/module/modules/ui/components/health-import-card.js +12 -1
- package/lib/module/modules/ui/components/health-import-card.js.map +1 -1
- package/lib/module/modules/ui/components/manual-entry-form.js +14 -1
- package/lib/module/modules/ui/components/manual-entry-form.js.map +1 -1
- package/lib/module/modules/ui/components/pairing-flow.js +31 -6
- package/lib/module/modules/ui/components/pairing-flow.js.map +1 -1
- package/lib/module/modules/ui/components/supported-devices-catalog-list.js +8 -0
- package/lib/module/modules/ui/components/supported-devices-catalog-list.js.map +1 -1
- package/lib/module/modules/ui/components/urine-test-result.js +7 -2
- package/lib/module/modules/ui/components/urine-test-result.js.map +1 -1
- package/lib/module/modules/ui/use-ovok-ui.js +2 -2
- package/lib/module/modules/ui/use-ovok-ui.js.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +0 -10
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/hooks/use-session.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/session/components/session-list.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts +2 -5
- package/lib/typescript/commonjs/src/modules/auth/types/session.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts +3 -1
- package/lib/typescript/commonjs/src/modules/background-sync/background-safe-storage.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device/index.d.ts +0 -2
- package/lib/typescript/commonjs/src/modules/bt-device/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-device-instructions/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/modules/bt-device-instructions/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts +14 -0
- package/lib/typescript/commonjs/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/constants/measurement-field-catalog.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts +4 -2
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-scan-control.d.ts +7 -0
- package/lib/typescript/commonjs/src/modules/bt-management/hooks/use-scan-control.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/services/push-notification.d.ts +8 -0
- package/lib/typescript/commonjs/src/modules/bt-management/services/push-notification.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts +17 -0
- package/lib/typescript/commonjs/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/bt-management/utils/result-identity.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/generate-observation-entry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/data-sync/utils/retry-save.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/index.d.ts +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts +3 -2
- package/lib/typescript/commonjs/src/modules/helpers/utils/telemetry.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/image/components/optimized-image.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/tile/constants/measurement-icon-svg.d.ts +1 -0
- package/lib/typescript/commonjs/src/modules/tile/constants/measurement-icon-svg.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts +2 -1
- package/lib/typescript/commonjs/src/modules/ui/components/manual-entry-form.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/pairing-flow.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/ui/components/urine-test-result.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +0 -10
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/hooks/use-session.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/logout-button/components/logout-button.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/register/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/session/components/session-list.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/sign-in/components/form/inputs.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/auth/types/session.d.ts +2 -5
- package/lib/typescript/module/src/modules/auth/types/session.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts +3 -1
- package/lib/typescript/module/src/modules/background-sync/background-safe-storage.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device/index.d.ts +0 -2
- package/lib/typescript/module/src/modules/bt-device/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-device-instructions/index.d.ts +4 -0
- package/lib/typescript/module/src/modules/bt-device-instructions/index.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts +14 -0
- package/lib/typescript/module/src/modules/bt-management/components/android-bluetooth-foreground-service.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/components/bt-provider-child-wrapper.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/constants/measurement-field-catalog.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts +4 -2
- package/lib/typescript/module/src/modules/bt-management/hooks/runtime-context.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-background-sync.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-device-connection.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-health-import.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-measurements.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-nearby-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-paired-devices.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/hooks/use-scan-control.d.ts +7 -0
- package/lib/typescript/module/src/modules/bt-management/hooks/use-scan-control.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/background-sync/background-sync-coordinator.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/bt-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-connection-handler.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/bt-managed-device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/custom/custom.device.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts +1 -0
- package/lib/typescript/module/src/modules/bt-management/services/devices/lepu/lepu.file-transfer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/services/push-notification.d.ts +8 -0
- package/lib/typescript/module/src/modules/bt-management/services/push-notification.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts +17 -0
- package/lib/typescript/module/src/modules/bt-management/testing/fake-ble-manager.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/bluetooth-error.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts +2 -0
- package/lib/typescript/module/src/modules/bt-management/types/command-sequencer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/bt-management/utils/result-identity.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/components/android/android-health-connect-authorization-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/services/base-health-sync-service.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/generate-observation-entry.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts +3 -2
- package/lib/typescript/module/src/modules/data-sync/utils/retry-save.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/index.d.ts +1 -1
- package/lib/typescript/module/src/modules/helpers/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/utils/sentry-logger.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts +3 -2
- package/lib/typescript/module/src/modules/helpers/utils/telemetry.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/image/components/optimized-image.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/questionnaire-response-form/components/questionnaire-form-provider.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/tile/constants/measurement-icon-svg.d.ts +1 -0
- package/lib/typescript/module/src/modules/tile/constants/measurement-icon-svg.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/bluetooth-state-notice.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/ecg-strip-viewer.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts +2 -1
- package/lib/typescript/module/src/modules/ui/components/manual-entry-form.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/pairing-flow.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/ui/components/urine-test-result.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Keep this dependency out of the root Bluetooth barrel. It is loaded only when an
|
|
4
|
+
// app opts into background notifications, while the notifications subpath remains the
|
|
5
|
+
// public API for permission management.
|
|
6
|
+
const notificationsModuleName = "expo-notifications";
|
|
7
|
+
const getNotifications = () => {
|
|
8
|
+
try {
|
|
9
|
+
return require(notificationsModuleName);
|
|
10
|
+
} catch (error) {
|
|
11
|
+
throw new Error("Background notifications require expo-notifications. Install it and configure its app plugin before using this feature.", {
|
|
12
|
+
cause: error
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export const showBackgroundPushNotification = async ({
|
|
17
|
+
title,
|
|
18
|
+
body,
|
|
19
|
+
data
|
|
20
|
+
}) => {
|
|
21
|
+
await getNotifications().scheduleNotificationAsync({
|
|
22
|
+
content: {
|
|
23
|
+
title,
|
|
24
|
+
...(body === undefined ? {} : {
|
|
25
|
+
body
|
|
26
|
+
}),
|
|
27
|
+
...(data === undefined ? {} : {
|
|
28
|
+
data
|
|
29
|
+
})
|
|
30
|
+
},
|
|
31
|
+
trigger: null
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=push-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["notificationsModuleName","getNotifications","require","error","Error","cause","showBackgroundPushNotification","title","body","data","scheduleNotificationAsync","content","undefined","trigger"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/services/push-notification.ts"],"mappings":";;AAiBA;AACA;AACA;AACA,MAAMA,uBAAuB,GAAG,oBAAoB;AAEpD,MAAMC,gBAAgB,GAAGA,CAAA,KAA2B;EAClD,IAAI;IACF,OAAOC,OAAO,CAACF,uBAAuB,CAAC;EACzC,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIC,KAAK,CACb,yHAAyH,EACzH;MAAEC,KAAK,EAAEF;IAAM,CACjB,CAAC;EACH;AACF,CAAC;AAED,OAAO,MAAMG,8BAA8B,GAAG,MAAAA,CAAO;EACnDC,KAAK;EACLC,IAAI;EACJC;AACuB,CAAC,KAAoB;EAC5C,MAAMR,gBAAgB,CAAC,CAAC,CAACS,yBAAyB,CAAC;IACjDC,OAAO,EAAE;MACPJ,KAAK;MACL,IAAIC,IAAI,KAAKI,SAAS,GAAG,CAAC,CAAC,GAAG;QAAEJ;MAAK,CAAC,CAAC;MACvC,IAAIC,IAAI,KAAKG,SAAS,GAAG,CAAC,CAAC,GAAG;QAAEH;MAAK,CAAC;IACxC,CAAC;IACDI,OAAO,EAAE;EACX,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,84 @@ import { State } from "react-native-ble-plx";
|
|
|
6
6
|
|
|
7
7
|
/** A deterministic BLE manager for hook and scan integration tests. No hardware is used. */
|
|
8
8
|
|
|
9
|
+
const characteristicKey = (serviceUuid, characteristicUuid) => `${serviceUuid}/${characteristicUuid}`;
|
|
10
|
+
|
|
11
|
+
/** Creates a GATT-capable fake device for connection and notification tests. */
|
|
12
|
+
export const createFakeBleDevice = ({
|
|
13
|
+
id,
|
|
14
|
+
name = id,
|
|
15
|
+
localName = name,
|
|
16
|
+
manufacturerData = "",
|
|
17
|
+
serviceUUIDs = [],
|
|
18
|
+
mtu = 23,
|
|
19
|
+
characteristics = {}
|
|
20
|
+
}) => {
|
|
21
|
+
let connected = false;
|
|
22
|
+
let currentMtu = mtu;
|
|
23
|
+
const values = new Map(Object.entries(characteristics));
|
|
24
|
+
const disconnectedCallbacks = new Set();
|
|
25
|
+
const notificationCallbacks = new Map();
|
|
26
|
+
const fake = {
|
|
27
|
+
id,
|
|
28
|
+
name,
|
|
29
|
+
localName,
|
|
30
|
+
manufacturerData,
|
|
31
|
+
serviceUUIDs: [...serviceUUIDs],
|
|
32
|
+
mtu: currentMtu,
|
|
33
|
+
isConnected: async () => connected,
|
|
34
|
+
connect: async () => {
|
|
35
|
+
connected = true;
|
|
36
|
+
return fake;
|
|
37
|
+
},
|
|
38
|
+
cancelConnection: async () => {
|
|
39
|
+
connected = false;
|
|
40
|
+
disconnectedCallbacks.forEach(callback => callback(null, fake));
|
|
41
|
+
return fake;
|
|
42
|
+
},
|
|
43
|
+
discoverAllServicesAndCharacteristics: async () => fake,
|
|
44
|
+
onDisconnected: callback => {
|
|
45
|
+
disconnectedCallbacks.add(callback);
|
|
46
|
+
return {
|
|
47
|
+
remove: () => disconnectedCallbacks.delete(callback)
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
requestMTU: async requestedMtu => {
|
|
51
|
+
currentMtu = requestedMtu;
|
|
52
|
+
return {
|
|
53
|
+
mtu: currentMtu
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
readCharacteristicForService: async (serviceUuid, characteristicUuid) => ({
|
|
57
|
+
value: values.get(characteristicKey(serviceUuid, characteristicUuid)) ?? null
|
|
58
|
+
}),
|
|
59
|
+
monitorCharacteristicForService: (serviceUuid, characteristicUuid, callback) => {
|
|
60
|
+
const key = characteristicKey(serviceUuid, characteristicUuid);
|
|
61
|
+
const callbacks = notificationCallbacks.get(key) ?? new Set();
|
|
62
|
+
callbacks.add(callback);
|
|
63
|
+
notificationCallbacks.set(key, callbacks);
|
|
64
|
+
return {
|
|
65
|
+
remove: () => callbacks.delete(callback)
|
|
66
|
+
};
|
|
67
|
+
},
|
|
68
|
+
writeCharacteristicWithResponseForService: async () => fake,
|
|
69
|
+
writeCharacteristicWithoutResponseForService: async () => fake
|
|
70
|
+
};
|
|
71
|
+
return {
|
|
72
|
+
device: fake,
|
|
73
|
+
emitCharacteristic: (serviceUuid, characteristicUuid, value) => {
|
|
74
|
+
const key = characteristicKey(serviceUuid, characteristicUuid);
|
|
75
|
+
const characteristic = {
|
|
76
|
+
uuid: characteristicUuid,
|
|
77
|
+
value
|
|
78
|
+
};
|
|
79
|
+
values.set(key, value);
|
|
80
|
+
notificationCallbacks.get(key)?.forEach(callback => callback(null, characteristic));
|
|
81
|
+
},
|
|
82
|
+
disconnect: async () => {
|
|
83
|
+
await fake.cancelConnection();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
9
87
|
export const createFakeBleManager = ({
|
|
10
88
|
state = State.PoweredOn,
|
|
11
89
|
devices = []
|
|
@@ -35,6 +113,7 @@ export const createFakeBleManager = ({
|
|
|
35
113
|
};
|
|
36
114
|
return {
|
|
37
115
|
manager,
|
|
116
|
+
createDevice: createFakeBleDevice,
|
|
38
117
|
emitDevice: device => scanCallback?.(null, device),
|
|
39
118
|
emitError: error => scanCallback?.(error, null),
|
|
40
119
|
setState: nextState => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["State","
|
|
1
|
+
{"version":3,"names":["State","characteristicKey","serviceUuid","characteristicUuid","createFakeBleDevice","id","name","localName","manufacturerData","serviceUUIDs","mtu","characteristics","connected","currentMtu","values","Map","Object","entries","disconnectedCallbacks","Set","notificationCallbacks","fake","isConnected","connect","cancelConnection","forEach","callback","discoverAllServicesAndCharacteristics","onDisconnected","add","remove","delete","requestMTU","requestedMtu","readCharacteristicForService","value","get","monitorCharacteristicForService","key","callbacks","set","writeCharacteristicWithResponseForService","writeCharacteristicWithoutResponseForService","device","emitCharacteristic","characteristic","uuid","disconnect","createFakeBleManager","state","PoweredOn","devices","currentState","scanCallback","stateCallbacks","scannedServiceUUIDs","manager","onStateChange","emitCurrentState","startDeviceScan","_options","stopDeviceScan","undefined","createDevice","emitDevice","emitError","error","setState","nextState","getScannedServiceUUIDs"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/testing/fake-ble-manager.ts"],"mappings":";;AAAA;;AAEA,SAA6BA,KAAK,QAAsB,sBAAsB;;AA2B9E;;AAWA,MAAMC,iBAAiB,GAAGA,CAACC,WAAmB,EAAEC,kBAA0B,KACxE,GAAGD,WAAW,IAAIC,kBAAkB,EAAE;;AAExC;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CAAC;EAClCC,EAAE;EACFC,IAAI,GAAGD,EAAE;EACTE,SAAS,GAAGD,IAAI;EAChBE,gBAAgB,GAAG,EAAE;EACrBC,YA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AAO,CAAEC,QAAQ,IAAKA,QAAQ,CAAC0C,SAAS,CAAC,CAAC;IAC3D,CAAC;IACDC,sBAAsB,EAAEA,CAAA,KAAMd,mBAAmB;IACjDM,cAAc,EAAEA,CAAA,KAAML,OAAO,CAACK,cAAc,CAAC;EAC/C,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -40,7 +40,9 @@ export const bluetoothErrorCodeFor = error => {
|
|
|
40
40
|
return error.code;
|
|
41
41
|
}
|
|
42
42
|
const message = messageFor(error);
|
|
43
|
-
const
|
|
43
|
+
const structured = error;
|
|
44
|
+
const errorCode = structured?.errorCode;
|
|
45
|
+
const structuredCodes = [errorCode, structured?.androidErrorCode, structured?.iosErrorCode].map(value => String(value ?? "").toLowerCase());
|
|
44
46
|
if (/permission|unauthori[sz]ed|denied/i.test(message)) {
|
|
45
47
|
return BluetoothErrorCode.PERMISSION_DENIED;
|
|
46
48
|
}
|
|
@@ -50,7 +52,7 @@ export const bluetoothErrorCodeFor = error => {
|
|
|
50
52
|
if (/scan/i.test(message) || errorCode === "ScanStartFailed") {
|
|
51
53
|
return BluetoothErrorCode.SCAN_FAILED;
|
|
52
54
|
}
|
|
53
|
-
if (/pair|bond|authentication/i.test(message)) {
|
|
55
|
+
if (structuredCodes.some(code => /pair|bond|auth|encryption|insufficientsecurity/.test(code)) || [5, 8, 15, 137].includes(Number(structured?.androidErrorCode)) || /pair|bond|authentication|passkey|pin/i.test(message)) {
|
|
54
56
|
return BluetoothErrorCode.PAIRING_REQUIRED;
|
|
55
57
|
}
|
|
56
58
|
if (/connect|disconnect/i.test(message)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BluetoothErrorCode","BluetoothError","Error","name","constructor","code","message","translationKey","originalError","translationKeyFor","test","undefined","messageFor","error","String","bluetoothErrorCodeFor","errorCode","PERMISSION_DENIED","UNSUPPORTED","SCAN_FAILED","PAIRING_REQUIRED","CONNECTION_FAILED","FRAME_INVALID","MEASUREMENT_FAILED","UNKNOWN","toBluetoothError"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/bluetooth-error.ts"],"mappings":";;AAAA;;AAIA,WAAYA,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAc9B,OAAO,MAAMC,cAAc,SAASC,KAAK,CAAC;EACxBC,IAAI,GAAG,gBAAgB;EAEhCC,WAAWA,CACAC,IAAwB,EACxCC,OAAe,EACCC,cAAuB,EACvBC,aAAuB,EACvC;IACA,KAAK,CAACF,OAAO,CAAC;IAAC,KALCD,IAAwB,GAAxBA,IAAwB;IAAA,KAExBE,cAAuB,GAAvBA,cAAuB;IAAA,KACvBC,aAAuB,GAAvBA,aAAuB;EAGzC;AACF;AAEA,MAAMC,iBAAiB,GAAIH,OAAe,IACxC,qBAAqB,CAACI,IAAI,CAACJ,OAAO,CAAC,GAAGA,OAAO,GAAGK,SAAS;AAE3D,MAAMC,UAAU,GAAIC,KAAc,IAAa;EAC7C,IAAIA,KAAK,YAAYX,KAAK,EAAE;IAC1B,OAAOW,KAAK,CAACP,OAAO;EACtB;EAEA,IAAI,OAAOO,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,OAAOC,MAAM,CAACD,KAAK,CAAC;AACtB,CAAC;AAED,OAAO,MAAME,qBAAqB,GAChCF,KAAc,IACS;EACvB,IAAIA,KAAK,YAAYZ,cAAc,EAAE;IACnC,OAAOY,KAAK,CAACR,IAAI;EACnB;EAEA,MAAMC,OAAO,GAAGM,UAAU,CAACC,KAAK,CAAC;EACjC,MAAMG,SAAS,
|
|
1
|
+
{"version":3,"names":["BluetoothErrorCode","BluetoothError","Error","name","constructor","code","message","translationKey","originalError","translationKeyFor","test","undefined","messageFor","error","String","bluetoothErrorCodeFor","structured","errorCode","structuredCodes","androidErrorCode","iosErrorCode","map","value","toLowerCase","PERMISSION_DENIED","UNSUPPORTED","SCAN_FAILED","some","includes","Number","PAIRING_REQUIRED","CONNECTION_FAILED","FRAME_INVALID","MEASUREMENT_FAILED","UNKNOWN","toBluetoothError"],"sourceRoot":"../../../../../src","sources":["modules/bt-management/types/bluetooth-error.ts"],"mappings":";;AAAA;;AAIA,WAAYA,kBAAkB,0BAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAlBA,kBAAkB;EAAA,OAAlBA,kBAAkB;AAAA;AAc9B,OAAO,MAAMC,cAAc,SAASC,KAAK,CAAC;EACxBC,IAAI,GAAG,gBAAgB;EAEhCC,WAAWA,CACAC,IAAwB,EACxCC,OAAe,EACCC,cAAuB,EACvBC,aAAuB,EACvC;IACA,KAAK,CAACF,OAAO,CAAC;IAAC,KALCD,IAAwB,GAAxBA,IAAwB;IAAA,KAExBE,cAAuB,GAAvBA,cAAuB;IAAA,KACvBC,aAAuB,GAAvBA,aAAuB;EAGzC;AACF;AAEA,MAAMC,iBAAiB,GAAIH,OAAe,IACxC,qBAAqB,CAACI,IAAI,CAACJ,OAAO,CAAC,GAAGA,OAAO,GAAGK,SAAS;AAE3D,MAAMC,UAAU,GAAIC,KAAc,IAAa;EAC7C,IAAIA,KAAK,YAAYX,KAAK,EAAE;IAC1B,OAAOW,KAAK,CAACP,OAAO;EACtB;EAEA,IAAI,OAAOO,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOA,KAAK;EACd;EAEA,OAAOC,MAAM,CAACD,KAAK,CAAC;AACtB,CAAC;AAED,OAAO,MAAME,qBAAqB,GAChCF,KAAc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kB,CAACgC,aAAa;EACzC;EAEA,IAAI,6BAA6B,CAACtB,IAAI,CAACJ,OAAO,CAAC,EAAE;IAC/C,OAAON,kBAAkB,CAACiC,kBAAkB;EAC9C;EAEA,OAAOjC,kBAAkB,CAACkC,OAAO;AACnC,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAItB,KAAc,IAAqB;EAClE,IAAIA,KAAK,YAAYZ,cAAc,EAAE;IACnC,OAAOY,KAAK;EACd;EAEA,MAAMP,OAAO,GAAGM,UAAU,CAACC,KAAK,CAAC;EAEjC,OAAO,IAAIZ,cAAc,CACvBc,qBAAqB,CAACF,KAAK,CAAC,EAC5BP,OAAO,EACPG,iBAAiB,CAACH,OAAO,CAAC,EAC1BO,KACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -31,7 +31,7 @@ const hash = value => {
|
|
|
31
31
|
* delivery metadata is deliberately not part of the key.
|
|
32
32
|
*/
|
|
33
33
|
export const createStableResultId = (deviceData, data) => {
|
|
34
|
-
const deviceIdentity = deviceData.sn || deviceData.
|
|
34
|
+
const deviceIdentity = deviceData.sn || deviceData.manufacturerData || deviceData.model || deviceData.name || deviceData.id;
|
|
35
35
|
return `ovok:${hash(JSON.stringify(canonicalize({
|
|
36
36
|
device: deviceIdentity,
|
|
37
37
|
name: deviceData.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["canonicalize","value","Date","toISOString","Array","isArray","map","Object","fromEntries","entries","sort","left","right","localeCompare","key","nested","hash","first","second","index","length","code","charCodeAt","Math","imul","toString","padStart","createStableResultId","deviceData","data","deviceIdentity","sn","
|
|
1
|
+
{"version":3,"names":["canonicalize","value","Date","toISOString","Array","isArray","map","Object","fromEntries","entries","sort","left","right","localeCompare","key","nested","hash","first","second","index","length","code","charCodeAt","Math","imul","toString","padStart","createStableResultId","deviceData","data","deviceIdentity","sn","manufacturerData","model","name","id","JSON","stringify","device","reviveResultDates","revive","current","includes","date","Number","isNaN","getTime","item","childKey","childValue"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AE;MAC1C,OAAOlC,MAAM,CAACC,WAAW,CACvBD,MAAM,CAACE,OAAO,CAACgC,OAAO,CAAC,CAACnC,GAAG,CAAC,CAAC,CAAC0C,QAAQ,EAAEC,UAAU,CAAC,KAAK,CACtDD,QAAQ,EACRR,MAAM,CAACS,UAAU,EAAED,QAAQ,CAAC,CAC7B,CACH,CAAC;IACH;IAEA,OAAOP,OAAO;EAChB,CAAC;EAED,OAAOD,MAAM,CAACvC,KAAK,CAAC;AACtB,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
/* eslint-disable max-lines */
|
|
4
|
+
|
|
3
5
|
import * as React from "react";
|
|
4
6
|
import { AppState } from "react-native";
|
|
5
7
|
import { getGrantedPermissions, initialize, requestPermission } from "react-native-health-connect";
|
|
6
8
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
7
9
|
const toError = error => error instanceof Error ? error : new Error(String(error));
|
|
10
|
+
const isHealthConnectUnavailable = error => /not available|not installed|unsupported|unavailable/i.test(error instanceof Error ? error.message : String(error));
|
|
8
11
|
const useHealthConnectAuthorization = (readIdentifiers, writeIdentifiers, backgroundAccess = false, onStatusChange) => {
|
|
9
12
|
const [status, setStatus] = React.useState({
|
|
10
13
|
state: "unknown"
|
|
@@ -45,7 +48,10 @@ const useHealthConnectAuthorization = (readIdentifiers, writeIdentifiers, backgr
|
|
|
45
48
|
const error = new Error("Health Connect is not available");
|
|
46
49
|
updateStatus({
|
|
47
50
|
state: "error",
|
|
48
|
-
error
|
|
51
|
+
error,
|
|
52
|
+
...(backgroundAccess ? {
|
|
53
|
+
backgroundAccess: "unsupported"
|
|
54
|
+
} : {})
|
|
49
55
|
});
|
|
50
56
|
return;
|
|
51
57
|
}
|
|
@@ -63,10 +69,13 @@ const useHealthConnectAuthorization = (readIdentifiers, writeIdentifiers, backgr
|
|
|
63
69
|
} catch (error) {
|
|
64
70
|
updateStatus({
|
|
65
71
|
state: "error",
|
|
66
|
-
error: toError(error)
|
|
72
|
+
error: toError(error),
|
|
73
|
+
...(backgroundAccess && isHealthConnectUnavailable(error) ? {
|
|
74
|
+
backgroundAccess: "unsupported"
|
|
75
|
+
} : {})
|
|
67
76
|
});
|
|
68
77
|
}
|
|
69
|
-
}, [updateStatus]);
|
|
78
|
+
}, [backgroundAccess, updateStatus]);
|
|
70
79
|
const requestAuthorization = React.useCallback(async () => {
|
|
71
80
|
hasRequestedRef.current = true;
|
|
72
81
|
updateStatus({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","AppState","getGrantedPermissions","initialize","requestPermission","Fragment","_Fragment","jsx","_jsx","toError","error","Error","String","useHealthConnectAuthorization","readIdentifiers","writeIdentifiers","backgroundAccess","onStatusChange","status","setStatus","useState","state","hasRequestedRef","useRef","identifiersRef","permissionsRef","current","readPermissions","map","recordType","accessType","writePermissions","backgroundPermissions","updateStatus","useCallback","nextStatus","checkAuthorization","isInitialized","grantedPermissions","backgroundPermission","find","permission","requiredPermissions","filter","allGranted","every","some","granted","backgroundGranted","undefined","requestAuthorization","useEffect","subscription","addEventListener","remove","AndroidHealthConnectAuthorizationProvider","memo","fallback","children","skipRequest","renderManualRequestUI","onAuthorizationStatusChange","authorizationStatus","shouldRenderManualRequestUI","includes","shouldRenderFallback"],"sourceRoot":"../../../../../../src","sources":["modules/data-sync/components/android/android-health-connect-authorization-provider.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AACvC,SACEC,qBAAqB,EACrBC,UAAU,EACVC,iBAAiB,QACZ,6BAA6B;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAWrC,MAAMC,OAAO,GAAIC,KAAc,IAC7BA,KAAK,YAAYC,KAAK,GAAGD,KAAK,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACF,KAAK,CAAC,CAAC;AAE3D,MAAMG,6BAA6B,GAAGA,CACpCC,eAA6B,EAC7BC,gBAA+B,EAC/BC,gBAAgB,GAAG,KAAK,EACxBC,cAA0E,KACP;EACnE,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"names":["React","AppState","getGrantedPermissions","initialize","requestPermission","Fragment","_Fragment","jsx","_jsx","toError","error","Error","String","isHealthConnectUnavailable","test","message","useHealthConnectAuthorization","readIdentifiers","writeIdentifiers","backgroundAccess","onStatusChange","status","setStatus","useState","state","hasRequestedRef","useRef","identifiersRef","permissionsRef","current","readPermissions","map","recordType","accessType","writePermissions","backgroundPermissions","updateStatus","useCallback","nextStatus","checkAuthorization","isInitialized","grantedPermissions","backgroundPermission","find","permission","requiredPermissions","filter","allGranted","every","some","granted","backgroundGranted","undefined","requestAuthorization","useEffect","subscription","addEventListener","remove","AndroidHealthConnectAuthorizationProvider","memo","fallback","children","skipRequest","renderManualRequestUI","onAuthorizationStatusChange","authorizationStatus","shouldRenderManualRequestUI","includes","shouldRenderFallback"],"sourceRoot":"../../../../../../src","sources":["modules/data-sync/components/android/android-health-connect-authorization-provider.tsx"],"mappings":";;AAAA;;AAEA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,cAAc;AACvC,SACEC,qBAAqB,EACrBC,UAAU,EACVC,iBAAiB,QACZ,6BAA6B;AAAC,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA;AAWrC,MAAMC,OAAO,GAAIC,KAAc,IAC7BA,KAAK,YAAYC,KAAK,GAAGD,KAAK,GAAG,IAAIC,KAAK,CAACC,MAAM,CAACF,KAAK,CAAC,CAAC;AAE3D,MAAMG,0BAA0B,GAAIH,KAAc,IAChD,sDAAsD,CAACI,IAAI,CACzDJ,KAAK,YAAYC,KAAK,GAAGD,KAAK,CAACK,OAAO,GAAGH,MAAM,CAACF,KAAK,CACvD,CAAC;AAEH,MAAMM,6BAA6B,GAA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EACpBS,WAAW,CACZ,CAAC;EAEF,IAAIA,WAAW,IAAIG,mBAAmB,CAACzC,KAAK,KAAK,YAAY,EAAE;IAC7D,oBAAOhB,IAAA,CAAAF,SAAA;MAAAuD,QAAA,EAAGA;IAAQ,CAAG,CAAC;EACxB;EAEA,IAAIK,2BAA2B,EAAE;IAC/B,OAAOH,qBAAqB,GAAGV,oBAAoB,CAAC;EACtD;EAEA,IAAIe,oBAAoB,EAAE;IACxB,oBAAO5D,IAAA,CAAAF,SAAA;MAAAuD,QAAA,EAAGD,QAAQ,IAAI;IAAI,CAAG,CAAC;EAChC;EAEA,IAAIK,mBAAmB,CAACzC,KAAK,KAAK,SAAS,EAAE;IAC3C,OAAO,IAAI;EACb;EAEA,OAAO,IAAI;AACb,CACF,CAAC","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable max-lines */
|
|
4
4
|
|
|
5
5
|
import { recordOvokDuration, recordOvokMetric, withOvokSpan } from "../../helpers/utils/telemetry.js";
|
|
6
|
-
import { withSyncRetries } from "../utils/retry-save.js";
|
|
6
|
+
import { isSyncRetryCancelled, withSyncRetries } from "../utils/retry-save.js";
|
|
7
7
|
import { DataProcessor } from "./managers/data-processor.js";
|
|
8
8
|
import { StorageManager } from "./managers/storage-manager.js";
|
|
9
9
|
import { SyncProgressManager } from "./managers/sync-progress-manager.js";
|
|
@@ -105,7 +105,10 @@ export class BaseHealthSyncService {
|
|
|
105
105
|
if (entries.length !== 0 && !this.stateManager.shouldStopSync) {
|
|
106
106
|
try {
|
|
107
107
|
const startedAt = Date.now();
|
|
108
|
-
const result = await withSyncRetries(() => this.storageManager.saveObservations(entries));
|
|
108
|
+
const result = await withSyncRetries(() => this.storageManager.saveObservations(entries), () => this.stateManager.shouldStopSync);
|
|
109
|
+
if (this.stateManager.shouldStopSync) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
109
112
|
recordOvokMetric("ovok.health.samples.imported", entries.length, {
|
|
110
113
|
provider: this.getProviderName(),
|
|
111
114
|
measurementTypeKey
|
|
@@ -117,6 +120,9 @@ export class BaseHealthSyncService {
|
|
|
117
120
|
this.progressManager.incrementSyncedObservations(measurementTypeKey, entries.length);
|
|
118
121
|
this.storageManager.saveAnchors(anchors);
|
|
119
122
|
} catch (error) {
|
|
123
|
+
if (isSyncRetryCancelled(error) || this.stateManager.shouldStopSync) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
120
126
|
this.progressManager.setStatus(measurementTypeKey, "failed");
|
|
121
127
|
this.onSyncError(error);
|
|
122
128
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["recordOvokDuration","recordOvokMetric","withOvokSpan","withSyncRetries","DataProcessor","StorageManager","SyncProgressManager","SyncStateManager","BaseHealthSyncService","constructor","props","client","patientId","dataToSync","onSyncError","progressManager","updateProgress","stateManager","storageManager","getProviderName","dataProcessor","chunkSize","getTotalCountsFunction","getDataFromProviderFunction","getConverterFunction","startSync","once","provider","runSync","isInitialized","Error","resume","setNotStartedStatuses","initialDataFetched","initializeSync","processAllDataTypes","setPauseStatuses","pauseReason","error","stopSync","resetAll","reset","shouldStopSync","pauseSync","reason","pause","latestObservationDates","getLatestObservationDates","calculateTotalCounts","key","Object","keys","measurementTypeKey","data","getDataForMeasurementType","latestValidStartDate","getLatestValidStartDate","totalCount","getTotalRecordsCountForType","setTotalObservations","setStatus","syncDataByType","hasAnchor","observationBodies","currentHasAnchor","anchors","getObservationBodiesForType","entries","generateObservationEntries","length","startedAt","Date","now","result","saveObservations","addResult","incrementSyncedObservations","saveAnchors"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/services/base-health-sync-service.ts"],"mappings":";;AAAA;;AAUA,SACEA,kBAAkB,EAClBC,gBAAgB,EAChBC,YAAY,QACP,kCAA+B;AAWtC,SAASC,eAAe,QAAQ,wBAAqB;
|
|
1
|
+
{"version":3,"names":["recordOvokDuration","recordOvokMetric","withOvokSpan","isSyncRetryCancelled","withSyncRetries","DataProcessor","StorageManager","SyncProgressManager","SyncStateManager","BaseHealthSyncService","constructor","props","client","patientId","dataToSync","onSyncError","progressManager","updateProgress","stateManager","storageManager","getProviderName","dataProcessor","chunkSize","getTotalCountsFunction","getDataFromProviderFunction","getConverterFunction","startSync","once","provider","runSync","isInitialized","Error","resume","setNotStartedStatuses","initialDataFetched","initializeSync","processAllDataTypes","setPauseStatuses","pauseReason","error","stopSync","resetAll","reset","shouldStopSync","pauseSync","reason","pause","latestObservationDates","getLatestObservationDates","calculateTotalCounts","key","Object","keys","measurementTypeKey","data","getDataForMeasurementType","latestValidStartDate","getLatestValidStartDate","totalCount","getTotalRecordsCountForType","setTotalObservations","setStatus","syncDataByType","hasAnchor","observationBodies","currentHasAnchor","anchors","getObservationBodiesForType","entries","generateObservationEntries","length","startedAt","Date","now","result","saveObservations","addResult","incrementSyncedObservations","saveAnchors"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/services/base-health-sync-service.ts"],"mappings":";;AAAA;;AAUA,SACEA,kBAAkB,EAClBC,gBAAgB,EAChBC,YAAY,QACP,kCAA+B;AAWtC,SAASC,oBAAoB,EAAEC,eAAe,QAAQ,wBAAqB;AAE3E,SAASC,aAAa,QAAQ,8BAA2B;AACzD,SAASC,cAAc,QAAQ,+BAA4B;AAC3D,SAASC,mBAAmB,QAAQ,qCAAkC;AACtE,SAASC,gBAAgB,QAAQ,kCAA+B;AAEhE,OAAO,MAAeC,qBAAqB,CAUzC;EAeAC,WAAWA,CAACC,KAAoC,EAAE;IAChD,IAAI,CAACC,MAAM,GAAGD,KAAK,CAACC,MAAM;IAC1B,IAAI,CAACC,SAAS,GAAGF,KAAK,CAACE,SAAS;IAChC,IAAI,CAACC,UAAU,GAAGH,KAAK,CAACG,UAAU;IAClC,IAAI,CAACC,WAAW,GAAGJ,KAAK,CAACI,WAAW;IAEpC,IAAI,CAACC,eAAe,GAAG,IAAIT,mBAAmB,CAC5CI,KAAK,CAACM,cAAc,EACpBN,KAAK,CAACG,U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CAAC6C,SAAS,CAACR,kBAAkB,EAAE,QAAQ,CAAC;UAC5D,IAAI,CAACtC,WAAW,CAACwB,KAAc,CAAC;UAEhC;QACF;MACF,CAAC,MAAM;QACL,IAAI,CAACpB,cAAc,CAAC2D,WAAW,CAACZ,OAAO,CAAC;MAC1C;IACF;IAEA,IAAI,CAAClD,eAAe,CAAC6C,SAAS,CAC5BR,kBAAkB,EAClB,IAAI,CAACnC,YAAY,CAACyB,cAAc,GAAG,MAAM,GAAG,WAC9C,CAAC;EACH;EAEQY,yBAAyBA,CAACF,kBAAkC,EAAE;IACpE,OAAO,IAAI,CAACvC,UAAU,CAACuC,kBAAkB,CAAC;EAC5C;AACF","ignoreList":[]}
|
|
@@ -4,28 +4,36 @@ export const generateObservationEntry = ({
|
|
|
4
4
|
groupedObservationBodies,
|
|
5
5
|
provider
|
|
6
6
|
}) => {
|
|
7
|
-
return groupedObservationBodies.map((observationBodies, groupIndex) => observationBodies.map((observationBody, bodyIndex) =>
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
identifier: {
|
|
7
|
+
return groupedObservationBodies.map((observationBodies, groupIndex) => observationBodies.map((observationBody, bodyIndex) => {
|
|
8
|
+
const syncIdentifier = `${provider}:${observationBody.id ?? `${groupIndex}-${bodyIndex}`}`;
|
|
9
|
+
const syncIdentifierSystem = "https://api.ovok.com/fhir/StructureDefinition/observation-sync-id";
|
|
10
|
+
return {
|
|
11
|
+
fullUrl: `urn:uuid:60081479-c0a1-4b9e-9c52-039cf80f45${groupIndex}-${bodyIndex}`,
|
|
12
|
+
request: {
|
|
13
|
+
method: "POST",
|
|
14
|
+
url: "Observation",
|
|
15
|
+
ifNoneExist: `identifier=${encodeURIComponent(syncIdentifierSystem)}|${encodeURIComponent(syncIdentifier)}`
|
|
16
|
+
},
|
|
17
|
+
resource: {
|
|
18
|
+
...observationBody,
|
|
19
|
+
identifier: [...(observationBody.identifier || []), {
|
|
21
20
|
system: "https://api.ovok.com/fhir/StructureDefinition/observation-sync-provider",
|
|
22
21
|
value: provider
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
}, {
|
|
23
|
+
system: syncIdentifierSystem,
|
|
24
|
+
value: syncIdentifier
|
|
25
|
+
}],
|
|
26
|
+
device: {
|
|
27
|
+
identifier: {
|
|
28
|
+
system: "https://api.ovok.com/fhir/StructureDefinition/observation-sync-provider",
|
|
29
|
+
value: provider
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
hasMember: bodyIndex === 0 ? [] : [{
|
|
33
|
+
reference: `urn:uuid:60081479-c0a1-4b9e-9c52-039cf80f45${groupIndex}-0`
|
|
34
|
+
}]
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
})).flat();
|
|
30
38
|
};
|
|
31
39
|
//# sourceMappingURL=generate-observation-entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["generateObservationEntry","groupedObservationBodies","provider","map","observationBodies","groupIndex","observationBody","bodyIndex","fullUrl","request","method","url","resource","identifier","system","value","device","hasMember","reference","flat"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/generate-observation-entry.ts"],"mappings":";;AASA,OAAO,MAAMA,wBAAwB,GAAGA,CAAC;EACvCC,wBAAwB;EACxBC;AAC6B,CAAC,KAAiC;EAC/D,OAAOD,wBAAwB,CAC5BE,GAAG,CAAC,CAACC,iBAAiB,EAAEC,UAAU,KACjCD,iBAAiB,CAACD,GAAG,CAAC,CAACG,eAAe,EAAEC,SAAS,
|
|
1
|
+
{"version":3,"names":["generateObservationEntry","groupedObservationBodies","provider","map","observationBodies","groupIndex","observationBody","bodyIndex","syncIdentifier","id","syncIdentifierSystem","fullUrl","request","method","url","ifNoneExist","encodeURIComponent","resource","identifier","system","value","device","hasMember","reference","flat"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/generate-observation-entry.ts"],"mappings":";;AASA,OAAO,MAAMA,wBAAwB,GAAGA,CAAC;EACvCC,wBAAwB;EACxBC;AAC6B,CAAC,KAAiC;EAC/D,OAAOD,wBAAwB,CAC5BE,GAAG,CAAC,CAACC,iBAAiB,EAAEC,UAAU,KACjCD,iBAAiB,CAACD,GAAG,CAAC,CAACG,eAAe,EAAEC,SAAS,KAAK;IACpD,MAAMC,cAAc,GAAG,GAAGN,QAAQ,IAAII,eAAe,CAACG,EAAE,IAAI,GAAGJ,UAAU,IAAIE,SAAS,EAAE,EAAE;IAE1F,MAAMG,oBAAoB,GACxB,mEAAmE;IAErE,OAAO;MACLC,OAAO,EAAE,8CAA8CN,UAAU,IAAIE,SAAS,EAAE;MAChFK,OAAO,EAAE;QACPC,MAAM,EAAE,MAAe;QACvBC,GAAG,EAAE,aAAa;QAClBC,WAAW,EAAE,cAAcC,kBAAkB,CAACN,oBAAoB,CAAC,IAAIM,kBAAkB,CAACR,cAAc,CAAC;MAC3G,CAAC;MACDS,QAAQ,EAAE;QACR,GAAGX,eAAe;QAClBY,UAAU,EAAE,CACV,IAAIZ,eAAe,CAACY,UAAU,IAAI,EAAE,CAAC,EACrC;UACEC,MAAM,EACJ,yEAAyE;UAC3EC,KAAK,EAAElB;QACT,CAAC,EACD;UACEiB,MAAM,EAAET,oBAAoB;UAC5BU,KAAK,EAAEZ;QACT,CAAC,CACF;QACDa,MAAM,EAAE;UACNH,UAAU,EAAE;YACVC,MAAM,EACJ,yEAAyE;YAC3EC,KAAK,EAAElB;UACT;QACF,CAAC;QACDoB,SAAS,EACPf,SAAS,KAAK,CAAC,GACX,EAAE,GACF,CACE;UACEgB,SAAS,EAAE,8CAA8ClB,UAAU;QACrE,CAAC;MAEX;IACF,CAAC;EACH,CAAC,CACH,CAAC,CACAmB,IAAI,CAAC,CAAC;AACX,CAAC","ignoreList":[]}
|
|
@@ -4,18 +4,29 @@ const RETRY_DELAYS_MS = [1000, 4000, 16000];
|
|
|
4
4
|
function asRecord(value) {
|
|
5
5
|
return typeof value === "object" && value !== null ? value : undefined;
|
|
6
6
|
}
|
|
7
|
+
const statusNumber = value => {
|
|
8
|
+
const parsed = typeof value === "string" ? Number.parseInt(value, 10) : Number(value);
|
|
9
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : undefined;
|
|
10
|
+
};
|
|
7
11
|
function getStatus(error) {
|
|
8
12
|
const record = asRecord(error);
|
|
9
13
|
const response = asRecord(record?.response);
|
|
10
|
-
const statuses = [record?.status, record?.statusCode, response?.status, ...(Array.isArray(record?.entry) ? record.entry.map(entry => asRecord(entry)?.response)
|
|
14
|
+
const statuses = [record?.status, record?.statusCode, response?.status, ...(Array.isArray(record?.entry) ? record.entry.map(entry => asRecord(asRecord(entry)?.response)?.status) : [])];
|
|
11
15
|
for (const status of statuses) {
|
|
12
|
-
const numberStatus =
|
|
13
|
-
if (
|
|
16
|
+
const numberStatus = statusNumber(status);
|
|
17
|
+
if (numberStatus !== undefined) {
|
|
14
18
|
return numberStatus;
|
|
15
19
|
}
|
|
16
20
|
}
|
|
17
21
|
return undefined;
|
|
18
22
|
}
|
|
23
|
+
class SyncRetryCancelledError extends Error {
|
|
24
|
+
constructor() {
|
|
25
|
+
super("Health sync retry cancelled");
|
|
26
|
+
this.name = "SyncRetryCancelledError";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const isSyncRetryCancelled = error => error instanceof SyncRetryCancelledError;
|
|
19
30
|
function getRetryAfterMs(error) {
|
|
20
31
|
const record = asRecord(error);
|
|
21
32
|
const response = asRecord(record?.response);
|
|
@@ -42,19 +53,40 @@ function isRetryableSyncError(error) {
|
|
|
42
53
|
function getSyncRetryDelayMs(error, retryIndex) {
|
|
43
54
|
return Math.max(RETRY_DELAYS_MS[retryIndex] ?? RETRY_DELAYS_MS.at(-1), getRetryAfterMs(error) ?? 0);
|
|
44
55
|
}
|
|
45
|
-
async function withSyncRetries(operation) {
|
|
56
|
+
async function withSyncRetries(operation, shouldCancel = () => false) {
|
|
46
57
|
for (let retryIndex = 0;; retryIndex += 1) {
|
|
47
58
|
try {
|
|
48
59
|
return await operation();
|
|
49
60
|
} catch (error) {
|
|
61
|
+
if (shouldCancel()) {
|
|
62
|
+
throw new SyncRetryCancelledError();
|
|
63
|
+
}
|
|
50
64
|
if (!isRetryableSyncError(error) || retryIndex >= RETRY_DELAYS_MS.length) {
|
|
51
65
|
throw error;
|
|
52
66
|
}
|
|
53
|
-
await new Promise(resolve => {
|
|
54
|
-
|
|
67
|
+
await new Promise((resolve, reject) => {
|
|
68
|
+
const timers = {};
|
|
69
|
+
timers.poll = setInterval(() => {
|
|
70
|
+
if (!shouldCancel()) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (timers.timer) {
|
|
74
|
+
clearTimeout(timers.timer);
|
|
75
|
+
}
|
|
76
|
+
if (timers.poll) {
|
|
77
|
+
clearInterval(timers.poll);
|
|
78
|
+
}
|
|
79
|
+
reject(new SyncRetryCancelledError());
|
|
80
|
+
}, 50);
|
|
81
|
+
timers.timer = setTimeout(() => {
|
|
82
|
+
if (timers.poll) {
|
|
83
|
+
clearInterval(timers.poll);
|
|
84
|
+
}
|
|
85
|
+
resolve();
|
|
86
|
+
}, getSyncRetryDelayMs(error, retryIndex));
|
|
55
87
|
});
|
|
56
88
|
}
|
|
57
89
|
}
|
|
58
90
|
}
|
|
59
|
-
export { getSyncRetryDelayMs, isRetryableSyncError, withSyncRetries };
|
|
91
|
+
export { getSyncRetryDelayMs, isRetryableSyncError, isSyncRetryCancelled, withSyncRetries };
|
|
60
92
|
//# sourceMappingURL=retry-save.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RETRY_DELAYS_MS","asRecord","value","undefined","getStatus","error","record","response","statuses","status","statusCode","Array","isArray","entry","map","numberStatus","
|
|
1
|
+
{"version":3,"names":["RETRY_DELAYS_MS","asRecord","value","undefined","statusNumber","parsed","Number","parseInt","isInteger","getStatus","error","record","response","statuses","status","statusCode","Array","isArray","entry","map","numberStatus","SyncRetryCancelledError","Error","constructor","name","isSyncRetryCancelled","getRetryAfterMs","retryAfter","retryAfterMs","headers","header","seconds","isFinite","isRetryableSyncError","message","String","TypeError","test","getSyncRetryDelayMs","retryIndex","Math","max","at","withSyncRetries","operation","shouldCancel","length","Promise","resolve","reject","timers","poll","setInterval","timer","clearTimeout","clearInterval","setTimeout"],"sourceRoot":"../../../../../src","sources":["modules/data-sync/utils/retry-save.ts"],"mappings":";;AAAA,MAAMA,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAU;AAIpD,SAASC,QAAQA,CAACC,KAAc,EAA2B;EACzD,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,GAC7CA,KAAK,GACNC,SAAS;AACf;AAEA,MAAMC,YAAY,GAAIF,KAAc,IAAyB;EAC3D,MAAMG,MAAM,GAAG,OAAOH,KAAK,KAAK,QAAQ,GAAGI,MAAM,CAACC,QAAQ,CAACL,KAAK,EAAE,EAAE,CAAC,GAAGI,MAAM,CAACJ,KAAK,CAAC;EAErF,OAAOI,MAAM,CAACE,SAAS,CAACH,MAAM,CAAC,IAAIA,MAAM,GAAG,CAAC,GAAGA,MAAM,GAAGF,SAAS;AACpE,CAAC;AAED,SAASM,SAASA,CAACC,KAAc,EAAsB;EACrD,MAAMC,MAAM,GAAGV,QAAQ,CAACS,KAAK,CAAC;EAC9B,MAAME,QAAQ,GAAGX,QAAQ,CAACU,MAAM,EAAEC,QAAQ,CAAC;EAE3C,MAAMC,QAAQ,GAAG,CACfF,MAAM,EAAEG,MAAM,EACdH,MAAM,EAAEI,UAAU,EAClBH,QAAQ,EAAEE,MAAM,EAChB,IAAIE,KAAK,CAACC,OAAO,CAACN,MAAM,EAAEO,KAAK,CAAC,GAC5BP,MAAM,CAACO,KAAK,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MAAM,CAACC,IAAI,GAAGC,WAAW,CAAC,MAAM;UAC9B,IAAI,CAACP,YAAY,CAAC,CAAC,EAAE;YACnB;UACF;UAEA,IAAIK,MAAM,CAACG,KAAK,EAAE;YAChBC,YAAY,CAACJ,MAAM,CAACG,KAAK,CAAC;UAC5B;UAEA,IAAIH,MAAM,CAACC,IAAI,EAAE;YACfI,aAAa,CAACL,MAAM,CAACC,IAAI,CAAC;UAC5B;UAEAF,MAAM,CAAC,IAAI5B,uBAAuB,CAAC,CAAC,CAAC;QACvC,CAAC,EAAE,EAAE,CAAC;QAEN6B,MAAM,CAACG,KAAK,GAAGG,UAAU,CAAC,MAAM;UAC9B,IAAIN,MAAM,CAACC,IAAI,EAAE;YACfI,aAAa,CAACL,MAAM,CAACC,IAAI,CAAC;UAC5B;UAEAH,OAAO,CAAC,CAAC;QACX,CAAC,EAAEV,mBAAmB,CAAC5B,KAAK,EAAE6B,UAAU,CAAC,CAAC;MAC5C,CAAC,CAAC;IACJ;EACF;AACF;AAEA,SAASD,mBAAmB,EAAEL,oBAAoB,EAAER,oBAAoB,EAAEkB,eAAe","ignoreList":[]}
|
|
@@ -5,7 +5,7 @@ export * from "./form-items/form-field.js";
|
|
|
5
5
|
export * from "./form-items/form-select.js";
|
|
6
6
|
export * from "./form-items/form-date-field.js";
|
|
7
7
|
export * from "./utils/s-log.js";
|
|
8
|
+
export { configureOvokLogger, ovokLogger } from "./utils/sentry-logger.js";
|
|
8
9
|
export * from "./utils/telemetry.js";
|
|
9
10
|
export * from "./utils/with-animated.js";
|
|
10
|
-
export { BottomSheetModalProvider } from "@gorhom/bottom-sheet";
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["configureOvokLogger","ovokLogger"],"sourceRoot":"../../../../src","sources":["modules/helpers/index.tsx"],"mappings":";;AAAA,cAAc,kBAAe;AAE7B,cAAc,4BAAyB;AAEvC,cAAc,6BAA0B;AAExC,cAAc,iCAA8B;AAE5C,cAAc,kBAAe;AAE7B,SACEA,mBAAmB,EACnBC,UAAU,QACL,0BAAuB;AAE9B,cAAc,sBAAmB;AAEjC,cAAc,0BAAuB","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable no-console */
|
|
4
4
|
/* eslint-disable import/group-exports */
|
|
5
5
|
|
|
6
|
-
import { emitOvokLog, recordOvokMetric
|
|
6
|
+
import { emitOvokLog, recordOvokMetric } from "./telemetry.js";
|
|
7
7
|
const consoleLogger = (level, message, extra = {}) => {
|
|
8
8
|
const method = level === "warning" ? "warn" : level === "trace" ? "debug" : level;
|
|
9
9
|
const log = method === "fatal" ? console.error : console[method] ?? console.log;
|
|
@@ -16,15 +16,14 @@ export const configureOvokLogger = logger => {
|
|
|
16
16
|
configuredLogger = logger;
|
|
17
17
|
};
|
|
18
18
|
export const ovokLogger = (type, message, extra = {}) => {
|
|
19
|
-
|
|
20
|
-
emitOvokLog(type, message, safeExtra);
|
|
19
|
+
emitOvokLog(type, message, extra);
|
|
21
20
|
if (type === "error" || type === "fatal") {
|
|
22
21
|
recordOvokMetric("ovok.errors", 1, {
|
|
23
22
|
errorCode: typeof extra.errorCode === "string" ? extra.errorCode : "unknown"
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
const logger = configuredLogger ?? consoleLogger;
|
|
27
|
-
logger(type, message,
|
|
26
|
+
logger(type, message, extra);
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
/** @deprecated Use ovokLogger. Kept as a source-compatible alias for existing apps. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["emitOvokLog","recordOvokMetric","
|
|
1
|
+
{"version":3,"names":["emitOvokLog","recordOvokMetric","consoleLogger","level","message","extra","method","log","console","error","configuredLogger","configureOvokLogger","logger","ovokLogger","type","errorCode","sentryLogger"],"sourceRoot":"../../../../../src","sources":["modules/helpers/utils/sentry-logger.ts"],"mappings":";;AAAA;AACA;;AAEA,SAASA,WAAW,EAAEC,gBAAgB,QAAQ,gBAAa;AAgB3D,MAAMC,aAAyB,GAAGA,CAACC,KAAK,EAAEC,OAAO,EAAEC,KAAK,GAAG,CAAC,CAAC,KAAK;EAChE,MAAMC,MAAM,GAAGH,KAAK,KAAK,SAAS,GAAG,MAAM,GAAGA,KAAK,KAAK,OAAO,GAAG,OAAO,GAAGA,KAAK;EAEjF,MAAMI,GAAG,GACPD,MAAM,KAAK,OAAO,GACdE,OAAO,CAACC,KAAK,GACbD,OAAO,CAACF,MAAM,CAAwC,IAAIE,OAAO,CAACD,GAAG;EAE3EA,GAAG,CAAC,UAAUH,OAAO,EAAE,EAAEC,KAAK,CAAC;AACjC,CAAC;AAED,IAAIK,gBAAwC;;AAE5C;AACA,OAAO,MAAMC,mBAAmB,GAAIC,MAAmB,IAAW;EAChEF,gBAAgB,GAAGE,MAAM;AAC3B,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGA,CACxBC,IAAkB,EAClBV,OAAe,EACfC,KAA8B,GAAG,CAAC,CAAC,KAChC;EACHL,WAAW,CAACc,IAAI,EAAEV,OAAO,EAAEC,KAAK,CAAC;EACjC,IAAIS,IAAI,KAAK,OAAO,IAAIA,IAAI,KAAK,OAAO,EAAE;IACxCb,gBAAgB,CAAC,aAAa,EAAE,CAAC,EAAE;MACjCc,SAAS,EAAE,OAAOV,KAAK,CAACU,SAAS,KAAK,QAAQ,GAAGV,KAAK,CAACU,SAAS,GAAG;IACrE,CAAC,CAAC;EACJ;EAEA,MAAMH,MAAM,GAAGF,gBAAgB,IAAIR,aAAa;EAEhDU,MAAM,CAACE,IAAI,EAAEV,OAAO,EAAEC,KAAK,CAAC;AAC9B,CAAC;;AAED;AACA,OAAO,MAAMW,YAAY,GAAGH,UAAU","ignoreList":[]}
|