@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.
Files changed (189) hide show
  1. package/ReactNativeHealthkit.podspec +1 -0
  2. package/app.plugin.ts +40 -2
  3. package/ios/BackgroundDeliveryManager.swift +196 -0
  4. package/ios/CategoryTypeModule.swift +1 -1
  5. package/ios/CoreModule.swift +24 -0
  6. package/ios/CorrelationTypeModule.swift +2 -35
  7. package/ios/ElectrocardiogramModule.swift +2 -34
  8. package/ios/HeartbeatSeriesModule.swift +2 -34
  9. package/ios/MedicationModule.swift +3 -35
  10. package/ios/PredicateHelpers.swift +2 -2
  11. package/ios/QuantityTypeModule.swift +11 -11
  12. package/ios/Serializers.swift +58 -90
  13. package/ios/StateOfMindModule.swift +2 -34
  14. package/ios/WorkoutProxy.swift +3 -149
  15. package/ios/generated/HealthkitGenerated.swift +52 -0
  16. package/lib/commonjs/generated/healthkit.generated.js +745 -0
  17. package/lib/commonjs/healthkit.ios.js +51 -17
  18. package/lib/commonjs/healthkit.js +120 -34
  19. package/lib/commonjs/specs/QuantityTypeModule.nitro.js +1 -0
  20. package/lib/commonjs/type-tests/generated-typing.js +2 -0
  21. package/lib/commonjs/types/CategoryType.js +19 -99
  22. package/lib/commonjs/types/Medication.js +2 -0
  23. package/lib/commonjs/types/MetadataEnums.js +17 -0
  24. package/lib/commonjs/types/QuantityType.js +4 -15
  25. package/lib/commonjs/types/WeatherCondition.js +2 -32
  26. package/lib/commonjs/types/Workouts.js +3 -98
  27. package/lib/commonjs/types/index.js +2 -0
  28. package/lib/module/generated/healthkit.generated.js +742 -0
  29. package/lib/module/healthkit.ios.js +49 -15
  30. package/lib/module/healthkit.js +94 -20
  31. package/lib/module/specs/QuantityTypeModule.nitro.js +1 -0
  32. package/lib/module/type-tests/generated-typing.js +1 -0
  33. package/lib/module/types/CategoryType.js +2 -98
  34. package/lib/module/types/Medication.js +1 -0
  35. package/lib/module/types/MetadataEnums.js +1 -0
  36. package/lib/module/types/QuantityType.js +2 -14
  37. package/lib/module/types/WeatherCondition.js +1 -32
  38. package/lib/module/types/Workouts.js +2 -98
  39. package/lib/module/types/index.js +2 -0
  40. package/lib/typescript/generated/healthkit.generated.d.ts +1006 -0
  41. package/lib/typescript/healthkit.d.ts +39 -36
  42. package/lib/typescript/healthkit.ios.d.ts +64 -53
  43. package/lib/typescript/hooks/useMostRecentQuantitySample.d.ts +3 -2
  44. package/lib/typescript/hooks/useMostRecentWorkout.d.ts +2 -2
  45. package/lib/typescript/hooks/useQuantitySampleById.d.ts +5 -4
  46. package/lib/typescript/hooks/useStatisticsForQuantity.d.ts +2 -2
  47. package/lib/typescript/hooks/useSubscribeToQuantitySamples.d.ts +1 -1
  48. package/lib/typescript/modules.d.ts +2 -2
  49. package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +3 -3
  50. package/lib/typescript/specs/CoreModule.nitro.d.ts +15 -0
  51. package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +20 -9
  52. package/lib/typescript/type-tests/generated-typing.d.ts +1 -0
  53. package/lib/typescript/types/CategoryType.d.ts +10 -104
  54. package/lib/typescript/types/CategoryTypeIdentifier.d.ts +1 -61
  55. package/lib/typescript/types/CorrelationType.d.ts +8 -2
  56. package/lib/typescript/types/ElectrocardiogramSample.d.ts +8 -1
  57. package/lib/typescript/types/HeartbeatSeries.d.ts +8 -1
  58. package/lib/typescript/types/InterfaceVerification.d.ts +14 -1
  59. package/lib/typescript/types/Medication.d.ts +10 -0
  60. package/lib/typescript/types/MetadataEnums.d.ts +1 -0
  61. package/lib/typescript/types/QuantitySample.d.ts +9 -1
  62. package/lib/typescript/types/QuantityType.d.ts +14 -18
  63. package/lib/typescript/types/QuantityTypeIdentifier.d.ts +1 -671
  64. package/lib/typescript/types/QueryOptions.d.ts +8 -4
  65. package/lib/typescript/types/Shared.d.ts +12 -41
  66. package/lib/typescript/types/StateOfMind.d.ts +8 -1
  67. package/lib/typescript/types/Subscriptions.d.ts +11 -11
  68. package/lib/typescript/types/WeatherCondition.d.ts +1 -30
  69. package/lib/typescript/types/Workouts.d.ts +18 -104
  70. package/lib/typescript/types/index.d.ts +2 -0
  71. package/lib/typescript/utils/getMostRecentQuantitySample.d.ts +2 -1
  72. package/lib/typescript/utils/getMostRecentWorkout.d.ts +2 -1
  73. package/lib/typescript/utils/getPreferredUnit.d.ts +2 -1
  74. package/lib/typescript/utils/getQuantitySampleById.d.ts +2 -1
  75. package/lib/typescript/utils/subscribeToQuantitySamples.d.ts +1 -1
  76. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +55 -109
  77. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +12 -18
  78. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +5 -14
  79. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +18 -2
  80. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +1 -13
  81. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +1 -13
  82. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +2 -14
  83. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +1 -13
  84. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +19 -28
  85. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +2 -14
  86. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +2 -115
  87. package/nitrogen/generated/ios/swift/CategorySample.swift +4 -329
  88. package/nitrogen/generated/ios/swift/CategoryTypeIdentifier.swift +112 -108
  89. package/nitrogen/generated/ios/swift/CategoryTypeIdentifierWriteable.swift +292 -0
  90. package/nitrogen/generated/ios/swift/CorrelationSample.swift +4 -347
  91. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +4 -329
  92. package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +30 -30
  93. package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +30 -30
  94. package/nitrogen/generated/ios/swift/GeneralForm.swift +4 -4
  95. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +4 -329
  96. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
  97. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +1 -1
  98. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -0
  99. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +38 -0
  100. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +6 -6
  101. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +6 -6
  102. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +1 -27
  103. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +2 -340
  104. package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +4 -329
  105. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +492 -492
  106. package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -329
  107. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +380 -384
  108. package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +372 -376
  109. package/nitrogen/generated/ios/swift/{QueryOptionsWithAnchorAndUnit.swift → QueryOptionsWithAnchorAndStringUnit.swift} +5 -5
  110. package/nitrogen/generated/ios/swift/{QueryOptionsWithSortOrderAndUnit.swift → QueryOptionsWithSortOrderAndStringUnit.swift} +5 -5
  111. package/nitrogen/generated/ios/swift/QueryStatisticsResponseFromSingleSource.swift +37 -37
  112. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +492 -492
  113. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +482 -486
  114. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +4 -329
  115. package/nitrogen/generated/ios/swift/{StatisticsQueryOptions.swift → StatisticsQueryOptionsWithStringUnit.swift} +5 -5
  116. package/nitrogen/generated/ios/swift/WorkoutSample.swift +4 -402
  117. package/nitrogen/generated/shared/c++/CategorySample.hpp +8 -100
  118. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +153 -149
  119. package/nitrogen/generated/shared/c++/CategoryTypeIdentifierWriteable.hpp +328 -0
  120. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +9 -105
  121. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -99
  122. package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +13 -13
  123. package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +13 -13
  124. package/nitrogen/generated/shared/c++/GeneralForm.hpp +7 -7
  125. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +8 -100
  126. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +5 -2
  127. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +2 -0
  128. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -2
  129. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +15 -15
  130. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +1 -27
  131. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +2 -37
  132. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -99
  133. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +565 -565
  134. package/nitrogen/generated/shared/c++/QuantitySample.hpp +8 -100
  135. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +407 -411
  136. package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +398 -402
  137. package/nitrogen/generated/shared/c++/{QueryOptionsWithAnchorAndUnit.hpp → QueryOptionsWithAnchorAndStringUnit.hpp} +11 -11
  138. package/nitrogen/generated/shared/c++/{QueryOptionsWithSortOrderAndUnit.hpp → QueryOptionsWithSortOrderAndStringUnit.hpp} +11 -11
  139. package/nitrogen/generated/shared/c++/QueryStatisticsResponseFromSingleSource.hpp +12 -12
  140. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +559 -559
  141. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +541 -545
  142. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +8 -100
  143. package/nitrogen/generated/shared/c++/{StatisticsQueryOptions.hpp → StatisticsQueryOptionsWithStringUnit.hpp} +11 -11
  144. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +7 -120
  145. package/package.json +5 -2
  146. package/src/generated/healthkit-schema.json +3680 -0
  147. package/src/generated/healthkit.generated.ts +1307 -0
  148. package/src/healthkit.ios.ts +225 -19
  149. package/src/healthkit.ts +181 -55
  150. package/src/hooks/useMostRecentQuantitySample.ts +6 -5
  151. package/src/hooks/useMostRecentWorkout.ts +2 -2
  152. package/src/hooks/useQuantitySampleById.ts +6 -5
  153. package/src/hooks/useStatisticsForQuantity.ts +2 -1
  154. package/src/hooks/useSubscribeToQuantitySamples.ts +1 -1
  155. package/src/modules.ts +7 -2
  156. package/src/specs/CategoryTypeModule.nitro.ts +8 -5
  157. package/src/specs/CoreModule.nitro.ts +20 -0
  158. package/src/specs/QuantityTypeModule.nitro.ts +81 -7
  159. package/src/test-setup.ts +2 -0
  160. package/src/type-tests/generated-typing.ts +133 -0
  161. package/src/types/CategoryType.ts +52 -148
  162. package/src/types/CategoryTypeIdentifier.ts +5 -134
  163. package/src/types/CorrelationType.ts +13 -3
  164. package/src/types/ElectrocardiogramSample.ts +13 -1
  165. package/src/types/HeartbeatSeries.ts +13 -1
  166. package/src/types/InterfaceVerification.ts +38 -1
  167. package/src/types/Medication.ts +19 -0
  168. package/src/types/MetadataEnums.ts +15 -0
  169. package/src/types/QuantitySample.ts +14 -2
  170. package/src/types/QuantityType.ts +22 -122
  171. package/src/types/QuantityTypeIdentifier.ts +5 -772
  172. package/src/types/QueryOptions.ts +11 -4
  173. package/src/types/Shared.ts +22 -49
  174. package/src/types/StateOfMind.ts +13 -1
  175. package/src/types/Subscriptions.ts +19 -13
  176. package/src/types/WeatherCondition.ts +1 -31
  177. package/src/types/Workouts.ts +44 -108
  178. package/src/types/index.ts +2 -0
  179. package/src/utils/getMostRecentQuantitySample.ts +4 -3
  180. package/src/utils/getMostRecentWorkout.ts +5 -2
  181. package/src/utils/getPreferredUnit.ts +5 -4
  182. package/src/utils/getQuantitySampleById.ts +4 -3
  183. package/src/utils/subscribeToQuantitySamples.ts +5 -3
  184. package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +0 -44
  185. package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +0 -40
  186. package/nitrogen/generated/ios/swift/WeatherCondition.swift +0 -144
  187. package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +0 -67
  188. package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +0 -62
  189. package/nitrogen/generated/shared/c++/WeatherCondition.hpp +0 -88
@@ -1,101 +1,14 @@
1
1
  import type { AnyMap } from 'react-native-nitro-modules';
2
+ import type { CategoryTypedMetadataForIdentifierGenerated, CategoryValueForIdentifierGenerated } from '../generated/healthkit.generated';
3
+ import { CategoryValueAppetiteChanges, CategoryValueAppleStandHour, CategoryValueAppleWalkingSteadinessEvent, CategoryValueCervicalMucusQuality, CategoryValueContraceptive, CategoryValueEnvironmentalAudioExposureEvent, CategoryValueHeadphoneAudioExposureEvent, CategoryValueLowCardioFitnessEvent, CategoryValueMenstrualFlow, CategoryValue as CategoryValueNotApplicable, CategoryValueOvulationTestResult, CategoryValuePregnancyTestResult, CategoryValuePresence, CategoryValueProgesteroneTestResult, CategoryValueSeverity, CategoryValueSleepAnalysis, CategoryValueVaginalBleeding } from '../generated/healthkit.generated';
2
4
  import type { CategoryTypeIdentifier } from './CategoryTypeIdentifier';
3
5
  import type { BaseSample, DeletedSample, GenericMetadata } from './Shared';
4
6
  import type { SourceRevision } from './Source';
7
+ export { CategoryValueAppetiteChanges, CategoryValueAppleStandHour, CategoryValueAppleWalkingSteadinessEvent, CategoryValueCervicalMucusQuality, CategoryValueContraceptive, CategoryValueEnvironmentalAudioExposureEvent, CategoryValueHeadphoneAudioExposureEvent, CategoryValueLowCardioFitnessEvent, CategoryValueMenstrualFlow, CategoryValueNotApplicable, CategoryValueOvulationTestResult, CategoryValuePregnancyTestResult, CategoryValuePresence, CategoryValueProgesteroneTestResult, CategoryValueSeverity, CategoryValueSleepAnalysis, CategoryValueVaginalBleeding, };
5
8
  export type CategoryTypePresenceIdentifier = 'HKCategoryTypeIdentifierAppetiteChanges' | 'HKCategoryTypeIdentifierSleepChanges';
6
- export type CategoryTypeValueNotApplicableIdentifier = 'HKCategoryTypeIdentifierHighHeartRateEvent' | 'HKCategoryTypeIdentifierIntermenstrualBleeding' | 'HKCategoryTypeIdentifierMindfulSession' | 'HKCategoryTypeIdentifierSexualActivity';
7
- /**
8
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepregnancytestresult Apple Docs }
9
- */
10
- declare enum CategoryValuePregnancyTestResult {
11
- positive = 2,
12
- negative = 1,
13
- indeterminate = 3
14
- }
15
- export type CategoryTypeSeverityIdentifier = 'HKCategoryTypeIdentifierAbdominalCramps' | 'HKCategoryTypeIdentifierAcne' | 'HKCategoryTypeIdentifierBladderIncontinence' | 'HKCategoryTypeIdentifierBloating' | 'HKCategoryTypeIdentifierBreastPain' | 'HKCategoryTypeIdentifierChestTightnessOrPain' | 'HKCategoryTypeIdentifierChills' | 'HKCategoryTypeIdentifierConstipation' | 'HKCategoryTypeIdentifierCoughing' | 'HKCategoryTypeIdentifierDiarrhea' | 'HKCategoryTypeIdentifierDizziness' | 'HKCategoryTypeIdentifierDrySkin' | 'HKCategoryTypeIdentifierFainting' | 'HKCategoryTypeIdentifierFatigue' | 'HKCategoryTypeIdentifierFever' | 'HKCategoryTypeIdentifierGeneralizedBodyAche' | 'HKCategoryTypeIdentifierHairLoss' | 'HKCategoryTypeIdentifierHeadache' | 'HKCategoryTypeIdentifierHeartburn' | 'HKCategoryTypeIdentifierHotFlashes' | 'HKCategoryTypeIdentifierLossOfSmell' | 'HKCategoryTypeIdentifierLossOfTaste' | 'HKCategoryTypeIdentifierLowerBackPain' | 'HKCategoryTypeIdentifierMemoryLapse' | 'HKCategoryTypeIdentifierMoodChanges' | 'HKCategoryTypeIdentifierNausea' | 'HKCategoryTypeIdentifierNightSweats' | 'HKCategoryTypeIdentifierPelvicPain' | 'HKCategoryTypeIdentifierRapidPoundingOrFlutteringHeartbeat' | 'HKCategoryTypeIdentifierRunnyNose' | 'HKCategoryTypeIdentifierShortnessOfBreath' | 'HKCategoryTypeIdentifierSinusCongestion' | 'HKCategoryTypeIdentifierSkippedHeartbeat' | 'HKCategoryTypeIdentifierSoreThroat' | 'HKCategoryTypeIdentifierVaginalDryness' | 'HKCategoryTypeIdentifierVomiting' | 'HKCategoryTypeIdentifierWheezing';
16
- /**
17
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluecervicalmucusquality Apple Docs }
18
- */
19
- export declare enum CategoryValueCervicalMucusQuality {
20
- dry = 1,
21
- sticky = 2,
22
- creamy = 3,
23
- watery = 4,
24
- eggWhite = 5
25
- }
26
- /**
27
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluemenstrualflow Apple Docs }
28
- */
29
- export declare enum CategoryValueMenstrualFlow {
30
- unspecified = 1,
31
- none = 5,
32
- light = 2,
33
- medium = 3,
34
- heavy = 4
35
- }
36
- /**
37
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueovulationtestresult Apple Docs }
38
- */
39
- export declare enum CategoryValueOvulationTestResult {
40
- negative = 1,
41
- luteinizingHormoneSurge = 2,
42
- indeterminate = 3,
43
- estrogenSurge = 4
44
- }
45
- /**
46
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluesleepanalysis Apple Docs }
47
- */
48
- export declare enum CategoryValueSleepAnalysis {
49
- inBed = 0,
50
- asleepUnspecified = 1,
51
- awake = 2,
52
- asleepCore = 3,
53
- asleepDeep = 4,
54
- asleepREM = 5
55
- }
56
- /**
57
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueappetitechanges Apple Docs}
58
- */
59
- export declare enum CategoryValueAppetiteChanges {
60
- decreased = 2,
61
- increased = 3,
62
- noChange = 1,
63
- unspecified = 0
64
- }
65
- /**
66
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepresence Apple Docs}
67
- */
68
- export declare enum CategoryValuePresence {
69
- notPresent = 1,
70
- present = 0
71
- }
72
- /**
73
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueseverity Apple Docs }
74
- */
75
- export declare enum CategoryValueSeverity {
76
- notPresent = 1,
77
- mild = 2,
78
- moderate = 3,
79
- severe = 4,
80
- unspecified = 0
81
- }
82
- /**
83
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalue/notapplicable Apple Docs }
84
- */
85
- export declare enum CategoryValueNotApplicable {
86
- notApplicable = 0
87
- }
88
- export declare enum CategoryValueLowCardioFitnessEvent {
89
- lowFitness = 1
90
- }
91
- /**
92
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalue Apple Docs }
93
- */
94
- export type CategoryValue = CategoryValueAppetiteChanges | CategoryValueCervicalMucusQuality | CategoryValueLowCardioFitnessEvent | CategoryValueMenstrualFlow | CategoryValueOvulationTestResult | CategoryValuePresence | CategoryValueSeverity | CategoryValueSleepAnalysis | number;
95
- export declare enum CategoryValueAppleStandHour {
96
- stood = 0,
97
- idle = 1
98
- }
9
+ export type CategoryTypeValueNotApplicableIdentifier = 'HKCategoryTypeIdentifierHighHeartRateEvent' | 'HKCategoryTypeIdentifierHypertensionEvent' | 'HKCategoryTypeIdentifierIntermenstrualBleeding' | 'HKCategoryTypeIdentifierMindfulSession' | 'HKCategoryTypeIdentifierSexualActivity' | 'HKCategoryTypeIdentifierSleepApneaEvent';
10
+ export type CategoryTypeSeverityIdentifier = 'HKCategoryTypeIdentifierAbdominalCramps' | 'HKCategoryTypeIdentifierAcne' | 'HKCategoryTypeIdentifierBladderIncontinence' | 'HKCategoryTypeIdentifierBloating' | 'HKCategoryTypeIdentifierBreastPain' | 'HKCategoryTypeIdentifierChestTightnessOrPain' | 'HKCategoryTypeIdentifierChills' | 'HKCategoryTypeIdentifierConstipation' | 'HKCategoryTypeIdentifierCoughing' | 'HKCategoryTypeIdentifierDiarrhea' | 'HKCategoryTypeIdentifierDizziness' | 'HKCategoryTypeIdentifierDrySkin' | 'HKCategoryTypeIdentifierFainting' | 'HKCategoryTypeIdentifierFatigue' | 'HKCategoryTypeIdentifierFever' | 'HKCategoryTypeIdentifierGeneralizedBodyAche' | 'HKCategoryTypeIdentifierHairLoss' | 'HKCategoryTypeIdentifierHeadache' | 'HKCategoryTypeIdentifierHeartburn' | 'HKCategoryTypeIdentifierHotFlashes' | 'HKCategoryTypeIdentifierLossOfSmell' | 'HKCategoryTypeIdentifierLossOfTaste' | 'HKCategoryTypeIdentifierLowerBackPain' | 'HKCategoryTypeIdentifierMemoryLapse' | 'HKCategoryTypeIdentifierNausea' | 'HKCategoryTypeIdentifierNightSweats' | 'HKCategoryTypeIdentifierPelvicPain' | 'HKCategoryTypeIdentifierRapidPoundingOrFlutteringHeartbeat' | 'HKCategoryTypeIdentifierRunnyNose' | 'HKCategoryTypeIdentifierShortnessOfBreath' | 'HKCategoryTypeIdentifierSinusCongestion' | 'HKCategoryTypeIdentifierSkippedHeartbeat' | 'HKCategoryTypeIdentifierSoreThroat' | 'HKCategoryTypeIdentifierVaginalDryness' | 'HKCategoryTypeIdentifierVomiting' | 'HKCategoryTypeIdentifierWheezing';
11
+ export type CategoryValue = CategoryValueForIdentifierGenerated<CategoryTypeIdentifier> | number;
99
12
  export interface CategorySampleForSaving {
100
13
  readonly start: Date;
101
14
  readonly end: Date;
@@ -118,17 +31,10 @@ export interface CategorySamplesWithAnchorResponseTyped<T extends CategoryTypeId
118
31
  readonly deletedSamples: readonly DeletedSample[];
119
32
  readonly newAnchor: string;
120
33
  }
121
- export type MetadataForCategoryIdentifier<T extends CategoryTypeIdentifier = CategoryTypeIdentifier> = T extends 'HKCategoryTypeIdentifierSexualActivity' ? GenericMetadata & {
122
- readonly HKSexualActivityProtectionUsed?: boolean;
123
- } : T extends 'HKCategoryTypeIdentifierMenstrualFlow' ? GenericMetadata & {
124
- readonly HKMenstrualCycleStart?: boolean;
125
- } : GenericMetadata;
126
- export interface CategorySampleTyped<T extends CategoryTypeIdentifier> extends Omit<BaseSample, 'metadata'> {
34
+ export type MetadataForCategoryIdentifier<T extends CategoryTypeIdentifier = CategoryTypeIdentifier> = GenericMetadata & CategoryTypedMetadataForIdentifierGenerated<T>;
35
+ export type CategorySampleTyped<T extends CategoryTypeIdentifier> = Omit<CategorySample, 'categoryType' | 'value' | 'metadata'> & {
127
36
  readonly categoryType: T;
128
37
  readonly value: CategoryValueForIdentifier<T>;
129
38
  readonly metadata: MetadataForCategoryIdentifier<T>;
130
- readonly metadataSexualActivityProtectionUsed?: boolean;
131
- readonly metadataMenstrualCycleStart?: boolean;
132
- }
133
- export type CategoryValueForIdentifier<T extends CategoryTypeIdentifier = CategoryTypeIdentifier> = T extends 'HKCategoryTypeIdentifierCervicalMucusQuality' ? CategoryValueCervicalMucusQuality : T extends 'CategoryTypeIdentifierMenstrualFlow' ? CategoryValueMenstrualFlow : T extends 'HKCategoryTypeIdentifierOvulationTestResult' ? CategoryValueOvulationTestResult : T extends 'HKCategoryTypeIdentifierSleepAnalysis' ? CategoryValueSleepAnalysis : T extends CategoryTypeValueNotApplicableIdentifier ? CategoryValueNotApplicable : T extends CategoryTypeSeverityIdentifier ? CategoryValueSeverity : T extends CategoryTypePresenceIdentifier ? CategoryValuePresence : T extends 'HKCategoryTypeIdentifierLowCardioFitnessEvent' ? CategoryValueLowCardioFitnessEvent : T extends 'HKCategoryTypeIdentifierPregnancyTestResult' ? CategoryValuePregnancyTestResult : T extends 'HKCategoryTypeIdentifierPregnancyTestResult' ? CategoryValuePregnancyTestResult : T extends 'HKCategoryTypeIdentifierAppleStandHour' ? CategoryValueAppleStandHour : number;
134
- export {};
39
+ };
40
+ export type CategoryValueForIdentifier<T extends CategoryTypeIdentifier = CategoryTypeIdentifier> = CategoryValueForIdentifierGenerated<T>;
@@ -1,61 +1 @@
1
- export type CategoryTypeIdentifierReadOnly = 'HKCategoryTypeIdentifierAppleStandHour' | 'HKCategoryTypeIdentifierHighHeartRateEvent' | 'HKCategoryTypeIdentifierLowHeartRateEvent' | 'HKCategoryTypeIdentifierHeadphoneAudioExposureEvent';
2
- /**
3
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier Apple Docs }
4
- */
5
- export type CategoryTypeIdentifierWriteable = 'HKCategoryTypeIdentifierSleepAnalysis' | 'HKCategoryTypeIdentifierCervicalMucusQuality' | 'HKCategoryTypeIdentifierOvulationTestResult'
6
- /**
7
- * @deprecated In iOS 18 beta
8
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifiermenstrualflow Apple Docs }
9
- */
10
- | 'HKCategoryTypeIdentifierMenstrualFlow' | 'HKCategoryTypeIdentifierIntermenstrualBleeding' | 'HKCategoryTypeIdentifierSexualActivity' | 'HKCategoryTypeIdentifierMindfulSession' | 'HKCategoryTypeIdentifierIrregularHeartRhythmEvent'
11
- /**
12
- * @deprecated Use environmentalAudioExposureEvent instead.
13
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier/audioexposureevent Apple Docs }
14
- */
15
- | 'HKCategoryTypeIdentifierAudioExposureEvent' | 'HKCategoryTypeIdentifierToothbrushingEvent' | 'HKCategoryTypeIdentifierLowCardioFitnessEvent' | 'HKCategoryTypeIdentifierContraceptive' | 'HKCategoryTypeIdentifierLactation' | 'HKCategoryTypeIdentifierPregnancy' | 'HKCategoryTypeIdentifierPregnancyTestResult' | 'HKCategoryTypeIdentifierProgesteroneTestResult' | 'HKCategoryTypeIdentifierEnvironmentalAudioExposureEvent' | 'HKCategoryTypeIdentifierAppleWalkingSteadinessEvent' | 'HKCategoryTypeIdentifierHandwashingEvent' | 'HKCategoryTypeIdentifierAbdominalCramps' | 'HKCategoryTypeIdentifierAcne' | 'HKCategoryTypeIdentifierAppetiteChanges' | 'HKCategoryTypeIdentifierBladderIncontinence' | 'HKCategoryTypeIdentifierBloating' | 'HKCategoryTypeIdentifierBreastPain' | 'HKCategoryTypeIdentifierChestTightnessOrPain' | 'HKCategoryTypeIdentifierChills' | 'HKCategoryTypeIdentifierConstipation' | 'HKCategoryTypeIdentifierCoughing' | 'HKCategoryTypeIdentifierDiarrhea' | 'HKCategoryTypeIdentifierDizziness' | 'HKCategoryTypeIdentifierDrySkin' | 'HKCategoryTypeIdentifierFainting' | 'HKCategoryTypeIdentifierFatigue' | 'HKCategoryTypeIdentifierFever' | 'HKCategoryTypeIdentifierGeneralizedBodyAche' | 'HKCategoryTypeIdentifierHairLoss' | 'HKCategoryTypeIdentifierHeadache' | 'HKCategoryTypeIdentifierHeartburn' | 'HKCategoryTypeIdentifierHotFlashes' | 'HKCategoryTypeIdentifierLossOfSmell' | 'HKCategoryTypeIdentifierLossOfTaste' | 'HKCategoryTypeIdentifierLowerBackPain' | 'HKCategoryTypeIdentifierMemoryLapse' | 'HKCategoryTypeIdentifierMoodChanges' | 'HKCategoryTypeIdentifierNausea' | 'HKCategoryTypeIdentifierNightSweats' | 'HKCategoryTypeIdentifierPelvicPain' | 'HKCategoryTypeIdentifierRapidPoundingOrFlutteringHeartbeat' | 'HKCategoryTypeIdentifierRunnyNose' | 'HKCategoryTypeIdentifierShortnessOfBreath' | 'HKCategoryTypeIdentifierSinusCongestion' | 'HKCategoryTypeIdentifierSkippedHeartbeat' | 'HKCategoryTypeIdentifierSleepChanges' | 'HKCategoryTypeIdentifierSoreThroat' | 'HKCategoryTypeIdentifierVaginalDryness' | 'HKCategoryTypeIdentifierVomiting' | 'HKCategoryTypeIdentifierWheezing'
16
- /**
17
- * Bleeding After Pregnancy
18
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifierbleedingafterpregnancy Apple Docs }
19
- * @since iOS 18
20
- */
21
- | 'HKCategoryTypeIdentifierBleedingAfterPregnancy'
22
- /**
23
- * Bleeding During Pregnancy
24
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifierbleedingduringpregnancy Apple Docs }
25
- * @since iOS 18
26
- */
27
- | 'HKCategoryTypeIdentifierBleedingDuringPregnancy'
28
- /**
29
- * Infrequent Menstrual Cycles
30
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier/infrequentmenstrualcycles Apple Docs }
31
- * @since iOS 16
32
- */
33
- | 'HKCategoryTypeIdentifierInfrequentMenstrualCycles'
34
- /**
35
- * Irregular Menstrual Cycles
36
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier/irregularmenstrualcycles Apple Docs }
37
- * @since iOS 16
38
- */
39
- | 'HKCategoryTypeIdentifierIrregularMenstrualCycles'
40
- /**
41
- * Persistent Intermenstrual Bleeding
42
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier/persistentintermenstrualbleeding Apple Docs }
43
- * @since iOS 16
44
- */
45
- | 'HKCategoryTypeIdentifierPersistentIntermenstrualBleeding'
46
- /**
47
- * Prolonged Menstrual Periods
48
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier/prolongedmenstrualperiods Apple Docs }
49
- * @since iOS 16
50
- */
51
- | 'HKCategoryTypeIdentifierProlongedMenstrualPeriods'
52
- /**
53
- * Sleep Apnea Event
54
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier/sleepapneaevent Apple Docs }
55
- * @since iOS 18
56
- */
57
- | 'HKCategoryTypeIdentifierSleepApneaEvent';
58
- /**
59
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifier Apple Docs }
60
- */
61
- export type CategoryTypeIdentifier = CategoryTypeIdentifierReadOnly | CategoryTypeIdentifierWriteable;
1
+ export type { CategoryTypeIdentifier, CategoryTypeIdentifierReadOnly, CategoryTypeIdentifierWriteable, } from '../generated/healthkit.generated';
@@ -1,6 +1,7 @@
1
+ import type { KnownSampleMetadata } from '../generated/healthkit.generated';
1
2
  import type { CategorySample, CategorySampleForSaving } from './CategoryType';
2
3
  import type { QuantitySample, QuantitySampleForSaving } from './QuantitySample';
3
- import type { BaseSample, DeletedSample } from './Shared';
4
+ import type { BaseSample, DeletedSample, WithTypedMetadata } from './Shared';
4
5
  /**
5
6
  * @see {@link https://developer.apple.com/documentation/healthkit/hkcorrelationtypeidentifier Apple Docs }
6
7
  */
@@ -9,12 +10,17 @@ type CorrelationObject = CategorySample | QuantitySample;
9
10
  export interface CorrelationSample extends BaseSample {
10
11
  readonly correlationType: CorrelationTypeIdentifier;
11
12
  readonly objects: readonly CorrelationObject[];
12
- readonly metadataFoodType?: string;
13
13
  }
14
+ export type CorrelationSampleTyped = WithTypedMetadata<CorrelationSample, KnownSampleMetadata>;
14
15
  export type SampleForSaving = CategorySampleForSaving | QuantitySampleForSaving;
15
16
  export interface QueryCorrelationSamplesWithAnchorResponse {
16
17
  readonly correlations: readonly CorrelationSample[];
17
18
  readonly deletedSamples: readonly DeletedSample[];
18
19
  readonly newAnchor: string;
19
20
  }
21
+ export interface QueryCorrelationSamplesWithAnchorResponseTyped {
22
+ readonly correlations: readonly CorrelationSampleTyped[];
23
+ readonly deletedSamples: readonly DeletedSample[];
24
+ readonly newAnchor: string;
25
+ }
20
26
  export {};
@@ -1,5 +1,6 @@
1
+ import type { KnownSampleMetadata } from '../generated/healthkit.generated';
1
2
  import type { QueryOptionsWithAnchor, QueryOptionsWithSortOrder } from '../types/QueryOptions';
2
- import type { BaseSample, DeletedSample } from './Shared';
3
+ import type { BaseSample, DeletedSample, WithTypedMetadata } from './Shared';
3
4
  export type ElectrocardiogramClassification = 'notSet' | 'sinusRhythm' | 'atrialFibrillation' | 'inconclusiveLowHeartRate' | 'inconclusiveHighHeartRate' | 'inconclusivePoorReading' | 'inconclusiveOther';
4
5
  export type ElectrocardiogramSymptomsStatus = 'notSet' | 'none' | 'present';
5
6
  export type ElectrocardiogramLead = 'appleWatchSimilarToLeadI' | 'unknown';
@@ -16,11 +17,17 @@ export interface ElectrocardiogramSample extends BaseSample {
16
17
  readonly numberOfVoltageMeasurements: number;
17
18
  readonly voltages?: readonly ElectrocardiogramVoltage[];
18
19
  }
20
+ export type ElectrocardiogramSampleTyped = WithTypedMetadata<ElectrocardiogramSample, KnownSampleMetadata>;
19
21
  export interface ElectrocardiogramSamplesWithAnchorResponse {
20
22
  readonly samples: readonly ElectrocardiogramSample[];
21
23
  readonly deletedSamples: readonly DeletedSample[];
22
24
  readonly newAnchor: string;
23
25
  }
26
+ export interface ElectrocardiogramSamplesWithAnchorResponseTyped {
27
+ readonly samples: readonly ElectrocardiogramSampleTyped[];
28
+ readonly deletedSamples: readonly DeletedSample[];
29
+ readonly newAnchor: string;
30
+ }
24
31
  export interface ECGQueryOptionsWithSortOrder extends QueryOptionsWithSortOrder {
25
32
  readonly includeVoltages?: boolean;
26
33
  }
@@ -1,4 +1,5 @@
1
- import type { BaseSample, DeletedSample } from './Shared';
1
+ import type { KnownSampleMetadata } from '../generated/healthkit.generated';
2
+ import type { BaseSample, DeletedSample, WithTypedMetadata } from './Shared';
2
3
  export interface Heartbeat {
3
4
  readonly timeSinceSeriesStart: number;
4
5
  readonly precededByGap: boolean;
@@ -6,8 +7,14 @@ export interface Heartbeat {
6
7
  export interface HeartbeatSeriesSample extends BaseSample {
7
8
  readonly heartbeats: readonly Heartbeat[];
8
9
  }
10
+ export type HeartbeatSeriesSampleTyped = WithTypedMetadata<HeartbeatSeriesSample, KnownSampleMetadata>;
9
11
  export interface HeartbeatSeriesSamplesWithAnchorResponse {
10
12
  readonly samples: readonly HeartbeatSeriesSample[];
11
13
  readonly deletedSamples: readonly DeletedSample[];
12
14
  readonly newAnchor: string;
13
15
  }
16
+ export interface HeartbeatSeriesSamplesWithAnchorResponseTyped {
17
+ readonly samples: readonly HeartbeatSeriesSampleTyped[];
18
+ readonly deletedSamples: readonly DeletedSample[];
19
+ readonly newAnchor: string;
20
+ }
@@ -47,13 +47,26 @@ export type CheckParameterCounts<BaseInterface, TypedInterface, ExcludeFromBase
47
47
  [K in ExtractMethodNames<BaseInterface, ExcludeFromBase> & ExtractMethodNames<TypedInterface>]: GetParameterCount<BaseInterface[K]> extends GetParameterCount<TypedInterface[K]> ? GetParameterCount<TypedInterface[K]> extends GetParameterCount<BaseInterface[K]> ? never : K : K;
48
48
  }[ExtractMethodNames<BaseInterface, ExcludeFromBase> & ExtractMethodNames<TypedInterface>];
49
49
  };
50
+ /**
51
+ * Checks that typed methods remain assignable to their base counterparts.
52
+ */
53
+ export type CheckMethodCompatibility<BaseInterface, TypedInterface, ExcludeFromBase extends keyof BaseInterface = never> = {
54
+ SharedMethodNames: ExtractMethodNames<BaseInterface, ExcludeFromBase> & ExtractMethodNames<TypedInterface>;
55
+ IncompatibleMethods: {
56
+ [K in ExtractMethodNames<BaseInterface, ExcludeFromBase> & ExtractMethodNames<TypedInterface>]: TypedInterface[K] extends BaseInterface[K] ? never : K;
57
+ }[ExtractMethodNames<BaseInterface, ExcludeFromBase> & ExtractMethodNames<TypedInterface>];
58
+ };
50
59
  /**
51
60
  * Complete interface verification that checks both method names and parameter counts
52
61
  */
53
62
  export type VerifyInterfaceSync<BaseInterface, TypedInterface, ExcludeFromBase extends keyof BaseInterface = never> = {
54
63
  MethodCheck: CheckMethodNames<BaseInterface, TypedInterface, ExcludeFromBase>;
55
64
  ParameterCheck: CheckParameterCounts<BaseInterface, TypedInterface, ExcludeFromBase>;
56
- Result: CheckMethodNames<BaseInterface, TypedInterface, ExcludeFromBase>['InterfaceMismatch'] extends never ? CheckParameterCounts<BaseInterface, TypedInterface, ExcludeFromBase>['ParameterCountMismatches'] extends never ? true : {
65
+ CompatibilityCheck: CheckMethodCompatibility<BaseInterface, TypedInterface, ExcludeFromBase>;
66
+ Result: CheckMethodNames<BaseInterface, TypedInterface, ExcludeFromBase>['InterfaceMismatch'] extends never ? CheckParameterCounts<BaseInterface, TypedInterface, ExcludeFromBase>['ParameterCountMismatches'] extends never ? CheckMethodCompatibility<BaseInterface, TypedInterface, ExcludeFromBase>['IncompatibleMethods'] extends never ? true : {
67
+ ERROR: 'Method signature compatibility mismatch detected';
68
+ IncompatibleMethods: CheckMethodCompatibility<BaseInterface, TypedInterface, ExcludeFromBase>['IncompatibleMethods'];
69
+ } : {
57
70
  ERROR: 'Parameter count mismatch detected';
58
71
  MethodsWithParameterCountMismatch: CheckParameterCounts<BaseInterface, TypedInterface, ExcludeFromBase>['ParameterCountMismatches'];
59
72
  } : {
@@ -0,0 +1,10 @@
1
+ import type { KnownSampleMetadata } from '../generated/healthkit.generated';
2
+ import type { MedicationDoseEvent, UserAnnotatedMedication } from '../specs/MedicationModule.nitro';
3
+ import type { DeletedSample, WithTypedMetadata } from './Shared';
4
+ export type { UserAnnotatedMedication };
5
+ export type MedicationDoseEventTyped = WithTypedMetadata<MedicationDoseEvent, KnownSampleMetadata>;
6
+ export interface MedicationDoseEventsWithAnchorResponseTyped {
7
+ readonly samples: readonly MedicationDoseEventTyped[];
8
+ readonly deletedSamples: readonly DeletedSample[];
9
+ readonly newAnchor: string;
10
+ }
@@ -0,0 +1 @@
1
+ export { AppleECGAlgorithmVersion, BloodGlucoseMealTime, BodyTemperatureSensorLocation, CyclingFunctionalThresholdPowerTestType, DevicePlacementSide, HeartRateRecoveryTestType, HeartRateSensorLocation, PhysicalEffortEstimationType, SwimmingStrokeStyle, UserMotionContext, VO2MaxTestType, WaterSalinity, WorkoutSwimmingLocationType, } from '../generated/healthkit.generated';
@@ -1,6 +1,8 @@
1
1
  import type { AnyMap } from 'react-native-nitro-modules';
2
+ import type { QuantityTypedMetadataForIdentifierGenerated } from '../generated/healthkit.generated';
3
+ import type { UnitForIdentifier } from './QuantityType';
2
4
  import type { QuantityTypeIdentifier } from './QuantityTypeIdentifier';
3
- import type { BaseSample } from './Shared';
5
+ import type { BaseSample, MetadataWithUnknown } from './Shared';
4
6
  import type { SourceRevision } from './Source';
5
7
  /**
6
8
  * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitysample Apple Docs }
@@ -10,6 +12,12 @@ export interface QuantitySample extends BaseSample {
10
12
  readonly quantity: number;
11
13
  readonly unit: string;
12
14
  }
15
+ export type MetadataForQuantityIdentifier<T extends QuantityTypeIdentifier = QuantityTypeIdentifier> = MetadataWithUnknown<QuantityTypedMetadataForIdentifierGenerated<T>>;
16
+ export interface QuantitySampleTyped<T extends QuantityTypeIdentifier> extends Omit<QuantitySample, 'quantityType' | 'unit' | 'metadata'> {
17
+ readonly quantityType: T;
18
+ readonly unit: UnitForIdentifier<T>;
19
+ readonly metadata: MetadataForQuantityIdentifier<T>;
20
+ }
13
21
  export interface QuantitySampleForSaving {
14
22
  readonly startDate: Date;
15
23
  readonly endDate: Date;
@@ -1,9 +1,11 @@
1
+ import type { UnitForIdentifierGenerated } from '../generated/healthkit.generated';
2
+ import { HeartRateMotionContext, InsulinDeliveryReason } from '../generated/healthkit.generated';
1
3
  import type { SourceProxy } from '../specs/SourceProxy.nitro';
2
- import type { QuantitySample } from './QuantitySample';
4
+ import type { QuantitySample, QuantitySampleTyped } from './QuantitySample';
3
5
  import type { QuantityTypeIdentifier } from './QuantityTypeIdentifier';
4
6
  import type { FilterForSamples } from './QueryOptions';
5
7
  import type { DeletedSample } from './Shared';
6
- import type { BloodGlucoseUnit, CountPerTime, EnergyUnit, LengthUnit, MassUnit, SpeedUnit, TemperatureUnit, TimeUnit, Unit, VolumeUnit } from './Units';
8
+ export { HeartRateMotionContext, InsulinDeliveryReason };
7
9
  interface QuantityDateInterval {
8
10
  readonly from: Date;
9
11
  readonly to: Date;
@@ -34,22 +36,15 @@ export interface QuantitySamplesWithAnchorResponse {
34
36
  readonly deletedSamples: readonly DeletedSample[];
35
37
  readonly newAnchor: string;
36
38
  }
39
+ export interface QuantitySamplesWithAnchorResponseTyped<T extends QuantityTypeIdentifier> {
40
+ readonly samples: readonly QuantitySampleTyped<T>[];
41
+ readonly deletedSamples: readonly DeletedSample[];
42
+ readonly newAnchor: string;
43
+ }
37
44
  export interface Quantity {
38
45
  readonly unit: string;
39
46
  readonly quantity: number;
40
47
  }
41
- /**
42
- * @see {@link https://developer.apple.com/documentation/healthkit/hkinsulindeliveryreason Apple Docs }
43
- */
44
- export declare enum InsulinDeliveryReason {
45
- basal = 1,
46
- bolus = 2
47
- }
48
- export declare enum HeartRateMotionContext {
49
- active = 2,
50
- notSet = 0,
51
- sedentary = 1
52
- }
53
48
  export interface IntervalComponents {
54
49
  readonly minute?: number;
55
50
  readonly hour?: number;
@@ -57,13 +52,14 @@ export interface IntervalComponents {
57
52
  readonly month?: number;
58
53
  readonly year?: number;
59
54
  }
60
- export interface StatisticsQueryOptions {
55
+ export interface StatisticsQueryOptions<TUnit extends string = string> {
61
56
  filter?: FilterForSamples;
62
- unit?: string;
57
+ unit?: TUnit;
58
+ }
59
+ export interface StatisticsQueryOptionsWithStringUnit extends StatisticsQueryOptions<string> {
63
60
  }
64
61
  /**
65
62
  * @see {@link https://developer.apple.com/documentation/healthkit/hkstatisticsoptions Apple Docs }
66
63
  */
67
64
  export type StatisticsOptions = 'cumulativeSum' | 'discreteAverage' | 'discreteMax' | 'discreteMin' | 'duration' | 'mostRecent';
68
- export type UnitForIdentifier<T extends QuantityTypeIdentifier = QuantityTypeIdentifier> = T extends 'QuantityTypeIdentifierBloodGlucose' ? BloodGlucoseUnit : T extends 'QuantityTypeIdentifierAppleExerciseTime' | 'QuantityTypeIdentifierAppleMoveTime' | 'QuantityTypeIdentifierAppleStandTime' ? TimeUnit : T extends 'QuantityTypeIdentifierActiveEnergyBurned' | 'QuantityTypeIdentifierBasalEnergyBurned' | 'QuantityTypeIdentifierDietaryEnergyConsumed' ? EnergyUnit : T extends 'QuantityTypeIdentifierDistanceCycling' | 'QuantityTypeIdentifierDistanceDownhillSnowSports' | 'QuantityTypeIdentifierDistanceSwimming' | 'QuantityTypeIdentifierDistanceWalkingRunning' | 'QuantityTypeIdentifierDistanceWheelchair' | 'QuantityTypeIdentifierSixMinuteWalkTestDistance' | 'QuantityTypeIdentifierWaistCircumference' ? LengthUnit : T extends 'QuantityTypeIdentifierBodyFatPercentage' | 'QuantityTypeIdentifierOxygenSaturation' | 'QuantityTypeIdentifierWalkingAsymmetryPercentage' | 'QuantityTypeIdentifierWalkingDoubleSupportPercentage' ? '%' : T extends 'QuantityTypeIdentifierBasalBodyTemperature' ? TemperatureUnit : T extends 'QuantityTypeIdentifierRunningSpeed' | 'QuantityTypeIdentifierStairAscentSpeed' | 'QuantityTypeIdentifierStairDescentSpeed' | 'QuantityTypeIdentifierWalkingSpeed' ? SpeedUnit<LengthUnit, TimeUnit> : T extends 'QuantityTypeIdentifierFlightsClimbed' | 'QuantityTypeIdentifierNumberOfAlcoholicBeverages' | 'QuantityTypeIdentifierNumberOfTimesFallen' | 'QuantityTypeIdentifierPushCount' | 'QuantityTypeIdentifierStepCount' | 'QuantityTypeIdentifierSwimmingStrokeCount' ? 'count' : T extends 'QuantityTypeIdentifierDietaryBiotin' | 'QuantityTypeIdentifierDietaryCaffeine' | 'QuantityTypeIdentifierDietaryCalcium' | 'QuantityTypeIdentifierDietaryCarbohydrates' | 'QuantityTypeIdentifierDietaryChloride' | 'QuantityTypeIdentifierDietaryCholesterol' | 'QuantityTypeIdentifierDietaryChromium' | 'QuantityTypeIdentifierDietaryCopper' | 'QuantityTypeIdentifierDietaryFatMonounsaturated' | 'QuantityTypeIdentifierDietaryFatPolyunsaturated' | 'QuantityTypeIdentifierDietaryFatSaturated' | 'QuantityTypeIdentifierDietaryFatTotal' | 'QuantityTypeIdentifierDietaryFiber' | 'QuantityTypeIdentifierDietaryFolate' | 'QuantityTypeIdentifierDietaryIodine' | 'QuantityTypeIdentifierDietaryIron' | 'QuantityTypeIdentifierDietaryMagnesium' | 'QuantityTypeIdentifierDietaryManganese' | 'QuantityTypeIdentifierDietaryMolybdenum' | 'QuantityTypeIdentifierDietaryNiacin' | 'QuantityTypeIdentifierDietaryPantothenicAcid' | 'QuantityTypeIdentifierDietaryPhosphorus' | 'QuantityTypeIdentifierDietaryPotassium' | 'QuantityTypeIdentifierDietaryProtein' | 'QuantityTypeIdentifierDietaryRiboflavin' | 'QuantityTypeIdentifierDietarySelenium' | 'QuantityTypeIdentifierDietarySodium' | 'QuantityTypeIdentifierDietarySugar' | 'QuantityTypeIdentifierDietaryThiamin' | 'QuantityTypeIdentifierDietaryVitaminA' | 'QuantityTypeIdentifierDietaryVitaminB6' | 'QuantityTypeIdentifierDietaryVitaminB12' | 'QuantityTypeIdentifierDietaryVitaminC' | 'QuantityTypeIdentifierDietaryVitaminD' | 'QuantityTypeIdentifierDietaryVitaminE' | 'QuantityTypeIdentifierDietaryVitaminK' | 'QuantityTypeIdentifierDietaryZinc' ? MassUnit : T extends 'QuantityTypeIdentifierDietaryWater' ? VolumeUnit : T extends 'QuantityTypeIdentifierInsulinDelivery' ? 'IU' : T extends 'QuantityTypeIdentifierHeartRate' | 'QuantityTypeIdentifierRestingHeartRate' | 'QuantityTypeIdentifierWalkingHeartRateAverage' ? CountPerTime<TimeUnit> : Unit;
69
- export {};
65
+ export type UnitForIdentifier<T extends QuantityTypeIdentifier = QuantityTypeIdentifier> = UnitForIdentifierGenerated<T>;