@kingstinct/react-native-healthkit 8.7.2 → 9.0.0
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/ReactNativeHealthkit.podspec +36 -0
- package/app.plugin.js +43 -33
- package/ios/Bridge.h +8 -0
- package/ios/CategoryTypeModule.swift +128 -0
- package/ios/CharacteristicTypeModule.swift +78 -0
- package/ios/Constants.swift +2 -0
- package/ios/CoreModule.swift +376 -0
- package/ios/CorrelationTypeModule.swift +153 -0
- package/ios/HeartbeatSeriesModule.swift +189 -0
- package/ios/Helpers.swift +529 -251
- package/ios/QuantityTypeModule.swift +461 -0
- package/ios/Serializers.swift +211 -124
- package/ios/SourceProxy.swift +35 -0
- package/ios/StateOfMindModule.swift +160 -0
- package/ios/WorkoutProxy.swift +405 -0
- package/ios/WorkoutSessionModule.swift +182 -0
- package/ios/WorkoutsModule.swift +357 -0
- package/package.json +43 -127
- package/react-native.config.js +16 -0
- package/src/hooks/useHealthkitAuthorization.test.ts +47 -29
- package/src/hooks/useHealthkitAuthorization.ts +21 -15
- package/src/hooks/useIsHealthDataAvailable.test.ts +17 -7
- package/src/hooks/useIsHealthDataAvailable.ts +7 -7
- package/src/hooks/useMostRecentCategorySample.ts +10 -12
- package/src/hooks/useMostRecentQuantitySample.ts +17 -36
- package/src/hooks/useMostRecentWorkout.ts +16 -38
- package/src/hooks/useSources.ts +8 -12
- package/src/hooks/useStatisticsForQuantity.ts +19 -14
- package/src/hooks/useSubscribeToChanges.ts +9 -13
- package/src/index.ios.ts +232 -0
- package/src/index.ts +444 -0
- package/src/modules.ts +43 -0
- package/src/specs/CategoryTypeModule.nitro.ts +64 -0
- package/src/specs/CharacteristicTypeModule.nitro.ts +22 -0
- package/src/specs/CoreModule.nitro.ts +107 -0
- package/src/specs/CorrelationTypeModule.nitro.ts +23 -0
- package/src/specs/HeartbeatSeriesModule.nitro.ts +19 -0
- package/src/specs/QuantityTypeModule.nitro.ts +60 -0
- package/src/specs/SourceProxy.nitro.ts +13 -0
- package/src/specs/StateOfMindModule.nitro.ts +23 -0
- package/src/specs/WorkoutProxy.nitro.ts +18 -0
- package/src/specs/WorkoutSessionModule.nitro.ts +71 -0
- package/src/specs/WorkoutsModule.nitro.ts +32 -0
- package/src/test-setup.ts +68 -54
- package/src/test-utils.ts +3 -2
- package/src/types/Auth.ts +17 -0
- package/src/types/Background.ts +9 -0
- package/src/types/CategoryType.ts +249 -0
- package/src/types/CategoryTypeIdentifier.ts +99 -0
- package/src/types/Characteristics.ts +53 -0
- package/src/types/Constants.ts +25 -0
- package/src/types/CorrelationType.ts +31 -0
- package/src/types/Device.ts +13 -0
- package/src/types/HeartbeatSeries.ts +29 -0
- package/src/types/InterfaceVerification.ts +164 -0
- package/src/types/InterfaceVerificationExample.ts +89 -0
- package/src/types/QuantitySample.ts +30 -0
- package/src/types/QuantityType.ts +192 -0
- package/src/types/QuantityTypeIdentifier.ts +758 -0
- package/src/types/QueryOptions.ts +69 -0
- package/src/types/README-InterfaceVerification.md +103 -0
- package/src/types/Shared.ts +79 -0
- package/src/types/Source.ts +11 -0
- package/src/types/StateOfMind.ts +110 -0
- package/src/types/Subscriptons.ts +10 -0
- package/src/types/Units.ts +190 -0
- package/src/types/WeatherCondition.ts +31 -0
- package/src/types/WorkoutKit.ts +18 -0
- package/src/types/Workouts.ts +282 -0
- package/src/utils/getMostRecentCategorySample.ts +7 -11
- package/src/utils/getMostRecentQuantitySample.ts +8 -18
- package/src/utils/getMostRecentWorkout.ts +7 -17
- package/src/utils/getPreferredUnit.ts +12 -8
- package/src/utils/subscribeToChanges.ts +9 -26
- package/LICENSE +0 -21
- package/README.md +0 -179
- package/ios/ReactNativeHealthkit-Bridging-Header.h +0 -2
- package/ios/ReactNativeHealthkit.m +0 -271
- package/ios/ReactNativeHealthkit.swift +0 -2333
- package/ios/ReactNativeHealthkit.xcodeproj/project.pbxproj +0 -279
- package/kingstinct-react-native-healthkit.podspec +0 -21
- package/lib/commonjs/hooks/useHealthkitAuthorization.js +0 -39
- package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +0 -1
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +0 -72
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +0 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js +0 -27
- package/lib/commonjs/hooks/useIsHealthDataAvailable.js.map +0 -1
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +0 -41
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +0 -1
- package/lib/commonjs/hooks/useMostRecentCategorySample.js +0 -23
- package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +0 -1
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js +0 -37
- package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +0 -1
- package/lib/commonjs/hooks/useMostRecentWorkout.js +0 -48
- package/lib/commonjs/hooks/useMostRecentWorkout.js.map +0 -1
- package/lib/commonjs/hooks/useSources.js +0 -22
- package/lib/commonjs/hooks/useSources.js.map +0 -1
- package/lib/commonjs/hooks/useStatisticsForQuantity.js +0 -28
- package/lib/commonjs/hooks/useStatisticsForQuantity.js.map +0 -1
- package/lib/commonjs/hooks/useSubscribeToChanges.js +0 -28
- package/lib/commonjs/hooks/useSubscribeToChanges.js.map +0 -1
- package/lib/commonjs/index.ios.js +0 -531
- package/lib/commonjs/index.ios.js.map +0 -1
- package/lib/commonjs/index.js +0 -22
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/index.native.js +0 -235
- package/lib/commonjs/index.native.js.map +0 -1
- package/lib/commonjs/index.web.js +0 -22
- package/lib/commonjs/index.web.js.map +0 -1
- package/lib/commonjs/native-types.js +0 -1575
- package/lib/commonjs/native-types.js.map +0 -1
- package/lib/commonjs/test-setup.js +0 -57
- package/lib/commonjs/test-setup.js.map +0 -1
- package/lib/commonjs/test-utils.js +0 -18
- package/lib/commonjs/test-utils.js.map +0 -1
- package/lib/commonjs/types.js +0 -17
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/deleteQuantitySample.js +0 -11
- package/lib/commonjs/utils/deleteQuantitySample.js.map +0 -1
- package/lib/commonjs/utils/deleteSamples.js +0 -18
- package/lib/commonjs/utils/deleteSamples.js.map +0 -1
- package/lib/commonjs/utils/deleteWorkoutSample.js +0 -11
- package/lib/commonjs/utils/deleteWorkoutSample.js.map +0 -1
- package/lib/commonjs/utils/deserializeCategorySample.js +0 -13
- package/lib/commonjs/utils/deserializeCategorySample.js.map +0 -1
- package/lib/commonjs/utils/deserializeCategorySample.test.js +0 -26
- package/lib/commonjs/utils/deserializeCategorySample.test.js.map +0 -1
- package/lib/commonjs/utils/deserializeCorrelation.js +0 -26
- package/lib/commonjs/utils/deserializeCorrelation.js.map +0 -1
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js +0 -15
- package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js.map +0 -1
- package/lib/commonjs/utils/deserializeSample.js +0 -15
- package/lib/commonjs/utils/deserializeSample.js.map +0 -1
- package/lib/commonjs/utils/deserializeWorkout.js +0 -15
- package/lib/commonjs/utils/deserializeWorkout.js.map +0 -1
- package/lib/commonjs/utils/ensureMetadata.js +0 -11
- package/lib/commonjs/utils/ensureMetadata.js.map +0 -1
- package/lib/commonjs/utils/ensureTotals.js +0 -11
- package/lib/commonjs/utils/ensureTotals.js.map +0 -1
- package/lib/commonjs/utils/ensureUnit.js +0 -17
- package/lib/commonjs/utils/ensureUnit.js.map +0 -1
- package/lib/commonjs/utils/getDateOfBirth.js +0 -14
- package/lib/commonjs/utils/getDateOfBirth.js.map +0 -1
- package/lib/commonjs/utils/getMostRecentCategorySample.js +0 -17
- package/lib/commonjs/utils/getMostRecentCategorySample.js.map +0 -1
- package/lib/commonjs/utils/getMostRecentQuantitySample.js +0 -21
- package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +0 -1
- package/lib/commonjs/utils/getMostRecentWorkout.js +0 -19
- package/lib/commonjs/utils/getMostRecentWorkout.js.map +0 -1
- package/lib/commonjs/utils/getPreferredUnit.js +0 -14
- package/lib/commonjs/utils/getPreferredUnit.js.map +0 -1
- package/lib/commonjs/utils/getPreferredUnits.js +0 -14
- package/lib/commonjs/utils/getPreferredUnits.js.map +0 -1
- package/lib/commonjs/utils/getPreferredUnitsTyped.js +0 -33
- package/lib/commonjs/utils/getPreferredUnitsTyped.js.map +0 -1
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js +0 -21
- package/lib/commonjs/utils/getRequestStatusForAuthorization.js.map +0 -1
- package/lib/commonjs/utils/getWorkoutPlanById.js +0 -13
- package/lib/commonjs/utils/getWorkoutPlanById.js.map +0 -1
- package/lib/commonjs/utils/prepareOptions.js +0 -25
- package/lib/commonjs/utils/prepareOptions.js.map +0 -1
- package/lib/commonjs/utils/queryCategorySamples.js +0 -17
- package/lib/commonjs/utils/queryCategorySamples.js.map +0 -1
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js +0 -21
- package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/queryCorrelationSamples.js +0 -17
- package/lib/commonjs/utils/queryCorrelationSamples.js.map +0 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js +0 -17
- package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js.map +0 -1
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js +0 -21
- package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/queryQuantitySamples.js +0 -19
- package/lib/commonjs/utils/queryQuantitySamples.js.map +0 -1
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js +0 -23
- package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/querySources.js +0 -14
- package/lib/commonjs/utils/querySources.js.map +0 -1
- package/lib/commonjs/utils/queryStateOfMindSamples.js +0 -22
- package/lib/commonjs/utils/queryStateOfMindSamples.js.map +0 -1
- package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js +0 -16
- package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js.map +0 -1
- package/lib/commonjs/utils/queryStatisticsForQuantity.js +0 -29
- package/lib/commonjs/utils/queryStatisticsForQuantity.js.map +0 -1
- package/lib/commonjs/utils/queryWorkoutSamplesWithAnchor.js +0 -26
- package/lib/commonjs/utils/queryWorkoutSamplesWithAnchor.js.map +0 -1
- package/lib/commonjs/utils/queryWorkouts.js +0 -22
- package/lib/commonjs/utils/queryWorkouts.js.map +0 -1
- package/lib/commonjs/utils/requestAuthorization.js +0 -22
- package/lib/commonjs/utils/requestAuthorization.js.map +0 -1
- package/lib/commonjs/utils/saveCategorySample.js +0 -20
- package/lib/commonjs/utils/saveCategorySample.js.map +0 -1
- package/lib/commonjs/utils/saveCorrelationSample.js +0 -35
- package/lib/commonjs/utils/saveCorrelationSample.js.map +0 -1
- package/lib/commonjs/utils/saveQuantitySample.js +0 -16
- package/lib/commonjs/utils/saveQuantitySample.js.map +0 -1
- package/lib/commonjs/utils/saveStateOfMindSample.js +0 -17
- package/lib/commonjs/utils/saveStateOfMindSample.js.map +0 -1
- package/lib/commonjs/utils/saveWorkoutRoute.js +0 -26
- package/lib/commonjs/utils/saveWorkoutRoute.js.map +0 -1
- package/lib/commonjs/utils/saveWorkoutSample.js +0 -36
- package/lib/commonjs/utils/saveWorkoutSample.js.map +0 -1
- package/lib/commonjs/utils/serializeDate.js +0 -9
- package/lib/commonjs/utils/serializeDate.js.map +0 -1
- package/lib/commonjs/utils/serializeDate.test.js +0 -17
- package/lib/commonjs/utils/serializeDate.test.js.map +0 -1
- package/lib/commonjs/utils/startWatchApp.js +0 -11
- package/lib/commonjs/utils/startWatchApp.js.map +0 -1
- package/lib/commonjs/utils/subscribeToChanges.js +0 -27
- package/lib/commonjs/utils/subscribeToChanges.js.map +0 -1
- package/lib/module/hooks/useHealthkitAuthorization.js +0 -32
- package/lib/module/hooks/useHealthkitAuthorization.js.map +0 -1
- package/lib/module/hooks/useHealthkitAuthorization.test.js +0 -68
- package/lib/module/hooks/useHealthkitAuthorization.test.js.map +0 -1
- package/lib/module/hooks/useIsHealthDataAvailable.js +0 -21
- package/lib/module/hooks/useIsHealthDataAvailable.js.map +0 -1
- package/lib/module/hooks/useIsHealthDataAvailable.test.js +0 -37
- package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +0 -1
- package/lib/module/hooks/useMostRecentCategorySample.js +0 -16
- package/lib/module/hooks/useMostRecentCategorySample.js.map +0 -1
- package/lib/module/hooks/useMostRecentQuantitySample.js +0 -30
- package/lib/module/hooks/useMostRecentQuantitySample.js.map +0 -1
- package/lib/module/hooks/useMostRecentWorkout.js +0 -41
- package/lib/module/hooks/useMostRecentWorkout.js.map +0 -1
- package/lib/module/hooks/useSources.js +0 -15
- package/lib/module/hooks/useSources.js.map +0 -1
- package/lib/module/hooks/useStatisticsForQuantity.js +0 -21
- package/lib/module/hooks/useStatisticsForQuantity.js.map +0 -1
- package/lib/module/hooks/useSubscribeToChanges.js +0 -21
- package/lib/module/hooks/useSubscribeToChanges.js.map +0 -1
- package/lib/module/index.ios.js +0 -209
- package/lib/module/index.ios.js.map +0 -1
- package/lib/module/index.js +0 -4
- package/lib/module/index.js.map +0 -1
- package/lib/module/index.native.js +0 -160
- package/lib/module/index.native.js.map +0 -1
- package/lib/module/index.web.js +0 -4
- package/lib/module/index.web.js.map +0 -1
- package/lib/module/native-types.js +0 -1606
- package/lib/module/native-types.js.map +0 -1
- package/lib/module/test-setup.js +0 -54
- package/lib/module/test-setup.js.map +0 -1
- package/lib/module/test-utils.js +0 -11
- package/lib/module/test-utils.js.map +0 -1
- package/lib/module/types.js +0 -67
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/deleteQuantitySample.js +0 -4
- package/lib/module/utils/deleteQuantitySample.js.map +0 -1
- package/lib/module/utils/deleteSamples.js +0 -11
- package/lib/module/utils/deleteSamples.js.map +0 -1
- package/lib/module/utils/deleteWorkoutSample.js +0 -4
- package/lib/module/utils/deleteWorkoutSample.js.map +0 -1
- package/lib/module/utils/deserializeCategorySample.js +0 -7
- package/lib/module/utils/deserializeCategorySample.js.map +0 -1
- package/lib/module/utils/deserializeCategorySample.test.js +0 -22
- package/lib/module/utils/deserializeCategorySample.test.js.map +0 -1
- package/lib/module/utils/deserializeCorrelation.js +0 -19
- package/lib/module/utils/deserializeCorrelation.js.map +0 -1
- package/lib/module/utils/deserializeHeartbeatSeriesSample.js +0 -9
- package/lib/module/utils/deserializeHeartbeatSeriesSample.js.map +0 -1
- package/lib/module/utils/deserializeSample.js +0 -9
- package/lib/module/utils/deserializeSample.js.map +0 -1
- package/lib/module/utils/deserializeWorkout.js +0 -9
- package/lib/module/utils/deserializeWorkout.js.map +0 -1
- package/lib/module/utils/ensureMetadata.js +0 -5
- package/lib/module/utils/ensureMetadata.js.map +0 -1
- package/lib/module/utils/ensureTotals.js +0 -5
- package/lib/module/utils/ensureTotals.js.map +0 -1
- package/lib/module/utils/ensureUnit.js +0 -10
- package/lib/module/utils/ensureUnit.js.map +0 -1
- package/lib/module/utils/getDateOfBirth.js +0 -7
- package/lib/module/utils/getDateOfBirth.js.map +0 -1
- package/lib/module/utils/getMostRecentCategorySample.js +0 -10
- package/lib/module/utils/getMostRecentCategorySample.js.map +0 -1
- package/lib/module/utils/getMostRecentQuantitySample.js +0 -14
- package/lib/module/utils/getMostRecentQuantitySample.js.map +0 -1
- package/lib/module/utils/getMostRecentWorkout.js +0 -12
- package/lib/module/utils/getMostRecentWorkout.js.map +0 -1
- package/lib/module/utils/getPreferredUnit.js +0 -7
- package/lib/module/utils/getPreferredUnit.js.map +0 -1
- package/lib/module/utils/getPreferredUnits.js +0 -7
- package/lib/module/utils/getPreferredUnits.js.map +0 -1
- package/lib/module/utils/getPreferredUnitsTyped.js +0 -26
- package/lib/module/utils/getPreferredUnitsTyped.js.map +0 -1
- package/lib/module/utils/getRequestStatusForAuthorization.js +0 -14
- package/lib/module/utils/getRequestStatusForAuthorization.js.map +0 -1
- package/lib/module/utils/getWorkoutPlanById.js +0 -6
- package/lib/module/utils/getWorkoutPlanById.js.map +0 -1
- package/lib/module/utils/prepareOptions.js +0 -18
- package/lib/module/utils/prepareOptions.js.map +0 -1
- package/lib/module/utils/queryCategorySamples.js +0 -10
- package/lib/module/utils/queryCategorySamples.js.map +0 -1
- package/lib/module/utils/queryCategorySamplesWithAnchor.js +0 -14
- package/lib/module/utils/queryCategorySamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/queryCorrelationSamples.js +0 -10
- package/lib/module/utils/queryCorrelationSamples.js.map +0 -1
- package/lib/module/utils/queryHeartbeatSeriesSamples.js +0 -10
- package/lib/module/utils/queryHeartbeatSeriesSamples.js.map +0 -1
- package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js +0 -14
- package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/queryQuantitySamples.js +0 -12
- package/lib/module/utils/queryQuantitySamples.js.map +0 -1
- package/lib/module/utils/queryQuantitySamplesWithAnchor.js +0 -16
- package/lib/module/utils/queryQuantitySamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/querySources.js +0 -7
- package/lib/module/utils/querySources.js.map +0 -1
- package/lib/module/utils/queryStateOfMindSamples.js +0 -14
- package/lib/module/utils/queryStateOfMindSamples.js.map +0 -1
- package/lib/module/utils/queryStatisticsCollectionForQuantity.js +0 -9
- package/lib/module/utils/queryStatisticsCollectionForQuantity.js.map +0 -1
- package/lib/module/utils/queryStatisticsForQuantity.js +0 -22
- package/lib/module/utils/queryStatisticsForQuantity.js.map +0 -1
- package/lib/module/utils/queryWorkoutSamplesWithAnchor.js +0 -19
- package/lib/module/utils/queryWorkoutSamplesWithAnchor.js.map +0 -1
- package/lib/module/utils/queryWorkouts.js +0 -15
- package/lib/module/utils/queryWorkouts.js.map +0 -1
- package/lib/module/utils/requestAuthorization.js +0 -15
- package/lib/module/utils/requestAuthorization.js.map +0 -1
- package/lib/module/utils/saveCategorySample.js +0 -13
- package/lib/module/utils/saveCategorySample.js.map +0 -1
- package/lib/module/utils/saveCorrelationSample.js +0 -28
- package/lib/module/utils/saveCorrelationSample.js.map +0 -1
- package/lib/module/utils/saveQuantitySample.js +0 -9
- package/lib/module/utils/saveQuantitySample.js.map +0 -1
- package/lib/module/utils/saveStateOfMindSample.js +0 -10
- package/lib/module/utils/saveStateOfMindSample.js.map +0 -1
- package/lib/module/utils/saveWorkoutRoute.js +0 -19
- package/lib/module/utils/saveWorkoutRoute.js.map +0 -1
- package/lib/module/utils/saveWorkoutSample.js +0 -29
- package/lib/module/utils/saveWorkoutSample.js.map +0 -1
- package/lib/module/utils/serializeDate.js +0 -3
- package/lib/module/utils/serializeDate.js.map +0 -1
- package/lib/module/utils/serializeDate.test.js +0 -14
- package/lib/module/utils/serializeDate.test.js.map +0 -1
- package/lib/module/utils/startWatchApp.js +0 -4
- package/lib/module/utils/startWatchApp.js.map +0 -1
- package/lib/module/utils/subscribeToChanges.js +0 -20
- package/lib/module/utils/subscribeToChanges.js.map +0 -1
- package/lib/typescript/example-expo/App.d.ts +0 -2
- package/lib/typescript/src/hooks/useHealthkitAuthorization.d.ts +0 -8
- package/lib/typescript/src/hooks/useHealthkitAuthorization.test.d.ts +0 -1
- package/lib/typescript/src/hooks/useIsHealthDataAvailable.d.ts +0 -7
- package/lib/typescript/src/hooks/useIsHealthDataAvailable.test.d.ts +0 -1
- package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +0 -7
- package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +0 -7
- package/lib/typescript/src/hooks/useMostRecentWorkout.d.ts +0 -10
- package/lib/typescript/src/hooks/useSources.d.ts +0 -3
- package/lib/typescript/src/hooks/useStatisticsForQuantity.d.ts +0 -4
- package/lib/typescript/src/hooks/useSubscribeToChanges.d.ts +0 -3
- package/lib/typescript/src/index.d.ts +0 -3
- package/lib/typescript/src/index.ios.d.ts +0 -198
- package/lib/typescript/src/index.native.d.ts +0 -41
- package/lib/typescript/src/index.web.d.ts +0 -3
- package/lib/typescript/src/native-types.d.ts +0 -1764
- package/lib/typescript/src/test-setup.d.ts +0 -1
- package/lib/typescript/src/test-utils.d.ts +0 -2
- package/lib/typescript/src/types.d.ts +0 -111
- package/lib/typescript/src/utils/deleteQuantitySample.d.ts +0 -4
- package/lib/typescript/src/utils/deleteSamples.d.ts +0 -8
- package/lib/typescript/src/utils/deleteWorkoutSample.d.ts +0 -3
- package/lib/typescript/src/utils/deserializeCategorySample.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeCategorySample.test.d.ts +0 -1
- package/lib/typescript/src/utils/deserializeCorrelation.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeHeartbeatSeriesSample.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeSample.d.ts +0 -4
- package/lib/typescript/src/utils/deserializeWorkout.d.ts +0 -4
- package/lib/typescript/src/utils/ensureMetadata.d.ts +0 -2
- package/lib/typescript/src/utils/ensureTotals.d.ts +0 -2
- package/lib/typescript/src/utils/ensureUnit.d.ts +0 -3
- package/lib/typescript/src/utils/getDateOfBirth.d.ts +0 -2
- package/lib/typescript/src/utils/getMostRecentCategorySample.d.ts +0 -4
- package/lib/typescript/src/utils/getMostRecentQuantitySample.d.ts +0 -4
- package/lib/typescript/src/utils/getMostRecentWorkout.d.ts +0 -5
- package/lib/typescript/src/utils/getPreferredUnit.d.ts +0 -4
- package/lib/typescript/src/utils/getPreferredUnits.d.ts +0 -4
- package/lib/typescript/src/utils/getPreferredUnitsTyped.d.ts +0 -9
- package/lib/typescript/src/utils/getRequestStatusForAuthorization.d.ts +0 -3
- package/lib/typescript/src/utils/getWorkoutPlanById.d.ts +0 -5
- package/lib/typescript/src/utils/prepareOptions.d.ts +0 -9
- package/lib/typescript/src/utils/queryCategorySamples.d.ts +0 -5
- package/lib/typescript/src/utils/queryCategorySamplesWithAnchor.d.ts +0 -10
- package/lib/typescript/src/utils/queryCorrelationSamples.d.ts +0 -5
- package/lib/typescript/src/utils/queryHeartbeatSeriesSamples.d.ts +0 -10
- package/lib/typescript/src/utils/queryHeartbeatSeriesSamplesWithAnchor.d.ts +0 -10
- package/lib/typescript/src/utils/queryQuantitySamples.d.ts +0 -7
- package/lib/typescript/src/utils/queryQuantitySamplesWithAnchor.d.ts +0 -12
- package/lib/typescript/src/utils/querySources.d.ts +0 -4
- package/lib/typescript/src/utils/queryStateOfMindSamples.d.ts +0 -7
- package/lib/typescript/src/utils/queryStatisticsCollectionForQuantity.d.ts +0 -3
- package/lib/typescript/src/utils/queryStatisticsForQuantity.d.ts +0 -14
- package/lib/typescript/src/utils/queryWorkoutSamplesWithAnchor.d.ts +0 -9
- package/lib/typescript/src/utils/queryWorkouts.d.ts +0 -4
- package/lib/typescript/src/utils/requestAuthorization.d.ts +0 -4
- package/lib/typescript/src/utils/saveCategorySample.d.ts +0 -11
- package/lib/typescript/src/utils/saveCorrelationSample.d.ts +0 -8
- package/lib/typescript/src/utils/saveQuantitySample.d.ts +0 -7
- package/lib/typescript/src/utils/saveStateOfMindSample.d.ts +0 -11
- package/lib/typescript/src/utils/saveWorkoutRoute.d.ts +0 -3
- package/lib/typescript/src/utils/saveWorkoutSample.d.ts +0 -11
- package/lib/typescript/src/utils/serializeDate.d.ts +0 -2
- package/lib/typescript/src/utils/serializeDate.test.d.ts +0 -1
- package/lib/typescript/src/utils/startWatchApp.d.ts +0 -3
- package/lib/typescript/src/utils/subscribeToChanges.d.ts +0 -3
- package/src/index.ios.tsx +0 -292
- package/src/index.native.tsx +0 -233
- package/src/index.tsx +0 -5
- package/src/index.web.tsx +0 -5
- package/src/native-types.ts +0 -2471
- package/src/types.ts +0 -156
- package/src/utils/deleteQuantitySample.ts +0 -14
- package/src/utils/deleteSamples.ts +0 -23
- package/src/utils/deleteWorkoutSample.ts +0 -7
- package/src/utils/deserializeCategorySample.test.ts +0 -24
- package/src/utils/deserializeCategorySample.ts +0 -12
- package/src/utils/deserializeCorrelation.ts +0 -28
- package/src/utils/deserializeHeartbeatSeriesSample.ts +0 -12
- package/src/utils/deserializeSample.ts +0 -17
- package/src/utils/deserializeWorkout.ts +0 -14
- package/src/utils/ensureMetadata.ts +0 -5
- package/src/utils/ensureTotals.ts +0 -5
- package/src/utils/ensureUnit.ts +0 -19
- package/src/utils/getDateOfBirth.ts +0 -8
- package/src/utils/getPreferredUnits.ts +0 -14
- package/src/utils/getPreferredUnitsTyped.ts +0 -38
- package/src/utils/getRequestStatusForAuthorization.ts +0 -21
- package/src/utils/getWorkoutPlanById.ts +0 -7
- package/src/utils/prepareOptions.ts +0 -19
- package/src/utils/queryCategorySamples.ts +0 -29
- package/src/utils/queryCategorySamplesWithAnchor.ts +0 -39
- package/src/utils/queryCorrelationSamples.ts +0 -29
- package/src/utils/queryHeartbeatSeriesSamples.ts +0 -29
- package/src/utils/queryHeartbeatSeriesSamplesWithAnchor.ts +0 -33
- package/src/utils/queryQuantitySamples.ts +0 -38
- package/src/utils/queryQuantitySamplesWithAnchor.ts +0 -46
- package/src/utils/querySources.ts +0 -21
- package/src/utils/queryStateOfMindSamples.ts +0 -14
- package/src/utils/queryStatisticsCollectionForQuantity.ts +0 -38
- package/src/utils/queryStatisticsForQuantity.ts +0 -38
- package/src/utils/queryWorkoutSamplesWithAnchor.ts +0 -46
- package/src/utils/queryWorkouts.ts +0 -28
- package/src/utils/requestAuthorization.ts +0 -19
- package/src/utils/saveCategorySample.ts +0 -31
- package/src/utils/saveCorrelationSample.ts +0 -43
- package/src/utils/saveQuantitySample.ts +0 -29
- package/src/utils/saveStateOfMindSample.ts +0 -38
- package/src/utils/saveWorkoutRoute.ts +0 -21
- package/src/utils/saveWorkoutSample.ts +0 -42
- package/src/utils/serializeDate.test.ts +0 -16
- package/src/utils/serializeDate.ts +0 -5
- package/src/utils/startWatchApp.ts +0 -7
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
import type {
|
|
3
|
+
HeartbeatSeriesSample,
|
|
4
|
+
HeartbeatSeriesSamplesWithAnchorResponse,
|
|
5
|
+
} from '../types/HeartbeatSeries'
|
|
6
|
+
import type {
|
|
7
|
+
QueryOptionsWithAnchor,
|
|
8
|
+
QueryOptionsWithSortOrder,
|
|
9
|
+
} from '../types/QueryOptions'
|
|
10
|
+
|
|
11
|
+
export interface HeartbeatSeriesModule extends HybridObject<{ ios: 'swift' }> {
|
|
12
|
+
queryHeartbeatSeriesSamples(
|
|
13
|
+
options?: QueryOptionsWithSortOrder,
|
|
14
|
+
): Promise<readonly HeartbeatSeriesSample[]>
|
|
15
|
+
|
|
16
|
+
queryHeartbeatSeriesSamplesWithAnchor(
|
|
17
|
+
options: QueryOptionsWithAnchor,
|
|
18
|
+
): Promise<HeartbeatSeriesSamplesWithAnchorResponse>
|
|
19
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { AnyMap, HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
import type { QuantitySample } from '../types/QuantitySample'
|
|
3
|
+
import type {
|
|
4
|
+
IntervalComponents,
|
|
5
|
+
QuantitySamplesWithAnchorResponse,
|
|
6
|
+
QueryStatisticsResponse,
|
|
7
|
+
StatisticsOptions,
|
|
8
|
+
StatisticsQueryOptions,
|
|
9
|
+
} from '../types/QuantityType'
|
|
10
|
+
import type { QuantityTypeIdentifier } from '../types/QuantityTypeIdentifier'
|
|
11
|
+
import type {
|
|
12
|
+
FilterForSamples,
|
|
13
|
+
QueryOptionsWithAnchorAndUnit,
|
|
14
|
+
QueryOptionsWithSortOrderAndUnit,
|
|
15
|
+
} from '../types/QueryOptions'
|
|
16
|
+
|
|
17
|
+
export interface QuantityTypeModule extends HybridObject<{ ios: 'swift' }> {
|
|
18
|
+
isQuantityCompatibleWithUnit(
|
|
19
|
+
identifier: QuantityTypeIdentifier,
|
|
20
|
+
unit: string,
|
|
21
|
+
): boolean
|
|
22
|
+
|
|
23
|
+
saveQuantitySample(
|
|
24
|
+
identifier: QuantityTypeIdentifier,
|
|
25
|
+
unit: string,
|
|
26
|
+
value: number,
|
|
27
|
+
start: Date,
|
|
28
|
+
end: Date,
|
|
29
|
+
metadata: AnyMap,
|
|
30
|
+
): Promise<boolean>
|
|
31
|
+
|
|
32
|
+
deleteQuantitySamples(
|
|
33
|
+
identifier: QuantityTypeIdentifier,
|
|
34
|
+
filter: FilterForSamples,
|
|
35
|
+
): Promise<boolean>
|
|
36
|
+
|
|
37
|
+
queryQuantitySamples(
|
|
38
|
+
identifier: QuantityTypeIdentifier,
|
|
39
|
+
options?: QueryOptionsWithSortOrderAndUnit,
|
|
40
|
+
): Promise<readonly QuantitySample[]>
|
|
41
|
+
|
|
42
|
+
queryStatisticsForQuantity(
|
|
43
|
+
identifier: QuantityTypeIdentifier,
|
|
44
|
+
statistics: readonly StatisticsOptions[],
|
|
45
|
+
options?: StatisticsQueryOptions,
|
|
46
|
+
): Promise<QueryStatisticsResponse>
|
|
47
|
+
|
|
48
|
+
queryStatisticsCollectionForQuantity(
|
|
49
|
+
identifier: QuantityTypeIdentifier,
|
|
50
|
+
statistics: readonly StatisticsOptions[],
|
|
51
|
+
anchorDate: string,
|
|
52
|
+
intervalComponents: IntervalComponents,
|
|
53
|
+
options?: StatisticsQueryOptions,
|
|
54
|
+
): Promise<readonly QueryStatisticsResponse[]>
|
|
55
|
+
|
|
56
|
+
queryQuantitySamplesWithAnchor(
|
|
57
|
+
identifier: QuantityTypeIdentifier,
|
|
58
|
+
options: QueryOptionsWithAnchorAndUnit,
|
|
59
|
+
): Promise<QuantitySamplesWithAnchorResponse>
|
|
60
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
|
|
3
|
+
interface Source {
|
|
4
|
+
readonly name: string
|
|
5
|
+
readonly bundleIdentifier: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkobject/1615781-source Apple Docs }
|
|
10
|
+
*/
|
|
11
|
+
export interface SourceProxy extends HybridObject<{ ios: 'swift' }>, Source {
|
|
12
|
+
toJSON(key?: string): Source
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AnyMap, HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
import type { QueryOptionsWithSortOrder } from '../types/QueryOptions'
|
|
3
|
+
import type {
|
|
4
|
+
StateOfMindAssociation,
|
|
5
|
+
StateOfMindKind,
|
|
6
|
+
StateOfMindLabel,
|
|
7
|
+
StateOfMindSample,
|
|
8
|
+
} from '../types/StateOfMind'
|
|
9
|
+
|
|
10
|
+
export interface StateOfMindModule extends HybridObject<{ ios: 'swift' }> {
|
|
11
|
+
queryStateOfMindSamples(
|
|
12
|
+
options?: QueryOptionsWithSortOrder,
|
|
13
|
+
): Promise<readonly StateOfMindSample[]>
|
|
14
|
+
|
|
15
|
+
saveStateOfMindSample(
|
|
16
|
+
date: Date,
|
|
17
|
+
kind: StateOfMindKind,
|
|
18
|
+
valence: number,
|
|
19
|
+
labels: readonly StateOfMindLabel[],
|
|
20
|
+
associations: readonly StateOfMindAssociation[],
|
|
21
|
+
metadata?: AnyMap,
|
|
22
|
+
): Promise<boolean>
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
import type {
|
|
3
|
+
LocationForSaving,
|
|
4
|
+
WorkoutPlan,
|
|
5
|
+
WorkoutRoute,
|
|
6
|
+
WorkoutSample,
|
|
7
|
+
} from '../types/Workouts'
|
|
8
|
+
|
|
9
|
+
export interface WorkoutProxy
|
|
10
|
+
extends HybridObject<{ ios: 'swift' }>,
|
|
11
|
+
WorkoutSample {
|
|
12
|
+
toJSON(key?: string): WorkoutSample
|
|
13
|
+
saveWorkoutRoute(locations: readonly LocationForSaving[]): Promise<boolean>
|
|
14
|
+
getWorkoutPlan(): Promise<WorkoutPlan | null>
|
|
15
|
+
getWorkoutRoutes(): Promise<readonly WorkoutRoute[]>
|
|
16
|
+
|
|
17
|
+
// nice to have here: getAllStatistics and getStatisticsForQuantityType
|
|
18
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { AnyMap, HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
import type { WorkoutConfiguration } from '../types/WorkoutKit'
|
|
3
|
+
import type { WorkoutEventType } from '../types/Workouts'
|
|
4
|
+
|
|
5
|
+
export interface WorkoutSessionMirroringStartHandlerOptions {
|
|
6
|
+
onError(errorMessage: string): void
|
|
7
|
+
onStateChange(
|
|
8
|
+
toState: WorkoutSessionState,
|
|
9
|
+
fromState: WorkoutSessionState,
|
|
10
|
+
date: Date,
|
|
11
|
+
): void
|
|
12
|
+
onDataReceived(data: RemoteSessionSharableData[]): void
|
|
13
|
+
onEventReceived(type: WorkoutEventType): void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface WorkoutSessionModule extends HybridObject<{ ios: 'swift' }> {
|
|
17
|
+
/**
|
|
18
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648358-startwatchapp Apple Docs }
|
|
19
|
+
*/
|
|
20
|
+
startWatchAppWithWorkoutConfiguration(
|
|
21
|
+
workoutConfiguration: WorkoutConfiguration,
|
|
22
|
+
): Promise<boolean>
|
|
23
|
+
|
|
24
|
+
workoutSessionMirroringStartHandler(
|
|
25
|
+
/*onError: (event: WorkoutErrorEvent) => void,
|
|
26
|
+
onStateChange: (event: WorkoutStateChangeEvent) => void,
|
|
27
|
+
onDataReceived: (event: WorkoutDataReceivedEvent) => void,
|
|
28
|
+
onEventReceived: (event: WorkoutEventReceivedEvent) => void,*/
|
|
29
|
+
options: WorkoutSessionMirroringStartHandlerOptions,
|
|
30
|
+
): boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutsessionstate Apple Docs }
|
|
35
|
+
*/
|
|
36
|
+
export enum WorkoutSessionState {
|
|
37
|
+
NotStarted = 1,
|
|
38
|
+
Running = 2,
|
|
39
|
+
Ended = 3,
|
|
40
|
+
Paused = 4,
|
|
41
|
+
Prepared = 5,
|
|
42
|
+
Stopped = 6,
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface WorkoutStateChangeEvent {
|
|
46
|
+
readonly toState: WorkoutSessionState
|
|
47
|
+
readonly fromState: WorkoutSessionState
|
|
48
|
+
readonly date: Date
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface WorkoutErrorEvent {
|
|
52
|
+
readonly error: string
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface RemoteSessionSharableData {
|
|
56
|
+
readonly type: string
|
|
57
|
+
readonly payload: AnyMap
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface WorkoutDataReceivedEvent {
|
|
61
|
+
readonly data: readonly RemoteSessionSharableData[]
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface WorkoutEventReceivedEvent {
|
|
65
|
+
readonly type: WorkoutEventType
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/*type OnRemoteWorkoutStateChangeCallback = ;
|
|
69
|
+
type OnRemoteWorkoutErrorCallback = (event: WorkoutErrorEvent) => void;
|
|
70
|
+
type OnRemoteWorkoutDataCallback = (event: WorkoutDataReceivedEvent) => void;
|
|
71
|
+
type OnRemoteWorkoutEventReceivedCallback = (event: WorkoutEventReceivedEvent) => void;*/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AnyMap, HybridObject } from 'react-native-nitro-modules'
|
|
2
|
+
import type { QuantitySampleForSaving } from '../types/QuantitySample'
|
|
3
|
+
import type { WorkoutConfiguration } from '../types/WorkoutKit'
|
|
4
|
+
import type {
|
|
5
|
+
QueryWorkoutSamplesWithAnchorResponse,
|
|
6
|
+
WorkoutActivityType,
|
|
7
|
+
WorkoutQueryOptions,
|
|
8
|
+
WorkoutQueryOptionsWithAnchor,
|
|
9
|
+
WorkoutTotals,
|
|
10
|
+
} from '../types/Workouts'
|
|
11
|
+
import type { WorkoutProxy } from './WorkoutProxy.nitro'
|
|
12
|
+
|
|
13
|
+
export interface WorkoutsModule extends HybridObject<{ ios: 'swift' }> {
|
|
14
|
+
saveWorkoutSample(
|
|
15
|
+
workoutActivityType: WorkoutActivityType,
|
|
16
|
+
quantities: readonly QuantitySampleForSaving[],
|
|
17
|
+
startDate: Date,
|
|
18
|
+
endDate: Date,
|
|
19
|
+
totals: WorkoutTotals,
|
|
20
|
+
metadata: AnyMap,
|
|
21
|
+
): Promise<string>
|
|
22
|
+
|
|
23
|
+
queryWorkoutSamplesWithAnchor(
|
|
24
|
+
options: WorkoutQueryOptionsWithAnchor,
|
|
25
|
+
): Promise<QueryWorkoutSamplesWithAnchorResponse>
|
|
26
|
+
|
|
27
|
+
queryWorkoutSamples(options: WorkoutQueryOptions): Promise<WorkoutProxy[]>
|
|
28
|
+
|
|
29
|
+
startWatchAppWithWorkoutConfiguration(
|
|
30
|
+
workoutConfiguration: WorkoutConfiguration,
|
|
31
|
+
): Promise<boolean>
|
|
32
|
+
}
|
package/src/test-setup.ts
CHANGED
|
@@ -1,57 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
import { jest, mock } from 'bun:test'
|
|
2
|
+
import { deleteObjects } from '.'
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const mockModule = {
|
|
5
|
+
queryWorkoutSamplesWithAnchor: jest.fn(),
|
|
6
|
+
isHealthDataAvailable: jest.fn(),
|
|
7
|
+
isHealthDataAvailableAsync: jest.fn(),
|
|
8
|
+
isProtectedDataAvailable: jest.fn(),
|
|
9
|
+
authorizationStatusFor: jest.fn(),
|
|
10
|
+
requestAuthorization: jest.fn(),
|
|
11
|
+
saveQuantitySample: jest.fn(),
|
|
12
|
+
deleteQuantitySample: jest.fn(),
|
|
13
|
+
deleteSamples: jest.fn(),
|
|
14
|
+
deleteWorkoutSample: jest.fn(),
|
|
15
|
+
disableAllBackgroundDelivery: jest.fn(),
|
|
16
|
+
disableBackgroundDelivery: jest.fn(),
|
|
17
|
+
enableBackgroundDelivery: jest.fn(),
|
|
18
|
+
queryCategorySamplesWithAnchor: jest.fn(),
|
|
19
|
+
queryQuantitySamplesWithAnchor: jest.fn(),
|
|
20
|
+
getBiologicalSex: jest.fn(),
|
|
21
|
+
getBloodType: jest.fn(),
|
|
22
|
+
getDateOfBirth: jest.fn(),
|
|
23
|
+
getFitzpatrickSkinType: jest.fn(),
|
|
24
|
+
getPreferredUnits: jest.fn(),
|
|
25
|
+
getRequestStatusForAuthorization: jest.fn(),
|
|
26
|
+
getWheelchairUse: jest.fn(),
|
|
27
|
+
getWorkoutRoutes: jest.fn(),
|
|
28
|
+
queryCategorySamples: jest.fn(),
|
|
29
|
+
queryCorrelationSamples: jest.fn(),
|
|
30
|
+
queryHeartbeatSeriesSamples: jest.fn(),
|
|
31
|
+
queryHeartbeatSeriesSamplesWithAnchor: jest.fn(),
|
|
32
|
+
queryQuantitySamples: jest.fn(),
|
|
33
|
+
querySources: jest.fn(),
|
|
34
|
+
queryStatisticsForQuantity: jest.fn(),
|
|
35
|
+
queryStatisticsCollectionForQuantity: jest.fn(),
|
|
36
|
+
queryWorkoutSamples: jest.fn(),
|
|
37
|
+
saveStateOfMindSample: jest.fn(),
|
|
38
|
+
saveCategorySample: jest.fn(),
|
|
39
|
+
saveCorrelationSample: jest.fn(),
|
|
40
|
+
saveWorkoutSample: jest.fn(),
|
|
41
|
+
subscribeToObserverQuery: jest.fn(),
|
|
42
|
+
unsubscribeQuery: jest.fn(),
|
|
43
|
+
saveWorkoutRoute: jest.fn(),
|
|
44
|
+
getWorkoutPlanById: jest.fn(),
|
|
45
|
+
startWatchAppWithWorkoutConfiguration: jest.fn(),
|
|
46
|
+
deleteObjects: jest.fn(),
|
|
47
|
+
isQuantityCompatibleWithUnit: jest.fn(),
|
|
48
|
+
isObjectTypeAvailable: jest.fn(),
|
|
49
|
+
isObjectTypeAvailableAsync: jest.fn(),
|
|
50
|
+
areObjectTypesAvailable: jest.fn(),
|
|
51
|
+
areObjectTypesAvailableAsync: jest.fn(),
|
|
52
|
+
queryStateOfMindSamples: jest.fn(),
|
|
53
|
+
workoutSessionMirroringStartHandler: jest.fn(),
|
|
54
|
+
}
|
|
5
55
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
deleteWorkoutSample: jest.fn(),
|
|
17
|
-
disableAllBackgroundDelivery: jest.fn(),
|
|
18
|
-
disableBackgroundDelivery: jest.fn(),
|
|
19
|
-
enableBackgroundDelivery: jest.fn(),
|
|
20
|
-
queryCategorySamplesWithAnchor: jest.fn(),
|
|
21
|
-
queryQuantitySamplesWithAnchor: jest.fn(),
|
|
22
|
-
getBiologicalSex: jest.fn(),
|
|
23
|
-
getBloodType: jest.fn(),
|
|
24
|
-
getDateOfBirth: jest.fn(),
|
|
25
|
-
getFitzpatrickSkinType: jest.fn(),
|
|
26
|
-
getPreferredUnits: jest.fn(),
|
|
27
|
-
getRequestStatusForAuthorization: jest.fn(),
|
|
28
|
-
getWheelchairUse: jest.fn(),
|
|
29
|
-
getWorkoutRoutes: jest.fn(),
|
|
30
|
-
queryCategorySamples: jest.fn(),
|
|
31
|
-
queryCorrelationSamples: jest.fn(),
|
|
32
|
-
queryHeartbeatSeriesSamples: jest.fn(),
|
|
33
|
-
queryHeartbeatSeriesSamplesWithAnchor: jest.fn(),
|
|
34
|
-
queryQuantitySamples: jest.fn(),
|
|
35
|
-
querySources: jest.fn(),
|
|
36
|
-
queryStatisticsForQuantity: jest.fn(),
|
|
37
|
-
queryStatisticsCollectionForQuantity: jest.fn(),
|
|
38
|
-
queryWorkoutSamples: jest.fn(),
|
|
39
|
-
saveStateOfMindSample: jest.fn(),
|
|
40
|
-
saveCategorySample: jest.fn(),
|
|
41
|
-
saveCorrelationSample: jest.fn(),
|
|
42
|
-
saveWorkoutSample: jest.fn(),
|
|
43
|
-
subscribeToObserverQuery: jest.fn(),
|
|
44
|
-
unsubscribeQuery: jest.fn(),
|
|
45
|
-
saveWorkoutRoute: jest.fn(),
|
|
46
|
-
getWorkoutPlanById: jest.fn(),
|
|
47
|
-
startWatchAppWithWorkoutConfiguration: jest.fn(),
|
|
48
|
-
queryStateOfMindSamples: jest.fn(),
|
|
49
|
-
}
|
|
56
|
+
await mock.module('react-native-nitro-modules', () => ({
|
|
57
|
+
NitroModules: {
|
|
58
|
+
createHybridObject: jest.fn((moduleName: string) => {
|
|
59
|
+
if (moduleName === 'CoreModule') {
|
|
60
|
+
return mockModule
|
|
61
|
+
}
|
|
62
|
+
return mockModule
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
}))
|
|
50
66
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}))
|
|
57
|
-
})
|
|
67
|
+
await mock.module('react-native', () => ({
|
|
68
|
+
Platform: {
|
|
69
|
+
OS: 'ios',
|
|
70
|
+
},
|
|
71
|
+
}))
|
package/src/test-utils.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
2
1
|
import { act } from '@testing-library/react-native'
|
|
3
2
|
|
|
4
3
|
const waitForNextUpdate = async () => {
|
|
5
4
|
await act(async () => {
|
|
6
|
-
await new Promise((resolve) => {
|
|
5
|
+
await new Promise((resolve) => {
|
|
6
|
+
setTimeout(resolve, 0)
|
|
7
|
+
})
|
|
7
8
|
})
|
|
8
9
|
}
|
|
9
10
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkauthorizationrequeststatus Apple Docs }
|
|
3
|
+
*/
|
|
4
|
+
export enum AuthorizationRequestStatus {
|
|
5
|
+
unknown = 0,
|
|
6
|
+
shouldRequest = 1,
|
|
7
|
+
unnecessary = 2,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkauthorizationstatus Apple Docs }
|
|
12
|
+
*/
|
|
13
|
+
export enum AuthorizationStatus {
|
|
14
|
+
notDetermined = 0,
|
|
15
|
+
sharingDenied = 1,
|
|
16
|
+
sharingAuthorized = 2,
|
|
17
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { AnyMap } from 'react-native-nitro-modules'
|
|
2
|
+
import type { CategoryTypeIdentifier } from './CategoryTypeIdentifier'
|
|
3
|
+
import type { Device } from './Device'
|
|
4
|
+
import type { DeletedSample, GenericMetadata } from './Shared'
|
|
5
|
+
import type { SourceRevision } from './Source'
|
|
6
|
+
|
|
7
|
+
export type CategoryTypePresenceIdentifier =
|
|
8
|
+
| 'HKCategoryTypeIdentifierAppetiteChanges'
|
|
9
|
+
| 'HKCategoryTypeIdentifierSleepChanges'
|
|
10
|
+
|
|
11
|
+
export type CategoryTypeValueNotApplicableIdentifier =
|
|
12
|
+
| 'HKCategoryTypeIdentifierHighHeartRateEvent'
|
|
13
|
+
| 'HKCategoryTypeIdentifierIntermenstrualBleeding'
|
|
14
|
+
| 'HKCategoryTypeIdentifierMindfulSession'
|
|
15
|
+
| 'HKCategoryTypeIdentifierSexualActivity'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepregnancytestresult Apple Docs }
|
|
19
|
+
*/
|
|
20
|
+
enum CategoryValuePregnancyTestResult {
|
|
21
|
+
positive = 2,
|
|
22
|
+
negative = 1,
|
|
23
|
+
indeterminate = 3,
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type CategoryTypeSeverityIdentifier =
|
|
27
|
+
| 'HKCategoryTypeIdentifierAbdominalCramps'
|
|
28
|
+
| 'HKCategoryTypeIdentifierAcne'
|
|
29
|
+
| 'HKCategoryTypeIdentifierBladderIncontinence'
|
|
30
|
+
| 'HKCategoryTypeIdentifierBloating'
|
|
31
|
+
| 'HKCategoryTypeIdentifierBreastPain'
|
|
32
|
+
| 'HKCategoryTypeIdentifierChestTightnessOrPain'
|
|
33
|
+
| 'HKCategoryTypeIdentifierChills'
|
|
34
|
+
| 'HKCategoryTypeIdentifierConstipation'
|
|
35
|
+
| 'HKCategoryTypeIdentifierCoughing'
|
|
36
|
+
| 'HKCategoryTypeIdentifierDiarrhea'
|
|
37
|
+
| 'HKCategoryTypeIdentifierDizziness'
|
|
38
|
+
| 'HKCategoryTypeIdentifierDrySkin'
|
|
39
|
+
| 'HKCategoryTypeIdentifierFainting'
|
|
40
|
+
| 'HKCategoryTypeIdentifierFatigue'
|
|
41
|
+
| 'HKCategoryTypeIdentifierFever'
|
|
42
|
+
| 'HKCategoryTypeIdentifierGeneralizedBodyAche'
|
|
43
|
+
| 'HKCategoryTypeIdentifierHairLoss'
|
|
44
|
+
| 'HKCategoryTypeIdentifierHeadache'
|
|
45
|
+
| 'HKCategoryTypeIdentifierHeartburn'
|
|
46
|
+
| 'HKCategoryTypeIdentifierHotFlashes'
|
|
47
|
+
| 'HKCategoryTypeIdentifierLossOfSmell'
|
|
48
|
+
| 'HKCategoryTypeIdentifierLossOfTaste'
|
|
49
|
+
| 'HKCategoryTypeIdentifierLowerBackPain'
|
|
50
|
+
| 'HKCategoryTypeIdentifierMemoryLapse'
|
|
51
|
+
| 'HKCategoryTypeIdentifierMoodChanges'
|
|
52
|
+
| 'HKCategoryTypeIdentifierNausea'
|
|
53
|
+
| 'HKCategoryTypeIdentifierNightSweats'
|
|
54
|
+
| 'HKCategoryTypeIdentifierPelvicPain'
|
|
55
|
+
| 'HKCategoryTypeIdentifierRapidPoundingOrFlutteringHeartbeat'
|
|
56
|
+
| 'HKCategoryTypeIdentifierRunnyNose'
|
|
57
|
+
| 'HKCategoryTypeIdentifierShortnessOfBreath'
|
|
58
|
+
| 'HKCategoryTypeIdentifierSinusCongestion'
|
|
59
|
+
| 'HKCategoryTypeIdentifierSkippedHeartbeat'
|
|
60
|
+
| 'HKCategoryTypeIdentifierSoreThroat'
|
|
61
|
+
| 'HKCategoryTypeIdentifierVaginalDryness'
|
|
62
|
+
| 'HKCategoryTypeIdentifierVomiting'
|
|
63
|
+
| 'HKCategoryTypeIdentifierWheezing'
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluecervicalmucusquality Apple Docs }
|
|
67
|
+
*/
|
|
68
|
+
export enum CategoryValueCervicalMucusQuality {
|
|
69
|
+
dry = 1,
|
|
70
|
+
sticky = 2,
|
|
71
|
+
creamy = 3,
|
|
72
|
+
watery = 4,
|
|
73
|
+
eggWhite = 5,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluemenstrualflow Apple Docs }
|
|
78
|
+
*/
|
|
79
|
+
export enum CategoryValueMenstrualFlow {
|
|
80
|
+
unspecified = 1,
|
|
81
|
+
none = 5,
|
|
82
|
+
light = 2,
|
|
83
|
+
medium = 3,
|
|
84
|
+
heavy = 4,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueovulationtestresult Apple Docs }
|
|
89
|
+
*/
|
|
90
|
+
export enum CategoryValueOvulationTestResult {
|
|
91
|
+
negative = 1,
|
|
92
|
+
luteinizingHormoneSurge = 2,
|
|
93
|
+
indeterminate = 3,
|
|
94
|
+
estrogenSurge = 4,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluesleepanalysis Apple Docs }
|
|
99
|
+
*/
|
|
100
|
+
export enum CategoryValueSleepAnalysis {
|
|
101
|
+
inBed = 0,
|
|
102
|
+
asleepUnspecified = 1,
|
|
103
|
+
awake = 2,
|
|
104
|
+
asleepCore = 3,
|
|
105
|
+
asleepDeep = 4,
|
|
106
|
+
asleepREM = 5,
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueappetitechanges Apple Docs}
|
|
111
|
+
*/
|
|
112
|
+
export enum CategoryValueAppetiteChanges {
|
|
113
|
+
decreased = 2,
|
|
114
|
+
increased = 3,
|
|
115
|
+
noChange = 1,
|
|
116
|
+
unspecified = 0,
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepresence Apple Docs}
|
|
121
|
+
*/
|
|
122
|
+
export enum CategoryValuePresence {
|
|
123
|
+
notPresent = 1,
|
|
124
|
+
present = 0,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueseverity Apple Docs }
|
|
129
|
+
*/
|
|
130
|
+
export enum CategoryValueSeverity {
|
|
131
|
+
notPresent = 1,
|
|
132
|
+
mild = 2,
|
|
133
|
+
moderate = 3,
|
|
134
|
+
severe = 4,
|
|
135
|
+
unspecified = 0,
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalue/notapplicable Apple Docs }
|
|
140
|
+
*/
|
|
141
|
+
export enum CategoryValueNotApplicable {
|
|
142
|
+
notApplicable = 0,
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export enum CategoryValueLowCardioFitnessEvent {
|
|
146
|
+
lowFitness = 1,
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalue Apple Docs }
|
|
151
|
+
*/
|
|
152
|
+
export type CategoryValue =
|
|
153
|
+
| CategoryValueAppetiteChanges
|
|
154
|
+
| CategoryValueCervicalMucusQuality
|
|
155
|
+
| CategoryValueLowCardioFitnessEvent
|
|
156
|
+
| CategoryValueMenstrualFlow
|
|
157
|
+
| CategoryValueOvulationTestResult
|
|
158
|
+
| CategoryValuePresence
|
|
159
|
+
| CategoryValueSeverity
|
|
160
|
+
| CategoryValueSleepAnalysis
|
|
161
|
+
| number
|
|
162
|
+
|
|
163
|
+
export enum CategoryValueAppleStandHour {
|
|
164
|
+
stood = 0,
|
|
165
|
+
idle = 1,
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface CategorySampleForSaving {
|
|
169
|
+
readonly start: Date
|
|
170
|
+
readonly end: Date
|
|
171
|
+
readonly categoryType: CategoryTypeIdentifier
|
|
172
|
+
readonly value: CategoryValueForIdentifier
|
|
173
|
+
readonly metadata: AnyMap
|
|
174
|
+
readonly sourceRevision?: SourceRevision
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export interface CategorySamplesWithAnchorResponse {
|
|
178
|
+
readonly samples: readonly CategorySample[]
|
|
179
|
+
readonly deletedSamples: readonly DeletedSample[]
|
|
180
|
+
readonly newAnchor: string
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface CategorySample {
|
|
184
|
+
readonly uuid: string
|
|
185
|
+
readonly device?: Device
|
|
186
|
+
readonly categoryType: CategoryTypeIdentifier
|
|
187
|
+
readonly startDate: Date
|
|
188
|
+
readonly endDate: Date
|
|
189
|
+
readonly value: CategoryValueForIdentifier
|
|
190
|
+
readonly metadata: AnyMap
|
|
191
|
+
readonly sourceRevision?: SourceRevision
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export interface CategorySamplesWithAnchorResponseTyped<
|
|
195
|
+
T extends CategoryTypeIdentifier,
|
|
196
|
+
> {
|
|
197
|
+
readonly samples: readonly CategorySampleTyped<T>[]
|
|
198
|
+
readonly deletedSamples: readonly DeletedSample[]
|
|
199
|
+
readonly newAnchor: string
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface CategorySampleTyped<T extends CategoryTypeIdentifier> {
|
|
203
|
+
readonly uuid: string
|
|
204
|
+
readonly device?: Device
|
|
205
|
+
readonly categoryType: T
|
|
206
|
+
readonly startDate: Date
|
|
207
|
+
readonly endDate: Date
|
|
208
|
+
readonly value: CategoryValueForIdentifier<T>
|
|
209
|
+
readonly metadata: MetadataForCategoryIdentifier<T>
|
|
210
|
+
readonly sourceRevision?: SourceRevision
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export type MetadataForCategoryIdentifier<
|
|
214
|
+
T extends CategoryTypeIdentifier = CategoryTypeIdentifier,
|
|
215
|
+
> = T extends 'HKCategoryTypeIdentifierSexualActivity'
|
|
216
|
+
? GenericMetadata & {
|
|
217
|
+
readonly HKSexualActivityProtectionUsed: boolean
|
|
218
|
+
}
|
|
219
|
+
: T extends 'HKCategoryTypeIdentifierMenstrualFlow'
|
|
220
|
+
? GenericMetadata & {
|
|
221
|
+
readonly HKMenstrualCycleStart: boolean
|
|
222
|
+
}
|
|
223
|
+
: GenericMetadata
|
|
224
|
+
|
|
225
|
+
export type CategoryValueForIdentifier<
|
|
226
|
+
T extends CategoryTypeIdentifier = CategoryTypeIdentifier,
|
|
227
|
+
> = T extends 'HKCategoryTypeIdentifierCervicalMucusQuality'
|
|
228
|
+
? CategoryValueCervicalMucusQuality
|
|
229
|
+
: T extends 'CategoryTypeIdentifierMenstrualFlow'
|
|
230
|
+
? CategoryValueMenstrualFlow
|
|
231
|
+
: T extends 'HKCategoryTypeIdentifierOvulationTestResult'
|
|
232
|
+
? CategoryValueOvulationTestResult
|
|
233
|
+
: T extends 'HKCategoryTypeIdentifierSleepAnalysis'
|
|
234
|
+
? CategoryValueSleepAnalysis
|
|
235
|
+
: T extends CategoryTypeValueNotApplicableIdentifier
|
|
236
|
+
? CategoryValueNotApplicable
|
|
237
|
+
: T extends CategoryTypeSeverityIdentifier
|
|
238
|
+
? CategoryValueSeverity
|
|
239
|
+
: T extends CategoryTypePresenceIdentifier
|
|
240
|
+
? CategoryValuePresence
|
|
241
|
+
: T extends 'HKCategoryTypeIdentifierLowCardioFitnessEvent'
|
|
242
|
+
? CategoryValueLowCardioFitnessEvent
|
|
243
|
+
: T extends 'HKCategoryTypeIdentifierPregnancyTestResult'
|
|
244
|
+
? CategoryValuePregnancyTestResult
|
|
245
|
+
: T extends 'HKCategoryTypeIdentifierPregnancyTestResult'
|
|
246
|
+
? CategoryValuePregnancyTestResult
|
|
247
|
+
: T extends 'HKCategoryTypeIdentifierAppleStandHour'
|
|
248
|
+
? CategoryValueAppleStandHour
|
|
249
|
+
: number
|