@kingstinct/react-native-healthkit 12.1.2 → 12.2.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 (266) hide show
  1. package/ios/CategoryTypeModule.swift +49 -97
  2. package/ios/CharacteristicTypeModule.swift +77 -63
  3. package/ios/CoreModule.swift +324 -280
  4. package/ios/CorrelationTypeModule.swift +192 -144
  5. package/ios/ElectrocardiogramModule.swift +185 -194
  6. package/ios/HeartbeatSeriesModule.swift +123 -171
  7. package/ios/Helpers.swift +312 -571
  8. package/ios/MedicationModule.swift +259 -0
  9. package/ios/PredicateHelpers.swift +334 -0
  10. package/ios/QuantityTypeModule.swift +297 -378
  11. package/ios/Serializers.swift +273 -210
  12. package/ios/SourceProxy.swift +2 -2
  13. package/ios/StateOfMindModule.swift +179 -125
  14. package/ios/WorkoutProxy.swift +235 -112
  15. package/ios/WorkoutsModule.swift +214 -262
  16. package/lib/commonjs/healthkit.ios.js +22 -2
  17. package/lib/commonjs/healthkit.js +35 -5
  18. package/lib/commonjs/hooks/useStatisticsForQuantity.js +1 -1
  19. package/lib/commonjs/hooks/useSubscribeToCategorySamples.js +20 -0
  20. package/lib/commonjs/modules.js +2 -1
  21. package/lib/commonjs/specs/MedicationModule.nitro.js +27 -0
  22. package/lib/commonjs/types/Constants.js +2 -1
  23. package/lib/commonjs/types/QuantityType.js +8 -1
  24. package/lib/commonjs/types/QueryOptions.js +18 -0
  25. package/lib/commonjs/types/WeatherCondition.js +32 -32
  26. package/lib/commonjs/types/Workouts.js +1 -50
  27. package/lib/commonjs/utils/getCategorySampleById.js +1 -1
  28. package/lib/commonjs/utils/getQuantitySampleById.js +1 -1
  29. package/lib/commonjs/utils/getWorkoutById.js +1 -1
  30. package/lib/commonjs/utils/subscribeToCategorySamples.js +29 -0
  31. package/lib/commonjs/utils/subscribeToQuantitySamples.js +8 -25
  32. package/lib/module/healthkit.ios.js +20 -2
  33. package/lib/module/healthkit.js +32 -2
  34. package/lib/module/hooks/useStatisticsForQuantity.js +1 -1
  35. package/lib/module/hooks/useSubscribeToCategorySamples.js +17 -0
  36. package/lib/module/modules.js +1 -0
  37. package/lib/module/specs/MedicationModule.nitro.js +26 -0
  38. package/lib/module/types/Constants.js +1 -0
  39. package/lib/module/types/QuantityType.js +7 -0
  40. package/lib/module/types/QueryOptions.js +17 -1
  41. package/lib/module/types/WeatherCondition.js +31 -31
  42. package/lib/module/types/Workouts.js +0 -49
  43. package/lib/module/utils/getCategorySampleById.js +1 -1
  44. package/lib/module/utils/getQuantitySampleById.js +1 -1
  45. package/lib/module/utils/getWorkoutById.js +1 -1
  46. package/lib/module/utils/subscribeToCategorySamples.js +26 -0
  47. package/lib/module/utils/subscribeToQuantitySamples.js +8 -25
  48. package/lib/typescript/healthkit.d.ts +18 -9
  49. package/lib/typescript/healthkit.ios.d.ts +33 -15
  50. package/lib/typescript/hooks/useSubscribeToCategorySamples.d.ts +3 -0
  51. package/lib/typescript/modules.d.ts +2 -0
  52. package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +2 -2
  53. package/lib/typescript/specs/CoreModule.nitro.d.ts +2 -1
  54. package/lib/typescript/specs/CorrelationTypeModule.nitro.d.ts +4 -2
  55. package/lib/typescript/specs/ElectrocardiogramModule.nitro.d.ts +1 -1
  56. package/lib/typescript/specs/HeartbeatSeriesModule.nitro.d.ts +1 -1
  57. package/lib/typescript/specs/MedicationModule.nitro.d.ts +56 -0
  58. package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +4 -4
  59. package/lib/typescript/specs/StateOfMindModule.nitro.d.ts +4 -3
  60. package/lib/typescript/types/CategoryType.d.ts +10 -20
  61. package/lib/typescript/types/Constants.d.ts +1 -0
  62. package/lib/typescript/types/CorrelationType.d.ts +8 -10
  63. package/lib/typescript/types/ElectrocardiogramSample.d.ts +2 -12
  64. package/lib/typescript/types/HeartbeatSeries.d.ts +2 -14
  65. package/lib/typescript/types/QuantitySample.d.ts +2 -8
  66. package/lib/typescript/types/QuantityType.d.ts +7 -8
  67. package/lib/typescript/types/QuantityTypeIdentifier.d.ts +23 -23
  68. package/lib/typescript/types/QueryOptions.d.ts +43 -28
  69. package/lib/typescript/types/Shared.d.ts +52 -7
  70. package/lib/typescript/types/StateOfMind.d.ts +7 -10
  71. package/lib/typescript/types/Subscriptions.d.ts +12 -3
  72. package/lib/typescript/types/WeatherCondition.d.ts +1 -1
  73. package/lib/typescript/types/Workouts.d.ts +28 -81
  74. package/lib/typescript/utils/subscribeToCategorySamples.d.ts +5 -0
  75. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +57 -0
  76. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +592 -389
  77. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +65 -30
  78. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.mm +8 -0
  79. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.swift +15 -0
  80. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +32 -26
  81. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +36 -37
  82. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +55 -2
  83. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +36 -30
  84. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +35 -29
  85. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.cpp +11 -0
  86. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +181 -0
  87. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +48 -42
  88. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +59 -36
  89. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +150 -29
  90. package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +13 -28
  91. package/nitrogen/generated/ios/swift/AggregationStyle.swift +48 -0
  92. package/nitrogen/generated/ios/swift/CategorySample.swift +571 -24
  93. package/nitrogen/generated/ios/swift/ComparisonPredicateOperator.swift +2 -2
  94. package/nitrogen/generated/ios/swift/CorrelationSample.swift +640 -17
  95. package/nitrogen/generated/ios/swift/{PredicateWithStartAndEnd.swift → DateFilter.swift} +5 -5
  96. package/nitrogen/generated/ios/swift/ECGQueryOptionsWithAnchor.swift +11 -91
  97. package/nitrogen/generated/ios/swift/ECGQueryOptionsWithSortOrder.swift +11 -91
  98. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +570 -72
  99. package/nitrogen/generated/ios/swift/FilterForSamples.swift +349 -12
  100. package/nitrogen/generated/ios/swift/FilterForSamplesBase.swift +234 -0
  101. package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +366 -0
  102. package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +240 -0
  103. package/nitrogen/generated/ios/swift/Func_void_MedicationDoseEventsWithAnchorResponse.swift +47 -0
  104. package/nitrogen/generated/ios/swift/Func_void_QueryCorrelationSamplesWithAnchorResponse.swift +47 -0
  105. package/nitrogen/generated/ios/swift/Func_void_StateOfMindSamplesWithAnchorResponse.swift +47 -0
  106. package/nitrogen/generated/ios/swift/Func_void_std__vector_MedicationDoseEvent_.swift +47 -0
  107. package/nitrogen/generated/ios/swift/Func_void_std__vector_UserAnnotatedMedication_.swift +47 -0
  108. package/nitrogen/generated/ios/swift/GeneralForm.swift +104 -0
  109. package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +44 -0
  110. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +565 -37
  111. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
  112. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +2 -2
  113. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -1
  114. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +19 -31
  115. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec.swift +2 -1
  116. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec_cxx.swift +21 -2
  117. package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec.swift +1 -1
  118. package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec_cxx.swift +2 -2
  119. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec.swift +1 -1
  120. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec_cxx.swift +2 -2
  121. package/nitrogen/generated/ios/swift/HybridMedicationModuleSpec.swift +60 -0
  122. package/nitrogen/generated/ios/swift/HybridMedicationModuleSpec_cxx.swift +208 -0
  123. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +2 -2
  124. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +9 -43
  125. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec.swift +2 -1
  126. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec_cxx.swift +21 -2
  127. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +34 -6
  128. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +376 -36
  129. package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +40 -0
  130. package/nitrogen/generated/ios/swift/MedicationConcept.swift +80 -0
  131. package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +781 -0
  132. package/nitrogen/generated/ios/swift/MedicationDoseEventLogStatus.swift +56 -0
  133. package/nitrogen/generated/ios/swift/MedicationDoseEventScheduleType.swift +40 -0
  134. package/nitrogen/generated/ios/swift/MedicationDoseEventsWithAnchorResponse.swift +81 -0
  135. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +16 -16
  136. package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +7 -7
  137. package/nitrogen/generated/ios/swift/QuantitySample.swift +574 -27
  138. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +16 -16
  139. package/nitrogen/generated/ios/swift/QueryCorrelationSamplesWithAnchorResponse.swift +81 -0
  140. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchor.swift +11 -91
  141. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchorAndUnit.swift +11 -91
  142. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrder.swift +11 -91
  143. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrderAndUnit.swift +11 -91
  144. package/nitrogen/generated/ios/swift/RelatedCoding.swift +76 -0
  145. package/nitrogen/generated/ios/swift/SampleType.swift +68 -0
  146. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +16 -16
  147. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +0 -16
  148. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +586 -58
  149. package/nitrogen/generated/ios/swift/StateOfMindSamplesWithAnchorResponse.swift +81 -0
  150. package/nitrogen/generated/ios/swift/StatisticsQueryOptions.swift +7 -75
  151. package/nitrogen/generated/ios/swift/UserAnnotatedMedication.swift +87 -0
  152. package/nitrogen/generated/ios/swift/WeatherCondition.swift +144 -0
  153. package/nitrogen/generated/ios/swift/WorkoutQueryOptions.swift +11 -105
  154. package/nitrogen/generated/ios/swift/WorkoutQueryOptionsWithAnchor.swift +11 -105
  155. package/nitrogen/generated/ios/swift/WorkoutSample.swift +751 -78
  156. package/nitrogen/generated/shared/c++/AggregationStyle.hpp +64 -0
  157. package/nitrogen/generated/shared/c++/CategorySample.hpp +126 -23
  158. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +134 -12
  159. package/nitrogen/generated/shared/c++/{PredicateWithStartAndEnd.hpp → DateFilter.hpp} +10 -10
  160. package/nitrogen/generated/shared/c++/ECGQueryOptionsWithAnchor.hpp +12 -31
  161. package/nitrogen/generated/shared/c++/ECGQueryOptionsWithSortOrder.hpp +12 -31
  162. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +135 -36
  163. package/nitrogen/generated/shared/c++/FilterForSamples.hpp +124 -0
  164. package/nitrogen/generated/shared/c++/FilterForSamplesBase.hpp +109 -0
  165. package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +131 -0
  166. package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +116 -0
  167. package/nitrogen/generated/shared/c++/GeneralForm.hpp +140 -0
  168. package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +67 -0
  169. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +131 -28
  170. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +1 -2
  171. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +1 -0
  172. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +10 -28
  173. package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.cpp +1 -0
  174. package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.hpp +11 -1
  175. package/nitrogen/generated/shared/c++/HybridElectrocardiogramModuleSpec.hpp +1 -2
  176. package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.hpp +1 -2
  177. package/nitrogen/generated/shared/c++/HybridMedicationModuleSpec.cpp +24 -0
  178. package/nitrogen/generated/shared/c++/HybridMedicationModuleSpec.hpp +80 -0
  179. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.cpp +1 -1
  180. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +6 -25
  181. package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.cpp +1 -0
  182. package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.hpp +9 -2
  183. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +33 -5
  184. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +56 -16
  185. package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +62 -0
  186. package/nitrogen/generated/shared/c++/MedicationConcept.hpp +93 -0
  187. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +240 -0
  188. package/nitrogen/generated/shared/c++/MedicationDoseEventLogStatus.hpp +66 -0
  189. package/nitrogen/generated/shared/c++/MedicationDoseEventScheduleType.hpp +62 -0
  190. package/nitrogen/generated/shared/c++/MedicationDoseEventsWithAnchorResponse.hpp +89 -0
  191. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +105 -105
  192. package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +8 -8
  193. package/nitrogen/generated/shared/c++/QuantitySample.hpp +130 -27
  194. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +105 -105
  195. package/nitrogen/generated/shared/c++/QueryCorrelationSamplesWithAnchorResponse.hpp +89 -0
  196. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchor.hpp +12 -31
  197. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchorAndUnit.hpp +12 -31
  198. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrder.hpp +12 -31
  199. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrderAndUnit.hpp +12 -31
  200. package/nitrogen/generated/shared/c++/RelatedCoding.hpp +84 -0
  201. package/nitrogen/generated/shared/c++/SampleType.hpp +87 -0
  202. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +105 -105
  203. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +105 -121
  204. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +139 -36
  205. package/nitrogen/generated/shared/c++/StateOfMindSamplesWithAnchorResponse.hpp +89 -0
  206. package/nitrogen/generated/shared/c++/StatisticsQueryOptions.hpp +8 -27
  207. package/nitrogen/generated/shared/c++/UserAnnotatedMedication.hpp +90 -0
  208. package/nitrogen/generated/shared/c++/WeatherCondition.hpp +88 -0
  209. package/nitrogen/generated/shared/c++/WorkoutQueryOptions.hpp +12 -37
  210. package/nitrogen/generated/shared/c++/WorkoutQueryOptionsWithAnchor.hpp +12 -37
  211. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +159 -35
  212. package/package.json +1 -1
  213. package/src/healthkit.ios.ts +30 -0
  214. package/src/healthkit.ts +68 -3
  215. package/src/hooks/useStatisticsForQuantity.ts +1 -1
  216. package/src/hooks/useSubscribeToCategorySamples.ts +31 -0
  217. package/src/modules.ts +4 -0
  218. package/src/specs/CategoryTypeModule.nitro.ts +2 -2
  219. package/src/specs/CoreModule.nitro.ts +3 -0
  220. package/src/specs/CorrelationTypeModule.nitro.ts +11 -3
  221. package/src/specs/ElectrocardiogramModule.nitro.ts +1 -1
  222. package/src/specs/HeartbeatSeriesModule.nitro.ts +1 -1
  223. package/src/specs/MedicationModule.nitro.ts +140 -0
  224. package/src/specs/QuantityTypeModule.nitro.ts +4 -7
  225. package/src/specs/StateOfMindModule.nitro.ts +10 -2
  226. package/src/types/CategoryType.ts +15 -22
  227. package/src/types/Constants.ts +3 -0
  228. package/src/types/CorrelationType.ts +10 -15
  229. package/src/types/ElectrocardiogramSample.ts +2 -14
  230. package/src/types/HeartbeatSeries.ts +2 -15
  231. package/src/types/QuantitySample.ts +2 -8
  232. package/src/types/QuantityType.ts +8 -17
  233. package/src/types/QuantityTypeIdentifier.ts +25 -25
  234. package/src/types/QueryOptions.ts +54 -43
  235. package/src/types/Shared.ts +74 -17
  236. package/src/types/StateOfMind.ts +8 -10
  237. package/src/types/Subscriptions.ts +19 -3
  238. package/src/types/WeatherCondition.ts +1 -1
  239. package/src/types/Workouts.ts +28 -91
  240. package/src/utils/getCategorySampleById.ts +1 -1
  241. package/src/utils/getQuantitySampleById.ts +1 -1
  242. package/src/utils/getWorkoutById.ts +1 -2
  243. package/src/utils/subscribeToCategorySamples.ts +38 -0
  244. package/src/utils/subscribeToQuantitySamples.ts +12 -37
  245. package/nitrogen/generated/ios/swift/FilterForSamplesAnd.swift +0 -94
  246. package/nitrogen/generated/ios/swift/FilterForSamplesOr.swift +0 -94
  247. package/nitrogen/generated/ios/swift/PredicateForSamples.swift +0 -21
  248. package/nitrogen/generated/ios/swift/PredicateForWorkouts.swift +0 -23
  249. package/nitrogen/generated/ios/swift/PredicateForWorkoutsAnd.swift +0 -108
  250. package/nitrogen/generated/ios/swift/PredicateForWorkoutsOr.swift +0 -108
  251. package/nitrogen/generated/ios/swift/PredicateFromWorkout.swift +0 -45
  252. package/nitrogen/generated/ios/swift/PredicateWithMetadataOperator.swift +0 -48
  253. package/nitrogen/generated/ios/swift/PredicateWithUUID.swift +0 -35
  254. package/nitrogen/generated/ios/swift/PredicateWithUUIDs.swift +0 -47
  255. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_FilterForSamplesAnd_FilterForSamplesOr.swift +0 -23
  256. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_WorkoutActivityTypePredicate_WorkoutDurationPredicate_PredicateForWorkoutsOr_PredicateForWorkoutsAnd.swift +0 -25
  257. package/nitrogen/generated/ios/swift/WorkoutActivityTypePredicate.swift +0 -35
  258. package/nitrogen/generated/shared/c++/FilterForSamplesAnd.hpp +0 -90
  259. package/nitrogen/generated/shared/c++/FilterForSamplesOr.hpp +0 -90
  260. package/nitrogen/generated/shared/c++/PredicateForWorkoutsAnd.hpp +0 -96
  261. package/nitrogen/generated/shared/c++/PredicateForWorkoutsOr.hpp +0 -96
  262. package/nitrogen/generated/shared/c++/PredicateFromWorkout.hpp +0 -77
  263. package/nitrogen/generated/shared/c++/PredicateWithMetadataOperator.hpp +0 -84
  264. package/nitrogen/generated/shared/c++/PredicateWithUUID.hpp +0 -75
  265. package/nitrogen/generated/shared/c++/PredicateWithUUIDs.hpp +0 -76
  266. package/nitrogen/generated/shared/c++/WorkoutActivityTypePredicate.hpp +0 -76
@@ -23,30 +23,42 @@
23
23
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
24
  #endif
25
25
 
26
- // Forward declaration of `Device` to properly resolve imports.
27
- namespace margelo::nitro::healthkit { struct Device; }
28
26
  // Forward declaration of `WorkoutActivityType` to properly resolve imports.
29
27
  namespace margelo::nitro::healthkit { enum class WorkoutActivityType; }
30
28
  // Forward declaration of `Quantity` to properly resolve imports.
31
29
  namespace margelo::nitro::healthkit { struct Quantity; }
32
- // Forward declaration of `SourceRevision` to properly resolve imports.
33
- namespace margelo::nitro::healthkit { struct SourceRevision; }
34
30
  // Forward declaration of `WorkoutEvent` to properly resolve imports.
35
31
  namespace margelo::nitro::healthkit { struct WorkoutEvent; }
36
32
  // Forward declaration of `WorkoutActivity` to properly resolve imports.
37
33
  namespace margelo::nitro::healthkit { struct WorkoutActivity; }
34
+ // Forward declaration of `SampleType` to properly resolve imports.
35
+ namespace margelo::nitro::healthkit { struct SampleType; }
36
+ // Forward declaration of `WeatherCondition` to properly resolve imports.
37
+ namespace margelo::nitro::healthkit { enum class WeatherCondition; }
38
+ // Forward declaration of `InsulinDeliveryReason` to properly resolve imports.
39
+ namespace margelo::nitro::healthkit { enum class InsulinDeliveryReason; }
40
+ // Forward declaration of `HeartRateMotionContext` to properly resolve imports.
41
+ namespace margelo::nitro::healthkit { enum class HeartRateMotionContext; }
42
+ // Forward declaration of `SourceRevision` to properly resolve imports.
43
+ namespace margelo::nitro::healthkit { struct SourceRevision; }
44
+ // Forward declaration of `Device` to properly resolve imports.
45
+ namespace margelo::nitro::healthkit { struct Device; }
38
46
 
39
- #include <string>
40
- #include "Device.hpp"
41
- #include <optional>
42
47
  #include "WorkoutActivityType.hpp"
43
48
  #include "Quantity.hpp"
44
- #include <chrono>
45
- #include <NitroModules/AnyMap.hpp>
46
- #include "SourceRevision.hpp"
47
49
  #include "WorkoutEvent.hpp"
48
50
  #include <vector>
51
+ #include <optional>
49
52
  #include "WorkoutActivity.hpp"
53
+ #include "SampleType.hpp"
54
+ #include <chrono>
55
+ #include "WeatherCondition.hpp"
56
+ #include "InsulinDeliveryReason.hpp"
57
+ #include "HeartRateMotionContext.hpp"
58
+ #include <string>
59
+ #include "SourceRevision.hpp"
60
+ #include "Device.hpp"
61
+ #include <NitroModules/AnyMap.hpp>
50
62
 
51
63
  namespace margelo::nitro::healthkit {
52
64
 
@@ -55,20 +67,48 @@ namespace margelo::nitro::healthkit {
55
67
  */
56
68
  struct WorkoutSample {
57
69
  public:
58
- std::string uuid SWIFT_PRIVATE;
59
- std::optional<Device> device SWIFT_PRIVATE;
60
70
  WorkoutActivityType workoutActivityType SWIFT_PRIVATE;
61
71
  Quantity duration SWIFT_PRIVATE;
62
- std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
63
- std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
64
- std::optional<std::shared_ptr<AnyMap>> metadata SWIFT_PRIVATE;
65
- std::optional<SourceRevision> sourceRevision SWIFT_PRIVATE;
66
72
  std::optional<std::vector<WorkoutEvent>> events SWIFT_PRIVATE;
67
73
  std::optional<std::vector<WorkoutActivity>> activities SWIFT_PRIVATE;
74
+ std::optional<Quantity> metadataAverageMETs SWIFT_PRIVATE;
75
+ std::optional<Quantity> metadataElevationAscended SWIFT_PRIVATE;
76
+ std::optional<Quantity> metadataElevationDescended SWIFT_PRIVATE;
77
+ std::optional<bool> metadataIndoorWorkout SWIFT_PRIVATE;
78
+ std::optional<Quantity> metadataAverageSpeed SWIFT_PRIVATE;
79
+ std::optional<Quantity> metadataMaximumSpeed SWIFT_PRIVATE;
80
+ SampleType sampleType SWIFT_PRIVATE;
81
+ std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
82
+ std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
83
+ bool hasUndeterminedDuration SWIFT_PRIVATE;
84
+ std::optional<WeatherCondition> metadataWeatherCondition SWIFT_PRIVATE;
85
+ std::optional<Quantity> metadataWeatherHumidity SWIFT_PRIVATE;
86
+ std::optional<Quantity> metadataWeatherTemperature SWIFT_PRIVATE;
87
+ std::optional<InsulinDeliveryReason> metadataInsulinDeliveryReason SWIFT_PRIVATE;
88
+ std::optional<HeartRateMotionContext> metadataHeartRateMotionContext SWIFT_PRIVATE;
89
+ std::string uuid SWIFT_PRIVATE;
90
+ SourceRevision sourceRevision SWIFT_PRIVATE;
91
+ std::optional<Device> device SWIFT_PRIVATE;
92
+ std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
93
+ std::optional<std::string> metadataExternalUUID SWIFT_PRIVATE;
94
+ std::optional<std::string> metadataTimeZone SWIFT_PRIVATE;
95
+ std::optional<bool> metadataWasUserEntered SWIFT_PRIVATE;
96
+ std::optional<std::string> metadataDeviceSerialNumber SWIFT_PRIVATE;
97
+ std::optional<std::string> metadataUdiDeviceIdentifier SWIFT_PRIVATE;
98
+ std::optional<std::string> metadataUdiProductionIdentifier SWIFT_PRIVATE;
99
+ std::optional<std::string> metadataDigitalSignature SWIFT_PRIVATE;
100
+ std::optional<std::string> metadataDeviceName SWIFT_PRIVATE;
101
+ std::optional<std::string> metadataDeviceManufacturerName SWIFT_PRIVATE;
102
+ std::optional<std::string> metadataSyncIdentifier SWIFT_PRIVATE;
103
+ std::optional<double> metadataSyncVersion SWIFT_PRIVATE;
104
+ std::optional<bool> metadataWasTakenInLab SWIFT_PRIVATE;
105
+ std::optional<double> metadataReferenceRangeLowerLimit SWIFT_PRIVATE;
106
+ std::optional<double> metadataReferenceRangeUpperLimit SWIFT_PRIVATE;
107
+ std::optional<double> metadataAlgorithmVersion SWIFT_PRIVATE;
68
108
 
69
109
  public:
70
110
  WorkoutSample() = default;
71
- explicit WorkoutSample(std::string uuid, std::optional<Device> device, WorkoutActivityType workoutActivityType, Quantity duration, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, std::optional<std::shared_ptr<AnyMap>> metadata, std::optional<SourceRevision> sourceRevision, std::optional<std::vector<WorkoutEvent>> events, std::optional<std::vector<WorkoutActivity>> activities): uuid(uuid), device(device), workoutActivityType(workoutActivityType), duration(duration), startDate(startDate), endDate(endDate), metadata(metadata), sourceRevision(sourceRevision), events(events), activities(activities) {}
111
+ explicit WorkoutSample(WorkoutActivityType workoutActivityType, Quantity duration, std::optional<std::vector<WorkoutEvent>> events, std::optional<std::vector<WorkoutActivity>> activities, std::optional<Quantity> metadataAverageMETs, std::optional<Quantity> metadataElevationAscended, std::optional<Quantity> metadataElevationDescended, std::optional<bool> metadataIndoorWorkout, std::optional<Quantity> metadataAverageSpeed, std::optional<Quantity> metadataMaximumSpeed, SampleType sampleType, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, bool hasUndeterminedDuration, std::optional<WeatherCondition> metadataWeatherCondition, std::optional<Quantity> metadataWeatherHumidity, std::optional<Quantity> metadataWeatherTemperature, std::optional<InsulinDeliveryReason> metadataInsulinDeliveryReason, std::optional<HeartRateMotionContext> metadataHeartRateMotionContext, std::string uuid, SourceRevision sourceRevision, std::optional<Device> device, std::shared_ptr<AnyMap> metadata, std::optional<std::string> metadataExternalUUID, std::optional<std::string> metadataTimeZone, std::optional<bool> metadataWasUserEntered, std::optional<std::string> metadataDeviceSerialNumber, std::optional<std::string> metadataUdiDeviceIdentifier, std::optional<std::string> metadataUdiProductionIdentifier, std::optional<std::string> metadataDigitalSignature, std::optional<std::string> metadataDeviceName, std::optional<std::string> metadataDeviceManufacturerName, std::optional<std::string> metadataSyncIdentifier, std::optional<double> metadataSyncVersion, std::optional<bool> metadataWasTakenInLab, std::optional<double> metadataReferenceRangeLowerLimit, std::optional<double> metadataReferenceRangeUpperLimit, std::optional<double> metadataAlgorithmVersion): workoutActivityType(workoutActivityType), duration(duration), events(events), activities(activities), metadataAverageMETs(metadataAverageMETs), metadataElevationAscended(metadataElevationAscended), metadataElevationDescended(metadataElevationDescended), metadataIndoorWorkout(metadataIndoorWorkout), metadataAverageSpeed(metadataAverageSpeed), metadataMaximumSpeed(metadataMaximumSpeed), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), metadataWeatherCondition(metadataWeatherCondition), metadataWeatherHumidity(metadataWeatherHumidity), metadataWeatherTemperature(metadataWeatherTemperature), metadataInsulinDeliveryReason(metadataInsulinDeliveryReason), metadataHeartRateMotionContext(metadataHeartRateMotionContext), uuid(uuid), sourceRevision(sourceRevision), device(device), metadata(metadata), metadataExternalUUID(metadataExternalUUID), metadataTimeZone(metadataTimeZone), metadataWasUserEntered(metadataWasUserEntered), metadataDeviceSerialNumber(metadataDeviceSerialNumber), metadataUdiDeviceIdentifier(metadataUdiDeviceIdentifier), metadataUdiProductionIdentifier(metadataUdiProductionIdentifier), metadataDigitalSignature(metadataDigitalSignature), metadataDeviceName(metadataDeviceName), metadataDeviceManufacturerName(metadataDeviceManufacturerName), metadataSyncIdentifier(metadataSyncIdentifier), metadataSyncVersion(metadataSyncVersion), metadataWasTakenInLab(metadataWasTakenInLab), metadataReferenceRangeLowerLimit(metadataReferenceRangeLowerLimit), metadataReferenceRangeUpperLimit(metadataReferenceRangeUpperLimit), metadataAlgorithmVersion(metadataAlgorithmVersion) {}
72
112
  };
73
113
 
74
114
  } // namespace margelo::nitro::healthkit
@@ -81,30 +121,86 @@ namespace margelo::nitro {
81
121
  static inline margelo::nitro::healthkit::WorkoutSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
82
122
  jsi::Object obj = arg.asObject(runtime);
83
123
  return margelo::nitro::healthkit::WorkoutSample(
84
- JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
85
- JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
86
124
  JSIConverter<margelo::nitro::healthkit::WorkoutActivityType>::fromJSI(runtime, obj.getProperty(runtime, "workoutActivityType")),
87
125
  JSIConverter<margelo::nitro::healthkit::Quantity>::fromJSI(runtime, obj.getProperty(runtime, "duration")),
126
+ JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::fromJSI(runtime, obj.getProperty(runtime, "events")),
127
+ JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::fromJSI(runtime, obj.getProperty(runtime, "activities")),
128
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataAverageMETs")),
129
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataElevationAscended")),
130
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataElevationDescended")),
131
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "metadataIndoorWorkout")),
132
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataAverageSpeed")),
133
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataMaximumSpeed")),
134
+ JSIConverter<margelo::nitro::healthkit::SampleType>::fromJSI(runtime, obj.getProperty(runtime, "sampleType")),
88
135
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "startDate")),
89
136
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "endDate")),
90
- JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::fromJSI(runtime, obj.getProperty(runtime, "metadata")),
91
- JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision")),
92
- JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::fromJSI(runtime, obj.getProperty(runtime, "events")),
93
- JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::fromJSI(runtime, obj.getProperty(runtime, "activities"))
137
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "hasUndeterminedDuration")),
138
+ JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWeatherCondition")),
139
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWeatherHumidity")),
140
+ JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWeatherTemperature")),
141
+ JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::fromJSI(runtime, obj.getProperty(runtime, "metadataInsulinDeliveryReason")),
142
+ JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::fromJSI(runtime, obj.getProperty(runtime, "metadataHeartRateMotionContext")),
143
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
144
+ JSIConverter<margelo::nitro::healthkit::SourceRevision>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision")),
145
+ JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
146
+ JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, "metadata")),
147
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataExternalUUID")),
148
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataTimeZone")),
149
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWasUserEntered")),
150
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDeviceSerialNumber")),
151
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataUdiDeviceIdentifier")),
152
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataUdiProductionIdentifier")),
153
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDigitalSignature")),
154
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDeviceName")),
155
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataDeviceManufacturerName")),
156
+ JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "metadataSyncIdentifier")),
157
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataSyncVersion")),
158
+ JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "metadataWasTakenInLab")),
159
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataReferenceRangeLowerLimit")),
160
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataReferenceRangeUpperLimit")),
161
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "metadataAlgorithmVersion"))
94
162
  );
95
163
  }
96
164
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::WorkoutSample& arg) {
97
165
  jsi::Object obj(runtime);
98
- obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
99
- obj.setProperty(runtime, "device", JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
100
166
  obj.setProperty(runtime, "workoutActivityType", JSIConverter<margelo::nitro::healthkit::WorkoutActivityType>::toJSI(runtime, arg.workoutActivityType));
101
167
  obj.setProperty(runtime, "duration", JSIConverter<margelo::nitro::healthkit::Quantity>::toJSI(runtime, arg.duration));
102
- obj.setProperty(runtime, "startDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
103
- obj.setProperty(runtime, "endDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
104
- obj.setProperty(runtime, "metadata", JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::toJSI(runtime, arg.metadata));
105
- obj.setProperty(runtime, "sourceRevision", JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::toJSI(runtime, arg.sourceRevision));
106
168
  obj.setProperty(runtime, "events", JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::toJSI(runtime, arg.events));
107
169
  obj.setProperty(runtime, "activities", JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::toJSI(runtime, arg.activities));
170
+ obj.setProperty(runtime, "metadataAverageMETs", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataAverageMETs));
171
+ obj.setProperty(runtime, "metadataElevationAscended", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataElevationAscended));
172
+ obj.setProperty(runtime, "metadataElevationDescended", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataElevationDescended));
173
+ obj.setProperty(runtime, "metadataIndoorWorkout", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataIndoorWorkout));
174
+ obj.setProperty(runtime, "metadataAverageSpeed", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataAverageSpeed));
175
+ obj.setProperty(runtime, "metadataMaximumSpeed", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataMaximumSpeed));
176
+ obj.setProperty(runtime, "sampleType", JSIConverter<margelo::nitro::healthkit::SampleType>::toJSI(runtime, arg.sampleType));
177
+ obj.setProperty(runtime, "startDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
178
+ obj.setProperty(runtime, "endDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
179
+ obj.setProperty(runtime, "hasUndeterminedDuration", JSIConverter<bool>::toJSI(runtime, arg.hasUndeterminedDuration));
180
+ obj.setProperty(runtime, "metadataWeatherCondition", JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::toJSI(runtime, arg.metadataWeatherCondition));
181
+ obj.setProperty(runtime, "metadataWeatherHumidity", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherHumidity));
182
+ obj.setProperty(runtime, "metadataWeatherTemperature", JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherTemperature));
183
+ obj.setProperty(runtime, "metadataInsulinDeliveryReason", JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::toJSI(runtime, arg.metadataInsulinDeliveryReason));
184
+ obj.setProperty(runtime, "metadataHeartRateMotionContext", JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::toJSI(runtime, arg.metadataHeartRateMotionContext));
185
+ obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
186
+ obj.setProperty(runtime, "sourceRevision", JSIConverter<margelo::nitro::healthkit::SourceRevision>::toJSI(runtime, arg.sourceRevision));
187
+ obj.setProperty(runtime, "device", JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
188
+ obj.setProperty(runtime, "metadata", JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
189
+ obj.setProperty(runtime, "metadataExternalUUID", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataExternalUUID));
190
+ obj.setProperty(runtime, "metadataTimeZone", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataTimeZone));
191
+ obj.setProperty(runtime, "metadataWasUserEntered", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasUserEntered));
192
+ obj.setProperty(runtime, "metadataDeviceSerialNumber", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceSerialNumber));
193
+ obj.setProperty(runtime, "metadataUdiDeviceIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiDeviceIdentifier));
194
+ obj.setProperty(runtime, "metadataUdiProductionIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiProductionIdentifier));
195
+ obj.setProperty(runtime, "metadataDigitalSignature", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDigitalSignature));
196
+ obj.setProperty(runtime, "metadataDeviceName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceName));
197
+ obj.setProperty(runtime, "metadataDeviceManufacturerName", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceManufacturerName));
198
+ obj.setProperty(runtime, "metadataSyncIdentifier", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataSyncIdentifier));
199
+ obj.setProperty(runtime, "metadataSyncVersion", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataSyncVersion));
200
+ obj.setProperty(runtime, "metadataWasTakenInLab", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasTakenInLab));
201
+ obj.setProperty(runtime, "metadataReferenceRangeLowerLimit", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeLowerLimit));
202
+ obj.setProperty(runtime, "metadataReferenceRangeUpperLimit", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeUpperLimit));
203
+ obj.setProperty(runtime, "metadataAlgorithmVersion", JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataAlgorithmVersion));
108
204
  return obj;
109
205
  }
110
206
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -115,16 +211,44 @@ namespace margelo::nitro {
115
211
  if (!nitro::isPlainObject(runtime, obj)) {
116
212
  return false;
117
213
  }
118
- if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
119
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
120
214
  if (!JSIConverter<margelo::nitro::healthkit::WorkoutActivityType>::canConvert(runtime, obj.getProperty(runtime, "workoutActivityType"))) return false;
121
215
  if (!JSIConverter<margelo::nitro::healthkit::Quantity>::canConvert(runtime, obj.getProperty(runtime, "duration"))) return false;
122
- if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "startDate"))) return false;
123
- if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "endDate"))) return false;
124
- if (!JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
125
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
126
216
  if (!JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::canConvert(runtime, obj.getProperty(runtime, "events"))) return false;
127
217
  if (!JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::canConvert(runtime, obj.getProperty(runtime, "activities"))) return false;
218
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataAverageMETs"))) return false;
219
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataElevationAscended"))) return false;
220
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataElevationDescended"))) return false;
221
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "metadataIndoorWorkout"))) return false;
222
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataAverageSpeed"))) return false;
223
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataMaximumSpeed"))) return false;
224
+ if (!JSIConverter<margelo::nitro::healthkit::SampleType>::canConvert(runtime, obj.getProperty(runtime, "sampleType"))) return false;
225
+ if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "startDate"))) return false;
226
+ if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "endDate"))) return false;
227
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "hasUndeterminedDuration"))) return false;
228
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::canConvert(runtime, obj.getProperty(runtime, "metadataWeatherCondition"))) return false;
229
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataWeatherHumidity"))) return false;
230
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, "metadataWeatherTemperature"))) return false;
231
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::canConvert(runtime, obj.getProperty(runtime, "metadataInsulinDeliveryReason"))) return false;
232
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::canConvert(runtime, obj.getProperty(runtime, "metadataHeartRateMotionContext"))) return false;
233
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
234
+ if (!JSIConverter<margelo::nitro::healthkit::SourceRevision>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
235
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
236
+ if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
237
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataExternalUUID"))) return false;
238
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataTimeZone"))) return false;
239
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "metadataWasUserEntered"))) return false;
240
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDeviceSerialNumber"))) return false;
241
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataUdiDeviceIdentifier"))) return false;
242
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataUdiProductionIdentifier"))) return false;
243
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDigitalSignature"))) return false;
244
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDeviceName"))) return false;
245
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataDeviceManufacturerName"))) return false;
246
+ if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "metadataSyncIdentifier"))) return false;
247
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataSyncVersion"))) return false;
248
+ if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "metadataWasTakenInLab"))) return false;
249
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataReferenceRangeLowerLimit"))) return false;
250
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataReferenceRangeUpperLimit"))) return false;
251
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, "metadataAlgorithmVersion"))) return false;
128
252
  return true;
129
253
  }
130
254
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingstinct/react-native-healthkit",
3
- "version": "12.1.2",
3
+ "version": "12.2.0",
4
4
  "description": "React Native bindings for HealthKit",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -6,6 +6,7 @@ import useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'
6
6
  import useMostRecentWorkout from './hooks/useMostRecentWorkout'
7
7
  import useSources from './hooks/useSources'
8
8
  import useStatisticsForQuantity from './hooks/useStatisticsForQuantity'
9
+ import useSubscribeToCategorySamples from './hooks/useSubscribeToCategorySamples'
9
10
  import useSubscribeToChanges from './hooks/useSubscribeToChanges'
10
11
  import useSubscribeToQuantitySamples from './hooks/useSubscribeToQuantitySamples'
11
12
  import {
@@ -15,6 +16,7 @@ import {
15
16
  CorrelationTypes,
16
17
  Electrocardiograms,
17
18
  HeartbeatSeries,
19
+ Medication,
18
20
  QuantityTypes,
19
21
  StateOfMind,
20
22
  Workouts,
@@ -24,6 +26,7 @@ import getMostRecentCategorySample from './utils/getMostRecentCategorySample'
24
26
  import getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'
25
27
  import getMostRecentWorkout from './utils/getMostRecentWorkout'
26
28
  import getPreferredUnit from './utils/getPreferredUnit'
29
+ import { subscribeToCategorySamples } from './utils/subscribeToCategorySamples'
27
30
  import { subscribeToChanges } from './utils/subscribeToChanges'
28
31
  import { subscribeToQuantitySamples } from './utils/subscribeToQuantitySamples'
29
32
 
@@ -56,6 +59,7 @@ export {
56
59
  getMostRecentQuantitySample,
57
60
  getMostRecentWorkout,
58
61
  getPreferredUnit,
62
+ subscribeToCategorySamples,
59
63
  subscribeToChanges,
60
64
  subscribeToQuantitySamples,
61
65
  useHealthkitAuthorization,
@@ -65,6 +69,7 @@ export {
65
69
  useMostRecentWorkout,
66
70
  useSources,
67
71
  useStatisticsForQuantity,
72
+ useSubscribeToCategorySamples,
68
73
  useSubscribeToChanges,
69
74
  useSubscribeToQuantitySamples,
70
75
  }
@@ -113,6 +118,8 @@ export const queryCategorySamplesWithAnchor =
113
118
  CategoryTypes.queryCategorySamplesWithAnchor.bind(CategoryTypes)
114
119
  export const queryCorrelationSamples =
115
120
  CorrelationTypes.queryCorrelationSamples.bind(CorrelationTypes)
121
+ export const queryCorrelationSamplesWithAnchor =
122
+ CorrelationTypes.queryCorrelationSamplesWithAnchor.bind(CorrelationTypes)
116
123
  export const queryHeartbeatSeriesSamples =
117
124
  HeartbeatSeries.queryHeartbeatSeriesSamples.bind(HeartbeatSeries)
118
125
  export const queryHeartbeatSeriesSamplesWithAnchor =
@@ -149,6 +156,8 @@ export const startWatchApp =
149
156
  export const isProtectedDataAvailable = Core.isProtectedDataAvailable.bind(Core)
150
157
  export const queryStateOfMindSamples =
151
158
  StateOfMind.queryStateOfMindSamples.bind(StateOfMind)
159
+ export const queryStateOfMindSamplesWithAnchor =
160
+ StateOfMind.queryStateOfMindSamplesWithAnchor.bind(StateOfMind)
152
161
  export const saveStateOfMindSample =
153
162
  StateOfMind.saveStateOfMindSample.bind(StateOfMind)
154
163
  export const isQuantityCompatibleWithUnit =
@@ -160,6 +169,16 @@ export const isObjectTypeAvailableAsync =
160
169
  export const areObjectTypesAvailable = Core.areObjectTypesAvailable.bind(Core)
161
170
  export const areObjectTypesAvailableAsync =
162
171
  Core.areObjectTypesAvailableAsync.bind(Core)
172
+ export const requestMedicationsAuthorization =
173
+ Medication.requestMedicationsAuthorization.bind(Medication)
174
+
175
+ export const queryMedications = Medication.queryMedications.bind(Medication)
176
+ export const queryMedicationEvents =
177
+ Medication.queryMedicationEvents.bind(Medication)
178
+ export const queryMedicationEventsWithAnchor =
179
+ Medication.queryMedicationEventsWithAnchor.bind(Medication)
180
+
181
+ export const currentAppSource = Core.currentAppSource.bind(Core)
163
182
 
164
183
  export const getBiologicalSexAsync =
165
184
  Characteristics.getBiologicalSexAsync.bind(Characteristics)
@@ -203,6 +222,7 @@ export default {
203
222
  queryCategorySamples,
204
223
  queryCategorySamplesWithAnchor,
205
224
  queryCorrelationSamples,
225
+ queryCorrelationSamplesWithAnchor,
206
226
  queryHeartbeatSeriesSamples,
207
227
  queryHeartbeatSeriesSamplesWithAnchor,
208
228
  queryElectrocardiogramSamples,
@@ -225,7 +245,17 @@ export default {
225
245
  startWatchApp,
226
246
  isProtectedDataAvailable,
227
247
  queryStateOfMindSamples,
248
+ queryStateOfMindSamplesWithAnchor,
228
249
  saveStateOfMindSample,
250
+ requestMedicationsAuthorization,
251
+ currentAppSource,
252
+
253
+ queryMedicationEventsWithAnchor,
254
+ queryMedicationEvents,
255
+ queryMedications,
256
+
257
+ subscribeToCategorySamples,
258
+ useSubscribeToCategorySamples,
229
259
 
230
260
  // hooks
231
261
  useMostRecentCategorySample,
package/src/healthkit.ts CHANGED
@@ -7,6 +7,7 @@ import { Platform } from 'react-native'
7
7
  // This import is crucial for deriving the type of the default export `HealthkitModule`
8
8
  // It assumes that index.ios.ts exports a default object matching the Healthkit native module structure.
9
9
  import type ReactNativeHealthkit from './healthkit.ios'
10
+ import type { SourceProxy } from './specs/SourceProxy.nitro'
10
11
  import type { WorkoutProxy } from './specs/WorkoutProxy.nitro'
11
12
  import { AuthorizationRequestStatus, AuthorizationStatus } from './types/Auth'
12
13
  import type {
@@ -177,7 +178,7 @@ export const isQuantityCompatibleWithUnit = UnavailableFnFromModule(
177
178
  // CategoryTypeModule functions
178
179
  export function queryCategorySamples<T extends CategoryTypeIdentifier>(
179
180
  _categoryTypeIdentifier: T,
180
- _options?: QueryOptionsWithSortOrder,
181
+ _options: QueryOptionsWithSortOrder,
181
182
  ): Promise<CategorySampleTyped<T>[]> {
182
183
  if (Platform.OS !== 'ios' && !hasWarned) {
183
184
  console.warn(notAvailableError)
@@ -273,6 +274,24 @@ export const queryStateOfMindSamples = UnavailableFnFromModule(
273
274
  'queryStateOfMindSamples',
274
275
  Promise.resolve([]),
275
276
  )
277
+ export const queryStateOfMindSamplesWithAnchor = UnavailableFnFromModule(
278
+ 'queryStateOfMindSamplesWithAnchor',
279
+ Promise.resolve({
280
+ samples: [],
281
+ deletedSamples: [],
282
+ newAnchor: '',
283
+ }),
284
+ )
285
+
286
+ export const queryCorrelationSamplesWithAnchor = UnavailableFnFromModule(
287
+ 'queryCorrelationSamplesWithAnchor',
288
+ Promise.resolve({
289
+ correlations: [],
290
+ deletedSamples: [],
291
+ newAnchor: '',
292
+ }),
293
+ )
294
+
276
295
  export const saveStateOfMindSample = UnavailableFnFromModule(
277
296
  'saveStateOfMindSample',
278
297
  Promise.resolve(false),
@@ -374,12 +393,48 @@ const subscribeToQuantitySamples = UnavailableFnFromModule(
374
393
 
375
394
  export { subscribeToQuantitySamples }
376
395
 
377
- const useSubscribeToQuantitySamples = UnavailableFnFromModule(
396
+ export const currentAppSource = UnavailableFnFromModule('currentAppSource', {
397
+ bundleIdentifier: '',
398
+ name: '',
399
+ } as SourceProxy) // Mocking callback structure
400
+
401
+ export const queryMedications = UnavailableFnFromModule(
402
+ 'queryMedications',
403
+ Promise.resolve([]),
404
+ ) // Mocking callback structure
405
+
406
+ export const queryMedicationEvents = UnavailableFnFromModule(
407
+ 'queryMedicationEvents',
408
+ Promise.resolve([]),
409
+ ) // Mocking callback structure
410
+
411
+ export const queryMedicationEventsWithAnchor = UnavailableFnFromModule(
412
+ 'queryMedicationEventsWithAnchor',
413
+ Promise.resolve({ newAnchor: '', samples: [], deletedSamples: [] }),
414
+ ) // Mocking callback structure
415
+
416
+ export const useSubscribeToQuantitySamples = UnavailableFnFromModule(
378
417
  'useSubscribeToQuantitySamples',
379
418
  undefined,
419
+ )
420
+
421
+ export const useSubscribeToCategorySamples = UnavailableFnFromModule(
422
+ 'useSubscribeToCategorySamples',
423
+ undefined,
424
+ )
425
+
426
+ export const subscribeToCategorySamples = UnavailableFnFromModule(
427
+ 'subscribeToCategorySamples',
428
+ {
429
+ remove: () => false,
430
+ },
431
+ ) // Mocking the observer query UUID
432
+
433
+ export const requestMedicationsAuthorization = UnavailableFnFromModule(
434
+ 'requestMedicationsAuthorization',
435
+ Promise.resolve(false),
380
436
  ) // Mocking callback structure
381
437
 
382
- export { useSubscribeToQuantitySamples }
383
438
  // --- Default Export ---
384
439
  // This attempts to match the structure of the default export from index.ios.ts
385
440
  const HealthkitModule = {
@@ -430,9 +485,18 @@ const HealthkitModule = {
430
485
  startWatchApp,
431
486
  isProtectedDataAvailable,
432
487
  queryStateOfMindSamples,
488
+ queryStateOfMindSamplesWithAnchor,
433
489
  saveStateOfMindSample,
434
490
  subscribeToQuantitySamples,
435
491
  useSubscribeToQuantitySamples,
492
+ queryCorrelationSamplesWithAnchor,
493
+ queryMedications,
494
+ queryMedicationEvents,
495
+ queryMedicationEventsWithAnchor,
496
+ requestMedicationsAuthorization,
497
+
498
+ subscribeToCategorySamples,
499
+ currentAppSource,
436
500
 
437
501
  // Hooks
438
502
  useMostRecentCategorySample,
@@ -441,6 +505,7 @@ const HealthkitModule = {
441
505
  useSubscribeToChanges,
442
506
  useHealthkitAuthorization,
443
507
  useIsHealthDataAvailable,
508
+ useSubscribeToCategorySamples,
444
509
  useSources,
445
510
  useStatisticsForQuantity,
446
511
  getBiologicalSexAsync,
@@ -28,7 +28,7 @@ export function useStatisticsForQuantity<
28
28
  const res = await QuantityTypes.queryStatisticsForQuantity(
29
29
  identifier,
30
30
  optionsRef.current,
31
- { filter: { startDate: from, endDate: to }, unit },
31
+ { filter: { date: { startDate: from, endDate: to } }, unit },
32
32
  )
33
33
  setResult(res)
34
34
  }, [identifier, from, to, unit])
@@ -0,0 +1,31 @@
1
+ import { useEffect, useRef } from 'react'
2
+ import type {
3
+ CategoryTypeIdentifier,
4
+ OnCategorySamplesCallback,
5
+ } from '../types'
6
+ import { subscribeToCategorySamples } from '../utils/subscribeToCategorySamples'
7
+
8
+ export function useSubscribeToCategorySamples<
9
+ TIdentifier extends CategoryTypeIdentifier,
10
+ >(
11
+ identifier: TIdentifier,
12
+ onChange: (args: OnCategorySamplesCallback<TIdentifier>) => void,
13
+ ): void {
14
+ const onChangeRef = useRef(onChange)
15
+
16
+ useEffect(() => {
17
+ onChangeRef.current = onChange
18
+ }, [onChange])
19
+
20
+ useEffect(() => {
21
+ const subscription = subscribeToCategorySamples(identifier, (args) => {
22
+ onChangeRef.current(args)
23
+ })
24
+
25
+ return () => {
26
+ subscription.remove()
27
+ }
28
+ }, [identifier])
29
+ }
30
+
31
+ export default useSubscribeToCategorySamples
package/src/modules.ts CHANGED
@@ -8,12 +8,16 @@ import type { CoreModule } from './specs/CoreModule.nitro'
8
8
  import type { CorrelationTypeModule } from './specs/CorrelationTypeModule.nitro'
9
9
  import type { ElectrocardiogramModule } from './specs/ElectrocardiogramModule.nitro'
10
10
  import type { HeartbeatSeriesModule } from './specs/HeartbeatSeriesModule.nitro'
11
+ import type { MedicationModule } from './specs/MedicationModule.nitro'
11
12
  import type { QuantityTypeModule } from './specs/QuantityTypeModule.nitro'
12
13
  import type { StateOfMindModule } from './specs/StateOfMindModule.nitro'
13
14
  import type { WorkoutsModule } from './specs/WorkoutsModule.nitro'
14
15
 
15
16
  export const Core = NitroModules.createHybridObject<CoreModule>('CoreModule')
16
17
 
18
+ export const Medication =
19
+ NitroModules.createHybridObject<MedicationModule>('MedicationModule')
20
+
17
21
  export const Workouts =
18
22
  NitroModules.createHybridObject<WorkoutsModule>('WorkoutsModule')
19
23
 
@@ -26,7 +26,7 @@ export interface CategoryTypeModule extends HybridObject<{ ios: 'swift' }> {
26
26
 
27
27
  queryCategorySamples(
28
28
  identifier: CategoryTypeIdentifier,
29
- options?: QueryOptionsWithSortOrder,
29
+ options: QueryOptionsWithSortOrder,
30
30
  ): Promise<readonly CategorySample[]>
31
31
 
32
32
  queryCategorySamplesWithAnchor(
@@ -54,7 +54,7 @@ export interface CategoryTypeModuleTyped {
54
54
 
55
55
  queryCategorySamples<T extends CategoryTypeIdentifier>(
56
56
  identifier: T,
57
- options?: QueryOptionsWithSortOrder,
57
+ options: QueryOptionsWithSortOrder,
58
58
  ): Promise<readonly CategorySampleTyped<T>[]>
59
59
 
60
60
  queryCategorySamplesWithAnchor<T extends CategoryTypeIdentifier>(
@@ -48,6 +48,8 @@ export interface CoreModule extends HybridObject<{ ios: 'swift' }> {
48
48
  isProtectedDataAvailable(): boolean
49
49
  isProtectedDataAvailableAsync(): Promise<boolean>
50
50
 
51
+ currentAppSource(): SourceProxy
52
+
51
53
  getPreferredUnits(
52
54
  identifiers: readonly QuantityTypeIdentifier[],
53
55
  forceUpdate?: boolean,
@@ -55,6 +57,7 @@ export interface CoreModule extends HybridObject<{ ios: 'swift' }> {
55
57
 
56
58
  querySources(
57
59
  identifier: SampleTypeIdentifier,
60
+ filter?: FilterForSamples,
58
61
  ): Promise<readonly SourceProxy[]>
59
62
 
60
63
  /** @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-requestauthorizationtoaccess Apple Docs }
@@ -1,8 +1,12 @@
1
1
  import type { AnyMap, HybridObject } from 'react-native-nitro-modules'
2
-
2
+ import type {
3
+ QueryOptionsWithAnchor,
4
+ QueryOptionsWithSortOrder,
5
+ } from '../types'
3
6
  import type {
4
7
  CorrelationSample,
5
8
  CorrelationTypeIdentifier,
9
+ QueryCorrelationSamplesWithAnchorResponse,
6
10
  SampleForSaving,
7
11
  } from '../types/CorrelationType'
8
12
 
@@ -17,7 +21,11 @@ export interface CorrelationTypeModule extends HybridObject<{ ios: 'swift' }> {
17
21
 
18
22
  queryCorrelationSamples(
19
23
  typeIdentifier: CorrelationTypeIdentifier,
20
- from: Date,
21
- to: Date,
24
+ options: QueryOptionsWithSortOrder,
22
25
  ): Promise<readonly CorrelationSample[]>
26
+
27
+ queryCorrelationSamplesWithAnchor(
28
+ typeIdentifier: CorrelationTypeIdentifier,
29
+ options: QueryOptionsWithAnchor,
30
+ ): Promise<QueryCorrelationSamplesWithAnchorResponse>
23
31
  }
@@ -9,7 +9,7 @@ import type {
9
9
  export interface ElectrocardiogramModule
10
10
  extends HybridObject<{ ios: 'swift' }> {
11
11
  queryElectrocardiogramSamples(
12
- options?: ECGQueryOptionsWithSortOrder,
12
+ options: ECGQueryOptionsWithSortOrder,
13
13
  ): Promise<readonly ElectrocardiogramSample[]>
14
14
 
15
15
  queryElectrocardiogramSamplesWithAnchor(
@@ -10,7 +10,7 @@ import type {
10
10
 
11
11
  export interface HeartbeatSeriesModule extends HybridObject<{ ios: 'swift' }> {
12
12
  queryHeartbeatSeriesSamples(
13
- options?: QueryOptionsWithSortOrder,
13
+ options: QueryOptionsWithSortOrder,
14
14
  ): Promise<readonly HeartbeatSeriesSample[]>
15
15
 
16
16
  queryHeartbeatSeriesSamplesWithAnchor(