@kingstinct/react-native-healthkit 5.1.2 → 5.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -23
- package/android/.project +18 -1
- package/android/.settings/org.eclipse.buildship.core.prefs +4 -4
- package/ios/ReactNativeHealthkit.m +9 -0
- package/ios/ReactNativeHealthkit.swift +23 -7
- package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +57 -0
- package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +1 -0
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +12 -19
- package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +1 -1
- package/lib/commonjs/index.ios.js +1 -0
- package/lib/commonjs/index.ios.js.map +1 -1
- package/lib/commonjs/index.js +3 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/jest.setup.js +29 -2
- package/lib/commonjs/jest.setup.js.map +1 -1
- package/lib/commonjs/native-types.js +37 -30
- package/lib/commonjs/native-types.js.map +1 -1
- package/lib/commonjs/test-utils.js +21 -0
- package/lib/commonjs/test-utils.js.map +1 -0
- package/lib/commonjs/utils/getPreferredUnit.js.map +1 -1
- package/lib/commonjs/utils/subscribeToChanges.js +4 -4
- package/lib/commonjs/utils/subscribeToChanges.js.map +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.js.map +1 -1
- package/lib/module/hooks/useHealthkitAuthorization.test.js +45 -0
- package/lib/module/hooks/useHealthkitAuthorization.test.js.map +1 -0
- package/lib/module/hooks/useIsHealthDataAvailable.test.js +8 -16
- package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +1 -1
- package/lib/module/index.ios.js +1 -0
- package/lib/module/index.ios.js.map +1 -1
- package/lib/module/index.js +3 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/jest.setup.js +29 -2
- package/lib/module/jest.setup.js.map +1 -1
- package/lib/module/native-types.js +37 -30
- package/lib/module/native-types.js.map +1 -1
- package/lib/module/test-utils.js +13 -0
- package/lib/module/test-utils.js.map +1 -0
- package/lib/module/utils/getPreferredUnit.js.map +1 -1
- package/lib/module/utils/subscribeToChanges.js +1 -2
- package/lib/module/utils/subscribeToChanges.js.map +1 -1
- package/lib/{src/types.js → typescript/src/hooks/useHealthkitAuthorization.test.d.ts} +0 -0
- package/lib/typescript/src/index.ios.d.ts +1 -0
- package/lib/typescript/src/native-types.d.ts +60 -51
- package/lib/typescript/src/test-utils.d.ts +2 -0
- package/lib/typescript/src/utils/getPreferredUnit.d.ts +1 -1
- package/package.json +8 -4
- package/src/hooks/useHealthkitAuthorization.test.ts +54 -0
- package/src/hooks/useHealthkitAuthorization.ts +1 -0
- package/src/hooks/useIsHealthDataAvailable.test.ts +9 -14
- package/src/index.ios.tsx +3 -1
- package/src/index.tsx +2 -0
- package/src/jest.setup.ts +32 -2
- package/src/native-types.ts +364 -162
- package/src/test-utils.ts +10 -0
- package/src/utils/getPreferredUnit.ts +2 -2
- package/src/utils/subscribeToChanges.ts +1 -2
- package/lib/example/App.js +0 -197
- package/lib/index.ios.js +0 -310
- package/lib/index.js +0 -44
- package/lib/native-types.js +0 -447
- package/lib/src/index.ios.js +0 -314
- package/lib/src/index.js +0 -45
- package/lib/src/native-types.js +0 -453
- package/lib/types.js +0 -1
package/src/native-types.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NativeEventEmitter,
|
|
3
|
-
NativeModules,
|
|
4
|
-
} from 'react-native'
|
|
1
|
+
import { NativeEventEmitter, NativeModules } from 'react-native'
|
|
5
2
|
|
|
6
|
-
import type { EmitterSubscription } from 'react-native'
|
|
3
|
+
import type { EmitterSubscription, NativeModule } from 'react-native'
|
|
7
4
|
|
|
8
5
|
export const HKWorkoutTypeIdentifier = 'HKWorkoutTypeIdentifier' as const
|
|
9
6
|
export const HKAudiogramTypeIdentifier = 'HKAudiogramTypeIdentifier' as const
|
|
@@ -32,7 +29,7 @@ export enum HKQuantityTypeIdentifier {
|
|
|
32
29
|
pushCount = 'HKQuantityTypeIdentifierPushCount', // Scalar(Count), Cumulative
|
|
33
30
|
distanceSwimming = 'HKQuantityTypeIdentifierDistanceSwimming', // Length, Cumulative
|
|
34
31
|
swimmingStrokeCount = 'HKQuantityTypeIdentifierSwimmingStrokeCount', // Scalar(Count), Cumulative
|
|
35
|
-
vo2Max = '
|
|
32
|
+
vo2Max = 'HKQuantityTypeIdentifierVO2Max', // ml/(kg*min) Discrete
|
|
36
33
|
distanceDownhillSnowSports = 'HKQuantityTypeIdentifierDistanceDownhillSnowSports', // Length, Cumulative
|
|
37
34
|
|
|
38
35
|
appleStandTime = 'HKQuantityTypeIdentifierAppleStandTime', // Time, Cumulative
|
|
@@ -116,16 +113,25 @@ export enum HKQuantityTypeIdentifier {
|
|
|
116
113
|
stairAscentSpeed = 'HKQuantityTypeIdentifierStairAscentSpeed',
|
|
117
114
|
stairDescentSpeed = 'HKQuantityTypeIdentifierStairDescentSpeed',
|
|
118
115
|
|
|
119
|
-
uvExposure = '
|
|
116
|
+
uvExposure = 'HKQuantityTypeIdentifierUVExposure', // Scalar (Count), Discrete
|
|
120
117
|
|
|
121
118
|
appleMoveTime = 'HKQuantityTypeIdentifierAppleMoveTime', // Time, Cumulative
|
|
122
119
|
appleWalkingSteadiness = 'HKQuantityTypeIdentifierAppleWalkingSteadiness', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
123
120
|
|
|
124
121
|
numberOfAlcoholicBeverages = 'HKQuantityTypeIdentifierNumberOfAlcoholicBeverages', // Scalar(Count), Cumulative
|
|
122
|
+
|
|
123
|
+
atrialFibrillationBurden = 'HKQuantityTypeIdentifierAtrialFibrillationBurden', // Scalar(Percent, 0.0 - 1.0), Discrete
|
|
124
|
+
|
|
125
|
+
underwaterDepth = 'HKQuantityTypeIdentifierUnderwaterDepth', // Length, Discrete
|
|
126
|
+
|
|
127
|
+
waterTemperature = 'HKQuantityTypeIdentifierWaterTemperature', // Temperature, Discrete
|
|
128
|
+
|
|
129
|
+
appleSleepingWristTemperature = 'HKQuantityTypeIdentifierAppleSleepingWristTemperature', // Temperature, Discrete
|
|
130
|
+
|
|
125
131
|
}
|
|
126
132
|
|
|
127
|
-
export type TypeToUnitMapping = {
|
|
128
|
-
[key in HKQuantityTypeIdentifier]: HKUnit;
|
|
133
|
+
export type TypeToUnitMapping = {
|
|
134
|
+
readonly [key in HKQuantityTypeIdentifier]: HKUnit;
|
|
129
135
|
};
|
|
130
136
|
|
|
131
137
|
export enum HKCategoryValueLowCardioFitnessEvent {
|
|
@@ -208,23 +214,26 @@ export enum HKCategoryTypeIdentifier {
|
|
|
208
214
|
vaginalDryness = 'HKCategoryTypeIdentifierVaginalDryness', // HKCategoryValueSeverity
|
|
209
215
|
vomiting = 'HKCategoryTypeIdentifierVomiting', // HKCategoryValueSeverity
|
|
210
216
|
wheezing = 'HKCategoryTypeIdentifierWheezing', // HKCategoryValueSeverity
|
|
211
|
-
|
|
212
217
|
}
|
|
213
218
|
|
|
214
219
|
export type HKSampleTypeIdentifier =
|
|
215
|
-
HKCategoryTypeIdentifier
|
|
216
|
-
| HKCorrelationTypeIdentifier
|
|
217
|
-
| HKQuantityTypeIdentifier
|
|
218
|
-
| typeof HKAudiogramTypeIdentifier
|
|
219
|
-
| typeof HKDataTypeIdentifierHeartbeatSeries
|
|
220
|
-
| typeof HKWorkoutRouteTypeIdentifier
|
|
221
|
-
| typeof HKWorkoutTypeIdentifier
|
|
222
|
-
| `${HKCategoryTypeIdentifier}`
|
|
223
|
-
| `${HKCorrelationTypeIdentifier}`
|
|
224
|
-
| `${HKQuantityTypeIdentifier}
|
|
225
|
-
|
|
226
|
-
export type HealthkitReadAuthorization =
|
|
227
|
-
|
|
220
|
+
| HKCategoryTypeIdentifier
|
|
221
|
+
| HKCorrelationTypeIdentifier
|
|
222
|
+
| HKQuantityTypeIdentifier
|
|
223
|
+
| typeof HKAudiogramTypeIdentifier
|
|
224
|
+
| typeof HKDataTypeIdentifierHeartbeatSeries
|
|
225
|
+
| typeof HKWorkoutRouteTypeIdentifier
|
|
226
|
+
| typeof HKWorkoutTypeIdentifier
|
|
227
|
+
| `${HKCategoryTypeIdentifier}`
|
|
228
|
+
| `${HKCorrelationTypeIdentifier}`
|
|
229
|
+
| `${HKQuantityTypeIdentifier}`;
|
|
230
|
+
|
|
231
|
+
export type HealthkitReadAuthorization =
|
|
232
|
+
| HKCharacteristicTypeIdentifier
|
|
233
|
+
| HKSampleTypeIdentifier
|
|
234
|
+
| `${HKCharacteristicTypeIdentifier}`
|
|
235
|
+
| `${HKSampleTypeIdentifier}`;
|
|
236
|
+
export type HealthkitWriteAuthorization = HKSampleTypeIdentifier;
|
|
228
237
|
|
|
229
238
|
export enum HKCategoryValueAppleStandHour {
|
|
230
239
|
stood = 0,
|
|
@@ -369,11 +378,17 @@ enum HKIndoorWorkout {
|
|
|
369
378
|
export interface HKWorkoutMetadata
|
|
370
379
|
extends HKGenericMetadata /* <TTemperatureUnit extends HKUnit> */ {
|
|
371
380
|
readonly HKWeatherCondition?: HKWeatherCondition;
|
|
372
|
-
readonly HKWeatherHumidity?: HKQuantity<
|
|
381
|
+
readonly HKWeatherHumidity?: HKQuantity<
|
|
382
|
+
HKQuantityTypeIdentifier,
|
|
383
|
+
HKUnits.Percent
|
|
384
|
+
>;
|
|
373
385
|
// HKWeatherTemperature: HKQuantity<TTemperatureUnit>
|
|
374
|
-
readonly HKAverageMETs?: HKQuantity<HKQuantityTypeIdentifier, HKUnit
|
|
375
|
-
readonly HKElevationAscended?: HKQuantity<
|
|
376
|
-
|
|
386
|
+
readonly HKAverageMETs?: HKQuantity<HKQuantityTypeIdentifier, HKUnit>;
|
|
387
|
+
readonly HKElevationAscended?: HKQuantity<
|
|
388
|
+
HKQuantityTypeIdentifier,
|
|
389
|
+
LengthUnit
|
|
390
|
+
>;
|
|
391
|
+
readonly HKIndoorWorkout?: HKIndoorWorkout;
|
|
377
392
|
}
|
|
378
393
|
|
|
379
394
|
export enum HKAuthorizationRequestStatus {
|
|
@@ -388,7 +403,10 @@ export enum HKAuthorizationStatus {
|
|
|
388
403
|
sharingAuthorized = 2,
|
|
389
404
|
}
|
|
390
405
|
|
|
391
|
-
export type HKQuantity<
|
|
406
|
+
export type HKQuantity<
|
|
407
|
+
TIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier,
|
|
408
|
+
TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>
|
|
409
|
+
> = {
|
|
392
410
|
readonly unit: TUnit;
|
|
393
411
|
readonly quantity: number;
|
|
394
412
|
};
|
|
@@ -433,13 +451,19 @@ export enum HKStatisticsOptions {
|
|
|
433
451
|
separateBySource = 'separateBySource',
|
|
434
452
|
}
|
|
435
453
|
|
|
436
|
-
export type QueryStatisticsResponseRaw<
|
|
454
|
+
export type QueryStatisticsResponseRaw<
|
|
455
|
+
TIdentifier extends HKQuantityTypeIdentifier,
|
|
456
|
+
TUnit extends UnitForIdentifier<TIdentifier>
|
|
457
|
+
> = {
|
|
437
458
|
readonly averageQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
438
459
|
readonly maximumQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
439
460
|
readonly minimumQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
440
461
|
readonly sumQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
441
462
|
readonly mostRecentQuantity?: HKQuantity<TIdentifier, TUnit>;
|
|
442
|
-
readonly mostRecentQuantityDateInterval?: {
|
|
463
|
+
readonly mostRecentQuantityDateInterval?: {
|
|
464
|
+
readonly from: string;
|
|
465
|
+
readonly to: string;
|
|
466
|
+
};
|
|
443
467
|
readonly duration?: HKQuantity<HKQuantityTypeIdentifier, TimeUnit>;
|
|
444
468
|
};
|
|
445
469
|
|
|
@@ -468,8 +492,11 @@ export enum HKCategoryValueOvulationTestResult {
|
|
|
468
492
|
|
|
469
493
|
export enum HKCategoryValueSleepAnalysis {
|
|
470
494
|
inBed = 0,
|
|
471
|
-
|
|
495
|
+
asleepUnspecified = 1,
|
|
472
496
|
awake = 2,
|
|
497
|
+
asleepCore = 3,
|
|
498
|
+
asleepDeep = 4,
|
|
499
|
+
asleepREM = 5
|
|
473
500
|
}
|
|
474
501
|
|
|
475
502
|
export enum HKCategoryValueAppetiteChanges {
|
|
@@ -497,10 +524,15 @@ export enum HKCategoryValueNotApplicable {
|
|
|
497
524
|
}
|
|
498
525
|
|
|
499
526
|
export type HKCategoryValue =
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
527
|
+
| HKCategoryValueAppetiteChanges
|
|
528
|
+
| HKCategoryValueCervicalMucusQuality
|
|
529
|
+
| HKCategoryValueLowCardioFitnessEvent
|
|
530
|
+
| HKCategoryValueMenstrualFlow
|
|
531
|
+
| HKCategoryValueOvulationTestResult
|
|
532
|
+
| HKCategoryValuePresence
|
|
533
|
+
| HKCategoryValueSeverity
|
|
534
|
+
| HKCategoryValueSleepAnalysis
|
|
535
|
+
| number;
|
|
504
536
|
|
|
505
537
|
export enum HKInsulinDeliveryReason {
|
|
506
538
|
basal = 1,
|
|
@@ -531,19 +563,102 @@ export type MetadataMapperForCorrelationIdentifier<
|
|
|
531
563
|
}
|
|
532
564
|
: HKGenericMetadata;
|
|
533
565
|
|
|
534
|
-
export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> =
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
566
|
+
export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> =
|
|
567
|
+
T extends HKQuantityTypeIdentifier.bloodGlucose
|
|
568
|
+
? BloodGlucoseUnit
|
|
569
|
+
: T extends
|
|
570
|
+
| HKQuantityTypeIdentifier.appleExerciseTime
|
|
571
|
+
| HKQuantityTypeIdentifier.appleMoveTime
|
|
572
|
+
| HKQuantityTypeIdentifier.appleStandTime
|
|
573
|
+
? TimeUnit
|
|
574
|
+
: T extends
|
|
575
|
+
| HKQuantityTypeIdentifier.activeEnergyBurned
|
|
576
|
+
| HKQuantityTypeIdentifier.basalEnergyBurned
|
|
577
|
+
| HKQuantityTypeIdentifier.dietaryEnergyConsumed
|
|
578
|
+
? EnergyUnit
|
|
579
|
+
: T extends
|
|
580
|
+
| HKQuantityTypeIdentifier.distanceCycling
|
|
581
|
+
| HKQuantityTypeIdentifier.distanceDownhillSnowSports
|
|
582
|
+
| HKQuantityTypeIdentifier.distanceSwimming
|
|
583
|
+
| HKQuantityTypeIdentifier.distanceWalkingRunning
|
|
584
|
+
| HKQuantityTypeIdentifier.distanceWheelchair
|
|
585
|
+
| HKQuantityTypeIdentifier.sixMinuteWalkTestDistance
|
|
586
|
+
| HKQuantityTypeIdentifier.waistCircumference
|
|
587
|
+
? LengthUnit
|
|
588
|
+
: T extends
|
|
589
|
+
| HKQuantityTypeIdentifier.bodyFatPercentage
|
|
590
|
+
| HKQuantityTypeIdentifier.oxygenSaturation
|
|
591
|
+
| HKQuantityTypeIdentifier.walkingAsymmetryPercentage
|
|
592
|
+
| HKQuantityTypeIdentifier.walkingDoubleSupportPercentage
|
|
593
|
+
? HKUnits.Percent
|
|
594
|
+
: T extends
|
|
595
|
+
| HKQuantityTypeIdentifier.basalBodyTemperature
|
|
596
|
+
| HKQuantityTypeIdentifier.basalBodyTemperature
|
|
597
|
+
? TemperatureUnit
|
|
598
|
+
: T extends
|
|
599
|
+
| HKQuantityTypeIdentifier.stairAscentSpeed
|
|
600
|
+
| HKQuantityTypeIdentifier.stairDescentSpeed
|
|
601
|
+
| HKQuantityTypeIdentifier.walkingSpeed
|
|
602
|
+
| HKQuantityTypeIdentifier.walkingSpeed
|
|
603
|
+
? SpeedUnit<LengthUnit, TimeUnit>
|
|
604
|
+
: T extends
|
|
605
|
+
| HKQuantityTypeIdentifier.flightsClimbed
|
|
606
|
+
| HKQuantityTypeIdentifier.numberOfAlcoholicBeverages
|
|
607
|
+
| HKQuantityTypeIdentifier.numberOfTimesFallen
|
|
608
|
+
| HKQuantityTypeIdentifier.pushCount
|
|
609
|
+
| HKQuantityTypeIdentifier.stepCount
|
|
610
|
+
| HKQuantityTypeIdentifier.swimmingStrokeCount
|
|
611
|
+
? HKUnits.Count
|
|
612
|
+
: T extends
|
|
613
|
+
| HKQuantityTypeIdentifier.dietaryBiotin
|
|
614
|
+
| HKQuantityTypeIdentifier.dietaryCaffeine
|
|
615
|
+
| HKQuantityTypeIdentifier.dietaryCalcium
|
|
616
|
+
| HKQuantityTypeIdentifier.dietaryCarbohydrates
|
|
617
|
+
| HKQuantityTypeIdentifier.dietaryChloride
|
|
618
|
+
| HKQuantityTypeIdentifier.dietaryCholesterol
|
|
619
|
+
| HKQuantityTypeIdentifier.dietaryChromium
|
|
620
|
+
| HKQuantityTypeIdentifier.dietaryCopper
|
|
621
|
+
| HKQuantityTypeIdentifier.dietaryFatMonounsaturated
|
|
622
|
+
| HKQuantityTypeIdentifier.dietaryFatPolyunsaturated
|
|
623
|
+
| HKQuantityTypeIdentifier.dietaryFatSaturated
|
|
624
|
+
| HKQuantityTypeIdentifier.dietaryFatTotal
|
|
625
|
+
| HKQuantityTypeIdentifier.dietaryFiber
|
|
626
|
+
| HKQuantityTypeIdentifier.dietaryFolate
|
|
627
|
+
| HKQuantityTypeIdentifier.dietaryIodine
|
|
628
|
+
| HKQuantityTypeIdentifier.dietaryIodine
|
|
629
|
+
| HKQuantityTypeIdentifier.dietaryIron
|
|
630
|
+
| HKQuantityTypeIdentifier.dietaryMagnesium
|
|
631
|
+
| HKQuantityTypeIdentifier.dietaryManganese
|
|
632
|
+
| HKQuantityTypeIdentifier.dietaryMolybdenum
|
|
633
|
+
| HKQuantityTypeIdentifier.dietaryNiacin
|
|
634
|
+
| HKQuantityTypeIdentifier.dietaryPantothenicAcid
|
|
635
|
+
| HKQuantityTypeIdentifier.dietaryPhosphorus
|
|
636
|
+
| HKQuantityTypeIdentifier.dietaryPotassium
|
|
637
|
+
| HKQuantityTypeIdentifier.dietaryProtein
|
|
638
|
+
| HKQuantityTypeIdentifier.dietaryRiboflavin
|
|
639
|
+
| HKQuantityTypeIdentifier.dietarySelenium
|
|
640
|
+
| HKQuantityTypeIdentifier.dietarySodium
|
|
641
|
+
| HKQuantityTypeIdentifier.dietarySugar
|
|
642
|
+
| HKQuantityTypeIdentifier.dietaryThiamin
|
|
643
|
+
| HKQuantityTypeIdentifier.dietaryVitaminA
|
|
644
|
+
| HKQuantityTypeIdentifier.dietaryVitaminB6
|
|
645
|
+
| HKQuantityTypeIdentifier.dietaryVitaminB12
|
|
646
|
+
| HKQuantityTypeIdentifier.dietaryVitaminC
|
|
647
|
+
| HKQuantityTypeIdentifier.dietaryVitaminD
|
|
648
|
+
| HKQuantityTypeIdentifier.dietaryVitaminE
|
|
649
|
+
| HKQuantityTypeIdentifier.dietaryVitaminK
|
|
650
|
+
| HKQuantityTypeIdentifier.dietaryZinc
|
|
651
|
+
? MassUnit
|
|
652
|
+
: T extends HKQuantityTypeIdentifier.dietaryWater
|
|
653
|
+
? VolumeUnit
|
|
654
|
+
: T extends HKQuantityTypeIdentifier.insulinDelivery
|
|
655
|
+
? HKUnits.InternationalUnit | `${HKUnits.InternationalUnit}`
|
|
656
|
+
: T extends
|
|
657
|
+
| HKQuantityTypeIdentifier.heartRate
|
|
658
|
+
| HKQuantityTypeIdentifier.restingHeartRate
|
|
659
|
+
| HKQuantityTypeIdentifier.walkingHeartRateAverage
|
|
660
|
+
? CountPerTime<TimeUnit>
|
|
661
|
+
: HKUnit;
|
|
547
662
|
|
|
548
663
|
export type HKCategoryValueForIdentifier<T extends HKCategoryTypeIdentifier> =
|
|
549
664
|
T extends HKCategoryTypeIdentifier.cervicalMucusQuality
|
|
@@ -554,39 +669,70 @@ export type HKCategoryValueForIdentifier<T extends HKCategoryTypeIdentifier> =
|
|
|
554
669
|
? HKCategoryValueOvulationTestResult
|
|
555
670
|
: T extends HKCategoryTypeIdentifier.sleepAnalysis
|
|
556
671
|
? HKCategoryValueSleepAnalysis
|
|
557
|
-
: T extends
|
|
558
|
-
| HKCategoryTypeIdentifier.
|
|
672
|
+
: T extends
|
|
673
|
+
| HKCategoryTypeIdentifier.highHeartRateEvent
|
|
674
|
+
| HKCategoryTypeIdentifier.intermenstrualBleeding
|
|
675
|
+
| HKCategoryTypeIdentifier.mindfulSession
|
|
676
|
+
| HKCategoryTypeIdentifier.sexualActivity
|
|
559
677
|
? HKCategoryValueNotApplicable
|
|
560
|
-
: T extends
|
|
678
|
+
: T extends
|
|
679
|
+
| HKCategoryTypeIdentifier.abdominalCramps
|
|
561
680
|
| HKCategoryTypeIdentifier.abdominalCramps
|
|
562
681
|
| HKCategoryTypeIdentifier.acne
|
|
563
682
|
| HKCategoryTypeIdentifier.bladderIncontinence
|
|
564
|
-
| HKCategoryTypeIdentifier.bloating
|
|
565
|
-
| HKCategoryTypeIdentifier.
|
|
566
|
-
| HKCategoryTypeIdentifier.
|
|
567
|
-
| HKCategoryTypeIdentifier.
|
|
568
|
-
| HKCategoryTypeIdentifier.
|
|
569
|
-
| HKCategoryTypeIdentifier.
|
|
570
|
-
| HKCategoryTypeIdentifier.
|
|
571
|
-
| HKCategoryTypeIdentifier.
|
|
572
|
-
| HKCategoryTypeIdentifier.
|
|
573
|
-
| HKCategoryTypeIdentifier.
|
|
574
|
-
| HKCategoryTypeIdentifier.
|
|
575
|
-
| HKCategoryTypeIdentifier.
|
|
683
|
+
| HKCategoryTypeIdentifier.bloating
|
|
684
|
+
| HKCategoryTypeIdentifier.breastPain
|
|
685
|
+
| HKCategoryTypeIdentifier.chestTightnessOrPain
|
|
686
|
+
| HKCategoryTypeIdentifier.chills
|
|
687
|
+
| HKCategoryTypeIdentifier.constipation
|
|
688
|
+
| HKCategoryTypeIdentifier.coughing
|
|
689
|
+
| HKCategoryTypeIdentifier.diarrhea
|
|
690
|
+
| HKCategoryTypeIdentifier.dizziness
|
|
691
|
+
| HKCategoryTypeIdentifier.drySkin
|
|
692
|
+
| HKCategoryTypeIdentifier.fainting
|
|
693
|
+
| HKCategoryTypeIdentifier.fatigue
|
|
694
|
+
| HKCategoryTypeIdentifier.fever
|
|
695
|
+
| HKCategoryTypeIdentifier.generalizedBodyAche
|
|
696
|
+
| HKCategoryTypeIdentifier.hairLoss
|
|
697
|
+
| HKCategoryTypeIdentifier.headache
|
|
698
|
+
| HKCategoryTypeIdentifier.heartburn
|
|
699
|
+
| HKCategoryTypeIdentifier.hotFlashes
|
|
700
|
+
| HKCategoryTypeIdentifier.lossOfSmell
|
|
701
|
+
| HKCategoryTypeIdentifier.lossOfTaste
|
|
702
|
+
| HKCategoryTypeIdentifier.lowerBackPain
|
|
703
|
+
| HKCategoryTypeIdentifier.memoryLapse
|
|
704
|
+
| HKCategoryTypeIdentifier.moodChanges
|
|
705
|
+
| HKCategoryTypeIdentifier.nausea
|
|
706
|
+
| HKCategoryTypeIdentifier.nightSweats
|
|
707
|
+
| HKCategoryTypeIdentifier.pelvicPain
|
|
708
|
+
| HKCategoryTypeIdentifier.rapidPoundingOrFlutteringHeartbeat
|
|
709
|
+
| HKCategoryTypeIdentifier.runnyNose
|
|
710
|
+
| HKCategoryTypeIdentifier.shortnessOfBreath
|
|
711
|
+
| HKCategoryTypeIdentifier.sinusCongestion
|
|
712
|
+
| HKCategoryTypeIdentifier.skippedHeartbeat
|
|
713
|
+
| HKCategoryTypeIdentifier.soreThroat
|
|
714
|
+
| HKCategoryTypeIdentifier.vaginalDryness
|
|
715
|
+
| HKCategoryTypeIdentifier.vomiting
|
|
716
|
+
| HKCategoryTypeIdentifier.wheezing
|
|
576
717
|
? HKCategoryValueSeverity
|
|
577
|
-
: T extends
|
|
718
|
+
: T extends
|
|
719
|
+
| HKCategoryTypeIdentifier.appetiteChanges
|
|
720
|
+
| HKCategoryTypeIdentifier.sleepChanges
|
|
578
721
|
? HKCategoryValuePresence
|
|
579
|
-
: T extends HKCategoryTypeIdentifier.lowCardioFitnessEvent
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
722
|
+
: T extends HKCategoryTypeIdentifier.lowCardioFitnessEvent
|
|
723
|
+
? HKCategoryValueLowCardioFitnessEvent
|
|
724
|
+
: T extends HKCategoryTypeIdentifier.pregnancyTestResult
|
|
725
|
+
? HKCategoryValuePregnancyTestResult
|
|
726
|
+
: T extends HKCategoryTypeIdentifier.pregnancyTestResult
|
|
727
|
+
? HKCategoryValuePregnancyTestResult
|
|
728
|
+
: T extends HKCategoryTypeIdentifier.appleStandHour
|
|
583
729
|
? HKCategoryValueAppleStandHour
|
|
584
730
|
: number;
|
|
585
731
|
|
|
586
732
|
enum HKCategoryValuePregnancyTestResult {
|
|
587
733
|
positive = 2,
|
|
588
734
|
negative = 1,
|
|
589
|
-
indeterminate = 3
|
|
735
|
+
indeterminate = 3,
|
|
590
736
|
}
|
|
591
737
|
/* needs further mapping
|
|
592
738
|
|
|
@@ -651,53 +797,63 @@ export enum HKUnitMetric {
|
|
|
651
797
|
}
|
|
652
798
|
|
|
653
799
|
export enum HKUnits {
|
|
654
|
-
|
|
655
800
|
DecibelHearingLevel = 'dBHL',
|
|
656
801
|
DecibelSoundPressureLevel = 'dBASPL',
|
|
657
802
|
|
|
658
803
|
Percent = '%',
|
|
659
804
|
Count = 'count',
|
|
660
805
|
InternationalUnit = 'IU',
|
|
661
|
-
|
|
662
806
|
}
|
|
663
807
|
|
|
664
|
-
export type MeterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None>
|
|
665
|
-
|
|
666
|
-
export type
|
|
667
|
-
|
|
668
|
-
export type
|
|
669
|
-
|
|
670
|
-
export type
|
|
671
|
-
|
|
672
|
-
export type
|
|
808
|
+
export type MeterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
809
|
+
`${Prefix}${HKUnitMetric.Meter}`;
|
|
810
|
+
export type LiterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
811
|
+
`${Prefix}${HKUnitMetric.Liter}`;
|
|
812
|
+
export type GramUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
813
|
+
`${Prefix}${HKUnitMetric.Gram}`;
|
|
814
|
+
export type PascalUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
815
|
+
`${Prefix}${HKUnitMetric.Pascal}`;
|
|
816
|
+
export type SecondUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
817
|
+
`${Prefix}${HKUnitMetric.Second}`;
|
|
818
|
+
export type JouleUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
819
|
+
`${Prefix}${HKUnitMetric.Joule}`;
|
|
820
|
+
export type HertzUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
821
|
+
`${Prefix}${HKUnitMetric.Hertz}`;
|
|
822
|
+
export type VoltUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
823
|
+
`${Prefix}${HKUnitMetric.Volt}`;
|
|
824
|
+
export type SiemenUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> =
|
|
825
|
+
`${Prefix}${HKUnitMetric.Siemen}`;
|
|
673
826
|
|
|
674
827
|
// not 100% sure about these
|
|
675
|
-
export type MoleUnit<MolarMass extends number>
|
|
676
|
-
export type MoleUnitWith<
|
|
828
|
+
export type MoleUnit<MolarMass extends number> = `mol<${MolarMass}>`;
|
|
829
|
+
export type MoleUnitWith<
|
|
830
|
+
MolarMass extends number,
|
|
831
|
+
Prefix extends HKMetricPrefix = HKMetricPrefix.None
|
|
832
|
+
> = `${Prefix}mol<${MolarMass}>`;
|
|
677
833
|
|
|
678
|
-
export type FrequencyUnit = HertzUnit<HKMetricPrefix
|
|
834
|
+
export type FrequencyUnit = HertzUnit<HKMetricPrefix>;
|
|
679
835
|
|
|
680
836
|
/**
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
837
|
+
* More SI prefixes also available as literals, just type the string
|
|
838
|
+
* @example 'cm', 'km'
|
|
839
|
+
*/
|
|
684
840
|
export enum UnitOfLength {
|
|
685
841
|
Feet = 'ft',
|
|
686
842
|
/**
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
843
|
+
* More SI prefixes also available as literals, just type the string
|
|
844
|
+
* @example 'cm', 'km'
|
|
845
|
+
*/
|
|
690
846
|
Meter = 'm',
|
|
691
847
|
Inches = 'in',
|
|
692
848
|
Yards = 'yd',
|
|
693
849
|
Miles = 'mi',
|
|
694
850
|
}
|
|
695
|
-
export type LengthUnit = MeterUnit<HKMetricPrefix> | UnitOfLength
|
|
851
|
+
export type LengthUnit = MeterUnit<HKMetricPrefix> | UnitOfLength;
|
|
696
852
|
|
|
697
853
|
/**
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
854
|
+
* More SI prefixes also available as literals, just type the string
|
|
855
|
+
* @example 'ml', 'cl'
|
|
856
|
+
*/
|
|
701
857
|
export enum UnitOfVolume {
|
|
702
858
|
ImperialCup = 'cup_imp',
|
|
703
859
|
ImperialFluidOunces = 'fl_oz_imp',
|
|
@@ -706,37 +862,37 @@ export enum UnitOfVolume {
|
|
|
706
862
|
USFluidOunces = 'fl_oz_us',
|
|
707
863
|
USPint = 'pt_us',
|
|
708
864
|
/**
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
865
|
+
* More SI prefixes also available as literals, just type the string
|
|
866
|
+
* @example 'ml', 'cl'
|
|
867
|
+
*/
|
|
712
868
|
Liter = 'l',
|
|
713
869
|
}
|
|
714
870
|
export type VolumeUnit = LiterUnit<HKMetricPrefix> | UnitOfVolume;
|
|
715
871
|
|
|
716
872
|
/**
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
873
|
+
* More SI prefixes also available as literals, just type the string
|
|
874
|
+
* @example 'mg', 'kg'
|
|
875
|
+
*/
|
|
720
876
|
export enum UnitOfMass {
|
|
721
877
|
Ounces = 'oz',
|
|
722
878
|
Stones = 'st',
|
|
723
879
|
Pounds = 'lb',
|
|
724
880
|
/**
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
Gram = 'g'
|
|
881
|
+
* More SI prefixes also available as literals, just type the string
|
|
882
|
+
* @example 'mg', 'kg'
|
|
883
|
+
*/
|
|
884
|
+
Gram = 'g',
|
|
729
885
|
}
|
|
730
886
|
/**
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
export type MassUnit = GramUnit<HKMetricPrefix> | UnitOfMass
|
|
887
|
+
* More SI prefixes also available as literals, just type the string
|
|
888
|
+
* @example 'mg', 'kg'
|
|
889
|
+
*/
|
|
890
|
+
export type MassUnit = GramUnit<HKMetricPrefix> | UnitOfMass;
|
|
735
891
|
|
|
736
892
|
/**
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
893
|
+
* More SI prefixes also available as literals, just type the string
|
|
894
|
+
* @example 'kPa', 'hPa'
|
|
895
|
+
*/
|
|
740
896
|
export enum UnitOfPressure {
|
|
741
897
|
Atmospheres = 'atm',
|
|
742
898
|
CentimetersOfWater = 'cmAq',
|
|
@@ -744,37 +900,37 @@ export enum UnitOfPressure {
|
|
|
744
900
|
InchesOfMercury = 'inHg',
|
|
745
901
|
DecibelAWeightedSoundPressureLevel = 'dBASPL',
|
|
746
902
|
/**
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
903
|
+
* More SI prefixes also available as literals, just type the string
|
|
904
|
+
* @example 'kPa', 'hPa'
|
|
905
|
+
*/
|
|
750
906
|
Pascals = 'Pa',
|
|
751
907
|
}
|
|
752
908
|
|
|
753
909
|
/**
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
910
|
+
* More SI prefixes also available as literals, just type the string
|
|
911
|
+
* @example 'kPa', 'hPa'
|
|
912
|
+
*/
|
|
757
913
|
export type PressureUnit = PascalUnit<HKMetricPrefix> | UnitOfPressure;
|
|
758
914
|
|
|
759
915
|
/**
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
916
|
+
* More SI prefixes also available as literals, just type the string
|
|
917
|
+
* @example 'ms'
|
|
918
|
+
*/
|
|
763
919
|
export enum UnitOfTime {
|
|
764
920
|
Days = 'd',
|
|
765
921
|
Minutes = 'min',
|
|
766
922
|
Hours = 'hr',
|
|
767
923
|
/**
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
924
|
+
* More SI prefixes also available as literals, just type the string
|
|
925
|
+
* @example 'ms'
|
|
926
|
+
*/
|
|
771
927
|
Seconds = 's',
|
|
772
928
|
}
|
|
773
929
|
/**
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
export type TimeUnit = SecondUnit<HKMetricPrefix> | UnitOfTime
|
|
930
|
+
* More SI prefixes also available as literals, just type the string
|
|
931
|
+
* @example 'ms'
|
|
932
|
+
*/
|
|
933
|
+
export type TimeUnit = SecondUnit<HKMetricPrefix> | UnitOfTime;
|
|
778
934
|
export enum TemperatureUnit {
|
|
779
935
|
DegreesCelsius = 'degC',
|
|
780
936
|
DegreesFahrenheit = 'degF',
|
|
@@ -782,33 +938,54 @@ export enum TemperatureUnit {
|
|
|
782
938
|
}
|
|
783
939
|
|
|
784
940
|
/**
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
941
|
+
* More SI prefixes also available as literals, just type the string
|
|
942
|
+
* @example 'kJ'
|
|
943
|
+
*/
|
|
788
944
|
export enum UnitOfEnergy {
|
|
789
945
|
Kilocalories = 'kcal',
|
|
790
946
|
LargeCalories = 'Cal',
|
|
791
947
|
SmallCalories = 'cal',
|
|
792
948
|
/**
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
949
|
+
* More SI prefixes also available as literals, just type the string
|
|
950
|
+
* @example 'kJ'
|
|
951
|
+
*/
|
|
796
952
|
Joules = 'J',
|
|
797
953
|
}
|
|
798
|
-
export type EnergyUnit = JouleUnit<HKMetricPrefix> | UnitOfEnergy
|
|
954
|
+
export type EnergyUnit = JouleUnit<HKMetricPrefix> | UnitOfEnergy;
|
|
799
955
|
export enum BloodGlucoseUnit {
|
|
800
956
|
GlucoseMmolPerL = 'mmol<180.15588000005408>/l',
|
|
801
957
|
GlucoseMgPerDl = 'mg/dL',
|
|
802
958
|
}
|
|
803
959
|
|
|
804
|
-
export type SpeedUnit<
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
|
960
|
+
export type SpeedUnit<
|
|
961
|
+
TLength extends LengthUnit,
|
|
962
|
+
TTime extends TimeUnit
|
|
963
|
+
> = `${TLength}/${TTime}`;
|
|
964
|
+
export type CountPerTime<TTime extends TimeUnit> = `count/${TTime}`;
|
|
965
|
+
|
|
966
|
+
export type HKUnit =
|
|
967
|
+
| BloodGlucoseUnit
|
|
968
|
+
| CountPerTime<TimeUnit>
|
|
969
|
+
| EnergyUnit
|
|
970
|
+
| FrequencyUnit
|
|
971
|
+
| HKUnits
|
|
972
|
+
| LengthUnit
|
|
973
|
+
| MassUnit
|
|
974
|
+
| PressureUnit
|
|
975
|
+
| SpeedUnit<LengthUnit, TimeUnit>
|
|
976
|
+
| TemperatureUnit
|
|
977
|
+
| TimeUnit
|
|
978
|
+
| VolumeUnit
|
|
979
|
+
| `${BloodGlucoseUnit}`
|
|
980
|
+
| `${EnergyUnit}`
|
|
981
|
+
| `${FrequencyUnit}`
|
|
982
|
+
| `${HKUnits}`
|
|
983
|
+
| `${LengthUnit}`
|
|
984
|
+
| `${MassUnit}`
|
|
985
|
+
| `${PressureUnit}`
|
|
986
|
+
| `${TemperatureUnit}`
|
|
987
|
+
| `${TimeUnit}`
|
|
988
|
+
| `${VolumeUnit}`;
|
|
812
989
|
|
|
813
990
|
export type HKDevice = {
|
|
814
991
|
readonly name: string; // ex: "Apple Watch"
|
|
@@ -834,7 +1011,7 @@ export type HKSourceRevision = {
|
|
|
834
1011
|
|
|
835
1012
|
export type HKQuantitySampleRaw<
|
|
836
1013
|
TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier,
|
|
837
|
-
TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier
|
|
1014
|
+
TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>
|
|
838
1015
|
> = {
|
|
839
1016
|
readonly uuid: string;
|
|
840
1017
|
readonly device?: HKDevice;
|
|
@@ -849,28 +1026,37 @@ export type HKQuantitySampleRaw<
|
|
|
849
1026
|
|
|
850
1027
|
export type HKQuantitySampleRawForSaving<
|
|
851
1028
|
TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier,
|
|
852
|
-
TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier
|
|
1029
|
+
TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>
|
|
853
1030
|
> = Omit<
|
|
854
1031
|
HKQuantitySampleRaw<TQuantityIdentifier, TUnit>,
|
|
855
1032
|
'device' | 'endDate' | 'startDate' | 'uuid'
|
|
856
|
-
|
|
1033
|
+
>;
|
|
857
1034
|
|
|
858
1035
|
export type HKCategorySampleRawForSaving<
|
|
859
|
-
TCategory extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier
|
|
1036
|
+
TCategory extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier
|
|
860
1037
|
> = Omit<
|
|
861
1038
|
HKCategorySampleRaw<TCategory>,
|
|
862
1039
|
'device' | 'endDate' | 'startDate' | 'uuid'
|
|
863
|
-
|
|
1040
|
+
>;
|
|
864
1041
|
|
|
865
|
-
export type HKWorkoutRaw<
|
|
1042
|
+
export type HKWorkoutRaw<
|
|
1043
|
+
TEnergy extends EnergyUnit,
|
|
1044
|
+
TDistance extends LengthUnit
|
|
1045
|
+
> = {
|
|
866
1046
|
readonly uuid: string;
|
|
867
1047
|
readonly device?: HKDevice;
|
|
868
1048
|
readonly workoutActivityType: HKWorkoutActivityType;
|
|
869
1049
|
readonly duration: number;
|
|
870
1050
|
readonly totalDistance?: HKQuantity<HKQuantityTypeIdentifier, TDistance>;
|
|
871
1051
|
readonly totalEnergyBurned?: HKQuantity<HKQuantityTypeIdentifier, TEnergy>;
|
|
872
|
-
readonly totalSwimmingStrokeCount?: HKQuantity<
|
|
873
|
-
|
|
1052
|
+
readonly totalSwimmingStrokeCount?: HKQuantity<
|
|
1053
|
+
HKQuantityTypeIdentifier,
|
|
1054
|
+
HKUnits.Count
|
|
1055
|
+
>;
|
|
1056
|
+
readonly totalFlightsClimbed?: HKQuantity<
|
|
1057
|
+
HKQuantityTypeIdentifier,
|
|
1058
|
+
HKUnits.Count
|
|
1059
|
+
>;
|
|
874
1060
|
readonly startDate: string;
|
|
875
1061
|
readonly endDate: string;
|
|
876
1062
|
readonly metadata?: HKWorkoutMetadata;
|
|
@@ -888,11 +1074,17 @@ export enum HKCharacteristicTypeIdentifier {
|
|
|
888
1074
|
}
|
|
889
1075
|
|
|
890
1076
|
export type WritePermissions = {
|
|
891
|
-
readonly [key in
|
|
1077
|
+
readonly [key in
|
|
1078
|
+
| HKCategoryTypeIdentifier
|
|
1079
|
+
| HKCharacteristicTypeIdentifier
|
|
1080
|
+
| HKQuantityTypeIdentifier]: boolean;
|
|
892
1081
|
};
|
|
893
1082
|
|
|
894
1083
|
export type ReadPermissions = {
|
|
895
|
-
readonly [key in
|
|
1084
|
+
readonly [key in
|
|
1085
|
+
| HKCategoryTypeIdentifier
|
|
1086
|
+
| HKCharacteristicTypeIdentifier
|
|
1087
|
+
| HKQuantityTypeIdentifier]: boolean;
|
|
896
1088
|
};
|
|
897
1089
|
|
|
898
1090
|
export type HKCategorySampleRaw<
|
|
@@ -935,6 +1127,7 @@ export type WorkoutLocation = {
|
|
|
935
1127
|
readonly horizontalAccuracy: number;
|
|
936
1128
|
readonly speedAccuracy: number;
|
|
937
1129
|
readonly verticalAccuracy: number;
|
|
1130
|
+
readonly distance: number | null;
|
|
938
1131
|
};
|
|
939
1132
|
|
|
940
1133
|
export type WorkoutRoute = {
|
|
@@ -945,6 +1138,7 @@ export type WorkoutRoute = {
|
|
|
945
1138
|
|
|
946
1139
|
type ReactNativeHealthkitTypeNative = {
|
|
947
1140
|
isHealthDataAvailable(): Promise<boolean>;
|
|
1141
|
+
canAccessProtectedData(): Promise<boolean>;
|
|
948
1142
|
getBloodType(): Promise<HKBloodType>;
|
|
949
1143
|
getDateOfBirth(): Promise<string>;
|
|
950
1144
|
getBiologicalSex(): Promise<HKBiologicalSex>;
|
|
@@ -956,13 +1150,16 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
956
1150
|
updateFrequency: HKUpdateFrequency
|
|
957
1151
|
) => Promise<boolean>;
|
|
958
1152
|
readonly disableBackgroundDelivery: (
|
|
959
|
-
typeIdentifier: HKSampleTypeIdentifier
|
|
1153
|
+
typeIdentifier: HKSampleTypeIdentifier
|
|
960
1154
|
) => Promise<boolean>;
|
|
961
1155
|
readonly disableAllBackgroundDelivery: () => Promise<boolean>;
|
|
962
1156
|
|
|
963
1157
|
readonly saveCorrelationSample: <
|
|
964
1158
|
TIdentifier extends HKCorrelationTypeIdentifier,
|
|
965
|
-
TSamples extends readonly (
|
|
1159
|
+
TSamples extends readonly (
|
|
1160
|
+
| HKCategorySampleRawForSaving
|
|
1161
|
+
| HKQuantitySampleRawForSaving
|
|
1162
|
+
)[]
|
|
966
1163
|
>(
|
|
967
1164
|
typeIdentifier: TIdentifier,
|
|
968
1165
|
samples: TSamples,
|
|
@@ -979,7 +1176,9 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
979
1176
|
metadata: HKWorkoutMetadata
|
|
980
1177
|
) => Promise<boolean>;
|
|
981
1178
|
|
|
982
|
-
readonly queryCorrelationSamples: <
|
|
1179
|
+
readonly queryCorrelationSamples: <
|
|
1180
|
+
TIdentifier extends HKCorrelationTypeIdentifier
|
|
1181
|
+
>(
|
|
983
1182
|
typeIdentifier: TIdentifier,
|
|
984
1183
|
from: string,
|
|
985
1184
|
to: string
|
|
@@ -989,9 +1188,7 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
989
1188
|
identifier: HKSampleTypeIdentifier
|
|
990
1189
|
): Promise<QueryId>;
|
|
991
1190
|
unsubscribeQuery(queryId: QueryId): Promise<boolean>;
|
|
992
|
-
authorizationStatusFor(
|
|
993
|
-
type: HealthkitReadAuthorization
|
|
994
|
-
): Promise<boolean>;
|
|
1191
|
+
authorizationStatusFor(type: HealthkitReadAuthorization): Promise<boolean>;
|
|
995
1192
|
getRequestStatusForAuthorization(
|
|
996
1193
|
write: WritePermissions,
|
|
997
1194
|
read: ReadPermissions
|
|
@@ -1003,7 +1200,7 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
1003
1200
|
readonly saveQuantitySample: <
|
|
1004
1201
|
TType extends HKQuantityTypeIdentifier,
|
|
1005
1202
|
TUnit extends UnitForIdentifier<TType> = UnitForIdentifier<TType>
|
|
1006
|
-
>
|
|
1203
|
+
>(
|
|
1007
1204
|
identifier: TType,
|
|
1008
1205
|
unit: TUnit,
|
|
1009
1206
|
value: number,
|
|
@@ -1015,7 +1212,10 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
1015
1212
|
typeIdentifier: TIdentifier,
|
|
1016
1213
|
uuid: string
|
|
1017
1214
|
) => Promise<boolean>;
|
|
1018
|
-
readonly queryWorkoutSamples: <
|
|
1215
|
+
readonly queryWorkoutSamples: <
|
|
1216
|
+
TEnergy extends EnergyUnit,
|
|
1217
|
+
TDistance extends LengthUnit
|
|
1218
|
+
>(
|
|
1019
1219
|
energyUnit: TEnergy,
|
|
1020
1220
|
distanceUnit: TDistance,
|
|
1021
1221
|
from: string,
|
|
@@ -1032,7 +1232,7 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
1032
1232
|
) => Promise<readonly HKCategorySampleRaw<T>[]>;
|
|
1033
1233
|
readonly queryQuantitySamples: <
|
|
1034
1234
|
TIdentifier extends HKQuantityTypeIdentifier,
|
|
1035
|
-
TUnit extends UnitForIdentifier<TIdentifier
|
|
1235
|
+
TUnit extends UnitForIdentifier<TIdentifier>
|
|
1036
1236
|
>(
|
|
1037
1237
|
identifier: TIdentifier,
|
|
1038
1238
|
unit: TUnit,
|
|
@@ -1061,7 +1261,9 @@ type ReactNativeHealthkitTypeNative = {
|
|
|
1061
1261
|
readonly getPreferredUnits: (
|
|
1062
1262
|
identifiers: readonly HKQuantityTypeIdentifier[]
|
|
1063
1263
|
) => Promise<TypeToUnitMapping>;
|
|
1064
|
-
readonly getWorkoutRoutes: (
|
|
1264
|
+
readonly getWorkoutRoutes: (
|
|
1265
|
+
workoutUUID: string
|
|
1266
|
+
) => Promise<readonly WorkoutRoute[]>;
|
|
1065
1267
|
};
|
|
1066
1268
|
|
|
1067
1269
|
const Native = NativeModules.ReactNativeHealthkit as ReactNativeHealthkitTypeNative
|
|
@@ -1080,7 +1282,7 @@ interface HealthkitEventEmitter extends NativeEventEmitter {
|
|
|
1080
1282
|
}
|
|
1081
1283
|
|
|
1082
1284
|
export const EventEmitter = new NativeEventEmitter(
|
|
1083
|
-
NativeModules.ReactNativeHealthkit,
|
|
1285
|
+
NativeModules.ReactNativeHealthkit as NativeModule,
|
|
1084
1286
|
) as HealthkitEventEmitter
|
|
1085
1287
|
|
|
1086
1288
|
export default Native
|