react-native-rook-sdk 4.0.0 → 5.0.0-beta.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/LICENSE +1 -1
- package/README.md +35 -3
- package/RNRookSdk.podspec +22 -0
- package/android/build.gradle +21 -40
- package/android/gradle.properties +5 -5
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/rooksdk/RookSdkModule.kt +1709 -117
- package/android/src/main/java/com/rooksdk/RookSdkPackage.kt +26 -42
- package/android/src/main/java/com/rooksdk/broadcasts/AndroidPermissionsReceiverTransmitter.kt +34 -37
- package/android/src/main/java/com/rooksdk/broadcasts/HealthConnectPermissionsReceiverTransmitter.kt +8 -14
- package/android/src/main/java/com/rooksdk/broadcasts/SamsungHealthPermissionsReceiverTransmitter.kt +8 -16
- package/android/src/main/java/com/rooksdk/utils/{DatasourcesUtils.kt → DatasourceUtils.kt} +10 -9
- package/android/src/main/java/com/rooksdk/utils/{PermissionConversion.kt → PermissionConvertions.kt} +1 -1
- package/android/src/main/java/com/rooksdk/utils/ReadableToWritable.kt +0 -1
- package/android/src/main/java/com/rooksdk/utils/RookGsonBuilder.kt +3 -0
- package/android/src/main/java/com/rooksdk/utils/SamsungAvailability.kt +1 -0
- package/android/src/main/java/com/rooksdk/utils/serializers/InstantSerializer.kt +0 -1
- package/android/src/main/java/com/rooksdk/utils/serializers/ZoneDateTimeSerializer.kt +18 -0
- package/ios/DateHelper.swift +4 -4
- package/ios/Encodable.swift +25 -0
- package/ios/EncodableDataSource.swift +2 -3
- package/ios/EncodableDataSourceAuthorizer.swift +2 -3
- package/ios/EncodableSDKState.swift +3 -2
- package/ios/{EncodableHeartRate.swift → HearRateMapper.swift} +3 -3
- package/ios/NutritionMapper.swift +3 -3
- package/ios/RookBackground.swift +5 -8
- package/ios/RookConfiguration.swift +33 -30
- package/ios/{RookLocalData.swift → RookData.swift} +76 -69
- package/ios/RookEntry.swift +62 -0
- package/ios/RookPermissions.swift +36 -40
- package/ios/RookSdk-Bridging-Header.h +12 -0
- package/ios/RookSdk.h +3 -3
- package/ios/RookSdk.mm +390 -134
- package/ios/RookSources.swift +60 -54
- package/ios/RookSync.swift +48 -78
- package/ios/boost-boost_privacy-Bridging-Header.h +4 -0
- package/lib/{commonjs/types/AppleHealthPermissions.js → module/NativeRookSdk.js} +50 -6
- package/lib/module/NativeRookSdk.js.map +1 -0
- package/lib/module/context/RookSyncGateContext.js +2 -0
- package/lib/module/context/RookSyncGateContext.js.map +1 -1
- package/lib/module/context/RookSyncGateProvider.js +17 -18
- package/lib/module/context/RookSyncGateProvider.js.map +1 -1
- package/lib/module/context/RookSyncGateReducer.js +2 -0
- package/lib/module/context/RookSyncGateReducer.js.map +1 -1
- package/lib/module/context/RookSyncGateTypes.js +2 -0
- package/lib/module/hooks/useRookAPISources.js +10 -16
- package/lib/module/hooks/useRookAPISources.js.map +1 -1
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js +11 -12
- package/lib/module/hooks/useRookAndroidBackgroundSteps.js.map +1 -1
- package/lib/module/hooks/useRookAppleHealth.js +9 -10
- package/lib/module/hooks/useRookAppleHealth.js.map +1 -1
- package/lib/module/hooks/useRookConfiguration.js +17 -22
- package/lib/module/hooks/useRookConfiguration.js.map +1 -1
- package/lib/module/hooks/useRookData.js +33 -38
- package/lib/module/hooks/useRookData.js.map +1 -1
- package/lib/module/hooks/useRookHealthConnect.js +9 -10
- package/lib/module/hooks/useRookHealthConnect.js.map +1 -1
- package/lib/module/hooks/useRookPermissions.js +34 -45
- package/lib/module/hooks/useRookPermissions.js.map +1 -1
- package/lib/module/hooks/useRookSamsungHealth.js +8 -20
- package/lib/module/hooks/useRookSamsungHealth.js.map +1 -1
- package/lib/module/hooks/useRookSync.js +23 -32
- package/lib/module/hooks/useRookSync.js.map +1 -1
- package/lib/module/hooks/useRookVariables.js +26 -29
- package/lib/module/hooks/useRookVariables.js.map +1 -1
- package/lib/module/index.js +18 -10
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/components/RookStateManager.js +31 -0
- package/lib/module/modules/components/RookStateManager.js.map +1 -0
- package/lib/module/modules/hook/useRookAutoSync.js +24 -36
- package/lib/module/modules/hook/useRookAutoSync.js.map +1 -1
- package/lib/module/modules/hook/useRookEmitter.js +61 -0
- package/lib/module/modules/hook/useRookEmitter.js.map +1 -0
- package/lib/module/modules/types/sendMessageBroadcast.js +1 -1
- package/lib/module/modules/utils/errors.js +2 -0
- package/lib/module/modules/utils/errors.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types/ActivityEvent.js +2 -0
- package/lib/module/types/AppleHealthNutritionEvent.js +2 -0
- package/lib/module/types/AppleHealthNutritionEvent.js.map +1 -1
- package/lib/module/types/AppleHealthPermissions.js +2 -0
- package/lib/module/types/AppleHealthPermissions.js.map +1 -1
- package/lib/module/types/AuthorizedSources.js +2 -0
- package/lib/module/types/BodySummary.js +2 -0
- package/lib/module/types/DataSource.js +2 -0
- package/lib/module/types/DataSource.js.map +1 -1
- package/lib/module/types/HCMealData.js +3 -1
- package/lib/module/types/HCMealData.js.map +1 -1
- package/lib/module/types/HeartRateEvent.js +1 -1
- package/lib/module/types/PermissionsType.js +1 -1
- package/lib/module/types/PhysicalSummary.js +2 -0
- package/lib/module/types/Rook.js +2 -0
- package/lib/{commonjs/types/BodySummary.js.map → module/types/Rook.js.map} +1 -1
- package/lib/module/types/SDKSources.js +2 -0
- package/lib/module/types/SDKSources.js.map +1 -1
- package/lib/module/types/SamsungHealthPermissions.js +3 -0
- package/lib/module/types/SamsungHealthPermissions.js.map +1 -1
- package/lib/module/types/SleepSummary.js +2 -0
- package/lib/module/types/SummaryTypes.js +1 -1
- package/lib/module/types/SyncTypes.js +2 -0
- package/lib/module/types/SyncTypes.js.map +1 -1
- package/lib/module/types/WriteNutrition.js +2 -0
- package/lib/module/types/WriteNutrition.js.map +1 -1
- package/lib/module/utils/isModuleReady.js +2 -0
- package/lib/module/utils/isModuleReady.js.map +1 -1
- package/lib/module/utils/isRunningOnAndroid.js +2 -0
- package/lib/module/utils/isRunningOnAndroid.js.map +1 -1
- package/lib/module/utils/isRunningOniOS.js +2 -0
- package/lib/module/utils/isRunningOniOS.js.map +1 -1
- package/lib/module/utils/isValidDate.js +2 -0
- package/lib/module/utils/isValidDate.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeRookSdk.d.ts +705 -0
- package/lib/typescript/src/NativeRookSdk.d.ts.map +1 -0
- package/lib/typescript/src/context/RookSyncGateContext.d.ts.map +1 -1
- package/lib/typescript/src/context/RookSyncGateProvider.d.ts.map +1 -1
- package/lib/typescript/src/context/RookSyncGateReducer.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAPISources.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAndroidBackgroundSteps.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookAppleHealth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookConfiguration.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookData.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookData.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookHealthConnect.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookPermissions.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookPermissions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts +0 -6
- package/lib/typescript/src/hooks/useRookSamsungHealth.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookSync.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useRookVariables.d.ts +1 -1
- package/lib/typescript/src/hooks/useRookVariables.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +18 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/modules/components/RookStateManager.d.ts +10 -0
- package/lib/typescript/src/modules/components/RookStateManager.d.ts.map +1 -0
- package/lib/typescript/src/modules/hook/useRookAutoSync.d.ts.map +1 -1
- package/lib/typescript/src/modules/hook/useRookEmitter.d.ts +4 -0
- package/lib/typescript/src/modules/hook/useRookEmitter.d.ts.map +1 -0
- package/lib/typescript/src/types/AppleHealthNutritionEvent.d.ts.map +1 -1
- package/lib/typescript/src/types/AuthorizedSources.d.ts +11 -0
- package/lib/typescript/src/types/AuthorizedSources.d.ts.map +1 -1
- package/lib/typescript/src/types/HCMealData.d.ts.map +1 -1
- package/lib/typescript/src/types/HeartRateEvent.d.ts +2 -2
- package/lib/typescript/src/types/HeartRateEvent.d.ts.map +1 -1
- package/lib/typescript/src/types/Rook.d.ts +9 -0
- package/lib/typescript/src/types/Rook.d.ts.map +1 -0
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts +1 -0
- package/lib/typescript/src/types/SamsungHealthPermissions.d.ts.map +1 -1
- package/lib/typescript/src/types/SyncTypes.d.ts +5 -1
- package/lib/typescript/src/types/SyncTypes.d.ts.map +1 -1
- package/lib/typescript/src/utils/isModuleReady.d.ts.map +1 -1
- package/lib/typescript/src/utils/isValidDate.d.ts.map +1 -1
- package/package.json +94 -98
- package/src/NativeRookSdk.ts +839 -0
- package/{lib/commonjs/context/RookSyncGateContext.js → src/context/RookSyncGateContext.ts} +10 -13
- package/src/context/RookSyncGateProvider.tsx +82 -0
- package/{lib/commonjs/context/RookSyncGateReducer.js → src/context/RookSyncGateReducer.ts} +14 -41
- package/src/context/RookSyncGateTypes.ts +40 -0
- package/{lib/commonjs/hooks/useRookAPISources.js → src/hooks/useRookAPISources.ts} +40 -36
- package/src/hooks/useRookAndroidBackgroundSteps.ts +81 -0
- package/src/hooks/useRookAppleHealth.ts +55 -0
- package/src/hooks/useRookConfiguration.ts +106 -0
- package/src/hooks/useRookData.ts +133 -0
- package/src/hooks/useRookHealthConnect.ts +59 -0
- package/src/hooks/useRookPermissions.ts +240 -0
- package/src/hooks/useRookSamsungHealth.ts +37 -0
- package/src/hooks/useRookSync.ts +157 -0
- package/src/hooks/useRookVariables.ts +98 -0
- package/src/index.tsx +29 -0
- package/src/modules/components/RookStateManager.tsx +41 -0
- package/{lib/commonjs/modules/hook/useRookAutoSync.js → src/modules/hook/useRookAutoSync.ts} +141 -95
- package/src/modules/hook/useRookEmitter.ts +94 -0
- package/src/modules/types/sendMessageBroadcast.ts +5 -0
- package/src/modules/utils/errors.ts +9 -0
- package/src/types/ActivityEvent.ts +159 -0
- package/src/types/AppleHealthNutritionEvent.ts +142 -0
- package/src/types/AppleHealthPermissions.ts +49 -0
- package/src/types/AuthorizedSources.ts +33 -0
- package/src/types/BodySummary.ts +116 -0
- package/src/types/DataSource.ts +16 -0
- package/{lib/commonjs/types/HCMealData.js → src/types/HCMealData.ts} +60 -11
- package/src/types/HeartRateEvent.ts +26 -0
- package/src/types/PermissionsType.ts +9 -0
- package/src/types/PhysicalSummary.ts +84 -0
- package/src/types/Rook.ts +8 -0
- package/src/types/SDKSources.ts +5 -0
- package/src/types/SamsungHealthPermissions.ts +16 -0
- package/src/types/SleepSummary.ts +66 -0
- package/src/types/SummaryTypes.ts +70 -0
- package/src/types/SyncTypes.ts +63 -0
- package/src/types/WriteNutrition.ts +66 -0
- package/{lib/commonjs/utils/isModuleReady.js → src/utils/isModuleReady.ts} +4 -10
- package/src/utils/isRunningOnAndroid.ts +10 -0
- package/src/utils/isRunningOniOS.ts +10 -0
- package/{lib/commonjs/utils/isValidDate.js → src/utils/isValidDate.ts} +12 -14
- package/android/src/main/AndroidManifestNew.xml +0 -36
- package/android/src/main/java/com/rooksdk/modules/RookBackgroundSyncModule.kt +0 -99
- package/android/src/main/java/com/rooksdk/modules/RookConfigurationModule.kt +0 -182
- package/android/src/main/java/com/rooksdk/modules/RookLocalData.kt +0 -301
- package/android/src/main/java/com/rooksdk/modules/RookPermissionsModule.kt +0 -359
- package/android/src/main/java/com/rooksdk/modules/RookSourcesModule.kt +0 -102
- package/android/src/main/java/com/rooksdk/modules/RookStepsModule.kt +0 -119
- package/android/src/main/java/com/rooksdk/modules/RookSyncModule.kt +0 -551
- package/android/src/main/res/drawable/ic_health_connect.xml +0 -19
- package/android/src/main/res/values/themes.xml +0 -3
- package/ios/EncodableRookDataSource.swift +0 -36
- package/ios/EncodableStatusDataSources.swift +0 -47
- package/ios/RookBackgroundModule.h +0 -5
- package/ios/RookBackgroundModule.mm +0 -15
- package/ios/RookConfigurationModule.h +0 -5
- package/ios/RookConfigurationModule.mm +0 -22
- package/ios/RookExternalModule.h +0 -5
- package/ios/RookExternalModule.m +0 -31
- package/ios/RookPermissionsModule.h +0 -5
- package/ios/RookPermissionsModule.mm +0 -20
- package/ios/RookSourcesModule.h +0 -5
- package/ios/RookSourcesModule.mm +0 -18
- package/ios/RookSync.h +0 -5
- package/ios/RookSync.m +0 -35
- package/ios/SwiftTest.swift +0 -18
- package/ios/react-native-rook-sdk-Bridging-Header.h +0 -12
- package/lib/commonjs/context/RookSyncGateContext.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateProvider.js +0 -108
- package/lib/commonjs/context/RookSyncGateProvider.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateReducer.js.map +0 -1
- package/lib/commonjs/context/RookSyncGateTypes.js +0 -6
- package/lib/commonjs/context/RookSyncGateTypes.js.map +0 -1
- package/lib/commonjs/context/index.js +0 -14
- package/lib/commonjs/context/index.js.map +0 -1
- package/lib/commonjs/hooks/index.js +0 -76
- package/lib/commonjs/hooks/index.js.map +0 -1
- package/lib/commonjs/hooks/useRookAPISources.js.map +0 -1
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js +0 -88
- package/lib/commonjs/hooks/useRookAndroidBackgroundSteps.js.map +0 -1
- package/lib/commonjs/hooks/useRookAppleHealth.js +0 -63
- package/lib/commonjs/hooks/useRookAppleHealth.js.map +0 -1
- package/lib/commonjs/hooks/useRookConfiguration.js +0 -113
- package/lib/commonjs/hooks/useRookConfiguration.js.map +0 -1
- package/lib/commonjs/hooks/useRookData.js +0 -116
- package/lib/commonjs/hooks/useRookData.js.map +0 -1
- package/lib/commonjs/hooks/useRookHealthConnect.js +0 -70
- package/lib/commonjs/hooks/useRookHealthConnect.js.map +0 -1
- package/lib/commonjs/hooks/useRookPermissions.js +0 -211
- package/lib/commonjs/hooks/useRookPermissions.js.map +0 -1
- package/lib/commonjs/hooks/useRookSamsungHealth.js +0 -54
- package/lib/commonjs/hooks/useRookSamsungHealth.js.map +0 -1
- package/lib/commonjs/hooks/useRookSync.js +0 -148
- package/lib/commonjs/hooks/useRookSync.js.map +0 -1
- package/lib/commonjs/hooks/useRookVariables.js +0 -93
- package/lib/commonjs/hooks/useRookVariables.js.map +0 -1
- package/lib/commonjs/index.js +0 -121
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/modules/hook/useRookAutoSync.js.map +0 -1
- package/lib/commonjs/modules/types/sendMessageBroadcast.js +0 -2
- package/lib/commonjs/modules/types/sendMessageBroadcast.js.map +0 -1
- package/lib/commonjs/modules/utils/errors.js +0 -12
- package/lib/commonjs/modules/utils/errors.js.map +0 -1
- package/lib/commonjs/types/ActivityEvent.js +0 -6
- package/lib/commonjs/types/ActivityEvent.js.map +0 -1
- package/lib/commonjs/types/AppleHealthNutritionEvent.js +0 -77
- package/lib/commonjs/types/AppleHealthNutritionEvent.js.map +0 -1
- package/lib/commonjs/types/AppleHealthPermissions.js.map +0 -1
- package/lib/commonjs/types/AuthorizedSources.js +0 -6
- package/lib/commonjs/types/AuthorizedSources.js.map +0 -1
- package/lib/commonjs/types/BodySummary.js +0 -6
- package/lib/commonjs/types/DataSource.js +0 -16
- package/lib/commonjs/types/DataSource.js.map +0 -1
- package/lib/commonjs/types/DiagnosticState.js +0 -2
- package/lib/commonjs/types/DiagnosticState.js.map +0 -1
- package/lib/commonjs/types/HCMealData.js.map +0 -1
- package/lib/commonjs/types/HeartRateEvent.js +0 -2
- package/lib/commonjs/types/HeartRateEvent.js.map +0 -1
- package/lib/commonjs/types/PermissionsType.js +0 -2
- package/lib/commonjs/types/PermissionsType.js.map +0 -1
- package/lib/commonjs/types/PhysicalSummary.js +0 -6
- package/lib/commonjs/types/PhysicalSummary.js.map +0 -1
- package/lib/commonjs/types/SDKSources.js +0 -13
- package/lib/commonjs/types/SDKSources.js.map +0 -1
- package/lib/commonjs/types/SamsungHealthPermissions.js +0 -23
- package/lib/commonjs/types/SamsungHealthPermissions.js.map +0 -1
- package/lib/commonjs/types/SleepSummary.js +0 -6
- package/lib/commonjs/types/SleepSummary.js.map +0 -1
- package/lib/commonjs/types/SummaryTypes.js +0 -2
- package/lib/commonjs/types/SummaryTypes.js.map +0 -1
- package/lib/commonjs/types/SyncTypes.js +0 -33
- package/lib/commonjs/types/SyncTypes.js.map +0 -1
- package/lib/commonjs/types/WriteNutrition.js +0 -18
- package/lib/commonjs/types/WriteNutrition.js.map +0 -1
- package/lib/commonjs/utils/getNativeModule.js +0 -29
- package/lib/commonjs/utils/getNativeModule.js.map +0 -1
- package/lib/commonjs/utils/getRookModule.js +0 -28
- package/lib/commonjs/utils/getRookModule.js.map +0 -1
- package/lib/commonjs/utils/isModuleReady.js.map +0 -1
- package/lib/commonjs/utils/isRunningOnAndroid.js +0 -15
- package/lib/commonjs/utils/isRunningOnAndroid.js.map +0 -1
- package/lib/commonjs/utils/isRunningOniOS.js +0 -15
- package/lib/commonjs/utils/isRunningOniOS.js.map +0 -1
- package/lib/commonjs/utils/isValidDate.js.map +0 -1
- package/lib/commonjs/utils/nativeModules.js +0 -29
- package/lib/commonjs/utils/nativeModules.js.map +0 -1
- package/lib/commonjs/utils/packageInfo.js +0 -13
- package/lib/commonjs/utils/packageInfo.js.map +0 -1
- package/lib/module/context/index.js +0 -2
- package/lib/module/context/index.js.map +0 -1
- package/lib/module/hooks/index.js +0 -11
- package/lib/module/hooks/index.js.map +0 -1
- package/lib/module/types/DiagnosticState.js +0 -2
- package/lib/module/types/DiagnosticState.js.map +0 -1
- package/lib/module/utils/getNativeModule.js +0 -23
- package/lib/module/utils/getNativeModule.js.map +0 -1
- package/lib/module/utils/getRookModule.js +0 -22
- package/lib/module/utils/getRookModule.js.map +0 -1
- package/lib/module/utils/nativeModules.js +0 -23
- package/lib/module/utils/nativeModules.js.map +0 -1
- package/lib/module/utils/packageInfo.js +0 -7
- package/lib/module/utils/packageInfo.js.map +0 -1
- package/lib/typescript/src/context/index.d.ts +0 -2
- package/lib/typescript/src/context/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -11
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/types/DiagnosticState.d.ts +0 -13
- package/lib/typescript/src/types/DiagnosticState.d.ts.map +0 -1
- package/lib/typescript/src/utils/getNativeModule.d.ts +0 -10
- package/lib/typescript/src/utils/getNativeModule.d.ts.map +0 -1
- package/lib/typescript/src/utils/getRookModule.d.ts +0 -9
- package/lib/typescript/src/utils/getRookModule.d.ts.map +0 -1
- package/lib/typescript/src/utils/nativeModules.d.ts +0 -24
- package/lib/typescript/src/utils/nativeModules.d.ts.map +0 -1
- package/lib/typescript/src/utils/packageInfo.d.ts +0 -6
- package/lib/typescript/src/utils/packageInfo.d.ts.map +0 -1
- package/react-native-rook-sdk.podspec +0 -45
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActivityLevelGranularData,
|
|
3
|
+
ElevationGranularData,
|
|
4
|
+
FloorsClimbedGranularData,
|
|
5
|
+
HrGranularData,
|
|
6
|
+
HrvRmssdGranularData,
|
|
7
|
+
HrvSdnnGranularData,
|
|
8
|
+
SaturationGranularData,
|
|
9
|
+
StepsGranularData,
|
|
10
|
+
SwimmingDistanceGranularData,
|
|
11
|
+
TraveledDistanceGranularData,
|
|
12
|
+
Vo2GranularData,
|
|
13
|
+
} from './SummaryTypes';
|
|
14
|
+
|
|
15
|
+
export interface SpeedGranularData {
|
|
16
|
+
dateTime: string;
|
|
17
|
+
intervalDurationSeconds: number;
|
|
18
|
+
speedMetersPerSecond: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface VelocityObject {
|
|
22
|
+
speedMetersPerSecond: number;
|
|
23
|
+
direction: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CadenceGranularData {
|
|
27
|
+
dateTime: string;
|
|
28
|
+
intervalDurationSeconds: number;
|
|
29
|
+
cadenceRpm: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface TorqueGranularData {
|
|
33
|
+
dateTime: string;
|
|
34
|
+
intervalDurationSeconds: number;
|
|
35
|
+
torqueNewtonMeters: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface LapGranularData {
|
|
39
|
+
dateTime: string;
|
|
40
|
+
intervalDurationSeconds: number;
|
|
41
|
+
laps: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface PositionObject {
|
|
45
|
+
latDeg: number;
|
|
46
|
+
lngDeg: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface PositionGranularData {
|
|
50
|
+
dateTime: string;
|
|
51
|
+
intervalDurationSeconds: number;
|
|
52
|
+
latDeg: number;
|
|
53
|
+
lngDeg: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface PowerGranularData {
|
|
57
|
+
dateTime: string;
|
|
58
|
+
intervalDurationSeconds: number;
|
|
59
|
+
powerWatts: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface TssGranularData {
|
|
63
|
+
dateTime: string;
|
|
64
|
+
intervalDurationSeconds: number;
|
|
65
|
+
tssScore: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// --- Interfaz SHActivityEvent Completa ---
|
|
69
|
+
export interface ActivityEvent {
|
|
70
|
+
dateTime: string;
|
|
71
|
+
sourceOfData: string;
|
|
72
|
+
wasTheUserUnderPhysicalActivity: boolean;
|
|
73
|
+
activityStartDateTime: string;
|
|
74
|
+
activityEndDateTime: string;
|
|
75
|
+
activityDurationSeconds: number;
|
|
76
|
+
activityTypeName: string;
|
|
77
|
+
activeSeconds: number | null;
|
|
78
|
+
restSeconds: number | null;
|
|
79
|
+
lowIntensitySeconds: number | null;
|
|
80
|
+
moderateIntensitySeconds: number | null;
|
|
81
|
+
vigorousIntensitySeconds: number | null;
|
|
82
|
+
inactivitySeconds: number | null;
|
|
83
|
+
activityLevelGranularData: ActivityLevelGranularData[] | null;
|
|
84
|
+
continuousInactivePeriods: number | null;
|
|
85
|
+
activityStrainLevel: number | null;
|
|
86
|
+
activityWorkKilojoules: number | null;
|
|
87
|
+
activityEnergyKilojoules: number | null;
|
|
88
|
+
activityEnergyPlannedKilojoules: number | null;
|
|
89
|
+
caloriesNetIntakeKcal: number | null;
|
|
90
|
+
caloriesExpenditureKcal: number | null;
|
|
91
|
+
caloriesNetActiveKcal: number | null;
|
|
92
|
+
caloriesBasalMetabolicRateKcal: number | null;
|
|
93
|
+
fatPercentageOfCalories: number | null;
|
|
94
|
+
carbohydratePercentageOfCalories: number | null;
|
|
95
|
+
proteinPercentageOfCalories: number | null;
|
|
96
|
+
steps: number | null;
|
|
97
|
+
stepsGranularData: StepsGranularData[] | null;
|
|
98
|
+
walkedDistanceMeters: number | null;
|
|
99
|
+
traveledDistanceMeters: number | null;
|
|
100
|
+
traveledDistanceGranularData: TraveledDistanceGranularData[] | null;
|
|
101
|
+
floorsClimbed: number | null;
|
|
102
|
+
floorsClimbedGranularData: FloorsClimbedGranularData[] | null;
|
|
103
|
+
elevationAvgAltitudeMeters: number | null;
|
|
104
|
+
elevationMinimumAltitudeMeters: number | null;
|
|
105
|
+
elevationMaximumAltitudeMeters: number | null;
|
|
106
|
+
elevationLossActualAltitudeMeters: number | null;
|
|
107
|
+
elevationGainActualAltitudeMeters: number | null;
|
|
108
|
+
elevationPlannedGainMeters: number | null;
|
|
109
|
+
elevationGranularData: ElevationGranularData[] | null;
|
|
110
|
+
swimmingNumStrokes: number | null;
|
|
111
|
+
swimmingNumLaps: number | null;
|
|
112
|
+
swimmingPoolLengthMeters: number | null;
|
|
113
|
+
swimmingTotalDistanceMeters: number | null;
|
|
114
|
+
swimmingDistanceGranularData: SwimmingDistanceGranularData[] | null;
|
|
115
|
+
hrMaximumBpm: number | null;
|
|
116
|
+
hrMinimumBpm: number | null;
|
|
117
|
+
hrAvgBpm: number | null;
|
|
118
|
+
hrRestingBpm: number | null;
|
|
119
|
+
hrGranularData: HrGranularData[] | null;
|
|
120
|
+
hrvAvgRmssd: number | null;
|
|
121
|
+
hrvAvgSdnn: number | null;
|
|
122
|
+
hrvSdnnGranularData: HrvSdnnGranularData[] | null;
|
|
123
|
+
hrvRmssdGranularData: HrvRmssdGranularData[] | null;
|
|
124
|
+
speedNormalizedMetersPerSecond: number | null;
|
|
125
|
+
speedAvgMetersPerSecond: number | null;
|
|
126
|
+
speedMaximumMetersPerSecond: number | null;
|
|
127
|
+
speedGranularData: SpeedGranularData[] | null;
|
|
128
|
+
velocityAvg: VelocityObject | null;
|
|
129
|
+
velocityMaximum: VelocityObject | null;
|
|
130
|
+
paceAvgMinPerKm: number | null;
|
|
131
|
+
paceMaximumMinPerKm: number | null;
|
|
132
|
+
cadenceAvgRpm: number | null;
|
|
133
|
+
cadenceMaximumRpm: number | null;
|
|
134
|
+
cadenceGranularData: CadenceGranularData[] | null;
|
|
135
|
+
torqueAvgNewtonMeters: number | null;
|
|
136
|
+
torqueMaximumNewtonMeters: number | null;
|
|
137
|
+
torqueGranularData: TorqueGranularData[] | null;
|
|
138
|
+
lapGranularData: LapGranularData[] | null;
|
|
139
|
+
saturationAvgPercentage: number | null;
|
|
140
|
+
saturationGranularData: SaturationGranularData[] | null;
|
|
141
|
+
vo2MaxMlPerMinPerKg: number | null;
|
|
142
|
+
vo2GranularData: Vo2GranularData[] | null;
|
|
143
|
+
positionStart: PositionObject | null;
|
|
144
|
+
positionCentroid: PositionObject | null;
|
|
145
|
+
positionEnd: PositionObject | null;
|
|
146
|
+
positionGranularData: PositionGranularData[] | null;
|
|
147
|
+
positionPolylineMapDataSummary: string | null;
|
|
148
|
+
powerAvgWatts: number | null;
|
|
149
|
+
powerMaximumWatts: number | null;
|
|
150
|
+
powerGranularData: PowerGranularData[] | null;
|
|
151
|
+
stressAtRestDurationSeconds: number | null;
|
|
152
|
+
stressDurationSeconds: number | null;
|
|
153
|
+
lowStressDurationSeconds: number | null;
|
|
154
|
+
mediumStressDurationSeconds: number | null;
|
|
155
|
+
highStressDurationSeconds: number | null;
|
|
156
|
+
tssGranularData: TssGranularData[] | null;
|
|
157
|
+
stressAvgLevel: number | null;
|
|
158
|
+
stressMaximumLevel: number | null;
|
|
159
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { WriteNutrition } from './WriteNutrition';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the unit of measurement for nutrition.
|
|
5
|
+
* Map these integers to your SDK's unit requirements (e.g., Grams, Calories).
|
|
6
|
+
*/
|
|
7
|
+
export interface NutritionInsertionEventQuantity {
|
|
8
|
+
unit: number;
|
|
9
|
+
amount: number;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface NutritionInsertionEnergyWaterDataRelated {
|
|
13
|
+
dietaryKiloCaloriesEnergyConsumed?: number;
|
|
14
|
+
dietaryMilliLiterWater?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface NutritionCarbohydratesDataRelated {
|
|
18
|
+
dietaryGramCarbohydrates?: number;
|
|
19
|
+
dietaryGramFiber?: number;
|
|
20
|
+
dietaryGramSugar?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface NutritionFatsDataRelated {
|
|
24
|
+
dietaryGramFatTotal?: number;
|
|
25
|
+
dietaryGramFatSaturated?: number;
|
|
26
|
+
dietaryGramFatMonounsaturated?: number;
|
|
27
|
+
dietaryGramFatPolyunsaturated?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface NutritionProteinDataRelated {
|
|
31
|
+
dietaryGramProtein?: number;
|
|
32
|
+
dietaryMilliGramCholesterol?: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface NutritionVitaminsDataRelated {
|
|
36
|
+
dietaryMicroGramVitaminA?: number;
|
|
37
|
+
dietaryMilliGramVitaminB6?: number;
|
|
38
|
+
dietaryMicroGramVitaminB12?: number;
|
|
39
|
+
dietaryMilliGramVitaminC?: number;
|
|
40
|
+
dietaryMicroGramVitaminD?: number;
|
|
41
|
+
dietaryMilliGramVitaminE?: number;
|
|
42
|
+
dietaryMicroGramVitaminK?: number;
|
|
43
|
+
dietaryMilliGramThiamin?: number;
|
|
44
|
+
dietaryMilliGramRiboflavin?: number;
|
|
45
|
+
dietaryMilliGramNiacin?: number;
|
|
46
|
+
dietaryMilliGramPantothenicAcid?: number;
|
|
47
|
+
dietaryMicroGramFolate?: number;
|
|
48
|
+
dietaryMicroGramBiotin?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface NutritionMineralDataRelated {
|
|
52
|
+
dietaryMilliGramsCalcium?: number;
|
|
53
|
+
dietaryMilliGramsChloride?: number;
|
|
54
|
+
dietaryMilliGramsChromium?: number;
|
|
55
|
+
dietaryMilliGramsCopper?: number;
|
|
56
|
+
dietaryMilliGramsIodine?: number;
|
|
57
|
+
dietaryMilliGramsIron?: number;
|
|
58
|
+
dietaryMilliGramsMagnesium?: number;
|
|
59
|
+
dietaryMilliGramsManganese?: number;
|
|
60
|
+
dietaryMilliGramsMolybdenum?: number;
|
|
61
|
+
dietaryMilliGramsPhosphorus?: number;
|
|
62
|
+
dietaryMilliGramsPotassium?: number;
|
|
63
|
+
dietaryMilliGramsSelenium?: number;
|
|
64
|
+
dietaryMilliGramsSodium?: number;
|
|
65
|
+
dietaryMilliGramsZinc?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Main Interface for Apple Health Nutrition Insertion
|
|
70
|
+
*/
|
|
71
|
+
export interface AHNutritionInsertionEvent {
|
|
72
|
+
name: string;
|
|
73
|
+
quantity: NutritionInsertionEventQuantity;
|
|
74
|
+
/** ISO-8601 string (e.g., new Date().toISOString()) */
|
|
75
|
+
date: string;
|
|
76
|
+
energyWaterData?: NutritionInsertionEnergyWaterDataRelated;
|
|
77
|
+
carbohydratesData?: NutritionCarbohydratesDataRelated;
|
|
78
|
+
fatsData?: NutritionFatsDataRelated;
|
|
79
|
+
proteinData?: NutritionProteinDataRelated;
|
|
80
|
+
vitaminsData?: NutritionVitaminsDataRelated;
|
|
81
|
+
mineralData?: NutritionMineralDataRelated;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const parseWriteNutritionToAH = (
|
|
85
|
+
data: WriteNutrition
|
|
86
|
+
): AHNutritionInsertionEvent => {
|
|
87
|
+
return {
|
|
88
|
+
name: data.name,
|
|
89
|
+
date: data.date,
|
|
90
|
+
quantity: { unit: data.unit ?? 1, amount: data.amount ?? 0 },
|
|
91
|
+
energyWaterData: {
|
|
92
|
+
dietaryKiloCaloriesEnergyConsumed: data.calories,
|
|
93
|
+
dietaryMilliLiterWater: data.water,
|
|
94
|
+
},
|
|
95
|
+
carbohydratesData: {
|
|
96
|
+
dietaryGramCarbohydrates: data.totalCarbohydrates,
|
|
97
|
+
dietaryGramFiber: data.dietaryFiber,
|
|
98
|
+
dietaryGramSugar: data.sugar,
|
|
99
|
+
},
|
|
100
|
+
fatsData: {
|
|
101
|
+
dietaryGramFatTotal: data.totalFat,
|
|
102
|
+
dietaryGramFatSaturated: data.saturatedFat,
|
|
103
|
+
dietaryGramFatMonounsaturated: data.monounsaturatedFat,
|
|
104
|
+
dietaryGramFatPolyunsaturated: data.polyunsaturatedFat,
|
|
105
|
+
},
|
|
106
|
+
proteinData: {
|
|
107
|
+
dietaryGramProtein: data.protein,
|
|
108
|
+
dietaryMilliGramCholesterol: data.cholesterol,
|
|
109
|
+
},
|
|
110
|
+
vitaminsData: {
|
|
111
|
+
dietaryMicroGramVitaminA: data.vitaminA,
|
|
112
|
+
dietaryMilliGramVitaminB6: data.vitaminB6,
|
|
113
|
+
dietaryMicroGramVitaminB12: data.vitaminB12,
|
|
114
|
+
dietaryMilliGramVitaminC: data.vitaminC,
|
|
115
|
+
dietaryMicroGramVitaminD: data.vitaminD,
|
|
116
|
+
dietaryMilliGramVitaminE: data.vitaminE,
|
|
117
|
+
dietaryMicroGramVitaminK: data.vitaminK,
|
|
118
|
+
dietaryMilliGramThiamin: data.thiamin,
|
|
119
|
+
dietaryMilliGramRiboflavin: data.riboflavin,
|
|
120
|
+
dietaryMilliGramNiacin: data.niacin,
|
|
121
|
+
dietaryMilliGramPantothenicAcid: data.pantothenicAcid,
|
|
122
|
+
dietaryMicroGramFolate: data.folate,
|
|
123
|
+
dietaryMicroGramBiotin: data.biotin,
|
|
124
|
+
},
|
|
125
|
+
mineralData: {
|
|
126
|
+
dietaryMilliGramsCalcium: data.calcium,
|
|
127
|
+
dietaryMilliGramsChloride: data.chloride,
|
|
128
|
+
dietaryMilliGramsChromium: data.chromium,
|
|
129
|
+
dietaryMilliGramsCopper: data.copper,
|
|
130
|
+
dietaryMilliGramsIodine: data.iodine,
|
|
131
|
+
dietaryMilliGramsIron: data.iron,
|
|
132
|
+
dietaryMilliGramsMagnesium: data.magnesium,
|
|
133
|
+
dietaryMilliGramsManganese: data.manganese,
|
|
134
|
+
dietaryMilliGramsMolybdenum: data.molybdenum,
|
|
135
|
+
dietaryMilliGramsPhosphorus: data.phosphorus,
|
|
136
|
+
dietaryMilliGramsPotassium: data.potassium,
|
|
137
|
+
dietaryMilliGramsSelenium: data.selenium,
|
|
138
|
+
dietaryMilliGramsSodium: data.sodium,
|
|
139
|
+
dietaryMilliGramsZinc: data.zinc,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export enum AppleHealthPermission {
|
|
2
|
+
APPLE_EXERCISE_TIME = 'appleExerciseTime',
|
|
3
|
+
APPLE_MOVE_TIME = 'appleMoveTime',
|
|
4
|
+
APPLE_STAND_TIME = 'appleStandTime',
|
|
5
|
+
BASAL_ENERGY_BURNED = 'basalEnergyBurned',
|
|
6
|
+
ACTIVE_ENERGY_BURNED = 'activeEnergyBurned',
|
|
7
|
+
STEP_COUNT = 'stepCount',
|
|
8
|
+
DISTANCE_CYCLING = 'distanceCycling',
|
|
9
|
+
DISTANCE_WALKING_RUNNING = 'distanceWalkingRunning',
|
|
10
|
+
DISTANCE_SWIMMING = 'distanceSwimming',
|
|
11
|
+
SWIMMING_STROKE_COUNT = 'swimmingStrokeCount',
|
|
12
|
+
FLIGHTS_CLIMBED = 'flightsClimbed',
|
|
13
|
+
WALKING_SPEED = 'walkingSpeed',
|
|
14
|
+
WALKING_STEP_LENGTH = 'walkingStepLength',
|
|
15
|
+
RUNNING_POWER = 'runningPower',
|
|
16
|
+
RUNNING_SPEED = 'runningSpeed',
|
|
17
|
+
HEIGHT = 'height',
|
|
18
|
+
BODY_MASS = 'bodyMass',
|
|
19
|
+
BODY_MASS_INDEX = 'bodyMassIndex',
|
|
20
|
+
WAIST_CIRCUMFERENCE = 'waistCircumference',
|
|
21
|
+
BODY_FAT_PERCENTAGE = 'bodyFatPercentage',
|
|
22
|
+
BODY_TEMPERATURE = 'bodyTemperature',
|
|
23
|
+
BASAL_BODY_TEMPERATURE = 'basalBodyTemperature',
|
|
24
|
+
APPLE_SLEEPING_WRIST_TEMPERATURE = 'appleSleepingWristTemperature',
|
|
25
|
+
HEART_RATE = 'heartRate',
|
|
26
|
+
RESTING_HEART_RATE = 'restingHeartRate',
|
|
27
|
+
WALKING_HEART_RATE_AVERAGE = 'walkingHeartRateAverage',
|
|
28
|
+
HEART_RATE_VARIABILITY_SDNN = 'heartRateVariabilitySDNN',
|
|
29
|
+
ELECTROCARDIOGRAM = 'electrocardiogram',
|
|
30
|
+
WORKOUT = 'workout',
|
|
31
|
+
SLEEP_ANALYSIS = 'sleepAnalysis',
|
|
32
|
+
VO2_MAX = 'vo2Max',
|
|
33
|
+
OXYGEN_SATURATION = 'oxygenSaturation',
|
|
34
|
+
RESPIRATORY_RATE = 'respiratoryRate',
|
|
35
|
+
UV_EXPOSURE = 'uvExposure',
|
|
36
|
+
BIOLOGICAL_SEX = 'biologicalSex',
|
|
37
|
+
DATE_OF_BIRTH = 'dateOfBirth',
|
|
38
|
+
BLOOD_PRESSURE_SYSTOLIC = 'bloodPressureSystolic',
|
|
39
|
+
BLOOD_PRESSURE_DIASTOLIC = 'bloodPressureDiastolic',
|
|
40
|
+
BLOOD_GLUCOSE = 'bloodGlucose',
|
|
41
|
+
DIETARY_ENERGY_CONSUMED = 'dietaryEnergyConsumed',
|
|
42
|
+
DIETARY_PROTEIN = 'dietaryProtein',
|
|
43
|
+
DIETARY_SUGAR = 'dietarySugar',
|
|
44
|
+
DIETARY_FAT_TOTAL = 'dietaryFatTotal',
|
|
45
|
+
DIETARY_CARBOHYDRATES = 'dietaryCarbohydrates',
|
|
46
|
+
DIETARY_FIBER = 'dietaryFiber',
|
|
47
|
+
DIETARY_SODIUM = 'dietarySodium',
|
|
48
|
+
DIETARY_CHOLESTEROL = 'dietaryCholesterol',
|
|
49
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { APIDataSource } from './DataSource';
|
|
2
|
+
|
|
3
|
+
export interface AuthorizedSources {
|
|
4
|
+
android?: boolean;
|
|
5
|
+
appleHealth?: boolean;
|
|
6
|
+
fitbit?: boolean;
|
|
7
|
+
garmin?: boolean;
|
|
8
|
+
healthConnect?: boolean;
|
|
9
|
+
oura?: boolean;
|
|
10
|
+
polar?: boolean;
|
|
11
|
+
whoop?: boolean;
|
|
12
|
+
withings?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type DataSourceAuthorizer = {
|
|
16
|
+
dataSource: string;
|
|
17
|
+
authorized: boolean;
|
|
18
|
+
authorizationUrl?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type DataSourceProps = {
|
|
22
|
+
userID: string;
|
|
23
|
+
dataSource: APIDataSource;
|
|
24
|
+
redirectURL?: string;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export type AuthorizedSource = {
|
|
28
|
+
name: string;
|
|
29
|
+
imageUrl: string;
|
|
30
|
+
authorized: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type BasicObject = { [key: string]: boolean };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HrGranularData,
|
|
3
|
+
HrvRmssdGranularData,
|
|
4
|
+
HrvSdnnGranularData,
|
|
5
|
+
SaturationGranularData,
|
|
6
|
+
TemperatureGranularData,
|
|
7
|
+
TemperatureObject,
|
|
8
|
+
Vo2GranularData,
|
|
9
|
+
} from './SummaryTypes';
|
|
10
|
+
|
|
11
|
+
// --- Definiciones completas para nuevos tipos ---
|
|
12
|
+
export interface BloodGlucoseGranularData {
|
|
13
|
+
dateTime: string;
|
|
14
|
+
bloodGlucoseMgPerDl: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface BloodPressureObject {
|
|
18
|
+
systolicMmHg: number;
|
|
19
|
+
diastolicMmHg: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface BloodPressureGranularData {
|
|
23
|
+
dateTime: string;
|
|
24
|
+
systolicMmHg: number;
|
|
25
|
+
diastolicMmHg: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface HydrationAmountGranularData {
|
|
29
|
+
dateTime: string;
|
|
30
|
+
intervalDurationSeconds: number;
|
|
31
|
+
hydrationAmountMl: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface HydrationLevelGranularData {
|
|
35
|
+
dateTime: string;
|
|
36
|
+
intervalDurationSeconds: number;
|
|
37
|
+
hydrationLevelPercentage: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface MoodGranularData {
|
|
41
|
+
dateTime: string;
|
|
42
|
+
intervalDurationSeconds: number;
|
|
43
|
+
moodScale: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface MenstruationFlowGranularData {
|
|
47
|
+
dateTime: string;
|
|
48
|
+
flowMl: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// --- Interfaz SHBodySummary Completa ---
|
|
52
|
+
export interface BodySummary {
|
|
53
|
+
dateTime: string;
|
|
54
|
+
sourceOfData: string;
|
|
55
|
+
wasTheUserUnderPhysicalActivity: boolean;
|
|
56
|
+
waistCircumferenceCm: number | null;
|
|
57
|
+
hipCircumferenceCm: number | null;
|
|
58
|
+
chestCircumferenceCm: number | null;
|
|
59
|
+
boneCompositionPercentage: number | null;
|
|
60
|
+
muscleCompositionPercentage: number | null;
|
|
61
|
+
waterCompositionPercentage: number | null;
|
|
62
|
+
weightKg: number | null;
|
|
63
|
+
heightCm: number | null;
|
|
64
|
+
bmi: number | null;
|
|
65
|
+
bloodGlucoseAvgMgPerDl: number | null;
|
|
66
|
+
bloodGlucoseGranularData: BloodGlucoseGranularData[] | null;
|
|
67
|
+
bloodPressureAvg: BloodPressureObject | null;
|
|
68
|
+
bloodPressureGranularData: BloodPressureGranularData[] | null;
|
|
69
|
+
waterTotalConsumptionMl: number | null;
|
|
70
|
+
hydrationAmountGranularData: HydrationAmountGranularData[] | null;
|
|
71
|
+
hydrationLevelGranularData: HydrationLevelGranularData[] | null;
|
|
72
|
+
hrMaximumBpm: number | null;
|
|
73
|
+
hrMinimumBpm: number | null;
|
|
74
|
+
hrAvgBpm: number | null;
|
|
75
|
+
hrRestingBpm: number | null;
|
|
76
|
+
hrGranularData: HrGranularData[] | null;
|
|
77
|
+
hrvAvgRmssd: number | null;
|
|
78
|
+
hrvAvgSdnn: number | null;
|
|
79
|
+
hrvSdnnGranularData: HrvSdnnGranularData[] | null;
|
|
80
|
+
hrvRmssdGranularData: HrvRmssdGranularData[] | null;
|
|
81
|
+
moodMinimumScale: number | null;
|
|
82
|
+
moodAvgScale: number | null;
|
|
83
|
+
moodMaximumScale: number | null;
|
|
84
|
+
moodGranularData: MoodGranularData[] | null;
|
|
85
|
+
moodDeltaScale: number | null;
|
|
86
|
+
foodIntake: number | null;
|
|
87
|
+
caloriesIntakeKcal: number | null;
|
|
88
|
+
proteinIntakeG: number | null;
|
|
89
|
+
sugarIntakeG: number | null;
|
|
90
|
+
fatIntakeG: number | null;
|
|
91
|
+
transFatIntakeG: number | null;
|
|
92
|
+
carbohydratesIntakeG: number | null;
|
|
93
|
+
fiberIntakeG: number | null;
|
|
94
|
+
alcoholIntakeG: number | null;
|
|
95
|
+
sodiumIntakeMg: number | null;
|
|
96
|
+
cholesterolIntakeMg: number | null;
|
|
97
|
+
saturationAvgPercentage: number | null;
|
|
98
|
+
saturationGranularData: SaturationGranularData[] | null;
|
|
99
|
+
vo2MaxMlPerMinPerKg: number | null;
|
|
100
|
+
vo2GranularData: Vo2GranularData[] | null;
|
|
101
|
+
temperatureMinimum: TemperatureObject | null;
|
|
102
|
+
temperatureAvg: TemperatureObject | null;
|
|
103
|
+
temperatureMaximum: TemperatureObject | null;
|
|
104
|
+
temperatureGranularData: TemperatureGranularData[] | null;
|
|
105
|
+
temperatureDelta: TemperatureObject | null;
|
|
106
|
+
lastUpdatedDatetime: string | null;
|
|
107
|
+
periodStartDate: string | null;
|
|
108
|
+
cycleDay: number | null;
|
|
109
|
+
cycleLengthDays: number | null;
|
|
110
|
+
predictedCycleLengthDays: number | null;
|
|
111
|
+
currentPhase: string | null;
|
|
112
|
+
lengthOfCurrentPhaseDays: number | null;
|
|
113
|
+
daysUntilNextPhase: number | null;
|
|
114
|
+
isAPredictedCycle: boolean | null;
|
|
115
|
+
menstruationFlowGranularData: MenstruationFlowGranularData[] | null;
|
|
116
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DataSource {
|
|
2
|
+
name: string;
|
|
3
|
+
authorizationURL: string;
|
|
4
|
+
imageUrl: string;
|
|
5
|
+
description: string;
|
|
6
|
+
connected: boolean;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export enum APIDataSource {
|
|
10
|
+
GARMIN = 'Garmin',
|
|
11
|
+
OURA = 'Oura',
|
|
12
|
+
POLAR = 'Polar',
|
|
13
|
+
FITBIT = 'Fitbit',
|
|
14
|
+
WITHINGS = 'Withings',
|
|
15
|
+
WHOOP = 'Whoop',
|
|
16
|
+
}
|
|
@@ -1,22 +1,73 @@
|
|
|
1
|
-
|
|
1
|
+
import { type WriteNutrition, MealDataType } from './WriteNutrition';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.parseWriteNutritionToHC = void 0;
|
|
7
|
-
var _WriteNutrition = require("./WriteNutrition");
|
|
8
3
|
/**
|
|
9
4
|
* Interface representing nutrition and meal data for Health Connect.
|
|
10
5
|
* * Note: All gram values have a range of [0.0 - 100.0] unless specified otherwise.
|
|
11
6
|
* Energy and macro values have a range of [0.0 - 100,000.0].
|
|
12
7
|
*/
|
|
8
|
+
export interface HCMealData {
|
|
9
|
+
/** ISO-8601 formatted string (e.g., new Date().toISOString()) */
|
|
10
|
+
startDateTime: string;
|
|
11
|
+
/** ISO-8601 formatted string (e.g., new Date().toISOString()) */
|
|
12
|
+
endDateTime: string;
|
|
13
|
+
/** Name of the meal or food item */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Category of the meal */
|
|
16
|
+
type: MealDataType;
|
|
13
17
|
|
|
14
|
-
|
|
18
|
+
// Macros & Energy (Range: 0.0 to 100,000.0)
|
|
19
|
+
energyKcal?: number;
|
|
20
|
+
energyFromFatKcal?: number;
|
|
21
|
+
dietaryFiberGrams?: number;
|
|
22
|
+
monounsaturatedFatGrams?: number;
|
|
23
|
+
polyunsaturatedFatGrams?: number;
|
|
24
|
+
proteinGrams?: number;
|
|
25
|
+
saturatedFatGrams?: number;
|
|
26
|
+
sugarGrams?: number;
|
|
27
|
+
totalCarbohydrateGrams?: number;
|
|
28
|
+
totalFatGrams?: number;
|
|
29
|
+
transFatGrams?: number;
|
|
30
|
+
unsaturatedFatGrams?: number;
|
|
31
|
+
|
|
32
|
+
// Micro-nutrients & Minerals (Range: 0.0 to 100.0)
|
|
33
|
+
biotinGrams?: number;
|
|
34
|
+
caffeineGrams?: number;
|
|
35
|
+
calciumGrams?: number;
|
|
36
|
+
chlorideGrams?: number;
|
|
37
|
+
cholesterolGrams?: number;
|
|
38
|
+
chromiumGrams?: number;
|
|
39
|
+
copperGrams?: number;
|
|
40
|
+
folateGrams?: number;
|
|
41
|
+
folicAcidGrams?: number;
|
|
42
|
+
iodineGrams?: number;
|
|
43
|
+
ironGrams?: number;
|
|
44
|
+
magnesiumGrams?: number;
|
|
45
|
+
manganeseGrams?: number;
|
|
46
|
+
molybdenumGrams?: number;
|
|
47
|
+
niacinGrams?: number;
|
|
48
|
+
pantothenicAcidGrams?: number;
|
|
49
|
+
phosphorusGrams?: number;
|
|
50
|
+
potassiumGrams?: number;
|
|
51
|
+
riboflavinGrams?: number;
|
|
52
|
+
seleniumGrams?: number;
|
|
53
|
+
sodiumGrams?: number;
|
|
54
|
+
thiaminGrams?: number;
|
|
55
|
+
vitaminAGrams?: number;
|
|
56
|
+
vitaminB12Grams?: number;
|
|
57
|
+
vitaminB6Grams?: number;
|
|
58
|
+
vitaminCGrams?: number;
|
|
59
|
+
vitaminDGrams?: number;
|
|
60
|
+
vitaminEGrams?: number;
|
|
61
|
+
vitaminKGrams?: number;
|
|
62
|
+
zincGrams?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const parseWriteNutritionToHC = (data: WriteNutrition): HCMealData => {
|
|
15
66
|
return {
|
|
16
67
|
name: data.name,
|
|
17
68
|
startDateTime: data.date,
|
|
18
69
|
endDateTime: data.date,
|
|
19
|
-
type: data.mealType ??
|
|
70
|
+
type: data.mealType ?? MealDataType.SNACK,
|
|
20
71
|
biotinGrams: data.biotin,
|
|
21
72
|
caffeineGrams: data.caffeine,
|
|
22
73
|
calciumGrams: data.calcium,
|
|
@@ -58,8 +109,6 @@ const parseWriteNutritionToHC = data => {
|
|
|
58
109
|
vitaminDGrams: data.vitaminD,
|
|
59
110
|
vitaminEGrams: data.vitaminE,
|
|
60
111
|
vitaminKGrams: data.vitaminK,
|
|
61
|
-
zincGrams: data.zinc
|
|
112
|
+
zincGrams: data.zinc,
|
|
62
113
|
};
|
|
63
114
|
};
|
|
64
|
-
exports.parseWriteNutritionToHC = parseWriteNutritionToHC;
|
|
65
|
-
//# sourceMappingURL=HCMealData.js.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface HrGranularDataItem {
|
|
2
|
+
dateTime: string;
|
|
3
|
+
hrBPM: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface HrvSDNNGranularData {
|
|
7
|
+
dateTime: string;
|
|
8
|
+
hrvSDNN: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface HrvSDNNGranularData {
|
|
12
|
+
dateTime: string;
|
|
13
|
+
hrvRmssd: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface HeartRateData {
|
|
17
|
+
hrAverageBPM: number;
|
|
18
|
+
hrvSDNNGranularData: HrvSDNNGranularData[] | null;
|
|
19
|
+
hrGranularData: HrGranularDataItem[];
|
|
20
|
+
hrMinimumBPM: number;
|
|
21
|
+
hrRestingBPM: number | null;
|
|
22
|
+
hrMaximumBPM: number;
|
|
23
|
+
hrvAverageSDNN: number | null;
|
|
24
|
+
hrvRMSSDGranularData: HrvSDNNGranularData[] | null;
|
|
25
|
+
hrvAverageRMSSD: number | null;
|
|
26
|
+
}
|