@appeeky/expo-healthkit 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +92 -0
  3. package/README.md +453 -0
  4. package/android/build.gradle +22 -0
  5. package/android/src/main/AndroidManifest.xml +74 -0
  6. package/android/src/main/java/expo/modules/healthkit/ExpoHealthKitModule.kt +228 -0
  7. package/android/src/main/java/expo/modules/healthkit/HealthConnectMapping.kt +129 -0
  8. package/android/src/main/java/expo/modules/healthkit/HealthConnectNutrition.kt +152 -0
  9. package/android/src/main/java/expo/modules/healthkit/HealthConnectRationaleActivity.kt +62 -0
  10. package/android/src/main/java/expo/modules/healthkit/HealthConnectService.kt +1054 -0
  11. package/android/src/main/java/expo/modules/healthkit/HealthConnectUnits.kt +133 -0
  12. package/android/src/main/java/expo/modules/healthkit/HealthConnectWorkouts.kt +105 -0
  13. package/android/src/main/java/expo/modules/healthkit/HealthKitExceptions.kt +30 -0
  14. package/app.plugin.js +1 -0
  15. package/build/ExpoHealthKitModule.d.ts +39 -0
  16. package/build/ExpoHealthKitModule.d.ts.map +1 -0
  17. package/build/ExpoHealthKitModule.js +35 -0
  18. package/build/ExpoHealthKitModule.js.map +1 -0
  19. package/build/ExpoHealthKitModule.web.d.ts +39 -0
  20. package/build/ExpoHealthKitModule.web.d.ts.map +1 -0
  21. package/build/ExpoHealthKitModule.web.js +105 -0
  22. package/build/ExpoHealthKitModule.web.js.map +1 -0
  23. package/build/dates.d.ts +6 -0
  24. package/build/dates.d.ts.map +1 -0
  25. package/build/dates.js +13 -0
  26. package/build/dates.js.map +1 -0
  27. package/build/errors.d.ts +9 -0
  28. package/build/errors.d.ts.map +1 -0
  29. package/build/errors.js +18 -0
  30. package/build/errors.js.map +1 -0
  31. package/build/identifiers.d.ts +418 -0
  32. package/build/identifiers.d.ts.map +1 -0
  33. package/build/identifiers.js +402 -0
  34. package/build/identifiers.js.map +1 -0
  35. package/build/index.d.ts +454 -0
  36. package/build/index.d.ts.map +1 -0
  37. package/build/index.js +418 -0
  38. package/build/index.js.map +1 -0
  39. package/build/types.d.ts +542 -0
  40. package/build/types.d.ts.map +1 -0
  41. package/build/types.js +2 -0
  42. package/build/types.js.map +1 -0
  43. package/docs/banner.jpg +0 -0
  44. package/expo-module.config.json +9 -0
  45. package/ios/ExpoHealthKit.podspec +30 -0
  46. package/ios/ExpoHealthKitModule.swift +155 -0
  47. package/ios/HealthKitAdvancedQueries.swift +458 -0
  48. package/ios/HealthKitExceptions.swift +109 -0
  49. package/ios/HealthKitIdentifiers.swift +183 -0
  50. package/ios/HealthKitRecords.swift +214 -0
  51. package/ios/HealthKitService.swift +626 -0
  52. package/ios/PrivacyInfo.xcprivacy +14 -0
  53. package/package.json +105 -0
  54. package/plugin/build/index.d.ts +30 -0
  55. package/plugin/build/index.js +138 -0
  56. package/src/ExpoHealthKitModule.ts +116 -0
  57. package/src/ExpoHealthKitModule.web.ts +140 -0
  58. package/src/dates.ts +17 -0
  59. package/src/errors.ts +22 -0
  60. package/src/identifiers.ts +494 -0
  61. package/src/index.ts +563 -0
  62. package/src/types.ts +625 -0
package/src/types.ts ADDED
@@ -0,0 +1,625 @@
1
+ import type {
2
+ ClinicalType,
3
+ CorrelationType,
4
+ ElectrocardiogramClassification,
5
+ ElectrocardiogramSymptomsStatus,
6
+ ObjectType,
7
+ WorkoutActivityType,
8
+ } from './identifiers';
9
+
10
+ export type DateInput = Date | string;
11
+
12
+ export interface AuthorizationOptions {
13
+ toRead?: readonly ObjectType[];
14
+ toShare?: readonly ObjectType[];
15
+ }
16
+
17
+ export interface SampleQueryOptions {
18
+ type: ObjectType;
19
+ from?: DateInput;
20
+ to?: DateInput;
21
+ limit?: number;
22
+ ascending?: boolean;
23
+ }
24
+
25
+ export interface QuantityQueryOptions extends SampleQueryOptions {
26
+ unit: string;
27
+ }
28
+
29
+ export interface WorkoutQueryOptions {
30
+ from?: DateInput;
31
+ to?: DateInput;
32
+ limit?: number;
33
+ ascending?: boolean;
34
+ activityType?: WorkoutActivityType;
35
+ }
36
+
37
+ export interface StatisticsQueryOptions {
38
+ type: ObjectType;
39
+ unit: string;
40
+ from?: DateInput;
41
+ to?: DateInput;
42
+ /** Bitmask of `StatisticsOption` values. Combine with bitwise OR. */
43
+ options?: number;
44
+ }
45
+
46
+ export interface DateInterval {
47
+ year?: number;
48
+ month?: number;
49
+ day?: number;
50
+ hour?: number;
51
+ minute?: number;
52
+ second?: number;
53
+ }
54
+
55
+ export interface StatisticsCollectionQueryOptions extends StatisticsQueryOptions {
56
+ interval?: DateInterval;
57
+ }
58
+
59
+ export interface AnchoredQueryOptions extends SampleQueryOptions {
60
+ unit?: string;
61
+ /** Opaque token returned by a previous anchored query. */
62
+ anchor?: string | null;
63
+ }
64
+
65
+ export interface QuantitySampleInput {
66
+ type: ObjectType;
67
+ unit: string;
68
+ value: number;
69
+ startDate: DateInput;
70
+ endDate?: DateInput;
71
+ metadata?: Record<string, string>;
72
+ }
73
+
74
+ export interface CategorySampleInput {
75
+ type: ObjectType;
76
+ value: number;
77
+ startDate: DateInput;
78
+ endDate?: DateInput;
79
+ metadata?: Record<string, string>;
80
+ }
81
+
82
+ export interface WorkoutInput {
83
+ activityType: WorkoutActivityType;
84
+ startDate: DateInput;
85
+ endDate: DateInput;
86
+ energyBurned?: number;
87
+ energyBurnedUnit?: string;
88
+ distance?: number;
89
+ distanceUnit?: string;
90
+ metadata?: Record<string, string>;
91
+ }
92
+
93
+ export interface DeleteObjectsOptions {
94
+ uuid?: string;
95
+ type?: ObjectType;
96
+ from?: DateInput;
97
+ to?: DateInput;
98
+ }
99
+
100
+ export interface DateRangeQueryOptions {
101
+ from?: DateInput;
102
+ to?: DateInput;
103
+ limit?: number;
104
+ ascending?: boolean;
105
+ }
106
+
107
+ export interface ElectrocardiogramQueryOptions extends DateRangeQueryOptions {
108
+ includeVoltage?: boolean;
109
+ }
110
+
111
+ export interface ActivitySummaryQueryOptions {
112
+ from?: DateInput;
113
+ to?: DateInput;
114
+ }
115
+
116
+ export interface ClinicalRecordQueryOptions extends DateRangeQueryOptions {
117
+ type: ClinicalType | (string & {});
118
+ }
119
+
120
+ export interface WorkoutRouteQueryOptions {
121
+ workoutUUID: string;
122
+ }
123
+
124
+ export interface CorrelationQueryOptions extends DateRangeQueryOptions {
125
+ type: CorrelationType | (string & {});
126
+ }
127
+
128
+ export interface CorrelationObjectInput {
129
+ type: ObjectType;
130
+ unit: string;
131
+ value: number;
132
+ startDate?: DateInput;
133
+ endDate?: DateInput;
134
+ metadata?: Record<string, string>;
135
+ }
136
+
137
+ export interface CorrelationInput {
138
+ type: CorrelationType | (string & {});
139
+ startDate: DateInput;
140
+ endDate?: DateInput;
141
+ objects: readonly CorrelationObjectInput[];
142
+ metadata?: Record<string, string>;
143
+ }
144
+
145
+ export interface HeartbeatSeriesQueryOptions extends DateRangeQueryOptions {
146
+ /** Default `true`. `false` returns series metadata without beat timestamps. */
147
+ includeBeats?: boolean;
148
+ }
149
+
150
+ export interface Correlation {
151
+ uuid: string;
152
+ type: string;
153
+ startDate: Date;
154
+ endDate: Date;
155
+ objects: QuantitySample[];
156
+ sourceName?: string;
157
+ sourceId?: string;
158
+ metadata?: Record<string, string>;
159
+ }
160
+
161
+ export interface Heartbeat {
162
+ timeSinceSeriesStart: number;
163
+ precededByGap: boolean;
164
+ }
165
+
166
+ export interface HeartbeatSeriesSample {
167
+ uuid: string;
168
+ type: string;
169
+ startDate: Date;
170
+ endDate: Date;
171
+ count: number;
172
+ beats?: Heartbeat[];
173
+ sourceName?: string;
174
+ sourceId?: string;
175
+ metadata?: Record<string, string>;
176
+ }
177
+
178
+ export interface QuantitySample {
179
+ uuid: string;
180
+ type: string;
181
+ startDate: Date;
182
+ endDate: Date;
183
+ value: number;
184
+ unit: string;
185
+ sourceName?: string;
186
+ sourceId?: string;
187
+ metadata?: Record<string, string>;
188
+ }
189
+
190
+ export interface CategorySample {
191
+ uuid: string;
192
+ type: string;
193
+ startDate: Date;
194
+ endDate: Date;
195
+ value: number;
196
+ sourceName?: string;
197
+ sourceId?: string;
198
+ metadata?: Record<string, string>;
199
+ }
200
+
201
+ export interface WorkoutSample {
202
+ uuid: string;
203
+ type: string;
204
+ startDate: Date;
205
+ endDate: Date;
206
+ duration: number;
207
+ workoutActivityType: WorkoutActivityType;
208
+ totalEnergyBurned?: number;
209
+ totalEnergyBurnedUnit?: string;
210
+ totalDistance?: number;
211
+ totalDistanceUnit?: string;
212
+ sourceName?: string;
213
+ sourceId?: string;
214
+ metadata?: Record<string, string>;
215
+ }
216
+
217
+ export interface ElectrocardiogramVoltageMeasurement {
218
+ timeSinceSampleStart: number;
219
+ voltage: number;
220
+ unit: string;
221
+ }
222
+
223
+ export interface ElectrocardiogramSample {
224
+ uuid: string;
225
+ type: string;
226
+ startDate: Date;
227
+ endDate: Date;
228
+ classification: ElectrocardiogramClassification;
229
+ symptomsStatus: ElectrocardiogramSymptomsStatus;
230
+ averageHeartRate?: number;
231
+ samplingFrequency?: number;
232
+ numberOfVoltageMeasurements: number;
233
+ voltageMeasurements?: ElectrocardiogramVoltageMeasurement[];
234
+ sourceName?: string;
235
+ sourceId?: string;
236
+ metadata?: Record<string, string>;
237
+ }
238
+
239
+ export interface AudiogramSensitivityPoint {
240
+ frequency: number;
241
+ leftEarSensitivity?: number;
242
+ rightEarSensitivity?: number;
243
+ }
244
+
245
+ export interface AudiogramSample {
246
+ uuid: string;
247
+ type: string;
248
+ startDate: Date;
249
+ endDate: Date;
250
+ sensitivityPoints: AudiogramSensitivityPoint[];
251
+ sourceName?: string;
252
+ sourceId?: string;
253
+ metadata?: Record<string, string>;
254
+ }
255
+
256
+ export interface ActivitySummary {
257
+ date: string;
258
+ activeEnergyBurned: number;
259
+ appleExerciseTime: number;
260
+ appleStandHours: number;
261
+ activeEnergyBurnedGoal: number;
262
+ appleExerciseTimeGoal: number;
263
+ appleStandHoursGoal: number;
264
+ appleMoveTime?: number;
265
+ appleMoveTimeGoal?: number;
266
+ }
267
+
268
+ export interface ClinicalRecord {
269
+ uuid: string;
270
+ type: string;
271
+ startDate: Date;
272
+ endDate: Date;
273
+ displayName: string;
274
+ fhirResourceType?: string;
275
+ fhirJson?: string;
276
+ sourceName?: string;
277
+ sourceId?: string;
278
+ }
279
+
280
+ export interface WorkoutRouteLocation {
281
+ latitude: number;
282
+ longitude: number;
283
+ altitude?: number;
284
+ timestamp: Date;
285
+ speed?: number;
286
+ course?: number;
287
+ }
288
+
289
+ export interface WorkoutRoute {
290
+ uuid: string;
291
+ type: string;
292
+ startDate: Date;
293
+ endDate: Date;
294
+ locations: WorkoutRouteLocation[];
295
+ }
296
+
297
+ export interface DeletedSample {
298
+ uuid: string;
299
+ type?: string;
300
+ }
301
+
302
+ export interface Statistics {
303
+ startDate: Date;
304
+ endDate: Date;
305
+ unit: string;
306
+ sum?: number;
307
+ min?: number;
308
+ max?: number;
309
+ average?: number;
310
+ mostRecent?: number;
311
+ }
312
+
313
+ export interface AnchoredQueryResult {
314
+ added: QuantitySample[];
315
+ deleted: DeletedSample[];
316
+ anchor: string | null;
317
+ }
318
+
319
+ export interface HealthUpdateEvent {
320
+ type: string;
321
+ }
322
+
323
+ export type ExpoHealthKitModuleEvents = {
324
+ onUpdate: (event: HealthUpdateEvent) => void;
325
+ };
326
+
327
+ export interface NativeAuthorizationOptions {
328
+ toRead: string[];
329
+ toShare: string[];
330
+ }
331
+
332
+ export interface NativeQuantityQueryOptions {
333
+ type: string;
334
+ unit: string;
335
+ from?: string;
336
+ to?: string;
337
+ limit: number;
338
+ ascending: boolean;
339
+ }
340
+
341
+ export interface NativeCategoryQueryOptions {
342
+ type: string;
343
+ from?: string;
344
+ to?: string;
345
+ limit: number;
346
+ ascending: boolean;
347
+ }
348
+
349
+ export interface NativeWorkoutQueryOptions {
350
+ from?: string;
351
+ to?: string;
352
+ limit: number;
353
+ ascending: boolean;
354
+ activityType?: number;
355
+ }
356
+
357
+ export interface NativeStatisticsQueryOptions {
358
+ type: string;
359
+ unit: string;
360
+ from?: string;
361
+ to?: string;
362
+ options: number;
363
+ }
364
+
365
+ export interface NativeStatisticsCollectionQueryOptions extends NativeStatisticsQueryOptions {
366
+ year: number;
367
+ month: number;
368
+ day: number;
369
+ hour: number;
370
+ minute: number;
371
+ second: number;
372
+ }
373
+
374
+ export interface NativeAnchoredQueryOptions {
375
+ type: string;
376
+ unit?: string;
377
+ from?: string;
378
+ to?: string;
379
+ limit: number;
380
+ anchor?: string;
381
+ }
382
+
383
+ export interface NativeQuantitySampleInput {
384
+ type: string;
385
+ unit: string;
386
+ value: number;
387
+ startDate: string;
388
+ endDate: string;
389
+ metadata?: Record<string, string>;
390
+ }
391
+
392
+ export interface NativeCategorySampleInput {
393
+ type: string;
394
+ value: number;
395
+ startDate: string;
396
+ endDate: string;
397
+ metadata?: Record<string, string>;
398
+ }
399
+
400
+ export interface NativeWorkoutInput {
401
+ activityType: number;
402
+ startDate: string;
403
+ endDate: string;
404
+ energyBurned?: number;
405
+ energyBurnedUnit?: string;
406
+ distance?: number;
407
+ distanceUnit?: string;
408
+ metadata?: Record<string, string>;
409
+ }
410
+
411
+ export interface NativeDeleteObjectsOptions {
412
+ uuid?: string;
413
+ type?: string;
414
+ from?: string;
415
+ to?: string;
416
+ }
417
+
418
+ export interface NativeQuantitySample {
419
+ uuid: string;
420
+ type: string;
421
+ startDate: string;
422
+ endDate: string;
423
+ value: number;
424
+ unit: string;
425
+ sourceName?: string;
426
+ sourceId?: string;
427
+ metadata?: Record<string, string>;
428
+ }
429
+
430
+ export interface NativeCategorySample {
431
+ uuid: string;
432
+ type: string;
433
+ startDate: string;
434
+ endDate: string;
435
+ value: number;
436
+ sourceName?: string;
437
+ sourceId?: string;
438
+ metadata?: Record<string, string>;
439
+ }
440
+
441
+ export interface NativeWorkoutSample {
442
+ uuid: string;
443
+ type: string;
444
+ startDate: string;
445
+ endDate: string;
446
+ duration: number;
447
+ workoutActivityType: number;
448
+ totalEnergyBurned?: number;
449
+ totalEnergyBurnedUnit?: string;
450
+ totalDistance?: number;
451
+ totalDistanceUnit?: string;
452
+ sourceName?: string;
453
+ sourceId?: string;
454
+ metadata?: Record<string, string>;
455
+ }
456
+
457
+ export interface NativeDeletedSample {
458
+ uuid: string;
459
+ type?: string;
460
+ }
461
+
462
+ export interface NativeStatistics {
463
+ startDate: string;
464
+ endDate: string;
465
+ unit: string;
466
+ sum?: number;
467
+ min?: number;
468
+ max?: number;
469
+ average?: number;
470
+ mostRecent?: number;
471
+ }
472
+
473
+ export interface NativeAnchoredQueryResult {
474
+ added: NativeQuantitySample[];
475
+ deleted: NativeDeletedSample[];
476
+ anchor?: string;
477
+ }
478
+
479
+ export interface NativeDateRangeQueryOptions {
480
+ from?: string;
481
+ to?: string;
482
+ limit: number;
483
+ ascending: boolean;
484
+ }
485
+
486
+ export interface NativeElectrocardiogramQueryOptions extends NativeDateRangeQueryOptions {
487
+ includeVoltage: boolean;
488
+ }
489
+
490
+ export interface NativeActivitySummaryQueryOptions {
491
+ from?: string;
492
+ to?: string;
493
+ }
494
+
495
+ export interface NativeClinicalRecordQueryOptions extends NativeDateRangeQueryOptions {
496
+ type: string;
497
+ }
498
+
499
+ export interface NativeWorkoutRouteQueryOptions {
500
+ workoutUUID: string;
501
+ }
502
+
503
+ export interface NativeElectrocardiogramVoltageMeasurement {
504
+ timeSinceSampleStart: number;
505
+ voltage: number;
506
+ unit: string;
507
+ }
508
+
509
+ export interface NativeElectrocardiogramSample {
510
+ uuid: string;
511
+ type: string;
512
+ startDate: string;
513
+ endDate: string;
514
+ classification: number;
515
+ symptomsStatus: number;
516
+ averageHeartRate?: number;
517
+ samplingFrequency?: number;
518
+ numberOfVoltageMeasurements: number;
519
+ voltageMeasurements?: NativeElectrocardiogramVoltageMeasurement[];
520
+ sourceName?: string;
521
+ sourceId?: string;
522
+ metadata?: Record<string, string>;
523
+ }
524
+
525
+ export interface NativeAudiogramSensitivityPoint {
526
+ frequency: number;
527
+ leftEarSensitivity?: number;
528
+ rightEarSensitivity?: number;
529
+ }
530
+
531
+ export interface NativeAudiogramSample {
532
+ uuid: string;
533
+ type: string;
534
+ startDate: string;
535
+ endDate: string;
536
+ sensitivityPoints: NativeAudiogramSensitivityPoint[];
537
+ sourceName?: string;
538
+ sourceId?: string;
539
+ metadata?: Record<string, string>;
540
+ }
541
+
542
+ export interface NativeActivitySummary {
543
+ date: string;
544
+ activeEnergyBurned: number;
545
+ appleExerciseTime: number;
546
+ appleStandHours: number;
547
+ activeEnergyBurnedGoal: number;
548
+ appleExerciseTimeGoal: number;
549
+ appleStandHoursGoal: number;
550
+ appleMoveTime?: number;
551
+ appleMoveTimeGoal?: number;
552
+ }
553
+
554
+ export interface NativeClinicalRecord {
555
+ uuid: string;
556
+ type: string;
557
+ startDate: string;
558
+ endDate: string;
559
+ displayName: string;
560
+ fhirResourceType?: string;
561
+ fhirJson?: string;
562
+ sourceName?: string;
563
+ sourceId?: string;
564
+ }
565
+
566
+ export interface NativeWorkoutRouteLocation {
567
+ latitude: number;
568
+ longitude: number;
569
+ altitude?: number;
570
+ timestamp: string;
571
+ speed?: number;
572
+ course?: number;
573
+ }
574
+
575
+ export interface NativeWorkoutRoute {
576
+ uuid: string;
577
+ type: string;
578
+ startDate: string;
579
+ endDate: string;
580
+ locations: NativeWorkoutRouteLocation[];
581
+ }
582
+
583
+ export interface NativeCorrelationQueryOptions extends NativeDateRangeQueryOptions {
584
+ type: string;
585
+ }
586
+
587
+ export interface NativeCorrelationInput {
588
+ type: string;
589
+ startDate: string;
590
+ endDate: string;
591
+ objects: NativeQuantitySampleInput[];
592
+ metadata?: Record<string, string>;
593
+ }
594
+
595
+ export interface NativeHeartbeatSeriesQueryOptions extends NativeDateRangeQueryOptions {
596
+ includeBeats: boolean;
597
+ }
598
+
599
+ export interface NativeCorrelation {
600
+ uuid: string;
601
+ type: string;
602
+ startDate: string;
603
+ endDate: string;
604
+ objects: NativeQuantitySample[];
605
+ sourceName?: string;
606
+ sourceId?: string;
607
+ metadata?: Record<string, string>;
608
+ }
609
+
610
+ export interface NativeHeartbeat {
611
+ timeSinceSeriesStart: number;
612
+ precededByGap: boolean;
613
+ }
614
+
615
+ export interface NativeHeartbeatSeriesSample {
616
+ uuid: string;
617
+ type: string;
618
+ startDate: string;
619
+ endDate: string;
620
+ count: number;
621
+ beats?: NativeHeartbeat[];
622
+ sourceName?: string;
623
+ sourceId?: string;
624
+ metadata?: Record<string, string>;
625
+ }