@kingstinct/react-native-healthkit 10.1.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (206) hide show
  1. package/ios/CoreModule.swift +5 -15
  2. package/ios/CorrelationTypeModule.swift +7 -2
  3. package/ios/QuantityTypeModule.swift +62 -110
  4. package/ios/Serializers.swift +39 -66
  5. package/ios/WorkoutProxy.swift +38 -20
  6. package/ios/WorkoutsModule.swift +7 -18
  7. package/lib/commonjs/hooks/useMostRecentWorkout.js +2 -9
  8. package/lib/commonjs/hooks/useWorkoutById.js +1 -4
  9. package/lib/commonjs/utils/getMostRecentWorkout.js +1 -3
  10. package/lib/commonjs/utils/getWorkoutById.js +1 -3
  11. package/lib/module/hooks/useMostRecentWorkout.js +3 -10
  12. package/lib/module/hooks/useWorkoutById.js +1 -4
  13. package/lib/module/utils/getMostRecentWorkout.js +1 -3
  14. package/lib/module/utils/getWorkoutById.js +1 -3
  15. package/lib/typescript/healthkit.d.ts +1 -1
  16. package/lib/typescript/healthkit.ios.d.ts +1 -1
  17. package/lib/typescript/hooks/useMostRecentWorkout.d.ts +1 -4
  18. package/lib/typescript/specs/WorkoutProxy.nitro.d.ts +11 -0
  19. package/lib/typescript/types/Workouts.d.ts +0 -8
  20. package/lib/typescript/utils/getMostRecentWorkout.d.ts +1 -2
  21. package/lib/typescript/utils/getWorkoutById.d.ts +1 -2
  22. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +103 -87
  23. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +748 -493
  24. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.mm +8 -8
  25. package/nitrogen/generated/ios/ReactNativeHealthkitAutolinking.swift +16 -16
  26. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +6 -4
  27. package/nitrogen/generated/ios/c++/HybridCharacteristicTypeModuleSpecSwift.hpp +4 -2
  28. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +7 -5
  29. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +6 -4
  30. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +7 -5
  31. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +5 -3
  32. package/nitrogen/generated/ios/c++/HybridSourceProxySpecSwift.hpp +3 -1
  33. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +7 -5
  34. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +50 -22
  35. package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +9 -7
  36. package/nitrogen/generated/ios/swift/CategorySample.swift +4 -2
  37. package/nitrogen/generated/ios/swift/CategorySampleForSaving.swift +2 -1
  38. package/nitrogen/generated/ios/swift/CorrelationObject.swift +2 -0
  39. package/nitrogen/generated/ios/swift/DeletedSample.swift +2 -1
  40. package/nitrogen/generated/ios/swift/Device.swift +16 -8
  41. package/nitrogen/generated/ios/swift/FilterForSamples.swift +2 -0
  42. package/nitrogen/generated/ios/swift/Func_void_AuthorizationRequestStatus.swift +1 -0
  43. package/nitrogen/generated/ios/swift/Func_void_BiologicalSex.swift +1 -0
  44. package/nitrogen/generated/ios/swift/Func_void_BloodType.swift +1 -0
  45. package/nitrogen/generated/ios/swift/Func_void_CategorySamplesWithAnchorResponse.swift +1 -0
  46. package/nitrogen/generated/ios/swift/Func_void_FitzpatrickSkinType.swift +1 -0
  47. package/nitrogen/generated/ios/swift/Func_void_HeartbeatSeriesSamplesWithAnchorResponse.swift +1 -0
  48. package/nitrogen/generated/ios/swift/Func_void_OnChangeCallbackArgs.swift +1 -0
  49. package/nitrogen/generated/ios/swift/Func_void_QuantitySamplesWithAnchorResponse.swift +1 -0
  50. package/nitrogen/generated/ios/swift/Func_void_QueryStatisticsResponse.swift +1 -0
  51. package/nitrogen/generated/ios/swift/Func_void_QueryWorkoutSamplesWithAnchorResponse.swift +1 -0
  52. package/nitrogen/generated/ios/swift/Func_void_WheelchairUse.swift +1 -0
  53. package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -0
  54. package/nitrogen/generated/ios/swift/Func_void_double.swift +1 -0
  55. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -0
  56. package/nitrogen/generated/ios/swift/Func_void_std__optional_QueryStatisticsResponse_.swift +54 -0
  57. package/nitrogen/generated/ios/swift/Func_void_std__optional_WorkoutPlan_.swift +3 -1
  58. package/nitrogen/generated/ios/swift/Func_void_std__optional_std__chrono__system_clock__time_point_.swift +3 -1
  59. package/nitrogen/generated/ios/swift/{Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_.swift → Func_void_std__shared_ptr_HybridWorkoutProxySpec_.swift} +9 -8
  60. package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__QueryStatisticsResponse_.swift +55 -0
  61. package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__bool_.swift +2 -1
  62. package/nitrogen/generated/ios/swift/Func_void_std__vector_CategorySample_.swift +1 -0
  63. package/nitrogen/generated/ios/swift/Func_void_std__vector_CorrelationSample_.swift +1 -0
  64. package/nitrogen/generated/ios/swift/Func_void_std__vector_HeartbeatSeriesSample_.swift +1 -0
  65. package/nitrogen/generated/ios/swift/Func_void_std__vector_IdentifierWithUnit_.swift +1 -0
  66. package/nitrogen/generated/ios/swift/Func_void_std__vector_QuantitySample_.swift +1 -0
  67. package/nitrogen/generated/ios/swift/Func_void_std__vector_QueryStatisticsResponse_.swift +1 -0
  68. package/nitrogen/generated/ios/swift/Func_void_std__vector_StateOfMindSample_.swift +1 -0
  69. package/nitrogen/generated/ios/swift/Func_void_std__vector_WorkoutRoute_.swift +1 -0
  70. 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
  71. 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
  72. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +6 -3
  73. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +2 -1
  74. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +17 -7
  75. package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec.swift +2 -1
  76. package/nitrogen/generated/ios/swift/HybridCharacteristicTypeModuleSpec_cxx.swift +15 -6
  77. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -1
  78. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +24 -15
  79. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec.swift +2 -1
  80. package/nitrogen/generated/ios/swift/HybridCorrelationTypeModuleSpec_cxx.swift +15 -6
  81. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec.swift +2 -1
  82. package/nitrogen/generated/ios/swift/HybridHeartbeatSeriesModuleSpec_cxx.swift +17 -7
  83. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +2 -1
  84. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +21 -9
  85. package/nitrogen/generated/ios/swift/HybridSourceProxySpec.swift +2 -1
  86. package/nitrogen/generated/ios/swift/HybridSourceProxySpec_cxx.swift +17 -7
  87. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec.swift +2 -1
  88. package/nitrogen/generated/ios/swift/HybridStateOfMindModuleSpec_cxx.swift +19 -8
  89. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +8 -5
  90. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +108 -41
  91. package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec.swift +2 -1
  92. package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec_cxx.swift +31 -22
  93. package/nitrogen/generated/ios/swift/OnChangeCallbackArgs.swift +2 -1
  94. package/nitrogen/generated/ios/swift/PredicateForSamples.swift +2 -0
  95. package/nitrogen/generated/ios/swift/PredicateForWorkouts.swift +2 -0
  96. package/nitrogen/generated/ios/swift/PredicateFromWorkout.swift +3 -3
  97. package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +2 -1
  98. package/nitrogen/generated/ios/swift/PredicateWithStartAndEnd.swift +4 -2
  99. package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -2
  100. package/nitrogen/generated/ios/swift/QuantitySampleForSaving.swift +2 -1
  101. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchor.swift +4 -2
  102. package/nitrogen/generated/ios/swift/QueryOptionsWithAnchorAndUnit.swift +6 -3
  103. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrder.swift +2 -1
  104. package/nitrogen/generated/ios/swift/QueryOptionsWithSortOrderAndUnit.swift +4 -2
  105. package/nitrogen/generated/ios/swift/QueryStatisticsResponse.swift +18 -9
  106. package/nitrogen/generated/ios/swift/QueryWorkoutSamplesWithAnchorResponse.swift +7 -7
  107. package/nitrogen/generated/ios/swift/SampleForSaving.swift +2 -0
  108. package/nitrogen/generated/ios/swift/SourceRevision.swift +13 -9
  109. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +6 -3
  110. package/nitrogen/generated/ios/swift/StatisticsQueryOptions.swift +4 -2
  111. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_FilterForSamplesAnd_FilterForSamplesOr.swift +2 -0
  112. package/nitrogen/generated/ios/swift/Variant_PredicateWithUUID_PredicateWithUUIDs_PredicateWithMetadataKey_PredicateWithStartAndEnd_PredicateFromWorkout_WorkoutActivityTypePredicate_WorkoutDurationPredicate_PredicateForWorkoutsOr_PredicateForWorkoutsAnd.swift +2 -0
  113. package/nitrogen/generated/ios/swift/Variant_String_Double_Bool_Date.swift +2 -0
  114. package/nitrogen/generated/ios/swift/WorkoutQueryOptions.swift +4 -61
  115. package/nitrogen/generated/ios/swift/WorkoutQueryOptionsWithAnchor.swift +6 -62
  116. package/nitrogen/generated/ios/swift/WorkoutRoute.swift +2 -1
  117. package/nitrogen/generated/ios/swift/WorkoutSample.swift +12 -123
  118. package/nitrogen/generated/shared/c++/AuthorizationRequestStatus.hpp +9 -11
  119. package/nitrogen/generated/shared/c++/AuthorizationStatus.hpp +9 -11
  120. package/nitrogen/generated/shared/c++/BiologicalSex.hpp +9 -11
  121. package/nitrogen/generated/shared/c++/BloodType.hpp +9 -11
  122. package/nitrogen/generated/shared/c++/CategorySample.hpp +14 -16
  123. package/nitrogen/generated/shared/c++/CategorySampleForSaving.hpp +11 -13
  124. package/nitrogen/generated/shared/c++/CategorySamplesWithAnchorResponse.hpp +11 -13
  125. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +131 -133
  126. package/nitrogen/generated/shared/c++/ComparisonPredicateOperator.hpp +26 -13
  127. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +12 -14
  128. package/nitrogen/generated/shared/c++/CorrelationTypeIdentifier.hpp +7 -9
  129. package/nitrogen/generated/shared/c++/DeletedSample.hpp +5 -7
  130. package/nitrogen/generated/shared/c++/Device.hpp +5 -7
  131. package/nitrogen/generated/shared/c++/FilterForSamplesAnd.hpp +9 -11
  132. package/nitrogen/generated/shared/c++/FilterForSamplesOr.hpp +9 -11
  133. package/nitrogen/generated/shared/c++/FitzpatrickSkinType.hpp +9 -11
  134. package/nitrogen/generated/shared/c++/Heartbeat.hpp +4 -6
  135. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +15 -17
  136. package/nitrogen/generated/shared/c++/HeartbeatSeriesSamplesWithAnchorResponse.hpp +11 -13
  137. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +2 -2
  138. package/nitrogen/generated/shared/c++/HybridCharacteristicTypeModuleSpec.hpp +1 -1
  139. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -4
  140. package/nitrogen/generated/shared/c++/HybridCorrelationTypeModuleSpec.hpp +2 -2
  141. package/nitrogen/generated/shared/c++/HybridHeartbeatSeriesModuleSpec.hpp +3 -3
  142. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +3 -3
  143. package/nitrogen/generated/shared/c++/HybridStateOfMindModuleSpec.hpp +3 -3
  144. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +6 -4
  145. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +18 -9
  146. package/nitrogen/generated/shared/c++/HybridWorkoutsModuleSpec.hpp +4 -4
  147. package/nitrogen/generated/shared/c++/IdentifierWithUnit.hpp +4 -6
  148. package/nitrogen/generated/shared/c++/IntervalComponents.hpp +4 -6
  149. package/nitrogen/generated/shared/c++/LocationForSaving.hpp +4 -6
  150. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +397 -399
  151. package/nitrogen/generated/shared/c++/OnChangeCallbackArgs.hpp +8 -10
  152. package/nitrogen/generated/shared/c++/PredicateForWorkoutsAnd.hpp +9 -11
  153. package/nitrogen/generated/shared/c++/PredicateForWorkoutsOr.hpp +9 -11
  154. package/nitrogen/generated/shared/c++/PredicateFromWorkout.hpp +6 -8
  155. package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +9 -11
  156. package/nitrogen/generated/shared/c++/PredicateWithMetadataOperator.hpp +11 -13
  157. package/nitrogen/generated/shared/c++/PredicateWithStartAndEnd.hpp +5 -7
  158. package/nitrogen/generated/shared/c++/PredicateWithUUID.hpp +4 -6
  159. package/nitrogen/generated/shared/c++/PredicateWithUUIDs.hpp +5 -7
  160. package/nitrogen/generated/shared/c++/Quantity.hpp +4 -6
  161. package/nitrogen/generated/shared/c++/QuantityDateInterval.hpp +4 -6
  162. package/nitrogen/generated/shared/c++/QuantitySample.hpp +14 -16
  163. package/nitrogen/generated/shared/c++/QuantitySampleForSaving.hpp +11 -13
  164. package/nitrogen/generated/shared/c++/QuantitySamplesWithAnchorResponse.hpp +11 -13
  165. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +241 -243
  166. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchor.hpp +9 -11
  167. package/nitrogen/generated/shared/c++/QueryOptionsWithAnchorAndUnit.hpp +9 -11
  168. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrder.hpp +8 -10
  169. package/nitrogen/generated/shared/c++/QueryOptionsWithSortOrderAndUnit.hpp +9 -11
  170. package/nitrogen/generated/shared/c++/QueryStatisticsResponse.hpp +26 -28
  171. package/nitrogen/generated/shared/c++/QueryWorkoutSamplesWithAnchorResponse.hpp +10 -12
  172. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +383 -385
  173. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +373 -375
  174. package/nitrogen/generated/shared/c++/Source.hpp +4 -6
  175. package/nitrogen/generated/shared/c++/SourceRevision.hpp +7 -9
  176. package/nitrogen/generated/shared/c++/StateOfMindAssociation.hpp +10 -12
  177. package/nitrogen/generated/shared/c++/StateOfMindKind.hpp +14 -13
  178. package/nitrogen/generated/shared/c++/StateOfMindLabel.hpp +10 -12
  179. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +24 -26
  180. package/nitrogen/generated/shared/c++/StateOfMindValenceClassification.hpp +10 -12
  181. package/nitrogen/generated/shared/c++/StatisticsOptions.hpp +17 -19
  182. package/nitrogen/generated/shared/c++/StatisticsQueryOptions.hpp +9 -11
  183. package/nitrogen/generated/shared/c++/UpdateFrequency.hpp +10 -12
  184. package/nitrogen/generated/shared/c++/WheelchairUse.hpp +9 -11
  185. package/nitrogen/generated/shared/c++/WorkoutActivity.hpp +4 -6
  186. package/nitrogen/generated/shared/c++/WorkoutActivityType.hpp +96 -13
  187. package/nitrogen/generated/shared/c++/WorkoutActivityTypePredicate.hpp +7 -9
  188. package/nitrogen/generated/shared/c++/WorkoutConfiguration.hpp +11 -13
  189. package/nitrogen/generated/shared/c++/WorkoutDurationPredicate.hpp +7 -9
  190. package/nitrogen/generated/shared/c++/WorkoutEvent.hpp +7 -9
  191. package/nitrogen/generated/shared/c++/WorkoutEventType.hpp +10 -12
  192. package/nitrogen/generated/shared/c++/WorkoutPlan.hpp +7 -9
  193. package/nitrogen/generated/shared/c++/WorkoutQueryOptions.hpp +10 -21
  194. package/nitrogen/generated/shared/c++/WorkoutQueryOptionsWithAnchor.hpp +11 -21
  195. package/nitrogen/generated/shared/c++/WorkoutRoute.hpp +9 -11
  196. package/nitrogen/generated/shared/c++/WorkoutRouteLocation.hpp +4 -6
  197. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +25 -43
  198. package/nitrogen/generated/shared/c++/WorkoutSessionLocationType.hpp +10 -12
  199. package/nitrogen/generated/shared/c++/WorkoutTotals.hpp +4 -6
  200. package/package.json +11 -11
  201. package/src/hooks/useMostRecentWorkout.ts +3 -17
  202. package/src/hooks/useWorkoutById.ts +1 -4
  203. package/src/specs/WorkoutProxy.nitro.ts +18 -1
  204. package/src/types/Workouts.ts +0 -8
  205. package/src/utils/getMostRecentWorkout.ts +1 -6
  206. package/src/utils/getWorkoutById.ts +1 -6
@@ -50,14 +50,12 @@ namespace margelo::nitro::healthkit {
50
50
 
51
51
  namespace margelo::nitro {
52
52
 
53
- using namespace margelo::nitro::healthkit;
54
-
55
53
  // C++ WorkoutRouteLocation <> JS WorkoutRouteLocation (object)
56
54
  template <>
57
- struct JSIConverter<WorkoutRouteLocation> final {
58
- static inline WorkoutRouteLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
55
+ struct JSIConverter<margelo::nitro::healthkit::WorkoutRouteLocation> final {
56
+ static inline margelo::nitro::healthkit::WorkoutRouteLocation fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
59
57
  jsi::Object obj = arg.asObject(runtime);
60
- return WorkoutRouteLocation(
58
+ return margelo::nitro::healthkit::WorkoutRouteLocation(
61
59
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "altitude")),
62
60
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "course")),
63
61
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "date")),
@@ -70,7 +68,7 @@ namespace margelo::nitro {
70
68
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, "verticalAccuracy"))
71
69
  );
72
70
  }
73
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutRouteLocation& arg) {
71
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::WorkoutRouteLocation& arg) {
74
72
  jsi::Object obj(runtime);
75
73
  obj.setProperty(runtime, "altitude", JSIConverter<double>::toJSI(runtime, arg.altitude));
76
74
  obj.setProperty(runtime, "course", JSIConverter<double>::toJSI(runtime, arg.course));
@@ -34,15 +34,15 @@ namespace margelo::nitro::healthkit { struct WorkoutEvent; }
34
34
  namespace margelo::nitro::healthkit { struct WorkoutActivity; }
35
35
 
36
36
  #include <string>
37
- #include <optional>
38
37
  #include "Device.hpp"
38
+ #include <optional>
39
39
  #include "WorkoutActivityType.hpp"
40
40
  #include "Quantity.hpp"
41
41
  #include <chrono>
42
42
  #include <NitroModules/AnyMap.hpp>
43
43
  #include "SourceRevision.hpp"
44
- #include <vector>
45
44
  #include "WorkoutEvent.hpp"
45
+ #include <vector>
46
46
  #include "WorkoutActivity.hpp"
47
47
 
48
48
  namespace margelo::nitro::healthkit {
@@ -56,10 +56,6 @@ namespace margelo::nitro::healthkit {
56
56
  std::optional<Device> device SWIFT_PRIVATE;
57
57
  WorkoutActivityType workoutActivityType SWIFT_PRIVATE;
58
58
  Quantity duration SWIFT_PRIVATE;
59
- std::optional<Quantity> totalDistance SWIFT_PRIVATE;
60
- std::optional<Quantity> totalEnergyBurned SWIFT_PRIVATE;
61
- std::optional<Quantity> totalSwimmingStrokeCount SWIFT_PRIVATE;
62
- std::optional<Quantity> totalFlightsClimbed SWIFT_PRIVATE;
63
59
  std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
64
60
  std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
65
61
  std::optional<std::shared_ptr<AnyMap>> metadata SWIFT_PRIVATE;
@@ -69,53 +65,43 @@ namespace margelo::nitro::healthkit {
69
65
 
70
66
  public:
71
67
  WorkoutSample() = default;
72
- explicit WorkoutSample(std::string uuid, std::optional<Device> device, WorkoutActivityType workoutActivityType, Quantity duration, std::optional<Quantity> totalDistance, std::optional<Quantity> totalEnergyBurned, std::optional<Quantity> totalSwimmingStrokeCount, std::optional<Quantity> totalFlightsClimbed, 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), totalDistance(totalDistance), totalEnergyBurned(totalEnergyBurned), totalSwimmingStrokeCount(totalSwimmingStrokeCount), totalFlightsClimbed(totalFlightsClimbed), startDate(startDate), endDate(endDate), metadata(metadata), sourceRevision(sourceRevision), events(events), activities(activities) {}
68
+ 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) {}
73
69
  };
74
70
 
75
71
  } // namespace margelo::nitro::healthkit
76
72
 
77
73
  namespace margelo::nitro {
78
74
 
79
- using namespace margelo::nitro::healthkit;
80
-
81
75
  // C++ WorkoutSample <> JS WorkoutSample (object)
82
76
  template <>
83
- struct JSIConverter<WorkoutSample> final {
84
- static inline WorkoutSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
77
+ struct JSIConverter<margelo::nitro::healthkit::WorkoutSample> final {
78
+ static inline margelo::nitro::healthkit::WorkoutSample fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
85
79
  jsi::Object obj = arg.asObject(runtime);
86
- return WorkoutSample(
80
+ return margelo::nitro::healthkit::WorkoutSample(
87
81
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, "uuid")),
88
- JSIConverter<std::optional<Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
89
- JSIConverter<WorkoutActivityType>::fromJSI(runtime, obj.getProperty(runtime, "workoutActivityType")),
90
- JSIConverter<Quantity>::fromJSI(runtime, obj.getProperty(runtime, "duration")),
91
- JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalDistance")),
92
- JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalEnergyBurned")),
93
- JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalSwimmingStrokeCount")),
94
- JSIConverter<std::optional<Quantity>>::fromJSI(runtime, obj.getProperty(runtime, "totalFlightsClimbed")),
82
+ JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, "device")),
83
+ JSIConverter<margelo::nitro::healthkit::WorkoutActivityType>::fromJSI(runtime, obj.getProperty(runtime, "workoutActivityType")),
84
+ JSIConverter<margelo::nitro::healthkit::Quantity>::fromJSI(runtime, obj.getProperty(runtime, "duration")),
95
85
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "startDate")),
96
86
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, "endDate")),
97
87
  JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::fromJSI(runtime, obj.getProperty(runtime, "metadata")),
98
- JSIConverter<std::optional<SourceRevision>>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision")),
99
- JSIConverter<std::optional<std::vector<WorkoutEvent>>>::fromJSI(runtime, obj.getProperty(runtime, "events")),
100
- JSIConverter<std::optional<std::vector<WorkoutActivity>>>::fromJSI(runtime, obj.getProperty(runtime, "activities"))
88
+ JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::fromJSI(runtime, obj.getProperty(runtime, "sourceRevision")),
89
+ JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::fromJSI(runtime, obj.getProperty(runtime, "events")),
90
+ JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::fromJSI(runtime, obj.getProperty(runtime, "activities"))
101
91
  );
102
92
  }
103
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutSample& arg) {
93
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::WorkoutSample& arg) {
104
94
  jsi::Object obj(runtime);
105
95
  obj.setProperty(runtime, "uuid", JSIConverter<std::string>::toJSI(runtime, arg.uuid));
106
- obj.setProperty(runtime, "device", JSIConverter<std::optional<Device>>::toJSI(runtime, arg.device));
107
- obj.setProperty(runtime, "workoutActivityType", JSIConverter<WorkoutActivityType>::toJSI(runtime, arg.workoutActivityType));
108
- obj.setProperty(runtime, "duration", JSIConverter<Quantity>::toJSI(runtime, arg.duration));
109
- obj.setProperty(runtime, "totalDistance", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalDistance));
110
- obj.setProperty(runtime, "totalEnergyBurned", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalEnergyBurned));
111
- obj.setProperty(runtime, "totalSwimmingStrokeCount", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalSwimmingStrokeCount));
112
- obj.setProperty(runtime, "totalFlightsClimbed", JSIConverter<std::optional<Quantity>>::toJSI(runtime, arg.totalFlightsClimbed));
96
+ obj.setProperty(runtime, "device", JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
97
+ obj.setProperty(runtime, "workoutActivityType", JSIConverter<margelo::nitro::healthkit::WorkoutActivityType>::toJSI(runtime, arg.workoutActivityType));
98
+ obj.setProperty(runtime, "duration", JSIConverter<margelo::nitro::healthkit::Quantity>::toJSI(runtime, arg.duration));
113
99
  obj.setProperty(runtime, "startDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
114
100
  obj.setProperty(runtime, "endDate", JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
115
101
  obj.setProperty(runtime, "metadata", JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::toJSI(runtime, arg.metadata));
116
- obj.setProperty(runtime, "sourceRevision", JSIConverter<std::optional<SourceRevision>>::toJSI(runtime, arg.sourceRevision));
117
- obj.setProperty(runtime, "events", JSIConverter<std::optional<std::vector<WorkoutEvent>>>::toJSI(runtime, arg.events));
118
- obj.setProperty(runtime, "activities", JSIConverter<std::optional<std::vector<WorkoutActivity>>>::toJSI(runtime, arg.activities));
102
+ obj.setProperty(runtime, "sourceRevision", JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::toJSI(runtime, arg.sourceRevision));
103
+ obj.setProperty(runtime, "events", JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::toJSI(runtime, arg.events));
104
+ obj.setProperty(runtime, "activities", JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::toJSI(runtime, arg.activities));
119
105
  return obj;
120
106
  }
121
107
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -124,19 +110,15 @@ namespace margelo::nitro {
124
110
  }
125
111
  jsi::Object obj = value.getObject(runtime);
126
112
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, "uuid"))) return false;
127
- if (!JSIConverter<std::optional<Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
128
- if (!JSIConverter<WorkoutActivityType>::canConvert(runtime, obj.getProperty(runtime, "workoutActivityType"))) return false;
129
- if (!JSIConverter<Quantity>::canConvert(runtime, obj.getProperty(runtime, "duration"))) return false;
130
- if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalDistance"))) return false;
131
- if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalEnergyBurned"))) return false;
132
- if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalSwimmingStrokeCount"))) return false;
133
- if (!JSIConverter<std::optional<Quantity>>::canConvert(runtime, obj.getProperty(runtime, "totalFlightsClimbed"))) return false;
113
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, "device"))) return false;
114
+ if (!JSIConverter<margelo::nitro::healthkit::WorkoutActivityType>::canConvert(runtime, obj.getProperty(runtime, "workoutActivityType"))) return false;
115
+ if (!JSIConverter<margelo::nitro::healthkit::Quantity>::canConvert(runtime, obj.getProperty(runtime, "duration"))) return false;
134
116
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "startDate"))) return false;
135
117
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, "endDate"))) return false;
136
118
  if (!JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::canConvert(runtime, obj.getProperty(runtime, "metadata"))) return false;
137
- if (!JSIConverter<std::optional<SourceRevision>>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
138
- if (!JSIConverter<std::optional<std::vector<WorkoutEvent>>>::canConvert(runtime, obj.getProperty(runtime, "events"))) return false;
139
- if (!JSIConverter<std::optional<std::vector<WorkoutActivity>>>::canConvert(runtime, obj.getProperty(runtime, "activities"))) return false;
119
+ if (!JSIConverter<std::optional<margelo::nitro::healthkit::SourceRevision>>::canConvert(runtime, obj.getProperty(runtime, "sourceRevision"))) return false;
120
+ if (!JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::canConvert(runtime, obj.getProperty(runtime, "events"))) return false;
121
+ if (!JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::canConvert(runtime, obj.getProperty(runtime, "activities"))) return false;
140
122
  return true;
141
123
  }
142
124
  };
@@ -7,7 +7,6 @@
7
7
 
8
8
  #pragma once
9
9
 
10
- #include <cmath>
11
10
  #if __has_include(<NitroModules/JSIConverter.hpp>)
12
11
  #include <NitroModules/JSIConverter.hpp>
13
12
  #else
@@ -34,16 +33,14 @@ namespace margelo::nitro::healthkit {
34
33
 
35
34
  namespace margelo::nitro {
36
35
 
37
- using namespace margelo::nitro::healthkit;
38
-
39
36
  // C++ WorkoutSessionLocationType <> JS WorkoutSessionLocationType (enum)
40
37
  template <>
41
- struct JSIConverter<WorkoutSessionLocationType> final {
42
- static inline WorkoutSessionLocationType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
38
+ struct JSIConverter<margelo::nitro::healthkit::WorkoutSessionLocationType> final {
39
+ static inline margelo::nitro::healthkit::WorkoutSessionLocationType fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
43
40
  int enumValue = JSIConverter<int>::fromJSI(runtime, arg);
44
- return static_cast<WorkoutSessionLocationType>(enumValue);
41
+ return static_cast<margelo::nitro::healthkit::WorkoutSessionLocationType>(enumValue);
45
42
  }
46
- static inline jsi::Value toJSI(jsi::Runtime& runtime, WorkoutSessionLocationType arg) {
43
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::healthkit::WorkoutSessionLocationType arg) {
47
44
  int enumValue = static_cast<int>(arg);
48
45
  return JSIConverter<int>::toJSI(runtime, enumValue);
49
46
  }
@@ -51,14 +48,15 @@ namespace margelo::nitro {
51
48
  if (!value.isNumber()) {
52
49
  return false;
53
50
  }
54
- double integer;
55
- double fraction = modf(value.getNumber(), &integer);
56
- if (fraction != 0.0) {
57
- // It is some kind of floating point number - our enums are ints.
51
+ double number = value.getNumber();
52
+ int integer = static_cast<int>(number);
53
+ if (number != integer) {
54
+ // The integer is not the same value as the double - we truncated floating points.
55
+ // Enums are all integers, so the input floating point number is obviously invalid.
58
56
  return false;
59
57
  }
60
58
  // Check if we are within the bounds of the enum.
61
- return integer >= 0 && integer <= 2;
59
+ return integer >= 1 && integer <= 3;
62
60
  }
63
61
  };
64
62
 
@@ -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++ WorkoutTotals <> JS WorkoutTotals (object)
47
45
  template <>
48
- struct JSIConverter<WorkoutTotals> final {
49
- static inline WorkoutTotals fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
46
+ struct JSIConverter<margelo::nitro::healthkit::WorkoutTotals> final {
47
+ static inline margelo::nitro::healthkit::WorkoutTotals fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
50
48
  jsi::Object obj = arg.asObject(runtime);
51
- return WorkoutTotals(
49
+ return margelo::nitro::healthkit::WorkoutTotals(
52
50
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "distance")),
53
51
  JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, "energyBurned"))
54
52
  );
55
53
  }
56
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const WorkoutTotals& arg) {
54
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::WorkoutTotals& arg) {
57
55
  jsi::Object obj(runtime);
58
56
  obj.setProperty(runtime, "distance", JSIConverter<std::optional<double>>::toJSI(runtime, arg.distance));
59
57
  obj.setProperty(runtime, "energyBurned", JSIConverter<std::optional<double>>::toJSI(runtime, arg.energyBurned));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingstinct/react-native-healthkit",
3
- "version": "10.1.0",
3
+ "version": "11.0.0",
4
4
  "description": "React Native bindings for HealthKit",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -58,7 +58,7 @@
58
58
  "build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types",
59
59
  "typecheck": "tsc --noEmit -p tsconfig.json",
60
60
  "lint": "bunx @biomejs/biome format --write",
61
- "codegen": "bun run build && nitro-codegen --logLevel=\"debug\"",
61
+ "codegen": "bun run build && nitrogen --logLevel=\"debug\"",
62
62
  "test": "bun test",
63
63
  "prepublishOnly": "bun run build && bun run codegen"
64
64
  },
@@ -88,17 +88,17 @@
88
88
  "access": "public"
89
89
  },
90
90
  "devDependencies": {
91
- "@testing-library/react-native": "^13.2.0",
91
+ "@testing-library/react-native": "^13.3.3",
92
92
  "@types/react": "~19.0.14",
93
- "nitro-codegen": "^0.26.4",
94
- "react": "19.0.0",
95
- "react-native": "*",
96
- "react-native-nitro-modules": "^0.26.4",
97
- "typescript": "~5.8.3"
93
+ "nitrogen": "^0.29.4",
94
+ "react": "19.1.0",
95
+ "react-native": "0.81.4",
96
+ "react-native-nitro-modules": "^0.29.6",
97
+ "typescript": "~5.9.2"
98
98
  },
99
99
  "peerDependencies": {
100
- "react": "*",
101
- "react-native": "*",
102
- "react-native-nitro-modules": "*"
100
+ "react": "19.1.0",
101
+ "react-native": "0.81.4",
102
+ "react-native-nitro-modules": "0.29.6"
103
103
  }
104
104
  }
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useRef, useState } from 'react'
1
+ import { useCallback, useEffect, useState } from 'react'
2
2
  import type { WorkoutProxy } from '../specs/WorkoutProxy.nitro'
3
3
  import getMostRecentWorkout from '../utils/getMostRecentWorkout'
4
4
  import useSubscribeToChanges from './useSubscribeToChanges'
@@ -6,25 +6,11 @@ import useSubscribeToChanges from './useSubscribeToChanges'
6
6
  /**
7
7
  * @returns the most recent workout sample.
8
8
  */
9
- export function useMostRecentWorkout(options?: {
10
- readonly energyUnit?: string
11
- readonly distanceUnit?: string
12
- }) {
9
+ export function useMostRecentWorkout() {
13
10
  const [workout, setWorkout] = useState<WorkoutProxy>()
14
11
 
15
- const optionsRef = useRef(options)
16
-
17
- useEffect(() => {
18
- optionsRef.current = options
19
- }, [options])
20
-
21
12
  const update = useCallback(async () => {
22
- setWorkout(
23
- await getMostRecentWorkout({
24
- energyUnit: optionsRef.current?.energyUnit,
25
- distanceUnit: optionsRef.current?.distanceUnit,
26
- }),
27
- )
13
+ setWorkout(await getMostRecentWorkout())
28
14
  }, [])
29
15
 
30
16
  useEffect(() => {
@@ -27,10 +27,7 @@ export function useWorkoutById(
27
27
  setIsLoading(true)
28
28
  setError(null)
29
29
  try {
30
- const fetchedWorkout = await getWorkoutById(uuid, {
31
- energyUnit: optionsRef.current?.energyUnit,
32
- distanceUnit: optionsRef.current?.distanceUnit,
33
- })
30
+ const fetchedWorkout = await getWorkoutById(uuid)
34
31
  setWorkout(fetchedWorkout)
35
32
  } catch (err) {
36
33
  setError(
@@ -1,4 +1,9 @@
1
1
  import type { HybridObject } from 'react-native-nitro-modules'
2
+ import type {
3
+ Quantity,
4
+ QuantityTypeIdentifier,
5
+ QueryStatisticsResponse,
6
+ } from '../types'
2
7
  import type {
3
8
  LocationForSaving,
4
9
  WorkoutPlan,
@@ -13,6 +18,18 @@ export interface WorkoutProxy
13
18
  saveWorkoutRoute(locations: readonly LocationForSaving[]): Promise<boolean>
14
19
  getWorkoutPlan(): Promise<WorkoutPlan | null>
15
20
  getWorkoutRoutes(): Promise<readonly WorkoutRoute[]>
21
+ getStatistic(
22
+ quantityType: QuantityTypeIdentifier,
23
+ unitOverride?: string,
24
+ ): Promise<QueryStatisticsResponse | null>
25
+ getAllStatistics(): Promise<Record<string, QueryStatisticsResponse>>
16
26
 
17
- // nice to have here: getAllStatistics and getStatisticsForQuantityType
27
+ /** @deprecated Use allStatistics or statistic() method instead */
28
+ readonly totalDistance?: Quantity
29
+ /** @deprecated Use allStatistics or statistic() method instead */
30
+ readonly totalEnergyBurned?: Quantity
31
+ /** @deprecated Use allStatistics or statistic() method instead */
32
+ readonly totalSwimmingStrokeCount?: Quantity
33
+ /** @deprecated Use allStatistics or statistic() method instead */
34
+ readonly totalFlightsClimbed?: Quantity
18
35
  }
@@ -215,16 +215,12 @@ export type FilterForWorkouts =
215
215
  | PredicateForWorkoutsAnd
216
216
 
217
217
  export interface WorkoutQueryOptionsWithAnchor {
218
- energyUnit?: string
219
- distanceUnit?: string
220
218
  filter?: FilterForWorkouts
221
219
  limit?: number
222
220
  anchor?: string
223
221
  }
224
222
 
225
223
  export interface WorkoutQueryOptions {
226
- energyUnit?: string
227
- distanceUnit?: string
228
224
  filter?: FilterForWorkouts
229
225
  limit?: number
230
226
  ascending?: boolean
@@ -269,10 +265,6 @@ export interface WorkoutSample {
269
265
  readonly device?: Device
270
266
  readonly workoutActivityType: WorkoutActivityType
271
267
  readonly duration: Quantity
272
- readonly totalDistance?: Quantity
273
- readonly totalEnergyBurned?: Quantity
274
- readonly totalSwimmingStrokeCount?: Quantity
275
- readonly totalFlightsClimbed?: Quantity
276
268
  readonly startDate: Date
277
269
  readonly endDate: Date
278
270
  readonly metadata?: AnyMap
@@ -1,14 +1,9 @@
1
1
  import { Workouts } from '../modules'
2
- import type { WorkoutQueryOptions } from '../types/Workouts'
3
2
 
4
- const getMostRecentWorkout = async (
5
- options: Pick<WorkoutQueryOptions, 'distanceUnit' | 'energyUnit'>,
6
- ) => {
3
+ const getMostRecentWorkout = async () => {
7
4
  const workouts = await Workouts.queryWorkoutSamples({
8
5
  limit: 1,
9
6
  ascending: false,
10
- energyUnit: options?.energyUnit,
11
- distanceUnit: options?.distanceUnit,
12
7
  })
13
8
 
14
9
  return workouts[0]
@@ -1,17 +1,12 @@
1
1
  import { Workouts } from '../modules'
2
2
  import type { WorkoutQueryOptions } from '../types/Workouts'
3
3
 
4
- const getWorkoutById = async (
5
- uuid: string,
6
- options: Pick<WorkoutQueryOptions, 'distanceUnit' | 'energyUnit'>,
7
- ) => {
4
+ const getWorkoutById = async (uuid: string) => {
8
5
  const workouts = await Workouts.queryWorkoutSamples({
9
6
  limit: 1,
10
7
  filter: {
11
8
  uuid: uuid,
12
9
  },
13
- energyUnit: options?.energyUnit,
14
- distanceUnit: options?.distanceUnit,
15
10
  })
16
11
 
17
12
  return workouts[0]