@kingstinct/react-native-healthkit 13.3.1 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/ReactNativeHealthkit.podspec +1 -0
  2. package/app.plugin.ts +40 -2
  3. package/ios/BackgroundDeliveryManager.swift +196 -0
  4. package/ios/CategoryTypeModule.swift +1 -1
  5. package/ios/CoreModule.swift +24 -0
  6. package/ios/CorrelationTypeModule.swift +2 -35
  7. package/ios/ElectrocardiogramModule.swift +2 -34
  8. package/ios/HeartbeatSeriesModule.swift +2 -34
  9. package/ios/MedicationModule.swift +3 -35
  10. package/ios/PredicateHelpers.swift +2 -2
  11. package/ios/QuantityTypeModule.swift +11 -11
  12. package/ios/Serializers.swift +58 -90
  13. package/ios/StateOfMindModule.swift +2 -34
  14. package/ios/WorkoutProxy.swift +4 -149
  15. package/ios/generated/HealthkitGenerated.swift +52 -0
  16. package/lib/commonjs/generated/healthkit.generated.js +745 -0
  17. package/lib/commonjs/healthkit.ios.js +51 -17
  18. package/lib/commonjs/healthkit.js +120 -34
  19. package/lib/commonjs/specs/QuantityTypeModule.nitro.js +1 -0
  20. package/lib/commonjs/type-tests/generated-typing.js +2 -0
  21. package/lib/commonjs/types/CategoryType.js +19 -99
  22. package/lib/commonjs/types/Medication.js +2 -0
  23. package/lib/commonjs/types/MetadataEnums.js +17 -0
  24. package/lib/commonjs/types/QuantityType.js +4 -15
  25. package/lib/commonjs/types/WeatherCondition.js +2 -32
  26. package/lib/commonjs/types/Workouts.js +3 -98
  27. package/lib/commonjs/types/index.js +2 -0
  28. package/lib/module/generated/healthkit.generated.js +742 -0
  29. package/lib/module/healthkit.ios.js +49 -15
  30. package/lib/module/healthkit.js +94 -20
  31. package/lib/module/specs/QuantityTypeModule.nitro.js +1 -0
  32. package/lib/module/type-tests/generated-typing.js +1 -0
  33. package/lib/module/types/CategoryType.js +2 -98
  34. package/lib/module/types/Medication.js +1 -0
  35. package/lib/module/types/MetadataEnums.js +1 -0
  36. package/lib/module/types/QuantityType.js +2 -14
  37. package/lib/module/types/WeatherCondition.js +1 -32
  38. package/lib/module/types/Workouts.js +2 -98
  39. package/lib/module/types/index.js +2 -0
  40. package/lib/typescript/generated/healthkit.generated.d.ts +1006 -0
  41. package/lib/typescript/healthkit.d.ts +39 -36
  42. package/lib/typescript/healthkit.ios.d.ts +64 -53
  43. package/lib/typescript/hooks/useMostRecentQuantitySample.d.ts +3 -2
  44. package/lib/typescript/hooks/useMostRecentWorkout.d.ts +2 -2
  45. package/lib/typescript/hooks/useQuantitySampleById.d.ts +5 -4
  46. package/lib/typescript/hooks/useStatisticsForQuantity.d.ts +2 -2
  47. package/lib/typescript/hooks/useSubscribeToQuantitySamples.d.ts +1 -1
  48. package/lib/typescript/modules.d.ts +2 -2
  49. package/lib/typescript/specs/CategoryTypeModule.nitro.d.ts +3 -3
  50. package/lib/typescript/specs/CoreModule.nitro.d.ts +15 -0
  51. package/lib/typescript/specs/QuantityTypeModule.nitro.d.ts +20 -9
  52. package/lib/typescript/type-tests/generated-typing.d.ts +1 -0
  53. package/lib/typescript/types/CategoryType.d.ts +10 -104
  54. package/lib/typescript/types/CategoryTypeIdentifier.d.ts +1 -61
  55. package/lib/typescript/types/CorrelationType.d.ts +8 -2
  56. package/lib/typescript/types/ElectrocardiogramSample.d.ts +8 -1
  57. package/lib/typescript/types/HeartbeatSeries.d.ts +8 -1
  58. package/lib/typescript/types/InterfaceVerification.d.ts +14 -1
  59. package/lib/typescript/types/Medication.d.ts +10 -0
  60. package/lib/typescript/types/MetadataEnums.d.ts +1 -0
  61. package/lib/typescript/types/QuantitySample.d.ts +9 -1
  62. package/lib/typescript/types/QuantityType.d.ts +14 -18
  63. package/lib/typescript/types/QuantityTypeIdentifier.d.ts +1 -671
  64. package/lib/typescript/types/QueryOptions.d.ts +8 -4
  65. package/lib/typescript/types/Shared.d.ts +12 -41
  66. package/lib/typescript/types/StateOfMind.d.ts +8 -1
  67. package/lib/typescript/types/Subscriptions.d.ts +11 -11
  68. package/lib/typescript/types/WeatherCondition.d.ts +1 -30
  69. package/lib/typescript/types/Workouts.d.ts +20 -104
  70. package/lib/typescript/types/index.d.ts +2 -0
  71. package/lib/typescript/utils/getMostRecentQuantitySample.d.ts +2 -1
  72. package/lib/typescript/utils/getMostRecentWorkout.d.ts +2 -1
  73. package/lib/typescript/utils/getPreferredUnit.d.ts +2 -1
  74. package/lib/typescript/utils/getQuantitySampleById.d.ts +2 -1
  75. package/lib/typescript/utils/subscribeToQuantitySamples.d.ts +1 -1
  76. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +55 -109
  77. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +12 -18
  78. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +5 -14
  79. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +18 -2
  80. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +1 -13
  81. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +1 -13
  82. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +2 -14
  83. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +1 -13
  84. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +19 -28
  85. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +2 -14
  86. package/nitrogen/generated/ios/c++/HybridWorkoutProxySpecSwift.hpp +3 -116
  87. package/nitrogen/generated/ios/swift/CategorySample.swift +4 -329
  88. package/nitrogen/generated/ios/swift/CategoryTypeIdentifier.swift +112 -108
  89. package/nitrogen/generated/ios/swift/CategoryTypeIdentifierWriteable.swift +292 -0
  90. package/nitrogen/generated/ios/swift/CorrelationSample.swift +4 -347
  91. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +4 -329
  92. package/nitrogen/generated/ios/swift/FilterForWorkouts.swift +30 -30
  93. package/nitrogen/generated/ios/swift/FilterForWorkoutsBase.swift +30 -30
  94. package/nitrogen/generated/ios/swift/GeneralForm.swift +4 -4
  95. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +4 -329
  96. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec.swift +1 -1
  97. package/nitrogen/generated/ios/swift/HybridCategoryTypeModuleSpec_cxx.swift +1 -1
  98. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +2 -0
  99. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +38 -0
  100. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec.swift +6 -6
  101. package/nitrogen/generated/ios/swift/HybridQuantityTypeModuleSpec_cxx.swift +6 -6
  102. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec.swift +1 -27
  103. package/nitrogen/generated/ios/swift/HybridWorkoutProxySpec_cxx.swift +2 -340
  104. package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +4 -329
  105. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +492 -492
  106. package/nitrogen/generated/ios/swift/QuantitySample.swift +4 -329
  107. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +380 -384
  108. package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +372 -376
  109. package/nitrogen/generated/ios/swift/{QueryOptionsWithAnchorAndUnit.swift → QueryOptionsWithAnchorAndStringUnit.swift} +5 -5
  110. package/nitrogen/generated/ios/swift/{QueryOptionsWithSortOrderAndUnit.swift → QueryOptionsWithSortOrderAndStringUnit.swift} +5 -5
  111. package/nitrogen/generated/ios/swift/QueryStatisticsResponseFromSingleSource.swift +37 -37
  112. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +492 -492
  113. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +482 -486
  114. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +4 -329
  115. package/nitrogen/generated/ios/swift/{StatisticsQueryOptions.swift → StatisticsQueryOptionsWithStringUnit.swift} +5 -5
  116. package/nitrogen/generated/ios/swift/WorkoutEvent.swift +20 -2
  117. package/nitrogen/generated/ios/swift/WorkoutSample.swift +4 -402
  118. package/nitrogen/generated/shared/c++/CategorySample.hpp +8 -100
  119. package/nitrogen/generated/shared/c++/CategoryTypeIdentifier.hpp +153 -149
  120. package/nitrogen/generated/shared/c++/CategoryTypeIdentifierWriteable.hpp +328 -0
  121. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +9 -105
  122. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -99
  123. package/nitrogen/generated/shared/c++/FilterForWorkouts.hpp +13 -13
  124. package/nitrogen/generated/shared/c++/FilterForWorkoutsBase.hpp +13 -13
  125. package/nitrogen/generated/shared/c++/GeneralForm.hpp +7 -7
  126. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +8 -100
  127. package/nitrogen/generated/shared/c++/HybridCategoryTypeModuleSpec.hpp +5 -2
  128. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +2 -0
  129. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +4 -2
  130. package/nitrogen/generated/shared/c++/HybridQuantityTypeModuleSpec.hpp +15 -15
  131. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.cpp +1 -27
  132. package/nitrogen/generated/shared/c++/HybridWorkoutProxySpec.hpp +2 -37
  133. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -99
  134. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +565 -565
  135. package/nitrogen/generated/shared/c++/QuantitySample.hpp +8 -100
  136. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +407 -411
  137. package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +398 -402
  138. package/nitrogen/generated/shared/c++/{QueryOptionsWithAnchorAndUnit.hpp → QueryOptionsWithAnchorAndStringUnit.hpp} +11 -11
  139. package/nitrogen/generated/shared/c++/{QueryOptionsWithSortOrderAndUnit.hpp → QueryOptionsWithSortOrderAndStringUnit.hpp} +11 -11
  140. package/nitrogen/generated/shared/c++/QueryStatisticsResponseFromSingleSource.hpp +12 -12
  141. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +559 -559
  142. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +541 -545
  143. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +8 -100
  144. package/nitrogen/generated/shared/c++/{StatisticsQueryOptions.hpp → StatisticsQueryOptionsWithStringUnit.hpp} +11 -11
  145. package/nitrogen/generated/shared/c++/WorkoutEvent.hpp +8 -2
  146. package/nitrogen/generated/shared/c++/WorkoutSample.hpp +7 -120
  147. package/package.json +5 -2
  148. package/src/generated/healthkit-schema.json +3680 -0
  149. package/src/generated/healthkit.generated.ts +1307 -0
  150. package/src/healthkit.ios.ts +225 -19
  151. package/src/healthkit.ts +181 -55
  152. package/src/hooks/useMostRecentQuantitySample.ts +6 -5
  153. package/src/hooks/useMostRecentWorkout.ts +2 -2
  154. package/src/hooks/useQuantitySampleById.ts +6 -5
  155. package/src/hooks/useStatisticsForQuantity.ts +2 -1
  156. package/src/hooks/useSubscribeToQuantitySamples.ts +1 -1
  157. package/src/modules.ts +7 -2
  158. package/src/specs/CategoryTypeModule.nitro.ts +8 -5
  159. package/src/specs/CoreModule.nitro.ts +20 -0
  160. package/src/specs/QuantityTypeModule.nitro.ts +81 -7
  161. package/src/test-setup.ts +2 -0
  162. package/src/type-tests/generated-typing.ts +133 -0
  163. package/src/types/CategoryType.ts +52 -148
  164. package/src/types/CategoryTypeIdentifier.ts +5 -134
  165. package/src/types/CorrelationType.ts +13 -3
  166. package/src/types/ElectrocardiogramSample.ts +13 -1
  167. package/src/types/HeartbeatSeries.ts +13 -1
  168. package/src/types/InterfaceVerification.ts +38 -1
  169. package/src/types/Medication.ts +19 -0
  170. package/src/types/MetadataEnums.ts +15 -0
  171. package/src/types/QuantitySample.ts +14 -2
  172. package/src/types/QuantityType.ts +22 -122
  173. package/src/types/QuantityTypeIdentifier.ts +5 -772
  174. package/src/types/QueryOptions.ts +11 -4
  175. package/src/types/Shared.ts +22 -49
  176. package/src/types/StateOfMind.ts +13 -1
  177. package/src/types/Subscriptions.ts +19 -13
  178. package/src/types/WeatherCondition.ts +1 -31
  179. package/src/types/Workouts.ts +46 -108
  180. package/src/types/index.ts +2 -0
  181. package/src/utils/getMostRecentQuantitySample.ts +4 -3
  182. package/src/utils/getMostRecentWorkout.ts +5 -2
  183. package/src/utils/getPreferredUnit.ts +5 -4
  184. package/src/utils/getQuantitySampleById.ts +4 -3
  185. package/src/utils/subscribeToQuantitySamples.ts +5 -3
  186. package/nitrogen/generated/ios/swift/HeartRateMotionContext.swift +0 -44
  187. package/nitrogen/generated/ios/swift/InsulinDeliveryReason.swift +0 -40
  188. package/nitrogen/generated/ios/swift/WeatherCondition.swift +0 -144
  189. package/nitrogen/generated/shared/c++/HeartRateMotionContext.hpp +0 -67
  190. package/nitrogen/generated/shared/c++/InsulinDeliveryReason.hpp +0 -62
  191. package/nitrogen/generated/shared/c++/WeatherCondition.hpp +0 -88
@@ -38,14 +38,6 @@ namespace margelo::nitro::healthkit { enum class StateOfMindAssociation; }
38
38
  namespace margelo::nitro::healthkit { enum class StateOfMindLabel; }
39
39
  // Forward declaration of `SampleType` to properly resolve imports.
40
40
  namespace margelo::nitro::healthkit { struct SampleType; }
41
- // Forward declaration of `WeatherCondition` to properly resolve imports.
42
- namespace margelo::nitro::healthkit { enum class WeatherCondition; }
43
- // Forward declaration of `Quantity` to properly resolve imports.
44
- namespace margelo::nitro::healthkit { struct Quantity; }
45
- // Forward declaration of `InsulinDeliveryReason` to properly resolve imports.
46
- namespace margelo::nitro::healthkit { enum class InsulinDeliveryReason; }
47
- // Forward declaration of `HeartRateMotionContext` to properly resolve imports.
48
- namespace margelo::nitro::healthkit { enum class HeartRateMotionContext; }
49
41
  // Forward declaration of `SourceRevision` to properly resolve imports.
50
42
  namespace margelo::nitro::healthkit { struct SourceRevision; }
51
43
  // Forward declaration of `Device` to properly resolve imports.
@@ -58,15 +50,11 @@ namespace margelo::nitro::healthkit { struct Device; }
58
50
  #include "StateOfMindLabel.hpp"
59
51
  #include "SampleType.hpp"
60
52
  #include <chrono>
61
- #include "WeatherCondition.hpp"
62
- #include <optional>
63
- #include "Quantity.hpp"
64
- #include "InsulinDeliveryReason.hpp"
65
- #include "HeartRateMotionContext.hpp"
53
+ #include <NitroModules/AnyMap.hpp>
66
54
  #include <string>
67
55
  #include "SourceRevision.hpp"
68
56
  #include "Device.hpp"
69
- #include <NitroModules/AnyMap.hpp>
57
+ #include <optional>
70
58
 
71
59
  namespace margelo::nitro::healthkit {
72
60
 
@@ -84,34 +72,14 @@ namespace margelo::nitro::healthkit {
84
72
  std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
85
73
  std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
86
74
  bool hasUndeterminedDuration SWIFT_PRIVATE;
87
- std::optional<WeatherCondition> metadataWeatherCondition SWIFT_PRIVATE;
88
- std::optional<Quantity> metadataWeatherHumidity SWIFT_PRIVATE;
89
- std::optional<Quantity> metadataWeatherTemperature SWIFT_PRIVATE;
90
- std::optional<InsulinDeliveryReason> metadataInsulinDeliveryReason SWIFT_PRIVATE;
91
- std::optional<HeartRateMotionContext> metadataHeartRateMotionContext SWIFT_PRIVATE;
75
+ std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
92
76
  std::string uuid SWIFT_PRIVATE;
93
77
  SourceRevision sourceRevision SWIFT_PRIVATE;
94
78
  std::optional<Device> device SWIFT_PRIVATE;
95
- std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
96
- std::optional<std::string> metadataExternalUUID SWIFT_PRIVATE;
97
- std::optional<std::string> metadataTimeZone SWIFT_PRIVATE;
98
- std::optional<bool> metadataWasUserEntered SWIFT_PRIVATE;
99
- std::optional<std::string> metadataDeviceSerialNumber SWIFT_PRIVATE;
100
- std::optional<std::string> metadataUdiDeviceIdentifier SWIFT_PRIVATE;
101
- std::optional<std::string> metadataUdiProductionIdentifier SWIFT_PRIVATE;
102
- std::optional<std::string> metadataDigitalSignature SWIFT_PRIVATE;
103
- std::optional<std::string> metadataDeviceName SWIFT_PRIVATE;
104
- std::optional<std::string> metadataDeviceManufacturerName SWIFT_PRIVATE;
105
- std::optional<std::string> metadataSyncIdentifier SWIFT_PRIVATE;
106
- std::optional<double> metadataSyncVersion SWIFT_PRIVATE;
107
- std::optional<bool> metadataWasTakenInLab SWIFT_PRIVATE;
108
- std::optional<double> metadataReferenceRangeLowerLimit SWIFT_PRIVATE;
109
- std::optional<double> metadataReferenceRangeUpperLimit SWIFT_PRIVATE;
110
- std::optional<double> metadataAlgorithmVersion SWIFT_PRIVATE;
111
79
 
112
80
  public:
113
81
  StateOfMindSample() = default;
114
- explicit StateOfMindSample(double valence, StateOfMindKind kind, StateOfMindValenceClassification valenceClassification, std::vector<StateOfMindAssociation> associations, std::vector<StateOfMindLabel> labels, 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): valence(valence), kind(kind), valenceClassification(valenceClassification), associations(associations), labels(labels), 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) {}
82
+ explicit StateOfMindSample(double valence, StateOfMindKind kind, StateOfMindValenceClassification valenceClassification, std::vector<StateOfMindAssociation> associations, std::vector<StateOfMindLabel> labels, SampleType sampleType, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, bool hasUndeterminedDuration, std::shared_ptr<AnyMap> metadata, std::string uuid, SourceRevision sourceRevision, std::optional<Device> device): valence(valence), kind(kind), valenceClassification(valenceClassification), associations(associations), labels(labels), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), metadata(metadata), uuid(uuid), sourceRevision(sourceRevision), device(device) {}
115
83
 
116
84
  public:
117
85
  friend bool operator==(const StateOfMindSample& lhs, const StateOfMindSample& rhs) = default;
@@ -136,30 +104,10 @@ namespace margelo::nitro {
136
104
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
137
105
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
138
106
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"))),
139
- JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition"))),
140
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity"))),
141
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature"))),
142
- JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason"))),
143
- JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext"))),
107
+ JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
144
108
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid"))),
145
109
  JSIConverter<margelo::nitro::healthkit::SourceRevision>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"))),
146
- JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device"))),
147
- JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
148
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID"))),
149
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone"))),
150
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered"))),
151
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber"))),
152
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier"))),
153
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier"))),
154
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature"))),
155
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName"))),
156
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName"))),
157
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier"))),
158
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion"))),
159
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab"))),
160
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit"))),
161
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit"))),
162
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion")))
110
+ JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))
163
111
  );
164
112
  }
165
113
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::StateOfMindSample& arg) {
@@ -173,30 +121,10 @@ namespace margelo::nitro {
173
121
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
174
122
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
175
123
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"), JSIConverter<bool>::toJSI(runtime, arg.hasUndeterminedDuration));
176
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition"), JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::toJSI(runtime, arg.metadataWeatherCondition));
177
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherHumidity));
178
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherTemperature));
179
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason"), JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::toJSI(runtime, arg.metadataInsulinDeliveryReason));
180
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext"), JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::toJSI(runtime, arg.metadataHeartRateMotionContext));
124
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
181
125
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "uuid"), JSIConverter<std::string>::toJSI(runtime, arg.uuid));
182
126
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"), JSIConverter<margelo::nitro::healthkit::SourceRevision>::toJSI(runtime, arg.sourceRevision));
183
127
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "device"), JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
184
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
185
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataExternalUUID));
186
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataTimeZone));
187
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasUserEntered));
188
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceSerialNumber));
189
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiDeviceIdentifier));
190
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiProductionIdentifier));
191
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDigitalSignature));
192
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceName));
193
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceManufacturerName));
194
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataSyncIdentifier));
195
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataSyncVersion));
196
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasTakenInLab));
197
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeLowerLimit));
198
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeUpperLimit));
199
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataAlgorithmVersion));
200
128
  return obj;
201
129
  }
202
130
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -216,30 +144,10 @@ namespace margelo::nitro {
216
144
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
217
145
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
218
146
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration")))) return false;
219
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition")))) return false;
220
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity")))) return false;
221
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature")))) return false;
222
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason")))) return false;
223
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext")))) return false;
147
+ if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
224
148
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid")))) return false;
225
149
  if (!JSIConverter<margelo::nitro::healthkit::SourceRevision>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision")))) return false;
226
150
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))) return false;
227
- if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
228
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID")))) return false;
229
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone")))) return false;
230
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered")))) return false;
231
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber")))) return false;
232
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier")))) return false;
233
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier")))) return false;
234
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature")))) return false;
235
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName")))) return false;
236
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName")))) return false;
237
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier")))) return false;
238
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion")))) return false;
239
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab")))) return false;
240
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit")))) return false;
241
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit")))) return false;
242
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion")))) return false;
243
151
  return true;
244
152
  }
245
153
  };
@@ -1,5 +1,5 @@
1
1
  ///
2
- /// StatisticsQueryOptions.hpp
2
+ /// StatisticsQueryOptionsWithStringUnit.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
5
  /// Copyright © Marc Rousavy @ Margelo
@@ -38,36 +38,36 @@ namespace margelo::nitro::healthkit { struct FilterForSamples; }
38
38
  namespace margelo::nitro::healthkit {
39
39
 
40
40
  /**
41
- * A struct which can be represented as a JavaScript object (StatisticsQueryOptions).
41
+ * A struct which can be represented as a JavaScript object (StatisticsQueryOptionsWithStringUnit).
42
42
  */
43
- struct StatisticsQueryOptions final {
43
+ struct StatisticsQueryOptionsWithStringUnit final {
44
44
  public:
45
45
  std::optional<FilterForSamples> filter SWIFT_PRIVATE;
46
46
  std::optional<std::string> unit SWIFT_PRIVATE;
47
47
 
48
48
  public:
49
- StatisticsQueryOptions() = default;
50
- explicit StatisticsQueryOptions(std::optional<FilterForSamples> filter, std::optional<std::string> unit): filter(filter), unit(unit) {}
49
+ StatisticsQueryOptionsWithStringUnit() = default;
50
+ explicit StatisticsQueryOptionsWithStringUnit(std::optional<FilterForSamples> filter, std::optional<std::string> unit): filter(filter), unit(unit) {}
51
51
 
52
52
  public:
53
- friend bool operator==(const StatisticsQueryOptions& lhs, const StatisticsQueryOptions& rhs) = default;
53
+ friend bool operator==(const StatisticsQueryOptionsWithStringUnit& lhs, const StatisticsQueryOptionsWithStringUnit& rhs) = default;
54
54
  };
55
55
 
56
56
  } // namespace margelo::nitro::healthkit
57
57
 
58
58
  namespace margelo::nitro {
59
59
 
60
- // C++ StatisticsQueryOptions <> JS StatisticsQueryOptions (object)
60
+ // C++ StatisticsQueryOptionsWithStringUnit <> JS StatisticsQueryOptionsWithStringUnit (object)
61
61
  template <>
62
- struct JSIConverter<margelo::nitro::healthkit::StatisticsQueryOptions> final {
63
- static inline margelo::nitro::healthkit::StatisticsQueryOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
62
+ struct JSIConverter<margelo::nitro::healthkit::StatisticsQueryOptionsWithStringUnit> final {
63
+ static inline margelo::nitro::healthkit::StatisticsQueryOptionsWithStringUnit fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
64
64
  jsi::Object obj = arg.asObject(runtime);
65
- return margelo::nitro::healthkit::StatisticsQueryOptions(
65
+ return margelo::nitro::healthkit::StatisticsQueryOptionsWithStringUnit(
66
66
  JSIConverter<std::optional<margelo::nitro::healthkit::FilterForSamples>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "filter"))),
67
67
  JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "unit")))
68
68
  );
69
69
  }
70
- static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::StatisticsQueryOptions& arg) {
70
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::StatisticsQueryOptionsWithStringUnit& arg) {
71
71
  jsi::Object obj(runtime);
72
72
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "filter"), JSIConverter<std::optional<margelo::nitro::healthkit::FilterForSamples>>::toJSI(runtime, arg.filter));
73
73
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "unit"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.unit));
@@ -33,6 +33,8 @@ namespace margelo::nitro::healthkit { enum class WorkoutEventType; }
33
33
 
34
34
  #include "WorkoutEventType.hpp"
35
35
  #include <chrono>
36
+ #include <NitroModules/AnyMap.hpp>
37
+ #include <optional>
36
38
 
37
39
  namespace margelo::nitro::healthkit {
38
40
 
@@ -44,10 +46,11 @@ namespace margelo::nitro::healthkit {
44
46
  WorkoutEventType type SWIFT_PRIVATE;
45
47
  std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
46
48
  std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
49
+ std::optional<std::shared_ptr<AnyMap>> metadata SWIFT_PRIVATE;
47
50
 
48
51
  public:
49
52
  WorkoutEvent() = default;
50
- explicit WorkoutEvent(WorkoutEventType type, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate): type(type), startDate(startDate), endDate(endDate) {}
53
+ explicit WorkoutEvent(WorkoutEventType type, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, std::optional<std::shared_ptr<AnyMap>> metadata): type(type), startDate(startDate), endDate(endDate), metadata(metadata) {}
51
54
 
52
55
  public:
53
56
  friend bool operator==(const WorkoutEvent& lhs, const WorkoutEvent& rhs) = default;
@@ -65,7 +68,8 @@ namespace margelo::nitro {
65
68
  return margelo::nitro::healthkit::WorkoutEvent(
66
69
  JSIConverter<margelo::nitro::healthkit::WorkoutEventType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type"))),
67
70
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
68
- JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))
71
+ JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
72
+ JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))
69
73
  );
70
74
  }
71
75
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::WorkoutEvent& arg) {
@@ -73,6 +77,7 @@ namespace margelo::nitro {
73
77
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "type"), JSIConverter<margelo::nitro::healthkit::WorkoutEventType>::toJSI(runtime, arg.type));
74
78
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
75
79
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
80
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::toJSI(runtime, arg.metadata));
76
81
  return obj;
77
82
  }
78
83
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -86,6 +91,7 @@ namespace margelo::nitro {
86
91
  if (!JSIConverter<margelo::nitro::healthkit::WorkoutEventType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "type")))) return false;
87
92
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
88
93
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
94
+ if (!JSIConverter<std::optional<std::shared_ptr<AnyMap>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
89
95
  return true;
90
96
  }
91
97
  };
@@ -38,12 +38,6 @@ namespace margelo::nitro::healthkit { struct WorkoutEvent; }
38
38
  namespace margelo::nitro::healthkit { struct WorkoutActivity; }
39
39
  // Forward declaration of `SampleType` to properly resolve imports.
40
40
  namespace margelo::nitro::healthkit { struct SampleType; }
41
- // Forward declaration of `WeatherCondition` to properly resolve imports.
42
- namespace margelo::nitro::healthkit { enum class WeatherCondition; }
43
- // Forward declaration of `InsulinDeliveryReason` to properly resolve imports.
44
- namespace margelo::nitro::healthkit { enum class InsulinDeliveryReason; }
45
- // Forward declaration of `HeartRateMotionContext` to properly resolve imports.
46
- namespace margelo::nitro::healthkit { enum class HeartRateMotionContext; }
47
41
  // Forward declaration of `SourceRevision` to properly resolve imports.
48
42
  namespace margelo::nitro::healthkit { struct SourceRevision; }
49
43
  // Forward declaration of `Device` to properly resolve imports.
@@ -55,15 +49,12 @@ namespace margelo::nitro::healthkit { struct Device; }
55
49
  #include "WorkoutEvent.hpp"
56
50
  #include <vector>
57
51
  #include "WorkoutActivity.hpp"
52
+ #include <NitroModules/AnyMap.hpp>
58
53
  #include "SampleType.hpp"
59
54
  #include <chrono>
60
- #include "WeatherCondition.hpp"
61
- #include "InsulinDeliveryReason.hpp"
62
- #include "HeartRateMotionContext.hpp"
63
55
  #include <string>
64
56
  #include "SourceRevision.hpp"
65
57
  #include "Device.hpp"
66
- #include <NitroModules/AnyMap.hpp>
67
58
 
68
59
  namespace margelo::nitro::healthkit {
69
60
 
@@ -80,44 +71,18 @@ namespace margelo::nitro::healthkit {
80
71
  std::optional<Quantity> totalFlightsClimbed SWIFT_PRIVATE;
81
72
  std::optional<std::vector<WorkoutEvent>> events SWIFT_PRIVATE;
82
73
  std::optional<std::vector<WorkoutActivity>> activities SWIFT_PRIVATE;
83
- std::optional<Quantity> metadataAverageMETs SWIFT_PRIVATE;
84
- std::optional<Quantity> metadataElevationAscended SWIFT_PRIVATE;
85
- std::optional<Quantity> metadataElevationDescended SWIFT_PRIVATE;
86
- std::optional<bool> metadataIndoorWorkout SWIFT_PRIVATE;
87
- std::optional<Quantity> metadataAverageSpeed SWIFT_PRIVATE;
88
- std::optional<Quantity> metadataMaximumSpeed SWIFT_PRIVATE;
74
+ std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
89
75
  SampleType sampleType SWIFT_PRIVATE;
90
76
  std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
91
77
  std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
92
78
  bool hasUndeterminedDuration SWIFT_PRIVATE;
93
- std::optional<WeatherCondition> metadataWeatherCondition SWIFT_PRIVATE;
94
- std::optional<Quantity> metadataWeatherHumidity SWIFT_PRIVATE;
95
- std::optional<Quantity> metadataWeatherTemperature SWIFT_PRIVATE;
96
- std::optional<InsulinDeliveryReason> metadataInsulinDeliveryReason SWIFT_PRIVATE;
97
- std::optional<HeartRateMotionContext> metadataHeartRateMotionContext SWIFT_PRIVATE;
98
79
  std::string uuid SWIFT_PRIVATE;
99
80
  SourceRevision sourceRevision SWIFT_PRIVATE;
100
81
  std::optional<Device> device SWIFT_PRIVATE;
101
- std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
102
- std::optional<std::string> metadataExternalUUID SWIFT_PRIVATE;
103
- std::optional<std::string> metadataTimeZone SWIFT_PRIVATE;
104
- std::optional<bool> metadataWasUserEntered SWIFT_PRIVATE;
105
- std::optional<std::string> metadataDeviceSerialNumber SWIFT_PRIVATE;
106
- std::optional<std::string> metadataUdiDeviceIdentifier SWIFT_PRIVATE;
107
- std::optional<std::string> metadataUdiProductionIdentifier SWIFT_PRIVATE;
108
- std::optional<std::string> metadataDigitalSignature SWIFT_PRIVATE;
109
- std::optional<std::string> metadataDeviceName SWIFT_PRIVATE;
110
- std::optional<std::string> metadataDeviceManufacturerName SWIFT_PRIVATE;
111
- std::optional<std::string> metadataSyncIdentifier SWIFT_PRIVATE;
112
- std::optional<double> metadataSyncVersion SWIFT_PRIVATE;
113
- std::optional<bool> metadataWasTakenInLab SWIFT_PRIVATE;
114
- std::optional<double> metadataReferenceRangeLowerLimit SWIFT_PRIVATE;
115
- std::optional<double> metadataReferenceRangeUpperLimit SWIFT_PRIVATE;
116
- std::optional<double> metadataAlgorithmVersion SWIFT_PRIVATE;
117
82
 
118
83
  public:
119
84
  WorkoutSample() = default;
120
- explicit WorkoutSample(WorkoutActivityType workoutActivityType, Quantity duration, std::optional<Quantity> totalEnergyBurned, std::optional<Quantity> totalDistance, std::optional<Quantity> totalSwimmingStrokeCount, std::optional<Quantity> totalFlightsClimbed, 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), totalEnergyBurned(totalEnergyBurned), totalDistance(totalDistance), totalSwimmingStrokeCount(totalSwimmingStrokeCount), totalFlightsClimbed(totalFlightsClimbed), 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) {}
85
+ explicit WorkoutSample(WorkoutActivityType workoutActivityType, Quantity duration, std::optional<Quantity> totalEnergyBurned, std::optional<Quantity> totalDistance, std::optional<Quantity> totalSwimmingStrokeCount, std::optional<Quantity> totalFlightsClimbed, std::optional<std::vector<WorkoutEvent>> events, std::optional<std::vector<WorkoutActivity>> activities, std::shared_ptr<AnyMap> metadata, SampleType sampleType, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, bool hasUndeterminedDuration, std::string uuid, SourceRevision sourceRevision, std::optional<Device> device): workoutActivityType(workoutActivityType), duration(duration), totalEnergyBurned(totalEnergyBurned), totalDistance(totalDistance), totalSwimmingStrokeCount(totalSwimmingStrokeCount), totalFlightsClimbed(totalFlightsClimbed), events(events), activities(activities), metadata(metadata), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), uuid(uuid), sourceRevision(sourceRevision), device(device) {}
121
86
 
122
87
  public:
123
88
  friend bool operator==(const WorkoutSample& lhs, const WorkoutSample& rhs) = default;
@@ -141,40 +106,14 @@ namespace margelo::nitro {
141
106
  JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalFlightsClimbed"))),
142
107
  JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "events"))),
143
108
  JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activities"))),
144
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAverageMETs"))),
145
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataElevationAscended"))),
146
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataElevationDescended"))),
147
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataIndoorWorkout"))),
148
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAverageSpeed"))),
149
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataMaximumSpeed"))),
109
+ JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
150
110
  JSIConverter<margelo::nitro::healthkit::SampleType>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleType"))),
151
111
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
152
112
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
153
113
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"))),
154
- JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition"))),
155
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity"))),
156
- JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature"))),
157
- JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason"))),
158
- JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext"))),
159
114
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid"))),
160
115
  JSIConverter<margelo::nitro::healthkit::SourceRevision>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"))),
161
- JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device"))),
162
- JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
163
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID"))),
164
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone"))),
165
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered"))),
166
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber"))),
167
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier"))),
168
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier"))),
169
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature"))),
170
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName"))),
171
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName"))),
172
- JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier"))),
173
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion"))),
174
- JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab"))),
175
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit"))),
176
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit"))),
177
- JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion")))
116
+ JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))
178
117
  );
179
118
  }
180
119
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::WorkoutSample& arg) {
@@ -187,40 +126,14 @@ namespace margelo::nitro {
187
126
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "totalFlightsClimbed"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.totalFlightsClimbed));
188
127
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "events"), JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::toJSI(runtime, arg.events));
189
128
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "activities"), JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::toJSI(runtime, arg.activities));
190
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataAverageMETs"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataAverageMETs));
191
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataElevationAscended"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataElevationAscended));
192
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataElevationDescended"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataElevationDescended));
193
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataIndoorWorkout"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataIndoorWorkout));
194
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataAverageSpeed"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataAverageSpeed));
195
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataMaximumSpeed"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataMaximumSpeed));
129
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
196
130
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "sampleType"), JSIConverter<margelo::nitro::healthkit::SampleType>::toJSI(runtime, arg.sampleType));
197
131
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
198
132
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
199
133
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"), JSIConverter<bool>::toJSI(runtime, arg.hasUndeterminedDuration));
200
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition"), JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::toJSI(runtime, arg.metadataWeatherCondition));
201
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherHumidity));
202
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature"), JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::toJSI(runtime, arg.metadataWeatherTemperature));
203
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason"), JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::toJSI(runtime, arg.metadataInsulinDeliveryReason));
204
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext"), JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::toJSI(runtime, arg.metadataHeartRateMotionContext));
205
134
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "uuid"), JSIConverter<std::string>::toJSI(runtime, arg.uuid));
206
135
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"), JSIConverter<margelo::nitro::healthkit::SourceRevision>::toJSI(runtime, arg.sourceRevision));
207
136
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "device"), JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
208
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
209
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataExternalUUID));
210
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataTimeZone));
211
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasUserEntered));
212
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceSerialNumber));
213
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiDeviceIdentifier));
214
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataUdiProductionIdentifier));
215
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDigitalSignature));
216
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceName));
217
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataDeviceManufacturerName));
218
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.metadataSyncIdentifier));
219
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataSyncVersion));
220
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.metadataWasTakenInLab));
221
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeLowerLimit));
222
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataReferenceRangeUpperLimit));
223
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.metadataAlgorithmVersion));
224
137
  return obj;
225
138
  }
226
139
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -239,40 +152,14 @@ namespace margelo::nitro {
239
152
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "totalFlightsClimbed")))) return false;
240
153
  if (!JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutEvent>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "events")))) return false;
241
154
  if (!JSIConverter<std::optional<std::vector<margelo::nitro::healthkit::WorkoutActivity>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "activities")))) return false;
242
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAverageMETs")))) return false;
243
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataElevationAscended")))) return false;
244
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataElevationDescended")))) return false;
245
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataIndoorWorkout")))) return false;
246
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAverageSpeed")))) return false;
247
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataMaximumSpeed")))) return false;
155
+ if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
248
156
  if (!JSIConverter<margelo::nitro::healthkit::SampleType>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sampleType")))) return false;
249
157
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
250
158
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
251
159
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration")))) return false;
252
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::WeatherCondition>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherCondition")))) return false;
253
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherHumidity")))) return false;
254
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::Quantity>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWeatherTemperature")))) return false;
255
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::InsulinDeliveryReason>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataInsulinDeliveryReason")))) return false;
256
- if (!JSIConverter<std::optional<margelo::nitro::healthkit::HeartRateMotionContext>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataHeartRateMotionContext")))) return false;
257
160
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid")))) return false;
258
161
  if (!JSIConverter<margelo::nitro::healthkit::SourceRevision>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision")))) return false;
259
162
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))) return false;
260
- if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
261
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataExternalUUID")))) return false;
262
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataTimeZone")))) return false;
263
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasUserEntered")))) return false;
264
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceSerialNumber")))) return false;
265
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiDeviceIdentifier")))) return false;
266
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataUdiProductionIdentifier")))) return false;
267
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDigitalSignature")))) return false;
268
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceName")))) return false;
269
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataDeviceManufacturerName")))) return false;
270
- if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncIdentifier")))) return false;
271
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataSyncVersion")))) return false;
272
- if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataWasTakenInLab")))) return false;
273
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeLowerLimit")))) return false;
274
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataReferenceRangeUpperLimit")))) return false;
275
- if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadataAlgorithmVersion")))) return false;
276
163
  return true;
277
164
  }
278
165
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingstinct/react-native-healthkit",
3
- "version": "13.3.1",
3
+ "version": "14.0.0",
4
4
  "description": "React Native bindings for HealthKit",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -52,13 +52,16 @@
52
52
  "README.md"
53
53
  ],
54
54
  "scripts": {
55
+ "generate:healthkit": "bun ./scripts/generate-healthkit-cli.ts",
56
+ "verify:healthkit-sdk": "bun ./scripts/verify-healthkit-sdk.ts",
55
57
  "clean": "rm -rf lib",
56
58
  "build:cjs": "tsc -p tsconfig.cjs.json",
57
59
  "build:esm": "tsc -p tsconfig.esm.json",
58
60
  "build:types": "tsc -p tsconfig.declarations.json",
59
61
  "build": "bun run clean && bun run build:cjs && bun run build:esm && bun run build:types",
60
- "typecheck": "tsc --noEmit -p tsconfig.json",
62
+ "typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.type-tests.json",
61
63
  "lint": "bunx @biomejs/biome format --write",
64
+ "check:generated": "bun run generate:healthkit && bun run verify:healthkit-sdk && git diff --exit-code -- src/generated/healthkit.generated.ts src/generated/healthkit-schema.json ../../apps/example/contracts/generated ios/generated",
62
65
  "codegen": "bun run build && nitrogen --logLevel=\"debug\" && perl -i -pe 's/Bool\\(fromCxx: cachedCxxPart\\)/cachedCxxPart.use_count() > 0/g' nitrogen/generated/ios/swift/*Spec_cxx.swift",
63
66
  "test": "bun test",
64
67
  "prepublishOnly": "bun run build && bun run codegen"