@kingstinct/react-native-healthkit 9.0.11 → 10.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +1 -1
  2. package/ios/CorrelationTypeModule.swift +1 -0
  3. package/ios/Helpers.swift +50 -6
  4. package/ios/QuantityTypeModule.swift +61 -53
  5. package/ios/WorkoutsModule.swift +10 -9
  6. package/lib/commonjs/healthkit.js +4 -2
  7. package/lib/module/healthkit.js +4 -2
  8. package/lib/typescript/healthkit.d.ts +5 -5
  9. package/lib/typescript/healthkit.ios.d.ts +2 -2
  10. package/lib/typescript/specs/WorkoutsModule.nitro.d.ts +1 -1
  11. package/lib/typescript/types/CorrelationType.d.ts +1 -0
  12. package/lib/typescript/types/QuantityType.d.ts +2 -0
  13. package/lib/typescript/types/QueryOptions.d.ts +4 -0
  14. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +4 -4
  15. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +86 -24
  16. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp +3 -0
  17. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +3 -0
  18. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +3 -0
  19. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +3 -0
  20. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +3 -0
  21. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +3 -0
  22. package/nitrogen/generated/ios/c++/HybridWorkoutsModuleSpecSwift.hpp +9 -6
  23. package/nitrogen/generated/ios/swift/CorrelationSample.swift +13 -2
  24. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_.swift +50 -0
  25. package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec.swift +1 -1
  26. package/nitrogen/generated/ios/swift/HybridWorkoutsModuleSpec_cxx.swift +10 -7
  27. package/nitrogen/generated/ios/swift/PredicateWithMetadataKey.swift +94 -2
  28. package/nitrogen/generated/ios/swift/PredicateWithMetadataOperator.swift +48 -0
  29. package/nitrogen/generated/ios/swift/QueryStatisticsResponse.swift +59 -1
  30. package/nitrogen/generated/ios/swift/Variant_String_Double_Bool_Date.swift +18 -0
  31. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +6 -1
  32. package/nitrogen/generated/shared/c++/HybridWorkoutsModuleSpec.hpp +5 -6
  33. package/nitrogen/generated/shared/c++/PredicateWithMetadataKey.hpp +16 -3
  34. package/nitrogen/generated/shared/c++/PredicateWithMetadataOperator.hpp +86 -0
  35. package/nitrogen/generated/shared/c++/QueryStatisticsResponse.hpp +11 -2
  36. package/package.json +1 -1
  37. package/src/healthkit.ts +7 -2
  38. package/src/hooks/queryStatisticsForQuantity.test.ts +32 -0
  39. package/src/specs/WorkoutsModule.nitro.ts +1 -1
  40. package/src/types/CorrelationType.ts +1 -0
  41. package/src/types/QuantityType.ts +2 -0
  42. package/src/types/QueryOptions.ts +10 -0
  43. package/nitrogen/generated/ios/swift/Func_void_std__string.swift +0 -46
@@ -84,6 +84,8 @@ namespace margelo::nitro::healthkit { struct PredicateForWorkoutsOr; }
84
84
  namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
85
85
  // Forward declaration of `PredicateWithMetadataKey` to properly resolve imports.
86
86
  namespace margelo::nitro::healthkit { struct PredicateWithMetadataKey; }
87
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
88
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
87
89
  // Forward declaration of `PredicateWithStartAndEnd` to properly resolve imports.
88
90
  namespace margelo::nitro::healthkit { struct PredicateWithStartAndEnd; }
89
91
  // Forward declaration of `PredicateWithUUID` to properly resolve imports.
@@ -217,6 +219,7 @@ namespace ReactNativeHealthkit { class HybridWorkoutsModuleSpec_cxx; }
217
219
  #include "PredicateForWorkoutsOr.hpp"
218
220
  #include "PredicateFromWorkout.hpp"
219
221
  #include "PredicateWithMetadataKey.hpp"
222
+ #include "PredicateWithMetadataOperator.hpp"
220
223
  #include "PredicateWithStartAndEnd.hpp"
221
224
  #include "PredicateWithUUID.hpp"
222
225
  #include "PredicateWithUUIDs.hpp"
@@ -442,6 +445,65 @@ namespace margelo::nitro::healthkit::bridge::swift {
442
445
  return vector;
443
446
  }
444
447
 
448
+ // pragma MARK: std::optional<PredicateWithMetadataOperator>
449
+ /**
450
+ * Specialized version of `std::optional<PredicateWithMetadataOperator>`.
451
+ */
452
+ using std__optional_PredicateWithMetadataOperator_ = std::optional<PredicateWithMetadataOperator>;
453
+ inline std::optional<PredicateWithMetadataOperator> create_std__optional_PredicateWithMetadataOperator_(const PredicateWithMetadataOperator& value) {
454
+ return std::optional<PredicateWithMetadataOperator>(value);
455
+ }
456
+
457
+ // pragma MARK: std::variant<std::string, double, bool, std::chrono::system_clock::time_point>
458
+ /**
459
+ * Wrapper struct for `std::variant<std::string, double, bool, std::chrono::system_clock::time_point>`.
460
+ * std::variant cannot be used in Swift because of a Swift bug.
461
+ * Not even specializing it works. So we create a wrapper struct.
462
+ */
463
+ struct std__variant_std__string__double__bool__std__chrono__system_clock__time_point_ {
464
+ std::variant<std::string, double, bool, std::chrono::system_clock::time_point> variant;
465
+ std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(std::variant<std::string, double, bool, std::chrono::system_clock::time_point> variant): variant(variant) { }
466
+ operator std::variant<std::string, double, bool, std::chrono::system_clock::time_point>() const {
467
+ return variant;
468
+ }
469
+ inline size_t index() const {
470
+ return variant.index();
471
+ }
472
+ inline std::string get_0() const {
473
+ return std::get<0>(variant);
474
+ }
475
+ inline double get_1() const {
476
+ return std::get<1>(variant);
477
+ }
478
+ inline bool get_2() const {
479
+ return std::get<2>(variant);
480
+ }
481
+ inline std::chrono::system_clock::time_point get_3() const {
482
+ return std::get<3>(variant);
483
+ }
484
+ };
485
+ inline std__variant_std__string__double__bool__std__chrono__system_clock__time_point_ create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(const std::string& value) {
486
+ return std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(value);
487
+ }
488
+ inline std__variant_std__string__double__bool__std__chrono__system_clock__time_point_ create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(double value) {
489
+ return std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(value);
490
+ }
491
+ inline std__variant_std__string__double__bool__std__chrono__system_clock__time_point_ create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(bool value) {
492
+ return std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(value);
493
+ }
494
+ inline std__variant_std__string__double__bool__std__chrono__system_clock__time_point_ create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(std::chrono::system_clock::time_point value) {
495
+ return std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(value);
496
+ }
497
+
498
+ // pragma MARK: std::optional<std::variant<std::string, double, bool, std::chrono::system_clock::time_point>>
499
+ /**
500
+ * Specialized version of `std::optional<std::variant<std::string, double, bool, std::chrono::system_clock::time_point>>`.
501
+ */
502
+ using std__optional_std__variant_std__string__double__bool__std__chrono__system_clock__time_point__ = std::optional<std::variant<std::string, double, bool, std::chrono::system_clock::time_point>>;
503
+ inline std::optional<std::variant<std::string, double, bool, std::chrono::system_clock::time_point>> create_std__optional_std__variant_std__string__double__bool__std__chrono__system_clock__time_point__(const std::variant<std::string, double, bool, std::chrono::system_clock::time_point>& value) {
504
+ return std::optional<std::variant<std::string, double, bool, std::chrono::system_clock::time_point>>(value);
505
+ }
506
+
445
507
  // pragma MARK: std::optional<std::chrono::system_clock::time_point>
446
508
  /**
447
509
  * Specialized version of `std::optional<std::chrono::system_clock::time_point>`.
@@ -2136,38 +2198,38 @@ namespace margelo::nitro::healthkit::bridge::swift {
2136
2198
  return Result<std::shared_ptr<Promise<std::vector<WorkoutRoute>>>>::withError(error);
2137
2199
  }
2138
2200
 
2139
- // pragma MARK: std::shared_ptr<Promise<std::string>>
2201
+ // pragma MARK: std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>
2140
2202
  /**
2141
- * Specialized version of `std::shared_ptr<Promise<std::string>>`.
2203
+ * Specialized version of `std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>`.
2142
2204
  */
2143
- using std__shared_ptr_Promise_std__string__ = std::shared_ptr<Promise<std::string>>;
2144
- inline std::shared_ptr<Promise<std::string>> create_std__shared_ptr_Promise_std__string__() {
2145
- return Promise<std::string>::create();
2205
+ using std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec___ = std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>;
2206
+ inline std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>> create_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec___() {
2207
+ return Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>::create();
2146
2208
  }
2147
- inline PromiseHolder<std::string> wrap_std__shared_ptr_Promise_std__string__(std::shared_ptr<Promise<std::string>> promise) {
2148
- return PromiseHolder<std::string>(std::move(promise));
2209
+ inline PromiseHolder<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>> wrap_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec___(std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>> promise) {
2210
+ return PromiseHolder<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>(std::move(promise));
2149
2211
  }
2150
2212
 
2151
- // pragma MARK: std::function<void(const std::string& /* result */)>
2213
+ // pragma MARK: std::function<void(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>& /* result */)>
2152
2214
  /**
2153
- * Specialized version of `std::function<void(const std::string&)>`.
2215
+ * Specialized version of `std::function<void(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>&)>`.
2154
2216
  */
2155
- using Func_void_std__string = std::function<void(const std::string& /* result */)>;
2217
+ using Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_ = std::function<void(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>& /* result */)>;
2156
2218
  /**
2157
- * Wrapper class for a `std::function<void(const std::string& / * result * /)>`, this can be used from Swift.
2219
+ * Wrapper class for a `std::function<void(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>& / * result * /)>`, this can be used from Swift.
2158
2220
  */
2159
- class Func_void_std__string_Wrapper final {
2221
+ class Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec__Wrapper final {
2160
2222
  public:
2161
- explicit Func_void_std__string_Wrapper(std::function<void(const std::string& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::string& /* result */)>>(std::move(func))) {}
2162
- inline void call(std::string result) const {
2223
+ explicit Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec__Wrapper(std::function<void(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>& /* result */)>>(std::move(func))) {}
2224
+ inline void call(std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec> result) const {
2163
2225
  _function->operator()(result);
2164
2226
  }
2165
2227
  private:
2166
- std::unique_ptr<std::function<void(const std::string& /* result */)>> _function;
2228
+ std::unique_ptr<std::function<void(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>& /* result */)>> _function;
2167
2229
  } SWIFT_NONCOPYABLE;
2168
- Func_void_std__string create_Func_void_std__string(void* _Nonnull swiftClosureWrapper);
2169
- inline Func_void_std__string_Wrapper wrap_Func_void_std__string(Func_void_std__string value) {
2170
- return Func_void_std__string_Wrapper(std::move(value));
2230
+ Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_ create_Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_(void* _Nonnull swiftClosureWrapper);
2231
+ inline Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec__Wrapper wrap_Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_(Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_ value) {
2232
+ return Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec__Wrapper(std::move(value));
2171
2233
  }
2172
2234
 
2173
2235
  // pragma MARK: std::vector<QuantitySampleForSaving>
@@ -2431,13 +2493,13 @@ namespace margelo::nitro::healthkit::bridge::swift {
2431
2493
  using std__weak_ptr_margelo__nitro__healthkit__HybridWorkoutsModuleSpec_ = std::weak_ptr<margelo::nitro::healthkit::HybridWorkoutsModuleSpec>;
2432
2494
  inline std__weak_ptr_margelo__nitro__healthkit__HybridWorkoutsModuleSpec_ weakify_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutsModuleSpec_(const std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutsModuleSpec>& strong) { return strong; }
2433
2495
 
2434
- // pragma MARK: Result<std::shared_ptr<Promise<std::string>>>
2435
- using Result_std__shared_ptr_Promise_std__string___ = Result<std::shared_ptr<Promise<std::string>>>;
2436
- inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::shared_ptr<Promise<std::string>>& value) {
2437
- return Result<std::shared_ptr<Promise<std::string>>>::withValue(value);
2496
+ // pragma MARK: Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>>
2497
+ using Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____ = Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>>;
2498
+ inline Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____ create_Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____(const std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>& value) {
2499
+ return Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>>::withValue(value);
2438
2500
  }
2439
- inline Result_std__shared_ptr_Promise_std__string___ create_Result_std__shared_ptr_Promise_std__string___(const std::exception_ptr& error) {
2440
- return Result<std::shared_ptr<Promise<std::string>>>::withError(error);
2501
+ inline Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____ create_Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____(const std::exception_ptr& error) {
2502
+ return Result<std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>>>::withError(error);
2441
2503
  }
2442
2504
 
2443
2505
  // pragma MARK: Result<std::shared_ptr<Promise<QueryWorkoutSamplesWithAnchorResponse>>>
@@ -86,6 +86,8 @@ namespace margelo::nitro::healthkit { struct PredicateForWorkoutsOr; }
86
86
  namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
87
87
  // Forward declaration of `PredicateWithMetadataKey` to properly resolve imports.
88
88
  namespace margelo::nitro::healthkit { struct PredicateWithMetadataKey; }
89
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
90
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
89
91
  // Forward declaration of `PredicateWithStartAndEnd` to properly resolve imports.
90
92
  namespace margelo::nitro::healthkit { struct PredicateWithStartAndEnd; }
91
93
  // Forward declaration of `PredicateWithUUID` to properly resolve imports.
@@ -212,6 +214,7 @@ namespace margelo::nitro::healthkit { struct WorkoutTotals; }
212
214
  #include "PredicateForWorkoutsOr.hpp"
213
215
  #include "PredicateFromWorkout.hpp"
214
216
  #include "PredicateWithMetadataKey.hpp"
217
+ #include "PredicateWithMetadataOperator.hpp"
215
218
  #include "PredicateWithStartAndEnd.hpp"
216
219
  #include "PredicateWithUUID.hpp"
217
220
  #include "PredicateWithUUIDs.hpp"
@@ -40,6 +40,8 @@ namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
40
40
  namespace margelo::nitro::healthkit { struct FilterForSamplesAnd; }
41
41
  // Forward declaration of `FilterForSamplesOr` to properly resolve imports.
42
42
  namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
43
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
44
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
43
45
  // Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
44
46
  namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
45
47
  // Forward declaration of `CategorySamplesWithAnchorResponse` to properly resolve imports.
@@ -70,6 +72,7 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
70
72
  #include "PredicateFromWorkout.hpp"
71
73
  #include "FilterForSamplesAnd.hpp"
72
74
  #include "FilterForSamplesOr.hpp"
75
+ #include "PredicateWithMetadataOperator.hpp"
73
76
  #include "HybridWorkoutProxySpec.hpp"
74
77
  #include "CategorySamplesWithAnchorResponse.hpp"
75
78
  #include "DeletedSample.hpp"
@@ -46,6 +46,8 @@ namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
46
46
  namespace margelo::nitro::healthkit { struct FilterForSamplesAnd; }
47
47
  // Forward declaration of `FilterForSamplesOr` to properly resolve imports.
48
48
  namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
49
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
50
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
49
51
  // Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
50
52
  namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
51
53
 
@@ -73,6 +75,7 @@ namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
73
75
  #include "PredicateFromWorkout.hpp"
74
76
  #include "FilterForSamplesAnd.hpp"
75
77
  #include "FilterForSamplesOr.hpp"
78
+ #include "PredicateWithMetadataOperator.hpp"
76
79
  #include <chrono>
77
80
  #include "HybridWorkoutProxySpec.hpp"
78
81
  #include <unordered_map>
@@ -40,6 +40,8 @@ namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
40
40
  namespace margelo::nitro::healthkit { struct FilterForSamplesAnd; }
41
41
  // Forward declaration of `FilterForSamplesOr` to properly resolve imports.
42
42
  namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
43
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
44
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
43
45
  // Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
44
46
  namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
45
47
  // Forward declaration of `HeartbeatSeriesSamplesWithAnchorResponse` to properly resolve imports.
@@ -70,6 +72,7 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
70
72
  #include "PredicateFromWorkout.hpp"
71
73
  #include "FilterForSamplesAnd.hpp"
72
74
  #include "FilterForSamplesOr.hpp"
75
+ #include "PredicateWithMetadataOperator.hpp"
73
76
  #include "HybridWorkoutProxySpec.hpp"
74
77
  #include "HeartbeatSeriesSamplesWithAnchorResponse.hpp"
75
78
  #include "DeletedSample.hpp"
@@ -30,6 +30,8 @@ namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
30
30
  namespace margelo::nitro::healthkit { struct FilterForSamplesAnd; }
31
31
  // Forward declaration of `FilterForSamplesOr` to properly resolve imports.
32
32
  namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
33
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
34
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
33
35
  // Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
34
36
  namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
35
37
  // Forward declaration of `QuantitySample` to properly resolve imports.
@@ -76,6 +78,7 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndUnit; }
76
78
  #include "FilterForSamplesOr.hpp"
77
79
  #include <vector>
78
80
  #include <optional>
81
+ #include "PredicateWithMetadataOperator.hpp"
79
82
  #include <memory>
80
83
  #include "HybridWorkoutProxySpec.hpp"
81
84
  #include "QuantitySample.hpp"
@@ -46,6 +46,8 @@ namespace margelo::nitro::healthkit { struct PredicateFromWorkout; }
46
46
  namespace margelo::nitro::healthkit { struct FilterForSamplesAnd; }
47
47
  // Forward declaration of `FilterForSamplesOr` to properly resolve imports.
48
48
  namespace margelo::nitro::healthkit { struct FilterForSamplesOr; }
49
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
50
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
49
51
  // Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
50
52
  namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
51
53
 
@@ -73,6 +75,7 @@ namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
73
75
  #include "PredicateFromWorkout.hpp"
74
76
  #include "FilterForSamplesAnd.hpp"
75
77
  #include "FilterForSamplesOr.hpp"
78
+ #include "PredicateWithMetadataOperator.hpp"
76
79
  #include "HybridWorkoutProxySpec.hpp"
77
80
 
78
81
  #include "ReactNativeHealthkit-Swift-Cxx-Umbrella.hpp"
@@ -12,6 +12,8 @@
12
12
  // Forward declaration of `HybridWorkoutsModuleSpec_cxx` to properly resolve imports.
13
13
  namespace ReactNativeHealthkit { class HybridWorkoutsModuleSpec_cxx; }
14
14
 
15
+ // Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
16
+ namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
15
17
  // Forward declaration of `WorkoutActivityType` to properly resolve imports.
16
18
  namespace margelo::nitro::healthkit { enum class WorkoutActivityType; }
17
19
  // Forward declaration of `QuantitySampleForSaving` to properly resolve imports.
@@ -28,8 +30,6 @@ namespace margelo::nitro::healthkit { class HybridSourceProxySpec; }
28
30
  namespace margelo::nitro::healthkit { struct WorkoutTotals; }
29
31
  // Forward declaration of `QueryWorkoutSamplesWithAnchorResponse` to properly resolve imports.
30
32
  namespace margelo::nitro::healthkit { struct QueryWorkoutSamplesWithAnchorResponse; }
31
- // Forward declaration of `HybridWorkoutProxySpec` to properly resolve imports.
32
- namespace margelo::nitro::healthkit { class HybridWorkoutProxySpec; }
33
33
  // Forward declaration of `DeletedSample` to properly resolve imports.
34
34
  namespace margelo::nitro::healthkit { struct DeletedSample; }
35
35
  // Forward declaration of `WorkoutQueryOptionsWithAnchor` to properly resolve imports.
@@ -52,6 +52,8 @@ namespace margelo::nitro::healthkit { struct WorkoutDurationPredicate; }
52
52
  namespace margelo::nitro::healthkit { struct PredicateForWorkoutsOr; }
53
53
  // Forward declaration of `PredicateForWorkoutsAnd` to properly resolve imports.
54
54
  namespace margelo::nitro::healthkit { struct PredicateForWorkoutsAnd; }
55
+ // Forward declaration of `PredicateWithMetadataOperator` to properly resolve imports.
56
+ namespace margelo::nitro::healthkit { enum class PredicateWithMetadataOperator; }
55
57
  // Forward declaration of `ComparisonPredicateOperator` to properly resolve imports.
56
58
  namespace margelo::nitro::healthkit { enum class ComparisonPredicateOperator; }
57
59
  // Forward declaration of `WorkoutQueryOptions` to properly resolve imports.
@@ -62,20 +64,20 @@ namespace margelo::nitro::healthkit { struct WorkoutConfiguration; }
62
64
  namespace margelo::nitro::healthkit { enum class WorkoutSessionLocationType; }
63
65
 
64
66
  #include <NitroModules/Promise.hpp>
65
- #include <string>
67
+ #include <memory>
68
+ #include "HybridWorkoutProxySpec.hpp"
66
69
  #include "WorkoutActivityType.hpp"
67
70
  #include <vector>
68
71
  #include "QuantitySampleForSaving.hpp"
69
72
  #include <chrono>
70
73
  #include "QuantityTypeIdentifier.hpp"
74
+ #include <string>
71
75
  #include <NitroModules/AnyMap.hpp>
72
76
  #include <optional>
73
77
  #include "SourceRevision.hpp"
74
- #include <memory>
75
78
  #include "HybridSourceProxySpec.hpp"
76
79
  #include "WorkoutTotals.hpp"
77
80
  #include "QueryWorkoutSamplesWithAnchorResponse.hpp"
78
- #include "HybridWorkoutProxySpec.hpp"
79
81
  #include "DeletedSample.hpp"
80
82
  #include "WorkoutQueryOptionsWithAnchor.hpp"
81
83
  #include <variant>
@@ -88,6 +90,7 @@ namespace margelo::nitro::healthkit { enum class WorkoutSessionLocationType; }
88
90
  #include "WorkoutDurationPredicate.hpp"
89
91
  #include "PredicateForWorkoutsOr.hpp"
90
92
  #include "PredicateForWorkoutsAnd.hpp"
93
+ #include "PredicateWithMetadataOperator.hpp"
91
94
  #include "ComparisonPredicateOperator.hpp"
92
95
  #include "WorkoutQueryOptions.hpp"
93
96
  #include "WorkoutConfiguration.hpp"
@@ -132,7 +135,7 @@ namespace margelo::nitro::healthkit {
132
135
 
133
136
  public:
134
137
  // Methods
135
- inline std::shared_ptr<Promise<std::string>> saveWorkoutSample(WorkoutActivityType workoutActivityType, const std::vector<QuantitySampleForSaving>& quantities, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const WorkoutTotals& totals, const std::shared_ptr<AnyMap>& metadata) override {
138
+ inline std::shared_ptr<Promise<std::shared_ptr<margelo::nitro::healthkit::HybridWorkoutProxySpec>>> saveWorkoutSample(WorkoutActivityType workoutActivityType, const std::vector<QuantitySampleForSaving>& quantities, std::chrono::system_clock::time_point startDate, std::chrono::system_clock::time_point endDate, const WorkoutTotals& totals, const std::shared_ptr<AnyMap>& metadata) override {
136
139
  auto __result = _swiftPart.saveWorkoutSample(static_cast<int>(workoutActivityType), quantities, startDate, endDate, totals, metadata);
137
140
  if (__result.hasError()) [[unlikely]] {
138
141
  std::rethrow_exception(__result.error());
@@ -18,8 +18,8 @@ public extension CorrelationSample {
18
18
  /**
19
19
  * Create a new instance of `CorrelationSample`.
20
20
  */
21
- init(correlationType: CorrelationTypeIdentifier, objects: [CorrelationObject], metadata: AnyMap, startDate: Date, endDate: Date) {
22
- self.init(correlationType, { () -> bridge.std__vector_std__variant_CategorySample__QuantitySample__ in
21
+ init(uuid: String, correlationType: CorrelationTypeIdentifier, objects: [CorrelationObject], metadata: AnyMap, startDate: Date, endDate: Date) {
22
+ self.init(std.string(uuid), correlationType, { () -> bridge.std__vector_std__variant_CategorySample__QuantitySample__ in
23
23
  var __vector = bridge.create_std__vector_std__variant_CategorySample__QuantitySample__(objects.count)
24
24
  for __item in objects {
25
25
  __vector.push_back({ () -> bridge.std__variant_CategorySample__QuantitySample_ in
@@ -35,6 +35,17 @@ public extension CorrelationSample {
35
35
  }(), metadata.cppPart, startDate.toCpp(), endDate.toCpp())
36
36
  }
37
37
 
38
+ var uuid: String {
39
+ @inline(__always)
40
+ get {
41
+ return String(self.__uuid)
42
+ }
43
+ @inline(__always)
44
+ set {
45
+ self.__uuid = std.string(newValue)
46
+ }
47
+ }
48
+
38
49
  var correlationType: CorrelationTypeIdentifier {
39
50
  @inline(__always)
40
51
  get {
@@ -0,0 +1,50 @@
1
+ ///
2
+ /// Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: (any HybridWorkoutProxySpec)) -> Void` as a class.
12
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
13
+ */
14
+ public final class Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_ {
15
+ public typealias bridge = margelo.nitro.healthkit.bridge.swift
16
+
17
+ private let closure: (_ value: (any HybridWorkoutProxySpec)) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: (any HybridWorkoutProxySpec)) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: bridge.std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_) -> Void {
25
+ self.closure({ () -> HybridWorkoutProxySpec in
26
+ let __unsafePointer = bridge.get_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_(value)
27
+ let __instance = HybridWorkoutProxySpec_cxx.fromUnsafe(__unsafePointer)
28
+ return __instance.getHybridWorkoutProxySpec()
29
+ }())
30
+ }
31
+
32
+ /**
33
+ * Casts this instance to a retained unsafe raw pointer.
34
+ * This acquires one additional strong reference on the object!
35
+ */
36
+ @inline(__always)
37
+ public func toUnsafe() -> UnsafeMutableRawPointer {
38
+ return Unmanaged.passRetained(self).toOpaque()
39
+ }
40
+
41
+ /**
42
+ * Casts an unsafe pointer to a `Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_`.
43
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_>`.
44
+ * This removes one strong reference from the object!
45
+ */
46
+ @inline(__always)
47
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_ {
48
+ return Unmanaged<Func_void_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_>.fromOpaque(pointer).takeRetainedValue()
49
+ }
50
+ }
@@ -14,7 +14,7 @@ public protocol HybridWorkoutsModuleSpec_protocol: HybridObject {
14
14
 
15
15
 
16
16
  // Methods
17
- func saveWorkoutSample(workoutActivityType: WorkoutActivityType, quantities: [QuantitySampleForSaving], startDate: Date, endDate: Date, totals: WorkoutTotals, metadata: AnyMap) throws -> Promise<String>
17
+ func saveWorkoutSample(workoutActivityType: WorkoutActivityType, quantities: [QuantitySampleForSaving], startDate: Date, endDate: Date, totals: WorkoutTotals, metadata: AnyMap) throws -> Promise<(any HybridWorkoutProxySpec)>
18
18
  func queryWorkoutSamplesWithAnchor(options: WorkoutQueryOptionsWithAnchor) throws -> Promise<QueryWorkoutSamplesWithAnchorResponse>
19
19
  func queryWorkoutSamples(options: WorkoutQueryOptions) throws -> Promise<[(any HybridWorkoutProxySpec)]>
20
20
  func startWatchAppWithWorkoutConfiguration(workoutConfiguration: WorkoutConfiguration) throws -> Promise<Bool>
@@ -101,21 +101,24 @@ public class HybridWorkoutsModuleSpec_cxx {
101
101
 
102
102
  // Methods
103
103
  @inline(__always)
104
- public final func saveWorkoutSample(workoutActivityType: Int32, quantities: bridge.std__vector_QuantitySampleForSaving_, startDate: margelo.nitro.chrono_time, endDate: margelo.nitro.chrono_time, totals: WorkoutTotals, metadata: margelo.nitro.SharedAnyMap) -> bridge.Result_std__shared_ptr_Promise_std__string___ {
104
+ public final func saveWorkoutSample(workoutActivityType: Int32, quantities: bridge.std__vector_QuantitySampleForSaving_, startDate: margelo.nitro.chrono_time, endDate: margelo.nitro.chrono_time, totals: WorkoutTotals, metadata: margelo.nitro.SharedAnyMap) -> bridge.Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____ {
105
105
  do {
106
106
  let __result = try self.__implementation.saveWorkoutSample(workoutActivityType: margelo.nitro.healthkit.WorkoutActivityType(rawValue: workoutActivityType)!, quantities: quantities.map({ __item in __item }), startDate: Date(fromChrono: startDate), endDate: Date(fromChrono: endDate), totals: totals, metadata: AnyMap(withCppPart: metadata))
107
- let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__string__ in
108
- let __promise = bridge.create_std__shared_ptr_Promise_std__string__()
109
- let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__string__(__promise)
107
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec___ in
108
+ let __promise = bridge.create_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec___()
109
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec___(__promise)
110
110
  __result
111
- .then({ __result in __promiseHolder.resolve(std.string(__result)) })
111
+ .then({ __result in __promiseHolder.resolve({ () -> bridge.std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec_ in
112
+ let __cxxWrapped = __result.getCxxWrapper()
113
+ return __cxxWrapped.getCxxPart()
114
+ }()) })
112
115
  .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
113
116
  return __promise
114
117
  }()
115
- return bridge.create_Result_std__shared_ptr_Promise_std__string___(__resultCpp)
118
+ return bridge.create_Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____(__resultCpp)
116
119
  } catch (let __error) {
117
120
  let __exceptionPtr = __error.toCpp()
118
- return bridge.create_Result_std__shared_ptr_Promise_std__string___(__exceptionPtr)
121
+ return bridge.create_Result_std__shared_ptr_Promise_std__shared_ptr_margelo__nitro__healthkit__HybridWorkoutProxySpec____(__exceptionPtr)
119
122
  }
120
123
  }
121
124
 
@@ -18,8 +18,31 @@ public extension PredicateWithMetadataKey {
18
18
  /**
19
19
  * Create a new instance of `PredicateWithMetadataKey`.
20
20
  */
21
- init(withMetadataKey: String) {
22
- self.init(std.string(withMetadataKey))
21
+ init(withMetadataKey: String, operatorType: PredicateWithMetadataOperator?, value: Variant_String_Double_Bool_Date?) {
22
+ self.init(std.string(withMetadataKey), { () -> bridge.std__optional_PredicateWithMetadataOperator_ in
23
+ if let __unwrappedValue = operatorType {
24
+ return bridge.create_std__optional_PredicateWithMetadataOperator_(__unwrappedValue)
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.std__optional_std__variant_std__string__double__bool__std__chrono__system_clock__time_point__ in
29
+ if let __unwrappedValue = value {
30
+ return bridge.create_std__optional_std__variant_std__string__double__bool__std__chrono__system_clock__time_point__({ () -> bridge.std__variant_std__string__double__bool__std__chrono__system_clock__time_point_ in
31
+ switch __unwrappedValue {
32
+ case .first(let __value):
33
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(std.string(__value))
34
+ case .second(let __value):
35
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(__value)
36
+ case .third(let __value):
37
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(__value)
38
+ case .fourth(let __value):
39
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(__value.toCpp())
40
+ }
41
+ }().variant)
42
+ } else {
43
+ return .init()
44
+ }
45
+ }())
23
46
  }
24
47
 
25
48
  var withMetadataKey: String {
@@ -32,4 +55,73 @@ public extension PredicateWithMetadataKey {
32
55
  self.__withMetadataKey = std.string(newValue)
33
56
  }
34
57
  }
58
+
59
+ var operatorType: PredicateWithMetadataOperator? {
60
+ @inline(__always)
61
+ get {
62
+ return self.__operatorType.value
63
+ }
64
+ @inline(__always)
65
+ set {
66
+ self.__operatorType = { () -> bridge.std__optional_PredicateWithMetadataOperator_ in
67
+ if let __unwrappedValue = newValue {
68
+ return bridge.create_std__optional_PredicateWithMetadataOperator_(__unwrappedValue)
69
+ } else {
70
+ return .init()
71
+ }
72
+ }()
73
+ }
74
+ }
75
+
76
+ var value: Variant_String_Double_Bool_Date? {
77
+ @inline(__always)
78
+ get {
79
+ return { () -> Variant_String_Double_Bool_Date? in
80
+ if let __unwrapped = self.__value.value {
81
+ return { () -> Variant_String_Double_Bool_Date in
82
+ let __variant = bridge.std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(__unwrapped)
83
+ switch __variant.index() {
84
+ case 0:
85
+ let __actual = __variant.get_0()
86
+ return .first(String(__actual))
87
+ case 1:
88
+ let __actual = __variant.get_1()
89
+ return .second(__actual)
90
+ case 2:
91
+ let __actual = __variant.get_2()
92
+ return .third(__actual)
93
+ case 3:
94
+ let __actual = __variant.get_3()
95
+ return .fourth(Date(fromChrono: __actual))
96
+ default:
97
+ fatalError("Variant can never have index \(__variant.index())!")
98
+ }
99
+ }()
100
+ } else {
101
+ return nil
102
+ }
103
+ }()
104
+ }
105
+ @inline(__always)
106
+ set {
107
+ self.__value = { () -> bridge.std__optional_std__variant_std__string__double__bool__std__chrono__system_clock__time_point__ in
108
+ if let __unwrappedValue = newValue {
109
+ return bridge.create_std__optional_std__variant_std__string__double__bool__std__chrono__system_clock__time_point__({ () -> bridge.std__variant_std__string__double__bool__std__chrono__system_clock__time_point_ in
110
+ switch __unwrappedValue {
111
+ case .first(let __value):
112
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(std.string(__value))
113
+ case .second(let __value):
114
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(__value)
115
+ case .third(let __value):
116
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(__value)
117
+ case .fourth(let __value):
118
+ return bridge.create_std__variant_std__string__double__bool__std__chrono__system_clock__time_point_(__value.toCpp())
119
+ }
120
+ }().variant)
121
+ } else {
122
+ return .init()
123
+ }
124
+ }()
125
+ }
126
+ }
35
127
  }
@@ -0,0 +1,48 @@
1
+ ///
2
+ /// PredicateWithMetadataOperator.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ /**
9
+ * Represents the JS union `PredicateWithMetadataOperator`, backed by a C++ enum.
10
+ */
11
+ public typealias PredicateWithMetadataOperator = margelo.nitro.healthkit.PredicateWithMetadataOperator
12
+
13
+ public extension PredicateWithMetadataOperator {
14
+ /**
15
+ * Get a PredicateWithMetadataOperator for the given String value, or
16
+ * return `nil` if the given value was invalid/unknown.
17
+ */
18
+ init?(fromString string: String) {
19
+ switch string {
20
+ case "equalTo":
21
+ self = .equalto
22
+ case "notEqualTo":
23
+ self = .notequalto
24
+ case "greaterThan":
25
+ self = .greaterthan
26
+ case "lessThan":
27
+ self = .lessthan
28
+ default:
29
+ return nil
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Get the String value this PredicateWithMetadataOperator represents.
35
+ */
36
+ var stringValue: String {
37
+ switch self {
38
+ case .equalto:
39
+ return "equalTo"
40
+ case .notequalto:
41
+ return "notEqualTo"
42
+ case .greaterthan:
43
+ return "greaterThan"
44
+ case .lessthan:
45
+ return "lessThan"
46
+ }
47
+ }
48
+ }