@kingstinct/react-native-healthkit 8.7.2 → 9.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 (449) hide show
  1. package/ReactNativeHealthkit.podspec +36 -0
  2. package/app.plugin.js +43 -33
  3. package/ios/Bridge.h +8 -0
  4. package/ios/CategoryTypeModule.swift +128 -0
  5. package/ios/CharacteristicTypeModule.swift +78 -0
  6. package/ios/Constants.swift +2 -0
  7. package/ios/CoreModule.swift +376 -0
  8. package/ios/CorrelationTypeModule.swift +153 -0
  9. package/ios/HeartbeatSeriesModule.swift +189 -0
  10. package/ios/Helpers.swift +529 -251
  11. package/ios/QuantityTypeModule.swift +461 -0
  12. package/ios/Serializers.swift +211 -124
  13. package/ios/SourceProxy.swift +35 -0
  14. package/ios/StateOfMindModule.swift +160 -0
  15. package/ios/WorkoutProxy.swift +405 -0
  16. package/ios/WorkoutSessionModule.swift +182 -0
  17. package/ios/WorkoutsModule.swift +357 -0
  18. package/package.json +43 -127
  19. package/react-native.config.js +16 -0
  20. package/src/hooks/useHealthkitAuthorization.test.ts +47 -29
  21. package/src/hooks/useHealthkitAuthorization.ts +21 -15
  22. package/src/hooks/useIsHealthDataAvailable.test.ts +17 -7
  23. package/src/hooks/useIsHealthDataAvailable.ts +7 -7
  24. package/src/hooks/useMostRecentCategorySample.ts +10 -12
  25. package/src/hooks/useMostRecentQuantitySample.ts +17 -36
  26. package/src/hooks/useMostRecentWorkout.ts +16 -38
  27. package/src/hooks/useSources.ts +8 -12
  28. package/src/hooks/useStatisticsForQuantity.ts +19 -14
  29. package/src/hooks/useSubscribeToChanges.ts +9 -13
  30. package/src/index.ios.ts +232 -0
  31. package/src/index.ts +444 -0
  32. package/src/modules.ts +43 -0
  33. package/src/specs/CategoryTypeModule.nitro.ts +64 -0
  34. package/src/specs/CharacteristicTypeModule.nitro.ts +22 -0
  35. package/src/specs/CoreModule.nitro.ts +107 -0
  36. package/src/specs/CorrelationTypeModule.nitro.ts +23 -0
  37. package/src/specs/HeartbeatSeriesModule.nitro.ts +19 -0
  38. package/src/specs/QuantityTypeModule.nitro.ts +60 -0
  39. package/src/specs/SourceProxy.nitro.ts +13 -0
  40. package/src/specs/StateOfMindModule.nitro.ts +23 -0
  41. package/src/specs/WorkoutProxy.nitro.ts +18 -0
  42. package/src/specs/WorkoutSessionModule.nitro.ts +71 -0
  43. package/src/specs/WorkoutsModule.nitro.ts +32 -0
  44. package/src/test-setup.ts +68 -54
  45. package/src/test-utils.ts +3 -2
  46. package/src/types/Auth.ts +17 -0
  47. package/src/types/Background.ts +9 -0
  48. package/src/types/CategoryType.ts +249 -0
  49. package/src/types/CategoryTypeIdentifier.ts +99 -0
  50. package/src/types/Characteristics.ts +53 -0
  51. package/src/types/Constants.ts +25 -0
  52. package/src/types/CorrelationType.ts +31 -0
  53. package/src/types/Device.ts +13 -0
  54. package/src/types/HeartbeatSeries.ts +29 -0
  55. package/src/types/InterfaceVerification.ts +164 -0
  56. package/src/types/InterfaceVerificationExample.ts +89 -0
  57. package/src/types/QuantitySample.ts +30 -0
  58. package/src/types/QuantityType.ts +192 -0
  59. package/src/types/QuantityTypeIdentifier.ts +758 -0
  60. package/src/types/QueryOptions.ts +69 -0
  61. package/src/types/README-InterfaceVerification.md +103 -0
  62. package/src/types/Shared.ts +79 -0
  63. package/src/types/Source.ts +11 -0
  64. package/src/types/StateOfMind.ts +110 -0
  65. package/src/types/Subscriptons.ts +10 -0
  66. package/src/types/Units.ts +190 -0
  67. package/src/types/WeatherCondition.ts +31 -0
  68. package/src/types/WorkoutKit.ts +18 -0
  69. package/src/types/Workouts.ts +282 -0
  70. package/src/utils/getMostRecentCategorySample.ts +7 -11
  71. package/src/utils/getMostRecentQuantitySample.ts +8 -18
  72. package/src/utils/getMostRecentWorkout.ts +7 -17
  73. package/src/utils/getPreferredUnit.ts +12 -8
  74. package/src/utils/subscribeToChanges.ts +9 -26
  75. package/LICENSE +0 -21
  76. package/README.md +0 -179
  77. package/ios/ReactNativeHealthkit-Bridging-Header.h +0 -2
  78. package/ios/ReactNativeHealthkit.m +0 -271
  79. package/ios/ReactNativeHealthkit.swift +0 -2333
  80. package/ios/ReactNativeHealthkit.xcodeproj/project.pbxproj +0 -279
  81. package/kingstinct-react-native-healthkit.podspec +0 -21
  82. package/lib/commonjs/hooks/useHealthkitAuthorization.js +0 -39
  83. package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +0 -1
  84. package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +0 -72
  85. package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +0 -1
  86. package/lib/commonjs/hooks/useIsHealthDataAvailable.js +0 -27
  87. package/lib/commonjs/hooks/useIsHealthDataAvailable.js.map +0 -1
  88. package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +0 -41
  89. package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +0 -1
  90. package/lib/commonjs/hooks/useMostRecentCategorySample.js +0 -23
  91. package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +0 -1
  92. package/lib/commonjs/hooks/useMostRecentQuantitySample.js +0 -37
  93. package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +0 -1
  94. package/lib/commonjs/hooks/useMostRecentWorkout.js +0 -48
  95. package/lib/commonjs/hooks/useMostRecentWorkout.js.map +0 -1
  96. package/lib/commonjs/hooks/useSources.js +0 -22
  97. package/lib/commonjs/hooks/useSources.js.map +0 -1
  98. package/lib/commonjs/hooks/useStatisticsForQuantity.js +0 -28
  99. package/lib/commonjs/hooks/useStatisticsForQuantity.js.map +0 -1
  100. package/lib/commonjs/hooks/useSubscribeToChanges.js +0 -28
  101. package/lib/commonjs/hooks/useSubscribeToChanges.js.map +0 -1
  102. package/lib/commonjs/index.ios.js +0 -531
  103. package/lib/commonjs/index.ios.js.map +0 -1
  104. package/lib/commonjs/index.js +0 -22
  105. package/lib/commonjs/index.js.map +0 -1
  106. package/lib/commonjs/index.native.js +0 -235
  107. package/lib/commonjs/index.native.js.map +0 -1
  108. package/lib/commonjs/index.web.js +0 -22
  109. package/lib/commonjs/index.web.js.map +0 -1
  110. package/lib/commonjs/native-types.js +0 -1575
  111. package/lib/commonjs/native-types.js.map +0 -1
  112. package/lib/commonjs/test-setup.js +0 -57
  113. package/lib/commonjs/test-setup.js.map +0 -1
  114. package/lib/commonjs/test-utils.js +0 -18
  115. package/lib/commonjs/test-utils.js.map +0 -1
  116. package/lib/commonjs/types.js +0 -17
  117. package/lib/commonjs/types.js.map +0 -1
  118. package/lib/commonjs/utils/deleteQuantitySample.js +0 -11
  119. package/lib/commonjs/utils/deleteQuantitySample.js.map +0 -1
  120. package/lib/commonjs/utils/deleteSamples.js +0 -18
  121. package/lib/commonjs/utils/deleteSamples.js.map +0 -1
  122. package/lib/commonjs/utils/deleteWorkoutSample.js +0 -11
  123. package/lib/commonjs/utils/deleteWorkoutSample.js.map +0 -1
  124. package/lib/commonjs/utils/deserializeCategorySample.js +0 -13
  125. package/lib/commonjs/utils/deserializeCategorySample.js.map +0 -1
  126. package/lib/commonjs/utils/deserializeCategorySample.test.js +0 -26
  127. package/lib/commonjs/utils/deserializeCategorySample.test.js.map +0 -1
  128. package/lib/commonjs/utils/deserializeCorrelation.js +0 -26
  129. package/lib/commonjs/utils/deserializeCorrelation.js.map +0 -1
  130. package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js +0 -15
  131. package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js.map +0 -1
  132. package/lib/commonjs/utils/deserializeSample.js +0 -15
  133. package/lib/commonjs/utils/deserializeSample.js.map +0 -1
  134. package/lib/commonjs/utils/deserializeWorkout.js +0 -15
  135. package/lib/commonjs/utils/deserializeWorkout.js.map +0 -1
  136. package/lib/commonjs/utils/ensureMetadata.js +0 -11
  137. package/lib/commonjs/utils/ensureMetadata.js.map +0 -1
  138. package/lib/commonjs/utils/ensureTotals.js +0 -11
  139. package/lib/commonjs/utils/ensureTotals.js.map +0 -1
  140. package/lib/commonjs/utils/ensureUnit.js +0 -17
  141. package/lib/commonjs/utils/ensureUnit.js.map +0 -1
  142. package/lib/commonjs/utils/getDateOfBirth.js +0 -14
  143. package/lib/commonjs/utils/getDateOfBirth.js.map +0 -1
  144. package/lib/commonjs/utils/getMostRecentCategorySample.js +0 -17
  145. package/lib/commonjs/utils/getMostRecentCategorySample.js.map +0 -1
  146. package/lib/commonjs/utils/getMostRecentQuantitySample.js +0 -21
  147. package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +0 -1
  148. package/lib/commonjs/utils/getMostRecentWorkout.js +0 -19
  149. package/lib/commonjs/utils/getMostRecentWorkout.js.map +0 -1
  150. package/lib/commonjs/utils/getPreferredUnit.js +0 -14
  151. package/lib/commonjs/utils/getPreferredUnit.js.map +0 -1
  152. package/lib/commonjs/utils/getPreferredUnits.js +0 -14
  153. package/lib/commonjs/utils/getPreferredUnits.js.map +0 -1
  154. package/lib/commonjs/utils/getPreferredUnitsTyped.js +0 -33
  155. package/lib/commonjs/utils/getPreferredUnitsTyped.js.map +0 -1
  156. package/lib/commonjs/utils/getRequestStatusForAuthorization.js +0 -21
  157. package/lib/commonjs/utils/getRequestStatusForAuthorization.js.map +0 -1
  158. package/lib/commonjs/utils/getWorkoutPlanById.js +0 -13
  159. package/lib/commonjs/utils/getWorkoutPlanById.js.map +0 -1
  160. package/lib/commonjs/utils/prepareOptions.js +0 -25
  161. package/lib/commonjs/utils/prepareOptions.js.map +0 -1
  162. package/lib/commonjs/utils/queryCategorySamples.js +0 -17
  163. package/lib/commonjs/utils/queryCategorySamples.js.map +0 -1
  164. package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js +0 -21
  165. package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js.map +0 -1
  166. package/lib/commonjs/utils/queryCorrelationSamples.js +0 -17
  167. package/lib/commonjs/utils/queryCorrelationSamples.js.map +0 -1
  168. package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js +0 -17
  169. package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js.map +0 -1
  170. package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js +0 -21
  171. package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +0 -1
  172. package/lib/commonjs/utils/queryQuantitySamples.js +0 -19
  173. package/lib/commonjs/utils/queryQuantitySamples.js.map +0 -1
  174. package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js +0 -23
  175. package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js.map +0 -1
  176. package/lib/commonjs/utils/querySources.js +0 -14
  177. package/lib/commonjs/utils/querySources.js.map +0 -1
  178. package/lib/commonjs/utils/queryStateOfMindSamples.js +0 -22
  179. package/lib/commonjs/utils/queryStateOfMindSamples.js.map +0 -1
  180. package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js +0 -16
  181. package/lib/commonjs/utils/queryStatisticsCollectionForQuantity.js.map +0 -1
  182. package/lib/commonjs/utils/queryStatisticsForQuantity.js +0 -29
  183. package/lib/commonjs/utils/queryStatisticsForQuantity.js.map +0 -1
  184. package/lib/commonjs/utils/queryWorkoutSamplesWithAnchor.js +0 -26
  185. package/lib/commonjs/utils/queryWorkoutSamplesWithAnchor.js.map +0 -1
  186. package/lib/commonjs/utils/queryWorkouts.js +0 -22
  187. package/lib/commonjs/utils/queryWorkouts.js.map +0 -1
  188. package/lib/commonjs/utils/requestAuthorization.js +0 -22
  189. package/lib/commonjs/utils/requestAuthorization.js.map +0 -1
  190. package/lib/commonjs/utils/saveCategorySample.js +0 -20
  191. package/lib/commonjs/utils/saveCategorySample.js.map +0 -1
  192. package/lib/commonjs/utils/saveCorrelationSample.js +0 -35
  193. package/lib/commonjs/utils/saveCorrelationSample.js.map +0 -1
  194. package/lib/commonjs/utils/saveQuantitySample.js +0 -16
  195. package/lib/commonjs/utils/saveQuantitySample.js.map +0 -1
  196. package/lib/commonjs/utils/saveStateOfMindSample.js +0 -17
  197. package/lib/commonjs/utils/saveStateOfMindSample.js.map +0 -1
  198. package/lib/commonjs/utils/saveWorkoutRoute.js +0 -26
  199. package/lib/commonjs/utils/saveWorkoutRoute.js.map +0 -1
  200. package/lib/commonjs/utils/saveWorkoutSample.js +0 -36
  201. package/lib/commonjs/utils/saveWorkoutSample.js.map +0 -1
  202. package/lib/commonjs/utils/serializeDate.js +0 -9
  203. package/lib/commonjs/utils/serializeDate.js.map +0 -1
  204. package/lib/commonjs/utils/serializeDate.test.js +0 -17
  205. package/lib/commonjs/utils/serializeDate.test.js.map +0 -1
  206. package/lib/commonjs/utils/startWatchApp.js +0 -11
  207. package/lib/commonjs/utils/startWatchApp.js.map +0 -1
  208. package/lib/commonjs/utils/subscribeToChanges.js +0 -27
  209. package/lib/commonjs/utils/subscribeToChanges.js.map +0 -1
  210. package/lib/module/hooks/useHealthkitAuthorization.js +0 -32
  211. package/lib/module/hooks/useHealthkitAuthorization.js.map +0 -1
  212. package/lib/module/hooks/useHealthkitAuthorization.test.js +0 -68
  213. package/lib/module/hooks/useHealthkitAuthorization.test.js.map +0 -1
  214. package/lib/module/hooks/useIsHealthDataAvailable.js +0 -21
  215. package/lib/module/hooks/useIsHealthDataAvailable.js.map +0 -1
  216. package/lib/module/hooks/useIsHealthDataAvailable.test.js +0 -37
  217. package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +0 -1
  218. package/lib/module/hooks/useMostRecentCategorySample.js +0 -16
  219. package/lib/module/hooks/useMostRecentCategorySample.js.map +0 -1
  220. package/lib/module/hooks/useMostRecentQuantitySample.js +0 -30
  221. package/lib/module/hooks/useMostRecentQuantitySample.js.map +0 -1
  222. package/lib/module/hooks/useMostRecentWorkout.js +0 -41
  223. package/lib/module/hooks/useMostRecentWorkout.js.map +0 -1
  224. package/lib/module/hooks/useSources.js +0 -15
  225. package/lib/module/hooks/useSources.js.map +0 -1
  226. package/lib/module/hooks/useStatisticsForQuantity.js +0 -21
  227. package/lib/module/hooks/useStatisticsForQuantity.js.map +0 -1
  228. package/lib/module/hooks/useSubscribeToChanges.js +0 -21
  229. package/lib/module/hooks/useSubscribeToChanges.js.map +0 -1
  230. package/lib/module/index.ios.js +0 -209
  231. package/lib/module/index.ios.js.map +0 -1
  232. package/lib/module/index.js +0 -4
  233. package/lib/module/index.js.map +0 -1
  234. package/lib/module/index.native.js +0 -160
  235. package/lib/module/index.native.js.map +0 -1
  236. package/lib/module/index.web.js +0 -4
  237. package/lib/module/index.web.js.map +0 -1
  238. package/lib/module/native-types.js +0 -1606
  239. package/lib/module/native-types.js.map +0 -1
  240. package/lib/module/test-setup.js +0 -54
  241. package/lib/module/test-setup.js.map +0 -1
  242. package/lib/module/test-utils.js +0 -11
  243. package/lib/module/test-utils.js.map +0 -1
  244. package/lib/module/types.js +0 -67
  245. package/lib/module/types.js.map +0 -1
  246. package/lib/module/utils/deleteQuantitySample.js +0 -4
  247. package/lib/module/utils/deleteQuantitySample.js.map +0 -1
  248. package/lib/module/utils/deleteSamples.js +0 -11
  249. package/lib/module/utils/deleteSamples.js.map +0 -1
  250. package/lib/module/utils/deleteWorkoutSample.js +0 -4
  251. package/lib/module/utils/deleteWorkoutSample.js.map +0 -1
  252. package/lib/module/utils/deserializeCategorySample.js +0 -7
  253. package/lib/module/utils/deserializeCategorySample.js.map +0 -1
  254. package/lib/module/utils/deserializeCategorySample.test.js +0 -22
  255. package/lib/module/utils/deserializeCategorySample.test.js.map +0 -1
  256. package/lib/module/utils/deserializeCorrelation.js +0 -19
  257. package/lib/module/utils/deserializeCorrelation.js.map +0 -1
  258. package/lib/module/utils/deserializeHeartbeatSeriesSample.js +0 -9
  259. package/lib/module/utils/deserializeHeartbeatSeriesSample.js.map +0 -1
  260. package/lib/module/utils/deserializeSample.js +0 -9
  261. package/lib/module/utils/deserializeSample.js.map +0 -1
  262. package/lib/module/utils/deserializeWorkout.js +0 -9
  263. package/lib/module/utils/deserializeWorkout.js.map +0 -1
  264. package/lib/module/utils/ensureMetadata.js +0 -5
  265. package/lib/module/utils/ensureMetadata.js.map +0 -1
  266. package/lib/module/utils/ensureTotals.js +0 -5
  267. package/lib/module/utils/ensureTotals.js.map +0 -1
  268. package/lib/module/utils/ensureUnit.js +0 -10
  269. package/lib/module/utils/ensureUnit.js.map +0 -1
  270. package/lib/module/utils/getDateOfBirth.js +0 -7
  271. package/lib/module/utils/getDateOfBirth.js.map +0 -1
  272. package/lib/module/utils/getMostRecentCategorySample.js +0 -10
  273. package/lib/module/utils/getMostRecentCategorySample.js.map +0 -1
  274. package/lib/module/utils/getMostRecentQuantitySample.js +0 -14
  275. package/lib/module/utils/getMostRecentQuantitySample.js.map +0 -1
  276. package/lib/module/utils/getMostRecentWorkout.js +0 -12
  277. package/lib/module/utils/getMostRecentWorkout.js.map +0 -1
  278. package/lib/module/utils/getPreferredUnit.js +0 -7
  279. package/lib/module/utils/getPreferredUnit.js.map +0 -1
  280. package/lib/module/utils/getPreferredUnits.js +0 -7
  281. package/lib/module/utils/getPreferredUnits.js.map +0 -1
  282. package/lib/module/utils/getPreferredUnitsTyped.js +0 -26
  283. package/lib/module/utils/getPreferredUnitsTyped.js.map +0 -1
  284. package/lib/module/utils/getRequestStatusForAuthorization.js +0 -14
  285. package/lib/module/utils/getRequestStatusForAuthorization.js.map +0 -1
  286. package/lib/module/utils/getWorkoutPlanById.js +0 -6
  287. package/lib/module/utils/getWorkoutPlanById.js.map +0 -1
  288. package/lib/module/utils/prepareOptions.js +0 -18
  289. package/lib/module/utils/prepareOptions.js.map +0 -1
  290. package/lib/module/utils/queryCategorySamples.js +0 -10
  291. package/lib/module/utils/queryCategorySamples.js.map +0 -1
  292. package/lib/module/utils/queryCategorySamplesWithAnchor.js +0 -14
  293. package/lib/module/utils/queryCategorySamplesWithAnchor.js.map +0 -1
  294. package/lib/module/utils/queryCorrelationSamples.js +0 -10
  295. package/lib/module/utils/queryCorrelationSamples.js.map +0 -1
  296. package/lib/module/utils/queryHeartbeatSeriesSamples.js +0 -10
  297. package/lib/module/utils/queryHeartbeatSeriesSamples.js.map +0 -1
  298. package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js +0 -14
  299. package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +0 -1
  300. package/lib/module/utils/queryQuantitySamples.js +0 -12
  301. package/lib/module/utils/queryQuantitySamples.js.map +0 -1
  302. package/lib/module/utils/queryQuantitySamplesWithAnchor.js +0 -16
  303. package/lib/module/utils/queryQuantitySamplesWithAnchor.js.map +0 -1
  304. package/lib/module/utils/querySources.js +0 -7
  305. package/lib/module/utils/querySources.js.map +0 -1
  306. package/lib/module/utils/queryStateOfMindSamples.js +0 -14
  307. package/lib/module/utils/queryStateOfMindSamples.js.map +0 -1
  308. package/lib/module/utils/queryStatisticsCollectionForQuantity.js +0 -9
  309. package/lib/module/utils/queryStatisticsCollectionForQuantity.js.map +0 -1
  310. package/lib/module/utils/queryStatisticsForQuantity.js +0 -22
  311. package/lib/module/utils/queryStatisticsForQuantity.js.map +0 -1
  312. package/lib/module/utils/queryWorkoutSamplesWithAnchor.js +0 -19
  313. package/lib/module/utils/queryWorkoutSamplesWithAnchor.js.map +0 -1
  314. package/lib/module/utils/queryWorkouts.js +0 -15
  315. package/lib/module/utils/queryWorkouts.js.map +0 -1
  316. package/lib/module/utils/requestAuthorization.js +0 -15
  317. package/lib/module/utils/requestAuthorization.js.map +0 -1
  318. package/lib/module/utils/saveCategorySample.js +0 -13
  319. package/lib/module/utils/saveCategorySample.js.map +0 -1
  320. package/lib/module/utils/saveCorrelationSample.js +0 -28
  321. package/lib/module/utils/saveCorrelationSample.js.map +0 -1
  322. package/lib/module/utils/saveQuantitySample.js +0 -9
  323. package/lib/module/utils/saveQuantitySample.js.map +0 -1
  324. package/lib/module/utils/saveStateOfMindSample.js +0 -10
  325. package/lib/module/utils/saveStateOfMindSample.js.map +0 -1
  326. package/lib/module/utils/saveWorkoutRoute.js +0 -19
  327. package/lib/module/utils/saveWorkoutRoute.js.map +0 -1
  328. package/lib/module/utils/saveWorkoutSample.js +0 -29
  329. package/lib/module/utils/saveWorkoutSample.js.map +0 -1
  330. package/lib/module/utils/serializeDate.js +0 -3
  331. package/lib/module/utils/serializeDate.js.map +0 -1
  332. package/lib/module/utils/serializeDate.test.js +0 -14
  333. package/lib/module/utils/serializeDate.test.js.map +0 -1
  334. package/lib/module/utils/startWatchApp.js +0 -4
  335. package/lib/module/utils/startWatchApp.js.map +0 -1
  336. package/lib/module/utils/subscribeToChanges.js +0 -20
  337. package/lib/module/utils/subscribeToChanges.js.map +0 -1
  338. package/lib/typescript/example-expo/App.d.ts +0 -2
  339. package/lib/typescript/src/hooks/useHealthkitAuthorization.d.ts +0 -8
  340. package/lib/typescript/src/hooks/useHealthkitAuthorization.test.d.ts +0 -1
  341. package/lib/typescript/src/hooks/useIsHealthDataAvailable.d.ts +0 -7
  342. package/lib/typescript/src/hooks/useIsHealthDataAvailable.test.d.ts +0 -1
  343. package/lib/typescript/src/hooks/useMostRecentCategorySample.d.ts +0 -7
  344. package/lib/typescript/src/hooks/useMostRecentQuantitySample.d.ts +0 -7
  345. package/lib/typescript/src/hooks/useMostRecentWorkout.d.ts +0 -10
  346. package/lib/typescript/src/hooks/useSources.d.ts +0 -3
  347. package/lib/typescript/src/hooks/useStatisticsForQuantity.d.ts +0 -4
  348. package/lib/typescript/src/hooks/useSubscribeToChanges.d.ts +0 -3
  349. package/lib/typescript/src/index.d.ts +0 -3
  350. package/lib/typescript/src/index.ios.d.ts +0 -198
  351. package/lib/typescript/src/index.native.d.ts +0 -41
  352. package/lib/typescript/src/index.web.d.ts +0 -3
  353. package/lib/typescript/src/native-types.d.ts +0 -1764
  354. package/lib/typescript/src/test-setup.d.ts +0 -1
  355. package/lib/typescript/src/test-utils.d.ts +0 -2
  356. package/lib/typescript/src/types.d.ts +0 -111
  357. package/lib/typescript/src/utils/deleteQuantitySample.d.ts +0 -4
  358. package/lib/typescript/src/utils/deleteSamples.d.ts +0 -8
  359. package/lib/typescript/src/utils/deleteWorkoutSample.d.ts +0 -3
  360. package/lib/typescript/src/utils/deserializeCategorySample.d.ts +0 -4
  361. package/lib/typescript/src/utils/deserializeCategorySample.test.d.ts +0 -1
  362. package/lib/typescript/src/utils/deserializeCorrelation.d.ts +0 -4
  363. package/lib/typescript/src/utils/deserializeHeartbeatSeriesSample.d.ts +0 -4
  364. package/lib/typescript/src/utils/deserializeSample.d.ts +0 -4
  365. package/lib/typescript/src/utils/deserializeWorkout.d.ts +0 -4
  366. package/lib/typescript/src/utils/ensureMetadata.d.ts +0 -2
  367. package/lib/typescript/src/utils/ensureTotals.d.ts +0 -2
  368. package/lib/typescript/src/utils/ensureUnit.d.ts +0 -3
  369. package/lib/typescript/src/utils/getDateOfBirth.d.ts +0 -2
  370. package/lib/typescript/src/utils/getMostRecentCategorySample.d.ts +0 -4
  371. package/lib/typescript/src/utils/getMostRecentQuantitySample.d.ts +0 -4
  372. package/lib/typescript/src/utils/getMostRecentWorkout.d.ts +0 -5
  373. package/lib/typescript/src/utils/getPreferredUnit.d.ts +0 -4
  374. package/lib/typescript/src/utils/getPreferredUnits.d.ts +0 -4
  375. package/lib/typescript/src/utils/getPreferredUnitsTyped.d.ts +0 -9
  376. package/lib/typescript/src/utils/getRequestStatusForAuthorization.d.ts +0 -3
  377. package/lib/typescript/src/utils/getWorkoutPlanById.d.ts +0 -5
  378. package/lib/typescript/src/utils/prepareOptions.d.ts +0 -9
  379. package/lib/typescript/src/utils/queryCategorySamples.d.ts +0 -5
  380. package/lib/typescript/src/utils/queryCategorySamplesWithAnchor.d.ts +0 -10
  381. package/lib/typescript/src/utils/queryCorrelationSamples.d.ts +0 -5
  382. package/lib/typescript/src/utils/queryHeartbeatSeriesSamples.d.ts +0 -10
  383. package/lib/typescript/src/utils/queryHeartbeatSeriesSamplesWithAnchor.d.ts +0 -10
  384. package/lib/typescript/src/utils/queryQuantitySamples.d.ts +0 -7
  385. package/lib/typescript/src/utils/queryQuantitySamplesWithAnchor.d.ts +0 -12
  386. package/lib/typescript/src/utils/querySources.d.ts +0 -4
  387. package/lib/typescript/src/utils/queryStateOfMindSamples.d.ts +0 -7
  388. package/lib/typescript/src/utils/queryStatisticsCollectionForQuantity.d.ts +0 -3
  389. package/lib/typescript/src/utils/queryStatisticsForQuantity.d.ts +0 -14
  390. package/lib/typescript/src/utils/queryWorkoutSamplesWithAnchor.d.ts +0 -9
  391. package/lib/typescript/src/utils/queryWorkouts.d.ts +0 -4
  392. package/lib/typescript/src/utils/requestAuthorization.d.ts +0 -4
  393. package/lib/typescript/src/utils/saveCategorySample.d.ts +0 -11
  394. package/lib/typescript/src/utils/saveCorrelationSample.d.ts +0 -8
  395. package/lib/typescript/src/utils/saveQuantitySample.d.ts +0 -7
  396. package/lib/typescript/src/utils/saveStateOfMindSample.d.ts +0 -11
  397. package/lib/typescript/src/utils/saveWorkoutRoute.d.ts +0 -3
  398. package/lib/typescript/src/utils/saveWorkoutSample.d.ts +0 -11
  399. package/lib/typescript/src/utils/serializeDate.d.ts +0 -2
  400. package/lib/typescript/src/utils/serializeDate.test.d.ts +0 -1
  401. package/lib/typescript/src/utils/startWatchApp.d.ts +0 -3
  402. package/lib/typescript/src/utils/subscribeToChanges.d.ts +0 -3
  403. package/src/index.ios.tsx +0 -292
  404. package/src/index.native.tsx +0 -233
  405. package/src/index.tsx +0 -5
  406. package/src/index.web.tsx +0 -5
  407. package/src/native-types.ts +0 -2471
  408. package/src/types.ts +0 -156
  409. package/src/utils/deleteQuantitySample.ts +0 -14
  410. package/src/utils/deleteSamples.ts +0 -23
  411. package/src/utils/deleteWorkoutSample.ts +0 -7
  412. package/src/utils/deserializeCategorySample.test.ts +0 -24
  413. package/src/utils/deserializeCategorySample.ts +0 -12
  414. package/src/utils/deserializeCorrelation.ts +0 -28
  415. package/src/utils/deserializeHeartbeatSeriesSample.ts +0 -12
  416. package/src/utils/deserializeSample.ts +0 -17
  417. package/src/utils/deserializeWorkout.ts +0 -14
  418. package/src/utils/ensureMetadata.ts +0 -5
  419. package/src/utils/ensureTotals.ts +0 -5
  420. package/src/utils/ensureUnit.ts +0 -19
  421. package/src/utils/getDateOfBirth.ts +0 -8
  422. package/src/utils/getPreferredUnits.ts +0 -14
  423. package/src/utils/getPreferredUnitsTyped.ts +0 -38
  424. package/src/utils/getRequestStatusForAuthorization.ts +0 -21
  425. package/src/utils/getWorkoutPlanById.ts +0 -7
  426. package/src/utils/prepareOptions.ts +0 -19
  427. package/src/utils/queryCategorySamples.ts +0 -29
  428. package/src/utils/queryCategorySamplesWithAnchor.ts +0 -39
  429. package/src/utils/queryCorrelationSamples.ts +0 -29
  430. package/src/utils/queryHeartbeatSeriesSamples.ts +0 -29
  431. package/src/utils/queryHeartbeatSeriesSamplesWithAnchor.ts +0 -33
  432. package/src/utils/queryQuantitySamples.ts +0 -38
  433. package/src/utils/queryQuantitySamplesWithAnchor.ts +0 -46
  434. package/src/utils/querySources.ts +0 -21
  435. package/src/utils/queryStateOfMindSamples.ts +0 -14
  436. package/src/utils/queryStatisticsCollectionForQuantity.ts +0 -38
  437. package/src/utils/queryStatisticsForQuantity.ts +0 -38
  438. package/src/utils/queryWorkoutSamplesWithAnchor.ts +0 -46
  439. package/src/utils/queryWorkouts.ts +0 -28
  440. package/src/utils/requestAuthorization.ts +0 -19
  441. package/src/utils/saveCategorySample.ts +0 -31
  442. package/src/utils/saveCorrelationSample.ts +0 -43
  443. package/src/utils/saveQuantitySample.ts +0 -29
  444. package/src/utils/saveStateOfMindSample.ts +0 -38
  445. package/src/utils/saveWorkoutRoute.ts +0 -21
  446. package/src/utils/saveWorkoutSample.ts +0 -42
  447. package/src/utils/serializeDate.test.ts +0 -16
  448. package/src/utils/serializeDate.ts +0 -5
  449. package/src/utils/startWatchApp.ts +0 -7
@@ -0,0 +1,69 @@
1
+ import type { WorkoutProxy } from '../specs/WorkoutProxy.nitro'
2
+
3
+ type PredicateWithUUID = {
4
+ readonly uuid: string
5
+ }
6
+
7
+ type PredicateWithUUIDs = {
8
+ readonly uuids: readonly string[]
9
+ }
10
+
11
+ type PredicateWithStartAndEnd = {
12
+ readonly startDate?: Date
13
+ readonly endDate?: Date
14
+ readonly strictEndDate?: boolean
15
+ readonly strictStartDate?: boolean
16
+ }
17
+
18
+ type PredicateWithMetadataKey = {
19
+ readonly withMetadataKey: string
20
+ }
21
+
22
+ export type FilterForSamplesAnd = {
23
+ AND: PredicateForSamples[]
24
+ }
25
+
26
+ export type FilterForSamplesOr = {
27
+ OR: PredicateForSamples[]
28
+ }
29
+
30
+ export type PredicateFromWorkout = {
31
+ workout: WorkoutProxy
32
+ }
33
+
34
+ export type FilterForSamples =
35
+ | PredicateForSamples
36
+ | FilterForSamplesAnd
37
+ | FilterForSamplesOr
38
+
39
+ export type PredicateForSamples =
40
+ | PredicateWithUUID
41
+ | PredicateWithUUIDs
42
+ | PredicateWithMetadataKey
43
+ | PredicateWithStartAndEnd
44
+ | PredicateFromWorkout
45
+
46
+ /**
47
+ * Generic options for querying.
48
+ */
49
+ export interface GenericQueryOptions {
50
+ filter?: FilterForSamples
51
+ readonly limit?: number
52
+ }
53
+
54
+ export interface QueryOptionsWithAnchor extends GenericQueryOptions {
55
+ readonly anchor?: string
56
+ }
57
+
58
+ export interface QueryOptionsWithSortOrder extends GenericQueryOptions {
59
+ readonly ascending?: boolean
60
+ }
61
+
62
+ export interface QueryOptionsWithSortOrderAndUnit
63
+ extends QueryOptionsWithSortOrder {
64
+ readonly unit?: string
65
+ }
66
+
67
+ export interface QueryOptionsWithAnchorAndUnit extends QueryOptionsWithAnchor {
68
+ readonly unit?: string
69
+ }
@@ -0,0 +1,103 @@
1
+ # Interface Verification Utility
2
+
3
+ A TypeScript utility for ensuring that typed and untyped versions of interfaces stay in sync during development.
4
+
5
+ ## Overview
6
+
7
+ When working with libraries like `react-native-nitro-modules`, you often have two versions of an interface:
8
+ 1. A base interface that extends `HybridObject` (for the native bridge)
9
+ 2. A typed interface with generics for better type safety
10
+
11
+ This utility ensures both interfaces have the same method names and parameter counts, catching mismatches at compile-time.
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import type { InterfaceAssertion } from "../types/InterfaceVerification";
17
+
18
+ // Base interface
19
+ export interface MyModule extends HybridObject<{ ios: "swift" }> {
20
+ getData(id: string): Promise<string>;
21
+ saveData(id: string, data: string): Promise<boolean>;
22
+ }
23
+
24
+ // Typed interface
25
+ export interface MyModuleTyped {
26
+ getData<T extends string>(id: T): Promise<string>;
27
+ saveData<T extends string>(id: T, data: string): Promise<boolean>;
28
+ }
29
+
30
+ // Verification - will cause TypeScript error if interfaces don't match
31
+ const _verification: InterfaceAssertion<MyModule, MyModuleTyped, keyof HybridObject> = true;
32
+ ```
33
+
34
+ ## Features
35
+
36
+ - ✅ **Method name verification** - Ensures both interfaces have the same methods
37
+ - ✅ **Parameter count verification** - Ensures corresponding methods have the same number of parameters
38
+ - ✅ **Descriptive error messages** - Shows exactly what's missing or mismatched
39
+ - ✅ **Zero runtime cost** - Pure TypeScript types with no JavaScript output
40
+ - ✅ **Compile-time checking** - Catches issues during development, not runtime
41
+
42
+ ## Error Types
43
+
44
+ ### Interface Mismatch
45
+ When method names don't match between interfaces:
46
+
47
+ ```typescript
48
+ // Error: Interface mismatch detected
49
+ // MissingInBase: "newMethod"
50
+ // MissingInTyped: never
51
+ ```
52
+
53
+ ### Parameter Count Mismatch
54
+ When corresponding methods have different parameter counts:
55
+
56
+ ```typescript
57
+ // Error: Parameter count mismatch detected
58
+ // MethodsWithParameterCountMismatch: "getData"
59
+ ```
60
+
61
+ ## API Reference
62
+
63
+ ### `InterfaceAssertion<BaseInterface, TypedInterface, ExcludeFromBase>`
64
+
65
+ Main utility type for interface verification.
66
+
67
+ **Parameters:**
68
+ - `BaseInterface` - The base interface (usually extending HybridObject)
69
+ - `TypedInterface` - The typed interface with generics
70
+ - `ExcludeFromBase` - Keys to exclude from the base interface (e.g., `keyof HybridObject`)
71
+
72
+ **Returns:**
73
+ - `true` if interfaces match
74
+ - Error object with descriptive message if they don't match
75
+
76
+ ### Other Utility Types
77
+
78
+ - `ExtractMethodNames<T, ExcludeKeys>` - Extracts method names from an interface
79
+ - `GetParameterCount<T>` - Gets parameter count of a function type
80
+ - `CheckMethodNames<BaseInterface, TypedInterface, ExcludeFromBase>` - Detailed method name comparison
81
+ - `CheckParameterCounts<BaseInterface, TypedInterface, ExcludeFromBase>` - Detailed parameter count comparison
82
+
83
+ ## Usage in Your Project
84
+
85
+ 1. Copy `InterfaceVerification.ts` to your project
86
+ 2. Import `InterfaceAssertion` in your module files
87
+ 3. Add verification lines after your interface definitions
88
+ 4. TypeScript will show errors if interfaces don't match
89
+
90
+ ## Best Practices
91
+
92
+ 1. **Always exclude inherited keys** - Use `keyof HybridObject` or similar to exclude inherited methods
93
+ 2. **Add verification immediately** - Add the verification line right after defining both interfaces
94
+ 3. **Use descriptive naming** - Name your verification constants with `_verification` or similar
95
+ 4. **Keep interfaces close** - Define both interfaces in the same file when possible
96
+
97
+ ## Examples
98
+
99
+ See `InterfaceVerificationExample.ts` for complete examples including:
100
+ - Basic interfaces
101
+ - Interfaces with optional parameters
102
+ - What happens when interfaces don't match
103
+ - Real-world usage patterns
@@ -0,0 +1,79 @@
1
+ import type {
2
+ CategoryTypeIdentifier,
3
+ CategoryTypeIdentifierWriteable,
4
+ } from './CategoryTypeIdentifier'
5
+ import type {
6
+ QuantityTypeIdentifier,
7
+ QuantityTypeIdentifierWriteable,
8
+ } from './QuantityTypeIdentifier'
9
+
10
+ import type {
11
+ HeartbeatSeriesTypeIdentifier,
12
+ StateOfMindTypeIdentifier,
13
+ WorkoutRouteTypeIdentifier,
14
+ WorkoutTypeIdentifier,
15
+ } from './Constants'
16
+
17
+ import type { AnyMap } from 'react-native-nitro-modules'
18
+ import type { CharacteristicTypeIdentifier } from './Characteristics'
19
+ import type { CorrelationTypeIdentifier } from './CorrelationType'
20
+
21
+ export interface GenericMetadata {
22
+ readonly HKExternalUUID?: string
23
+ readonly HKTimeZone?: string
24
+ readonly HKWasUserEntered?: boolean
25
+ readonly HKDeviceSerialNumber?: string
26
+ readonly HKUDIDeviceIdentifier?: string
27
+ readonly HKUDIProductionIdentifier?: string
28
+ readonly HKDigitalSignature?: string
29
+ readonly HKDeviceName?: string
30
+ readonly HKDeviceManufacturerName?: string
31
+ readonly HKSyncIdentifier?: string
32
+ readonly HKSyncVersion?: number
33
+ readonly HKWasTakenInLab?: boolean
34
+ readonly HKReferenceRangeLowerLimit?: number
35
+ readonly HKReferenceRangeUpperLimit?: number
36
+ }
37
+
38
+ export interface DeletedSample {
39
+ readonly uuid: string
40
+ readonly metadata?: AnyMap
41
+ }
42
+
43
+ export type ObjectTypeIdentifier =
44
+ | CharacteristicTypeIdentifier
45
+ | SampleTypeIdentifier
46
+ | typeof ActivitySummaryTypeIdentifier
47
+
48
+ export type SampleTypeIdentifier =
49
+ | CategoryTypeIdentifier
50
+ | CorrelationTypeIdentifier
51
+ | QuantityTypeIdentifier
52
+ | typeof StateOfMindTypeIdentifier
53
+ | typeof AudiogramTypeIdentifier
54
+ | typeof HeartbeatSeriesTypeIdentifier
55
+ | typeof WorkoutRouteTypeIdentifier
56
+ | typeof WorkoutTypeIdentifier
57
+
58
+ export type SampleTypeIdentifierWriteable =
59
+ | CategoryTypeIdentifierWriteable
60
+ | CorrelationTypeIdentifier
61
+ | QuantityTypeIdentifierWriteable
62
+ | typeof StateOfMindTypeIdentifier
63
+ | typeof AudiogramTypeIdentifier
64
+ | typeof HeartbeatSeriesTypeIdentifier
65
+ | typeof WorkoutRouteTypeIdentifier
66
+ | typeof WorkoutTypeIdentifier
67
+
68
+ /**
69
+ * Represents a type that identifies activity summary objects.
70
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkactivitysummarytype Apple Docs HKActivitySummaryType}
71
+ */
72
+ export const ActivitySummaryTypeIdentifier =
73
+ 'ActivitySummaryTypeIdentifier' as const
74
+
75
+ /**
76
+ * Represents an audiogram type identifier.
77
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKAudiogramSampleType Apple Docs HKAudiogramSampleType}
78
+ */
79
+ export const AudiogramTypeIdentifier = 'HKAudiogramSampleType' as const
@@ -0,0 +1,11 @@
1
+ import type { SourceProxy } from '../specs/SourceProxy.nitro'
2
+
3
+ /**
4
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkobject/1615483-sourcerevision Apple Docs }
5
+ */
6
+ export interface SourceRevision {
7
+ readonly source?: SourceProxy
8
+ readonly version?: string
9
+ readonly operatingSystemVersion?: string | null
10
+ readonly productType?: string | null
11
+ }
@@ -0,0 +1,110 @@
1
+ import type { AnyMap } from 'react-native-nitro-modules'
2
+ import type { Device } from './Device'
3
+ import type { SourceRevision } from './Source'
4
+
5
+ export enum StateOfMindValenceClassification {
6
+ veryUnpleasant = 1,
7
+ unpleasant = 2,
8
+ slightlyUnpleasant = 3,
9
+ neutral = 4,
10
+ slightlyPleasant = 5,
11
+ pleasant = 6,
12
+ veryPleasant = 7,
13
+ }
14
+
15
+ export interface StateOfMindSample {
16
+ readonly uuid: string
17
+ readonly device?: Device
18
+ readonly startDate: Date
19
+ readonly endDate: Date
20
+ readonly metadata?: AnyMap
21
+ readonly sourceRevision?: SourceRevision
22
+ // State of mind sample properties
23
+ /**
24
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/4337998-valence Apple Docs }
25
+ * Value between -1 and 1
26
+ */
27
+ readonly valence: number
28
+ readonly kind: StateOfMindKind
29
+ readonly valenceClassification: StateOfMindValenceClassification
30
+ readonly associations: readonly StateOfMindAssociation[]
31
+ readonly labels: readonly StateOfMindLabel[]
32
+ }
33
+
34
+ /**
35
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/label Apple Docs}
36
+ */
37
+ export enum StateOfMindLabel {
38
+ amazed = 1,
39
+ amused = 2,
40
+ angry = 3,
41
+ anxious = 4,
42
+ ashamed = 5,
43
+ brave = 6,
44
+ calm = 7,
45
+ content = 8,
46
+ disappointed = 9,
47
+ discouraged = 10,
48
+ disgusted = 11,
49
+ embarrassed = 12,
50
+ excited = 13,
51
+ frustrated = 14,
52
+ grateful = 15,
53
+ guilty = 16,
54
+ happy = 17,
55
+ hopeless = 18,
56
+ irritated = 19,
57
+ jealous = 20,
58
+ joyful = 21,
59
+ lonely = 22,
60
+ passionate = 23,
61
+ peaceful = 24,
62
+ proud = 25,
63
+ relieved = 26,
64
+ sad = 27,
65
+ scared = 28,
66
+ stressed = 29,
67
+ surprised = 30,
68
+ worried = 31,
69
+
70
+ annoyed = 32,
71
+ confident = 33,
72
+ drained = 34,
73
+ hopeful = 35,
74
+ indifferent = 36,
75
+ overwhelmed = 37,
76
+ satisfied = 38,
77
+ }
78
+
79
+ /**
80
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/kind Apple Docs}
81
+ */
82
+ export enum StateOfMindKind {
83
+ dailyMood = 2,
84
+ momentaryEmotion = 1,
85
+ }
86
+
87
+ /**
88
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkstateofmind/association Apple Docs}
89
+ * @since iOS 17.0+
90
+ */
91
+ export enum StateOfMindAssociation {
92
+ community = 1,
93
+ currentEvents = 2,
94
+ dating = 3,
95
+ education = 4,
96
+ family = 5,
97
+ fitness = 6,
98
+ friends = 7,
99
+ health = 8,
100
+ hobbies = 9,
101
+ identity = 10,
102
+ money = 11,
103
+ partner = 12,
104
+ selfCare = 13,
105
+ spirituality = 14,
106
+ tasks = 15,
107
+ travel = 16,
108
+ work = 17,
109
+ weather = 18,
110
+ }
@@ -0,0 +1,10 @@
1
+ import type { SampleTypeIdentifier } from './Shared'
2
+
3
+ export interface EmitterSubscription {
4
+ remove: () => void
5
+ }
6
+
7
+ export interface OnChangeCallbackArgs {
8
+ readonly typeIdentifier: SampleTypeIdentifier
9
+ readonly errorMessage?: string
10
+ }
@@ -0,0 +1,190 @@
1
+ // Unit types are a straight mapping from here https://developer.apple.com/documentation/healthkit/hkunit/1615733-init
2
+ export type MetricPrefix =
3
+ | ''
4
+ | 'p'
5
+ | 'n'
6
+ | 'mc'
7
+ | 'm'
8
+ | 'c'
9
+ | 'd'
10
+ | 'da'
11
+ | 'h'
12
+ | 'k'
13
+ | 'M'
14
+ | 'G'
15
+ | 'T'
16
+ | 'f'
17
+
18
+ export type UnitMetric =
19
+ | 'g'
20
+ | 'J'
21
+ | 'K'
22
+ | 'l'
23
+ | 'm'
24
+ | 'Pa'
25
+ | 's'
26
+ | 'S'
27
+ | 'Hz'
28
+ | 'V'
29
+
30
+ export type Units =
31
+ | 'dBHL'
32
+ | 'dBASPL'
33
+ | '%'
34
+ | 'count'
35
+ | 'IU'
36
+ | 'appleEffortScore'
37
+
38
+ export type MeterUnit<Prefix extends MetricPrefix> = `${Prefix}m`
39
+ export type LiterUnit<Prefix extends MetricPrefix> = `${Prefix}l`
40
+ export type GramUnit<Prefix extends MetricPrefix> = `${Prefix}g`
41
+ export type PascalUnit<Prefix extends MetricPrefix> = `${Prefix}Pa`
42
+ export type SecondUnit<Prefix extends MetricPrefix> = `${Prefix}s`
43
+ export type JouleUnit<Prefix extends MetricPrefix> = `${Prefix}J`
44
+ export type HertzUnit<Prefix extends MetricPrefix> = `${Prefix}Hz`
45
+ export type VoltUnit<Prefix extends MetricPrefix> = `${Prefix}V`
46
+ export type SiemenUnit<Prefix extends MetricPrefix> = `${Prefix}S`
47
+
48
+ // not 100% sure about these
49
+ export type MoleUnit<MolarMass extends number> = `mol<${MolarMass}>`
50
+ export type MoleUnitWith<
51
+ MolarMass extends number,
52
+ Prefix extends MetricPrefix,
53
+ > = `${Prefix}mol<${MolarMass}>`
54
+
55
+ export type FrequencyUnit = HertzUnit<MetricPrefix>
56
+
57
+ /**
58
+ * More SI prefixes also available as literals, just type the string
59
+ * @example 'cm', 'km'
60
+ */
61
+ export type UnitOfLength =
62
+ | 'ft'
63
+ /**
64
+ * More SI prefixes also available as literals, just type the string
65
+ * @example 'cm', 'km'
66
+ */
67
+ | 'm'
68
+ | 'in'
69
+ | 'yd'
70
+ | 'mi'
71
+
72
+ export type LengthUnit = MeterUnit<MetricPrefix> | UnitOfLength
73
+
74
+ /**
75
+ * More SI prefixes also available as literals, just type the string
76
+ * @example 'ml', 'cl'
77
+ */
78
+ export type UnitOfVolume =
79
+ | 'cup_imp'
80
+ | 'fl_oz_imp'
81
+ | 'pt_imp'
82
+ | 'cup_us'
83
+ | 'fl_oz_us'
84
+ | 'pt_us'
85
+ /**
86
+ * More SI prefixes also available as literals, just type the string
87
+ * @example 'ml', 'cl'
88
+ */
89
+ | 'l'
90
+
91
+ export type VolumeUnit = LiterUnit<MetricPrefix> | UnitOfVolume
92
+
93
+ /**
94
+ * More SI prefixes also available as literals, just type the string
95
+ * @example 'mg', 'kg'
96
+ */
97
+ export type UnitOfMass =
98
+ | 'oz'
99
+ | 'st'
100
+ | 'lb'
101
+ /**
102
+ * More SI prefixes also available as literals, just type the string
103
+ * @example 'mg', 'kg'
104
+ */
105
+ | 'g'
106
+
107
+ /**
108
+ * More SI prefixes also available as literals, just type the string
109
+ * @example 'mg', 'kg'
110
+ */
111
+ export type MassUnit = GramUnit<MetricPrefix> | UnitOfMass
112
+
113
+ /**
114
+ * More SI prefixes also available as literals, just type the string
115
+ * @example 'kPa', 'hPa'
116
+ */
117
+ export type UnitOfPressure =
118
+ | 'atm'
119
+ | 'cmAq'
120
+ | 'mmHg'
121
+ | 'inHg'
122
+ | 'dBASPL'
123
+ /**
124
+ * More SI prefixes also available as literals, just type the string
125
+ * @example 'kPa', 'hPa'
126
+ */
127
+ | 'Pa'
128
+
129
+ /**
130
+ * More SI prefixes also available as literals, just type the string
131
+ * @example 'kPa', 'hPa'
132
+ */
133
+ export type PressureUnit = PascalUnit<MetricPrefix> | UnitOfPressure
134
+
135
+ /**
136
+ * More SI prefixes also available as literals, just type the string
137
+ * @example 'ms'
138
+ */
139
+ export type UnitOfTime =
140
+ | 'd'
141
+ | 'min'
142
+ | 'hr'
143
+ /**
144
+ * More SI prefixes also available as literals, just type the string
145
+ * @example 'ms'
146
+ */
147
+ | 's'
148
+
149
+ /**
150
+ * More SI prefixes also available as literals, just type the string
151
+ * @example 'ms'
152
+ */
153
+ export type TimeUnit = SecondUnit<MetricPrefix> | UnitOfTime
154
+ export type TemperatureUnit = 'degC' | 'degF' | 'K'
155
+
156
+ /**
157
+ * More SI prefixes also available as literals, just type the string
158
+ * @example 'kJ'
159
+ */
160
+ export type UnitOfEnergy = 'kcal' | 'Cal' | 'cal' | 'J'
161
+
162
+ export type EnergyUnit = JouleUnit<MetricPrefix> | UnitOfEnergy
163
+
164
+ export type BloodGlucoseUnit = 'mmol<180.15588000005408>/l' | 'mg/dL'
165
+
166
+ export type SpeedUnit<
167
+ TLength extends LengthUnit,
168
+ TTime extends TimeUnit,
169
+ > = `${TLength}/${TTime}`
170
+
171
+ export type CountPerTime<TTime extends TimeUnit> = `count/${TTime}`
172
+
173
+ export type Unit =
174
+ | BloodGlucoseUnit
175
+ | CountPerTime<TimeUnit>
176
+ | EnergyUnit
177
+ | FrequencyUnit
178
+ | Units
179
+ | LengthUnit
180
+ | MassUnit
181
+ | PressureUnit
182
+ | SpeedUnit<LengthUnit, TimeUnit>
183
+ | TemperatureUnit
184
+ | TimeUnit
185
+ | VolumeUnit
186
+
187
+ export interface IdentifierWithUnit {
188
+ typeIdentifier: string
189
+ unit: string
190
+ }
@@ -0,0 +1,31 @@
1
+ // documented at https://developer.apple.com/documentation/healthkit/hkweathercondition
2
+ export enum HKWeatherCondition {
3
+ none = 0,
4
+ clear = 1,
5
+ fair = 2,
6
+ partlyCloudy = 3,
7
+ mostlyCloudy = 4,
8
+ cloudy = 5,
9
+ foggy = 6,
10
+ haze = 7,
11
+ windy = 8,
12
+ blustery = 9,
13
+ smoky = 10,
14
+ dust = 11,
15
+ snow = 12,
16
+ hail = 13,
17
+ sleet = 14,
18
+ freezingDrizzle = 15,
19
+ freezingRain = 16,
20
+ mixedRainAndHail = 17,
21
+ mixedRainAndSnow = 18,
22
+ mixedRainAndSleet = 19,
23
+ mixedSnowAndSleet = 20,
24
+ drizzle = 21,
25
+ scatteredShowers = 22,
26
+ showers = 23,
27
+ thunderstorms = 24,
28
+ tropicalStorm = 25,
29
+ hurricane = 26,
30
+ tornado = 27,
31
+ }
@@ -0,0 +1,18 @@
1
+ import type { WorkoutActivityType } from './Workouts'
2
+
3
+ /**
4
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutconfiguration Apple Docs }
5
+ */
6
+ export interface WorkoutConfiguration {
7
+ readonly activityType: WorkoutActivityType
8
+ readonly locationType?: WorkoutSessionLocationType
9
+ }
10
+
11
+ /**
12
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutsessionlocationtype Apple Docs }
13
+ */
14
+ export enum WorkoutSessionLocationType {
15
+ unknown = 1,
16
+ indoor = 2,
17
+ outdoor = 3,
18
+ }