@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 +1 @@
1
- {"version":3,"names":["deserializeQuantitySample","sample","startDate","Date","endDate"],"sources":["deserializeSample.ts"],"sourcesContent":["import type { HKQuantitySampleRaw, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nfunction deserializeQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n sample: HKQuantitySampleRaw<TIdentifier, TUnit>,\n): HKQuantitySample<TIdentifier, TUnit> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeQuantitySample\n"],"mappings":";;;;;;;AAGA,SAASA,yBAAT,CAIEC,MAJF,EAKwC;EACtC,OAAO,EACL,GAAGA,MADE;IAELC,SAAS,EAAE,IAAIC,IAAJ,CAASF,MAAM,CAACC,SAAhB,CAFN;IAGLE,OAAO,EAAE,IAAID,IAAJ,CAASF,MAAM,CAACG,OAAhB;EAHJ,CAAP;AAKD;;eAEcJ,yB"}
1
+ {"version":3,"names":["deserializeQuantitySample","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeSample.ts"],"sourcesContent":["import type { HKQuantitySampleRaw, HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\nimport type { HKQuantitySample } from '../types'\n\nfunction deserializeQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n sample: HKQuantitySampleRaw<TIdentifier, TUnit>,\n): HKQuantitySample<TIdentifier, TUnit> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeQuantitySample\n"],"mappings":";;;;;;AAGA,SAASA,yBAAyBA,CAIhCC,MAA+C,EACT;EACtC,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,GAEcL,yBAAyB;AAAAM,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function deserializeWorkout(sample) {
9
- return { ...sample,
8
+ return {
9
+ ...sample,
10
10
  startDate: new Date(sample.startDate),
11
11
  endDate: new Date(sample.endDate)
12
12
  };
13
13
  }
14
-
15
14
  var _default = deserializeWorkout;
16
15
  exports.default = _default;
17
16
  //# sourceMappingURL=deserializeWorkout.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["deserializeWorkout","sample","startDate","Date","endDate"],"sources":["deserializeWorkout.ts"],"sourcesContent":["import type { EnergyUnit, HKWorkoutRaw, LengthUnit } from '../native-types'\nimport type { HKWorkout } from '../types'\n\nfunction deserializeWorkout<TEnergy extends EnergyUnit, TDistance extends LengthUnit>(\n sample: HKWorkoutRaw<TEnergy, TDistance>,\n): HKWorkout<TEnergy, TDistance> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeWorkout\n"],"mappings":";;;;;;;AAGA,SAASA,kBAAT,CACEC,MADF,EAEiC;EAC/B,OAAO,EACL,GAAGA,MADE;IAELC,SAAS,EAAE,IAAIC,IAAJ,CAASF,MAAM,CAACC,SAAhB,CAFN;IAGLE,OAAO,EAAE,IAAID,IAAJ,CAASF,MAAM,CAACG,OAAhB;EAHJ,CAAP;AAKD;;eAEcJ,kB"}
1
+ {"version":3,"names":["deserializeWorkout","sample","startDate","Date","endDate","_default","exports","default"],"sources":["deserializeWorkout.ts"],"sourcesContent":["import type { EnergyUnit, HKWorkoutRaw, LengthUnit } from '../native-types'\nimport type { HKWorkout } from '../types'\n\nfunction deserializeWorkout<TEnergy extends EnergyUnit, TDistance extends LengthUnit>(\n sample: HKWorkoutRaw<TEnergy, TDistance>,\n): HKWorkout<TEnergy, TDistance> {\n return {\n ...sample,\n startDate: new Date(sample.startDate),\n endDate: new Date(sample.endDate),\n }\n}\n\nexport default deserializeWorkout\n"],"mappings":";;;;;;AAGA,SAASA,kBAAkBA,CACzBC,MAAwC,EACT;EAC/B,OAAO;IACL,GAAGA,MAAM;IACTC,SAAS,EAAE,IAAIC,IAAI,CAACF,MAAM,CAACC,SAAS,CAAC;IACrCE,OAAO,EAAE,IAAID,IAAI,CAACF,MAAM,CAACG,OAAO;EAClC,CAAC;AACH;AAAC,IAAAC,QAAA,GAEcL,kBAAkB;AAAAM,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  function ensureMetadata(metadata) {
9
8
  return metadata || {};
10
9
  }
11
-
12
10
  var _default = ensureMetadata;
13
11
  exports.default = _default;
14
12
  //# sourceMappingURL=ensureMetadata.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ensureMetadata","metadata"],"sources":["ensureMetadata.ts"],"sourcesContent":["function ensureMetadata<TMetadata>(metadata?: TMetadata) {\n return metadata || ({} as TMetadata)\n}\n\nexport default ensureMetadata\n"],"mappings":";;;;;;;AAAA,SAASA,cAAT,CAAmCC,QAAnC,EAAyD;EACvD,OAAOA,QAAQ,IAAK,EAApB;AACD;;eAEcD,c"}
1
+ {"version":3,"names":["ensureMetadata","metadata","_default","exports","default"],"sources":["ensureMetadata.ts"],"sourcesContent":["function ensureMetadata<TMetadata>(metadata?: TMetadata) {\n return metadata || ({} as TMetadata)\n}\n\nexport default ensureMetadata\n"],"mappings":";;;;;;AAAA,SAASA,cAAcA,CAAYC,QAAoB,EAAE;EACvD,OAAOA,QAAQ,IAAK,CAAC,CAAe;AACtC;AAAC,IAAAC,QAAA,GAEcF,cAAc;AAAAG,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
@@ -4,20 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nativeTypes = _interopRequireDefault(require("../native-types"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const ensureUnit = async (type, providedUnit) => {
13
10
  if (providedUnit) {
14
11
  return providedUnit;
15
12
  }
16
-
17
13
  const unit = await _nativeTypes.default.getPreferredUnits([type]);
18
14
  return unit[type];
19
15
  };
20
-
21
16
  var _default = ensureUnit;
22
17
  exports.default = _default;
23
18
  //# sourceMappingURL=ensureUnit.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ensureUnit","type","providedUnit","unit","Native","getPreferredUnits"],"sources":["ensureUnit.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nconst ensureUnit = async <\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n type: TIdentifier,\n providedUnit?: TUnit,\n) => {\n if (providedUnit) {\n return providedUnit\n }\n const unit = await Native.getPreferredUnits([type])\n return unit[type] as TUnit\n}\n\nexport default ensureUnit\n"],"mappings":";;;;;;;AAAA;;;;AAIA,MAAMA,UAAU,GAAG,OAIjBC,IAJiB,EAKjBC,YALiB,KAMd;EACH,IAAIA,YAAJ,EAAkB;IAChB,OAAOA,YAAP;EACD;;EACD,MAAMC,IAAI,GAAG,MAAMC,oBAAA,CAAOC,iBAAP,CAAyB,CAACJ,IAAD,CAAzB,CAAnB;EACA,OAAOE,IAAI,CAACF,IAAD,CAAX;AACD,CAZD;;eAceD,U"}
1
+ {"version":3,"names":["_nativeTypes","_interopRequireDefault","require","obj","__esModule","default","ensureUnit","type","providedUnit","unit","Native","getPreferredUnits","_default","exports"],"sources":["ensureUnit.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nconst ensureUnit = async <\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n type: TIdentifier,\n providedUnit?: TUnit,\n) => {\n if (providedUnit) {\n return providedUnit\n }\n const unit = await Native.getPreferredUnits([type])\n return unit[type] as TUnit\n}\n\nexport default ensureUnit\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIpC,MAAMG,UAAU,GAAG,MAAAA,CAIjBC,IAAiB,EACjBC,YAAoB,KACjB;EACH,IAAIA,YAAY,EAAE;IAChB,OAAOA,YAAY;EACrB;EACA,MAAMC,IAAI,GAAG,MAAMC,oBAAM,CAACC,iBAAiB,CAAC,CAACJ,IAAI,CAAC,CAAC;EACnD,OAAOE,IAAI,CAACF,IAAI,CAAC;AACnB,CAAC;AAAA,IAAAK,QAAA,GAEcN,UAAU;AAAAO,OAAA,CAAAR,OAAA,GAAAO,QAAA"}
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nativeTypes = _interopRequireDefault(require("../native-types"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const getDateOfBirth = async () => {
13
10
  const dateOfBirth = await _nativeTypes.default.getDateOfBirth();
14
11
  return new Date(dateOfBirth);
15
12
  };
16
-
17
13
  var _default = getDateOfBirth;
18
14
  exports.default = _default;
19
15
  //# sourceMappingURL=getDateOfBirth.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getDateOfBirth","dateOfBirth","Native","Date"],"sources":["getDateOfBirth.ts"],"sourcesContent":["import Native from '../native-types'\n\nconst getDateOfBirth = async () => {\n const dateOfBirth = await Native.getDateOfBirth()\n return new Date(dateOfBirth)\n}\n\nexport default getDateOfBirth\n"],"mappings":";;;;;;;AAAA;;;;AAEA,MAAMA,cAAc,GAAG,YAAY;EACjC,MAAMC,WAAW,GAAG,MAAMC,oBAAA,CAAOF,cAAP,EAA1B;EACA,OAAO,IAAIG,IAAJ,CAASF,WAAT,CAAP;AACD,CAHD;;eAKeD,c"}
1
+ {"version":3,"names":["_nativeTypes","_interopRequireDefault","require","obj","__esModule","default","getDateOfBirth","dateOfBirth","Native","Date","_default","exports"],"sources":["getDateOfBirth.ts"],"sourcesContent":["import Native from '../native-types'\n\nconst getDateOfBirth = async () => {\n const dateOfBirth = await Native.getDateOfBirth()\n return new Date(dateOfBirth)\n}\n\nexport default getDateOfBirth\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEpC,MAAMG,cAAc,GAAG,MAAAA,CAAA,KAAY;EACjC,MAAMC,WAAW,GAAG,MAAMC,oBAAM,CAACF,cAAc,CAAC,CAAC;EACjD,OAAO,IAAIG,IAAI,CAACF,WAAW,CAAC;AAC9B,CAAC;AAAA,IAAAG,QAAA,GAEcJ,cAAc;AAAAK,OAAA,CAAAN,OAAA,GAAAK,QAAA"}
@@ -4,19 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _queryCategorySamples = _interopRequireDefault(require("./queryCategorySamples"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  async function getMostRecentCategorySample(identifier) {
13
10
  const samples = await (0, _queryCategorySamples.default)(identifier, {
14
11
  limit: 1,
15
12
  ascending: false
16
13
  });
17
- return samples.samples[0] || null;
14
+ return samples[0] || null;
18
15
  }
19
-
20
16
  var _default = getMostRecentCategorySample;
21
17
  exports.default = _default;
22
18
  //# sourceMappingURL=getMostRecentCategorySample.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getMostRecentCategorySample","identifier","samples","queryCategorySamples","limit","ascending"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n) {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples.samples[0] || null\n}\n\nexport default getMostRecentCategorySample\n"],"mappings":";;;;;;;AAAA;;;;AAIA,eAAeA,2BAAf,CAGEC,UAHF,EAIE;EACA,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAA,EAAqBF,UAArB,EAAiC;IACrDG,KAAK,EAAE,CAD8C;IAErDC,SAAS,EAAE;EAF0C,CAAjC,CAAtB;EAKA,OAAOH,OAAO,CAACA,OAAR,CAAgB,CAAhB,KAAsB,IAA7B;AACD;;eAEcF,2B"}
1
+ {"version":3,"names":["_queryCategorySamples","_interopRequireDefault","require","obj","__esModule","default","getMostRecentCategorySample","identifier","samples","queryCategorySamples","limit","ascending","_default","exports"],"sources":["getMostRecentCategorySample.ts"],"sourcesContent":["import queryCategorySamples from './queryCategorySamples'\n\nimport type { HKCategoryTypeIdentifier } from '../native-types'\n\nasync function getMostRecentCategorySample<\n T extends HKCategoryTypeIdentifier\n>(\n identifier: T,\n) {\n const samples = await queryCategorySamples(identifier, {\n limit: 1,\n ascending: false,\n })\n\n return samples[0] || null\n}\n\nexport default getMostRecentCategorySample\n"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIzD,eAAeG,2BAA2BA,CAGxCC,UAAa,EACb;EACA,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAoB,EAACF,UAAU,EAAE;IACrDG,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,OAAOH,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC3B;AAAC,IAAAI,QAAA,GAEcN,2BAA2B;AAAAO,OAAA,CAAAR,OAAA,GAAAO,QAAA"}
@@ -4,19 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _queryQuantitySamples = _interopRequireDefault(require("./queryQuantitySamples"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  async function getMostRecentQuantitySample(identifier, unit) {
13
10
  const samples = await (0, _queryQuantitySamples.default)(identifier, {
14
11
  limit: 1,
15
12
  unit
16
13
  });
17
- return samples.samples[0] || null;
14
+ return samples[0] || null;
18
15
  }
19
-
20
16
  var _default = getMostRecentQuantitySample;
21
17
  exports.default = _default;
22
18
  //# sourceMappingURL=getMostRecentQuantitySample.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getMostRecentQuantitySample","identifier","unit","samples","queryQuantitySamples","limit"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n) {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n return samples.samples[0] || null\n}\n\nexport default getMostRecentQuantitySample\n"],"mappings":";;;;;;;AAAA;;;;AAIA,eAAeA,2BAAf,CAIEC,UAJF,EAKEC,IALF,EAME;EACA,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAA,EAAqBH,UAArB,EAAiC;IACrDI,KAAK,EAAE,CAD8C;IAErDH;EAFqD,CAAjC,CAAtB;EAIA,OAAOC,OAAO,CAACA,OAAR,CAAgB,CAAhB,KAAsB,IAA7B;AACD;;eAEcH,2B"}
1
+ {"version":3,"names":["_queryQuantitySamples","_interopRequireDefault","require","obj","__esModule","default","getMostRecentQuantitySample","identifier","unit","samples","queryQuantitySamples","limit","_default","exports"],"sources":["getMostRecentQuantitySample.ts"],"sourcesContent":["import queryQuantitySamples from './queryQuantitySamples'\n\nimport type { HKQuantityTypeIdentifier, UnitForIdentifier } from '../native-types'\n\nasync function getMostRecentQuantitySample<\n TIdentifier extends HKQuantityTypeIdentifier,\n TUnit extends UnitForIdentifier<TIdentifier>\n>(\n identifier: TIdentifier,\n unit: TUnit,\n) {\n const samples = await queryQuantitySamples(identifier, {\n limit: 1,\n unit,\n })\n return samples[0] || null\n}\n\nexport default getMostRecentQuantitySample\n"],"mappings":";;;;;;AAAA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyD,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAIzD,eAAeG,2BAA2BA,CAIxCC,UAAuB,EACvBC,IAAW,EACX;EACA,MAAMC,OAAO,GAAG,MAAM,IAAAC,6BAAoB,EAACH,UAAU,EAAE;IACrDI,KAAK,EAAE,CAAC;IACRH;EACF,CAAC,CAAC;EACF,OAAOC,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI;AAC3B;AAAC,IAAAG,QAAA,GAEcN,2BAA2B;AAAAO,OAAA,CAAAR,OAAA,GAAAO,QAAA"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _queryWorkouts = _interopRequireDefault(require("./queryWorkouts"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const getMostRecentWorkout = async options => {
13
10
  const workouts = await (0, _queryWorkouts.default)({
14
11
  limit: 1,
@@ -18,7 +15,6 @@ const getMostRecentWorkout = async options => {
18
15
  });
19
16
  return workouts[0] || null;
20
17
  };
21
-
22
18
  var _default = getMostRecentWorkout;
23
19
  exports.default = _default;
24
20
  //# sourceMappingURL=getMostRecentWorkout.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getMostRecentWorkout","options","workouts","queryWorkouts","limit","ascending","energyUnit","distanceUnit"],"sources":["getMostRecentWorkout.ts"],"sourcesContent":["import queryWorkouts from './queryWorkouts'\n\nimport type { EnergyUnit, LengthUnit } from '../native-types'\nimport type { HKWorkout, QueryWorkoutsOptions } from '../types'\n\nexport type GetMostRecentWorkoutFn = <\n TEnergy extends EnergyUnit,\n TDistance extends LengthUnit\n>(\n options?: Pick<\n QueryWorkoutsOptions<TEnergy, TDistance>,\n 'distanceUnit' | 'energyUnit'\n >\n) => Promise<HKWorkout<TEnergy, TDistance> | null>;\n\nconst getMostRecentWorkout: GetMostRecentWorkoutFn = async (options) => {\n const workouts = await queryWorkouts({\n limit: 1,\n ascending: false,\n energyUnit: options?.energyUnit,\n distanceUnit: options?.distanceUnit,\n })\n\n return workouts[0] || null\n}\n\nexport default getMostRecentWorkout\n"],"mappings":";;;;;;;AAAA;;;;AAeA,MAAMA,oBAA4C,GAAG,MAAOC,OAAP,IAAmB;EACtE,MAAMC,QAAQ,GAAG,MAAM,IAAAC,sBAAA,EAAc;IACnCC,KAAK,EAAE,CAD4B;IAEnCC,SAAS,EAAE,KAFwB;IAGnCC,UAAU,EAAEL,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEK,UAHc;IAInCC,YAAY,EAAEN,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEM;EAJY,CAAd,CAAvB;EAOA,OAAOL,QAAQ,CAAC,CAAD,CAAR,IAAe,IAAtB;AACD,CATD;;eAWeF,oB"}
1
+ {"version":3,"names":["_queryWorkouts","_interopRequireDefault","require","obj","__esModule","default","getMostRecentWorkout","options","workouts","queryWorkouts","limit","ascending","energyUnit","distanceUnit","_default","exports"],"sources":["getMostRecentWorkout.ts"],"sourcesContent":["import queryWorkouts from './queryWorkouts'\n\nimport type { EnergyUnit, LengthUnit } from '../native-types'\nimport type { HKWorkout, QueryWorkoutsOptions } from '../types'\n\nexport type GetMostRecentWorkoutFn = <\n TEnergy extends EnergyUnit,\n TDistance extends LengthUnit\n>(\n options?: Pick<\n QueryWorkoutsOptions<TEnergy, TDistance>,\n 'distanceUnit' | 'energyUnit'\n >\n) => Promise<HKWorkout<TEnergy, TDistance> | null>;\n\nconst getMostRecentWorkout: GetMostRecentWorkoutFn = async (options) => {\n const workouts = await queryWorkouts({\n limit: 1,\n ascending: false,\n energyUnit: options?.energyUnit,\n distanceUnit: options?.distanceUnit,\n })\n\n return workouts[0] || null\n}\n\nexport default getMostRecentWorkout\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAe3C,MAAMG,oBAA4C,GAAG,MAAOC,OAAO,IAAK;EACtE,MAAMC,QAAQ,GAAG,MAAM,IAAAC,sBAAa,EAAC;IACnCC,KAAK,EAAE,CAAC;IACRC,SAAS,EAAE,KAAK;IAChBC,UAAU,EAAEL,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEK,UAAU;IAC/BC,YAAY,EAAEN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEM;EACzB,CAAC,CAAC;EAEF,OAAOL,QAAQ,CAAC,CAAC,CAAC,IAAI,IAAI;AAC5B,CAAC;AAAA,IAAAM,QAAA,GAEcR,oBAAoB;AAAAS,OAAA,CAAAV,OAAA,GAAAS,QAAA"}
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _getPreferredUnits = _interopRequireDefault(require("./getPreferredUnits"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const getPreferredUnit = async type => {
13
10
  const [unit] = await (0, _getPreferredUnits.default)([type]);
14
11
  return unit;
15
12
  };
16
-
17
13
  var _default = getPreferredUnit;
18
14
  exports.default = _default;
19
15
  //# sourceMappingURL=getPreferredUnit.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getPreferredUnit","type","unit","getPreferredUnits"],"sources":["getPreferredUnit.ts"],"sourcesContent":["import getPreferredUnits from './getPreferredUnits'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitFn = (\n identifier: HKQuantityTypeIdentifier\n) => Promise<HKUnit | undefined>;\n\nconst getPreferredUnit: GetPreferredUnitFn = async (type) => {\n const [unit] = await getPreferredUnits([type])\n return unit\n}\n\nexport default getPreferredUnit\n"],"mappings":";;;;;;;AAAA;;;;AAQA,MAAMA,gBAAoC,GAAG,MAAOC,IAAP,IAAgB;EAC3D,MAAM,CAACC,IAAD,IAAS,MAAM,IAAAC,0BAAA,EAAkB,CAACF,IAAD,CAAlB,CAArB;EACA,OAAOC,IAAP;AACD,CAHD;;eAKeF,gB"}
1
+ {"version":3,"names":["_getPreferredUnits","_interopRequireDefault","require","obj","__esModule","default","getPreferredUnit","type","unit","getPreferredUnits","_default","exports"],"sources":["getPreferredUnit.ts"],"sourcesContent":["import getPreferredUnits from './getPreferredUnits'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitFn = (\n identifier: HKQuantityTypeIdentifier\n) => Promise<HKUnit | undefined>;\n\nconst getPreferredUnit: GetPreferredUnitFn = async (type) => {\n const [unit] = await getPreferredUnits([type])\n return unit\n}\n\nexport default getPreferredUnit\n"],"mappings":";;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAmD,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQnD,MAAMG,gBAAoC,GAAG,MAAOC,IAAI,IAAK;EAC3D,MAAM,CAACC,IAAI,CAAC,GAAG,MAAM,IAAAC,0BAAiB,EAAC,CAACF,IAAI,CAAC,CAAC;EAC9C,OAAOC,IAAI;AACb,CAAC;AAAA,IAAAE,QAAA,GAEcJ,gBAAgB;AAAAK,OAAA,CAAAN,OAAA,GAAAK,QAAA"}
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nativeTypes = _interopRequireDefault(require("../native-types"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const getPreferredUnits = async identifiers => {
13
10
  const units = await _nativeTypes.default.getPreferredUnits(identifiers);
14
11
  return identifiers.map(i => units[i]);
15
12
  };
16
-
17
13
  var _default = getPreferredUnits;
18
14
  exports.default = _default;
19
15
  //# sourceMappingURL=getPreferredUnits.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getPreferredUnits","identifiers","units","Native","map","i"],"sources":["getPreferredUnits.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitsFn = (\n identifiers: readonly HKQuantityTypeIdentifier[]\n) => Promise<readonly HKUnit[]>;\n\nconst getPreferredUnits: GetPreferredUnitsFn = async (identifiers) => {\n const units = await Native.getPreferredUnits(identifiers)\n return identifiers.map((i) => units[i])\n}\n\nexport default getPreferredUnits\n"],"mappings":";;;;;;;AAAA;;;;AAQA,MAAMA,iBAAsC,GAAG,MAAOC,WAAP,IAAuB;EACpE,MAAMC,KAAK,GAAG,MAAMC,oBAAA,CAAOH,iBAAP,CAAyBC,WAAzB,CAApB;EACA,OAAOA,WAAW,CAACG,GAAZ,CAAiBC,CAAD,IAAOH,KAAK,CAACG,CAAD,CAA5B,CAAP;AACD,CAHD;;eAKeL,iB"}
1
+ {"version":3,"names":["_nativeTypes","_interopRequireDefault","require","obj","__esModule","default","getPreferredUnits","identifiers","units","Native","map","i","_default","exports"],"sources":["getPreferredUnits.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type { HKQuantityTypeIdentifier, HKUnit } from '../native-types'\n\nexport type GetPreferredUnitsFn = (\n identifiers: readonly HKQuantityTypeIdentifier[]\n) => Promise<readonly HKUnit[]>;\n\nconst getPreferredUnits: GetPreferredUnitsFn = async (identifiers) => {\n const units = await Native.getPreferredUnits(identifiers)\n return identifiers.map((i) => units[i])\n}\n\nexport default getPreferredUnits\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAQpC,MAAMG,iBAAsC,GAAG,MAAOC,WAAW,IAAK;EACpE,MAAMC,KAAK,GAAG,MAAMC,oBAAM,CAACH,iBAAiB,CAACC,WAAW,CAAC;EACzD,OAAOA,WAAW,CAACG,GAAG,CAAEC,CAAC,IAAKH,KAAK,CAACG,CAAC,CAAC,CAAC;AACzC,CAAC;AAAA,IAAAC,QAAA,GAEcN,iBAAiB;AAAAO,OAAA,CAAAR,OAAA,GAAAO,QAAA"}
@@ -4,43 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nativeTypes = _interopRequireWildcard(require("../native-types"));
9
-
10
8
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
-
12
9
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
-
14
10
  async function getPreferredUnitsTyped(options) {
15
11
  let energyUnit = options === null || options === void 0 ? void 0 : options.energyUnit;
16
12
  let distanceUnit = options === null || options === void 0 ? void 0 : options.distanceUnit;
17
-
18
13
  if (!energyUnit || !distanceUnit) {
19
14
  const units = await _nativeTypes.default.getPreferredUnits([_nativeTypes.HKQuantityTypeIdentifier.distanceWalkingRunning, _nativeTypes.HKQuantityTypeIdentifier.activeEnergyBurned]);
20
-
21
15
  if (!energyUnit) {
22
16
  energyUnit = units[_nativeTypes.HKQuantityTypeIdentifier.activeEnergyBurned];
23
17
  }
24
-
25
18
  if (!distanceUnit) {
26
19
  distanceUnit = units[_nativeTypes.HKQuantityTypeIdentifier.distanceWalkingRunning];
27
20
  }
28
21
  }
29
-
30
22
  if (!energyUnit) {
31
23
  energyUnit = _nativeTypes.UnitOfEnergy.Kilocalories;
32
24
  }
33
-
34
25
  if (!distanceUnit) {
35
26
  distanceUnit = _nativeTypes.UnitOfLength.Meter;
36
27
  }
37
-
38
28
  return {
39
29
  energyUnit,
40
30
  distanceUnit
41
31
  };
42
32
  }
43
-
44
33
  var _default = getPreferredUnitsTyped;
45
34
  exports.default = _default;
46
35
  //# sourceMappingURL=getPreferredUnitsTyped.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getPreferredUnitsTyped","options","energyUnit","distanceUnit","units","Native","getPreferredUnits","HKQuantityTypeIdentifier","distanceWalkingRunning","activeEnergyBurned","UnitOfEnergy","Kilocalories","UnitOfLength","Meter"],"sources":["getPreferredUnitsTyped.ts"],"sourcesContent":["import Native, { HKQuantityTypeIdentifier, UnitOfEnergy, UnitOfLength } from '../native-types'\n\nimport type { HKUnit } from '../native-types'\n\nasync function getPreferredUnitsTyped<\n TEnergy extends HKUnit,\n TDistance extends HKUnit\n>(options?: { readonly energyUnit?: TEnergy; readonly distanceUnit?: TDistance }) {\n let energyUnit = options?.energyUnit\n let distanceUnit = options?.distanceUnit\n\n if (!energyUnit || !distanceUnit) {\n const units = await Native.getPreferredUnits([\n HKQuantityTypeIdentifier.distanceWalkingRunning,\n HKQuantityTypeIdentifier.activeEnergyBurned,\n ])\n if (!energyUnit) {\n energyUnit = units[HKQuantityTypeIdentifier.activeEnergyBurned] as\n | TEnergy\n | undefined\n }\n if (!distanceUnit) {\n distanceUnit = units[HKQuantityTypeIdentifier.distanceWalkingRunning] as\n | TDistance\n | undefined\n }\n }\n\n if (!energyUnit) {\n energyUnit = UnitOfEnergy.Kilocalories as TEnergy\n }\n if (!distanceUnit) {\n distanceUnit = UnitOfLength.Meter as TDistance\n }\n return { energyUnit, distanceUnit }\n}\n\nexport default getPreferredUnitsTyped\n"],"mappings":";;;;;;;AAAA;;;;;;AAIA,eAAeA,sBAAf,CAGEC,OAHF,EAGkF;EAChF,IAAIC,UAAU,GAAGD,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEC,UAA1B;EACA,IAAIC,YAAY,GAAGF,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAAEE,YAA5B;;EAEA,IAAI,CAACD,UAAD,IAAe,CAACC,YAApB,EAAkC;IAChC,MAAMC,KAAK,GAAG,MAAMC,oBAAA,CAAOC,iBAAP,CAAyB,CAC3CC,qCAAA,CAAyBC,sBADkB,EAE3CD,qCAAA,CAAyBE,kBAFkB,CAAzB,CAApB;;IAIA,IAAI,CAACP,UAAL,EAAiB;MACfA,UAAU,GAAGE,KAAK,CAACG,qCAAA,CAAyBE,kBAA1B,CAAlB;IAGD;;IACD,IAAI,CAACN,YAAL,EAAmB;MACjBA,YAAY,GAAGC,KAAK,CAACG,qCAAA,CAAyBC,sBAA1B,CAApB;IAGD;EACF;;EAED,IAAI,CAACN,UAAL,EAAiB;IACfA,UAAU,GAAGQ,yBAAA,CAAaC,YAA1B;EACD;;EACD,IAAI,CAACR,YAAL,EAAmB;IACjBA,YAAY,GAAGS,yBAAA,CAAaC,KAA5B;EACD;;EACD,OAAO;IAAEX,UAAF;IAAcC;EAAd,CAAP;AACD;;eAEcH,sB"}
1
+ {"version":3,"names":["_nativeTypes","_interopRequireWildcard","require","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","getPreferredUnitsTyped","options","energyUnit","distanceUnit","units","Native","getPreferredUnits","HKQuantityTypeIdentifier","distanceWalkingRunning","activeEnergyBurned","UnitOfEnergy","Kilocalories","UnitOfLength","Meter","_default","exports"],"sources":["getPreferredUnitsTyped.ts"],"sourcesContent":["import Native, { HKQuantityTypeIdentifier, UnitOfEnergy, UnitOfLength } from '../native-types'\n\nimport type { HKUnit } from '../native-types'\n\nasync function getPreferredUnitsTyped<\n TEnergy extends HKUnit,\n TDistance extends HKUnit\n>(options?: { readonly energyUnit?: TEnergy; readonly distanceUnit?: TDistance }) {\n let energyUnit = options?.energyUnit\n let distanceUnit = options?.distanceUnit\n\n if (!energyUnit || !distanceUnit) {\n const units = await Native.getPreferredUnits([\n HKQuantityTypeIdentifier.distanceWalkingRunning,\n HKQuantityTypeIdentifier.activeEnergyBurned,\n ])\n if (!energyUnit) {\n energyUnit = units[HKQuantityTypeIdentifier.activeEnergyBurned] as\n | TEnergy\n | undefined\n }\n if (!distanceUnit) {\n distanceUnit = units[HKQuantityTypeIdentifier.distanceWalkingRunning] as\n | TDistance\n | undefined\n }\n }\n\n if (!energyUnit) {\n energyUnit = UnitOfEnergy.Kilocalories as TEnergy\n }\n if (!distanceUnit) {\n distanceUnit = UnitOfLength.Meter as TDistance\n }\n return { energyUnit, distanceUnit }\n}\n\nexport default getPreferredUnitsTyped\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8F,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA;AAI9F,eAAeW,sBAAsBA,CAGnCC,OAA8E,EAAE;EAChF,IAAIC,UAAU,GAAGD,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEC,UAAU;EACpC,IAAIC,YAAY,GAAGF,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,YAAY;EAExC,IAAI,CAACD,UAAU,IAAI,CAACC,YAAY,EAAE;IAChC,MAAMC,KAAK,GAAG,MAAMC,oBAAM,CAACC,iBAAiB,CAAC,CAC3CC,qCAAwB,CAACC,sBAAsB,EAC/CD,qCAAwB,CAACE,kBAAkB,CAC5C,CAAC;IACF,IAAI,CAACP,UAAU,EAAE;MACfA,UAAU,GAAGE,KAAK,CAACG,qCAAwB,CAACE,kBAAkB,CAEnD;IACb;IACA,IAAI,CAACN,YAAY,EAAE;MACjBA,YAAY,GAAGC,KAAK,CAACG,qCAAwB,CAACC,sBAAsB,CAEzD;IACb;EACF;EAEA,IAAI,CAACN,UAAU,EAAE;IACfA,UAAU,GAAGQ,yBAAY,CAACC,YAAuB;EACnD;EACA,IAAI,CAACR,YAAY,EAAE;IACjBA,YAAY,GAAGS,yBAAY,CAACC,KAAkB;EAChD;EACA,OAAO;IAAEX,UAAU;IAAEC;EAAa,CAAC;AACrC;AAAC,IAAAW,QAAA,GAEcd,sBAAsB;AAAAe,OAAA,CAAA9B,OAAA,GAAA6B,QAAA"}
@@ -4,22 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _nativeTypes = _interopRequireDefault(require("../native-types"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const getRequestStatusForAuthorization = async function (read) {
13
10
  let write = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
14
- const readPermissions = read.reduce((obj, cur) => ({ ...obj,
11
+ const readPermissions = read.reduce((obj, cur) => ({
12
+ ...obj,
15
13
  [cur]: true
16
14
  }), {});
17
- const writePermissions = write.reduce((obj, cur) => ({ ...obj,
15
+ const writePermissions = write.reduce((obj, cur) => ({
16
+ ...obj,
18
17
  [cur]: true
19
18
  }), {});
20
19
  return _nativeTypes.default.getRequestStatusForAuthorization(writePermissions, readPermissions);
21
20
  };
22
-
23
21
  var _default = getRequestStatusForAuthorization;
24
22
  exports.default = _default;
25
23
  //# sourceMappingURL=getRequestStatusForAuthorization.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getRequestStatusForAuthorization","read","write","readPermissions","reduce","obj","cur","writePermissions","Native"],"sources":["getRequestStatusForAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\nconst getRequestStatusForAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n) => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.getRequestStatusForAuthorization(\n writePermissions,\n readPermissions,\n )\n}\n\nexport default getRequestStatusForAuthorization\n"],"mappings":";;;;;;;AAAA;;;;AAMA,MAAMA,gCAAgC,GAAG,gBACvCC,IADuC,EAGpC;EAAA,IADHC,KACG,uEAD6C,EAC7C;EACH,MAAMC,eAAe,GAAGF,IAAI,CAACG,MAAL,CAAY,CAACC,GAAD,EAAMC,GAAN,MAAe,EAAE,GAAGD,GAAL;IAAU,CAACC,GAAD,GAAO;EAAjB,CAAf,CAAZ,EAAqD,EAArD,CAAxB;EAEA,MAAMC,gBAAgB,GAAGL,KAAK,CAACE,MAAN,CAAa,CAACC,GAAD,EAAMC,GAAN,MAAe,EAAE,GAAGD,GAAL;IAAU,CAACC,GAAD,GAAO;EAAjB,CAAf,CAAb,EAAsD,EAAtD,CAAzB;EAEA,OAAOE,oBAAA,CAAOR,gCAAP,CACLO,gBADK,EAELJ,eAFK,CAAP;AAID,CAZD;;eAceH,gC"}
1
+ {"version":3,"names":["_nativeTypes","_interopRequireDefault","require","obj","__esModule","default","getRequestStatusForAuthorization","read","write","arguments","length","undefined","readPermissions","reduce","cur","writePermissions","Native","_default","exports"],"sources":["getRequestStatusForAuthorization.ts"],"sourcesContent":["import Native from '../native-types'\n\nimport type {\n HealthkitReadAuthorization, HealthkitWriteAuthorization, ReadPermissions, WritePermissions,\n} from '../native-types'\n\nconst getRequestStatusForAuthorization = async (\n read: readonly HealthkitReadAuthorization[],\n write: readonly HealthkitWriteAuthorization[] = [],\n) => {\n const readPermissions = read.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as ReadPermissions)\n\n const writePermissions = write.reduce((obj, cur) => ({ ...obj, [cur]: true }), {} as WritePermissions)\n\n return Native.getRequestStatusForAuthorization(\n writePermissions,\n readPermissions,\n )\n}\n\nexport default getRequestStatusForAuthorization\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAMpC,MAAMG,gCAAgC,GAAG,eAAAA,CACvCC,IAA2C,EAExC;EAAA,IADHC,KAA6C,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAElD,MAAMG,eAAe,GAAGL,IAAI,CAACM,MAAM,CAAC,CAACV,GAAG,EAAEW,GAAG,MAAM;IAAE,GAAGX,GAAG;IAAE,CAACW,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAoB,CAAC;EAEnG,MAAMC,gBAAgB,GAAGP,KAAK,CAACK,MAAM,CAAC,CAACV,GAAG,EAAEW,GAAG,MAAM;IAAE,GAAGX,GAAG;IAAE,CAACW,GAAG,GAAG;EAAK,CAAC,CAAC,EAAE,CAAC,CAAqB,CAAC;EAEtG,OAAOE,oBAAM,CAACV,gCAAgC,CAC5CS,gBAAgB,EAChBH,eACF,CAAC;AACH,CAAC;AAAA,IAAAK,QAAA,GAEcX,gCAAgC;AAAAY,OAAA,CAAAb,OAAA,GAAAY,QAAA"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _serializeDate = _interopRequireDefault(require("./serializeDate"));
9
-
10
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
9
  const prepareOptions = options => {
13
10
  const limit = !options.limit || options.limit === Infinity ? 0 : options.limit;
14
11
  const ascending = options.ascending ?? limit === 0;
@@ -23,7 +20,6 @@ const prepareOptions = options => {
23
20
  anchor
24
21
  };
25
22
  };
26
-
27
23
  var _default = prepareOptions;
28
24
  exports.default = _default;
29
25
  //# sourceMappingURL=prepareOptions.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["prepareOptions","options","limit","Infinity","ascending","from","serializeDate","Date","undefined","to","anchor"],"sources":["prepareOptions.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\nimport type { GenericQueryOptions } from '../types'\n\nconst prepareOptions = (options: GenericQueryOptions) => {\n const limit = !options.limit || options.limit === Infinity\n ? 0\n : options.limit\n const ascending = options.ascending ?? limit === 0\n const from = serializeDate(options.from ? options.from : (limit > 0 ? new Date(0) : undefined))\n const to = serializeDate(options.to)\n const anchor = options.anchor ?? ''\n return {\n limit, ascending, from, to, anchor,\n }\n}\n\nexport default prepareOptions\n"],"mappings":";;;;;;;AAAA;;;;AAIA,MAAMA,cAAc,GAAIC,OAAD,IAAkC;EACvD,MAAMC,KAAK,GAAG,CAACD,OAAO,CAACC,KAAT,IAAkBD,OAAO,CAACC,KAAR,KAAkBC,QAApC,GACV,CADU,GAEVF,OAAO,CAACC,KAFZ;EAGA,MAAME,SAAS,GAAGH,OAAO,CAACG,SAAR,IAAqBF,KAAK,KAAK,CAAjD;EACA,MAAMG,IAAI,GAAG,IAAAC,sBAAA,EAAcL,OAAO,CAACI,IAAR,GAAeJ,OAAO,CAACI,IAAvB,GAA+BH,KAAK,GAAG,CAAR,GAAY,IAAIK,IAAJ,CAAS,CAAT,CAAZ,GAA0BC,SAAvE,CAAb;EACA,MAAMC,EAAE,GAAG,IAAAH,sBAAA,EAAcL,OAAO,CAACQ,EAAtB,CAAX;EACA,MAAMC,MAAM,GAAGT,OAAO,CAACS,MAAR,IAAkB,EAAjC;EACA,OAAO;IACLR,KADK;IACEE,SADF;IACaC,IADb;IACmBI,EADnB;IACuBC;EADvB,CAAP;AAGD,CAXD;;eAaeV,c"}
1
+ {"version":3,"names":["_serializeDate","_interopRequireDefault","require","obj","__esModule","default","prepareOptions","options","limit","Infinity","ascending","from","serializeDate","Date","undefined","to","anchor","_default","exports"],"sources":["prepareOptions.ts"],"sourcesContent":["import serializeDate from './serializeDate'\n\nimport type { GenericQueryOptions } from '../types'\n\nconst prepareOptions = (options: GenericQueryOptions) => {\n const limit = !options.limit || options.limit === Infinity\n ? 0\n : options.limit\n const ascending = options.ascending ?? limit === 0\n const from = serializeDate(options.from ? options.from : (limit > 0 ? new Date(0) : undefined))\n const to = serializeDate(options.to)\n const anchor = options.anchor ?? ''\n return {\n limit, ascending, from, to, anchor,\n }\n}\n\nexport default prepareOptions\n"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA2C,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAI3C,MAAMG,cAAc,GAAIC,OAA4B,IAAK;EACvD,MAAMC,KAAK,GAAG,CAACD,OAAO,CAACC,KAAK,IAAID,OAAO,CAACC,KAAK,KAAKC,QAAQ,GACtD,CAAC,GACDF,OAAO,CAACC,KAAK;EACjB,MAAME,SAAS,GAAGH,OAAO,CAACG,SAAS,IAAIF,KAAK,KAAK,CAAC;EAClD,MAAMG,IAAI,GAAG,IAAAC,sBAAa,EAACL,OAAO,CAACI,IAAI,GAAGJ,OAAO,CAACI,IAAI,GAAIH,KAAK,GAAG,CAAC,GAAG,IAAIK,IAAI,CAAC,CAAC,CAAC,GAAGC,SAAU,CAAC;EAC/F,MAAMC,EAAE,GAAG,IAAAH,sBAAa,EAACL,OAAO,CAACQ,EAAE,CAAC;EACpC,MAAMC,MAAM,GAAGT,OAAO,CAACS,MAAM,IAAI,EAAE;EACnC,OAAO;IACLR,KAAK;IAAEE,SAAS;IAAEC,IAAI;IAAEI,EAAE;IAAEC;EAC9B,CAAC;AACH,CAAC;AAAA,IAAAC,QAAA,GAEcX,cAAc;AAAAY,OAAA,CAAAb,OAAA,GAAAY,QAAA"}
@@ -4,25 +4,14 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- var _nativeTypes = _interopRequireDefault(require("../native-types"));
9
-
10
- var _deserializeCategorySample = _interopRequireDefault(require("./deserializeCategorySample"));
11
-
12
7
  var _prepareOptions = _interopRequireDefault(require("./prepareOptions"));
13
-
8
+ var _nativeTypes = _interopRequireDefault(require("../native-types"));
14
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
10
  const queryCategorySamples = async (identifier, options) => {
17
11
  const opts = (0, _prepareOptions.default)(options);
18
- const raw = await _nativeTypes.default.queryCategorySamples(identifier, opts.from, opts.to, opts.limit, opts.ascending, opts.anchor);
19
- return {
20
- samples: raw.samples.map(_deserializeCategorySample.default),
21
- deletedSamples: raw.deletedSamples,
22
- newAnchor: raw.newAnchor
23
- };
12
+ const raw = await _nativeTypes.default.queryCategorySamples(identifier, opts.from, opts.to, opts.limit, opts.ascending);
13
+ return raw;
24
14
  };
25
-
26
15
  var _default = queryCategorySamples;
27
16
  exports.default = _default;
28
17
  //# sourceMappingURL=queryCategorySamples.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["queryCategorySamples","identifier","options","opts","prepareOptions","raw","Native","from","to","limit","ascending","anchor","samples","map","deserializCategorySample","deletedSamples","newAnchor"],"sources":["queryCategorySamples.ts"],"sourcesContent":["import Native from '../native-types'\nimport deserializCategorySample from './deserializeCategorySample'\nimport prepareOptions from './prepareOptions'\n\nimport type { HKCategoryTypeIdentifier, DeletedCategorySampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKCategorySample } from '../types'\n\nexport type QueryCategorySamplesResponse<T extends HKCategoryTypeIdentifier> = {\n readonly samples: readonly HKCategorySample<T>[],\n readonly deletedSamples: readonly DeletedCategorySampleRaw<T>[],\n readonly newAnchor: string\n}\n\nexport type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(\n identifier: T,\n options: GenericQueryOptions\n) => Promise<QueryCategorySamplesResponse<T>>;\n\nconst queryCategorySamples: QueryCategorySamplesFn = async (\n identifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const raw = await Native.queryCategorySamples(\n identifier,\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n opts.anchor,\n )\n\n return {\n samples: raw.samples.map(deserializCategorySample),\n deletedSamples: raw.deletedSamples,\n newAnchor: raw.newAnchor,\n }\n}\n\nexport default queryCategorySamples\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAgBA,MAAMA,oBAA4C,GAAG,OACnDC,UADmD,EAEnDC,OAFmD,KAGhD;EACH,MAAMC,IAAI,GAAG,IAAAC,uBAAA,EAAeF,OAAf,CAAb;EACA,MAAMG,GAAG,GAAG,MAAMC,oBAAA,CAAON,oBAAP,CAChBC,UADgB,EAEhBE,IAAI,CAACI,IAFW,EAGhBJ,IAAI,CAACK,EAHW,EAIhBL,IAAI,CAACM,KAJW,EAKhBN,IAAI,CAACO,SALW,EAMhBP,IAAI,CAACQ,MANW,CAAlB;EASA,OAAO;IACLC,OAAO,EAAEP,GAAG,CAACO,OAAJ,CAAYC,GAAZ,CAAgBC,kCAAhB,CADJ;IAELC,cAAc,EAAEV,GAAG,CAACU,cAFf;IAGLC,SAAS,EAAEX,GAAG,CAACW;EAHV,CAAP;AAKD,CAnBD;;eAqBehB,oB"}
1
+ {"version":3,"names":["_prepareOptions","_interopRequireDefault","require","_nativeTypes","obj","__esModule","default","queryCategorySamples","identifier","options","opts","prepareOptions","raw","Native","from","to","limit","ascending","_default","exports"],"sources":["queryCategorySamples.ts"],"sourcesContent":["import prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, HKCategorySampleRaw } from '../native-types'\nimport type { GenericQueryOptions } from '../types'\n\nexport type QueryCategorySamplesFn = <T extends HKCategoryTypeIdentifier>(\n identifier: T,\n options: Omit<GenericQueryOptions, 'anchor'>\n) => Promise<readonly HKCategorySampleRaw<T>[]>;\n\nconst queryCategorySamples: QueryCategorySamplesFn = async (\n identifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const raw = await Native.queryCategorySamples(\n identifier,\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return raw\n}\n\nexport default queryCategorySamples\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAUpC,MAAMG,oBAA4C,GAAG,MAAAA,CACnDC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAG,IAAAC,uBAAc,EAACF,OAAO,CAAC;EACpC,MAAMG,GAAG,GAAG,MAAMC,oBAAM,CAACN,oBAAoB,CAC3CC,UAAU,EACVE,IAAI,CAACI,IAAI,EACTJ,IAAI,CAACK,EAAE,EACPL,IAAI,CAACM,KAAK,EACVN,IAAI,CAACO,SACP,CAAC;EAED,OAAOL,GAAG;AACZ,CAAC;AAAA,IAAAM,QAAA,GAEcX,oBAAoB;AAAAY,OAAA,CAAAb,OAAA,GAAAY,QAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _deserializeCategorySample = _interopRequireDefault(require("./deserializeCategorySample"));
8
+ var _prepareOptions = _interopRequireDefault(require("./prepareOptions"));
9
+ var _nativeTypes = _interopRequireDefault(require("../native-types"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const queryCategorySamplesWithAnchor = async (identifier, options) => {
12
+ const opts = (0, _prepareOptions.default)(options);
13
+ const raw = await _nativeTypes.default.queryCategorySamplesWithAnchor(identifier, opts.from, opts.to, opts.limit, opts.anchor);
14
+ return {
15
+ samples: raw.samples.map(_deserializeCategorySample.default),
16
+ deletedSamples: raw.deletedSamples,
17
+ newAnchor: raw.newAnchor
18
+ };
19
+ };
20
+ var _default = queryCategorySamplesWithAnchor;
21
+ exports.default = _default;
22
+ //# sourceMappingURL=queryCategorySamplesWithAnchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_deserializeCategorySample","_interopRequireDefault","require","_prepareOptions","_nativeTypes","obj","__esModule","default","queryCategorySamplesWithAnchor","identifier","options","opts","prepareOptions","raw","Native","from","to","limit","anchor","samples","map","deserializCategorySample","deletedSamples","newAnchor","_default","exports"],"sources":["queryCategorySamplesWithAnchor.ts"],"sourcesContent":["import deserializCategorySample from './deserializeCategorySample'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCategoryTypeIdentifier, DeletedCategorySampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKCategorySample } from '../types'\n\nexport type QueryCategorySamplesWithAnchorResponse<T extends HKCategoryTypeIdentifier> = {\n readonly samples: readonly HKCategorySample<T>[],\n readonly deletedSamples: readonly DeletedCategorySampleRaw<T>[],\n readonly newAnchor: string\n}\n\nexport type QueryCategorySamplesWithAnchorFn = <T extends HKCategoryTypeIdentifier>(\n identifier: T,\n options: Omit<GenericQueryOptions, 'ascending'>\n) => Promise<QueryCategorySamplesWithAnchorResponse<T>>;\n\nconst queryCategorySamplesWithAnchor: QueryCategorySamplesWithAnchorFn = async (\n identifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const raw = await Native.queryCategorySamplesWithAnchor(\n identifier,\n opts.from,\n opts.to,\n opts.limit,\n opts.anchor,\n )\n\n return {\n samples: raw.samples.map(deserializCategorySample),\n deletedSamples: raw.deletedSamples,\n newAnchor: raw.newAnchor,\n }\n}\n\nexport default queryCategorySamplesWithAnchor\n"],"mappings":";;;;;;AAAA,IAAAA,0BAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAgBpC,MAAMG,8BAAgE,GAAG,MAAAA,CACvEC,UAAU,EACVC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAG,IAAAC,uBAAc,EAACF,OAAO,CAAC;EACpC,MAAMG,GAAG,GAAG,MAAMC,oBAAM,CAACN,8BAA8B,CACrDC,UAAU,EACVE,IAAI,CAACI,IAAI,EACTJ,IAAI,CAACK,EAAE,EACPL,IAAI,CAACM,KAAK,EACVN,IAAI,CAACO,MACP,CAAC;EAED,OAAO;IACLC,OAAO,EAAEN,GAAG,CAACM,OAAO,CAACC,GAAG,CAACC,kCAAwB,CAAC;IAClDC,cAAc,EAAET,GAAG,CAACS,cAAc;IAClCC,SAAS,EAAEV,GAAG,CAACU;EACjB,CAAC;AACH,CAAC;AAAA,IAAAC,QAAA,GAEchB,8BAA8B;AAAAiB,OAAA,CAAAlB,OAAA,GAAAiB,QAAA"}
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- var _nativeTypes = _interopRequireDefault(require("../native-types"));
9
-
10
7
  var _deserializeCorrelation = _interopRequireDefault(require("./deserializeCorrelation"));
11
-
12
8
  var _prepareOptions = _interopRequireDefault(require("./prepareOptions"));
13
-
9
+ var _nativeTypes = _interopRequireDefault(require("../native-types"));
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  const queryCorrelationSamples = async (typeIdentifier, options) => {
17
12
  const opts = (0, _prepareOptions.default)(options);
18
13
  const correlations = await _nativeTypes.default.queryCorrelationSamples(typeIdentifier, opts.from, opts.to);
19
14
  return correlations.map(_deserializeCorrelation.default);
20
15
  };
21
-
22
16
  var _default = queryCorrelationSamples;
23
17
  exports.default = _default;
24
18
  //# sourceMappingURL=queryCorrelationSamples.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["queryCorrelationSamples","typeIdentifier","options","opts","prepareOptions","correlations","Native","from","to","map","deserializeCorrelation"],"sources":["queryCorrelationSamples.ts"],"sourcesContent":["import Native from '../native-types'\nimport deserializeCorrelation from './deserializeCorrelation'\nimport prepareOptions from './prepareOptions'\n\nimport type { HKCorrelationTypeIdentifier } from '../native-types'\nimport type { GenericQueryOptions, HKCorrelation } from '../types'\n\nexport type QueryCorrelationSamplesFn = <\n TIdentifier extends HKCorrelationTypeIdentifier\n>(\n typeIdentifier: TIdentifier,\n options: Omit<GenericQueryOptions, 'ascending' | 'limit'>\n) => Promise<readonly HKCorrelation<TIdentifier>[]>;\n\nconst queryCorrelationSamples: QueryCorrelationSamplesFn = async (\n typeIdentifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const correlations = await Native.queryCorrelationSamples(\n typeIdentifier,\n opts.from,\n opts.to,\n )\n\n return correlations.map(deserializeCorrelation)\n}\n\nexport default queryCorrelationSamples\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAYA,MAAMA,uBAAkD,GAAG,OACzDC,cADyD,EAEzDC,OAFyD,KAGtD;EACH,MAAMC,IAAI,GAAG,IAAAC,uBAAA,EAAeF,OAAf,CAAb;EACA,MAAMG,YAAY,GAAG,MAAMC,oBAAA,CAAON,uBAAP,CACzBC,cADyB,EAEzBE,IAAI,CAACI,IAFoB,EAGzBJ,IAAI,CAACK,EAHoB,CAA3B;EAMA,OAAOH,YAAY,CAACI,GAAb,CAAiBC,+BAAjB,CAAP;AACD,CAZD;;eAceV,uB"}
1
+ {"version":3,"names":["_deserializeCorrelation","_interopRequireDefault","require","_prepareOptions","_nativeTypes","obj","__esModule","default","queryCorrelationSamples","typeIdentifier","options","opts","prepareOptions","correlations","Native","from","to","map","deserializeCorrelation","_default","exports"],"sources":["queryCorrelationSamples.ts"],"sourcesContent":["import deserializeCorrelation from './deserializeCorrelation'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { HKCorrelationTypeIdentifier } from '../native-types'\nimport type { GenericQueryOptions, HKCorrelation } from '../types'\n\nexport type QueryCorrelationSamplesFn = <\n TIdentifier extends HKCorrelationTypeIdentifier\n>(\n typeIdentifier: TIdentifier,\n options: Omit<GenericQueryOptions, 'anchor' | 'ascending' | 'limit'>\n) => Promise<readonly HKCorrelation<TIdentifier>[]>;\n\nconst queryCorrelationSamples: QueryCorrelationSamplesFn = async (\n typeIdentifier,\n options,\n) => {\n const opts = prepareOptions(options)\n const correlations = await Native.queryCorrelationSamples(\n typeIdentifier,\n opts.from,\n opts.to,\n )\n\n return correlations.map(deserializeCorrelation)\n}\n\nexport default queryCorrelationSamples\n"],"mappings":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAYpC,MAAMG,uBAAkD,GAAG,MAAAA,CACzDC,cAAc,EACdC,OAAO,KACJ;EACH,MAAMC,IAAI,GAAG,IAAAC,uBAAc,EAACF,OAAO,CAAC;EACpC,MAAMG,YAAY,GAAG,MAAMC,oBAAM,CAACN,uBAAuB,CACvDC,cAAc,EACdE,IAAI,CAACI,IAAI,EACTJ,IAAI,CAACK,EACP,CAAC;EAED,OAAOH,YAAY,CAACI,GAAG,CAACC,+BAAsB,CAAC;AACjD,CAAC;AAAA,IAAAC,QAAA,GAEcX,uBAAuB;AAAAY,OAAA,CAAAb,OAAA,GAAAY,QAAA"}
@@ -4,25 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
- var _nativeTypes = _interopRequireDefault(require("../native-types"));
9
-
10
7
  var _deserializeHeartbeatSeriesSample = _interopRequireDefault(require("./deserializeHeartbeatSeriesSample"));
11
-
12
8
  var _prepareOptions = _interopRequireDefault(require("./prepareOptions"));
13
-
9
+ var _nativeTypes = _interopRequireDefault(require("../native-types"));
14
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
-
16
11
  const queryHeartbeatSeriesSamples = async options => {
17
12
  const opts = (0, _prepareOptions.default)(options);
18
- const result = await _nativeTypes.default.queryHeartbeatSeriesSamples(opts.from, opts.to, opts.limit, opts.ascending, opts.anchor);
19
- return {
20
- deletedSamples: result.deletedSamples,
21
- newAnchor: result.newAnchor,
22
- samples: result.samples.map(_deserializeHeartbeatSeriesSample.default)
23
- };
13
+ const result = await _nativeTypes.default.queryHeartbeatSeriesSamples(opts.from, opts.to, opts.limit, opts.ascending);
14
+ return result.map(_deserializeHeartbeatSeriesSample.default);
24
15
  };
25
-
26
16
  var _default = queryHeartbeatSeriesSamples;
27
17
  exports.default = _default;
28
18
  //# sourceMappingURL=queryHeartbeatSeriesSamples.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["queryHeartbeatSeriesSamples","options","opts","prepareOptions","result","Native","from","to","limit","ascending","anchor","deletedSamples","newAnchor","samples","map","deserializeHeartbeatSeriesSample"],"sources":["queryHeartbeatSeriesSamples.ts"],"sourcesContent":["import Native from '../native-types'\nimport deserializeHeartbeatSeriesSample from './deserializeHeartbeatSeriesSample'\nimport prepareOptions from './prepareOptions'\n\nimport type { DeletedHeartbeatSeriesSampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKHeartbeatSeriesSample } from '../types'\n\nexport type QueryHeartbeatSeriesSamplesResponse = {\n readonly samples: readonly HKHeartbeatSeriesSample[],\n readonly deletedSamples: readonly DeletedHeartbeatSeriesSampleRaw[],\n readonly newAnchor: string\n}\n\nexport type QueryHeartbeatSeriesSamplesFn = (options: GenericQueryOptions) => Promise<QueryHeartbeatSeriesSamplesResponse>;\n\nconst queryHeartbeatSeriesSamples: QueryHeartbeatSeriesSamplesFn = async (options) => {\n const opts = prepareOptions(options)\n\n const result = await Native.queryHeartbeatSeriesSamples(\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n opts.anchor,\n )\n\n return {\n deletedSamples: result.deletedSamples,\n newAnchor: result.newAnchor,\n samples: result.samples.map(deserializeHeartbeatSeriesSample),\n }\n}\n\nexport default queryHeartbeatSeriesSamples\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAaA,MAAMA,2BAA0D,GAAG,MAAOC,OAAP,IAAmB;EACpF,MAAMC,IAAI,GAAG,IAAAC,uBAAA,EAAeF,OAAf,CAAb;EAEA,MAAMG,MAAM,GAAG,MAAMC,oBAAA,CAAOL,2BAAP,CACnBE,IAAI,CAACI,IADc,EAEnBJ,IAAI,CAACK,EAFc,EAGnBL,IAAI,CAACM,KAHc,EAInBN,IAAI,CAACO,SAJc,EAKnBP,IAAI,CAACQ,MALc,CAArB;EAQA,OAAO;IACLC,cAAc,EAAEP,MAAM,CAACO,cADlB;IAELC,SAAS,EAAER,MAAM,CAACQ,SAFb;IAGLC,OAAO,EAAET,MAAM,CAACS,OAAP,CAAeC,GAAf,CAAmBC,yCAAnB;EAHJ,CAAP;AAKD,CAhBD;;eAkBef,2B"}
1
+ {"version":3,"names":["_deserializeHeartbeatSeriesSample","_interopRequireDefault","require","_prepareOptions","_nativeTypes","obj","__esModule","default","queryHeartbeatSeriesSamples","options","opts","prepareOptions","result","Native","from","to","limit","ascending","map","deserializeHeartbeatSeriesSample","_default","exports"],"sources":["queryHeartbeatSeriesSamples.ts"],"sourcesContent":["import deserializeHeartbeatSeriesSample from './deserializeHeartbeatSeriesSample'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { DeletedHeartbeatSeriesSampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKHeartbeatSeriesSample } from '../types'\n\nexport type QueryHeartbeatSeriesSamplesResponse = {\n readonly samples: readonly HKHeartbeatSeriesSample[],\n readonly deletedSamples: readonly DeletedHeartbeatSeriesSampleRaw[],\n readonly newAnchor: string\n}\n\nexport type QueryHeartbeatSeriesSamplesFn = (options: Omit<GenericQueryOptions, 'anchor'>) => Promise<readonly HKHeartbeatSeriesSample[]>;\n\nconst queryHeartbeatSeriesSamples: QueryHeartbeatSeriesSamplesFn = async (options) => {\n const opts = prepareOptions(options)\n\n const result = await Native.queryHeartbeatSeriesSamples(\n opts.from,\n opts.to,\n opts.limit,\n opts.ascending,\n )\n\n return result.map(deserializeHeartbeatSeriesSample)\n}\n\nexport default queryHeartbeatSeriesSamples\n"],"mappings":";;;;;;AAAA,IAAAA,iCAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAapC,MAAMG,2BAA0D,GAAG,MAAOC,OAAO,IAAK;EACpF,MAAMC,IAAI,GAAG,IAAAC,uBAAc,EAACF,OAAO,CAAC;EAEpC,MAAMG,MAAM,GAAG,MAAMC,oBAAM,CAACL,2BAA2B,CACrDE,IAAI,CAACI,IAAI,EACTJ,IAAI,CAACK,EAAE,EACPL,IAAI,CAACM,KAAK,EACVN,IAAI,CAACO,SACP,CAAC;EAED,OAAOL,MAAM,CAACM,GAAG,CAACC,yCAAgC,CAAC;AACrD,CAAC;AAAA,IAAAC,QAAA,GAEcZ,2BAA2B;AAAAa,OAAA,CAAAd,OAAA,GAAAa,QAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _deserializeHeartbeatSeriesSample = _interopRequireDefault(require("./deserializeHeartbeatSeriesSample"));
8
+ var _prepareOptions = _interopRequireDefault(require("./prepareOptions"));
9
+ var _nativeTypes = _interopRequireDefault(require("../native-types"));
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ const queryHeartbeatSeriesSamplesWithAnchor = async options => {
12
+ const opts = (0, _prepareOptions.default)(options);
13
+ const result = await _nativeTypes.default.queryHeartbeatSeriesSamplesWithAnchor(opts.from, opts.to, opts.limit, opts.anchor);
14
+ return {
15
+ deletedSamples: result.deletedSamples,
16
+ newAnchor: result.newAnchor,
17
+ samples: result.samples.map(_deserializeHeartbeatSeriesSample.default)
18
+ };
19
+ };
20
+ var _default = queryHeartbeatSeriesSamplesWithAnchor;
21
+ exports.default = _default;
22
+ //# sourceMappingURL=queryHeartbeatSeriesSamplesWithAnchor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_deserializeHeartbeatSeriesSample","_interopRequireDefault","require","_prepareOptions","_nativeTypes","obj","__esModule","default","queryHeartbeatSeriesSamplesWithAnchor","options","opts","prepareOptions","result","Native","from","to","limit","anchor","deletedSamples","newAnchor","samples","map","deserializeHeartbeatSeriesSample","_default","exports"],"sources":["queryHeartbeatSeriesSamplesWithAnchor.ts"],"sourcesContent":["import deserializeHeartbeatSeriesSample from './deserializeHeartbeatSeriesSample'\nimport prepareOptions from './prepareOptions'\nimport Native from '../native-types'\n\nimport type { DeletedHeartbeatSeriesSampleRaw } from '../native-types'\nimport type { GenericQueryOptions, HKHeartbeatSeriesSample } from '../types'\n\nexport type QueryHeartbeatSeriesSamplesResponse = {\n readonly samples: readonly HKHeartbeatSeriesSample[],\n readonly deletedSamples: readonly DeletedHeartbeatSeriesSampleRaw[],\n readonly newAnchor: string\n}\n\nexport type QueryHeartbeatSeriesSamplesFn = (options: Omit<GenericQueryOptions, 'ascending'>) => Promise<QueryHeartbeatSeriesSamplesResponse>;\n\nconst queryHeartbeatSeriesSamplesWithAnchor: QueryHeartbeatSeriesSamplesFn = async (options) => {\n const opts = prepareOptions(options)\n\n const result = await Native.queryHeartbeatSeriesSamplesWithAnchor(\n opts.from,\n opts.to,\n opts.limit,\n opts.anchor,\n )\n\n return {\n deletedSamples: result.deletedSamples,\n newAnchor: result.newAnchor,\n samples: result.samples.map(deserializeHeartbeatSeriesSample),\n }\n}\n\nexport default queryHeartbeatSeriesSamplesWithAnchor\n"],"mappings":";;;;;;AAAA,IAAAA,iCAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,YAAA,GAAAH,sBAAA,CAAAC,OAAA;AAAoC,SAAAD,uBAAAI,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAapC,MAAMG,qCAAoE,GAAG,MAAOC,OAAO,IAAK;EAC9F,MAAMC,IAAI,GAAG,IAAAC,uBAAc,EAACF,OAAO,CAAC;EAEpC,MAAMG,MAAM,GAAG,MAAMC,oBAAM,CAACL,qCAAqC,CAC/DE,IAAI,CAACI,IAAI,EACTJ,IAAI,CAACK,EAAE,EACPL,IAAI,CAACM,KAAK,EACVN,IAAI,CAACO,MACP,CAAC;EAED,OAAO;IACLC,cAAc,EAAEN,MAAM,CAACM,cAAc;IACrCC,SAAS,EAAEP,MAAM,CAACO,SAAS;IAC3BC,OAAO,EAAER,MAAM,CAACQ,OAAO,CAACC,GAAG,CAACC,yCAAgC;EAC9D,CAAC;AACH,CAAC;AAAA,IAAAC,QAAA,GAEcf,qCAAqC;AAAAgB,OAAA,CAAAjB,OAAA,GAAAgB,QAAA"}