@kingstinct/react-native-healthkit 7.0.6 → 7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingstinct/react-native-healthkit",
3
- "version": "7.0.6",
3
+ "version": "7.1.0",
4
4
  "description": "React Native bindings for HealthKit",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -8,17 +8,29 @@ import type { EmitterSubscription, NativeModule } from 'react-native'
8
8
  */
9
9
  export const HKWorkoutTypeIdentifier = 'HKWorkoutTypeIdentifier' as const
10
10
 
11
+ /**
12
+ * Represents a type that identifies activity summary objects.
13
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkactivitysummarytype Apple Docs HKActivitySummaryType}
14
+ */
15
+ export const HKActivitySummaryType = 'HKActivitySummaryType' as const
16
+
11
17
  /**
12
18
  * Represents an audiogram type identifier.
19
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKAudiogramSampleType Apple Docs HKAudiogramSampleType}
13
20
  */
14
- export const HKAudiogramTypeIdentifier = 'HKAudiogramTypeIdentifier' as const
21
+ export const HKAudiogramTypeIdentifier = 'HKAudiogramSampleType' as const
15
22
 
16
23
  /**
17
24
  * Represents a workout route type identifier.
18
25
  * @see {@link https://developer.apple.com/documentation/healthkit/hkworkoutroutetypeidentifier Apple Docs HKWorkoutRouteTypeIdentifier}
19
26
  */
20
27
  export const HKWorkoutRouteTypeIdentifier = 'HKWorkoutRouteTypeIdentifier' as const
21
- export const HKDataTypeIdentifierHeartbeatSeries = 'HKDataTypeIdentifierHeartbeatSeries' as const
28
+
29
+ /**
30
+ * Represents a series sample containing heartbeat data..
31
+ * @see {@link https://developer.apple.com/documentation/healthkit/HKDataTypeIdentifierHeartbeatSeries Apple Docs HKDataTypeIdentifierHeartbeatSeries}
32
+ */
33
+ export declare const HKDataTypeIdentifierHeartbeatSeries: 'HKDataTypeIdentifierHeartbeatSeries'
22
34
 
23
35
  /**
24
36
  * Represents a quantity type identifier.
@@ -670,6 +682,41 @@ export enum HKQuantityTypeIdentifier {
670
682
  * @since iOS 16
671
683
  */
672
684
  heartRateRecoveryOneMinute = 'HKQuantityTypeIdentifierHeartRateRecoveryOneMinute',
685
+
686
+ /**
687
+ * Running Ground Contact Time
688
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierrunninggroundcontacttime Apple Docs HKQuantityTypeIdentifierRunningGroundContactTime}
689
+ * @since iOS 16
690
+ */
691
+ runningGroundContactTime = 'HKQuantityTypeIdentifierRunningGroundContactTime',
692
+
693
+ /**
694
+ * Running Stride Length
695
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierrunningstridelength Apple Docs HKQuantityTypeIdentifierRunningStrideLength}
696
+ * @since iOS 16
697
+ */
698
+ runningStrideLength = 'HKQuantityTypeIdentifierRunningStrideLength',
699
+
700
+ /**
701
+ * Running Power
702
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierrunningpower Apple Docs HKQuantityTypeIdentifierRunningPower}
703
+ * @since iOS 16
704
+ */
705
+ runningPower = 'HKQuantityTypeIdentifierRunningPower',
706
+
707
+ /**
708
+ * Running Vertical Oscillation
709
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierrunningverticaloscillation Apple Docs HKQuantityTypeIdentifierRunningVerticalOscillation}
710
+ * @since iOS 16
711
+ */
712
+ runningVerticalOscillation = 'HKQuantityTypeIdentifierRunningVerticalOscillation',
713
+
714
+ /**
715
+ * Running Speed
716
+ * @see {@link https://developer.apple.com/documentation/healthkit/hkquantitytypeidentifierrunningspeed Apple Docs HKQuantityTypeIdentifierRunningSpeed}
717
+ * @since iOS 16
718
+ */
719
+ runningSpeed = 'HKQuantityTypeIdentifierRunningSpeed',
673
720
  }
674
721
 
675
722
  export type TypeToUnitMapping = {
@@ -768,16 +815,7 @@ export enum HKCategoryTypeIdentifier {
768
815
  }
769
816
 
770
817
  export type HKSampleTypeIdentifier =
771
- | HKCategoryTypeIdentifier
772
- | HKCorrelationTypeIdentifier
773
- | HKQuantityTypeIdentifier
774
- | typeof HKAudiogramTypeIdentifier
775
- | typeof HKDataTypeIdentifierHeartbeatSeries
776
- | typeof HKWorkoutRouteTypeIdentifier
777
- | typeof HKWorkoutTypeIdentifier
778
- | `${HKCategoryTypeIdentifier}`
779
- | `${HKCorrelationTypeIdentifier}`
780
- | `${HKQuantityTypeIdentifier}`;
818
+ HKCategoryTypeIdentifier | HKCorrelationTypeIdentifier | HKQuantityTypeIdentifier | typeof HKActivitySummaryType | typeof HKAudiogramTypeIdentifier | typeof HKDataTypeIdentifierHeartbeatSeries | typeof HKWorkoutRouteTypeIdentifier | typeof HKWorkoutTypeIdentifier | `${HKCategoryTypeIdentifier}` | `${HKCorrelationTypeIdentifier}` | `${HKQuantityTypeIdentifier}`;
781
819
 
782
820
  export type HealthkitReadAuthorization =
783
821
  | HKCharacteristicTypeIdentifier
@@ -1673,6 +1711,30 @@ HKCategorySampleRaw<TCategory>,
1673
1711
  'device' | 'endDate' | 'startDate' | 'uuid'
1674
1712
  >;
1675
1713
 
1714
+ export interface HKWorkoutEvent {
1715
+ readonly type: HKWorkoutEventType,
1716
+ readonly startDate: string,
1717
+ readonly endDate: string,
1718
+ }
1719
+
1720
+ export enum HKWorkoutEventType {
1721
+ pause = 1,
1722
+ resume = 2,
1723
+ lap = 3,
1724
+ marker = 4,
1725
+ motionPaused = 5,
1726
+ motionResumed = 6,
1727
+ segment = 7,
1728
+ pauseOrResumeRequest = 8,
1729
+ }
1730
+
1731
+ export interface HKWorkoutActivity {
1732
+ readonly startDate: string,
1733
+ readonly endDate: string,
1734
+ readonly uuid: string,
1735
+ readonly duration: number,
1736
+ }
1737
+
1676
1738
  export type HKWorkoutRaw<
1677
1739
  TEnergy extends EnergyUnit,
1678
1740
  TDistance extends LengthUnit
@@ -1695,6 +1757,9 @@ export type HKWorkoutRaw<
1695
1757
  readonly endDate: string;
1696
1758
  readonly metadata?: HKWorkoutMetadata;
1697
1759
  readonly sourceRevision?: HKSourceRevision;
1760
+ readonly events?: readonly HKWorkoutEvent[];
1761
+ readonly activities?: readonly HKWorkoutActivity[];
1762
+ readonly workoutPlanId?: string;
1698
1763
  };
1699
1764
 
1700
1765
  // Straight mapping to https://developer.apple.com/documentation/healthkit/hkcharacteristictypeidentifier