@kingstinct/react-native-healthkit 10.1.0 → 11.1.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 (251) hide show
  1. package/README.md +2 -2
  2. package/ios/CoreModule.swift +5 -15
  3. package/ios/CorrelationTypeModule.swift +7 -2
  4. package/ios/ElectrocardiogramModule.swift +210 -0
  5. package/ios/QuantityTypeModule.swift +113 -124
  6. package/ios/Serializers.swift +39 -66
  7. package/ios/WorkoutProxy.swift +38 -20
  8. package/ios/WorkoutsModule.swift +7 -18
  9. package/lib/commonjs/healthkit.ios.js +6 -2
  10. package/lib/commonjs/healthkit.js +10 -2
  11. package/lib/commonjs/hooks/useMostRecentWorkout.js +2 -9
  12. package/lib/commonjs/hooks/useWorkoutById.js +1 -4
  13. package/lib/commonjs/modules.js +2 -1
  14. package/lib/commonjs/specs/ElectrocardiogramModule.nitro.js +2 -0
  15. package/lib/commonjs/types/ElectrocardiogramSample.js +2 -0
  16. package/lib/commonjs/utils/getMostRecentWorkout.js +1 -3
  17. package/lib/commonjs/utils/getWorkoutById.js +1 -3
  18. package/lib/module/healthkit.ios.js +5 -1
  19. package/lib/module/healthkit.js +8 -0
  20. package/lib/module/hooks/useMostRecentWorkout.js +3 -10
  21. package/lib/module/hooks/useWorkoutById.js +1 -4
  22. package/lib/module/modules.js +1 -0
  23. package/lib/module/specs/ElectrocardiogramModule.nitro.js +1 -0
  24. package/lib/module/types/ElectrocardiogramSample.js +1 -0
  25. package/lib/module/utils/getMostRecentWorkout.js +1 -3
  26. package/lib/module/utils/getWorkoutById.js +1 -3
  27. package/lib/typescript/healthkit.d.ts +3 -1
  28. package/lib/typescript/healthkit.ios.d.ts +5 -1
  29. package/lib/typescript/hooks/useMostRecentWorkout.d.ts +1 -4
  30. package/lib/typescript/modules.d.ts +2 -0
  31. package/lib/typescript/specs/ElectrocardiogramModule.nitro.d.ts +8 -0
  32. package/lib/typescript/specs/WorkoutProxy.nitro.d.ts +11 -0
  33. package/lib/typescript/types/ElectrocardiogramSample.d.ts +39 -0
  34. package/lib/typescript/types/Workouts.d.ts +0 -8
  35. package/lib/typescript/utils/getMostRecentWorkout.d.ts +1 -2
  36. package/lib/typescript/utils/getWorkoutById.d.ts +1 -2
  37. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +136 -87
  38. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +924 -493
  39. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +29 -0
  40. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.mm +16 -8
  41. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.swift +31 -16
  42. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +6 -4
  43. package/nitrogen/generated/ios/c++/HybridCharacteristicTypeModuleSpecSwift.hpp +4 -2
  44. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +7 -5
  45. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +6 -4
  46. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.cpp +11 -0
  47. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +152 -0
  48. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +7 -5
  49. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +5 -3
  50. package/nitrogen/generated/ios/c++/HybridSourceProxySpecSwift.hpp +3 -1
  51. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +7 -5
  52. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +50 -22
  53. package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +9 -7
  54. package/nitrogen/generated/ios/swift/CategorySample.swift +4 -2
  55. package/nitrogen/generated/ios/swift/CategorySampleForSaving.swift +2 -1
  56. package/nitrogen/generated/ios/swift/CorrelationObject.swift +2 -0
  57. package/nitrogen/generated/ios/swift/DeletedSample.swift +2 -1
  58. package/nitrogen/generated/ios/swift/Device.swift +16 -8
  59. package/nitrogen/generated/ios/swift/ECGQueryOptionsWithAnchor.swift +179 -0
  60. package/nitrogen/generated/ios/swift/ECGQueryOptionsWithSortOrder.swift +184 -0
  61. package/nitrogen/generated/ios/swift/ElectrocardiogramClassification.swift +60 -0
  62. package/nitrogen/generated/ios/swift/ElectrocardiogramLead.swift +40 -0
  63. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +298 -0
  64. package/nitrogen/generated/ios/swift/ElectrocardiogramSamplesWithAnchorResponse.swift +81 -0
  65. package/nitrogen/generated/ios/swift/ElectrocardiogramSymptomsStatus.swift +44 -0
  66. package/nitrogen/generated/ios/swift/ElectrocardiogramVoltage.swift +57 -0
  67. package/nitrogen/generated/ios/swift/FilterForSamples.swift +2 -0
  68. package/nitrogen/generated/ios/swift/Func_void_AuthorizationRequestStatus.swift +1 -0
  69. package/nitrogen/generated/ios/swift/Func_void_BiologicalSex.swift +1 -0
  70. package/nitrogen/generated/ios/swift/Func_void_BloodType.swift +1 -0
  71. package/nitrogen/generated/ios/swift/Func_void_CategorySamplesWithAnchorResponse.swift +1 -0
  72. package/nitrogen/generated/ios/swift/Func_void_ElectrocardiogramSamplesWithAnchorResponse.swift +47 -0
  73. package/nitrogen/generated/ios/swift/Func_void_FitzpatrickSkinType.swift +1 -0
  74. package/nitrogen/generated/ios/swift/Func_void_HeartbeatSeriesSamplesWithAnchorResponse.swift +1 -0
  75. package/nitrogen/generated/ios/swift/Func_void_OnChangeCallbackArgs.swift +1 -0
  76. package/nitrogen/generated/ios/swift/Func_void_QuantitySamplesWithAnchorResponse.swift +1 -0
  77. package/nitrogen/generated/ios/swift/Func_void_QueryStatisticsResponse.swift +1 -0
  78. package/nitrogen/generated/ios/swift/Func_void_QueryWorkoutSamplesWithAnchorResponse.swift +1 -0
  79. package/nitrogen/generated/ios/swift/Func_void_WheelchairUse.swift +1 -0
  80. package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -0
  81. package/nitrogen/generated/ios/swift/Func_void_double.swift +1 -0
  82. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -0
  83. package/nitrogen/generated/ios/swift/Func_void_std__optional_QueryStatisticsResponse_.swift +54 -0
  84. package/nitrogen/generated/ios/swift/Func_void_std__optional_WorkoutPlan_.swift +3 -1
  85. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__chrono__system_clock__time_point_.swift +3 -1
  86. package/nitrogen/generated/ios/swift/{Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_.swift → Func_void_std__shared_ptr_HybridWorkoutProxySpec_.swift} +9 -8
  87. package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__QueryStatisticsResponse_.swift +55 -0
  88. package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__bool_.swift +2 -1
  89. package/nitrogen/generated/ios/swift/Func_void_std__vector_CategorySample_.swift +1 -0
  90. package/nitrogen/generated/ios/swift/Func_void_std__vector_CorrelationSample_.swift +1 -0
  91. package/nitrogen/generated/ios/swift/Func_void_std__vector_ElectrocardiogramSample_.swift +47 -0
  92. package/nitrogen/generated/ios/swift/Func_void_std__vector_HeartbeatSeriesSample_.swift +1 -0
  93. package/nitrogen/generated/ios/swift/Func_void_std__vector_IdentifierWithUnit_.swift +1 -0
  94. package/nitrogen/generated/ios/swift/Func_void_std__vector_QuantitySample_.swift +1 -0
  95. package/nitrogen/generated/ios/swift/Func_void_std__vector_QueryStatisticsResponse_.swift +1 -0
  96. package/nitrogen/generated/ios/swift/Func_void_std__vector_StateOfMindSample_.swift +1 -0
  97. package/nitrogen/generated/ios/swift/Func_void_std__vector_WorkoutRoute_.swift +1 -0
  98. package/nitrogen/generated/ios/swift/{Func_void_std__vector_std__shared_ptr_margelo__nitro__healthkit__HybridSourceProxySpec__.swift → Func_void_std__vector_std__shared_ptr_HybridSourceProxySpec__.swift} +9 -8
  99. package/nitrogen/generated/ios/swift/{Func_void_std__vector_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec__.swift → Func_void_std__vector_std__shared_ptr_HybridWorkoutProxySpec__.swift} +9 -8
  100. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +6 -3
  101. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +2 -1
  102. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +17 -7
  103. package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec.swift +2 -1
  104. package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec_cxx.swift +15 -6
  105. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -1
  106. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +24 -15
  107. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec.swift +2 -1
  108. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec_cxx.swift +15 -6
  109. package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec.swift +50 -0
  110. package/nitrogen/generated/ios/swift/HybridElectrocardiogramModuleSpec_cxx.swift +162 -0
  111. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec.swift +2 -1
  112. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec_cxx.swift +17 -7
  113. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +2 -1
  114. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +21 -9
  115. package/nitrogen/generated/ios/swift/HybridSourceProxySpec.swift +2 -1
  116. package/nitrogen/generated/ios/swift/HybridSourceProxySpec_cxx.swift +17 -7
  117. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec.swift +2 -1
  118. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec_cxx.swift +19 -8
  119. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +8 -5
  120. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +108 -41
  121. package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec.swift +2 -1
  122. package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec_cxx.swift +31 -22
  123. package/nitrogen/generated/ios/swift/OnChangeCallbackArgs.swift +2 -1
  124. package/nitrogen/generated/ios/swift/PredicateForSamples.swift +2 -0
  125. package/nitrogen/generated/ios/swift/PredicateForWorkouts.swift +2 -0
  126. package/nitrogen/generated/ios/swift/PredicateFromWorkout.swift +3 -3
  127. package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +2 -1
  128. package/nitrogen/generated/ios/swift/PredicateWithStartAndEnd.swift +4 -2
  129. package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -2
  130. package/nitrogen/generated/ios/swift/QuantitySampleForSaving.swift +2 -1
  131. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchor.swift +4 -2
  132. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchorAndUnit.swift +6 -3
  133. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrder.swift +2 -1
  134. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrderAndUnit.swift +4 -2
  135. package/nitrogen/generated/ios/swift/QueryStatisticsResponse.swift +18 -9
  136. package/nitrogen/generated/ios/swift/QueryWorkoutSamplesWithAnchorResponse.swift +7 -7
  137. package/nitrogen/generated/ios/swift/SampleForSaving.swift +2 -0
  138. package/nitrogen/generated/ios/swift/SourceRevision.swift +13 -9
  139. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +6 -3
  140. package/nitrogen/generated/ios/swift/StatisticsQueryOptions.swift +4 -2
  141. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_FilterForSamplesAnd_FilterForSamplesOr.swift +2 -0
  142. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_WorkoutActivityTypePredicate_WorkoutDurationPredicate_PredicateForWorkoutsOr_PredicateForWorkoutsAnd.swift +2 -0
  143. package/nitrogen/generated/ios/swift/Variant_String_Double_Bool_Date.swift +2 -0
  144. package/nitrogen/generated/ios/swift/WorkoutQueryOptions.swift +4 -61
  145. package/nitrogen/generated/ios/swift/WorkoutQueryOptionsWithAnchor.swift +6 -62
  146. package/nitrogen/generated/ios/swift/WorkoutRoute.swift +2 -1
  147. package/nitrogen/generated/ios/swift/WorkoutSample.swift +12 -123
  148. package/nitrogen/generated/shared/c++/AuthorizationRequestStatus.hpp +9 -11
  149. package/nitrogen/generated/shared/c++/AuthorizationStatus.hpp +9 -11
  150. package/nitrogen/generated/shared/c++/BiologicalSex.hpp +9 -11
  151. package/nitrogen/generated/shared/c++/BloodType.hpp +9 -11
  152. package/nitrogen/generated/shared/c++/CategorySample.hpp +14 -16
  153. package/nitrogen/generated/shared/c++/CategorySampleForSaving.hpp +11 -13
  154. package/nitrogen/generated/shared/c++/CategorySamplesWithAnchorResponse.hpp +11 -13
  155. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +131 -133
  156. package/nitrogen/generated/shared/c++/ComparisonPredicateOperator.hpp +26 -13
  157. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +12 -14
  158. package/nitrogen/generated/shared/c++/CorrelationTypeIdentifier.hpp +7 -9
  159. package/nitrogen/generated/shared/c++/DeletedSample.hpp +5 -7
  160. package/nitrogen/generated/shared/c++/Device.hpp +5 -7
  161. package/nitrogen/generated/shared/c++/ECGQueryOptionsWithAnchor.hpp +101 -0
  162. package/nitrogen/generated/shared/c++/ECGQueryOptionsWithSortOrder.hpp +100 -0
  163. package/nitrogen/generated/shared/c++/ElectrocardiogramClassification.hpp +96 -0
  164. package/nitrogen/generated/shared/c++/ElectrocardiogramLead.hpp +76 -0
  165. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +135 -0
  166. package/nitrogen/generated/shared/c++/ElectrocardiogramSamplesWithAnchorResponse.hpp +81 -0
  167. package/nitrogen/generated/shared/c++/ElectrocardiogramSymptomsStatus.hpp +80 -0
  168. package/nitrogen/generated/shared/c++/ElectrocardiogramVoltage.hpp +76 -0
  169. package/nitrogen/generated/shared/c++/FilterForSamplesAnd.hpp +9 -11
  170. package/nitrogen/generated/shared/c++/FilterForSamplesOr.hpp +9 -11
  171. package/nitrogen/generated/shared/c++/FitzpatrickSkinType.hpp +9 -11
  172. package/nitrogen/generated/shared/c++/Heartbeat.hpp +4 -6
  173. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +15 -17
  174. package/nitrogen/generated/shared/c++/HeartbeatSeriesSamplesWithAnchorResponse.hpp +11 -13
  175. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +2 -2
  176. package/nitrogen/generated/shared/c++/HybridCharacteristicTypeModuleSpec.hpp +1 -1
  177. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -4
  178. package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.hpp +2 -2
  179. package/nitrogen/generated/shared/c++/HybridElectrocardiogramModuleSpec.cpp +22 -0
  180. package/nitrogen/generated/shared/c++/HybridElectrocardiogramModuleSpec.hpp +76 -0
  181. package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.hpp +3 -3
  182. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +3 -3
  183. package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.hpp +3 -3
  184. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +6 -4
  185. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +18 -9
  186. package/nitrogen/generated/shared/c++/HybridWorkoutsModuleSpec.hpp +4 -4
  187. package/nitrogen/generated/shared/c++/IdentifierWithUnit.hpp +4 -6
  188. package/nitrogen/generated/shared/c++/IntervalComponents.hpp +4 -6
  189. package/nitrogen/generated/shared/c++/LocationForSaving.hpp +4 -6
  190. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +397 -399
  191. package/nitrogen/generated/shared/c++/OnChangeCallbackArgs.hpp +8 -10
  192. package/nitrogen/generated/shared/c++/PredicateForWorkoutsAnd.hpp +9 -11
  193. package/nitrogen/generated/shared/c++/PredicateForWorkoutsOr.hpp +9 -11
  194. package/nitrogen/generated/shared/c++/PredicateFromWorkout.hpp +6 -8
  195. package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +9 -11
  196. package/nitrogen/generated/shared/c++/PredicateWithMetadataOperator.hpp +11 -13
  197. package/nitrogen/generated/shared/c++/PredicateWithStartAndEnd.hpp +5 -7
  198. package/nitrogen/generated/shared/c++/PredicateWithUUID.hpp +4 -6
  199. package/nitrogen/generated/shared/c++/PredicateWithUUIDs.hpp +5 -7
  200. package/nitrogen/generated/shared/c++/Quantity.hpp +4 -6
  201. package/nitrogen/generated/shared/c++/QuantityDateInterval.hpp +4 -6
  202. package/nitrogen/generated/shared/c++/QuantitySample.hpp +14 -16
  203. package/nitrogen/generated/shared/c++/QuantitySampleForSaving.hpp +11 -13
  204. package/nitrogen/generated/shared/c++/QuantitySamplesWithAnchorResponse.hpp +11 -13
  205. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +241 -243
  206. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchor.hpp +9 -11
  207. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchorAndUnit.hpp +9 -11
  208. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrder.hpp +8 -10
  209. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrderAndUnit.hpp +9 -11
  210. package/nitrogen/generated/shared/c++/QueryStatisticsResponse.hpp +26 -28
  211. package/nitrogen/generated/shared/c++/QueryWorkoutSamplesWithAnchorResponse.hpp +10 -12
  212. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +383 -385
  213. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +373 -375
  214. package/nitrogen/generated/shared/c++/Source.hpp +4 -6
  215. package/nitrogen/generated/shared/c++/SourceRevision.hpp +7 -9
  216. package/nitrogen/generated/shared/c++/StateOfMindAssociation.hpp +10 -12
  217. package/nitrogen/generated/shared/c++/StateOfMindKind.hpp +14 -13
  218. package/nitrogen/generated/shared/c++/StateOfMindLabel.hpp +10 -12
  219. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +24 -26
  220. package/nitrogen/generated/shared/c++/StateOfMindValenceClassification.hpp +10 -12
  221. package/nitrogen/generated/shared/c++/StatisticsOptions.hpp +17 -19
  222. package/nitrogen/generated/shared/c++/StatisticsQueryOptions.hpp +9 -11
  223. package/nitrogen/generated/shared/c++/UpdateFrequency.hpp +10 -12
  224. package/nitrogen/generated/shared/c++/WheelchairUse.hpp +9 -11
  225. package/nitrogen/generated/shared/c++/WorkoutActivity.hpp +4 -6
  226. package/nitrogen/generated/shared/c++/WorkoutActivityType.hpp +96 -13
  227. package/nitrogen/generated/shared/c++/WorkoutActivityTypePredicate.hpp +7 -9
  228. package/nitrogen/generated/shared/c++/WorkoutConfiguration.hpp +11 -13
  229. package/nitrogen/generated/shared/c++/WorkoutDurationPredicate.hpp +7 -9
  230. package/nitrogen/generated/shared/c++/WorkoutEvent.hpp +7 -9
  231. package/nitrogen/generated/shared/c++/WorkoutEventType.hpp +10 -12
  232. package/nitrogen/generated/shared/c++/WorkoutPlan.hpp +7 -9
  233. package/nitrogen/generated/shared/c++/WorkoutQueryOptions.hpp +10 -21
  234. package/nitrogen/generated/shared/c++/WorkoutQueryOptionsWithAnchor.hpp +11 -21
  235. package/nitrogen/generated/shared/c++/WorkoutRoute.hpp +9 -11
  236. package/nitrogen/generated/shared/c++/WorkoutRouteLocation.hpp +4 -6
  237. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +25 -43
  238. package/nitrogen/generated/shared/c++/WorkoutSessionLocationType.hpp +10 -12
  239. package/nitrogen/generated/shared/c++/WorkoutTotals.hpp +4 -6
  240. package/package.json +11 -11
  241. package/src/healthkit.ios.ts +9 -0
  242. package/src/healthkit.ts +16 -0
  243. package/src/hooks/useMostRecentWorkout.ts +3 -17
  244. package/src/hooks/useWorkoutById.ts +1 -4
  245. package/src/modules.ts +6 -0
  246. package/src/specs/ElectrocardiogramModule.nitro.ts +18 -0
  247. package/src/specs/WorkoutProxy.nitro.ts +18 -1
  248. package/src/types/ElectrocardiogramSample.ts +60 -0
  249. package/src/types/Workouts.ts +0 -8
  250. package/src/utils/getMostRecentWorkout.ts +1 -6
  251. package/src/utils/getWorkoutById.ts +1 -6
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// HybridElectrocardiogramModuleSpec.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/HybridObject.hpp>)
11
+ #include <NitroModules/HybridObject.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+
16
+ // Forward declaration of `ElectrocardiogramSample` to properly resolve imports.
17
+ namespace margelo::nitro::healthkit { struct ElectrocardiogramSample; }
18
+ // Forward declaration of `ECGQueryOptionsWithSortOrder` to properly resolve imports.
19
+ namespace margelo::nitro::healthkit { struct ECGQueryOptionsWithSortOrder; }
20
+ // Forward declaration of `ElectrocardiogramSamplesWithAnchorResponse` to properly resolve imports.
21
+ namespace margelo::nitro::healthkit { struct ElectrocardiogramSamplesWithAnchorResponse; }
22
+ // Forward declaration of `ECGQueryOptionsWithAnchor` to properly resolve imports.
23
+ namespace margelo::nitro::healthkit { struct ECGQueryOptionsWithAnchor; }
24
+
25
+ #include "ElectrocardiogramSample.hpp"
26
+ #include <vector>
27
+ #include <NitroModules/Promise.hpp>
28
+ #include "ECGQueryOptionsWithSortOrder.hpp"
29
+ #include <optional>
30
+ #include "ElectrocardiogramSamplesWithAnchorResponse.hpp"
31
+ #include "ECGQueryOptionsWithAnchor.hpp"
32
+
33
+ namespace margelo::nitro::healthkit {
34
+
35
+ using namespace margelo::nitro;
36
+
37
+ /**
38
+ * An abstract base class for `ElectrocardiogramModule`
39
+ * Inherit this class to create instances of `HybridElectrocardiogramModuleSpec` in C++.
40
+ * You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
41
+ * @example
42
+ * ```cpp
43
+ * class HybridElectrocardiogramModule: public HybridElectrocardiogramModuleSpec {
44
+ * public:
45
+ * HybridElectrocardiogramModule(...): HybridObject(TAG) { ... }
46
+ * // ...
47
+ * };
48
+ * ```
49
+ */
50
+ class HybridElectrocardiogramModuleSpec: public virtual HybridObject {
51
+ public:
52
+ // Constructor
53
+ explicit HybridElectrocardiogramModuleSpec(): HybridObject(TAG) { }
54
+
55
+ // Destructor
56
+ ~HybridElectrocardiogramModuleSpec() override = default;
57
+
58
+ public:
59
+ // Properties
60
+
61
+
62
+ public:
63
+ // Methods
64
+ virtual std::shared_ptr<Promise<std::vector<ElectrocardiogramSample>>> queryElectrocardiogramSamples(const std::optional<ECGQueryOptionsWithSortOrder>& options) = 0;
65
+ virtual std::shared_ptr<Promise<ElectrocardiogramSamplesWithAnchorResponse>> queryElectrocardiogramSamplesWithAnchor(const ECGQueryOptionsWithAnchor& options) = 0;
66
+
67
+ protected:
68
+ // Hybrid Setup
69
+ void loadHybridMethods() override;
70
+
71
+ protected:
72
+ // Tag for logging
73
+ static constexpr auto TAG = "ElectrocardiogramModule";
74
+ };
75
+
76
+ } // namespace margelo::nitro::healthkit
@@ -22,11 +22,11 @@ namespace margelo::nitro::healthkit { struct HeartbeatSeriesSamplesWithAnchorRes
22
22
  // Forward declaration of `QueryOptionsWithAnchor` to properly resolve imports.
23
23
  namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
24
24
 
25
- #include <NitroModules/Promise.hpp>
26
- #include <vector>
27
25
  #include "HeartbeatSeriesSample.hpp"
28
- #include <optional>
26
+ #include <vector>
27
+ #include <NitroModules/Promise.hpp>
29
28
  #include "QueryOptionsWithSortOrder.hpp"
29
+ #include <optional>
30
30
  #include "HeartbeatSeriesSamplesWithAnchorResponse.hpp"
31
31
  #include "QueryOptionsWithAnchor.hpp"
32
32
 
@@ -53,7 +53,6 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
53
53
  #include <NitroModules/Promise.hpp>
54
54
  #include <chrono>
55
55
  #include <NitroModules/AnyMap.hpp>
56
- #include <variant>
57
56
  #include "PredicateWithUUID.hpp"
58
57
  #include "PredicateWithUUIDs.hpp"
59
58
  #include "PredicateWithMetadataKey.hpp"
@@ -61,10 +60,11 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
61
60
  #include "PredicateFromWorkout.hpp"
62
61
  #include "FilterForSamplesAnd.hpp"
63
62
  #include "FilterForSamplesOr.hpp"
64
- #include <vector>
63
+ #include <variant>
65
64
  #include "QuantitySample.hpp"
66
- #include <optional>
65
+ #include <vector>
67
66
  #include "QueryOptionsWithSortOrderAndUnit.hpp"
67
+ #include <optional>
68
68
  #include "QueryStatisticsResponse.hpp"
69
69
  #include "StatisticsOptions.hpp"
70
70
  #include "StatisticsQueryOptions.hpp"
@@ -26,11 +26,11 @@ namespace margelo::nitro::healthkit { enum class StateOfMindAssociation; }
26
26
  // Forward declaration of `AnyMap` to properly resolve imports.
27
27
  namespace NitroModules { class AnyMap; }
28
28
 
29
- #include <NitroModules/Promise.hpp>
30
- #include <vector>
31
29
  #include "StateOfMindSample.hpp"
32
- #include <optional>
30
+ #include <vector>
31
+ #include <NitroModules/Promise.hpp>
33
32
  #include "QueryOptionsWithSortOrder.hpp"
33
+ #include <optional>
34
34
  #include <chrono>
35
35
  #include "StateOfMindKind.hpp"
36
36
  #include "StateOfMindLabel.hpp"
@@ -14,14 +14,14 @@ namespace margelo::nitro::healthkit {
14
14
  HybridObject::loadHybridMethods();
15
15
  // load custom methods/properties
16
16
  registerHybrids(this, [](Prototype& prototype) {
17
- prototype.registerHybridGetter("uuid", &HybridWorkoutProxySpec::getUuid);
18
- prototype.registerHybridGetter("device", &HybridWorkoutProxySpec::getDevice);
19
- prototype.registerHybridGetter("workoutActivityType", &HybridWorkoutProxySpec::getWorkoutActivityType);
20
- prototype.registerHybridGetter("duration", &HybridWorkoutProxySpec::getDuration);
21
17
  prototype.registerHybridGetter("totalDistance", &HybridWorkoutProxySpec::getTotalDistance);
22
18
  prototype.registerHybridGetter("totalEnergyBurned", &HybridWorkoutProxySpec::getTotalEnergyBurned);
23
19
  prototype.registerHybridGetter("totalSwimmingStrokeCount", &HybridWorkoutProxySpec::getTotalSwimmingStrokeCount);
24
20
  prototype.registerHybridGetter("totalFlightsClimbed", &HybridWorkoutProxySpec::getTotalFlightsClimbed);
21
+ prototype.registerHybridGetter("uuid", &HybridWorkoutProxySpec::getUuid);
22
+ prototype.registerHybridGetter("device", &HybridWorkoutProxySpec::getDevice);
23
+ prototype.registerHybridGetter("workoutActivityType", &HybridWorkoutProxySpec::getWorkoutActivityType);
24
+ prototype.registerHybridGetter("duration", &HybridWorkoutProxySpec::getDuration);
25
25
  prototype.registerHybridGetter("startDate", &HybridWorkoutProxySpec::getStartDate);
26
26
  prototype.registerHybridGetter("endDate", &HybridWorkoutProxySpec::getEndDate);
27
27
  prototype.registerHybridGetter("metadata", &HybridWorkoutProxySpec::getMetadata);
@@ -32,6 +32,8 @@ namespace margelo::nitro::healthkit {
32
32
  prototype.registerHybridMethod("saveWorkoutRoute", &HybridWorkoutProxySpec::saveWorkoutRoute);
33
33
  prototype.registerHybridMethod("getWorkoutPlan", &HybridWorkoutProxySpec::getWorkoutPlan);
34
34
  prototype.registerHybridMethod("getWorkoutRoutes", &HybridWorkoutProxySpec::getWorkoutRoutes);
35
+ prototype.registerHybridMethod("getStatistic", &HybridWorkoutProxySpec::getStatistic);
36
+ prototype.registerHybridMethod("getAllStatistics", &HybridWorkoutProxySpec::getAllStatistics);
35
37
  });
36
38
  }
37
39
 
@@ -13,12 +13,12 @@
13
13
  #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
14
  #endif
15
15
 
16
+ // Forward declaration of `Quantity` to properly resolve imports.
17
+ namespace margelo::nitro::healthkit { struct Quantity; }
16
18
  // Forward declaration of `Device` to properly resolve imports.
17
19
  namespace margelo::nitro::healthkit { struct Device; }
18
20
  // Forward declaration of `WorkoutActivityType` to properly resolve imports.
19
21
  namespace margelo::nitro::healthkit { enum class WorkoutActivityType; }
20
- // Forward declaration of `Quantity` to properly resolve imports.
21
- namespace margelo::nitro::healthkit { struct Quantity; }
22
22
  // Forward declaration of `AnyMap` to properly resolve imports.
23
23
  namespace NitroModules { class AnyMap; }
24
24
  // Forward declaration of `SourceRevision` to properly resolve imports.
@@ -35,23 +35,30 @@ namespace margelo::nitro::healthkit { struct LocationForSaving; }
35
35
  namespace margelo::nitro::healthkit { struct WorkoutPlan; }
36
36
  // Forward declaration of `WorkoutRoute` to properly resolve imports.
37
37
  namespace margelo::nitro::healthkit { struct WorkoutRoute; }
38
+ // Forward declaration of `QueryStatisticsResponse` to properly resolve imports.
39
+ namespace margelo::nitro::healthkit { struct QueryStatisticsResponse; }
40
+ // Forward declaration of `QuantityTypeIdentifier` to properly resolve imports.
41
+ namespace margelo::nitro::healthkit { enum class QuantityTypeIdentifier; }
38
42
 
39
- #include <string>
43
+ #include "Quantity.hpp"
40
44
  #include <optional>
45
+ #include <string>
41
46
  #include "Device.hpp"
42
47
  #include "WorkoutActivityType.hpp"
43
- #include "Quantity.hpp"
44
48
  #include <chrono>
45
49
  #include <NitroModules/AnyMap.hpp>
46
50
  #include "SourceRevision.hpp"
47
- #include <vector>
48
51
  #include "WorkoutEvent.hpp"
52
+ #include <vector>
49
53
  #include "WorkoutActivity.hpp"
50
54
  #include "WorkoutSample.hpp"
51
55
  #include <NitroModules/Promise.hpp>
52
56
  #include "LocationForSaving.hpp"
53
57
  #include "WorkoutPlan.hpp"
54
58
  #include "WorkoutRoute.hpp"
59
+ #include "QueryStatisticsResponse.hpp"
60
+ #include "QuantityTypeIdentifier.hpp"
61
+ #include <unordered_map>
55
62
 
56
63
  namespace margelo::nitro::healthkit {
57
64
 
@@ -80,14 +87,14 @@ namespace margelo::nitro::healthkit {
80
87
 
81
88
  public:
82
89
  // Properties
83
- virtual std::string getUuid() = 0;
84
- virtual std::optional<Device> getDevice() = 0;
85
- virtual WorkoutActivityType getWorkoutActivityType() = 0;
86
- virtual Quantity getDuration() = 0;
87
90
  virtual std::optional<Quantity> getTotalDistance() = 0;
88
91
  virtual std::optional<Quantity> getTotalEnergyBurned() = 0;
89
92
  virtual std::optional<Quantity> getTotalSwimmingStrokeCount() = 0;
90
93
  virtual std::optional<Quantity> getTotalFlightsClimbed() = 0;
94
+ virtual std::string getUuid() = 0;
95
+ virtual std::optional<Device> getDevice() = 0;
96
+ virtual WorkoutActivityType getWorkoutActivityType() = 0;
97
+ virtual Quantity getDuration() = 0;
91
98
  virtual std::chrono::system_clock::time_point getStartDate() = 0;
92
99
  virtual std::chrono::system_clock::time_point getEndDate() = 0;
93
100
  virtual std::optional<std::shared_ptr<AnyMap>> getMetadata() = 0;
@@ -101,6 +108,8 @@ namespace margelo::nitro::healthkit {
101
108
  virtual std::shared_ptr<Promise<bool>> saveWorkoutRoute(const std::vector<LocationForSaving>& locations) = 0;
102
109
  virtual std::shared_ptr<Promise<std::optional<WorkoutPlan>>> getWorkoutPlan() = 0;
103
110
  virtual std::shared_ptr<Promise<std::vector<WorkoutRoute>>> getWorkoutRoutes() = 0;
111
+ virtual std::shared_ptr<Promise<std::optional<QueryStatisticsResponse>>> getStatistic(QuantityTypeIdentifier quantityType, const std::optional<std::string>& unitOverride) = 0;
112
+ virtual std::shared_ptr<Promise<std::unordered_map<std::string, QueryStatisticsResponse>>> getAllStatistics() = 0;
104
113
 
105
114
  protected:
106
115
  // Hybrid Setup
@@ -32,12 +32,12 @@ namespace margelo::nitro::healthkit { struct WorkoutQueryOptions; }
32
32
  // Forward declaration of `WorkoutConfiguration` to properly resolve imports.
33
33
  namespace margelo::nitro::healthkit { struct WorkoutConfiguration; }
34
34
 
35
- #include <NitroModules/Promise.hpp>
36
35
  #include <memory>
37
36
  #include "HybridWorkoutProxySpec.hpp"
37
+ #include <NitroModules/Promise.hpp>
38
38
  #include "WorkoutActivityType.hpp"
39
- #include <vector>
40
39
  #include "QuantitySampleForSaving.hpp"
40
+ #include <vector>
41
41
  #include <chrono>
42
42
  #include "WorkoutTotals.hpp"
43
43
  #include <NitroModules/AnyMap.hpp>
@@ -77,9 +77,9 @@ namespace margelo::nitro::healthkit {
77
77
 
78
78
  public:
79
79
  // Methods
80
- virtual std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>> saveWorkoutSample(WorkoutActivityType workoutActivityType, const std::vector<QuantitySampleForSaving>& quantities, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const WorkoutTotals& totals, const std::shared_ptr<AnyMap>& metadata) = 0;
80
+ virtual std::shared_ptr<Promise<std::shared_ptr<HybridWorkoutProxySpec>>> saveWorkoutSample(WorkoutActivityType workoutActivityType, const std::vector<QuantitySampleForSaving>& quantities, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const WorkoutTotals& totals, const std::shared_ptr<AnyMap>& metadata) = 0;
81
81
  virtual std::shared_ptr<Promise<QueryWorkoutSamplesWithAnchorResponse>> queryWorkoutSamplesWithAnchor(const WorkoutQueryOptionsWithAnchor& options) = 0;
82
- virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>> queryWorkoutSamples(const WorkoutQueryOptions& options) = 0;
82
+ virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridWorkoutProxySpec>>>> queryWorkoutSamples(const WorkoutQueryOptions& options) = 0;
83
83
  virtual std::shared_ptr<Promise<bool>> startWatchAppWithWorkoutConfiguration(const WorkoutConfiguration& workoutConfiguration) = 0;
84
84
 
85
85
  protected:
@@ -41,19 +41,17 @@ namespace margelo::nitro::healthkit {
41
41
 
42
42
  namespace margelo::nitro {
43
43
 
44
- using namespace margelo::nitro::healthkit;
45
-
46
44
  // C++ IdentifierWithUnit <> JS IdentifierWithUnit (object)
47
45
  template <>
48
- struct JSIConverter<IdentifierWithUnit> final {
49
- static inline IdentifierWithUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
+ struct JSIConverter<margelo::nitro::healthkit::IdentifierWithUnit> final {
47
+ static inline margelo::nitro::healthkit::IdentifierWithUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
50
48
  jsi::Object obj = arg.asObject(runtime);
51
- return IdentifierWithUnit(
49
+ return margelo::nitro::healthkit::IdentifierWithUnit(
52
50
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "typeIdentifier")),
53
51
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "unit"))
54
52
  );
55
53
  }
56
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const IdentifierWithUnit& arg) {
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::IdentifierWithUnit& arg) {
57
55
  jsi::Object obj(runtime);
58
56
  obj.setProperty(runtime, "typeIdentifier", JSIConverter<std::string>::toJSI(runtime, arg.typeIdentifier));
59
57
  obj.setProperty(runtime, "unit", JSIConverter<std::string>::toJSI(runtime, arg.unit));
@@ -44,14 +44,12 @@ namespace margelo::nitro::healthkit {
44
44
 
45
45
  namespace margelo::nitro {
46
46
 
47
- using namespace margelo::nitro::healthkit;
48
-
49
47
  // C++ IntervalComponents <> JS IntervalComponents (object)
50
48
  template <>
51
- struct JSIConverter<IntervalComponents> final {
52
- static inline IntervalComponents fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
49
+ struct JSIConverter<margelo::nitro::healthkit::IntervalComponents> final {
50
+ static inline margelo::nitro::healthkit::IntervalComponents fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
53
51
  jsi::Object obj = arg.asObject(runtime);
54
- return IntervalComponents(
52
+ return margelo::nitro::healthkit::IntervalComponents(
55
53
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "minute")),
56
54
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "hour")),
57
55
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "day")),
@@ -59,7 +57,7 @@ namespace margelo::nitro {
59
57
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "year"))
60
58
  );
61
59
  }
62
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const IntervalComponents& arg) {
60
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::IntervalComponents& arg) {
63
61
  jsi::Object obj(runtime);
64
62
  obj.setProperty(runtime, "minute", JSIConverter<std::optional<double>>::toJSI(runtime, arg.minute));
65
63
  obj.setProperty(runtime, "hour", JSIConverter<std::optional<double>>::toJSI(runtime, arg.hour));
@@ -47,14 +47,12 @@ namespace margelo::nitro::healthkit {
47
47
 
48
48
  namespace margelo::nitro {
49
49
 
50
- using namespace margelo::nitro::healthkit;
51
-
52
50
  // C++ LocationForSaving <> JS LocationForSaving (object)
53
51
  template <>
54
- struct JSIConverter<LocationForSaving> final {
55
- static inline LocationForSaving fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
52
+ struct JSIConverter<margelo::nitro::healthkit::LocationForSaving> final {
53
+ static inline margelo::nitro::healthkit::LocationForSaving fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
56
54
  jsi::Object obj = arg.asObject(runtime);
57
- return LocationForSaving(
55
+ return margelo::nitro::healthkit::LocationForSaving(
58
56
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "altitude")),
59
57
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "course")),
60
58
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "date")),
@@ -65,7 +63,7 @@ namespace margelo::nitro {
65
63
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "verticalAccuracy"))
66
64
  );
67
65
  }
68
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const LocationForSaving& arg) {
66
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::LocationForSaving& arg) {
69
67
  jsi::Object obj(runtime);
70
68
  obj.setProperty(runtime, "altitude", JSIConverter<double>::toJSI(runtime, arg.altitude));
71
69
  obj.setProperty(runtime, "course", JSIConverter<double>::toJSI(runtime, arg.course));