@kingstinct/react-native-healthkit 13.4.0 → 14.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 +1 -0
- package/app.plugin.ts +40 -2
- package/ios/BackgroundDeliveryManager.swift +196 -0
- package/ios/CategoryTypeModule.swift +1 -1
- package/ios/CoreModule.swift +24 -0
- package/ios/CorrelationTypeModule.swift +2 -35
- package/ios/ElectrocardiogramModule.swift +2 -34
- package/ios/HeartbeatSeriesModule.swift +2 -34
- package/ios/MedicationModule.swift +3 -35
- package/ios/PredicateHelpers.swift +2 -2
- package/ios/QuantityTypeModule.swift +11 -11
- package/ios/Serializers.swift +58 -90
- package/ios/StateOfMindModule.swift +2 -34
- package/ios/WorkoutProxy.swift +3 -149
- package/ios/generated/HealthkitGenerated.swift +52 -0
- package/lib/commonjs/generated/healthkit.generated.js +745 -0
- package/lib/commonjs/healthkit.ios.js +51 -17
- package/lib/commonjs/healthkit.js +120 -34
- package/lib/commonjs/specs/QuantityTypeModule.nitro.js +1 -0
- package/lib/commonjs/type-tests/generated-typing.js +2 -0
- package/lib/commonjs/types/CategoryType.js +19 -99
- package/lib/commonjs/types/Medication.js +2 -0
- package/lib/commonjs/types/MetadataEnums.js +17 -0
- package/lib/commonjs/types/QuantityType.js +4 -15
- package/lib/commonjs/types/WeatherCondition.js +2 -32
- package/lib/commonjs/types/Workouts.js +3 -98
- package/lib/commonjs/types/index.js +2 -0
- package/lib/module/generated/healthkit.generated.js +742 -0
- package/lib/module/healthkit.ios.js +49 -15
- package/lib/module/healthkit.js +94 -20
- package/lib/module/specs/QuantityTypeModule.nitro.js +1 -0
- package/lib/module/type-tests/generated-typing.js +1 -0
- package/lib/module/types/CategoryType.js +2 -98
- package/lib/module/types/Medication.js +1 -0
- package/lib/module/types/MetadataEnums.js +1 -0
- package/lib/module/types/QuantityType.js +2 -14
- package/lib/module/types/WeatherCondition.js +1 -32
- package/lib/module/types/Workouts.js +2 -98
- package/lib/module/types/index.js +2 -0
- package/lib/typescript/generated/healthkit.generated.d.ts +1006 -0
- package/lib/typescript/healthkit.d.ts +39 -36
- package/lib/typescript/healthkit.ios.d.ts +64 -53
- package/lib/typescript/hooks/useMostRecentQuantitySample.d.ts +3 -2
- package/lib/typescript/hooks/useMostRecentWorkout.d.ts +2 -2
- package/lib/typescript/hooks/useQuantitySampleById.d.ts +5 -4
- package/lib/typescript/hooks/useStatisticsForQuantity.d.ts +2 -2
- package/lib/typescript/hooks/useSubscribeToQuantitySamples.d.ts +1 -1
- package/lib/typescript/modules.d.ts +2 -2
- package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +3 -3
- package/lib/typescript/specs/CoreModule.nitro.d.ts +15 -0
- package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +20 -9
- package/lib/typescript/type-tests/generated-typing.d.ts +1 -0
- package/lib/typescript/types/CategoryType.d.ts +10 -104
- package/lib/typescript/types/CategoryTypeIdentifier.d.ts +1 -61
- package/lib/typescript/types/CorrelationType.d.ts +8 -2
- package/lib/typescript/types/ElectrocardiogramSample.d.ts +8 -1
- package/lib/typescript/types/HeartbeatSeries.d.ts +8 -1
- package/lib/typescript/types/InterfaceVerification.d.ts +14 -1
- package/lib/typescript/types/Medication.d.ts +10 -0
- package/lib/typescript/types/MetadataEnums.d.ts +1 -0
- package/lib/typescript/types/QuantitySample.d.ts +9 -1
- package/lib/typescript/types/QuantityType.d.ts +14 -18
- package/lib/typescript/types/QuantityTypeIdentifier.d.ts +1 -671
- package/lib/typescript/types/QueryOptions.d.ts +8 -4
- package/lib/typescript/types/Shared.d.ts +12 -41
- package/lib/typescript/types/StateOfMind.d.ts +8 -1
- package/lib/typescript/types/Subscriptions.d.ts +11 -11
- package/lib/typescript/types/WeatherCondition.d.ts +1 -30
- package/lib/typescript/types/Workouts.d.ts +18 -104
- package/lib/typescript/types/index.d.ts +2 -0
- package/lib/typescript/utils/getMostRecentQuantitySample.d.ts +2 -1
- package/lib/typescript/utils/getMostRecentWorkout.d.ts +2 -1
- package/lib/typescript/utils/getPreferredUnit.d.ts +2 -1
- package/lib/typescript/utils/getQuantitySampleById.d.ts +2 -1
- package/lib/typescript/utils/subscribeToQuantitySamples.d.ts +1 -1
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +55 -109
- package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +12 -18
- package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +5 -14
- package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +18 -2
- package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +1 -13
- package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +1 -13
- package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +2 -14
- package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +1 -13
- package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +19 -28
- package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +2 -14
- package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +2 -115
- package/nitrogen/generated/ios/swift/CategorySample.swift +4 -329
- package/nitrogen/generated/ios/swift/CategoryTypeIdentifier.swift +112 -108
- package/nitrogen/generated/ios/swift/CategoryTypeIdentifierWriteable.swift +292 -0
- package/nitrogen/generated/ios/swift/CorrelationSample.swift +4 -347
- package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +4 -329
- package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +30 -30
- package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +30 -30
- package/nitrogen/generated/ios/swift/GeneralForm.swift +4 -4
- package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +4 -329
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +38 -0
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +6 -6
- package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +6 -6
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +1 -27
- package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +2 -340
- package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +4 -329
- package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +492 -492
- package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -329
- package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +380 -384
- package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +372 -376
- package/nitrogen/generated/ios/swift/{QueryOptionsWithAnchorAndUnit.swift → QueryOptionsWithAnchorAndStringUnit.swift} +5 -5
- package/nitrogen/generated/ios/swift/{QueryOptionsWithSortOrderAndUnit.swift → QueryOptionsWithSortOrderAndStringUnit.swift} +5 -5
- package/nitrogen/generated/ios/swift/QueryStatisticsResponseFromSingleSource.swift +37 -37
- package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +492 -492
- package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +482 -486
- package/nitrogen/generated/ios/swift/StateOfMindSample.swift +4 -329
- package/nitrogen/generated/ios/swift/{StatisticsQueryOptions.swift → StatisticsQueryOptionsWithStringUnit.swift} +5 -5
- package/nitrogen/generated/ios/swift/WorkoutSample.swift +4 -402
- package/nitrogen/generated/shared/c++/CategorySample.hpp +8 -100
- package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +153 -149
- package/nitrogen/generated/shared/c++/CategoryTypeIdentifierWriteable.hpp +328 -0
- package/nitrogen/generated/shared/c++/CorrelationSample.hpp +9 -105
- package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -99
- package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +13 -13
- package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +13 -13
- package/nitrogen/generated/shared/c++/GeneralForm.hpp +7 -7
- package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +8 -100
- package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +5 -2
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -2
- package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +15 -15
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +1 -27
- package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +2 -37
- package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -99
- package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +565 -565
- package/nitrogen/generated/shared/c++/QuantitySample.hpp +8 -100
- package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +407 -411
- package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +398 -402
- package/nitrogen/generated/shared/c++/{QueryOptionsWithAnchorAndUnit.hpp → QueryOptionsWithAnchorAndStringUnit.hpp} +11 -11
- package/nitrogen/generated/shared/c++/{QueryOptionsWithSortOrderAndUnit.hpp → QueryOptionsWithSortOrderAndStringUnit.hpp} +11 -11
- package/nitrogen/generated/shared/c++/QueryStatisticsResponseFromSingleSource.hpp +12 -12
- package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +559 -559
- package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +541 -545
- package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +8 -100
- package/nitrogen/generated/shared/c++/{StatisticsQueryOptions.hpp → StatisticsQueryOptionsWithStringUnit.hpp} +11 -11
- package/nitrogen/generated/shared/c++/WorkoutSample.hpp +7 -120
- package/package.json +5 -2
- package/src/generated/healthkit-schema.json +3680 -0
- package/src/generated/healthkit.generated.ts +1307 -0
- package/src/healthkit.ios.ts +225 -19
- package/src/healthkit.ts +181 -55
- package/src/hooks/useMostRecentQuantitySample.ts +6 -5
- package/src/hooks/useMostRecentWorkout.ts +2 -2
- package/src/hooks/useQuantitySampleById.ts +6 -5
- package/src/hooks/useStatisticsForQuantity.ts +2 -1
- package/src/hooks/useSubscribeToQuantitySamples.ts +1 -1
- package/src/modules.ts +7 -2
- package/src/specs/CategoryTypeModule.nitro.ts +8 -5
- package/src/specs/CoreModule.nitro.ts +20 -0
- package/src/specs/QuantityTypeModule.nitro.ts +81 -7
- package/src/test-setup.ts +2 -0
- package/src/type-tests/generated-typing.ts +133 -0
- package/src/types/CategoryType.ts +52 -148
- package/src/types/CategoryTypeIdentifier.ts +5 -134
- package/src/types/CorrelationType.ts +13 -3
- package/src/types/ElectrocardiogramSample.ts +13 -1
- package/src/types/HeartbeatSeries.ts +13 -1
- package/src/types/InterfaceVerification.ts +38 -1
- package/src/types/Medication.ts +19 -0
- package/src/types/MetadataEnums.ts +15 -0
- package/src/types/QuantitySample.ts +14 -2
- package/src/types/QuantityType.ts +22 -122
- package/src/types/QuantityTypeIdentifier.ts +5 -772
- package/src/types/QueryOptions.ts +11 -4
- package/src/types/Shared.ts +22 -49
- package/src/types/StateOfMind.ts +13 -1
- package/src/types/Subscriptions.ts +19 -13
- package/src/types/WeatherCondition.ts +1 -31
- package/src/types/Workouts.ts +44 -108
- package/src/types/index.ts +2 -0
- package/src/utils/getMostRecentQuantitySample.ts +4 -3
- package/src/utils/getMostRecentWorkout.ts +5 -2
- package/src/utils/getPreferredUnit.ts +5 -4
- package/src/utils/getQuantitySampleById.ts +4 -3
- package/src/utils/subscribeToQuantitySamples.ts +5 -3
- package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +0 -44
- package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +0 -40
- package/nitrogen/generated/ios/swift/WeatherCondition.swift +0 -144
- package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +0 -67
- package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +0 -62
- package/nitrogen/generated/shared/c++/WeatherCondition.hpp +0 -88
|
@@ -3,6 +3,7 @@ import { QuantityTypes } from '../modules'
|
|
|
3
3
|
import type {
|
|
4
4
|
QueryStatisticsResponse,
|
|
5
5
|
StatisticsOptions,
|
|
6
|
+
UnitForIdentifier,
|
|
6
7
|
} from '../types/QuantityType'
|
|
7
8
|
import type { QuantityTypeIdentifier } from '../types/QuantityTypeIdentifier'
|
|
8
9
|
import useSubscribeToChanges from './useSubscribeToChanges'
|
|
@@ -14,7 +15,7 @@ export function useStatisticsForQuantity<
|
|
|
14
15
|
options: readonly StatisticsOptions[],
|
|
15
16
|
from: Date,
|
|
16
17
|
to?: Date,
|
|
17
|
-
unit?:
|
|
18
|
+
unit?: UnitForIdentifier<TIdentifier>,
|
|
18
19
|
) {
|
|
19
20
|
const [result, setResult] = useState<QueryStatisticsResponse | null>(null)
|
|
20
21
|
|
|
@@ -9,7 +9,7 @@ export function useSubscribeToQuantitySamples<
|
|
|
9
9
|
TIdentifier extends QuantityTypeIdentifier,
|
|
10
10
|
>(
|
|
11
11
|
identifier: TIdentifier,
|
|
12
|
-
onChange: (args: OnQuantitySamplesCallback) => void,
|
|
12
|
+
onChange: (args: OnQuantitySamplesCallback<TIdentifier>) => void,
|
|
13
13
|
): void {
|
|
14
14
|
const onChangeRef = useRef(onChange)
|
|
15
15
|
|
package/src/modules.ts
CHANGED
|
@@ -9,7 +9,10 @@ import type { CorrelationTypeModule } from './specs/CorrelationTypeModule.nitro'
|
|
|
9
9
|
import type { ElectrocardiogramModule } from './specs/ElectrocardiogramModule.nitro'
|
|
10
10
|
import type { HeartbeatSeriesModule } from './specs/HeartbeatSeriesModule.nitro'
|
|
11
11
|
import type { MedicationModule } from './specs/MedicationModule.nitro'
|
|
12
|
-
import type {
|
|
12
|
+
import type {
|
|
13
|
+
QuantityTypeModule,
|
|
14
|
+
QuantityTypeModuleTyped,
|
|
15
|
+
} from './specs/QuantityTypeModule.nitro'
|
|
13
16
|
import type { StateOfMindModule } from './specs/StateOfMindModule.nitro'
|
|
14
17
|
import type { WorkoutsModule } from './specs/WorkoutsModule.nitro'
|
|
15
18
|
|
|
@@ -27,7 +30,9 @@ export const Characteristics =
|
|
|
27
30
|
)
|
|
28
31
|
|
|
29
32
|
export const QuantityTypes =
|
|
30
|
-
NitroModules.createHybridObject<QuantityTypeModule>(
|
|
33
|
+
NitroModules.createHybridObject<QuantityTypeModule>(
|
|
34
|
+
'QuantityTypeModule',
|
|
35
|
+
) as QuantityTypeModuleTyped
|
|
31
36
|
|
|
32
37
|
export const CategoryTypes =
|
|
33
38
|
NitroModules.createHybridObject<CategoryTypeModule>(
|
|
@@ -8,7 +8,10 @@ import type {
|
|
|
8
8
|
CategoryValueForIdentifier,
|
|
9
9
|
MetadataForCategoryIdentifier,
|
|
10
10
|
} from '../types/CategoryType'
|
|
11
|
-
import type {
|
|
11
|
+
import type {
|
|
12
|
+
CategoryTypeIdentifier,
|
|
13
|
+
CategoryTypeIdentifierWriteable,
|
|
14
|
+
} from '../types/CategoryTypeIdentifier'
|
|
12
15
|
import type { InterfaceAssertion } from '../types/InterfaceVerification'
|
|
13
16
|
import type {
|
|
14
17
|
QueryOptionsWithAnchor,
|
|
@@ -17,7 +20,7 @@ import type {
|
|
|
17
20
|
|
|
18
21
|
export interface CategoryTypeModule extends HybridObject<{ ios: 'swift' }> {
|
|
19
22
|
saveCategorySample(
|
|
20
|
-
identifier:
|
|
23
|
+
identifier: CategoryTypeIdentifierWriteable,
|
|
21
24
|
value: CategoryValueForIdentifier,
|
|
22
25
|
startDate: Date,
|
|
23
26
|
endDate: Date,
|
|
@@ -44,13 +47,13 @@ const _interfaceVerification: InterfaceAssertion<
|
|
|
44
47
|
> = true
|
|
45
48
|
|
|
46
49
|
export interface CategoryTypeModuleTyped {
|
|
47
|
-
saveCategorySample<T extends
|
|
50
|
+
saveCategorySample<T extends CategoryTypeIdentifierWriteable>(
|
|
48
51
|
identifier: T,
|
|
49
|
-
value: CategoryValueForIdentifier
|
|
52
|
+
value: CategoryValueForIdentifier<T>,
|
|
50
53
|
startDate: Date,
|
|
51
54
|
endDate: Date,
|
|
52
55
|
metadata?: MetadataForCategoryIdentifier<T>,
|
|
53
|
-
): Promise<
|
|
56
|
+
): Promise<CategorySampleTyped<T> | undefined>
|
|
54
57
|
|
|
55
58
|
queryCategorySamples<T extends CategoryTypeIdentifier>(
|
|
56
59
|
identifier: T,
|
|
@@ -40,6 +40,26 @@ export interface CoreModule extends HybridObject<{ ios: 'swift' }> {
|
|
|
40
40
|
*/
|
|
41
41
|
disableAllBackgroundDelivery(): Promise<boolean>
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Configure background delivery types that will be registered natively in
|
|
45
|
+
* AppDelegate.didFinishLaunchingWithOptions — surviving app termination.
|
|
46
|
+
* Types and frequency are persisted to UserDefaults so they're available
|
|
47
|
+
* before the JS bridge boots on subsequent cold launches.
|
|
48
|
+
*
|
|
49
|
+
* Requires the Expo config plugin with `background: true` (default) or
|
|
50
|
+
* manual AppDelegate setup: `BackgroundDeliveryManager.shared.setupBackgroundObservers()`
|
|
51
|
+
*/
|
|
52
|
+
configureBackgroundTypes(
|
|
53
|
+
typeIdentifiers: string[],
|
|
54
|
+
updateFrequency: UpdateFrequency,
|
|
55
|
+
): Promise<boolean>
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Clear persisted background delivery configuration and stop all observer queries.
|
|
59
|
+
* After calling this, the app will no longer register observers on cold launch.
|
|
60
|
+
*/
|
|
61
|
+
clearBackgroundTypes(): Promise<boolean>
|
|
62
|
+
|
|
43
63
|
/**
|
|
44
64
|
* @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs }
|
|
45
65
|
*/
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
import type { AnyMap, HybridObject } from 'react-native-nitro-modules'
|
|
2
|
-
import type {
|
|
2
|
+
import type { InterfaceAssertion } from '../types/InterfaceVerification'
|
|
3
|
+
import type {
|
|
4
|
+
MetadataForQuantityIdentifier,
|
|
5
|
+
QuantitySample,
|
|
6
|
+
QuantitySampleTyped,
|
|
7
|
+
} from '../types/QuantitySample'
|
|
3
8
|
import type {
|
|
4
9
|
AggregationStyle,
|
|
5
10
|
IntervalComponents,
|
|
6
11
|
QuantitySamplesWithAnchorResponse,
|
|
12
|
+
QuantitySamplesWithAnchorResponseTyped,
|
|
7
13
|
QueryStatisticsResponse,
|
|
8
14
|
QueryStatisticsResponseFromSingleSource,
|
|
9
15
|
StatisticsOptions,
|
|
10
16
|
StatisticsQueryOptions,
|
|
17
|
+
StatisticsQueryOptionsWithStringUnit,
|
|
18
|
+
UnitForIdentifier,
|
|
11
19
|
} from '../types/QuantityType'
|
|
12
20
|
import type {
|
|
13
21
|
QuantityTypeIdentifier,
|
|
14
22
|
QuantityTypeIdentifierWriteable,
|
|
15
23
|
} from '../types/QuantityTypeIdentifier'
|
|
16
24
|
import type {
|
|
25
|
+
QueryOptionsWithAnchorAndStringUnit,
|
|
17
26
|
QueryOptionsWithAnchorAndUnit,
|
|
27
|
+
QueryOptionsWithSortOrderAndStringUnit,
|
|
18
28
|
QueryOptionsWithSortOrderAndUnit,
|
|
19
29
|
} from '../types/QueryOptions'
|
|
20
30
|
|
|
@@ -37,13 +47,13 @@ export interface QuantityTypeModule extends HybridObject<{ ios: 'swift' }> {
|
|
|
37
47
|
|
|
38
48
|
queryQuantitySamples(
|
|
39
49
|
identifier: QuantityTypeIdentifier,
|
|
40
|
-
options:
|
|
50
|
+
options: QueryOptionsWithSortOrderAndStringUnit,
|
|
41
51
|
): Promise<readonly QuantitySample[]>
|
|
42
52
|
|
|
43
53
|
queryStatisticsForQuantity(
|
|
44
54
|
identifier: QuantityTypeIdentifier,
|
|
45
55
|
statistics: readonly StatisticsOptions[],
|
|
46
|
-
options?:
|
|
56
|
+
options?: StatisticsQueryOptionsWithStringUnit,
|
|
47
57
|
): Promise<QueryStatisticsResponse>
|
|
48
58
|
|
|
49
59
|
queryStatisticsCollectionForQuantity(
|
|
@@ -51,13 +61,13 @@ export interface QuantityTypeModule extends HybridObject<{ ios: 'swift' }> {
|
|
|
51
61
|
statistics: readonly StatisticsOptions[],
|
|
52
62
|
anchorDate: Date,
|
|
53
63
|
intervalComponents: IntervalComponents,
|
|
54
|
-
options?:
|
|
64
|
+
options?: StatisticsQueryOptionsWithStringUnit,
|
|
55
65
|
): Promise<readonly QueryStatisticsResponse[]>
|
|
56
66
|
|
|
57
67
|
queryStatisticsForQuantitySeparateBySource(
|
|
58
68
|
identifier: QuantityTypeIdentifier,
|
|
59
69
|
statistics: readonly StatisticsOptions[],
|
|
60
|
-
options?:
|
|
70
|
+
options?: StatisticsQueryOptionsWithStringUnit,
|
|
61
71
|
): Promise<QueryStatisticsResponseFromSingleSource[]>
|
|
62
72
|
|
|
63
73
|
queryStatisticsCollectionForQuantitySeparateBySource(
|
|
@@ -65,11 +75,75 @@ export interface QuantityTypeModule extends HybridObject<{ ios: 'swift' }> {
|
|
|
65
75
|
statistics: readonly StatisticsOptions[],
|
|
66
76
|
anchorDate: Date,
|
|
67
77
|
intervalComponents: IntervalComponents,
|
|
68
|
-
options?:
|
|
78
|
+
options?: StatisticsQueryOptionsWithStringUnit,
|
|
69
79
|
): Promise<readonly QueryStatisticsResponseFromSingleSource[]>
|
|
70
80
|
|
|
71
81
|
queryQuantitySamplesWithAnchor(
|
|
72
82
|
identifier: QuantityTypeIdentifier,
|
|
73
|
-
options:
|
|
83
|
+
options: QueryOptionsWithAnchorAndStringUnit,
|
|
74
84
|
): Promise<QuantitySamplesWithAnchorResponse>
|
|
75
85
|
}
|
|
86
|
+
|
|
87
|
+
const _interfaceVerification: InterfaceAssertion<
|
|
88
|
+
QuantityTypeModule,
|
|
89
|
+
QuantityTypeModuleTyped,
|
|
90
|
+
keyof HybridObject<{ ios: 'swift' }>
|
|
91
|
+
> = true
|
|
92
|
+
|
|
93
|
+
export interface QuantityTypeModuleTyped {
|
|
94
|
+
isQuantityCompatibleWithUnit<T extends QuantityTypeIdentifier>(
|
|
95
|
+
identifier: T,
|
|
96
|
+
unit: UnitForIdentifier<T>,
|
|
97
|
+
): boolean
|
|
98
|
+
|
|
99
|
+
aggregationStyle(identifier: QuantityTypeIdentifier): AggregationStyle
|
|
100
|
+
|
|
101
|
+
saveQuantitySample<T extends QuantityTypeIdentifierWriteable>(
|
|
102
|
+
identifier: T,
|
|
103
|
+
unit: UnitForIdentifier<T>,
|
|
104
|
+
value: number,
|
|
105
|
+
start: Date,
|
|
106
|
+
end: Date,
|
|
107
|
+
metadata?: MetadataForQuantityIdentifier<T>,
|
|
108
|
+
): Promise<QuantitySampleTyped<T> | undefined>
|
|
109
|
+
|
|
110
|
+
queryQuantitySamples<T extends QuantityTypeIdentifier>(
|
|
111
|
+
identifier: T,
|
|
112
|
+
options: QueryOptionsWithSortOrderAndUnit<UnitForIdentifier<T>>,
|
|
113
|
+
): Promise<readonly QuantitySampleTyped<T>[]>
|
|
114
|
+
|
|
115
|
+
queryStatisticsForQuantity<T extends QuantityTypeIdentifier>(
|
|
116
|
+
identifier: T,
|
|
117
|
+
statistics: readonly StatisticsOptions[],
|
|
118
|
+
options?: StatisticsQueryOptions<UnitForIdentifier<T>>,
|
|
119
|
+
): Promise<QueryStatisticsResponse>
|
|
120
|
+
|
|
121
|
+
queryStatisticsCollectionForQuantity<T extends QuantityTypeIdentifier>(
|
|
122
|
+
identifier: T,
|
|
123
|
+
statistics: readonly StatisticsOptions[],
|
|
124
|
+
anchorDate: Date,
|
|
125
|
+
intervalComponents: IntervalComponents,
|
|
126
|
+
options?: StatisticsQueryOptions<UnitForIdentifier<T>>,
|
|
127
|
+
): Promise<readonly QueryStatisticsResponse[]>
|
|
128
|
+
|
|
129
|
+
queryStatisticsForQuantitySeparateBySource<T extends QuantityTypeIdentifier>(
|
|
130
|
+
identifier: T,
|
|
131
|
+
statistics: readonly StatisticsOptions[],
|
|
132
|
+
options?: StatisticsQueryOptions<UnitForIdentifier<T>>,
|
|
133
|
+
): Promise<QueryStatisticsResponseFromSingleSource[]>
|
|
134
|
+
|
|
135
|
+
queryStatisticsCollectionForQuantitySeparateBySource<
|
|
136
|
+
T extends QuantityTypeIdentifier,
|
|
137
|
+
>(
|
|
138
|
+
identifier: T,
|
|
139
|
+
statistics: readonly StatisticsOptions[],
|
|
140
|
+
anchorDate: Date,
|
|
141
|
+
intervalComponents: IntervalComponents,
|
|
142
|
+
options?: StatisticsQueryOptions<UnitForIdentifier<T>>,
|
|
143
|
+
): Promise<readonly QueryStatisticsResponseFromSingleSource[]>
|
|
144
|
+
|
|
145
|
+
queryQuantitySamplesWithAnchor<T extends QuantityTypeIdentifier>(
|
|
146
|
+
identifier: T,
|
|
147
|
+
options: QueryOptionsWithAnchorAndUnit<UnitForIdentifier<T>>,
|
|
148
|
+
): Promise<QuantitySamplesWithAnchorResponseTyped<T>>
|
|
149
|
+
}
|
package/src/test-setup.ts
CHANGED
|
@@ -14,6 +14,8 @@ const mockModule = {
|
|
|
14
14
|
disableAllBackgroundDelivery: jest.fn(),
|
|
15
15
|
disableBackgroundDelivery: jest.fn(),
|
|
16
16
|
enableBackgroundDelivery: jest.fn(),
|
|
17
|
+
configureBackgroundTypes: jest.fn(),
|
|
18
|
+
clearBackgroundTypes: jest.fn(),
|
|
17
19
|
queryCategorySamplesWithAnchor: jest.fn(),
|
|
18
20
|
queryQuantitySamplesWithAnchor: jest.fn(),
|
|
19
21
|
getBiologicalSex: jest.fn(),
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BloodGlucoseUnit,
|
|
3
|
+
CategorySampleTyped,
|
|
4
|
+
CategoryTypeIdentifier,
|
|
5
|
+
CategoryTypeIdentifierWriteable,
|
|
6
|
+
CategoryValueForIdentifier,
|
|
7
|
+
CategoryValueSleepAnalysis,
|
|
8
|
+
CorrelationSampleTyped,
|
|
9
|
+
HeartRateMotionContext,
|
|
10
|
+
Quantity,
|
|
11
|
+
QuantitySampleTyped,
|
|
12
|
+
QueryOptionsWithAnchorAndUnit,
|
|
13
|
+
QueryOptionsWithSortOrderAndUnit,
|
|
14
|
+
StateOfMindSampleTyped,
|
|
15
|
+
StatisticsQueryOptions,
|
|
16
|
+
SwimmingStrokeStyle,
|
|
17
|
+
WorkoutEventTyped,
|
|
18
|
+
WorkoutSampleTyped,
|
|
19
|
+
} from '../types'
|
|
20
|
+
|
|
21
|
+
type Equal<A, B> =
|
|
22
|
+
(<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2
|
|
23
|
+
? true
|
|
24
|
+
: false
|
|
25
|
+
|
|
26
|
+
type Assert<T extends true> = T
|
|
27
|
+
|
|
28
|
+
type _sleepAnalysisValuesAreTyped = Assert<
|
|
29
|
+
Equal<
|
|
30
|
+
CategoryValueForIdentifier<'HKCategoryTypeIdentifierSleepAnalysis'>,
|
|
31
|
+
CategoryValueSleepAnalysis
|
|
32
|
+
>
|
|
33
|
+
>
|
|
34
|
+
|
|
35
|
+
type _newCategoryIdentifierFromSdkIsPresent = Assert<
|
|
36
|
+
'HKCategoryTypeIdentifierHypertensionEvent' extends CategoryTypeIdentifier
|
|
37
|
+
? true
|
|
38
|
+
: false
|
|
39
|
+
>
|
|
40
|
+
|
|
41
|
+
type _heartRateMetadataNarrowsToEnum = Assert<
|
|
42
|
+
Equal<
|
|
43
|
+
QuantitySampleTyped<'HKQuantityTypeIdentifierHeartRate'>['metadata']['HKHeartRateMotionContext'],
|
|
44
|
+
HeartRateMotionContext | undefined
|
|
45
|
+
>
|
|
46
|
+
>
|
|
47
|
+
|
|
48
|
+
type _categoryMetadataIncludesKnownSampleFields = Assert<
|
|
49
|
+
Equal<
|
|
50
|
+
CategorySampleTyped<'HKCategoryTypeIdentifierSleepAnalysis'>['metadata']['HKWasUserEntered'],
|
|
51
|
+
boolean | undefined
|
|
52
|
+
>
|
|
53
|
+
>
|
|
54
|
+
|
|
55
|
+
type _heartRateEventMetadataIsTypedOnMetadata = Assert<
|
|
56
|
+
Equal<
|
|
57
|
+
QuantitySampleTyped<'HKQuantityTypeIdentifierHeartRate'>['metadata']['HKAppleDeviceCalibrated'],
|
|
58
|
+
boolean | undefined
|
|
59
|
+
>
|
|
60
|
+
>
|
|
61
|
+
|
|
62
|
+
type _quantityMetadataIncludesEstimateDate = Assert<
|
|
63
|
+
Equal<
|
|
64
|
+
QuantitySampleTyped<'HKQuantityTypeIdentifierVO2Max'>['metadata']['HKDateOfEarliestDataUsedForEstimate'],
|
|
65
|
+
string | undefined
|
|
66
|
+
>
|
|
67
|
+
>
|
|
68
|
+
|
|
69
|
+
type _heartRateEventThresholdMetadataIsTyped = Assert<
|
|
70
|
+
Equal<
|
|
71
|
+
CategorySampleTyped<'HKCategoryTypeIdentifierHighHeartRateEvent'>['metadata']['HKHeartRateEventThreshold'],
|
|
72
|
+
Quantity | undefined
|
|
73
|
+
>
|
|
74
|
+
>
|
|
75
|
+
|
|
76
|
+
type _bloodGlucoseUnitNarrows = Assert<
|
|
77
|
+
Equal<
|
|
78
|
+
QuantitySampleTyped<'HKQuantityTypeIdentifierBloodGlucose'>['unit'],
|
|
79
|
+
BloodGlucoseUnit
|
|
80
|
+
>
|
|
81
|
+
>
|
|
82
|
+
|
|
83
|
+
type _quantityQueryOptionsUnitNarrows = Assert<
|
|
84
|
+
Equal<
|
|
85
|
+
QueryOptionsWithSortOrderAndUnit<BloodGlucoseUnit>['unit'],
|
|
86
|
+
BloodGlucoseUnit | undefined
|
|
87
|
+
>
|
|
88
|
+
>
|
|
89
|
+
|
|
90
|
+
type _quantityAnchorQueryOptionsUnitNarrows = Assert<
|
|
91
|
+
Equal<
|
|
92
|
+
QueryOptionsWithAnchorAndUnit<BloodGlucoseUnit>['unit'],
|
|
93
|
+
BloodGlucoseUnit | undefined
|
|
94
|
+
>
|
|
95
|
+
>
|
|
96
|
+
|
|
97
|
+
type _quantityStatisticsOptionsUnitNarrows = Assert<
|
|
98
|
+
Equal<
|
|
99
|
+
StatisticsQueryOptions<BloodGlucoseUnit>['unit'],
|
|
100
|
+
BloodGlucoseUnit | undefined
|
|
101
|
+
>
|
|
102
|
+
>
|
|
103
|
+
|
|
104
|
+
type _categorySaveIdentifierIsWriteableOnly = Assert<
|
|
105
|
+
'HKCategoryTypeIdentifierHighHeartRateEvent' extends CategoryTypeIdentifierWriteable
|
|
106
|
+
? false
|
|
107
|
+
: true
|
|
108
|
+
>
|
|
109
|
+
|
|
110
|
+
type _stateOfMindMetadataIsTyped = Assert<
|
|
111
|
+
Equal<
|
|
112
|
+
StateOfMindSampleTyped['metadata']['HKWasUserEntered'],
|
|
113
|
+
boolean | undefined
|
|
114
|
+
>
|
|
115
|
+
>
|
|
116
|
+
|
|
117
|
+
type _correlationMetadataIsTyped = Assert<
|
|
118
|
+
Equal<CorrelationSampleTyped['metadata']['HKFoodType'], string | undefined>
|
|
119
|
+
>
|
|
120
|
+
|
|
121
|
+
type _workoutMetadataIsTypedOnMetadata = Assert<
|
|
122
|
+
Equal<
|
|
123
|
+
WorkoutSampleTyped['metadata']['HKWorkoutBrandName'],
|
|
124
|
+
string | undefined
|
|
125
|
+
>
|
|
126
|
+
>
|
|
127
|
+
|
|
128
|
+
type _workoutEventMetadataIsTypedOnMetadata = Assert<
|
|
129
|
+
Equal<
|
|
130
|
+
NonNullable<WorkoutEventTyped['metadata']>['HKSwimmingStrokeStyle'],
|
|
131
|
+
SwimmingStrokeStyle | undefined
|
|
132
|
+
>
|
|
133
|
+
>
|
|
@@ -1,26 +1,62 @@
|
|
|
1
1
|
import type { AnyMap } from 'react-native-nitro-modules'
|
|
2
|
+
import type {
|
|
3
|
+
CategoryTypedMetadataForIdentifierGenerated,
|
|
4
|
+
CategoryValueForIdentifierGenerated,
|
|
5
|
+
} from '../generated/healthkit.generated'
|
|
6
|
+
import {
|
|
7
|
+
CategoryValueAppetiteChanges,
|
|
8
|
+
CategoryValueAppleStandHour,
|
|
9
|
+
CategoryValueAppleWalkingSteadinessEvent,
|
|
10
|
+
CategoryValueCervicalMucusQuality,
|
|
11
|
+
CategoryValueContraceptive,
|
|
12
|
+
CategoryValueEnvironmentalAudioExposureEvent,
|
|
13
|
+
CategoryValueHeadphoneAudioExposureEvent,
|
|
14
|
+
CategoryValueLowCardioFitnessEvent,
|
|
15
|
+
CategoryValueMenstrualFlow,
|
|
16
|
+
CategoryValue as CategoryValueNotApplicable,
|
|
17
|
+
CategoryValueOvulationTestResult,
|
|
18
|
+
CategoryValuePregnancyTestResult,
|
|
19
|
+
CategoryValuePresence,
|
|
20
|
+
CategoryValueProgesteroneTestResult,
|
|
21
|
+
CategoryValueSeverity,
|
|
22
|
+
CategoryValueSleepAnalysis,
|
|
23
|
+
CategoryValueVaginalBleeding,
|
|
24
|
+
} from '../generated/healthkit.generated'
|
|
2
25
|
import type { CategoryTypeIdentifier } from './CategoryTypeIdentifier'
|
|
3
26
|
import type { BaseSample, DeletedSample, GenericMetadata } from './Shared'
|
|
4
27
|
import type { SourceRevision } from './Source'
|
|
5
28
|
|
|
29
|
+
export {
|
|
30
|
+
CategoryValueAppetiteChanges,
|
|
31
|
+
CategoryValueAppleStandHour,
|
|
32
|
+
CategoryValueAppleWalkingSteadinessEvent,
|
|
33
|
+
CategoryValueCervicalMucusQuality,
|
|
34
|
+
CategoryValueContraceptive,
|
|
35
|
+
CategoryValueEnvironmentalAudioExposureEvent,
|
|
36
|
+
CategoryValueHeadphoneAudioExposureEvent,
|
|
37
|
+
CategoryValueLowCardioFitnessEvent,
|
|
38
|
+
CategoryValueMenstrualFlow,
|
|
39
|
+
CategoryValueNotApplicable,
|
|
40
|
+
CategoryValueOvulationTestResult,
|
|
41
|
+
CategoryValuePregnancyTestResult,
|
|
42
|
+
CategoryValuePresence,
|
|
43
|
+
CategoryValueProgesteroneTestResult,
|
|
44
|
+
CategoryValueSeverity,
|
|
45
|
+
CategoryValueSleepAnalysis,
|
|
46
|
+
CategoryValueVaginalBleeding,
|
|
47
|
+
}
|
|
48
|
+
|
|
6
49
|
export type CategoryTypePresenceIdentifier =
|
|
7
50
|
| 'HKCategoryTypeIdentifierAppetiteChanges'
|
|
8
51
|
| 'HKCategoryTypeIdentifierSleepChanges'
|
|
9
52
|
|
|
10
53
|
export type CategoryTypeValueNotApplicableIdentifier =
|
|
11
54
|
| 'HKCategoryTypeIdentifierHighHeartRateEvent'
|
|
55
|
+
| 'HKCategoryTypeIdentifierHypertensionEvent'
|
|
12
56
|
| 'HKCategoryTypeIdentifierIntermenstrualBleeding'
|
|
13
57
|
| 'HKCategoryTypeIdentifierMindfulSession'
|
|
14
58
|
| 'HKCategoryTypeIdentifierSexualActivity'
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepregnancytestresult Apple Docs }
|
|
18
|
-
*/
|
|
19
|
-
enum CategoryValuePregnancyTestResult {
|
|
20
|
-
positive = 2,
|
|
21
|
-
negative = 1,
|
|
22
|
-
indeterminate = 3,
|
|
23
|
-
}
|
|
59
|
+
| 'HKCategoryTypeIdentifierSleepApneaEvent'
|
|
24
60
|
|
|
25
61
|
export type CategoryTypeSeverityIdentifier =
|
|
26
62
|
| 'HKCategoryTypeIdentifierAbdominalCramps'
|
|
@@ -47,7 +83,6 @@ export type CategoryTypeSeverityIdentifier =
|
|
|
47
83
|
| 'HKCategoryTypeIdentifierLossOfTaste'
|
|
48
84
|
| 'HKCategoryTypeIdentifierLowerBackPain'
|
|
49
85
|
| 'HKCategoryTypeIdentifierMemoryLapse'
|
|
50
|
-
| 'HKCategoryTypeIdentifierMoodChanges'
|
|
51
86
|
| 'HKCategoryTypeIdentifierNausea'
|
|
52
87
|
| 'HKCategoryTypeIdentifierNightSweats'
|
|
53
88
|
| 'HKCategoryTypeIdentifierPelvicPain'
|
|
@@ -61,109 +96,10 @@ export type CategoryTypeSeverityIdentifier =
|
|
|
61
96
|
| 'HKCategoryTypeIdentifierVomiting'
|
|
62
97
|
| 'HKCategoryTypeIdentifierWheezing'
|
|
63
98
|
|
|
64
|
-
/**
|
|
65
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluecervicalmucusquality Apple Docs }
|
|
66
|
-
*/
|
|
67
|
-
export enum CategoryValueCervicalMucusQuality {
|
|
68
|
-
dry = 1,
|
|
69
|
-
sticky = 2,
|
|
70
|
-
creamy = 3,
|
|
71
|
-
watery = 4,
|
|
72
|
-
eggWhite = 5,
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluemenstrualflow Apple Docs }
|
|
77
|
-
*/
|
|
78
|
-
export enum CategoryValueMenstrualFlow {
|
|
79
|
-
unspecified = 1,
|
|
80
|
-
none = 5,
|
|
81
|
-
light = 2,
|
|
82
|
-
medium = 3,
|
|
83
|
-
heavy = 4,
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueovulationtestresult Apple Docs }
|
|
88
|
-
*/
|
|
89
|
-
export enum CategoryValueOvulationTestResult {
|
|
90
|
-
negative = 1,
|
|
91
|
-
luteinizingHormoneSurge = 2,
|
|
92
|
-
indeterminate = 3,
|
|
93
|
-
estrogenSurge = 4,
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluesleepanalysis Apple Docs }
|
|
98
|
-
*/
|
|
99
|
-
export enum CategoryValueSleepAnalysis {
|
|
100
|
-
inBed = 0,
|
|
101
|
-
asleepUnspecified = 1,
|
|
102
|
-
awake = 2,
|
|
103
|
-
asleepCore = 3,
|
|
104
|
-
asleepDeep = 4,
|
|
105
|
-
asleepREM = 5,
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueappetitechanges Apple Docs}
|
|
110
|
-
*/
|
|
111
|
-
export enum CategoryValueAppetiteChanges {
|
|
112
|
-
decreased = 2,
|
|
113
|
-
increased = 3,
|
|
114
|
-
noChange = 1,
|
|
115
|
-
unspecified = 0,
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepresence Apple Docs}
|
|
120
|
-
*/
|
|
121
|
-
export enum CategoryValuePresence {
|
|
122
|
-
notPresent = 1,
|
|
123
|
-
present = 0,
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueseverity Apple Docs }
|
|
128
|
-
*/
|
|
129
|
-
export enum CategoryValueSeverity {
|
|
130
|
-
notPresent = 1,
|
|
131
|
-
mild = 2,
|
|
132
|
-
moderate = 3,
|
|
133
|
-
severe = 4,
|
|
134
|
-
unspecified = 0,
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalue/notapplicable Apple Docs }
|
|
139
|
-
*/
|
|
140
|
-
export enum CategoryValueNotApplicable {
|
|
141
|
-
notApplicable = 0,
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export enum CategoryValueLowCardioFitnessEvent {
|
|
145
|
-
lowFitness = 1,
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalue Apple Docs }
|
|
150
|
-
*/
|
|
151
99
|
export type CategoryValue =
|
|
152
|
-
|
|
|
153
|
-
| CategoryValueCervicalMucusQuality
|
|
154
|
-
| CategoryValueLowCardioFitnessEvent
|
|
155
|
-
| CategoryValueMenstrualFlow
|
|
156
|
-
| CategoryValueOvulationTestResult
|
|
157
|
-
| CategoryValuePresence
|
|
158
|
-
| CategoryValueSeverity
|
|
159
|
-
| CategoryValueSleepAnalysis
|
|
100
|
+
| CategoryValueForIdentifierGenerated<CategoryTypeIdentifier>
|
|
160
101
|
| number
|
|
161
102
|
|
|
162
|
-
export enum CategoryValueAppleStandHour {
|
|
163
|
-
stood = 0,
|
|
164
|
-
idle = 1,
|
|
165
|
-
}
|
|
166
|
-
|
|
167
103
|
export interface CategorySampleForSaving {
|
|
168
104
|
readonly start: Date
|
|
169
105
|
readonly end: Date
|
|
@@ -194,49 +130,17 @@ export interface CategorySamplesWithAnchorResponseTyped<
|
|
|
194
130
|
|
|
195
131
|
export type MetadataForCategoryIdentifier<
|
|
196
132
|
T extends CategoryTypeIdentifier = CategoryTypeIdentifier,
|
|
197
|
-
> =
|
|
198
|
-
? GenericMetadata & {
|
|
199
|
-
readonly HKSexualActivityProtectionUsed?: boolean
|
|
200
|
-
}
|
|
201
|
-
: T extends 'HKCategoryTypeIdentifierMenstrualFlow'
|
|
202
|
-
? GenericMetadata & {
|
|
203
|
-
readonly HKMenstrualCycleStart?: boolean
|
|
204
|
-
}
|
|
205
|
-
: GenericMetadata
|
|
133
|
+
> = GenericMetadata & CategoryTypedMetadataForIdentifierGenerated<T>
|
|
206
134
|
|
|
207
|
-
export
|
|
208
|
-
|
|
135
|
+
export type CategorySampleTyped<T extends CategoryTypeIdentifier> = Omit<
|
|
136
|
+
CategorySample,
|
|
137
|
+
'categoryType' | 'value' | 'metadata'
|
|
138
|
+
> & {
|
|
209
139
|
readonly categoryType: T
|
|
210
140
|
readonly value: CategoryValueForIdentifier<T>
|
|
211
|
-
|
|
212
141
|
readonly metadata: MetadataForCategoryIdentifier<T>
|
|
213
|
-
|
|
214
|
-
readonly metadataSexualActivityProtectionUsed?: boolean
|
|
215
|
-
readonly metadataMenstrualCycleStart?: boolean
|
|
216
142
|
}
|
|
217
143
|
|
|
218
144
|
export type CategoryValueForIdentifier<
|
|
219
145
|
T extends CategoryTypeIdentifier = CategoryTypeIdentifier,
|
|
220
|
-
> = T
|
|
221
|
-
? CategoryValueCervicalMucusQuality
|
|
222
|
-
: T extends 'CategoryTypeIdentifierMenstrualFlow'
|
|
223
|
-
? CategoryValueMenstrualFlow
|
|
224
|
-
: T extends 'HKCategoryTypeIdentifierOvulationTestResult'
|
|
225
|
-
? CategoryValueOvulationTestResult
|
|
226
|
-
: T extends 'HKCategoryTypeIdentifierSleepAnalysis'
|
|
227
|
-
? CategoryValueSleepAnalysis
|
|
228
|
-
: T extends CategoryTypeValueNotApplicableIdentifier
|
|
229
|
-
? CategoryValueNotApplicable
|
|
230
|
-
: T extends CategoryTypeSeverityIdentifier
|
|
231
|
-
? CategoryValueSeverity
|
|
232
|
-
: T extends CategoryTypePresenceIdentifier
|
|
233
|
-
? CategoryValuePresence
|
|
234
|
-
: T extends 'HKCategoryTypeIdentifierLowCardioFitnessEvent'
|
|
235
|
-
? CategoryValueLowCardioFitnessEvent
|
|
236
|
-
: T extends 'HKCategoryTypeIdentifierPregnancyTestResult'
|
|
237
|
-
? CategoryValuePregnancyTestResult
|
|
238
|
-
: T extends 'HKCategoryTypeIdentifierPregnancyTestResult'
|
|
239
|
-
? CategoryValuePregnancyTestResult
|
|
240
|
-
: T extends 'HKCategoryTypeIdentifierAppleStandHour'
|
|
241
|
-
? CategoryValueAppleStandHour
|
|
242
|
-
: number
|
|
146
|
+
> = CategoryValueForIdentifierGenerated<T>
|