@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,69 @@
|
|
|
1
|
+
import type { WorkoutProxy } from '../specs/WorkoutProxy.nitro'
|
|
2
|
+
|
|
3
|
+
type PredicateWithUUID = {
|
|
4
|
+
readonly uuid: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type PredicateWithUUIDs = {
|
|
8
|
+
readonly uuids: readonly string[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type PredicateWithStartAndEnd = {
|
|
12
|
+
readonly startDate?: Date
|
|
13
|
+
readonly endDate?: Date
|
|
14
|
+
readonly strictEndDate?: boolean
|
|
15
|
+
readonly strictStartDate?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type PredicateWithMetadataKey = {
|
|
19
|
+
readonly withMetadataKey: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export type FilterForSamplesAnd = {
|
|
23
|
+
AND: PredicateForSamples[]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type FilterForSamplesOr = {
|
|
27
|
+
OR: PredicateForSamples[]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type PredicateFromWorkout = {
|
|
31
|
+
workout: WorkoutProxy
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type FilterForSamples =
|
|
35
|
+
| PredicateForSamples
|
|
36
|
+
| FilterForSamplesAnd
|
|
37
|
+
| FilterForSamplesOr
|
|
38
|
+
|
|
39
|
+
export type PredicateForSamples =
|
|
40
|
+
| PredicateWithUUID
|
|
41
|
+
| PredicateWithUUIDs
|
|
42
|
+
| PredicateWithMetadataKey
|
|
43
|
+
| PredicateWithStartAndEnd
|
|
44
|
+
| PredicateFromWorkout
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Generic options for querying.
|
|
48
|
+
*/
|
|
49
|
+
export interface GenericQueryOptions {
|
|
50
|
+
filter?: FilterForSamples
|
|
51
|
+
readonly limit?: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export interface QueryOptionsWithAnchor extends GenericQueryOptions {
|
|
55
|
+
readonly anchor?: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface QueryOptionsWithSortOrder extends GenericQueryOptions {
|
|
59
|
+
readonly ascending?: boolean
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface QueryOptionsWithSortOrderAndUnit
|
|
63
|
+
extends QueryOptionsWithSortOrder {
|
|
64
|
+
readonly unit?: string
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface QueryOptionsWithAnchorAndUnit extends QueryOptionsWithAnchor {
|
|
68
|
+
readonly unit?: string
|
|
69
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Interface Verification Utility
|
|
2
|
+
|
|
3
|
+
A TypeScript utility for ensuring that typed and untyped versions of interfaces stay in sync during development.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
When working with libraries like `react-native-nitro-modules`, you often have two versions of an interface:
|
|
8
|
+
1. A base interface that extends `HybridObject` (for the native bridge)
|
|
9
|
+
2. A typed interface with generics for better type safety
|
|
10
|
+
|
|
11
|
+
This utility ensures both interfaces have the same method names and parameter counts, catching mismatches at compile-time.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { InterfaceAssertion } from "../types/InterfaceVerification";
|
|
17
|
+
|
|
18
|
+
// Base interface
|
|
19
|
+
export interface MyModule extends HybridObject<{ ios: "swift" }> {
|
|
20
|
+
getData(id: string): Promise<string>;
|
|
21
|
+
saveData(id: string, data: string): Promise<boolean>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Typed interface
|
|
25
|
+
export interface MyModuleTyped {
|
|
26
|
+
getData<T extends string>(id: T): Promise<string>;
|
|
27
|
+
saveData<T extends string>(id: T, data: string): Promise<boolean>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Verification - will cause TypeScript error if interfaces don't match
|
|
31
|
+
const _verification: InterfaceAssertion<MyModule, MyModuleTyped, keyof HybridObject> = true;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- ✅ **Method name verification** - Ensures both interfaces have the same methods
|
|
37
|
+
- ✅ **Parameter count verification** - Ensures corresponding methods have the same number of parameters
|
|
38
|
+
- ✅ **Descriptive error messages** - Shows exactly what's missing or mismatched
|
|
39
|
+
- ✅ **Zero runtime cost** - Pure TypeScript types with no JavaScript output
|
|
40
|
+
- ✅ **Compile-time checking** - Catches issues during development, not runtime
|
|
41
|
+
|
|
42
|
+
## Error Types
|
|
43
|
+
|
|
44
|
+
### Interface Mismatch
|
|
45
|
+
When method names don't match between interfaces:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// Error: Interface mismatch detected
|
|
49
|
+
// MissingInBase: "newMethod"
|
|
50
|
+
// MissingInTyped: never
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Parameter Count Mismatch
|
|
54
|
+
When corresponding methods have different parameter counts:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
// Error: Parameter count mismatch detected
|
|
58
|
+
// MethodsWithParameterCountMismatch: "getData"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## API Reference
|
|
62
|
+
|
|
63
|
+
### `InterfaceAssertion<BaseInterface, TypedInterface, ExcludeFromBase>`
|
|
64
|
+
|
|
65
|
+
Main utility type for interface verification.
|
|
66
|
+
|
|
67
|
+
**Parameters:**
|
|
68
|
+
- `BaseInterface` - The base interface (usually extending HybridObject)
|
|
69
|
+
- `TypedInterface` - The typed interface with generics
|
|
70
|
+
- `ExcludeFromBase` - Keys to exclude from the base interface (e.g., `keyof HybridObject`)
|
|
71
|
+
|
|
72
|
+
**Returns:**
|
|
73
|
+
- `true` if interfaces match
|
|
74
|
+
- Error object with descriptive message if they don't match
|
|
75
|
+
|
|
76
|
+
### Other Utility Types
|
|
77
|
+
|
|
78
|
+
- `ExtractMethodNames<T, ExcludeKeys>` - Extracts method names from an interface
|
|
79
|
+
- `GetParameterCount<T>` - Gets parameter count of a function type
|
|
80
|
+
- `CheckMethodNames<BaseInterface, TypedInterface, ExcludeFromBase>` - Detailed method name comparison
|
|
81
|
+
- `CheckParameterCounts<BaseInterface, TypedInterface, ExcludeFromBase>` - Detailed parameter count comparison
|
|
82
|
+
|
|
83
|
+
## Usage in Your Project
|
|
84
|
+
|
|
85
|
+
1. Copy `InterfaceVerification.ts` to your project
|
|
86
|
+
2. Import `InterfaceAssertion` in your module files
|
|
87
|
+
3. Add verification lines after your interface definitions
|
|
88
|
+
4. TypeScript will show errors if interfaces don't match
|
|
89
|
+
|
|
90
|
+
## Best Practices
|
|
91
|
+
|
|
92
|
+
1. **Always exclude inherited keys** - Use `keyof HybridObject` or similar to exclude inherited methods
|
|
93
|
+
2. **Add verification immediately** - Add the verification line right after defining both interfaces
|
|
94
|
+
3. **Use descriptive naming** - Name your verification constants with `_verification` or similar
|
|
95
|
+
4. **Keep interfaces close** - Define both interfaces in the same file when possible
|
|
96
|
+
|
|
97
|
+
## Examples
|
|
98
|
+
|
|
99
|
+
See `InterfaceVerificationExample.ts` for complete examples including:
|
|
100
|
+
- Basic interfaces
|
|
101
|
+
- Interfaces with optional parameters
|
|
102
|
+
- What happens when interfaces don't match
|
|
103
|
+
- Real-world usage patterns
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CategoryTypeIdentifier,
|
|
3
|
+
CategoryTypeIdentifierWriteable,
|
|
4
|
+
} from './CategoryTypeIdentifier'
|
|
5
|
+
import type {
|
|
6
|
+
QuantityTypeIdentifier,
|
|
7
|
+
QuantityTypeIdentifierWriteable,
|
|
8
|
+
} from './QuantityTypeIdentifier'
|
|
9
|
+
|
|
10
|
+
import type {
|
|
11
|
+
HeartbeatSeriesTypeIdentifier,
|
|
12
|
+
StateOfMindTypeIdentifier,
|
|
13
|
+
WorkoutRouteTypeIdentifier,
|
|
14
|
+
WorkoutTypeIdentifier,
|
|
15
|
+
} from './Constants'
|
|
16
|
+
|
|
17
|
+
import type { AnyMap } from 'react-native-nitro-modules'
|
|
18
|
+
import type { CharacteristicTypeIdentifier } from './Characteristics'
|
|
19
|
+
import type { CorrelationTypeIdentifier } from './CorrelationType'
|
|
20
|
+
|
|
21
|
+
export interface GenericMetadata {
|
|
22
|
+
readonly HKExternalUUID?: string
|
|
23
|
+
readonly HKTimeZone?: string
|
|
24
|
+
readonly HKWasUserEntered?: boolean
|
|
25
|
+
readonly HKDeviceSerialNumber?: string
|
|
26
|
+
readonly HKUDIDeviceIdentifier?: string
|
|
27
|
+
readonly HKUDIProductionIdentifier?: string
|
|
28
|
+
readonly HKDigitalSignature?: string
|
|
29
|
+
readonly HKDeviceName?: string
|
|
30
|
+
readonly HKDeviceManufacturerName?: string
|
|
31
|
+
readonly HKSyncIdentifier?: string
|
|
32
|
+
readonly HKSyncVersion?: number
|
|
33
|
+
readonly HKWasTakenInLab?: boolean
|
|
34
|
+
readonly HKReferenceRangeLowerLimit?: number
|
|
35
|
+
readonly HKReferenceRangeUpperLimit?: number
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface DeletedSample {
|
|
39
|
+
readonly uuid: string
|
|
40
|
+
readonly metadata?: AnyMap
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type ObjectTypeIdentifier =
|
|
44
|
+
| CharacteristicTypeIdentifier
|
|
45
|
+
| SampleTypeIdentifier
|
|
46
|
+
| typeof ActivitySummaryTypeIdentifier
|
|
47
|
+
|
|
48
|
+
export type SampleTypeIdentifier =
|
|
49
|
+
| CategoryTypeIdentifier
|
|
50
|
+
| CorrelationTypeIdentifier
|
|
51
|
+
| QuantityTypeIdentifier
|
|
52
|
+
| typeof StateOfMindTypeIdentifier
|
|
53
|
+
| typeof AudiogramTypeIdentifier
|
|
54
|
+
| typeof HeartbeatSeriesTypeIdentifier
|
|
55
|
+
| typeof WorkoutRouteTypeIdentifier
|
|
56
|
+
| typeof WorkoutTypeIdentifier
|
|
57
|
+
|
|
58
|
+
export type SampleTypeIdentifierWriteable =
|
|
59
|
+
| CategoryTypeIdentifierWriteable
|
|
60
|
+
| CorrelationTypeIdentifier
|
|
61
|
+
| QuantityTypeIdentifierWriteable
|
|
62
|
+
| typeof StateOfMindTypeIdentifier
|
|
63
|
+
| typeof AudiogramTypeIdentifier
|
|
64
|
+
| typeof HeartbeatSeriesTypeIdentifier
|
|
65
|
+
| typeof WorkoutRouteTypeIdentifier
|
|
66
|
+
| typeof WorkoutTypeIdentifier
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Represents a type that identifies activity summary objects.
|
|
70
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkactivitysummarytype Apple Docs HKActivitySummaryType}
|
|
71
|
+
*/
|
|
72
|
+
export const ActivitySummaryTypeIdentifier =
|
|
73
|
+
'ActivitySummaryTypeIdentifier' as const
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Represents an audiogram type identifier.
|
|
77
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/HKAudiogramSampleType Apple Docs HKAudiogramSampleType}
|
|
78
|
+
*/
|
|
79
|
+
export const AudiogramTypeIdentifier = 'HKAudiogramSampleType' as const
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SourceProxy } from '../specs/SourceProxy.nitro'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkobject/1615483-sourcerevision Apple Docs }
|
|
5
|
+
*/
|
|
6
|
+
export interface SourceRevision {
|
|
7
|
+
readonly source?: SourceProxy
|
|
8
|
+
readonly version?: string
|
|
9
|
+
readonly operatingSystemVersion?: string | null
|
|
10
|
+
readonly productType?: string | null
|
|
11
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { AnyMap } from 'react-native-nitro-modules'
|
|
2
|
+
import type { Device } from './Device'
|
|
3
|
+
import type { SourceRevision } from './Source'
|
|
4
|
+
|
|
5
|
+
export enum StateOfMindValenceClassification {
|
|
6
|
+
veryUnpleasant = 1,
|
|
7
|
+
unpleasant = 2,
|
|
8
|
+
slightlyUnpleasant = 3,
|
|
9
|
+
neutral = 4,
|
|
10
|
+
slightlyPleasant = 5,
|
|
11
|
+
pleasant = 6,
|
|
12
|
+
veryPleasant = 7,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface StateOfMindSample {
|
|
16
|
+
readonly uuid: string
|
|
17
|
+
readonly device?: Device
|
|
18
|
+
readonly startDate: Date
|
|
19
|
+
readonly endDate: Date
|
|
20
|
+
readonly metadata?: AnyMap
|
|
21
|
+
readonly sourceRevision?: SourceRevision
|
|
22
|
+
// State of mind sample properties
|
|
23
|
+
/**
|
|
24
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/4337998-valence Apple Docs }
|
|
25
|
+
* Value between -1 and 1
|
|
26
|
+
*/
|
|
27
|
+
readonly valence: number
|
|
28
|
+
readonly kind: StateOfMindKind
|
|
29
|
+
readonly valenceClassification: StateOfMindValenceClassification
|
|
30
|
+
readonly associations: readonly StateOfMindAssociation[]
|
|
31
|
+
readonly labels: readonly StateOfMindLabel[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/label Apple Docs}
|
|
36
|
+
*/
|
|
37
|
+
export enum StateOfMindLabel {
|
|
38
|
+
amazed = 1,
|
|
39
|
+
amused = 2,
|
|
40
|
+
angry = 3,
|
|
41
|
+
anxious = 4,
|
|
42
|
+
ashamed = 5,
|
|
43
|
+
brave = 6,
|
|
44
|
+
calm = 7,
|
|
45
|
+
content = 8,
|
|
46
|
+
disappointed = 9,
|
|
47
|
+
discouraged = 10,
|
|
48
|
+
disgusted = 11,
|
|
49
|
+
embarrassed = 12,
|
|
50
|
+
excited = 13,
|
|
51
|
+
frustrated = 14,
|
|
52
|
+
grateful = 15,
|
|
53
|
+
guilty = 16,
|
|
54
|
+
happy = 17,
|
|
55
|
+
hopeless = 18,
|
|
56
|
+
irritated = 19,
|
|
57
|
+
jealous = 20,
|
|
58
|
+
joyful = 21,
|
|
59
|
+
lonely = 22,
|
|
60
|
+
passionate = 23,
|
|
61
|
+
peaceful = 24,
|
|
62
|
+
proud = 25,
|
|
63
|
+
relieved = 26,
|
|
64
|
+
sad = 27,
|
|
65
|
+
scared = 28,
|
|
66
|
+
stressed = 29,
|
|
67
|
+
surprised = 30,
|
|
68
|
+
worried = 31,
|
|
69
|
+
|
|
70
|
+
annoyed = 32,
|
|
71
|
+
confident = 33,
|
|
72
|
+
drained = 34,
|
|
73
|
+
hopeful = 35,
|
|
74
|
+
indifferent = 36,
|
|
75
|
+
overwhelmed = 37,
|
|
76
|
+
satisfied = 38,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/kind Apple Docs}
|
|
81
|
+
*/
|
|
82
|
+
export enum StateOfMindKind {
|
|
83
|
+
dailyMood = 2,
|
|
84
|
+
momentaryEmotion = 1,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/association Apple Docs}
|
|
89
|
+
* @since iOS 17.0+
|
|
90
|
+
*/
|
|
91
|
+
export enum StateOfMindAssociation {
|
|
92
|
+
community = 1,
|
|
93
|
+
currentEvents = 2,
|
|
94
|
+
dating = 3,
|
|
95
|
+
education = 4,
|
|
96
|
+
family = 5,
|
|
97
|
+
fitness = 6,
|
|
98
|
+
friends = 7,
|
|
99
|
+
health = 8,
|
|
100
|
+
hobbies = 9,
|
|
101
|
+
identity = 10,
|
|
102
|
+
money = 11,
|
|
103
|
+
partner = 12,
|
|
104
|
+
selfCare = 13,
|
|
105
|
+
spirituality = 14,
|
|
106
|
+
tasks = 15,
|
|
107
|
+
travel = 16,
|
|
108
|
+
work = 17,
|
|
109
|
+
weather = 18,
|
|
110
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// Unit types are a straight mapping from here https://developer.apple.com/documentation/healthkit/hkunit/1615733-init
|
|
2
|
+
export type MetricPrefix =
|
|
3
|
+
| ''
|
|
4
|
+
| 'p'
|
|
5
|
+
| 'n'
|
|
6
|
+
| 'mc'
|
|
7
|
+
| 'm'
|
|
8
|
+
| 'c'
|
|
9
|
+
| 'd'
|
|
10
|
+
| 'da'
|
|
11
|
+
| 'h'
|
|
12
|
+
| 'k'
|
|
13
|
+
| 'M'
|
|
14
|
+
| 'G'
|
|
15
|
+
| 'T'
|
|
16
|
+
| 'f'
|
|
17
|
+
|
|
18
|
+
export type UnitMetric =
|
|
19
|
+
| 'g'
|
|
20
|
+
| 'J'
|
|
21
|
+
| 'K'
|
|
22
|
+
| 'l'
|
|
23
|
+
| 'm'
|
|
24
|
+
| 'Pa'
|
|
25
|
+
| 's'
|
|
26
|
+
| 'S'
|
|
27
|
+
| 'Hz'
|
|
28
|
+
| 'V'
|
|
29
|
+
|
|
30
|
+
export type Units =
|
|
31
|
+
| 'dBHL'
|
|
32
|
+
| 'dBASPL'
|
|
33
|
+
| '%'
|
|
34
|
+
| 'count'
|
|
35
|
+
| 'IU'
|
|
36
|
+
| 'appleEffortScore'
|
|
37
|
+
|
|
38
|
+
export type MeterUnit<Prefix extends MetricPrefix> = `${Prefix}m`
|
|
39
|
+
export type LiterUnit<Prefix extends MetricPrefix> = `${Prefix}l`
|
|
40
|
+
export type GramUnit<Prefix extends MetricPrefix> = `${Prefix}g`
|
|
41
|
+
export type PascalUnit<Prefix extends MetricPrefix> = `${Prefix}Pa`
|
|
42
|
+
export type SecondUnit<Prefix extends MetricPrefix> = `${Prefix}s`
|
|
43
|
+
export type JouleUnit<Prefix extends MetricPrefix> = `${Prefix}J`
|
|
44
|
+
export type HertzUnit<Prefix extends MetricPrefix> = `${Prefix}Hz`
|
|
45
|
+
export type VoltUnit<Prefix extends MetricPrefix> = `${Prefix}V`
|
|
46
|
+
export type SiemenUnit<Prefix extends MetricPrefix> = `${Prefix}S`
|
|
47
|
+
|
|
48
|
+
// not 100% sure about these
|
|
49
|
+
export type MoleUnit<MolarMass extends number> = `mol<${MolarMass}>`
|
|
50
|
+
export type MoleUnitWith<
|
|
51
|
+
MolarMass extends number,
|
|
52
|
+
Prefix extends MetricPrefix,
|
|
53
|
+
> = `${Prefix}mol<${MolarMass}>`
|
|
54
|
+
|
|
55
|
+
export type FrequencyUnit = HertzUnit<MetricPrefix>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* More SI prefixes also available as literals, just type the string
|
|
59
|
+
* @example 'cm', 'km'
|
|
60
|
+
*/
|
|
61
|
+
export type UnitOfLength =
|
|
62
|
+
| 'ft'
|
|
63
|
+
/**
|
|
64
|
+
* More SI prefixes also available as literals, just type the string
|
|
65
|
+
* @example 'cm', 'km'
|
|
66
|
+
*/
|
|
67
|
+
| 'm'
|
|
68
|
+
| 'in'
|
|
69
|
+
| 'yd'
|
|
70
|
+
| 'mi'
|
|
71
|
+
|
|
72
|
+
export type LengthUnit = MeterUnit<MetricPrefix> | UnitOfLength
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* More SI prefixes also available as literals, just type the string
|
|
76
|
+
* @example 'ml', 'cl'
|
|
77
|
+
*/
|
|
78
|
+
export type UnitOfVolume =
|
|
79
|
+
| 'cup_imp'
|
|
80
|
+
| 'fl_oz_imp'
|
|
81
|
+
| 'pt_imp'
|
|
82
|
+
| 'cup_us'
|
|
83
|
+
| 'fl_oz_us'
|
|
84
|
+
| 'pt_us'
|
|
85
|
+
/**
|
|
86
|
+
* More SI prefixes also available as literals, just type the string
|
|
87
|
+
* @example 'ml', 'cl'
|
|
88
|
+
*/
|
|
89
|
+
| 'l'
|
|
90
|
+
|
|
91
|
+
export type VolumeUnit = LiterUnit<MetricPrefix> | UnitOfVolume
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* More SI prefixes also available as literals, just type the string
|
|
95
|
+
* @example 'mg', 'kg'
|
|
96
|
+
*/
|
|
97
|
+
export type UnitOfMass =
|
|
98
|
+
| 'oz'
|
|
99
|
+
| 'st'
|
|
100
|
+
| 'lb'
|
|
101
|
+
/**
|
|
102
|
+
* More SI prefixes also available as literals, just type the string
|
|
103
|
+
* @example 'mg', 'kg'
|
|
104
|
+
*/
|
|
105
|
+
| 'g'
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* More SI prefixes also available as literals, just type the string
|
|
109
|
+
* @example 'mg', 'kg'
|
|
110
|
+
*/
|
|
111
|
+
export type MassUnit = GramUnit<MetricPrefix> | UnitOfMass
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* More SI prefixes also available as literals, just type the string
|
|
115
|
+
* @example 'kPa', 'hPa'
|
|
116
|
+
*/
|
|
117
|
+
export type UnitOfPressure =
|
|
118
|
+
| 'atm'
|
|
119
|
+
| 'cmAq'
|
|
120
|
+
| 'mmHg'
|
|
121
|
+
| 'inHg'
|
|
122
|
+
| 'dBASPL'
|
|
123
|
+
/**
|
|
124
|
+
* More SI prefixes also available as literals, just type the string
|
|
125
|
+
* @example 'kPa', 'hPa'
|
|
126
|
+
*/
|
|
127
|
+
| 'Pa'
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* More SI prefixes also available as literals, just type the string
|
|
131
|
+
* @example 'kPa', 'hPa'
|
|
132
|
+
*/
|
|
133
|
+
export type PressureUnit = PascalUnit<MetricPrefix> | UnitOfPressure
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* More SI prefixes also available as literals, just type the string
|
|
137
|
+
* @example 'ms'
|
|
138
|
+
*/
|
|
139
|
+
export type UnitOfTime =
|
|
140
|
+
| 'd'
|
|
141
|
+
| 'min'
|
|
142
|
+
| 'hr'
|
|
143
|
+
/**
|
|
144
|
+
* More SI prefixes also available as literals, just type the string
|
|
145
|
+
* @example 'ms'
|
|
146
|
+
*/
|
|
147
|
+
| 's'
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* More SI prefixes also available as literals, just type the string
|
|
151
|
+
* @example 'ms'
|
|
152
|
+
*/
|
|
153
|
+
export type TimeUnit = SecondUnit<MetricPrefix> | UnitOfTime
|
|
154
|
+
export type TemperatureUnit = 'degC' | 'degF' | 'K'
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* More SI prefixes also available as literals, just type the string
|
|
158
|
+
* @example 'kJ'
|
|
159
|
+
*/
|
|
160
|
+
export type UnitOfEnergy = 'kcal' | 'Cal' | 'cal' | 'J'
|
|
161
|
+
|
|
162
|
+
export type EnergyUnit = JouleUnit<MetricPrefix> | UnitOfEnergy
|
|
163
|
+
|
|
164
|
+
export type BloodGlucoseUnit = 'mmol<180.15588000005408>/l' | 'mg/dL'
|
|
165
|
+
|
|
166
|
+
export type SpeedUnit<
|
|
167
|
+
TLength extends LengthUnit,
|
|
168
|
+
TTime extends TimeUnit,
|
|
169
|
+
> = `${TLength}/${TTime}`
|
|
170
|
+
|
|
171
|
+
export type CountPerTime<TTime extends TimeUnit> = `count/${TTime}`
|
|
172
|
+
|
|
173
|
+
export type Unit =
|
|
174
|
+
| BloodGlucoseUnit
|
|
175
|
+
| CountPerTime<TimeUnit>
|
|
176
|
+
| EnergyUnit
|
|
177
|
+
| FrequencyUnit
|
|
178
|
+
| Units
|
|
179
|
+
| LengthUnit
|
|
180
|
+
| MassUnit
|
|
181
|
+
| PressureUnit
|
|
182
|
+
| SpeedUnit<LengthUnit, TimeUnit>
|
|
183
|
+
| TemperatureUnit
|
|
184
|
+
| TimeUnit
|
|
185
|
+
| VolumeUnit
|
|
186
|
+
|
|
187
|
+
export interface IdentifierWithUnit {
|
|
188
|
+
typeIdentifier: string
|
|
189
|
+
unit: string
|
|
190
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// documented at https://developer.apple.com/documentation/healthkit/hkweathercondition
|
|
2
|
+
export enum HKWeatherCondition {
|
|
3
|
+
none = 0,
|
|
4
|
+
clear = 1,
|
|
5
|
+
fair = 2,
|
|
6
|
+
partlyCloudy = 3,
|
|
7
|
+
mostlyCloudy = 4,
|
|
8
|
+
cloudy = 5,
|
|
9
|
+
foggy = 6,
|
|
10
|
+
haze = 7,
|
|
11
|
+
windy = 8,
|
|
12
|
+
blustery = 9,
|
|
13
|
+
smoky = 10,
|
|
14
|
+
dust = 11,
|
|
15
|
+
snow = 12,
|
|
16
|
+
hail = 13,
|
|
17
|
+
sleet = 14,
|
|
18
|
+
freezingDrizzle = 15,
|
|
19
|
+
freezingRain = 16,
|
|
20
|
+
mixedRainAndHail = 17,
|
|
21
|
+
mixedRainAndSnow = 18,
|
|
22
|
+
mixedRainAndSleet = 19,
|
|
23
|
+
mixedSnowAndSleet = 20,
|
|
24
|
+
drizzle = 21,
|
|
25
|
+
scatteredShowers = 22,
|
|
26
|
+
showers = 23,
|
|
27
|
+
thunderstorms = 24,
|
|
28
|
+
tropicalStorm = 25,
|
|
29
|
+
hurricane = 26,
|
|
30
|
+
tornado = 27,
|
|
31
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorkoutActivityType } from './Workouts'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutconfiguration Apple Docs }
|
|
5
|
+
*/
|
|
6
|
+
export interface WorkoutConfiguration {
|
|
7
|
+
readonly activityType: WorkoutActivityType
|
|
8
|
+
readonly locationType?: WorkoutSessionLocationType
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutsessionlocationtype Apple Docs }
|
|
13
|
+
*/
|
|
14
|
+
export enum WorkoutSessionLocationType {
|
|
15
|
+
unknown = 1,
|
|
16
|
+
indoor = 2,
|
|
17
|
+
outdoor = 3,
|
|
18
|
+
}
|