@kingstinct/react-native-healthkit 6.1.0 → 7.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 (268) hide show
  1. package/README.md +7 -5
  2. package/app.plugin.js +69 -0
  3. package/ios/Constants.swift +28 -0
  4. package/ios/Helpers.swift +152 -0
  5. package/ios/ReactNativeHealthkit.m +24 -0
  6. package/ios/ReactNativeHealthkit.swift +534 -728
  7. package/ios/Serializers.swift +206 -0
  8. package/lib/commonjs/hooks/useHealthkitAuthorization.js +0 -6
  9. package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +1 -1
  10. package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +2 -9
  11. package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +1 -1
  12. package/lib/commonjs/hooks/useIsHealthDataAvailable.js +0 -6
  13. package/lib/commonjs/hooks/useIsHealthDataAvailable.js.map +1 -1
  14. package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +1 -6
  15. package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +1 -1
  16. package/lib/commonjs/hooks/useMostRecentCategorySample.js +1 -7
  17. package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +1 -1
  18. package/lib/commonjs/hooks/useMostRecentQuantitySample.js +0 -10
  19. package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +1 -1
  20. package/lib/commonjs/hooks/useMostRecentWorkout.js +0 -10
  21. package/lib/commonjs/hooks/useMostRecentWorkout.js.map +1 -1
  22. package/lib/commonjs/hooks/useSources.js +0 -5
  23. package/lib/commonjs/hooks/useSources.js.map +1 -1
  24. package/lib/commonjs/hooks/useStatisticsForQuantity.js +1 -7
  25. package/lib/commonjs/hooks/useStatisticsForQuantity.js.map +1 -1
  26. package/lib/commonjs/hooks/useSubscribeToChanges.js +0 -8
  27. package/lib/commonjs/hooks/useSubscribeToChanges.js.map +1 -1
  28. package/lib/commonjs/index.ios.js +6 -33
  29. package/lib/commonjs/index.ios.js.map +1 -1
  30. package/lib/commonjs/index.js +7 -11
  31. package/lib/commonjs/index.js.map +1 -1
  32. package/lib/commonjs/jest.setup.js +3 -1
  33. package/lib/commonjs/jest.setup.js.map +1 -1
  34. package/lib/commonjs/native-types.js +166 -250
  35. package/lib/commonjs/native-types.js.map +1 -1
  36. package/lib/commonjs/test-utils.js +1 -3
  37. package/lib/commonjs/test-utils.js.map +1 -1
  38. package/lib/commonjs/types.js +0 -2
  39. package/lib/commonjs/types.js.map +1 -1
  40. package/lib/commonjs/utils/deleteQuantitySample.js +0 -4
  41. package/lib/commonjs/utils/deleteQuantitySample.js.map +1 -1
  42. package/lib/commonjs/utils/deleteSamples.js +0 -4
  43. package/lib/commonjs/utils/deleteSamples.js.map +1 -1
  44. package/lib/commonjs/utils/deserializeCategorySample.js +2 -3
  45. package/lib/commonjs/utils/deserializeCategorySample.js.map +1 -1
  46. package/lib/commonjs/utils/deserializeCategorySample.test.js +3 -5
  47. package/lib/commonjs/utils/deserializeCategorySample.test.js.map +1 -1
  48. package/lib/commonjs/utils/deserializeCorrelation.js +2 -7
  49. package/lib/commonjs/utils/deserializeCorrelation.js.map +1 -1
  50. package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js +2 -3
  51. package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
  52. package/lib/commonjs/utils/deserializeSample.js +2 -3
  53. package/lib/commonjs/utils/deserializeSample.js.map +1 -1
  54. package/lib/commonjs/utils/deserializeWorkout.js +2 -3
  55. package/lib/commonjs/utils/deserializeWorkout.js.map +1 -1
  56. package/lib/commonjs/utils/ensureMetadata.js +0 -2
  57. package/lib/commonjs/utils/ensureMetadata.js.map +1 -1
  58. package/lib/commonjs/utils/ensureUnit.js +0 -5
  59. package/lib/commonjs/utils/ensureUnit.js.map +1 -1
  60. package/lib/commonjs/utils/getDateOfBirth.js +0 -4
  61. package/lib/commonjs/utils/getDateOfBirth.js.map +1 -1
  62. package/lib/commonjs/utils/getMostRecentCategorySample.js +1 -5
  63. package/lib/commonjs/utils/getMostRecentCategorySample.js.map +1 -1
  64. package/lib/commonjs/utils/getMostRecentQuantitySample.js +1 -5
  65. package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +1 -1
  66. package/lib/commonjs/utils/getMostRecentWorkout.js +0 -4
  67. package/lib/commonjs/utils/getMostRecentWorkout.js.map +1 -1
  68. package/lib/commonjs/utils/getPreferredUnit.js +0 -4
  69. package/lib/commonjs/utils/getPreferredUnit.js.map +1 -1
  70. package/lib/commonjs/utils/getPreferredUnits.js +0 -4
  71. package/lib/commonjs/utils/getPreferredUnits.js.map +1 -1
  72. package/lib/commonjs/utils/getPreferredUnitsTyped.js +0 -11
  73. package/lib/commonjs/utils/getPreferredUnitsTyped.js.map +1 -1
  74. package/lib/commonjs/utils/getRequestStatusForAuthorization.js +4 -6
  75. package/lib/commonjs/utils/getRequestStatusForAuthorization.js.map +1 -1
  76. package/lib/commonjs/utils/prepareOptions.js +0 -4
  77. package/lib/commonjs/utils/prepareOptions.js.map +1 -1
  78. package/lib/commonjs/utils/queryCategorySamples.js +3 -14
  79. package/lib/commonjs/utils/queryCategorySamples.js.map +1 -1
  80. package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js +22 -0
  81. package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js.map +1 -0
  82. package/lib/commonjs/utils/queryCorrelationSamples.js +1 -7
  83. package/lib/commonjs/utils/queryCorrelationSamples.js.map +1 -1
  84. package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js +3 -13
  85. package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js.map +1 -1
  86. package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js +22 -0
  87. package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -0
  88. package/lib/commonjs/utils/queryQuantitySamples.js +3 -15
  89. package/lib/commonjs/utils/queryQuantitySamples.js.map +1 -1
  90. package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js +24 -0
  91. package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js.map +1 -0
  92. package/lib/commonjs/utils/querySources.js +0 -4
  93. package/lib/commonjs/utils/querySources.js.map +1 -1
  94. package/lib/commonjs/utils/queryStatisticsForQuantity.js +3 -7
  95. package/lib/commonjs/utils/queryStatisticsForQuantity.js.map +1 -1
  96. package/lib/commonjs/utils/queryWorkouts.js +1 -8
  97. package/lib/commonjs/utils/queryWorkouts.js.map +1 -1
  98. package/lib/commonjs/utils/requestAuthorization.js +4 -6
  99. package/lib/commonjs/utils/requestAuthorization.js.map +1 -1
  100. package/lib/commonjs/utils/saveCategorySample.js +0 -4
  101. package/lib/commonjs/utils/saveCategorySample.js.map +1 -1
  102. package/lib/commonjs/utils/saveCorrelationSample.js +3 -7
  103. package/lib/commonjs/utils/saveCorrelationSample.js.map +1 -1
  104. package/lib/commonjs/utils/saveQuantitySample.js +0 -4
  105. package/lib/commonjs/utils/saveQuantitySample.js.map +1 -1
  106. package/lib/commonjs/utils/saveWorkoutSample.js +3 -8
  107. package/lib/commonjs/utils/saveWorkoutSample.js.map +1 -1
  108. package/lib/commonjs/utils/serializeDate.js +0 -2
  109. package/lib/commonjs/utils/serializeDate.js.map +1 -1
  110. package/lib/commonjs/utils/serializeDate.test.js +0 -2
  111. package/lib/commonjs/utils/serializeDate.test.js.map +1 -1
  112. package/lib/commonjs/utils/subscribeToChanges.js +0 -7
  113. package/lib/commonjs/utils/subscribeToChanges.js.map +1 -1
  114. package/lib/module/hooks/useHealthkitAuthorization.js +0 -2
  115. package/lib/module/hooks/useHealthkitAuthorization.js.map +1 -1
  116. package/lib/module/hooks/useHealthkitAuthorization.test.js +1 -1
  117. package/lib/module/hooks/useHealthkitAuthorization.test.js.map +1 -1
  118. package/lib/module/hooks/useIsHealthDataAvailable.js +0 -3
  119. package/lib/module/hooks/useIsHealthDataAvailable.js.map +1 -1
  120. package/lib/module/hooks/useIsHealthDataAvailable.test.js +1 -1
  121. package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +1 -1
  122. package/lib/module/hooks/useMostRecentCategorySample.js +1 -3
  123. package/lib/module/hooks/useMostRecentCategorySample.js.map +1 -1
  124. package/lib/module/hooks/useMostRecentQuantitySample.js +0 -5
  125. package/lib/module/hooks/useMostRecentQuantitySample.js.map +1 -1
  126. package/lib/module/hooks/useMostRecentWorkout.js +0 -5
  127. package/lib/module/hooks/useMostRecentWorkout.js.map +1 -1
  128. package/lib/module/hooks/useSources.js +0 -2
  129. package/lib/module/hooks/useSources.js.map +1 -1
  130. package/lib/module/hooks/useStatisticsForQuantity.js +1 -3
  131. package/lib/module/hooks/useStatisticsForQuantity.js.map +1 -1
  132. package/lib/module/hooks/useSubscribeToChanges.js +0 -5
  133. package/lib/module/hooks/useSubscribeToChanges.js.map +1 -1
  134. package/lib/module/index.ios.js +6 -0
  135. package/lib/module/index.ios.js.map +1 -1
  136. package/lib/module/index.js +8 -8
  137. package/lib/module/index.js.map +1 -1
  138. package/lib/module/jest.setup.js +3 -0
  139. package/lib/module/jest.setup.js.map +1 -1
  140. package/lib/module/native-types.js +134 -201
  141. package/lib/module/native-types.js.map +1 -1
  142. package/lib/module/test-utils.js +0 -2
  143. package/lib/module/test-utils.js.map +1 -1
  144. package/lib/module/types.js.map +1 -1
  145. package/lib/module/utils/deleteQuantitySample.js +0 -2
  146. package/lib/module/utils/deleteQuantitySample.js.map +1 -1
  147. package/lib/module/utils/deleteSamples.js +0 -2
  148. package/lib/module/utils/deleteSamples.js.map +1 -1
  149. package/lib/module/utils/deserializeCategorySample.js +2 -2
  150. package/lib/module/utils/deserializeCategorySample.js.map +1 -1
  151. package/lib/module/utils/deserializeCategorySample.test.js +3 -2
  152. package/lib/module/utils/deserializeCategorySample.test.js.map +1 -1
  153. package/lib/module/utils/deserializeCorrelation.js +2 -4
  154. package/lib/module/utils/deserializeCorrelation.js.map +1 -1
  155. package/lib/module/utils/deserializeHeartbeatSeriesSample.js +2 -2
  156. package/lib/module/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
  157. package/lib/module/utils/deserializeSample.js +2 -2
  158. package/lib/module/utils/deserializeSample.js.map +1 -1
  159. package/lib/module/utils/deserializeWorkout.js +2 -2
  160. package/lib/module/utils/deserializeWorkout.js.map +1 -1
  161. package/lib/module/utils/ensureMetadata.js +0 -1
  162. package/lib/module/utils/ensureMetadata.js.map +1 -1
  163. package/lib/module/utils/ensureUnit.js +0 -3
  164. package/lib/module/utils/ensureUnit.js.map +1 -1
  165. package/lib/module/utils/getDateOfBirth.js +0 -2
  166. package/lib/module/utils/getDateOfBirth.js.map +1 -1
  167. package/lib/module/utils/getMostRecentCategorySample.js +1 -3
  168. package/lib/module/utils/getMostRecentCategorySample.js.map +1 -1
  169. package/lib/module/utils/getMostRecentQuantitySample.js +1 -3
  170. package/lib/module/utils/getMostRecentQuantitySample.js.map +1 -1
  171. package/lib/module/utils/getMostRecentWorkout.js +0 -2
  172. package/lib/module/utils/getMostRecentWorkout.js.map +1 -1
  173. package/lib/module/utils/getPreferredUnit.js +0 -2
  174. package/lib/module/utils/getPreferredUnit.js.map +1 -1
  175. package/lib/module/utils/getPreferredUnits.js +0 -2
  176. package/lib/module/utils/getPreferredUnits.js.map +1 -1
  177. package/lib/module/utils/getPreferredUnitsTyped.js +0 -8
  178. package/lib/module/utils/getPreferredUnitsTyped.js.map +1 -1
  179. package/lib/module/utils/getRequestStatusForAuthorization.js +4 -4
  180. package/lib/module/utils/getRequestStatusForAuthorization.js.map +1 -1
  181. package/lib/module/utils/prepareOptions.js +0 -2
  182. package/lib/module/utils/prepareOptions.js.map +1 -1
  183. package/lib/module/utils/queryCategorySamples.js +3 -10
  184. package/lib/module/utils/queryCategorySamples.js.map +1 -1
  185. package/lib/module/utils/queryCategorySamplesWithAnchor.js +14 -0
  186. package/lib/module/utils/queryCategorySamplesWithAnchor.js.map +1 -0
  187. package/lib/module/utils/queryCorrelationSamples.js +1 -3
  188. package/lib/module/utils/queryCorrelationSamples.js.map +1 -1
  189. package/lib/module/utils/queryHeartbeatSeriesSamples.js +3 -9
  190. package/lib/module/utils/queryHeartbeatSeriesSamples.js.map +1 -1
  191. package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js +14 -0
  192. package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -0
  193. package/lib/module/utils/queryQuantitySamples.js +3 -10
  194. package/lib/module/utils/queryQuantitySamples.js.map +1 -1
  195. package/lib/module/utils/queryQuantitySamplesWithAnchor.js +16 -0
  196. package/lib/module/utils/queryQuantitySamplesWithAnchor.js.map +1 -0
  197. package/lib/module/utils/querySources.js +0 -2
  198. package/lib/module/utils/querySources.js.map +1 -1
  199. package/lib/module/utils/queryStatisticsForQuantity.js +3 -4
  200. package/lib/module/utils/queryStatisticsForQuantity.js.map +1 -1
  201. package/lib/module/utils/queryWorkouts.js +1 -3
  202. package/lib/module/utils/queryWorkouts.js.map +1 -1
  203. package/lib/module/utils/requestAuthorization.js +4 -4
  204. package/lib/module/utils/requestAuthorization.js.map +1 -1
  205. package/lib/module/utils/saveCategorySample.js +0 -2
  206. package/lib/module/utils/saveCategorySample.js.map +1 -1
  207. package/lib/module/utils/saveCorrelationSample.js +3 -4
  208. package/lib/module/utils/saveCorrelationSample.js.map +1 -1
  209. package/lib/module/utils/saveQuantitySample.js +0 -2
  210. package/lib/module/utils/saveQuantitySample.js.map +1 -1
  211. package/lib/module/utils/saveWorkoutSample.js +3 -5
  212. package/lib/module/utils/saveWorkoutSample.js.map +1 -1
  213. package/lib/module/utils/serializeDate.js +0 -1
  214. package/lib/module/utils/serializeDate.js.map +1 -1
  215. package/lib/module/utils/serializeDate.test.js.map +1 -1
  216. package/lib/module/utils/subscribeToChanges.js +0 -3
  217. package/lib/module/utils/subscribeToChanges.js.map +1 -1
  218. package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +2 -3
  219. package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +2 -3
  220. package/lib/typescript/src/index.ios.d.ts +4 -1
  221. package/lib/typescript/src/native-types.d.ts +66 -63
  222. package/lib/typescript/src/types.d.ts +3 -3
  223. package/lib/typescript/src/utils/deleteQuantitySample.d.ts +1 -1
  224. package/lib/typescript/src/utils/deleteSamples.d.ts +1 -1
  225. package/lib/typescript/src/utils/getMostRecentCategorySample.d.ts +1 -1
  226. package/lib/typescript/src/utils/getMostRecentQuantitySample.d.ts +1 -1
  227. package/lib/typescript/src/utils/getMostRecentWorkout.d.ts +1 -1
  228. package/lib/typescript/src/utils/getPreferredUnit.d.ts +1 -1
  229. package/lib/typescript/src/utils/getPreferredUnits.d.ts +1 -1
  230. package/lib/typescript/src/utils/queryCategorySamples.d.ts +3 -8
  231. package/lib/typescript/src/utils/queryCategorySamplesWithAnchor.d.ts +10 -0
  232. package/lib/typescript/src/utils/queryCorrelationSamples.d.ts +1 -1
  233. package/lib/typescript/src/utils/queryHeartbeatSeriesSamples.d.ts +2 -2
  234. package/lib/typescript/src/utils/queryHeartbeatSeriesSamplesWithAnchor.d.ts +10 -0
  235. package/lib/typescript/src/utils/queryQuantitySamples.d.ts +4 -9
  236. package/lib/typescript/src/utils/queryQuantitySamplesWithAnchor.d.ts +12 -0
  237. package/lib/typescript/src/utils/querySources.d.ts +1 -1
  238. package/package.json +20 -18
  239. package/src/hooks/useHealthkitAuthorization.test.ts +1 -1
  240. package/src/hooks/useIsHealthDataAvailable.test.ts +1 -1
  241. package/src/hooks/useMostRecentCategorySample.ts +3 -4
  242. package/src/hooks/useMostRecentQuantitySample.ts +2 -3
  243. package/src/hooks/useStatisticsForQuantity.ts +1 -1
  244. package/src/index.ios.tsx +6 -0
  245. package/src/index.tsx +10 -5
  246. package/src/jest.setup.ts +3 -0
  247. package/src/native-types.ts +28 -7
  248. package/src/utils/deserializeCategorySample.test.ts +1 -1
  249. package/src/utils/getMostRecentCategorySample.ts +1 -1
  250. package/src/utils/getMostRecentQuantitySample.ts +1 -1
  251. package/src/utils/queryCategorySamples.ts +6 -18
  252. package/src/utils/queryCategorySamplesWithAnchor.ts +39 -0
  253. package/src/utils/queryCorrelationSamples.ts +2 -2
  254. package/src/utils/queryHeartbeatSeriesSamples.ts +3 -8
  255. package/src/utils/queryHeartbeatSeriesSamplesWithAnchor.ts +33 -0
  256. package/src/utils/queryQuantitySamples.ts +8 -18
  257. package/src/utils/queryQuantitySamplesWithAnchor.ts +46 -0
  258. package/src/utils/queryStatisticsForQuantity.ts +1 -1
  259. package/src/utils/queryWorkouts.ts +1 -1
  260. package/src/utils/saveCorrelationSample.ts +1 -1
  261. package/src/utils/saveWorkoutSample.ts +1 -1
  262. package/android/.project +0 -34
  263. package/android/.settings/org.eclipse.buildship.core.prefs +0 -13
  264. package/android/build.gradle +0 -130
  265. package/android/gradle.properties +0 -4
  266. package/android/src/main/AndroidManifest.xml +0 -4
  267. package/android/src/main/java/com/kingstinctreactnativehealthkit/ReactNativeHealthkitModule.kt +0 -24
  268. package/android/src/main/java/com/kingstinctreactnativehealthkit/ReactNativeHealthkitPackage.kt +0 -20
@@ -1,11 +1,9 @@
1
1
  import Native from '../native-types';
2
-
3
2
  async function saveCategorySample(identifier, value, options) {
4
3
  const start = (options === null || options === void 0 ? void 0 : options.start) || (options === null || options === void 0 ? void 0 : options.end) || new Date();
5
4
  const end = (options === null || options === void 0 ? void 0 : options.end) || (options === null || options === void 0 ? void 0 : options.start) || new Date();
6
5
  const metadata = (options === null || options === void 0 ? void 0 : options.metadata) || {};
7
6
  return Native.saveCategorySample(identifier, value, start.toISOString(), end.toISOString(), metadata || {});
8
7
  }
9
-
10
8
  export default saveCategorySample;
11
9
  //# sourceMappingURL=saveCategorySample.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Native","saveCategorySample","identifier","value","options","start","end","Date","metadata","toISOString"],"sources":["saveCategorySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategoryValueForIdentifier, MetadataMapperForCategoryIdentifier } from '../native-types'\n\nasync function saveCategorySample<T extends HKCategoryTypeIdentifier>(\n identifier: T,\n value: HKCategoryValueForIdentifier<T>,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCategoryIdentifier<T>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveCategorySample(\n identifier,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata || {},\n )\n}\n\nexport default saveCategorySample\n"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,iBAAnB;;AAIA,eAAeC,kBAAf,CACEC,UADF,EAEEC,KAFF,EAGEC,OAHF,EAQE;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEC,KAAT,MAAkBD,OAAlB,aAAkBA,OAAlB,uBAAkBA,OAAO,CAAEE,GAA3B,KAAkC,IAAIC,IAAJ,EAAhD;EACA,MAAMD,GAAG,GAAG,CAAAF,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEE,GAAT,MAAgBF,OAAhB,aAAgBA,OAAhB,uBAAgBA,OAAO,CAAEC,KAAzB,KAAkC,IAAIE,IAAJ,EAA9C;EACA,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEI,QAAT,KAAqB,EAAtC;EAEA,OAAOR,MAAM,CAACC,kBAAP,CACLC,UADK,EAELC,KAFK,EAGLE,KAAK,CAACI,WAAN,EAHK,EAILH,GAAG,CAACG,WAAJ,EAJK,EAKLD,QAAQ,IAAI,EALP,CAAP;AAOD;;AAED,eAAeP,kBAAf"}
1
+ {"version":3,"names":["Native","saveCategorySample","identifier","value","options","start","end","Date","metadata","toISOString"],"sources":["saveCategorySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategoryValueForIdentifier, MetadataMapperForCategoryIdentifier } from '../native-types'\n\nasync function saveCategorySample<T extends HKCategoryTypeIdentifier>(\n identifier: T,\n value: HKCategoryValueForIdentifier<T>,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCategoryIdentifier<T>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveCategorySample(\n identifier,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata || {},\n )\n}\n\nexport default saveCategorySample\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC,eAAeC,kBAAkBA,CAC/BC,UAAa,EACbC,KAAsC,EACtCC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,MAAID,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC;EAC1D,MAAMD,GAAG,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,MAAIF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIE,IAAI,CAAC,CAAC;EACxD,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,QAAQ,KAAI,CAAC,CAAC;EAExC,OAAOR,MAAM,CAACC,kBAAkB,CAC9BC,UAAU,EACVC,KAAK,EACLE,KAAK,CAACI,WAAW,CAAC,CAAC,EACnBH,GAAG,CAACG,WAAW,CAAC,CAAC,EACjBD,QAAQ,IAAI,CAAC,CACf,CAAC;AACH;AAEA,eAAeP,kBAAkB"}
@@ -1,13 +1,12 @@
1
- import Native from '../native-types';
2
1
  import ensureMetadata from './ensureMetadata';
3
-
2
+ import Native from '../native-types';
4
3
  async function saveCorrelationSample(typeIdentifier, samples, options) {
5
4
  const start = ((options === null || options === void 0 ? void 0 : options.start) || new Date()).toISOString();
6
5
  const end = ((options === null || options === void 0 ? void 0 : options.end) || new Date()).toISOString();
7
- return Native.saveCorrelationSample(typeIdentifier, samples.map(s => ({ ...s,
6
+ return Native.saveCorrelationSample(typeIdentifier, samples.map(s => ({
7
+ ...s,
8
8
  metadata: ensureMetadata(s.metadata)
9
9
  })), start, end, ensureMetadata(options === null || options === void 0 ? void 0 : options.metadata));
10
10
  }
11
-
12
11
  export default saveCorrelationSample;
13
12
  //# sourceMappingURL=saveCorrelationSample.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Native","ensureMetadata","saveCorrelationSample","typeIdentifier","samples","options","start","Date","toISOString","end","map","s","metadata"],"sources":["saveCorrelationSample.ts"],"sourcesContent":["import Native from '../native-types'\nimport ensureMetadata from './ensureMetadata'\n\nimport type { MetadataMapperForCorrelationIdentifier, HKCorrelationTypeIdentifier } from '../native-types'\nimport type { HKCategorySampleForSaving, HKQuantitySampleForSaving } from '../types'\n\nasync function saveCorrelationSample<\n TIdentifier extends HKCorrelationTypeIdentifier,\n TSamples extends readonly(\n | HKCategorySampleForSaving\n | HKQuantitySampleForSaving\n )[]\n>(\n typeIdentifier: TIdentifier,\n samples: TSamples,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCorrelationIdentifier<TIdentifier>;\n },\n) {\n const start = (options?.start || new Date()).toISOString()\n const end = (options?.end || new Date()).toISOString()\n\n return Native.saveCorrelationSample(\n typeIdentifier,\n samples.map((s) => ({ ...s, metadata: ensureMetadata(s.metadata) })),\n start,\n end,\n ensureMetadata(options?.metadata),\n )\n}\n\nexport default saveCorrelationSample\n"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,iBAAnB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;;AAKA,eAAeC,qBAAf,CAOEC,cAPF,EAQEC,OARF,EASEC,OATF,EAcE;EACA,MAAMC,KAAK,GAAG,CAAC,CAAAD,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEC,KAAT,KAAkB,IAAIC,IAAJ,EAAnB,EAA+BC,WAA/B,EAAd;EACA,MAAMC,GAAG,GAAG,CAAC,CAAAJ,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEI,GAAT,KAAgB,IAAIF,IAAJ,EAAjB,EAA6BC,WAA7B,EAAZ;EAEA,OAAOR,MAAM,CAACE,qBAAP,CACLC,cADK,EAELC,OAAO,CAACM,GAAR,CAAaC,CAAD,KAAQ,EAAE,GAAGA,CAAL;IAAQC,QAAQ,EAAEX,cAAc,CAACU,CAAC,CAACC,QAAH;EAAhC,CAAR,CAAZ,CAFK,EAGLN,KAHK,EAILG,GAJK,EAKLR,cAAc,CAACI,OAAD,aAACA,OAAD,uBAACA,OAAO,CAAEO,QAAV,CALT,CAAP;AAOD;;AAED,eAAeV,qBAAf"}
1
+ {"version":3,"names":["ensureMetadata","Native","saveCorrelationSample","typeIdentifier","samples","options","start","Date","toISOString","end","map","s","metadata"],"sources":["saveCorrelationSample.ts"],"sourcesContent":["import ensureMetadata from './ensureMetadata'\nimport Native from '../native-types'\n\nimport type { MetadataMapperForCorrelationIdentifier, HKCorrelationTypeIdentifier } from '../native-types'\nimport type { HKCategorySampleForSaving, HKQuantitySampleForSaving } from '../types'\n\nasync function saveCorrelationSample<\n TIdentifier extends HKCorrelationTypeIdentifier,\n TSamples extends readonly(\n | HKCategorySampleForSaving\n | HKQuantitySampleForSaving\n )[]\n>(\n typeIdentifier: TIdentifier,\n samples: TSamples,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForCorrelationIdentifier<TIdentifier>;\n },\n) {\n const start = (options?.start || new Date()).toISOString()\n const end = (options?.end || new Date()).toISOString()\n\n return Native.saveCorrelationSample(\n typeIdentifier,\n samples.map((s) => ({ ...s, metadata: ensureMetadata(s.metadata) })),\n start,\n end,\n ensureMetadata(options?.metadata),\n )\n}\n\nexport default saveCorrelationSample\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAKpC,eAAeC,qBAAqBA,CAOlCC,cAA2B,EAC3BC,OAAiB,EACjBC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAC,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIC,IAAI,CAAC,CAAC,EAAEC,WAAW,CAAC,CAAC;EAC1D,MAAMC,GAAG,GAAG,CAAC,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,GAAG,KAAI,IAAIF,IAAI,CAAC,CAAC,EAAEC,WAAW,CAAC,CAAC;EAEtD,OAAOP,MAAM,CAACC,qBAAqB,CACjCC,cAAc,EACdC,OAAO,CAACM,GAAG,CAAEC,CAAC,KAAM;IAAE,GAAGA,CAAC;IAAEC,QAAQ,EAAEZ,cAAc,CAACW,CAAC,CAACC,QAAQ;EAAE,CAAC,CAAC,CAAC,EACpEN,KAAK,EACLG,GAAG,EACHT,cAAc,CAACK,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,QAAQ,CAClC,CAAC;AACH;AAEA,eAAeV,qBAAqB"}
@@ -1,11 +1,9 @@
1
1
  import Native from '../native-types';
2
-
3
2
  async function saveQuantitySample(identifier, unit, value, options) {
4
3
  const start = (options === null || options === void 0 ? void 0 : options.start) || (options === null || options === void 0 ? void 0 : options.end) || new Date();
5
4
  const end = (options === null || options === void 0 ? void 0 : options.end) || (options === null || options === void 0 ? void 0 : options.start) || new Date();
6
5
  const metadata = (options === null || options === void 0 ? void 0 : options.metadata) || {};
7
6
  return Native.saveQuantitySample(identifier, unit, value, start.toISOString(), end.toISOString(), metadata);
8
7
  }
9
-
10
8
  export default saveQuantitySample;
11
9
  //# sourceMappingURL=saveQuantitySample.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Native","saveQuantitySample","identifier","unit","value","options","start","end","Date","metadata","toISOString"],"sources":["saveQuantitySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { MetadataMapperForQuantityIdentifier, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function saveQuantitySample<TType extends HKQuantityTypeIdentifier>(\n identifier: TType,\n unit: UnitForIdentifier<TType>,\n value: number,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForQuantityIdentifier<TType>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveQuantitySample(\n identifier,\n unit,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata,\n )\n}\n\nexport default saveQuantitySample\n"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,iBAAnB;;AAIA,eAAeC,kBAAf,CACEC,UADF,EAEEC,IAFF,EAGEC,KAHF,EAIEC,OAJF,EASE;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEC,KAAT,MAAkBD,OAAlB,aAAkBA,OAAlB,uBAAkBA,OAAO,CAAEE,GAA3B,KAAkC,IAAIC,IAAJ,EAAhD;EACA,MAAMD,GAAG,GAAG,CAAAF,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEE,GAAT,MAAgBF,OAAhB,aAAgBA,OAAhB,uBAAgBA,OAAO,CAAEC,KAAzB,KAAkC,IAAIE,IAAJ,EAA9C;EACA,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEI,QAAT,KAAqB,EAAtC;EAEA,OAAOT,MAAM,CAACC,kBAAP,CACLC,UADK,EAELC,IAFK,EAGLC,KAHK,EAILE,KAAK,CAACI,WAAN,EAJK,EAKLH,GAAG,CAACG,WAAJ,EALK,EAMLD,QANK,CAAP;AAQD;;AAED,eAAeR,kBAAf"}
1
+ {"version":3,"names":["Native","saveQuantitySample","identifier","unit","value","options","start","end","Date","metadata","toISOString"],"sources":["saveQuantitySample.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { MetadataMapperForQuantityIdentifier, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function saveQuantitySample<TType extends HKQuantityTypeIdentifier>(\n identifier: TType,\n unit: UnitForIdentifier<TType>,\n value: number,\n options?: {\n readonly start?: Date;\n readonly end?: Date;\n readonly metadata?: MetadataMapperForQuantityIdentifier<TType>;\n },\n) {\n const start = options?.start || options?.end || new Date()\n const end = options?.end || options?.start || new Date()\n const metadata = options?.metadata || {}\n\n return Native.saveQuantitySample(\n identifier,\n unit,\n value,\n start.toISOString(),\n end.toISOString(),\n metadata,\n )\n}\n\nexport default saveQuantitySample\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,iBAAiB;AAIpC,eAAeC,kBAAkBA,CAC/BC,UAAiB,EACjBC,IAA8B,EAC9BC,KAAa,EACbC,OAIC,EACD;EACA,MAAMC,KAAK,GAAG,CAAAD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,MAAID,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC;EAC1D,MAAMD,GAAG,GAAG,CAAAF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,GAAG,MAAIF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,KAAK,KAAI,IAAIE,IAAI,CAAC,CAAC;EACxD,MAAMC,QAAQ,GAAG,CAAAJ,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEI,QAAQ,KAAI,CAAC,CAAC;EAExC,OAAOT,MAAM,CAACC,kBAAkB,CAC9BC,UAAU,EACVC,IAAI,EACJC,KAAK,EACLE,KAAK,CAACI,WAAW,CAAC,CAAC,EACnBH,GAAG,CAACG,WAAW,CAAC,CAAC,EACjBD,QACF,CAAC;AACH;AAEA,eAAeR,kBAAkB"}
@@ -1,14 +1,12 @@
1
- import Native from '../native-types';
2
1
  import ensureMetadata from './ensureMetadata';
3
-
2
+ import Native from '../native-types';
4
3
  async function saveWorkoutSample(typeIdentifier, quantities, _start, options) {
5
4
  const start = _start.toISOString();
6
-
7
5
  const end = ((options === null || options === void 0 ? void 0 : options.end) || new Date()).toISOString();
8
- return Native.saveWorkoutSample(typeIdentifier, quantities.map(s => ({ ...s,
6
+ return Native.saveWorkoutSample(typeIdentifier, quantities.map(s => ({
7
+ ...s,
9
8
  metadata: ensureMetadata(s.metadata)
10
9
  })), start, end, ensureMetadata(options === null || options === void 0 ? void 0 : options.metadata));
11
10
  }
12
-
13
11
  export default saveWorkoutSample;
14
12
  //# sourceMappingURL=saveWorkoutSample.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Native","ensureMetadata","saveWorkoutSample","typeIdentifier","quantities","_start","options","start","toISOString","end","Date","map","s","metadata"],"sources":["saveWorkoutSample.ts"],"sourcesContent":["import Native from '../native-types'\nimport ensureMetadata from './ensureMetadata'\n\nimport type { HKWorkoutActivityType, HKWorkoutMetadata } from '../native-types'\nimport type { HKQuantitySampleForSaving } from '../types'\n\nasync function saveWorkoutSample<TIdentifier extends HKWorkoutActivityType>(\n typeIdentifier: TIdentifier,\n quantities: readonly HKQuantitySampleForSaving[],\n _start: Date,\n options?: {\n readonly end?: Date;\n readonly metadata?: HKWorkoutMetadata;\n },\n) {\n const start = _start.toISOString()\n const end = (options?.end || new Date()).toISOString()\n\n return Native.saveWorkoutSample(\n typeIdentifier,\n quantities.map(((s) => ({ ...s, metadata: ensureMetadata(s.metadata) }))),\n start,\n end,\n ensureMetadata(options?.metadata),\n )\n}\n\nexport default saveWorkoutSample\n"],"mappings":"AAAA,OAAOA,MAAP,MAAmB,iBAAnB;AACA,OAAOC,cAAP,MAA2B,kBAA3B;;AAKA,eAAeC,iBAAf,CACEC,cADF,EAEEC,UAFF,EAGEC,MAHF,EAIEC,OAJF,EAQE;EACA,MAAMC,KAAK,GAAGF,MAAM,CAACG,WAAP,EAAd;;EACA,MAAMC,GAAG,GAAG,CAAC,CAAAH,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAEG,GAAT,KAAgB,IAAIC,IAAJ,EAAjB,EAA6BF,WAA7B,EAAZ;EAEA,OAAOR,MAAM,CAACE,iBAAP,CACLC,cADK,EAELC,UAAU,CAACO,GAAX,CAAiBC,CAAD,KAAQ,EAAE,GAAGA,CAAL;IAAQC,QAAQ,EAAEZ,cAAc,CAACW,CAAC,CAACC,QAAH;EAAhC,CAAR,CAAhB,CAFK,EAGLN,KAHK,EAILE,GAJK,EAKLR,cAAc,CAACK,OAAD,aAACA,OAAD,uBAACA,OAAO,CAAEO,QAAV,CALT,CAAP;AAOD;;AAED,eAAeX,iBAAf"}
1
+ {"version":3,"names":["ensureMetadata","Native","saveWorkoutSample","typeIdentifier","quantities","_start","options","start","toISOString","end","Date","map","s","metadata"],"sources":["saveWorkoutSample.ts"],"sourcesContent":["import ensureMetadata from './ensureMetadata'\nimport Native from '../native-types'\n\nimport type { HKWorkoutActivityType, HKWorkoutMetadata } from '../native-types'\nimport type { HKQuantitySampleForSaving } from '../types'\n\nasync function saveWorkoutSample<TIdentifier extends HKWorkoutActivityType>(\n typeIdentifier: TIdentifier,\n quantities: readonly HKQuantitySampleForSaving[],\n _start: Date,\n options?: {\n readonly end?: Date;\n readonly metadata?: HKWorkoutMetadata;\n },\n) {\n const start = _start.toISOString()\n const end = (options?.end || new Date()).toISOString()\n\n return Native.saveWorkoutSample(\n typeIdentifier,\n quantities.map(((s) => ({ ...s, metadata: ensureMetadata(s.metadata) }))),\n start,\n end,\n ensureMetadata(options?.metadata),\n )\n}\n\nexport default saveWorkoutSample\n"],"mappings":"AAAA,OAAOA,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,MAAM,MAAM,iBAAiB;AAKpC,eAAeC,iBAAiBA,CAC9BC,cAA2B,EAC3BC,UAAgD,EAChDC,MAAY,EACZC,OAGC,EACD;EACA,MAAMC,KAAK,GAAGF,MAAM,CAACG,WAAW,CAAC,CAAC;EAClC,MAAMC,GAAG,GAAG,CAAC,CAAAH,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEG,GAAG,KAAI,IAAIC,IAAI,CAAC,CAAC,EAAEF,WAAW,CAAC,CAAC;EAEtD,OAAOP,MAAM,CAACC,iBAAiB,CAC7BC,cAAc,EACdC,UAAU,CAACO,GAAG,CAAGC,CAAC,KAAM;IAAE,GAAGA,CAAC;IAAEC,QAAQ,EAAEb,cAAc,CAACY,CAAC,CAACC,QAAQ;EAAE,CAAC,CAAE,CAAC,EACzEN,KAAK,EACLE,GAAG,EACHT,cAAc,CAACM,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEO,QAAQ,CAClC,CAAC;AACH;AAEA,eAAeX,iBAAiB"}
@@ -1,4 +1,3 @@
1
1
  const serializeDate = date => (date || new Date(-1)).toISOString();
2
-
3
2
  export default serializeDate;
4
3
  //# sourceMappingURL=serializeDate.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["serializeDate","date","Date","toISOString"],"sources":["serializeDate.ts"],"sourcesContent":["const serializeDate = (date?: Date | null): string => (\n (date || new Date(-1)).toISOString()\n)\n\nexport default serializeDate\n"],"mappings":"AAAA,MAAMA,aAAa,GAAIC,IAAD,IACpB,CAACA,IAAI,IAAI,IAAIC,IAAJ,CAAS,CAAC,CAAV,CAAT,EAAuBC,WAAvB,EADF;;AAIA,eAAeH,aAAf"}
1
+ {"version":3,"names":["serializeDate","date","Date","toISOString"],"sources":["serializeDate.ts"],"sourcesContent":["const serializeDate = (date?: Date | null): string => (\n (date || new Date(-1)).toISOString()\n)\n\nexport default serializeDate\n"],"mappings":"AAAA,MAAMA,aAAa,GAAIC,IAAkB,IACvC,CAACA,IAAI,IAAI,IAAIC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAEC,WAAW,CAAC,CACpC;AAED,eAAeH,aAAa"}
@@ -1 +1 @@
1
- {"version":3,"names":["serializeDate","describe","it","expect","Date","toBe","date","toISOString"],"sources":["serializeDate.test.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\ndescribe('serializeDate', () => {\n it('should serialize zero date', () => {\n expect(serializeDate(new Date(0))).toBe('1970-01-01T00:00:00.000Z')\n })\n\n it('should serialize date', () => {\n const date = new Date()\n expect(serializeDate(date)).toBe(date.toISOString())\n })\n\n it('should serialize null date', () => {\n expect(serializeDate(null)).toBe('1969-12-31T23:59:59.999Z')\n })\n})\n"],"mappings":"AAAA,OAAOA,aAAP,MAA0B,iBAA1B;AAEAC,QAAQ,CAAC,eAAD,EAAkB,MAAM;EAC9BC,EAAE,CAAC,4BAAD,EAA+B,MAAM;IACrCC,MAAM,CAACH,aAAa,CAAC,IAAII,IAAJ,CAAS,CAAT,CAAD,CAAd,CAAN,CAAmCC,IAAnC,CAAwC,0BAAxC;EACD,CAFC,CAAF;EAIAH,EAAE,CAAC,uBAAD,EAA0B,MAAM;IAChC,MAAMI,IAAI,GAAG,IAAIF,IAAJ,EAAb;IACAD,MAAM,CAACH,aAAa,CAACM,IAAD,CAAd,CAAN,CAA4BD,IAA5B,CAAiCC,IAAI,CAACC,WAAL,EAAjC;EACD,CAHC,CAAF;EAKAL,EAAE,CAAC,4BAAD,EAA+B,MAAM;IACrCC,MAAM,CAACH,aAAa,CAAC,IAAD,CAAd,CAAN,CAA4BK,IAA5B,CAAiC,0BAAjC;EACD,CAFC,CAAF;AAGD,CAbO,CAAR"}
1
+ {"version":3,"names":["serializeDate","describe","it","expect","Date","toBe","date","toISOString"],"sources":["serializeDate.test.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\ndescribe('serializeDate', () => {\n it('should serialize zero date', () => {\n expect(serializeDate(new Date(0))).toBe('1970-01-01T00:00:00.000Z')\n })\n\n it('should serialize date', () => {\n const date = new Date()\n expect(serializeDate(date)).toBe(date.toISOString())\n })\n\n it('should serialize null date', () => {\n expect(serializeDate(null)).toBe('1969-12-31T23:59:59.999Z')\n })\n})\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3CC,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9BC,EAAE,CAAC,4BAA4B,EAAE,MAAM;IACrCC,MAAM,CAACH,aAAa,CAAC,IAAII,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,0BAA0B,CAAC;EACrE,CAAC,CAAC;EAEFH,EAAE,CAAC,uBAAuB,EAAE,MAAM;IAChC,MAAMI,IAAI,GAAG,IAAIF,IAAI,CAAC,CAAC;IACvBD,MAAM,CAACH,aAAa,CAACM,IAAI,CAAC,CAAC,CAACD,IAAI,CAACC,IAAI,CAACC,WAAW,CAAC,CAAC,CAAC;EACtD,CAAC,CAAC;EAEFL,EAAE,CAAC,4BAA4B,EAAE,MAAM;IACrCC,MAAM,CAACH,aAAa,CAAC,IAAI,CAAC,CAAC,CAACK,IAAI,CAAC,0BAA0B,CAAC;EAC9D,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,11 +1,9 @@
1
1
  import Native, { EventEmitter } from '../native-types';
2
-
3
2
  const subscribeToChanges = async (identifier, callback) => {
4
3
  const subscription = EventEmitter.addListener('onChange', _ref => {
5
4
  let {
6
5
  typeIdentifier
7
6
  } = _ref;
8
-
9
7
  if (typeIdentifier === identifier) {
10
8
  callback();
11
9
  }
@@ -19,6 +17,5 @@ const subscribeToChanges = async (identifier, callback) => {
19
17
  return Native.unsubscribeQuery(queryId);
20
18
  };
21
19
  };
22
-
23
20
  export default subscribeToChanges;
24
21
  //# sourceMappingURL=subscribeToChanges.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Native","EventEmitter","subscribeToChanges","identifier","callback","subscription","addListener","typeIdentifier","queryId","subscribeToObserverQuery","catch","error","remove","Promise","reject","unsubscribeQuery"],"sources":["subscribeToChanges.ts"],"sourcesContent":["import Native, { EventEmitter } from '../native-types'\n\nimport type { HKSampleTypeIdentifier } from '..'\n\nconst subscribeToChanges = async (\n identifier: HKSampleTypeIdentifier,\n callback: () => void,\n) => {\n const subscription = EventEmitter.addListener(\n 'onChange',\n ({ typeIdentifier }) => {\n if (typeIdentifier === identifier) {\n callback()\n }\n },\n )\n\n const queryId = await Native.subscribeToObserverQuery(identifier).catch(\n async (error) => {\n subscription.remove()\n return Promise.reject(error)\n },\n )\n\n return async () => {\n subscription.remove()\n return Native.unsubscribeQuery(queryId)\n }\n}\n\nexport default subscribeToChanges\n"],"mappings":"AAAA,OAAOA,MAAP,IAAiBC,YAAjB,QAAqC,iBAArC;;AAIA,MAAMC,kBAAkB,GAAG,OACzBC,UADyB,EAEzBC,QAFyB,KAGtB;EACH,MAAMC,YAAY,GAAGJ,YAAY,CAACK,WAAb,CACnB,UADmB,EAEnB,QAAwB;IAAA,IAAvB;MAAEC;IAAF,CAAuB;;IACtB,IAAIA,cAAc,KAAKJ,UAAvB,EAAmC;MACjCC,QAAQ;IACT;EACF,CANkB,CAArB;EASA,MAAMI,OAAO,GAAG,MAAMR,MAAM,CAACS,wBAAP,CAAgCN,UAAhC,EAA4CO,KAA5C,CACpB,MAAOC,KAAP,IAAiB;IACfN,YAAY,CAACO,MAAb;IACA,OAAOC,OAAO,CAACC,MAAR,CAAeH,KAAf,CAAP;EACD,CAJmB,CAAtB;EAOA,OAAO,YAAY;IACjBN,YAAY,CAACO,MAAb;IACA,OAAOZ,MAAM,CAACe,gBAAP,CAAwBP,OAAxB,CAAP;EACD,CAHD;AAID,CAxBD;;AA0BA,eAAeN,kBAAf"}
1
+ {"version":3,"names":["Native","EventEmitter","subscribeToChanges","identifier","callback","subscription","addListener","_ref","typeIdentifier","queryId","subscribeToObserverQuery","catch","error","remove","Promise","reject","unsubscribeQuery"],"sources":["subscribeToChanges.ts"],"sourcesContent":["import Native, { EventEmitter } from '../native-types'\n\nimport type { HKSampleTypeIdentifier } from '..'\n\nconst subscribeToChanges = async (\n identifier: HKSampleTypeIdentifier,\n callback: () => void,\n) => {\n const subscription = EventEmitter.addListener(\n 'onChange',\n ({ typeIdentifier }) => {\n if (typeIdentifier === identifier) {\n callback()\n }\n },\n )\n\n const queryId = await Native.subscribeToObserverQuery(identifier).catch(\n async (error) => {\n subscription.remove()\n return Promise.reject(error)\n },\n )\n\n return async () => {\n subscription.remove()\n return Native.unsubscribeQuery(queryId)\n }\n}\n\nexport default subscribeToChanges\n"],"mappings":"AAAA,OAAOA,MAAM,IAAIC,YAAY,QAAQ,iBAAiB;AAItD,MAAMC,kBAAkB,GAAG,MAAAA,CACzBC,UAAkC,EAClCC,QAAoB,KACjB;EACH,MAAMC,YAAY,GAAGJ,YAAY,CAACK,WAAW,CAC3C,UAAU,EACVC,IAAA,IAAwB;IAAA,IAAvB;MAAEC;IAAe,CAAC,GAAAD,IAAA;IACjB,IAAIC,cAAc,KAAKL,UAAU,EAAE;MACjCC,QAAQ,CAAC,CAAC;IACZ;EACF,CACF,CAAC;EAED,MAAMK,OAAO,GAAG,MAAMT,MAAM,CAACU,wBAAwB,CAACP,UAAU,CAAC,CAACQ,KAAK,CACrE,MAAOC,KAAK,IAAK;IACfP,YAAY,CAACQ,MAAM,CAAC,CAAC;IACrB,OAAOC,OAAO,CAACC,MAAM,CAACH,KAAK,CAAC;EAC9B,CACF,CAAC;EAED,OAAO,YAAY;IACjBP,YAAY,CAACQ,MAAM,CAAC,CAAC;IACrB,OAAOb,MAAM,CAACgB,gBAAgB,CAACP,OAAO,CAAC;EACzC,CAAC;AACH,CAAC;AAED,eAAeP,kBAAkB"}
@@ -1,4 +1,3 @@
1
- import type { HKCategoryTypeIdentifier } from '../native-types';
2
- import type { HKCategorySample } from '../types';
3
- declare function useMostRecentCategorySample<TCategory extends HKCategoryTypeIdentifier>(identifier: TCategory): HKCategorySample<TCategory> | null;
1
+ import type { HKCategorySampleRaw, HKCategoryTypeIdentifier } from '../native-types';
2
+ declare function useMostRecentCategorySample<TCategory extends HKCategoryTypeIdentifier>(identifier: TCategory): HKCategorySampleRaw<TCategory> | null;
4
3
  export default useMostRecentCategorySample;
@@ -1,4 +1,3 @@
1
- import type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
2
- import type { HKQuantitySample } from '../types';
3
- declare function useMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit?: TUnit): HKQuantitySample<TIdentifier, UnitForIdentifier<TIdentifier>> | null;
1
+ import type { HKQuantitySampleRaw, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types';
2
+ declare function useMostRecentQuantitySample<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit?: TUnit): HKQuantitySampleRaw<TIdentifier, UnitForIdentifier<TIdentifier>> | null;
4
3
  export default useMostRecentQuantitySample;
@@ -11,7 +11,7 @@ import saveCorrelationSample from './utils/saveCorrelationSample';
11
11
  import saveQuantitySample from './utils/saveQuantitySample';
12
12
  import saveWorkoutSample from './utils/saveWorkoutSample';
13
13
  declare const Healthkit: {
14
- authorizationStatusFor: (type: import("./native-types").HealthkitReadAuthorization) => Promise<boolean>;
14
+ authorizationStatusFor: (type: import("./native-types").HealthkitReadAuthorization) => Promise<import("./native-types").HKAuthorizationStatus>;
15
15
  isHealthDataAvailable: () => Promise<boolean>;
16
16
  canAccessProtectedData: () => Promise<boolean>;
17
17
  disableAllBackgroundDelivery: () => Promise<boolean>;
@@ -30,9 +30,12 @@ declare const Healthkit: {
30
30
  getPreferredUnits: import("./utils/getPreferredUnits").GetPreferredUnitsFn;
31
31
  getRequestStatusForAuthorization: (read: readonly import("./native-types").HealthkitReadAuthorization[], write?: readonly import("./native-types").HKSampleTypeIdentifier[]) => Promise<import("./native-types").HKAuthorizationRequestStatus>;
32
32
  queryCategorySamples: import("./utils/queryCategorySamples").QueryCategorySamplesFn;
33
+ queryCategorySamplesWithAnchor: import("./utils/queryCategorySamplesWithAnchor").QueryCategorySamplesWithAnchorFn;
33
34
  queryCorrelationSamples: import("./utils/queryCorrelationSamples").QueryCorrelationSamplesFn;
34
35
  queryHeartbeatSeriesSamples: import("./utils/queryHeartbeatSeriesSamples").QueryHeartbeatSeriesSamplesFn;
36
+ queryHeartbeatSeriesSamplesWithAnchor: import("./utils/queryHeartbeatSeriesSamplesWithAnchor").QueryHeartbeatSeriesSamplesFn;
35
37
  queryQuantitySamples: import("./utils/queryQuantitySamples").QueryQuantitySamplesFn;
38
+ queryQuantitySamplesWithAnchor: import("./utils/queryQuantitySamplesWithAnchor").QueryQuantitySamplesWithAnchorFn;
36
39
  queryStatisticsForQuantity: typeof queryStatisticsForQuantity;
37
40
  queryWorkouts: typeof queryWorkouts;
38
41
  querySources: import("./utils/querySources").QuerySourcesFn;
@@ -103,7 +103,7 @@ export declare enum HKQuantityTypeIdentifier {
103
103
  waterTemperature = "HKQuantityTypeIdentifierWaterTemperature",
104
104
  appleSleepingWristTemperature = "HKQuantityTypeIdentifierAppleSleepingWristTemperature"
105
105
  }
106
- export declare type TypeToUnitMapping = {
106
+ export type TypeToUnitMapping = {
107
107
  readonly [key in HKQuantityTypeIdentifier]: HKUnit;
108
108
  };
109
109
  export declare enum HKCategoryValueLowCardioFitnessEvent {
@@ -182,9 +182,9 @@ export declare enum HKCategoryTypeIdentifier {
182
182
  vomiting = "HKCategoryTypeIdentifierVomiting",
183
183
  wheezing = "HKCategoryTypeIdentifierWheezing"
184
184
  }
185
- export declare type HKSampleTypeIdentifier = HKCategoryTypeIdentifier | HKCorrelationTypeIdentifier | HKQuantityTypeIdentifier | typeof HKAudiogramTypeIdentifier | typeof HKDataTypeIdentifierHeartbeatSeries | typeof HKWorkoutRouteTypeIdentifier | typeof HKWorkoutTypeIdentifier | `${HKCategoryTypeIdentifier}` | `${HKCorrelationTypeIdentifier}` | `${HKQuantityTypeIdentifier}`;
186
- export declare type HealthkitReadAuthorization = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier | `${HKCharacteristicTypeIdentifier}` | `${HKSampleTypeIdentifier}`;
187
- export declare type HealthkitWriteAuthorization = HKSampleTypeIdentifier;
185
+ export type HKSampleTypeIdentifier = HKCategoryTypeIdentifier | HKCorrelationTypeIdentifier | HKQuantityTypeIdentifier | typeof HKAudiogramTypeIdentifier | typeof HKDataTypeIdentifierHeartbeatSeries | typeof HKWorkoutRouteTypeIdentifier | typeof HKWorkoutTypeIdentifier | `${HKCategoryTypeIdentifier}` | `${HKCorrelationTypeIdentifier}` | `${HKQuantityTypeIdentifier}`;
186
+ export type HealthkitReadAuthorization = HKCharacteristicTypeIdentifier | HKSampleTypeIdentifier | `${HKCharacteristicTypeIdentifier}` | `${HKSampleTypeIdentifier}`;
187
+ export type HealthkitWriteAuthorization = HKSampleTypeIdentifier;
188
188
  export declare enum HKCategoryValueAppleStandHour {
189
189
  stood = 0,
190
190
  idle = 1
@@ -268,7 +268,7 @@ export declare enum HKWorkoutActivityType {
268
268
  fitnessGaming = 76,
269
269
  other = 3000
270
270
  }
271
- export declare type HKGenericMetadata = {
271
+ export type HKGenericMetadata = {
272
272
  readonly [key: string]: HKQuantity | boolean | number | string | undefined;
273
273
  readonly HKExternalUUID?: string;
274
274
  readonly HKTimeZone?: string;
@@ -336,7 +336,7 @@ export declare enum HKAuthorizationStatus {
336
336
  sharingDenied = 1,
337
337
  sharingAuthorized = 2
338
338
  }
339
- export declare type HKQuantity<TIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>> = {
339
+ export type HKQuantity<TIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier> = UnitForIdentifier<TIdentifier>> = {
340
340
  readonly unit: TUnit;
341
341
  readonly quantity: number;
342
342
  };
@@ -376,7 +376,7 @@ export declare enum HKStatisticsOptions {
376
376
  mostRecent = "mostRecent",
377
377
  separateBySource = "separateBySource"
378
378
  }
379
- export declare type QueryStatisticsResponseRaw<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>> = {
379
+ export type QueryStatisticsResponseRaw<TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>> = {
380
380
  readonly averageQuantity?: HKQuantity<TIdentifier, TUnit>;
381
381
  readonly maximumQuantity?: HKQuantity<TIdentifier, TUnit>;
382
382
  readonly minimumQuantity?: HKQuantity<TIdentifier, TUnit>;
@@ -436,32 +436,32 @@ export declare enum HKCategoryValueSeverity {
436
436
  export declare enum HKCategoryValueNotApplicable {
437
437
  notApplicable = 0
438
438
  }
439
- export declare type HKCategoryValue = HKCategoryValueAppetiteChanges | HKCategoryValueCervicalMucusQuality | HKCategoryValueLowCardioFitnessEvent | HKCategoryValueMenstrualFlow | HKCategoryValueOvulationTestResult | HKCategoryValuePresence | HKCategoryValueSeverity | HKCategoryValueSleepAnalysis | number;
439
+ export type HKCategoryValue = HKCategoryValueAppetiteChanges | HKCategoryValueCervicalMucusQuality | HKCategoryValueLowCardioFitnessEvent | HKCategoryValueMenstrualFlow | HKCategoryValueOvulationTestResult | HKCategoryValuePresence | HKCategoryValueSeverity | HKCategoryValueSleepAnalysis | number;
440
440
  export declare enum HKInsulinDeliveryReason {
441
441
  basal = 1,
442
442
  bolus = 2
443
443
  }
444
- export declare type MetadataMapperForQuantityIdentifier<TQuantityTypeIdentifier = HKQuantityTypeIdentifier> = TQuantityTypeIdentifier extends HKQuantityTypeIdentifier.insulinDelivery ? HKGenericMetadata & {
444
+ export type MetadataMapperForQuantityIdentifier<TQuantityTypeIdentifier = HKQuantityTypeIdentifier> = TQuantityTypeIdentifier extends HKQuantityTypeIdentifier.insulinDelivery ? HKGenericMetadata & {
445
445
  readonly HKInsulinDeliveryReason: HKInsulinDeliveryReason;
446
446
  } : TQuantityTypeIdentifier extends HKQuantityTypeIdentifier.bloodGlucose ? HKGenericMetadata & {
447
447
  readonly HKBloodGlucoseMealTime?: number;
448
448
  } : TQuantityTypeIdentifier extends HKQuantityTypeIdentifier.heartRate ? HKGenericMetadata & {
449
449
  readonly HKHeartRateMotionContext?: HKHeartRateMotionContext;
450
450
  } : HKGenericMetadata;
451
- export declare type MetadataMapperForCorrelationIdentifier<TCorrelationTypeIdentifier = HKCorrelationTypeIdentifier> = TCorrelationTypeIdentifier extends HKCorrelationTypeIdentifier.food ? HKGenericMetadata & {
451
+ export type MetadataMapperForCorrelationIdentifier<TCorrelationTypeIdentifier = HKCorrelationTypeIdentifier> = TCorrelationTypeIdentifier extends HKCorrelationTypeIdentifier.food ? HKGenericMetadata & {
452
452
  readonly HKFoodType?: string;
453
453
  } : HKGenericMetadata;
454
- export declare type UnitForIdentifier<T extends HKQuantityTypeIdentifier> = T extends HKQuantityTypeIdentifier.bloodGlucose ? BloodGlucoseUnit : T extends HKQuantityTypeIdentifier.appleExerciseTime | HKQuantityTypeIdentifier.appleMoveTime | HKQuantityTypeIdentifier.appleStandTime ? TimeUnit : T extends HKQuantityTypeIdentifier.activeEnergyBurned | HKQuantityTypeIdentifier.basalEnergyBurned | HKQuantityTypeIdentifier.dietaryEnergyConsumed ? EnergyUnit : T extends HKQuantityTypeIdentifier.distanceCycling | HKQuantityTypeIdentifier.distanceDownhillSnowSports | HKQuantityTypeIdentifier.distanceSwimming | HKQuantityTypeIdentifier.distanceWalkingRunning | HKQuantityTypeIdentifier.distanceWheelchair | HKQuantityTypeIdentifier.sixMinuteWalkTestDistance | HKQuantityTypeIdentifier.waistCircumference ? LengthUnit : T extends HKQuantityTypeIdentifier.bodyFatPercentage | HKQuantityTypeIdentifier.oxygenSaturation | HKQuantityTypeIdentifier.walkingAsymmetryPercentage | HKQuantityTypeIdentifier.walkingDoubleSupportPercentage ? HKUnits.Percent : T extends HKQuantityTypeIdentifier.basalBodyTemperature | HKQuantityTypeIdentifier.basalBodyTemperature ? TemperatureUnit : T extends HKQuantityTypeIdentifier.stairAscentSpeed | HKQuantityTypeIdentifier.stairDescentSpeed | HKQuantityTypeIdentifier.walkingSpeed | HKQuantityTypeIdentifier.walkingSpeed ? SpeedUnit<LengthUnit, TimeUnit> : T extends HKQuantityTypeIdentifier.flightsClimbed | HKQuantityTypeIdentifier.numberOfAlcoholicBeverages | HKQuantityTypeIdentifier.numberOfTimesFallen | HKQuantityTypeIdentifier.pushCount | HKQuantityTypeIdentifier.stepCount | HKQuantityTypeIdentifier.swimmingStrokeCount ? HKUnits.Count : T extends HKQuantityTypeIdentifier.dietaryBiotin | HKQuantityTypeIdentifier.dietaryCaffeine | HKQuantityTypeIdentifier.dietaryCalcium | HKQuantityTypeIdentifier.dietaryCarbohydrates | HKQuantityTypeIdentifier.dietaryChloride | HKQuantityTypeIdentifier.dietaryCholesterol | HKQuantityTypeIdentifier.dietaryChromium | HKQuantityTypeIdentifier.dietaryCopper | HKQuantityTypeIdentifier.dietaryFatMonounsaturated | HKQuantityTypeIdentifier.dietaryFatPolyunsaturated | HKQuantityTypeIdentifier.dietaryFatSaturated | HKQuantityTypeIdentifier.dietaryFatTotal | HKQuantityTypeIdentifier.dietaryFiber | HKQuantityTypeIdentifier.dietaryFolate | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIron | HKQuantityTypeIdentifier.dietaryMagnesium | HKQuantityTypeIdentifier.dietaryManganese | HKQuantityTypeIdentifier.dietaryMolybdenum | HKQuantityTypeIdentifier.dietaryNiacin | HKQuantityTypeIdentifier.dietaryPantothenicAcid | HKQuantityTypeIdentifier.dietaryPhosphorus | HKQuantityTypeIdentifier.dietaryPotassium | HKQuantityTypeIdentifier.dietaryProtein | HKQuantityTypeIdentifier.dietaryRiboflavin | HKQuantityTypeIdentifier.dietarySelenium | HKQuantityTypeIdentifier.dietarySodium | HKQuantityTypeIdentifier.dietarySugar | HKQuantityTypeIdentifier.dietaryThiamin | HKQuantityTypeIdentifier.dietaryVitaminA | HKQuantityTypeIdentifier.dietaryVitaminB6 | HKQuantityTypeIdentifier.dietaryVitaminB12 | HKQuantityTypeIdentifier.dietaryVitaminC | HKQuantityTypeIdentifier.dietaryVitaminD | HKQuantityTypeIdentifier.dietaryVitaminE | HKQuantityTypeIdentifier.dietaryVitaminK | HKQuantityTypeIdentifier.dietaryZinc ? MassUnit : T extends HKQuantityTypeIdentifier.dietaryWater ? VolumeUnit : T extends HKQuantityTypeIdentifier.insulinDelivery ? HKUnits.InternationalUnit | `${HKUnits.InternationalUnit}` : T extends HKQuantityTypeIdentifier.heartRate | HKQuantityTypeIdentifier.restingHeartRate | HKQuantityTypeIdentifier.walkingHeartRateAverage ? CountPerTime<TimeUnit> : HKUnit;
455
- export declare type HKCategoryValueForIdentifier<T extends HKCategoryTypeIdentifier> = T extends HKCategoryTypeIdentifier.cervicalMucusQuality ? HKCategoryValueCervicalMucusQuality : T extends HKCategoryTypeIdentifier.menstrualFlow ? HKCategoryValueMenstrualFlow : T extends HKCategoryTypeIdentifier.ovulationTestResult ? HKCategoryValueOvulationTestResult : T extends HKCategoryTypeIdentifier.sleepAnalysis ? HKCategoryValueSleepAnalysis : T extends HKCategoryTypeIdentifier.highHeartRateEvent | HKCategoryTypeIdentifier.intermenstrualBleeding | HKCategoryTypeIdentifier.mindfulSession | HKCategoryTypeIdentifier.sexualActivity ? HKCategoryValueNotApplicable : T extends HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.acne | HKCategoryTypeIdentifier.bladderIncontinence | HKCategoryTypeIdentifier.bloating | HKCategoryTypeIdentifier.breastPain | HKCategoryTypeIdentifier.chestTightnessOrPain | HKCategoryTypeIdentifier.chills | HKCategoryTypeIdentifier.constipation | HKCategoryTypeIdentifier.coughing | HKCategoryTypeIdentifier.diarrhea | HKCategoryTypeIdentifier.dizziness | HKCategoryTypeIdentifier.drySkin | HKCategoryTypeIdentifier.fainting | HKCategoryTypeIdentifier.fatigue | HKCategoryTypeIdentifier.fever | HKCategoryTypeIdentifier.generalizedBodyAche | HKCategoryTypeIdentifier.hairLoss | HKCategoryTypeIdentifier.headache | HKCategoryTypeIdentifier.heartburn | HKCategoryTypeIdentifier.hotFlashes | HKCategoryTypeIdentifier.lossOfSmell | HKCategoryTypeIdentifier.lossOfTaste | HKCategoryTypeIdentifier.lowerBackPain | HKCategoryTypeIdentifier.memoryLapse | HKCategoryTypeIdentifier.moodChanges | HKCategoryTypeIdentifier.nausea | HKCategoryTypeIdentifier.nightSweats | HKCategoryTypeIdentifier.pelvicPain | HKCategoryTypeIdentifier.rapidPoundingOrFlutteringHeartbeat | HKCategoryTypeIdentifier.runnyNose | HKCategoryTypeIdentifier.shortnessOfBreath | HKCategoryTypeIdentifier.sinusCongestion | HKCategoryTypeIdentifier.skippedHeartbeat | HKCategoryTypeIdentifier.soreThroat | HKCategoryTypeIdentifier.vaginalDryness | HKCategoryTypeIdentifier.vomiting | HKCategoryTypeIdentifier.wheezing ? HKCategoryValueSeverity : T extends HKCategoryTypeIdentifier.appetiteChanges | HKCategoryTypeIdentifier.sleepChanges ? HKCategoryValuePresence : T extends HKCategoryTypeIdentifier.lowCardioFitnessEvent ? HKCategoryValueLowCardioFitnessEvent : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.appleStandHour ? HKCategoryValueAppleStandHour : number;
454
+ export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> = T extends HKQuantityTypeIdentifier.bloodGlucose ? BloodGlucoseUnit : T extends HKQuantityTypeIdentifier.appleExerciseTime | HKQuantityTypeIdentifier.appleMoveTime | HKQuantityTypeIdentifier.appleStandTime ? TimeUnit : T extends HKQuantityTypeIdentifier.activeEnergyBurned | HKQuantityTypeIdentifier.basalEnergyBurned | HKQuantityTypeIdentifier.dietaryEnergyConsumed ? EnergyUnit : T extends HKQuantityTypeIdentifier.distanceCycling | HKQuantityTypeIdentifier.distanceDownhillSnowSports | HKQuantityTypeIdentifier.distanceSwimming | HKQuantityTypeIdentifier.distanceWalkingRunning | HKQuantityTypeIdentifier.distanceWheelchair | HKQuantityTypeIdentifier.sixMinuteWalkTestDistance | HKQuantityTypeIdentifier.waistCircumference ? LengthUnit : T extends HKQuantityTypeIdentifier.bodyFatPercentage | HKQuantityTypeIdentifier.oxygenSaturation | HKQuantityTypeIdentifier.walkingAsymmetryPercentage | HKQuantityTypeIdentifier.walkingDoubleSupportPercentage ? HKUnits.Percent : T extends HKQuantityTypeIdentifier.basalBodyTemperature | HKQuantityTypeIdentifier.basalBodyTemperature ? TemperatureUnit : T extends HKQuantityTypeIdentifier.stairAscentSpeed | HKQuantityTypeIdentifier.stairDescentSpeed | HKQuantityTypeIdentifier.walkingSpeed | HKQuantityTypeIdentifier.walkingSpeed ? SpeedUnit<LengthUnit, TimeUnit> : T extends HKQuantityTypeIdentifier.flightsClimbed | HKQuantityTypeIdentifier.numberOfAlcoholicBeverages | HKQuantityTypeIdentifier.numberOfTimesFallen | HKQuantityTypeIdentifier.pushCount | HKQuantityTypeIdentifier.stepCount | HKQuantityTypeIdentifier.swimmingStrokeCount ? HKUnits.Count : T extends HKQuantityTypeIdentifier.dietaryBiotin | HKQuantityTypeIdentifier.dietaryCaffeine | HKQuantityTypeIdentifier.dietaryCalcium | HKQuantityTypeIdentifier.dietaryCarbohydrates | HKQuantityTypeIdentifier.dietaryChloride | HKQuantityTypeIdentifier.dietaryCholesterol | HKQuantityTypeIdentifier.dietaryChromium | HKQuantityTypeIdentifier.dietaryCopper | HKQuantityTypeIdentifier.dietaryFatMonounsaturated | HKQuantityTypeIdentifier.dietaryFatPolyunsaturated | HKQuantityTypeIdentifier.dietaryFatSaturated | HKQuantityTypeIdentifier.dietaryFatTotal | HKQuantityTypeIdentifier.dietaryFiber | HKQuantityTypeIdentifier.dietaryFolate | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIodine | HKQuantityTypeIdentifier.dietaryIron | HKQuantityTypeIdentifier.dietaryMagnesium | HKQuantityTypeIdentifier.dietaryManganese | HKQuantityTypeIdentifier.dietaryMolybdenum | HKQuantityTypeIdentifier.dietaryNiacin | HKQuantityTypeIdentifier.dietaryPantothenicAcid | HKQuantityTypeIdentifier.dietaryPhosphorus | HKQuantityTypeIdentifier.dietaryPotassium | HKQuantityTypeIdentifier.dietaryProtein | HKQuantityTypeIdentifier.dietaryRiboflavin | HKQuantityTypeIdentifier.dietarySelenium | HKQuantityTypeIdentifier.dietarySodium | HKQuantityTypeIdentifier.dietarySugar | HKQuantityTypeIdentifier.dietaryThiamin | HKQuantityTypeIdentifier.dietaryVitaminA | HKQuantityTypeIdentifier.dietaryVitaminB6 | HKQuantityTypeIdentifier.dietaryVitaminB12 | HKQuantityTypeIdentifier.dietaryVitaminC | HKQuantityTypeIdentifier.dietaryVitaminD | HKQuantityTypeIdentifier.dietaryVitaminE | HKQuantityTypeIdentifier.dietaryVitaminK | HKQuantityTypeIdentifier.dietaryZinc ? MassUnit : T extends HKQuantityTypeIdentifier.dietaryWater ? VolumeUnit : T extends HKQuantityTypeIdentifier.insulinDelivery ? HKUnits.InternationalUnit | `${HKUnits.InternationalUnit}` : T extends HKQuantityTypeIdentifier.heartRate | HKQuantityTypeIdentifier.restingHeartRate | HKQuantityTypeIdentifier.walkingHeartRateAverage ? CountPerTime<TimeUnit> : HKUnit;
455
+ export type HKCategoryValueForIdentifier<T extends HKCategoryTypeIdentifier> = T extends HKCategoryTypeIdentifier.cervicalMucusQuality ? HKCategoryValueCervicalMucusQuality : T extends HKCategoryTypeIdentifier.menstrualFlow ? HKCategoryValueMenstrualFlow : T extends HKCategoryTypeIdentifier.ovulationTestResult ? HKCategoryValueOvulationTestResult : T extends HKCategoryTypeIdentifier.sleepAnalysis ? HKCategoryValueSleepAnalysis : T extends HKCategoryTypeIdentifier.highHeartRateEvent | HKCategoryTypeIdentifier.intermenstrualBleeding | HKCategoryTypeIdentifier.mindfulSession | HKCategoryTypeIdentifier.sexualActivity ? HKCategoryValueNotApplicable : T extends HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.abdominalCramps | HKCategoryTypeIdentifier.acne | HKCategoryTypeIdentifier.bladderIncontinence | HKCategoryTypeIdentifier.bloating | HKCategoryTypeIdentifier.breastPain | HKCategoryTypeIdentifier.chestTightnessOrPain | HKCategoryTypeIdentifier.chills | HKCategoryTypeIdentifier.constipation | HKCategoryTypeIdentifier.coughing | HKCategoryTypeIdentifier.diarrhea | HKCategoryTypeIdentifier.dizziness | HKCategoryTypeIdentifier.drySkin | HKCategoryTypeIdentifier.fainting | HKCategoryTypeIdentifier.fatigue | HKCategoryTypeIdentifier.fever | HKCategoryTypeIdentifier.generalizedBodyAche | HKCategoryTypeIdentifier.hairLoss | HKCategoryTypeIdentifier.headache | HKCategoryTypeIdentifier.heartburn | HKCategoryTypeIdentifier.hotFlashes | HKCategoryTypeIdentifier.lossOfSmell | HKCategoryTypeIdentifier.lossOfTaste | HKCategoryTypeIdentifier.lowerBackPain | HKCategoryTypeIdentifier.memoryLapse | HKCategoryTypeIdentifier.moodChanges | HKCategoryTypeIdentifier.nausea | HKCategoryTypeIdentifier.nightSweats | HKCategoryTypeIdentifier.pelvicPain | HKCategoryTypeIdentifier.rapidPoundingOrFlutteringHeartbeat | HKCategoryTypeIdentifier.runnyNose | HKCategoryTypeIdentifier.shortnessOfBreath | HKCategoryTypeIdentifier.sinusCongestion | HKCategoryTypeIdentifier.skippedHeartbeat | HKCategoryTypeIdentifier.soreThroat | HKCategoryTypeIdentifier.vaginalDryness | HKCategoryTypeIdentifier.vomiting | HKCategoryTypeIdentifier.wheezing ? HKCategoryValueSeverity : T extends HKCategoryTypeIdentifier.appetiteChanges | HKCategoryTypeIdentifier.sleepChanges ? HKCategoryValuePresence : T extends HKCategoryTypeIdentifier.lowCardioFitnessEvent ? HKCategoryValueLowCardioFitnessEvent : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.pregnancyTestResult ? HKCategoryValuePregnancyTestResult : T extends HKCategoryTypeIdentifier.appleStandHour ? HKCategoryValueAppleStandHour : number;
456
456
  declare enum HKCategoryValuePregnancyTestResult {
457
457
  positive = 2,
458
458
  negative = 1,
459
459
  indeterminate = 3
460
460
  }
461
- export declare type HKHeartbeatSeriesSampleMetadata = HKGenericMetadata & {
461
+ export type HKHeartbeatSeriesSampleMetadata = HKGenericMetadata & {
462
462
  readonly HKMetadataKeyAlgorithmVersion: string;
463
463
  };
464
- export declare type MetadataMapperForCategoryIdentifier<T extends HKCategoryTypeIdentifier> = T extends HKCategoryTypeIdentifier.sexualActivity ? HKGenericMetadata & {
464
+ export type MetadataMapperForCategoryIdentifier<T extends HKCategoryTypeIdentifier> = T extends HKCategoryTypeIdentifier.sexualActivity ? HKGenericMetadata & {
465
465
  readonly HKSexualActivityProtectionUsed: boolean;
466
466
  } : T extends HKCategoryTypeIdentifier.menstrualFlow ? HKGenericMetadata & {
467
467
  readonly HKMenstrualCycleStart: boolean;
@@ -506,18 +506,18 @@ export declare enum HKUnits {
506
506
  Count = "count",
507
507
  InternationalUnit = "IU"
508
508
  }
509
- export declare type MeterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Meter}`;
510
- export declare type LiterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Liter}`;
511
- export declare type GramUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Gram}`;
512
- export declare type PascalUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Pascal}`;
513
- export declare type SecondUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Second}`;
514
- export declare type JouleUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Joule}`;
515
- export declare type HertzUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Hertz}`;
516
- export declare type VoltUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Volt}`;
517
- export declare type SiemenUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Siemen}`;
518
- export declare type MoleUnit<MolarMass extends number> = `mol<${MolarMass}>`;
519
- export declare type MoleUnitWith<MolarMass extends number, Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}mol<${MolarMass}>`;
520
- export declare type FrequencyUnit = HertzUnit<HKMetricPrefix>;
509
+ export type MeterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Meter}`;
510
+ export type LiterUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Liter}`;
511
+ export type GramUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Gram}`;
512
+ export type PascalUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Pascal}`;
513
+ export type SecondUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Second}`;
514
+ export type JouleUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Joule}`;
515
+ export type HertzUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Hertz}`;
516
+ export type VoltUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Volt}`;
517
+ export type SiemenUnit<Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}${HKUnitMetric.Siemen}`;
518
+ export type MoleUnit<MolarMass extends number> = `mol<${MolarMass}>`;
519
+ export type MoleUnitWith<MolarMass extends number, Prefix extends HKMetricPrefix = HKMetricPrefix.None> = `${Prefix}mol<${MolarMass}>`;
520
+ export type FrequencyUnit = HertzUnit<HKMetricPrefix>;
521
521
  /**
522
522
  * More SI prefixes also available as literals, just type the string
523
523
  * @example 'cm', 'km'
@@ -533,7 +533,7 @@ export declare enum UnitOfLength {
533
533
  Yards = "yd",
534
534
  Miles = "mi"
535
535
  }
536
- export declare type LengthUnit = MeterUnit<HKMetricPrefix> | UnitOfLength;
536
+ export type LengthUnit = MeterUnit<HKMetricPrefix> | UnitOfLength;
537
537
  /**
538
538
  * More SI prefixes also available as literals, just type the string
539
539
  * @example 'ml', 'cl'
@@ -551,7 +551,7 @@ export declare enum UnitOfVolume {
551
551
  */
552
552
  Liter = "l"
553
553
  }
554
- export declare type VolumeUnit = LiterUnit<HKMetricPrefix> | UnitOfVolume;
554
+ export type VolumeUnit = LiterUnit<HKMetricPrefix> | UnitOfVolume;
555
555
  /**
556
556
  * More SI prefixes also available as literals, just type the string
557
557
  * @example 'mg', 'kg'
@@ -570,7 +570,7 @@ export declare enum UnitOfMass {
570
570
  * More SI prefixes also available as literals, just type the string
571
571
  * @example 'mg', 'kg'
572
572
  */
573
- export declare type MassUnit = GramUnit<HKMetricPrefix> | UnitOfMass;
573
+ export type MassUnit = GramUnit<HKMetricPrefix> | UnitOfMass;
574
574
  /**
575
575
  * More SI prefixes also available as literals, just type the string
576
576
  * @example 'kPa', 'hPa'
@@ -591,7 +591,7 @@ export declare enum UnitOfPressure {
591
591
  * More SI prefixes also available as literals, just type the string
592
592
  * @example 'kPa', 'hPa'
593
593
  */
594
- export declare type PressureUnit = PascalUnit<HKMetricPrefix> | UnitOfPressure;
594
+ export type PressureUnit = PascalUnit<HKMetricPrefix> | UnitOfPressure;
595
595
  /**
596
596
  * More SI prefixes also available as literals, just type the string
597
597
  * @example 'ms'
@@ -610,7 +610,7 @@ export declare enum UnitOfTime {
610
610
  * More SI prefixes also available as literals, just type the string
611
611
  * @example 'ms'
612
612
  */
613
- export declare type TimeUnit = SecondUnit<HKMetricPrefix> | UnitOfTime;
613
+ export type TimeUnit = SecondUnit<HKMetricPrefix> | UnitOfTime;
614
614
  export declare enum TemperatureUnit {
615
615
  DegreesCelsius = "degC",
616
616
  DegreesFahrenheit = "degF",
@@ -630,15 +630,15 @@ export declare enum UnitOfEnergy {
630
630
  */
631
631
  Joules = "J"
632
632
  }
633
- export declare type EnergyUnit = JouleUnit<HKMetricPrefix> | UnitOfEnergy;
633
+ export type EnergyUnit = JouleUnit<HKMetricPrefix> | UnitOfEnergy;
634
634
  export declare enum BloodGlucoseUnit {
635
635
  GlucoseMmolPerL = "mmol<180.15588000005408>/l",
636
636
  GlucoseMgPerDl = "mg/dL"
637
637
  }
638
- export declare type SpeedUnit<TLength extends LengthUnit, TTime extends TimeUnit> = `${TLength}/${TTime}`;
639
- export declare type CountPerTime<TTime extends TimeUnit> = `count/${TTime}`;
640
- export declare type HKUnit = BloodGlucoseUnit | CountPerTime<TimeUnit> | EnergyUnit | FrequencyUnit | HKUnits | LengthUnit | MassUnit | PressureUnit | SpeedUnit<LengthUnit, TimeUnit> | TemperatureUnit | TimeUnit | VolumeUnit | `${BloodGlucoseUnit}` | `${EnergyUnit}` | `${FrequencyUnit}` | `${HKUnits}` | `${LengthUnit}` | `${MassUnit}` | `${PressureUnit}` | `${TemperatureUnit}` | `${TimeUnit}` | `${VolumeUnit}`;
641
- export declare type HKDevice = {
638
+ export type SpeedUnit<TLength extends LengthUnit, TTime extends TimeUnit> = `${TLength}/${TTime}`;
639
+ export type CountPerTime<TTime extends TimeUnit> = `count/${TTime}`;
640
+ export type HKUnit = BloodGlucoseUnit | CountPerTime<TimeUnit> | EnergyUnit | FrequencyUnit | HKUnits | LengthUnit | MassUnit | PressureUnit | SpeedUnit<LengthUnit, TimeUnit> | TemperatureUnit | TimeUnit | VolumeUnit | `${BloodGlucoseUnit}` | `${EnergyUnit}` | `${FrequencyUnit}` | `${HKUnits}` | `${LengthUnit}` | `${MassUnit}` | `${PressureUnit}` | `${TemperatureUnit}` | `${TimeUnit}` | `${VolumeUnit}`;
641
+ export type HKDevice = {
642
642
  readonly name: string;
643
643
  readonly firmwareVersion: string | null;
644
644
  readonly hardwareVersion: string;
@@ -648,17 +648,17 @@ export declare type HKDevice = {
648
648
  readonly softwareVersion: string;
649
649
  readonly udiDeviceIdentifier: string | null;
650
650
  };
651
- export declare type HKSource = {
651
+ export type HKSource = {
652
652
  readonly name: string;
653
653
  readonly bundleIdentifier: string;
654
654
  };
655
- export declare type HKSourceRevision = {
655
+ export type HKSourceRevision = {
656
656
  readonly source: HKSource;
657
657
  readonly version: string;
658
658
  readonly operatingSystemVersion?: string;
659
659
  readonly productType?: string;
660
660
  };
661
- export declare type HKQuantitySampleRaw<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = {
661
+ export type HKQuantitySampleRaw<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = {
662
662
  readonly uuid: string;
663
663
  readonly device?: HKDevice;
664
664
  readonly quantityType: TQuantityIdentifier;
@@ -669,11 +669,11 @@ export declare type HKQuantitySampleRaw<TQuantityIdentifier extends HKQuantityTy
669
669
  readonly metadata: MetadataMapperForQuantityIdentifier<TQuantityIdentifier>;
670
670
  readonly sourceRevision?: HKSourceRevision;
671
671
  };
672
- export declare type HKHeartbeatRaw = {
672
+ export type HKHeartbeatRaw = {
673
673
  readonly timeSinceSeriesStart: number;
674
674
  readonly precededByGap: boolean;
675
675
  };
676
- export declare type HKHeartbeatSeriesSampleRaw = {
676
+ export type HKHeartbeatSeriesSampleRaw = {
677
677
  readonly uuid: string;
678
678
  readonly device?: HKDevice;
679
679
  readonly startDate: string;
@@ -682,9 +682,9 @@ export declare type HKHeartbeatSeriesSampleRaw = {
682
682
  readonly metadata?: HKHeartbeatSeriesSampleMetadata;
683
683
  readonly sourceRevision?: HKSourceRevision;
684
684
  };
685
- export declare type HKQuantitySampleRawForSaving<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = Omit<HKQuantitySampleRaw<TQuantityIdentifier, TUnit>, 'device' | 'endDate' | 'startDate' | 'uuid'>;
686
- export declare type HKCategorySampleRawForSaving<TCategory extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier> = Omit<HKCategorySampleRaw<TCategory>, 'device' | 'endDate' | 'startDate' | 'uuid'>;
687
- export declare type HKWorkoutRaw<TEnergy extends EnergyUnit, TDistance extends LengthUnit> = {
685
+ export type HKQuantitySampleRawForSaving<TQuantityIdentifier extends HKQuantityTypeIdentifier = HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TQuantityIdentifier> = UnitForIdentifier<TQuantityIdentifier>> = Omit<HKQuantitySampleRaw<TQuantityIdentifier, TUnit>, 'device' | 'endDate' | 'startDate' | 'uuid'>;
686
+ export type HKCategorySampleRawForSaving<TCategory extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier> = Omit<HKCategorySampleRaw<TCategory>, 'device' | 'endDate' | 'startDate' | 'uuid'>;
687
+ export type HKWorkoutRaw<TEnergy extends EnergyUnit, TDistance extends LengthUnit> = {
688
688
  readonly uuid: string;
689
689
  readonly device?: HKDevice;
690
690
  readonly workoutActivityType: HKWorkoutActivityType;
@@ -706,13 +706,13 @@ export declare enum HKCharacteristicTypeIdentifier {
706
706
  wheelchairUse = "HKCharacteristicTypeIdentifierWheelchairUse",
707
707
  activityMoveMode = "HKCharacteristicTypeIdentifierActivityMoveMode"
708
708
  }
709
- export declare type WritePermissions = {
709
+ export type WritePermissions = {
710
710
  readonly [key in HKCategoryTypeIdentifier | HKCharacteristicTypeIdentifier | HKQuantityTypeIdentifier]: boolean;
711
711
  };
712
- export declare type ReadPermissions = {
712
+ export type ReadPermissions = {
713
713
  readonly [key in HKCategoryTypeIdentifier | HKCharacteristicTypeIdentifier | HKQuantityTypeIdentifier]: boolean;
714
714
  };
715
- export declare type HKCategorySampleRaw<T extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier> = {
715
+ export type HKCategorySampleRaw<T extends HKCategoryTypeIdentifier = HKCategoryTypeIdentifier> = {
716
716
  readonly uuid: string;
717
717
  readonly device?: HKDevice;
718
718
  readonly categoryType: T;
@@ -722,48 +722,48 @@ export declare type HKCategorySampleRaw<T extends HKCategoryTypeIdentifier = HKC
722
722
  readonly metadata: MetadataMapperForCategoryIdentifier<T>;
723
723
  readonly sourceRevision?: HKSourceRevision;
724
724
  };
725
- export declare type DeletedCategorySampleRaw<T extends HKCategoryTypeIdentifier> = {
725
+ export type DeletedCategorySampleRaw<T extends HKCategoryTypeIdentifier> = {
726
726
  readonly uuid: string;
727
727
  readonly metadata: MetadataMapperForCategoryIdentifier<T>;
728
728
  };
729
- export declare type DeletedHeartbeatSeriesSampleRaw = {
729
+ export type DeletedHeartbeatSeriesSampleRaw = {
730
730
  readonly uuid: string;
731
731
  readonly metadata: HKHeartbeatSeriesSampleMetadata;
732
732
  };
733
- export declare type DeletedQuantitySampleRaw<T extends HKQuantityTypeIdentifier> = {
733
+ export type DeletedQuantitySampleRaw<T extends HKQuantityTypeIdentifier> = {
734
734
  readonly uuid: string;
735
735
  readonly metadata: MetadataMapperForQuantityIdentifier<T>;
736
736
  };
737
- export declare type QueryCategorySamplesResponseRaw<T extends HKCategoryTypeIdentifier> = {
737
+ export type QueryCategorySamplesResponseRaw<T extends HKCategoryTypeIdentifier> = {
738
738
  readonly samples: readonly HKCategorySampleRaw<T>[];
739
739
  readonly deletedSamples: readonly DeletedCategorySampleRaw<T>[];
740
740
  readonly newAnchor: string;
741
741
  };
742
- export declare type QueryHeartbeatSeriesSamplesResponseRaw = {
742
+ export type QueryHeartbeatSeriesSamplesResponseRaw = {
743
743
  readonly samples: readonly HKHeartbeatSeriesSampleRaw[];
744
744
  readonly deletedSamples: readonly DeletedHeartbeatSeriesSampleRaw[];
745
745
  readonly newAnchor: string;
746
746
  };
747
- export declare type QueryQuantitySamplesResponseRaw<T extends HKQuantityTypeIdentifier> = {
747
+ export type QueryQuantitySamplesResponseRaw<T extends HKQuantityTypeIdentifier> = {
748
748
  readonly samples: readonly HKQuantitySampleRaw<T>[];
749
749
  readonly deletedSamples: readonly DeletedQuantitySampleRaw<T>[];
750
750
  readonly newAnchor: string;
751
751
  };
752
- export declare type HKCorrelationRaw<TIdentifier extends HKCorrelationTypeIdentifier> = {
752
+ export type HKCorrelationRaw<TIdentifier extends HKCorrelationTypeIdentifier> = {
753
753
  readonly correlationType: HKCorrelationTypeIdentifier;
754
754
  readonly objects: readonly (HKCategorySampleRaw | HKQuantitySampleRaw)[];
755
755
  readonly metadata: MetadataMapperForCorrelationIdentifier<TIdentifier>;
756
756
  readonly startDate: string;
757
757
  readonly endDate: string;
758
758
  };
759
- declare type QueryId = string;
759
+ type QueryId = string;
760
760
  export declare enum HKUpdateFrequency {
761
761
  immediate = 1,
762
762
  hourly = 2,
763
763
  daily = 3,
764
764
  weekly = 4
765
765
  }
766
- export declare type WorkoutLocation = {
766
+ export type WorkoutLocation = {
767
767
  readonly longitude: number;
768
768
  readonly latitude: number;
769
769
  readonly altitude: number;
@@ -774,12 +774,12 @@ export declare type WorkoutLocation = {
774
774
  readonly verticalAccuracy: number;
775
775
  readonly distance: number | null;
776
776
  };
777
- export declare type WorkoutRoute = {
777
+ export type WorkoutRoute = {
778
778
  readonly locations: readonly WorkoutLocation[];
779
779
  readonly HKMetadataKeySyncIdentifier?: string;
780
780
  readonly HKMetadataKeySyncVersion?: number;
781
781
  };
782
- declare type ReactNativeHealthkitTypeNative = {
782
+ type ReactNativeHealthkitTypeNative = {
783
783
  isHealthDataAvailable(): Promise<boolean>;
784
784
  canAccessProtectedData(): Promise<boolean>;
785
785
  getBloodType(): Promise<HKBloodType>;
@@ -795,16 +795,19 @@ declare type ReactNativeHealthkitTypeNative = {
795
795
  readonly queryCorrelationSamples: <TIdentifier extends HKCorrelationTypeIdentifier>(typeIdentifier: TIdentifier, from: string, to: string) => Promise<readonly HKCorrelationRaw<TIdentifier>[]>;
796
796
  subscribeToObserverQuery(identifier: HKSampleTypeIdentifier): Promise<QueryId>;
797
797
  unsubscribeQuery(queryId: QueryId): Promise<boolean>;
798
- authorizationStatusFor(type: HealthkitReadAuthorization): Promise<boolean>;
798
+ authorizationStatusFor(type: HealthkitReadAuthorization): Promise<HKAuthorizationStatus>;
799
799
  getRequestStatusForAuthorization(write: WritePermissions, read: ReadPermissions): Promise<HKAuthorizationRequestStatus>;
800
800
  requestAuthorization(write: WritePermissions, read: ReadPermissions): Promise<boolean>;
801
801
  readonly saveQuantitySample: <TType extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TType> = UnitForIdentifier<TType>>(identifier: TType, unit: TUnit, value: number, start: string, end: string, metadata: unknown) => Promise<boolean>;
802
802
  readonly deleteQuantitySample: <TIdentifier extends HKQuantityTypeIdentifier>(typeIdentifier: TIdentifier, uuid: string) => Promise<boolean>;
803
803
  readonly deleteSamples: <TIdentifier extends HKQuantityTypeIdentifier>(identifier: TIdentifier, start: string, end: string) => Promise<boolean>;
804
804
  readonly queryWorkoutSamples: <TEnergy extends EnergyUnit, TDistance extends LengthUnit>(energyUnit: TEnergy, distanceUnit: TDistance, from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKWorkoutRaw<TEnergy, TDistance>[]>;
805
- readonly queryCategorySamples: <T extends HKCategoryTypeIdentifier>(identifier: T, from: string, to: string, limit: number, ascending: boolean, anchor: string) => Promise<QueryCategorySamplesResponseRaw<T>>;
806
- readonly queryHeartbeatSeriesSamples: (from: string, to: string, limit: number, ascending: boolean, anchor: string) => Promise<QueryHeartbeatSeriesSamplesResponseRaw>;
807
- readonly queryQuantitySamples: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit, from: string, to: string, limit: number, ascending: boolean, anchor: string) => Promise<QueryQuantitySamplesResponseRaw<TIdentifier>>;
805
+ readonly queryCategorySamples: <T extends HKCategoryTypeIdentifier>(identifier: T, from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKCategorySampleRaw<T>[]>;
806
+ readonly queryQuantitySamples: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit, from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKQuantitySampleRaw<TIdentifier>[]>;
807
+ readonly queryCategorySamplesWithAnchor: <T extends HKCategoryTypeIdentifier>(identifier: T, from: string, to: string, limit: number, anchor: string) => Promise<QueryCategorySamplesResponseRaw<T>>;
808
+ readonly queryQuantitySamplesWithAnchor: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: TIdentifier, unit: TUnit, from: string, to: string, limit: number, anchor: string) => Promise<QueryQuantitySamplesResponseRaw<TIdentifier>>;
809
+ readonly queryHeartbeatSeriesSamples: (from: string, to: string, limit: number, ascending: boolean) => Promise<readonly HKHeartbeatSeriesSampleRaw[]>;
810
+ readonly queryHeartbeatSeriesSamplesWithAnchor: (from: string, to: string, limit: number, anchor: string) => Promise<QueryHeartbeatSeriesSamplesResponseRaw>;
808
811
  readonly querySources: <TIdentifier extends HKCategoryTypeIdentifier | HKQuantityTypeIdentifier>(identifier: TIdentifier) => Promise<readonly HKSource[]>;
809
812
  readonly saveCategorySample: <T extends HKCategoryTypeIdentifier>(identifier: T, value: HKCategoryValueForIdentifier<T>, start: string, end: string, metadata: unknown) => Promise<boolean>;
810
813
  readonly queryStatisticsForQuantity: <TIdentifier extends HKQuantityTypeIdentifier, TUnit extends UnitForIdentifier<TIdentifier>>(identifier: HKQuantityTypeIdentifier, unit: TUnit, from: string, to: string, options: readonly HKStatisticsOptions[]) => Promise<QueryStatisticsResponseRaw<TIdentifier, TUnit>>;
@@ -812,7 +815,7 @@ declare type ReactNativeHealthkitTypeNative = {
812
815
  readonly getWorkoutRoutes: (workoutUUID: string) => Promise<readonly WorkoutRoute[]>;
813
816
  };
814
817
  declare const Native: ReactNativeHealthkitTypeNative;
815
- declare type OnChangeCallback = ({ typeIdentifier, }: {
818
+ type OnChangeCallback = ({ typeIdentifier, }: {
816
819
  readonly typeIdentifier: HKSampleTypeIdentifier;
817
820
  }) => void;
818
821
  interface HealthkitEventEmitter extends NativeEventEmitter {