@kingstinct/react-native-healthkit 4.4.0 → 4.4.3
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/lib/commonjs/index.ios.js +31 -1
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +49 -36
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-types.js +111 -104
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/index.ios.js +32 -2
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js +50 -36
- package/lib/module/index.js.map +1 -1
- package/lib/module/native-types.js +109 -102
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/native-types.d.ts +113 -105
- package/lib/typescript/src/types.d.ts +7 -5
- package/package.json +1 -1
- package/src/index.ios.tsx +42 -7
- package/src/index.tsx +53 -36
- package/src/native-types.ts +149 -137
- package/src/types.ts +13 -7
package/src/native-types.ts
CHANGED
|
@@ -5,19 +5,119 @@ import {
|
|
|
5
5
|
|
|
6
6
|
import type { EmitterSubscription } from 'react-native'
|
|
7
7
|
|
|
8
|
-
export const HKWorkoutTypeIdentifier = 'HKWorkoutTypeIdentifier'
|
|
9
|
-
export const HKAudiogramTypeIdentifier = 'HKAudiogramTypeIdentifier'
|
|
10
|
-
export const HKWorkoutRouteTypeIdentifier = 'HKWorkoutRouteTypeIdentifier'
|
|
11
|
-
export const HKDataTypeIdentifierHeartbeatSeries = 'HKDataTypeIdentifierHeartbeatSeries'
|
|
8
|
+
export const HKWorkoutTypeIdentifier = 'HKWorkoutTypeIdentifier' as const
|
|
9
|
+
export const HKAudiogramTypeIdentifier = 'HKAudiogramTypeIdentifier' as const
|
|
10
|
+
export const HKWorkoutRouteTypeIdentifier = 'HKWorkoutRouteTypeIdentifier' as const
|
|
11
|
+
export const HKDataTypeIdentifierHeartbeatSeries = 'HKDataTypeIdentifierHeartbeatSeries' as const
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
// Straight mapping to https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifier
|
|
14
|
+
export enum HKQuantityTypeIdentifier {
|
|
15
|
+
bodyMassIndex = 'HKQuantityTypeIdentifierBodyMassIndex',
|
|
16
|
+
bodyFatPercentage = 'HKQuantityTypeIdentifierBodyFatPercentage', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
17
|
+
height = 'HKQuantityTypeIdentifierHeight', // Length, Discrete
|
|
18
|
+
bodyMass = 'HKQuantityTypeIdentifierBodyMass', // Mass, Discrete
|
|
19
|
+
leanBodyMass = 'HKQuantityTypeIdentifierLeanBodyMass', // Mass, Discrete
|
|
20
|
+
|
|
21
|
+
waistCircumference = 'HKQuantityTypeIdentifierWaistCircumference', // Length, Discrete
|
|
22
|
+
// Fitness
|
|
23
|
+
stepCount = 'HKQuantityTypeIdentifierStepCount', // Scalar(Count), Cumulative
|
|
24
|
+
distanceWalkingRunning = 'HKQuantityTypeIdentifierDistanceWalkingRunning', // Length, Cumulative
|
|
25
|
+
distanceCycling = 'HKQuantityTypeIdentifierDistanceCycling', // Length, Cumulative
|
|
26
|
+
distanceWheelchair = 'HKQuantityTypeIdentifierDistanceWheelchair', // Length, Cumulative
|
|
27
|
+
basalEnergyBurned = 'HKQuantityTypeIdentifierBasalEnergyBurned', // Energy, Cumulative
|
|
28
|
+
activeEnergyBurned = 'HKQuantityTypeIdentifierActiveEnergyBurned', // Energy, Cumulative
|
|
29
|
+
flightsClimbed = 'HKQuantityTypeIdentifierFlightsClimbed', // Scalar(Count), Cumulative
|
|
30
|
+
nikeFuel = 'HKQuantityTypeIdentifierNikeFuel', // Scalar(Count), Cumulative
|
|
31
|
+
appleExerciseTime = 'HKQuantityTypeIdentifierAppleExerciseTime', // Time Cumulative
|
|
32
|
+
pushCount = 'HKQuantityTypeIdentifierPushCount', // Scalar(Count), Cumulative
|
|
33
|
+
distanceSwimming = 'HKQuantityTypeIdentifierDistanceSwimming', // Length, Cumulative
|
|
34
|
+
swimmingStrokeCount = 'HKQuantityTypeIdentifierSwimmingStrokeCount', // Scalar(Count), Cumulative
|
|
35
|
+
vo2Max = 'HKQuantityTypeIdentifierVo2Max', // ml/(kg*min) Discrete
|
|
36
|
+
distanceDownhillSnowSports = 'HKQuantityTypeIdentifierDistanceDownhillSnowSports', // Length, Cumulative
|
|
37
|
+
|
|
38
|
+
appleStandTime = 'HKQuantityTypeIdentifierAppleStandTime', // Time, Cumulative
|
|
39
|
+
// Vitals
|
|
40
|
+
heartRate = 'HKQuantityTypeIdentifierHeartRate', // Scalar(Count)/Time, Discrete
|
|
41
|
+
bodyTemperature = 'HKQuantityTypeIdentifierBodyTemperature', // Temperature, Discrete
|
|
42
|
+
basalBodyTemperature = 'HKQuantityTypeIdentifierBasalBodyTemperature', // Basal Body Temperature, Discrete
|
|
43
|
+
bloodPressureSystolic = 'HKQuantityTypeIdentifierBloodPressureSystolic', // Pressure, Discrete
|
|
44
|
+
bloodPressureDiastolic = 'HKQuantityTypeIdentifierBloodPressureDiastolic', // Pressure, Discrete
|
|
45
|
+
respiratoryRate = 'HKQuantityTypeIdentifierRespiratoryRate', // Scalar(Count)/Time, Discrete
|
|
46
|
+
// Beats per minute estimate of a user's lowest heart rate while at rest
|
|
47
|
+
restingHeartRate = 'HKQuantityTypeIdentifierRestingHeartRate', // Scalar(Count)/Time, Discrete
|
|
48
|
+
// Average heartbeats per minute captured by an Apple Watch while a user is walking
|
|
49
|
+
walkingHeartRateAverage = 'HKQuantityTypeIdentifierWalkingHeartRateAverage', // Scalar(Count)/Time, Discrete
|
|
50
|
+
// The standard deviation of heart beat-to-beat intevals (Standard Deviation of Normal to Normal)
|
|
51
|
+
|
|
52
|
+
heartRateVariabilitySDNN = 'HKQuantityTypeIdentifierHeartRateVariabilitySDNN', // Time (ms), Discrete
|
|
53
|
+
// Results
|
|
54
|
+
oxygenSaturation = 'HKQuantityTypeIdentifierOxygenSaturation', // Scalar (Percent, 0.0 - 1.0, Discrete
|
|
55
|
+
peripheralPerfusionIndex = 'HKQuantityTypeIdentifierPeripheralPerfusionIndex', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
56
|
+
bloodGlucose = 'HKQuantityTypeIdentifierBloodGlucose', // Mass/Volume, Discrete
|
|
57
|
+
numberOfTimesFallen = 'HKQuantityTypeIdentifierNumberOfTimesFallen', // Scalar(Count), Cumulative
|
|
58
|
+
electrodermalActivity = 'HKQuantityTypeIdentifierElectrodermalActivity', // Conductance, Discrete
|
|
59
|
+
inhalerUsage = 'HKQuantityTypeIdentifierInhalerUsage', // Scalar(Count), Cumulative
|
|
60
|
+
insulinDelivery = 'HKQuantityTypeIdentifierInsulinDelivery', // Pharmacology (IU) Cumulative
|
|
61
|
+
bloodAlcoholContent = 'HKQuantityTypeIdentifierBloodAlcoholContent', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
62
|
+
forcedVitalCapacity = 'HKQuantityTypeIdentifierForcedVitalCapacity', // Volume, Discrete
|
|
63
|
+
forcedExpiratoryVolume1 = 'HKQuantityTypeIdentifierForcedExpiratoryVolume1', // Volume, Discrete
|
|
64
|
+
peakExpiratoryFlowRate = 'HKQuantityTypeIdentifierPeakExpiratoryFlowRate', // Volume/Time, Discrete
|
|
65
|
+
environmentalAudioExposure = 'HKQuantityTypeIdentifierEnvironmentalAudioExposure', // Pressure, Cumulative
|
|
66
|
+
|
|
67
|
+
headphoneAudioExposure = 'HKQuantityTypeIdentifierHeadphoneAudioExposure', // Pressure, Cumulative
|
|
68
|
+
// Nutrition
|
|
69
|
+
dietaryFatTotal = 'HKQuantityTypeIdentifierDietaryFatTotal', // Mass, Cumulative
|
|
70
|
+
dietaryFatPolyunsaturated = 'HKQuantityTypeIdentifierDietaryFatPolyunsaturated', // Mass, Cumulative
|
|
71
|
+
dietaryFatMonounsaturated = 'HKQuantityTypeIdentifierDietaryFatMonounsaturated', // Mass, Cumulative
|
|
72
|
+
dietaryFatSaturated = 'HKQuantityTypeIdentifierDietaryFatSaturated', // Mass, Cumulative
|
|
73
|
+
dietaryCholesterol = 'HKQuantityTypeIdentifierDietaryCholesterol', // Mass, Cumulative
|
|
74
|
+
dietarySodium = 'HKQuantityTypeIdentifierDietarySodium', // Mass, Cumulative
|
|
75
|
+
dietaryCarbohydrates = 'HKQuantityTypeIdentifierDietaryCarbohydrates', // Mass, Cumulative
|
|
76
|
+
dietaryFiber = 'HKQuantityTypeIdentifierDietaryFiber', // Mass, Cumulative
|
|
77
|
+
dietarySugar = 'HKQuantityTypeIdentifierDietarySugar', // Mass, Cumulative
|
|
78
|
+
dietaryEnergyConsumed = 'HKQuantityTypeIdentifierDietaryEnergyConsumed', // Energy, Cumulative
|
|
79
|
+
dietaryProtein = 'HKQuantityTypeIdentifierDietaryProtein', // Mass, Cumulative
|
|
80
|
+
|
|
81
|
+
dietaryVitaminA = 'HKQuantityTypeIdentifierDietaryVitaminA', // Mass, Cumulative
|
|
82
|
+
dietaryVitaminB6 = 'HKQuantityTypeIdentifierDietaryVitaminB6', // Mass, Cumulative
|
|
83
|
+
dietaryVitaminB12 = 'HKQuantityTypeIdentifierDietaryVitaminB12', // Mass, Cumulative
|
|
84
|
+
dietaryVitaminC = 'HKQuantityTypeIdentifierDietaryVitaminC', // Mass, Cumulative
|
|
85
|
+
dietaryVitaminD = 'HKQuantityTypeIdentifierDietaryVitaminD', // Mass, Cumulative
|
|
86
|
+
dietaryVitaminE = 'HKQuantityTypeIdentifierDietaryVitaminE', // Mass, Cumulative
|
|
87
|
+
dietaryVitaminK = 'HKQuantityTypeIdentifierDietaryVitaminK', // Mass, Cumulative
|
|
88
|
+
dietaryCalcium = 'HKQuantityTypeIdentifierDietaryCalcium', // Mass, Cumulative
|
|
89
|
+
dietaryIron = 'HKQuantityTypeIdentifierDietaryIron', // Mass, Cumulative
|
|
90
|
+
dietaryThiamin = 'HKQuantityTypeIdentifierDietaryThiamin', // Mass, Cumulative
|
|
91
|
+
dietaryRiboflavin = 'HKQuantityTypeIdentifierDietaryRiboflavin', // Mass, Cumulative
|
|
92
|
+
dietaryNiacin = 'HKQuantityTypeIdentifierDietaryNiacin', // Mass, Cumulative
|
|
93
|
+
dietaryFolate = 'HKQuantityTypeIdentifierDietaryFolate', // Mass, Cumulative
|
|
94
|
+
dietaryBiotin = 'HKQuantityTypeIdentifierDietaryBiotin', // Mass, Cumulative
|
|
95
|
+
dietaryPantothenicAcid = 'HKQuantityTypeIdentifierDietaryPantothenicAcid', // Mass, Cumulative
|
|
96
|
+
dietaryPhosphorus = 'HKQuantityTypeIdentifierDietaryPhosphorus', // Mass, Cumulative
|
|
97
|
+
dietaryIodine = 'HKQuantityTypeIdentifierDietaryIodine', // Mass, Cumulative
|
|
98
|
+
dietaryMagnesium = 'HKQuantityTypeIdentifierDietaryMagnesium', // Mass, Cumulative
|
|
99
|
+
dietaryZinc = 'HKQuantityTypeIdentifierDietaryZinc', // Mass, Cumulative
|
|
100
|
+
dietarySelenium = 'HKQuantityTypeIdentifierDietarySelenium', // Mass, Cumulative
|
|
101
|
+
dietaryCopper = 'HKQuantityTypeIdentifierDietaryCopper', // Mass, Cumulative
|
|
102
|
+
dietaryManganese = 'HKQuantityTypeIdentifierDietaryManganese', // Mass, Cumulative
|
|
103
|
+
dietaryChromium = 'HKQuantityTypeIdentifierDietaryChromium', // Mass, Cumulative
|
|
104
|
+
dietaryMolybdenum = 'HKQuantityTypeIdentifierDietaryMolybdenum', // Mass, Cumulative
|
|
105
|
+
dietaryChloride = 'HKQuantityTypeIdentifierDietaryChloride', // Mass, Cumulative
|
|
106
|
+
dietaryPotassium = 'HKQuantityTypeIdentifierDietaryPotassium', // Mass, Cumulative
|
|
107
|
+
dietaryCaffeine = 'HKQuantityTypeIdentifierDietaryCaffeine', // Mass, Cumulative
|
|
108
|
+
dietaryWater = 'HKQuantityTypeIdentifierDietaryWater', // Volume, Cumulative
|
|
109
|
+
|
|
110
|
+
// Mobility
|
|
111
|
+
sixMinuteWalkTestDistance = 'HKQuantityTypeIdentifierSixMinuteWalkTestDistance',
|
|
112
|
+
walkingSpeed = 'HKQuantityTypeIdentifierWalkingSpeed',
|
|
113
|
+
walkingStepLength = 'HKQuantityTypeIdentifierWalkingStepLength',
|
|
114
|
+
walkingAsymmetryPercentage = 'HKQuantityTypeIdentifierWalkingAsymmetryPercentage',
|
|
115
|
+
walkingDoubleSupportPercentage = 'HKQuantityTypeIdentifierWalkingDoubleSupportPercentage',
|
|
116
|
+
stairAscentSpeed = 'HKQuantityTypeIdentifierStairAscentSpeed',
|
|
117
|
+
stairDescentSpeed = 'HKQuantityTypeIdentifierStairDescentSpeed',
|
|
118
|
+
|
|
119
|
+
uvExposure = 'HKQuantityTypeIdentifierUvExposure', // Scalar (Count), Discrete
|
|
120
|
+
}
|
|
21
121
|
|
|
22
122
|
export type TypeToUnitMapping = { readonly
|
|
23
123
|
[key in HKQuantityTypeIdentifier]: HKUnit;
|
|
@@ -29,6 +129,11 @@ export enum HKHeartRateMotionContext {
|
|
|
29
129
|
sedentary = 1,
|
|
30
130
|
}
|
|
31
131
|
|
|
132
|
+
export enum HKCorrelationTypeIdentifier {
|
|
133
|
+
bloodPressure = 'HKCorrelationTypeIdentifierBloodPressure',
|
|
134
|
+
food = 'HKCorrelationTypeIdentifierFood',
|
|
135
|
+
}
|
|
136
|
+
|
|
32
137
|
export enum HKCategoryTypeIdentifier {
|
|
33
138
|
sleepAnalysis = 'HKCategoryTypeIdentifierSleepAnalysis',
|
|
34
139
|
appleStandHour = 'HKCategoryTypeIdentifierAppleStandHour',
|
|
@@ -45,6 +150,21 @@ export enum HKCategoryTypeIdentifier {
|
|
|
45
150
|
toothbrushingEvent = 'HKCategoryTypeIdentifierToothbrushingEvent',
|
|
46
151
|
}
|
|
47
152
|
|
|
153
|
+
export type HKSampleTypeIdentifier =
|
|
154
|
+
HKCategoryTypeIdentifier
|
|
155
|
+
| HKCorrelationTypeIdentifier
|
|
156
|
+
| HKQuantityTypeIdentifier
|
|
157
|
+
| typeof HKAudiogramTypeIdentifier
|
|
158
|
+
| typeof HKDataTypeIdentifierHeartbeatSeries
|
|
159
|
+
| typeof HKWorkoutRouteTypeIdentifier
|
|
160
|
+
| typeof HKWorkoutTypeIdentifier
|
|
161
|
+
| `${HKCategoryTypeIdentifier}`
|
|
162
|
+
| `${HKCorrelationTypeIdentifier}`
|
|
163
|
+
| `${HKQuantityTypeIdentifier}`
|
|
164
|
+
|
|
165
|
+
export type HealthkitReadAuthorization = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier | `${HKCharacteristicTypeIdentifier}` | `${HKSampleTypeIdentifier}`
|
|
166
|
+
export type HealthkitWriteAuthorization = HKSampleTypeIdentifier
|
|
167
|
+
|
|
48
168
|
export enum HKCategoryValueAppleStandHour {
|
|
49
169
|
stood = 0,
|
|
50
170
|
idle = 1,
|
|
@@ -180,120 +300,19 @@ export enum HKWeatherCondition {
|
|
|
180
300
|
tornado = 27,
|
|
181
301
|
}
|
|
182
302
|
|
|
303
|
+
enum HKIndoorWorkout {
|
|
304
|
+
false = 0,
|
|
305
|
+
true = 1,
|
|
306
|
+
}
|
|
307
|
+
|
|
183
308
|
export interface HKWorkoutMetadata
|
|
184
309
|
extends HKGenericMetadata /* <TTemperatureUnit extends HKUnit> */ {
|
|
185
310
|
readonly HKWeatherCondition?: HKWeatherCondition;
|
|
186
311
|
readonly HKWeatherHumidity?: HKQuantity<HKUnit.Percent>;
|
|
187
312
|
// HKWeatherTemperature: HKQuantity<TTemperatureUnit>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
export enum HKQuantityTypeIdentifier {
|
|
192
|
-
bodyMassIndex = 'HKQuantityTypeIdentifierBodyMassIndex',
|
|
193
|
-
bodyFatPercentage = 'HKQuantityTypeIdentifierBodyFatPercentage', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
194
|
-
height = 'HKQuantityTypeIdentifierHeight', // Length, Discrete
|
|
195
|
-
bodyMass = 'HKQuantityTypeIdentifierBodyMass', // Mass, Discrete
|
|
196
|
-
leanBodyMass = 'HKQuantityTypeIdentifierLeanBodyMass', // Mass, Discrete
|
|
197
|
-
|
|
198
|
-
waistCircumference = 'HKQuantityTypeIdentifierWaistCircumference', // Length, Discrete
|
|
199
|
-
// Fitness
|
|
200
|
-
stepCount = 'HKQuantityTypeIdentifierStepCount', // Scalar(Count), Cumulative
|
|
201
|
-
distanceWalkingRunning = 'HKQuantityTypeIdentifierDistanceWalkingRunning', // Length, Cumulative
|
|
202
|
-
distanceCycling = 'HKQuantityTypeIdentifierDistanceCycling', // Length, Cumulative
|
|
203
|
-
distanceWheelchair = 'HKQuantityTypeIdentifierDistanceWheelchair', // Length, Cumulative
|
|
204
|
-
basalEnergyBurned = 'HKQuantityTypeIdentifierBasalEnergyBurned', // Energy, Cumulative
|
|
205
|
-
activeEnergyBurned = 'HKQuantityTypeIdentifierActiveEnergyBurned', // Energy, Cumulative
|
|
206
|
-
flightsClimbed = 'HKQuantityTypeIdentifierFlightsClimbed', // Scalar(Count), Cumulative
|
|
207
|
-
nikeFuel = 'HKQuantityTypeIdentifierNikeFuel', // Scalar(Count), Cumulative
|
|
208
|
-
appleExerciseTime = 'HKQuantityTypeIdentifierAppleExerciseTime', // Time Cumulative
|
|
209
|
-
pushCount = 'HKQuantityTypeIdentifierPushCount', // Scalar(Count), Cumulative
|
|
210
|
-
distanceSwimming = 'HKQuantityTypeIdentifierDistanceSwimming', // Length, Cumulative
|
|
211
|
-
swimmingStrokeCount = 'HKQuantityTypeIdentifierSwimmingStrokeCount', // Scalar(Count), Cumulative
|
|
212
|
-
vo2Max = 'HKQuantityTypeIdentifierVo2Max', // ml/(kg*min) Discrete
|
|
213
|
-
distanceDownhillSnowSports = 'HKQuantityTypeIdentifierDistanceDownhillSnowSports', // Length, Cumulative
|
|
214
|
-
|
|
215
|
-
appleStandTime = 'HKQuantityTypeIdentifierAppleStandTime', // Time, Cumulative
|
|
216
|
-
// Vitals
|
|
217
|
-
heartRate = 'HKQuantityTypeIdentifierHeartRate', // Scalar(Count)/Time, Discrete
|
|
218
|
-
bodyTemperature = 'HKQuantityTypeIdentifierBodyTemperature', // Temperature, Discrete
|
|
219
|
-
basalBodyTemperature = 'HKQuantityTypeIdentifierBasalBodyTemperature', // Basal Body Temperature, Discrete
|
|
220
|
-
bloodPressureSystolic = 'HKQuantityTypeIdentifierBloodPressureSystolic', // Pressure, Discrete
|
|
221
|
-
bloodPressureDiastolic = 'HKQuantityTypeIdentifierBloodPressureDiastolic', // Pressure, Discrete
|
|
222
|
-
respiratoryRate = 'HKQuantityTypeIdentifierRespiratoryRate', // Scalar(Count)/Time, Discrete
|
|
223
|
-
// Beats per minute estimate of a user's lowest heart rate while at rest
|
|
224
|
-
restingHeartRate = 'HKQuantityTypeIdentifierRestingHeartRate', // Scalar(Count)/Time, Discrete
|
|
225
|
-
// Average heartbeats per minute captured by an Apple Watch while a user is walking
|
|
226
|
-
walkingHeartRateAverage = 'HKQuantityTypeIdentifierWalkingHeartRateAverage', // Scalar(Count)/Time, Discrete
|
|
227
|
-
// The standard deviation of heart beat-to-beat intevals (Standard Deviation of Normal to Normal)
|
|
228
|
-
|
|
229
|
-
heartRateVariabilitySDNN = 'HKQuantityTypeIdentifierHeartRateVariabilitySDNN', // Time (ms), Discrete
|
|
230
|
-
// Results
|
|
231
|
-
oxygenSaturation = 'HKQuantityTypeIdentifierOxygenSaturation', // Scalar (Percent, 0.0 - 1.0, Discrete
|
|
232
|
-
peripheralPerfusionIndex = 'HKQuantityTypeIdentifierPeripheralPerfusionIndex', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
233
|
-
bloodGlucose = 'HKQuantityTypeIdentifierBloodGlucose', // Mass/Volume, Discrete
|
|
234
|
-
numberOfTimesFallen = 'HKQuantityTypeIdentifierNumberOfTimesFallen', // Scalar(Count), Cumulative
|
|
235
|
-
electrodermalActivity = 'HKQuantityTypeIdentifierElectrodermalActivity', // Conductance, Discrete
|
|
236
|
-
inhalerUsage = 'HKQuantityTypeIdentifierInhalerUsage', // Scalar(Count), Cumulative
|
|
237
|
-
insulinDelivery = 'HKQuantityTypeIdentifierInsulinDelivery', // Pharmacology (IU) Cumulative
|
|
238
|
-
bloodAlcoholContent = 'HKQuantityTypeIdentifierBloodAlcoholContent', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
239
|
-
forcedVitalCapacity = 'HKQuantityTypeIdentifierForcedVitalCapacity', // Volume, Discrete
|
|
240
|
-
forcedExpiratoryVolume1 = 'HKQuantityTypeIdentifierForcedExpiratoryVolume1', // Volume, Discrete
|
|
241
|
-
peakExpiratoryFlowRate = 'HKQuantityTypeIdentifierPeakExpiratoryFlowRate', // Volume/Time, Discrete
|
|
242
|
-
environmentalAudioExposure = 'HKQuantityTypeIdentifierEnvironmentalAudioExposure', // Pressure, Cumulative
|
|
243
|
-
|
|
244
|
-
headphoneAudioExposure = 'HKQuantityTypeIdentifierHeadphoneAudioExposure', // Pressure, Cumulative
|
|
245
|
-
// Nutrition
|
|
246
|
-
dietaryFatTotal = 'HKQuantityTypeIdentifierDietaryFatTotal', // Mass, Cumulative
|
|
247
|
-
dietaryFatPolyunsaturated = 'HKQuantityTypeIdentifierDietaryFatPolyunsaturated', // Mass, Cumulative
|
|
248
|
-
dietaryFatMonounsaturated = 'HKQuantityTypeIdentifierDietaryFatMonounsaturated', // Mass, Cumulative
|
|
249
|
-
dietaryFatSaturated = 'HKQuantityTypeIdentifierDietaryFatSaturated', // Mass, Cumulative
|
|
250
|
-
dietaryCholesterol = 'HKQuantityTypeIdentifierDietaryCholesterol', // Mass, Cumulative
|
|
251
|
-
dietarySodium = 'HKQuantityTypeIdentifierDietarySodium', // Mass, Cumulative
|
|
252
|
-
dietaryCarbohydrates = 'HKQuantityTypeIdentifierDietaryCarbohydrates', // Mass, Cumulative
|
|
253
|
-
dietaryFiber = 'HKQuantityTypeIdentifierDietaryFiber', // Mass, Cumulative
|
|
254
|
-
dietarySugar = 'HKQuantityTypeIdentifierDietarySugar', // Mass, Cumulative
|
|
255
|
-
dietaryEnergyConsumed = 'HKQuantityTypeIdentifierDietaryEnergyConsumed', // Energy, Cumulative
|
|
256
|
-
dietaryProtein = 'HKQuantityTypeIdentifierDietaryProtein', // Mass, Cumulative
|
|
257
|
-
|
|
258
|
-
dietaryVitaminA = 'HKQuantityTypeIdentifierDietaryVitaminA', // Mass, Cumulative
|
|
259
|
-
dietaryVitaminB6 = 'HKQuantityTypeIdentifierDietaryVitaminB6', // Mass, Cumulative
|
|
260
|
-
dietaryVitaminB12 = 'HKQuantityTypeIdentifierDietaryVitaminB12', // Mass, Cumulative
|
|
261
|
-
dietaryVitaminC = 'HKQuantityTypeIdentifierDietaryVitaminC', // Mass, Cumulative
|
|
262
|
-
dietaryVitaminD = 'HKQuantityTypeIdentifierDietaryVitaminD', // Mass, Cumulative
|
|
263
|
-
dietaryVitaminE = 'HKQuantityTypeIdentifierDietaryVitaminE', // Mass, Cumulative
|
|
264
|
-
dietaryVitaminK = 'HKQuantityTypeIdentifierDietaryVitaminK', // Mass, Cumulative
|
|
265
|
-
dietaryCalcium = 'HKQuantityTypeIdentifierDietaryCalcium', // Mass, Cumulative
|
|
266
|
-
dietaryIron = 'HKQuantityTypeIdentifierDietaryIron', // Mass, Cumulative
|
|
267
|
-
dietaryThiamin = 'HKQuantityTypeIdentifierDietaryThiamin', // Mass, Cumulative
|
|
268
|
-
dietaryRiboflavin = 'HKQuantityTypeIdentifierDietaryRiboflavin', // Mass, Cumulative
|
|
269
|
-
dietaryNiacin = 'HKQuantityTypeIdentifierDietaryNiacin', // Mass, Cumulative
|
|
270
|
-
dietaryFolate = 'HKQuantityTypeIdentifierDietaryFolate', // Mass, Cumulative
|
|
271
|
-
dietaryBiotin = 'HKQuantityTypeIdentifierDietaryBiotin', // Mass, Cumulative
|
|
272
|
-
dietaryPantothenicAcid = 'HKQuantityTypeIdentifierDietaryPantothenicAcid', // Mass, Cumulative
|
|
273
|
-
dietaryPhosphorus = 'HKQuantityTypeIdentifierDietaryPhosphorus', // Mass, Cumulative
|
|
274
|
-
dietaryIodine = 'HKQuantityTypeIdentifierDietaryIodine', // Mass, Cumulative
|
|
275
|
-
dietaryMagnesium = 'HKQuantityTypeIdentifierDietaryMagnesium', // Mass, Cumulative
|
|
276
|
-
dietaryZinc = 'HKQuantityTypeIdentifierDietaryZinc', // Mass, Cumulative
|
|
277
|
-
dietarySelenium = 'HKQuantityTypeIdentifierDietarySelenium', // Mass, Cumulative
|
|
278
|
-
dietaryCopper = 'HKQuantityTypeIdentifierDietaryCopper', // Mass, Cumulative
|
|
279
|
-
dietaryManganese = 'HKQuantityTypeIdentifierDietaryManganese', // Mass, Cumulative
|
|
280
|
-
dietaryChromium = 'HKQuantityTypeIdentifierDietaryChromium', // Mass, Cumulative
|
|
281
|
-
dietaryMolybdenum = 'HKQuantityTypeIdentifierDietaryMolybdenum', // Mass, Cumulative
|
|
282
|
-
dietaryChloride = 'HKQuantityTypeIdentifierDietaryChloride', // Mass, Cumulative
|
|
283
|
-
dietaryPotassium = 'HKQuantityTypeIdentifierDietaryPotassium', // Mass, Cumulative
|
|
284
|
-
dietaryCaffeine = 'HKQuantityTypeIdentifierDietaryCaffeine', // Mass, Cumulative
|
|
285
|
-
dietaryWater = 'HKQuantityTypeIdentifierDietaryWater', // Volume, Cumulative
|
|
286
|
-
|
|
287
|
-
// Mobility
|
|
288
|
-
sixMinuteWalkTestDistance = 'HKQuantityTypeIdentifierSixMinuteWalkTestDistance',
|
|
289
|
-
walkingSpeed = 'HKQuantityTypeIdentifierWalkingSpeed',
|
|
290
|
-
walkingStepLength = 'HKQuantityTypeIdentifierWalkingStepLength',
|
|
291
|
-
walkingAsymmetryPercentage = 'HKQuantityTypeIdentifierWalkingAsymmetryPercentage',
|
|
292
|
-
walkingDoubleSupportPercentage = 'HKQuantityTypeIdentifierWalkingDoubleSupportPercentage',
|
|
293
|
-
stairAscentSpeed = 'HKQuantityTypeIdentifierStairAscentSpeed',
|
|
294
|
-
stairDescentSpeed = 'HKQuantityTypeIdentifierStairDescentSpeed',
|
|
295
|
-
|
|
296
|
-
uvExposure = 'HKQuantityTypeIdentifierUvExposure', // Scalar (Count), Discrete
|
|
313
|
+
readonly HKAverageMETs?: HKQuantity<HKUnit>,
|
|
314
|
+
readonly HKElevationAscended?: HKQuantity<HKUnit.Meters>,
|
|
315
|
+
readonly HKIndoorWorkout?: HKIndoorWorkout,
|
|
297
316
|
}
|
|
298
317
|
|
|
299
318
|
export enum HKAuthorizationRequestStatus {
|
|
@@ -569,13 +588,13 @@ export enum HKUnit {
|
|
|
569
588
|
}
|
|
570
589
|
|
|
571
590
|
export type HKDevice = {
|
|
572
|
-
readonly name: string;
|
|
573
|
-
readonly firmwareVersion: string;
|
|
574
|
-
readonly hardwareVersion: string;
|
|
575
|
-
readonly localIdentifier: string;
|
|
576
|
-
readonly manufacturer: string;
|
|
577
|
-
readonly model: string;
|
|
578
|
-
readonly softwareVersion: string;
|
|
591
|
+
readonly name: string; // ex: "Apple Watch"
|
|
592
|
+
readonly firmwareVersion: string | null;
|
|
593
|
+
readonly hardwareVersion: string; // ex: "Watch6,2",
|
|
594
|
+
readonly localIdentifier: string | null;
|
|
595
|
+
readonly manufacturer: string; // ex: "Apple Inc."
|
|
596
|
+
readonly model: string; // ex: "Watch"
|
|
597
|
+
readonly softwareVersion: string; // ex: "9.0"
|
|
579
598
|
};
|
|
580
599
|
|
|
581
600
|
export type HKSource = {
|
|
@@ -661,11 +680,6 @@ export type HKCorrelationRaw<TIdentifier extends HKCorrelationTypeIdentifier> =
|
|
|
661
680
|
|
|
662
681
|
type QueryId = string;
|
|
663
682
|
|
|
664
|
-
export enum HKCorrelationTypeIdentifier {
|
|
665
|
-
bloodPressure = 'HKCorrelationTypeIdentifierBloodPressure',
|
|
666
|
-
food = 'HKCorrelationTypeIdentifierFood',
|
|
667
|
-
}
|
|
668
|
-
|
|
669
683
|
export enum HKUpdateFrequency {
|
|
670
684
|
immediate = 1,
|
|
671
685
|
hourly = 2,
|
|
@@ -690,8 +704,6 @@ export type WorkoutRoute = {
|
|
|
690
704
|
readonly HKMetadataKeySyncVersion?: number;
|
|
691
705
|
};
|
|
692
706
|
|
|
693
|
-
type AuthorizationStatusFor = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier
|
|
694
|
-
|
|
695
707
|
type ReactNativeHealthkitTypeNative = {
|
|
696
708
|
isHealthDataAvailable(): Promise<boolean>;
|
|
697
709
|
getBloodType(): Promise<HKBloodType>;
|
|
@@ -705,7 +717,7 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
705
717
|
updateFrequency: HKUpdateFrequency
|
|
706
718
|
) => Promise<boolean>;
|
|
707
719
|
readonly disableBackgroundDelivery: (
|
|
708
|
-
typeIdentifier: HKSampleTypeIdentifier
|
|
720
|
+
typeIdentifier: HKSampleTypeIdentifier,
|
|
709
721
|
) => Promise<boolean>;
|
|
710
722
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
711
723
|
|
|
@@ -742,7 +754,7 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
742
754
|
): Promise<QueryId>;
|
|
743
755
|
unsubscribeQuery(queryId: QueryId): Promise<boolean>;
|
|
744
756
|
authorizationStatusFor(
|
|
745
|
-
type:
|
|
757
|
+
type: HealthkitReadAuthorization
|
|
746
758
|
): Promise<boolean>;
|
|
747
759
|
getRequestStatusForAuthorization(
|
|
748
760
|
write: WritePermissions,
|
package/src/types.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
HealthkitReadAuthorization,
|
|
3
|
+
HealthkitWriteAuthorization,
|
|
2
4
|
HKAuthorizationRequestStatus,
|
|
3
5
|
HKBiologicalSex,
|
|
4
6
|
HKBloodType,
|
|
5
7
|
HKCategorySampleRaw,
|
|
6
8
|
HKCategoryTypeIdentifier,
|
|
7
9
|
HKCategoryValueForIdentifier,
|
|
8
|
-
HKCharacteristicTypeIdentifier,
|
|
9
10
|
HKCorrelationRaw,
|
|
10
11
|
HKCorrelationTypeIdentifier,
|
|
11
12
|
HKFitzpatrickSkinType,
|
|
@@ -104,7 +105,7 @@ export type QueryWorkoutsFn = <
|
|
|
104
105
|
) => Promise<readonly HKWorkout<TEnergy, TDistance>[]>;
|
|
105
106
|
|
|
106
107
|
export type AuthorizationStatusForFn = (
|
|
107
|
-
type:
|
|
108
|
+
type: HealthkitReadAuthorization
|
|
108
109
|
) => Promise<boolean>;
|
|
109
110
|
|
|
110
111
|
export type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(
|
|
@@ -113,13 +114,13 @@ export type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(
|
|
|
113
114
|
) => Promise<readonly HKCategorySample<T>[]>;
|
|
114
115
|
|
|
115
116
|
export type GetRequestStatusForAuthorizationFn = (
|
|
116
|
-
read: readonly
|
|
117
|
-
write?: readonly
|
|
117
|
+
read: readonly HealthkitReadAuthorization[],
|
|
118
|
+
write?: readonly HealthkitWriteAuthorization[]
|
|
118
119
|
) => Promise<HKAuthorizationRequestStatus>;
|
|
119
120
|
|
|
120
121
|
export type RequestAuthorizationFn = (
|
|
121
|
-
read: readonly
|
|
122
|
-
write?: readonly
|
|
122
|
+
read: readonly HealthkitReadAuthorization[],
|
|
123
|
+
write?: readonly HealthkitWriteAuthorization[]
|
|
123
124
|
) => Promise<boolean>;
|
|
124
125
|
|
|
125
126
|
export type SaveQuantitySampleFn = <TUnit extends HKQuantityTypeIdentifier>(
|
|
@@ -178,7 +179,7 @@ export type GetMostRecentQuantitySampleFn = <
|
|
|
178
179
|
>(
|
|
179
180
|
identifier: TIdentifier,
|
|
180
181
|
unit?: TUnit
|
|
181
|
-
) => Promise<HKQuantitySample<TIdentifier, TUnit
|
|
182
|
+
) => Promise<HKQuantitySample<TIdentifier, TUnit> | null>;
|
|
182
183
|
|
|
183
184
|
export type MostRecentQuantitySampleHook = <
|
|
184
185
|
TIdentifier extends HKQuantityTypeIdentifier,
|
|
@@ -321,4 +322,9 @@ export type ReactNativeHealthkit = {
|
|
|
321
322
|
readonly useMostRecentQuantitySample: MostRecentQuantitySampleHook;
|
|
322
323
|
|
|
323
324
|
readonly useSubscribeToChanges: SubscribeToChangesHook;
|
|
325
|
+
readonly useIsHealthDataAvailable: () => boolean | null;
|
|
326
|
+
readonly useHealthkitAuthorization: (
|
|
327
|
+
read: readonly HealthkitReadAuthorization[],
|
|
328
|
+
write?: readonly HealthkitWriteAuthorization[],
|
|
329
|
+
) => readonly [authorizationStatus: HKAuthorizationRequestStatus | null, request: () => Promise<HKAuthorizationRequestStatus | null>];
|
|
324
330
|
};
|