@kingstinct/react-native-healthkit 15.1.0 → 16.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 (107) hide show
  1. package/README.md +22 -3
  2. package/ReactNativeHealthkit.podspec +17 -6
  3. package/app.plugin.js +18 -34
  4. package/app.plugin.ts +25 -50
  5. package/ios/CategoryTypeModule.swift +1 -0
  6. package/ios/CharacteristicTypeModule.swift +7 -6
  7. package/ios/Constants.swift +9 -34
  8. package/ios/CoreModule.swift +72 -41
  9. package/ios/CorrelationTypeModule.swift +3 -2
  10. package/ios/ElectrocardiogramModule.swift +4 -3
  11. package/ios/HeartbeatSeriesModule.swift +4 -3
  12. package/ios/Helpers.swift +10 -243
  13. package/ios/MedicationModule.swift +9 -8
  14. package/ios/MemoryEstimation.swift +1 -0
  15. package/ios/PredicateHelpers.swift +16 -86
  16. package/ios/QuantityTypeModule.swift +3 -2
  17. package/ios/Serializers.swift +16 -67
  18. package/ios/SourceProxy.swift +1 -0
  19. package/ios/StateOfMindModule.swift +3 -2
  20. package/ios/WorkoutProxy.swift +3 -2
  21. package/ios/WorkoutsModule.swift +4 -3
  22. package/lib/commonjs/generated/healthkit.generated.js +3 -0
  23. package/lib/commonjs/healthkit.ios.js +4 -2
  24. package/lib/commonjs/healthkit.js +21 -78
  25. package/lib/commonjs/types/Auth.js +3 -18
  26. package/lib/commonjs/types/Background.js +2 -10
  27. package/lib/commonjs/types/QueryOptions.js +2 -17
  28. package/lib/module/generated/healthkit.generated.js +3 -0
  29. package/lib/module/healthkit.ios.js +2 -0
  30. package/lib/module/healthkit.js +20 -77
  31. package/lib/module/types/Auth.js +1 -18
  32. package/lib/module/types/Background.js +1 -10
  33. package/lib/module/types/QueryOptions.js +1 -17
  34. package/lib/typescript/generated/healthkit.generated.d.ts +6 -2
  35. package/lib/typescript/healthkit.d.ts +3 -2
  36. package/lib/typescript/healthkit.ios.d.ts +11 -9
  37. package/lib/typescript/specs/CoreModule.nitro.d.ts +16 -0
  38. package/lib/typescript/specs/SourceProxy.nitro.d.ts +2 -4
  39. package/lib/typescript/types/Auth.d.ts +1 -16
  40. package/lib/typescript/types/Background.d.ts +1 -9
  41. package/lib/typescript/types/Device.d.ts +1 -13
  42. package/lib/typescript/types/QuantityType.d.ts +1 -1
  43. package/lib/typescript/types/QueryOptions.d.ts +3 -37
  44. package/lib/typescript/types/Shared.d.ts +2 -25
  45. package/lib/typescript/types/Source.d.ts +1 -10
  46. package/lib/typescript/types/Subscriptions.d.ts +2 -3
  47. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.cpp +8 -0
  48. package/nitrogen/generated/ios/ReactNativeHealthkit-Swift-Cxx-Bridge.hpp +68 -0
  49. package/nitrogen/generated/ios/c++/HybridCategoryTypeModuleSpecSwift.hpp +1 -1
  50. package/nitrogen/generated/ios/c++/HybridCoreModuleSpecSwift.hpp +8 -0
  51. package/nitrogen/generated/ios/c++/HybridCorrelationTypeModuleSpecSwift.hpp +1 -1
  52. package/nitrogen/generated/ios/c++/HybridElectrocardiogramModuleSpecSwift.hpp +1 -1
  53. package/nitrogen/generated/ios/c++/HybridHeartbeatSeriesModuleSpecSwift.hpp +1 -1
  54. package/nitrogen/generated/ios/c++/HybridMedicationModuleSpecSwift.hpp +1 -1
  55. package/nitrogen/generated/ios/c++/HybridQuantityTypeModuleSpecSwift.hpp +1 -1
  56. package/nitrogen/generated/ios/c++/HybridStateOfMindModuleSpecSwift.hpp +1 -1
  57. package/nitrogen/generated/ios/swift/CategorySample.swift +8 -8
  58. package/nitrogen/generated/ios/swift/CorrelationSample.swift +8 -8
  59. package/nitrogen/generated/ios/swift/ElectrocardiogramSample.swift +8 -8
  60. package/nitrogen/generated/ios/swift/Func_void_std__unordered_map_std__string__std__chrono__system_clock__time_point_.swift +54 -0
  61. package/nitrogen/generated/ios/swift/HeartbeatSeriesSample.swift +8 -8
  62. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec.swift +1 -0
  63. package/nitrogen/generated/ios/swift/HybridCoreModuleSpec_cxx.swift +25 -0
  64. package/nitrogen/generated/ios/swift/MedicationDoseEvent.swift +8 -8
  65. package/nitrogen/generated/ios/swift/ObjectTypeIdentifier.swift +4 -0
  66. package/nitrogen/generated/ios/swift/QuantitySample.swift +8 -8
  67. package/nitrogen/generated/ios/swift/QuantityTypeIdentifier.swift +4 -0
  68. package/nitrogen/generated/ios/swift/QuantityTypeIdentifierWriteable.swift +4 -0
  69. package/nitrogen/generated/ios/swift/SampleTypeIdentifier.swift +4 -0
  70. package/nitrogen/generated/ios/swift/SampleTypeIdentifierWriteable.swift +4 -0
  71. package/nitrogen/generated/ios/swift/StateOfMindSample.swift +8 -8
  72. package/nitrogen/generated/shared/c++/CategorySample.hpp +7 -7
  73. package/nitrogen/generated/shared/c++/CorrelationSample.hpp +7 -7
  74. package/nitrogen/generated/shared/c++/ElectrocardiogramSample.hpp +7 -7
  75. package/nitrogen/generated/shared/c++/HeartbeatSeriesSample.hpp +7 -7
  76. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.cpp +1 -0
  77. package/nitrogen/generated/shared/c++/HybridCoreModuleSpec.hpp +3 -1
  78. package/nitrogen/generated/shared/c++/MedicationDoseEvent.hpp +7 -7
  79. package/nitrogen/generated/shared/c++/ObjectTypeIdentifier.hpp +49 -45
  80. package/nitrogen/generated/shared/c++/QuantitySample.hpp +7 -7
  81. package/nitrogen/generated/shared/c++/QuantityTypeIdentifier.hpp +42 -38
  82. package/nitrogen/generated/shared/c++/QuantityTypeIdentifierWriteable.hpp +42 -38
  83. package/nitrogen/generated/shared/c++/SampleTypeIdentifier.hpp +48 -44
  84. package/nitrogen/generated/shared/c++/SampleTypeIdentifierWriteable.hpp +47 -43
  85. package/nitrogen/generated/shared/c++/StateOfMindSample.hpp +7 -7
  86. package/package.json +4 -1
  87. package/src/generated/healthkit-schema.json +13 -0
  88. package/src/generated/healthkit.generated.ts +5 -0
  89. package/src/healthkit.ios.ts +3 -0
  90. package/src/healthkit.ts +27 -84
  91. package/src/specs/CoreModule.nitro.ts +19 -0
  92. package/src/specs/SourceProxy.nitro.ts +2 -4
  93. package/src/test-setup.ts +1 -0
  94. package/src/types/Auth.ts +4 -17
  95. package/src/types/Background.ts +1 -9
  96. package/src/types/Device.ts +1 -13
  97. package/src/types/QuantityType.ts +1 -1
  98. package/src/types/QueryOptions.ts +7 -65
  99. package/src/types/Shared.ts +7 -28
  100. package/src/types/Source.ts +1 -11
  101. package/src/types/Subscriptions.ts +2 -3
  102. package/ios/BackgroundDeliveryManager.swift +0 -284
  103. package/ios/BackgroundLaunchHook.mm +0 -41
  104. package/ios/Bridge.h +0 -10
  105. package/ios/ExceptionCatcher.h +0 -5
  106. package/ios/ExceptionCatcher.mm +0 -32
  107. package/ios/module.modulemap +0 -5
@@ -70,10 +70,10 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
70
70
  #include <chrono>
71
71
  #include "MedicationDoseEventLogStatus.hpp"
72
72
  #include "SampleType.hpp"
73
- #include <NitroModules/AnyMap.hpp>
74
73
  #include "SourceRevision.hpp"
75
74
  #include "Source.hpp"
76
75
  #include "Device.hpp"
76
+ #include <NitroModules/AnyMap.hpp>
77
77
  #include "QueryOptionsWithSortOrder.hpp"
78
78
  #include "FilterForSamples.hpp"
79
79
  #include <memory>
@@ -73,10 +73,10 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchorAndStringUnit
73
73
  #include <NitroModules/Promise.hpp>
74
74
  #include "SampleType.hpp"
75
75
  #include <chrono>
76
- #include <NitroModules/AnyMap.hpp>
77
76
  #include "SourceRevision.hpp"
78
77
  #include "Source.hpp"
79
78
  #include "Device.hpp"
79
+ #include <NitroModules/AnyMap.hpp>
80
80
  #include "QuantityTypeIdentifierWriteable.hpp"
81
81
  #include <vector>
82
82
  #include "QueryOptionsWithSortOrderAndStringUnit.hpp"
@@ -63,11 +63,11 @@ namespace margelo::nitro::healthkit { struct QueryOptionsWithAnchor; }
63
63
  #include "SampleType.hpp"
64
64
  #include <string>
65
65
  #include <chrono>
66
- #include <NitroModules/AnyMap.hpp>
67
66
  #include "SourceRevision.hpp"
68
67
  #include "Source.hpp"
69
68
  #include <optional>
70
69
  #include "Device.hpp"
70
+ #include <NitroModules/AnyMap.hpp>
71
71
  #include "QueryOptionsWithSortOrder.hpp"
72
72
  #include "FilterForSamples.hpp"
73
73
  #include <memory>
@@ -18,14 +18,14 @@ public extension CategorySample {
18
18
  /**
19
19
  * Create a new instance of `CategorySample`.
20
20
  */
21
- init(categoryType: CategoryTypeIdentifier, value: Double, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, metadata: AnyMap, uuid: String, sourceRevision: SourceRevision, device: Device?) {
22
- self.init(categoryType, value, sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, metadata.cppPart, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
21
+ init(categoryType: CategoryTypeIdentifier, value: Double, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, uuid: String, sourceRevision: SourceRevision, device: Device?, metadata: AnyMap) {
22
+ self.init(categoryType, value, sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
23
23
  if let __unwrappedValue = device {
24
24
  return bridge.create_std__optional_Device_(__unwrappedValue)
25
25
  } else {
26
26
  return .init()
27
27
  }
28
- }())
28
+ }(), metadata.cppPart)
29
29
  }
30
30
 
31
31
  @inline(__always)
@@ -58,11 +58,6 @@ public extension CategorySample {
58
58
  return self.__hasUndeterminedDuration
59
59
  }
60
60
 
61
- @inline(__always)
62
- var metadata: AnyMap {
63
- return AnyMap(withCppPart: self.__metadata)
64
- }
65
-
66
61
  @inline(__always)
67
62
  var uuid: String {
68
63
  return String(self.__uuid)
@@ -77,4 +72,9 @@ public extension CategorySample {
77
72
  var device: Device? {
78
73
  return self.__device.value
79
74
  }
75
+
76
+ @inline(__always)
77
+ var metadata: AnyMap {
78
+ return AnyMap(withCppPart: self.__metadata)
79
+ }
80
80
  }
@@ -18,7 +18,7 @@ public extension CorrelationSample {
18
18
  /**
19
19
  * Create a new instance of `CorrelationSample`.
20
20
  */
21
- init(correlationType: CorrelationTypeIdentifier, objects: [CorrelationObject], sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, metadata: AnyMap, uuid: String, sourceRevision: SourceRevision, device: Device?) {
21
+ init(correlationType: CorrelationTypeIdentifier, objects: [CorrelationObject], sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, uuid: String, sourceRevision: SourceRevision, device: Device?, metadata: AnyMap) {
22
22
  self.init(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 {
@@ -32,13 +32,13 @@ public extension CorrelationSample {
32
32
  }().variant)
33
33
  }
34
34
  return __vector
35
- }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, metadata.cppPart, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
35
+ }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
36
36
  if let __unwrappedValue = device {
37
37
  return bridge.create_std__optional_Device_(__unwrappedValue)
38
38
  } else {
39
39
  return .init()
40
40
  }
41
- }())
41
+ }(), metadata.cppPart)
42
42
  }
43
43
 
44
44
  @inline(__always)
@@ -83,11 +83,6 @@ public extension CorrelationSample {
83
83
  return self.__hasUndeterminedDuration
84
84
  }
85
85
 
86
- @inline(__always)
87
- var metadata: AnyMap {
88
- return AnyMap(withCppPart: self.__metadata)
89
- }
90
-
91
86
  @inline(__always)
92
87
  var uuid: String {
93
88
  return String(self.__uuid)
@@ -102,4 +97,9 @@ public extension CorrelationSample {
102
97
  var device: Device? {
103
98
  return self.__device.value
104
99
  }
100
+
101
+ @inline(__always)
102
+ var metadata: AnyMap {
103
+ return AnyMap(withCppPart: self.__metadata)
104
+ }
105
105
  }
@@ -18,7 +18,7 @@ public extension ElectrocardiogramSample {
18
18
  /**
19
19
  * Create a new instance of `ElectrocardiogramSample`.
20
20
  */
21
- init(classification: ElectrocardiogramClassification, symptomsStatus: ElectrocardiogramSymptomsStatus, averageHeartRateBpm: Double?, samplingFrequencyHz: Double?, numberOfVoltageMeasurements: Double, voltages: [ElectrocardiogramVoltage]?, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, metadata: AnyMap, uuid: String, sourceRevision: SourceRevision, device: Device?) {
21
+ init(classification: ElectrocardiogramClassification, symptomsStatus: ElectrocardiogramSymptomsStatus, averageHeartRateBpm: Double?, samplingFrequencyHz: Double?, numberOfVoltageMeasurements: Double, voltages: [ElectrocardiogramVoltage]?, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, uuid: String, sourceRevision: SourceRevision, device: Device?, metadata: AnyMap) {
22
22
  self.init(classification, symptomsStatus, { () -> bridge.std__optional_double_ in
23
23
  if let __unwrappedValue = averageHeartRateBpm {
24
24
  return bridge.create_std__optional_double_(__unwrappedValue)
@@ -43,13 +43,13 @@ public extension ElectrocardiogramSample {
43
43
  } else {
44
44
  return .init()
45
45
  }
46
- }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, metadata.cppPart, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
46
+ }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
47
47
  if let __unwrappedValue = device {
48
48
  return bridge.create_std__optional_Device_(__unwrappedValue)
49
49
  } else {
50
50
  return .init()
51
51
  }
52
- }())
52
+ }(), metadata.cppPart)
53
53
  }
54
54
 
55
55
  @inline(__always)
@@ -123,11 +123,6 @@ public extension ElectrocardiogramSample {
123
123
  return self.__hasUndeterminedDuration
124
124
  }
125
125
 
126
- @inline(__always)
127
- var metadata: AnyMap {
128
- return AnyMap(withCppPart: self.__metadata)
129
- }
130
-
131
126
  @inline(__always)
132
127
  var uuid: String {
133
128
  return String(self.__uuid)
@@ -142,4 +137,9 @@ public extension ElectrocardiogramSample {
142
137
  var device: Device? {
143
138
  return self.__device.value
144
139
  }
140
+
141
+ @inline(__always)
142
+ var metadata: AnyMap {
143
+ return AnyMap(withCppPart: self.__metadata)
144
+ }
145
145
  }
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// Func_void_std__unordered_map_std__string__std__chrono__system_clock__time_point_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Wraps a Swift `(_ value: Dictionary<String, Date>) -> 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__unordered_map_std__string__std__chrono__system_clock__time_point_ {
15
+ public typealias bridge = margelo.nitro.healthkit.bridge.swift
16
+
17
+ private let closure: (_ value: Dictionary<String, Date>) -> Void
18
+
19
+ public init(_ closure: @escaping (_ value: Dictionary<String, Date>) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(value: bridge.std__unordered_map_std__string__std__chrono__system_clock__time_point_) -> Void {
25
+ self.closure({ () -> Dictionary<String, Date> in
26
+ var __dictionary = Dictionary<String, Date>(minimumCapacity: value.size())
27
+ let __keys = bridge.get_std__unordered_map_std__string__std__chrono__system_clock__time_point__keys(value)
28
+ for __key in __keys {
29
+ let __value = bridge.get_std__unordered_map_std__string__std__chrono__system_clock__time_point__value(value, __key)
30
+ __dictionary[String(__key)] = Date(fromChrono: __value)
31
+ }
32
+ return __dictionary
33
+ }())
34
+ }
35
+
36
+ /**
37
+ * Casts this instance to a retained unsafe raw pointer.
38
+ * This acquires one additional strong reference on the object!
39
+ */
40
+ @inline(__always)
41
+ public func toUnsafe() -> UnsafeMutableRawPointer {
42
+ return Unmanaged.passRetained(self).toOpaque()
43
+ }
44
+
45
+ /**
46
+ * Casts an unsafe pointer to a `Func_void_std__unordered_map_std__string__std__chrono__system_clock__time_point_`.
47
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__unordered_map_std__string__std__chrono__system_clock__time_point_>`.
48
+ * This removes one strong reference from the object!
49
+ */
50
+ @inline(__always)
51
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__unordered_map_std__string__std__chrono__system_clock__time_point_ {
52
+ return Unmanaged<Func_void_std__unordered_map_std__string__std__chrono__system_clock__time_point_>.fromOpaque(pointer).takeRetainedValue()
53
+ }
54
+ }
@@ -18,20 +18,20 @@ public extension HeartbeatSeriesSample {
18
18
  /**
19
19
  * Create a new instance of `HeartbeatSeriesSample`.
20
20
  */
21
- init(heartbeats: [Heartbeat], sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, metadata: AnyMap, uuid: String, sourceRevision: SourceRevision, device: Device?) {
21
+ init(heartbeats: [Heartbeat], sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, uuid: String, sourceRevision: SourceRevision, device: Device?, metadata: AnyMap) {
22
22
  self.init({ () -> bridge.std__vector_Heartbeat_ in
23
23
  var __vector = bridge.create_std__vector_Heartbeat_(heartbeats.count)
24
24
  for __item in heartbeats {
25
25
  __vector.push_back(__item)
26
26
  }
27
27
  return __vector
28
- }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, metadata.cppPart, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
28
+ }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
29
29
  if let __unwrappedValue = device {
30
30
  return bridge.create_std__optional_Device_(__unwrappedValue)
31
31
  } else {
32
32
  return .init()
33
33
  }
34
- }())
34
+ }(), metadata.cppPart)
35
35
  }
36
36
 
37
37
  @inline(__always)
@@ -59,11 +59,6 @@ public extension HeartbeatSeriesSample {
59
59
  return self.__hasUndeterminedDuration
60
60
  }
61
61
 
62
- @inline(__always)
63
- var metadata: AnyMap {
64
- return AnyMap(withCppPart: self.__metadata)
65
- }
66
-
67
62
  @inline(__always)
68
63
  var uuid: String {
69
64
  return String(self.__uuid)
@@ -78,4 +73,9 @@ public extension HeartbeatSeriesSample {
78
73
  var device: Device? {
79
74
  return self.__device.value
80
75
  }
76
+
77
+ @inline(__always)
78
+ var metadata: AnyMap {
79
+ return AnyMap(withCppPart: self.__metadata)
80
+ }
81
81
  }
@@ -34,6 +34,7 @@ public protocol HybridCoreModuleSpec_protocol: HybridObject {
34
34
  func getRequestStatusForAuthorization(toCheck: AuthDataTypes) throws -> Promise<AuthorizationRequestStatus>
35
35
  func requestAuthorization(toRequest: AuthDataTypes) throws -> Promise<Bool>
36
36
  func requestPerObjectReadAuthorization(typeIdentifier: PerObjectTypeIdentifier) throws -> Promise<Void>
37
+ func getEarliestAuthorizedSampleDates(objectTypeIdentifiers: [ObjectTypeIdentifier]) throws -> Promise<Dictionary<String, Date>>
37
38
  func deleteObjects(objectTypeIdentifier: SampleTypeIdentifierWriteable, filter: FilterForSamples) throws -> Promise<Double>
38
39
  func isObjectTypeAvailable(objectTypeIdentifier: ObjectTypeIdentifier) throws -> Bool
39
40
  func areObjectTypesAvailable(objectTypeIdentifiers: [ObjectTypeIdentifier]) throws -> Dictionary<String, Bool>
@@ -504,6 +504,31 @@ open class HybridCoreModuleSpec_cxx {
504
504
  }
505
505
  }
506
506
 
507
+ @inline(__always)
508
+ public final func getEarliestAuthorizedSampleDates(objectTypeIdentifiers: bridge.std__vector_ObjectTypeIdentifier_) -> bridge.Result_std__shared_ptr_Promise_std__unordered_map_std__string__std__chrono__system_clock__time_point____ {
509
+ do {
510
+ let __result = try self.__implementation.getEarliestAuthorizedSampleDates(objectTypeIdentifiers: objectTypeIdentifiers.map({ __item in __item }))
511
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__unordered_map_std__string__std__chrono__system_clock__time_point___ in
512
+ let __promise = bridge.create_std__shared_ptr_Promise_std__unordered_map_std__string__std__chrono__system_clock__time_point___()
513
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__unordered_map_std__string__std__chrono__system_clock__time_point___(__promise)
514
+ __result
515
+ .then({ __result in __promiseHolder.resolve({ () -> bridge.std__unordered_map_std__string__std__chrono__system_clock__time_point_ in
516
+ var __map = bridge.create_std__unordered_map_std__string__std__chrono__system_clock__time_point_(__result.count)
517
+ for (__k, __v) in __result {
518
+ bridge.emplace_std__unordered_map_std__string__std__chrono__system_clock__time_point_(&__map, std.string(__k), __v.toCpp())
519
+ }
520
+ return __map
521
+ }()) })
522
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
523
+ return __promise
524
+ }()
525
+ return bridge.create_Result_std__shared_ptr_Promise_std__unordered_map_std__string__std__chrono__system_clock__time_point____(__resultCpp)
526
+ } catch (let __error) {
527
+ let __exceptionPtr = __error.toCpp()
528
+ return bridge.create_Result_std__shared_ptr_Promise_std__unordered_map_std__string__std__chrono__system_clock__time_point____(__exceptionPtr)
529
+ }
530
+ }
531
+
507
532
  @inline(__always)
508
533
  public final func deleteObjects(objectTypeIdentifier: Int32, filter: FilterForSamples) -> bridge.Result_std__shared_ptr_Promise_double___ {
509
534
  do {
@@ -18,7 +18,7 @@ public extension MedicationDoseEvent {
18
18
  /**
19
19
  * Create a new instance of `MedicationDoseEvent`.
20
20
  */
21
- init(scheduleType: MedicationDoseEventScheduleType, medicationConceptIdentifier: String, medicationDisplayText: String?, scheduledDate: Date?, scheduledDoseQuantity: Double?, doseQuantity: Double?, logStatus: MedicationDoseEventLogStatus, unit: String, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, metadata: AnyMap, uuid: String, sourceRevision: SourceRevision, device: Device?) {
21
+ init(scheduleType: MedicationDoseEventScheduleType, medicationConceptIdentifier: String, medicationDisplayText: String?, scheduledDate: Date?, scheduledDoseQuantity: Double?, doseQuantity: Double?, logStatus: MedicationDoseEventLogStatus, unit: String, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, uuid: String, sourceRevision: SourceRevision, device: Device?, metadata: AnyMap) {
22
22
  self.init(scheduleType, std.string(medicationConceptIdentifier), { () -> bridge.std__optional_std__string_ in
23
23
  if let __unwrappedValue = medicationDisplayText {
24
24
  return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
@@ -43,13 +43,13 @@ public extension MedicationDoseEvent {
43
43
  } else {
44
44
  return .init()
45
45
  }
46
- }(), logStatus, std.string(unit), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, metadata.cppPart, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
46
+ }(), logStatus, std.string(unit), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
47
47
  if let __unwrappedValue = device {
48
48
  return bridge.create_std__optional_Device_(__unwrappedValue)
49
49
  } else {
50
50
  return .init()
51
51
  }
52
- }())
52
+ }(), metadata.cppPart)
53
53
  }
54
54
 
55
55
  @inline(__always)
@@ -140,11 +140,6 @@ public extension MedicationDoseEvent {
140
140
  return self.__hasUndeterminedDuration
141
141
  }
142
142
 
143
- @inline(__always)
144
- var metadata: AnyMap {
145
- return AnyMap(withCppPart: self.__metadata)
146
- }
147
-
148
143
  @inline(__always)
149
144
  var uuid: String {
150
145
  return String(self.__uuid)
@@ -159,4 +154,9 @@ public extension MedicationDoseEvent {
159
154
  var device: Device? {
160
155
  return self.__device.value
161
156
  }
157
+
158
+ @inline(__always)
159
+ var metadata: AnyMap {
160
+ return AnyMap(withCppPart: self.__metadata)
161
+ }
162
162
  }
@@ -341,6 +341,8 @@ public extension ObjectTypeIdentifier {
341
341
  self = .hkquantitytypeidentifierheartrate
342
342
  case "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute":
343
343
  self = .hkquantitytypeidentifierheartraterecoveryoneminute
344
+ case "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD":
345
+ self = .hkquantitytypeidentifierheartratevariabilityrmssd
344
346
  case "HKQuantityTypeIdentifierHeartRateVariabilitySDNN":
345
347
  self = .hkquantitytypeidentifierheartratevariabilitysdnn
346
348
  case "HKQuantityTypeIdentifierHeight":
@@ -765,6 +767,8 @@ public extension ObjectTypeIdentifier {
765
767
  return "HKQuantityTypeIdentifierHeartRate"
766
768
  case .hkquantitytypeidentifierheartraterecoveryoneminute:
767
769
  return "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute"
770
+ case .hkquantitytypeidentifierheartratevariabilityrmssd:
771
+ return "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD"
768
772
  case .hkquantitytypeidentifierheartratevariabilitysdnn:
769
773
  return "HKQuantityTypeIdentifierHeartRateVariabilitySDNN"
770
774
  case .hkquantitytypeidentifierheight:
@@ -18,14 +18,14 @@ public extension QuantitySample {
18
18
  /**
19
19
  * Create a new instance of `QuantitySample`.
20
20
  */
21
- init(quantityType: QuantityTypeIdentifier, quantity: Double, unit: String, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, metadata: AnyMap, uuid: String, sourceRevision: SourceRevision, device: Device?) {
22
- self.init(quantityType, quantity, std.string(unit), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, metadata.cppPart, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
21
+ init(quantityType: QuantityTypeIdentifier, quantity: Double, unit: String, sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, uuid: String, sourceRevision: SourceRevision, device: Device?, metadata: AnyMap) {
22
+ self.init(quantityType, quantity, std.string(unit), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
23
23
  if let __unwrappedValue = device {
24
24
  return bridge.create_std__optional_Device_(__unwrappedValue)
25
25
  } else {
26
26
  return .init()
27
27
  }
28
- }())
28
+ }(), metadata.cppPart)
29
29
  }
30
30
 
31
31
  @inline(__always)
@@ -63,11 +63,6 @@ public extension QuantitySample {
63
63
  return self.__hasUndeterminedDuration
64
64
  }
65
65
 
66
- @inline(__always)
67
- var metadata: AnyMap {
68
- return AnyMap(withCppPart: self.__metadata)
69
- }
70
-
71
66
  @inline(__always)
72
67
  var uuid: String {
73
68
  return String(self.__uuid)
@@ -82,4 +77,9 @@ public extension QuantitySample {
82
77
  var device: Device? {
83
78
  return self.__device.value
84
79
  }
80
+
81
+ @inline(__always)
82
+ var metadata: AnyMap {
83
+ return AnyMap(withCppPart: self.__metadata)
84
+ }
85
85
  }
@@ -181,6 +181,8 @@ public extension QuantityTypeIdentifier {
181
181
  self = .hkquantitytypeidentifierheartrate
182
182
  case "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute":
183
183
  self = .hkquantitytypeidentifierheartraterecoveryoneminute
184
+ case "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD":
185
+ self = .hkquantitytypeidentifierheartratevariabilityrmssd
184
186
  case "HKQuantityTypeIdentifierHeartRateVariabilitySDNN":
185
187
  self = .hkquantitytypeidentifierheartratevariabilitysdnn
186
188
  case "HKQuantityTypeIdentifierHeight":
@@ -431,6 +433,8 @@ public extension QuantityTypeIdentifier {
431
433
  return "HKQuantityTypeIdentifierHeartRate"
432
434
  case .hkquantitytypeidentifierheartraterecoveryoneminute:
433
435
  return "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute"
436
+ case .hkquantitytypeidentifierheartratevariabilityrmssd:
437
+ return "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD"
434
438
  case .hkquantitytypeidentifierheartratevariabilitysdnn:
435
439
  return "HKQuantityTypeIdentifierHeartRateVariabilitySDNN"
436
440
  case .hkquantitytypeidentifierheight:
@@ -171,6 +171,8 @@ public extension QuantityTypeIdentifierWriteable {
171
171
  self = .hkquantitytypeidentifierheartrate
172
172
  case "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute":
173
173
  self = .hkquantitytypeidentifierheartraterecoveryoneminute
174
+ case "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD":
175
+ self = .hkquantitytypeidentifierheartratevariabilityrmssd
174
176
  case "HKQuantityTypeIdentifierHeartRateVariabilitySDNN":
175
177
  self = .hkquantitytypeidentifierheartratevariabilitysdnn
176
178
  case "HKQuantityTypeIdentifierHeight":
@@ -411,6 +413,8 @@ public extension QuantityTypeIdentifierWriteable {
411
413
  return "HKQuantityTypeIdentifierHeartRate"
412
414
  case .hkquantitytypeidentifierheartraterecoveryoneminute:
413
415
  return "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute"
416
+ case .hkquantitytypeidentifierheartratevariabilityrmssd:
417
+ return "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD"
414
418
  case .hkquantitytypeidentifierheartratevariabilitysdnn:
415
419
  return "HKQuantityTypeIdentifierHeartRateVariabilitySDNN"
416
420
  case .hkquantitytypeidentifierheight:
@@ -329,6 +329,8 @@ public extension SampleTypeIdentifier {
329
329
  self = .hkquantitytypeidentifierheartrate
330
330
  case "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute":
331
331
  self = .hkquantitytypeidentifierheartraterecoveryoneminute
332
+ case "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD":
333
+ self = .hkquantitytypeidentifierheartratevariabilityrmssd
332
334
  case "HKQuantityTypeIdentifierHeartRateVariabilitySDNN":
333
335
  self = .hkquantitytypeidentifierheartratevariabilitysdnn
334
336
  case "HKQuantityTypeIdentifierHeight":
@@ -739,6 +741,8 @@ public extension SampleTypeIdentifier {
739
741
  return "HKQuantityTypeIdentifierHeartRate"
740
742
  case .hkquantitytypeidentifierheartraterecoveryoneminute:
741
743
  return "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute"
744
+ case .hkquantitytypeidentifierheartratevariabilityrmssd:
745
+ return "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD"
742
746
  case .hkquantitytypeidentifierheartratevariabilitysdnn:
743
747
  return "HKQuantityTypeIdentifierHeartRateVariabilitySDNN"
744
748
  case .hkquantitytypeidentifierheight:
@@ -309,6 +309,8 @@ public extension SampleTypeIdentifierWriteable {
309
309
  self = .hkquantitytypeidentifierheartrate
310
310
  case "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute":
311
311
  self = .hkquantitytypeidentifierheartraterecoveryoneminute
312
+ case "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD":
313
+ self = .hkquantitytypeidentifierheartratevariabilityrmssd
312
314
  case "HKQuantityTypeIdentifierHeartRateVariabilitySDNN":
313
315
  self = .hkquantitytypeidentifierheartratevariabilitysdnn
314
316
  case "HKQuantityTypeIdentifierHeight":
@@ -697,6 +699,8 @@ public extension SampleTypeIdentifierWriteable {
697
699
  return "HKQuantityTypeIdentifierHeartRate"
698
700
  case .hkquantitytypeidentifierheartraterecoveryoneminute:
699
701
  return "HKQuantityTypeIdentifierHeartRateRecoveryOneMinute"
702
+ case .hkquantitytypeidentifierheartratevariabilityrmssd:
703
+ return "HKQuantityTypeIdentifierHeartRateVariabilityRMSSD"
700
704
  case .hkquantitytypeidentifierheartratevariabilitysdnn:
701
705
  return "HKQuantityTypeIdentifierHeartRateVariabilitySDNN"
702
706
  case .hkquantitytypeidentifierheight:
@@ -18,7 +18,7 @@ public extension StateOfMindSample {
18
18
  /**
19
19
  * Create a new instance of `StateOfMindSample`.
20
20
  */
21
- init(valence: Double, kind: StateOfMindKind, valenceClassification: StateOfMindValenceClassification, associations: [StateOfMindAssociation], labels: [StateOfMindLabel], sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, metadata: AnyMap, uuid: String, sourceRevision: SourceRevision, device: Device?) {
21
+ init(valence: Double, kind: StateOfMindKind, valenceClassification: StateOfMindValenceClassification, associations: [StateOfMindAssociation], labels: [StateOfMindLabel], sampleType: SampleType, startDate: Date, endDate: Date, hasUndeterminedDuration: Bool, uuid: String, sourceRevision: SourceRevision, device: Device?, metadata: AnyMap) {
22
22
  self.init(valence, kind, valenceClassification, { () -> bridge.std__vector_StateOfMindAssociation_ in
23
23
  var __vector = bridge.create_std__vector_StateOfMindAssociation_(associations.count)
24
24
  for __item in associations {
@@ -31,13 +31,13 @@ public extension StateOfMindSample {
31
31
  __vector.push_back(__item)
32
32
  }
33
33
  return __vector
34
- }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, metadata.cppPart, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
34
+ }(), sampleType, startDate.toCpp(), endDate.toCpp(), hasUndeterminedDuration, std.string(uuid), sourceRevision, { () -> bridge.std__optional_Device_ in
35
35
  if let __unwrappedValue = device {
36
36
  return bridge.create_std__optional_Device_(__unwrappedValue)
37
37
  } else {
38
38
  return .init()
39
39
  }
40
- }())
40
+ }(), metadata.cppPart)
41
41
  }
42
42
 
43
43
  @inline(__always)
@@ -85,11 +85,6 @@ public extension StateOfMindSample {
85
85
  return self.__hasUndeterminedDuration
86
86
  }
87
87
 
88
- @inline(__always)
89
- var metadata: AnyMap {
90
- return AnyMap(withCppPart: self.__metadata)
91
- }
92
-
93
88
  @inline(__always)
94
89
  var uuid: String {
95
90
  return String(self.__uuid)
@@ -104,4 +99,9 @@ public extension StateOfMindSample {
104
99
  var device: Device? {
105
100
  return self.__device.value
106
101
  }
102
+
103
+ @inline(__always)
104
+ var metadata: AnyMap {
105
+ return AnyMap(withCppPart: self.__metadata)
106
+ }
107
107
  }
@@ -40,11 +40,11 @@ namespace margelo::nitro::healthkit { struct Device; }
40
40
  #include "CategoryTypeIdentifier.hpp"
41
41
  #include "SampleType.hpp"
42
42
  #include <chrono>
43
- #include <NitroModules/AnyMap.hpp>
44
43
  #include <string>
45
44
  #include "SourceRevision.hpp"
46
45
  #include "Device.hpp"
47
46
  #include <optional>
47
+ #include <NitroModules/AnyMap.hpp>
48
48
 
49
49
  namespace margelo::nitro::healthkit {
50
50
 
@@ -59,14 +59,14 @@ namespace margelo::nitro::healthkit {
59
59
  std::chrono::system_clock::time_point startDate SWIFT_PRIVATE;
60
60
  std::chrono::system_clock::time_point endDate SWIFT_PRIVATE;
61
61
  bool hasUndeterminedDuration SWIFT_PRIVATE;
62
- std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
63
62
  std::string uuid SWIFT_PRIVATE;
64
63
  SourceRevision sourceRevision SWIFT_PRIVATE;
65
64
  std::optional<Device> device SWIFT_PRIVATE;
65
+ std::shared_ptr<AnyMap> metadata SWIFT_PRIVATE;
66
66
 
67
67
  public:
68
68
  CategorySample() = default;
69
- explicit CategorySample(CategoryTypeIdentifier categoryType, double value, 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): categoryType(categoryType), value(value), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), metadata(metadata), uuid(uuid), sourceRevision(sourceRevision), device(device) {}
69
+ explicit CategorySample(CategoryTypeIdentifier categoryType, double value, 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, std::shared_ptr<AnyMap> metadata): categoryType(categoryType), value(value), sampleType(sampleType), startDate(startDate), endDate(endDate), hasUndeterminedDuration(hasUndeterminedDuration), uuid(uuid), sourceRevision(sourceRevision), device(device), metadata(metadata) {}
70
70
 
71
71
  public:
72
72
  friend bool operator==(const CategorySample& lhs, const CategorySample& rhs) = default;
@@ -88,10 +88,10 @@ namespace margelo::nitro {
88
88
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate"))),
89
89
  JSIConverter<std::chrono::system_clock::time_point>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate"))),
90
90
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"))),
91
- JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata"))),
92
91
  JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid"))),
93
92
  JSIConverter<margelo::nitro::healthkit::SourceRevision>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"))),
94
- JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))
93
+ JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device"))),
94
+ JSIConverter<std::shared_ptr<AnyMap>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))
95
95
  );
96
96
  }
97
97
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::healthkit::CategorySample& arg) {
@@ -102,10 +102,10 @@ namespace margelo::nitro {
102
102
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "startDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.startDate));
103
103
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "endDate"), JSIConverter<std::chrono::system_clock::time_point>::toJSI(runtime, arg.endDate));
104
104
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration"), JSIConverter<bool>::toJSI(runtime, arg.hasUndeterminedDuration));
105
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
106
105
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "uuid"), JSIConverter<std::string>::toJSI(runtime, arg.uuid));
107
106
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision"), JSIConverter<margelo::nitro::healthkit::SourceRevision>::toJSI(runtime, arg.sourceRevision));
108
107
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "device"), JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::toJSI(runtime, arg.device));
108
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "metadata"), JSIConverter<std::shared_ptr<AnyMap>>::toJSI(runtime, arg.metadata));
109
109
  return obj;
110
110
  }
111
111
  static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
@@ -122,10 +122,10 @@ namespace margelo::nitro {
122
122
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "startDate")))) return false;
123
123
  if (!JSIConverter<std::chrono::system_clock::time_point>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "endDate")))) return false;
124
124
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "hasUndeterminedDuration")))) return false;
125
- if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
126
125
  if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uuid")))) return false;
127
126
  if (!JSIConverter<margelo::nitro::healthkit::SourceRevision>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceRevision")))) return false;
128
127
  if (!JSIConverter<std::optional<margelo::nitro::healthkit::Device>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "device")))) return false;
128
+ if (!JSIConverter<std::shared_ptr<AnyMap>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "metadata")))) return false;
129
129
  return true;
130
130
  }
131
131
  };