@kingstinct/react-native-healthkit 7.3.1 → 8.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 (216) hide show
  1. package/README.md +1 -1
  2. package/ios/Constants.swift +1 -1
  3. package/ios/ReactNativeHealthkit.m +1 -1
  4. package/ios/ReactNativeHealthkit.swift +2 -2
  5. package/ios/Serializers.swift +12 -0
  6. package/lib/commonjs/hooks/useHealthkitAuthorization.js +2 -3
  7. package/lib/commonjs/hooks/useHealthkitAuthorization.js.map +1 -1
  8. package/lib/commonjs/hooks/useHealthkitAuthorization.test.js +42 -19
  9. package/lib/commonjs/hooks/useHealthkitAuthorization.test.js.map +1 -1
  10. package/lib/commonjs/hooks/useIsHealthDataAvailable.js +2 -3
  11. package/lib/commonjs/hooks/useIsHealthDataAvailable.js.map +1 -1
  12. package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js +17 -8
  13. package/lib/commonjs/hooks/useIsHealthDataAvailable.test.js.map +1 -1
  14. package/lib/commonjs/hooks/useMostRecentCategorySample.js +2 -3
  15. package/lib/commonjs/hooks/useMostRecentCategorySample.js.map +1 -1
  16. package/lib/commonjs/hooks/useMostRecentQuantitySample.js +4 -3
  17. package/lib/commonjs/hooks/useMostRecentQuantitySample.js.map +1 -1
  18. package/lib/commonjs/hooks/useMostRecentWorkout.js +2 -3
  19. package/lib/commonjs/hooks/useMostRecentWorkout.js.map +1 -1
  20. package/lib/commonjs/hooks/useSources.js +2 -3
  21. package/lib/commonjs/hooks/useSources.js.map +1 -1
  22. package/lib/commonjs/hooks/useStatisticsForQuantity.js +2 -3
  23. package/lib/commonjs/hooks/useStatisticsForQuantity.js.map +1 -1
  24. package/lib/commonjs/hooks/useSubscribeToChanges.js +2 -3
  25. package/lib/commonjs/hooks/useSubscribeToChanges.js.map +1 -1
  26. package/lib/commonjs/index.ios.js +471 -0
  27. package/lib/commonjs/index.ios.js.map +1 -0
  28. package/lib/commonjs/index.js +9 -482
  29. package/lib/commonjs/index.js.map +1 -1
  30. package/lib/commonjs/index.native.js +46 -95
  31. package/lib/commonjs/index.native.js.map +1 -1
  32. package/lib/commonjs/index.web.js +7 -1
  33. package/lib/commonjs/index.web.js.map +1 -1
  34. package/lib/commonjs/native-types.js +65 -90
  35. package/lib/commonjs/native-types.js.map +1 -1
  36. package/lib/commonjs/test-setup.js +51 -0
  37. package/lib/commonjs/test-setup.js.map +1 -0
  38. package/lib/commonjs/test-utils.js +1 -2
  39. package/lib/commonjs/test-utils.js.map +1 -1
  40. package/lib/commonjs/types.js.map +1 -1
  41. package/lib/commonjs/utils/deleteQuantitySample.js +2 -3
  42. package/lib/commonjs/utils/deleteQuantitySample.js.map +1 -1
  43. package/lib/commonjs/utils/deleteSamples.js +2 -3
  44. package/lib/commonjs/utils/deleteSamples.js.map +1 -1
  45. package/lib/commonjs/utils/deserializeCategorySample.js +1 -2
  46. package/lib/commonjs/utils/deserializeCategorySample.js.map +1 -1
  47. package/lib/commonjs/utils/deserializeCategorySample.test.js +8 -4
  48. package/lib/commonjs/utils/deserializeCategorySample.test.js.map +1 -1
  49. package/lib/commonjs/utils/deserializeCorrelation.js +2 -3
  50. package/lib/commonjs/utils/deserializeCorrelation.js.map +1 -1
  51. package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js +1 -2
  52. package/lib/commonjs/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
  53. package/lib/commonjs/utils/deserializeSample.js +1 -2
  54. package/lib/commonjs/utils/deserializeSample.js.map +1 -1
  55. package/lib/commonjs/utils/deserializeWorkout.js +1 -2
  56. package/lib/commonjs/utils/deserializeWorkout.js.map +1 -1
  57. package/lib/commonjs/utils/ensureMetadata.js +1 -2
  58. package/lib/commonjs/utils/ensureMetadata.js.map +1 -1
  59. package/lib/commonjs/utils/ensureTotals.js +1 -2
  60. package/lib/commonjs/utils/ensureTotals.js.map +1 -1
  61. package/lib/commonjs/utils/ensureUnit.js +2 -3
  62. package/lib/commonjs/utils/ensureUnit.js.map +1 -1
  63. package/lib/commonjs/utils/getDateOfBirth.js +2 -3
  64. package/lib/commonjs/utils/getDateOfBirth.js.map +1 -1
  65. package/lib/commonjs/utils/getMostRecentCategorySample.js +2 -3
  66. package/lib/commonjs/utils/getMostRecentCategorySample.js.map +1 -1
  67. package/lib/commonjs/utils/getMostRecentQuantitySample.js +2 -3
  68. package/lib/commonjs/utils/getMostRecentQuantitySample.js.map +1 -1
  69. package/lib/commonjs/utils/getMostRecentWorkout.js +2 -3
  70. package/lib/commonjs/utils/getMostRecentWorkout.js.map +1 -1
  71. package/lib/commonjs/utils/getPreferredUnit.js +2 -3
  72. package/lib/commonjs/utils/getPreferredUnit.js.map +1 -1
  73. package/lib/commonjs/utils/getPreferredUnits.js +2 -3
  74. package/lib/commonjs/utils/getPreferredUnits.js.map +1 -1
  75. package/lib/commonjs/utils/getPreferredUnitsTyped.js +3 -4
  76. package/lib/commonjs/utils/getPreferredUnitsTyped.js.map +1 -1
  77. package/lib/commonjs/utils/getRequestStatusForAuthorization.js +3 -5
  78. package/lib/commonjs/utils/getRequestStatusForAuthorization.js.map +1 -1
  79. package/lib/commonjs/utils/getWorkoutPlanById.js +2 -3
  80. package/lib/commonjs/utils/getWorkoutPlanById.js.map +1 -1
  81. package/lib/commonjs/utils/prepareOptions.js +3 -3
  82. package/lib/commonjs/utils/prepareOptions.js.map +1 -1
  83. package/lib/commonjs/utils/queryCategorySamples.js +2 -3
  84. package/lib/commonjs/utils/queryCategorySamples.js.map +1 -1
  85. package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js +2 -3
  86. package/lib/commonjs/utils/queryCategorySamplesWithAnchor.js.map +1 -1
  87. package/lib/commonjs/utils/queryCorrelationSamples.js +2 -3
  88. package/lib/commonjs/utils/queryCorrelationSamples.js.map +1 -1
  89. package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js +2 -3
  90. package/lib/commonjs/utils/queryHeartbeatSeriesSamples.js.map +1 -1
  91. package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js +2 -3
  92. package/lib/commonjs/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -1
  93. package/lib/commonjs/utils/queryQuantitySamples.js +2 -3
  94. package/lib/commonjs/utils/queryQuantitySamples.js.map +1 -1
  95. package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js +2 -3
  96. package/lib/commonjs/utils/queryQuantitySamplesWithAnchor.js.map +1 -1
  97. package/lib/commonjs/utils/querySources.js +2 -3
  98. package/lib/commonjs/utils/querySources.js.map +1 -1
  99. package/lib/commonjs/utils/queryStatisticsForQuantity.js +2 -3
  100. package/lib/commonjs/utils/queryStatisticsForQuantity.js.map +1 -1
  101. package/lib/commonjs/utils/queryWorkouts.js +2 -3
  102. package/lib/commonjs/utils/queryWorkouts.js.map +1 -1
  103. package/lib/commonjs/utils/requestAuthorization.js +3 -5
  104. package/lib/commonjs/utils/requestAuthorization.js.map +1 -1
  105. package/lib/commonjs/utils/saveCategorySample.js +2 -3
  106. package/lib/commonjs/utils/saveCategorySample.js.map +1 -1
  107. package/lib/commonjs/utils/saveCorrelationSample.js +2 -3
  108. package/lib/commonjs/utils/saveCorrelationSample.js.map +1 -1
  109. package/lib/commonjs/utils/saveQuantitySample.js +2 -3
  110. package/lib/commonjs/utils/saveQuantitySample.js.map +1 -1
  111. package/lib/commonjs/utils/saveWorkoutRoute.js +2 -3
  112. package/lib/commonjs/utils/saveWorkoutRoute.js.map +1 -1
  113. package/lib/commonjs/utils/saveWorkoutSample.js +2 -3
  114. package/lib/commonjs/utils/saveWorkoutSample.js.map +1 -1
  115. package/lib/commonjs/utils/serializeDate.js +1 -2
  116. package/lib/commonjs/utils/serializeDate.js.map +1 -1
  117. package/lib/commonjs/utils/serializeDate.test.js +1 -1
  118. package/lib/commonjs/utils/serializeDate.test.js.map +1 -1
  119. package/lib/commonjs/utils/subscribeToChanges.js +6 -8
  120. package/lib/commonjs/utils/subscribeToChanges.js.map +1 -1
  121. package/lib/module/hooks/useHealthkitAuthorization.js.map +1 -1
  122. package/lib/module/hooks/useHealthkitAuthorization.test.js +26 -3
  123. package/lib/module/hooks/useHealthkitAuthorization.test.js.map +1 -1
  124. package/lib/module/hooks/useIsHealthDataAvailable.js.map +1 -1
  125. package/lib/module/hooks/useIsHealthDataAvailable.test.js +9 -2
  126. package/lib/module/hooks/useIsHealthDataAvailable.test.js.map +1 -1
  127. package/lib/module/hooks/useMostRecentCategorySample.js.map +1 -1
  128. package/lib/module/hooks/useMostRecentQuantitySample.js +2 -0
  129. package/lib/module/hooks/useMostRecentQuantitySample.js.map +1 -1
  130. package/lib/module/hooks/useMostRecentWorkout.js.map +1 -1
  131. package/lib/module/hooks/useSources.js.map +1 -1
  132. package/lib/module/hooks/useStatisticsForQuantity.js.map +1 -1
  133. package/lib/module/hooks/useSubscribeToChanges.js.map +1 -1
  134. package/lib/module/index.ios.js +188 -0
  135. package/lib/module/index.ios.js.map +1 -0
  136. package/lib/module/index.js +3 -198
  137. package/lib/module/index.js.map +1 -1
  138. package/lib/module/index.native.js +1 -3
  139. package/lib/module/index.native.js.map +1 -1
  140. package/lib/module/index.web.js +2 -0
  141. package/lib/module/index.web.js.map +1 -1
  142. package/lib/module/native-types.js +21 -2
  143. package/lib/module/native-types.js.map +1 -1
  144. package/lib/module/test-setup.js +48 -0
  145. package/lib/module/test-setup.js.map +1 -0
  146. package/lib/module/test-utils.js.map +1 -1
  147. package/lib/module/types.js.map +1 -1
  148. package/lib/module/utils/deleteQuantitySample.js.map +1 -1
  149. package/lib/module/utils/deleteSamples.js.map +1 -1
  150. package/lib/module/utils/deserializeCategorySample.js.map +1 -1
  151. package/lib/module/utils/deserializeCategorySample.test.js +4 -2
  152. package/lib/module/utils/deserializeCategorySample.test.js.map +1 -1
  153. package/lib/module/utils/deserializeCorrelation.js.map +1 -1
  154. package/lib/module/utils/deserializeHeartbeatSeriesSample.js.map +1 -1
  155. package/lib/module/utils/deserializeSample.js.map +1 -1
  156. package/lib/module/utils/deserializeWorkout.js.map +1 -1
  157. package/lib/module/utils/ensureMetadata.js.map +1 -1
  158. package/lib/module/utils/ensureTotals.js.map +1 -1
  159. package/lib/module/utils/ensureUnit.js.map +1 -1
  160. package/lib/module/utils/getDateOfBirth.js.map +1 -1
  161. package/lib/module/utils/getMostRecentCategorySample.js.map +1 -1
  162. package/lib/module/utils/getMostRecentQuantitySample.js.map +1 -1
  163. package/lib/module/utils/getMostRecentWorkout.js.map +1 -1
  164. package/lib/module/utils/getPreferredUnit.js.map +1 -1
  165. package/lib/module/utils/getPreferredUnits.js.map +1 -1
  166. package/lib/module/utils/getPreferredUnitsTyped.js.map +1 -1
  167. package/lib/module/utils/getRequestStatusForAuthorization.js +1 -2
  168. package/lib/module/utils/getRequestStatusForAuthorization.js.map +1 -1
  169. package/lib/module/utils/getWorkoutPlanById.js.map +1 -1
  170. package/lib/module/utils/prepareOptions.js +1 -0
  171. package/lib/module/utils/prepareOptions.js.map +1 -1
  172. package/lib/module/utils/queryCategorySamples.js.map +1 -1
  173. package/lib/module/utils/queryCategorySamplesWithAnchor.js.map +1 -1
  174. package/lib/module/utils/queryCorrelationSamples.js.map +1 -1
  175. package/lib/module/utils/queryHeartbeatSeriesSamples.js.map +1 -1
  176. package/lib/module/utils/queryHeartbeatSeriesSamplesWithAnchor.js.map +1 -1
  177. package/lib/module/utils/queryQuantitySamples.js.map +1 -1
  178. package/lib/module/utils/queryQuantitySamplesWithAnchor.js.map +1 -1
  179. package/lib/module/utils/querySources.js.map +1 -1
  180. package/lib/module/utils/queryStatisticsForQuantity.js.map +1 -1
  181. package/lib/module/utils/queryWorkouts.js.map +1 -1
  182. package/lib/module/utils/requestAuthorization.js +1 -2
  183. package/lib/module/utils/requestAuthorization.js.map +1 -1
  184. package/lib/module/utils/saveCategorySample.js.map +1 -1
  185. package/lib/module/utils/saveCorrelationSample.js.map +1 -1
  186. package/lib/module/utils/saveQuantitySample.js.map +1 -1
  187. package/lib/module/utils/saveWorkoutRoute.js.map +1 -1
  188. package/lib/module/utils/saveWorkoutSample.js.map +1 -1
  189. package/lib/module/utils/serializeDate.js.map +1 -1
  190. package/lib/module/utils/serializeDate.test.js.map +1 -1
  191. package/lib/module/utils/subscribeToChanges.js +3 -4
  192. package/lib/module/utils/subscribeToChanges.js.map +1 -1
  193. package/lib/typescript/src/index.d.ts +3 -180
  194. package/lib/typescript/src/index.ios.d.ts +172 -0
  195. package/lib/typescript/src/index.native.d.ts +3 -3
  196. package/lib/typescript/src/index.web.d.ts +2 -0
  197. package/lib/typescript/src/native-types.d.ts +86 -8
  198. package/package.json +16 -11
  199. package/src/hooks/useHealthkitAuthorization.test.ts +18 -4
  200. package/src/hooks/useIsHealthDataAvailable.test.ts +5 -2
  201. package/src/hooks/useIsHealthDataAvailable.ts +1 -1
  202. package/src/hooks/useMostRecentQuantitySample.ts +3 -0
  203. package/src/index.ios.tsx +263 -0
  204. package/src/index.native.tsx +1 -4
  205. package/src/index.tsx +3 -274
  206. package/src/index.web.tsx +4 -0
  207. package/src/native-types.ts +97 -9
  208. package/src/test-setup.ts +51 -0
  209. package/src/utils/deserializeCategorySample.test.ts +5 -2
  210. package/src/utils/prepareOptions.ts +1 -0
  211. package/lib/commonjs/jest.setup.js +0 -45
  212. package/lib/commonjs/jest.setup.js.map +0 -1
  213. package/lib/module/jest.setup.js +0 -43
  214. package/lib/module/jest.setup.js.map +0 -1
  215. package/src/jest.setup.ts +0 -46
  216. /package/lib/typescript/src/{jest.setup.d.ts → test-setup.d.ts} +0 -0
package/src/index.tsx CHANGED
@@ -1,276 +1,5 @@
1
- import { Platform } from 'react-native'
1
+ import Healthkit from './index.ios'
2
2
 
3
- import useHealthkitAuthorization from './hooks/useHealthkitAuthorization'
4
- import useIsHealthDataAvailable from './hooks/useIsHealthDataAvailable'
5
- import useMostRecentCategorySample from './hooks/useMostRecentCategorySample'
6
- import useMostRecentQuantitySample from './hooks/useMostRecentQuantitySample'
7
- import useMostRecentWorkout from './hooks/useMostRecentWorkout'
8
- import useSources from './hooks/useSources'
9
- import useStatisticsForQuantity from './hooks/useStatisticsForQuantity'
10
- import useSubscribeToChanges from './hooks/useSubscribeToChanges'
11
- import Native, { HKQuantityTypeIdentifier } from './native-types'
12
- import deleteQuantitySample from './utils/deleteQuantitySample'
13
- import deleteSamples from './utils/deleteSamples'
14
- import getDateOfBirth from './utils/getDateOfBirth'
15
- import getMostRecentCategorySample from './utils/getMostRecentCategorySample'
16
- import getMostRecentQuantitySample from './utils/getMostRecentQuantitySample'
17
- import getMostRecentWorkout from './utils/getMostRecentWorkout'
18
- import getPreferredUnit from './utils/getPreferredUnit'
19
- import getPreferredUnits from './utils/getPreferredUnits'
20
- import getRequestStatusForAuthorization from './utils/getRequestStatusForAuthorization'
21
- import getWorkoutPlanById from './utils/getWorkoutPlanById'
22
- import queryCategorySamples from './utils/queryCategorySamples'
23
- import queryCategorySamplesWithAnchor from './utils/queryCategorySamplesWithAnchor'
24
- import queryCorrelationSamples from './utils/queryCorrelationSamples'
25
- import queryHeartbeatSeriesSamples from './utils/queryHeartbeatSeriesSamples'
26
- import queryHeartbeatSeriesSamplesWithAnchor from './utils/queryHeartbeatSeriesSamplesWithAnchor'
27
- import queryQuantitySamples from './utils/queryQuantitySamples'
28
- import queryQuantitySamplesWithAnchor from './utils/queryQuantitySamplesWithAnchor'
29
- import querySources from './utils/querySources'
30
- import queryStatisticsForQuantity from './utils/queryStatisticsForQuantity'
31
- import queryWorkouts from './utils/queryWorkouts'
32
- import requestAuthorization from './utils/requestAuthorization'
33
- import saveCategorySample from './utils/saveCategorySample'
34
- import saveCorrelationSample from './utils/saveCorrelationSample'
35
- import saveQuantitySample from './utils/saveQuantitySample'
36
- import saveWorkoutRoute from './utils/saveWorkoutRoute'
37
- import saveWorkoutSample from './utils/saveWorkoutSample'
38
- import subscribeToChanges from './utils/subscribeToChanges'
3
+ export * from './index.ios'
39
4
 
40
- const currentMajorVersionIOS = Platform.OS === 'ios' ? parseInt(Platform.Version, 10) : 0
41
-
42
- const allQuantityTypesList = [...Object.values(HKQuantityTypeIdentifier)]
43
-
44
- const availableQuantityTypes = (majorVersionIOS = currentMajorVersionIOS) => {
45
- if (majorVersionIOS >= 17) {
46
- return allQuantityTypesList
47
- }
48
-
49
- // remove types that are not available before iOS 17
50
- return allQuantityTypesList.filter((type) => ![
51
- HKQuantityTypeIdentifier.cyclingCadence,
52
- HKQuantityTypeIdentifier.cyclingFunctionalThresholdPower,
53
- HKQuantityTypeIdentifier.cyclingPower,
54
- HKQuantityTypeIdentifier.cyclingSpeed,
55
- HKQuantityTypeIdentifier.physicalEffort,
56
- HKQuantityTypeIdentifier.timeInDaylight,
57
- ].includes(type))
58
- }
59
-
60
- const authorizationStatusFor = Native.authorizationStatusFor.bind(Native)
61
- const isHealthDataAvailable = Native.isHealthDataAvailable.bind(Native)
62
- // Todo [>8]: Rename to align with Apple function name (isProtectedDataAvailable)
63
- const canAccessProtectedData = Native.canAccessProtectedData.bind(Native)
64
- const disableBackgroundDelivery = Native.disableBackgroundDelivery.bind(Native)
65
- const disableAllBackgroundDelivery = Native.disableAllBackgroundDelivery.bind(Native)
66
- const enableBackgroundDelivery = Native.enableBackgroundDelivery.bind(Native)
67
- const getBiologicalSex = Native.getBiologicalSex.bind(Native)
68
- const getFitzpatrickSkinType = Native.getFitzpatrickSkinType.bind(Native)
69
- const getWheelchairUse = Native.getWheelchairUse.bind(Native)
70
- const getBloodType = Native.getBloodType.bind(Native)
71
- const getWorkoutRoutes = Native.getWorkoutRoutes.bind(Native)
72
-
73
- /**
74
- * @see {@link https://developer.apple.com/documentation/healthkit/about_the_healthkit_framework About the HealthKit Framework (Apple Docs)}
75
- */
76
- export default {
77
- /**
78
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614154-authorizationstatus authorizationStatus(for:) (Apple Docs) }
79
- * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Authorizing access to health data (Apple Docs) }
80
- */
81
- authorizationStatusFor,
82
-
83
- /**
84
- *
85
- * @returns All available quantity types for the current iOS version (currently excluding types that are not available before iOS 17)
86
- */
87
- availableQuantityTypes,
88
-
89
- /**
90
- * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.
91
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable isHealthDataAvailable() (Apple Docs)}
92
- * @returns {boolean} true if HealthKit is available; otherwise, false.
93
- */
94
- isHealthDataAvailable,
95
-
96
- /**
97
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}
98
- * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}
99
- * @returns {boolean} A Boolean value that indicates whether content protection is active.
100
- */
101
- isProtectedDataAvailable: canAccessProtectedData,
102
-
103
- // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)
104
- /**
105
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614181-isprotecteddataavailable isProtectedDataAvailable() (Apple Docs)}
106
- * @see {@link https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705074 Protecting User Privacy - Access encrypted data (Apple Docs)}
107
- * @deprecated Use {@link isProtectedDataAvailable} instead. Will be removed in next major version.
108
- * @returns {boolean} A Boolean value that indicates whether content protection is active.
109
- */
110
- canAccessProtectedData,
111
-
112
- /**
113
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614158-disableallbackgrounddelivery disableAllBackgroundDelivery(completion:) (Apple Docs)}
114
- */
115
- disableAllBackgroundDelivery,
116
- /**
117
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614177-disablebackgrounddelivery disableBackgroundDelivery(for:withCompletion:) (Apple Docs)}
118
- */
119
- disableBackgroundDelivery,
120
- /**
121
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614175-enablebackgrounddelivery enableBackgroundDelivery(for:frequency:withCompletion:) (Apple Docs)}
122
- */
123
- enableBackgroundDelivery,
124
-
125
- // simple convenience getters
126
- /**
127
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614171-biologicalsex biologicalSex() (Apple Docs)}
128
- */
129
- getBiologicalSex,
130
- /**
131
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614161-fitzpatrickskintype fitzpatrickSkinType() (Apple Docs)}
132
- */
133
- getFitzpatrickSkinType,
134
- /**
135
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648356-wheelchairuse wheelchairUse() (Apple Docs)}
136
- */
137
- getWheelchairUse,
138
- /**
139
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614164-bloodtype bloodType() (Apple Docs)}
140
- */
141
- getBloodType,
142
- /**
143
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1648357-dateofbirthcomponents dateOfBirthComponents() (Apple Docs)}
144
- */
145
- getDateOfBirth,
146
-
147
- getMostRecentQuantitySample,
148
- getMostRecentCategorySample,
149
- getMostRecentWorkout,
150
-
151
- /**
152
- * @see {@link https://developer.apple.com/documentation/healthkit/workouts_and_activity_rings/reading_route_data Reading route data (Apple Docs)}
153
- * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutequery HKWorkoutRouteQuery (Apple Docs)}
154
- */
155
- getWorkoutRoutes,
156
- getWorkoutPlanById,
157
-
158
- getPreferredUnit,
159
- getPreferredUnits,
160
- getRequestStatusForAuthorization,
161
-
162
- // query methods
163
- queryCategorySamples,
164
- queryCategorySamplesWithAnchor,
165
- queryCorrelationSamples,
166
- queryHeartbeatSeriesSamples,
167
- queryHeartbeatSeriesSamplesWithAnchor,
168
- queryQuantitySamples,
169
- queryQuantitySamplesWithAnchor,
170
- queryStatisticsForQuantity,
171
- queryWorkouts,
172
- querySources,
173
-
174
- requestAuthorization,
175
-
176
- // delete methods
177
- deleteQuantitySample,
178
- deleteSamples,
179
-
180
- // save methods
181
- /**
182
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614168-savecategorysample save(_:withCompletion:) (Apple Docs)}
183
- * @see {@link https://developer.apple.com/documentation/healthkit/saving_data_to_healthkit Saving data to HealthKit (Apple Docs)}
184
- */
185
- saveCategorySample,
186
- saveCorrelationSample,
187
- saveQuantitySample,
188
- saveWorkoutSample,
189
- saveWorkoutRoute,
190
-
191
- // subscriptions
192
- subscribeToChanges,
193
-
194
- /**
195
- * @returns the most recent sample for the given category type.
196
- */
197
- useMostRecentCategorySample,
198
- /**
199
- * @returns the most recent sample for the given quantity type.
200
- */
201
- useMostRecentQuantitySample,
202
- /**
203
- * @returns the most recent workout sample.
204
- */
205
- useMostRecentWorkout,
206
- useSubscribeToChanges,
207
- /**
208
- * @description By default, HealthKit data is available on iOS and watchOS. HealthKit data is also available on iPadOS 17 or later. However, devices running in an enterprise environment may restrict access to HealthKit data.
209
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs}
210
- * @returns {boolean | null} true if HealthKit is available; otherwise, false. null while initializing.
211
- */
212
- useIsHealthDataAvailable,
213
- /**
214
- * @description Hook to retrieve the current authorization status for the given types, and request authorization if needed.
215
- * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614152-requestauthorization Apple Docs - requestAuthorization}
216
- * @see {@link https://developer.apple.com/documentation/healthkit/authorizing_access_to_health_data Apple Docs - Authorizing access to health data}
217
- */
218
- useHealthkitAuthorization,
219
- useSources,
220
- useStatisticsForQuantity,
221
- }
222
-
223
- const isProtectedDataAvailable = canAccessProtectedData
224
-
225
- export {
226
- authorizationStatusFor,
227
- availableQuantityTypes,
228
- disableAllBackgroundDelivery,
229
- disableBackgroundDelivery,
230
- enableBackgroundDelivery,
231
- getBiologicalSex,
232
- getBloodType,
233
- getDateOfBirth,
234
- getFitzpatrickSkinType,
235
- getMostRecentCategorySample,
236
- getMostRecentQuantitySample,
237
- getMostRecentWorkout,
238
- getPreferredUnit,
239
- getPreferredUnits,
240
- getRequestStatusForAuthorization,
241
- getWheelchairUse,
242
- getWorkoutRoutes,
243
- isHealthDataAvailable,
244
- queryCategorySamples,
245
- queryCategorySamplesWithAnchor,
246
- queryCorrelationSamples,
247
- queryHeartbeatSeriesSamples,
248
- queryHeartbeatSeriesSamplesWithAnchor,
249
- queryQuantitySamples,
250
- queryQuantitySamplesWithAnchor,
251
- queryStatisticsForQuantity,
252
- queryWorkouts,
253
- querySources,
254
- requestAuthorization,
255
- deleteQuantitySample,
256
- deleteSamples,
257
- getWorkoutPlanById,
258
- saveCategorySample,
259
- saveCorrelationSample,
260
- saveQuantitySample,
261
- saveWorkoutSample,
262
- saveWorkoutRoute,
263
- subscribeToChanges,
264
- useMostRecentCategorySample,
265
- useMostRecentQuantitySample,
266
- useMostRecentWorkout,
267
- useSubscribeToChanges,
268
- useHealthkitAuthorization,
269
- useIsHealthDataAvailable,
270
- useSources,
271
- useStatisticsForQuantity,
272
- canAccessProtectedData,
273
- isProtectedDataAvailable,
274
- }
275
-
276
- export * from './types'
5
+ export default Healthkit
package/src/index.web.tsx CHANGED
@@ -1 +1,5 @@
1
+ import Healthkit from './index.native'
2
+
1
3
  export * from './index.native'
4
+
5
+ export default Healthkit
@@ -717,6 +717,69 @@ export enum HKQuantityTypeIdentifier {
717
717
  * @since iOS 16
718
718
  */
719
719
  runningSpeed = 'HKQuantityTypeIdentifierRunningSpeed',
720
+
721
+ /**
722
+ * Cross Country Skiing Speed
723
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierCrossCountrySkiingSpeed Apple Docs HKQuantityTypeIdentifierCrossCountrySkiingSpeed}
724
+ * @since iOS 18
725
+ */
726
+ crossCountrySkiingSpeed = 'HKQuantityTypeIdentifierCrossCountrySkiingSpeed',
727
+
728
+ /**
729
+ * Cross Country Skiing Distance
730
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierDistanceCrossCountrySkiing Apple Docs HKQuantityTypeIdentifierCrossCountrySkiingDistance}
731
+ * @since iOS 18
732
+ */
733
+ distanceCrossCountrySkiing = 'HKQuantityTypeIdentifierDistanceCrossCountrySkiing',
734
+
735
+ /**
736
+ * Paddle Sports Distance
737
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierDistancePaddleSports Apple Docs HKQuantityTypeIdentifierDistancePaddleSports}
738
+ * @since iOS 18
739
+ */
740
+ distancePaddleSports = 'HKQuantityTypeIdentifierDistancePaddleSports',
741
+
742
+ /**
743
+ * Rowing Distance
744
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierDistanceRowing Apple Docs HKQuantityTypeIdentifierDistanceRowing}
745
+ * @since iOS 18
746
+ */
747
+ distanceRowing = 'HKQuantityTypeIdentifierDistanceRowing',
748
+
749
+ /**
750
+ * Skating Sports Distance
751
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierDistanceSkatingSports Apple Docs HKQuantityTypeIdentifierDistanceSkatingSports}
752
+ * @since iOS 18
753
+ */
754
+ distanceSkatingSports = 'HKQuantityTypeIdentifierDistanceSkatingSports',
755
+
756
+ /**
757
+ * Estimated Workout Effort Score
758
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierEstimatedWorkoutEffortScore Apple Docs HKQuantityTypeIdentifierEstimatedWorkoutEffortScore}
759
+ * @since iOS 18
760
+ */
761
+ estimatedWorkoutEffortScore = 'HKQuantityTypeIdentifierEstimatedWorkoutEffortScore',
762
+
763
+ /**
764
+ * Paddle Sports Speed
765
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierPaddleSportsSpeed Apple Docs HKQuantityTypeIdentifierPaddleSportsSpeed}
766
+ * @since iOS 18
767
+ */
768
+ paddleSportsSpeed = 'HKQuantityTypeIdentifierPaddleSportsSpeed',
769
+
770
+ /**
771
+ * Rowing Speed
772
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierRowingSpeed Apple Docs HKQuantityTypeIdentifierRowingSpeed}
773
+ * @since iOS 18
774
+ */
775
+ rowingSpeed = 'HKQuantityTypeIdentifierRowingSpeed',
776
+
777
+ /**
778
+ * Workout Effort Score
779
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKQuantityTypeIdentifierWorkoutEffortScore Apple Docs HKQuantityTypeIdentifierWorkoutEffortScore}
780
+ * @since iOS 18
781
+ */
782
+ workoutEffortScore = 'HKQuantityTypeIdentifierWorkoutEffortScore',
720
783
  }
721
784
 
722
785
  export type TypeToUnitMapping = {
@@ -749,6 +812,10 @@ export enum HKCategoryTypeIdentifier {
749
812
  appleStandHour = 'HKCategoryTypeIdentifierAppleStandHour',
750
813
  cervicalMucusQuality = 'HKCategoryTypeIdentifierCervicalMucusQuality',
751
814
  ovulationTestResult = 'HKCategoryTypeIdentifierOvulationTestResult',
815
+ /**
816
+ * @deprecated In iOS 18 beta
817
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifiermenstrualflow Apple Docs }
818
+ */
752
819
  menstrualFlow = 'HKCategoryTypeIdentifierMenstrualFlow',
753
820
  intermenstrualBleeding = 'HKCategoryTypeIdentifierIntermenstrualBleeding',
754
821
  sexualActivity = 'HKCategoryTypeIdentifierSexualActivity',
@@ -812,6 +879,20 @@ export enum HKCategoryTypeIdentifier {
812
879
  vaginalDryness = 'HKCategoryTypeIdentifierVaginalDryness', // HKCategoryValueSeverity
813
880
  vomiting = 'HKCategoryTypeIdentifierVomiting', // HKCategoryValueSeverity
814
881
  wheezing = 'HKCategoryTypeIdentifierWheezing', // HKCategoryValueSeverity
882
+
883
+ /**
884
+ * Bleeding After Pregnancy
885
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifierbleedingafterpregnancy Apple Docs }
886
+ * @since iOS 18
887
+ */
888
+ bleedingAfterPregnancy = 'HKCategoryTypeIdentifierBleedingAfterPregnancy', // HKCategoryValueSeverity
889
+
890
+ /**
891
+ * Bleeding During Pregnancy
892
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkcategorytypeidentifierbleedingduringpregnancy Apple Docs }
893
+ * @since iOS 18
894
+ */
895
+ bleedingDuringPregnancy = 'HKCategoryTypeIdentifierBleedingDuringPregnancy', // HKCategoryValueSeverity
815
896
  }
816
897
 
817
898
  export type HKSampleTypeIdentifier =
@@ -916,6 +997,13 @@ export enum HKWorkoutActivityType {
916
997
  handCycling = 74,
917
998
  discSports = 75,
918
999
  fitnessGaming = 76,
1000
+ cardioDance = 77,
1001
+ socialDance = 78,
1002
+ pickleball = 79,
1003
+ cooldown = 80,
1004
+ swimBikeRun = 82,
1005
+ transition = 83,
1006
+ underwaterDiving = 84,
919
1007
  other = 3000,
920
1008
  }
921
1009
 
@@ -1097,6 +1185,7 @@ export enum HKCategoryValueCervicalMucusQuality {
1097
1185
 
1098
1186
  /**
1099
1187
  * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluemenstrualflow Apple Docs }
1188
+ * @deprecated In iOS 18 beta
1100
1189
  */
1101
1190
  export enum HKCategoryValueMenstrualFlow {
1102
1191
  unspecified = 1,
@@ -1129,7 +1218,7 @@ export enum HKCategoryValueSleepAnalysis {
1129
1218
  }
1130
1219
 
1131
1220
  /**
1132
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueappetitechanges
1221
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvalueappetitechanges Apple Docs}
1133
1222
  */
1134
1223
  export enum HKCategoryValueAppetiteChanges {
1135
1224
  decreased = 2,
@@ -1139,7 +1228,7 @@ export enum HKCategoryValueAppetiteChanges {
1139
1228
  }
1140
1229
 
1141
1230
  /**
1142
- * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepresence
1231
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkcategoryvaluepresence Apple Docs}
1143
1232
  */
1144
1233
  export enum HKCategoryValuePresence {
1145
1234
  notPresent = 1,
@@ -1240,14 +1329,14 @@ export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> =
1240
1329
  ? HKUnits.Percent
1241
1330
  : T extends
1242
1331
  | HKQuantityTypeIdentifier.basalBodyTemperature
1243
- | HKQuantityTypeIdentifier.basalBodyTemperature
1332
+
1244
1333
  ? TemperatureUnit
1245
1334
  : T extends
1246
1335
  | HKQuantityTypeIdentifier.runningSpeed
1247
1336
  | HKQuantityTypeIdentifier.stairAscentSpeed
1248
1337
  | HKQuantityTypeIdentifier.stairDescentSpeed
1249
1338
  | HKQuantityTypeIdentifier.walkingSpeed
1250
- | HKQuantityTypeIdentifier.walkingSpeed
1339
+
1251
1340
  ? SpeedUnit<LengthUnit, TimeUnit>
1252
1341
  : T extends
1253
1342
  | HKQuantityTypeIdentifier.flightsClimbed
@@ -1273,7 +1362,7 @@ export type UnitForIdentifier<T extends HKQuantityTypeIdentifier> =
1273
1362
  | HKQuantityTypeIdentifier.dietaryFiber
1274
1363
  | HKQuantityTypeIdentifier.dietaryFolate
1275
1364
  | HKQuantityTypeIdentifier.dietaryIodine
1276
- | HKQuantityTypeIdentifier.dietaryIodine
1365
+
1277
1366
  | HKQuantityTypeIdentifier.dietaryIron
1278
1367
  | HKQuantityTypeIdentifier.dietaryMagnesium
1279
1368
  | HKQuantityTypeIdentifier.dietaryManganese
@@ -1325,7 +1414,7 @@ export type HKCategoryValueForIdentifier<T extends HKCategoryTypeIdentifier> =
1325
1414
  ? HKCategoryValueNotApplicable
1326
1415
  : T extends
1327
1416
  | HKCategoryTypeIdentifier.abdominalCramps
1328
- | HKCategoryTypeIdentifier.abdominalCramps
1417
+
1329
1418
  | HKCategoryTypeIdentifier.acne
1330
1419
  | HKCategoryTypeIdentifier.bladderIncontinence
1331
1420
  | HKCategoryTypeIdentifier.bloating
@@ -1633,7 +1722,7 @@ export type HKUnit =
1633
1722
  | VolumeUnit
1634
1723
  | `${BloodGlucoseUnit}`
1635
1724
  | `${EnergyUnit}`
1636
- | `${FrequencyUnit}`
1725
+
1637
1726
  | `${HKUnits}`
1638
1727
  | `${LengthUnit}`
1639
1728
  | `${MassUnit}`
@@ -1908,8 +1997,7 @@ type ReactNativeHealthkitTypeNative = {
1908
1997
  * @see {@link https://developer.apple.com/documentation/healthkit/hkhealthstore/1614180-ishealthdataavailable Apple Docs }
1909
1998
  */
1910
1999
  isHealthDataAvailable(): Promise<boolean>;
1911
- // Todo [>8]: Rename to align with Apple function name (isProtectedDataAvailable) - remember to rename native code :)
1912
- canAccessProtectedData(): Promise<boolean>;
2000
+ isProtectedDataAvailable(): Promise<boolean>;
1913
2001
  getBloodType(): Promise<HKBloodType>;
1914
2002
  getDateOfBirth(): Promise<string>;
1915
2003
  getBiologicalSex(): Promise<HKBiologicalSex>;
@@ -0,0 +1,51 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import { mock, jest, beforeAll } from 'bun:test'
3
+
4
+ import type Native from './native-types'
5
+
6
+ beforeAll(async () => {
7
+ const mockModule: typeof Native = {
8
+ isHealthDataAvailable: jest.fn(),
9
+ isProtectedDataAvailable: jest.fn(),
10
+ authorizationStatusFor: jest.fn(),
11
+ requestAuthorization: jest.fn(),
12
+ saveQuantitySample: jest.fn(),
13
+ deleteQuantitySample: jest.fn(),
14
+ deleteSamples: jest.fn(),
15
+ disableAllBackgroundDelivery: jest.fn(),
16
+ disableBackgroundDelivery: jest.fn(),
17
+ enableBackgroundDelivery: jest.fn(),
18
+ queryCategorySamplesWithAnchor: jest.fn(),
19
+ queryQuantitySamplesWithAnchor: jest.fn(),
20
+ getBiologicalSex: jest.fn(),
21
+ getBloodType: jest.fn(),
22
+ getDateOfBirth: jest.fn(),
23
+ getFitzpatrickSkinType: jest.fn(),
24
+ getPreferredUnits: jest.fn(),
25
+ getRequestStatusForAuthorization: jest.fn(),
26
+ getWheelchairUse: jest.fn(),
27
+ getWorkoutRoutes: jest.fn(),
28
+ queryCategorySamples: jest.fn(),
29
+ queryCorrelationSamples: jest.fn(),
30
+ queryHeartbeatSeriesSamples: jest.fn(),
31
+ queryHeartbeatSeriesSamplesWithAnchor: jest.fn(),
32
+ queryQuantitySamples: jest.fn(),
33
+ querySources: jest.fn(),
34
+ queryStatisticsForQuantity: jest.fn(),
35
+ queryWorkoutSamples: jest.fn(),
36
+ saveCategorySample: jest.fn(),
37
+ saveCorrelationSample: jest.fn(),
38
+ saveWorkoutSample: jest.fn(),
39
+ subscribeToObserverQuery: jest.fn(),
40
+ unsubscribeQuery: jest.fn(),
41
+ saveWorkoutRoute: jest.fn(),
42
+ getWorkoutPlanById: jest.fn(),
43
+ }
44
+
45
+ await mock.module('react-native', () => ({
46
+ NativeModules: {
47
+ ReactNativeHealthkit: mockModule,
48
+ },
49
+ NativeEventEmitter: jest.fn(),
50
+ }))
51
+ })
@@ -1,8 +1,11 @@
1
1
  import deserializeCategorySample from './deserializeCategorySample'
2
- import { HKCategorySampleRaw, HKCategoryTypeIdentifier } from '../types'
2
+
3
+ import type { HKCategorySampleRaw } from '../types'
3
4
 
4
5
  describe('deserializeCategorySample', () => {
5
- it('should deserialize category sample', () => {
6
+ it('should deserialize category sample', async () => {
7
+ const { HKCategoryTypeIdentifier } = await import('../native-types')
8
+
6
9
  const sample: HKCategorySampleRaw = {
7
10
  startDate: '2020-01-01T00:00:00.000Z',
8
11
  endDate: '2020-01-01T00:00:00.000Z',
@@ -7,6 +7,7 @@ const prepareOptions = (options: GenericQueryOptions) => {
7
7
  ? 0
8
8
  : options.limit
9
9
  const ascending = options.ascending ?? limit === 0
10
+ // eslint-disable-next-line no-nested-ternary
10
11
  const from = serializeDate(options.from ? options.from : (limit > 0 ? new Date(0) : undefined))
11
12
  const to = serializeDate(options.to)
12
13
  const anchor = options.anchor ?? ''
@@ -1,45 +0,0 @@
1
- "use strict";
2
-
3
- var _reactNative = require("react-native");
4
- const mockModule = {
5
- isHealthDataAvailable: jest.fn(),
6
- addListener: jest.fn(),
7
- removeListeners: jest.fn(),
8
- authorizationStatusFor: jest.fn(),
9
- requestAuthorization: jest.fn(),
10
- saveQuantitySample: jest.fn(),
11
- deleteQuantitySample: jest.fn(),
12
- deleteSamples: jest.fn(),
13
- disableAllBackgroundDelivery: jest.fn(),
14
- disableBackgroundDelivery: jest.fn(),
15
- enableBackgroundDelivery: jest.fn(),
16
- queryCategorySamplesWithAnchor: jest.fn(),
17
- queryQuantitySamplesWithAnchor: jest.fn(),
18
- getBiologicalSex: jest.fn(),
19
- getBloodType: jest.fn(),
20
- getDateOfBirth: jest.fn(),
21
- getFitzpatrickSkinType: jest.fn(),
22
- getPreferredUnits: jest.fn(),
23
- getRequestStatusForAuthorization: jest.fn(),
24
- getWheelchairUse: jest.fn(),
25
- getWorkoutRoutes: jest.fn(),
26
- queryCategorySamples: jest.fn(),
27
- queryCorrelationSamples: jest.fn(),
28
- queryHeartbeatSeriesSamples: jest.fn(),
29
- queryHeartbeatSeriesSamplesWithAnchor: jest.fn(),
30
- queryQuantitySamples: jest.fn(),
31
- querySources: jest.fn(),
32
- queryStatisticsForQuantity: jest.fn(),
33
- queryWorkoutSamples: jest.fn(),
34
- saveCategorySample: jest.fn(),
35
- saveCorrelationSample: jest.fn(),
36
- saveWorkoutSample: jest.fn(),
37
- subscribeToObserverQuery: jest.fn(),
38
- unsubscribeQuery: jest.fn(),
39
- // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)
40
- canAccessProtectedData: jest.fn(),
41
- saveWorkoutRoute: jest.fn(),
42
- getWorkoutPlanById: jest.fn()
43
- };
44
- _reactNative.NativeModules.ReactNativeHealthkit = mockModule;
45
- //# sourceMappingURL=jest.setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_reactNative","require","mockModule","isHealthDataAvailable","jest","fn","addListener","removeListeners","authorizationStatusFor","requestAuthorization","saveQuantitySample","deleteQuantitySample","deleteSamples","disableAllBackgroundDelivery","disableBackgroundDelivery","enableBackgroundDelivery","queryCategorySamplesWithAnchor","queryQuantitySamplesWithAnchor","getBiologicalSex","getBloodType","getDateOfBirth","getFitzpatrickSkinType","getPreferredUnits","getRequestStatusForAuthorization","getWheelchairUse","getWorkoutRoutes","queryCategorySamples","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","querySources","queryStatisticsForQuantity","queryWorkoutSamples","saveCategorySample","saveCorrelationSample","saveWorkoutSample","subscribeToObserverQuery","unsubscribeQuery","canAccessProtectedData","saveWorkoutRoute","getWorkoutPlanById","NativeModules","ReactNativeHealthkit"],"sources":["jest.setup.ts"],"sourcesContent":["import { NativeModule, NativeModules } from 'react-native'\n\nimport type Native from './native-types'\n\nconst mockModule: NativeModule & typeof Native = {\n isHealthDataAvailable: jest.fn(),\n addListener: jest.fn(),\n removeListeners: jest.fn(),\n authorizationStatusFor: jest.fn(),\n requestAuthorization: jest.fn(),\n saveQuantitySample: jest.fn(),\n deleteQuantitySample: jest.fn(),\n deleteSamples: jest.fn(),\n disableAllBackgroundDelivery: jest.fn(),\n disableBackgroundDelivery: jest.fn(),\n enableBackgroundDelivery: jest.fn(),\n queryCategorySamplesWithAnchor: jest.fn(),\n queryQuantitySamplesWithAnchor: jest.fn(),\n getBiologicalSex: jest.fn(),\n getBloodType: jest.fn(),\n getDateOfBirth: jest.fn(),\n getFitzpatrickSkinType: jest.fn(),\n getPreferredUnits: jest.fn(),\n getRequestStatusForAuthorization: jest.fn(),\n getWheelchairUse: jest.fn(),\n getWorkoutRoutes: jest.fn(),\n queryCategorySamples: jest.fn(),\n queryCorrelationSamples: jest.fn(),\n queryHeartbeatSeriesSamples: jest.fn(),\n queryHeartbeatSeriesSamplesWithAnchor: jest.fn(),\n queryQuantitySamples: jest.fn(),\n querySources: jest.fn(),\n queryStatisticsForQuantity: jest.fn(),\n queryWorkoutSamples: jest.fn(),\n saveCategorySample: jest.fn(),\n saveCorrelationSample: jest.fn(),\n saveWorkoutSample: jest.fn(),\n subscribeToObserverQuery: jest.fn(),\n unsubscribeQuery: jest.fn(),\n // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)\n canAccessProtectedData: jest.fn(),\n saveWorkoutRoute: jest.fn(),\n getWorkoutPlanById: jest.fn(),\n}\n\nNativeModules.ReactNativeHealthkit = mockModule\n"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIA,MAAMC,UAAwC,GAAG;EAC/CC,qBAAqB,EAAEC,IAAI,CAACC,EAAE,CAAC,CAAC;EAChCC,WAAW,EAAEF,IAAI,CAACC,EAAE,CAAC,CAAC;EACtBE,eAAe,EAAEH,IAAI,CAACC,EAAE,CAAC,CAAC;EAC1BG,sBAAsB,EAAEJ,IAAI,CAACC,EAAE,CAAC,CAAC;EACjCI,oBAAoB,EAAEL,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/BK,kBAAkB,EAAEN,IAAI,CAACC,EAAE,CAAC,CAAC;EAC7BM,oBAAoB,EAAEP,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/BO,aAAa,EAAER,IAAI,CAACC,EAAE,CAAC,CAAC;EACxBQ,4BAA4B,EAAET,IAAI,CAACC,EAAE,CAAC,CAAC;EACvCS,yBAAyB,EAAEV,IAAI,CAACC,EAAE,CAAC,CAAC;EACpCU,wBAAwB,EAAEX,IAAI,CAACC,EAAE,CAAC,CAAC;EACnCW,8BAA8B,EAAEZ,IAAI,CAACC,EAAE,CAAC,CAAC;EACzCY,8BAA8B,EAAEb,IAAI,CAACC,EAAE,CAAC,CAAC;EACzCa,gBAAgB,EAAEd,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3Bc,YAAY,EAAEf,IAAI,CAACC,EAAE,CAAC,CAAC;EACvBe,cAAc,EAAEhB,IAAI,CAACC,EAAE,CAAC,CAAC;EACzBgB,sBAAsB,EAAEjB,IAAI,CAACC,EAAE,CAAC,CAAC;EACjCiB,iBAAiB,EAAElB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC5BkB,gCAAgC,EAAEnB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3CmB,gBAAgB,EAAEpB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3BoB,gBAAgB,EAAErB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3BqB,oBAAoB,EAAEtB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/BsB,uBAAuB,EAAEvB,IAAI,CAACC,EAAE,CAAC,CAAC;EAClCuB,2BAA2B,EAAExB,IAAI,CAACC,EAAE,CAAC,CAAC;EACtCwB,qCAAqC,EAAEzB,IAAI,CAACC,EAAE,CAAC,CAAC;EAChDyB,oBAAoB,EAAE1B,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/B0B,YAAY,EAAE3B,IAAI,CAACC,EAAE,CAAC,CAAC;EACvB2B,0BAA0B,EAAE5B,IAAI,CAACC,EAAE,CAAC,CAAC;EACrC4B,mBAAmB,EAAE7B,IAAI,CAACC,EAAE,CAAC,CAAC;EAC9B6B,kBAAkB,EAAE9B,IAAI,CAACC,EAAE,CAAC,CAAC;EAC7B8B,qBAAqB,EAAE/B,IAAI,CAACC,EAAE,CAAC,CAAC;EAChC+B,iBAAiB,EAAEhC,IAAI,CAACC,EAAE,CAAC,CAAC;EAC5BgC,wBAAwB,EAAEjC,IAAI,CAACC,EAAE,CAAC,CAAC;EACnCiC,gBAAgB,EAAElC,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3B;EACAkC,sBAAsB,EAAEnC,IAAI,CAACC,EAAE,CAAC,CAAC;EACjCmC,gBAAgB,EAAEpC,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3BoC,kBAAkB,EAAErC,IAAI,CAACC,EAAE,CAAC;AAC9B,CAAC;AAEDqC,0BAAa,CAACC,oBAAoB,GAAGzC,UAAU"}
@@ -1,43 +0,0 @@
1
- import { NativeModules } from 'react-native';
2
- const mockModule = {
3
- isHealthDataAvailable: jest.fn(),
4
- addListener: jest.fn(),
5
- removeListeners: jest.fn(),
6
- authorizationStatusFor: jest.fn(),
7
- requestAuthorization: jest.fn(),
8
- saveQuantitySample: jest.fn(),
9
- deleteQuantitySample: jest.fn(),
10
- deleteSamples: jest.fn(),
11
- disableAllBackgroundDelivery: jest.fn(),
12
- disableBackgroundDelivery: jest.fn(),
13
- enableBackgroundDelivery: jest.fn(),
14
- queryCategorySamplesWithAnchor: jest.fn(),
15
- queryQuantitySamplesWithAnchor: jest.fn(),
16
- getBiologicalSex: jest.fn(),
17
- getBloodType: jest.fn(),
18
- getDateOfBirth: jest.fn(),
19
- getFitzpatrickSkinType: jest.fn(),
20
- getPreferredUnits: jest.fn(),
21
- getRequestStatusForAuthorization: jest.fn(),
22
- getWheelchairUse: jest.fn(),
23
- getWorkoutRoutes: jest.fn(),
24
- queryCategorySamples: jest.fn(),
25
- queryCorrelationSamples: jest.fn(),
26
- queryHeartbeatSeriesSamples: jest.fn(),
27
- queryHeartbeatSeriesSamplesWithAnchor: jest.fn(),
28
- queryQuantitySamples: jest.fn(),
29
- querySources: jest.fn(),
30
- queryStatisticsForQuantity: jest.fn(),
31
- queryWorkoutSamples: jest.fn(),
32
- saveCategorySample: jest.fn(),
33
- saveCorrelationSample: jest.fn(),
34
- saveWorkoutSample: jest.fn(),
35
- subscribeToObserverQuery: jest.fn(),
36
- unsubscribeQuery: jest.fn(),
37
- // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)
38
- canAccessProtectedData: jest.fn(),
39
- saveWorkoutRoute: jest.fn(),
40
- getWorkoutPlanById: jest.fn()
41
- };
42
- NativeModules.ReactNativeHealthkit = mockModule;
43
- //# sourceMappingURL=jest.setup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["NativeModules","mockModule","isHealthDataAvailable","jest","fn","addListener","removeListeners","authorizationStatusFor","requestAuthorization","saveQuantitySample","deleteQuantitySample","deleteSamples","disableAllBackgroundDelivery","disableBackgroundDelivery","enableBackgroundDelivery","queryCategorySamplesWithAnchor","queryQuantitySamplesWithAnchor","getBiologicalSex","getBloodType","getDateOfBirth","getFitzpatrickSkinType","getPreferredUnits","getRequestStatusForAuthorization","getWheelchairUse","getWorkoutRoutes","queryCategorySamples","queryCorrelationSamples","queryHeartbeatSeriesSamples","queryHeartbeatSeriesSamplesWithAnchor","queryQuantitySamples","querySources","queryStatisticsForQuantity","queryWorkoutSamples","saveCategorySample","saveCorrelationSample","saveWorkoutSample","subscribeToObserverQuery","unsubscribeQuery","canAccessProtectedData","saveWorkoutRoute","getWorkoutPlanById","ReactNativeHealthkit"],"sources":["jest.setup.ts"],"sourcesContent":["import { NativeModule, NativeModules } from 'react-native'\n\nimport type Native from './native-types'\n\nconst mockModule: NativeModule & typeof Native = {\n isHealthDataAvailable: jest.fn(),\n addListener: jest.fn(),\n removeListeners: jest.fn(),\n authorizationStatusFor: jest.fn(),\n requestAuthorization: jest.fn(),\n saveQuantitySample: jest.fn(),\n deleteQuantitySample: jest.fn(),\n deleteSamples: jest.fn(),\n disableAllBackgroundDelivery: jest.fn(),\n disableBackgroundDelivery: jest.fn(),\n enableBackgroundDelivery: jest.fn(),\n queryCategorySamplesWithAnchor: jest.fn(),\n queryQuantitySamplesWithAnchor: jest.fn(),\n getBiologicalSex: jest.fn(),\n getBloodType: jest.fn(),\n getDateOfBirth: jest.fn(),\n getFitzpatrickSkinType: jest.fn(),\n getPreferredUnits: jest.fn(),\n getRequestStatusForAuthorization: jest.fn(),\n getWheelchairUse: jest.fn(),\n getWorkoutRoutes: jest.fn(),\n queryCategorySamples: jest.fn(),\n queryCorrelationSamples: jest.fn(),\n queryHeartbeatSeriesSamples: jest.fn(),\n queryHeartbeatSeriesSamplesWithAnchor: jest.fn(),\n queryQuantitySamples: jest.fn(),\n querySources: jest.fn(),\n queryStatisticsForQuantity: jest.fn(),\n queryWorkoutSamples: jest.fn(),\n saveCategorySample: jest.fn(),\n saveCorrelationSample: jest.fn(),\n saveWorkoutSample: jest.fn(),\n subscribeToObserverQuery: jest.fn(),\n unsubscribeQuery: jest.fn(),\n // Todo [>8]: Remove to align with Apple function name (isProtectedDataAvailable)\n canAccessProtectedData: jest.fn(),\n saveWorkoutRoute: jest.fn(),\n getWorkoutPlanById: jest.fn(),\n}\n\nNativeModules.ReactNativeHealthkit = mockModule\n"],"mappings":"AAAA,SAAuBA,aAAa,QAAQ,cAAc;AAI1D,MAAMC,UAAwC,GAAG;EAC/CC,qBAAqB,EAAEC,IAAI,CAACC,EAAE,CAAC,CAAC;EAChCC,WAAW,EAAEF,IAAI,CAACC,EAAE,CAAC,CAAC;EACtBE,eAAe,EAAEH,IAAI,CAACC,EAAE,CAAC,CAAC;EAC1BG,sBAAsB,EAAEJ,IAAI,CAACC,EAAE,CAAC,CAAC;EACjCI,oBAAoB,EAAEL,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/BK,kBAAkB,EAAEN,IAAI,CAACC,EAAE,CAAC,CAAC;EAC7BM,oBAAoB,EAAEP,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/BO,aAAa,EAAER,IAAI,CAACC,EAAE,CAAC,CAAC;EACxBQ,4BAA4B,EAAET,IAAI,CAACC,EAAE,CAAC,CAAC;EACvCS,yBAAyB,EAAEV,IAAI,CAACC,EAAE,CAAC,CAAC;EACpCU,wBAAwB,EAAEX,IAAI,CAACC,EAAE,CAAC,CAAC;EACnCW,8BAA8B,EAAEZ,IAAI,CAACC,EAAE,CAAC,CAAC;EACzCY,8BAA8B,EAAEb,IAAI,CAACC,EAAE,CAAC,CAAC;EACzCa,gBAAgB,EAAEd,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3Bc,YAAY,EAAEf,IAAI,CAACC,EAAE,CAAC,CAAC;EACvBe,cAAc,EAAEhB,IAAI,CAACC,EAAE,CAAC,CAAC;EACzBgB,sBAAsB,EAAEjB,IAAI,CAACC,EAAE,CAAC,CAAC;EACjCiB,iBAAiB,EAAElB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC5BkB,gCAAgC,EAAEnB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3CmB,gBAAgB,EAAEpB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3BoB,gBAAgB,EAAErB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3BqB,oBAAoB,EAAEtB,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/BsB,uBAAuB,EAAEvB,IAAI,CAACC,EAAE,CAAC,CAAC;EAClCuB,2BAA2B,EAAExB,IAAI,CAACC,EAAE,CAAC,CAAC;EACtCwB,qCAAqC,EAAEzB,IAAI,CAACC,EAAE,CAAC,CAAC;EAChDyB,oBAAoB,EAAE1B,IAAI,CAACC,EAAE,CAAC,CAAC;EAC/B0B,YAAY,EAAE3B,IAAI,CAACC,EAAE,CAAC,CAAC;EACvB2B,0BAA0B,EAAE5B,IAAI,CAACC,EAAE,CAAC,CAAC;EACrC4B,mBAAmB,EAAE7B,IAAI,CAACC,EAAE,CAAC,CAAC;EAC9B6B,kBAAkB,EAAE9B,IAAI,CAACC,EAAE,CAAC,CAAC;EAC7B8B,qBAAqB,EAAE/B,IAAI,CAACC,EAAE,CAAC,CAAC;EAChC+B,iBAAiB,EAAEhC,IAAI,CAACC,EAAE,CAAC,CAAC;EAC5BgC,wBAAwB,EAAEjC,IAAI,CAACC,EAAE,CAAC,CAAC;EACnCiC,gBAAgB,EAAElC,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3B;EACAkC,sBAAsB,EAAEnC,IAAI,CAACC,EAAE,CAAC,CAAC;EACjCmC,gBAAgB,EAAEpC,IAAI,CAACC,EAAE,CAAC,CAAC;EAC3BoC,kBAAkB,EAAErC,IAAI,CAACC,EAAE,CAAC;AAC9B,CAAC;AAEDJ,aAAa,CAACyC,oBAAoB,GAAGxC,UAAU"}